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

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"
@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">
<el-input
v-model="goods.query.productId"
@@ -20,7 +34,6 @@
/>
<!-- @keyup.enter.native="getGoods" -->
</div>
<div
style="display: flex; justify-content: flex-end; margin-left: 10px"
>
@@ -42,6 +55,7 @@
</div>
</div>
</div>
</div>
<div class="diancan">
<div class="order">
<div class="relative">
@@ -107,9 +121,6 @@
</div>
<div class="flex mt-14">
<!-- <button class="my-btn flex-1 success" v-if="!isCreateOrder">
<span>仅下单</span>
</button> -->
<template v-if="isCreateOrder">
<button
class="my-btn flex-1 default"
@@ -123,7 +134,7 @@
</button>
</template>
<template v-else>
<el-dropdown
<!-- <el-dropdown
split-button
size="medium"
type="success"
@@ -138,50 +149,31 @@
>下单并打印制作单</el-dropdown-item
>
</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>
</template>
<div class="flex-1">
<el-button
size="medium"
:disabled="!order.list.length"
@click="toPay"
@click="toCreateOrder"
>
去结账
</el-button>
</div>
<!-- <button
class="my-btn flex-1 success"
:class="{ disabled: !order.list.length }"
:disabled="!order.list.length"
@click="toPay"
>
<span>去结账</span>
</button> -->
</template>
</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 class="list">
<div
@@ -418,9 +410,17 @@
<div>
<div class="stockNumber"></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>
</template>
</div>
</div>
</div>
@@ -825,7 +825,7 @@ import {
$getCacheOrder,
$delOrder,
$setUser,
$payOrder
$payOrder,
} from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop";
//判断商品是否可以下单
@@ -885,6 +885,8 @@ export default {
},
data() {
return {
//true后付款false先付款
postPay: true,
//是否打印
isPrint: false,
// 备注
@@ -1231,6 +1233,9 @@ export default {
this.getCategory();
},
methods: {
changePostPay(val) {
this.postPay = val;
},
//改变是否打印
changeIsPrint(e) {
console.log(e);
@@ -1286,13 +1291,21 @@ export default {
this.isCreateOrder = false;
},
//生成订单
async toPay() {
async toCreateOrder() {
const res = await $createOrder({
masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
note: this.note.content,
});
//后付款
if(this.postPay){
this.$notify({
title: "下单成功",
type: "success",
});
return this.close()
}
this.createOrder.data = res;
const { masterId } = await this.getMasterId();
this.masterId = masterId;
@@ -1806,8 +1819,8 @@ export default {
}
},
onclose() {
this.$emit('close')
this.reset()
this.$emit("close");
this.reset();
},
reset() {
// this.goods.list = [];
@@ -2072,7 +2085,7 @@ export default {
},
close() {
this.informationdialogshow = false;
this.$emit('close')
this.$emit("close");
},
resetCommodityArr() {
this.commodityArr = [];