更新订单管理模块
This commit is contained in:
@@ -2,7 +2,12 @@
|
||||
<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>
|
||||
<my-button plain shape="circle" :width="160" :height="56">退菜</my-button>
|
||||
<template v-if="orderInfo.status=='unpaid'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
</template>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>{{data.name||'餐位费'}}</view>
|
||||
@@ -18,6 +23,10 @@
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
orderInfo:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
@@ -27,9 +36,16 @@
|
||||
const statusMap={
|
||||
unpaid:'未支付'
|
||||
}
|
||||
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
|
||||
function returnStatus(status){
|
||||
return statusMap[status]||''
|
||||
}
|
||||
function tuikuan(){
|
||||
emits('tuikuan',props.data)
|
||||
}
|
||||
function tuicai(){
|
||||
emits('tuicai',props.data)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -17,15 +17,23 @@
|
||||
<view class="u-p-l-30 u-flex-1">
|
||||
<view class="u-flex u-row-between u-col-top">
|
||||
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="item.status=='return'">
|
||||
已退
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="item.status=='return'">
|
||||
已退
|
||||
</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
|
||||
</view>
|
||||
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
|
||||
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
|
||||
</view>
|
||||
<view class="u-text-right">
|
||||
<view>¥{{item.salePrice||item.price}}</view>
|
||||
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">¥{{item.salePrice||item.price}}</view>
|
||||
<template v-if="item.status=='return'">
|
||||
<view >¥0.00</view>
|
||||
<view class="line-th color-666 u-font-24">¥{{item.salePrice||item.price}}</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view >¥{{item.salePrice||item.price}}</view>
|
||||
</template>
|
||||
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单类型</view>
|
||||
<view>堂食</view>
|
||||
<view>{{returnUseType(data.useType)}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>桌位号</view>
|
||||
@@ -26,7 +26,7 @@
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>下单时间</view>
|
||||
<view ><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
|
||||
<view><up-text v-if="data.createdAt" mode="date" :text="data.createdAt"></up-text></view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>订单编号</view>
|
||||
@@ -46,19 +46,28 @@
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
table:{
|
||||
table: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
seatFee:{
|
||||
seatFee: {
|
||||
type: Object,
|
||||
default: () => {totalNumber:0}
|
||||
default: () => {
|
||||
totalNumber: 0
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function returnStatus(status){
|
||||
const item=orderEnum.status.find(v=>v.key==status)
|
||||
return item?item.label:''
|
||||
|
||||
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>
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
<text class="color-666">桌位号:</text>
|
||||
<text class="font-bold">{{orderDetail.info.tableName}}</text>
|
||||
</view>
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info" :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
|
||||
@tuicai="onTuiCai"></goods-list>
|
||||
<extra-vue :data="orderDetail.seatFee"></extra-vue>
|
||||
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
|
||||
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" @tuicai="onTuiCai"></goods-list>
|
||||
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
|
||||
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info" :data="orderDetail.seatFee"></extra-vue>
|
||||
</template>
|
||||
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
|
||||
<step-vue></step-vue>
|
||||
<view style="height: 200rpx;"></view>
|
||||
@@ -51,58 +53,84 @@
|
||||
onHide
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
reactive, ref
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import OrderDetail from './page.js'
|
||||
const tuicai = reactive({
|
||||
show: false,
|
||||
isSeatFee:false,
|
||||
selGoods: {}
|
||||
})
|
||||
|
||||
|
||||
function onSeatFeeTuicai(seatFee){
|
||||
tuicai.show = true
|
||||
tuicai.isSeatFee = seatFee
|
||||
tuicai.selGoods = seatFee
|
||||
}
|
||||
function onSeatFeeTuiKuan(seatFee){
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
|
||||
})
|
||||
}
|
||||
function onTuiCai(goods, index) {
|
||||
console.log(goods);
|
||||
tuicai.show = true
|
||||
tuicai.selGoods = goods
|
||||
}
|
||||
async function printDishes(){
|
||||
try{
|
||||
const res= await Api.$printDishes({
|
||||
tableId:orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
}catch(e){
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
function onPrintOrder(){
|
||||
uni.showModal({
|
||||
title:'提示',
|
||||
content:'是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
if(res.confirm){
|
||||
printDishes()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function onTuikuan(goods, index){
|
||||
go.to('PAGES_ORDER_TUIKUAN',{
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async function tuicaiConfirm() {
|
||||
console.log(tuicai.selGoods);
|
||||
const res = await Api.$returnCart({
|
||||
cartId:tuicai.selGoods.hasOwnProperty('cartId')? tuicai.selGoods.cartId:tuicai.selGoods.id,
|
||||
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
|
||||
tableId: orderDetail.info.tableId,
|
||||
})
|
||||
tuicai.selGoods.status = 'return'
|
||||
tuicai.show = false
|
||||
}
|
||||
|
||||
|
||||
async function printDishes() {
|
||||
try {
|
||||
const res = await Api.$printDishes({
|
||||
tableId: orderDetail.info.tableId
|
||||
})
|
||||
infoBox.showToast('已发送打印请求')
|
||||
} catch (e) {
|
||||
infoBox.showToast('发送打印请求失败')
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onPrintOrder() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否打印当前台桌菜品',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
printDishes()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function onTuikuan(goods, index) {
|
||||
const {id,productId,productSkuId,productName,productSkuName,cartId,num,priceAmount,price}=goods
|
||||
go.to('PAGES_ORDER_TUIKUAN', {
|
||||
id,
|
||||
cartId,
|
||||
productId,
|
||||
productSkuId,
|
||||
productName,
|
||||
num,
|
||||
number:0,
|
||||
productSkuName:productSkuName||'',
|
||||
priceAmount,price
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
const uiPage = new OrderDetail()
|
||||
setTimeout(() => {
|
||||
uiPage.setVal('user', {
|
||||
@@ -112,8 +140,8 @@
|
||||
|
||||
function diancan() {
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId,
|
||||
tableName: options.name,
|
||||
tableId: options.tableId || orderDetail.info.tableId,
|
||||
name: options.name || orderDetail.info.tableName,
|
||||
type: 'add'
|
||||
})
|
||||
}
|
||||
@@ -138,13 +166,13 @@
|
||||
const options = reactive({})
|
||||
async function init() {
|
||||
const res = await orderApi.tbOrderInfoDetail(options.id)
|
||||
if(res.detailList.length){
|
||||
uni.setStorageSync('useType',res.detailList[0].useType)
|
||||
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) {
|
||||
// if (res.status == 'unpaid') {
|
||||
if (false) {
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
@@ -161,6 +189,7 @@
|
||||
for (let i in res.detailList) {
|
||||
const goods = res.detailList[i]
|
||||
if (goods.productName != '客座费') {
|
||||
console.log(goods);
|
||||
if (goodsMap.hasOwnProperty(goods.placeNum)) {
|
||||
goodsMap[goods.placeNum].push(goods)
|
||||
} else {
|
||||
@@ -181,7 +210,6 @@
|
||||
}))
|
||||
console.log(orderDetail.goodsList);
|
||||
}
|
||||
console.log(orderDetail);
|
||||
orderDetail.info = res
|
||||
}
|
||||
|
||||
@@ -192,20 +220,21 @@
|
||||
init()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 监听选择用户事件
|
||||
let user = ref(null)
|
||||
//更新选择用户
|
||||
function setUser(par) {
|
||||
const submitPar = {
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
masterId: options.masterId,
|
||||
tableId: options.tableId,
|
||||
vipUserId: user.value.id ? user.value.id : '',
|
||||
type: user.value.id ? 0 : 1 //0 设置 1 取消
|
||||
}
|
||||
Object.assign(submitPar, par)
|
||||
return Api.$setUser(submitPar)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (data) => {
|
||||
@@ -214,15 +243,15 @@
|
||||
setUser()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
watchChooseuser()
|
||||
init()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log(options);
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user