Commit 33e9f5a0 authored by XieZhiXiong's avatar XieZhiXiong
parents 35a468f3 54043d96
...@@ -56,7 +56,8 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => { ...@@ -56,7 +56,8 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
} }
const handleLinkEdit = () => { 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 ( return (
......
...@@ -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}</>
......
...@@ -3,7 +3,7 @@ import { Button, Input } from 'antd' ...@@ -3,7 +3,7 @@ import { Button, Input } from 'antd'
import UploadImage from '@/components/UploadImage' import UploadImage from '@/components/UploadImage'
import { filterPropsFunction, getAdvertType } from '../../../../utils' import { filterPropsFunction, getAdvertType } from '../../../../utils'
import SettingPanel from '../../../../components/SettingPanel' import SettingPanel from '../../../../components/SettingPanel'
import { message } from 'antd' import { message, Modal } from 'antd'
import { isEmpty } from '@formily/antd/esm/shared' import { isEmpty } from '@formily/antd/esm/shared'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'; import { clearSelectedStatus, changeProps } from 'lingxi-editor-core';
...@@ -171,13 +171,26 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref) ...@@ -171,13 +171,26 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
changeNewProps('advertList', newList) 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) => { const handleConfirmSave = useCallback((e: any) => {
e.preventDefault(); e.preventDefault();
if (JSON.stringify(props) === JSON.stringify(newProps)) { if (JSON.stringify(props) === JSON.stringify(newProps)) {
return return
} }
setConfirmLoading(true) setConfirmLoading(true)
saveAdvert(newProps).then(() => { saveAdvert(newProps).then(() => {
changeProps({ changeProps({
...@@ -253,6 +266,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref) ...@@ -253,6 +266,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
return ( return (
<SettingPanel <SettingPanel
confirmLoading={confirmLoading} confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave} onOK={handleConfirmSave}
> >
<div className={styles.advert_setting}> <div className={styles.advert_setting}>
......
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core' 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 SettingList from '../../../../components/SettingList'
import BrandItem from './BrandItem' import BrandItem from './BrandItem'
import SettingPanel from '../../../../components/SettingPanel' import SettingPanel from '../../../../components/SettingPanel'
...@@ -161,9 +161,25 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => { ...@@ -161,9 +161,25 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
setSelectList(selectBrandList) setSelectList(selectBrandList)
} }
const handleCancel = () => {
if (JSON.stringify(brandList) !== JSON.stringify(selectBrandList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
return ( return (
<SettingPanel <SettingPanel
confirmLoading={confirmLoading} confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()} onOK={() => handleConfirm()}
> >
<div className={styles.goods_setting}> <div className={styles.goods_setting}>
......
import React, { useState, useEffect, useCallback } from 'react' 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 UploadImage from '@/components/UploadImage'
import SettingPanel from '../../../../components/SettingPanel' import SettingPanel from '../../../../components/SettingPanel'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core' import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
...@@ -127,9 +127,25 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p ...@@ -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 ( return (
<SettingPanel <SettingPanel
confirmLoading={confirmLoading} confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave} onOK={handleConfirmSave}
> >
<div className={styles.category_recommend}> <div className={styles.category_recommend}>
......
...@@ -18,7 +18,7 @@ const GoodsItem: React.FC<GoodsItemPropsType> = (props) => { ...@@ -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_name}>{dataInfo.goodsName}</div>
<div className={styles.goods_item_info_price}> <div className={styles.goods_item_info_price}>
<i></i> <i></i>
<span>{dataInfo.priceRange}</span> <span>{dataInfo.priceRange || dataInfo.goodsPrice}</span>
</div> </div>
<div className={styles.goods_item_info_brief}> <div className={styles.goods_item_info_brief}>
<span>品类:</span> <span>品类:</span>
......
import React, { useState, useEffect, useCallback } from 'react' import React, { useState, useEffect, useCallback } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core' 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 SettingList from '../../../../components/SettingList'
import GoodsItem from './GoodsItem' import GoodsItem from './GoodsItem'
import SettingPanel from '../../../../components/SettingPanel' import SettingPanel from '../../../../components/SettingPanel'
...@@ -129,6 +129,21 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -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 = () => { const handleConfirmSave = () => {
console.log('handleConfirmSave1') console.log('handleConfirmSave1')
if (JSON.stringify(goodsList) === JSON.stringify(selectGoodsList)) { if (JSON.stringify(goodsList) === JSON.stringify(selectGoodsList)) {
...@@ -141,11 +156,22 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -141,11 +156,22 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
} }
setConfirmLoading(true) setConfirmLoading(true)
saveGoods().then(() => { 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({ changeProps({
props: { props: {
templateid, templateid,
categoryid, categoryid,
goodsList: selectGoodsList goodsList: newList
} }
}) })
clearSelectedStatus() clearSelectedStatus()
...@@ -198,6 +224,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => { ...@@ -198,6 +224,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
return ( return (
<SettingPanel <SettingPanel
confirmLoading={confirmLoading} confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()} onOK={() => handleConfirm()}
> >
<div className={styles.goods_setting}> <div className={styles.goods_setting}>
......
...@@ -198,7 +198,6 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => { ...@@ -198,7 +198,6 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
...InformationConfig, ...InformationConfig,
...FooterConfig ...FooterConfig
} }
setComponentConfigs(config) setComponentConfigs(config)
setLoading(false) setLoading(false)
} }
......
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import { history } from 'umi';
import { LayoutOutlined, EyeOutlined, PushpinOutlined } from '@ant-design/icons' import { LayoutOutlined, EyeOutlined, PushpinOutlined } from '@ant-design/icons'
import cx from 'classnames' import cx from 'classnames'
import DetailPage from '@/components/DetailPage' import DetailPage from '@/components/DetailPage'
...@@ -57,7 +56,8 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => { ...@@ -57,7 +56,8 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
} }
const handleLinkEdit = () => { 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 ( return (
......
...@@ -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