Commit b08c5314 by 高淑倩

preview_addressId

parent bfbb8bb3
......@@ -25,7 +25,7 @@ wxService.page({
orderPrice: null, // 订单金额
orderInitPrice: 0,
plusMemberPrice: 0, // plus 默认价
plusMemberName:'',
plusMemberName: '',
defalutCoupon: '',
addressId: '', // 收货地址id
showPlus: null
......@@ -41,9 +41,7 @@ wxService.page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
console.log('dddd',app.globalData.isPlusVip)
const { memberId } = wx.getStorageSync('_baseUserInfo')
console.log('dddd', app.globalData.isPlusVip)
let pages = getCurrentPages();
let currPage = pages[pages.length - 1];
......@@ -60,20 +58,20 @@ wxService.page({
trolleySku2Buy: tradeDto.trolleySku2Buy,
showPlus: app.globalData.isPlusVip ? false : true
}, () => {
console.log('showPlus', this.data.showPlus)
const { trolleySku2Buy, checkByPremium } = this.data
let params = {
checkByPremium,
trolleySku2Buy
}
this.calPreferentialPrice(params) // 计算优惠价
})
this.initCitys()
// 地址列表
if (!this.data.wxAddress){
this.getAddressList()
}
// if (!this.data.wxAddress){
// this.getAddressList()
// }
})
// this.initCitys()
// // 地址列表
// this.getAddressList()
// // if (!this.data.wxAddress){
// // this.getAddressList()
// // }
},
updateCoupon(e) {
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券
......@@ -101,7 +99,7 @@ wxService.page({
},
setPayPrice() {
const { currentCoupon, orderInitPrice, isSelect, plusMemberPrice } = this.data
let newCurrentCoupon = currentCoupon? currentCoupon : 0
let newCurrentCoupon = currentCoupon ? currentCoupon : 0
let orderCoupon = parseFloat(newCurrentCoupon) // 优惠券价格
let plusPrice = isSelect ? plusMemberPrice : 0 // plus
// 实际价格 - 优惠价 + plus
......@@ -244,10 +242,12 @@ wxService.page({
this.setData({
checkByPremium: isSelect
}, () => {
const { trolleySku2Buy, checkByPremium } = this.data
const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data
let params = {
checkByPremium,
trolleySku2Buy
trolleySku2Buy,
addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id
}
this.calPreferentialPrice(params) // 重新计算优惠价
// 获取默认付费会员设置
......@@ -269,7 +269,7 @@ wxService.page({
this.setData({
plusMemberPrice: data.price,
plusMemberName: data.name
},()=>{
}, () => {
// 实付款
this.setPayPrice()
})
......@@ -283,6 +283,7 @@ wxService.page({
},
// 计算优惠价
calPreferentialPrice(params) {
console.log('params', params)
wx.showLoading({
title: '加载中'
})
......@@ -295,7 +296,7 @@ wxService.page({
currentOrderList: data,
defalutCoupon: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0].couponDiscount || '',
orderInitPrice: data.amount
},()=>{
}, () => {
// 实付款
this.setPayPrice()
})
......@@ -304,7 +305,7 @@ wxService.page({
})
},
handelGobuy() {
const { trolleySku2Buy, couponId,addressId, addressInfo } = this.data
const { trolleySku2Buy, couponId, addressId, addressInfo } = this.data
let params = {
couponId,
trolleySku2Buy,
......@@ -370,8 +371,16 @@ wxService.page({
this.setData({
addressInfo: _defalutAddress
}, () => {
// preview
const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data
let params = {
checkByPremium,
trolleySku2Buy,
addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id
}
this.calPreferentialPrice(params) // 计算优惠价
})
console.log(this.data.addressInfo)
}
}
}).finally(() => {
......@@ -391,7 +400,7 @@ wxService.page({
goodsAddress: false,
wxAddress: true,
addressInfo: res,
params:{
params: {
userId: memberId,
name: res.userName,
phone: res.telNumber,
......@@ -407,7 +416,7 @@ wxService.page({
if (result == 0) {
wx.hideLoading()
this.setData({
addressId:data
addressId: data
})
}
}).finally(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment