|
|
|
@ -209,7 +209,8 @@ |
|
|
|
|
getAddressPrice, |
|
|
|
|
getUserExclusiveDiscount, |
|
|
|
|
createOrder, |
|
|
|
|
findUser |
|
|
|
|
findUser, |
|
|
|
|
findDeliveryAddressById |
|
|
|
|
} from '@/Utils/physicalObject.js' |
|
|
|
|
import { |
|
|
|
|
getThirdPartyByDetail |
|
|
|
@ -225,6 +226,7 @@ |
|
|
|
|
isMoreThanOne: false, //是否超过一个商品 |
|
|
|
|
goodsList: [], //商品列表 |
|
|
|
|
haveAddress: false, //默认没有地址 |
|
|
|
|
isFirstSearchAddress:true, |
|
|
|
|
addressDetail: null, //地址信息 |
|
|
|
|
postPrice: null, //运费信息 |
|
|
|
|
|
|
|
|
@ -390,18 +392,53 @@ |
|
|
|
|
if (this.goodsList.length > 1) { |
|
|
|
|
this.isMoreThanOne = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 监听事件 |
|
|
|
|
uni.$on('address',(addressDetail)=>{ |
|
|
|
|
this.addressDetail = addressDetail; |
|
|
|
|
this.getRegiFreight(addressDetail); |
|
|
|
|
console.log(addressDetail,"监听") |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
this.getAddrPrice() //查询收货地址包邮金额和运费金额 |
|
|
|
|
onUnload() { |
|
|
|
|
// 移除监听事件 |
|
|
|
|
uni.$off('address'); |
|
|
|
|
}, |
|
|
|
|
onShow() { |
|
|
|
|
|
|
|
|
|
this.getUserDiscount() //查询优惠券 |
|
|
|
|
this.findUser() //查询用户相关内容 |
|
|
|
|
this.getAddrPrice() //查询收货地址包邮金额和运费金额 |
|
|
|
|
|
|
|
|
|
if(this.addressDetail&&!this.isFirstSearchAddress){ |
|
|
|
|
console.log(this.addressDetail,"123456") |
|
|
|
|
let params = { |
|
|
|
|
id:this.addressDetail.id |
|
|
|
|
} |
|
|
|
|
findDeliveryAddressById(params).then(res=>{ |
|
|
|
|
// console.log(res) |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
|
|
|
|
|
}else{ //之前选择的地址失效了 |
|
|
|
|
this.isFirstSearchAddress=true; |
|
|
|
|
this.haveAddress = false; |
|
|
|
|
this.addressDetail = null; |
|
|
|
|
this.getAddrPrice(); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
//根据区域查询包邮,运费价格 |
|
|
|
|
getRegiFreight(addressDetail) { |
|
|
|
|
this.haveAddress = true; |
|
|
|
|
async getRegiFreight(addressDetail) { |
|
|
|
|
// console.log(addressDetail,"addressDetail") |
|
|
|
|
this.addressDetail = addressDetail; |
|
|
|
|
this.haveAddress = true; |
|
|
|
|
let params = { |
|
|
|
|
regionId: addressDetail.regionId |
|
|
|
|
} |
|
|
|
@ -420,7 +457,8 @@ |
|
|
|
|
}, |
|
|
|
|
//初始化查询地址 |
|
|
|
|
getAddrPrice() { |
|
|
|
|
if(this.haveAddress){ |
|
|
|
|
|
|
|
|
|
if(!this.isFirstSearchAddress&&this.addressDetail){ |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -428,15 +466,15 @@ |
|
|
|
|
title: '加载中', |
|
|
|
|
mask: true, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
getAddressPrice().then(res => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
this.isFirstSearchAddress = false; |
|
|
|
|
if (res.return_code == '000000') { |
|
|
|
|
if (res.return_data) { |
|
|
|
|
|
|
|
|
|
this.getRegiFreight(res.return_data.deliveryAddress) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.haveAddress = false; |
|
|
|
|
// uni.showToast({ |
|
|
|
|
// title: res.return_msg, |
|
|
|
|
// icon: 'none', |
|
|
|
@ -572,7 +610,7 @@ |
|
|
|
|
let yhqID = this.yhqId |
|
|
|
|
this.$refs.detailPopup.show(str, this.goodsList,yhqID); |
|
|
|
|
} else if (str == 'freight') { |
|
|
|
|
if (!this.postPrice) { |
|
|
|
|
if (!this.addressDetail&&!this.haveAddress) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请先选择地址', |
|
|
|
|
duration: 1000, |
|
|
|
@ -595,7 +633,7 @@ |
|
|
|
|
}, |
|
|
|
|
// 去支付按钮,下单 |
|
|
|
|
settleAccount() { |
|
|
|
|
if (!this.addressDetail) { |
|
|
|
|
if (!this.addressDetail&&!this.haveAddress) { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: '请选择地址', |
|
|
|
|
duration: 1000, |
|
|
|
|