增加订单列表详情的客座费打包费

This commit is contained in:
YeMingfei666 2024-10-28 09:22:31 +08:00
parent 291b495c10
commit 96a9dfb5b5
6 changed files with 192 additions and 82 deletions

View File

@ -15,6 +15,7 @@ import {
} from '@/commons/utils/encryptUtil.js'
import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js';
import { reject } from 'lodash';
// 测试服
// let baseUrl = 'https://admintestpapi.sxczgkj.cn'
@ -125,9 +126,11 @@ function commonsProcess(showLoading, httpReqCallback) {
return Promise.resolve(bodyData)
}).catch(res => {
if(res.status==401||res.status==400){
// storageManage.token(null, true)
infoBox.showErrorToast(res.message||'状态码400').then(() => {
if(res.status==401){
storageManage.token(null, true)
infoBox.showErrorToast(res.message||'请登录').then(() => {
uni.redirectTo({url: '/pages/login/index'})
reject()
})
}
if(res.status==500){

View File

@ -3,6 +3,7 @@
<view class="search bg-fff u-flex u-col-center ">
<view class="u-flex-1">
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索" @confirm="search"
@clear="search"
v-model="query.name">
</uni-search-bar>
</view>
@ -15,33 +16,44 @@
<view>不选择用户</view>
<my-radio v-model="nouser" :size="18" border-color="#d1d1d1" @change="chooseUser"></my-radio>
</view>
<view class="u-m-t-32 bg-fff box bg-fff">
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index"
@tap="chooseUser(index,item)">
<view class="u-flex">
<view class="headimg u-flex u-row-center u-col-center">
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
</view>
<view class="u-m-l-32">
<view>{{item.nickName}}</view>
<view class=" u-font-24 u-m-t-12 u-flex">
<text class="color-999" v-if="!item.isVip">非会员</text>
<text class="color-main" v-else>会员</text>
<view class="u-m-l-30 u-flex">
<text class="">余额</text>
<text class="color-main">{{item.amount}}</text>
</view>
<view class="u-m-l-30 u-flex">
<text class="">积分</text>
<text class="color-main">{{item.totalScore}}</text>
<template v-if="list.length>0">
<view class="u-m-t-32 bg-fff box bg-fff">
<view class="u-flex item u-row-between" v-for="(item,index) in list" :key="index"
@tap="chooseUser(index,item)">
<view class="u-flex">
<view class="headimg u-flex u-row-center u-col-center">
<image v-if="item.headImg" :src="item.headImg" class="img" mode=""></image>
</view>
<view class="u-m-l-32">
<view>{{item.nickName}}</view>
<view class=" u-font-24 u-m-t-12 u-flex">
<text class="color-999" v-if="!item.isVip">非会员</text>
<text class="color-main" v-else>会员</text>
<view class="u-m-l-30 u-flex">
<text class="">余额</text>
<text class="color-main">{{item.amount}}</text>
</view>
<view class="u-m-l-30 u-flex">
<text class="">积分</text>
<text class="color-main">{{item.totalScore}}</text>
</view>
</view>
</view>
</view>
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18"
border-color="#d1d1d1"></my-radio>
</view>
<my-radio @change="chooseUser(index,item)" v-model="item.checked" :size="18"
border-color="#d1d1d1"></my-radio>
</view>
</view>
<view class="u-m-t-32">
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
@change="pageChange"></my-pagination>
</view>
</template>
<template v-if="hasAjax&&list.length<=0">
<my-img-empty tips="未找到相关用户"></my-img-empty>
</template>
</view>
@ -54,20 +66,23 @@
onLoad
} from '@dcloudio/uni-app'
import {
reactive,onBeforeMount,
reactive,
onBeforeMount,
ref
} from 'vue';
let nouser = ref(false)
let timer=null
let timer = null
function emitChooser(data) {
uni.$emit('choose-user', data)
timer=setTimeout(() => {
timer = setTimeout(() => {
uni.navigateBack()
}, 100)
}
onBeforeMount(()=>{
onBeforeMount(() => {
clearInterval(timer)
})
function chooseUser(index, item) {
if (index === undefined || item === undefined) {
nouser.value = true
@ -85,28 +100,38 @@
}
const query = reactive({
page: 0,
page: 1,
name: '',
size: 300,
isVip:1
totalElements: 0,
size: 10,
isVip: 1
})
const list = reactive([])
let hasAjax=ref(false)
async function getUser() {
const {
content
content,
totalElements
} = await Api.queryAllShopUser(query)
hasAjax.value=true
list.length=content.length
for (let i in content) {
list.push({
list[i]={
...content[i],
checked: false
})
}
}
query.totalElements = totalElements
console.log(list);
}
function pageChange(e) {
query.page=e
getUser()
}
function search() {
query.page = 0
list.length = 0
query.page = 1
getUser()
}
onLoad(() => {

View File

@ -2,61 +2,103 @@
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between">
<view class="font-bold">附加费</view>
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
<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>
<template v-if="data.status!='return'">
<view class="u-flex u-row-between u-m-t-24">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view>{{data.totalAmount}}</view>
</view>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-24 color-999">
<view class="u-flex">
<view class="line-th ">{{data.name||'餐位费'}}</view>
<view class="tag yitui u-m-l-10">已退</view>
<view>
<template v-if="data.status!='return'">
<view class="u-flex u-row-between u-m-t-24">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view class="price-min-width">{{data.totalAmount}}</view>
</view>
<view class="line-th">x{{data.number}}</view>
<view class="line-th">{{data.totalAmount}}</view>
</view>
</template>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-24 color-999">
<view class="u-flex">
<view class="line-th ">{{data.name||'餐位费'}}</view>
<view class="tag yitui u-m-l-10">已退</view>
</view>
<view class="line-th">x{{data.number||0}}</view>
<view class="line-th">{{data.totalAmount}}</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">
<view>打包费</view>
<view>x{{packeNumbber}}</view>
<view class="price-min-width">{{packeFee}}</view>
</view>
</view>
</template>
<script setup>
import {
computed
} from 'vue'
const props = defineProps({
data: {
type: Object,
default: () => {}
},
orderInfo:{
orderInfo: {
type: Object,
default: () => {}
default: () => {
return {
detailList: []
}
}
},
table:{
table: {
type: Object,
default: () => {}
}
})
const statusMap={
unpaid:'未支付'
const packeNumbber = computed(() => {
if (!props.orderInfo.detailList) {
return 0
}
return props.orderInfo.detailList.reduce((prve, cur) => {
return prve + (cur.packAmount>0?cur.num:0)
}, 0)
})
const packeFee = computed(() => {
if (!props.orderInfo.detailList) {
return 0
}
return props.orderInfo.detailList.reduce((prve, cur) => {
return prve + cur.packAmount
}, 0).toFixed(2)
})
const statusMap = {
unpaid: '未支付'
}
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
function returnStatus(status){
return statusMap[status]||''
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function returnStatus(status) {
return statusMap[status] || ''
}
function tuikuan(){
emits('tuikuan',props.data)
function tuikuan() {
emits('tuikuan', props.data)
}
function tuicai(){
emits('tuicai',props.data)
function tuicai() {
emits('tuicai', props.data)
}
</script>
@ -65,9 +107,14 @@
padding: 0 6rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.yitui {
background-color: rgb(188, 188, 188);
color: #fff;
}
}
.price-min-width{
min-width: 100rpx;
text-align: right;
}
</style>

View File

@ -53,7 +53,7 @@
</view>
</view>
</view>
<template v-if="orderInfo.status=='unpaid'">
<template v-if="orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'">
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.status!='return'">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="128" :height="48" plain shape="circle"

View File

@ -7,7 +7,8 @@
</view> -->
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
<!-- <template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount"> -->
<template v-if="true">
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
:data="orderDetail.seatFee"></extra-vue>
</template>
@ -16,7 +17,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'">
<template v-if="orderDetail.info.useType=='takeout'||!orderDetail.info.tableId||orderDetail.info.useType=='dine-in-before'">
<view class="u-flex-1" v-if="orderDetail.info.status=='unpaid'">
<my-button @tap="toPay" borderRadius="100rpx" shape="circle"
type="primary">结账</my-button>

View File

@ -30,22 +30,42 @@
<view class="u-m-t-32">
<view class="u-font-32">{{goosZhonglei}}种商品{{goodsNumber}}</view>
<view class="border-bottom u-p-b-32">
<view class="u-flex u-row-between u-col-top u-m-t-32" v-for="(item,index) in data.detailList"
<view class="" v-for="(item,index) in data.detailList"
:key="index">
<view>
<view class=""> {{item.productName}}</view>
<view class="color-999 u-font-24 u-m-t-8">
{{item.productSkuName}}
<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}}
</view>
</view>
<view class="u-flex u-flex-1 u-row-right">
<view>×{{item.num}}</view>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text :class="{'line-th':item.gift}">{{goodsPriceAmount(item)}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;" v-if="item.gift">
0
</view>
</view>
</view>
</view>
<view class="u-flex u-flex-1 u-row-right">
<view>×{{item.num}}</view>
<view class="u-text-right" :style="computedPriceStyle()">{{item.priceAmount}}</view>
</view>
</view>
</view>
</view>
<view class="border-bottom">
<view class="u-flex u-row-between u-m-t-32 u-col-top" v-if="data.packFee>0">
<view class="no-wrap u-m-r-32">打包费</view>
<view>{{data.packFee||0}}</view>
</view>
<view class="u-flex u-row-between u-m-t-32 u-p-b-32 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>
</view>
<view class="u-flex u-row-between border-bottom u-m-t-32 u-p-b-32 u-col-top">
<view class="no-wrap u-m-r-32">订单备注</view>
<view>{{data.remark||'无'}}</view>
@ -78,7 +98,14 @@
data: {
type: Object,
default: () => {
detailList: []
return{
packFee:0,
seatInfo:{
productName:'客座费',
priceAmount:0
},
detailList: []
}
}
},
index: {
@ -89,9 +116,16 @@
let $goodsMap = {}
let goosZhonglei = ref(0)
let goodsNumber = ref(0)
const priceSize = 9
function goodsPriceAmount(item){
return item.price*item.num
}
// const packeFee=computed(()=>{
// return props.data.detailList.reduce((prve,cur)=>{
// return prve+cur.packAmount
// },0).toFixed(2)
// })
function computedPriceStyle() {
const item = props.data.detailList.reduce((prev, current) => (`${prev.price}`.length > `${current.price}`
.length) ? prev : current)