edit-address.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view>
  3. <!--标题栏-->
  4. <bar-title bgColor="bg-white" isBack>
  5. <block slot="content">编辑地址</block>
  6. <block slot="right">
  7. <text class="text-orange">保存</text>
  8. </block>
  9. </bar-title>
  10. <!--表单-->
  11. <view class="cu-form-group margin-top">
  12. <view class="title">收货人名</view>
  13. <input placeholder="您的姓名" @input="nameInput"/>
  14. <text class='cuIcon-roundclosefill text-grey' v-if="nameClose"/>
  15. </view>
  16. <view class="cu-form-group">
  17. <view class="title">手机号码</view>
  18. <input placeholder="卖家和快递员联系您的方式" @input="phoneInput"/>
  19. <text class='cuIcon-roundclosefill text-grey' v-if="phoneClose"/>
  20. </view>
  21. <view class="cu-form-group">
  22. <view class="title">邮政编码</view>
  23. <input placeholder="可以不用那么精确" @input="zipCodeInput"/>
  24. <text class='cuIcon-roundclosefill text-grey' v-if="zipCodeClose"/>
  25. </view>
  26. <view class="cu-form-group">
  27. <view class="title">所在地区</view>
  28. <picker mode="multiSelector" @change="MultiChange" @columnchange="MultiColumnChange" :value="multiIndex" :range="multiArray">
  29. <view class="picker">
  30. {{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}},{{multiArray[2][multiIndex[2]]}}
  31. </view>
  32. </picker>
  33. </view>
  34. <view class="cu-form-group">
  35. <view class="title">详细地址</view>
  36. <input placeholder="请输入详细的地址信息" @input="addressInput"/>
  37. <text class='cuIcon-roundclosefill text-grey' v-if="addressClose"/>
  38. </view>
  39. <view class="cu-list menu margin-top">
  40. <view class="cu-item">
  41. <view class="content">
  42. <text class="text-red">删除地址</text>
  43. </view>
  44. </view>
  45. </view>
  46. <!--小程序端显示-->
  47. <!-- #ifdef MP -->
  48. <view class="bg-white wecanui-footer-fixed foot-pb">
  49. <view class="flex flex-direction">
  50. <button class="cu-btn bg-red">提交保存</button>
  51. </view>
  52. </view>
  53. <!-- #endif -->
  54. </view>
  55. </template>
  56. <script>
  57. import barTitle from '@/components/zaiui-common/basics/bar-title';
  58. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  59. export default {
  60. components: {
  61. barTitle
  62. },
  63. data() {
  64. return {
  65. multiIndex: [0, 0, 0], nameClose: false, phoneClose: false, zipCodeClose: false, addressClose: false,
  66. multiArray: [['重庆市', '四川省'],['渝中区', '渝北区', '江北区', '南岸区'],['周边', '周边地区']],
  67. }
  68. },
  69. onLoad() {
  70. },
  71. onReady() {
  72. _tool.setBarColor(true);
  73. uni.pageScrollTo({
  74. scrollTop: 0,
  75. duration: 0
  76. });
  77. },
  78. methods: {
  79. nameInput(event) {
  80. let value = event.detail.value;
  81. if(value != "") {
  82. this.nameClose = true;
  83. } else {
  84. this.nameClose = false;
  85. }
  86. },
  87. phoneInput(event) {
  88. let value = event.detail.value;
  89. if(value != "") {
  90. this.phoneClose = true;
  91. } else {
  92. this.phoneClose = false;
  93. }
  94. },
  95. zipCodeInput(event) {
  96. let value = event.detail.value;
  97. if(value != "") {
  98. this.zipCodeClose = true;
  99. } else {
  100. this.zipCodeClose = false;
  101. }
  102. },
  103. addressInput(event) {
  104. let value = event.detail.value;
  105. if(value != "") {
  106. this.addressClose = true;
  107. } else {
  108. this.addressClose = false;
  109. }
  110. },
  111. MultiChange(e) {
  112. this.multiIndex = e.detail.value
  113. },
  114. //联动地址,请自行开发,或在插件市场寻找插件替代,此处不做具体功能开发。
  115. MultiColumnChange(e) {
  116. let data = {
  117. multiArray: this.multiArray,
  118. multiIndex: this.multiIndex
  119. };
  120. data.multiIndex[e.detail.column] = e.detail.value;
  121. switch (e.detail.column) {
  122. case 0:
  123. switch (data.multiIndex[0]) {
  124. case 0:
  125. data.multiArray[1] = ['渝中区', '渝北区', '江北区', '南岸区'];
  126. data.multiArray[2] = ['周边', '周边地区'];
  127. break;
  128. case 1:
  129. data.multiArray[1] = ['渝中区', '渝北区', '江北区', '南岸区'];
  130. data.multiArray[2] = ['周边', '周边地区'];
  131. break;
  132. }
  133. data.multiIndex[1] = 0;
  134. data.multiIndex[2] = 0;
  135. break;
  136. case 1:
  137. switch (data.multiIndex[0]) {
  138. case 0:
  139. switch (data.multiIndex[1]) {
  140. case 0:
  141. data.multiArray[2] = ['周边', '周边地区'];
  142. break;
  143. case 1:
  144. data.multiArray[2] = ['周边', '周边地区'];
  145. break;
  146. case 2:
  147. data.multiArray[2] = ['周边', '周边地区'];
  148. break;
  149. case 3:
  150. data.multiArray[2] = ['周边', '周边地区'];
  151. break;
  152. case 4:
  153. data.multiArray[2] = ['周边', '周边地区'];
  154. break;
  155. }
  156. break;
  157. case 1:
  158. switch (data.multiIndex[1]) {
  159. case 0:
  160. data.multiArray[2] = ['周边', '周边地区'];
  161. break;
  162. case 1:
  163. data.multiArray[2] = ['周边', '周边地区'];
  164. break;
  165. case 2:
  166. data.multiArray[2] = ['周边', '周边地区'];
  167. break;
  168. }
  169. break;
  170. }
  171. data.multiIndex[2] = 0;
  172. break;
  173. }
  174. this.multiArray = data.multiArray;
  175. this.multiIndex = data.multiIndex;
  176. },
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. /* #ifdef APP-PLUS */
  182. @import "../../static/colorui/main.css";
  183. @import "../../static/colorui/icon.css";
  184. @import "../../static/zaiui/style/app.scss";
  185. /* #endif */
  186. .wecanui-footer-fixed .flex-direction {
  187. padding: 18.18upx;
  188. }
  189. </style>