diff --git a/src/views/coupon_manage/components/coupon_details.vue b/src/views/coupon_manage/components/coupon_details.vue
index 6e11f0c..c08f4f4 100644
--- a/src/views/coupon_manage/components/coupon_details.vue
+++ b/src/views/coupon_manage/components/coupon_details.vue
@@ -91,7 +91,7 @@
Date: Wed, 20 Nov 2024 15:55:31 +0800
Subject: [PATCH 05/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E5=AE=A2?=
=?UTF-8?q?=E4=B8=8B=E5=8D=95=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=8C=E7=A7=AF?=
=?UTF-8?q?=E5=88=86=E6=8A=B5=E6=89=A3=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tool/Instead/components/pay-type.vue | 9 +++
src/views/tool/Instead/components/quans.vue | 79 ++++++++++++------
src/views/tool/Instead/index.vue | 80 +++++++++++++------
src/views/tool/Instead/quan_util.js | 41 ++++++++--
4 files changed, 153 insertions(+), 56 deletions(-)
diff --git a/src/views/tool/Instead/components/pay-type.vue b/src/views/tool/Instead/components/pay-type.vue
index f5f672d..884fd53 100644
--- a/src/views/tool/Instead/components/pay-type.vue
+++ b/src/views/tool/Instead/components/pay-type.vue
@@ -10,6 +10,7 @@
v-for="(item, index) in list"
:key="index"
:type="sel === item.payType ? 'primary' : ''"
+ :disabled="disabledPayType.includes(item.payType)"
>
{{ item.payName }}
@@ -30,6 +31,10 @@ export default {
type: [String, Number],
default: '',
},
+ disabledPayType:{
+ type:Array,
+ default:()=>[]
+ }
},
data() {
return {
@@ -38,6 +43,10 @@ export default {
};
},
watch: {
+ disabledPayType(){
+ const item = this.list.find(v=>!this.disabledPayType.includes(v.payType))
+ this.sel=item.payType
+ },
sel(newval) {
console.log(newval);
this.$emit("input", newval);
diff --git a/src/views/tool/Instead/components/quans.vue b/src/views/tool/Instead/components/quans.vue
index 2de1167..7540356 100644
--- a/src/views/tool/Instead/components/quans.vue
+++ b/src/views/tool/Instead/components/quans.vue
@@ -16,11 +16,7 @@
:data="quans.fullReductionCoupon"
@cell-click="fullReductionCouponClick"
>
-
+
-
+
-
+
@@ -232,11 +225,11 @@ export default {
isVip: false,
};
},
- }
+ },
},
data() {
return {
- orderPrice:0,
+ orderPrice: 0,
fullReductionCouponSel: {
id: "",
},
@@ -297,7 +290,7 @@ export default {
$goodsPayPriceMap[row.proId],
index,
row.num
- );
+ ).toFixed(2);
} else {
return 0;
}
@@ -310,7 +303,8 @@ export default {
const index = this.quansSelArr.findIndex((item) => item.id == row.id);
if (row.type == 2 && index != -1) {
this.quansSelArr.splice(index, 1);
- this.quans.productCoupon[index].checked = false;
+ const proIndex=this.quans.productCoupon.findIndex((v) => v.id == row.id);
+ this.quans.productCoupon[proIndex].checked = false;
}
if (row.type == 1 && index != -1) {
this.fullReductionCouponSel = { id: "" };
@@ -350,16 +344,44 @@ export default {
if (!item.use) {
return;
}
+ const hasSelNum = this.quansSelArr
+ .filter((v) => v.type == 2 && v.proId == item.proId)
+ .reduce((a, b) => {
+ return a + b.num;
+ }, 0);
+ const maxSelNum = $goodsPayPriceMap[item.proId].length;
+ const coupMaxUseNum = Math.min(item.num, maxSelNum - hasSelNum);
+ const canUseNum = Math.min(maxSelNum, coupMaxUseNum);
+
if (this.fullReductionCouponSel.id && !item.checked) {
const goodsQuan = this.quans.productCoupon.filter((v) => v.checked);
const fullReductionCoupon = this.fullReductionCouponSel.id
? [this.fullReductionCouponSel]
: [];
- let coupArr = [...goodsQuan, item];
+
+ let coupArr = [...goodsQuan, { ...item, num: canUseNum }];
const payPrice =
this.orderPrice -
returnCouponAllPrice(coupArr, canDikouGoodsArr, this.vipUser);
console.log(payPrice);
+ if (payPrice <= 0) {
+ return this.$confirm(
+ "选择该商品券后支付金额将为0,继续选择将取消选择的满减券",
+ "提示",
+ {
+ confirmButtonText: "继续选择",
+ cancelButtonText: "取消",
+ type: "warning",
+ }
+ )
+ .then(() => {
+ this.fullReductionCouponSel = {
+ id: "",
+ };
+ this.quansSelArr.splice(0, 1);
+ })
+ .catch(() => {});
+ }
if (this.fullReductionCouponSel.fullAmount > payPrice) {
this.$confirm(
"选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券",
@@ -379,13 +401,19 @@ export default {
}
}
item.checked = !item.checked;
+ if (!item.checked) {
+ console.log(index);
+ const index = this.quansSelArr.findIndex((v) => v.id == item.id);
+ this.quansSelArr.splice(index, 1);
+ } else {
+ this.quansSelArr.push({ ...item, num: canUseNum });
+ }
const CheckedArr = this.quans.productCoupon.filter((v) => v.checked);
- this.quansSelArr = [
- ...(this.fullReductionCouponSel.id
- ? [this.fullReductionCouponSel]
- : []),
- ...CheckedArr,
- ];
+ if (CheckedArr.length <= 0) {
+ return this.quans.productCoupon.map((v) => {
+ v.use = true;
+ });
+ }
const noCheckedArr = this.quans.productCoupon.filter((v) => !v.checked);
noCheckedArr.map((v) => {
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr);
@@ -405,12 +433,12 @@ export default {
},
confirm() {
- this.$emit("confirm", [...this.quansSelArr]);
+ this.$emit("confirm", [...this.quansSelArr], $goodsPayPriceMap);
this.close();
},
async open(data, propSelCoup) {
console.log(data);
- this.orderPrice=data.orderPrice;
+ this.orderPrice = data.orderPrice;
this.quansSelArr = [...propSelCoup];
$goodsPayPriceMap = returnGoodsPayPriceMap(this.goodsArr || []);
if (data.memberId) {
@@ -419,7 +447,7 @@ export default {
memberId: data.memberId,
});
quansRes.fullReductionCoupon = quansRes.fullReductionCoupon.filter(
- (v) => v.use && this.orderPrice * 1 >= v.fullAmount * 1
+ (v) =>this.orderPrice<=0?false:(v.use && this.orderPrice * 1 >= v.fullAmount * 1)
);
const selFullReductionCoupon = this.quansSelArr.find(
(v) => v.type == 1
@@ -442,6 +470,7 @@ export default {
checked: this.quansSelArr.find((selCoup) => selCoup.id == v.id)
? true
: false,
+ use:this.orderPrice<=0?false:calcCoup.use
};
})
.filter((v) => v.use);
diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue
index a9a1272..d721fa9 100644
--- a/src/views/tool/Instead/index.vue
+++ b/src/views/tool/Instead/index.vue
@@ -982,9 +982,14 @@
-
+
¥{{ scope.row.discountAmount }}
+
+ ¥{{
+ returnProDiscount(scope.row, scope.row.index)
+ }}
+
@@ -1011,6 +1016,7 @@
ref="refPayType"
v-model="order.payType"
@itemClick="payTypeItemClick"
+ :disabledPayType="disabledPayType"
>
@@ -1094,13 +1100,7 @@
@@ -1481,6 +1481,11 @@ import {
returnVipDiscountPrice,
returnCouponAllPrice,
} from "./util.js";
+import {
+ returnProductCoupAllPrice
+} from "./quan_util.js";
+//商品数量从0到n每一个对应的价格
+let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js";
let $originTableList = [];
@@ -1501,6 +1506,7 @@ export default {
},
data() {
return {
+ disabledPayType: [],
//积分抵扣
points: {
res: {
@@ -1609,7 +1615,7 @@ export default {
total: 0,
},
order: {
- status:'',
+ status: "",
packFee: {
totalNumber: 0,
status: "",
@@ -1715,8 +1721,8 @@ export default {
},
computed: {
isShowVipPrice() {
- if(!this.shopInfo.isMemberPrice){
- return false
+ if (!this.shopInfo.isMemberPrice) {
+ return false;
}
return this.vipUser.isVip ? true : false;
},
@@ -1972,6 +1978,13 @@ export default {
},
},
watch: {
+ yinFuJinE: function (newval) {
+ if (newval <= 0) {
+ this.disabledPayType = ["scanCode", "deposit"];
+ } else {
+ this.disabledPayType = [];
+ }
+ },
"goods.query.categoryId": function (newval) {
this.goods.query.page = 1;
this.goods.list = [];
@@ -2039,9 +2052,9 @@ export default {
// this.masterId = masterId;
console.log("this.createOrder.data");
console.log(this.createOrder.data);
- if(this.order.status=='finish'){
- return
- }
+ if (this.order.status == "finish") {
+ return;
+ }
$setUser({
tableId: this.table.tableId,
masterId: this.masterId,
@@ -2054,8 +2067,8 @@ export default {
this.getOrderData().then(() => {
this.pointsValueChange(this.points.value);
});
- }else{
- this.getCart()
+ } else {
+ this.getCart();
}
});
},
@@ -2174,6 +2187,21 @@ export default {
this.open(this.$route.query);
},
methods: {
+ returnProDiscount(row) {
+ console.log(row);
+ //相同商品抵扣券数组
+ const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
+ const index = arr.findIndex((v) => v.id == row.id);
+ if (index != -1) {
+ return returnProductCoupAllPrice(
+ $goodsPayPriceMap[row.proId],
+ index,
+ row.num
+ ).toFixed(2);
+ } else {
+ return 0;
+ }
+ },
lingshicaiShow() {
this.$refs.refPopAddCai.open();
},
@@ -2234,14 +2262,15 @@ export default {
{
id: this.createOrder.data.id,
memberId: this.createOrder.data.memberId || this.vipUser.id,
- orderPrice:(this.yinFuJinE*1+this.coupdiscount*1).toFixed(2)
+ orderPrice: (this.yinFuJinE * 1 + this.coupdiscount * 1).toFixed(2),
},
[...this.quansSelArr]
);
},
- quansConfirm(e) {
+ quansConfirm(e,goodsPayPriceMap) {
console.log(e);
this.quansSelArr = [...e];
+ $goodsPayPriceMap=goodsPayPriceMap
},
searchInput(e) {
console.log(e);
@@ -2837,7 +2866,7 @@ export default {
title: "支付成功",
type: "success",
});
- this.order.status='finish'
+ this.order.status = "finish";
this.close();
// this.reset();
},
@@ -3069,11 +3098,14 @@ export default {
}
if (key === "returnCart") {
console.log(this.order);
- let selGoods=undefined
- if(this.order.selPlaceNum==-10){
- selGoods = {...this.order.seatFee,num:this.order.seatFee.number}
- }else{
- selGoods = this.order.old.list[this.order.selPlaceNum-1].info[this.order.old.selIndex];
+ let selGoods = undefined;
+ if (this.order.selPlaceNum == -10) {
+ selGoods = { ...this.order.seatFee, num: this.order.seatFee.number };
+ } else {
+ selGoods =
+ this.order.old.list[this.order.selPlaceNum - 1].info[
+ this.order.old.selIndex
+ ];
}
console.log(selGoods);
this.refToggle("refReturnCart", true, selGoods);
diff --git a/src/views/tool/Instead/quan_util.js b/src/views/tool/Instead/quan_util.js
index 5052034..78360d7 100644
--- a/src/views/tool/Instead/quan_util.js
+++ b/src/views/tool/Instead/quan_util.js
@@ -2,7 +2,7 @@ export function isTui(item) {
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
}
//是否使用会员价
-export function isUseMemberPrice(vipUser,goods){
+export function isUseVipPrice(vipUser,goods){
return vipUser.id&&vipUser.isVip&&goods.isMember
}
@@ -13,7 +13,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
return 0
}
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
- const price = item ? (isUseMemberPrice(vipUser,item) ? memberPrice : item.price) : 0;
+ const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
return price * coup.num
}
@@ -40,7 +40,8 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
if (selCoupNumber >= findGoodsTotalNumber) {
return false
}
- return findGoodsTotalNumber < (coup.num + selCoupNumber) ? false : true
+ console.log(selCoupNumber,findGoodsTotalNumber);
+ return findGoodsTotalNumber < selCoupNumber ? false : true
}
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
@@ -54,12 +55,13 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
}
}
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
- const price = item ? (isUseMemberPrice(vipUser,item) ? memberPrice : item.price) : 0;
+ const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
const discountAmount = (price * coup.num).toFixed(2)
console.log(discountAmount);
- const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
+ // const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
// const canUse=discountAmount>0
+ const canUse=coup.use
return {
...coup,
discountAmount: discountAmount,
@@ -85,7 +87,7 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
//返回商品实际支付价格
export function returnProductPayPrice(goods,vipUser){
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
- const price = isUseMemberPrice(vipUser,goods) ? memberPrice : goods.price;
+ const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
return price
}
//返回商品券抵扣的商品价格
@@ -100,6 +102,23 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num){
return prve+curPrice
},0)
}
+
+//返回商品券可抵扣的商品数量
+export function returnProductCanUseNum(productPriceArr,startIndex,num){
+ console.log(productPriceArr);
+ console.log(num);
+ let n=0;
+ for(let i=0;i
{
@@ -166,7 +185,9 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
}
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
console.log(proCoupStartIndex);
- total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coup.num)
+ const coupNum=Math.min(goodsPayPriceMap[coup.proId].length,coup.num)
+ console.log(coupNum);
+ total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
}
}
@@ -198,6 +219,12 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
return v
}
const isfullAmount = payPrice >= v.fullAmount * 1
+ if(payPrice<=0){
+ return {
+ ...v,
+ use: false
+ }
+ }
return {
...v,
use: v.use && isfullAmount
From 7ff8632af9af5a85c22adfafdf8ac291326e1294 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 20 Nov 2024 16:09:44 +0800
Subject: [PATCH 06/22] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=94=AF=E4=BB=98?=
=?UTF-8?q?=E5=AE=8C=E6=88=90=E5=BC=BA=E5=88=B6=E5=88=B7=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/tool/Instead/index.vue | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue
index d721fa9..457e69a 100644
--- a/src/views/tool/Instead/index.vue
+++ b/src/views/tool/Instead/index.vue
@@ -1481,9 +1481,7 @@ import {
returnVipDiscountPrice,
returnCouponAllPrice,
} from "./util.js";
-import {
- returnProductCoupAllPrice
-} from "./quan_util.js";
+import { returnProductCoupAllPrice } from "./quan_util.js";
//商品数量从0到n每一个对应的价格
let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js";
@@ -2267,10 +2265,10 @@ export default {
[...this.quansSelArr]
);
},
- quansConfirm(e,goodsPayPriceMap) {
+ quansConfirm(e, goodsPayPriceMap) {
console.log(e);
this.quansSelArr = [...e];
- $goodsPayPriceMap=goodsPayPriceMap
+ $goodsPayPriceMap = goodsPayPriceMap;
},
searchInput(e) {
console.log(e);
@@ -3574,6 +3572,7 @@ export default {
},
reset() {
// this.goods.list = [];
+ this.order.status = "";
this.loading = false;
this.table = "";
this.order.list = [];
@@ -3947,7 +3946,6 @@ export default {
this.$router.replace({ path: "/tool/table_list" });
} else {
this.$router.replace({ path: "/tool/Instead/index" });
- this.$router.go(0);
// this.reset();
// this.$router.replace({ path: "/tool/Instead/index" });
}
From c7283a493c9e5de0dd159c911a671f66e21c4b04 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 20 Nov 2024 16:36:32 +0800
Subject: [PATCH 07/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B4=E5=8D=95?=
=?UTF-8?q?=E6=94=B9=E4=BB=B7=E6=97=B6=E4=BB=B7=E6=A0=BC=E4=B8=8D=E5=AF=B9?=
=?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/tool/Instead/index.vue | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue
index 457e69a..7510105 100644
--- a/src/views/tool/Instead/index.vue
+++ b/src/views/tool/Instead/index.vue
@@ -1757,11 +1757,12 @@ export default {
const amount = this.createOrder.data.amount || 0;
const discount = this.createOrder.discount || 1;
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
- const total = (amount - this.coupdiscount) * this.createOrder.discount;
+ const total = (amount) * this.createOrder.discount - this.coupdiscount;
return total <= 0 ? 0 : total;
},
yinFuJinE() {
const total = this.currentPayMoney - (this.points.toMoney || 0);
+ console.log(total)
if (this.isCreateOrder) {
return total.toFixed(2);
} else {
@@ -2676,7 +2677,7 @@ export default {
if (!canDiscount) {
return;
}
- const amount = this.createOrder.data.amount - this.coupdiscount;
+ const amount = this.createOrder.data.amount;
this.refToggle("refDiscount", true, {
amount,
discount: this.createOrder.discount * 100,
From d9cf881b62b09ceaa41c7b854191426209a40aea Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 20 Nov 2024 16:54:43 +0800
Subject: [PATCH 08/22] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?=
=?UTF-8?q?=E6=89=93=E6=8A=98=E5=BC=B9=E7=AA=97=E5=BA=94=E4=BB=98=E9=87=91?=
=?UTF-8?q?=E9=A2=9D=E6=96=87=E5=AD=97=E6=94=B9=E4=B8=BA=E6=80=BB=E4=BB=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/tool/Instead/components/discount.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/tool/Instead/components/discount.vue b/src/views/tool/Instead/components/discount.vue
index b3a2f56..b281a44 100644
--- a/src/views/tool/Instead/components/discount.vue
+++ b/src/views/tool/Instead/components/discount.vue
@@ -3,7 +3,7 @@
-
+
¥{{ form.money }}
From 9969251050234f8a145f122222bcad5c72c27619 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Wed, 20 Nov 2024 18:25:37 +0800
Subject: [PATCH 09/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E4=BC=98=E6=83=A0=E9=87=91=E9=A2=9D=E8=AE=A1?=
=?UTF-8?q?=E7=AE=97=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=AE=A2=E5=8D=95=E9=80=80?=
=?UTF-8?q?=E6=AC=BE=E6=97=B6=E5=AE=A2=E5=BA=A7=E8=B4=B9=E9=83=A8=E5=88=86?=
=?UTF-8?q?=E9=80=80=E6=AC=BE=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 4 +-
.../order_manage/components/orderDetail.vue | 203 ++++++++++++------
.../tool/Instead/components/return-money.vue | 48 +++--
src/views/tool/Instead/index.vue | 10 +
4 files changed, 180 insertions(+), 85 deletions(-)
diff --git a/.env.development b/.env.development
index fdeba2f..98c3e63 100644
--- a/.env.development
+++ b/.env.development
@@ -5,9 +5,9 @@ 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 = 'https://admintestpapi.sxczgkj.cn'
#预发布
-# VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
+VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
# 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
diff --git a/src/views/order_manage/components/orderDetail.vue b/src/views/order_manage/components/orderDetail.vue
index 568aa0a..9984e66 100644
--- a/src/views/order_manage/components/orderDetail.vue
+++ b/src/views/order_manage/components/orderDetail.vue
@@ -1,7 +1,13 @@
-
+