兑换码列表新增字段并转译 修复立减金不能提交BUG

This commit is contained in:
wangsongsole 2022-05-19 15:33:50 +08:00
parent 2921d09dd1
commit 92b93fe66b
3 changed files with 47 additions and 29 deletions

View File

@ -38,7 +38,7 @@ import {
putCodes, putCodes,
putCodesBatch putCodesBatch
} from '../../../assets/api.js' } from '../../../assets/api.js'
import _ from 'lodash' import _, { isArray } from 'lodash'
import Productform from '../product/add' import Productform from '../product/add'
import KnockGold from '../../plan/knockGold/' /* 立减金 */ import KnockGold from '../../plan/knockGold/' /* 立减金 */
@ -619,7 +619,7 @@ export default class exchangedit extends React.Component {
data = JSON.parse(sessionStorage.getItem('knockGoldData')) data = JSON.parse(sessionStorage.getItem('knockGoldData'))
temp = _.map(data, (item) => { temp = _.map(data, (item) => {
let index = this.state.tempdata.findIndex((o) => { let index = this.state.tempdata.findIndex((o) => {
return o.product_id === item.uuid return o.batch_number === item.batch_number
}) })
if (index > -1) { if (index > -1) {
@ -629,15 +629,14 @@ export default class exchangedit extends React.Component {
/* 转换商品结构 */ /* 转换商品结构 */
// temp // temp
return { return {
product_id: item.uuid,
product_name: item.batch_goods_name, //名字 product_name: item.batch_goods_name, //名字
cost_price: '', batch_number: item.batch_number, //批次号
type: 'knockGold', //类型
upstream: item.channel === '1' ? '支付宝' : '微信', //上游
effectDate: item.entry_time[0] + '至' + item.entry_time[1], //有效时间
contract_price: item.contract_price, //单价 contract_price: item.contract_price, //单价
official_price: item.denomination, //官方价 official_price: item.denomination, //官方价
quantity: (item.all_budget / item.denomination).toFixed(0), //总库存 quantity: (item.all_budget / item.denomination).toFixed(0), //总库存
stock: '',
usage: '',
type: 'knockGold',
edit: 'edit' edit: 'edit'
} }
}) })
@ -646,7 +645,7 @@ export default class exchangedit extends React.Component {
let arr = [] let arr = []
_.map(temp.concat(this.state.tempdata), (res) => { _.map(temp.concat(this.state.tempdata), (res) => {
let obj = {} let obj = {}
obj.key = res.product_id obj.key = res.batch_number
obj.text = res.product_name obj.text = res.product_name
arr.push(obj) arr.push(obj)
return obj return obj
@ -655,7 +654,7 @@ export default class exchangedit extends React.Component {
this.setState({ rankoptions: arr }) this.setState({ rankoptions: arr })
} }
let newArray = temp.concat(this.state.tempdata) let newArray = temp.concat(this.state.tempdata)
newArray = deWeightThree(newArray, 'product_id') newArray = deWeightThree(newArray, 'batch_number')
this.setState({ tempdata: newArray }) this.setState({ tempdata: newArray })
}, 500) }, 500)
} }
@ -872,7 +871,7 @@ export default class exchangedit extends React.Component {
if (rowData.type === 'knockGold') { if (rowData.type === 'knockGold') {
const temp = JSON.parse(sessionStorage.getItem('knockGoldData')) const temp = JSON.parse(sessionStorage.getItem('knockGoldData'))
const editData = temp.filter( const editData = temp.filter(
(item) => item.uuid === rowData.product_id (item) => item.batch_number === rowData.batch_number
) )
this.setState({ this.setState({
@ -920,6 +919,13 @@ export default class exchangedit extends React.Component {
width: 'auto', width: 'auto',
type: 'normal' type: 'normal'
}, },
{
title: '立减金平台批次号',
width: '200px',
prop: 'batch_number',
name: 'batch_number',
type: 'normal'
},
{ {
title: '商品名称', title: '商品名称',
width: 'auto', width: 'auto',
@ -927,6 +933,28 @@ export default class exchangedit extends React.Component {
name: 'product_name', name: 'product_name',
type: 'slot' type: 'slot'
}, },
{
title: '类型',
width: 'auto',
prop: 'type',
name: 'type',
type: 'slot'
},
{
title: '上游平台',
width: 'auto',
prop: 'upstream',
name: 'upstream',
type: 'normal'
},
{
title: '有效时间段',
width: '250px',
prop: 'effectDate',
name: 'effectDate',
type: 'normal'
},
{ {
title: '当前成本价格', title: '当前成本价格',
prop: 'cost_price', prop: 'cost_price',
@ -935,7 +963,7 @@ export default class exchangedit extends React.Component {
type: 'normal' type: 'normal'
}, },
{ {
title: '合同价', title: '合同价',
name: 'contract_price', name: 'contract_price',
prop: 'contract_price', prop: 'contract_price',
type: 'slot', type: 'slot',
@ -1163,6 +1191,13 @@ export default class exchangedit extends React.Component {
/> />
) )
} }
if (com == 'type') {
return (
<>
{rowData.type === 'knockGold' ? '立减金' : '商品'}
</>
)
}
if (com == 'quantity') { if (com == 'quantity') {
return ( return (
<Input <Input

View File

@ -147,7 +147,7 @@ export default class addKnockGold extends Component {
} }
} else { } else {
/* 校验表单 */ /* 校验表单 */
if (!this.limitFunction()) { if (this.limitFunction() === false) {
return false return false
} }
// //

View File

@ -80,21 +80,4 @@ export default {
} }
] ]
} }
// quantity: [
// { type: 'required', message: '请输入商品库存' },
// {
// type: 'regExp',
// message: '请输入小于100万的整数',
// reg: '^(?!0)(?:[0-9]{1,6}|1000000)$'
// }
// ],
// contract_price: [
// { type: 'required', message: '请输入合同价' },
// {
// type: 'regExp',
// message: '最多保留4位小数',
// reg: '^[0-9]+(.[0-9]{1,4})?$'
// }
// ],
// product_name: [{ type: 'required', message: '请输入商品名称' }]
} }