根据原型调整兑换码页面

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 moment from "moment"
import Grid from "@/components/gird/main.js" import Grid from "@/components/gird/main.js"
import { isSameDay } from "date-fns" import { isSameDay } from "date-fns"
import { Column2, rulesInfo, codeInfo, state } from "./utils" import { Column2, rulesInfo, codeInfo, init } from "./utils"
const initArray = (targetNum) => { const initArray = (targetNum) => {
return Array.from({ length: targetNum }, (_, index) => index) return Array.from({ length: targetNum }, (_, index) => index)
} }
@ -44,7 +44,7 @@ const initArray = (targetNum) => {
export default class exchangeAdd extends React.Component { export default class exchangeAdd extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { ...state } this.state = { ...init() }
} }
componentDidMount() { componentDidMount() {
@ -1143,7 +1143,7 @@ export default class exchangeAdd extends React.Component {
rules={codeInfo} rules={codeInfo}
ref='code_info' ref='code_info'
className='addform'> className='addform'>
<FormItem labelname='营销计划' prop='planId' id='planId'> <FormItem labelname='归属计划' prop='planId' id='planId'>
<Select <Select
onChange={(e) => this.handleChange(e, "planId")} onChange={(e) => this.handleChange(e, "planId")}
clearable clearable
@ -1157,7 +1157,7 @@ export default class exchangeAdd extends React.Component {
alignment={"left"} alignment={"left"}
/> />
</FormItem> </FormItem>
<FormItem labelname='key批次' prop='keyBatchId' id='keyBatchId'> <FormItem labelname='归属key' prop='keyBatchId' id='keyBatchId'>
<Select <Select
onChange={(e) => this.handleChange(e, "keyBatchId")} onChange={(e) => this.handleChange(e, "keyBatchId")}
clearable clearable
@ -1181,19 +1181,40 @@ export default class exchangeAdd extends React.Component {
value={this.state.codeInfo.code_name} value={this.state.codeInfo.code_name}
placeholder={"请输入兑换码名称"} placeholder={"请输入兑换码名称"}
labelWidth={"0px"} labelWidth={"0px"}
maxLength={10} maxLength={12}
height={"36px"} height={"36px"}
width={"520px"} width={"520px"}
alignment={"left"} alignment={"left"}
/> />
</FormItem> </FormItem>
{this.state.isState === 2 ? (
<>
<FormItem labelname='发放总量' prop='issued' id='issued'> <FormItem labelname='发放总量' prop='issued' id='issued'>
<div className='line'>{this.state.codeInfo.issued}</div> <div className='line'>{this.state.codeInfo.issued}</div>
</FormItem> </FormItem>
<FormItem labelname='剩余库存量' prop='issued' id='issued'> <FormItem labelname='剩余库存量' prop='issued' id='issued'>
<div className='line'>{this.state.codeInfo.stock}</div> <div className='line'>{this.state.codeInfo.stock}</div>
</FormItem> </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 <FormItem
labelname='使用说明' labelname='使用说明'
prop='describe' prop='describe'

View File

@ -10,6 +10,7 @@ export const rulesInfo = {
date_time: [{ type: "required", message: "请选择生效时间段" }] date_time: [{ type: "required", message: "请选择生效时间段" }]
} }
/* 商品范围列表 */
export const Column2 = [ export const Column2 = [
{ {
title: "商品ID", title: "商品ID",
@ -105,7 +106,9 @@ export const Column2 = [
} }
] ]
export const state = { /* 初始化数据 */
export const init = () => {
return {
uploading: false, //上传中 uploading: false, //上传中
model: { model: {
//数据模型不可少 //数据模型不可少
@ -160,4 +163,5 @@ export const state = {
isState: 0, isState: 0,
planSelectData: [] /* 营销计划数据 */, planSelectData: [] /* 营销计划数据 */,
keyBatchSelectData: [] /* 营销计划ID */ keyBatchSelectData: [] /* 营销计划ID */
}
} }