feat: 接入下载桌台码接口,代客下单代码调整
This commit is contained in:
@@ -34,10 +34,14 @@
|
||||
<span class="totalPrice">¥{{ carts.payMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<el-button type="primary" @click="createOrder">微信/支付宝</el-button>
|
||||
<el-button type="primary" @click="createOrder">现金</el-button>
|
||||
<el-button type="primary" @click="createOrder">更多支付</el-button>
|
||||
<div class="btn-group" v-if="isXianFuKuan">
|
||||
<el-button type="primary" size="large" @click="createOrder">微信/支付宝</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">现金</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">更多支付</el-button>
|
||||
</div>
|
||||
<div class="btn-group" v-else>
|
||||
<el-button type="primary" size="large" @click="createOrder">仅下单</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">去结账</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,6 +51,8 @@
|
||||
import cartsItem from "./item.vue";
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
|
||||
let isXianFuKuan = ref(true);
|
||||
|
||||
const props = defineProps({
|
||||
goodsList: {
|
||||
type: Array,
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<div class="controls">
|
||||
<div class="input-number">
|
||||
<div class="reduce" @click="carts.changeNumber(-1, carts.selCart)">
|
||||
<div class="input-number" :class="{ disabled: canEdit }">
|
||||
<div class="reduce" @click="changeCartNumber(-1)">
|
||||
<el-icon><Minus /></el-icon>
|
||||
</div>
|
||||
<span class="text">{{ carts.selCart.number || 1 }}</span>
|
||||
<div class="add" @click="carts.changeNumber(1, carts.selCart)">
|
||||
<div class="add" @click="changeCartNumber(1)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-button
|
||||
v-for="(item, index) in controls"
|
||||
:key="index"
|
||||
v-bund="item"
|
||||
:disabled="btnDisabled(item)"
|
||||
@click="controlsClick(item)"
|
||||
>
|
||||
@@ -30,7 +30,7 @@ const controls = ref([
|
||||
{ label: "规格", key: "", disabled: false, per: "sku" },
|
||||
{ label: "赠送", key: "is_gift", disabled: false, per: "cart" },
|
||||
{ label: "打包", key: "is_pack", disabled: false, per: "cart" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "cart" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "del" },
|
||||
{ label: "存单", key: "", disabled: false, per: "save" },
|
||||
{ label: "取单", key: "", disabled: false },
|
||||
{ label: "单品备注", key: "one-note", disabled: false, per: "one-note" },
|
||||
@@ -78,9 +78,15 @@ const perList = computed(() => {
|
||||
if (!carts.selCart.id) {
|
||||
return ["all-wating", "all-note"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "save", "one-note", "all-note", "all-wating"];
|
||||
if (carts.isCanSelectGroup) {
|
||||
return ["all-wating", "all-note", "del"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "del", "save", "one-note", "all-note", "all-wating"];
|
||||
}
|
||||
});
|
||||
const canEdit = computed(() => {
|
||||
return !perList.value.includes("cart");
|
||||
});
|
||||
|
||||
function btnDisabled(item) {
|
||||
@@ -101,6 +107,11 @@ function returnLabel(item) {
|
||||
}
|
||||
return item.label;
|
||||
}
|
||||
function changeCartNumber(step) {
|
||||
if (perList.value.includes("cart")) {
|
||||
carts.changeNumber(step, carts.selCart);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -143,4 +154,7 @@ $gap: 10px;
|
||||
.add {
|
||||
}
|
||||
}
|
||||
.disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
274
src/views/tool/Instead/components/diner-number.vue
Normal file
274
src/views/tool/Instead/components/diner-number.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<div class="select_desk">
|
||||
<el-dialog width="410px" title="就餐人数" v-model="show">
|
||||
<div class="select_desk_dialog u-p-b-20">
|
||||
<key-board
|
||||
isCanEmpty
|
||||
v-model="number"
|
||||
@clear="clear"
|
||||
:max="max"
|
||||
:maxTips="'最多' + max + '位'"
|
||||
>
|
||||
<template #clear>
|
||||
<div>清空</div>
|
||||
</template>
|
||||
<template #input>
|
||||
<div class="u-p-l-20 u-p-r-20 u-flex w-full">
|
||||
<el-input
|
||||
placeholder="请输入就餐人数"
|
||||
v-model="number"
|
||||
@input="inputNumber"
|
||||
@change="inputChange"
|
||||
type="number"
|
||||
>
|
||||
<template #append>位</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</template>
|
||||
</key-board>
|
||||
<div class="confirm_btns">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import keyBoard from "./keyboard.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
components: { keyBoard },
|
||||
props: {
|
||||
max: {
|
||||
type: Number,
|
||||
default: 99,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
number: "",
|
||||
show: false,
|
||||
hasOpen: false,
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
number(newval) {
|
||||
if (newval > this.max) {
|
||||
this.number = this.max;
|
||||
ElMessage.error("最多只能选择" + this.max + "位就餐人数");
|
||||
}
|
||||
// 使用正则表达式匹配正整数
|
||||
const regex = /^[1-9]\d*$/;
|
||||
// 如果输入的值不是正整数,则将其设置为上一个有效值
|
||||
if (!regex.test(newval)) {
|
||||
this.number = newval.substring(0, newval.length - 1);
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
inputNumber(e) {},
|
||||
inputChange(e) {},
|
||||
clear(e) {
|
||||
console.log(e);
|
||||
this.number = "";
|
||||
},
|
||||
confirm() {
|
||||
if (this.number > this.max) {
|
||||
ElMessage.error("最多只能选择" + this.max + "位就餐人数");
|
||||
}
|
||||
if (!this.number) {
|
||||
ElMessage.error("请选择就餐人数");
|
||||
}
|
||||
console.log(this.number);
|
||||
this.$emit("confirm", this.number);
|
||||
this.close();
|
||||
},
|
||||
open(number) {
|
||||
this.number = number || "";
|
||||
this.show = true;
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
this.number = "";
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-button) {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
:deep(.el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
:deep(.el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
:deep(.el-button--success) {
|
||||
border-color: #22bf64;
|
||||
background-color: #22bf64;
|
||||
}
|
||||
.select_desk .btn {
|
||||
height: 34px;
|
||||
}
|
||||
.tags {
|
||||
font-size: 16px;
|
||||
&.using {
|
||||
color: rgb(234, 64, 37);
|
||||
}
|
||||
&.wait {
|
||||
color: rgb(252, 236, 79);
|
||||
}
|
||||
&.idle {
|
||||
color: rgb(137, 234, 71);
|
||||
}
|
||||
&.closed {
|
||||
color: rgb(221, 221, 221);
|
||||
filter: grayscale(1);
|
||||
}
|
||||
}
|
||||
::v-deep .inputs .el-input__inner {
|
||||
border-color: transparent !important;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.select_desk .select_desk_dialog {
|
||||
display: flex;
|
||||
|
||||
flex-direction: column;
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav {
|
||||
width: 286px;
|
||||
height: 38px;
|
||||
background: #dcf0e8;
|
||||
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .li,
|
||||
.select_desk .select_desk_dialog .nav {
|
||||
border-radius: 4px;
|
||||
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .li {
|
||||
width: 140px;
|
||||
height: 34px;
|
||||
color: #0fc161;
|
||||
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .lion {
|
||||
background: #0fc161;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .inputs {
|
||||
width: 370px;
|
||||
line-height: 54px;
|
||||
margin-top: 24px;
|
||||
height: 54px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .inputs .close {
|
||||
color: #aaa;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
line-height: 30px;
|
||||
top: 50%;
|
||||
margin-top: -15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard {
|
||||
display: flex;
|
||||
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
border-right: 1px solid #dcdfe6;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li {
|
||||
height: 60px;
|
||||
width: 33.333%;
|
||||
|
||||
display: flex;
|
||||
|
||||
justify-content: center;
|
||||
|
||||
align-items: center;
|
||||
font-size: 24px;
|
||||
color: #212121;
|
||||
cursor: pointer;
|
||||
|
||||
user-select: none;
|
||||
border-left: 1px solid #dcdfe6;
|
||||
border-top: 1px solid #dcdfe6;
|
||||
|
||||
transition: all 0.1s;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li .icon {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .confirm {
|
||||
height: 140px;
|
||||
background: #ff9f2e;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .confirm:hover {
|
||||
background: #f88502;
|
||||
}
|
||||
|
||||
.confirm_btns {
|
||||
display: flex;
|
||||
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.confirm_btns .el-button {
|
||||
width: 175px;
|
||||
}
|
||||
</style>
|
||||
@@ -61,6 +61,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ElMessage } from "element-plus";
|
||||
const props = defineProps({
|
||||
isCanEmpty: {
|
||||
type: Boolean,
|
||||
@@ -108,6 +109,7 @@ function clearFunction() {
|
||||
if (props.isFloat) {
|
||||
return keyboradAdd(".");
|
||||
}
|
||||
number.value = "";
|
||||
}
|
||||
function keyboradAdd(n) {
|
||||
if (n == "." && `${number.value}`.includes(".")) {
|
||||
@@ -120,7 +122,7 @@ function keyboradAdd(n) {
|
||||
}
|
||||
const newval = number.value + n;
|
||||
if (newval * 1 > props.max * 1) {
|
||||
return ElMessage.error(this.maxTips);
|
||||
return ElMessage.error(props.maxTips);
|
||||
}
|
||||
console.log(number.value);
|
||||
number.value = newval;
|
||||
|
||||
@@ -73,9 +73,15 @@ function handleSelectionChange(val, index) {
|
||||
};
|
||||
}
|
||||
|
||||
const emits = defineEmits(["dialogpackageconfirm"]);
|
||||
const emits = defineEmits(["confirm"]);
|
||||
function confirm() {
|
||||
emits("dialogpackageconfirm", listdata.value, multipleSelection.value);
|
||||
const pro_group_info = listdata.value.groupSnap.map((v, index) => {
|
||||
return {
|
||||
...v,
|
||||
goods: [...multipleSelection.value[index]],
|
||||
};
|
||||
});
|
||||
emits("confirm", listdata.value, pro_group_info);
|
||||
show.value = false;
|
||||
}
|
||||
function open(item) {
|
||||
@@ -87,11 +93,6 @@ function open(item) {
|
||||
});
|
||||
} catch (error) {}
|
||||
multipleSelection.value = [];
|
||||
// 不用选套餐
|
||||
if (item.groupType == 0) {
|
||||
emits("dialogpackageconfirm", listdata.value, [item.groupSnap[0].goods]);
|
||||
return false;
|
||||
}
|
||||
disabledshow.value = true;
|
||||
show.value = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user