根据原型调整兑换码页面

This commit is contained in:
wangsongsole 2022-08-29 10:21:28 +08:00
parent 86708c2688
commit 8cc7012a18
2 changed files with 91 additions and 66 deletions

View File

@ -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'>
<FormItem labelname='营销计划' prop='planId' id='planId'>
<FormItem labelname='归属计划' prop='planId' id='planId'>
<Select
onChange={(e) => this.handleChange(e, "planId")}
clearable
@ -1157,7 +1157,7 @@ export default class exchangeAdd extends React.Component {
alignment={"left"}
/>
</FormItem>
<FormItem labelname='key批次' prop='keyBatchId' id='keyBatchId'>
<FormItem labelname='归属key' prop='keyBatchId' id='keyBatchId'>
<Select
onChange={(e) => 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"}
/>
</FormItem>
<FormItem labelname='发放总量' prop='issued' id='issued'>
<div className='line'>{this.state.codeInfo.issued}</div>
</FormItem>
<FormItem labelname='剩余库存量' prop='issued' id='issued'>
<div className='line'>{this.state.codeInfo.stock}</div>
</FormItem>
{this.state.isState === 2 ? (
<>
<FormItem labelname='发放总量' prop='issued' id='issued'>
<div className='line'>{this.state.codeInfo.issued}</div>
</FormItem>
<FormItem labelname='剩余库存量' prop='issued' id='issued'>
<div className='line'>{this.state.codeInfo.stock}</div>
</FormItem>
</>
) : (
<FormItem labelname='发放总量' prop='issued' id='issued'>
<Ipt
onChange={(e) => 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"}
/>
</FormItem>
)}
<FormItem
labelname='使用说明'
prop='describe'

View File

@ -10,6 +10,7 @@ export const rulesInfo = {
date_time: [{ type: "required", message: "请选择生效时间段" }]
}
/* 商品范围列表 */
export const Column2 = [
{
title: "商品ID",
@ -105,59 +106,62 @@ export const Column2 = [
}
]
export const state = {
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 */
/* 初始化数据 */
export const init = () => {
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 */
}
}