diff --git a/.env.production b/.env.production index 7f079f7..2a4f841 100644 --- a/.env.production +++ b/.env.production @@ -3,10 +3,10 @@ ENV = 'production' # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http # 测试 -# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn' +VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn' # 生产 -VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn' +# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn' # 预发布接口 # VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn' diff --git a/src/api/Instead.js b/src/api/Instead.js new file mode 100644 index 0000000..296c793 --- /dev/null +++ b/src/api/Instead.js @@ -0,0 +1,68 @@ +// 代客下单 +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 + } + }); +} +// 购物车-单品改价 +export function $updatePrice(data) { + return request({ + url: '/api/place/updatePrice', + method: "put", + data:{ + shopId: localStorage.getItem("shopId"), + ...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 + } + }); +} +//整体等叫/取消等叫 +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/api/coup/index.js b/src/api/coup/index.js new file mode 100644 index 0000000..9ba574a --- /dev/null +++ b/src/api/coup/index.js @@ -0,0 +1,199 @@ +// 代客下单 +import request from "@/utils/request-php"; + +// 抖音团购核销准备 +export function $douyin_fulfilmentcertificateprepare(data) { + return request({ + url: 'douyin/fulfilmentcertificateprepare', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +// 抖音团购核销 +export function $douyin_certificateprepare(data) { + return request({ + url: 'douyin/certificateprepare', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + +// 抖音团购核销撤销 +export function $douyin_fulfilmentcertificatecancel(data) { + return request({ + url: 'douyin/fulfilmentcertificatecancel', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +// 抖音团购核销记录 +export function $douyin_orderlist(data) { + return request({ + url: 'douyin/orderlist', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + + +// 抖音门店列表 +export function $douyin_storelist(data) { + return request({ + url: 'douyin/storelist', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + +// 抖音绑定门店 +export function $douyin_bindstore(data) { + return request({ + url: 'douyin/bindstore', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +// 抖音订单查询 + +export function $douyin_orderquery(data) { + return request({ + url: 'douyin/orderquery', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +//会员签入 +export function $douyin_checkIn(data) { + return request({ + url: 'douyin/checkIn', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + +//美团 + +// 美团获取uisdk 绑定 链接 + +export function $meituan_getuisdkurl(data) { + return request({ + url: 'meituan/getuisdkurl', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +// 美团获取uisdk 解绑 链接 + +export function $meituan_getuisdkuniurl(data) { + return request({ + url: 'meituan/getuisdkuniurl', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +// 美团团购核销准备 + +export function $meituan_fulfilmentcertificateprepare(data) { + return request({ + url: 'meituan/fulfilmentcertificateprepare', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +// 美团执行核销 + +export function $meituan_certificateprepare(data) { + return request({ + url: 'meituan/certificateprepare', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} +// 美团团购核销记录 + + +export function $meituan_orderlist(data) { + return request({ + url: 'meituan/orderlist', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + +// 美团团购撤销 + + +export function $meituan_fulfilmentcertificatecancel(data) { + return request({ + url: 'meituan/fulfilmentcertificatecancel', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + +// 美团查询绑定状态 +export function $meituan_searchstorestatus(data) { + return request({ + url: 'meituan/searchstorestatus', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + +// 登出 +export function $logout(data) { + return request({ + url: 'user/logout', + method: "post", + data: { + shopId: localStorage.getItem("shopId"), + ...data + } + }); +} + diff --git a/src/api/credit.js b/src/api/credit.js index 0010803..a9d4337 100644 --- a/src/api/credit.js +++ b/src/api/credit.js @@ -1,7 +1,7 @@ import request from '@/utils/request' /** - * 获取挂账列表 + * 获取挂账人列表 * @returns */ export function getCreditBuyerList(params) { @@ -15,7 +15,7 @@ export function getCreditBuyerList(params) { } /** - * 获取挂账详情 + * 获取挂账人详情 * @returns */ export function getCreditBuyerInfo(id) { @@ -38,6 +38,18 @@ export function addCreditBuyer(data) { }) } +/** + * 编辑挂账人 + * @returns + */ +export function editCreditBuyer(data) { + return request({ + url: '/api/credit/buyer', + method: 'put', + data + }) +} + /** * 还款 * @returns 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/utils/request-php.js b/src/utils/request-php.js new file mode 100644 index 0000000..a19cfbb --- /dev/null +++ b/src/utils/request-php.js @@ -0,0 +1,101 @@ +import axios from 'axios' +import router from '@/router/routers' +import { Notification } from 'element-ui' +import store from '../store' +import { getToken } from '@/utils/auth' +import Config from '@/settings' +import Cookies from 'js-cookie' +import { setToken } from '@/utils/globalCancelToken.js' +// 创建axios实例 +const service = axios.create({ + // baseURL: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_API : '/', + baseURL: 'https://czgdoumei.sxczgkj.com/index.php/api/', // api 的 base_url + timeout: Config.timeout // 请求超时时间 +}) + +// request拦截器 +service.interceptors.request.use( + config => { + if (getToken()) { + config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + } + config.headers['Content-Type'] = 'application/json' + // 添加可取消请求配置 + config.cancelToken = new axios.CancelToken(c => setToken(c)) + return config + }, + error => { + Promise.reject(error) + } +) + +// response 拦截器 +service.interceptors.response.use( + response => { + return response.data + }, + error => { + console.log(error); + if (axios.isCancel(error)) { + console.log('请求已取消') + Notification.error({ + title: '请求已取消', + duration: 5000 + }) + return Promise.reject('请求已取消') + } + + // 兼容blob下载出错json提示 + if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) { + const reader = new FileReader() + reader.readAsText(error.response.data, 'utf-8') + reader.onload = function (e) { + const errorMsg = JSON.parse(reader.result).message + Notification.error({ + title: errorMsg, + duration: 5000 + }) + } + } else { + let code = 0 + try { + code = error.response.data.status + } catch (e) { + if (error.toString().indexOf('Error: timeout') !== -1) { + Notification.error({ + title: '网络请求超时', + duration: 5000 + }) + return Promise.reject(error) + } + } + console.log(code) + if (code) { + if (code === 401) { + store.dispatch('LogOut').then(() => { + // 用户登录界面提示 + Cookies.set('point', 401) + location.reload() + }) + } else if (code === 403) { + router.push({ path: '/401' }) + } else { + const errorMsg = error.response.data.message + if (errorMsg !== undefined) { + Notification.error({ + title: errorMsg, + duration: 5000 + }) + } + } + } else { + Notification.error({ + title: '接口请求失败', + duration: 5000 + }) + } + } + return Promise.reject(error) + } +) +export default service diff --git a/src/views/home/components/credit_RePaymentRecord.vue b/src/views/home/components/credit_RePaymentRecord.vue index a5c667d..edfd6de 100644 --- a/src/views/home/components/credit_RePaymentRecord.vue +++ b/src/views/home/components/credit_RePaymentRecord.vue @@ -127,7 +127,7 @@ export default { * 重置 */ reset() { - this.query = { ...this.resetQuery } + this.query.paymentMethod = '' this.getTableData() } } diff --git a/src/views/home/components/credit_add.vue b/src/views/home/components/credit_add.vue index e12c4c0..689d9ae 100644 --- a/src/views/home/components/credit_add.vue +++ b/src/views/home/components/credit_add.vue @@ -21,7 +21,7 @@ - + @@ -50,7 +50,7 @@ + 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-cart-changePrice.vue b/src/views/tool/Instead/components/popup-cart-changePrice.vue new file mode 100644 index 0000000..c0ad96c --- /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/components/popup-choose-guazhang.vue b/src/views/tool/Instead/components/popup-choose-guazhang.vue new file mode 100644 index 0000000..6f9c351 --- /dev/null +++ b/src/views/tool/Instead/components/popup-choose-guazhang.vue @@ -0,0 +1,357 @@ + + + + + \ 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/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 75ca1cb..a0c6186 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -399,11 +399,18 @@
会员优惠 {{ vipDiscountPrice }}
+
+ 单品改价优惠 + {{ discountSaleAmount }} +
已优惠¥{{ youhuiAllPrice }} @@ -500,7 +507,7 @@ @@ -639,21 +646,36 @@ > 退菜
- + {{ returnWaingAllText }} +
+
+ 团购代金券 +
+ 代金券名称 + +
+ + +
+ +
优惠券
+ @@ -1019,6 +1069,9 @@ :disabledPayType="disabledPayType" > + 挂账
立即支付 @@ -1413,7 +1466,25 @@ > - + + + + + + +
@@ -1431,6 +1502,11 @@ 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 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,7 +1539,9 @@ import { $calcUsablePoints, $calcDeDuctionPoints, } from "@/api/table"; + import { tbShopCategoryGet } from "@/api/shop"; +import { $checkCoupon,$waitCall } from "@/api/Instead"; import { isCanBuy, arrayContainsAll, @@ -1480,10 +1558,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,9 +1579,12 @@ export default { moneyDiscount, cartItem, chooseDinersNumber, + PopupChooseGuazhang, }, data() { return { + //挂账人 + guazhangRen: "", disabledPayType: [], //积分抵扣 points: { @@ -1512,6 +1598,8 @@ export default { value: 0, toMoney: 0, }, + //团购券 + tuanQuan: "", //选中可用优惠券 quansSelArr: [], //台桌搜索文字 @@ -1710,9 +1798,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; @@ -1765,6 +1877,8 @@ export default { !this.order.selGoods || this.order.old.list.length <= 0 || this.order.selGoods.status == "return" + ||this.order.selGoods.useType=='dine-in' + ||this.order.selGoods.useType=='dine-in-before' ); }, title() { @@ -1918,8 +2032,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) => { @@ -1975,7 +2109,7 @@ export default { watch: { yinFuJinE: function (newval) { if (newval <= 0) { - this.disabledPayType = ["scanCode", "deposit"]; + this.disabledPayType = ["scanCode", "deposit","creditBuyer"]; } else { this.disabledPayType = []; } @@ -2194,6 +2328,38 @@ export default { this.open(this.$route.query); }, methods: { + //挂账人支付确认 + guazhangPayConfirm(guazhangren, price) { + this.guazhangRen = guazhangren; + this.pays({ + creditBuyerId: this.guazhangRen.id, + payType: "creditBuyer", + }); + }, + //挂账 + 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; + this.$set(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); //相同商品抵扣券数组 @@ -2216,20 +2382,24 @@ export default { } }, 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); 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() { @@ -2249,8 +2419,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; @@ -2296,11 +2466,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; }, @@ -2892,7 +3063,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); @@ -2907,6 +3078,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, @@ -2915,8 +3095,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(); @@ -3044,7 +3225,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, @@ -3055,6 +3245,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, { @@ -3107,7 +3299,7 @@ export default { // }, //右侧控制按钮点击事件 - orderBtnsClick(key) { + async orderBtnsClick(key) { const orderGoods = this.order.list[this.order.selIndex]; if (this.key != "isJieZhang" && this.payAfter) { this.createOrderClose(); @@ -3132,6 +3324,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, @@ -3532,6 +3745,7 @@ export default { tableId: this.table.tableId, num: this.skuGoods.number, // 0会删除此商品 isPack: false, // 是否打包 + isWaitCall:this.isAllWaitCall //是否等叫 }); this.orderListPush({ ...res, specSnap: name }); // this.orderListPush({ @@ -3637,6 +3851,7 @@ export default { }, reset() { // this.goods.list = []; + this.guazhangRen = ""; this.order.status = ""; this.loading = false; this.table = ""; @@ -3671,7 +3886,8 @@ export default { //设置购物车数据 setCart(res) { console.log(res); - const { seatFee } = res; + try { + const { seatFee } = res; this.order.seatFee = seatFee ? { ...seatFee, @@ -3690,6 +3906,32 @@ export default { this.order.old.list = oldCart ? oldCart : []; // this.order.gift.list = returnGiftArr(res.records); console.log(this.order.old.list); + } catch (error) { + //当购物车数据发生错误时会导致页面报错购物车商品不展示 + this.$confirm('购物车数据结构错误,是否清空购物车商品?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + $clearCart({ + masterId: this.masterId, + tableId: this.table.tableId, + }).then((res) => { + this.order.list = []; + this.changeOrderSel(-1); + this.$message({ + type: "success", + message: "清除成功!", + }); + }); + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); + }); + } + }, //获取购物车数据 async getCart() { @@ -3833,6 +4075,7 @@ export default { tableId: this.table.tableId, num: item.specList[0].suit, // 0会删除此商品 isPack: false, // 是否打包 + isWaitCall:this.isAllWaitCall //是否等叫 }); this.orderListPush(res); } @@ -4114,9 +4357,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; @@ -4635,13 +4876,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