From 8b80420d953cddd6093da3470773e1d9e4f3da2b Mon Sep 17 00:00:00 2001 From: zhangds Date: Mon, 31 Oct 2022 11:20:05 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E8=B6=85=E8=BF=873=E5=B9=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/coupon/list/index.jsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/pages/coupon/list/index.jsx b/src/pages/coupon/list/index.jsx index c62a7989..6e662043 100644 --- a/src/pages/coupon/list/index.jsx +++ b/src/pages/coupon/list/index.jsx @@ -10,6 +10,7 @@ import { Sweetalert, } from "zent"; import _ from "lodash"; +import moment from "moment"; import TabPage from "@/components/tabPage/main.js"; import Ipt from "@/components/input/main"; import Grid from "@/components/gird/main.js"; @@ -203,13 +204,19 @@ const UseCouponList = () => { setState({ limit: data, isQuery: !state.isQuery }); }; const onChangeCombinedDate = (data) => { - setState({ combinedValue: data }); if (data[0]) { - setState({ - begin_time: data[0], - end_time: data[1], - isQuery: !state.isQuery, - }); + let years = moment(data[1]).diff(moment(data[0]), "years"); + if (years > 2) { + Notify.error("查询时间不能超过3年"); + return; + } else { + setState({ combinedValue: data }); + setState({ + begin_time: data[0], + end_time: data[1], + isQuery: !state.isQuery, + }); + } } else { setState({ combinedValue: data, From 0a744b052492d49d5c2ead2c68c1c4abc3738812 Mon Sep 17 00:00:00 2001 From: zhangds Date: Mon, 31 Oct 2022 15:43:19 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=AB=8B=E5=87=8F?= =?UTF-8?q?=E9=87=91=E5=A4=8D=E5=88=B6=E5=BA=93=E5=AD=98=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/tools/index.js b/src/tools/index.js index 4ae68846..f1b8cd65 100644 --- a/src/tools/index.js +++ b/src/tools/index.js @@ -1,4 +1,15 @@ import { divNum } from "./number"; + +// 判断 +const kgType = (item) => { + let type = sessionStorage.getItem("KeyPcType"); + if (type === "2" || type === "3") { + return divNum(item.all_budget, item.reduce_amount); + } else { + return item.stock; + } +}; + // 立减金对象重构 export const knockGoldFun = (item) => { let table_obj = {}; @@ -11,9 +22,7 @@ export const knockGoldFun = (item) => { table_obj.official_price = item.reduce_amount; // 官方价 table_obj.contract_price = item.price; // 合同价格 table_obj.quantity = item.total_stock; // 库存数量 - table_obj.stock = item.stock - ? item.stock - : divNum(item.all_budget, item.reduce_amount); // 剩余库存数量 + table_obj.stock = kgType(item); // 剩余库存数量 table_obj.channel_activity_id = item.channel_activity_id; // 批次号 table_obj.all_budget = Number(item.all_budget); // 总预算 table_obj.effectDate = `${item.time_limit.effect_time.start_time} 至 ${item.time_limit.effect_time.end_time}`; // 有效时间段 From 84e3cbd5ab619dbaeb92979dc71f03c5f93b93e2 Mon Sep 17 00:00:00 2001 From: zhangds Date: Mon, 31 Oct 2022 15:55:04 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=AB=8B=E5=87=8F?= =?UTF-8?q?=E9=87=91=E5=BA=93=E5=AD=98=E8=88=8D=E5=8E=BB=E5=B0=8F=E6=95=B0?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/index.js b/src/tools/index.js index f1b8cd65..7dacb39b 100644 --- a/src/tools/index.js +++ b/src/tools/index.js @@ -4,7 +4,7 @@ import { divNum } from "./number"; const kgType = (item) => { let type = sessionStorage.getItem("KeyPcType"); if (type === "2" || type === "3") { - return divNum(item.all_budget, item.reduce_amount); + return parseInt(divNum(item.all_budget, item.reduce_amount)); } else { return item.stock; } From f6cf046e0ebc9fcb31d04e7440ccd248ce9f16de Mon Sep 17 00:00:00 2001 From: zhangds Date: Mon, 31 Oct 2022 16:19:51 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E7=BC=96=E8=BE=91=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=BA=93=E5=AD=98=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tools/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/index.js b/src/tools/index.js index 7dacb39b..0427ec07 100644 --- a/src/tools/index.js +++ b/src/tools/index.js @@ -6,7 +6,11 @@ const kgType = (item) => { if (type === "2" || type === "3") { return parseInt(divNum(item.all_budget, item.reduce_amount)); } else { - return item.stock; + if (item.stock) { + return item.stock; + } else { + return parseInt(divNum(item.all_budget, item.reduce_amount)); + } } }; From 8d00f01e465963941945a65cb4412c28e1538965 Mon Sep 17 00:00:00 2001 From: zhangds Date: Mon, 31 Oct 2022 17:00:55 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E6=8C=89=E9=92=AE=E9=98=B2=E6=8A=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseCouponAddEdit/index.jsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index e441d529..23ab3dee 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -217,6 +217,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { productType: 1, checkedProduct: [], KeyPcType: sessionStorage.getItem("KeyPcType"), + isLoadingBtn: false, }); // 基础信息 @@ -602,6 +603,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }; const onAuditSubmit = () => { + setState({ + isLoadingBtn: true, + }); // 3新增 1编辑 if (state.KeyPcType === "1") { let param = { @@ -658,6 +662,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => { console.log("编辑 大提交 =>", param); editCoupon(editData.id, param).then((res) => { + setState({ + isLoadingBtn: false, + }); handelResponse( res, (req, msg) => { @@ -714,6 +721,9 @@ const UseCouponAddEdit = forwardRef((props, ref) => { }); } addCoupon(param).then((res) => { + setState({ + isLoadingBtn: false, + }); handelResponse( res, (req, msg) => { @@ -1115,6 +1125,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {