Commit b08c5314 by 高淑倩

preview_addressId

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