From 4f61181409bd4a3582b6c9fc8fad360285c82064 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Fri, 18 Aug 2023 09:07:21 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=96=B0=E5=A2=9E=E5=8D=A1?= =?UTF-8?q?=E5=AF=86=E5=95=86=E5=93=81=E5=8F=AF=E9=80=89=E6=8B=A9=E5=8F=91?= =?UTF-8?q?=E6=94=BE=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 5 +++ src/components/UseProductPop/index.jsx | 51 ++++++++++++++++++-------- src/pages/order/list/list.js | 23 +++++++++++- src/pages/order/list/utils.js | 2 +- 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index 38238191..d8a371ac 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -997,4 +997,9 @@ export const keyBatchExport = (data) => { return derives("post", baseurl + "/keybatch/export", data) } +/* 发送短信 */ +export const resendCardCode = (data) => { + return req("post", baseurl + "/order/resendCardCode", data) +} + export { req } diff --git a/src/components/UseProductPop/index.jsx b/src/components/UseProductPop/index.jsx index 52e75a85..de5027c1 100644 --- a/src/components/UseProductPop/index.jsx +++ b/src/components/UseProductPop/index.jsx @@ -25,7 +25,7 @@ const initArray = (targetNum) => { //校验规则 const formRules = { - product: [{ type: "required", message: "请选择映射商品" }], + product_id: [{ type: "required", message: "请选择映射商品" }], quantity: [ { type: "required", message: "请输入商品库存" }, { @@ -52,7 +52,8 @@ const formRules = { reg: "^([0-9]{0,2}|100)$" } ], - end_time: [{ type: "required", message: "请选择兑换结束时间" }] + end_time: [{ type: "required", message: "请选择兑换结束时间" }], + card_show: [{ type: "required", message: "请选择卡密发放类型" }] } const UseProductPop = forwardRef((props, ref) => { @@ -74,7 +75,7 @@ const UseProductPop = forwardRef((props, ref) => { loading: true }) const [model, setModel] = useSetState({ - cur_product: {}, + cur_product: undefined, code_batch_id: "", product_type: Number(productType), cost_price: "", @@ -89,7 +90,8 @@ const UseProductPop = forwardRef((props, ref) => { product_id: "", account_type: "", map_product_name: "", - end_time: "" + end_time: "", + card_show: 2 }) useEffect(() => { @@ -186,6 +188,7 @@ const UseProductPop = forwardRef((props, ref) => { account_type: productData.account_type, map_product_name: productData.map_product_name, product_type: model.product_type, + card_show: Number(productData.card_show), code_batch_id: productData.code_batch_id, end_time: productData.end_time, show_url: [ @@ -225,7 +228,7 @@ const UseProductPop = forwardRef((props, ref) => { const clearForm = () => { setModel({ - cur_product: {}, + cur_product: undefined, code_batch_id: "", cost_price: "", weight: "0", @@ -240,7 +243,8 @@ const UseProductPop = forwardRef((props, ref) => { detail_url: [], account_type: "", map_product_name: "", - end_time: "" + end_time: "", + card_show: 2 }) setTimeout(() => { setState({ isUpdatePic: !state.isUpdatePic }) @@ -263,7 +267,8 @@ const UseProductPop = forwardRef((props, ref) => { account_type: model.account_type, map_product_name: model.product_name, goods_id: model.goods_id, - end_time: model.end_time + end_time: model.end_time, + card_show: model.card_show } } @@ -290,19 +295,17 @@ const UseProductPop = forwardRef((props, ref) => { setModel({ cur_product: e }) // 当前选中的商品数据 - let cur_product = state.productDataAll.find((item) => { - return item.id === e.key - }) + let cur_product = e ? state.productDataAll.find((item) => item.id === e.key) : {} // 获取商品logo和图片 let picItem = window.goods.find((item) => { return Number(item.id) === Number(cur_product.product_category_id) }) setModel({ - product_id: cur_product.id, - official_price: cur_product.official_price, - cost_price: cur_product.cost_price, - product_name: cur_product.title, - account_type: cur_product.account_type, + product_id: cur_product.id || "", + official_price: cur_product.official_price || "", + cost_price: cur_product.cost_price || "", + product_name: cur_product.title || "", + account_type: cur_product.account_type || "", quantity: "", contract_price: "" }) @@ -346,6 +349,7 @@ const UseProductPop = forwardRef((props, ref) => { clearForm() setModel({ product_type: e.target.value }) } + const onUploadError = (type, data) => { if (type === "overMaxAmount") { Notify.error(`最多可上传 ${data.maxAmount} 张图片`) @@ -507,7 +511,22 @@ const UseProductPop = forwardRef((props, ref) => { 卡密 - + {model.product_type === 2 ? ( + + { + setModel({ card_show: e.target.value }) + }} + value={model.card_show} + disabled={!!model.code_batch_id} + > + 平台查看 + 短信下发 + + + ) : null} + +