浏览代码

获取微信地址(未完)

hwb0 3 年之前
父节点
当前提交
620dd87ac8
共有 1 个文件被更改,包括 45 次插入5 次删除
  1. 45 5
      pages/order/settlement.vue

+ 45 - 5
pages/order/settlement.vue

@@ -10,11 +10,20 @@
 						<u-icon name="arrow-right" size="18" color="#237ED4 100%"></u-icon>
 					</view>
 				</view>
+				<view class="flex settlement-address-top" v-else>
+					<view class="settlement-address-top__left">配送地址</view>
+					<view class="flex settlement-address-top__right" @click="toWeixinAddress">
+						<view class="">微信地址</view>
+						<u-icon name="arrow-right" size="18" color="#237ED4 100%"></u-icon>
+					</view>
+				</view>
 				<view class="settlement-address-desc" v-if="info.addr !== null">
-					<view class="settlement-address-desc__item">{{ `${ addr.province || '-' }-${ addr.city || '-' }-${ addr.area || '-' }` }}
+					<view class="settlement-address-desc__item">
+						{{ `${ addr.province || '-' }-${ addr.city || '-' }-${ addr.area || '-' }` }}
 						{{ addr.addr || '-' }}
 					</view>
-					<view class="settlement-address-desc__item">{{ addr.receiver || '-' }} {{ addr.mobile || '-' }}</view>
+					<view class="settlement-address-desc__item">{{ addr.receiver || '-' }} {{ addr.mobile || '-' }}
+					</view>
 				</view>
 				<view class="settlement-address-form" v-else>
 					<view class="address-add">
@@ -112,6 +121,8 @@
 				},
 				areaShow: false,
 				toAddressShow: false,
+				
+				wxAddress: {}
 			}
 		},
 		onLoad(opthios) {
@@ -127,7 +138,7 @@
 		},
 		methods: {
 			save() {
-				if(this.info.addr == null){
+				if (this.info.addr == null) {
 					uni.$u.toast('请先保存配送地址');
 					return
 				}
@@ -245,6 +256,7 @@
 			cancel() {
 				this.areaShow = false
 			},
+
 			toAddress() {
 				this.toAddressShow = true
 				uni.navigateTo({
@@ -252,6 +264,34 @@
 				})
 			},
 
+			toWeixinAddress() {
+				let _this = this
+				uni.chooseAddress({
+					success(res) {
+						console.log(res);
+						_this.wxAddress = res
+						_this.getArea()
+					}
+				})
+			},
+			
+			async getArea() {
+				let provinceRes = await $http.post('/api/v1/mp/area/listByPid', {
+					pid: 0
+				})
+				console.log(provinceRes);
+				let provinceItem = provinceRes && provinceRes.data.find((item=> item.areaName == this.wxAddress.provinceName))
+				console.log(provinceItem);
+				return
+				let cityRes = await $http.post('/api/v1/mp/area/listByPid', {
+					pid: provinceRes && provinceRes.data && provinceRes.data[1].areaId
+				})
+				let areaRes = await $http.post('/api/v1/mp/area/listByPid', {
+					pid: cityRes && cityRes.data && cityRes.data[0].areaId
+				})
+				
+			},
+
 			saveAddress() {
 				let _this = this
 				if (!_this.form.receiver) {
@@ -368,8 +408,8 @@
 					justify-content: space-between;
 					align-items: flex-start;
 					font-size: 30rpx;
-					
-					.title{
+
+					.title {
 						font-weight: bold;
 					}