根据原型调整兑换码页面

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>
{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,7 +106,9 @@ export const Column2 = [
}
]
export const state = {
/* 初始化数据 */
export const init = () => {
return {
uploading: false, //上传中
model: {
//数据模型不可少
@ -161,3 +164,4 @@ export const state = {
planSelectData: [] /* 营销计划数据 */,
keyBatchSelectData: [] /* 营销计划ID */
}
}