代客下单页面增加获取台桌信息接口
This commit is contained in:
@@ -346,9 +346,12 @@
|
|||||||
productId,
|
productId,
|
||||||
skuId,
|
skuId,
|
||||||
id,
|
id,
|
||||||
number
|
number,
|
||||||
|
isPack,isGift
|
||||||
} = item
|
} = item
|
||||||
const par = {
|
const par = {
|
||||||
|
isPack,
|
||||||
|
isGift,
|
||||||
masterId: option.masterId,
|
masterId: option.masterId,
|
||||||
tableId: table.value.tableId,
|
tableId: table.value.tableId,
|
||||||
productId,
|
productId,
|
||||||
@@ -453,11 +456,19 @@
|
|||||||
totalNumber: 0,
|
totalNumber: 0,
|
||||||
totalAmount: 0,
|
totalAmount: 0,
|
||||||
})
|
})
|
||||||
const allPrice = computed(() => {
|
const goodsPrice = computed(() => {
|
||||||
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
||||||
}, 0)
|
}, 0)
|
||||||
return (goodsTotalPrice + $seatFee.totalAmount || 0).toFixed(2)
|
return (goodsTotalPrice|| 0).toFixed(2)
|
||||||
|
})
|
||||||
|
const allPrice = computed(() => {
|
||||||
|
const n=goodsPrice.value*1 + ($seatFee.totalAmount || 0)
|
||||||
|
return n.toFixed(2)
|
||||||
|
// const goodsTotalPrice = goods.list.reduce((prve, cur) => {
|
||||||
|
// return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
||||||
|
// }, 0)
|
||||||
|
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
function setGoodsItem(key, val) {
|
function setGoodsItem(key, val) {
|
||||||
|
|||||||
@@ -100,9 +100,11 @@
|
|||||||
<view class="u-font-28 color-666 ">搜索</view>
|
<view class="u-font-28 color-666 ">搜索</view>
|
||||||
<view class="u-flex u-m-t-20 u-flex-wrap u-row-between">
|
<view class="u-flex u-m-t-20 u-flex-wrap u-row-between">
|
||||||
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
|
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
|
||||||
<goods-item :img="{width:'330rpx',height:'330rpx'}" @chooseGuige="chooseGuige($event,goodsItem.index)"
|
<goods-item :img="{width:'330rpx',height:'330rpx'}"
|
||||||
@add="goodsUpdate($event,goodsItem.index,true)" @reduce="goodsUpdate($event,index,false)"
|
@chooseGuige="chooseGuige($event,goodsItem.index)"
|
||||||
:index="goodsItem.goodsIndex" :data="goodsItem"></goods-item>
|
@add="goodsUpdate($event,goodsItem.index,true)"
|
||||||
|
@reduce="goodsUpdate($event,index,false)" :index="goodsItem.goodsIndex"
|
||||||
|
:data="goodsItem"></goods-item>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -395,6 +397,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let $originGoods = []
|
let $originGoods = []
|
||||||
|
let $category = []
|
||||||
async function init() {
|
async function init() {
|
||||||
const shopInfo = await tbShopInfo()
|
const shopInfo = await tbShopInfo()
|
||||||
$shop.value = shopInfo
|
$shop.value = shopInfo
|
||||||
@@ -410,7 +413,7 @@
|
|||||||
});
|
});
|
||||||
return [...prve, ...cur.childrenList];
|
return [...prve, ...cur.childrenList];
|
||||||
}, []);
|
}, []);
|
||||||
console.log(category);
|
$category = category
|
||||||
const goodsRes = await getGoods()
|
const goodsRes = await getGoods()
|
||||||
const goods = goodsRes.records.filter((v) => {
|
const goods = goodsRes.records.filter((v) => {
|
||||||
let isShow = true;
|
let isShow = true;
|
||||||
@@ -419,7 +422,7 @@
|
|||||||
}
|
}
|
||||||
return isShow;
|
return isShow;
|
||||||
});
|
});
|
||||||
$originGoods=goods
|
$originGoods = goods
|
||||||
if (!data.table.tableId) {
|
if (!data.table.tableId) {
|
||||||
//无桌台
|
//无桌台
|
||||||
setTabBar(category, goods, [])
|
setTabBar(category, goods, [])
|
||||||
@@ -465,14 +468,14 @@
|
|||||||
function returnSearchGoods() {
|
function returnSearchGoods() {
|
||||||
const newval = searchValue.value
|
const newval = searchValue.value
|
||||||
let arr = []
|
let arr = []
|
||||||
let goods=[]
|
let goods = []
|
||||||
for(let i in data.tabbar){
|
for (let i in data.tabbar) {
|
||||||
const goodsArr=data.tabbar[i].foods||[]
|
const goodsArr = data.tabbar[i].foods || []
|
||||||
for(let k in goodsArr){
|
for (let k in goodsArr) {
|
||||||
goods.push({
|
goods.push({
|
||||||
...goodsArr[k],
|
...goodsArr[k],
|
||||||
index:i,
|
index: i,
|
||||||
goodsIndex:k
|
goodsIndex: k
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -672,7 +675,7 @@
|
|||||||
|
|
||||||
function chooseGuige(foodsindex, index) {
|
function chooseGuige(foodsindex, index) {
|
||||||
if (!canAddGoods()) {
|
if (!canAddGoods()) {
|
||||||
return infoBox.showToast('清先选择桌台',0.5).then(res=>{
|
return infoBox.showToast('清先选择桌台', 0.5).then(res => {
|
||||||
chooseTable()
|
chooseTable()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -778,7 +781,7 @@
|
|||||||
}
|
}
|
||||||
async function goodsUpdate(foodsindex, index, isAdd) {
|
async function goodsUpdate(foodsindex, index, isAdd) {
|
||||||
if (!canAddGoods()) {
|
if (!canAddGoods()) {
|
||||||
return infoBox.showToast('请先选择桌台',0.5).then(res=>{
|
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||||
chooseTable()
|
chooseTable()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -977,14 +980,27 @@
|
|||||||
setUser()
|
setUser()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
watch(() => data.table.tableId, (newval) => {
|
watch(() => data.table.tableId, (newval, oldval) => {
|
||||||
console.log(newval);
|
onSelTable()
|
||||||
init()
|
|
||||||
})
|
})
|
||||||
|
async function onSelTable() {
|
||||||
|
const {
|
||||||
|
masterId
|
||||||
|
} = await getMasterId()
|
||||||
|
data.masterId = masterId
|
||||||
|
const cartRes = await getCart()
|
||||||
|
cars.length = 0
|
||||||
|
const cartArr = getNowCart(cartRes.records)
|
||||||
|
for (let i in cartArr) {
|
||||||
|
cars.push(cartArr[i])
|
||||||
|
}
|
||||||
|
setTabBar($category, $originGoods, cars)
|
||||||
|
}
|
||||||
onBeforeUnmount(() => {})
|
onBeforeUnmount(() => {})
|
||||||
|
|
||||||
function watchUpdate() {
|
function watchUpdate() {
|
||||||
uni.$off('update:createOrderIndex')
|
uni.$off('update:createOrderIndex')
|
||||||
|
uni.$off('get:table')
|
||||||
uni.$on('update:createOrderIndex', () => {
|
uni.$on('update:createOrderIndex', () => {
|
||||||
// data.table = {
|
// data.table = {
|
||||||
// tableId: ""
|
// tableId: ""
|
||||||
@@ -993,6 +1009,20 @@
|
|||||||
console.log('update:createOrderIndex');
|
console.log('update:createOrderIndex');
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
|
uni.$on('get:table', () => {
|
||||||
|
console.log('get:table');
|
||||||
|
if (data.table.tableId) {
|
||||||
|
$table.get({
|
||||||
|
qrcode: data.table.tableId
|
||||||
|
}).then(res => {
|
||||||
|
if (res.content[0] && res.content[0].status != 'idle') {
|
||||||
|
data.table = {
|
||||||
|
tableId: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
// watchChooseuser()
|
// watchChooseuser()
|
||||||
@@ -1000,16 +1030,18 @@
|
|||||||
watchUpdate()
|
watchUpdate()
|
||||||
})
|
})
|
||||||
let isCreateOrderToDetail = ref(false)
|
let isCreateOrderToDetail = ref(false)
|
||||||
let option={type:''}
|
let option = {
|
||||||
|
type: ''
|
||||||
|
}
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
console.log(opt)
|
console.log(opt)
|
||||||
option=opt
|
option = opt
|
||||||
Object.assign(data.table, opt)
|
Object.assign(data.table, opt)
|
||||||
if (opt.useType) {
|
if (opt.useType) {
|
||||||
uni.setStorageSync('useType', opt.useType)
|
uni.setStorageSync('useType', opt.useType)
|
||||||
}
|
}
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title:(opt&&opt.type=='add')?'顾客加菜':'代客下单'
|
title: (opt && opt.type == 'add') ? '顾客加菜' : '代客下单'
|
||||||
})
|
})
|
||||||
if (JSON.stringify(opt) == '{}') {
|
if (JSON.stringify(opt) == '{}') {
|
||||||
isCreateOrderToDetail.value = true
|
isCreateOrderToDetail.value = true
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<template>
|
|
||||||
<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>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>{{data.name||'餐位费'}}</view>
|
|
||||||
<view>x{{data.number}}</view>
|
|
||||||
<view>¥{{data.number}}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
const props = defineProps({
|
|
||||||
data: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
table:{
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const statusMap={
|
|
||||||
unpaid:'未支付'
|
|
||||||
}
|
|
||||||
function returnStatus(status){
|
|
||||||
return statusMap[status]||''
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
</style>
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
|
|
||||||
<view class="u-font-32 font-bold">
|
|
||||||
<text>共</text>
|
|
||||||
<text class="color-main font-bold"> {{goodsNumber}}</text>
|
|
||||||
<text>份菜品</text>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
|
|
||||||
<view class="u-font-32"> 第{{ order.placeNum }}次下单
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-20 list">
|
|
||||||
<view class="item u-m-b-20" v-for="(item,index) in order.info" :key="index">
|
|
||||||
<view class="u-flex u-col-top">
|
|
||||||
<view>
|
|
||||||
<image class="img" :src="item.coverImg" mode=""></image>
|
|
||||||
</view>
|
|
||||||
<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>
|
|
||||||
<view :class="{'line-th':item.status=='return'}">{{item.name}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-text-right">
|
|
||||||
<view>¥{{item.salePrice}}</view>
|
|
||||||
<view v-if="item.status=='return'" class="line-th color-666 u-font-24">¥{{item.salePrice}}</view>
|
|
||||||
<view class="u-m-t-10 u-font-24">X{{item.number}}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
|
||||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
|
||||||
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="bg-gray u-p-20 u-m-t-20">
|
|
||||||
<view>备注</view>
|
|
||||||
<view class="u-m-t-10">无</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="u-m-t-40">
|
|
||||||
<view class="u-flex u-row-between border-bottom u-p-b-20">
|
|
||||||
<view class="tag no-pay">
|
|
||||||
未支付
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<text>小计¥</text>
|
|
||||||
<text class="font-bold u-font-32">{{allPrice}}</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">{{seatFee*1+allPrice*1}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-30">
|
|
||||||
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import {
|
|
||||||
computed
|
|
||||||
} from 'vue';
|
|
||||||
import color from '@/commons/color.js'
|
|
||||||
const emits=defineEmits(['tuicai'])
|
|
||||||
function tuicai(item,index){
|
|
||||||
emits('tuicai',item,index)
|
|
||||||
}
|
|
||||||
const props = defineProps({
|
|
||||||
data: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
},
|
|
||||||
seatFee:{
|
|
||||||
type:[String,Number],
|
|
||||||
default:0
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const allPrice = computed(() => {
|
|
||||||
return props.data.reduce((prve, cur) => {
|
|
||||||
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
|
|
||||||
return a+b.salePrice * b.number
|
|
||||||
},0)
|
|
||||||
return prve + curTotal
|
|
||||||
}, 0).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 * 1;
|
|
||||||
}, 0);
|
|
||||||
return a + bTotal
|
|
||||||
}, 0)
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
function printOrder(){
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.img {
|
|
||||||
width: 70rpx;
|
|
||||||
height: 70rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-bottom {
|
|
||||||
border-color: rgb(240, 240, 240);
|
|
||||||
}
|
|
||||||
.line-th{
|
|
||||||
text-decoration: line-through;
|
|
||||||
}
|
|
||||||
.tag {
|
|
||||||
padding: 2rpx 8rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
|
|
||||||
&.no-pay {
|
|
||||||
background-color: rgb(170, 170, 170);
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.tui{
|
|
||||||
background-color: rgb(239, 239, 239);
|
|
||||||
border-radius: 4rpx;
|
|
||||||
margin-right: 6rpx;
|
|
||||||
color: #666;
|
|
||||||
padding: 0 4rpx;
|
|
||||||
font-size: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
|
||||||
<view class="u-flex u-row-between">
|
|
||||||
<view>订单状态</view>
|
|
||||||
<view>{{returnStatus(data.status)}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>订单类型</view>
|
|
||||||
<view>堂食</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>桌位号</view>
|
|
||||||
<view>{{table.name}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>就餐人数</view>
|
|
||||||
<view>{{seatFee.totalNumber}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>支付方式</view>
|
|
||||||
<view></view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>预约时间</view>
|
|
||||||
<view></view>
|
|
||||||
</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>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>订单编号</view>
|
|
||||||
<view>{{data.orderNo}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-row-between u-m-t-20">
|
|
||||||
<view>商家备注</view>
|
|
||||||
<my-button plain shape="circle" :width="160" :height="60">编辑</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import orderEnum from '@/commons/orderEnum.js'
|
|
||||||
const props = defineProps({
|
|
||||||
data: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
table:{
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
seatFee:{
|
|
||||||
type: Object,
|
|
||||||
default: () => {totalNumber:0}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function returnStatus(status){
|
|
||||||
const item=orderEnum.status.find(v=>v.key==status)
|
|
||||||
return item?item.label:''
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
</style>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
|
||||||
<up-steps :dot="true" current="0" direction="column">
|
|
||||||
<up-steps-item title="2024-09-02 09:19" :itemStyle="itemStyle" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
|
|
||||||
</up-steps-item>
|
|
||||||
<up-steps-item title="2024-09-02 09:19" desc="[东风(id:124413)]使用代客下单提交。(未打印预结单)">
|
|
||||||
</up-steps-item>
|
|
||||||
</up-steps>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import {
|
|
||||||
reactive
|
|
||||||
} from 'vue';
|
|
||||||
import color from '@/commons/color.js'
|
|
||||||
const itemStyle = reactive({
|
|
||||||
color: 'rgb(255,0,0)'
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
<template>
|
|
||||||
<my-model title="退菜" ref="model" @close="onModelClose" @open="onModelOpen">
|
|
||||||
<template #desc>
|
|
||||||
<view class="u-p-30 u-text-left">
|
|
||||||
<view>
|
|
||||||
{{data.name}}
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-m-t-32">
|
|
||||||
<up-number-box :buttonSize="44" :inputWidth="220" v-model="number"></up-number-box>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-32">
|
|
||||||
<view class="u-font-24">
|
|
||||||
<text class="color-999">退菜理由</text>
|
|
||||||
<text class="color-red">*</text>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-flex-wrap u-m-t-24">
|
|
||||||
<view class="u-flex u-m-r-16 u-m-b-16" v-for="(item,index) in tags" :key="index">
|
|
||||||
<up-tag @click="changeTagSel(item)" :text="item.label" plain v-if="item.checked"> </up-tag>
|
|
||||||
<up-tag @click="changeTagSel(item)" borderColor="#E5E5E5" color="#999" :text="item.label" plain v-else> </up-tag>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-24">
|
|
||||||
<up-input placeholder="备注"></up-input>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<template #btn>
|
|
||||||
<view class="u-p-t-18 u-p-l-30 u-p-r-30 u-p-b-30">
|
|
||||||
<my-button box-shadow shape="circle" @tap="confirm">确认退菜</my-button>
|
|
||||||
<view class="u-m-t-10">
|
|
||||||
<my-button @tap="toggleModelShow" shape="circle" bgColor="#fff" type="cancel" box-shadow>取消</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
</my-model>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import {
|
|
||||||
ref,
|
|
||||||
watch
|
|
||||||
} from 'vue';
|
|
||||||
const props = defineProps({
|
|
||||||
data: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {}
|
|
||||||
},
|
|
||||||
show: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const emits = defineEmits(['update:show','confirm'])
|
|
||||||
let model = ref(null)
|
|
||||||
let modelShow = ref(props.show)
|
|
||||||
let number = ref(1)
|
|
||||||
const tags=ref([{label:"点错",checked:false},{label:"不想要了",checked:false} ,{label:"食材不足",checked:false} ,{label:"等待时间过长",checked:false}])
|
|
||||||
function changeTagSel(item){
|
|
||||||
item.checked=!item.checked
|
|
||||||
}
|
|
||||||
watch(() => props.show, (newval) => {
|
|
||||||
modelShow.value = newval
|
|
||||||
})
|
|
||||||
watch(() => modelShow.value, (newval) => {
|
|
||||||
emits('update:show', newval)
|
|
||||||
if (newval) {
|
|
||||||
open()
|
|
||||||
} else {
|
|
||||||
close()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function toggleModelShow(show){
|
|
||||||
modelShow.value=show?true:false
|
|
||||||
}
|
|
||||||
|
|
||||||
function onModelClose() {
|
|
||||||
modelShow.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
function onModelOpen() {
|
|
||||||
modelShow.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
function open() {
|
|
||||||
model.value.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
function close() {
|
|
||||||
model.value.close()
|
|
||||||
}
|
|
||||||
function confirm(){
|
|
||||||
emits('confirm')
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="u-font-28 default-box-padding u-relative bg-fff border-r-12 u-overflow-hide">
|
|
||||||
<view class="change u-absolute my-bg-main color-fff left-top" >切换</view>
|
|
||||||
<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"></up-avatar>
|
|
||||||
<view class="color-666 u-m-l-30">未绑定手机号</view>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<my-button :height="60" plain shape="circle">他的订单</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex u-m-t-20 u-row-between">
|
|
||||||
<view class="">
|
|
||||||
<view class="font-bold">0.00</view>
|
|
||||||
<view class="color-666 u-m-t-10">余额</view>
|
|
||||||
</view>
|
|
||||||
<view class="">
|
|
||||||
<view class="font-bold">0.00</view>
|
|
||||||
<view class="color-666 u-m-t-10">积分</view>
|
|
||||||
</view>
|
|
||||||
<view class="">
|
|
||||||
<view class="font-bold">0.00</view>
|
|
||||||
<view class="color-666 u-m-t-10">已消费</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.change{
|
|
||||||
padding: 4rpx 16rpx;
|
|
||||||
border-radius: 0 0 16rpx 0;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="min-page bg-gray u-font-28 u-p-30">
|
|
||||||
<user-vue></user-vue>
|
|
||||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
|
|
||||||
<text class="color-666">桌位号:</text>
|
|
||||||
<text class="font-bold">{{options.name}}</text>
|
|
||||||
</view>
|
|
||||||
<goods-list :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount"
|
|
||||||
@tuicai="onTuiCai"></goods-list>
|
|
||||||
<extra-vue :data="orderDetail.seatFee"></extra-vue>
|
|
||||||
<order-vue :data="orderDetail.info" :table="options" :seatFee="orderDetail.seatFee"></order-vue>
|
|
||||||
<step-vue></step-vue>
|
|
||||||
<view style="height: 200rpx;"></view>
|
|
||||||
<view class="u-fixed bottom bg-fff ">
|
|
||||||
<view class="u-flex u-abso">
|
|
||||||
<view class="u-flex-1">
|
|
||||||
<my-button @tap="diancan" color="#fff" bgColor="rgb(57,53,52)" borderRadius="100rpx 0 0 100rpx"
|
|
||||||
shape="circle" plain type="primary">加菜</my-button>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex-1">
|
|
||||||
<my-button @tap="toPay" borderRadius="0 100rpx 100rpx 0" shape="circle"
|
|
||||||
type="primary">结账</my-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import * as Api from '@/http/yskApi/Instead.js'
|
|
||||||
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 {
|
|
||||||
onLoad,
|
|
||||||
onShow,
|
|
||||||
onHide
|
|
||||||
} from '@dcloudio/uni-app';
|
|
||||||
import {
|
|
||||||
reactive
|
|
||||||
} from 'vue';
|
|
||||||
import OrderDetail from './page.js'
|
|
||||||
const tuicai = reactive({
|
|
||||||
show: false,
|
|
||||||
selGoods: ''
|
|
||||||
})
|
|
||||||
|
|
||||||
function onTuiCai(goods, index) {
|
|
||||||
tuicai.show = true
|
|
||||||
tuicai.selGoods = goods
|
|
||||||
}
|
|
||||||
|
|
||||||
async function tuicaiConfirm() {
|
|
||||||
const res=await Api.$returnCart({
|
|
||||||
cartId: tuicai.selGoods.id,
|
|
||||||
tableId:options.tableId,
|
|
||||||
})
|
|
||||||
tuicai.selGoods.status='return'
|
|
||||||
tuicai.show = false
|
|
||||||
}
|
|
||||||
const uiPage = new OrderDetail()
|
|
||||||
setTimeout(() => {
|
|
||||||
uiPage.setVal('user', {
|
|
||||||
name: 1
|
|
||||||
})
|
|
||||||
}, 1500)
|
|
||||||
|
|
||||||
function diancan() {
|
|
||||||
go.to('PAGES_CREATE_ORDER', {
|
|
||||||
tableId: options.tableId,
|
|
||||||
tableName: options.name,
|
|
||||||
type: 'add'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function toPay() {
|
|
||||||
go.to('PAGES_CRESATE_ORDER_PAY', {
|
|
||||||
tableId: options.tableId,
|
|
||||||
tableName: options.name,
|
|
||||||
masterId: options.masterId,
|
|
||||||
orderId: orderDetail.info.id,
|
|
||||||
discount: 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const orderDetail = reactive({
|
|
||||||
goodsList: [],
|
|
||||||
info: {},
|
|
||||||
seatFee: {
|
|
||||||
totalAmount: 0
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const options = reactive({})
|
|
||||||
async function init() {
|
|
||||||
const {
|
|
||||||
masterId
|
|
||||||
} = await Api.$getMasterId(options)
|
|
||||||
console.log(masterId);
|
|
||||||
options.masterId = masterId
|
|
||||||
const {
|
|
||||||
records,
|
|
||||||
seatFee
|
|
||||||
} = await Api.getCart({
|
|
||||||
...options,
|
|
||||||
masterId
|
|
||||||
})
|
|
||||||
orderDetail.goodsList = records
|
|
||||||
orderDetail.seatFee = seatFee
|
|
||||||
const info = await Api.$createOrder({
|
|
||||||
masterId,
|
|
||||||
vipUserId: '',
|
|
||||||
tableId: options.tableId,
|
|
||||||
note: '',
|
|
||||||
postPay: true,
|
|
||||||
orderld: ''
|
|
||||||
})
|
|
||||||
orderDetail.info = info
|
|
||||||
}
|
|
||||||
|
|
||||||
function watchEmit() {
|
|
||||||
uni.$off('orderDetail:update')
|
|
||||||
uni.$once('orderDetail:update', (newval) => {
|
|
||||||
console.log(newval);
|
|
||||||
init()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
onShow(() => {
|
|
||||||
watchEmit()
|
|
||||||
})
|
|
||||||
onLoad((opt) => {
|
|
||||||
Object.assign(options, opt)
|
|
||||||
console.log(options);
|
|
||||||
init()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.bottom {
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
height: 68rpx;
|
|
||||||
|
|
||||||
.u-abso {
|
|
||||||
bottom: 84rpx;
|
|
||||||
left: 28rpx;
|
|
||||||
right: 28rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import {
|
|
||||||
reactive, ref
|
|
||||||
} from 'vue';
|
|
||||||
function isSameType(a, b) {
|
|
||||||
return a instanceof b === true || b instanceof a === true;
|
|
||||||
}
|
|
||||||
class OrderDetail {
|
|
||||||
constructor(data) {
|
|
||||||
const user ={}
|
|
||||||
const table = {}
|
|
||||||
const goodsList =[]
|
|
||||||
const orderInfo = {}
|
|
||||||
this.data=reactive({
|
|
||||||
user,table,goodsList,orderInfo
|
|
||||||
})
|
|
||||||
Object.assign(this, data)
|
|
||||||
}
|
|
||||||
setVal(key,val){
|
|
||||||
this.data[key]=val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default OrderDetail
|
|
||||||
@@ -1,288 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="bg-gray min-page u-p-30 u-font-28">
|
|
||||||
<view class="u-p-t-60 u-p-b-60 u-text-center">
|
|
||||||
<view class="u-font-32 ">
|
|
||||||
<text class="price-fuhao">¥</text>
|
|
||||||
<text class="font-bold price">{{order.amount}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-10 color-999 old-price">
|
|
||||||
<text class="">¥</text>
|
|
||||||
<text class=" ">{{order.amount}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-10 u-flex u-row-center color-main">
|
|
||||||
<view @click="showModel('editMoney',true)">修改</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 u-m-t-30">
|
|
||||||
<view class="u-flex border-bottom-dashed u-row-between u-p-b-30">
|
|
||||||
<view>优惠券</view>
|
|
||||||
<view class="color-999 u-flex u-col-center">
|
|
||||||
<text>选择优惠券</text>
|
|
||||||
<view class="u-flex u-col-center">
|
|
||||||
<uni-icons type="right"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
|
||||||
<my-tabs :list="pays.list" v-model="pays.selIndex"></my-tabs>
|
|
||||||
<template v-if="pays.selIndex==0">
|
|
||||||
<view class="list">
|
|
||||||
<view class="item" @click="changePayType(index)" v-for="(item,index) in pays.payTypes.list"
|
|
||||||
:key="index">
|
|
||||||
<view class="u-flex u-row-between u-p-t-30 u-p-b-30 border-bottom">
|
|
||||||
<view class="u-flex">
|
|
||||||
<image class="icon" :src="item.icon" mode=""></image>
|
|
||||||
<text class="u-m-l-10">{{item.payName}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="u-flex color-999 u-font-24">
|
|
||||||
<!-- <view class="u-m-r-20">
|
|
||||||
<text>余额:</text>
|
|
||||||
<text>¥0.00</text>
|
|
||||||
</view> -->
|
|
||||||
<my-radio @click="changePayType(index)" :modelValue="index==pays.payTypes.selIndex">
|
|
||||||
</my-radio>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="u-m-t-60 u-p-b-30">
|
|
||||||
<my-button @click="payOrder">确认付款</my-button>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<view class="">
|
|
||||||
<view class="u-font-32 u-m-t-40 u-text-center">请让顾客使用微信扫码</view>
|
|
||||||
<view class="u-flex u-row-center u-m-t-40">
|
|
||||||
<image style="width: 300rpx;height: 300rpx;" src="@/static/logo.png" mode=""></image>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card top border-r-12 ">
|
|
||||||
|
|
||||||
</view>
|
|
||||||
<view class="bg-fff box-shadow u-p-t-30 u-p-l-50 u-p-r-50 card bottom border-r-12 ">
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="order.amount"></edit-discount>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import {
|
|
||||||
reactive,
|
|
||||||
onMounted,
|
|
||||||
watch,
|
|
||||||
ref
|
|
||||||
} from 'vue';
|
|
||||||
import {
|
|
||||||
onLoad,
|
|
||||||
onBackPress
|
|
||||||
} from '@dcloudio/uni-app'
|
|
||||||
import * as Api from '@/http/yskApi/Instead.js'
|
|
||||||
import infoBox from '@/commons/utils/infoBox.js'
|
|
||||||
import editDiscount from '/pagesCreateOrder/components/edit-discount.vue'
|
|
||||||
import {
|
|
||||||
queryAllShopUser
|
|
||||||
} from '@/http/yskApi/shop-user.js'
|
|
||||||
const pays = reactive({
|
|
||||||
list: ['扫码收款', '二维码收款'],
|
|
||||||
selIndex: 0,
|
|
||||||
payTypes: {
|
|
||||||
list: [],
|
|
||||||
selIndex: 0
|
|
||||||
}
|
|
||||||
})
|
|
||||||
let option = opt
|
|
||||||
onBackPress(()=>{
|
|
||||||
console.log('-------------------');
|
|
||||||
console.log('onBackPress');
|
|
||||||
})
|
|
||||||
const models = new Map();
|
|
||||||
|
|
||||||
function setModel(el) {
|
|
||||||
if (el && el.$attrs['name']) {
|
|
||||||
models.set(el.$attrs['name'], el);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showModel(key) {
|
|
||||||
const model = models.get(key)
|
|
||||||
model && model.open()
|
|
||||||
}
|
|
||||||
|
|
||||||
let user = ref({})
|
|
||||||
async function getPayType() {
|
|
||||||
const payTypeList = await Api.$getPayType()
|
|
||||||
pays.payTypes.list = payTypeList
|
|
||||||
}
|
|
||||||
|
|
||||||
function changePayType(i) {
|
|
||||||
pays.payTypes.selIndex = i
|
|
||||||
}
|
|
||||||
//支付成功回调
|
|
||||||
function paySuccess() {
|
|
||||||
infoBox.showToast('支付成功')
|
|
||||||
setTimeout(() => {
|
|
||||||
// uni.$emit('orderDetail:update')
|
|
||||||
uni.$emit('update:createOrderIndex')
|
|
||||||
console.log('update:createOrderIndex');
|
|
||||||
uni.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
async function payOrder(code) {
|
|
||||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
|
||||||
console.log({
|
|
||||||
tableId: order.tableId,
|
|
||||||
masterId: order.masterId,
|
|
||||||
orderId: order.id || order.orderId,
|
|
||||||
payType,
|
|
||||||
vipUserId: order.userId,
|
|
||||||
discount: 1,
|
|
||||||
code: code
|
|
||||||
});
|
|
||||||
await Api.$payOrder({
|
|
||||||
tableId: order.tableId,
|
|
||||||
masterId: order.masterId,
|
|
||||||
orderId: order.id || order.orderId,
|
|
||||||
payType,
|
|
||||||
vipUserId: order.userId,
|
|
||||||
code: code
|
|
||||||
})
|
|
||||||
paySuccess()
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
getPayType()
|
|
||||||
})
|
|
||||||
const order = reactive({
|
|
||||||
amount: 0
|
|
||||||
})
|
|
||||||
|
|
||||||
function saomaPay() {
|
|
||||||
const item = pays.payTypes.list[pays.payTypes.selIndex]
|
|
||||||
uni.scanCode({
|
|
||||||
onlyFromCamera: true,
|
|
||||||
success: function(res) {
|
|
||||||
console.log('条码类型:' + res.scanType);
|
|
||||||
console.log('条码内容:' + res.result);
|
|
||||||
payOrder(res.result)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
watch(() => pays.payTypes.selIndex, (newval) => {
|
|
||||||
const item = pays.payTypes.list[newval]
|
|
||||||
if (item.payType == "vipPay") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (item.payType == "deposit") {
|
|
||||||
//储值卡支付
|
|
||||||
return saomaPay('deposit')
|
|
||||||
}
|
|
||||||
if (item.payType == "scanCode") {
|
|
||||||
//扫码支付
|
|
||||||
return saomaPay('scanCode')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
onLoad((opt) => {
|
|
||||||
option = opt
|
|
||||||
console.log(opt);
|
|
||||||
Object.assign(order, opt)
|
|
||||||
if (order.userId) {
|
|
||||||
queryAllShopUser({
|
|
||||||
id: opt.userId
|
|
||||||
}).then(res => {
|
|
||||||
user.value = res.content[0] || opt
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.box-shadow {
|
|
||||||
box-shadow: 0 0 5px #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
width: 40rpx;
|
|
||||||
height: 40rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-bottom-dashed {
|
|
||||||
border-bottom: 1px dashed #bbb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.border-bottom {
|
|
||||||
border-color: rgb(240, 240, 240);
|
|
||||||
}
|
|
||||||
|
|
||||||
.list {
|
|
||||||
.item:last-child {
|
|
||||||
.border-bottom {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.old-price {
|
|
||||||
text-decoration: line-through;
|
|
||||||
}
|
|
||||||
|
|
||||||
.price-fuhao {
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.price {
|
|
||||||
font-size: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dotSize: 20rpx;
|
|
||||||
$position: calc($dotSize / (-2));
|
|
||||||
|
|
||||||
.card {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::after,
|
|
||||||
&:before {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
position: absolute;
|
|
||||||
background-color: #F9F9F9;
|
|
||||||
width: $dotSize;
|
|
||||||
height: $dotSize;
|
|
||||||
box-shadow: 0 0 5px #eee;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.top {
|
|
||||||
&::after {
|
|
||||||
right: $position;
|
|
||||||
bottom: $position;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
left: $position;
|
|
||||||
bottom: $position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.bottom {
|
|
||||||
&::after {
|
|
||||||
right: $position;
|
|
||||||
top: $position;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
left: $position;
|
|
||||||
top: $position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user