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 0000000..8cb3dca Binary files /dev/null and b/src/assets/images/scan.png differ 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,