From 570f8c9c0f97320bfbdd79c545c7e395229b86bb Mon Sep 17 00:00:00 2001 From: wangh <9483> Date: Tue, 27 Feb 2024 15:32:58 +0800 Subject: [PATCH] no message --- .../order/mapper/xml/CashierOrderMapper.xml | 42 +++++++ .../views/cashier/NewComponents/Integral.vue | 116 ++++++++++++++---- .../cashier/orderComponents/order_Cashier.vue | 16 ++- 3 files changed, 150 insertions(+), 24 deletions(-) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/CashierOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/CashierOrderMapper.xml index 04a6fee07..80bbf4193 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/CashierOrderMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/CashierOrderMapper.xml @@ -99,6 +99,48 @@ ) AS numberOfStrokes, -- 笔数 + (SELECT count(*) FROM cashier_order + + store_id = #{order.storeId} + and oil_order_id is not null + + and staff_id = #{order.staffId} + + + and order_no like concat('%', #{order.orderNo}, '%') + + + and terminal like concat('%', #{order.terminal}, '%') + + + and date_format(pay_time,'%y%m%d') >= date_format(#{order.params.beginTime},'%y%m%d') + + + and date_format(pay_time,'%y%m%d') <= date_format(#{order.params.endTime},'%y%m%d') + + + ) AS numberOfStrokesByOil, -- 笔数 + (SELECT count(*) FROM cashier_order + + store_id = #{order.storeId} + and goods_order_id is not null + + and staff_id = #{order.staffId} + + + and order_no like concat('%', #{order.orderNo}, '%') + + + and terminal like concat('%', #{order.terminal}, '%') + + + and date_format(pay_time,'%y%m%d') >= date_format(#{order.params.beginTime},'%y%m%d') + + + and date_format(pay_time,'%y%m%d') <= date_format(#{order.params.endTime},'%y%m%d') + + + ) AS numberOfStrokesByGoods, -- 笔数 (SELECT sum(amount) FROM cashier_order store_id = #{order.storeId} diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/Integral.vue b/fuintCashierWeb/src/views/cashier/NewComponents/Integral.vue index bb9b03c29..741385b49 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/Integral.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/Integral.vue @@ -595,7 +595,34 @@ import {connectFlag, getLodop} from "@/api/LodopFuncs"; // }) // } - if (data.markPurchases) { + + if (this.shoppingCart.length != 0) { + // 只能订购加钱购 + let flag = false + this.shoppingCart.forEach(res => { + if (res.exchangeMethod == "积分+加钱购") { + flag = true + } + }) + + if (data.exchangeMethod == "积分+加钱购" || flag) { + flag = false + this.shoppingCart.forEach(res => { + if (res.id != data.id ) { + flag = true + + return + } + }) + } + if (flag){ + this.$message.error('“加钱购”商品仅支持在单商品结算时支持积分不足情况下使用加钱购进行付款,多个商品结算不支持“加钱够”计算'); + return + } + } + + + if (data.markPurchases) { if (data.markPurchases>=data.remainingInventory){ this.$message.error('库存不足'); return @@ -617,6 +644,9 @@ import {connectFlag, getLodop} from "@/api/LodopFuncs"; // 计算总额 this.dataChange(data); + + + if (this.shoppingCart.length === 0) { this.shoppingCart.push(data); } else { @@ -739,6 +769,7 @@ import {connectFlag, getLodop} from "@/api/LodopFuncs"; }); } else { this.openShoppingCart = true + this.dataChange(this.shoppingCart[0]) } }, // 购物车页面计算 @@ -790,7 +821,9 @@ import {connectFlag, getLodop} from "@/api/LodopFuncs"; // 拿到总的积分 this.member.points = this.member.points?this.member.points:0 let points = this.member.points - exchangePoints.toNumber(); // 使用 toNumber() 获取 BigNumber 的数值 - + if (this.member.points<0) { + points = 0 + } // 以及分等一多少 if (points < 0) { @@ -874,33 +907,74 @@ import {connectFlag, getLodop} from "@/api/LodopFuncs"; }else if (data.exchangeMethod =='积分+加钱购') { - let exchange = new BigNumber(data.exchangePoints); - let mark = new BigNumber(data.markPurchases); - let exchangePoints_sum = exchange.multipliedBy(mark); - this.$set(data, "exchangePoints_sum", exchangePoints_sum); - if (data.exchangePoints_sum) { - data.exchangePoints_sum = Number(exchangePoints_sum); - }else { - this.$set(data, "exchangePoints_sum", exchangePoints_sum); + let exchangePoints_sum = 0 + let exchangeAmount_sum = 0 + + // let data1 = this.shoppingCart[0]; + // 计算加钱购商品一共多少积分 + let markPurchases = new BigNumber(data.markPurchases); + let exchangePoints = markPurchases.multipliedBy(new BigNumber(data.exchangePoints)); + // 拿到总的积分 + this.member.points = this.member.points?this.member.points:0 + let points = this.member.points - exchangePoints.toNumber(); // 使用 toNumber() 获取 BigNumber 的数值 + console.log("points",points) + // 以及分等一多少 + if (points < 0) { + + // 计算需要的金额 + points = Math.abs(points); + + + exchangeAmount_sum = points * data.moneyRatio; // 直接使用 JavaScript 中的乘法 + exchangeAmount_sum = exchangeAmount_sum.toFixed(2); + + exchangePoints_sum = this.member.points; + } else { + exchangeAmount_sum = 0 + exchangePoints_sum = exchangePoints.toNumber(); } + this.$set(data, "exchangePoints_sum", exchangePoints_sum) + this.$set(data, "exchangeAmount_sum", exchangeAmount_sum) - let ratio = new BigNumber(data.moneyRatio); - let moneyRatio_sum = ratio.multipliedBy(mark); - this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+moneyRatio_sum+""); - if (data.moneyRatio_sum) { - data.moneyRatio_sum = moneyRatio_sum; - }else { - this.$set(data, "moneyRatio_sum", moneyRatio_sum); - } if (data.totalPoints_sum) { - data.totalPoints_sum = exchangePoints_sum+"积分"+"+"+moneyRatio_sum+""; + data.totalPoints_sum = exchangePoints_sum+"积分"+"+"+exchangeAmount_sum+""; }else { - this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+moneyRatio_sum+""); + this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+exchangeAmount_sum+""); } - console.log("data积分",data) + console.log("数据",data) + return + + // + // let exchange = new BigNumber(data.exchangePoints); + // let mark = new BigNumber(data.markPurchases); + // let exchangePoints_sum = exchange.multipliedBy(mark); + // this.$set(data, "exchangePoints_sum", exchangePoints_sum); + // + // if (data.exchangePoints_sum) { + // data.exchangePoints_sum = Number(exchangePoints_sum); + // }else { + // this.$set(data, "exchangePoints_sum", exchangePoints_sum); + // } + // + // let ratio = new BigNumber(data.moneyRatio); + // let moneyRatio_sum = ratio.multipliedBy(mark); + // this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+moneyRatio_sum+""); + // + // if (data.moneyRatio_sum) { + // data.moneyRatio_sum = moneyRatio_sum; + // }else { + // this.$set(data, "moneyRatio_sum", moneyRatio_sum); + // } + // if (data.totalPoints_sum) { + // data.totalPoints_sum = exchangePoints_sum+"积分"+"+"+moneyRatio_sum+""; + // }else { + // this.$set(data, "totalPoints_sum", exchangePoints_sum+"积分"+"+"+moneyRatio_sum+""); + // + // } + // console.log("data积分",data) } }, // 打开订单记录 diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/order_Cashier.vue b/fuintCashierWeb/src/views/cashier/orderComponents/order_Cashier.vue index 394e72af9..cc1448221 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/order_Cashier.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/order_Cashier.vue @@ -54,9 +54,19 @@ 收银台订单统计
-
-
笔数
-
{{ orderStatistics.numberOfStrokes?orderStatistics.numberOfStrokes:0 }}
+
+
+
笔数
+
{{ orderStatistics.numberOfStrokes?orderStatistics.numberOfStrokes:0 }}
+
+
+
油品笔数
+
{{ orderStatistics.numberOfStrokesByOil?orderStatistics.numberOfStrokesByOil:0 }}
+
+
+
商品笔数
+
{{ orderStatistics.numberOfStrokesByGoods?orderStatistics.numberOfStrokesByGoods:0 }}
+
订单总金额