From 4977dcb76b96f07292713ba820913d2a29deb724 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Sat, 17 Aug 2024 17:57:59 +0800
Subject: [PATCH 01/35] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E5=AE=A2?=
=?UTF-8?q?=E4=B8=8B=E5=8D=95=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/table.js | 177 +
src/views/table/components/choose-user.vue | 285 ++
src/views/table/components/keyboard.vue | 295 ++
src/views/table/components/order-btn.js | 62 +
src/views/table/components/pay-type.vue | 75 +
.../choose-table-master.vue | 258 ++
.../table-diancan-components/note.vue | 105 +
src/views/table/components/table-diancan.vue | 3031 +++++++++++++++++
src/views/table/table_list.vue | 13 +-
9 files changed, 4300 insertions(+), 1 deletion(-)
create mode 100644 src/views/table/components/choose-user.vue
create mode 100644 src/views/table/components/keyboard.vue
create mode 100644 src/views/table/components/order-btn.js
create mode 100644 src/views/table/components/pay-type.vue
create mode 100644 src/views/table/components/table-diancan-components/choose-table-master.vue
create mode 100644 src/views/table/components/table-diancan-components/note.vue
create mode 100644 src/views/table/components/table-diancan.vue
diff --git a/src/api/table.js b/src/api/table.js
index 31b8dfd..c9396f2 100644
--- a/src/api/table.js
+++ b/src/api/table.js
@@ -118,3 +118,180 @@ export function summaryTableDownload(data) {
});
}
+
+
+/**
+ * 获取当前台桌订单信息
+ * @returns
+ */
+export function getCart(params) {
+ return request({
+ url: `/api/place/cart`,
+ method: "get",
+ params:{
+ shopId: localStorage.getItem("shopId"),
+ ...params
+ }
+ });
+}
+/**
+ * 已上架商品列表
+ * @returns
+ */
+export function getGoodsLists(params) {
+ return request({
+ url: `/api/place/activate`,
+ method: "get",
+ params:{
+ shopId: localStorage.getItem("shopId"),
+ ...params
+ }
+ });
+}
+
+/**
+ * 点单
+ * @returns
+ */
+export function addCart(data) {
+ return request({
+ url: `/api/place/addCart`,
+ method: "post",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+
+/**
+ * 清空购物车/支付订单
+ * @returns
+ */
+export function $clearCart(data) {
+ return request({
+ url: `/api/place/clearCart`,
+ method: "delete",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+
+/**
+ * 删除购物车某个商品
+ * @returns
+ */
+export function $removeCart(data) {
+ return request({
+ url: `/api/place/removeCart`,
+ method: "delete",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+/**
+ * 更新规格
+ * @returns
+ */
+export function $updateCart(data) {
+ return request({
+ url: `/api/place/updateCart`,
+ method: "put",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+/**
+ * 批量打包
+ * @returns
+ */
+export function $allPack(data) {
+ return request({
+ url: `/api/place/pack`,
+ method: "put",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+/**
+ * 获取取餐号
+ * @returns
+ */
+export function $getMasterId(data) {
+ return request({
+ url: `/api/place/masterId`,
+ method: "get",
+ params:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+/**
+ * 支付方式获取
+ * @returns
+ */
+export function $getPayType(data) {
+ return request({
+ url: `/api/place/payType`,
+ method: "get",
+ params:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+/**
+ * 创建订单
+ * @returns
+ */
+export function $createOrder(data) {
+ return request({
+ url: `/api/place/order`,
+ method: "post",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+
+
+/**
+ * 挂起订单
+ * @returns
+ */
+export function $cacheOrder(data) {
+ return request({
+ url: `/api/place/pending`,
+ method: "post",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+
+/**
+ * 获取已挂起订单
+ * @returns
+ */
+export function $getCacheOrder(data) {
+ return request({
+ url: `/api/place/car`,
+ method: "get",
+ params:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+
diff --git a/src/views/table/components/choose-user.vue b/src/views/table/components/choose-user.vue
new file mode 100644
index 0000000..02b73f8
--- /dev/null
+++ b/src/views/table/components/choose-user.vue
@@ -0,0 +1,285 @@
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+ 不选择用户
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ scope.row.nickName }}
+
+
+
+
+
+
+
+ 会员等级{{ scope.row.isVip }}
+ 否
+
+
+
+
+
+
+
+ 选择
+ 充值
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/table/components/keyboard.vue b/src/views/table/components/keyboard.vue
new file mode 100644
index 0000000..03ddbd7
--- /dev/null
+++ b/src/views/table/components/keyboard.vue
@@ -0,0 +1,295 @@
+
+
+
+
{{ number }}
+
+
+ 确认
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/table/components/order-btn.js b/src/views/table/components/order-btn.js
new file mode 100644
index 0000000..33c7922
--- /dev/null
+++ b/src/views/table/components/order-btn.js
@@ -0,0 +1,62 @@
+export const orderBtns=[
+ {
+ text: "删除",
+ disabled: false,
+ },
+ {
+ text: "规格",
+ disabled: true,
+ },
+ {
+ text: "菜品打折",
+ disabled: false,
+ },
+ {
+ text: "赠菜",
+ disabled: false,
+ },
+ {
+ text: "赠菜",
+ disabled: false,
+ },
+ {
+ text: "打包",
+ disabled: false,
+ },
+ {
+ text: "等叫",
+ disabled: false,
+ },
+ {
+ text: "整单等叫",
+ disabled: false,
+ },
+ {
+ text: "单品备注",
+ disabled: false,
+ },
+ {
+ text: "退菜",
+ disabled: false,
+ },
+ {
+ text: "附加费",
+ disabled: false,
+ },
+ {
+ text: "存单",
+ disabled: false,
+ },
+ {
+ text: "取单",
+ disabled: false,
+ },
+ {
+ text: "修改价格",
+ disabled: false,
+ },
+ {
+ text: "撤单",
+ disabled: false,
+ }
+]
\ No newline at end of file
diff --git a/src/views/table/components/pay-type.vue b/src/views/table/components/pay-type.vue
new file mode 100644
index 0000000..760d909
--- /dev/null
+++ b/src/views/table/components/pay-type.vue
@@ -0,0 +1,75 @@
+
+
+
选择支付方式
+
+
+
+
+ {{ item.payName }}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/table/components/table-diancan-components/choose-table-master.vue b/src/views/table/components/table-diancan-components/choose-table-master.vue
new file mode 100644
index 0000000..f2711bb
--- /dev/null
+++ b/src/views/table/components/table-diancan-components/choose-table-master.vue
@@ -0,0 +1,258 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 确定
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/table/components/table-diancan-components/note.vue b/src/views/table/components/table-diancan-components/note.vue
new file mode 100644
index 0000000..3df74f6
--- /dev/null
+++ b/src/views/table/components/table-diancan-components/note.vue
@@ -0,0 +1,105 @@
+
+
+
+
+
+ {{ tag }}
+
+
+
+
+ 取消
+
+ 确定
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
new file mode 100644
index 0000000..05d48bf
--- /dev/null
+++ b/src/views/table/components/table-diancan.vue
@@ -0,0 +1,3031 @@
+
+
+
+
+
+
+
+
+
+
+
选择用户
+
+
+
![]()
+
+
{{ vipUser.nickName }}
+
+ 余额:{{ vipUser.amount }}
+
+
+
+
+
+
+
+ {{ table ? "桌台号:" + table.name : "桌台号/取餐号" }}
+
+
+
清空
+
+
+
+
+
+ 已优惠¥{{ allGiftMoney | to2 }}
+
+
+
+
+
打包
+
+ 共{{ allNumber }}件
+ ¥{{ allPrice }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 包
+
+
+
+
![]()
+
+
+
+
+ {{ item.specSnap }}
+
+
+
+
+
+
+
+ ¥{{ item.salePrice }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 规格
+
+
+ {{ returnGiftText }}
+
+
+ {{ returnPackText }}
+
+
+ 删除
+
+
+
+ 存单
+
+
+ 取单
+ {{
+ prveOrder.list.length
+ }}
+
+
+
+
+
整单备注
+
+
+
+
+
+
+
+
+ {{ item.name }}
+ {{
+ item.name
+ }}
+
+
+
+
+ 未找到相关商品
+
+
+
+
![]()
+
+ {{ item | returntypeName }}
+
+
+
{{ item.name }}
+
+
¥{{ item.lowPrice }}
+
+
+
+
+
+
+
+
+
+
选择优惠
+
+
+
![]()
+
+
+ {{
+ vipUser.id ? vipUser.nickName : "服务员下单"
+ }}
+
+
+
余额:{{ vipUser.amount | to2 }}
+
积分:{{ vipUser.totalScore }}
+
+
+
+
+
+
+
+ 整单打折/减免
+ 免单
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+ ({{ item.values.length }}选1)
+
+
+
+
+
+
+ {{ val }}
+
+
+ {{ val }}
+
+
+
+
+
+
+
+
+
+
¥{{ skuGoods.data.salePrice | to2 }}
+
+ {{ skuText }}
+ 库存:{{ skuGoods.data.stockNumber || "" }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 数量
+
+
+
{{ keyborad.number }}
+
+
+
+
+
+
+
+
+
+
+
+
{{ index + 1 }}
+
¥{{ item.totalAmount }}
+
+
{{ item.created_at ||''}}
+
({{ item.totalNumber }}件)
+
+
+
+
+
+
+
![]()
+
+
+
+
{{ item.name }}
+
x{{ item.number }}
+
¥{{ item.totalAmount || 0 }}
+
+
+
+ {{ item.specSnap | formatSpecSnap }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/table/table_list.vue b/src/views/table/table_list.vue
index 4349239..ed0fbda 100644
--- a/src/views/table/table_list.vue
+++ b/src/views/table/table_list.vue
@@ -41,6 +41,9 @@
客座次数:{{ item.maxCapacity }}人
+
+ 点餐
+
@@ -71,12 +77,14 @@
import addEara from './components/addEara'
import addTable from './components/addTable'
import downloadTableCode from './components/downloadTableCode'
+import tableDiancan from './components/table-diancan.vue'
import { tbShopTableGet, tbShopAreaGet, tbShopAreaDelete, tbShopTableDelete } from '@/api/table'
export default {
components: {
addEara,
addTable,
- downloadTableCode
+ downloadTableCode,
+ tableDiancan
},
data() {
return {
@@ -109,6 +117,9 @@ export default {
this.tbShopAreaGet()
},
methods: {
+ diancanShow(item){
+ this.$refs.dianan.open(item)
+ },
tabClick() {
this.tbShopTableGet()
},
From e0be30bd02a28ee60ada46c276c5fa46d836a595 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Sat, 17 Aug 2024 18:02:38 +0800
Subject: [PATCH 02/35] =?UTF-8?q?=E5=8F=B0=E6=A1=8C=E5=88=97=E8=A1=A8-?=
=?UTF-8?q?=E4=BB=A3=E8=AF=BE=E4=B8=8B=E5=8D=95=E7=A6=81=E6=AD=A2=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E6=A1=8C=E5=8F=B0=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index 05d48bf..80276de 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -66,7 +66,8 @@
-
+
+
{{ table ? "桌台号:" + table.name : "桌台号/取餐号" }}
From 51e410a4bec7b021de805acb3206b0b5ee171b41 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Mon, 19 Aug 2024 17:15:00 +0800
Subject: [PATCH 03/35] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E8=AF=BE?=
=?UTF-8?q?=E4=B8=8B=E5=8D=95=E6=9C=AC=E5=9C=B0=E6=B5=8B=E8=AF=95=E7=8E=AF?=
=?UTF-8?q?=E5=A2=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 2 +-
.env.production | 2 +-
src/api/table.js | 24 ++-
src/views/table/components/table-diancan.vue | 186 +++++++++++++------
4 files changed, 158 insertions(+), 56 deletions(-)
diff --git a/.env.development b/.env.development
index 6ab192b..e76c640 100644
--- a/.env.development
+++ b/.env.development
@@ -5,7 +5,7 @@ ENV = 'development'
# VUE_APP_BASE_API = 'http://192.168.2.42:8000'
# VUE_APP_BASE_API = 'http://192.168.2.133:8000'
# 测试
-VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
+VUE_APP_BASE_API = 'http://t361017w45.qicp.vip/'
# 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.96:8000'
diff --git a/.env.production b/.env.production
index 04cb80a..8de7729 100644
--- a/.env.production
+++ b/.env.production
@@ -3,7 +3,7 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
# 测试
-VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
+VUE_APP_BASE_API = 'http://t361017w45.qicp.vip/'
# 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.98:8000'
diff --git a/src/api/table.js b/src/api/table.js
index c9396f2..672a4f7 100644
--- a/src/api/table.js
+++ b/src/api/table.js
@@ -286,7 +286,7 @@ export function $cacheOrder(data) {
*/
export function $getCacheOrder(data) {
return request({
- url: `/api/place/car`,
+ url: `/api/place/pending/cart`,
method: "get",
params:{
shopId: localStorage.getItem("shopId"),
@@ -295,3 +295,25 @@ export function $getCacheOrder(data) {
});
}
+// 会员点单/取消会员点单
+export function $setUser(data) {
+ return request({
+ url: `/api/place/updateVip`,
+ method: "delete",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
+// 删除订单
+export function $delOrder(data) {
+ return request({
+ url: `/api/place/order`,
+ method: "put",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
+}
\ No newline at end of file
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index 80276de..147868f 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -67,11 +67,17 @@
-
+
{{ table ? "桌台号:" + table.name : "桌台号/取餐号" }}
-
清空
+
清空
-
-
-
{{ val }}
@@ -598,11 +606,12 @@
v-else
size="medium"
type="success"
+ :disabled="item.disabled"
@click="changeTagSel(index, val)"
effect="light"
>
{{ val }}
-
+ -->
@@ -807,9 +816,44 @@ import {
$cacheOrder,
$getCacheOrder,
$delOrder,
- $setUser
+ $setUser,
} from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop";
+//判断商品是否可以下单
+function isCanBuy(goods) {
+ return goods.isGrounding && goods.isPauseSale == 0 && goods.stockNumber > 0;
+}
+
+// 一个数组是否包含另外一个数组全部元素
+function arrayContainsAll(arr1, arr2) {
+ for (let i = 0; i < arr2.length; i++) {
+ if (!arr1.includes(arr2[i])) {
+ return false;
+ }
+ }
+ return true;
+}
+
+//n项 n-1项组合,生成全部结果
+function generateCombinations(arr, k) {
+ let result = [];
+
+ function helper(index, current) {
+ if (current.length === k) {
+ result.push(current.slice()); // 使用slice()来避免直接修改原始数组
+ } else {
+ for (let i = index; i < arr.length; i++) {
+ current.push(arr[i]); // 将当前元素添加到组合中
+ helper(i + 1, current); // 递归调用,索引增加以避免重复选择相同的元素
+ current.pop(); // 回溯,移除当前元素以便尝试其他组合
+ }
+ }
+ }
+
+ helper(0, []); // 从索引0开始,初始空数组作为起点
+ return result;
+}
+
function returnReverseVal(val, isReturnString = true) {
const isBol = typeof val === "boolean";
const isString = typeof val === "string";
@@ -991,7 +1035,7 @@ export default {
},
skuText() {
const result = this.selGoods.skuList.reduce((a, b) => {
- return a + b.sel + "+";
+ return a + (b.sel ? b.sel + "+" : "");
}, "");
return result.substring(0, result.length - 1);
},
@@ -1039,15 +1083,15 @@ export default {
},
},
watch: {
- "vipUser.id":async function(val){
- const {masterId}= await this.getMasterId()
- this.masterId=masterId
- $setUser({
- tableId:this.table.tableId,
- masterId:this.masterId,
- vipUserId:val,
- type:val===''?1:0
- })
+ "vipUser.id": async function (val) {
+ const { masterId } = await this.getMasterId();
+ this.masterId = masterId;
+ $setUser({
+ tableId: this.table.tableId,
+ masterId: this.masterId,
+ vipUserId: val,
+ type: val === "" ? 1 : 0,
+ });
},
"prveOrder.list.length": function (val) {
if (val !== 0) {
@@ -1376,17 +1420,20 @@ export default {
// tableId:this.table.tableId,
// masterId:order.carList[0].masterId
// })
- const {masterId,tableId,userId}= await $cacheOrder({orderId:this.prveOrder.list[this.prveOrder.sel].orderId,isPending:false})
- this.masterId=masterId
- const {records}=await getCart({
+ const { masterId, tableId, userId } = await $cacheOrder({
+ orderId: this.prveOrder.list[this.prveOrder.sel].orderId,
+ isPending: false,
+ });
+ this.masterId = masterId;
+ const { records } = await getCart({
masterId,
tableId,
- vipUserId:userId!='null'?userId:''
- })
- console.log(records)
- this.order.list = records
+ vipUserId: userId != "null" ? userId : "",
+ });
+ console.log(records);
+ this.order.list = records;
this.prveOrder.show = false;
- return
+ return;
this.order.list = this.prveOrder.list[this.prveOrder.sel].carList;
this.delPrveOrder();
this.prveOrder.show = false;
@@ -1396,7 +1443,7 @@ export default {
const { sel } = this.prveOrder;
const order = this.prveOrder.list[sel];
const res = await $delOrder({
- orderId: order.orderId
+ orderId: order.orderId,
});
this.$notify({
message: "删除成功",
@@ -1654,15 +1701,81 @@ export default {
this.order.list.push({ ...item, isPack, isGift });
this.order.selIndex = this.order.list.length - 1;
},
+ //设置规格按钮的禁止状态
+ setTagDisabled() {
+ const selArr = this.selGoods.skuList.reduce((prve, cur) => {
+ if (cur.sel) {
+ prve.push(cur.sel);
+ } else {
+ }
+ return prve;
+ }, []);
+ console.log(selArr);
+ let selArrAllGroup = generateCombinations(selArr, selArr.length - 1);
+ console.log(selArrAllGroup);
+ const matchArr = [];
+ for (let key in this.selGoods.skuMap) {
+ const goods = this.selGoods.skuMap[key];
+ const keyArr = key.split(",");
+ for (let spe of selArrAllGroup) {
+ if (arrayContainsAll(keyArr, spe)) {
+ matchArr.push(goods);
+ break;
+ }
+ }
+ }
+ console.log(matchArr);
+ const skuList = this.selGoods.skuList;
+ console.log(skuList);
+ //全部规格都已下架
+ if (!matchArr.length) {
+ for (let k in skuList) {
+ for (let i in skuList[k].values) {
+ this.$set(skuList[k].values[i], "disabled", true);
+ }
+ }
+ return;
+ }
+ const includeSkuMap = matchArr.reduce((prve, cur) => {
+ const speArr = cur.specSnap.split(",");
+ for (let i of speArr) {
+ if (!prve.hasOwnProperty("i")) {
+ prve[i] = matchArr
+ .filter((v) => v.specSnap.match(i))
+ .every((v) => {
+ return (
+ !v.isGrounding || v.isPauseSale == 1 || v.stockNumber <= 0
+ );
+ });
+ }
+ }
+ return prve;
+ }, {});
+ for (let i in includeSkuMap) {
+ for (let k in skuList) {
+ const index = skuList[k].valueArr.findIndex((val) => val === i);
+ if (index !== -1) {
+ this.$set(skuList[k].values[index], "disabled", includeSkuMap[i]);
+ }
+ }
+ }
+ },
changeTagSel(index, val) {
- this.$set(this.selGoods.skuList[index], "sel", val);
+ this.$set(this.selGoods.skuList[index], "sel", val.name);
let specSnap = this.selGoods.skuList.reduce((a, b) => {
return a + b.sel + ",";
}, "");
specSnap = specSnap.substring(0, specSnap.length - 1);
- const skuGoods = this.selGoods.skuMap[specSnap];
- this.skuGoods.data = skuGoods;
- this.skuGoods.number = skuGoods.suit || 1;
+ for (let sku of this.selGoods.skuList) {
+ console.log(sku);
+ }
+ this.setTagDisabled();
+ const canChooseGoods = this.selGoods.skuList.every((v) => v.sel);
+ if (canChooseGoods) {
+ const skuGoods = this.selGoods.skuMap[specSnap];
+ this.skuGoods.data = skuGoods;
+ this.skuGoods.number = skuGoods.suit || 1;
+ }
},
reset() {
// this.goods.list = [];
@@ -1719,8 +1832,8 @@ export default {
this.selGoods.title = item.name;
this.selGoods.show = true;
},
- //根据右侧商品单规格多规格做不同处理
- async goodsClick(item) {
+ // 备份版本,会过滤下架和售尽以为库存小于等于0的商品
+ async goodsClickback(item) {
if (item.typeEnum === "sku") {
this.selGoods.data = item;
this.selGoods.skuMap = {};
@@ -1729,36 +1842,38 @@ export default {
this.selGoods.skuMap[specList[i].specSnap] = specList[i];
}
console.log(this.selGoods.skuMap);
-
+
let specSnap = "";
- let tagSnap=JSON.parse(item.skuResult.tagSnap).map(v=>{
- return {...v,newval:{}}
- })
- const canUseSpecSnap={}
- const canBudyGoods=specList.filter(v=>v.isGrounding&&v.isPauseSale!=1&&v.stockNumber>0)
- canBudyGoods.map(v=>{
- v.specSnap.split(',').map(spe=>{
- canUseSpecSnap[spe]=spe
- })
- })
- console.log(canUseSpecSnap)
- for(let i in canUseSpecSnap){
- const item=tagSnap.find(v=>v.value.match(i))
- item.newval[i]=i
+ let tagSnap = JSON.parse(item.skuResult.tagSnap).map((v) => {
+ return { ...v, newval: {} };
+ });
+ const canUseSpecSnap = {};
+ const canBudyGoods = specList.filter(
+ (v) => v.isGrounding && v.isPauseSale != 1 && v.stockNumber > 0
+ );
+ canBudyGoods.map((v) => {
+ v.specSnap.split(",").map((spe) => {
+ canUseSpecSnap[spe] = spe;
+ });
+ });
+ console.log(canUseSpecSnap);
+ for (let i in canUseSpecSnap) {
+ const item = tagSnap.find((v) => v.value.match(i));
+ item.newval[i] = i;
}
- tagSnap=tagSnap.map(v=>{
- const newvals=Object.keys(v.newval)
+ tagSnap = tagSnap.map((v) => {
+ const newvals = Object.keys(v.newval);
specSnap += newvals[0] + ",";
return {
...v,
- values:newvals,
+ values: newvals,
sel: newvals[0],
- }
- })
- console.log(tagSnap)
- console.log(canUseSpecSnap)
- console.log(canBudyGoods)
- this.selGoods.skuList = tagSnap
+ };
+ });
+ console.log(tagSnap);
+ console.log(canUseSpecSnap);
+ console.log(canBudyGoods);
+ this.selGoods.skuList = tagSnap;
// this.selGoods.skuList = tagSnap.map((v) => {
// const values = v.value.split(",");
// specSnap += values[0] + ",";
@@ -1815,6 +1930,139 @@ export default {
this.orderListPush(res);
}
},
+ //多规格商品弹窗时,找到默认可以下单的规格商品
+ findGoods(skuList = [], goodsListMap = {}) {
+ const skuMapNumber = skuList.reduce((prve, cur) => {
+ for (let i in cur.valueArr) {
+ prve[cur.valueArr[i]] = i;
+ }
+ return prve;
+ }, {});
+ const canBudyGoods = this.selGoods.data.specList
+ .filter((v) => isCanBuy(v))
+ .sort((a, b) => {
+ const aNumber = a.specSnap.split(",").reduce((prve, cur) => {
+ return prve + skuMapNumber[cur];
+ }, 0);
+ const bNumber = b.specSnap.split(",").reduce((prve, cur) => {
+ return prve + skuMapNumber[cur];
+ }, 0);
+ return aNumber - bNumber;
+ });
+ return canBudyGoods[0];
+ },
+ //设置商品默认选中,规格禁止以及选中
+ setSkugoodsDefaultInit() {
+ const skuList = this.selGoods.skuList;
+ const goodsListMap = this.selGoods.skuMap;
+ const skuGoods = this.findGoods(skuList, goodsListMap);
+ console.log(skuGoods);
+ if (skuGoods) {
+ this.skuGoods.data = skuGoods;
+ this.skuGoods.number = skuGoods.suit || 1;
+ skuGoods.specSnap.split(",").map((v, index) => {
+ skuList[index].sel = v;
+ });
+ }
+ this.setTagDisabled();
+ // console.log(goods)
+ // const includeSkuMap = goodsList.reduce((prve, cur) => {
+ // const speArr = cur.specSnap.split(",");
+ // for (let i of speArr) {
+ // if (!prve.hasOwnProperty("i")) {
+ // prve[i] = goodsList
+ // .filter((v) => v.specSnap.match(i))
+ // .every((v) => {
+ // return (
+ // !v.isGrounding || v.isPauseSale == 1 || v.stockNumber <= 0
+ // );
+ // });
+ // }
+ // }
+ // return prve;
+ // }, {});
+ // console.log(includeSkuMap);
+ // for (let i in includeSkuMap) {
+ // for (let k in skuList) {
+ // const index = skuList[k].valueArr.findIndex((val) => val === i);
+ // if (index !== -1) {
+ // this.$set(skuList[k].values[index], "disabled", includeSkuMap[i]);
+ // }
+ // }
+ // }
+ },
+ //根据右侧商品单规格多规格做不同处理
+ async goodsClick(item) {
+ if (item.typeEnum === "sku") {
+ this.selGoods.data = item;
+ this.selGoods.skuMap = {};
+ const specList = item.specList;
+ for (let i in specList) {
+ this.selGoods.skuMap[specList[i].specSnap] = specList[i];
+ }
+ console.log(this.selGoods.skuMap);
+ let specSnap = "";
+ // const canBudyGoods=specList.filter(v=>v)
+ this.selGoods.skuList = JSON.parse(item.skuResult.tagSnap).map((v) => {
+ const values = v.value.split(",");
+ // specSnap += values[0] + ",";
+ return {
+ ...v,
+ valueArr: values,
+ values: values.map((name) => {
+ return { name, disabled: false };
+ }),
+ // sel: values[0],
+ // sel: values[0],
+ };
+ });
+
+ // specSnap = specSnap.substring(0, specSnap.length - 1);
+ // const skuGoods = this.selGoods.skuMap[specSnap];
+ this.setSkugoodsDefaultInit();
+ // this.skuGoods.data = skuGoods;
+ // this.skuGoods.number = skuGoods.suit || 1;
+ this.selGoods.title = item.name;
+ this.selGoods.show = true;
+ return;
+ }
+ //单规格
+ const orderGoodsIndex = this.order.list.findIndex((V) => {
+ return V.skuId == item.specList[0].id && V.productId == item.id;
+ });
+ const orderGoods =
+ orderGoodsIndex != -1 ? this.order.list[orderGoodsIndex] : undefined;
+ // const orderGoods = this.order.list.find((V) => {
+ // return V.skuId == item.specList[0].id && V.productId == item.id;
+ // });
+ let res = "";
+ if (orderGoods) {
+ //更新
+ // res = await $updateCart({
+ // cartId: orderGoods.id,
+ // productId: item.id,
+ // skuId: item.specList[0].id,
+ // tableId: this.table.tableId,
+ // num: orderGoods.number * 1 + item.specList[0].suit, // 0会删除此商品
+ // });
+ orderGoods.number += item.specList[0].suit;
+ this.order.number = orderGoods.number;
+ this.order.selIndex = orderGoodsIndex;
+ } else {
+ //增加
+ console.log(item);
+ res = await addCart({
+ masterId: this.masterId,
+ vipUserId: this.vipUser.id,
+ productId: item.id,
+ skuId: item.specList[0].id,
+ tableId: this.table.tableId,
+ num: item.specList[0].suit, // 0会删除此商品
+ isPack: false, // 是否打包
+ });
+ this.orderListPush(res);
+ }
+ },
async getGoods() {
const res = await getGoodsLists(this.goods.query);
console.log(res);
@@ -1912,9 +2160,14 @@ input[type="number"]::-webkit-outer-spin-button {
background: #22bf64;
color: #fff;
}
-::v-deep .flex-1 .el-button{
+::v-deep .flex-1 .el-button {
width: 100%;
}
+::v-deep .el-button--success.is-plain {
+ background: rgba(34, 191, 100, 0.1);
+ color: #22bf64;
+ border: 1px solid #22bf64;
+}
::v-deep .el-button--medium {
padding-top: 12px;
padding-bottom: 12px;
From 555d0ebaa00235f1436a70410ef2cf286aa656b5 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Tue, 20 Aug 2024 17:46:25 +0800
Subject: [PATCH 09/35] =?UTF-8?q?=E4=BB=A3=E8=AF=BE=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=98=E5=8D=95=E5=8F=96=E5=8D=95=E4=BB=A5?=
=?UTF-8?q?=E5=8F=8A=E7=94=A8=E6=88=B7=E5=88=87=E6=8D=A2=E6=97=B6masterid?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=20=E5=BD=93=E6=98=AF?=
=?UTF-8?q?=E5=8F=96=E5=87=BA=E7=9A=84=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81?=
=?UTF-8?q?=E6=97=B6=E4=BD=BF=E7=94=A8=E8=AE=A2=E5=8D=95=E7=9A=84masterID?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index a5231a6..ce981ef 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -921,6 +921,7 @@ export default {
},
order: {
payType: "",
+ masterId:'',
allPack: false,
btns: [
{
@@ -1084,7 +1085,11 @@ export default {
},
watch: {
"vipUser.id": async function (val) {
- const { masterId } = await this.getMasterId();
+ let masterId=this.order.masterId
+ if(!masterId){
+ const res = await this.getMasterId();
+ masterId=res.masterId
+ }
this.masterId = masterId;
$setUser({
tableId: this.table.tableId,
@@ -1269,17 +1274,17 @@ export default {
this.isCreateOrder = false;
},
async createOrderShow() {
- this.order.payType;
- this.isCreateOrder = true;
const res = await $createOrder({
- masterId: this.masterId,
+ masterId:this.order.masterId||this.masterId,
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
- note: this.note.content,
+ note: this.note.content
});
this.createOrder.data = res;
const masterId = await this.getMasterId();
this.masterId = masterId;
+ this.isCreateOrder = true;
+
},
// 获取取餐号
@@ -1425,12 +1430,14 @@ export default {
isPending: false,
});
this.masterId = masterId;
+ console.log(masterId)
const { records } = await getCart({
masterId,
tableId,
vipUserId: userId != "null" ? userId : "",
});
console.log(records);
+ this.order.masterId=masterId
this.order.list = records;
this.prveOrder.show = false;
return;
@@ -1468,6 +1475,7 @@ export default {
vipUserId: this.vipUser.id,
isPending: true,
});
+ this.order.masterId='';
this.order.list = [];
this.order.selIndex = -1;
const masterId = await this.getMasterId();
@@ -1779,6 +1787,7 @@ export default {
},
reset() {
// this.goods.list = [];
+ this.order.masterId='';
this.order.list = [];
this.order.query.page = 1;
this.goods.total = 0;
From 8a84a99272efc5bb25ef1d2974d1cd2e8459a03b Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 21 Aug 2024 10:58:57 +0800
Subject: [PATCH 10/35] =?UTF-8?q?=E4=BB=A3=E8=AF=BE=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=EF=BC=8C=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E9=83=A8=E5=88=86=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 172 +++---
src/views/table/table_list.vue | 522 ++++++++++---------
2 files changed, 356 insertions(+), 338 deletions(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index ce981ef..646a103 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -144,7 +144,7 @@
去结账
@@ -154,7 +154,7 @@
class="my-btn flex-1 success"
:class="{ disabled: !order.list.length }"
:disabled="!order.list.length"
- @click="createOrderShow"
+ @click="toPay"
>
去结账
-->
@@ -177,7 +177,7 @@
class="my-btn flex-1 default"
:class="{ disabled: !order.list.length }"
:disabled="!order.list.length"
- @click="createOrderShow"
+ @click="toPay"
>
去结账
@@ -921,7 +921,7 @@ export default {
},
order: {
payType: "",
- masterId:'',
+ masterId: "",
allPack: false,
btns: [
{
@@ -1084,11 +1084,14 @@ export default {
},
},
watch: {
+ masterId:function(val){
+ console.log(val)
+ },
"vipUser.id": async function (val) {
- let masterId=this.order.masterId
- if(!masterId){
+ let masterId = this.order.masterId;
+ if (!masterId) {
const res = await this.getMasterId();
- masterId=res.masterId
+ masterId = res.masterId;
}
this.masterId = masterId;
$setUser({
@@ -1232,7 +1235,6 @@ export default {
},
// 支付订单
async payOrder() {
- return this.payOrderSuccess();
console.log({
orderId: this.createOrder.data.id,
payType: this.order.payType,
@@ -1251,6 +1253,7 @@ export default {
type: "success",
});
this.reset();
+ this.close()
},
chooseTableConfirm(item) {
console.log(item);
@@ -1273,18 +1276,18 @@ export default {
createOrderClose() {
this.isCreateOrder = false;
},
- async createOrderShow() {
+ //生成订单
+ async toPay() {
const res = await $createOrder({
- masterId:this.order.masterId||this.masterId,
+ masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
- note: this.note.content
+ note: this.note.content,
});
this.createOrder.data = res;
const masterId = await this.getMasterId();
this.masterId = masterId;
this.isCreateOrder = true;
-
},
// 获取取餐号
@@ -1300,6 +1303,7 @@ export default {
changePrveOrder(index) {
this.prveOrder.sel = index;
},
+ //更新购物车商品数据
updateOrder(par = {}) {
let item = this.order.list[this.order.selIndex];
console.log(item.specSnap);
@@ -1363,6 +1367,8 @@ export default {
// return { ...v, cart: JSON.parse(v.cart) };
// });
// },
+
+ //右侧控制按钮点击事件
orderBtnsClick(key) {
const orderGoods = this.order.list[this.order.selIndex];
this.createOrderClose();
@@ -1430,35 +1436,35 @@ export default {
isPending: false,
});
this.masterId = masterId;
- console.log(masterId)
+ console.log(masterId);
const { records } = await getCart({
masterId,
tableId,
vipUserId: userId != "null" ? userId : "",
});
console.log(records);
- this.order.masterId=masterId
+ this.order.masterId = masterId;
this.order.list = records;
this.prveOrder.show = false;
- return;
- this.order.list = this.prveOrder.list[this.prveOrder.sel].carList;
- this.delPrveOrder();
- this.prveOrder.show = false;
+ this.delPrveOrder(false);
},
//删除挂单
- async delPrveOrder() {
+ async delPrveOrder(isRequest = true) {
const { sel } = this.prveOrder;
const order = this.prveOrder.list[sel];
- const res = await $delOrder({
- orderId: order.orderId,
- });
- this.$notify({
- message: "删除成功",
- type: "success",
- });
+ if (isRequest) {
+ const res = await $delOrder({
+ orderId: order.orderId,
+ });
+ this.$notify({
+ message: "删除成功",
+ type: "success",
+ });
+ }
this.prveOrder.list.splice(sel, 1);
this.prveOrder.sel = sel - 1 <= 0 ? 0 : sel - 1;
},
+ //打开挂起订单
cacheOrderShow() {
this.prveOrder.show = true;
},
@@ -1468,6 +1474,7 @@ export default {
console.log(res);
this.prveOrder.list = res;
},
+ //存单
async saveOrder() {
const res = await $cacheOrder({
masterId: this.masterId,
@@ -1475,11 +1482,11 @@ export default {
vipUserId: this.vipUser.id,
isPending: true,
});
- this.order.masterId='';
+ this.order.masterId = "";
this.order.list = [];
this.order.selIndex = -1;
- const masterId = await this.getMasterId();
- this.masterId = masterId;
+ const masterIdRes = await this.getMasterId();
+ this.masterId = masterIdRes.masterId;
this.$nextTick(() => {
this.getCacheOrder();
});
@@ -1500,6 +1507,7 @@ export default {
// message: "清除成功!",
// });
},
+ // 点击订单里的加减改变购物车商品数量
async changeOrderNumber(index, isReduce) {
if (index < 0) {
return;
@@ -1526,6 +1534,7 @@ export default {
this.order.number = newval;
this.order.cacheNumber = newval;
},
+ // 点击右侧控制列表上的加减改变购物车商品数量
changeOrderGoodsNumber(isReduce) {
if (this.order.selIndex < 0) {
return;
@@ -1546,6 +1555,7 @@ export default {
this.order.number = newval;
this.order.cacheNumber = newval;
},
+ //清空购物车
clearCart() {
if (this.order.list.length <= 0) {
return;
@@ -1787,7 +1797,7 @@ export default {
},
reset() {
// this.goods.list = [];
- this.order.masterId='';
+ this.order.masterId = "";
this.order.list = [];
this.order.query.page = 1;
this.goods.total = 0;
@@ -1813,31 +1823,12 @@ export default {
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
- for (let i in specList) {
- this.selGoods.skuMap[specList[i].specSnap] = specList[i];
- }
- console.log(this.selGoods.skuMap);
- let specSnap = "";
- let specSnapArr = item.specSnap ? item.specSnap.split(",") : [];
- this.selGoods.skuList = JSON.parse(item.skuResult.tagSnap).map(
- (v, index) => {
- const values = v.value.split(",");
- specSnap += values[0] + ",";
- return {
- ...v,
- values: values,
- sel: specSnapArr.length ? specSnapArr[index] : values[0],
- };
- }
- );
- specSnap = item.specSnap
- ? item.specSnap
- : specSnap.substring(0, specSnap.length - 1);
- const skuGoods = this.selGoods.skuMap[specSnap];
+ this.setSelGoodsSkuMap(specList)
+ this.setSelGoodsSkuList(JSON.parse(item.skuResult.tagSnap),item.specSnap)
+ this.setTagDisabled()
+ const skuGoods = this.selGoods.skuMap[item.specSnap];
this.skuGoods.data = skuGoods;
- console.log(skuGoods);
this.skuGoods.number = item.number ? item.number : skuGoods.suit || 1;
- console.log(this.skuGoods.data);
this.selGoods.title = item.name;
this.selGoods.show = true;
},
@@ -1974,31 +1965,26 @@ export default {
});
}
this.setTagDisabled();
- // console.log(goods)
- // const includeSkuMap = goodsList.reduce((prve, cur) => {
- // const speArr = cur.specSnap.split(",");
- // for (let i of speArr) {
- // if (!prve.hasOwnProperty("i")) {
- // prve[i] = goodsList
- // .filter((v) => v.specSnap.match(i))
- // .every((v) => {
- // return (
- // !v.isGrounding || v.isPauseSale == 1 || v.stockNumber <= 0
- // );
- // });
- // }
- // }
- // return prve;
- // }, {});
- // console.log(includeSkuMap);
- // for (let i in includeSkuMap) {
- // for (let k in skuList) {
- // const index = skuList[k].valueArr.findIndex((val) => val === i);
- // if (index !== -1) {
- // this.$set(skuList[k].values[index], "disabled", includeSkuMap[i]);
- // }
- // }
- // }
+ },
+ // 设置当前选中商品skuList
+ setSelGoodsSkuList(skuList,specSnap) {
+ const specSnapArr=specSnap?specSnap.split(","):[]
+ this.selGoods.skuList = skuList.map((v,index) => {
+ const values = v.value.split(",");
+ return {
+ ...v,
+ valueArr: values,
+ sel:specSnap?specSnapArr[index]:'',
+ values: values.map((name) => {
+ return { name, disabled: false };
+ }),
+ };
+ });
+ },
+ setSelGoodsSkuMap(specList) {
+ for (let i in specList) {
+ this.selGoods.skuMap[specList[i].specSnap] = specList[i];
+ }
},
//根据右侧商品单规格多规格做不同处理
async goodsClick(item) {
@@ -2006,31 +1992,10 @@ export default {
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
- for (let i in specList) {
- this.selGoods.skuMap[specList[i].specSnap] = specList[i];
- }
+ this.setSelGoodsSkuMap(specList)
console.log(this.selGoods.skuMap);
- let specSnap = "";
- // const canBudyGoods=specList.filter(v=>v)
- this.selGoods.skuList = JSON.parse(item.skuResult.tagSnap).map((v) => {
- const values = v.value.split(",");
- // specSnap += values[0] + ",";
- return {
- ...v,
- valueArr: values,
- values: values.map((name) => {
- return { name, disabled: false };
- }),
- // sel: values[0],
- // sel: values[0],
- };
- });
-
- // specSnap = specSnap.substring(0, specSnap.length - 1);
- // const skuGoods = this.selGoods.skuMap[specSnap];
+ this.setSelGoodsSkuList( JSON.parse(item.skuResult.tagSnap))
this.setSkugoodsDefaultInit();
- // this.skuGoods.data = skuGoods;
- // this.skuGoods.number = skuGoods.suit || 1;
this.selGoods.title = item.name;
this.selGoods.show = true;
return;
@@ -2181,6 +2146,11 @@ input[type="number"]::-webkit-outer-spin-button {
padding-top: 12px;
padding-bottom: 12px;
}
+// ::v-deep .el-button.is-plain:hover, .el-button.is-plain:focus{
+// background: rgba(34, 191, 100, .1);
+// color: #22bf64;
+// border: 1px solid #22bf64;
+// }
::v-deep .number-box .el-input__inner::-webkit-inner-spin-button {
-webkit-appearance: none;
diff --git a/src/views/table/table_list.vue b/src/views/table/table_list.vue
index ed0fbda..58737f3 100644
--- a/src/views/table/table_list.vue
+++ b/src/views/table/table_list.vue
@@ -1,275 +1,323 @@
-
-
-
-
-
- {{ item.name }}
-
-
-
-
-
-
-
-
-
- 添加区域
- 添加台桌
-
- 下载台桌码
-
- 下载店铺码
-
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
-
-
-
-
-
-
{{ item.name }}
-
-
- {{ status[item.status].label }}
-
-
-
- {{ item.type == 0 ? '低消' : '计时' }}
- {{ item.isPredate == 1 ? '可预约'
- : '不可预约' }}
-
-
- 客座次数:{{ item.maxCapacity }}人
-
-
- 点餐
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 1bc4cf134c5aa1c78c82b7088251d6d3922114f3 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 21 Aug 2024 13:30:09 +0800
Subject: [PATCH 11/35] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8B=E5=8D=95=E5=85=B3=E9=97=AD=E5=9B=9E?=
=?UTF-8?q?=E8=B0=83=EF=BC=8C=E5=BD=93=E7=82=B9=E9=A4=90=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E5=85=B3=E9=97=AD=E5=88=B7=E6=96=B0=E6=A1=8C=E5=8F=B0=E7=8A=B6?=
=?UTF-8?q?=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 100 +++++++++++++------
src/views/table/table_list.vue | 5 +-
2 files changed, 75 insertions(+), 30 deletions(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index 646a103..bcea355 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -5,7 +5,7 @@
:title="title"
fullscreen
:visible.sync="informationdialogshow"
- @close="reset"
+ @close="onclose"
>
@@ -406,14 +406,22 @@
v-for="(item, index) in goods.list"
:key="index"
>
+
{{ item | returntypeName }}
{{ item.name }}
-
-
¥{{ item.lowPrice }}
+
+
+
¥{{ item.lowPrice }}
+
+
@@ -1084,8 +1092,8 @@ export default {
},
},
watch: {
- masterId:function(val){
- console.log(val)
+ masterId: function (val) {
+ console.log(val);
},
"vipUser.id": async function (val) {
let masterId = this.order.masterId;
@@ -1253,7 +1261,7 @@ export default {
type: "success",
});
this.reset();
- this.close()
+ this.close();
},
chooseTableConfirm(item) {
console.log(item);
@@ -1285,7 +1293,7 @@ export default {
note: this.note.content,
});
this.createOrder.data = res;
- const masterId = await this.getMasterId();
+ const {masterId} = await this.getMasterId();
this.masterId = masterId;
this.isCreateOrder = true;
},
@@ -1665,6 +1673,7 @@ export default {
type: "success",
});
this.selGoods.show = false;
+ this.order.cacheNumber = this.skuGoods.number;
return;
}
@@ -1795,6 +1804,10 @@ export default {
this.skuGoods.number = skuGoods.suit || 1;
}
},
+ onclose(){
+ this.$emit('close')
+ this.reset()
+ },
reset() {
// this.goods.list = [];
this.order.masterId = "";
@@ -1823,9 +1836,12 @@ export default {
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
- this.setSelGoodsSkuMap(specList)
- this.setSelGoodsSkuList(JSON.parse(item.skuResult.tagSnap),item.specSnap)
- this.setTagDisabled()
+ this.setSelGoodsSkuMap(specList);
+ this.setSelGoodsSkuList(
+ JSON.parse(item.skuResult.tagSnap),
+ item.specSnap
+ );
+ this.setTagDisabled();
const skuGoods = this.selGoods.skuMap[item.specSnap];
this.skuGoods.data = skuGoods;
this.skuGoods.number = item.number ? item.number : skuGoods.suit || 1;
@@ -1967,24 +1983,24 @@ export default {
this.setTagDisabled();
},
// 设置当前选中商品skuList
- setSelGoodsSkuList(skuList,specSnap) {
- const specSnapArr=specSnap?specSnap.split(","):[]
- this.selGoods.skuList = skuList.map((v,index) => {
- const values = v.value.split(",");
- return {
- ...v,
- valueArr: values,
- sel:specSnap?specSnapArr[index]:'',
- values: values.map((name) => {
- return { name, disabled: false };
- }),
- };
- });
+ setSelGoodsSkuList(skuList, specSnap) {
+ const specSnapArr = specSnap ? specSnap.split(",") : [];
+ this.selGoods.skuList = skuList.map((v, index) => {
+ const values = v.value.split(",");
+ return {
+ ...v,
+ valueArr: values,
+ sel: specSnap ? specSnapArr[index] : "",
+ values: values.map((name) => {
+ return { name, disabled: false };
+ }),
+ };
+ });
},
setSelGoodsSkuMap(specList) {
for (let i in specList) {
- this.selGoods.skuMap[specList[i].specSnap] = specList[i];
- }
+ this.selGoods.skuMap[specList[i].specSnap] = specList[i];
+ }
},
//根据右侧商品单规格多规格做不同处理
async goodsClick(item) {
@@ -1992,9 +2008,9 @@ export default {
this.selGoods.data = item;
this.selGoods.skuMap = {};
const specList = item.specList;
- this.setSelGoodsSkuMap(specList)
+ this.setSelGoodsSkuMap(specList);
console.log(this.selGoods.skuMap);
- this.setSelGoodsSkuList( JSON.parse(item.skuResult.tagSnap))
+ this.setSelGoodsSkuList(JSON.parse(item.skuResult.tagSnap));
this.setSkugoodsDefaultInit();
this.selGoods.title = item.name;
this.selGoods.show = true;
@@ -2055,6 +2071,7 @@ export default {
},
close() {
this.informationdialogshow = false;
+ this.$emit('close')
},
resetCommodityArr() {
this.commodityArr = [];
@@ -2364,7 +2381,10 @@ input[type="number"]::-webkit-outer-spin-button {
border-color: #ebeef5;
}
}
-
+.flex-xy-cnter {
+ justify-content: center;
+ align-items: center;
+}
.flex-wrap {
flex: 1;
}
@@ -2843,7 +2863,29 @@ input[type="number"]::-webkit-outer-spin-button {
opacity: 1;
margin: 0 7px 14px;
border-radius: 4px;
-
+ .timeSale {
+ text-align: center;
+ border-radius: 10px;
+ background-color: hsla(0, 0%, 99.2%, 0.5);
+ color: #fff;
+ font-size: 10px;
+ line-height: 16px;
+ padding: 2px 10px;
+ margin-top: 2px;
+ }
+ .sell-out {
+ width: 100%;
+ height: 100%;
+ padding: 10px;
+ background: rgba(0, 0, 0, 0.4);
+ z-index: 2;
+ position: absolute;
+ top: 0;
+ font-size: 14px;
+ font-weight: 400;
+ text-align: left;
+ color: #fff;
+ }
overflow: hidden;
position: relative;
diff --git a/src/views/table/table_list.vue b/src/views/table/table_list.vue
index 58737f3..dbffff3 100644
--- a/src/views/table/table_list.vue
+++ b/src/views/table/table_list.vue
@@ -103,7 +103,7 @@
-
+
@@ -164,6 +164,9 @@ export default {
this.tbShopAreaGet();
},
methods: {
+ onDiancanClose(){
+ this.tbShopTableGet()
+ },
diancanShow(item) {
this.$refs.dianan.open(item);
},
From 18c2c68c9fe98d8095afb2ff987846cfed4c64f3 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 21 Aug 2024 13:44:39 +0800
Subject: [PATCH 12/35] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=A2=E4=B8=8B?=
=?UTF-8?q?=E5=8D=95=E6=94=AF=E4=BB=98=E8=AE=A2=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/table.js | 11 +++++++++++
src/views/table/components/table-diancan.vue | 5 +++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/api/table.js b/src/api/table.js
index 26d338d..246c020 100644
--- a/src/api/table.js
+++ b/src/api/table.js
@@ -316,4 +316,15 @@ export function $delOrder(data) {
...data
}
});
+}
+// 支付订单
+export function $payOrder(data) {
+ return request({
+ url: '/api/place/pay',
+ method: "put",
+ data:{
+ shopId: localStorage.getItem("shopId"),
+ ...data
+ }
+ });
}
\ No newline at end of file
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index bcea355..9f2dc39 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -825,6 +825,7 @@ import {
$getCacheOrder,
$delOrder,
$setUser,
+ $payOrder
} from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop";
//判断商品是否可以下单
@@ -1247,7 +1248,7 @@ export default {
orderId: this.createOrder.data.id,
payType: this.order.payType,
});
- const res = await $clearCart({
+ const res = await $payOrder({
tableId: this.table.tableId,
masterId: this.masterId,
orderId: this.createOrder.data.id,
@@ -1257,7 +1258,7 @@ export default {
},
payOrderSuccess() {
this.$notify({
- title: "更新成功",
+ title: "支付成功",
type: "success",
});
this.reset();
From 0a36882c8b978c14034715d63c96edfa5d9fe9fb Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 21 Aug 2024 15:23:10 +0800
Subject: [PATCH 13/35] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=88=E4=BB=98=E8=B4=B9=E5=90=8E=E4=BB=98?=
=?UTF-8?q?=E8=B4=B9=E9=80=89=E6=8B=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 163 ++++++++++---------
1 file changed, 88 insertions(+), 75 deletions(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index 9f2dc39..a9d1c5f 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -7,38 +7,52 @@
:visible.sync="informationdialogshow"
@close="onclose"
>
-
-
-
-
+
+
+
+
+ {{ postPay ? "后付费" : "先付费" }}
+
+
+
+ 先付费
+ 后付费
+
+
-
-
+
+
@@ -107,9 +121,6 @@
-
- 下单并打印制作单
-
-
+ -->
+
+
+
+ 仅下单
+
+
+
+
去结账
-
-
-
-
¥{{ item.lowPrice }}
-
+
+
+
@@ -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,15 +1291,23 @@ 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();
+ const { masterId } = await this.getMasterId();
this.masterId = masterId;
this.isCreateOrder = true;
},
@@ -1805,9 +1818,9 @@ export default {
this.skuGoods.number = skuGoods.suit || 1;
}
},
- onclose(){
- this.$emit('close')
- this.reset()
+ onclose() {
+ 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 = [];
From 0b3084a3f924c93f302fe2fb504bdd7efceb1130 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 21 Aug 2024 15:36:23 +0800
Subject: [PATCH 14/35] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E5=90=8E=E4=BB=98=E6=AC=BE=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index a9d1c5f..c6a86aa 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -156,7 +156,7 @@
type="success"
size="medium"
:disabled="!order.list.length"
- @click="toCreateOrder"
+ @click="toCreateOrder(false)"
>
仅下单
@@ -167,7 +167,7 @@
去结账
@@ -1291,15 +1291,19 @@ export default {
this.isCreateOrder = false;
},
//生成订单
- async toCreateOrder() {
+ async toCreateOrder(isNowPay=false) {
const res = await $createOrder({
masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
note: this.note.content,
+ postPay:this.postPay
});
//后付款
- if(this.postPay){
+ console.log(this.postPay)
+ console.log(isNowPay)
+ console.log(this.postPay&&isNowPay)
+ if(this.postPay&&!isNowPay){
this.$notify({
title: "下单成功",
type: "success",
From 3f8a41f694320f604e18a596f93edf4253455963 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 21 Aug 2024 15:55:11 +0800
Subject: [PATCH 15/35] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=80=E5=8F=B0=E4=B8=AD=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/table_list.vue | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/views/table/table_list.vue b/src/views/table/table_list.vue
index dbffff3..f1dc59f 100644
--- a/src/views/table/table_list.vue
+++ b/src/views/table/table_list.vue
@@ -137,6 +137,14 @@ export default {
label: "挂单中",
type: "#E6A23C",
},
+ using:{
+ label: "开台中",
+ type: "#E6A23C",
+ },
+ paying:{
+ label: "结算中",
+ type: "#E6A23C",
+ },
idle: {
label: "空闲",
type: "#67C23A",
From f07b6ec29bcf895757655bd032da130d6339650f Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 21 Aug 2024 18:26:30 +0800
Subject: [PATCH 16/35] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8D=E5=90=8C?=
=?UTF-8?q?=E5=B8=83=E5=B1=80=E5=94=AE=E5=B0=BD=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 88 ++++++++++++++++++--
1 file changed, 79 insertions(+), 9 deletions(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index c6a86aa..843b504 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -153,7 +153,7 @@
-->
-
+
+
+
+
+
![]()
+
+
+
+
{{ item | returntypeName }}
@@ -1291,24 +1339,24 @@ export default {
this.isCreateOrder = false;
},
//生成订单
- async toCreateOrder(isNowPay=false) {
+ async toCreateOrder(isNowPay = false) {
const res = await $createOrder({
masterId: this.order.masterId || this.masterId,
vipUserId: this.vipUser.id,
tableId: this.table.tableId,
note: this.note.content,
- postPay:this.postPay
+ postPay: this.postPay,
});
//后付款
- console.log(this.postPay)
- console.log(isNowPay)
- console.log(this.postPay&&isNowPay)
- if(this.postPay&&!isNowPay){
+ console.log(this.postPay);
+ console.log(isNowPay);
+ console.log(this.postPay && isNowPay);
+ if (this.postPay && !isNowPay) {
this.$notify({
title: "下单成功",
type: "success",
});
- return this.close()
+ return this.close();
}
this.createOrder.data = res;
const { masterId } = await this.getMasterId();
@@ -2930,6 +2978,28 @@ input[type="number"]::-webkit-outer-spin-button {
flex-direction: column;
justify-content: space-between;
}
+ .img-box {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ }
+ .text-sell-out{
+ z-index: 1;
+ position: absolute;
+ right: 0;
+ top: 0;
+ }
+ .sell-out-svg {
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.5);
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
img {
width: 100%;
height: 100%;
From 9e4eaf1ebc7ebf8fa10a7076a77c05911a84f0a9 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Thu, 22 Aug 2024 09:30:58 +0800
Subject: [PATCH 17/35] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E5=AD=97=E5=B8=83=E5=B1=80=E5=94=AE?=
=?UTF-8?q?=E5=AE=8C=E5=B1=95=E7=A4=BA=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/table/components/table-diancan.vue | 88 ++++++++++++++++----
1 file changed, 72 insertions(+), 16 deletions(-)
diff --git a/src/views/table/components/table-diancan.vue b/src/views/table/components/table-diancan.vue
index 843b504..542912f 100644
--- a/src/views/table/components/table-diancan.vue
+++ b/src/views/table/components/table-diancan.vue
@@ -388,6 +388,9 @@
-->
-
-
-
+
-
+ "
+ >