address.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view style="padding-bottom: 150upx;">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <view style="height: max-content;background-color: #FFFFFF;margin-top: 10upx;padding: 30upx 30upx 10upx 40upx;"
  5. v-for="(item,index) in list" :key='index'>
  6. <view style="display: flex;" @tap='goBackByAddress(item)'>
  7. <view style="font-size: 28rpx;color: #333333;">{{item.userName}}</view>
  8. <view style="font-size: 28rpx;color: #333333;margin-left: 20upx;text-align: right;">{{item.userPhone}}
  9. </view>
  10. </view>
  11. <view style="display: flex;margin-top: 28rpx;">
  12. <view style="font-size: 28rpx;color: #333333;width: 90%;">
  13. {{item.address}}{{item.addressDetail}}
  14. </view>
  15. </view>
  16. <view style="margin-top: 15upx;height: 1upx;background-color: #E3E4E5;margin-bottom: 10upx;"></view>
  17. <view style="display: flex;padding: 10rpx 2rpx 10rpx 0rpx;font-size: 28rpx;">
  18. <radio-group name="openWay" style="text-align: left;width: 70%;">
  19. <label class="tui-radio" v-if="item.addressDefault == '1'">
  20. <radio :checked="item.addressDefault == 1 ? true : false" color="#FF7F00" disabled='true'
  21. style="transform:scale(0.8);" />
  22. <text style="font-size: 28rpx;margin-left: 10upx;">默认地址</text>
  23. </label>
  24. </radio-group>
  25. <view style="display: flex;margin-left: 80upx;margin-top: 5upx;width: 40%;text-align: right;">
  26. <view style="font-size: 28rpx;color: #999999;width: 50%;" @tap='deleteAddressList(item)'>
  27. 删除</view>
  28. <view style="font-size: 28rpx;color: #999999;width: 50%;" @tap='goAddress(item.addressId)'>编辑</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view style="position: fixed;bottom: 0rpx;left: 0;right: 0;background: #FFFFFF;height:150rpx;">
  33. <button style="background: #FF7F00;color: #FFFFFF;margin: 28rpx;position: fixed;bottom: 0upx;width: 90%;"
  34. @tap="goAddress('')">
  35. +新建地址
  36. </button>
  37. </view>
  38. <!-- #endif -->
  39. <!-- #ifndef MP-WEIXIN -->
  40. <view style="height: max-content;background-color: #FFFFFF;margin-top: 10upx;padding: 30upx 30upx 10upx 40upx;"
  41. v-for="(item,index) in list" :key='index'>
  42. <view style="display: flex;" @tap='goBackByAddress(item)'>
  43. <view style="font-size: 30upx;color: #333333;">{{item.userName}}</view>
  44. <view style="font-size: 30upx;color: #333333;margin-left: 20upx;text-align: right;">{{item.userPhone}}
  45. </view>
  46. </view>
  47. <view style="display: flex;margin-top: 30upx;height: 70upx;">
  48. <view style="font-size: 30upx;color: #333333;width: 90%;">
  49. {{item.address}}{{item.addressDetail}}
  50. </view>
  51. </view>
  52. <view style="margin-top: 30rpx;height: 1upx;background-color: #E3E4E5;margin-bottom: 10upx;"></view>
  53. <view style="display: flex;padding: 15upx 5upx 15upx 0upx;font-size: 30upx;">
  54. <radio-group name="openWay" style="text-align: left;width: 70%;">
  55. <label class="tui-radio" v-if="item.addressDefault == '1'">
  56. <radio :checked="item.addressDefault == 1 ? true : false" color="#FF7F00" disabled='true'
  57. style="transform:scale(0.8);" />
  58. <text style="font-size: 30upx;margin-left: 10upx;">默认地址</text>
  59. </label>
  60. </radio-group>
  61. <view style="display: flex;margin-left: 80upx;margin-top: 5upx;width: 40%;text-align: right;">
  62. <view style="font-size: 30upx;color: #999999;width: 50%;" @tap='deleteAddressList(item)'>
  63. 删除</view>
  64. <view style="font-size: 30upx;color: #999999;width: 50%;" @tap='goAddress(item.addressId)'>编辑</view>
  65. </view>
  66. </view>
  67. </view>
  68. <view style="position: fixed;bottom: 0rpx;left: 0;right: 0;background: #FFFFFF;height:150rpx;">
  69. <button style="background: #FF7F00;color: #FFFFFF;margin: 30upx;position: fixed;bottom: 0upx;width: 90%;"
  70. @tap="goAddress('')">
  71. +新建地址
  72. </button>
  73. </view>
  74. <!-- #endif -->
  75. <!-- 悬浮上拉 -->
  76. <view class="scroll_top" @tap="topScrollTap" v-bind:class="[scrollTop ? 'active' : '', '']"
  77. style="bottom: 56px;"><text class="iconfont icon-shangla"></text></view>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. openWay: 0,
  85. list: [],
  86. loadingType: 0,
  87. type: 1,
  88. scrollTop: false
  89. }
  90. },
  91. onShow() {
  92. let userId = this.$queue.getData('userId');
  93. if (userId) {
  94. this.getAddressList('');
  95. }
  96. },
  97. onLoad() {
  98. let userId = this.$queue.getData('userId');
  99. if (userId) {
  100. this.getAddressList('');
  101. }
  102. },
  103. methods: {
  104. goBackByAddress(item) {
  105. this.$queue.setData('EditAddress', item);
  106. uni.navigateBack();
  107. },
  108. deleteAddressList(e) {
  109. console.log(e)
  110. let data = {
  111. userName: e.userName,
  112. userPhone: e.userPhone,
  113. address: e.address,
  114. addressDetail: e.addressDetail,
  115. addressLatitude: e.addressLatitude,
  116. addressLongitude: e.addressLongitude,
  117. userId: e.userId,
  118. addressId: e.addressId,
  119. addressDefault: e.addressDefault
  120. }
  121. uni.showModal({
  122. title: '温馨提示',
  123. content: '您确定要删除此地址信息吗?',
  124. showCancel: true,
  125. cancelText: '取消',
  126. confirmText: '确认',
  127. success: res => {
  128. if (res.confirm) {
  129. this.$Request.getT('/app/indent/delUserAddress', data).then(res => {
  130. console.log(res)
  131. if (res.code == 0) {
  132. this.$queue.showToast("删除成功!");
  133. this.getAddressList();
  134. } else {
  135. this.$queue.showToast(res.msg);
  136. }
  137. });
  138. }
  139. }
  140. });
  141. },
  142. getAddressList(type) {
  143. this.loadingType = 1;
  144. uni.showLoading({
  145. title: '加载中...'
  146. });
  147. let userId = this.$queue.getData('userId');
  148. this.$Request.getT('/app/indent/findUserAddress').then(res => {
  149. console.log(res)
  150. if (res.code == 0) {
  151. this.list = []
  152. res.data.forEach(d => {
  153. this.list.push(d);
  154. });
  155. this.loadingType = 0;
  156. } else {
  157. this.loadingType = 2;
  158. }
  159. uni.hideLoading();
  160. if (type === 'Refresh') {
  161. uni.stopPullDownRefresh(); // 停止刷新
  162. }
  163. });
  164. },
  165. goAddress(id) {
  166. uni.navigateTo({
  167. // url: './EditAddress?id=' + id
  168. url: '/pageA/address/Endaddress?id=' + id
  169. });
  170. },
  171. tabSlect(item) {
  172. this.tabIndex = item.id;
  173. },
  174. selectWay(id) {
  175. this.openWay = id;
  176. },
  177. topScrollTap: function() {
  178. uni.pageScrollTo({
  179. scrollTop: 0,
  180. duration: 300
  181. });
  182. }
  183. }
  184. }
  185. </script>
  186. <style lang="less">
  187. // @import '../../../static/less/index.less';
  188. // @import '../../../static/css/index.css';
  189. page {
  190. background: #F2F2F2;
  191. }
  192. .tui-line-cell {
  193. width: 100%;
  194. box-sizing: border-box;
  195. display: flex;
  196. align-items: center;
  197. justify-content: space-between;
  198. border-bottom: 2upx solid #f2f2f2;
  199. padding: 0 0 16upx 0;
  200. }
  201. .tui-title {
  202. line-height: 32rpx;
  203. min-width: 120rpx;
  204. flex-shrink: 0;
  205. }
  206. .tui-input {
  207. font-size: 32rpx;
  208. color: #333;
  209. padding-left: 20rpx;
  210. flex: 1;
  211. }
  212. </style>