更新代码

This commit is contained in:
GaoHao
2025-02-07 14:56:53 +08:00
parent 0740c3f349
commit 7519ffced3
12 changed files with 391 additions and 97 deletions

View File

@@ -4,6 +4,13 @@
<text class="">桌号</text>
<text class="">{{orderInfo.tableName||""}}</text>
</view>
<view class=" font-bold u-p-b-32 border-bottom u-m-b-24" v-if="orderInfo.tableName&&orderInfo.status=='unpaid'">
<view class="block" @tap="rotatingTables"
style="display: flex;align-items: center;justify-content: space-between;">
<view>转桌/并桌</view>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</view>
<view class=" color-999 border-bottom u-p-b-24">
<text></text>
<text class="color-333 "> {{goodsNumber}}</text>
@@ -180,7 +187,7 @@
<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>
@@ -347,57 +354,58 @@
}
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 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)
// 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 cantuiSeatFee=computed(()=>{
let seatFee=props.orderInfo.seatInfo?(props.orderInfo.seatInfo.priceAmount):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
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
return props.orderInfo.status == 'unpaid' ? item.priceAmount : item.priceAmount
if (props.orderInfo.status == 'unpaid') {
return returnTotalMoney(item)
} else {
if(props.orderInfo.pointsDiscountAmount>0||props.orderInfo.fullCouponDiscountAmount>0){
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{
} else {
return item.priceAmount
}
}
@@ -419,7 +427,7 @@
if (res) {
emits('tuikuan', {
...item,
priceAmount: item.canReturnAmount
priceAmount: item.priceAmount
}, index)
}
})
@@ -503,8 +511,8 @@
})
const youhuiAllPrice = computed(() => {
const n= props.orderInfo.originAmount-props.orderInfo.amount+vipDiscountPrice.value*1
return (n<0?0:n).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)
@@ -528,26 +536,53 @@
})
const allPrice = computed(() => {
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)
return a + (b.status == 'unpaid' ? b.priceAmount : b.status == 'return' ? 0 : b
.priceAmount * 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 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)
})
function rotatingTables() {
let arr = []
props.data.forEach(ele => {
ele.info.forEach(res => {
// 头像 coverImg
res.coverImg = res.productImg
// 名字 name
res.name = res.productName
// 金额 salePrice
res.salePrice = res.price
// 数量 number
res.number = res.num
res.masterId = props.orderInfo.masterId
res.useType = props.orderInfo.useType
res.tableId = props.orderInfo.tableId
arr.push(res)
})
})
uni.navigateTo({
url: '/pagesCreateOrder/confirm-order/rotatingTables?item=' + JSON.stringify(arr) + '&tableId=' + props
.orderInfo.tableId
})
}
const goodsNumber = computed(() => {
let result = 0
result = props.data.reduce((a, b) => {

View File

@@ -6,22 +6,23 @@
{{data.productName}}
</view>
<view class="u-flex u-m-t-32" :class="{'gray':data.productId=='-999'}">
<up-number-box :min="1" :max="data.num" :buttonSize="44" v-model="number" integer :disabled="data.productId=='-999'">
<up-number-box :min="0" :max="data.num" :buttonSize="44" v-model="number" integer
:disabled="data.productId=='-999'">
<template #minus>
<view class="minus number-box-btn">
</view>
</template>
<template #input>
<view class="u-flex-1 u-row-center u-text-center input">
<up-input
:disabled="data.productId=='-999'"
@change="parseIntNumber($event,false)" @blur="parseIntNumber($event,true)"
v-model="number" border="none" type="number"></up-input>
<up-input :disabled="data.productId=='-999'" @change="parseIntNumber($event,false)"
@blur="parseIntNumber($event,true)" v-model="number" border="none"
type="number"></up-input>
</view>
</template>
<template #plus>
<view class="plus number-box-btn">
<up-icon v-if="data.productId=='-999'" name="plus" color="#ccc" size="16" bold></up-icon>
<up-icon v-if="data.productId=='-999'" name="plus" color="#ccc" size="16"
bold></up-icon>
<up-icon v-else name="plus" color="#999" size="16" bold></up-icon>
</view>
</template>
@@ -50,8 +51,7 @@
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-10">
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
<view class="u-m-t-10">
<my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel"
box-shadow>取消</my-button>
<my-button @tap="onModelClose" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
</view>
</view>
@@ -71,7 +71,7 @@
type: Object,
default: () => {
return {
productId:'-999'
productId: '-999'
}
}
},
@@ -86,7 +86,7 @@
const emits = defineEmits(['update:show', 'confirm'])
let model = ref(null)
let modelShow = ref(props.show)
let number = ref(1)
let number = ref(0)
const tags = ref([{
label: "点错",
checked: false
@@ -103,16 +103,18 @@
let timer = null
function parseIntNumber(val, isNow) {
console.log(val);
let newval = parseInt(val)
let newval = val * 1
if (newval > props.data.num) {
newval = props.data.num
}
if (newval < 1) {
newval = 1
// 判断是否是称重商品。如果是可以输入小数
if (props.data.isWeight != 1) {
if (newval < 1) {
newval = 1
}
}
if (isNow) {
number.value = parseInt(newval)
number.value = newval * 1
return
}
timer = setTimeout(() => {
@@ -138,10 +140,10 @@
function toggleModelShow(show) {
modelShow.value = show ? true : false
}
function onModelClose() {
number.value=1
number.value = 1
modelShow.value = false
}
@@ -151,17 +153,17 @@
function open() {
model.value.open()
if(props.data.productId=='-999'){
number.value=props.data.num
if (props.data.productId == '-999') {
number.value = props.data.num
}
}
function close() {
model.value.close()
tags.value.map(v=>{
v.checked=false
tags.value.map(v => {
v.checked = false
})
form.note=''
form.note = ''
}
function confirm() {
@@ -206,12 +208,14 @@
::v-deep .uni-input-input {
text-align: center;
}
.gray{
.minus::after{
.gray {
.minus::after {
border-color: #ccc;
}
}
.minus {
&::after {
content: '';

View File

@@ -94,7 +94,7 @@
}
async function onSeatFeeTuiKuan(seatFee) {
console.log(seatFee);
console.log(seatFee,'调试1');
const canTuikuan=await hasTuiKuan()
if(!canTuikuan){
return
@@ -124,19 +124,22 @@
}
function onTuiCai(goods, index) {
console.log(goods);
tuicai.show = true
tuicai.selGoods = goods
}
async function tuicaiConfirm(e) {
console.log(tuicai.selGoods);
const res = await Api.$returnCart({
...e,
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
tableId: orderDetail.info.tableId,
})
tuicai.show = false
if(res){
go.back()
}else{
init()
}
}
@@ -171,7 +174,7 @@
if(!canTuikuan){
return
}
console.log(goods);
console.log(goods,'debug');
const {
id,
productId,
@@ -307,6 +310,7 @@
}))
console.log(orderDetail.goodsList);
}
console.log(res,'debug121')
orderDetail.info = res
}