Fix:5498 【商城小程序】将抽奖商品加入购物车,从购物车进商品详情页,点击【送给朋友】仍可使用优惠券,改为不可使用
This commit is contained in:
@@ -732,6 +732,7 @@ export default {
|
|||||||
console.log("getLaunchOptionsSync", uni.getLaunchOptionsSync())
|
console.log("getLaunchOptionsSync", uni.getLaunchOptionsSync())
|
||||||
console.log("getEnterOptionsSync", uni.getEnterOptionsSync())
|
console.log("getEnterOptionsSync", uni.getEnterOptionsSync())
|
||||||
uni.removeStorageSync('couponId')
|
uni.removeStorageSync('couponId')
|
||||||
|
const pageQuery = Object.assign({}, this.resolvePageQuery(), options || {})
|
||||||
const from = options.from
|
const from = options.from
|
||||||
const id = options.id
|
const id = options.id
|
||||||
switch (from) {
|
switch (from) {
|
||||||
@@ -779,10 +780,10 @@ export default {
|
|||||||
if (url && url.productId) {
|
if (url && url.productId) {
|
||||||
this.id = url.productId
|
this.id = url.productId
|
||||||
} else if (options.id) {
|
} else if (options.id) {
|
||||||
this.id = options.id || null
|
this.id = pageQuery.id || options.id || null
|
||||||
this.partnerId = options.partnerId || null
|
this.partnerId = pageQuery.partnerId || options.partnerId || null
|
||||||
this.activityId = this._route.query.activityId
|
this.activityId = Number(pageQuery.activityId || pageQuery.drawActivityId || 0)
|
||||||
this.source = this._route.query.from || ''
|
this.source = pageQuery.from || ''
|
||||||
} else {
|
} else {
|
||||||
const obj = uni.getEnterOptionsSync()
|
const obj = uni.getEnterOptionsSync()
|
||||||
if (options.scene != null || obj.query.scene != null) {
|
if (options.scene != null || obj.query.scene != null) {
|
||||||
@@ -847,6 +848,18 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resolvePageQuery() {
|
||||||
|
if (this.$yroute && this.$yroute.query) {
|
||||||
|
return this.$yroute.query
|
||||||
|
}
|
||||||
|
if (this.$route && this.$route.query) {
|
||||||
|
return this.$route.query
|
||||||
|
}
|
||||||
|
if (this._route && this._route.query) {
|
||||||
|
return this._route.query
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
},
|
||||||
gift() {
|
gift() {
|
||||||
this.goCat(2)
|
this.goCat(2)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -299,11 +299,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(opts) {
|
onLoad(opts) {
|
||||||
this.cartId = opts.cartId
|
const pageQuery = Object.assign({}, this.resolvePageQuery(), opts || {})
|
||||||
this.isGroupBuy = opts.isGroupBuy === '1'
|
this.cartId = pageQuery.cartId
|
||||||
this.isCountyLotteryGift = opts.from === 'countyLottery' || opts.isCountyLotteryGift === '1' || !!opts.drawActivityId
|
this.isGroupBuy = pageQuery.isGroupBuy === '1'
|
||||||
|
this.isCountyLotteryGift = pageQuery.from === 'countyLottery' || pageQuery.isCountyLotteryGift === '1' || !!pageQuery.drawActivityId
|
||||||
// this.couponId = opts.couponId || 0
|
// this.couponId = opts.couponId || 0
|
||||||
this.discount = opts.discount
|
this.discount = pageQuery.discount
|
||||||
if(this.isGroupBuy) {
|
if(this.isGroupBuy) {
|
||||||
this.getGroupBuyInfo()
|
this.getGroupBuyInfo()
|
||||||
} else {
|
} else {
|
||||||
@@ -332,10 +333,39 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resolvePageQuery() {
|
||||||
|
if (this.$yroute && this.$yroute.query) {
|
||||||
|
return this.$yroute.query
|
||||||
|
}
|
||||||
|
if (this.$route && this.$route.query) {
|
||||||
|
return this.$route.query
|
||||||
|
}
|
||||||
|
if (this._route && this._route.query) {
|
||||||
|
return this._route.query
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
},
|
||||||
getCouponId() {
|
getCouponId() {
|
||||||
if (this.isCountyLotteryGift) return 0
|
if (this.isCountyLotteryGift) return 0
|
||||||
return this.couponId || 0
|
return this.couponId || 0
|
||||||
},
|
},
|
||||||
|
isCountyLotteryCartItem(item) {
|
||||||
|
return Number(
|
||||||
|
(item && item.drawActivityId) ||
|
||||||
|
(item && item.productInfo && item.productInfo.drawActivityId) ||
|
||||||
|
0
|
||||||
|
) > 0
|
||||||
|
},
|
||||||
|
syncCountyLotteryGiftFlag(item) {
|
||||||
|
if (!this.isCountyLotteryGift && this.isCountyLotteryCartItem(item)) {
|
||||||
|
this.isCountyLotteryGift = true
|
||||||
|
}
|
||||||
|
if (!this.isCountyLotteryGift) return
|
||||||
|
this.couponTitle = ''
|
||||||
|
if (Number(this.couponId || 0) !== 0) {
|
||||||
|
this.couponId = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
adjustCoverListForProductStory(coverList, productInfo, defaultTemplate) {
|
adjustCoverListForProductStory(coverList, productInfo, defaultTemplate) {
|
||||||
if (!productInfo || !productInfo.productStory) {
|
if (!productInfo || !productInfo.productStory) {
|
||||||
return {
|
return {
|
||||||
@@ -436,6 +466,7 @@ export default {
|
|||||||
this.giftNotice = res.data.giftCardGiftNotice
|
this.giftNotice = res.data.giftCardGiftNotice
|
||||||
this.orderKey = res.data.orderKey
|
this.orderKey = res.data.orderKey
|
||||||
this.goodsInfo = goodsInfo
|
this.goodsInfo = goodsInfo
|
||||||
|
this.syncCountyLotteryGiftFlag(goodsInfo)
|
||||||
this.templateId = template.id
|
this.templateId = template.id
|
||||||
this.defaultIndex = this.coverList.findIndex(item => item.id === this.templateId)
|
this.defaultIndex = this.coverList.findIndex(item => item.id === this.templateId)
|
||||||
console.log(this.defaultIndex, 'defaultIndex');
|
console.log(this.defaultIndex, 'defaultIndex');
|
||||||
@@ -522,6 +553,7 @@ export default {
|
|||||||
this.giftNotice = res.data.giftCardGiftNotice
|
this.giftNotice = res.data.giftCardGiftNotice
|
||||||
this.orderKey = res.data.orderKey
|
this.orderKey = res.data.orderKey
|
||||||
this.goodsInfo = goodsInfo
|
this.goodsInfo = goodsInfo
|
||||||
|
this.syncCountyLotteryGiftFlag(goodsInfo)
|
||||||
this.templateId = template.id
|
this.templateId = template.id
|
||||||
this.selectedCover = template.cover
|
this.selectedCover = template.cover
|
||||||
this.giftImage = template.image
|
this.giftImage = template.image
|
||||||
|
|||||||
Reference in New Issue
Block a user