Merge branch 'ymf_1.0.0' of https://e.coding.net/g-cphe0354/cashier_front/cashier_admin_app into ymf_3.0.0
This commit is contained in:
@@ -21,6 +21,9 @@ export function canTuiKuan(orderInfo, item) {
|
|||||||
return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status !=
|
return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status !=
|
||||||
'refunding' && !item.userCouponId
|
'refunding' && !item.userCouponId
|
||||||
}
|
}
|
||||||
|
export function isTuiCai(item) {
|
||||||
|
return item.status == 'return'
|
||||||
|
}
|
||||||
export function isTui(item) {
|
export function isTui(item) {
|
||||||
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
充值设置
|
充值设置
|
||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox_tow">
|
<view class="boxconstantbox_tow">
|
||||||
<text>用户消费结账时,成功充值成功</text>
|
<text>用户消费结账时,成功充值</text>
|
||||||
<input class="text" v-model="form.rechargeTimes"></input>
|
<input class="number" v-model="form.rechargeTimes"></input>
|
||||||
<text>倍的金额本单即可享受免单</text>
|
<text>倍的金额本单即可享受免单</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="boxconstantbox_tow">
|
<view class="boxconstantbox_tow">
|
||||||
<text>订单支付金额需满</text>
|
<text>订单支付金额需满</text>
|
||||||
<input class="text" v-model="form.rechargeThreshold"></input>
|
<input class="number" v-model="form.rechargeThreshold"></input>
|
||||||
<text> 元,才能使用</text>
|
<text> 元,才能使用</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -17,15 +17,17 @@
|
|||||||
<!-- <view class="headeimg">
|
<!-- <view class="headeimg">
|
||||||
<image class="img" :src="user.headImg" mode=""></image>
|
<image class="img" :src="user.headImg" mode=""></image>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view class="u-m-l-20">{{user.nickName}}</view>
|
<view class="u-m-l-20">
|
||||||
<view class="color-main u-m-l-10 u-font-24">{{user.isVip?'会员':'' }}</view>
|
<!-- <view class="color-main u-font-24 no-wrap">{{user.isVip?'会员':'' }}</view> -->
|
||||||
<view class="u-font-24 u-m-l-30"><text>余额:</text><text
|
<view class="">{{user.nickName}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-font-24 u-m-l-30 u-text-center"><text>余额:</text><text
|
||||||
class="color-main">{{user.amount}}</text>
|
class="color-main">{{user.amount}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-font-24 u-m-l-30"><text>积分:</text><text
|
<view class="u-font-24 u-m-l-30 u-text-center"><text>积分:</text><text
|
||||||
class="color-main">{{user.accountPoints}}</text></view>
|
class="color-main">{{user.accountPoints}}</text></view>
|
||||||
</view>
|
</view>
|
||||||
<uni-icons type="right" color="#999" size="16"></uni-icons>
|
<uni-icons type="right" color="#999" size="20" bold></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class=" ">
|
<view class=" ">
|
||||||
@@ -168,7 +170,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-if="isVip&&item.memberPrice&&item.memberPrice!=item.salePrice">
|
<template v-if="isVip&&item.memberPrice&&item.memberPrice*1!=item.salePrice*1">
|
||||||
<text
|
<text
|
||||||
class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
class="line-th color-999">¥{{formatPrice(item.salePrice*item.number) }}</text>
|
||||||
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
<view class="u-absolute" style="right: 0;bottom: 100%;">
|
||||||
@@ -239,10 +241,17 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="u-flex u-row-right u-m-t-38">
|
<view class="u-flex u-row-between u-m-t-38">
|
||||||
<!-- <template v-if="$shop.registerType=='munchies'">
|
<!-- <template v-if="$shop.registerType=='munchies'">
|
||||||
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
<view class="color-main" @tap="showModel('editMoney')">修改</view>
|
||||||
</template> -->
|
</template> -->
|
||||||
|
<view class="u-flex">
|
||||||
|
<view class="u-flex price" v-if="youhui*1>0">
|
||||||
|
<view class="">优惠金额</view>
|
||||||
|
<view class="font-bold u-font-32">¥{{formatPrice(youhui) }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="u-flex price u-m-l-32">
|
<view class="u-flex price u-m-l-32">
|
||||||
<view class="">实收金额</view>
|
<view class="">实收金额</view>
|
||||||
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
<view class="font-bold u-font-32">¥{{formatPrice(allPrice) }}</view>
|
||||||
@@ -512,7 +521,7 @@
|
|||||||
totalAmount: 0,
|
totalAmount: 0,
|
||||||
})
|
})
|
||||||
const isVip=computed(()=>{
|
const isVip=computed(()=>{
|
||||||
return $shop.isMemberPrice&& user.value&&user.value.id&&user.value.isVip
|
return $shop.value.isMemberPrice&& user.value&&user.value.id&&user.value.isVip
|
||||||
})
|
})
|
||||||
const goodsPrice = computed(() => {
|
const goodsPrice = computed(() => {
|
||||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
@@ -532,6 +541,19 @@
|
|||||||
// }, 0)
|
// }, 0)
|
||||||
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
||||||
})
|
})
|
||||||
|
const youhui=computed(()=>{
|
||||||
|
if(user.value&&user.value.id&&user.value.isVip){
|
||||||
|
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
|
const tPrice = cur.salePrice * cur.number
|
||||||
|
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
|
||||||
|
return prve + tPrice + tpackFee
|
||||||
|
}, 0)
|
||||||
|
return goodsTotalPrice-allPrice.value
|
||||||
|
}else{
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return goodsTotalPrice
|
||||||
|
})
|
||||||
|
|
||||||
function setGoodsItem(key, val) {
|
function setGoodsItem(key, val) {
|
||||||
item[key] = val
|
item[key] = val
|
||||||
|
|||||||
@@ -53,12 +53,7 @@
|
|||||||
returnCanComputedGoodsArr,canComputedPackFee,
|
returnCanComputedGoodsArr,canComputedPackFee,
|
||||||
returnPackFee
|
returnPackFee
|
||||||
} from '@/commons/utils/goodsUtil.js'
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
function extraCanTuicai(orderInfo,data){
|
|
||||||
return orderInfo.status=='unpaid'&&data.status!='return'&&data.priceAmount*1>0
|
|
||||||
}
|
|
||||||
function extraCanTuiKuan(orderInfo,data){
|
|
||||||
return orderInfo.status=='closed'&&data.status!='return'&&data.priceAmount*1>0
|
|
||||||
}
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -77,6 +72,12 @@
|
|||||||
default: () => {}
|
default: () => {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
function extraCanTuicai(orderInfo,data){
|
||||||
|
return orderInfo.status=='unpaid'&&data.status!='return'&&data.priceAmount*1>0
|
||||||
|
}
|
||||||
|
function extraCanTuiKuan(orderInfo,data){
|
||||||
|
return orderInfo.status=='closed'&&data.status!='refund'&&data.priceAmount*1>0
|
||||||
|
}
|
||||||
const packeNumbber = computed(() => {
|
const packeNumbber = computed(() => {
|
||||||
if (!props.orderInfo.detailList) {
|
if (!props.orderInfo.detailList) {
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<view class="u-text-right u-m-t-28">
|
<view class="u-text-right u-m-t-28">
|
||||||
<template v-if="isTui(item)">
|
<template v-if="isTui(item)">
|
||||||
<view>¥0.00</view>
|
<view>¥0.00</view>
|
||||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
<view class="line-th color-666 " >¥{{returnTotalMoney(item)}}
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="isGift(item)||item.userCouponId">
|
<template v-else-if="isGift(item)||item.userCouponId">
|
||||||
@@ -67,7 +67,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
|
<template
|
||||||
|
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
|
||||||
<view>¥{{returnVipMoney(item)}}</view>
|
<view>¥{{returnVipMoney(item)}}</view>
|
||||||
<view class=" color-666 line-th">
|
<view class=" color-666 line-th">
|
||||||
¥{{returnTotalMoney(item)}}</view>
|
¥{{returnTotalMoney(item)}}</view>
|
||||||
@@ -120,21 +121,21 @@
|
|||||||
|
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
|
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
|
||||||
<view class="color-red u-m-r-6 " >
|
<view class="color-red u-m-r-6 ">
|
||||||
已优惠¥{{youhuiAllPrice}}
|
已优惠¥{{youhuiAllPrice}}
|
||||||
</view>
|
</view>
|
||||||
<up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon>
|
<up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view>
|
<view>
|
||||||
<text>小计¥</text>
|
<text>小计¥</text>
|
||||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<template v-if="orderInfo.status=='refund'">
|
<template v-if="orderInfo.refundAmount">
|
||||||
<view class="u-flex u-row-between u-m-t-32">
|
<view class="u-flex u-row-between u-m-t-32">
|
||||||
<view>退款金额</view>
|
<view>退款金额</view>
|
||||||
<view class="color-999">
|
<view class="color-999">
|
||||||
@@ -165,40 +166,47 @@
|
|||||||
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide" >
|
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
|
||||||
<view class="u-p-30" style="width: 80vw;">
|
<view class="u-p-30" style="width: 80vw;">
|
||||||
<view class="font-bold u-text-center">优惠详情</view>
|
<view class="font-bold u-text-center">优惠详情</view>
|
||||||
<view class="u-m-t-32">
|
<view class="u-m-t-32">
|
||||||
<!-- <view class="u-flex u-row-between u-m-b-18">
|
<view class="u-flex u-row-between u-m-b-18">
|
||||||
<view>会员优惠</view>
|
<view>会员优惠</view>
|
||||||
<view class="color-red">
|
<view class="color-red">
|
||||||
<text>¥</text>
|
<text>¥</text>
|
||||||
<text>{{vipDiscountPrice}}</text>
|
<text>{{vipDiscountPrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view>
|
||||||
|
<view class="u-flex u-row-between u-m-b-18" v-if="orderInfo.discountAmount*1>0">
|
||||||
<view class="u-flex u-row-between ">
|
<view>打折</view>
|
||||||
|
<view class="color-red">
|
||||||
|
<text>¥</text>
|
||||||
|
<text>{{to2(orderInfo.discountAmount) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
|
||||||
<view>满减券抵扣</view>
|
<view>满减券抵扣</view>
|
||||||
<view class="color-red">
|
<view class="color-red">
|
||||||
<text>¥</text>
|
<text>¥</text>
|
||||||
<text>{{orderInfo.fullCouponDiscountAmount}}</text>
|
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-18">
|
<view class="u-flex u-row-between u-m-t-18"
|
||||||
|
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
|
||||||
<view>商品券抵扣</view>
|
<view>商品券抵扣</view>
|
||||||
<view class="color-red">
|
<view class="color-red">
|
||||||
<text>¥</text>
|
<text>¥</text>
|
||||||
<text>{{orderInfo.productCouponDiscountAmount||productCoupPrice}}</text>
|
<text> {{to2(orderInfo.productCouponDiscountAmount||productCoupPrice) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-between u-m-t-18">
|
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
|
||||||
<view>积分抵扣</view>
|
<view>积分抵扣</view>
|
||||||
<view class="color-red">
|
<view class="color-red">
|
||||||
<text>¥</text>
|
<text>¥</text>
|
||||||
<text>{{orderInfo.pointsDiscountAmount}}</text>
|
<text>{{to2(orderInfo.pointsDiscountAmount) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</up-popup>
|
</up-popup>
|
||||||
@@ -207,26 +215,31 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
computed, reactive
|
computed,
|
||||||
|
reactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import color from '@/commons/color.js'
|
import color from '@/commons/color.js'
|
||||||
import {
|
import {
|
||||||
hasPermission
|
hasPermission
|
||||||
} from '@/commons/utils/hasPermission.js'
|
} from '@/commons/utils/hasPermission.js'
|
||||||
import {
|
import {
|
||||||
isTui,isGift,
|
isTui,
|
||||||
|
isTuiCai,
|
||||||
|
isGift,
|
||||||
canTuiKuan,
|
canTuiKuan,
|
||||||
canTuicai,
|
canTuicai,
|
||||||
numSum
|
numSum
|
||||||
} from '@/commons/utils/goodsUtil.js'
|
} from '@/commons/utils/goodsUtil.js'
|
||||||
const pop=reactive({
|
const pop = reactive({
|
||||||
youhui:false
|
youhui: false
|
||||||
})
|
})
|
||||||
function youhuiDetailShow(){
|
|
||||||
pop.youhui=true
|
function youhuiDetailShow() {
|
||||||
|
pop.youhui = true
|
||||||
}
|
}
|
||||||
function youhuiDetailHide(){
|
|
||||||
pop.youhui=false
|
function youhuiDetailHide() {
|
||||||
|
pop.youhui = false
|
||||||
}
|
}
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
orderInfo: {
|
orderInfo: {
|
||||||
@@ -292,7 +305,7 @@
|
|||||||
if (!props.seatFee.priceAmount) {
|
if (!props.seatFee.priceAmount) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
const n = props.seatFee.priceAmount * (props.seatFee.status == 'return' ? 0 : 1)
|
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
|
||||||
return n.toFixed(2)
|
return n.toFixed(2)
|
||||||
})
|
})
|
||||||
const goodsOriginAllPrice = computed(() => {
|
const goodsOriginAllPrice = computed(() => {
|
||||||
@@ -305,12 +318,13 @@
|
|||||||
}, 0)
|
}, 0)
|
||||||
return goodsPrice.toFixed(2)
|
return goodsPrice.toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
const freePrice = computed(() => {
|
const freePrice = computed(() => {
|
||||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
const curTotal = cur.info.filter(v => v.gift == true || isTui(v)).reduce((a,
|
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
|
||||||
b) => {
|
b) => {
|
||||||
return a + (b.num * b.price)
|
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
|
||||||
|
return a + (b.num * price)
|
||||||
}, 0)
|
}, 0)
|
||||||
return prve + curTotal
|
return prve + curTotal
|
||||||
}, 0)
|
}, 0)
|
||||||
@@ -321,35 +335,43 @@
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" &&!v.userCouponId&&(v.isMember&&v.memberPrice)&&(v.memberPrice!=v.price)).reduce((a,
|
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && !v
|
||||||
|
.userCouponId && (v.isMember && v.memberPrice) && (v.memberPrice != v.price)).reduce((
|
||||||
|
a,
|
||||||
b) => {
|
b) => {
|
||||||
return a + (b.num * (b.price-b.memberPrice))
|
return a + (b.num * (b.price - b.memberPrice))
|
||||||
}, 0)
|
}, 0)
|
||||||
return prve + curTotal
|
return prve + curTotal
|
||||||
}, 0)
|
}, 0)
|
||||||
return goodsPrice.toFixed(2)
|
return goodsPrice.toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
const productCoupPrice=computed(()=>{
|
const productCoupPrice = computed(() => {
|
||||||
if(props.orderInfo.status=='closed'){
|
if (props.orderInfo.status == 'closed') {
|
||||||
return props.orderInfo.productCouponDiscountAmount
|
return props.orderInfo.productCouponDiscountAmount
|
||||||
}
|
}
|
||||||
const goodsPrice = props.data.reduce((a, b) => {
|
const goodsPrice = props.data.reduce((a, b) => {
|
||||||
const curTotal = b.info.filter(v => v.gift != true&& v.userCouponId).reduce((prve,
|
const curTotal = b.info.filter(v => v.gift != true && v.userCouponId).reduce((prve,
|
||||||
cur) => {
|
cur) => {
|
||||||
const isVip=props.user.isVip&&cur.isMember
|
const isVip = props.user.isVip && cur.isMember
|
||||||
const memberPrice=cur.memberPrice?cur.memberPrice:cur.price
|
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
|
||||||
const price=isVip?memberPrice:cur.price
|
const price = isVip ? memberPrice : cur.price
|
||||||
const curTotal=price*cur.num
|
const curTotal = price * cur.num
|
||||||
return prve+curTotal
|
return prve + curTotal
|
||||||
}, 0)
|
}, 0)
|
||||||
return a + curTotal
|
return a + curTotal
|
||||||
}, 0)
|
}, 0)
|
||||||
return goodsPrice.toFixed(2)
|
return goodsPrice.toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
const youhuiAllPrice=computed(()=>{
|
const youhuiAllPrice = computed(() => {
|
||||||
return (freePrice.value*1+vipDiscountPrice.value*1+props.orderInfo.fullCouponDiscountAmount+props.orderInfo.pointsDiscountAmount+productCoupPrice.value*1).toFixed(2)
|
console.log(freePrice.value * 1 , vipDiscountPrice.value * 1 , props.orderInfo.fullCouponDiscountAmount ,props
|
||||||
|
.orderInfo.pointsDiscountAmount , productCoupPrice.value * 1 , props.orderInfo.discountAmount);
|
||||||
|
return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
|
||||||
|
.orderInfo.pointsDiscountAmount + productCoupPrice.value * 1 + (props.orderInfo.discountAmount ||
|
||||||
|
0)).toFixed(2)
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
const packFee = computed(() => {
|
const packFee = computed(() => {
|
||||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||||
@@ -363,8 +385,8 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
const allPrice = computed(() => {
|
const allPrice = computed(() => {
|
||||||
const n=goodsOriginAllPrice.value-youhuiAllPrice.value
|
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
|
||||||
return (n<0?0:n).toFixed(2)
|
return (n < 0 ? 0 : n).toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
const goodsNumber = computed(() => {
|
const goodsNumber = computed(() => {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="data.isMember&&data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
<template v-else-if="item.isMember&&data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||||
@@ -164,7 +164,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function goodsVipPriceAmount(item) {
|
function goodsVipPriceAmount(item) {
|
||||||
const price = (props.data.memberId&&item.isMember) ? item.memberPrice : item.price
|
const price = item.memberPrice ? item.memberPrice : item.price
|
||||||
return (price * item.num).toFixed(2)
|
return (price * item.num).toFixed(2)
|
||||||
}
|
}
|
||||||
// const packeFee=computed(()=>{
|
// const packeFee=computed(()=>{
|
||||||
|
|||||||
@@ -46,15 +46,22 @@
|
|||||||
<view class="u-m-l-18">{{item.name}}</view>
|
<view class="u-m-l-18">{{item.name}}</view>
|
||||||
<view class="u-m-l-18 color-999">x{{item.num}}</view>
|
<view class="u-m-l-18 color-999">x{{item.num}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="color-red">
|
<view class="u-flex">
|
||||||
-¥{{item.discountAmount}}
|
<view class="color-red">
|
||||||
|
-¥{{item.discountAmount}}
|
||||||
|
</view>
|
||||||
|
<view class="u-m-l-12" @click="delQuan(index)">
|
||||||
|
<up-icon :size="16" name="minus-circle-fill" color="rgb(255, 0, 0)"></up-icon>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="border-bottom u-p-b-30" v-if="discount.price||accountPoints.sel">
|
<view class="border-bottom u-p-b-30" v-if="(discount.price&&discount.currentPrice!=order.amount)||accountPoints.sel">
|
||||||
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
|
||||||
v-if="discount.price&&discount.currentPrice!=order.amount">
|
v-if="discount.price&&discount.currentPrice!=order.amount">
|
||||||
<view>服务员改价</view>
|
<view>服务员改价</view>
|
||||||
@@ -77,7 +84,7 @@
|
|||||||
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
||||||
<template v-if="pays.selIndex==0">
|
<template v-if="pays.selIndex==0">
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="item" @click="changePayType(index,item)"
|
<view class="item" @click="changePayType(index,item)" :class="{disabled:item.disabled}"
|
||||||
v-for="(item,index) in pays.payTypes.list" :key="index">
|
v-for="(item,index) in pays.payTypes.list" :key="index">
|
||||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
@@ -99,16 +106,18 @@
|
|||||||
<text>{{user.accountPoints||'0'}}</text>
|
<text>{{user.accountPoints||'0'}}</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<my-radio @click="changePayType(index,item)"
|
<view :class="{op3:item.disabled}">
|
||||||
:modelValue="index==pays.payTypes.selIndex">
|
<my-radio @click="changePayType(index,item)"
|
||||||
</my-radio>
|
:modelValue="index==pays.payTypes.selIndex">
|
||||||
|
</my-radio>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="border-bottom-dashed "></view>
|
<view class="border-bottom-dashed "></view>
|
||||||
<view class="u-flex u-row-between u-p-t-24" v-if="user.id&&user.accountPoints"
|
<view class="u-flex u-row-between u-p-t-24" v-if="user.id" @click="changeAccountPoints">
|
||||||
@click="changeAccountPoints">
|
|
||||||
<view class="u-flex ">
|
<view class="u-flex ">
|
||||||
<view class="">积分抵扣</view>
|
<view class="">积分抵扣</view>
|
||||||
<view class="color-999 u-m-l-10">
|
<view class="color-999 u-m-l-10">
|
||||||
@@ -120,9 +129,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
|
|
||||||
<view class="u-flex" @click.stop="refPointsOpen">
|
<view class="u-flex">
|
||||||
<view><text>{{accountPoints.num}}</text></view>
|
<view><text>{{accountPoints.num}}</text></view>
|
||||||
<view v-if="accountPoints.calcRes.usable">
|
<view v-if="accountPoints.calcRes.usable" @click.stop="refPointsOpen">
|
||||||
<up-icon name="edit-pen" size="16" color="#999"></up-icon>
|
<up-icon name="edit-pen" size="16" color="#999"></up-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -196,7 +205,12 @@
|
|||||||
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
|
||||||
:price="order.amount"></edit-discount>
|
:price="order.amount"></edit-discount>
|
||||||
|
|
||||||
<edit-accountPoints @confirm="pointsConfirm" :price="accountPoints.num" :accountPoints="accountPoints" ref="refPoints"></edit-accountPoints>
|
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
|
||||||
|
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||||
|
@cancel="confirmModelCancel" @close="confirmModelCancel" width="300px" />
|
||||||
|
|
||||||
|
<edit-accountPoints @confirm="pointsConfirm" :price="accountPoints.num" :accountPoints="accountPoints"
|
||||||
|
ref="refPoints"></edit-accountPoints>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -227,13 +241,49 @@
|
|||||||
import editDiscount from '@/components/my-components/edit-discount.vue'
|
import editDiscount from '@/components/my-components/edit-discount.vue'
|
||||||
import editAccountPoints from './components/edit-accountPoints.vue'
|
import editAccountPoints from './components/edit-accountPoints.vue'
|
||||||
import {
|
import {
|
||||||
returnGoodsPayPriceMap,returnProCoupStartIndex ,returnProductCoupAllPrice
|
returnGoodsPayPriceMap,
|
||||||
|
returnProCoupStartIndex,
|
||||||
|
returnProductCoupAllPrice,
|
||||||
|
returnProductCanUseNum
|
||||||
} from '../quan_util.js'
|
} from '../quan_util.js'
|
||||||
|
|
||||||
|
const modal = reactive({
|
||||||
|
title: '提示',
|
||||||
|
cancelText: '取消',
|
||||||
|
confirmText: '确认',
|
||||||
|
content: '',
|
||||||
|
key: 'cash',
|
||||||
|
show: false,
|
||||||
|
data: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
function confirmModelCancel() {
|
||||||
|
modal.show=false
|
||||||
|
modal.key=''
|
||||||
|
modal.data=''
|
||||||
|
}
|
||||||
|
|
||||||
|
function cashConfirmShow() {
|
||||||
|
modal.content = '是否确认已现金收款' + payPrice.value
|
||||||
|
modal.key='cash'
|
||||||
|
modal.show=true
|
||||||
|
}
|
||||||
|
async function confirmModelConfirm() {
|
||||||
|
if (modal.key == 'cash') {
|
||||||
|
await pay()
|
||||||
|
confirmModelCancel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//商品数量从0到n每一个对应的价格
|
//商品数量从0到n每一个对应的价格
|
||||||
let $goodsPayPriceMap={}
|
let $goodsPayPriceMap = {}
|
||||||
|
|
||||||
const refPoints = ref(null)
|
const refPoints = ref(null)
|
||||||
|
|
||||||
|
function delQuan(i) {
|
||||||
|
pays.quan.splice(i, 1)
|
||||||
|
}
|
||||||
|
|
||||||
function refPointsOpen() {
|
function refPointsOpen() {
|
||||||
if (!accountPoints.calcRes.usable && accountPoints.sel) {
|
if (!accountPoints.calcRes.usable && accountPoints.sel) {
|
||||||
return
|
return
|
||||||
@@ -251,8 +301,9 @@
|
|||||||
},
|
},
|
||||||
price: 0
|
price: 0
|
||||||
})
|
})
|
||||||
function pointsConfirm(e){
|
|
||||||
accountPoints.num=e
|
function pointsConfirm(e) {
|
||||||
|
accountPoints.num = e
|
||||||
}
|
}
|
||||||
async function calcUsablePoints() {
|
async function calcUsablePoints() {
|
||||||
if (!order.memberId) {
|
if (!order.memberId) {
|
||||||
@@ -308,7 +359,7 @@
|
|||||||
go.to('PAGES_ORDER_QUAN', {
|
go.to('PAGES_ORDER_QUAN', {
|
||||||
orderId: order.id,
|
orderId: order.id,
|
||||||
memberId: order.memberId,
|
memberId: order.memberId,
|
||||||
orderPrice: payPrice.value*1+coupAllPrice.value*1
|
orderPrice: payPrice.value * 1 + coupAllPrice.value * 1
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
async function discountShow() {
|
async function discountShow() {
|
||||||
@@ -395,29 +446,35 @@
|
|||||||
uni.$off('choose-quan')
|
uni.$off('choose-quan')
|
||||||
uni.$on('choose-quan', (arr) => {
|
uni.$on('choose-quan', (arr) => {
|
||||||
console.log(arr);
|
console.log(arr);
|
||||||
const manjianCoup = arr.filter(v => v.type == 1&&v.num>=1)
|
const manjianCoup = arr.filter(v => v.type == 1 && v.num >= 1)
|
||||||
let productCoup = arr.filter(v => v.type == 2&&v.num>=1)
|
let productCoup = arr.filter(v => v.type == 2)
|
||||||
console.log(productCoup);
|
console.log(productCoup);
|
||||||
//商品券分组
|
//商品券分组
|
||||||
let coupMap={}
|
let coupMap = {}
|
||||||
for(let i in productCoup){
|
for (let i in productCoup) {
|
||||||
const coup=productCoup[i]
|
const coup = productCoup[i]
|
||||||
if(coupMap.hasOwnProperty(coup.proId)){
|
if (coupMap.hasOwnProperty(coup.proId)) {
|
||||||
coupMap[coup.proId].push(coup)
|
coupMap[coup.proId].push(coup)
|
||||||
}else{
|
} else {
|
||||||
coupMap[coup.proId]=[coup]
|
coupMap[coup.proId] = [coup]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(let key in coupMap){
|
console.log(coupMap);
|
||||||
const arr=coupMap[key]
|
for (let key in coupMap) {
|
||||||
for(let i in arr){
|
const arr = coupMap[key]
|
||||||
const coup=arr[i]
|
for (let i in arr) {
|
||||||
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
|
const coup = arr[i]
|
||||||
const num=Math.min($goodsPayPriceMap[coup.proId].length,coup.num)
|
const proCoupStartIndex = returnProCoupStartIndex(arr, i)
|
||||||
coup.num=num
|
console.log(proCoupStartIndex);
|
||||||
coup.discountAmount=returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],proCoupStartIndex,num).toFixed(2)
|
const coupUseNum = returnProductCanUseNum($goodsPayPriceMap[coup.proId], proCoupStartIndex,
|
||||||
|
coup.num)
|
||||||
|
const num = Math.min($goodsPayPriceMap[coup.proId].length, coupUseNum)
|
||||||
|
coup.num = num
|
||||||
|
coup.discountAmount = returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],
|
||||||
|
proCoupStartIndex, num).toFixed(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
productCoup = productCoup.filter(v => v.num >= 1)
|
||||||
console.log(productCoup);
|
console.log(productCoup);
|
||||||
pays.quan = [...manjianCoup, ...productCoup]
|
pays.quan = [...manjianCoup, ...productCoup]
|
||||||
})
|
})
|
||||||
@@ -459,7 +516,7 @@
|
|||||||
|
|
||||||
//打折相关数据
|
//打折相关数据
|
||||||
const discount = reactive({
|
const discount = reactive({
|
||||||
|
discount: 100
|
||||||
})
|
})
|
||||||
|
|
||||||
function editDiscountConfirm(form) {
|
function editDiscountConfirm(form) {
|
||||||
@@ -470,10 +527,18 @@
|
|||||||
|
|
||||||
async function getPayType() {
|
async function getPayType() {
|
||||||
const payTypeList = await Api.$getPayType()
|
const payTypeList = await Api.$getPayType()
|
||||||
pays.payTypes.list = payTypeList
|
pays.payTypes.list = payTypeList.map(v => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
disabled: false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePayType(i, item) {
|
function changePayType(i, item) {
|
||||||
|
if (item.disabled) {
|
||||||
|
return infoBox.showToast(item.payName + '不可用')
|
||||||
|
}
|
||||||
pays.payTypes.selIndex = i
|
pays.payTypes.selIndex = i
|
||||||
if (item.payType == 'vipPay') {
|
if (item.payType == 'vipPay') {
|
||||||
chooseUser()
|
chooseUser()
|
||||||
@@ -501,6 +566,9 @@
|
|||||||
if (payType == 'scanCode' || payType == 'deposit') {
|
if (payType == 'scanCode' || payType == 'deposit') {
|
||||||
return saomaPay()
|
return saomaPay()
|
||||||
}
|
}
|
||||||
|
if (payType == 'cash' && payPrice.value * 1 > 0) {
|
||||||
|
return cashConfirmShow()
|
||||||
|
}
|
||||||
payOrder()
|
payOrder()
|
||||||
}
|
}
|
||||||
const tipsMap = {
|
const tipsMap = {
|
||||||
@@ -513,33 +581,39 @@
|
|||||||
infoBox.showToast('余额不足')
|
infoBox.showToast('余额不足')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payStatus) {
|
if (payStatus) {
|
||||||
return infoBox.showToast(tipsMap[payStatus])
|
return infoBox.showToast(tipsMap[payStatus])
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
payStatus = 'paying'
|
pay()
|
||||||
await Api.$payOrder({
|
|
||||||
tableId: order.tableId,
|
|
||||||
masterId: order.masterId,
|
|
||||||
orderId: order.id || order.orderId,
|
|
||||||
payType,
|
|
||||||
vipUserId: order.memberId,
|
|
||||||
discount: 1,
|
|
||||||
code: '',
|
|
||||||
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
|
||||||
userCouponInfos: pays.quan.map(v => {
|
|
||||||
return {
|
|
||||||
userCouponId: v.id,
|
|
||||||
num: v.num
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
paySuccess()
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//TODO handle the exception
|
//TODO handle the exception
|
||||||
payStatus = ''
|
payStatus = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async function pay(par) {
|
||||||
|
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||||
|
payStatus = 'paying'
|
||||||
|
await Api.$payOrder({
|
||||||
|
tableId: order.tableId,
|
||||||
|
masterId: order.masterId,
|
||||||
|
orderId: order.id || order.orderId,
|
||||||
|
payType,
|
||||||
|
vipUserId: order.memberId,
|
||||||
|
discount: discount.discount / 100,
|
||||||
|
code: '',
|
||||||
|
pointsNum: accountPoints.sel ? accountPoints.num : 0,
|
||||||
|
userCouponInfos: pays.quan.map(v => {
|
||||||
|
return {
|
||||||
|
userCouponId: v.id,
|
||||||
|
num: v.num
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
...par
|
||||||
|
})
|
||||||
|
paySuccess()
|
||||||
|
}
|
||||||
|
|
||||||
const order = reactive({
|
const order = reactive({
|
||||||
amount: 0
|
amount: 0
|
||||||
@@ -554,15 +628,7 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('条码类型:' + res.scanType);
|
console.log('条码类型:' + res.scanType);
|
||||||
console.log('条码内容:' + res.result);
|
console.log('条码内容:' + res.result);
|
||||||
Api.$payOrder({
|
pay({code: res.result})
|
||||||
"orderId": order.orderId, // 订单id
|
|
||||||
"payType": item.payType, //
|
|
||||||
"discount": order.discount,
|
|
||||||
"code": res.result
|
|
||||||
}).then(res => {
|
|
||||||
console.log(res);
|
|
||||||
paySuccess()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -584,7 +650,7 @@
|
|||||||
async function init() {
|
async function init() {
|
||||||
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
|
||||||
Object.assign(order, orderRes)
|
Object.assign(order, orderRes)
|
||||||
$goodsPayPriceMap=returnGoodsPayPriceMap(order.detailList)
|
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
|
||||||
console.log($goodsPayPriceMap);
|
console.log($goodsPayPriceMap);
|
||||||
if (orderRes.memberId) {
|
if (orderRes.memberId) {
|
||||||
calcUsablePoints()
|
calcUsablePoints()
|
||||||
@@ -616,8 +682,24 @@
|
|||||||
const calcPrice = discountPrice - coupAllPrice.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
const calcPrice = discountPrice - coupAllPrice.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
|
||||||
return (calcPrice <= 0 ? 0 : calcPrice).toFixed(2)
|
return (calcPrice <= 0 ? 0 : calcPrice).toFixed(2)
|
||||||
})
|
})
|
||||||
watch(() => payPrice.value, () => {
|
watch(() => payPrice.value, (newval) => {
|
||||||
getPayUrl()
|
getPayUrl()
|
||||||
|
if (newval <= 0) {
|
||||||
|
const arr = ['cash', 'vipPay']
|
||||||
|
pays.payTypes.list.map(v => {
|
||||||
|
if (arr.includes(v.payType)) {
|
||||||
|
v.disabled = false
|
||||||
|
} else {
|
||||||
|
v.disabled = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const index = pays.payTypes.list.findIndex(v => !v.disabled)
|
||||||
|
pays.payTypes.selIndex = index
|
||||||
|
} else {
|
||||||
|
pays.payTypes.list.map(v => {
|
||||||
|
v.disabled = false
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
const pointCanDicountPrice = computed(() => {
|
const pointCanDicountPrice = computed(() => {
|
||||||
const discountPrice = discount.currentPrice ? discount.currentPrice : order.amount
|
const discountPrice = discount.currentPrice ? discount.currentPrice : order.amount
|
||||||
@@ -645,6 +727,10 @@
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$quan-color: #318AFE;
|
$quan-color: #318AFE;
|
||||||
|
|
||||||
|
.op3 {
|
||||||
|
opacity: .3;
|
||||||
|
}
|
||||||
|
|
||||||
.hui {
|
.hui {
|
||||||
// background-color: $quan-color;
|
// background-color: $quan-color;
|
||||||
background-image: linear-gradient(to right bottom, rgb(254, 103, 4), rgb(241, 50, 42));
|
background-image: linear-gradient(to right bottom, rgb(254, 103, 4), rgb(241, 50, 42));
|
||||||
@@ -676,6 +762,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
|
.item {
|
||||||
|
&.disabled {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.item:last-child {
|
.item:last-child {
|
||||||
.border-bottom {
|
.border-bottom {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class=" u-m-t-20 u-flex">
|
<view class=" u-m-t-20 u-flex">
|
||||||
<view>有效期:</view>
|
<view>有效期:</view>
|
||||||
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}</view>
|
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-10 color-999 u-font-24">
|
<view class="u-m-t-10 color-999 u-font-24">
|
||||||
{{ formatStr(item.useRestrictions)}}
|
{{ formatStr(item.useRestrictions)}}
|
||||||
@@ -65,7 +66,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class=" u-m-t-14 u-flex">
|
<view class=" u-m-t-14 u-flex">
|
||||||
<view>有效期:</view>
|
<view>有效期:</view>
|
||||||
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}</view>
|
<view class="u-font-24 u-m-l-6"> {{dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-10 color-999 u-font-24">
|
<view class="u-m-t-10 color-999 u-font-24">
|
||||||
{{ formatStr(item.useRestrictions)}}
|
{{ formatStr(item.useRestrictions)}}
|
||||||
@@ -92,7 +94,7 @@
|
|||||||
|
|
||||||
<view :style="{height:safebottomHeight+'px'}"></view>
|
<view :style="{height:safebottomHeight+'px'}"></view>
|
||||||
<view class="fixed-b bottom safe-bottom border-top">
|
<view class="fixed-b bottom safe-bottom border-top">
|
||||||
|
|
||||||
<view class="u-m-b-32 u-flex u-row-between u-p-t-10">
|
<view class="u-m-b-32 u-flex u-row-between u-p-t-10">
|
||||||
<view class="u-flex">
|
<view class="u-flex">
|
||||||
<text>抵扣金额:</text>
|
<text>抵扣金额:</text>
|
||||||
@@ -103,7 +105,8 @@
|
|||||||
<text>支付金额:</text>
|
<text>支付金额:</text>
|
||||||
<text class="color-red">¥</text>
|
<text class="color-red">¥</text>
|
||||||
<text class="color-red">{{payPrice }}</text>
|
<text class="color-red">{{payPrice }}</text>
|
||||||
<view class="u-absolute u-flex u-row-between" style="bottom: 100%;right: 0;" v-if="payPrice*1!=option.orderPrice*1">
|
<view class="u-absolute u-flex u-row-between" style="bottom: 100%;right: 0;"
|
||||||
|
v-if="payPrice*1!=option.orderPrice*1">
|
||||||
<view class="u-flex line-th color-999">
|
<view class="u-flex line-th color-999">
|
||||||
<text class="">¥</text>
|
<text class="">¥</text>
|
||||||
<text class="">{{option.orderPrice}}</text>
|
<text class="">{{option.orderPrice}}</text>
|
||||||
@@ -229,13 +232,18 @@
|
|||||||
if (!item.use) {
|
if (!item.use) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log();
|
|
||||||
if (myQuan.fullReductionCouponSel.id && !item.checked) {
|
if (myQuan.fullReductionCouponSel.id && !item.checked) {
|
||||||
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
const goodsQuan = myQuan.res.productCoupon.filter(v => v.checked)
|
||||||
const fullReductionCoupon = myQuan.fullReductionCouponSel.id ? [myQuan.fullReductionCouponSel] : []
|
const fullReductionCoupon = myQuan.fullReductionCouponSel.id ? [myQuan.fullReductionCouponSel] : []
|
||||||
let coupArr = [...goodsQuan, item]
|
let coupArr = [...goodsQuan, item]
|
||||||
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
const payPrice = option.orderPrice - returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
||||||
console.log(payPrice);
|
if (payPrice<=0) {
|
||||||
|
modal.content = '选择该商品券后支付金额将为0,继续选择将取消选择的满减券'
|
||||||
|
modal.cancelText = '取消'
|
||||||
|
modal.confirmText = '继续选择'
|
||||||
|
setModalShow('clear', true, item)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (myQuan.fullReductionCouponSel.fullAmount > payPrice) {
|
if (myQuan.fullReductionCouponSel.fullAmount > payPrice) {
|
||||||
modal.content = '选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券'
|
modal.content = '选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券'
|
||||||
modal.cancelText = '取消'
|
modal.cancelText = '取消'
|
||||||
@@ -247,11 +255,18 @@
|
|||||||
|
|
||||||
item.checked = !item.checked
|
item.checked = !item.checked
|
||||||
const CheckedArr = myQuan.res.productCoupon.filter(v => v.checked)
|
const CheckedArr = myQuan.res.productCoupon.filter(v => v.checked)
|
||||||
|
if (CheckedArr.length <= 0) {
|
||||||
|
return myQuan.res.productCoupon.map(v => {
|
||||||
|
v.use = true
|
||||||
|
})
|
||||||
|
}
|
||||||
const noCheckedArr = myQuan.res.productCoupon.filter(v => !v.checked)
|
const noCheckedArr = myQuan.res.productCoupon.filter(v => !v.checked)
|
||||||
noCheckedArr.map(v => {
|
noCheckedArr.map(v => {
|
||||||
console.log(returnCoupCanUse(canDikouGoodsArr, v, CheckedArr));
|
console.log(returnCoupCanUse(canDikouGoodsArr, v, CheckedArr));
|
||||||
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeFullReductionCouponSel(item) {
|
function changeFullReductionCouponSel(item) {
|
||||||
@@ -263,10 +278,11 @@
|
|||||||
myQuan.fullReductionCouponSel = {
|
myQuan.fullReductionCouponSel = {
|
||||||
id: ''
|
id: ''
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
myQuan.fullReductionCouponSel = item
|
myQuan.fullReductionCouponSel = item
|
||||||
}
|
}
|
||||||
myQuan.res.fullReductionCoupon=returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan.fullReductionCouponSel)
|
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan
|
||||||
|
.fullReductionCouponSel)
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatStr(str) {
|
function formatStr(str) {
|
||||||
@@ -299,13 +315,21 @@
|
|||||||
memberId: option.memberId
|
memberId: option.memberId
|
||||||
})
|
})
|
||||||
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
|
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
|
||||||
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => v.use && option.orderPrice * 1 >= v
|
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => {
|
||||||
.fullAmount * 1)
|
if(option.orderPrice<=0){
|
||||||
|
return false
|
||||||
|
}else{
|
||||||
|
return v.use && option.orderPrice * 1 >= v
|
||||||
|
.fullAmount * 1
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
res.productCoupon = res.productCoupon.map(v => {
|
res.productCoupon = res.productCoupon.map(v => {
|
||||||
const calcCoup = returnProductCoupon(v, canDikouGoodsArr, user.value)
|
const calcCoup = returnProductCoupon(v, canDikouGoodsArr, user.value)
|
||||||
return {
|
return {
|
||||||
...calcCoup,
|
...calcCoup,
|
||||||
checked: false
|
checked: false,
|
||||||
|
use:option.orderPrice<=0?false:v.use
|
||||||
}
|
}
|
||||||
}).filter((v) => v.use);
|
}).filter((v) => v.use);
|
||||||
$fullReductionCoupon = res.fullReductionCoupon
|
$fullReductionCoupon = res.fullReductionCoupon
|
||||||
@@ -316,7 +340,7 @@
|
|||||||
const option = reactive({
|
const option = reactive({
|
||||||
orderId: '',
|
orderId: '',
|
||||||
memberId: '',
|
memberId: '',
|
||||||
orderPrice:0
|
orderPrice: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
function toEmitChooseQuan(item) {
|
function toEmitChooseQuan(item) {
|
||||||
@@ -339,13 +363,14 @@
|
|||||||
let coupArr = [...fullReductionCoupon, ...goodsQuan]
|
let coupArr = [...fullReductionCoupon, ...goodsQuan]
|
||||||
return returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
return returnCouponAllPrice(coupArr, canDikouGoodsArr, user.value)
|
||||||
})
|
})
|
||||||
const payPrice=computed(()=>{
|
const payPrice = computed(() => {
|
||||||
const pay= option.orderPrice-discountAmount.value
|
const pay = option.orderPrice - discountAmount.value
|
||||||
return (pay<0?0:pay).toFixed(2)
|
return (pay < 0 ? 0 : pay).toFixed(2)
|
||||||
})
|
})
|
||||||
watch(() => myQuan.types.sel, (newval) => {
|
watch(() => myQuan.types.sel, (newval) => {
|
||||||
if (newval == 0) {
|
if (newval == 0) {
|
||||||
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value, myQuan.fullReductionCouponSel)
|
myQuan.res.fullReductionCoupon = returnCanUseFullReductionCoupon($fullReductionCoupon, payPrice.value,
|
||||||
|
myQuan.fullReductionCouponSel)
|
||||||
}
|
}
|
||||||
if (newval == 1) {
|
if (newval == 1) {
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
|
|||||||
if (selCoupNumber >= findGoodsTotalNumber) {
|
if (selCoupNumber >= findGoodsTotalNumber) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return findGoodsTotalNumber < (coup.num + selCoupNumber) ? false : true
|
console.log(selCoupNumber,findGoodsTotalNumber);
|
||||||
|
return findGoodsTotalNumber < selCoupNumber ? false : true
|
||||||
}
|
}
|
||||||
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
|
||||||
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
|
||||||
@@ -101,6 +102,23 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num){
|
|||||||
return prve+curPrice
|
return prve+curPrice
|
||||||
},0)
|
},0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//返回商品券可抵扣的商品数量
|
||||||
|
export function returnProductCanUseNum(productPriceArr,startIndex,num){
|
||||||
|
console.log(productPriceArr);
|
||||||
|
console.log(num);
|
||||||
|
let n=0;
|
||||||
|
for(let i=0;i<num;i++){
|
||||||
|
if(productPriceArr[startIndex*1+i]){
|
||||||
|
n+=1
|
||||||
|
console.log(n);
|
||||||
|
}else{
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
//返回同类商品券在同类商品价格数组里的开始位置
|
//返回同类商品券在同类商品价格数组里的开始位置
|
||||||
export function returnProCoupStartIndex(coupArr,index){
|
export function returnProCoupStartIndex(coupArr,index){
|
||||||
return coupArr.slice(0,index).reduce((prve,cur)=>{
|
return coupArr.slice(0,index).reduce((prve,cur)=>{
|
||||||
@@ -201,9 +219,31 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
const isfullAmount = payPrice >= v.fullAmount * 1
|
const isfullAmount = payPrice >= v.fullAmount * 1
|
||||||
|
if(payPrice<=0){
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
use: false
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...v,
|
...v,
|
||||||
use: v.use && isfullAmount
|
use: v.use && isfullAmount
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
|
||||||
|
export function returnCanUseNumProductCoup(coupArr,){
|
||||||
|
let productCoup = coupArr.filter(v => v.type == 2)
|
||||||
|
//商品券分组
|
||||||
|
let coupMap={}
|
||||||
|
for(let i in productCoup){
|
||||||
|
const coup=productCoup[i]
|
||||||
|
if(coupMap.hasOwnProperty(coup.proId)){
|
||||||
|
coupMap[coup.proId].push(coup)
|
||||||
|
}else{
|
||||||
|
coupMap[coup.proId]=[coup]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arr
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user