tapd相关修改更新
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="u-p-l-30 u-p-r-30 u-p-t-30 u-font-28 ">
|
||||
<up-sticky offset-top="0">
|
||||
<my-tabs v-model="pageData.types.sel" :list="pageData.types.list"></my-tabs>
|
||||
<my-tabs v-model="pageData.types.sel" @change="tabChange" :list="pageData.types.list"></my-tabs>
|
||||
</up-sticky>
|
||||
<view class="u-m-t-32">
|
||||
<template v-if="pageData.types.sel==0">
|
||||
@@ -60,8 +60,8 @@
|
||||
<view class="u-flex">
|
||||
<up-image width="80rpx" height="80rpx" :src="item.productCover"></up-image>
|
||||
<view class="u-m-l-18">
|
||||
<view class="u-m-l-18">{{item.productName}}</view>
|
||||
<view class="u-m-l-18 u-m-t-10 u-font-24 color-666">x{{item.num}}</view>
|
||||
<view class="u-m-l-18">{{item.name}}{{item.productName?' | '+item.productName : ''}}</view>
|
||||
<!-- <view class="u-m-l-18 u-m-t-10 u-font-24 color-666">x{{item.num}}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class=" u-m-t-14 u-flex">
|
||||
@@ -70,7 +70,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-10 color-999 u-font-24">
|
||||
{{ formatStr(item.useRestrictions)}}
|
||||
{{ item.useRestrictions }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="right u-flex u-flex-col u-col-bottom u-row-center">
|
||||
@@ -200,6 +200,10 @@
|
||||
})
|
||||
})
|
||||
|
||||
function tabChange () {
|
||||
getQuan()
|
||||
}
|
||||
|
||||
/**
|
||||
* 抵扣金额
|
||||
*/
|
||||
@@ -249,12 +253,13 @@
|
||||
return {
|
||||
...calcCoup,
|
||||
checked: false,
|
||||
use:option.orderPrice<=0?false:v.use
|
||||
use: option.orderPrice<=0?false:v.use
|
||||
}
|
||||
}).filter((v) => v.use);
|
||||
})
|
||||
// .filter((v) => v.use);
|
||||
pageData.fullReductionCoupon = fullReductionCoupon
|
||||
pageData.productCoupon = productCoupon
|
||||
console.log(pageData)
|
||||
console.log(res)
|
||||
pageData.hasAjax = true;
|
||||
}
|
||||
|
||||
@@ -262,18 +267,24 @@
|
||||
setModalShow('clear', false, '')
|
||||
}
|
||||
|
||||
/**
|
||||
* 继续选择
|
||||
*/
|
||||
async function confirmModelConfirm() {
|
||||
if (modal.key == 'clear') {
|
||||
pageData.fullReductionCouponSel = {
|
||||
id: ''
|
||||
if( modal.data ){
|
||||
pageData.fullReductionCouponSel = {
|
||||
id: ''
|
||||
}
|
||||
const item = modal.data
|
||||
item.checked = !item.checked
|
||||
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
|
||||
const noCheckedArr = pageData.productCoupon.filter(v => !v.checked)
|
||||
noCheckedArr.map(v => {
|
||||
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||
})
|
||||
}
|
||||
const item = modal.data
|
||||
item.checked = !item.checked
|
||||
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
|
||||
const noCheckedArr = pageData.productCoupon.filter(v => !v.checked)
|
||||
noCheckedArr.map(v => {
|
||||
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||
})
|
||||
|
||||
setModalShow('clear', false, '')
|
||||
}
|
||||
}
|
||||
@@ -284,8 +295,6 @@
|
||||
modal.data = data
|
||||
}
|
||||
|
||||
|
||||
|
||||
function back() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
@@ -295,14 +304,20 @@
|
||||
* @param {Object} item
|
||||
*/
|
||||
function changeProductCoupon(item) {
|
||||
if (!item.use) {
|
||||
if (!item.use) { return }
|
||||
if ( payPrice.value <= 0 ) {
|
||||
modal.content = '当前支付金额不满足选择商品券的最低使用需求,无法选择'
|
||||
modal.cancelText = '取消'
|
||||
modal.confirmText = '确定'
|
||||
setModalShow('clear', true)
|
||||
return
|
||||
}
|
||||
if (pageData.fullReductionCouponSel.id && !item.checked) {
|
||||
if (!item.checked) {
|
||||
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
|
||||
const fullReductionCoupon = pageData.fullReductionCouponSel.id ? [pageData.fullReductionCouponSel] : []
|
||||
let coupArr = [...goodsQuan, item]
|
||||
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, pageData.user)
|
||||
|
||||
console.log(payPrice)
|
||||
if (payPrice<=0) {
|
||||
modal.content = '选择该商品券后支付金额将为0,继续选择将取消选择的满减券'
|
||||
modal.cancelText = '取消'
|
||||
@@ -318,7 +333,7 @@
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
console.log(2)
|
||||
item.checked = !item.checked
|
||||
const CheckedArr = pageData.productCoupon.filter(v => v.checked)
|
||||
if (CheckedArr.length <= 0) {
|
||||
@@ -342,7 +357,6 @@
|
||||
if (!item.use) {
|
||||
return
|
||||
}
|
||||
console.log(item);
|
||||
if (item.id == pageData.fullReductionCouponSel.id) {
|
||||
pageData.fullReductionCouponSel = {
|
||||
id: ''
|
||||
@@ -364,15 +378,23 @@
|
||||
*/
|
||||
function toEmitChooseQuan(item) {
|
||||
let arr = []
|
||||
let discountAmount = 0;
|
||||
if (item) {
|
||||
arr = [item]
|
||||
} else {
|
||||
if (pageData.fullReductionCouponSel.id) {
|
||||
arr.push(pageData.fullReductionCouponSel)
|
||||
}
|
||||
const goodsQuan = pageData.productCoupon.filter(v => v.checked)
|
||||
let goodsQuan = pageData.productCoupon.filter(v => v.checked)
|
||||
arr.push(...goodsQuan)
|
||||
}
|
||||
arr.map(item=>{
|
||||
discountAmount += item.discountAmount
|
||||
})
|
||||
if( discountAmount > option.orderPrice){
|
||||
|
||||
}
|
||||
console.log(arr)
|
||||
uni.$emit('choose-quan', arr)
|
||||
back()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user