代客下单更新部分页面跳转请求。页面展示
This commit is contained in:
parent
2b5aa1275b
commit
5a973af47a
|
|
@ -25,7 +25,8 @@
|
|||
<view class="u-flex color-666">
|
||||
<radio-group @change="radioGroupChange">
|
||||
<label class="radio u-m-r-60" v-for="(item,index) in eatTypes.list" :key="index">
|
||||
<radio :value="''+index" :checked="index === eatTypes.active" class="scale7 " />
|
||||
<radio :value="''+item.value" :checked="item.value == eatTypes.active"
|
||||
class="scale7 " />
|
||||
<text>{{item.label}}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
|
|
@ -176,10 +177,10 @@
|
|||
|
||||
<view class="u-flex u-row-between u-m-t-30 u-p-b-34 border-bottom">
|
||||
<view>
|
||||
<text v-if="eatTypes.active==1">包装费</text>
|
||||
<text v-if="eatTypes.active==2">包装费</text>
|
||||
<text v-else>桌位费</text>
|
||||
</view>
|
||||
<view>¥0.00</view>
|
||||
<view>¥{{$seatFee.totalAmount||'0.00'}}</view>
|
||||
</view>
|
||||
|
||||
<view class="u-flex u-row-right u-m-t-38">
|
||||
|
|
@ -218,13 +219,15 @@
|
|||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,onShow
|
||||
onLoad,
|
||||
onShow
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
ref,
|
||||
onBeforeUnmount,
|
||||
reactive,
|
||||
computed
|
||||
computed,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myButton from '@/components/my-components/my-button'
|
||||
import modelDiscount from './components/discount'
|
||||
|
|
@ -237,9 +240,11 @@
|
|||
} from '@/commons/utils/format.js';
|
||||
import color from '@/commons/color.js';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {getNowCart} from '@/pagesCreateOrder/util.js'
|
||||
const models = new Map();
|
||||
//备注
|
||||
let note=ref('')
|
||||
let note = ref('')
|
||||
|
||||
function setModel(el) {
|
||||
if (el && el.$attrs['name']) {
|
||||
models.set(el.$attrs['name'], el);
|
||||
|
|
@ -264,6 +269,18 @@
|
|||
}),
|
||||
defaultCateIndex: 1,
|
||||
})
|
||||
watch(() => userNumbers.defaultCateIndex, (newval) => {
|
||||
updateChoseCount()
|
||||
})
|
||||
|
||||
//更新就餐人数
|
||||
async function updateChoseCount(){
|
||||
await Api.$choseCount({
|
||||
masterId: option.masterId,
|
||||
tableId: option.tableId,
|
||||
num: userNumbers.defaultCateIndex,
|
||||
})
|
||||
}
|
||||
|
||||
function userNumberChange(e) {
|
||||
userNumbers.defaultCateIndex = e.detail.value
|
||||
|
|
@ -299,11 +316,11 @@
|
|||
const eatTypes = reactive({
|
||||
list: [{
|
||||
label: '堂食',
|
||||
value: '1'
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: '自取',
|
||||
value: '2'
|
||||
value: 2
|
||||
},
|
||||
],
|
||||
active: 1
|
||||
|
|
@ -311,7 +328,6 @@
|
|||
|
||||
function radioGroupChange(e) {
|
||||
eatTypes.active = e.detail.value
|
||||
console.log(eatTypes.active);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -320,7 +336,7 @@
|
|||
}
|
||||
|
||||
function chooseTable() {
|
||||
go.to('PAGES_CHOOSE_TABLE',{
|
||||
go.to('PAGES_CHOOSE_TABLE', {
|
||||
...table.value
|
||||
})
|
||||
}
|
||||
|
|
@ -336,6 +352,16 @@
|
|||
})
|
||||
}
|
||||
let table = ref(null)
|
||||
//监听桌台改变
|
||||
watch(() => table.value, (newval, oldval) => {
|
||||
if (newval && oldval) {
|
||||
Api.$choseTable({
|
||||
orderId: 4462,
|
||||
oldTableId: oldval.tableId,
|
||||
newTableId: newval.tableId,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
function watchChooseTable() {
|
||||
uni.$off('choose-table')
|
||||
|
|
@ -344,7 +370,7 @@
|
|||
console.log(table.value);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const option = reactive({
|
||||
masterId: '',
|
||||
tableId: ""
|
||||
|
|
@ -360,6 +386,11 @@
|
|||
}, 0)
|
||||
return result
|
||||
})
|
||||
//餐位费
|
||||
const $seatFee = reactive({
|
||||
totalNumber: 0,
|
||||
totalAmount: 0,
|
||||
})
|
||||
const allPrice = computed(() => {
|
||||
return goods.list.reduce((prve, cur) => {
|
||||
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
|
||||
|
|
@ -380,43 +411,49 @@
|
|||
masterId: option.masterId,
|
||||
tableId: option.tableId
|
||||
}) {
|
||||
const res = await Api.getCart(par)
|
||||
goods.list = res.records.map(item => {
|
||||
return {
|
||||
...item,
|
||||
isPack: returnBoolean(item.isPack),
|
||||
isGift: returnBoolean(item.isGift)
|
||||
}
|
||||
})
|
||||
const {
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart(par)
|
||||
goods.list =getNowCart(records)
|
||||
if(seatFee&&seatFee.totalNumber){
|
||||
userNumbers.defaultCateIndex = seatFee.totalNumber || 1
|
||||
Object.assign($seatFee, seatFee)
|
||||
}
|
||||
|
||||
console.log(goods.list);
|
||||
}
|
||||
|
||||
|
||||
// 创建订单
|
||||
async function createOrder(par = {
|
||||
masterId: option.masterId,
|
||||
vipUserId:user.value?user.value.id:'',
|
||||
note:note.value,
|
||||
postPay:true,
|
||||
orderId:'',
|
||||
vipUserId: user.value ? user.value.id : '',
|
||||
note: note.value,
|
||||
postPay: true,
|
||||
orderId: '',
|
||||
tableId: option.tableId
|
||||
}) {
|
||||
updateChoseCount()
|
||||
const res = await Api.$createOrder(par)
|
||||
uni.showToast({
|
||||
title:'提交成功',
|
||||
icon:'none'
|
||||
title: '提交成功',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack({delta:2})
|
||||
},500)
|
||||
setTimeout(() => {
|
||||
uni.$emit('orderDetail:update')
|
||||
uni.navigateBack({
|
||||
delta: 2
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
|
||||
|
||||
onLoad((opt) => {
|
||||
console.log(opt);
|
||||
Object.assign(option, opt)
|
||||
if(opt){
|
||||
table.value={
|
||||
tableId:opt.tableId,
|
||||
name:opt.tableName
|
||||
if (opt) {
|
||||
table.value = {
|
||||
tableId: opt.tableId,
|
||||
name: opt.tableName
|
||||
}
|
||||
}
|
||||
getCart()
|
||||
|
|
@ -424,11 +461,10 @@
|
|||
onBeforeUnmount(() => {
|
||||
|
||||
})
|
||||
onShow(()=>{
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
watchChooseTable()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<view class="search u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
|
||||
:focus="true" v-model="searchValue">
|
||||
v-model="searchValue">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
|
|
@ -70,18 +70,18 @@
|
|||
</scroll-view>
|
||||
</view>
|
||||
<view class="bottom w-full">
|
||||
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId"
|
||||
:table="data.table"
|
||||
:data="cars" @clear="onClearCart"></my-car>
|
||||
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
|
||||
:data="cars" @clear="onClearCart"></my-car>
|
||||
</view>
|
||||
|
||||
<!-- 选择规格 -->
|
||||
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :title="guigeModelData.title"
|
||||
:sku-map="guigeModelData.chooseGoods.skuMap" :skus="guigeModelData.chooseGoods.skus"></guige-model>
|
||||
<!-- 添加附加费 -->
|
||||
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
|
||||
|
||||
<!-- 选择规格 -->
|
||||
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel"
|
||||
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
|
||||
:skus="guigeModelData.chooseGoods.skus"></guige-model>
|
||||
<!-- 添加附加费 -->
|
||||
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import _ from 'lodash';
|
||||
|
|
@ -112,6 +112,7 @@
|
|||
import myCar from './components/car'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import infoBox from '@/commons/utils/infoBox.js';
|
||||
import {getNowCart} from '@/pagesCreateOrder/util.js'
|
||||
const cars = reactive([])
|
||||
const data = reactive({
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
|
|
@ -302,9 +303,11 @@
|
|||
data.masterId = masterId
|
||||
const cartRes = await getCart()
|
||||
cars.length = 0
|
||||
for (let i in cartRes.records) {
|
||||
cars.push(cartRes.records[i])
|
||||
const cartArr =getNowCart(cartRes.records)
|
||||
for (let i in cartArr) {
|
||||
cars.push(cartArr[i])
|
||||
}
|
||||
|
||||
const categoryRes = await getCategory()
|
||||
const category = categoryRes.content.reduce((prve, cur) => {
|
||||
prve.push({
|
||||
|
|
@ -329,7 +332,7 @@
|
|||
|
||||
// 监听选择用户事件
|
||||
|
||||
|
||||
|
||||
|
||||
const surcharge = ref(null)
|
||||
|
||||
|
|
@ -663,15 +666,15 @@
|
|||
onReady(() => {
|
||||
getMenuItemTop()
|
||||
})
|
||||
|
||||
let isTabClickOver=true
|
||||
|
||||
let isTabClickOver = true
|
||||
// 点击左边的栏目切换
|
||||
async function swichMenu(index) {
|
||||
if (data.arr.length == 0) {
|
||||
await getMenuItemTop();
|
||||
}
|
||||
if (index == data.current) return;
|
||||
isTabClickOver=false;
|
||||
isTabClickOver = false;
|
||||
data.scrollRightTop = data.oldScrollTop;
|
||||
nextTick(function() {
|
||||
data.scrollRightTop = data.arr[index] + data.topZhanwei;
|
||||
|
|
@ -717,12 +720,12 @@
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 设置左边菜单的滚动状态
|
||||
async function leftMenuStatus(index) {
|
||||
if(!isTabClickOver){
|
||||
if (!isTabClickOver) {
|
||||
return
|
||||
}
|
||||
data.current = index;
|
||||
|
|
@ -755,9 +758,9 @@
|
|||
}).exec()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 右边菜单滚动
|
||||
async function rightScroll(e) {
|
||||
data.oldScrollTop = e.detail.scrollTop;
|
||||
|
|
@ -777,16 +780,17 @@
|
|||
let height2 = data.arr[i + 1];
|
||||
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
|
||||
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
|
||||
if(isTabClickOver){
|
||||
if (isTabClickOver) {
|
||||
leftMenuStatus(i);
|
||||
}else{
|
||||
isTabClickOver=true
|
||||
} else {
|
||||
isTabClickOver = true
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, 10)
|
||||
}
|
||||
|
||||
function watchChooseuser() {
|
||||
uni.$off('choose-user')
|
||||
uni.$on('choose-user', (user) => {
|
||||
|
|
@ -797,14 +801,13 @@
|
|||
setUser()
|
||||
})
|
||||
}
|
||||
onBeforeUnmount(() => {
|
||||
})
|
||||
onShow(()=>{
|
||||
onBeforeUnmount(() => {})
|
||||
onShow(() => {
|
||||
watchChooseuser()
|
||||
})
|
||||
onLoad((opt) => {
|
||||
console.log(opt)
|
||||
Object.assign(data.table,opt)
|
||||
Object.assign(data.table, opt)
|
||||
if (!opt.tableId) {
|
||||
infoBox.showErrorToast('暂不支持不选择台桌下载,请从桌台点餐')
|
||||
return setTimeout(() => {
|
||||
|
|
@ -813,8 +816,6 @@
|
|||
}
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
<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,37 +1,48 @@
|
|||
<template>
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
|
||||
<view class="u-font-32">
|
||||
<view class="u-font-32 font-bold">
|
||||
<text>共</text>
|
||||
<text class="color-main font-bold"> {{goodsNumber}}</text>
|
||||
<text>份菜品</text>
|
||||
</view>
|
||||
<view class="u-m-t-20 list">
|
||||
<view class="item u-m-b-20" v-for="(item,index) in data" :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>{{item.name}}</view>
|
||||
<view class="u-text-right">
|
||||
<view>¥{{item.salePrice}}</view>
|
||||
<view class="u-m-t-10 u-font-24">X{{item.number}}</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 class="u-flex u-row-right gap-20 u-m-t-20">
|
||||
<my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button>
|
||||
<my-button :width="168" :height="60" plain shape="circle">退菜</my-button>
|
||||
</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="bg-gray u-p-20 u-m-t-20 ">
|
||||
<view>备注</view>
|
||||
<view class="u-m-t-10">无</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">
|
||||
|
|
@ -47,11 +58,11 @@
|
|||
<view></view>
|
||||
<view>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{allPrice}}</text>
|
||||
<text class="font-bold u-font-32">{{seatFee*1+allPrice*1}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-30">
|
||||
<my-button type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||
<my-button @tap="printOrder" type="cancel" :color="color.ColorMain">重新打印</my-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -62,25 +73,42 @@
|
|||
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) => {
|
||||
return prve + cur.salePrice * cur.number
|
||||
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((prve, cur) => {
|
||||
return prve + cur.number
|
||||
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>
|
||||
|
|
@ -88,9 +116,13 @@
|
|||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
.border-bottom{
|
||||
|
||||
.border-bottom {
|
||||
border-color: rgb(240, 240, 240);
|
||||
}
|
||||
.line-th{
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.tag {
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 8rpx;
|
||||
|
|
@ -100,4 +132,13 @@
|
|||
color: #fff;
|
||||
}
|
||||
}
|
||||
.tui{
|
||||
background-color: rgb(239, 239, 239);
|
||||
border-radius: 4rpx;
|
||||
margin-right: 6rpx;
|
||||
color: #666;
|
||||
padding: 0 4rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>就餐人数</view>
|
||||
<view>1</view>
|
||||
<view>{{seatFee.totalNumber}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>支付方式</view>
|
||||
|
|
@ -26,11 +26,11 @@
|
|||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>下单时间</view>
|
||||
<view>2024-08-31 15:54:40</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>2024083115544056362</view>
|
||||
<view>{{data.orderNo}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-20">
|
||||
<view>商家备注</view>
|
||||
|
|
@ -40,6 +40,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
|
|
@ -48,14 +49,16 @@
|
|||
table:{
|
||||
type: Object,
|
||||
default: () => {}
|
||||
},
|
||||
seatFee:{
|
||||
type: Object,
|
||||
default: () => {totalNumber:0}
|
||||
}
|
||||
})
|
||||
|
||||
const statusMap={
|
||||
unpaid:'未支付'
|
||||
}
|
||||
function returnStatus(status){
|
||||
return statusMap[status]||''
|
||||
const item=orderEnum.status.find(v=>v.key==status)
|
||||
return item?item.label:''
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
<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>
|
||||
|
|
@ -5,8 +5,10 @@
|
|||
<text class="color-666">桌位号:</text>
|
||||
<text class="font-bold">{{options.name}}</text>
|
||||
</view>
|
||||
<goods-list :data="orderDetail.goodsList"></goods-list>
|
||||
<order-vue :data="orderDetail.info" :table="options"></order-vue>
|
||||
<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 ">
|
||||
|
|
@ -21,6 +23,8 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<tuicai-vue @confirm="tuicaiConfirm" v-model:show="tuicai.show" :data="tuicai.selGoods"></tuicai-vue>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -30,6 +34,8 @@
|
|||
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,
|
||||
|
|
@ -40,6 +46,24 @@
|
|||
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', {
|
||||
|
|
@ -50,22 +74,27 @@
|
|||
function diancan() {
|
||||
go.to('PAGES_CREATE_ORDER', {
|
||||
tableId: options.tableId,
|
||||
tableName: options.name
|
||||
tableName: options.name,
|
||||
type: 'add'
|
||||
})
|
||||
}
|
||||
|
||||
function toPay() {
|
||||
go.to('PAGES_CRESATE_ORDER_PAY', {
|
||||
...orderDetail.info,
|
||||
tableId: options.tableId,
|
||||
tableName: options.name,
|
||||
masterId: options.masterId,
|
||||
orderId: orderDetail.info.id,
|
||||
discount: 1
|
||||
})
|
||||
}
|
||||
|
||||
const orderDetail = reactive({
|
||||
goodsList: [],
|
||||
info: {}
|
||||
info: {},
|
||||
seatFee: {
|
||||
totalAmount: 0
|
||||
}
|
||||
})
|
||||
const options = reactive({})
|
||||
async function init() {
|
||||
|
|
@ -73,14 +102,16 @@
|
|||
masterId
|
||||
} = await Api.$getMasterId(options)
|
||||
console.log(masterId);
|
||||
options.masterId=masterId
|
||||
options.masterId = masterId
|
||||
const {
|
||||
records
|
||||
records,
|
||||
seatFee
|
||||
} = await Api.getCart({
|
||||
...options,
|
||||
masterId
|
||||
})
|
||||
orderDetail.goodsList = records
|
||||
orderDetail.seatFee = seatFee
|
||||
const info = await Api.$createOrder({
|
||||
masterId,
|
||||
vipUserId: '',
|
||||
|
|
@ -91,16 +122,16 @@
|
|||
})
|
||||
orderDetail.info = info
|
||||
}
|
||||
function watchEmit(){
|
||||
|
||||
function watchEmit() {
|
||||
uni.$off('orderDetail:update')
|
||||
uni.$once('orderDetail:update',(newval)=>{
|
||||
uni.$once('orderDetail:update', (newval) => {
|
||||
console.log(newval);
|
||||
init()
|
||||
})
|
||||
}
|
||||
onShow(()=>{
|
||||
onShow(() => {
|
||||
watchEmit()
|
||||
|
||||
})
|
||||
onLoad((opt) => {
|
||||
Object.assign(options, opt)
|
||||
|
|
|
|||
|
|
@ -25,32 +25,49 @@
|
|||
</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"></my-tabs>
|
||||
<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>
|
||||
<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>
|
||||
<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="u-m-t-60 u-p-b-30">
|
||||
<my-button @click="payOrder">确认付款</my-button>
|
||||
|
||||
<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>
|
||||
|
|
@ -70,6 +87,7 @@
|
|||
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
|
||||
const pays = reactive({
|
||||
list: ['扫码收款', '二维码收款'],
|
||||
selIndex: 0,
|
||||
payTypes: {
|
||||
list: [],
|
||||
selIndex: 0
|
||||
|
|
@ -97,54 +115,70 @@
|
|||
function changePayType(i) {
|
||||
pays.payTypes.selIndex = i
|
||||
}
|
||||
|
||||
//支付成功回调
|
||||
function paySuccess(){
|
||||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
// uni.$emit('orderDetail:update')
|
||||
uni.navigateBack({delta:2})
|
||||
}, 500)
|
||||
}
|
||||
async function payOrder() {
|
||||
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
|
||||
await Api.$payOrder({
|
||||
tableId: order.tableId,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id,
|
||||
orderId: order.id||order.orderId,
|
||||
payType,
|
||||
vipUserId: order.userId,
|
||||
discount: 1,
|
||||
code: ''
|
||||
})
|
||||
infoBox.showToast('支付成功')
|
||||
setTimeout(() => {
|
||||
uni.$emit('orderDetail:update')
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
paySuccess()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getPayType()
|
||||
})
|
||||
const order = reactive({
|
||||
amount: 0
|
||||
})
|
||||
function saoma(){
|
||||
|
||||
function saomaPay() {
|
||||
const item = pays.payTypes.list[pays.payTypes.selIndex]
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success: function (res) {
|
||||
success:function (res) {
|
||||
console.log('条码类型:' + res.scanType);
|
||||
console.log('条码内容:' + res.result);
|
||||
Api.$payOrder({
|
||||
"orderId": order.orderId, // 订单id
|
||||
"payType": item.payType, //
|
||||
"discount": order.discount,
|
||||
"code": res.result
|
||||
}).then(res=>{
|
||||
console.log(res);
|
||||
paySuccess()
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
watch(() => pays.payTypes.selIndex, (index) => {
|
||||
const item = pays.payTypes.list[index]
|
||||
watch(() => pays.payTypes.selIndex, (newval) => {
|
||||
const item = pays.payTypes.list[newval]
|
||||
if (item.payType == "vipPay") {
|
||||
return
|
||||
return
|
||||
}
|
||||
if (item.payType == "deposit") {
|
||||
//储值卡支付
|
||||
return saoma()
|
||||
return saomaPay('deposit')
|
||||
}
|
||||
if (item.payType == "scanCode") {
|
||||
//扫码支付
|
||||
return saoma()
|
||||
return saomaPay('scanCode')
|
||||
}
|
||||
})
|
||||
onLoad((opt) => {
|
||||
console.log(opt);
|
||||
Object.assign(order, opt)
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import {
|
||||
returnBoolean
|
||||
} from '@/commons/utils/format.js';
|
||||
// 返回购物车未下单的数据
|
||||
export function getNowCart(records) {
|
||||
const nowCart = records.find(v => v.placeNum == 0)
|
||||
const Cart = nowCart ? nowCart.info : []
|
||||
const result = Cart.map(item => {
|
||||
return {
|
||||
...item,
|
||||
isPack: returnBoolean(item.isPack),
|
||||
isGift: returnBoolean(item.isGift)
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
Loading…
Reference in New Issue