From d1cbebefe924e0bf9dfc3694f3fdfd84416defe7 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Fri, 22 Nov 2024 15:45:33 +0800 Subject: [PATCH 1/4] =?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=B4=E6=97=B6=E8=8F=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Instead.js | 21 ++++ .../Instead/components/popup-linshiCai.vue | 118 +++++++++++++----- src/views/tool/Instead/index.vue | 13 +- 3 files changed, 118 insertions(+), 34 deletions(-) create mode 100644 src/api/Instead.js diff --git a/src/api/Instead.js b/src/api/Instead.js new file mode 100644 index 0000000..5a8081b --- /dev/null +++ b/src/api/Instead.js @@ -0,0 +1,21 @@ +// 代客下单 +import request from "@/utils/request"; +//就餐形式,默认堂食后付费 +const useType='dine-in-after' +function getUseType(){ + const type=localStorage.getItem("useType") + return type?type:useType +} + +// 购物车-临时菜添加 +export function $temporaryDishes(data) { + return request({ + url: '/api/place/temporaryDishes', + method: "post", + data:{ + shopId: localStorage.getItem("shopId"), + useType:getUseType(), + ...data + } + }); +} \ No newline at end of file diff --git a/src/views/tool/Instead/components/popup-linshiCai.vue b/src/views/tool/Instead/components/popup-linshiCai.vue index 03879fb..7a692cd 100644 --- a/src/views/tool/Instead/components/popup-linshiCai.vue +++ b/src/views/tool/Instead/components/popup-linshiCai.vue @@ -8,12 +8,20 @@
将临时菜添加至购物车,不会影响总商品库
- - - + + + - - + + - - - + + + - - + + - - + + - - +
@@ -57,22 +77,32 @@ @@ -131,7 +189,7 @@ input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } -::v-deep .el-input__inner::-webkit-inner-spin-button { +::v-deep .el-input__inner::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue index eae9e76..d1294e7 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -713,7 +713,7 @@
@@ -1468,6 +1468,7 @@ import { $calcUsablePoints, $calcDeDuctionPoints, } from "@/api/table"; + import { tbShopCategoryGet } from "@/api/shop"; import { isCanBuy, @@ -2172,7 +2173,11 @@ export default { }, methods: { lingshicaiShow() { - this.$refs.refPopAddCai.open(); + this.$refs.refPopAddCai.open({ + masterId:this.masterId, + tableId:this.table.tableId, + vipUserId:this.vipUser.id, + }); }, delQuan(row) { const index = this.quansSelArr.findIndex((v) => v.id == row.id); From 63349360fa669fe29dbd17dd372f99091be54c26 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Mon, 25 Nov 2024 16:31:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=93=81?= =?UTF-8?q?=E6=94=B9=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Instead.js | 11 + .../components/popup-cart-changePrice.vue | 205 ++++++++++++++++++ src/views/tool/Instead/index.vue | 86 ++++---- src/views/tool/Instead/util.js | 10 + 4 files changed, 270 insertions(+), 42 deletions(-) create mode 100644 src/views/tool/Instead/components/popup-cart-changePrice.vue diff --git a/src/api/Instead.js b/src/api/Instead.js index 5a8081b..af26134 100644 --- a/src/api/Instead.js +++ b/src/api/Instead.js @@ -18,4 +18,15 @@ export function $temporaryDishes(data) { ...data } }); +} +// 购物车-单品改价 +export function $updatePrice(data) { + return request({ + url: '/api/place/updatePrice', + method: "put", + data:{ + shopId: localStorage.getItem("shopId"), + ...data + } + }); } \ No newline at end of file diff --git a/src/views/tool/Instead/components/popup-cart-changePrice.vue b/src/views/tool/Instead/components/popup-cart-changePrice.vue new file mode 100644 index 0000000..9a619ba --- /dev/null +++ b/src/views/tool/Instead/components/popup-cart-changePrice.vue @@ -0,0 +1,205 @@ + + + + \ No newline at end of file diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue index 3a61a84..ac3de58 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -639,21 +639,12 @@ > 退菜 - +
单品改价
+
等叫
+
取消全部等叫
+ + @@ -1431,6 +1428,7 @@ import chooseDinersNumber from "./components/choose-diners-number.vue"; import returnCart from "./components/return-cart.vue"; import moneyKeyboard from "./components/money-keyboard.vue"; import caiAdd from "./components/popup-linshiCai.vue"; +import cartChangePrice from "./components/popup-cart-changePrice.vue"; import dayjs from "dayjs"; import { tbShopInfo } from "@/api/user"; import { hasPermission } from "@/utils/limits.js"; @@ -1485,6 +1483,7 @@ import { $status } from "@/utils/table.js"; let $originTableList = []; export default { components: { + cartChangePrice, caiAdd, quansPop, returnCart, @@ -2195,6 +2194,17 @@ export default { this.open(this.$route.query); }, methods: { + //更新单品改价数据 + updateCartItem(res){ + if(res){ + this.order.list[this.order.selIndex]=res + } + }, + // 单品改价 + refPopChangePriceShow() { + const orderGoods = this.order.list[this.order.selIndex]; + this.$refs.refPopChangePrice.open(orderGoods); + }, returnProDiscount(row) { console.log(row); //相同商品抵扣券数组 @@ -2218,9 +2228,9 @@ export default { }, lingshicaiShow() { this.$refs.refPopAddCai.open({ - masterId:this.masterId, - tableId:this.table.tableId, - vipUserId:this.vipUser.id, + masterId: this.masterId, + tableId: this.table.tableId, + vipUserId: this.vipUser.id, }); }, delQuan(row) { @@ -2228,13 +2238,13 @@ export default { console.log(index); if (index != -1) { this.quansSelArr.splice(index, 1); - this.quansSelArr - .map((v, index) => { - return { - ...v, - discountAmount:v.type==2?this.returnProDiscount(v):v.discountAmount, - }; - }); + this.quansSelArr.map((v, index) => { + return { + ...v, + discountAmount: + v.type == 2 ? this.returnProDiscount(v) : v.discountAmount, + }; + }); } }, async getCalcUsablePoints() { @@ -2254,8 +2264,8 @@ export default { this.vipUser.accountPoints, this.points.res.maxUsablePoints || 0 ); - if(!pointsRes.usable){ - this.points.selected=false + if (!pointsRes.usable) { + this.points.selected = false; } } return pointsRes; @@ -2301,11 +2311,12 @@ export default { this.createOrder.discount = 1; this.points.selected = ""; e.map((v, index) => { - return { - ...v, - discountAmount:v.type==2? this.returnProDiscount(v):v.discountAmount, - }; - }); + return { + ...v, + discountAmount: + v.type == 2 ? this.returnProDiscount(v) : v.discountAmount, + }; + }); this.quansSelArr = [...e]; $goodsPayPriceMap = goodsPayPriceMap; }, @@ -4119,9 +4130,7 @@ input[type="number"]::-webkit-outer-spin-button { background-color: #fff; height: 100%; } -::v-deep .el-button--text { - // color: #000; -} + ::v-deep .meal_box .el-button-group { width: 100%; display: flex; @@ -4640,13 +4649,6 @@ input[type="number"]::-webkit-outer-spin-button { background-color: #fff; border: 1px solid #dcdfe6; } -::v-deep .el-checkbox__input.is-checked .el-checkbox__inner { - // background-color: #22bf64; - // border-color: #22bf64; -} -::v-deep .el-checkbox__input.is-checked + .el-checkbox__label { - // color: #22bf64; -} ::v-deep .tag-group .el-tag--dark { background: rgba(34, 191, 100, 0.1); diff --git a/src/views/tool/Instead/util.js b/src/views/tool/Instead/util.js index 7d61c8a..3c49399 100644 --- a/src/views/tool/Instead/util.js +++ b/src/views/tool/Instead/util.js @@ -218,4 +218,14 @@ export function returnCouponAllPrice(coupArr, goodsArr, vipUser) { const poductAllprice=returnProductCouponAllPrice(coupArr, goodsArr, vipUser) const pointAllPrice=returnFullReductionCouponAllPrice(coupArr) return (poductAllprice*1+pointAllPrice*1).toFixed(2); +} + +//返回购物车商品价格 +export function returnCartPrice(goods, vipUser) { + const price=goods.price||goods.salePrice + if(!vipUser||!vipUser.id ||!vipUser.isVip){ + return price + } + const memberPrice = goods.memberPrice ? goods.memberPrice :price; + return memberPrice } \ No newline at end of file From b0868703a590286452765841fff4626448ca9df7 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Wed, 27 Nov 2024 15:07:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=88=E5=B9=B6?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8C=82=E8=B4=A6=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Instead.js | 24 ++ src/assets/images/scan.png | Bin 0 -> 1988 bytes .../Instead/components/choose-guazhang.vue | 181 +++++++++ .../tool/Instead/components/keyboard.vue | 17 +- .../components/popup-choose-guazhang.vue | 355 ++++++++++++++++++ .../Instead/components/popup-tuan-quan.vue | 165 ++++++++ .../Instead/components/tuan-quan-table.vue | 61 +++ src/views/tool/Instead/index.vue | 91 ++++- 8 files changed, 883 insertions(+), 11 deletions(-) create mode 100644 src/assets/images/scan.png create mode 100644 src/views/tool/Instead/components/choose-guazhang.vue create mode 100644 src/views/tool/Instead/components/popup-choose-guazhang.vue create mode 100644 src/views/tool/Instead/components/popup-tuan-quan.vue create mode 100644 src/views/tool/Instead/components/tuan-quan-table.vue diff --git a/src/api/Instead.js b/src/api/Instead.js index af26134..8be0623 100644 --- a/src/api/Instead.js +++ b/src/api/Instead.js @@ -29,4 +29,28 @@ export function $updatePrice(data) { ...data } }); +} + +// 团购券-获取可使用团购券列表 + +export function $thirdPartyCoupon(data) { + return request({ + url: '/api/thirdPartyCoupon/list', + method: "get", + params:{ + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +//核销团购券商品 +export function $checkCoupon(data) { + return request({ + url: '/api/place/checkCoupon', + method: "post", + data:{ + shopId: localStorage.getItem("shopId"), + ...data + } + }); } \ No newline at end of file diff --git a/src/assets/images/scan.png b/src/assets/images/scan.png new file mode 100644 index 0000000000000000000000000000000000000000..8cb3dca289e1ba1a50be0eb19574fa3991b3bea9 GIT binary patch literal 1988 zcmcIlXIK+x68;jB7Z7B&Q=xY8k@2%!o{k*>55HY|#$80po>iqh6qUxqu*KH+%Q@e%(FyV`iS2d1n5+^S+bg<>@RbrXmIakaTr% z^btn#--bj8{Y#thAz^^T`Z(Kzdd7E)0PM?fb+q$K!hgAk%T{py?)Bv+8GCz-mL3E5 z8$I+6IU!RQ^239PP-s*lCtS_0*;~~E&0Npue2nToXkSX!wWo%l^|~s3)9H>km4!=QI(e@K z#*W`VqliHaEMUVK?agX(Q|ei$DKolsPewPqj>?4+m#HzB8-Gm7km#hkF(bzIB)B*e zb&+M~Gnf}28n!`Nf&?#7Uwl=@|AF^w9SaF9%Xoth# zApZO1jT!sCpN-{QP{3cHf~oKP%!1K&%X{C;8m*RCJyrZ!Zw`td_d$~Se)3?!04Gf) z^?94Br6wNM+J8lE_D=#6`1!XCE2W-M)urqaK@uu;ZR@N+28U2_)2Rx1w3ITI1ju_9 znU=OdW)Ew|4PzyMA`jx_jtk;<*BJuqm8MJwjLV9nqMn_izj`-q;)- zgp+kjUw7_9k!H0;8_j(QtzQFvWllU;ZC%pCte9_nlA^tMO)=Y>?T?A6?UbD2@=Sza zZl;T4GXYZjr}7&}^3iYm4@E=KB}K_cFkpQ-_(`28nc(wjF&p$Z#XN7+2AQsRsx_hL zkskO^>Hj>mBo9tCA2!*+cM}F9*)B~MZ&I4-h7zHQ=YPG?bJDP|2kz$kcd@g}98e2d zqxv^hA3gU|zVqPbjuph{I%``-k9)tHH=(L5!o|Ih-AhcnF-$@b&Sgrs;Gu+?d**d{ zz)1dVO(cxwWfgr&5kk-%_o5@o6$#8I22h$;O+~2;aQIRe9ttB@csZDBf@?E@FFTOH zq2k)vNJ$!(%Z+wWAR^-*H#F2PNGgRL19z=cH&+=9#`d(KnkR&&`f7gQi8Ner+b5&x z^ho(g%)4h5)}DBA+HMGo2UvU?YDEb{Y*+KDCDjUdN}Lv9(te;SKSjGYcED`)09=XK zRz0@(Ixpf4)W}LDpu6#d{#&dYTyR%St#kD^Yi+PA1$YsGHV5|hVS1LVMAG0uyjte% z;XwEW4Ym$mcz=8d(On<9;NI$f{G0_`P~fBfcxlJk5R9`1BG!9Q?4!hGEzmW|9_4Q6 z@P~u1v~rAlUG;kPbJ=-|aXWlEStbpLV{6Q@3sjX>?vXhkf@?G2o`J z67;?AZIWS%t92HU{dwYPce5aHR9-4q3n0k}@XvL$3yTzGN^pANmM73!sJtMj1v(}y zl6f%Ob$u?@4*LITl|#V^K;f_2Y4r67B}=Cv;+p6s#@0yB{%0*{es%V<$%kge4OuuC z`6Jwpi6YJYi+dC*bu8bQzw)UyT2AKVaF=ycBSKh9&42nwUgqc)^n4KELT#C#s%UGe z!zO&?4FoWfML~;!kl_-<mip{|obXCQj&O;gr5OjFyy z+t+g|zfNnr5Q5{Sm(vZ|;;9=m*a4V9FwgUNyU!&5;r#k#@n|qUI{jk=RnRCpo^?K~ zO=ZsSozr844GBBzDY1+nYizQRownx{ zECMTz9H>!_)7gA3FBH??ixihSdOm5^S%8CI(>y5qv%D3r3FWjB1r1%wX=~`7s|Dj|B0Qb$u7l};E(OPv=oNXUIEJ9(8NJ%+8)>?Ea&p5#sNotEKb(ZS* zazslPR1{!vYw~Eoj=C421w{|E_POPP?CSV}TS&6jtgN9P6kX1AJ%#}V=iIt}N0O6* mbd+;|OQZf;0p>pp3E;nMOVs1K^XG+c8Mr!mI@a40GXDZFSde}I literal 0 HcmV?d00001 diff --git a/src/views/tool/Instead/components/choose-guazhang.vue b/src/views/tool/Instead/components/choose-guazhang.vue new file mode 100644 index 0000000..21e6110 --- /dev/null +++ b/src/views/tool/Instead/components/choose-guazhang.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/src/views/tool/Instead/components/keyboard.vue b/src/views/tool/Instead/components/keyboard.vue index 8436f1f..c316f80 100644 --- a/src/views/tool/Instead/components/keyboard.vue +++ b/src/views/tool/Instead/components/keyboard.vue @@ -6,6 +6,7 @@ {{ number }} +
@@ -79,13 +80,18 @@ export default { default: false, }, max: { - type: Number, + type: [Number,String], default: Infinity, }, value: { type: [String, Number], default: 0, }, + // 是否启用小数 + isFloat: { + type: Boolean, + default: false, + } }, data() { return { @@ -102,14 +108,21 @@ export default { }, methods: { clearFunction() { + if(this.isFloat){ + return this.keyboradAdd('.') + } this.$emit("clear", this.number); }, keyboradAdd(n) { + if(n=='.'&& `${this.number}`.includes('.')){ + return + } if (Number(this.number) == 0) { return (this.number = n); } const newval = this.number + n; - if (newval > this.max) { + console.log(newval) + if (newval*1 > this.max*1) { return this.$message( this.maxTips); } this.number = newval; diff --git a/src/views/tool/Instead/components/popup-choose-guazhang.vue b/src/views/tool/Instead/components/popup-choose-guazhang.vue new file mode 100644 index 0000000..99e6720 --- /dev/null +++ b/src/views/tool/Instead/components/popup-choose-guazhang.vue @@ -0,0 +1,355 @@ + + + + + \ No newline at end of file diff --git a/src/views/tool/Instead/components/popup-tuan-quan.vue b/src/views/tool/Instead/components/popup-tuan-quan.vue new file mode 100644 index 0000000..ae67f2a --- /dev/null +++ b/src/views/tool/Instead/components/popup-tuan-quan.vue @@ -0,0 +1,165 @@ + + + + \ No newline at end of file diff --git a/src/views/tool/Instead/components/tuan-quan-table.vue b/src/views/tool/Instead/components/tuan-quan-table.vue new file mode 100644 index 0000000..29e5757 --- /dev/null +++ b/src/views/tool/Instead/components/tuan-quan-table.vue @@ -0,0 +1,61 @@ + + diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue index ac3de58..cbd4f73 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -500,7 +500,7 @@ @@ -639,10 +639,13 @@ > 退菜
-
单品改价
+
+ 单品改价 +
等叫
取消全部等叫
@@ -924,8 +927,35 @@
-
+ 团购代金券 +
+ 代金券名称 + +
+ + +
+ +
优惠券
+ @@ -1010,6 +1041,7 @@ :disabledPayType="disabledPayType" > + 挂账
立即支付 @@ -1411,6 +1443,14 @@ :vipUser="vipUser" @updateCart="updateCartItem" > + + + +
@@ -1429,6 +1469,10 @@ import returnCart from "./components/return-cart.vue"; import moneyKeyboard from "./components/money-keyboard.vue"; import caiAdd from "./components/popup-linshiCai.vue"; import cartChangePrice from "./components/popup-cart-changePrice.vue"; +import popTuanQuan from "./components/popup-tuan-quan.vue"; +import tuanQuanTable from "./components/tuan-quan-table.vue"; +import popupChooseGuazhang from "./components/popup-choose-guazhang.vue"; + import dayjs from "dayjs"; import { tbShopInfo } from "@/api/user"; import { hasPermission } from "@/utils/limits.js"; @@ -1463,6 +1507,7 @@ import { } from "@/api/table"; import { tbShopCategoryGet } from "@/api/shop"; +import { $checkCoupon } from "@/api/Instead"; import { isCanBuy, arrayContainsAll, @@ -1479,11 +1524,15 @@ import { returnProductCoupAllPrice } from "./quan_util.js"; //商品数量从0到n每一个对应的价格 let $goodsPayPriceMap = {}; import { $status } from "@/utils/table.js"; +import PopupChooseGuazhang from './components/popup-choose-guazhang.vue'; let $originTableList = []; export default { components: { + popupChooseGuazhang, cartChangePrice, + popTuanQuan, + tuanQuanTable, caiAdd, quansPop, returnCart, @@ -1496,6 +1545,7 @@ export default { moneyDiscount, cartItem, chooseDinersNumber, + PopupChooseGuazhang, }, data() { return { @@ -1512,6 +1562,8 @@ export default { value: 0, toMoney: 0, }, + //团购券 + tuanQuan: "", //选中可用优惠券 quansSelArr: [], //台桌搜索文字 @@ -2194,10 +2246,22 @@ export default { this.open(this.$route.query); }, methods: { + //挂账 + guazhangShow(){ + this.$refs.refGuaZhang.open(); + }, + //团购券扫码弹窗 + shouwTuanQuan() { + this.$refs.refPopTuanQuan.open(); + }, + tuanQuanConfirm(e) { + console.log(e); + this.tuanQuan = e; + }, //更新单品改价数据 - updateCartItem(res){ - if(res){ - this.order.list[this.order.selIndex]=res + updateCartItem(res) { + if (res) { + this.order.list[this.order.selIndex] = res; } }, // 单品改价 @@ -2923,6 +2987,15 @@ export default { return prve; }, []); try { + // 核销团购券商品 + if (this.tuanQuan && this.tuanQuan.goods.length > 0) { + await $checkCoupon({ + code: this.tuanQuan.couponCode, + num: this.tuanQuan.number, + orderId: this.createOrder.data.id, + cartId: this.tuanQuan.goods.map((v) => v.cartId), + }); + } const res = await $payOrder({ tableId: this.table.tableId, masterId: this.masterId, From 45eaccb9ac796146d7e31fd4b44c216ea8f16212 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Thu, 28 Nov 2024 17:50:27 +0800 Subject: [PATCH 4/4] =?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=8D=95=E5=93=81=E6=94=B9=E4=BB=B7=EF=BC=8C?= =?UTF-8?q?=E6=8C=82=E8=B4=A6=EF=BC=8C=E7=AD=89=E5=8F=AB=EF=BC=8C=E5=85=8D?= =?UTF-8?q?=E5=8E=A8=E6=89=93=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Instead.js | 12 ++ .../tool/Instead/components/cart-item.vue | 77 ++++++--- .../components/popup-cart-changePrice.vue | 4 +- .../components/popup-choose-guazhang.vue | 6 +- src/views/tool/Instead/index.vue | 151 ++++++++++++++++-- 5 files changed, 210 insertions(+), 40 deletions(-) diff --git a/src/api/Instead.js b/src/api/Instead.js index 8be0623..296c793 100644 --- a/src/api/Instead.js +++ b/src/api/Instead.js @@ -53,4 +53,16 @@ export function $checkCoupon(data) { ...data } }); +} +//整体等叫/取消等叫 +export function $waitCall(data) { + return request({ + url: '/api/place/waitCall', + method: "put", + data:{ + useType:getUseType(), + shopId: localStorage.getItem("shopId"), + ...data + } + }); } \ No newline at end of file diff --git a/src/views/tool/Instead/components/cart-item.vue b/src/views/tool/Instead/components/cart-item.vue index 94cd126..d275783 100644 --- a/src/views/tool/Instead/components/cart-item.vue +++ b/src/views/tool/Instead/components/cart-item.vue @@ -4,8 +4,12 @@ :class="[isActive]" @click="itemClick" > - - 退 +
+ + + + 退 +
-
备注:{{ item.note || "" }}
+
备注:{{ item.note }}
备注: @@ -74,11 +78,23 @@ ¥{{ isShowVipPrice ? vipAllPrice : allPrice }}
+ @@ -1507,7 +1539,7 @@ import { } from "@/api/table"; import { tbShopCategoryGet } from "@/api/shop"; -import { $checkCoupon } from "@/api/Instead"; +import { $checkCoupon,$waitCall } from "@/api/Instead"; import { isCanBuy, arrayContainsAll, @@ -1524,7 +1556,7 @@ import { returnProductCoupAllPrice } from "./quan_util.js"; //商品数量从0到n每一个对应的价格 let $goodsPayPriceMap = {}; import { $status } from "@/utils/table.js"; -import PopupChooseGuazhang from './components/popup-choose-guazhang.vue'; +import PopupChooseGuazhang from "./components/popup-choose-guazhang.vue"; let $originTableList = []; export default { @@ -1549,6 +1581,8 @@ export default { }, data() { return { + //挂账人 + guazhangRen: "", disabledPayType: [], //积分抵扣 points: { @@ -1762,9 +1796,33 @@ export default { }, }, timer: null, + isAllWaitCall: false, }; }, computed: { + returnPrintText(){ + if (this.order.selIndex < 0) { + return "免厨打"; + } + return this.order.list[this.order.selIndex].isPrint + ? "免厨打" + : "打印"; + }, + returnWaingText() { + if (this.order.selIndex < 0) { + return "等叫"; + } + return this.order.list[this.order.selIndex].isWaitCall == 1 + ? "取消等叫" + : "等叫"; + }, + isHasWaiting() { + const waitingArr = this.order.list.filter((v) => v.isWaitCall == 1); + return waitingArr.length > 0 ? true : false; + }, + returnWaingAllText() { + return this.isAllWaitCall ? "取消全部等叫" : "整单等叫"; + }, pointsDiscountAmount() { if (this.points.selected) { return this.points.toMoney; @@ -1970,8 +2028,28 @@ export default { }, 0); return (oldMemberPrice + nowMemberprice).toFixed(2); }, + discountSaleAmount() { + const oldTotal = this.order.old.list.reduce((a, b) => { + const bTotal = b.info + .filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0) + .reduce((prve, cur) => { + return prve + cur.number * cur.discountSaleAmount; + }, 0); + return a + bTotal; + }, 0); + const nowTotal = this.order.list + .filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0) + .reduce((a, b) => { + return a + b.number * b.discountSaleAmount; + }, 0); + return (oldTotal + nowTotal).toFixed(2); + }, youhuiAllPrice() { - return (this.vipDiscountPrice * 1 + this.allGiftMoney * 1).toFixed(2); + return ( + this.vipDiscountPrice * 1 + + this.allGiftMoney * 1 + + this.discountSaleAmount * 1 + ).toFixed(2); }, allNumber() { const oldNumber = this.order.old.list.reduce((a, b) => { @@ -2246,8 +2324,16 @@ export default { this.open(this.$route.query); }, methods: { + //挂账人支付确认 + guazhangPayConfirm(guazhangren, price) { + this.guazhangRen = guazhangren; + this.pays({ + creditBuyerId: this.guazhangRen.id, + payType: "creditBuyer", + }); + }, //挂账 - guazhangShow(){ + guazhangShow() { this.$refs.refGuaZhang.open(); }, //团购券扫码弹窗 @@ -2261,7 +2347,8 @@ export default { //更新单品改价数据 updateCartItem(res) { if (res) { - this.order.list[this.order.selIndex] = res; + // this.order.list[this.order.selIndex] = res; + this.$set(this.order.list, this.order.selIndex, res) } }, // 单品改价 @@ -2972,7 +3059,7 @@ export default { this.pays(); }, // 支付订单 - async pays() { + async pays(par) { this.loading = true; const userCouponInfos = this.quansSelArr.reduce((prve, cur) => { const index = prve.findIndex((v) => v.userCouponId == cur.couponId); @@ -3004,8 +3091,9 @@ export default { vipUserId: this.createOrder.data.memberId || this.vipUser.id, discount: this.createOrder.discount, code: this.createOrder.code, - userCouponInfos, + userCouponInfos: userCouponInfos.length > 0 ? userCouponInfos : "", pointsNum: this.points.value, + ...par, }); this.loading = false; this.payOrderSuccess(); @@ -3133,7 +3221,16 @@ export default { updateOrder(par = {}) { let item = this.order.list[this.order.selIndex]; console.log(this.table); - const { productId, skuId, isPack, isGift, number, id } = item; + const { + productId, + skuId, + isPack, + isGift, + number, + id, + isPrint, + isWaitCall, + } = item; $updateCart({ cartId: id, masterId: this.masterId, @@ -3144,6 +3241,8 @@ export default { num: number, isPack: isPack === "true" ? true : false, isGift: isGift === "true" ? true : false, + isPrint, + isWaitCall, ...par, }).then((res) => { this.$set(this.order.list, this.order.selIndex, { @@ -3196,7 +3295,7 @@ export default { // }, //右侧控制按钮点击事件 - orderBtnsClick(key) { + async orderBtnsClick(key) { const orderGoods = this.order.list[this.order.selIndex]; if (this.key != "isJieZhang" && this.payAfter) { this.createOrderClose(); @@ -3221,6 +3320,27 @@ export default { if (key === "del") { return this.removeCart(); } + if (key === "print") { + const isPrint = orderGoods.isPrint; + this.updateOrder({ isPrint: !isPrint }); + return; + } + if (key === "isWaitCall") { + const isWaitCall = orderGoods.isWaitCall; + this.updateOrder({ isWaitCall: !isWaitCall }); + return; + } + if (key == "AllWaitCall") { + await $waitCall({ + orderId:this.createOrder.data.id, + masterId:this.masterId, + tableId:this.table.tableId, + isWaitCall: !this.isAllWaitCall?1:0 + }) + this.isAllWaitCall=!this.isAllWaitCall; + this.getCart() + return; + } if (key === "save") { this.prveOrder.list.push({ cart: this.order.list, @@ -3621,6 +3741,7 @@ export default { tableId: this.table.tableId, num: this.skuGoods.number, // 0会删除此商品 isPack: false, // 是否打包 + isWaitCall:this.isAllWaitCall //是否等叫 }); this.orderListPush({ ...res, specSnap: name }); // this.orderListPush({ @@ -3726,6 +3847,7 @@ export default { }, reset() { // this.goods.list = []; + this.guazhangRen = ""; this.order.status = ""; this.loading = false; this.table = ""; @@ -3922,6 +4044,7 @@ export default { tableId: this.table.tableId, num: item.specList[0].suit, // 0会删除此商品 isPack: false, // 是否打包 + isWaitCall:this.isAllWaitCall //是否等叫 }); this.orderListPush(res); }