From 8cc7012a189f0650b03b22a05f3c0ef683c705cb Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Mon, 29 Aug 2022 10:21:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8E=9F=E5=9E=8B=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=85=91=E6=8D=A2=E7=A0=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exchangecode/exchangecodeAdd/index.jsx | 43 +++++-- .../exchangecode/exchangecodeAdd/utils.js | 114 +++++++++--------- 2 files changed, 91 insertions(+), 66 deletions(-) diff --git a/src/pages/exchangecode/exchangecodeAdd/index.jsx b/src/pages/exchangecode/exchangecodeAdd/index.jsx index 0e95d4aa..a10f4c01 100644 --- a/src/pages/exchangecode/exchangecodeAdd/index.jsx +++ b/src/pages/exchangecode/exchangecodeAdd/index.jsx @@ -36,7 +36,7 @@ import "./index.less" import moment from "moment" import Grid from "@/components/gird/main.js" import { isSameDay } from "date-fns" -import { Column2, rulesInfo, codeInfo, state } from "./utils" +import { Column2, rulesInfo, codeInfo, init } from "./utils" const initArray = (targetNum) => { return Array.from({ length: targetNum }, (_, index) => index) } @@ -44,7 +44,7 @@ const initArray = (targetNum) => { export default class exchangeAdd extends React.Component { constructor(props) { super(props) - this.state = { ...state } + this.state = { ...init() } } componentDidMount() { @@ -1143,7 +1143,7 @@ export default class exchangeAdd extends React.Component { rules={codeInfo} ref='code_info' className='addform'> - + this.handleChange(e, "keyBatchId")} clearable @@ -1181,19 +1181,40 @@ export default class exchangeAdd extends React.Component { value={this.state.codeInfo.code_name} placeholder={"请输入兑换码名称"} labelWidth={"0px"} - maxLength={10} + maxLength={12} height={"36px"} width={"520px"} alignment={"left"} /> - -
{this.state.codeInfo.issued}
-
- -
{this.state.codeInfo.stock}
-
+ {this.state.isState === 2 ? ( + <> + +
{this.state.codeInfo.issued}
+
+ +
{this.state.codeInfo.stock}
+
+ + ) : ( + + this.handleChange(e, "issued")} + onClearItem={() => this.handleChange("", "issued")} + value={this.state.codeInfo.issued} + placeholder={"请输入发放总量"} + labelWidth={"0px"} + maxLength={6} + countShow={false} + unit='条' + height={"36px"} + width={"520px"} + alignment={"left"} + /> + + )} + { + return { + uploading: false, //上传中 + model: { + //数据模型不可少 + product_id: "", + product_type: "1", + contract_price: "", + official_price: "", + cost_price: "", + quantity: "", + product_name: "", + show_url: "", + describe_url: "", + detail_url: "", + weight: "0" + }, + codeInfo: { + //数据模型不可少 + code_name: "", + issued: "", //发放总量 + describe: "", + date_time: "", + range: "", + stock: "", + planId: "", + keyBatchId: "" + }, + isload: false, + tempdata: [], + oldProduct: [], + deleteProduct: [], //审批删除的商品 + new_product: [], + cur_product: null, + productOption: [], + rankoptions: [], + rank: [], + recall_visible: false, + approvalLoading: false, + timer: 3, + paytype: 3, + reseller: null, + payment_direction: ["对私账户", "对公账户", "预付款扣除"], + isAudit: false, + approvalsStatus: false, + oldTable: [], + product_title: "新建商品", + plan_time: "", + direct_reseller_id: 0, + newGoodsBtnLoading: false, + tableLoading: false, + newGoldLoading: false, + addIsType: "", + isState: 0, + planSelectData: [] /* 营销计划数据 */, + keyBatchSelectData: [] /* 营销计划ID */ + } }