Commit d842823f by 高淑倩

下单plus

parent a8f1eda6
...@@ -88,6 +88,7 @@ Component({ ...@@ -88,6 +88,7 @@ Component({
params = { params = {
type, type,
id, id,
sid,
faceAmount: amount, faceAmount: amount,
couponDiscount: couponDiscount couponDiscount: couponDiscount
} }
......
...@@ -9,8 +9,8 @@ wxService.page({ ...@@ -9,8 +9,8 @@ wxService.page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
couponId: null, couponId: null, // 当前选中优惠券 id
couponSettingId: null, couponSettingId: null, // 当前选中plus优惠券 id
checkByPremium: false, checkByPremium: false,
addressInfo: [], addressInfo: [],
showSelectCoupon: false, showSelectCoupon: false,
...@@ -33,7 +33,7 @@ wxService.page({ ...@@ -33,7 +33,7 @@ wxService.page({
plusMemberPrice: 0, // plus 默认价 plusMemberPrice: 0, // plus 默认价
plusMemberName: '', plusMemberName: '',
defalutCoupon: '', defalutCoupon: '',
defalutCouponId: '', defalutCouponId: '', // 默认第一项
addressId: '', // 收货地址id addressId: '', // 收货地址id
}, },
...@@ -92,7 +92,6 @@ wxService.page({ ...@@ -92,7 +92,6 @@ wxService.page({
// select 传过来 // select 传过来
updateCoupon(e) { updateCoupon(e) {
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 // faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券
console.log('detail', e.detail)
if(!e.detail) { if(!e.detail) {
this.setData({ this.setData({
defalutCoupon: 0, defalutCoupon: 0,
...@@ -103,15 +102,19 @@ wxService.page({ ...@@ -103,15 +102,19 @@ wxService.page({
return return
} }
const { faceAmount, type, id, couponDiscount,sid } = e.detail const { faceAmount, type, id, couponDiscount,sid } = e.detail
const { defalutCouponId } = this.data
console.log('detail=====', e.detail)
const { orderPrice } = this.data const { orderPrice } = this.data
console.log('faceAmount', faceAmount)
// couponId couponSettingId // couponId---id couponSettingId --sid
let finCouponId = id ? id : sid let finCouponId = id ? id : sid
let finCouponName = id ? 'couponId' : 'couponSettingId' let finCouponName = id ? 'couponId' : 'couponSettingId'
console.log('upppppppppppppp', finCouponName,finCouponId )
if (type == 1) { if (type == 1) {
this.setData({ this.setData({
defalutCoupon: true, defalutCoupon: true,
defalutCouponId: finCouponId ? '' : defalutCouponId,
[finCouponName] : finCouponId, [finCouponName] : finCouponId,
// couponId: id, // couponId: id,
haveCoupon: true, haveCoupon: true,
...@@ -123,6 +126,7 @@ wxService.page({ ...@@ -123,6 +126,7 @@ wxService.page({
this.setData({ this.setData({
defalutCoupon: true, defalutCoupon: true,
[finCouponName] : finCouponId, [finCouponName] : finCouponId,
defalutCouponId: finCouponId ? '' : defalutCouponId,
// couponId: id, // couponId: id,
haveCoupon: true, haveCoupon: true,
currentCoupon: `${couponDiscount} 元` currentCoupon: `${couponDiscount} 元`
...@@ -302,7 +306,11 @@ wxService.page({ ...@@ -302,7 +306,11 @@ wxService.page({
const { isSelect } = this.data const { isSelect } = this.data
console.log('isSelect', isSelect) console.log('isSelect', isSelect)
this.setData({ this.setData({
checkByPremium: isSelect checkByPremium: isSelect,
defalutCoupon: 0,
couponId: '',
couponSettingId: '',
defalutCouponId: ''
}, () => { }, () => {
const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data
...@@ -391,12 +399,27 @@ wxService.page({ ...@@ -391,12 +399,27 @@ wxService.page({
}, },
handelGobuy() { handelGobuy() {
// 第一项 defalutCouponId couponId/ // 第一项 defalutCouponId couponId/
const { isSelect, trolleySku2Buy, couponId, couponSettingId, addressId, addressInfo, defalutCouponId } = this.data const { isSelect, defalutCoupon,trolleySku2Buy, couponId, couponSettingId, addressId, addressInfo, defalutCouponId } = this.data
let NoPlusCouponId = couponId ? couponId : defalutCouponId // couponId / 第一项 id // let NoPlusCouponId = couponId ? couponId : defalutCouponId // couponId / 第一项 id
let finCouponName = isSelect ? 'couponSettingId' : 'couponId' // key
let finCouponId = isSelect ? couponSettingId: NoPlusCouponId // val let finCouponName,finCouponId
// let finCouponId = NoPlusCouponId ? NoPlusCouponId : couponSettingId if(!defalutCoupon) {
finCouponName = 'couponId'
finCouponId = ''
} else {
// 当前选中 哪一个id couponSettingId
// 默认券存在 id settingId
let currentCouponId // couponId / 第一项 id
if(defalutCouponId) {
finCouponId = defalutCouponId
finCouponName = 'couponId'
} else {
currentCouponId = couponId ? couponId : couponSettingId
finCouponName = couponId ? 'couponId' : 'couponSettingId'
finCouponId = currentCouponId
}
}
let params = { let params = {
[finCouponName]: finCouponId, [finCouponName]: finCouponId,
// couponId: couponId? couponId : defalutCouponId, // couponId: couponId? couponId : defalutCouponId,
...@@ -404,7 +427,11 @@ wxService.page({ ...@@ -404,7 +427,11 @@ wxService.page({
addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id
} }
console.log('params', params, this.data) console.log('defalutCoupon',this.data.defalutCoupon)
console.log('couponIdiiiiiiiiiiiidddddd',couponId)
console.log('couponSettingIdiiiiiiidddddd',couponSettingId)
console.log('defalutCouponIdiiiiiiiiiiiiiidddddd',defalutCouponId)
console.log('params', params)
this.getBill(params) // 下单 this.getBill(params) // 下单
}, },
// 下单 // 下单
......
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