根据原型调整兑换码页面

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>
<FormItem labelname='发放总量' prop='issued' id='issued'> {this.state.isState === 2 ? (
<div className='line'>{this.state.codeInfo.issued}</div> <>
</FormItem> <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.stock}</div> </FormItem>
</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 <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,59 +106,62 @@ export const Column2 = [
} }
] ]
export const state = { /* 初始化数据 */
uploading: false, //上传中 export const init = () => {
model: { return {
//数据模型不可少 uploading: false, //上传中
product_id: "", model: {
product_type: "1", //数据模型不可少
contract_price: "", product_id: "",
official_price: "", product_type: "1",
cost_price: "", contract_price: "",
quantity: "", official_price: "",
product_name: "", cost_price: "",
show_url: "", quantity: "",
describe_url: "", product_name: "",
detail_url: "", show_url: "",
weight: "0" describe_url: "",
}, detail_url: "",
codeInfo: { weight: "0"
//数据模型不可少 },
code_name: "", codeInfo: {
issued: "", //发放总量 //数据模型不可少
describe: "", code_name: "",
date_time: "", issued: "", //发放总量
range: "", describe: "",
stock: "", date_time: "",
planId: "", range: "",
keyBatchId: "" stock: "",
}, planId: "",
isload: false, keyBatchId: ""
tempdata: [], },
oldProduct: [], isload: false,
deleteProduct: [], //审批删除的商品 tempdata: [],
new_product: [], oldProduct: [],
cur_product: null, deleteProduct: [], //审批删除的商品
productOption: [], new_product: [],
rankoptions: [], cur_product: null,
rank: [], productOption: [],
recall_visible: false, rankoptions: [],
approvalLoading: false, rank: [],
timer: 3, recall_visible: false,
paytype: 3, approvalLoading: false,
reseller: null, timer: 3,
payment_direction: ["对私账户", "对公账户", "预付款扣除"], paytype: 3,
isAudit: false, reseller: null,
approvalsStatus: false, payment_direction: ["对私账户", "对公账户", "预付款扣除"],
oldTable: [], isAudit: false,
product_title: "新建商品", approvalsStatus: false,
plan_time: "", oldTable: [],
direct_reseller_id: 0, product_title: "新建商品",
newGoodsBtnLoading: false, plan_time: "",
tableLoading: false, direct_reseller_id: 0,
newGoldLoading: false, newGoodsBtnLoading: false,
addIsType: "", tableLoading: false,
isState: 0, newGoldLoading: false,
planSelectData: [] /* 营销计划数据 */, addIsType: "",
keyBatchSelectData: [] /* 营销计划ID */ isState: 0,
planSelectData: [] /* 营销计划数据 */,
keyBatchSelectData: [] /* 营销计划ID */
}
} }