yijianjun hai 5 días
pai
achega
a7b1c9b2b6
Modificáronse 1 ficheiros con 12 adicións e 3 borrados
  1. 12 3
      mer_uniapp/pages/merchant/home/index.vue

+ 12 - 3
mer_uniapp/pages/merchant/home/index.vue

@@ -412,8 +412,6 @@
 				this.currentCateId = this.goods[0].id
 				// this.menuScrollIntoView = `cate-${9999}`
 			})
-			// 获取用户默认地址
-			this.getAddressList()
 			// this.getIndexConfig();
 			// #ifdef MP-WEIXIN
 			// 获取微信胶囊的位置信息 width,height,top,right,left,bottom
@@ -675,7 +673,7 @@
 				// 	})
 				// console.log(this.cart, '购物车')
 			},
-			toPay() {
+			async toPay() {
 				// if(!this.isLogin) {
 				// 	uni.navigateTo({url: '/pages/login/login'})
 				// 	return
@@ -685,6 +683,17 @@
 					title: '加载中'
 				})
 
+				try {
+					// 获取用户默认地址
+					const res =	await getAddressList()
+						console.log('地址', res)
+						if (res.code = 200) {
+							this.addressInfo = res.data.find(item => item.isDefault === true);
+							console.log('默认地址', this.addressInfo)
+						}
+				} catch (err) {
+					console.log(err,'err')
+				}
 				let orderDetails = this.cart.map((item) => {
 					return {
 						attrValueId: item.productid, //商品规格属性id(立即购买、活动购买必填)