Commit 33e9f5a0 authored by XieZhiXiong's avatar XieZhiXiong
parents 35a468f3 54043d96
......@@ -56,7 +56,8 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
}
const handleLinkEdit = () => {
history.push(`/channel/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
window.location.href = `/channel/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`
// history.push(`/channel/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
}
return (
......
......@@ -110,6 +110,7 @@ const Goods: React.FC<{}> = () => {
title: '成单价',
dataIndex: 'costPrice',
key: 'costPrice',
render: text => `¥${text}`
},
{
title: '导入批次',
......
......@@ -108,7 +108,7 @@ const AddProducts: React.FC<{}> = (props) => {
_itme.customerAttribute = {id: _itme.customerAttributeId }
delete _itme.attributeName
delete _itme.isPrice
delete _itme.customerAttributeId
// delete _itme.customerAttributeId
})
let _bacsicForm = {...values[0]}
if(values.length > 0){
......
......@@ -317,33 +317,46 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const constructedPrarams = () => {
let _paramsArray: any[] = [];
// 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 = []
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 = {};
/* 新格式 */
_tempObject.customerAttribute = {
id: attributeObjArr[_index].customerAttributeId,
name: attributeObjArr[_index].attributeName
}
_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]
}
_tempArr.push(_tempObject)
}) : _tempArr.push({
/* 新格式 */
customerAttribute: {
id: attributeObjArr[0].customerAttributeId,
name: attributeObjArr[0].attributeName
},
customerAttributeValue: {
id: attributeValObjArr[0][0].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 */
// ** 可能是单一多选 attributeValObjArr可能为多个
_tempArr.push({
customerAttribute: {
id: attributeObjArr[0].customerAttributeId,
name: attributeObjArr[0].attributeName
},
customerAttributeValue: {
id: attributeValObjArr[0][index].id, // 只有一行属性,多选情况下
value: item.toString()
}
})
) /* 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)
// console.log(_paramsArray,'params')
}
......
......@@ -129,8 +129,8 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
// 遍历 排空
let resultParams = _resultParams.filter((_item: any)=>_item.customerAttributeValueList.length!=0)
// console.log(resultParams,'resultParams') // 最终传输数据
setProductSelectAttribute(resultParams) //......存在数据冗余 导致价格列表属性出错
console.log(resultParams,'resultParams') // 最终传输数据
setProductSelectAttribute(resultParams)
}
/* 编辑情况下,利用商品信息中的属性值转换为结果参数,用于后续表格生成 */
......@@ -144,7 +144,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
isPrice: attributeLists.filter(_item => _item.name === item.customerAttribute.name)[0]?.isPrice
}
})
// console.log(_selectAttributeByEdit, '__selectAttributeByEdit__', attributeLists)
console.log(_selectAttributeByEdit, '__selectAttributeByEdit__', attributeLists)
paramsArray = _selectAttributeByEdit
setProductSelectAttribute(_selectAttributeByEdit)
}
......
......@@ -124,7 +124,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
let _URL = window.URL || window.webkitURL;
let img = new Image();
img.onload = function() {
let valid = img.width < width && img.height < height;
let valid = img.width <= width && img.height <= height;
valid ? resolve() : reject();
};
img.src = _URL.createObjectURL(file);
......
......@@ -93,7 +93,25 @@ const DirectChannel: React.FC<{}> = () => {
title: '价格',
dataIndex: ['channelCommodity', 'commodity', 'min'],
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: '渠道会员角色',
......@@ -101,7 +119,7 @@ const DirectChannel: React.FC<{}> = () => {
key: 'memberRoleName',
},
{
title: '适用会员',
title: '适用渠道',
dataIndex: 'memberName',
key: 'memberName',
},
......
......@@ -100,13 +100,13 @@ const FastModifyPrice: React.FC<{}> = () => {
key: 'min',
render: (text:any, reocrd:any) => {
if(reocrd.priceType === 1){
if(reocrd.min === reocrd.min)
if(reocrd.max === reocrd.min)
return <>{reocrd.min}</>
else
return <>{reocrd.min} ~ ¥{reocrd.max}</>
}
if(reocrd.priceType === 3){
if(reocrd.min === reocrd.min)
if(reocrd.max === reocrd.min)
return <>{reocrd.min}</>
else
return <>{reocrd.min} ~ {reocrd.max}</>
......
......@@ -143,13 +143,13 @@ const Products: React.FC<{}> = () => {
key: 'min',
render: (text:any, reocrd:any) => {
if(reocrd.priceType === 1){
if(reocrd.min === reocrd.min)
if(reocrd.max === reocrd.min)
return <>{reocrd.min}</>
else
return <>{reocrd.min} ~ ¥{reocrd.max}</>
}
if(reocrd.priceType === 3){
if(reocrd.min === reocrd.min)
if(reocrd.max === reocrd.min)
return <>{reocrd.min}</>
else
return <>{reocrd.min} ~ {reocrd.max}</>
......
......@@ -3,7 +3,7 @@ import { Button, Input } from 'antd'
import UploadImage from '@/components/UploadImage'
import { filterPropsFunction, getAdvertType } from '../../../../utils'
import SettingPanel from '../../../../components/SettingPanel'
import { message } from 'antd'
import { message, Modal } from 'antd'
import { isEmpty } from '@formily/antd/esm/shared'
import { PublicApi } from '@/services/api'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core';
......@@ -171,13 +171,26 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
changeNewProps('advertList', newList)
}
const handleCancel = useCallback(() => {
if (JSON.stringify(props) !== JSON.stringify(newProps)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}, [newProps])
const handleConfirmSave = useCallback((e: any) => {
e.preventDefault();
if (JSON.stringify(props) === JSON.stringify(newProps)) {
return
}
setConfirmLoading(true)
saveAdvert(newProps).then(() => {
changeProps({
......@@ -253,6 +266,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave}
>
<div className={styles.advert_setting}>
......
import React, { useState, useEffect } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Form, message } from 'antd'
import { Row, Col, Button, Input, Pagination, Form, message, Modal } from 'antd'
import SettingList from '../../../../components/SettingList'
import BrandItem from './BrandItem'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -161,9 +161,25 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
setSelectList(selectBrandList)
}
const handleCancel = () => {
if (JSON.stringify(brandList) !== JSON.stringify(selectBrandList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()}
>
<div className={styles.goods_setting}>
......
import React, { useState, useEffect, useCallback } from 'react'
import { Checkbox, Row, Col, message } from 'antd'
import { Checkbox, Row, Col, message, Modal } from 'antd'
import UploadImage from '@/components/UploadImage'
import SettingPanel from '../../../../components/SettingPanel'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
......@@ -127,9 +127,25 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
})
}
const handleCancel = useCallback(() => {
if (JSON.stringify(props) !== JSON.stringify(newProps)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}, [newProps])
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave}
>
<div className={styles.category_recommend}>
......
......@@ -18,7 +18,7 @@ const GoodsItem: React.FC<GoodsItemPropsType> = (props) => {
<div className={styles.goods_item_info_name}>{dataInfo.goodsName}</div>
<div className={styles.goods_item_info_price}>
<i></i>
<span>{dataInfo.priceRange}</span>
<span>{dataInfo.priceRange || dataInfo.goodsPrice}</span>
</div>
<div className={styles.goods_item_info_brief}>
<span>品类:</span>
......
import React, { useState, useEffect, useCallback } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Select, Form, message } from 'antd'
import { Row, Col, Button, Input, Pagination, Select, Form, message, Modal } from 'antd'
import SettingList from '../../../../components/SettingList'
import GoodsItem from './GoodsItem'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -129,6 +129,21 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}
}
const handleCancel = () => {
if (JSON.stringify(goodsList) !== JSON.stringify(selectGoodsList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
const handleConfirmSave = () => {
console.log('handleConfirmSave1')
if (JSON.stringify(goodsList) === JSON.stringify(selectGoodsList)) {
......@@ -141,11 +156,22 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}
setConfirmLoading(true)
saveGoods().then(() => {
let newList = JSON.parse(JSON.stringify(selectGoodsList))
newList = newList.map(item => {
let minPrice = 0
if (item.priceRange && typeof item.priceRange === 'string') {
minPrice = item.priceRange.split("~")[0]
item.goodsPrice = minPrice
}
return item
})
changeProps({
props: {
templateid,
categoryid,
goodsList: selectGoodsList
goodsList: newList
}
})
clearSelectedStatus()
......@@ -198,6 +224,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()}
>
<div className={styles.goods_setting}>
......
......@@ -198,7 +198,6 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
...InformationConfig,
...FooterConfig
}
setComponentConfigs(config)
setLoading(false)
}
......
import React, { useState, useEffect } from 'react'
import { history } from 'umi';
import { LayoutOutlined, EyeOutlined, PushpinOutlined } from '@ant-design/icons'
import cx from 'classnames'
import DetailPage from '@/components/DetailPage'
......@@ -57,7 +56,8 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
}
const handleLinkEdit = () => {
history.push(`/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
window.location.href = `/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`
// history.push(`/shop/template/edit?id=${detailInfo.id}&template=${detailInfo.fileName}`)
}
return (
......
......@@ -40,7 +40,7 @@ const Trademark: React.FC<{}> = () => {
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '申请时间',
title: '申请审核时间',
dataIndex: 'applyTime',
key: 'applyTime',
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