代客下单增加扫码支付退款弹窗

This commit is contained in:
2024-08-29 13:53:27 +08:00
parent 5b95ce2d56
commit 5292956f59
3 changed files with 222 additions and 80 deletions

View File

@@ -311,8 +311,8 @@
<el-input
:min="0"
type="number"
@input="cartGoodsNumberInput($event,item)"
@change="cartGoodsNumberChange($event,item)"
@input="cartGoodsNumberInput($event, item)"
@change="cartGoodsNumberChange($event, item)"
v-model="item.number"
placeholder="0"
></el-input>
@@ -504,10 +504,7 @@
<div class="flex img-box" v-if="layout.sel !== 'text'">
<img class="goods-img" :src="item.coverImg" alt="" />
<template v-if="layout.sel === 'img-and-text'">
<div
class="sell-out-svg"
v-if="isSellOut(item)"
>
<div class="sell-out-svg" v-if="isSellOut(item)">
<svg
t="1724234807994"
class="icon"
@@ -981,6 +978,9 @@
<!-- 支付时的键盘弹窗 -->
<money-keyboard ref="refMoneyKeyboard" :title="moneyKeyboard.title">
</money-keyboard>
<!-- 扫码支付 -->
<scan-pay ref="refScanCode"></scan-pay>
</div>
</template>
@@ -988,6 +988,7 @@
import chooseUser from "./choose-user.vue";
import payType from "./pay-type.vue";
import chooseTable from "./table-diancan-components/choose-table-master.vue";
import scanPay from "./table-diancan-components/scan-pay.vue";
import orderNote from "./table-diancan-components/note.vue";
import moneyKeyboard from "./money-keyboard.vue";
import dayjs from "dayjs";
@@ -1008,53 +1009,7 @@ import {
$payOrder,
} 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";
let reverseNewval = "";
if (isBol) {
reverseNewval = !val;
}
if (isString) {
reverseNewval = val === "true" ? "false" : "true";
}
return reverseNewval;
}
import { isCanBuy,arrayContainsAll,generateCombinations,returnReverseVal } from "./util.js";
export default {
components: {
@@ -1063,6 +1018,7 @@ export default {
payType,
orderNote,
moneyKeyboard,
scanPay,
},
data() {
return {
@@ -1250,7 +1206,7 @@ export default {
},
allNumber() {
return this.order.list.reduce((a, b) => {
return a + b.number*1;
return a + b.number * 1;
}, 0);
},
selGoodsHide() {
@@ -1405,8 +1361,8 @@ export default {
});
},
"goods.query.productId": function (newval) {
if(!this.$goodsData){
return
if (!this.$goodsData) {
return;
}
if (newval == "") {
this.goods.list = this.$goodsData || [];
@@ -1422,31 +1378,38 @@ export default {
mounted() {
// this.getGoods();
// this.getCategory();
// this.refToggle('refScanCode',true)
},
methods: {
//购物车商品输入框数量输入
cartGoodsNumberInput(newval,item){
if(newval<=0){
return this.order.cacheNumber=1
refToggle(key,isShow){
if(!this.$refs[key]){
return
}
newval=`${newval}`.split('.')[0]*1
this.order.cacheNumber=newval
this.$nextTick(()=>{
item.number=newval
})
isShow?this.$refs[key].open():this.$refs[key].close()
},
//购物车商品输入框数量输入
cartGoodsNumberInput(newval, item) {
if (newval <= 0) {
return (this.order.cacheNumber = 1);
}
newval = `${newval}`.split(".")[0] * 1;
this.order.cacheNumber = newval;
this.$nextTick(() => {
item.number = newval;
});
},
//购物车商品输入框数量改变
cartGoodsNumberChange(newval,item){
console.log(newval)
if(newval<=0){
item.number=1
return this.order.number=1
cartGoodsNumberChange(newval, item) {
console.log(newval);
if (newval <= 0) {
item.number = 1;
return (this.order.number = 1);
}
newval=`${newval}`.split('.')[0]*1
console.log(newval)
this.order.cacheNumber=newval
this.order.number=newval
newval = `${newval}`.split(".")[0] * 1;
console.log(newval);
this.order.cacheNumber = newval;
this.order.number = newval;
},
//判读单规格商品是否售尽
isSellOut(item) {
@@ -2386,9 +2349,9 @@ export default {
},
async getGoods() {
const res = await getGoodsLists(this.goods.query);
const goods= res.records.filter((v) => {
if(!v){
return false
const goods = res.records.filter((v) => {
if (!v) {
return false;
}
let isShow = true;
if (v.typeEnum !== "sku") {
@@ -2396,7 +2359,7 @@ export default {
}
return isShow;
});
this.goods.list =goods
this.goods.list = goods;
this.goods.total = res.total;
this.$goodsData = goods;
},
@@ -2943,7 +2906,6 @@ input[type="number"]::-webkit-outer-spin-button {
cursor: pointer;
}
::v-deep .tag-group .el-tag {
min-width: 80px;
height: 28px;