代客下单页面修改,增加店铺配置页面
This commit is contained in:
@@ -82,18 +82,18 @@
|
||||
<template v-if="item.is_gift || item.status == 'return'">
|
||||
<div>¥0</div>
|
||||
<div class="free-price">
|
||||
<span v-if="isSeatFee">¥{{ item.totalAmount }}</span>
|
||||
<span v-else>¥{{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
|
||||
<span v-if="isSeatFee">¥{{ to2(item.totalAmount) }}</span>
|
||||
<span v-else>¥{{ to2(isShowVipPrice ? vipAllPrice : allPrice) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="item.discountSaleAmount">
|
||||
<div>¥{{ discountNewPrice }}</div>
|
||||
<div class="free-price">
|
||||
<span>¥{{ isShowVipPrice ? vipAllPrice : allPrice }}</span>
|
||||
<span>¥{{ to2(isShowVipPrice ? vipAllPrice : allPrice) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="isSeatFee">¥{{ item.totalAmount }}</div>
|
||||
<div v-if="isSeatFee">¥{{ to2(item.totalAmount) }}</div>
|
||||
<div v-else>
|
||||
<div v-if="isShowVipPrice && vipAllPrice != allPrice">¥{{ vipAllPrice }}</div>
|
||||
<div
|
||||
@@ -101,7 +101,7 @@
|
||||
'free-price': isShowVipPrice && vipAllPrice != allPrice,
|
||||
}"
|
||||
>
|
||||
<span>¥{{ allPrice }}</span>
|
||||
<span>¥{{ to2(allPrice) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -161,7 +161,9 @@ const props = defineProps({
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
function to2(n) {
|
||||
return n.toFixed(2);
|
||||
}
|
||||
let number = ref(0);
|
||||
|
||||
const currentPrice = computed(() => {
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<el-button type="primary">微信/支付宝</el-button>
|
||||
<el-button type="primary">现金</el-button>
|
||||
<el-button type="primary">更多支付</el-button>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,11 +58,14 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(["editNote"]);
|
||||
const emits = defineEmits(["editNote", "createOrder"]);
|
||||
function editNote() {
|
||||
emits("editNote");
|
||||
}
|
||||
|
||||
function createOrder() {
|
||||
emits("createOrder");
|
||||
}
|
||||
const selCartId = ref(null);
|
||||
|
||||
const carts = useCartsStore();
|
||||
@@ -74,7 +77,12 @@ watch(
|
||||
for (let goods of props.goodsList) {
|
||||
goodsMap[goods.id] = goods;
|
||||
}
|
||||
carts.init({}, goodsMap);
|
||||
carts.init(
|
||||
{
|
||||
table_code: "",
|
||||
},
|
||||
goodsMap
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -86,7 +94,6 @@ function itemClick(item) {
|
||||
function changeNumber(step, item) {
|
||||
carts.changeNumber(step * 1, item);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
carts,
|
||||
});
|
||||
|
||||
242
src/views/tool/Instead/components/choose-user.vue
Normal file
242
src/views/tool/Instead/components/choose-user.vue
Normal file
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<el-dialog title="选择用户" width="850px" v-model="show" top="20px">
|
||||
<div class="app-container">
|
||||
<div class="head-container">
|
||||
<el-form :model="query" inline>
|
||||
<el-form-item label="">
|
||||
<el-input v-model="query.name" placeholder="请输入昵称或手机号"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<div class="flex gap-20">
|
||||
<el-button type="primary" @click="getTableData" size="medium">搜索</el-button>
|
||||
<el-button @click="noChooseUser" size="medium">不选择用户</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="head-container">
|
||||
<el-table :data="tableData.data" v-loading="tableData.loading" @cell-click="cellClick">
|
||||
<el-table-column label="ID" prop="id"></el-table-column>
|
||||
<el-table-column label="用户" prop="headImg" width="200px">
|
||||
<template v-slot="scope">
|
||||
<div class="user_info">
|
||||
<el-image
|
||||
:src="scope.row.headImg"
|
||||
style="width: 40px; height: 40px; flex-shrink: 0"
|
||||
>
|
||||
<template #error>
|
||||
<div class="image-slot">
|
||||
<i class="el-icon-user"></i>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
<span class="name">{{ scope.row.nickName }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="手机号" prop="telephone" width="160"></el-table-column>
|
||||
|
||||
<el-table-column label="会员" prop="isVip">
|
||||
<template v-slot="scope">
|
||||
<el-tag type="warning" v-if="scope.row.isVip">会员等级{{ scope.row.isVip }}</el-tag>
|
||||
<span v-else>否</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="余额" prop="amount"></el-table-column>
|
||||
<el-table-column label="积分" prop="accountPoints"></el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="90" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<el-button type="primary" size="mini" @click="choose(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<el-pagination
|
||||
:total="tableData.total"
|
||||
:current-page="tableData.page + 1"
|
||||
:page-size="tableData.size"
|
||||
@size-change="sizeChange"
|
||||
@current-change="paginationChange"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import shopUserApi from "@/api/account/shopUser";
|
||||
import dayjs from "dayjs";
|
||||
let cacheData = {};
|
||||
|
||||
const state = reactive({
|
||||
show: false,
|
||||
query: {
|
||||
name: "",
|
||||
isVip: 1,
|
||||
},
|
||||
tableData: {
|
||||
data: [],
|
||||
page: 0,
|
||||
size: 10,
|
||||
loading: false,
|
||||
total: 0,
|
||||
},
|
||||
});
|
||||
const { tableData, query, show } = toRefs(state);
|
||||
|
||||
function timeFilter(s) {
|
||||
return dayjs(s).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
const emits = defineEmits(["chooseUser"]);
|
||||
function cellClick(user) {
|
||||
console.log(user);
|
||||
emits("chooseUser", user);
|
||||
close();
|
||||
}
|
||||
function noChooseUser() {
|
||||
emits("chooseUser", null);
|
||||
close();
|
||||
}
|
||||
function choose(user) {
|
||||
emits("chooseUser", user);
|
||||
close();
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false;
|
||||
}
|
||||
function open() {
|
||||
getTableData();
|
||||
show.value = true;
|
||||
}
|
||||
|
||||
const router = useRouter();
|
||||
function toPage(type) {
|
||||
const pages = {
|
||||
charge: "charge_list",
|
||||
cost: "cost_list",
|
||||
};
|
||||
router.push({
|
||||
name: pages[type],
|
||||
});
|
||||
}
|
||||
|
||||
function sizeChange() {
|
||||
tableData.value.page = 0;
|
||||
getTableData();
|
||||
}
|
||||
// 切换状态
|
||||
async function statusChange(e, row) {
|
||||
try {
|
||||
tableData.value.loading = true;
|
||||
const data = { ...row };
|
||||
data.status = e;
|
||||
await modityActivate(data);
|
||||
getTableData();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
tableData.value.loading = false;
|
||||
}
|
||||
}
|
||||
// 重置查询
|
||||
function resetHandle() {
|
||||
query.valuename = "";
|
||||
getTableData();
|
||||
}
|
||||
// 分页回调
|
||||
function paginationChange(e) {
|
||||
tableData.value.page = e - 1;
|
||||
getTableData();
|
||||
}
|
||||
async function getTableData() {
|
||||
tableData.value.loading = true;
|
||||
try {
|
||||
const res = await shopUserApi.getList({
|
||||
...query.value,
|
||||
size: tableData.value.size,
|
||||
page: tableData.value.page + 1,
|
||||
});
|
||||
tableData.value.loading = false;
|
||||
tableData.value.data = res.records;
|
||||
tableData.value.total = res.totalRow * 1;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.user_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.name {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
::v-deep .el-input--small .el-input__inner {
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
::v-deep .image-slot {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #efefef;
|
||||
font-size: 20px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: #f5f5f5;
|
||||
padding: 0 14px;
|
||||
|
||||
.title {
|
||||
font-size: 22px;
|
||||
padding-top: 14px;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
padding: 20px 0;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
|
||||
.t {
|
||||
text-align: center;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.n {
|
||||
color: #000;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
padding-top: 6px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.gap-20 {
|
||||
gap: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="controls">
|
||||
<div class="input-number">
|
||||
<div class="reduce">
|
||||
<el-icon @click="carts.changeNumber(-1, carts.selCart)"><Minus /></el-icon>
|
||||
<div class="reduce" @click="carts.changeNumber(-1, carts.selCart)">
|
||||
<el-icon><Minus /></el-icon>
|
||||
</div>
|
||||
<span class="text">{{ carts.selCart.number || 1 }}</span>
|
||||
<div class="add">
|
||||
<el-icon @click="carts.changeNumber(1, carts.selCart)"><Plus /></el-icon>
|
||||
<div class="add" @click="carts.changeNumber(1, carts.selCart)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
|
||||
178
src/views/tool/Instead/components/discount.vue
Normal file
178
src/views/tool/Instead/components/discount.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<el-dialog width="400px" :title="title" v-model="show">
|
||||
<div class="u-p-15">
|
||||
<div class="u-m-t-20">
|
||||
<el-form label-width="90px" label-position="left">
|
||||
<el-form-item label="应付金额">
|
||||
<div class="color-red u-font-18 font-600">¥{{ form.money }}</div>
|
||||
<!-- <el-input :value="form.money" disabled> </el-input> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="减免金额">
|
||||
<el-input
|
||||
v-model="form.reduceMoney"
|
||||
clearable
|
||||
autofocus
|
||||
type="number"
|
||||
@keyup.enter="init('reduceMoney')"
|
||||
@blur="init('reduceMoney')"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠折扣">
|
||||
<el-input
|
||||
v-model="form.discount"
|
||||
type="number"
|
||||
@keyup.enter="init('discount')"
|
||||
@blur="init('discount')"
|
||||
>
|
||||
<template #append>%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="实收金额">
|
||||
<el-input
|
||||
v-model="form.curretnMoney"
|
||||
type="number"
|
||||
clearable
|
||||
@keyup.enter="init('curretnMoney')"
|
||||
@blur="init('curretnMoney')"
|
||||
>
|
||||
<template #append>元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<div class="u-flex u-row-center u-m-t-50">
|
||||
<el-button size="medium" @click="close">取消</el-button>
|
||||
<el-button size="medium" type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
function toFixedNoRounding(num) {
|
||||
// 转换为字符串
|
||||
var numStr = num.toString();
|
||||
// 分割整数部分和小数部分
|
||||
var parts = numStr.split(".");
|
||||
// 如果小数部分长度大于2,则截取前两位
|
||||
if (parts[1] && parts[1].length > 2) {
|
||||
parts[1] = parts[1].slice(0, 2);
|
||||
}
|
||||
// 拼接回数字字符串并返回
|
||||
return parts.join(".");
|
||||
}
|
||||
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "优惠金额",
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
money: 0,
|
||||
discount: 100,
|
||||
reduceMoney: 0,
|
||||
curretnMoney: 0,
|
||||
},
|
||||
number: "0",
|
||||
show: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init(key) {
|
||||
const { money, reduceMoney, discount, curretnMoney } = this.form;
|
||||
if (key == "reduceMoney") {
|
||||
if (reduceMoney < 0) {
|
||||
this.$message.error("减免金额不能小于0");
|
||||
this.form.reduceMoney = 0;
|
||||
}
|
||||
if (reduceMoney > money) {
|
||||
this.$message.error("减免金额不能大于总金额");
|
||||
this.form.reduceMoney = money;
|
||||
}
|
||||
this.form.curretnMoney = (money - this.form.reduceMoney).toFixed(2);
|
||||
this.form.discount = toFixedNoRounding(((this.form.curretnMoney / money) * 100).toFixed(3));
|
||||
return;
|
||||
}
|
||||
if (key == "discount") {
|
||||
if (discount < 0) {
|
||||
this.$message.error("折扣不能小于0");
|
||||
this.form.discount = 0;
|
||||
}
|
||||
if (discount > 100) {
|
||||
this.$message.error("折扣不能大于100");
|
||||
this.form.discount = 100;
|
||||
}
|
||||
this.form.curretnMoney = ((money * this.form.discount) / 100).toFixed(2);
|
||||
this.form.reduceMoney = ((money * (100 - this.form.discount)) / 100).toFixed(2);
|
||||
return;
|
||||
}
|
||||
if (key == "curretnMoney") {
|
||||
if (curretnMoney < 0) {
|
||||
this.$message.error("实收金额不能小于0");
|
||||
this.form.curretnMoney = 0;
|
||||
}
|
||||
if (curretnMoney > money) {
|
||||
this.$message.error("实收金额不能大于总金额");
|
||||
this.form.curretnMoney = this.form.money;
|
||||
}
|
||||
this.form.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
||||
this.form.discount = toFixedNoRounding(((this.form.curretnMoney / money) * 100).toFixed(3));
|
||||
return;
|
||||
}
|
||||
this.form.curretnMoney = ((money * discount) / 100).toFixed(2);
|
||||
this.form.reduceMoney = (money - this.form.curretnMoney).toFixed(2);
|
||||
},
|
||||
changeKey(key, val) {
|
||||
this[key] = val;
|
||||
},
|
||||
|
||||
confirm() {
|
||||
console.log(this.form.discount / 100);
|
||||
this.$emit("confirm", {
|
||||
discount: this.form.discount / 100,
|
||||
currentPrice: ((this.form.discount * this.form.money) / 100).toFixed(2),
|
||||
});
|
||||
this.close();
|
||||
},
|
||||
open(data) {
|
||||
console.log(data);
|
||||
this.form.money = data.amount * 1;
|
||||
this.form.discount = data.discount ? toFixedNoRounding(data.discount.toFixed(3)) : 100;
|
||||
this.show = true;
|
||||
this.init();
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.number = `${this.value}`;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.codeImg {
|
||||
width: 160px;
|
||||
border: 1px solid rgb(220, 223, 230);
|
||||
height: 160px;
|
||||
}
|
||||
:deep(.el-input .el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:deep(.el-input .el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -93,8 +93,9 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
let number = ref(0);
|
||||
|
||||
const number = defineModel({
|
||||
default: 0,
|
||||
});
|
||||
watch(
|
||||
() => props.value,
|
||||
(newval) => {
|
||||
@@ -102,12 +103,6 @@ watch(
|
||||
}
|
||||
);
|
||||
const emits = defineEmits(["input", "confirm"]);
|
||||
watch(
|
||||
() => number.value,
|
||||
(newval) => {
|
||||
emits("input", newval);
|
||||
}
|
||||
);
|
||||
|
||||
function clearFunction() {
|
||||
if (props.isFloat) {
|
||||
@@ -127,6 +122,7 @@ function keyboradAdd(n) {
|
||||
if (newval * 1 > props.max * 1) {
|
||||
return ElMessage.error(this.maxTips);
|
||||
}
|
||||
console.log(number.value);
|
||||
number.value = newval;
|
||||
}
|
||||
function keyboradReduce() {
|
||||
|
||||
190
src/views/tool/Instead/components/order.vue
Normal file
190
src/views/tool/Instead/components/order.vue
Normal file
@@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<div class="order-box">
|
||||
<div class="left">
|
||||
<div class="user bg-fff u-p-20">
|
||||
<div class="userinfo">
|
||||
<el-avatar class="avatar" :size="50" />
|
||||
<div class="u-m-l-12">
|
||||
<p>
|
||||
<span class="name u-font-16">hh</span>
|
||||
<span class="vip">VIP1</span>
|
||||
</p>
|
||||
<p class="u-font-14 color-666 u-m-t-10">
|
||||
<span class="money">余额:4.00</span>
|
||||
<span class="score u-m-l-10">积分:0</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="score">
|
||||
<div class="u-flex u-col-center u-m-t-10">
|
||||
<span class="u-font-14 font-bold u-m-r-20">积分抵扣</span>
|
||||
<el-radio-group v-model="score.sel" size="small" class="">
|
||||
<el-radio :value="0">
|
||||
<span class="u-font-14">全部抵扣</span>
|
||||
</el-radio>
|
||||
<el-radio :value="1">
|
||||
<span class="u-font-14">部分抵扣</span>
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<p class="u-font-14 color-666 u-m-t-10">
|
||||
<span class="color-red">*</span>
|
||||
<span>积分不足或小于最低使用门槛1</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="u-flex u-col-center u-m-t-20">
|
||||
<span class="u-font-14 font-bold u-m-r-20">团购代金券</span>
|
||||
<div class="u-flex my-select">
|
||||
<span class="u-m-r-10">代金券名称</span>
|
||||
<el-icon><ArrowDown /></el-icon>
|
||||
</div>
|
||||
<svg-icon iconClass="scan" size="30" class="u-m-l-10 cur-pointer"></svg-icon>
|
||||
</div>
|
||||
<div class="u-flex u-col-center u-m-t-20">
|
||||
<span class="u-font-14 font-bold u-m-r-20">优惠券</span>
|
||||
<div class="u-flex my-select">
|
||||
<span class="u-m-r-10">选择优惠券</span>
|
||||
<el-icon><ArrowDown /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="u-m-t-30">
|
||||
<el-button size="large" @click="discountShow">整单打折/减免</el-button>
|
||||
</div>
|
||||
<div class="u-m-t-30">
|
||||
<p class="u-font-16 font-bold u-m-r-20 font-bold">选择支付方式</p>
|
||||
<div class="u-m-t-20">
|
||||
<el-button
|
||||
v-for="(item, index) in payType.list"
|
||||
:key="index"
|
||||
size="large"
|
||||
:type="index == payType.sel ? 'primary' : ''"
|
||||
@click="changePayType(index)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="u-m-t-20">
|
||||
<el-button type="primary" size="large">立即支付</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>账单明细</h3>
|
||||
<div class="order-info">
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">订单号:</span>
|
||||
<span class="u-m-l-10 value">202111111111111111</span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">门店优惠</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">优惠券</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">积分抵扣</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">整单改价</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">餐位费/附加费</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">总价</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">抹零</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
<div class="u-flex u-m-b-10 u-row-between">
|
||||
<span class="title">应付金额</span>
|
||||
<span class="u-m-l-10 value"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const score = ref({
|
||||
list: [],
|
||||
sel: 0,
|
||||
});
|
||||
const emits = defineEmits(["discountShow"]);
|
||||
function discountShow() {
|
||||
emits("discountShow");
|
||||
}
|
||||
const payType = reactive({
|
||||
list: [
|
||||
{ label: "现金", value: "" },
|
||||
{ label: "扫码支付", value: "" },
|
||||
{ label: "会员支付", value: "" },
|
||||
],
|
||||
sel: 0,
|
||||
});
|
||||
function changePayType(i) {
|
||||
payType.sel = i;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.userinfo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 1;
|
||||
}
|
||||
.vip {
|
||||
padding: 2px 5px;
|
||||
background: #f7793d;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
margin-left: 10px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.order-box {
|
||||
display: flex;
|
||||
padding: 20px 20px;
|
||||
background-color: #f7f7fa;
|
||||
min-height: 100%;
|
||||
.left,
|
||||
.right {
|
||||
flex: 1;
|
||||
}
|
||||
.left {
|
||||
padding-right: 20px;
|
||||
}
|
||||
.right {
|
||||
border-left: 1px solid #ebebeb;
|
||||
padding-left: 20px;
|
||||
.order-info {
|
||||
font-size: 14px;
|
||||
.title {
|
||||
}
|
||||
.value {
|
||||
}
|
||||
.price {
|
||||
color: #fa5555;
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.my-select {
|
||||
border: 1px solid #d9d9d9;
|
||||
border-radius: 4px;
|
||||
margin-left: 12px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
padding: 8px 10px 8px 20px;
|
||||
}
|
||||
</style>
|
||||
124
src/views/tool/Instead/components/popup-taocan-goods.vue
Normal file
124
src/views/tool/Instead/components/popup-taocan-goods.vue
Normal file
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div class="select_desk">
|
||||
<el-dialog title="可选套餐" v-model="show">
|
||||
<div v-for="(item, index) in listdata.groupSnap" :key="index">
|
||||
<div class="box">
|
||||
<h2 class="boxspan">{{ item.title }}</h2>
|
||||
<h4 class="boxspan">本组菜品{{ item.count }}选{{ item.number || 1 }}</h4>
|
||||
<el-alert
|
||||
v-if="item.alertshow"
|
||||
title="错误:请按照规定选择套餐"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
></el-alert>
|
||||
</div>
|
||||
<el-table
|
||||
ref="refdialogpackagetable"
|
||||
:data="item.goods"
|
||||
tooltip-effect="dark"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange($event, index)"
|
||||
>
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column label="名称" prop="proName"></el-table-column>
|
||||
<el-table-column prop="name" label="规格"></el-table-column>
|
||||
<el-table-column prop="price" label="价格"></el-table-column>
|
||||
<el-table-column prop="number" label="数量"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="buttonbox">
|
||||
<el-button type="primary" :disabled="disabledshow" @click="confirm">确定</el-button>
|
||||
<el-button @click="toggleSelection">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const state = reactive({
|
||||
show: false,
|
||||
disabledshow: true,
|
||||
listdata: {
|
||||
groupSnap: [],
|
||||
},
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
});
|
||||
const refdialogpackagetable = ref();
|
||||
const { show, disabledshow, listdata, tableData, multipleSelection } = toRefs(state);
|
||||
|
||||
function toggleSelection() {
|
||||
try {
|
||||
refdialogpackagetable.value.forEach((a) => {
|
||||
a.clearSelection();
|
||||
});
|
||||
show.value = false;
|
||||
} catch (error) {}
|
||||
}
|
||||
function handleSelectionChange(val, index) {
|
||||
try {
|
||||
listdata.value.groupSnap.forEach((a, i) => {
|
||||
multipleSelection.value[index] = i === index ? val : multipleSelection.value[index] || [];
|
||||
});
|
||||
this.disabledshow = !listdata.value.groupSnap.every(
|
||||
(element, num) => element.number == multipleSelection.value[num].length
|
||||
);
|
||||
} catch (error) {}
|
||||
listdata.value.groupSnap[index] = {
|
||||
...listdata.value.groupSnap[index],
|
||||
alertshow:
|
||||
listdata.value.groupSnap[index].number != multipleSelection.value[index].length
|
||||
? true
|
||||
: false,
|
||||
};
|
||||
}
|
||||
|
||||
const emits = defineEmits(["dialogpackageconfirm"]);
|
||||
function confirm() {
|
||||
emits("dialogpackageconfirm", listdata.value, multipleSelection.value);
|
||||
show.value = false;
|
||||
}
|
||||
function open(item) {
|
||||
console.log(item);
|
||||
listdata.value = item;
|
||||
try {
|
||||
refdialogpackagetable.value.forEach((a) => {
|
||||
a.clearSelection();
|
||||
});
|
||||
} catch (error) {}
|
||||
multipleSelection.value = [];
|
||||
// 不用选套餐
|
||||
if (item.groupType == 0) {
|
||||
emits("dialogpackageconfirm", listdata.value, [item.groupSnap[0].goods]);
|
||||
return false;
|
||||
}
|
||||
disabledshow.value = true;
|
||||
show.value = true;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
close,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.el-button {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
.select_desk {
|
||||
.box {
|
||||
margin: 20px 10px;
|
||||
|
||||
.boxspan {
|
||||
}
|
||||
}
|
||||
|
||||
.buttonbox {
|
||||
margin: 0 auto;
|
||||
padding: 20px 0;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -106,13 +106,12 @@ function confirm() {
|
||||
emits("confirm", item.value, (number.value * 1).toFixed(2));
|
||||
close();
|
||||
}
|
||||
function open(item) {
|
||||
console.log(item);
|
||||
item.value = item;
|
||||
function open(data) {
|
||||
item.value = data;
|
||||
show.value = true;
|
||||
}
|
||||
function close() {
|
||||
show.valuie = false;
|
||||
show.value = false;
|
||||
number.value = "";
|
||||
item.value = "";
|
||||
}
|
||||
@@ -131,10 +130,6 @@ defineExpose({
|
||||
border: none;
|
||||
}
|
||||
|
||||
::v-deep .select_desk_dialog .el-input__inner {
|
||||
// border: none;
|
||||
}
|
||||
|
||||
::v-deep .el-input__inner::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
|
||||
@@ -5,8 +5,29 @@
|
||||
<div class="left u-flex u-col-center">
|
||||
<span class="title">代客下单</span>
|
||||
<div class="u-m-l-20 flex">
|
||||
<el-button type="primary">选择用户</el-button>
|
||||
<el-popover placement="right" width="333" trigger="click" v-model="tableShow">
|
||||
<div class="choose-user flex">
|
||||
<el-button type="primary" v-if="!user.id" @click="showChooseUser">选择用户</el-button>
|
||||
|
||||
<div v-else class="flex cur-pointer" @click="refChooseUserOpen">
|
||||
<img
|
||||
v-if="user.headImg && user.headImg != 'null'"
|
||||
class="headimg"
|
||||
:src="user.headImg"
|
||||
alt=""
|
||||
/>
|
||||
<div v-else class="headimg flex flex-x-y-center">
|
||||
<i class="el-icon-user"></i>
|
||||
</div>
|
||||
<div>
|
||||
<div class="u-flex">
|
||||
<div class="ft-13 color-000">{{ user.nickName }}</div>
|
||||
<div class="vip" v-if="user.isVip">VIP{{ user.isVip }}</div>
|
||||
</div>
|
||||
<div style="margin-top: 2px" class="color-666 ft-12">余额:{{ user.amount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-popover placement="right" width="333" trigger="click" ref="refTable">
|
||||
<el-input
|
||||
placeholder="请输入内容"
|
||||
prefix-icon="search"
|
||||
@@ -30,7 +51,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<template #reference>
|
||||
<el-button>选择桌号</el-button>
|
||||
<el-button>{{ table.name ? "桌台号:" + table.name : "选择桌号" }}</el-button>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-button type="warning">扫码验券</el-button>
|
||||
@@ -52,10 +73,12 @@
|
||||
<div class="diancan">
|
||||
<div class="left">
|
||||
<div class="diners">
|
||||
<!-- 就餐类型 -->
|
||||
<el-button-group v-model="diners.sel" style="width: 100%; display: flex">
|
||||
<el-button
|
||||
:class="{ active: index == diners.sel }"
|
||||
v-for="(item, index) in diners.list"
|
||||
@click="changeDinersSel(index)"
|
||||
:key="index"
|
||||
>
|
||||
{{ item.label }}
|
||||
@@ -75,6 +98,7 @@
|
||||
</div>
|
||||
<cartsList
|
||||
@editNote="showNote(true)"
|
||||
@createOrder="createOrder"
|
||||
:goodsMapisFinish="goodsMapisFinish"
|
||||
:goodsList="goods.list"
|
||||
ref="refCart"
|
||||
@@ -88,48 +112,53 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="right">
|
||||
<div class="flex categoty u-col-center">
|
||||
<div
|
||||
class="show_more_btn"
|
||||
:class="{ showAll: category.showAll }"
|
||||
@click="toggleShowAll"
|
||||
>
|
||||
<div class="flex">
|
||||
<div class="flex showmore">
|
||||
<el-icon color="#fff"><ArrowDown /></el-icon>
|
||||
</div>
|
||||
<span>{{ category.showAll ? "收起" : "展开" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex categorys" :class="{ 'flex-wrap': category.showAll }">
|
||||
<template v-if="!showOrder">
|
||||
<div class="flex categoty u-col-center">
|
||||
<div
|
||||
v-for="(item, index) in category.list"
|
||||
:key="index"
|
||||
@click="changeCategoryId(item)"
|
||||
class="show_more_btn"
|
||||
:class="{ showAll: category.showAll }"
|
||||
@click="toggleShowAll"
|
||||
>
|
||||
<el-tag
|
||||
size="large"
|
||||
:type="goods.query.categoryId === item.id ? 'primary' : 'info'"
|
||||
effect="dark"
|
||||
<div class="flex">
|
||||
<div class="flex showmore">
|
||||
<el-icon color="#fff"><ArrowDown /></el-icon>
|
||||
</div>
|
||||
<span>{{ category.showAll ? "收起" : "展开" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex categorys" :class="{ 'flex-wrap': category.showAll }">
|
||||
<div
|
||||
v-for="(item, index) in category.list"
|
||||
:key="index"
|
||||
@click="changeCategoryId(item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-tag>
|
||||
<el-tag
|
||||
size="large"
|
||||
:type="goods.query.categoryId === item.id ? 'primary' : 'info'"
|
||||
effect="dark"
|
||||
>
|
||||
{{ item.name }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="goods.list.length <= 0" class="no-goods">未找到相关商品</div>
|
||||
<div class="goods-list">
|
||||
<div class="lingshicai" @click="showaddLingShiCai">
|
||||
<el-icon size="26"><Plus /></el-icon>
|
||||
<div class="u-m-t-10">临时菜</div>
|
||||
<div v-if="goods.list.length <= 0" class="no-goods">未找到相关商品</div>
|
||||
<div class="goods-list">
|
||||
<div class="lingshicai" @click="showaddLingShiCai">
|
||||
<el-icon size="26"><Plus /></el-icon>
|
||||
<div class="u-m-t-10">临时菜</div>
|
||||
</div>
|
||||
<GoodsItem
|
||||
:item="item"
|
||||
@click="goodsClick(item)"
|
||||
v-for="item in goods.list"
|
||||
:key="item.id"
|
||||
></GoodsItem>
|
||||
</div>
|
||||
<GoodsItem
|
||||
:item="item"
|
||||
@click="goodsClick(item)"
|
||||
v-for="item in goods.list"
|
||||
:key="item.id"
|
||||
></GoodsItem>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 订单信息展示 -->
|
||||
<Order @discountShow="discountShow" v-else></Order>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,14 +175,24 @@
|
||||
<changePrice ref="refChangePrice" @confirm="changePriceConfirm"></changePrice>
|
||||
<!-- 称重商品 -->
|
||||
<changeWeight ref="refChangeWeight" @confirm="changeWeightConfirm"></changeWeight>
|
||||
<!-- 可选套餐 -->
|
||||
<changeTaocan ref="refAddTaocan" @confirm="taocanConfirm"></changeTaocan>
|
||||
<!-- 选择用户 -->
|
||||
<chooseUser ref="refChooseUser" @chooseUser="chooseUserConfirm"></chooseUser>
|
||||
<!-- 打折 -->
|
||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import Controls from "./components/control.vue";
|
||||
import discount from "./components/discount.vue";
|
||||
import note from "./components/note.vue";
|
||||
import Order from "./components/order.vue";
|
||||
import pack from "./components/pack.vue";
|
||||
import changePrice from "./components/popup-cart-changePrice.vue";
|
||||
import chooseUser from "./components/choose-user.vue";
|
||||
import changeWeight from "./components/popup-weight-goods.vue";
|
||||
import changeTaocan from "./components/popup-taocan-goods.vue";
|
||||
import addLingShiCai from "./components/popup-linshiCai.vue";
|
||||
import GoodsItem from "./components/goods-item.vue";
|
||||
import dialogGoodsSel from "./components/dialog-goods-sel.vue";
|
||||
@@ -162,15 +201,62 @@ import categoryApi from "@/api/product/productclassification";
|
||||
import productApi from "@/api/product/index";
|
||||
import tableApi from "@/api/account/table";
|
||||
import $status from "@/views/tool/table/status.js";
|
||||
import orderApi from "@/api/order/order";
|
||||
//打折
|
||||
const refDiscount = ref();
|
||||
function discountConfirm(e) {}
|
||||
function discountShow(e) {
|
||||
refDiscount.value.open({
|
||||
amount: 10,
|
||||
});
|
||||
}
|
||||
|
||||
//用户
|
||||
let user = ref({});
|
||||
const refChooseUser = ref();
|
||||
function chooseUserConfirm(e) {
|
||||
console.log(e);
|
||||
user.value = e;
|
||||
}
|
||||
function showChooseUser() {
|
||||
refChooseUser.value.open();
|
||||
}
|
||||
|
||||
//订单
|
||||
const showOrder = ref(false);
|
||||
function createOrder() {
|
||||
console.log(refCart.value.carts.table_code);
|
||||
orderApi.add({
|
||||
tableCode: refCart.value.carts.table_code,
|
||||
dineMode: "dine-in",
|
||||
});
|
||||
}
|
||||
|
||||
//套餐商品
|
||||
const refAddTaocan = ref();
|
||||
function taocanConfirm() {}
|
||||
function taocanShow(item) {
|
||||
refAddTaocan.value.open(item);
|
||||
}
|
||||
|
||||
// 称重商品
|
||||
const refChangeWeight = ref();
|
||||
function changeWeightConfirm(e) {}
|
||||
function changeWeightConfirm(goods, number) {
|
||||
console.log(goods, number);
|
||||
addCarts({
|
||||
product_id: goods.id,
|
||||
sku_id: goods.skuList[0].id,
|
||||
number,
|
||||
});
|
||||
}
|
||||
function showWeight(item) {
|
||||
console.log(item);
|
||||
refChangeWeight.value.open(item);
|
||||
}
|
||||
|
||||
//桌台
|
||||
const table = ref({}); //当前选中桌台
|
||||
const refTable = ref();
|
||||
const tableSearchText = ref("");
|
||||
const tableList = ref([]);
|
||||
function getTableList() {
|
||||
@@ -190,6 +276,8 @@ function returnTableLabel(key) {
|
||||
}
|
||||
function tableClick(item) {
|
||||
console.log(item);
|
||||
table.value = item;
|
||||
refTable.value.hide();
|
||||
}
|
||||
|
||||
//临时菜
|
||||
@@ -258,6 +346,11 @@ const diners = reactive({
|
||||
],
|
||||
sel: 0,
|
||||
});
|
||||
|
||||
function changeDinersSel(index) {
|
||||
diners.sel = index;
|
||||
}
|
||||
|
||||
// 商品分类
|
||||
const category = reactive({
|
||||
list: [],
|
||||
@@ -311,16 +404,7 @@ function goodsClick(item) {
|
||||
addCarts({
|
||||
product_id: item.id,
|
||||
sku_id: item.skuList[0].id,
|
||||
number: 1,
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
number: item.skuList[0].suitNum || 1,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -334,6 +418,24 @@ function goodsClick(item) {
|
||||
showWeight(item);
|
||||
return;
|
||||
}
|
||||
//套餐商品
|
||||
if (item.type === "package") {
|
||||
//固定套餐
|
||||
if (item.groupType == 0) {
|
||||
addCarts({
|
||||
sku_id: item.groupSnap[0].goods[0].skuId,
|
||||
product_id: item.id,
|
||||
number: item.groupSnap[0].goods[0].number,
|
||||
});
|
||||
return;
|
||||
}
|
||||
//可选套餐
|
||||
if (item.groupType == 1) {
|
||||
taocanShow(item);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 多规格选择确认
|
||||
@@ -345,18 +447,7 @@ function skuSelConfirm(item) {
|
||||
if (listItem) {
|
||||
refCart.value.carts.update({ ...listItem, ...item });
|
||||
} else {
|
||||
refCart.value.carts.add({
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
...item,
|
||||
});
|
||||
addCarts(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,15 +463,7 @@ function clearCarts() {
|
||||
});
|
||||
}
|
||||
function addCarts(item) {
|
||||
const hasCart = refCart.value.carts.list.find((cartItem) => {
|
||||
return cartItem.product_id == item.product_id && cartItem.sku_id == item.sku_id;
|
||||
});
|
||||
console.log(hasCart);
|
||||
if (hasCart) {
|
||||
refCart.value.carts.update({ ...item, id: hasCart.id });
|
||||
} else {
|
||||
refCart.value.carts.add(item);
|
||||
}
|
||||
refCart.value.carts.add(item);
|
||||
}
|
||||
|
||||
watch(
|
||||
@@ -585,4 +668,7 @@ $pl: 30px;
|
||||
.no-goods {
|
||||
color: #999;
|
||||
}
|
||||
.choose-user {
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user