Commit 8238a249 by 高淑倩

isSelect ? 'couponSettingId' : 'couponId'

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