Commit df636ee2 authored by 前端-许佳敏's avatar 前端-许佳敏
parents 4ea328df be10e206
......@@ -36,7 +36,7 @@
"@umijs/test": "^3.2.0",
"bizcharts": "^4.0.7",
"copy-to-clipboard": "^3.3.1",
"god": "0.1.24",
"god": "^0.1.25",
"lingxi-design": "^1.0.7",
"lingxi-design-ui": "^1.0.8",
"lingxi-editor-core": "^1.0.6",
......
......@@ -3,7 +3,7 @@
* @Date: 2020-07-17 18:01:43
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-19 17:24:16
* @LastEditTime: 2020-08-27 18:04:03
*/
/**
* 用于在项目开始前获取所有的配置
......@@ -50,15 +50,7 @@ const serviceConfig = {
// // }
// // }
// }
},
//初始化会员支付策略配置
// payConfig:{
// paymemberConfig:{
// url:'/pay/member/pay/config',
// method: 'get'
// }
// }
}
}
......
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
}
export interface ShopInfo {
id: number;
name: string;
type: number;
environment: number;
logoUrl: string;
describe: string;
state: number;
url: string;
}
export interface Web {
shopInfo: ShopInfo[];
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Global {
siteId: number;
siteUrl: string;
logo: string;
countryList: CountryList[];
}
export interface RootObject {
userRegister: UserRegister;
web: Web;
global: Global;
}
\ No newline at end of file
......@@ -32,6 +32,7 @@ interface InnerAttributeValueList {
}
export interface IProductSelectAttribute {
customerAttribute: { id: number; };
attributeName: string;
customerAttributeId: number;
customerAttributeValueList: InnerAttributeValueList[]
......
......@@ -3,7 +3,7 @@ import { history } from 'umi';
import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
SaveOutlined, EditFilled,
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle'
......@@ -11,14 +11,14 @@ import BasicInfoForm from './addProductsItem/basicInfoForm'
import SelectGoodsForm from './addProductsItem/selectGoodsForm'
import ProductAttributeForm from './addProductsItem/productAttributeForm'
import PriceAttributeForm from './addProductsItem/priceAttributeForm'
import LogisticsForm from './addProductsItem/logisticsForm';
import OtherForm from './addProductsItem/otherForm';
import ProductImageForm from './addProductsItem/productImageForm';
import ProductDescFormOne from './addProductsItem/productDescFormOne';
import LogisticsForm from './addProductsItem/logisticsForm'
import OtherForm from './addProductsItem/otherForm'
import ProductImageForm from './addProductsItem/productImageForm'
import ProductDescFormOne from './addProductsItem/productDescFormOne'
import { inject, observer } from 'mobx-react'
import { store } from '@/store'
import { PublicApi } from '@/services/api';
import { PublicApi } from '@/services/api'
const { TabPane } = Tabs
......@@ -26,6 +26,7 @@ const AddProducts: React.FC<{}> = (props) => {
const [isEnableCheck, setIsEnableCheck] = useState(true)
const [responseId, setReponseId] = useState<number>(null)
const [attributeList, setAttributeList] = useState<any[]>([])
const [clickTabIndex, setClickTabIndex] = useState<string[]>(['1'])
let [formRefs, setFormRefs] = useState([]) //子form的ref数组
const { ProductStore } = store
const {
......@@ -37,7 +38,8 @@ const AddProducts: React.FC<{}> = (props) => {
setAttributeLists,
clearData,
setProductInfoByEdit,
isAllAttributePic
isAllAttributePic,
productInfoByEdit
} = ProductStore
useEffect(()=>{
......@@ -54,15 +56,14 @@ const AddProducts: React.FC<{}> = (props) => {
makeRequest()
}
return ()=>{
return () => {
clearData([])
console.log('添加商品组件卸载')
}
}, [])
const onSave = () => {
// console.log('点击保存')
// console.log(formRefs, 'formrefs')
const { id } = history.location.query
if(formRefs.length > 0){
try{
let data = formRefs.map(async __ => {
......@@ -72,47 +73,22 @@ const AddProducts: React.FC<{}> = (props) => {
})
Promise.all(data).then((values) => {
// 提交的数据进行处理
// console.log(values, productSelectAttribute, productAttributeAndImageParams, '所有数据')
console.log(values, productSelectAttribute, productAttributeAndImageParams, '所有数据')
productSelectAttribute.length>0 && productSelectAttribute.map(_itme => {
delete _itme.attributeName
delete _itme.isPrice
_itme.customerAttribute = {id: _itme.customerAttributeId }
delete _itme.attributeName
delete _itme.isPrice
delete _itme.customerAttributeId
})
try{
if(productAttributeAndImageParams.length>0){
console.log(productAttributeAndImageParams,'____') // 所有属性共用的情况下 item只有第一项有图片
productAttributeAndImageParams.map(_item => {
if(_item.goodsCustomerAttributeList.length>0){
_item.goodsCustomerAttributeList.map(__item => {
delete __item.customerAttributeName
__item.customerAttributeValueId = __item.id
})
}
if(_item.commodityPic.length>0){
// 编辑情况下兼顾手动添加图片列表属性
_item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url)
}else{
if(isAllAttributePic && productAttributeAndImageParams[0].commodityPic.length>0) //处理所有属性共用
_item.commodityPic = productAttributeAndImageParams[0].commodityPic
else
throw new Error('每项请至少上传一张商品图片!')
}
})
}
else{
throw new Error('每项请至少上传一张商品图片!')
}
}catch(e){
return e
}
let _bacsicForm = {...values[0]}
_bacsicForm.customerCategoryId = _bacsicForm.customerCategoryId[_bacsicForm.customerCategoryId.length-1]
let _params = {
..._bacsicForm,
...values[2],
..._bacsicForm,
...values[2],
logistics: {...values[3]},
...values[4],
commodityAttributeList: productSelectAttribute,
unitPriceAndPicList: productAttributeAndImageParams,
...values[4],
commodityAttributeList: productSelectAttribute,
// unitPriceAndPicList: productAttributeAndImageParams,
commodityRemark: productDescription,
isAllAttributePic: isAllAttributePic,
}
......@@ -130,7 +106,6 @@ const AddProducts: React.FC<{}> = (props) => {
// 增加不限市区字段
cobj?.code ? _temp.isAllCity = false : _temp.isAllCity = true
_commodityAreaList.push(_temp)
// console.log(_itme, _temp, '地址的每一项')
}
})
// 增加不限区域字段
......@@ -141,9 +116,67 @@ const AddProducts: React.FC<{}> = (props) => {
_params.isAllArea = true
delete _params.commodityAreaList
}
const { id } = history.location.query
_params.id = id ? id : null
console.log(_params,'_params')
// 处理商品价格和图片
/** 没有点击tab项做修改处理时 */
// 如果没有点击商品图片第"5"项 不做校验
if(clickTabIndex.indexOf("5") !== -1){
try{
if(productAttributeAndImageParams.length>0){
productAttributeAndImageParams.map(_item => {
if(_item.goodsCustomerAttributeList.length>0){
_item.goodsCustomerAttributeList.map(__item => {
delete __item.customerAttributeName
// __item.customerAttributeValueId = __item.id
// **** 新字段结构变更
__item.customerAttribute = { id: __item.customerAttributeId }
__item.customerAttributeValue = { id: __item.id, value: __item.value }
delete __item.id
delete __item.value
delete __item.customerAttributeId
})
}
if(_item.commodityPic.length>0){
// 编辑情况下兼顾手动添加图片列表属性
_item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url)
}else{
if(isAllAttributePic && productAttributeAndImageParams[0].commodityPic.length>0) //处理所有属性共用
_item.commodityPic = productAttributeAndImageParams[0].commodityPic
else
throw new Error('每项请至少上传一张商品图片!')
}
})
}
else{
throw new Error('每项请至少上传一张商品图片!')
}
}catch(e){
return e
}
_params.unitPriceAndPicList = productAttributeAndImageParams
}else{
_params.unitPriceAndPicList = productInfoByEdit.unitPriceAndPicList
}
if(clickTabIndex.indexOf("3")===-1)
_params.commodityAttributeList = productInfoByEdit.commodityAttributeList
if(clickTabIndex.indexOf("4")===-1){
_params.unitId = productInfoByEdit.unitId
_params.unitName = productInfoByEdit.unitName
_params.minOrder = productInfoByEdit.minOrder
_params.priceType = productInfoByEdit.priceType
_params.isMemberPrice = productInfoByEdit.isMemberPrice
}
if(clickTabIndex.indexOf("6")===-1)
_params.commodityRemark = productInfoByEdit.commodityRemark
if(clickTabIndex.indexOf("7")===-1)
_params.logistics = productInfoByEdit.logistics
if(clickTabIndex.indexOf("8")===-1){
_params.isInvoice = productInfoByEdit.isInvoice
_params.marks = productInfoByEdit.marks
_params.packing = productInfoByEdit.packing
_params.afterService = productInfoByEdit.afterService
}
console.log(_params, 'params')
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
if(res.code === 1000){
setIsEnableCheck(false)
......@@ -174,7 +207,7 @@ const AddProducts: React.FC<{}> = (props) => {
}
const callback = (key: any) => {
console.log(key)
setClickTabIndex([...clickTabIndex, key])
}
return (<PageHeaderWrapper
......@@ -191,7 +224,7 @@ const AddProducts: React.FC<{}> = (props) => {
<Card>
<Tabs onChange={callback} type="card" defaultActiveKey="1">
<TabPane tab="基本信息" key="1">
<BasicInfoForm
<BasicInfoForm
onRef={(refs)=>setFormRefs([...formRefs, refs])}
onChangeAttributeList={(_lists: any)=>setAttributeList(_lists)} />
</TabPane>
......
......@@ -119,6 +119,10 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
{
required: true,
message: '请正确输入重量',
},
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '重量数值小数点后仅限三位',
}
]}
noStyle
......
......@@ -61,7 +61,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
clearData,
setPriceAttributeParams,
productInfoByEdit,
getPriceAttributeFormParamsByEdit
getPriceAttributeFormParamsByEdit,
} = ProductStore
_tableDataSource = useMemo(() => tableDataSource, [tableDataSource]) // 保持最新值
......@@ -593,7 +593,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
]}
>
<InputNumber style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" />
<InputNumber min={0} style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" />
</Form.Item>
<Input
style={{
......@@ -620,6 +620,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
]}
>
<InputNumber
min={0}
className={styles.siteInputRight}
style={{
width: 100,
......@@ -647,7 +648,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
]}
>
<InputNumber style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" />
<InputNumber min={0} style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" />
</Item>
</Col>
<Col span={4}>
......
......@@ -58,7 +58,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
*/
const onChange = (value, attrItem) => {
let params = { customerAttributeId: attrItem.id, attributeName: attrItem.name, isPrice: attrItem.isPrice, customerAttributeValueList: [] }
console.log(params, 'params')
console.log(params, attributesData, 'params')
if(attrItem.type!==3){
for(let item of attrItem?.customerAttributeValueList){
if(value?.length){
......
......@@ -50,9 +50,10 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
/* 给数据添加图片字段 */
useEffect(()=>{
console.log('图片111', priceAttributeParams)
let _priceAttributeParams: any = []
if(productInfoByEdit?.id){ // id判断是否新增还是编辑
console.log(123456789)
console.log('图片222', priceAttributeParams)
setSetImageType(productInfoByEdit.isAllAttributePic)
setIsAllAttributePic(productInfoByEdit.isAllAttributePic)
let _commodityPicList = productInfoByEdit.unitPriceAndPicList.map(_ => _.commodityPic)
......@@ -86,7 +87,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
// }
setPriceAttributeParamsByRender(_priceAttributeParams)
setProductAttributeAndImageParams(_priceAttributeParams)
console.log(_priceAttributeParams, '_p')
console.log(_priceAttributeParams, priceAttributeParams, '_p')
// 初始化若是按所有属性共用做显示处理
if(setImageType){
setCommonImageList(_priceAttributeParams[0].commodityPic)
......
......@@ -26,8 +26,8 @@ export interface Iprops {
const SelectGoodsForm: React.FC<Iprops> = (props) => {
const [selectGoodsForm] = Form.useForm()
const [showSelectGoods, setIsSelectGoods] = useState(false)
const [isChecked, setIsChecked] = useState(false)
const [showSelectGoods, setIsSelectGoods] = useState<boolean>(false)
const [isChecked, setIsChecked] = useState<boolean>(true)
const [selectGoodsRow, setSelectGoodsRow] = useState<GetProductGoodsGetGoodsListResponseDetail[]>([]) // 模态框选择的行数据
const [selectedGoodsRowKeys, setSelectedGoodsRowKeys] = useState<Array<number>>([])
const { ProductStore } = store
......@@ -47,7 +47,6 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
//@ts-ignore
setSelectedGoodsRowKeys(goodsArr.map(__=>__.id))
ProductStore.setSelectedGoods(goodsArr)
// console.log(_goodsArr, goodsArr, 'goodArr')
}
}
}, [productInfoByEdit])
......@@ -114,7 +113,6 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
ProductStore.setSelectedGoods(selectedRows)
setSelectGoodsRow(selectedRows);
setSelectedGoodsRowKeys(selectedRowKeys);
// console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
......@@ -132,12 +130,15 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
<Checkbox checked={isChecked} onChange={onSelectGoodsChange}>选择货品</Checkbox>
</Form.Item>
</Form>
{showSelectGoods && <StandardTable
columns={goodsColumns}
rowSelection={rowSelection}
tableProps={{ rowKey: "id" }}
fetchTableData={(params: any) => fetchData(params)}
/>}
{/* {
showSelectGoods && */}
<StandardTable
columns={goodsColumns}
rowSelection={rowSelection}
tableProps={{ rowKey: "id" }}
fetchTableData={(params: any) => fetchData(params)}
/>
{/* } */}
</>)
}
......
......@@ -78,6 +78,7 @@ const Products: React.FC<{}> = () => {
const [brandValue, setBrandValue] = useState(undefined)
const [classData, setClassData] = useState<any>([])
const [classValue, setClassValue] = useState(undefined)
const [shopId, setShopId] = useState<number>()
const columns: ColumnType<any>[] = [
{
......@@ -441,7 +442,8 @@ const Products: React.FC<{}> = () => {
const onChangeUpShop = (values) => {
// 判断上架之前是否有店铺 有即可以上下架
PublicApi.getTemplateShopFindShop().then(res => {
if(res.data.logo){
if(res.data.shopId){
setShopId(res.data.shopId)
setCheckedValues(values)
}else{
message.error('您还没有开通店铺,无法上下架商品!')
......@@ -466,7 +468,7 @@ const Products: React.FC<{}> = () => {
shopList: checkedValues
}
if(isUp)
PublicApi.postProductCommodityPublishCommodity(params).then(res => {
PublicApi.postProductCommodityPublishCommodity({storeId: shopId, ...params}).then(res => {
setUpDownModal(false)
ref.current.reload()
setIsDisabledOKbtn(false)
......@@ -828,14 +830,14 @@ const Products: React.FC<{}> = () => {
<Form.Item label={
<span>
请选择需要{isUp ? '上架' : '下架'}的商城&nbsp;
<Tooltip title="这是一段描述?">
<Tooltip title="已上架的商城为已勾选的商城,不可选择,只可以选择未勾选的商城。">
<QuestionCircleOutlined />
</Tooltip>
</span>}>
<Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop} value={checkedValues}>
<Row>
{
Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col key={index} span={6}>
Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col key={index} span={8}>
<Checkbox value={item}>{item.name}</Checkbox>
</Col>)
}
......
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PublicApi } from '@/services/api';
// 渠道商品列表高级搜索
......@@ -196,96 +197,159 @@ export const channelSchema: ISchema = {
// 添加渠道商品模态框高级筛选
export const addChannelSchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
properties: {
name: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '商品名称',
align: 'flex-left',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
},
properties: {
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '商品名称',
},
},
colStyle: {
marginTop: 20,
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
justifyContent: 'flex-start'
},
colStyle: {
marginLeft: 20,
},
properties: {
categoryId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
}
},
properties: {
brandId: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品牌',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
searchValue: null,
dataoption: [],
},
},
customerCategoryId: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品类',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
searchValue: null,
dataoption: []
},
},
parentMemberId: {
type: 'string',
enum: [
{
label: '渠道1',
value: 1,
},
{
label: '渠道2',
value: 2,
},
],
'x-component-props': {
placeholder: '上级渠道',
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
brandId: {
type: 'string',
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
style: {
width: 160
}
}
},
parentMemberId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '上级渠道',
style: {
width: 160
}
},
},
},
},
},
},
submit: {
"x-component": 'Submit',
"x-mega-props": {
span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
// type: 'object',
// properties: {
// mageLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// properties: {
// topLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// grid: true,
// },
// properties: {
// name: {
// type: 'string',
// 'x-component': 'Search',
// 'x-component-props': {
// placeholder: '商品名称',
// },
// },
// },
// },
// [FORM_FILTER_PATH]: {
// type: 'object',
// 'x-component': 'flex-layout',
// 'x-component-props': {
// rowStyle: {
// flexWrap: 'nowrap',
// justifyContent: 'flex-start'
// },
// colStyle: {
// marginLeft: 20,
// },
// },
// properties: {
// brandId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品牌',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// customerCategoryId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品类',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// parentMemberId: {
// type: 'string',
// enum: [],
// 'x-component-props': {
// placeholder: '上级渠道',
// },
// },
// submit: {
// 'x-component': 'Submit',
// 'x-mega-props': {
// span: 1,
// },
// 'x-component-props': {
// children: '查询',
// },
// },
// },
// },
// },
// },
// },
}
\ No newline at end of file
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import { history } from 'umi'
import { Card, Space, Radio, Row, Col, Descriptions, Table, Avatar } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
......@@ -9,9 +9,93 @@ import {
import { ColumnType } from 'antd/lib/table/interface'
import ReutrnEle from '@/components/ReturnEle'
import styles from "./index.less"
import { PublicApi } from '@/services/api'
import { GetProductChannelCommodityGetChannelCommodityResponse } from '@/services'
const ViewDriectChannel: React.FC<{}> = () => {
const [memberType, setMemberType] = useState(1)
const [channelDetails, setChannelDetails] = useState<GetProductChannelCommodityGetChannelCommodityResponse>()
const [priceTableData, setPriceTableData] = useState<any[]>([])
const [priceTableDataColumn, setPrcieTableColumn] = useState<any[]>([])
useEffect(() => {
const { id } = history.location.query
PublicApi.getProductChannelCommodityGetChannelCommodity({id: id}).then(res => {
const { data } = res
setChannelDetails(data)
constructTable(data)
})
}, [])
const constructTable = (param: GetProductChannelCommodityGetChannelCommodityResponse) => {
const { unitPriceAndPicList, priceType } = param
if(unitPriceAndPicList.length > 0){
let col: any = []
let temp: any = []
unitPriceAndPicList[0].attributeAndValueList.map(_item => {
temp.push({title: _item.customerAttribute.name, dataIndex: [_item.customerAttribute.name, 'value'], key: _item.customerAttribute.name})
})
col.push({
title: 'ID',
dataIndex: 'id',
key: 'id'
},
{
title: 'GoodsId',
dataIndex: 'goodsId',
key: 'id',
className: 'commonHide'
},
{
title: '索引',
dataIndex: '索引',
key: '索引',
className: 'commonHide'
},
{
title: '商品名称',
dataIndex: '商品名称',
key: '商品名称'
},
{
title: '对应货品',
dataIndex: '对应货品',
key: '对应货品'
},
...temp,
{
title: priceType === 3 ? '积分' : '单价',
dataIndex: '单价',
key: '单价',
render: (text, record) => {
if (!text || JSON.stringify(text)==='{}') return null
return Object.keys(text).map((v, i) => {
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{text[v]}</span></span><br /></>
})
}
})
setPrcieTableColumn(col)
// 构建table 数据Data
let _tableData: any = []
unitPriceAndPicList.map((item, index) => {
let temp: any = {}
item.attributeAndValueList.map(_item => {
temp[_item.customerAttribute.name] = {value: _item.customerAttributeValue.value, vId: _item.customerAttributeValue.id, id: _item.customerAttribute.id }
})
_tableData.push({
"id": item.id, // 行数据id
"goodsId": item.goods.id, // 货品ID
"索引": index,
"商品名称": param.name,
"对应货品": item.goods.name,
...temp,
"单价": item.unitPrice
})
})
console.log(col, 'col', _tableData)
setPriceTableData(_tableData)
}
}
const dataSourcePrice = [
{
......@@ -123,19 +207,30 @@ const ViewDriectChannel: React.FC<{}> = () => {
},
]
const renderStatus = (status: any) => {
if(status === 5)
return <span className={styles.pruductStatus}>已上架</span>
if(status === 6)
return <span style={{padding:'2px 5px',background:'rgba(244,245,247,1)',borderRadius:'4px'}}>已下架</span>
if(status === 4)
return <span style={{color:'#E63F3B',padding:'2px 5px',background:'rgba(255,235,230,1)',borderRadius:'4px'}}>未上架</span>
}
const content = <>
<Descriptions colon={true}>
<Descriptions.Item label="商品状态"><span className={styles.pruductStatus}>已上架</span></Descriptions.Item>
<Descriptions.Item label="上级渠道">经销5S店</Descriptions.Item>
<Descriptions.Item label="上架商城"><Avatar size="small" icon={<UserOutlined />} />&nbsp;<Avatar size="small" icon={<UserOutlined />} /></Descriptions.Item>
<Descriptions.Item label="商品品类">牛皮</Descriptions.Item>
<Descriptions.Item label="商品品牌">APPLE</Descriptions.Item>
<Descriptions.Item label="单位"></Descriptions.Item>
<Descriptions.Item label="商品ID">10086</Descriptions.Item>
</Descriptions>
</>
<Descriptions colon={true} style={{marginTop:50}}>
<Descriptions.Item label="商品状态">{renderStatus(channelDetails?.status)}</Descriptions.Item>
<Descriptions.Item label="上级渠道">经销5S店</Descriptions.Item>
<Descriptions.Item label="上架商城">
{
channelDetails?.commodityShopList?.length>0 && channelDetails.commodityShopList.map((item, index)=><span key={index}>{item.name}&nbsp;</span>)
}
</Descriptions.Item>
<Descriptions.Item label="商品品类">{channelDetails?.customerCategory?.fullName}</Descriptions.Item>
<Descriptions.Item label="商品品牌">{channelDetails?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="单位">{channelDetails?.unitName}</Descriptions.Item>
<Descriptions.Item label="商品ID">{channelDetails?.id}</Descriptions.Item>
</Descriptions>
</>
return (
<PageHeaderWrapper
......@@ -146,9 +241,9 @@ const ViewDriectChannel: React.FC<{}> = () => {
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="商品信息">
<p>
<Avatar size={48} shape="square" src="https://avatars1.githubusercontent.com/u/8186664?s=460&v=4" />
<span style={{color:'rgba(23,43,77,1)',fontSize:20,fontWeight:500,marginLeft:16}}>进口头层牛皮荔枝纹</span>
<span style={{color:'#E63F3B',padding:'2px 5px',background:'rgba(255,235,230,1)',borderRadius:'4px',marginLeft:16,marginRight:16}}>上级渠道</span>
<Avatar size={48} shape="square" src={channelDetails?.unitPriceAndPicList[0]?.commodityPic && channelDetails.unitPriceAndPicList[0].commodityPic[0]} />
<span style={{color:'rgba(23,43,77,1)',fontSize:20,fontWeight:500,marginLeft:16}}>{channelDetails?.name}</span>
<span style={{color:'#E63F3B',padding:'2px 5px',background:'rgba(255,235,230,1)',borderRadius:'4px',marginLeft:16,marginRight:16}}>{channelDetails?.source === 1 ? "上级渠道" : "渠道自有"}</span>
<a>去查看 &gt;</a>
</p>
{content}
......@@ -156,7 +251,15 @@ const ViewDriectChannel: React.FC<{}> = () => {
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="单价设置">
<Table dataSource={dataSourcePrice} columns={columnsPrice} pagination={false} />
<Row>
<Col span={3}>
<p>会员折扣:</p>
</Col>
<Col span={21}>
<p>{channelDetails?.isMemberPrice ? '允许使用会员折扣价购买' : '不允许使用会员折扣价购买'}</p>
</Col>
</Row>
<Table dataSource={priceTableData} columns={priceTableDataColumn} pagination={false} />
</Card>
</Space>
<Space direction="vertical" style={{width:'100%'}}>
......@@ -166,10 +269,10 @@ const ViewDriectChannel: React.FC<{}> = () => {
<p>使用渠道会员:</p>
</Col>
<Col span={21}>
<p>{memberType ? <Radio checked>指定渠道会员</Radio> : <Radio checked>所有渠道会员(默认)</Radio>}</p>
<p>{channelDetails?.isAllMember ? '所有渠道会员(默认)': '指定渠道会员'}</p>
</Col>
</Row>
{memberType ? <Table dataSource={dataMember} columns={columnsMember} /> : ''}
{channelDetails?.isAllMember ? '' : <Table dataSource={dataMember} columns={columnsMember} />}
</Card>
</Space>
</PageHeaderWrapper>
......
/*
* @Author: LeeJiancong
* @Date: 2020-08-27 16:27:53
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-08-27 16:34:59
*/
import { ColumnType } from 'antd/lib/table/interface'
export const equiryColumns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'memberId',
align: 'center',
key: 'memberId',
},
{
title: '商品规格型号',
dataIndex: 'name',
key: 'name',
align: 'left'
},
{
title: '品牌',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '颜色',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '尺码',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '面料',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '产地',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '单位',
dataIndex: 'levelTag',
key: 'levelTag',
align: 'center'
},
{
title: '采购数量',
dataIndex: 'levelTag',
key: 'levelTag',
align: 'center'
}
]
export const dockingList: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'memberId',
align: 'center',
key: 'memberId',
},
{
title: '公司名称',
dataIndex: 'name',
key: 'name',
align: 'left'
},
{
title: '公司地址',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '成立日期',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '公司规模',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '诚信度',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '是否归属会员',
dataIndex: 'roleName',
key: 'roleName',
align: 'center'
},
{
title: '状态',
dataIndex: 'levelTag',
key: 'levelTag',
align: 'center'
},
{
title: '操作',
dataIndex: 'levelTag',
key: 'levelTag',
align: 'center'
}
]
......@@ -142,6 +142,7 @@ class ProductStore implements IProductModule {
public setIsAllAttributePic(data: boolean) {
this.isAllAttributePic = data
}
}
......
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