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