球星卡微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
5.0 KiB

  1. <template>
  2. <view class="flex-col page">
  3. <view class="flex-col group_4">
  4. <view class="flex-col section_2">
  5. <view class="top-group flex-row">
  6. <text class="text_2 lf-m-r-18">收货人</text>
  7. <u-input class="input" v-model="address.name" placeholder="请填写收货人姓名" border="surround" :clearable="true" ></u-input>
  8. </view>
  9. <view class="top-group flex-row">
  10. <text class="text_4 lf-m-r-18">手机号码</text>
  11. <u-input class="input" v-model="address.phone" placeholder="请填写收货人手机号码" border="surround" maxlength="11" :clearable="true" ></u-input>
  12. </view>
  13. <view class="flex-col group_5">
  14. <picker mode="region" :value="address.region" @change="pickerChnage">
  15. <view class="top-group justify-between">
  16. <view class="flex-row">
  17. <text class="text_6 lf-m-r-18">所在地区</text>
  18. <text class="text_7" :class="{'black-color': regionNotEmpty}">{{ address.region.length > 0 ? address.region.join(',') : '请选择所在地区' }}</text>
  19. </view>
  20. <image
  21. src="https://project-user-resource-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497893779891395.png"
  22. class="image_6"
  23. />
  24. </view>
  25. </picker>
  26. <view class="flex-row group_7" style="align-items: flex-start;">
  27. <text class="text_8 lf-m-r-18 lf-m-t-12">详细地址</text>
  28. <u-textarea v-model="address.address" placeholder="请填写详细地址:如道路、门牌号、楼栋号、单元室等" ></u-textarea>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="flex-col group_8">
  33. <view class="flex-col items-center button" @click="save">
  34. <text>保存</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. id: null,
  45. address: {
  46. name: '',
  47. phone: '',
  48. region: [],
  49. address: ''
  50. }
  51. };
  52. },
  53. computed: {
  54. regionNotEmpty(){
  55. return this.address.region.length > 0;
  56. }
  57. },
  58. onLoad(options){
  59. this.id = options.id || null;
  60. this.id && this.getAddressDetail();
  61. },
  62. onReady(){
  63. let title = '新增收货地址';
  64. if(this.id){
  65. title = '编辑收货地址';
  66. }
  67. uni.setNavigationBarTitle({
  68. title: title
  69. })
  70. },
  71. methods: {
  72. // 编辑进入,根据地址id查询后做修改
  73. getAddressDetail(){
  74. this.address = {
  75. name: '邓平艺',
  76. phone: '1878455554',
  77. region: ['北京市','北京市','东城区'],
  78. address: '北京北京市海淀区钻石大厦C座'
  79. }
  80. },
  81. pickerChnage(event){
  82. console.log(event);
  83. this.address.region = event.detail.value;
  84. },
  85. save(){
  86. console.log(this.address)
  87. if(this.id){
  88. this.$msg('编辑')
  89. }else{
  90. this.$msg('新增')
  91. }
  92. }
  93. }
  94. };
  95. </script>
  96. <style scoped lang="css">
  97. .top-group {
  98. padding: 40rpx 0 38rpx;
  99. border-bottom: solid 2rpx rgb(239, 239, 239);
  100. }
  101. .page {
  102. background-color: #f6f6f6;
  103. width: 100%;
  104. overflow-y: auto;
  105. height: 100%;
  106. }
  107. .group_4 {
  108. padding-top: 2rpx;
  109. flex: 1 1 auto;
  110. overflow-y: auto;
  111. }
  112. .section_2 {
  113. padding: 0 32rpx;
  114. background-color: rgb(255, 255, 255);
  115. }
  116. .group_8 {
  117. margin-top: 64rpx;
  118. padding: 16rpx 32rpx;
  119. color: rgb(231, 162, 63);
  120. font-size: 32rpx;
  121. font-weight: 600;
  122. line-height: 44rpx;
  123. white-space: nowrap;
  124. }
  125. .group_5 {
  126. padding-top: 2rpx;
  127. }
  128. .button {
  129. padding: 24rpx 0;
  130. border-radius: 10rpx;
  131. border: solid 2rpx rgb(231, 162, 63);
  132. }
  133. .text_2 {
  134. color: rgb(51, 51, 51);
  135. font-size: 32rpx;
  136. font-weight: 500;
  137. line-height: 44rpx;
  138. white-space: nowrap;
  139. width: 140rpx;
  140. }
  141. .text_3 {
  142. margin-left: 72rpx;
  143. color: rgb(195, 195, 195);
  144. font-size: 32rpx;
  145. line-height: 44rpx;
  146. white-space: nowrap;
  147. }
  148. .text_4 {
  149. color: rgb(51, 51, 51);
  150. font-size: 32rpx;
  151. font-weight: 500;
  152. line-height: 44rpx;
  153. white-space: nowrap;
  154. width: 140rpx;
  155. }
  156. .text_5 {
  157. margin-left: 40rpx;
  158. color: rgb(195, 195, 195);
  159. font-size: 32rpx;
  160. line-height: 44rpx;
  161. white-space: nowrap;
  162. }
  163. .group_7 {
  164. margin-right: 6rpx;
  165. padding: 40rpx 0;
  166. }
  167. .image_6 {
  168. width: 44rpx;
  169. height: 44rpx;
  170. }
  171. .text_8 {
  172. color: rgb(51, 51, 51);
  173. font-size: 32rpx;
  174. font-weight: 500;
  175. line-height: 44rpx;
  176. white-space: nowrap;
  177. width: 140rpx;
  178. }
  179. .text_9 {
  180. margin-left: 40rpx;
  181. flex: 1 1 auto;
  182. color: rgb(195, 195, 195);
  183. font-size: 32rpx;
  184. line-height: 44rpx;
  185. text-align: left;
  186. }
  187. .text_6 {
  188. color: rgb(51, 51, 51);
  189. font-size: 32rpx;
  190. font-weight: 500;
  191. line-height: 44rpx;
  192. white-space: nowrap;
  193. width: 140rpx;
  194. }
  195. .text_7 {
  196. margin-left: 18rpx;
  197. color: rgb(195, 195, 195);
  198. font-size: 28rpx;
  199. line-height: 44rpx;
  200. white-space: nowrap;
  201. max-width: 440rpx;
  202. overflow:hidden;
  203. text-overflow:ellipsis;
  204. }
  205. .flex-row{
  206. display: flex;
  207. align-items: center;
  208. }
  209. .black-color{
  210. color: #303133 !important;
  211. }
  212. </style>