update
This commit is contained in:
@@ -29,14 +29,7 @@
|
||||
<!-- <view class="line-th">¥{{data.priceAmount||data.returnAmount}}</view> -->
|
||||
</view>
|
||||
</template>
|
||||
<!-- <view class="u-flex u-row-right u-m-t-24">
|
||||
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'&&data.status!='return'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
</template>
|
||||
</view> -->
|
||||
|
||||
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24" v-if="packeFee>0">
|
||||
@@ -112,7 +105,7 @@
|
||||
}
|
||||
|
||||
function extraCanTuiKuan(orderInfo, data) {
|
||||
return orderInfo.status == 'closed' && data.status != 'refund' && data.priceAmount * 1 > 0
|
||||
return orderInfo.status == 'done' && data.status != 'refund' && data.priceAmount * 1 > 0
|
||||
}
|
||||
const packeNumbber = computed(() => {
|
||||
if (!props.orderInfo.detailList) {
|
||||
|
||||
@@ -4,19 +4,29 @@
|
||||
<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>
|
||||
<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-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>
|
||||
|
||||
<image v-if="item.isTemporary == 0" class="img" :src="item.coverImg||item.productImg" mode=""></image>
|
||||
<view v-else style="background-color: #3f9eff; width: 152rpx;height: 152rpx;line-height: 152rpx;text-align: center;color: #fff;" >
|
||||
临时菜
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-p-l-32 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
@@ -24,70 +34,77 @@
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="isTui(item)">
|
||||
{{item.status=='refunding'?'退款中':'已退'}}
|
||||
{{item.status=='part_refund'?'部分已退':'全部已退'}}
|
||||
</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 class="u-flex u-m-t-8" style="flex-direction: column;align-items: flex-start;">
|
||||
<view class="u-flex u-m-b-8">
|
||||
<view class="u-m-r-20 u-flex" v-if="item.isGift">
|
||||
<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.packNumber > 0">
|
||||
<uni-tag
|
||||
custom-style="background-color: #E6F0FF; border-color: #E6F0FF; color: #318AFE;"
|
||||
size="small" text="打包" inverted type="success" />
|
||||
</view>
|
||||
</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 class="u-flex u-m-t-8">
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.refundNum>0">
|
||||
<view class="color-666">退款金额:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.refundNum*item.unitPrice}}</view>
|
||||
</view>
|
||||
<view class="u-m-r-20 u-font-24 u-flex" v-if="item.returnNum">
|
||||
<view class="color-666">退菜数量:</view>
|
||||
<view class="color-999 u-m-l-6">{{item.returnNum}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{item.productSkuName||''}}</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">{{item.skuName||''}}</view>
|
||||
|
||||
|
||||
<view class="u-m-t-12 color-666 u-font-24" v-if="item.note">
|
||||
备注:{{item.note}}
|
||||
<view class="u-m-t-12 color-666 u-font-24" v-if="item.remark">
|
||||
备注:{{item.remark}}
|
||||
</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 v-if="item.refundNum>0||item.returnNum>0">
|
||||
<view>¥{{mathFloorPrice( parseFloat(mathFloorPrice(item.num*item.unitPrice,item)) - (parseFloat(mathFloorPrice(item.returnNum*item.unitPrice,item)) + parseFloat(mathFloorPrice(item.refundNum*item.unitPrice,item))))}}</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 v-else-if="item.couponNum > 0">
|
||||
<view>¥{{mathFloorPrice((item.num-item.couponNum)*item.unitPrice,item)}}</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else-if="item.discountSaleAmount > 0">
|
||||
<view>¥{{mathFloorPrice(item.num*item.discountSaleAmount,item)}}</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}</view>
|
||||
</template>
|
||||
<template v-else-if="isVip == 1">
|
||||
<view>¥{{mathFloorPrice((item.memberPrice?item.num*item.memberPrice:item.num*item.price),item)}}</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>¥{{returnTotalMoney(item)}}</view>
|
||||
<view class=" color-666 line-th">
|
||||
¥{{returnTotalMoney(item)}}</view>
|
||||
¥{{returnCanTuiMoney(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>
|
||||
@@ -95,28 +112,29 @@
|
||||
</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> -->
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.returnNum*item.unitPrice<item.num*item.unitPrice">
|
||||
<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">
|
||||
<template v-if="seatFeePrice&&seatFeePrice>0">
|
||||
<view class="u-flex u-row-between border-top u-p-t-32 u-p-b-32 u-col-top">
|
||||
<view class="no-wrap u-m-r-32">桌位费</view>
|
||||
<view>{{seatFeePrice||'0.00'}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="allPpackFee&&allPpackFee>0">
|
||||
<view class="u-flex u-row-between border-top u-p-t-32 u-p-b-32 u-col-top">
|
||||
<view class="no-wrap u-m-r-32">打包费</view>
|
||||
<view>{{allPpackFee||'0.00'}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-row-between border-top u-p-t-32">
|
||||
<view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
@@ -132,25 +150,26 @@
|
||||
</view>
|
||||
|
||||
<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="discountsPrice>0">
|
||||
<view class="color-red u-m-r-6 ">
|
||||
已优惠¥{{youhuiAllPrice}}
|
||||
已优惠¥{{discountsPrice}}
|
||||
</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>
|
||||
<text>小计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</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>
|
||||
<text class="">{{mathFloorPrice(orderInfo.refundAmount)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32">
|
||||
@@ -166,38 +185,32 @@
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="canTuiKuan(orderInfo)">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
||||
<my-button :width="168" :height="48" plain shape="circle" @tap="tuikuan(data,index)"><text
|
||||
class="no-wrap">全部退款</text> </my-button>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
|
||||
<view></view>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.amount }}</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{orderInfo.amount}}</text>
|
||||
<text class="font-bold u-font-32">{{mathFloorPrice(orderInfo.payAmount)}}</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 class="u-m-t-24" v-if="orderInfo.status == 'unpaid'||orderInfo.status == 'done'">
|
||||
<my-button @tap="printOrder" type="cancel" :color="$utils.ColorMain">重新打印</my-button>
|
||||
</view>
|
||||
</view>
|
||||
<up-popup :round="10" :show="pop.youhui" mode="center" closeOnClickOverlay @close="youhuiDetailHide">
|
||||
@@ -211,8 +224,15 @@
|
||||
<text>{{vipDiscountPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-b-18" v-if="discountSaleAmount">
|
||||
<view>单品打折</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{ discountSaleAmount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-b-18" v-if="discountAmount">
|
||||
<view>打折</view>
|
||||
<view>服务改价优惠 </view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text>{{to2(discountAmount) }}</text>
|
||||
@@ -225,21 +245,13 @@
|
||||
<text>{{to2(orderInfo.fullCouponDiscountAmount) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-18" v-if="productCouponDiscountAmount*1>0">
|
||||
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.productCouponDiscountAmount*1>0">
|
||||
<view>商品券抵扣</view>
|
||||
<view class="color-red">
|
||||
<text>¥</text>
|
||||
<text> {{productCouponDiscountAmount }}</text>
|
||||
<text> {{to2(orderInfo.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">
|
||||
@@ -255,37 +267,15 @@
|
||||
</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'
|
||||
import { computed, reactive } from 'vue';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { isTui, isTuiCai, isGift, canTuiKuan, canTuicai, mathFloorPrice } from '@/commons/utils/goodsUtil.js'
|
||||
|
||||
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||
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,
|
||||
@@ -309,7 +299,194 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 计算菜品数量
|
||||
*/
|
||||
const goodsNumber = computed(() => {
|
||||
let result = 0
|
||||
result = props.data.reduce((a, b) => {
|
||||
const bTotal = b.info.length
|
||||
return a + bTotal
|
||||
}, 0)
|
||||
return result.toFixed(0)
|
||||
})
|
||||
|
||||
/**
|
||||
* 桌位费
|
||||
*/
|
||||
const seatFeePrice = computed(() => {
|
||||
const n = props.orderInfo.seatNum > 0 ? props.orderInfo.seatNum*uni.getStorageSync('shopInfo').tableFee : 0
|
||||
return n.toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 判断是否是会员
|
||||
*/
|
||||
const isVip = computed(() => {
|
||||
return uni.getStorageSync('shopInfo').isMemberPrice && props.user && props.user.id && props.user.isVip
|
||||
})
|
||||
|
||||
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 (!isVip.value) {
|
||||
return 0
|
||||
}
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.discountSaleAmount <= 0 && v.isGift != 1 && v.status !== "return" && (v.price != v.unitPrice) && (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 discountSaleAmount = computed(() => {
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.discountSaleAmount > 0 && v.isGift != 1 && v.status !== "return" ).reduce(( a, b) => {
|
||||
return a + (b.num * (b.price - b.discountSaleAmount))
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 打折优惠
|
||||
*/
|
||||
const discountAmount = computed(() => {
|
||||
return props.orderInfo.discountAmount||0
|
||||
})
|
||||
|
||||
/**
|
||||
* 总优惠金额
|
||||
*/
|
||||
const discountsPrice = computed(() => {
|
||||
|
||||
// 满减券优惠
|
||||
let fullCouponDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.fullCouponDiscountAmount : 0
|
||||
// 商品券优惠
|
||||
let productCouponDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.productCouponDiscountAmount : 0
|
||||
// 积分抵扣优惠
|
||||
let pointsDiscountAmount = props.orderInfo.status == 'done' ? props.orderInfo.pointsDiscountAmount : 0
|
||||
return (parseFloat(vipDiscountPrice.value) + parseFloat(discountSaleAmount.value) + discountAmount.value + fullCouponDiscountAmount + productCouponDiscountAmount + pointsDiscountAmount).toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
// 菜品金额
|
||||
const productCoupPrice = computed(() => {
|
||||
if (props.orderInfo.status == 'done') {
|
||||
return props.orderInfo.productCouponDiscountAmount
|
||||
}
|
||||
const goodsPrice = props.data.reduce((a, b) => {
|
||||
const curTotal = b.info.filter(v => !v.isGift).reduce((prve, cur) => {
|
||||
let memberPrice = cur.memberPrice ? cur.memberPrice : cur.price
|
||||
let tPrice = (isVip.value ? memberPrice : cur.price)
|
||||
tPrice = cur.memberPrice != cur.unitPrice&& cur.price != cur.unitPrice ? cur.unitPrice : tPrice
|
||||
let Total = Math.floor(tPrice * cur.num * 100) / 100
|
||||
|
||||
return prve + Total - (cur.returnNum*tPrice) - (cur.refundNum*cur.unitPrice)
|
||||
}, 0)
|
||||
return a + curTotal
|
||||
}, 0)
|
||||
// console.log("菜品金额==",goodsPrice)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
const allPpackFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.packNumber > 0).reduce((a,
|
||||
b) => {
|
||||
return a + parseFloat(b.packAmount*b.packNumber).toFixed(2)*1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
const packFee = computed(() => {
|
||||
//不是退菜只要有打包费的都计算,包括赠送
|
||||
const goodsPrice = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => v.status !== "return" && (v.returnNum+v.refundNum < v.num)).reduce((a,
|
||||
b) => {
|
||||
return a + parseFloat((b.packAmount*(b.num-(b.returnNum+b.refundNum)>b.packNumber?b.packNumber:b.num-(b.returnNum+b.refundNum))).toFixed(2))
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
})
|
||||
|
||||
|
||||
const allPrice = computed(() => {
|
||||
let seatAmount = props.orderInfo.seatAmount || 0
|
||||
const total = productCoupPrice.value*1 + seatAmount*1 + packFee.value*1
|
||||
return (total <= 0 ? 0 : total).toFixed(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 已优惠金额
|
||||
*/
|
||||
const youhuiAllPrice = computed(() => {
|
||||
const n = vipDiscountPrice.value * 1
|
||||
return (n < 0 ? 0 : n).toFixed(2)
|
||||
})
|
||||
|
||||
function youhuiDetailShow() {
|
||||
pop.youhui = true
|
||||
}
|
||||
|
||||
function productCouponDikou(item) {
|
||||
return '商品券抵扣¥' + returnProductCoupPrice(item)
|
||||
}
|
||||
|
||||
function youhuiDetailHide() {
|
||||
pop.youhui = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 转桌/并桌
|
||||
*/
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
function returnProductCoupPrice(item) {
|
||||
if (!item.isMember) {
|
||||
return item.price * item.num
|
||||
@@ -317,91 +494,56 @@
|
||||
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)
|
||||
return (Math.floor(item.num*item.price*100)/100).toFixed(2)
|
||||
}
|
||||
function returnCanTuiMoney(item) {
|
||||
// if (props.orderInfo.status == 'unpaid') {
|
||||
// return returnTotalMoney(item)
|
||||
// } else {
|
||||
if (props.orderInfo.pointsDiscountAmount > 0 || props.orderInfo.fullCouponDiscountAmount > 0) {
|
||||
return item.canReturnAmount
|
||||
} else if (item.price != item.unitPrice) {
|
||||
return item.price*item.num
|
||||
} else {
|
||||
return (Math.floor(item.num*item.unitPrice*100)/100).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 goodsTotal = props.data.reduce((prve, cur) => {
|
||||
const curTotal = cur.info.filter(v => !isTui(v) && !v.userCouponId)
|
||||
.reduce((a, b) => {
|
||||
return a + b.payAmount * 1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
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 => isTui(v) && !v.userCouponId)
|
||||
.reduce((a, b) => {
|
||||
return a + b.priceAmount * 1
|
||||
return a + b.payAmount * 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
|
||||
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.payAmount * 1
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
})
|
||||
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) {
|
||||
@@ -417,10 +559,32 @@
|
||||
function tuikuan(item, index) {
|
||||
hasPermission('允许退款').then(res => {
|
||||
if (res) {
|
||||
emits('tuikuan', {
|
||||
...item,
|
||||
priceAmount: item.canReturnAmount
|
||||
}, index)
|
||||
if (Array.isArray(item)) {
|
||||
let arr = [];
|
||||
item.map(v=>{
|
||||
let infoLit = JSON.parse(JSON.stringify(v.info))
|
||||
infoLit.map((obj,i)=>{
|
||||
obj.number = '0.00'
|
||||
obj.skuName = obj.skuName || ''
|
||||
obj.unitPrice = obj.unitPrice
|
||||
obj.num = obj.num - obj.returnNum - obj.refundNum - obj.couponNum
|
||||
obj.priceAmount = mathFloorPrice(obj.num*obj.unitPrice ,obj)
|
||||
})
|
||||
arr = [...arr,...infoLit]
|
||||
})
|
||||
arr.map((v,e)=>{
|
||||
if( v.num <= 0){
|
||||
// arr.splice(e, 1)
|
||||
}
|
||||
})
|
||||
emits('tuikuan', arr)
|
||||
} else {
|
||||
emits('tuikuan', {
|
||||
...item,
|
||||
payAmount: item.payAmount
|
||||
}, index)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -429,135 +593,7 @@
|
||||
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(() => {
|
||||
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.status !== "return").reduce((a,
|
||||
b) => {
|
||||
return a + b.packAmount
|
||||
}, 0)
|
||||
return prve + curTotal
|
||||
}, 0)
|
||||
return goodsPrice.toFixed(2)
|
||||
|
||||
})
|
||||
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)
|
||||
}, 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(() => {
|
||||
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>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-24">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>订单状态</view>
|
||||
<view>{{returnStatus(data.status)}}</view>
|
||||
<view>{{$dict.getDiceName(data.status,'orderStatus')}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单类型</view>
|
||||
<view>{{returnUseType(data.useType)}}</view>
|
||||
<view>{{$dict.getDiceName(data.dineMode,'dineMode')}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>桌位号</view>
|
||||
@@ -18,16 +18,11 @@
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>支付方式</view>
|
||||
<view>{{data.payType||''}}</view>
|
||||
<view>{{$dict.getDiceName(data.payType,'payType')||''}}</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex u-row-between u-m-t-24">
|
||||
<view>预约时间</view>
|
||||
<view></view>
|
||||
</view> -->
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>下单时间</view>
|
||||
<view><up-text v-if="data.createdAt" mode="date" format="yyyy-mm-dd hh:MM:ss"
|
||||
:text="data.createdAt"></up-text></view>
|
||||
<view><up-text v-if="data.createTime" mode="date" format="yyyy-mm-dd hh:MM:ss" :text="data.createTime"></up-text></view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view>订单编号</view>
|
||||
@@ -38,22 +33,20 @@
|
||||
<up-icon name="/static/copy.svg" :size="16"></up-icon>
|
||||
</up-copy>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-24 u-col-top">
|
||||
<view class="no-wrap">商家备注</view>
|
||||
<view class="u-p-l-32 " style="max-width: 522rpx; word-wrap: break-word;">
|
||||
{{data.remark}}
|
||||
</view>
|
||||
<!-- <my-button plain shape="circle" :width="160" :height="60">编辑</my-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
import { ref } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
@@ -70,18 +63,7 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function returnStatus(status) {
|
||||
const item = orderEnum.status.find(v => v.key == status)
|
||||
return item ? item.label : ''
|
||||
}
|
||||
|
||||
function returnUseType(useType) {
|
||||
if (!useType) {
|
||||
return ''
|
||||
}
|
||||
return useType == "takeout" ? '自取' : '堂食';
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive
|
||||
} from 'vue';
|
||||
import color from '@/commons/color.js'
|
||||
import { reactive } from 'vue';
|
||||
const itemStyle = reactive({
|
||||
color: 'rgb(255,0,0)'
|
||||
})
|
||||
|
||||
@@ -6,22 +6,22 @@
|
||||
{{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="maxNum" :buttonSize="44" v-model="number" integer
|
||||
:disabled="data.productId=='-999'">
|
||||
<template #minus>
|
||||
<view class="minus number-box-btn">
|
||||
</view>
|
||||
<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="digit"></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 +50,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>
|
||||
|
||||
@@ -60,18 +59,15 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const emits = defineEmits(['update:show', 'confirm'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
productId:'-999'
|
||||
productId: '-999'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -83,10 +79,11 @@
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
const emits = defineEmits(['update:show', 'confirm'])
|
||||
let model = ref(null)
|
||||
let modelShow = ref(props.show)
|
||||
let number = ref(1)
|
||||
let number = ref(0)
|
||||
let maxNum = ref(0)
|
||||
|
||||
const tags = ref([{
|
||||
label: "点错",
|
||||
checked: false
|
||||
@@ -101,28 +98,6 @@
|
||||
checked: false
|
||||
}])
|
||||
let timer = null
|
||||
|
||||
function parseIntNumber(val, isNow) {
|
||||
console.log(val);
|
||||
let newval = parseInt(val)
|
||||
if (newval > props.data.num) {
|
||||
newval = props.data.num
|
||||
}
|
||||
if (newval < 1) {
|
||||
newval = 1
|
||||
}
|
||||
if (isNow) {
|
||||
number.value = parseInt(newval)
|
||||
return
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
number.value = newval
|
||||
}, 100)
|
||||
}
|
||||
|
||||
function changeTagSel(item) {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
watch(() => props.show, (newval) => {
|
||||
modelShow.value = newval
|
||||
})
|
||||
@@ -134,14 +109,34 @@
|
||||
close()
|
||||
}
|
||||
})
|
||||
|
||||
function parseIntNumber(val, isNow) {
|
||||
console.log(val)
|
||||
let newval = val * 1
|
||||
if (newval > props.data.num - props.data.returnNum) {
|
||||
newval = props.data.num - props.data.returnNum
|
||||
}
|
||||
|
||||
if (isNow) {
|
||||
number.value = newval * 1
|
||||
return
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
number.value = newval
|
||||
}, 100)
|
||||
}
|
||||
|
||||
function changeTagSel(item) {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
|
||||
function toggleModelShow(show) {
|
||||
modelShow.value = show ? true : false
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function onModelClose() {
|
||||
number.value=1
|
||||
number.value = 1
|
||||
modelShow.value = false
|
||||
}
|
||||
|
||||
@@ -151,19 +146,21 @@
|
||||
|
||||
function open() {
|
||||
model.value.open()
|
||||
if(props.data.productId=='-999'){
|
||||
number.value=props.data.num
|
||||
}
|
||||
number.value = props.data.num - props.data.returnNum
|
||||
maxNum.value = props.data.num - props.data.returnNum
|
||||
}
|
||||
|
||||
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() {
|
||||
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
|
||||
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
|
||||
@@ -174,10 +171,17 @@
|
||||
if (!note) {
|
||||
return infoBox.showToast("请输入退菜原因");
|
||||
}
|
||||
emits('confirm', {
|
||||
note,
|
||||
num: number.value
|
||||
})
|
||||
let par = {
|
||||
orderId: props.data.orderId,
|
||||
refundAmount: number.value * props.data.unitPrice,
|
||||
refundReason: note,
|
||||
refundDetails: [{
|
||||
id: props.data.id,
|
||||
returnAmount: number.value * props.data.unitPrice,
|
||||
num: number.value,
|
||||
}],
|
||||
}
|
||||
emits('confirm', par)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -206,12 +210,14 @@
|
||||
::v-deep .uni-input-input {
|
||||
text-align: center;
|
||||
}
|
||||
.gray{
|
||||
.minus::after{
|
||||
|
||||
.gray {
|
||||
.minus::after {
|
||||
border-color: #ccc;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.minus {
|
||||
&::after {
|
||||
content: '';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<view class="u-flex u-row-between u-m-t-20 border-bottom u-p-b-20">
|
||||
<view class="u-flex">
|
||||
<up-avatar :size="30" :src="user.headImg"></up-avatar>
|
||||
<view class="color-666 u-m-l-30">{{user.telephone||'未绑定手机号'}}</view>
|
||||
<view class="color-666 u-m-l-30">{{user.phone||'未绑定手机号'}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<my-button @click="toOrder" :height="60" plain shape="circle">他的订单</my-button>
|
||||
@@ -29,11 +29,11 @@
|
||||
</template>
|
||||
<view class="u-flex u-m-t-24 u-row-between u-font-28">
|
||||
<view class="">
|
||||
<view class="font-bold ">{{user.amount}}</view>
|
||||
<view class="font-bold ">{{user.amount||0}}</view>
|
||||
<view class="color-666 u-m-t-8 u-font-24">余额</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="font-bold">{{user.accountPoints}}</view>
|
||||
<view class="font-bold">{{user.accountPoints||0}}</view>
|
||||
<view class="color-666 u-m-t-8 u-font-24">积分</view>
|
||||
</view>
|
||||
<view class="">
|
||||
@@ -66,10 +66,9 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function toOrder(){
|
||||
go.to('PAGES_ORDER_INDEX',{
|
||||
userId:props.user.id||'',
|
||||
userId:props.user.userId||'',
|
||||
type:'user'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
<template>
|
||||
<view class="min-page bg-gray u-font-28 u-p-30">
|
||||
<user-vue :orderInfo="orderDetail.info" :user="user"></user-vue>
|
||||
<!-- <view class="default-box-padding bg-fff border-r-12 u-m-t-32">
|
||||
<text class="">桌位号:</text>
|
||||
<text class="">{{orderDetail.info.tableName}}</text>
|
||||
</view> -->
|
||||
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
|
||||
: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>
|
||||
@@ -23,7 +15,7 @@
|
||||
<view style="height: 200rpx;"></view>
|
||||
<view class="u-fixed bottom bg-fff ">
|
||||
<view class="u-flex u-abso">
|
||||
<template v-if="orderDetail.info.useType=='takeout'||!orderDetail.info.tableId||orderDetail.info.useType=='dine-in-before'">
|
||||
<template v-if="orderDetail.info.dineMode=='take-out'||!orderDetail.info.tableCode||pageData.shopInfo.registerType=='before'">
|
||||
<view class="u-flex-1" v-if="orderDetail.info.status=='unpaid'">
|
||||
<my-button @tap="toPay" borderRadius="100rpx" shape="circle"
|
||||
type="primary">结账</my-button>
|
||||
@@ -49,40 +41,98 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import * as orderApi from '@/http/yskApi/order.js'
|
||||
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
objToArrary
|
||||
} from '@/commons/utils/returrn-data.js'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref } from 'vue';
|
||||
import userVue from './components/user.vue';
|
||||
import orderVue from './components/order.vue';
|
||||
import goodsList from './components/list.vue';
|
||||
import stepVue from './components/step.vue';
|
||||
import extraVue from './components/extra.vue';
|
||||
import tuicaiVue from './components/tuicai.vue';
|
||||
|
||||
import go from '@/commons/utils/go.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
|
||||
import OrderDetail from './page.js'
|
||||
import { getHistoryOrder, refundOrder,getOrderById,printOrder } from '@/http/api/order.js'
|
||||
import { shopStaffDetail } from '@/http/api/staff.js'
|
||||
import { shopUserDetail } from '@/http/api/shopUser.js'
|
||||
import { getShopInfo } from '@/http/api/shop.js'
|
||||
|
||||
const tuicai = reactive({
|
||||
show: false,
|
||||
isSeatFee: false,
|
||||
selGoods: {}
|
||||
})
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {},
|
||||
seatFee: {
|
||||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
const options = reactive({})
|
||||
// 监听选择用户事件
|
||||
let user = ref({
|
||||
headImg:'',
|
||||
phone:'',
|
||||
amount:'0.00',
|
||||
accountPoints:'0.00'
|
||||
})
|
||||
const pageData = reactive({
|
||||
shopInfo: {},
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
getShopInfoData()
|
||||
})
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
watchChooseuser()
|
||||
getOrderDetail()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取店铺信息
|
||||
*/
|
||||
function getShopInfoData () {
|
||||
getShopInfo({id:uni.getStorageSync('shopInfo').id}).then(res=>{
|
||||
pageData.shopInfo = res;
|
||||
uni.setStorageSync('shopInfo',res)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
async function getOrderDetail () {
|
||||
let {data:res} = await getHistoryOrder({orderId: options.id})
|
||||
// console.log("订单详情===",res)
|
||||
if(res.userId){
|
||||
let {data:resUser} = await shopUserDetail({userId:res.userId})
|
||||
user.value = resUser
|
||||
}
|
||||
orderDetail.seatFee = {
|
||||
seatNum: res.seatNum,
|
||||
seatAmount: res.seatAmount,
|
||||
}
|
||||
|
||||
orderDetail.goodsList = Object.entries(res.detailMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
|
||||
orderDetail.goodsList.map(item=>{
|
||||
item.info.map(item=>{
|
||||
item.unitPrice = uni.$utils.isGoodsPrice(item,user.value)
|
||||
})
|
||||
})
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
function onSeatFeeTuicai(seatFee) {
|
||||
seatFee={...seatFee,num:seatFee.num,productName:seatFee.productName}
|
||||
console.log(seatFee);
|
||||
tuicai.show = true
|
||||
tuicai.isSeatFee = seatFee
|
||||
tuicai.selGoods = seatFee
|
||||
@@ -90,11 +140,11 @@
|
||||
//是否有允许退款权限
|
||||
async function hasTuiKuan(){
|
||||
const isHas=await hasPermission('允许退款')
|
||||
console.log(isHas,'11111111');
|
||||
return isHas
|
||||
}
|
||||
|
||||
async function onSeatFeeTuiKuan(seatFee) {
|
||||
console.log(seatFee);
|
||||
const canTuikuan=await hasTuiKuan()
|
||||
if(!canTuikuan){
|
||||
return
|
||||
@@ -117,49 +167,45 @@
|
||||
productName,
|
||||
num,
|
||||
number: 0,
|
||||
productSkuName: '',
|
||||
skuName: '',
|
||||
priceAmount,
|
||||
price
|
||||
})
|
||||
}
|
||||
|
||||
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,
|
||||
})
|
||||
const res = await refundOrder(e)
|
||||
tuicai.show = false
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
async function printDishes() {
|
||||
try {
|
||||
const res = await Api.$printDishes({
|
||||
tableId: orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
if(res){
|
||||
go.back()
|
||||
}else{
|
||||
getOrderDetail()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 打印订单
|
||||
*/
|
||||
function onPrintOrder() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
printDishes()
|
||||
try {
|
||||
const res = await printOrder({
|
||||
id: orderDetail.info.id,
|
||||
type: orderDetail.info.status == 'unpaid' ? 1 : 0
|
||||
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -171,34 +217,25 @@
|
||||
if(!canTuikuan){
|
||||
return
|
||||
}
|
||||
console.log(goods);
|
||||
const {
|
||||
id,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
productSkuName,
|
||||
cartId,
|
||||
orderId,
|
||||
num,
|
||||
priceAmount,
|
||||
price,userCouponId
|
||||
} = goods
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
id,
|
||||
cartId,
|
||||
orderId,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
num,
|
||||
number: 0,
|
||||
productSkuName: productSkuName || '',
|
||||
priceAmount:priceAmount?priceAmount:(num*price).toFixed(2),
|
||||
price,
|
||||
userCouponId:userCouponId?userCouponId:''
|
||||
})
|
||||
|
||||
if (Array.isArray(goods)) {
|
||||
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
orderInfo: JSON.stringify(orderDetail.info),
|
||||
goodsList:JSON.stringify(goods)
|
||||
|
||||
})
|
||||
} else {
|
||||
goods.number = 0
|
||||
goods.skuName = goods.skuName || ''
|
||||
goods.priceAmount = goods.priceAmount ? goods.priceAmount : (goods.num*uni.$utils.isGoodsPrice(goods,user.value)).toFixed(2)
|
||||
console.log(goods)
|
||||
goods.unitPrice = uni.$utils.isGoodsPrice(goods,user.value)
|
||||
goods.userCouponId = goods.userCouponId ? goods.userCouponId:''
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
orderInfo: JSON.stringify(orderDetail.info),
|
||||
goodsList:JSON.stringify([goods])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,9 +254,10 @@
|
||||
clearEmit()
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId || orderDetail.info.tableId,
|
||||
tableCode: options.tableCode || orderDetail.info.tableCode,
|
||||
name: options.name || orderDetail.info.tableName,
|
||||
masterId:orderDetail.info.masterId,
|
||||
type: 'add'
|
||||
type: 'add',
|
||||
vipUserId: orderDetail.info.userId?orderDetail.info.userId:''
|
||||
})
|
||||
}
|
||||
|
||||
@@ -228,102 +266,27 @@
|
||||
if(!canJieZhang){
|
||||
return
|
||||
}
|
||||
const memberId=orderDetail.info.memberId||''
|
||||
const userId=orderDetail.info.userId||''
|
||||
clearEmit()
|
||||
go.to('PAGES_ORDER_PAY', {
|
||||
tableId: options.tableId|| orderDetail.info.tableId,
|
||||
tableName: options.name,
|
||||
masterId: options.masterId,
|
||||
tableCode: options.tableCode || orderDetail.info.tableCode,
|
||||
tableName: options.name || orderDetail.info.tableName,
|
||||
orderId: orderDetail.info.id,
|
||||
discount: 1,
|
||||
memberId
|
||||
userId
|
||||
})
|
||||
}
|
||||
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {},
|
||||
seatFee: {
|
||||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
const options = reactive({})
|
||||
async function init() {
|
||||
const res = await orderApi.tbOrderInfoDetail(options.id)
|
||||
if(res.memberId){
|
||||
queryAllShopUser({id:res.memberId}).then(res=>{
|
||||
if(res.content[0]){
|
||||
user.value=res.content[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (res.detailList.length) {
|
||||
uni.setStorageSync('useType', res.detailList[0].useType)
|
||||
}
|
||||
const masterId = res.masterId
|
||||
options.masterId = res.masterId
|
||||
// if (res.status == 'unpaid') {
|
||||
if (false) {
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart({
|
||||
masterId,
|
||||
tableId: res.tableId,
|
||||
page: 1,
|
||||
size: 200
|
||||
})
|
||||
orderDetail.goodsList = records
|
||||
orderDetail.seatFee = seatFee ? seatFee : orderDetail.seatFee
|
||||
} else {
|
||||
const goodsMap = {}
|
||||
for (let i in res.detailList) {
|
||||
const goods = res.detailList[i]
|
||||
if (goods.productName != '客座费') {
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum].push(goods)
|
||||
} else {
|
||||
goodsMap[goods.placeNum] = [goods]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
console.log(res.seatInfo);
|
||||
orderDetail.seatFee = res.seatInfo|| {
|
||||
// name: '客座费',
|
||||
// number: res.seatCount,
|
||||
// num: res.seatCount,
|
||||
// totalNumber: res.seatCount,
|
||||
// priceAmount: res.seatAmount,
|
||||
// status:'',
|
||||
totalNumber:0,
|
||||
}
|
||||
orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({
|
||||
info: value,
|
||||
placeNum: key
|
||||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
}
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
function watchEmit() {
|
||||
uni.$off('orderDetail:update')
|
||||
uni.$once('orderDetail:update', (newval) => {
|
||||
console.log(newval);
|
||||
init()
|
||||
getOrderDetail()
|
||||
})
|
||||
}
|
||||
|
||||
// 监听选择用户事件
|
||||
let user = ref({
|
||||
headImg:'',
|
||||
telephone:'',
|
||||
amount:'0.00',
|
||||
accountPoints:'0.00'
|
||||
})
|
||||
|
||||
//更新选择用户
|
||||
async function setUser(par) {
|
||||
const submitPar = {
|
||||
@@ -335,7 +298,7 @@
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
const res=await Api.$setUser(submitPar)
|
||||
init()
|
||||
getOrderDetail()
|
||||
return res
|
||||
}
|
||||
|
||||
@@ -354,15 +317,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
watchChooseuser()
|
||||
init()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<template>
|
||||
<view class="bg-fff item" @click="toDetail">
|
||||
<view class="u-flex u-p-b-22 border-bottom u-row-between u-col-center">
|
||||
<view class="u-flex u-col-bottom">
|
||||
<view class="u-flex u-col-bottom" style="align-items: center;">
|
||||
<template v-if="data.tableName">
|
||||
<view class="u-flex u-col-center">
|
||||
<view class="u-font-40 color-333">{{data.tableName}}</view>
|
||||
<view class="line" style="height: 16px;"></view>
|
||||
</view>
|
||||
</template>
|
||||
<view class="">{{data.masterId}}</view>
|
||||
<!-- <view class="">{{ $dict.getDiceName(data.platformType,'platformType') }}</view> -->
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<view>
|
||||
<text :class="[data.status]">{{returnStatus(data.status)}}</text>
|
||||
<text :class="[data.status]">{{$dict.getDiceName(data.status,'orderStatus')}}</text>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class=" color-main">
|
||||
<text>
|
||||
{{sendTypeFilter(data.sendType)}}
|
||||
{{$dict.getDiceName(data.dineMode,'dineMode')}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -25,42 +25,24 @@
|
||||
<view class="u-m-t-26">
|
||||
<view class="u-flex u-col-bottom u-font-24 color-999">
|
||||
<up-avatar :size="33"></up-avatar>
|
||||
<view class="u-m-l-16">{{formatTime(data.createdAt)}}</view>
|
||||
<view class="u-m-l-16">{{formatTime(data.createTime)}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-font-32">{{goosZhonglei}}种商品,共{{goodsNumber}}件</view>
|
||||
<view class="u-font-32">共{{data.goods.length}}件商品</view>
|
||||
<view class="border-bottom u-p-b-32">
|
||||
<view class="" v-for="(item,index) in data.detailList" :key="index">
|
||||
<view class="" v-for="(item,index) in data.goods" :key="index">
|
||||
<view class="u-flex u-row-between u-col-top u-m-t-32" v-if="item.productId!=-999">
|
||||
<view>
|
||||
<view class=""> {{item.productName}}</view>
|
||||
<view class="color-999 u-font-24 u-m-t-8">
|
||||
{{item.productSkuName}}
|
||||
{{item.skuName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-flex-1 u-row-right">
|
||||
<view>×{{item.num}}</view>
|
||||
<template v-if="item.gift||item.userCouponId">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||
¥0
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else-if="item.isMember&&data.memberId&&item.memberPrice&&item.memberPrice!=item.price">
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text class="line-th">¥{{goodsPriceAmount(item)}}</text>
|
||||
<view class="u-absolute" style="bottom: 100%;right: 0;">
|
||||
¥{{goodsVipPriceAmount(item)}}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text>¥{{goodsPriceAmount(item)}}</text>
|
||||
</view>
|
||||
</template>
|
||||
<view class="u-flex u-flex-1 u-row-right" style="align-items: center;">
|
||||
<view style="margin-right: 10rpx;">×{{item.num}}</view>
|
||||
<view class="u-text-right u-relative" :style="computedPriceStyle()">
|
||||
<text>¥{{item.unitPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -74,8 +56,8 @@
|
||||
<view class="no-wrap u-m-r-32">打包费</view>
|
||||
<view>¥{{data.packFee||0}}</view>
|
||||
</view>
|
||||
<view style="height: 32rpx;" v-if="data.packFee>0&&data.seatInfo&&data.seatInfo.priceAmount>0"></view>
|
||||
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
||||
<view style="height: 32rpx;" ></view>
|
||||
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
||||
<view class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
|
||||
<view>¥{{data.seatInfo.priceAmount}}</view>
|
||||
</view>
|
||||
@@ -105,9 +87,9 @@
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-flex u-row-right">
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
|
||||
<text class="font-bold u-font-32">{{originAmount.toFixed(2)}}</text>
|
||||
</view>
|
||||
<view class="u-flex u-row-right u-m-t-24">
|
||||
<view class="u-flex u-row-right u-m-t-24" v-if="data.status == 'unpaid'||data.status == 'done'">
|
||||
<view class="print" @click.stop="print(item)">重新打印</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -116,20 +98,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
isTui,
|
||||
canTuiKuan,
|
||||
canTuicai
|
||||
} from '@/commons/utils/goodsUtil.js'
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
|
||||
const emits = defineEmits(['printOrder'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
@@ -141,7 +114,7 @@
|
||||
productName: '客座费',
|
||||
priceAmount: 0
|
||||
},
|
||||
detailList: []
|
||||
goods: []
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -153,73 +126,40 @@
|
||||
let $goodsMap = {}
|
||||
let goosZhonglei = ref(0)
|
||||
let goodsNumber = ref(0)
|
||||
|
||||
let originAmount = ref(0)
|
||||
const priceSize = 9
|
||||
let minWidth=ref(36)
|
||||
function goodsPriceAmount(item) {
|
||||
const total=(item.price * item.num).toFixed(2)
|
||||
const minW=total.length * priceSize + 15
|
||||
minWidth.value=minW<minWidth.value?minWidth.value:minW
|
||||
return total
|
||||
}
|
||||
|
||||
function goodsVipPriceAmount(item) {
|
||||
const price = item.memberPrice ? item.memberPrice : item.price
|
||||
return (price * item.num).toFixed(2)
|
||||
}
|
||||
// const packeFee=computed(()=>{
|
||||
// return props.data.detailList.reduce((prve,cur)=>{
|
||||
// return prve+cur.packAmount
|
||||
// },0).toFixed(2)
|
||||
// })
|
||||
|
||||
function computedPriceStyle() {
|
||||
return {
|
||||
'min-width':minWidth.value + 'px'
|
||||
}
|
||||
}
|
||||
// const computedPriceStyle = computed(() => {
|
||||
|
||||
// })
|
||||
|
||||
|
||||
function goodsMapInit() {
|
||||
for (let i in props.data.detailList) {
|
||||
const goods = props.data.detailList[i]
|
||||
for (let i in props.data.goods) {
|
||||
const goods = props.data.goods[i]
|
||||
if ($goodsMap.hasOwnProperty(goods.productId)) {
|
||||
$goodsMap[goods.productId] += goods.num * 1
|
||||
goodsNumber.value += goods.num * 1
|
||||
} else {
|
||||
$goodsMap[goods.productId] = goods.num * 1
|
||||
goosZhonglei.value += 1
|
||||
goodsNumber.value += goods.num * 1
|
||||
}
|
||||
originAmount.value += goods.unitPrice
|
||||
}
|
||||
}
|
||||
goodsMapInit()
|
||||
watch(() => props.data.detailList.length, (newval) => {
|
||||
watch(() => props.data.goods.length, (newval) => {
|
||||
goodsNumber.value = 0
|
||||
goodsMapInit()
|
||||
})
|
||||
|
||||
|
||||
function formatTime(time) {
|
||||
return dayjs(time).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
function returnStatus(status) {
|
||||
const item = orderEnum.status.find(v => v.key == status)
|
||||
return item ? item.label : ''
|
||||
}
|
||||
|
||||
function sendTypeFilter(t) {
|
||||
console.log(t);
|
||||
if (t) {
|
||||
const item = orderEnum.sendType.find(item => item.key == t)
|
||||
return item ? item.label : '';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
function toDetail() {
|
||||
go.to('PAGES_ORDER_DETAIL', {
|
||||
id: props.data.id
|
||||
@@ -286,4 +226,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -3,12 +3,14 @@
|
||||
<up-sticky offset-top="0">
|
||||
<view class="top">
|
||||
<view class="search bg-fff u-p-t-32 u-p-l-28 u-p-r-28 u-p-b-32">
|
||||
<up-search v-bind="search" v-model="search.val" @search="searchConfirm" @clear="searchConfirm" @custom="searchConfirm"></up-search>
|
||||
<up-search v-bind="search" v-model="search.val" @search="searchConfirm" @clear="searchConfirm"
|
||||
@custom="searchConfirm"></up-search>
|
||||
</view>
|
||||
<filter-vue @clearUser="clearQueryUser" @updateStatus="updateQuery('status',$event)" v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
|
||||
<filter-vue @clearUser="clearQueryUser" @updateStatus="updateQuery('status',$event)"
|
||||
v-model:time="order.data.query.createdAt" :user="user" :type="option.type"></filter-vue>
|
||||
</view>
|
||||
</up-sticky>
|
||||
|
||||
|
||||
<order-list @printOrder="onPrintOrder" :hasAjax="order.data.hasAjax" :list="order.data.list"></order-list>
|
||||
<template v-if="order.data.list.length>0">
|
||||
<my-pagination @change="pageChange" :totalElements="order.data.total"></my-pagination>
|
||||
@@ -18,20 +20,32 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {onLoad,onShow,onPullDownRefresh} from '@dcloudio/uni-app'
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app'
|
||||
import * as Api from '@/http/yskApi/order.js'
|
||||
import {queryAllShopUser} from '@/http/yskApi/shop-user.js'
|
||||
|
||||
|
||||
import {
|
||||
queryAllShopUser
|
||||
} from '@/http/yskApi/shop-user.js'
|
||||
|
||||
|
||||
import LIST from '@/commons/class/list.js'
|
||||
import {$printOrder} from '@/http/yskApi/Instead.js'
|
||||
import {
|
||||
$printOrder
|
||||
} from '@/http/yskApi/Instead.js'
|
||||
import filterVue from './compoents/filter.vue';
|
||||
import orderList from './compoents/order-list.vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
import {
|
||||
reactive, ref, watch
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {getTodayTimestamps} from '@/commons/utils/dayjs-time.js';
|
||||
import {
|
||||
getTodayTimestamps
|
||||
} from '@/commons/utils/dayjs-time.js';
|
||||
const search = reactive({
|
||||
val: '',
|
||||
placeholder: '搜索单号/商品名称',
|
||||
@@ -43,12 +57,12 @@
|
||||
textAlign: 'right'
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const today = getTodayTimestamps();
|
||||
const order=new LIST({
|
||||
const order = new LIST({
|
||||
list: [],
|
||||
query: {
|
||||
createdAt: [today.start,today.end],
|
||||
createdAt: [today.start, today.end],
|
||||
id: "",
|
||||
orderNo: "",
|
||||
orderType: "0",
|
||||
@@ -57,81 +71,95 @@
|
||||
payType: "",
|
||||
productName: "",
|
||||
status: "",
|
||||
userId:''
|
||||
userId: ''
|
||||
}
|
||||
})
|
||||
console.log(order.data);
|
||||
function clearQueryUser(){
|
||||
order.setQuery('userId','')
|
||||
|
||||
function clearQueryUser() {
|
||||
order.setQuery('userId', '')
|
||||
}
|
||||
function pageChange(e){
|
||||
const newPage=e-1
|
||||
order.setVal('page',newPage)
|
||||
order.setQuery('page',newPage)
|
||||
|
||||
function pageChange(e) {
|
||||
const newPage = e - 1
|
||||
order.setVal('page', newPage)
|
||||
order.setQuery('page', newPage)
|
||||
init()
|
||||
}
|
||||
function updateQuery(key,e){
|
||||
order.setQuery(key,e)
|
||||
|
||||
function updateQuery(key, e) {
|
||||
order.setQuery(key, e)
|
||||
}
|
||||
watch(()=>order.data.query.createdAt,(newval)=>{
|
||||
watch(() => order.data.query.createdAt, (newval) => {
|
||||
init()
|
||||
})
|
||||
watch(()=>order.data.query.status,(newval)=>{
|
||||
watch(() => order.data.query.status, (newval) => {
|
||||
init()
|
||||
})
|
||||
watch(()=>order.data.query.userId,(newval)=>{
|
||||
watch(() => order.data.query.userId, (newval) => {
|
||||
init()
|
||||
})
|
||||
function searchConfirm(){
|
||||
order.setQuery('page',0)
|
||||
|
||||
function searchConfirm() {
|
||||
order.setQuery('page', 0)
|
||||
init()
|
||||
}
|
||||
async function init() {
|
||||
console.log(order.data.query);
|
||||
const {content,totalElements}=await Api.tbOrderInfoData({...order.data.query,page:order.data.query.page,keyword:search.val})
|
||||
const {
|
||||
data
|
||||
} = await Api.tbOrderInfoData({
|
||||
...order.data.query,
|
||||
page: order.data.query.page,
|
||||
keyword: search.val
|
||||
})
|
||||
uni.stopPullDownRefresh()
|
||||
order.setVal('list',content)
|
||||
console.log(order.data.list);
|
||||
order.setVal('total',totalElements)
|
||||
order.setVal('hasAjax',true)
|
||||
order.setVal('list', data.records)
|
||||
order.setVal('total', data.totalRow)
|
||||
order.setVal('hasAjax', true)
|
||||
}
|
||||
onPullDownRefresh(()=>{
|
||||
order.setQuery('page',0)
|
||||
onPullDownRefresh(() => {
|
||||
order.setQuery('page', 0)
|
||||
init()
|
||||
})
|
||||
|
||||
let user=ref({
|
||||
userId:''
|
||||
|
||||
let user = ref({
|
||||
userId: ''
|
||||
})
|
||||
const option=reactive({type:''})
|
||||
onLoad((opt)=>{
|
||||
Object.assign(option,opt)
|
||||
if(opt&&JSON.stringify(opt)!='{}'){
|
||||
order.setQuery('userId',opt.userId?opt.userId:'')
|
||||
if(opt.userId){
|
||||
queryAllShopUser({id:opt.userId}).then(res=>{
|
||||
user.value=res.content[0]||opt
|
||||
const option = reactive({
|
||||
type: ''
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(option, opt)
|
||||
if (opt && JSON.stringify(opt) != '{}') {
|
||||
order.setQuery('userId', opt.userId ? opt.userId : '')
|
||||
if (opt.userId) {
|
||||
queryAllShopUser({
|
||||
id: opt.userId
|
||||
}).then(res => {
|
||||
user.value = res.content[0] || opt
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
onShow(init)
|
||||
async function printOrder(item){
|
||||
try{
|
||||
async function printOrder(item) {
|
||||
try {
|
||||
console.log(item);
|
||||
const res= await $printOrder({
|
||||
tableId:item.tableId
|
||||
const res = await $printOrder({
|
||||
tableId: item.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function onPrintOrder(e){
|
||||
|
||||
function onPrintOrder(e) {
|
||||
console.log(e);
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user