代客下单增加先付费后付费选择

This commit is contained in:
2024-08-21 15:23:10 +08:00
parent 18c2c68c9f
commit 0a36882c8b

View File

@@ -7,7 +7,21 @@
:visible.sync="informationdialogshow" :visible.sync="informationdialogshow"
@close="onclose" @close="onclose"
> >
<div class="head-container search-box flex"> <div class="head-container search-box flex row-between">
<div>
<el-dropdown @command="changePostPay">
<el-button plain type="success" size="mini">
{{ postPay ? "后付费" : "先付费" }}
<i class="el-icon-caret-bottom"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="false">先付费</el-dropdown-item>
<el-dropdown-item :command="true">后付费</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="flex">
<div style="width: 300px"> <div style="width: 300px">
<el-input <el-input
v-model="goods.query.productId" v-model="goods.query.productId"
@@ -20,7 +34,6 @@
/> />
<!-- @keyup.enter.native="getGoods" --> <!-- @keyup.enter.native="getGoods" -->
</div> </div>
<div <div
style="display: flex; justify-content: flex-end; margin-left: 10px" style="display: flex; justify-content: flex-end; margin-left: 10px"
> >
@@ -42,6 +55,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="diancan"> <div class="diancan">
<div class="order"> <div class="order">
<div class="relative"> <div class="relative">
@@ -107,9 +121,6 @@
</div> </div>
<div class="flex mt-14"> <div class="flex mt-14">
<!-- <button class="my-btn flex-1 success" v-if="!isCreateOrder">
<span>仅下单</span>
</button> -->
<template v-if="isCreateOrder"> <template v-if="isCreateOrder">
<button <button
class="my-btn flex-1 default" class="my-btn flex-1 default"
@@ -123,7 +134,7 @@
</button> </button>
</template> </template>
<template v-else> <template v-else>
<el-dropdown <!-- <el-dropdown
split-button split-button
size="medium" size="medium"
type="success" type="success"
@@ -138,50 +149,31 @@
>下单并打印制作单</el-dropdown-item >下单并打印制作单</el-dropdown-item
> >
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown> -->
<template v-if="postPay">
<div class="flex-1">
<el-button
type="success"
size="medium"
:disabled="!order.list.length"
@click="toCreateOrder"
>
仅下单
</el-button>
</div>
<div style="width: 15px"></div> <div style="width: 15px"></div>
</template>
<div class="flex-1"> <div class="flex-1">
<el-button <el-button
size="medium" size="medium"
:disabled="!order.list.length" :disabled="!order.list.length"
@click="toPay" @click="toCreateOrder"
> >
去结账 去结账
</el-button> </el-button>
</div> </div>
<!-- <button
class="my-btn flex-1 success"
:class="{ disabled: !order.list.length }"
:disabled="!order.list.length"
@click="toPay"
>
<span>去结账</span>
</button> -->
</template> </template>
</div> </div>
<!-- <div class="flex mt-14">
<button class="my-btn flex-1 success" v-if="!isCreateOrder">
<span>仅下单</span>
</button>
<button
class="my-btn flex-1 default"
v-else
@click="createOrderClose"
>
<span>加菜/返回</span>
</button>
<div style="width: 15px"></div>
<button
class="my-btn flex-1 default"
:class="{ disabled: !order.list.length }"
:disabled="!order.list.length"
@click="toPay"
>
<span>去结账</span>
</button>
</div> -->
</div> </div>
<div class="list"> <div class="list">
<div <div
@@ -418,9 +410,17 @@
<div> <div>
<div class="stockNumber"></div> <div class="stockNumber"></div>
<div class="">{{ item.lowPrice }}</div> <div class="">{{ item.lowPrice }}</div>
<div class="flex" v-if="item.isPauseSale"> <template v-if="layout.sel === 'default'">
<div
class="flex"
v-if="
item.isPauseSale ||
(item.typeEnum !== 'sku' && item.stockNumber <= 0)
"
>
<div class="timeSale">售罄</div> <div class="timeSale">售罄</div>
</div> </div>
</template>
</div> </div>
</div> </div>
</div> </div>
@@ -825,7 +825,7 @@ import {
$getCacheOrder, $getCacheOrder,
$delOrder, $delOrder,
$setUser, $setUser,
$payOrder $payOrder,
} from "@/api/table"; } from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop"; import { tbShopCategoryGet } from "@/api/shop";
//判断商品是否可以下单 //判断商品是否可以下单
@@ -885,6 +885,8 @@ export default {
}, },
data() { data() {
return { return {
//true后付款false先付款
postPay: true,
//是否打印 //是否打印
isPrint: false, isPrint: false,
// 备注 // 备注
@@ -1231,6 +1233,9 @@ export default {
this.getCategory(); this.getCategory();
}, },
methods: { methods: {
changePostPay(val) {
this.postPay = val;
},
//改变是否打印 //改变是否打印
changeIsPrint(e) { changeIsPrint(e) {
console.log(e); console.log(e);
@@ -1286,15 +1291,23 @@ export default {
this.isCreateOrder = false; this.isCreateOrder = false;
}, },
//生成订单 //生成订单
async toPay() { async toCreateOrder() {
const res = await $createOrder({ const res = await $createOrder({
masterId: this.order.masterId || this.masterId, masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id, vipUserId: this.vipUser.id,
tableId: this.table.tableId, tableId: this.table.tableId,
note: this.note.content, note: this.note.content,
}); });
//后付款
if(this.postPay){
this.$notify({
title: "下单成功",
type: "success",
});
return this.close()
}
this.createOrder.data = res; this.createOrder.data = res;
const {masterId} = await this.getMasterId(); const { masterId } = await this.getMasterId();
this.masterId = masterId; this.masterId = masterId;
this.isCreateOrder = true; this.isCreateOrder = true;
}, },
@@ -1805,9 +1818,9 @@ export default {
this.skuGoods.number = skuGoods.suit || 1; this.skuGoods.number = skuGoods.suit || 1;
} }
}, },
onclose(){ onclose() {
this.$emit('close') this.$emit("close");
this.reset() this.reset();
}, },
reset() { reset() {
// this.goods.list = []; // this.goods.list = [];
@@ -2072,7 +2085,7 @@ export default {
}, },
close() { close() {
this.informationdialogshow = false; this.informationdialogshow = false;
this.$emit('close') this.$emit("close");
}, },
resetCommodityArr() { resetCommodityArr() {
this.commodityArr = []; this.commodityArr = [];