球星卡微信小程序
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.

223 lines
5.2 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 class="section_3"> </view>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. id: null,
  46. address: {
  47. name: '',
  48. phone: '',
  49. region: [],
  50. address: ''
  51. }
  52. };
  53. },
  54. computed: {
  55. regionNotEmpty(){
  56. return this.address.region.length > 0;
  57. }
  58. },
  59. onLoad(options){
  60. this.id = options.id || null;
  61. this.id && this.getAddressDetail();
  62. },
  63. onReady(){
  64. let title = '新增收货地址';
  65. if(this.id){
  66. title = '编辑收货地址';
  67. }
  68. uni.setNavigationBarTitle({
  69. title: title
  70. })
  71. },
  72. methods: {
  73. // 编辑进入,根据地址id查询后做修改
  74. getAddressDetail(){
  75. this.address = {
  76. name: '邓平艺',
  77. phone: '1878455554',
  78. region: ['北京市','北京市','东城区'],
  79. address: '北京北京市海淀区钻石大厦C座'
  80. }
  81. },
  82. pickerChnage(event){
  83. console.log(event);
  84. this.address.region = event.detail.value;
  85. },
  86. save(){
  87. console.log(this.address)
  88. if(this.id){
  89. this.$msg('编辑')
  90. }else{
  91. this.$msg('新增')
  92. }
  93. }
  94. }
  95. };
  96. </script>
  97. <style scoped lang="css">
  98. .top-group {
  99. padding: 40rpx 0 38rpx;
  100. border-bottom: solid 2rpx rgb(239, 239, 239);
  101. }
  102. .page {
  103. background-color: #f6f6f6;
  104. width: 100%;
  105. overflow-y: auto;
  106. height: 100%;
  107. }
  108. .group_4 {
  109. padding-top: 2rpx;
  110. flex: 1 1 auto;
  111. overflow-y: auto;
  112. }
  113. .section_2 {
  114. padding: 0 32rpx;
  115. background-color: rgb(255, 255, 255);
  116. }
  117. .group_8 {
  118. margin-top: 64rpx;
  119. padding: 16rpx 32rpx;
  120. color: rgb(231, 162, 63);
  121. font-size: 32rpx;
  122. font-weight: 600;
  123. line-height: 44rpx;
  124. white-space: nowrap;
  125. }
  126. .group_5 {
  127. padding-top: 2rpx;
  128. }
  129. .button {
  130. padding: 24rpx 0;
  131. border-radius: 10rpx;
  132. border: solid 2rpx rgb(231, 162, 63);
  133. }
  134. .section_3 {
  135. margin-top: 706rpx;
  136. align-self: center;
  137. background-color: rgb(0, 0, 0);
  138. border-radius: 4rpx;
  139. width: 196rpx;
  140. height: 8rpx;
  141. }
  142. .text_2 {
  143. color: rgb(51, 51, 51);
  144. font-size: 32rpx;
  145. font-weight: 500;
  146. line-height: 44rpx;
  147. white-space: nowrap;
  148. width: 140rpx;
  149. }
  150. .text_3 {
  151. margin-left: 72rpx;
  152. color: rgb(195, 195, 195);
  153. font-size: 32rpx;
  154. line-height: 44rpx;
  155. white-space: nowrap;
  156. }
  157. .text_4 {
  158. color: rgb(51, 51, 51);
  159. font-size: 32rpx;
  160. font-weight: 500;
  161. line-height: 44rpx;
  162. white-space: nowrap;
  163. width: 140rpx;
  164. }
  165. .text_5 {
  166. margin-left: 40rpx;
  167. color: rgb(195, 195, 195);
  168. font-size: 32rpx;
  169. line-height: 44rpx;
  170. white-space: nowrap;
  171. }
  172. .group_7 {
  173. margin-right: 6rpx;
  174. padding: 40rpx 0;
  175. }
  176. .image_6 {
  177. width: 44rpx;
  178. height: 44rpx;
  179. }
  180. .text_8 {
  181. color: rgb(51, 51, 51);
  182. font-size: 32rpx;
  183. font-weight: 500;
  184. line-height: 44rpx;
  185. white-space: nowrap;
  186. width: 140rpx;
  187. }
  188. .text_9 {
  189. margin-left: 40rpx;
  190. flex: 1 1 auto;
  191. color: rgb(195, 195, 195);
  192. font-size: 32rpx;
  193. line-height: 44rpx;
  194. text-align: left;
  195. }
  196. .text_6 {
  197. color: rgb(51, 51, 51);
  198. font-size: 32rpx;
  199. font-weight: 500;
  200. line-height: 44rpx;
  201. white-space: nowrap;
  202. width: 140rpx;
  203. }
  204. .text_7 {
  205. margin-left: 18rpx;
  206. color: rgb(195, 195, 195);
  207. font-size: 28rpx;
  208. line-height: 44rpx;
  209. white-space: nowrap;
  210. max-width: 440rpx;
  211. overflow:hidden;
  212. text-overflow:ellipsis;
  213. }
  214. .flex-row{
  215. display: flex;
  216. align-items: center;
  217. }
  218. .black-color{
  219. color: #303133 !important;
  220. }
  221. </style>