Commit 8238a249 by 高淑倩

isSelect ? 'couponSettingId' : 'couponId'

parent d9aac290
......@@ -38,18 +38,16 @@ Component({
if (couponList.length) {
couponList.map(coupon => {
console.log('22222', coupon)
coupon.couponDTOS.forEach(item => {
// item.checked = false
coupon.couponDTOS.forEach((item,index) => {
item.checked = false
item[0].checked = true
coupon.couponDTOS[0].checked = true
item.couponDiscount = coupon.couponDiscount
item.title = coupon.couponSettingDTO.title
item.type = coupon.couponSettingDTO.type
item.faceAmount = coupon.couponSettingDTO.faceAmount
item.takeCouponBgimg = coupon.couponSettingDetailDTO.style.takeCouponBgimg
// notice 格式
item.newNotice = JSON.parse(item.notice)
console.log('11111', item)
item.newNotice = item && item.notice ? JSON.parse(item.notice) : ''
for (let i in item.newNotice) {
if (item.newNotice[i].type == 1) {
item.newNotice[i].value = item.startTime.substring(0, 10) + ' 至 ' + item.endTime.substring(0, 10)
......
......@@ -370,6 +370,7 @@ wxService.page({
currentOrderList: data,
defalutCoupon: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0].couponSettingDTO.type == 1 ? data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0].couponSettingDTO.faceAmount / 100 : data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDiscount,
defalutCouponId: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] && data.couponDiscountPreviews[0].couponDTOS[0].id || '',
couponSettingId: data && data.couponDiscountPreviews.length && data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] && data.couponDiscountPreviews[0].couponDTOS[0].couponSettingId || '',
orderInitPrice: data.amount
}, () => {
// 实付款
......@@ -380,14 +381,22 @@ wxService.page({
})
},
handelGobuy() {
const { trolleySku2Buy, couponId, addressId, addressInfo, defalutCouponId } = this.data
// 第一项 defalutCouponId couponId/
const { isSelect, trolleySku2Buy, couponId, couponSettingId, addressId, addressInfo, defalutCouponId } = this.data
let NoPlusCouponId = couponId ? couponId : defalutCouponId // couponId / 第一项 id
let finCouponName = isSelect ? 'couponSettingId' : 'couponId' // key
let finCouponId = isSelect ? couponSettingId: NoPlusCouponId // val
// let finCouponId = NoPlusCouponId ? NoPlusCouponId : couponSettingId
let params = {
couponId: couponId? couponId : defalutCouponId,
[finCouponName]: finCouponId,
// couponId: couponId? couponId : defalutCouponId,
trolleySku2Buy,
addressId: addressId ? addressId : addressInfo.id // 微信地址 or 地址id
}
this.getBill(params) // 下单
console.log('params', params, this.data)
// this.getBill(params) // 下单
},
// 下单
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