-
+
¥{{ 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,9 @@ 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 +1504,7 @@ export default {
},
data() {
return {
+ disabledPayType: [],
//积分抵扣
points: {
res: {
@@ -1609,6 +1613,7 @@ export default {
total: 0,
},
order: {
+ status: "",
packFee: {
totalNumber: 0,
status: "",
@@ -1714,8 +1719,8 @@ export default {
},
computed: {
isShowVipPrice() {
- if(!this.shopInfo.isMemberPrice){
- return false
+ if (!this.shopInfo.isMemberPrice) {
+ return false;
}
return this.vipUser.isVip ? true : false;
},
@@ -1752,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 {
@@ -1971,6 +1977,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 = [];
@@ -2038,8 +2051,8 @@ export default {
// this.masterId = masterId;
console.log("this.createOrder.data");
console.log(this.createOrder.data);
- if(this.createOrder.data.memberId==val){
- return
+ if (this.order.status == "finish") {
+ return;
}
$setUser({
tableId: this.table.tableId,
@@ -2053,6 +2066,8 @@ export default {
this.getOrderData().then(() => {
this.pointsValueChange(this.points.value);
});
+ } else {
+ this.getCart();
}
});
},
@@ -2171,6 +2186,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();
},
@@ -2231,14 +2261,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);
@@ -2646,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,
@@ -2834,6 +2865,7 @@ export default {
title: "支付成功",
type: "success",
});
+ this.order.status = "finish";
this.close();
// this.reset();
},
@@ -3065,11 +3097,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);
@@ -3538,6 +3573,7 @@ export default {
},
reset() {
// this.goods.list = [];
+ this.order.status = "";
this.loading = false;
this.table = "";
this.order.list = [];
@@ -3911,7 +3947,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" });
}
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