Commit 9127cbda authored by GuanHua's avatar GuanHua
parents dd7c9740 54043d96
...@@ -110,6 +110,7 @@ const Goods: React.FC<{}> = () => { ...@@ -110,6 +110,7 @@ const Goods: React.FC<{}> = () => {
title: '成单价', title: '成单价',
dataIndex: 'costPrice', dataIndex: 'costPrice',
key: 'costPrice', key: 'costPrice',
render: text => `¥${text}`
}, },
{ {
title: '导入批次', title: '导入批次',
......
...@@ -108,7 +108,7 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -108,7 +108,7 @@ const AddProducts: React.FC<{}> = (props) => {
_itme.customerAttribute = {id: _itme.customerAttributeId } _itme.customerAttribute = {id: _itme.customerAttributeId }
delete _itme.attributeName delete _itme.attributeName
delete _itme.isPrice delete _itme.isPrice
delete _itme.customerAttributeId // delete _itme.customerAttributeId
}) })
let _bacsicForm = {...values[0]} let _bacsicForm = {...values[0]}
if(values.length > 0){ if(values.length > 0){
......
...@@ -317,33 +317,46 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -317,33 +317,46 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const constructedPrarams = () => { const constructedPrarams = () => {
let _paramsArray: any[] = []; let _paramsArray: any[] = [];
// console.log('生成传输数据', combineAttributeArray, attributeObjArr, attributeValObjArr, tableDataSource) // console.log('生成传输数据', combineAttributeArray, attributeObjArr, attributeValObjArr, tableDataSource)
Array.isArray(combineAttributeArray) ? combineAttributeArray.map((item, index)=>{ // 非数组情况下默认无组合 从table数据中获取 // 当属性减少的时候 这个combine数组还是之前的 Array.isArray(combineAttributeArray) ? combineAttributeArray.map((item, index)=>{ // 非数组情况下默认无组合 从table数据中获取 // 当属性减少的时候 这个combine数组还是之前的 /* code1 */
let _tempArr: any = [] let _tempArr: any = []
Array.isArray(item) ? item.map((_item, _index) => { console.log(item, '0')
Array.isArray(item) ? item.map((_item, _index) => { /* code2 */
console.log(item, _item, '1')
let _tempObject: any = {}; let _tempObject: any = {};
/* 新格式 */
_tempObject.customerAttribute = { _tempObject.customerAttribute = {
id: attributeObjArr[_index].customerAttributeId, id: attributeObjArr[_index].customerAttributeId,
name: attributeObjArr[_index].attributeName name: attributeObjArr[_index].attributeName
} }
_tempObject.customerAttributeValue = { _tempObject.customerAttributeValue = {
id: attributeValObjArr.map(item =>item.find(_ => _.value===_item)).filter(__ => __)[0].id, id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id,
value: item[_index] value: item[_index]
} }
_tempArr.push(_tempObject) _tempArr.push(_tempObject)
}) : _tempArr.push({ }) : ( /* code3 */
/* 新格式 */ // ** 可能是单一多选 attributeValObjArr可能为多个
customerAttribute: { _tempArr.push({
id: attributeObjArr[0].customerAttributeId, customerAttribute: {
name: attributeObjArr[0].attributeName id: attributeObjArr[0].customerAttributeId,
}, name: attributeObjArr[0].attributeName
customerAttributeValue: { },
id: attributeValObjArr[0][0].id, customerAttributeValue: {
value: item.toString() id: attributeValObjArr[0][index].id, // 只有一行属性,多选情况下
} value: item.toString()
}) }
_paramsArray.push({goodsId: _tableDataSource[index] ? _tableDataSource[index]['对应货品'] : 0, attributeAndValueList: _tempArr, unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价']}) /*带上货品id 带上单价*/ })
}) : _paramsArray.push({goodsId: _tableDataSource[0] ? _tableDataSource[0]['对应货品'] : 0, attributeAndValueList: [], unitPrice: _tableDataSource[0]&&_tableDataSource[0]['单价']}) /*带上货品id 带上单价*/ ) /* code3 end */ /* code2 end */
_paramsArray.push({
goodsId: _tableDataSource[index] ? _tableDataSource[index]['对应货品'] : 0,
attributeAndValueList: _tempArr,
unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价']
}) /*带上货品id 带上单价*/
}) : _paramsArray.push({
goodsId: _tableDataSource[0] ? _tableDataSource[0]['对应货品'] : 0,
attributeAndValueList: [],
unitPrice: _tableDataSource[0]&&_tableDataSource[0]['单价']
}) /*带上货品id 带上单价*/ /* code1 end */
setPriceAttributeParams(_paramsArray) setPriceAttributeParams(_paramsArray)
// console.log(_paramsArray,'params') // console.log(_paramsArray,'params')
} }
......
...@@ -129,8 +129,8 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -129,8 +129,8 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
// 遍历 排空 // 遍历 排空
let resultParams = _resultParams.filter((_item: any)=>_item.customerAttributeValueList.length!=0) let resultParams = _resultParams.filter((_item: any)=>_item.customerAttributeValueList.length!=0)
// console.log(resultParams,'resultParams') // 最终传输数据 console.log(resultParams,'resultParams') // 最终传输数据
setProductSelectAttribute(resultParams) //......存在数据冗余 导致价格列表属性出错 setProductSelectAttribute(resultParams)
} }
/* 编辑情况下,利用商品信息中的属性值转换为结果参数,用于后续表格生成 */ /* 编辑情况下,利用商品信息中的属性值转换为结果参数,用于后续表格生成 */
...@@ -144,7 +144,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -144,7 +144,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
isPrice: attributeLists.filter(_item => _item.name === item.customerAttribute.name)[0]?.isPrice isPrice: attributeLists.filter(_item => _item.name === item.customerAttribute.name)[0]?.isPrice
} }
}) })
// console.log(_selectAttributeByEdit, '__selectAttributeByEdit__', attributeLists) console.log(_selectAttributeByEdit, '__selectAttributeByEdit__', attributeLists)
paramsArray = _selectAttributeByEdit paramsArray = _selectAttributeByEdit
setProductSelectAttribute(_selectAttributeByEdit) setProductSelectAttribute(_selectAttributeByEdit)
} }
......
...@@ -124,7 +124,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => { ...@@ -124,7 +124,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
let _URL = window.URL || window.webkitURL; let _URL = window.URL || window.webkitURL;
let img = new Image(); let img = new Image();
img.onload = function() { img.onload = function() {
let valid = img.width < width && img.height < height; let valid = img.width <= width && img.height <= height;
valid ? resolve() : reject(); valid ? resolve() : reject();
}; };
img.src = _URL.createObjectURL(file); img.src = _URL.createObjectURL(file);
......
...@@ -93,7 +93,25 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -93,7 +93,25 @@ const DirectChannel: React.FC<{}> = () => {
title: '价格', title: '价格',
dataIndex: ['channelCommodity', 'commodity', 'min'], dataIndex: ['channelCommodity', 'commodity', 'min'],
key: 'id', key: 'id',
render: (text: any, record: any) => <>{text} ~ ¥{record.channelCommodity.commodity.max}</> render: (text:any, reocrd:any) => {
let min = reocrd.channelCommodity.commodity.min
let type = reocrd.channelCommodity.commodity.priceType
let max = reocrd.channelCommodity.commodity.max
if(type === 1){
if(max === min)
return <>{min}</>
else
return <>{min} ~ ¥{max}</>
}
if(type === 3){
if(max === min)
return <>{min}</>
else
return <>{min} ~ {max}</>
}
if(type === 2)
return null
}
}, },
{ {
title: '渠道会员角色', title: '渠道会员角色',
...@@ -101,7 +119,7 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -101,7 +119,7 @@ const DirectChannel: React.FC<{}> = () => {
key: 'memberRoleName', key: 'memberRoleName',
}, },
{ {
title: '适用会员', title: '适用渠道',
dataIndex: 'memberName', dataIndex: 'memberName',
key: 'memberName', key: 'memberName',
}, },
......
...@@ -100,13 +100,13 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -100,13 +100,13 @@ const FastModifyPrice: React.FC<{}> = () => {
key: 'min', key: 'min',
render: (text:any, reocrd:any) => { render: (text:any, reocrd:any) => {
if(reocrd.priceType === 1){ if(reocrd.priceType === 1){
if(reocrd.min === reocrd.min) if(reocrd.max === reocrd.min)
return <>{reocrd.min}</> return <>{reocrd.min}</>
else else
return <>{reocrd.min} ~ ¥{reocrd.max}</> return <>{reocrd.min} ~ ¥{reocrd.max}</>
} }
if(reocrd.priceType === 3){ if(reocrd.priceType === 3){
if(reocrd.min === reocrd.min) if(reocrd.max === reocrd.min)
return <>{reocrd.min}</> return <>{reocrd.min}</>
else else
return <>{reocrd.min} ~ {reocrd.max}</> return <>{reocrd.min} ~ {reocrd.max}</>
......
...@@ -143,13 +143,13 @@ const Products: React.FC<{}> = () => { ...@@ -143,13 +143,13 @@ const Products: React.FC<{}> = () => {
key: 'min', key: 'min',
render: (text:any, reocrd:any) => { render: (text:any, reocrd:any) => {
if(reocrd.priceType === 1){ if(reocrd.priceType === 1){
if(reocrd.min === reocrd.min) if(reocrd.max === reocrd.min)
return <>{reocrd.min}</> return <>{reocrd.min}</>
else else
return <>{reocrd.min} ~ ¥{reocrd.max}</> return <>{reocrd.min} ~ ¥{reocrd.max}</>
} }
if(reocrd.priceType === 3){ if(reocrd.priceType === 3){
if(reocrd.min === reocrd.min) if(reocrd.max === reocrd.min)
return <>{reocrd.min}</> return <>{reocrd.min}</>
else else
return <>{reocrd.min} ~ {reocrd.max}</> return <>{reocrd.min} ~ {reocrd.max}</>
......
...@@ -40,7 +40,7 @@ const Trademark: React.FC<{}> = () => { ...@@ -40,7 +40,7 @@ const Trademark: React.FC<{}> = () => {
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span> render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
}, },
{ {
title: '申请时间', title: '申请审核时间',
dataIndex: 'applyTime', dataIndex: 'applyTime',
key: 'applyTime', key: 'applyTime',
render: (text: any, record: any) => text && moment(text).format('YYYY-MM-DD HH:mm:ss') render: (text: any, record: any) => text && moment(text).format('YYYY-MM-DD HH:mm:ss')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment