This commit is contained in:
YeMingfei666 2024-11-27 15:09:36 +08:00
commit 38eec83e83
16 changed files with 1039 additions and 168 deletions

View File

@ -17,9 +17,8 @@ export function canTuicai(orderInfo, item) {
return orderInfo.status == 'unpaid' && orderInfo.useType != 'dine-in-before' && item.status != 'return'
}
export function canTuiKuan(orderInfo, item) {
// 已完成的订单,也不是商品券抵扣才可以退款
return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status !=
'refunding' && !item.userCouponId
'refunding'
}
export function isTuiCai(item) {
return item.status == 'return'

View File

@ -69,10 +69,14 @@
price: {
type: [Number,String],
default: 0
},
nowPrice:{
type: [Number,String],
default: 0
}
})
function currentPriceInput(newval){
form.discount=(newval*100/form.price).toFixed()
form.discount=(newval*100/form.price)
}
function discountInput(newval){
form.currentPrice=(form.price*newval/100).toFixed(2)
@ -126,8 +130,8 @@
function open() {
model.value.open()
form.price=props.price
form.currentPrice=props.price
form.discount=props.discount
form.currentPrice=(props.discount*props.price/100).toFixed(2)
}
function close() {

View File

@ -23,7 +23,7 @@ let baseUrl = 'https://admintestpapi.sxczgkj.cn'
// let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn'
//正式
// let baseUrl = 'https://cashieradmin.sxczgkj.cn'
let baseUrl = 'https://cashieradmin.sxczgkj.cn'
// 王伟本地测
// let baseUrl = '/ww'

View File

@ -1,23 +1,23 @@
<template>
<view class="boxconstant">
<view class="boxconstantbox"
style="border-radius: 18px 18px 0 0;padding:32rpx 24rpx 0 24rpx;border-bottom: 2rpx solid #E5E5E5;">
style="border-radius: 18px 18px 0 0;padding:32rpx 24rpx;border-bottom: 2rpx solid #E5E5E5;">
<view class="boxconstantbox_one">
充值设置
</view>
<view class="boxconstantbox_tow">
<text>用户消费结账时成功充值</text>
<input class="number" v-model="form.rechargeTimes"></input>
<input class="text" type="number" v-model="form.rechargeTimes" />
<text>倍的金额本单即可享受免单</text>
</view>
</view>
<view class="boxconstantbox" style="padding:32rpx 24rpx 0 24rpx; border-radius: 0 0 18px 18px;">
<view class="boxconstantbox" style="border-radius: 0 0 18px 18px;">
<view class="boxconstantbox_one">
充值门槛
</view>
<view class="boxconstantbox_tow">
<text>订单支付金额需满</text>
<input class="number" v-model="form.rechargeThreshold"></input>
<input class="text" type="number" v-model="form.rechargeThreshold"></input>
<text> 才能使用</text>
</view>
</view>
@ -28,11 +28,11 @@
<up-switch v-model="form.enable" size="18"></up-switch>
</view>
<view class="boxconstantbox"
style="margin-top:24rpx; padding:32rpx 24rpx 0 24rpx; border-radius: 0 0 18px 18px;">
style="margin-top:24rpx; padding:32rpx 24rpx; border-radius: 0 0 18px 18px;">
<view class="boxconstantbox_one">
充值说明
</view>
<view class="boxconstantbox_tow">
<view>
<up-textarea v-model="form.rechargeDesc" placeholder="请输入内容"></up-textarea>
</view>
</view>
@ -71,7 +71,7 @@
useTypeList: [],
childShopIdList: '',
});
const getlist = async () => {
let res = await get()
console.log(res)
@ -83,9 +83,9 @@
title: '保存成功'
})
Object.assign(form, res)
setTimeout(()=>{
setTimeout(() => {
uni.navigateBack()
},1500)
}, 1500)
}
onShow(() => {
getlist()
@ -113,21 +113,22 @@
}
.boxconstantbox_tow {
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
padding-bottom: 24rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
box-sizing: border-box;
// display: flex;
// justify-content: flex-start;
// align-items: center;
// flex-wrap: wrap;
// align-content: flex-start;
.text {
display:inline-flex;
text-align: center;
margin: 0 12rpx;
width: 118rpx;
height: 48rpx;
line-height: 48rpx;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #E5E5E5;

View File

@ -8,9 +8,9 @@
</view>
</view>
<view class="item">
<view class="lable">使用门槛</view>
<view class="lable">使用门槛2</view>
<view class="value">
<view></view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元</view><view>减</view><input v-model="formData.discountAmount" placeholder="填写金额" border="none"></input><view></view>
<view></view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>元</view><view>减</view><input v-model="formData.discountAmount" type="number" placeholder="填写金额" border="none"></input><view></view>
</view>
</view>
</view>
@ -35,13 +35,15 @@
<view class="item">
<view class="lable">有效期</view>
<view class="value">
<up-input v-model="formData.validDays" placeholder="填写天数" border="none"></up-input>
<up-input v-model="formData.validDays" type="number" placeholder="填写天数" border="none"></up-input>
</view>
</view>
<view class="item">
<view class="lable">隔天生效<up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon></view>
<view class="lable">隔天生效
<!-- <up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view>
<view class="value">
<view></view><input v-model="formData.daysToTakeEffect" placeholder="填写天数" border="none" ></input><view>天生效</view>
<view></view><input v-model="formData.daysToTakeEffect" type="number" placeholder="填写天数" border="none" ></input><view>天生效</view>
</view>
</view>
<view class="item">
@ -79,7 +81,7 @@
<view class="card">
<view class="item">
<view class="lable">总发放数量
<up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon>
<!-- <up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view>
<view class="value">
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
@ -311,6 +313,7 @@
height: 150rpx;
width: 100%;
background-color: #fff;
z-index: 9;
>button {
width: 530rpx;
margin: 30rpx 0;

View File

@ -10,13 +10,13 @@
<view class="item">
<view class="lable">使用门槛</view>
<view class="value">
<view></view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>可用</view>
<view></view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>可用</view>
</view>
</view>
<view class="item">
<view class="lable">总发放数量</view>
<view class="value">
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
<up-input v-model="formData.number" type="number" placeholder="填写数量" border="none" clearable ></up-input>
</view>
</view>
</view>

View File

@ -36,10 +36,10 @@
<view v-if="item.type == 1"> {{ item.fullAmount }} 元减 {{ item.discountAmount }} </view>
<view v-if="item.type == 2"> {{ item.fullAmount }} 元可用 </view>
</view>
<view>
<!-- <view>
<view> 领取方式 </view>
<view> 用户不可自行领取 </view>
</view>
</view> -->
<view v-if="item.type == 1">
<view> 有效期 </view>
<view> 领券后{{ item.validDays }}天过期 </view>
@ -197,7 +197,7 @@
padding: 32rpx 28rpx;
background-color: #fff;
position: fixed;
top: 79rpx;
top: 0rpx;
z-index: 999;
.tag-item {
display: inline-block;
@ -253,7 +253,7 @@
/* height: 544rpx; */
margin: 32rpx auto 0;
margin-bottom: 32rpx;
padding: 122rpx 28rpx 182rpx 28rpx;
padding: 70rpx 28rpx 182rpx 28rpx;
}
.couponContent {
/* background-color: #f9f9f9; */

View File

@ -120,7 +120,6 @@
<view class="constantboxitem" v-for="(item,index) in tableData.data" :key="index"
@click="toDetail(item)">
<view class="head">{{item.dutyId|| '无'}}</view>
<view class="head">班次</view>
<view class="head">{{item.staffName || '无'}}</view>
<view class="head">{{item.startTime|| '无'}}</view>
<view class="head">{{item.endTime|| '无'}}</view>

View File

@ -1,5 +1,6 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="packeFee>0||data.priceAmount>0">
<view class="default-box-padding bg-fff border-r-12 u-m-t-20"
v-if="packeFee>0||data.priceAmount>0||data.returnAmount>0">
<view class="u-flex u-row-between">
<view class="font-bold">附加费</view>
<template v-if="extraCanTuicai(orderInfo,data)">
@ -14,7 +15,7 @@
<view class="u-flex u-row-between u-m-t-24" v-if="data.priceAmount*1>0">
<view>{{data.productName||'餐位费'}}</view>
<view>x{{data.num||0}}</view>
<view class="price-min-width">{{data.priceAmount}}</view>
<view class="price-min-width">{{seatFeePrice}}</view>
</view>
</template>
<template v-else>
@ -24,7 +25,8 @@
<view class="tag yitui u-m-l-10">{{data.status=='refunding'?'退款中': '已退'}}</view>
</view>
<view class="line-th">x{{data.num||0}}</view>
<view class="line-th">{{data.priceAmount}}</view>
<view class="line-th">{{seatFeePrice}}</view>
<!-- <view class="line-th">{{data.priceAmount||data.returnAmount}}</view> -->
</view>
</template>
<!-- <view class="u-flex u-row-right u-m-t-24">
@ -50,19 +52,30 @@
computed
} from 'vue'
import {
returnCanComputedGoodsArr,canComputedPackFee,
returnPackFee
returnCanComputedGoodsArr,
canComputedPackFee,
returnPackFee,isTui,
isTuiCai,
isGift,
canTuiKuan,
canTuicai,
numSum
} from '@/commons/utils/goodsUtil.js'
const props = defineProps({
data: {
type: Object,
default: () => {}
default: () => {
return {
priceAmount: 0,
returnAmount: 0,
}
}
},
orderInfo: {
type: Object,
default: () => {
return {
amount: 0,
detailList: []
}
}
@ -72,11 +85,34 @@
default: () => {}
}
})
function extraCanTuicai(orderInfo,data){
return orderInfo.status=='unpaid'&&data.status!='return'&&data.priceAmount*1>0
const canTuiKuanPrice = computed(() => {
return props.orderInfo.detailList.filter(v =>!isTui(v)&& !v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
})
const seatFeePrice = computed(() => {
const item = props.data
if (props.data.returnAmount) {
return props.data.returnAmount
}
console.log(item);
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
return item.canReturnAmount
// const shengyuKeTui=canTuiKuanPrice.value
// const bili = Math.floor((item.priceAmount / shengyuKeTui) * 100) / 100
// return Math.floor((props.orderInfo.amount-props.orderInfo.refundAmount) * bili * 100) / 100
} else {
return item.priceAmount
}
})
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
function extraCanTuiKuan(orderInfo, data) {
return orderInfo.status == 'closed' && data.status != 'refund' && data.priceAmount * 1 > 0
}
const packeNumbber = computed(() => {
if (!props.orderInfo.detailList) {
@ -105,7 +141,7 @@
}
function tuikuan() {
emits('tuikuan', props.data)
emits('tuikuan', {...props.data,priceAmount:props.data.canReturnAmount})
}
function tuicai() {

View File

@ -0,0 +1,548 @@
<template>
<view class="default-box-padding bg-fff border-r-24 u-m-t-32" v-if="data.length">
<view class=" font-bold u-p-b-32 border-bottom u-m-b-24" v-if="orderInfo.tableName">
<text class="">桌号</text>
<text class="">{{orderInfo.tableName||""}}</text>
</view>
<view class=" color-999 border-bottom u-p-b-24">
<text></text>
<text class="color-333 "> {{goodsNumber}}</text>
<text>份菜品</text>
</view>
<view class="u-m-b-20 " v-for="(order,orderIndex) in data" :key="orderIndex">
<view class="u-p-t-24"> {{ order.placeNum }}次下单
</view>
<view class="u-m-t-24 list">
<view class="item u-m-b-32" v-for="(item,index) in order.info" :key="index">
<view class="u-flex u-col-top">
<view class="u-flex">
<image class="img" :src="item.coverImg||item.productImg" mode=""></image>
</view>
<view class="u-p-l-32 u-flex-1">
<view class="u-flex u-row-between u-col-top">
<view class="">
<view class="u-flex">
<view class="tui" v-if="isTui(item)">
{{item.status=='refunding'?'退款中':'已退'}}
</view>
<view
:class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">
{{item.name||item.productName}}
</view>
</view>
<view class="u-flex u-m-t-8">
<view class="u-m-r-20 u-flex " v-if="item.gift">
<uni-tag text="赠送"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
</uni-tag>
</view>
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
<uni-tag :text=" productCouponDikou(item)"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
</uni-tag>
</view>
<view class="u-m-r-20 u-flex" v-if="item.pack">
<uni-tag
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
size="small" text="打包" inverted type="success" />
</view>
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
<view class="color-666">退款金额:</view>
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
</view>
</view>
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
<view class="u-m-t-12 color-666 u-font-24" v-if="item.note">
备注{{item.note}}
</view>
</view>
<view class="u-text-right u-m-t-28">
<template v-if="isTui(item)">
<view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
</view>
</template>
<template v-else-if="isGift(item)||item.userCouponId">
<view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
</view>
</template>
<template v-else>
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
<view>{{returnCanTuiMoney(item)}}</view>
<view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view>
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
</template>
<!-- <template
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<view>{{returnVipMoney(item)}}</view>
<view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view>
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
</template> -->
</template>
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
</view>
</view>
</view>
</view>
<template v-if="canTuicai(orderInfo,item)">
<view class="u-flex u-row-right gap-20 u-m-t-24">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
class="no-wrap">退菜</text></my-button>
</view>
</template>
<template v-if="canTuiKuan(orderInfo,item)">
<view class="u-flex u-row-right gap-20 u-m-t-20">
<my-button :width="128" :height="48" plain shape="circle" @tap="tuikuan(item,index)"><text
class="no-wrap">{{item.userCouponId?'退券':'退款' }}</text> </my-button>
</view>
</template>
</view>
</view>
<!-- <view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
<view>备注</view>
<view class="u-m-t-10">{{orderInfo.remark}}</view>
</view> -->
</view>
<view class="u-m-t-32">
<view class="u-flex u-row-between border-top u-p-t-32">
<view>
<template v-if="orderInfo.status=='unpaid'">
<view class="tag no-pay">
未支付
</view>
</template>
<template v-if="orderInfo.status=='refund'">
<view class="tag refund">
退款成功
</view>
</template>
</view>
<view class="u-flex">
<view class="u-flex u-m-r-24" v-if="youhuiAllPrice>0">
<view class="color-red u-m-r-6 ">
已优惠{{youhuiAllPrice}}
</view>
<up-icon name="info-circle" color="#999" :size="14" @click="youhuiDetailShow"></up-icon>
</view>
<view>
<text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text>
</view>
</view>
</view>
<template v-if="orderInfo.refundAmount">
<view class="u-flex u-row-between u-m-t-32">
<view>退款金额</view>
<view class="color-999">
<text class="">{{(orderInfo.refundAmount).toFixed(2)}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32">
<view>退款原因</view>
<view class="color-999">
<text class="">{{orderInfo.refundRemark||''}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32 u-p-b-24 border-bottom">
<view></view>
<view class="">
<text class="">退款成功</text>
</view>
</view>
</template>
<view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
<text>总计</text>
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
<view></view>
<view>
<text>实付</text>
<text class="font-bold u-font-32">{{to2(orderInfo.amount) }}</text>
</view>
</view>
<!-- <view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
<text>原价</text>
<text class="font-bold u-font-32">{{to2(orderInfo.originAmount||0) }}</text>
</view>
</view> -->
<view class="u-m-t-24">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view>
</view>
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
<view class="u-p-30" style="width: 80vw;">
<view class="font-bold u-text-center">优惠详情</view>
<view class="u-m-t-32">
<view class="u-flex u-row-between u-m-b-18" v-if="vipDiscountPrice*1>0">
<view>会员优惠</view>
<view class="color-red">
<text></text>
<text>{{vipDiscountPrice}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-b-18" v-if="discountAmount">
<view>打折</view>
<view class="color-red">
<text></text>
<text>{{to2(discountAmount) }}</text>
</view>
</view>
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
<view>满减券抵扣</view>
<view class="color-red">
<text></text>
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-18" v-if="productCouponDiscountAmount*1>0">
<view>商品券抵扣</view>
<view class="color-red">
<text></text>
<text> {{productCouponDiscountAmount }}</text>
</view>
</view>
<!-- <view class="u-flex u-row-between u-m-t-18"
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
<view>商品券抵扣</view>
<view class="color-red">
<text></text>
<text> {{to2(orderInfo.productCouponDiscountAmount||productCoupPrice) }}</text>
</view>
</view> -->
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
<view>积分抵扣</view>
<view class="color-red">
<text></text>
<text>{{to2(orderInfo.pointsDiscountAmount) }}</text>
</view>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script setup>
import {
computed,
reactive
} from 'vue';
import color from '@/commons/color.js'
import {
hasPermission
} from '@/commons/utils/hasPermission.js'
import {
isTui,
isTuiCai,
isGift,
canTuiKuan,
canTuicai,
numSum
} from '@/commons/utils/goodsUtil.js'
const pop = reactive({
youhui: false
})
function youhuiDetailShow() {
pop.youhui = true
}
function productCouponDikou(item) {
return '商品券抵扣¥' + returnProductCoupPrice(item)
}
function youhuiDetailHide() {
pop.youhui = false
}
const props = defineProps({
orderInfo: {
type: Object,
default: () => {}
},
data: {
type: Array,
default: () => []
},
seatFee: {
type: Object,
default: () => {}
},
user: {
type: Object,
default: () => {
return {
id: '',
isVip: false
}
}
}
})
function returnProductCoupPrice(item) {
if (!item.isMember) {
return item.price * item.num
}
const price = item.memberPrice ? item.memberPrice : item.price
return price * item.num
}
const productCouponDiscountAmount = computed(() => {
// if(props.orderInfo.productCouponDiscountAmount){
// return orderInfo.productCouponDiscountAmount.toFixed(2)
// }
if (!props.data.length) {
return 0
}
const n = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.userCouponId).reduce((a, b) => {
return a + returnProductCoupPrice(b)
}, 0)
return prve + curTotal
}, 0)
console.log(n);
return n.toFixed(2)
})
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function returnVipMoney(item) {
if (!item.memberPrice || !props.user.isVip) {
return 0
}
return (item.memberPrice * item.num).toFixed(2)
}
function returnTotalMoney(item) {
return (item.price * item.num).toFixed(2)
}
const canTuiKuanPrice = computed(() => {
return props.data.reduce((prve,cur)=>{
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal=cur.info.filter(v=>canTuiKuan(props.orderInfo,v)&&!v.userCouponId).reduce((a,b)=>{
return a+b.priceAmount*1
},0)
return prve+curTotal
},0)
})
function returnCanTuiMoney(item) {
console.log(canTuiKuanPrice.value);
if(props.orderInfo.status=='unpaid'){
return returnTotalMoney(item)
}else{
return (item.priceAmount/(canTuiKuanPrice.value+seatFeePrice.value*1)*props.orderInfo.amount).toFixed(2)
}
}
function to2(n) {
if (!n) {
return 0
}
return n.toFixed(2)
}
function tuicai(item, index) {
emits('tuicai', item, index)
}
function tuikuan(item, index) {
hasPermission('允许退款').then(res => {
if (res) {
emits('tuikuan', {...item,priceAmount:returnCanTuiMoney(item)}, index)
}
})
}
function printOrder() {
emits('printOrder')
}
const seatFeePrice = computed(() => {
if (!props.seatFee.priceAmount) {
return 0
}
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
return n.toFixed(2)
})
const discountAmount = computed(() => {
if (props.orderInfo.discountAmount) {
return props.orderInfo.discountAmount
}
console.log(props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio));
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
})
const goodsOriginAllPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.reduce((a,
b) => {
return a + (b.num * b.price)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
b) => {
const price = (b.isMember && b.memberPrice) ? b.memberPrice : b.price
return a + (b.num * price)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const vipDiscountPrice = computed(() => {
if (!props.user.isVip) {
return 0
}
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && (v.isMember &&
v.memberPrice) && (v.memberPrice != v.price)).reduce((
a,
b) => {
return a + (b.num * (b.price - b.memberPrice))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const productCoupPrice = computed(() => {
if (props.orderInfo.status == 'closed') {
return props.orderInfo.productCouponDiscountAmount
}
const goodsPrice = props.data.reduce((a, b) => {
const curTotal = b.info.filter(v => v.gift != true && v.userCouponId).reduce((prve,
cur) => {
const isVip = props.user.isVip && cur.isMember
const memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
const price = isVip ? memberPrice : cur.price
const curTotal = price * cur.num
return prve + curTotal
}, 0)
return a + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const youhuiAllPrice = computed(() => {
return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
.orderInfo.pointsDiscountAmount + (props.orderInfo.status == 'unpaid' ? productCoupPrice.value :
productCouponDiscountAmount.value) * 1 + (props.orderInfo.discountAmount ||
0)).toFixed(2)
})
const packFee = computed(() => {
//退
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.status !== "return").reduce((a,
b) => {
return a + b.packAmount
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const allPrice = computed(() => {
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
return (n < 0 ? 0 : n).toFixed(2)
// if (props.orderInfo.status == 'unpaid') {
// const n = goodsOriginAllPrice.value - youhuiAllPrice.value
// return (n < 0 ? 0 : n).toFixed(2)
// }
// return props.orderInfo.amount
})
const goodsNumber = computed(() => {
let result = 0
result = props.data.reduce((a, b) => {
const bTotal = b.info.reduce((prve, cur) => {
return prve + (cur.number || cur.num) * 1;
}, 0);
return a + bTotal
}, 0)
return result
})
</script>
<style lang="scss" scoped>
.img {
width: 152rpx;
height: 152rpx;
border-radius: 6px;
}
.border-top {
border-color: #F6F6F6;
}
.border-r-24 {
border-radius: 24rpx;
}
.border-bottom {
// border-color: rgb(240, 240, 240);
border-color: #F6F6F6;
}
.line-th {
text-decoration: line-through;
}
.tag {
padding: 4rpx 8rpx 2rpx 10rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.no-pay {
background-color: rgb(170, 170, 170);
color: #fff;
}
&.refund {
background-color: #FCE7E7;
padding: 8rpx 20rpx 6rpx 22rpx;
color: #EB4F4F;
}
}
.tui {
background-color: rgb(239, 239, 239);
border-radius: 4rpx;
margin-right: 6rpx;
color: #666;
padding: 0 4rpx;
font-size: 20rpx;
}
</style>

View File

@ -38,7 +38,7 @@
</uni-tag>
</view>
<view class="u-m-r-20 u-flex " v-if="item.userCouponId">
<uni-tag text="商品券抵扣"
<uni-tag :text=" productCouponDikou(item)"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
</uni-tag>
</view>
@ -47,6 +47,10 @@
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
size="small" text="打包" inverted type="success" />
</view>
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnAmount">
<view class="color-666">退款金额:</view>
<view class="color-999 u-m-l-6">{{item.returnAmount}}</view>
</view>
</view>
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
@ -58,7 +62,7 @@
<view class="u-text-right u-m-t-28">
<template v-if="isTui(item)">
<view>0.00</view>
<view class="line-th color-666 " >{{returnTotalMoney(item)}}
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
</view>
</template>
<template v-else-if="isGift(item)||item.userCouponId">
@ -67,7 +71,15 @@
</view>
</template>
<template v-else>
<template
<template v-if="returnCanTuiMoney(item)*1!=returnTotalMoney(item)*1">
<view>{{returnCanTuiMoney(item)}}</view>
<view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view>
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
</template>
<!-- <template
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<view>{{returnVipMoney(item)}}</view>
<view class=" color-666 line-th">
@ -75,7 +87,7 @@
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
</template>
</template> -->
</template>
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
</view>
@ -92,7 +104,7 @@
<template v-if="canTuiKuan(orderInfo,item)">
<view class="u-flex u-row-right gap-20 u-m-t-20">
<my-button :width="128" :height="48" plain shape="circle" @tap="tuikuan(item,index)"><text
class="no-wrap">退款</text> </my-button>
class="no-wrap">{{item.userCouponId?'退券':'退款' }}</text> </my-button>
</view>
</template>
@ -124,9 +136,8 @@
<view class="color-red u-m-r-6 ">
已优惠{{youhuiAllPrice}}
</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>
<text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text>
@ -157,11 +168,34 @@
</template>
<view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
<text>总计</text>
<text class="font-bold u-font-32">{{to2(allPrice*1+seatFeePrice*1+packFee*1) }}</text>
</view>
<template v-if="orderInfo.status=='unpaid'">
<view>
<text>总计</text>
<text class="font-bold u-font-32">{{orderInfo.amount }}</text>
</view>
</template>
<template v-else>
<view>
<text>总计</text>
<text class="font-bold u-font-32">{{orderInfo.amount}}</text>
</view>
</template>
</view>
<!-- <view class="u-flex u-row-between u-m-t-20" v-if="orderInfo.status=='closed'">
<view></view>
<view>
<text>实付</text>
<text class="font-bold u-font-32">{{to2(orderInfo.amount) }}</text>
</view>
</view> -->
<!-- <view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
<text>原价</text>
<text class="font-bold u-font-32">{{to2(orderInfo.originAmount||0) }}</text>
</view>
</view> -->
<view class="u-m-t-24">
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
</view>
@ -170,18 +204,18 @@
<view class="u-p-30" style="width: 80vw;">
<view class="font-bold u-text-center">优惠详情</view>
<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" v-if="vipDiscountPrice*1>0">
<view>会员优惠</view>
<view class="color-red">
<text></text>
<text>{{vipDiscountPrice}}</text>
</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 u-m-b-18" v-if="discountAmount">
<view>打折</view>
<view class="color-red">
<text></text>
<text>{{to2(orderInfo.discountAmount) }}</text>
<text>{{to2(discountAmount) }}</text>
</view>
</view>
<view class="u-flex u-row-between " v-if="orderInfo.fullCouponDiscountAmount*1>0">
@ -191,14 +225,21 @@
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
</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="productCouponDiscountAmount*1>0">
<view>商品券抵扣</view>
<view class="color-red">
<text></text>
<text> {{productCouponDiscountAmount }}</text>
</view>
</view>
<!-- <view class="u-flex u-row-between u-m-t-18"
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice*1>0">
<view>商品券抵扣</view>
<view class="color-red">
<text></text>
<text> {{to2(orderInfo.productCouponDiscountAmount||productCoupPrice) }}</text>
</view>
</view>
</view> -->
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.pointsDiscountAmount">
<view>积分抵扣</view>
<view class="color-red">
@ -238,6 +279,10 @@
pop.youhui = true
}
function productCouponDikou(item) {
return '商品券抵扣¥' + returnProductCoupPrice(item)
}
function youhuiDetailHide() {
pop.youhui = false
}
@ -264,6 +309,30 @@
}
}
})
function returnProductCoupPrice(item) {
if (!item.isMember) {
return item.price * item.num
}
const price = item.memberPrice ? item.memberPrice : item.price
return price * item.num
}
const productCouponDiscountAmount = computed(() => {
// if(props.orderInfo.productCouponDiscountAmount){
// return orderInfo.productCouponDiscountAmount.toFixed(2)
// }
if (!props.data.length) {
return 0
}
const n = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.userCouponId).reduce((a, b) => {
return a + returnProductCoupPrice(b)
}, 0)
return prve + curTotal
}, 0)
console.log(n);
return n.toFixed(2)
})
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function returnVipMoney(item) {
@ -277,6 +346,63 @@
return (item.price * item.num).toFixed(2)
}
const canTuiKuanPrice = computed(() => {
const goodsTotal= props.data.reduce((prve, cur) => {
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal = cur.info.filter(v => !isTui(v)&& !v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
console.log(goodsTotal);
console.log(seatFeePrice.value);
return (goodsTotal+seatFeePrice.value*1).toFixed(2)
})
const TuiKuanPrice = computed(() => {
return props.data.reduce((prve, cur) => {
// const curTotal=cur.info.filter(v=>!v.userCouponId).reduce((a,b)=>{
// return a+b.priceAmount*1
// },0)
const curTotal = cur.info.filter(v => isTui(v)&&!v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
})
const noTuiKuanPrice=computed(()=>{
return props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => !isTui(v)&&!v.userCouponId)
.reduce((a, b) => {
return a + b.priceAmount * 1
}, 0)
return prve + curTotal
}, 0)
})
const cantuiSeatFee=computed(()=>{
let seatFee=props.orderInfo.seatInfo?(props.orderInfo.seatInfo.priceAmount):0
const bili = Math.floor((seatFee / canTuiKuanPrice.value) * 100) / 100
seatFee= Math.floor((props.orderInfo.amount-props.orderInfo.refundAmount) * bili * 100) / 100
return seatFee
})
function returnCanTuiMoney(item) {
return props.orderInfo.status == 'unpaid'? item.priceAmount: item.canReturnAmount
if (props.orderInfo.status == 'unpaid') {
return returnTotalMoney(item)
} else {
if(props.orderInfo.pointsDiscountAmount>0||props.orderInfo.fullCouponDiscountAmount>0){
return item.canReturnAmount
// const bili=Math.floor((item.priceAmount/canTuiKuanPrice.value )*100)/100
// return Math.floor((allPrice.value)*bili*100)/100
}else{
return item.priceAmount
}
}
}
function to2(n) {
if (!n) {
return 0
@ -291,7 +417,10 @@
function tuikuan(item, index) {
hasPermission('允许退款').then(res => {
if (res) {
emits('tuikuan', item, index)
emits('tuikuan', {
...item,
priceAmount: item.canReturnAmount
}, index)
}
})
}
@ -308,6 +437,13 @@
const n = props.seatFee.priceAmount * (isTui(props.seatFee) ? 0 : 1)
return n.toFixed(2)
})
const discountAmount = computed(() => {
if (props.orderInfo.discountAmount) {
return props.orderInfo.discountAmount
}
console.log(props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio));
return (props.orderInfo.originAmount * (1 - props.orderInfo.discountRatio))
})
const goodsOriginAllPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.reduce((a,
@ -319,6 +455,8 @@
return goodsPrice.toFixed(2)
})
const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
@ -335,8 +473,8 @@
return 0
}
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((
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && (v.isMember &&
v.memberPrice) && (v.memberPrice != v.price)).reduce((
a,
b) => {
return a + (b.num * (b.price - b.memberPrice))
@ -365,17 +503,22 @@
})
const youhuiAllPrice = computed(() => {
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 n= props.orderInfo.originAmount-props.orderInfo.amount+vipDiscountPrice.value*1
return (n<0?0:n).toFixed(2)
// if(props.orderInfo.status!='unpaid'){
// const seatfee=(props.orderInfo.amount==0&&allPrice.value==0)?seatFeePrice.value:0
// return (goodsOriginAllPrice.value-allPrice.value+seatfee*1).toFixed(2)
// }
// return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
// .orderInfo.pointsDiscountAmount + (props.orderInfo.status == 'unpaid' ? productCoupPrice.value :
// productCouponDiscountAmount.value) * 1 + (props.orderInfo.discountAmount ||
// 0)).toFixed(2)
})
const packFee = computed(() => {
//退
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return").reduce((a,
const curTotal = cur.info.filter(v => v.status !== "return").reduce((a,
b) => {
return a + b.packAmount
}, 0)
@ -385,8 +528,24 @@
})
const allPrice = computed(() => {
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
return (n < 0 ? 0 : n).toFixed(2)
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.reduce((a,
b) => {
return a +(props.orderInfo.status == 'unpaid'?b.priceAmount:b.canReturnAmount*1)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
if (props.orderInfo.status == 'unpaid') {
const n = goodsOriginAllPrice.value - youhuiAllPrice.value
return (n < 0 ? 0 : n).toFixed(2)
}
const returnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.returnAmount?props.orderInfo.seatInfo.returnAmount:0
const canReturnAmount=props.orderInfo.seatInfo&&props.orderInfo.seatInfo.canReturnAmount?props.orderInfo.seatInfo.canReturnAmount:0
const total=props.orderInfo.amount-(returnAmount?returnAmount:canReturnAmount)
return (total<=0?0:total).toFixed(2)
})
const goodsNumber = computed(() => {

View File

@ -9,6 +9,11 @@
:user="user"
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
<!-- <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount"> -->
<!-- <view class="default-box-padding bg-fff border-r-12 u-m-t-20 u-flex u-row-between" v-if="orderDetail.info.discountAmount>0">
<view>服务员改价</view>
<view class="color-red">-{{orderDetail.info.discountAmount}}</view>
</view> -->
<template v-if="true">
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
:data="orderDetail.seatFee"></extra-vue>
@ -177,7 +182,7 @@
orderId,
num,
priceAmount,
price
price,userCouponId
} = goods
go.to('PAGES_ORDER_TUIKUAN', {
id,
@ -190,7 +195,8 @@
number: 0,
productSkuName: productSkuName || '',
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
price
price,
userCouponId:userCouponId?userCouponId:''
})
}

View File

@ -1,7 +1,7 @@
<template>
<view class="bg-gray min-page u-p-30 u-font-28">
<view class="u-p-t-60 u-p-b-60 u-text-center">
<template v-if="order.amount!=payPrice">
<template v-if="originPrice!=payPrice">
<view class="u-font-32 ">
<text class="price-fuhao"></text>
<!-- <text class="font-bold price">{{discount.currentPrice?discount.currentPrice:order.amount}}</text> -->
@ -9,7 +9,7 @@
</view>
<view class="u-m-t-10 color-999 old-price">
<text class=""></text>
<text class=" ">{{order.amount}}</text>
<text class=" ">{{originPrice}}</text>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="discountShow">修改</view>
@ -18,7 +18,7 @@
<template v-else>
<view class="u-font-32 ">
<text class="price-fuhao"></text>
<text class="font-bold price">{{order.amount}}</text>
<text class="font-bold price">{{originPrice}}</text>
</view>
<view class="u-m-t-10 u-flex u-row-center color-main">
<view @click="discountShow">修改</view>
@ -27,8 +27,17 @@
</view>
<view class="content bg-fff border-r-12">
<view class=" u-p-t-30 u-p-l-26 u-p-r-26 card top u-m-t-30">
<view class="border-bottom-dashed u-p-b-30">
<view class="u-p-l-26 u-p-r-26 card top u-m-t-30">
<view class="border-bottom-dashed u-p-b-30 u-p-t-30" v-if="vipDiscount*1>0">
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between ">
<view>会员优惠</view>
<view class="color-red">
-{{vipDiscount}}
</view>
</view>
</view>
<view class="border-bottom-dashed u-p-b-30 u-p-t-30">
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between " @click="toQuan">
<view>优惠券</view>
<view class="color-999 u-flex u-col-center">
@ -61,12 +70,11 @@
</view>
<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 "
v-if="discount.price&&discount.currentPrice!=order.amount">
<view class="border-bottom u-p-b-30" v-if="discount.value||accountPoints.sel">
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 " v-if="discount.value">
<view>服务员改价</view>
<view class=" u-flex u-col-center">
<text style="color: rgb(255, 95, 46);">-{{to2(order.amount- discount.currentPrice)}}</text>
<text style="color: rgb(255, 95, 46);">-{{to2(discount.value)}}</text>
</view>
</view>
<view class="u-flex u-p-l-24 u-p-r-24 u-row-between u-p-t-30 "
@ -92,7 +100,8 @@
<text class="u-m-l-10 no-wrap">{{item.payName}}</text>
</view>
<view class="u-flex color-999 u-font-24">
<view class="u-m-r-20" v-if="item.payType=='vipPay'&&user.id">
<view class="u-m-r-20" v-if="item.payType=='vipPay'&&user.id"
@click.stop="chooseUser">
<view>
<text>会员</text>
<text class="u-m-r-4">{{user.telephone||user.nickName}}</text>
@ -202,8 +211,9 @@
<edit-discount @confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
:price="order.amount"></edit-discount>
<edit-discount :nowPrice="order.amount-productCouponDiscountAmount-fullCouponDiscountAmount"
@confirm="editDiscountConfirm" title="优惠金额" :ref="setModel" name="editMoney"
:price="order.amount-productCouponDiscountAmount" :discount="discount.discount"></edit-discount>
<up-modal :title="modal.title" :content="modal.content" :show="modal.show" :confirmText="modal.confirmText"
:cancelText="modal.cancelText" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
@ -211,6 +221,7 @@
<edit-accountPoints @confirm="pointsConfirm" :price="accountPoints.num" :accountPoints="accountPoints"
ref="refPoints"></edit-accountPoints>
</view>
</template>
@ -258,20 +269,36 @@
})
function confirmModelCancel() {
modal.show=false
modal.key=''
modal.data=''
if (modal.key == 'fullCoupon') {
//
discount.discount = 100
discount.value = 0
}
confirmModelClose()
}
function confirmModelClose() {
modal.show = false
modal.key = ''
modal.data = ''
}
function cashConfirmShow() {
modal.content = '是否确认已现金收款' + payPrice.value
modal.key='cash'
modal.show=true
modal.key = 'cash'
modal.show = true
}
async function confirmModelConfirm() {
if (modal.key == 'cash') {
await pay()
confirmModelCancel()
return
}
if (modal.key == 'fullCoupon') {
//
const index = pays.quan.findIndex(v => v.type == 1)
pays.quan.splice(index, 1)
return
}
}
@ -305,13 +332,14 @@
function pointsConfirm(e) {
accountPoints.num = e
}
async function calcUsablePoints() {
async function calcUsablePoints(orderAmount) {
if (!order.memberId) {
return
}
console.log(orderAmount);
const res = await Api.$calcUsablePoints({
memberId: order.memberId,
orderAmount: pointCanDicountPrice.value
orderAmount: orderAmount ? orderAmount : payPrice.value
})
accountPoints.calcRes = res
accountPoints.num = res.maxUsablePoints
@ -319,16 +347,22 @@
}
watch(() => accountPoints.sel, (newval) => {
if (newval) {
calcUsablePoints()
calcDeDuctionPoints()
}
})
async function calcDeDuctionPoints() {
if (accountPoints.num <= 0) {
accountPoints.price = 0
return ''
}
const res = await Api.$calcDeDuctionPoints({
memberId: order.memberId,
orderAmount: order.amount,
orderAmount: originPrice.value,
points: accountPoints.num
})
accountPoints.price = res
if (res) {
accountPoints.price = res
}
return res
}
watch(() => accountPoints.num, (newval) => {
@ -359,7 +393,7 @@
go.to('PAGES_ORDER_QUAN', {
orderId: order.id,
memberId: order.memberId,
orderPrice: payPrice.value * 1 + coupAllPrice.value * 1
orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2)
})
}
async function discountShow() {
@ -398,7 +432,7 @@
if (!n) {
return ''
}
return n.toFixed(2)
return Number(n).toFixed(2)
}
const pays = reactive({
list: ['扫码收款', '二维码收款'],
@ -431,6 +465,7 @@
uni.$off('choose-user')
uni.$on('choose-user', (data) => {
console.log(data);
pays.quan = []
setUser({
vipUserId: data.id ? data.id : '',
type: data.id ? 0 : 1 //0 1
@ -442,41 +477,52 @@
})
}
function setQuan(arr) {
console.log(arr);
discount.discount = 100
discount.value = 0
discount.currentPrice = order.amount
const manjianCoup = arr.filter(v => v.type == 1 && v.num >= 1)
let productCoup = arr.filter(v => v.type == 2)
console.log(productCoup);
//
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]
}
}
console.log(coupMap);
for (let key in coupMap) {
const arr = coupMap[key]
for (let i in arr) {
const coup = arr[i]
const proCoupStartIndex = returnProCoupStartIndex(arr, i)
console.log(proCoupStartIndex);
const coupUseNum = returnProductCanUseNum($goodsPayPriceMap[coup.proId], proCoupStartIndex,
coup.num)
const num = Math.min($goodsPayPriceMap[coup.proId].length, coupUseNum)
coup.num = num
console.log($goodsPayPriceMap[coup.proId]);
const findGoods = order.detailList.find(v => v.productId == coup.proId)
const isMember = findGoods.isMember
coup.discountAmount = returnProductCoupAllPrice($goodsPayPriceMap[coup.proId],
proCoupStartIndex, num, isMember).toFixed(2)
}
}
productCoup = productCoup.filter(v => v.num >= 1)
console.log(productCoup);
pays.quan = [...manjianCoup, ...productCoup]
console.log(pays.quan);
}
function watchChooseQuan() {
uni.$off('choose-quan')
uni.$on('choose-quan', (arr) => {
console.log(arr);
const manjianCoup = arr.filter(v => v.type == 1 && v.num >= 1)
let productCoup = arr.filter(v => v.type == 2)
console.log(productCoup);
//
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]
}
}
console.log(coupMap);
for (let key in coupMap) {
const arr = coupMap[key]
for (let i in arr) {
const coup = arr[i]
const proCoupStartIndex = returnProCoupStartIndex(arr, i)
console.log(proCoupStartIndex);
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);
pays.quan = [...manjianCoup, ...productCoup]
setQuan(arr)
})
}
@ -516,12 +562,26 @@
//
const discount = reactive({
discount: 100
discount: 100,
currentPrice: 0,
value: 0
})
function editDiscountConfirm(form) {
console.log(form);
Object.assign(discount, form)
accountPoints.sel = false
Object.assign(discount, {
...form,
value: form.price - form.currentPrice
})
const fullCoupon = pays.quan.find(v => v.type == 1)
if (fullCoupon && form.currentPrice < fullCoupon.fullAmount) {
modal.content = '改价后价格不满足满减券最低满减需求' + fullCoupon.fullAmount + '元'
modal.key = 'fullCoupon'
modal.show = true
modal.cancelText = '取消改价'
modal.confirmText = '删除满减券'
}
getPayUrl()
}
@ -540,7 +600,7 @@
return infoBox.showToast(item.payName + '不可用')
}
pays.payTypes.selIndex = i
if (item.payType == 'vipPay') {
if (item.payType == 'vipPay' && !user.value.id) {
chooseUser()
}
}
@ -581,7 +641,7 @@
infoBox.showToast('余额不足')
return
}
if (payStatus) {
return infoBox.showToast(tipsMap[payStatus])
}
@ -628,7 +688,9 @@
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
pay({code: res.result})
pay({
code: res.result
})
}
});
}
@ -651,9 +713,19 @@
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
Object.assign(order, orderRes)
$goodsPayPriceMap = returnGoodsPayPriceMap(order.detailList)
console.log($goodsPayPriceMap);
const hasSelQuan = orderRes.couponInfoList ? JSON.parse(orderRes.couponInfoList) : {
fullReductionCoupon: [],
productCoupon: []
};
const fullReductionCoupon = hasSelQuan.fullReductionCoupon.filter(v => v.type == 1)
const productCoupon = hasSelQuan.productCoupon.filter(v => v.type == 2)
setQuan([...fullReductionCoupon, ...productCoupon])
if (orderRes.memberId) {
calcUsablePoints()
if (orderRes.pointsNum) {
accountPoints.sel = true
}
queryAllShopUser({
id: orderRes.memberId
}).then(res => {
@ -673,14 +745,48 @@
})
}
const coupAllPrice = computed(() => {
return pays.quan.reduce((prve, cur) => {
const n = pays.quan.reduce((prve, cur) => {
return prve + cur.discountAmount * 1
}, 0)
return n
})
const payPrice = computed(() => {
// const discountPrice = discount.currentPrice ? discount.currentPrice : order.amount
// const calcPrice = discountPrice - coupAllPrice.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
// return (calcPrice <= 0 ? 0 : calcPrice).toFixed(2)
const total = (originPrice.value) - vipDiscount.value - productCouponDiscountAmount.value - discount
.value -
fullCouponDiscountAmount.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
return (total < 0 ? 0 : total).toFixed(2)
})
const vipDiscount = computed(() => {
if (!user.value.isVip) {
return 0
}
const goodsPrice = order.detailList.filter(v => v.gift != true && v.status !== "return" && (v.isMember &&
v.memberPrice) && (v.memberPrice != v.price)).reduce((
a,
b) => {
return a + (b.num * (b.price - b.memberPrice))
}, 0)
return goodsPrice.toFixed(2)
})
const originPrice = computed(() => {
const n = (order.amount || 0) * 1 + vipDiscount.value * 1 + (order.fullCouponDiscountAmount || 0) + (order
.productCouponDiscountAmount || 0) +
(order.pointsDiscountAmount || 0)
return n.toFixed(2)
})
const fullCouponDiscountAmount = computed(() => {
return pays.quan.filter(v => v.type == 1).reduce((prve, cur) => {
return prve + cur.discountAmount * 1
}, 0)
})
const payPrice = computed(() => {
const discountPrice = discount.currentPrice ? discount.currentPrice : order.amount
const calcPrice = discountPrice - coupAllPrice.value - accountPoints.price * (accountPoints.sel ? 1 : 0)
return (calcPrice <= 0 ? 0 : calcPrice).toFixed(2)
const productCouponDiscountAmount = computed(() => {
return pays.quan.filter(v => v.type == 2).reduce((prve, cur) => {
return prve + cur.discountAmount * 1
}, 0)
})
watch(() => payPrice.value, (newval) => {
getPayUrl()
@ -702,9 +808,9 @@
}
})
const pointCanDicountPrice = computed(() => {
const discountPrice = discount.currentPrice ? discount.currentPrice : order.amount
const calcPrice = discountPrice - coupAllPrice.value
return (calcPrice <= 0 ? 0 : calcPrice).toFixed(2)
const total = (order.amount || 0) - productCouponDiscountAmount.value - discount.value -
fullCouponDiscountAmount.value
return (total < 0 ? 0 : total).toFixed(2)
})
watch(() => pointCanDicountPrice.value, (newval) => {
calcUsablePoints()

View File

@ -14,7 +14,7 @@
<view class="sel u-abso" v-if="item.id==myQuan.fullReductionCouponSel.id ">
<up-icon name="checkbox-mark" color="#fff"></up-icon>
</view>
<view class="u-p-t-32 u-p-b-32 u-p-l-24 u-p-r-24">
<view class="u-p-t-32 u-p-b-32 u-p-l-24 u-p-r-24 left">
<view class="u-flex">
<view class="hui"></view>
<view class="u-m-l-18">{{item.name}}</view>
@ -315,12 +315,15 @@
memberId: option.memberId
})
canDikouGoodsArr = returnNewGoodsList(order.value.detailList || [])
res.fullReductionCoupon = res.fullReductionCoupon.filter((v) => {
res.fullReductionCoupon = res.fullReductionCoupon.map((v) => {
if(option.orderPrice<=0){
return false
return {...v,use:false}
}else{
return v.use && option.orderPrice * 1 >= v
.fullAmount * 1
return{
...v,
use:v.use && option.orderPrice * 1 >= v
.fullAmount * 1
}
}
})
@ -527,7 +530,9 @@
border-radius: 10rpx;
box-shadow: 0 0 5px #eee;
overflow: hidden;
.left{
max-width: 80%;
}
.sel {
padding: 2rpx 4rpx;
position: absolute;

View File

@ -91,11 +91,12 @@ export function returnProductPayPrice(goods,vipUser){
return price
}
//返回商品券抵扣的商品价格
export function returnProductCoupAllPrice(productPriceArr,startIndex,num){
export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMember=true){
console.log(productPriceArr);
return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{
let curPrice=0
if(typeof cur==='object'){
curPrice=cur.memberPrice*1
curPrice=isMember?cur.memberPrice*1:cur.price
}else{
curPrice=cur*1
}

View File

@ -20,7 +20,7 @@
</view>
<template v-if="option.productId=='-999'">
<view class="u-flex">
<view class="color-red">{{item.priceAmount}}</view>
<view class="color-red" >{{item.priceAmount}}</view>
<view class="u-flex u-m-l-32 u-col-center">
<view class="u-m-l-28 u-m-r-28">x{{item.number}}</view>
</view>
@ -28,7 +28,7 @@
</template>
<template v-else>
<view class="u-flex">
<view class="color-red">{{item.priceAmount}}</view>
<view class="color-red" v-if="!option.userCouponId">{{item.priceAmount}}</view>
<view class="u-flex u-m-l-32 u-col-center">
<up-icon @click="changeItem(item,-1)" :size="20" name="minus-circle"></up-icon>
<view class="u-m-l-28 u-m-r-28">{{item.number}}</view>
@ -39,21 +39,24 @@
</template>
</view>
</view>
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
<view>支付金额</view>
<view>
{{to2(totalPrice)}}
<template v-if="!option.userCouponId">
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
<view>支付金额</view>
<view>
{{to2(totalPrice)}}
</view>
</view>
</view>
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between">
<view>退款金额</view>
<view class="color-red">
{{to2(tuikuanPrice)}}
<view class="bg-fff u-m-t-32 u-p-24 border-r-12 u-flex u-row-between" >
<view>退款金额</view>
<view class="color-red">
{{to2(tuikuanPrice)}}
</view>
</view>
</view>
</template>
<view class="bg-fff u-p-24 border-r-12 u-m-t-32">
<view>退回优惠券</view>
<view class="u-font-24 color-999 u-m-t-16">
<view class="u-font-24 color-999 u-m-t-16" v-if="!option.userCouponId">
该订单未使用优惠券
</view>
</view>
@ -143,7 +146,8 @@
})
const tuikuanPrice = computed(() => {
return orderDetail.goodsList.reduce((prve, cur) => {
return prve + cur.number * cur.price
const n=(cur.number/cur.num*100) * cur.priceAmount
return prve + (n/100).toFixed(2)
}, 0)
})