多租户商城-商户小程序端
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.

347 lines
7.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <!-- 地址列表 -->
  2. <template>
  3. <view class="container">
  4. <global-loading />
  5. <view v-if="addresListlist.length" class="pad-bot-140 addAddress">
  6. <view class="addAddress-content flex-row-plus" v-for="(item, index) in addresListlist" :key="index">
  7. <!-- <view class="address-hesd">{{item.username1}}</view>-->
  8. <view class="address-detail" @click="itemTap(item)">
  9. <view class="userName">
  10. <text class="fs28 font-color-252744">{{item.receiveName}}</text>
  11. <text class="fs28 font-color-90919C mar-left-30">{{item.receivePhone}}</text>
  12. </view>
  13. <view class="defaultAD-box">
  14. <text class="def" v-if="item.ifDefault">{{$t('common.default')}}</text>
  15. <text class="lable font-color-999" v-else-if="item.label!=''">{{item.label}}</text>
  16. <text class="user-address font-color-999">{{item.receiveAdress}}{{item.address}}</text>
  17. </view>
  18. </view>
  19. <view class="editIcon" @click="editAdress(index, item)"></view>
  20. </view>
  21. </view>
  22. <view v-else class="emptyAddress-box">
  23. <image class="emptyAddress" src="http://36.138.125.206:8081/ceres-local-file/static/img/noAddress.png"></image>
  24. <text>{{$t('common.addressempty')}}</text>
  25. </view>
  26. <!-- #ifdef MP-WEIXIN -->
  27. <view class="wxAddressNBox">
  28. <view class="flex-items btnBox flex-sp-between">
  29. <view class="wxAddress btn flex-items flex-center" @click="wxAddFn">
  30. <image src="http://36.138.125.206:8081/ceres-local-file/static/images/weixin2x.png"></image>
  31. <text>微信导入</text>
  32. </view>
  33. <view class="addAddressBtn btn" @click="addAddressClick">{{$t('common.add')}}</view>
  34. </view>
  35. </view>
  36. <!-- #endif -->
  37. <!-- #ifdef H5 || APP-PLUS || MP-ALIPAY -->
  38. <view class="addAddress-box">
  39. <view class="addAddress" @click="addAddressClick">{{$t('common.add')}}</view>
  40. </view>
  41. <!-- #endif -->
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. hidden
  47. } from "../../utils/hidden";
  48. const NET = require('../../utils/request')
  49. const API = require('../../config/api')
  50. export default {
  51. data() {
  52. return {
  53. addresList: [],
  54. headWord: '',
  55. editAddress: [],
  56. type: 0,
  57. addresListlist: [],
  58. page: 1, //当前页
  59. pageSize: 20, //每页记录数
  60. loadingType: 0,
  61. addData: {},
  62. }
  63. },
  64. onLoad(options) {
  65. this.type = options.type
  66. },
  67. onShow(options) {
  68. this.addresListlist = []
  69. this.page = 1
  70. this.getAddressData()
  71. },
  72. onBackPress(e) {
  73. if (e.from === 'navigateBack') {
  74. return false;
  75. }
  76. this.back();
  77. return true;
  78. },
  79. onReachBottom() {
  80. if (this.loadingType == 1) {
  81. uni.stopPullDownRefresh()
  82. } else {
  83. this.page = this.page + 1
  84. this.getAddressData()
  85. }
  86. },
  87. methods: {
  88. back() {
  89. if (this.type == 1 || this.type == 2 ) {
  90. uni.navigateTo({
  91. url: '../../pages_category_page1/orderModule/orderConfirm?type=' + this.type
  92. })
  93. } else {
  94. uni.switchTab({
  95. url: '../../pages/tabbar/user/index'
  96. });
  97. }
  98. },
  99. addAddressClick() {
  100. if (this.type == 1 || this.type == 2) {
  101. uni.navigateTo({
  102. url: 'addAddress?type=1&ordertype=1'
  103. })
  104. } else {
  105. uni.navigateTo({
  106. url: 'addAddress?type=1'
  107. })
  108. }
  109. },
  110. getAddressData() {
  111. // uni.showLoading({
  112. // mask: true,
  113. // title: '加载中...',
  114. // })
  115. NET.request(API.QueryMemberAddres, {
  116. page: this.page,
  117. pageSize: this.pageSize
  118. }, "GET").then(res => {
  119. this.addresList = res.data
  120. if (res.data.list.length == 0) {
  121. this.loadingType = 1
  122. this.page = this.page
  123. }
  124. for (let i = 0; i < res.data.list.length; i++) {
  125. this.addresList.list[i].username1 = this.addresList.list[i].receiveName.slice(0, 1)
  126. }
  127. this.addresListlist = this.addresListlist.concat(res.data.list)
  128. this.addresListlist.forEach((item) => {
  129. item.receivePhone = hidden(item.receivePhone, 3, 4)
  130. })
  131. uni.hideLoading();
  132. }).catch(err => {
  133. uni.hideLoading();
  134. })
  135. },
  136. editAdress(id, item) {
  137. uni.setStorageSync("editAddress", JSON.stringify(this.addresList.list[id]))
  138. uni.navigateTo({
  139. url: 'addAddress?type=2&receiveId=' + item.receiveId
  140. })
  141. },
  142. itemTap(item) {
  143. if (this.type == 1 || this.type == 2) {
  144. uni.setStorageSync('receiveItem', item)
  145. uni.navigateTo({
  146. url: '../../pages_category_page1/orderModule/orderConfirm?receiveId=' + item
  147. .receiveId +'&type='+ this.type
  148. })
  149. }
  150. },
  151. // 微信导入
  152. wxAddFn() {
  153. let self = this
  154. uni.chooseAddress({
  155. success(res) {
  156. self.addData['username'] = res.userName
  157. self.addData['phone'] = res.telNumber
  158. self.addData['ssqText'] = `${res.provinceName}-${res.cityName}-${res.countyName}`
  159. self.addData['defaultRegion'] = self.addData.ssqText.split("-")
  160. self.addData['address'] = res.detailInfo
  161. self.addData['province'] = res.provinceName
  162. self.addData['city'] = res.cityName
  163. // uni.showLoading({
  164. // mask: true,
  165. // title: '导入中...',
  166. // })
  167. setTimeout(() => {
  168. uni.hideLoading();
  169. uni.navigateTo({
  170. url: 'addAddress?type=3&wxAddressData=' + JSON.stringify(self
  171. .addData)
  172. })
  173. }, 500);
  174. },
  175. fail:(res)=>{
  176. }
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style lang="scss">
  183. .container {
  184. padding: 0 24rpx;
  185. .addAddress {
  186. border-top: 2rpx solid #F3F4F5;
  187. padding-top: 30rpx;
  188. }
  189. .emptyAddress-box {
  190. display: flex;
  191. justify-content: center;
  192. flex-direction: column;
  193. align-items: center;
  194. margin-top: 50%;
  195. .emptyAddress {
  196. width: 186upx;
  197. height: 150upx;
  198. }
  199. text {
  200. margin-top: 40upx;
  201. color: #999999;
  202. }
  203. }
  204. .addAddress-box {
  205. position: fixed;
  206. bottom: 50upx;
  207. left: 30upx;
  208. .addAddress {
  209. width: 690upx;
  210. height: 100upx;
  211. color: #FFFFFF;
  212. text-align: center;
  213. background: #252744;
  214. border-radius: 50rpx;
  215. }
  216. }
  217. .wxAddressNBox {
  218. position: fixed;
  219. bottom: 50upx;
  220. width: 100%;
  221. left: 0;
  222. .btnBox {
  223. width: 100%;
  224. background: #FFFFFF;
  225. height: 120rpx;
  226. padding: 0 50rpx;
  227. .btn {
  228. width: 300rpx;
  229. background: #FFFFFF;
  230. height: 90rpx;
  231. line-height: 90rpx;
  232. border: 2rpx solid #E4E5E6;
  233. text-align: center;
  234. }
  235. .addAddressBtn {
  236. color: #FFEBC4;
  237. background: #333333;
  238. border: 2rpx solid #333333;
  239. }
  240. .wxAddress {
  241. image {
  242. width: 75rpx;
  243. height: 75rpx;
  244. margin-right: 20rpx;
  245. }
  246. }
  247. }
  248. }
  249. .addAddress-content {
  250. display: flex;
  251. align-items: center;
  252. justify-content: space-between;
  253. padding-bottom: 40rpx;
  254. margin-bottom: 40rpx;
  255. border-bottom: 1rpx solid #D3D4DE;
  256. .address-detail {
  257. flex-grow: 1;
  258. .userName {
  259. margin-bottom: 15rpx;
  260. }
  261. }
  262. .lable {
  263. padding: 3rpx 10rpx;
  264. background-color: #F2F2F6;
  265. border-radius: 6rpx;
  266. font-size: 24rpx;
  267. font-weight: 400;
  268. //color: rgba(102, 102, 102, 1);
  269. color: #595B6B;
  270. text-align: center;
  271. }
  272. .def {
  273. padding: 3rpx 10rpx;
  274. font-size: 24rpx;
  275. font-weight: 400;
  276. color: #F54639 !important;
  277. background-color: #FCE4E2 !important;
  278. border-radius: 6rpx;
  279. }
  280. .user-address {
  281. font-size: 28rpx;
  282. margin-left: 10rpx;
  283. color: #90919C;
  284. }
  285. .address-hesd {
  286. height: 70upx;
  287. width: 70upx;
  288. background-color: #BBBBBB;
  289. color: #FFFFFF;
  290. border-radius: 50%;
  291. line-height: 70upx;
  292. text-align: center;
  293. }
  294. .defaultAD-box {
  295. width: 100%;
  296. .default-textBox {
  297. padding-right: 20upx;
  298. width: 80upx;
  299. }
  300. .default-content {
  301. width: 435upx;
  302. }
  303. .default-text {
  304. color: #C5AA7B;
  305. background-color: #FFE4CC;
  306. height: 36upx;
  307. width: 60upx;
  308. font-size: 26upx;
  309. border-radius: 4upx;
  310. align-items: center;
  311. line-height: 36upx;
  312. }
  313. }
  314. .editIcon {
  315. width: 40rpx;
  316. height: 41rpx;
  317. display: block;
  318. background: url("http://36.138.125.206:8081/ceres-local-file/image/address_edit.png") no-repeat center center;
  319. background-size: contain;
  320. }
  321. }
  322. }
  323. </style>