Commit b11907b5 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 2e81de20 d89556ff
......@@ -38,10 +38,23 @@ const AfterServiceRoute = {
},
{
// 待提交换货申请单新增或修改
path: '/memberCenter/afterService/exchange/waitSubmitOrderList/:type',
path: '/memberCenter/afterService/exchange/waitSubmitOrderList/add',
name: 'waitSubmitOrderList',
hideInMenu: true,
component: '@/pages/afterService/exchangeGoods/waitSubmitOrderList/detail'
},
{
// 待提交换货申请单新增或修改
path: '/memberCenter/afterService/exchange/waitSubmitOrderList/edit',
name: 'waitSubmitOrderList',
hideInMenu: true,
component: '@/pages/afterService/exchangeGoods/waitSubmitOrderList/detail'
},
{
// 待提交换货申请单新增或修改
path: '/memberCenter/afterService/exchange/waitSubmitOrderList/detail',
name: 'waitSubmitOrderList',
hideInMenu: true,
noMargin: true,
component: '@/pages/afterService/exchangeGoods/waitSubmitOrderList/detail'
},
{
......
......@@ -19,7 +19,8 @@
"test": "umi-test",
"test:coverage": "umi-test --coverage",
"start:cross": "cross-env SITE_ID=352 yarn start",
"start:url": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-all.wg.shushangyun.com yarn start"
"start:url": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-all.wg.shushangyun.com yarn start",
"start:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 yarn start"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
......
......@@ -11,6 +11,7 @@ const SmilingFace: React.FC<SmilingFaceProps> = ({
let node = null;
switch (value) {
case 0:
case 1:
case 2: {
node = (
......
......@@ -68,7 +68,6 @@ registerVirtualBox('controller-group', (_props) => {
// 左右两列布局
registerVirtualBox('LeftRightLayout', (_props) => {
console.log('_props', _props)
const { children, props } = _props;
const leftItems = children.filter(
child => child.props.schema['x-component-props'] && child.props.schema['x-component-props'].position === 'left'
......
......@@ -5,7 +5,7 @@ import { CaretDownOutlined } from '@ant-design/icons'
export interface TableOperationProps {
record: any,
statusOperationMap: any, // 所有状态和操作名称的映射
operationHandler: any, // 所有的操作句柄
operationHandler: any, // 所有的操作句柄函数
priorityOperationName?: string, // 优先靠前的操作名称
}
......@@ -16,27 +16,22 @@ const TableOperation:React.FC<TableOperationProps> = (props) => {
const [operationName, setOperationName] = useState<string[]>([])
useEffect(() => {
// let maps = statusOperationMap[record.status]
// if(maps.length > 2){
// setOperationName(() => statusOperationMap[record.status].filter(_ => _ != priorityOperationName))
// }else{
// }
setOperationName(() => statusOperationMap[record.status])
}, [])
let maps = statusOperationMap[record.status]
if(maps.length > 2 && priorityOperationName && maps.includes(priorityOperationName)){
let temp = maps.filter(_ => _ != priorityOperationName)
temp.unshift(priorityOperationName)
setOperationName(temp)
}else{
setOperationName(() => statusOperationMap[record.status])
}
}, [record])
return ( <>
{
operationName.length > 2
?
<>
{/* {
priorityOperationName
?
<Button type='link' onClick={operationHandler[priorityOperationName]}>{priorityOperationName}</Button>
: */}
<Button type='link' onClick={operationHandler[operationName[0]]}>{operationName[0]}</Button>
{/* } */}
<Button type='link' onClick={operationHandler[operationName[0]]}>{operationName[0]}</Button>
<Dropdown overlay={
<Menu>
{
......
......@@ -28,6 +28,8 @@ const OrderDetail: React.FC<OrderDetailProps> = (props) => {
return '提交换货申请单'
case 'edit':
return '编辑换货申请单'
case 'detail':
return '查看详情'
default:
return ''
}
......
......@@ -52,6 +52,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const [minOrderNumber, setMinOrderNumber] = useState<number>()
const [isBatchSetting, setIsBatchSetting] = useState<boolean>(false) //是否点击批量设置
const flagRef = useRef<boolean>(false)
const [isChangePriceType, setIsChangePriceType] = useState<boolean>(false) // 价格类型是否有变动
const [colums, setColumns] = useState<ColumnType<any>[]>()
const { ProductStore } = store
......@@ -309,12 +310,15 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_tableDataSource = _tableData
// 有前面tab变动引起的二次构建 需要清空价格数据
if(updateFlag.current){
// ***** bug编辑积分商品(非现货价格)会导致价格类型变动引发重复渲染 *****
updateFlag.current = false
} else {
// ***** 编辑情况下且是积分商品 不做清空单价处理 *****
if(!(productInfoByEdit?.id && planPrice === 3))
// if(!(history.location.query?.id && planPrice === 3)){
// _tableDataSource.map(item => item['单价'] = {})
// }
if(isChangePriceType){ // 价格类型变动 清空价格
_tableDataSource.map(item => item['单价'] = {})
}
}
setTableDataSource(productName ? _tableDataSource : []) // 通过商品名称来判断是否显示表格数据
......@@ -418,6 +422,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
setPriceForm.resetFields()
setLadderPrice(false)
setPlanPrice(v.target.value)
setIsChangePriceType(true)
console.log('价格类型变动')
}
const setPriceOk = () => {
......
......@@ -168,7 +168,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => {
}
<div className={styles.descriptBox}>
<div className={styles.middleAddBtn}>
<ImgCrop rotate>
{/* <ImgCrop rotate> */}
<Upload {...uploadImgProps}>
<Button size="small" type="text">
<PlusOutlined />
......@@ -176,7 +176,7 @@ const ProductDescFormDefualt: React.FC<{}> = (props) => {
<br/>
<span>添加图片</span>
</Upload>
</ImgCrop>
{/* </ImgCrop> */}
</div>
</div>
</Spin>
......
......@@ -20,7 +20,7 @@ import styles from "./index.less"
import { PublicApi } from '@/services/api'
import { GetProductCommodityGetShopResponse } from '@/services/ProductApi'
import TableOperation from './TableOperation'
import TableOperation from '@/components/TableOperation'
import { store } from '@/store'
......@@ -258,14 +258,12 @@ const Products: React.FC<{}> = () => {
}
return (
<>
<TableOperation
record={record}
statusOperationMap={statusAndOperationList}
operationHandler={operationHandler}
priorityOperationName="提交审核"
<TableOperation
record={record}
statusOperationMap={statusAndOperationList}
operationHandler={operationHandler}
priorityOperationName="提交审核"
/>
</>
)
}
......
......@@ -20,7 +20,7 @@ const SearchForm = (props) => {
onFieldValueChange$('pagination').subscribe((state) => {
console.log("pagination")
// handleSearch({...state.value})
handleSubmit({...state.value})
})
!!effects && effects();
}
......
......@@ -23,6 +23,7 @@ const tableSchema = {
"columns": columns,
"rowKey": "id",
"pagination":false,
// loading: true,
"rowSelection": "{{rowSelection}}"
}
},
......@@ -62,8 +63,8 @@ const ProcessProducts = ({visible, cancel, actions, ...restProps}) => {
// const status = actions.getFieldValue('status'); // 状态
const postData = {
name: name || '',
current: 1,
pageSize: 10,
...paginationParams,
...params
}
fetchData(postData).then((data) => {
setTableStatus({dataSource:data.data, totalCount: data.totalCount})
......
/*
* @Author: Bill
* @Date: 2020-10-14 18:45:31
* @LastEditTime: 2020-10-16 17:39:55
* @LastEditTime: 2020-10-19 09:56:52
* @desc 选择加工商品schema
* 这里其实就是两个flex 布局加一个table, 通过expressScrope 注入代码
*/
......
......@@ -12,7 +12,7 @@ import { useLocalStore, observer } from 'mobx-react'
import { store } from '@/store'
import { PublicApi } from '@/services/api'
import { LAYOUT_TYPE } from '@/constants'
import { GetSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import { PostSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import bannerImg from '@/assets/imgs/banner_2.png'
import arrowDownIcon from '@/assets/imgs/arrow_down.png'
import arrowDownActiveIcon from '@/assets/imgs/arrow_down_active.png'
......@@ -55,7 +55,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
const { query: { categoryId, categoryName, brandId, brandName, priceType } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [showType, setShowType] = useState<number>(1) // 展示方式:1:矩阵排列; 2:列表排列
const [commodityList, setCommodityList] = useState<GetSearchShopEnterpriseGetCommodityListResponseDetail[]>([])
const [commodityList, setCommodityList] = useState<PostSearchShopEnterpriseGetCommodityListResponseDetail[]>([])
const [current, setCurrent] = useState<number>(1)
const [pageSize] = useState<number>(20)
const [totalCount, setTotalCount] = useState<number>(0)
......@@ -121,25 +121,25 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
let headers = {}
switch (layoutType) {
case LAYOUT_TYPE.mall:
getFn = PublicApi.getSearchShopEnterpriseGetCommodityList
getFn = PublicApi.postSearchShopEnterpriseGetCommodityList
break
case LAYOUT_TYPE.shop:
param.storeId = shopId
getFn = PublicApi.getSearchShopStoreGetCommodityList
getFn = PublicApi.postSearchShopStoreGetCommodityList
break
case LAYOUT_TYPE.channel:
param.channelMemberId = memberId
headers = {
type: 3
}
getFn = PublicApi.getSearchShopChannelGetCommodityList
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
param.channelMemberId = memberId
headers = {
type: 4
}
getFn = PublicApi.getSearchShopChannelGetCommodityList
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
}
......@@ -147,6 +147,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
getFn && getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
message.destroy()
setCommodityList(res.data.data)
setTotalCount(res.data.totalCount)
}
......
......@@ -2,20 +2,20 @@ import React from 'react'
import cx from 'classnames'
import { Skeleton } from 'antd'
import { LAYOUT_TYPE } from '@/constants'
import { GetSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import { PostSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import { priceFormat, numFormat } from '@/utils/numberFomat'
import creditIcon from '@/assets/imgs/credit_icon.png'
import styles from './list.less'
interface CommodityListPropsType {
showType: number;
commodityList: GetSearchShopEnterpriseGetCommodityListResponseDetail[]
commodityList: PostSearchShopEnterpriseGetCommodityListResponseDetail[]
layoutType: LAYOUT_TYPE
}
const CommodityList: React.FC<CommodityListPropsType> = (props) => {
const { showType, commodityList = [], layoutType = LAYOUT_TYPE.mall } = props
const renderPrice = (commodityItem: GetSearchShopEnterpriseGetCommodityListResponseDetail) => {
const renderPrice = (commodityItem: PostSearchShopEnterpriseGetCommodityListResponseDetail) => {
switch (commodityItem.priceType) {
// 现货价格
case 1:
......
import React, { useRef } from 'react'
import React, { useRef, useState, useEffect } from 'react'
import { Carousel } from 'antd'
import { LeftOutlined, RightOutlined } from '@ant-design/icons'
import cx from 'classnames'
import { COMMODITY_TYPE } from '@/constants'
import { COMMODITY_TYPE, LAYOUT_TYPE } from '@/constants'
import { priceFormat, numFormat } from '@/utils/numberFomat'
import ImageBox from '@/components/ImageBox'
import styles from './index.less'
interface BrowseRecordsPropsType {
priceType: COMMODITY_TYPE
priceType: COMMODITY_TYPE,
dataList: any,
layoutType: LAYOUT_TYPE,
}
const BrowseRecords: React.FC<BrowseRecordsPropsType> = (props) => {
const { priceType } = props
const actionRef = useRef<any>()
const { priceType, dataList, layoutType } = props
const [list, setList] = useState<any>([])
const product_list = [
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
price: '19.00'
},
]
const actionRef = useRef<any>()
const arrGroup = (array, subGroupLength) => {
let index = 0;
......@@ -45,9 +28,29 @@ const BrowseRecords: React.FC<BrowseRecordsPropsType> = (props) => {
return newArray;
}
const new_product_list = arrGroup(product_list, 3)
useEffect(() => {
if (dataList) {
setList(arrGroup(dataList, 3))
}
}, [dataList])
return priceType ? (
const getCommodityDetailLink = (item) => {
let link = ""
switch (layoutType) {
case LAYOUT_TYPE.channel:
link = `/channelmall/commodity/detail?id=${item.id}&type=${item.priceType}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
case LAYOUT_TYPE.ichannel:
link = `/ichannelmall/commodity/detail?id=${item.id}&type=${item.priceType}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
default:
link = `/shop/commodity/detail?id=${item.id}&type=${item.priceType}&shopId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
}
return link
}
return (priceType && list.length > 0) ? (
<div className={styles.browse_records}>
<div className={styles.browse_records_title}>
<span className={styles.browse_records_title_line}></span>
......@@ -57,19 +60,20 @@ const BrowseRecords: React.FC<BrowseRecordsPropsType> = (props) => {
<div className={styles.carousel_wrap}>
<Carousel ref={actionRef}>
{
new_product_list.map((item, index) => (
list && list.map((item, index) => (
<div key={`product_list_${index}`} className={styles.browse_records_product_list}>
{
item.map((childItem, childIndex) => (
<div key={`browse_records_product_list_item_${childIndex}`} className={styles.browse_records_product_list_item}>
<div className={styles.product_img_box}>
<img src={childItem.imgUrl} />
</div>
{
priceType === COMMODITY_TYPE.integral ? <div className={cx(styles.product_price, styles.integral)}>2,000~3,000积分</div> :
<div className={styles.product_price}>{childItem.price}</div>
}
<a href={getCommodityDetailLink(childItem)} title={childItem.name} target="_blank">
<div className={styles.product_img_box}>
<ImageBox width={110} height={110} imgUrl={childItem.mainPic} direction="column" />
</div>
{
priceType === COMMODITY_TYPE.integral ? <div className={cx(styles.product_price, styles.integral)}>{numFormat(childItem.min)}~{numFormat(childItem.max)}积分</div> :
<div className={styles.product_price}>{priceFormat(childItem.min)}</div>
}
</a>
</div>
))
}
......@@ -77,8 +81,14 @@ const BrowseRecords: React.FC<BrowseRecordsPropsType> = (props) => {
))
}
</Carousel>
<LeftOutlined className={cx(styles.common_arrow_btn, styles.prev)} onClick={() => actionRef.current.prev()} />
<RightOutlined className={cx(styles.common_arrow_btn, styles.next)} onClick={() => actionRef.current.next()} />
{
list.length > 1 && (
<>
<LeftOutlined className={cx(styles.common_arrow_btn, styles.prev)} onClick={() => actionRef.current.prev()} />
<RightOutlined className={cx(styles.common_arrow_btn, styles.next)} onClick={() => actionRef.current.next()} />
</>
)
}
</div>
</div>
) : null
......
.comment {
margin-top: 20px;
margin-bottom: 20px;
.comment_title {
height: 40px;
......
.introduction {
margin-bottom: 20px;
.introduction_list {
display: flex;
......
.recommand {
margin-top: 20px;
margin-bottom: 20px;
.recommand_title {
height: 40px;
......
import React from 'react'
import { LAYOUT_TYPE } from '@/constants'
import ImageBox from '@/components/ImageBox'
import styles from './index.less'
const Recommand: React.FC = () => {
interface RecommandPropsTyep {
dataList: any,
layoutType?: LAYOUT_TYPE
}
const Recommand: React.FC<RecommandPropsTyep> = (props) => {
const { dataList, layoutType } = props
const product_list = [
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
]
const getCommodityDetailLink = (item) => {
let link = ""
switch (layoutType) {
case LAYOUT_TYPE.channel:
link = `/channelmall/commodity/detail?id=${item.id}&type=${item.priceType}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
case LAYOUT_TYPE.ichannel:
link = `/ichannelmall/commodity/detail?id=${item.id}&type=${item.priceType}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
default:
link = `/shop/commodity/detail?id=${item.id}&type=${item.priceType}&shopId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
}
return link
}
return (
return (dataList && dataList.length > 0) && (
<div className={styles.recommand}>
<div className={styles.recommand_title}>买家还在看</div>
<div className={styles.recommand_list}>
{
product_list.map((item, index) => (
<a href="/shop/commodity/detail?id=asdjflewjfe&type=prompt" key={`recommand_list_item_${index}`}>
dataList && dataList.map((item, index) => (
<a href={getCommodityDetailLink(item)} key={`recommand_list_item_${index}`}>
<div className={styles.recommand_list_item}>
<div className={styles.recommand_list_item_img}>
<img src={item.imgUrl} />
<ImageBox width={184} height={184} imgUrl={item.mainPic} direction="column" />
</div>
<div className={styles.recommand_list_item_name}>{item.name}</div>
<div className={styles.recommand_list_item_price}>
<span></span>
{item.price}
{item.min}
</div>
</div>
</a>
......
.trade_record {
margin-top: 20px;
margin-bottom: 20px;
.trade_record_title {
height: 40px;
......
......@@ -12,11 +12,12 @@ import styles from './index.less'
const { Link } = Anchor
interface ProductDescriptionPropsType {
commodityDetail: GetSearchShopStoreGetCommodityDetailResponse
commodityDetail: GetSearchShopStoreGetCommodityDetailResponse,
dataList: any,
}
const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
const { commodityDetail } = props
const { commodityDetail, dataList } = props
const [currentAnchor, setCurrentAnchor] = useState<string>("#introduction")
const handleAnchorChange = (currentActiveLink: string) => {
......@@ -40,7 +41,7 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
<Introduction commodityDetail={commodityDetail} />
<TradeRecord />
<Comment />
<Recommand />
<Recommand dataList={dataList} {...props} />
</div>
)
}
......
......@@ -71,6 +71,8 @@ const CommodityDetail = (props) => {
const [buyCount, setBuyCount] = useState<number>(1)
const [purchaseCount, setPurchaseCount] = useState<number>(0)
const [payWayList, setPayWayList] = useState([])
const [commonCategoryCommodityList, setCommonCategoryCommodityList] = useState([])
let clickFlag = true
useEffect(() => {
......@@ -78,6 +80,75 @@ const CommodityDetail = (props) => {
}, [])
/**
* 获取”买家还在看“商品列表
* @param categoryId
* @param priceType
*/
const fetchCommonCategoryCommodityList = (categoryId: number, priceType: number) => {
let param: any = {
current: 1,
pageSize: 10,
categoryId
}
let headers = {}
let getListFn
switch (layoutType) {
case LAYOUT_TYPE.shop:
switch (priceType) {
case COMMODITY_TYPE.prompt:
getListFn = PublicApi.postSearchShopEnterpriseGetCommodityList
break
case COMMODITY_TYPE.inquiry:
getListFn = PublicApi.postSearchShopScoreGetCommodityList
break
case COMMODITY_TYPE.integral:
break
default:
break
}
break;
case LAYOUT_TYPE.channel:
if (priceType === COMMODITY_TYPE.prompt) {
param.channelMemberId = memberId
headers = {
type: 3
}
} else {
param.channelMemberId = memberId
param.priceType = 3
headers = {
type: 3
}
}
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
if (priceType === COMMODITY_TYPE.prompt) {
param.channelMemberId = memberId
headers = {
type: 4
}
} else {
param.channelMemberId = memberId
param.priceType = 3
headers = {
type: 4
}
}
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
default:
break;
}
getListFn && getListFn(param, { headers }).then(res => {
if (res.code === 1000) {
message.destroy()
setCommonCategoryCommodityList(res.data.data)
}
})
}
/**
* 获取商品详情
*/
const fetchDetail = () => {
......@@ -109,10 +180,14 @@ const CommodityDetail = (props) => {
getDetailFn && getDetailFn(params, { headers }).then(res => {
if (res.code === 1000) {
// res.data.priceType = 3
setCommodityDetail(res.data)
initAttributeAndValueList(res.data)
getPayWayListByMemberId(res.data?.memberId)
if (res.data.customerCategory.category) {
fetchCommonCategoryCommodityList(res.data.customerCategory.category.id, res.data.priceType)
}
if (getAuth() && res.data?.isMemberPrice) {
getMemberCredit(res.data?.memberId, res.data?.memberRoleId)
}
......@@ -122,7 +197,7 @@ const CommodityDetail = (props) => {
/**
* 获取供货商的支付方式
* @param memberId
* @param memberId
*/
const getPayWayListByMemberId = (memberId: number) => {
if (!memberId) {
......@@ -842,7 +917,7 @@ const CommodityDetail = (props) => {
</div>
</div>
</div>
<BrowseRecords priceType={commodityDetail?.priceType} />
<BrowseRecords priceType={commodityDetail?.priceType} dataList={commonCategoryCommodityList} {...props} />
</div>
<div className={styles.commodity_detail_body}>
<div className={styles.commodity_detail_body_left}>
......@@ -852,7 +927,7 @@ const CommodityDetail = (props) => {
<Interested priceType={commodityDetail?.priceType} />
</div>
<div className={styles.commodity_detail_body_right}>
<ProductDescription commodityDetail={commodityDetail} />
<ProductDescription commodityDetail={commodityDetail} dataList={commonCategoryCommodityList} {...props} />
</div>
</div>
</div>
......@@ -876,7 +951,7 @@ const CommodityDetail = (props) => {
<div className={cx(styles.add_success_btn, styles.primary)} onClick={() => history.push(getPurchaseOrderLink())}>去结算</div>
<div className={styles.add_success_btn} onClick={() => setAddSuccessVisible(false)}>继续购物</div>
</div>
<InterestedCommodity />
<InterestedCommodity dataList={commonCategoryCommodityList} {...props} />
</DialogModal>
</div>
)
......
......@@ -19,7 +19,7 @@
top: 0;
left: 0;
z-index: 999;
border-bottom: 1px solid var(--mall_main_color);
// border-bottom: 1px solid var(--mall_main_color);
padding-top: 0;
transition: all .5s;
......
......@@ -19,11 +19,32 @@ const Header: React.FC<HeaderPropsType> = (props) => {
const [count, setCount] = useState<number>(0)
const { search } = history.location.query
let handleScroll = () => {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const floatSearch = document.getElementById("floatSearch")
if (scrollTop > 500) {
if (!hasClass(floatSearch.classList, 'show')) {
floatSearch.classList.add(styles.show)
}
} else {
if (hasClass(floatSearch.classList, 'show')) {
floatSearch.classList.remove(styles.show)
}
}
}
const hasClass = (list, className) => {
let result = false
list && list.forEach(item => {
if (item && item.indexOf(className) > -1) {
result = true
}
})
return result
}
useEffect(() => {
// setTimeout(() => {
// let floatSearch = document.getElementById("floatSearch")
// floatSearch.classList.add(styles.show)
// }, 4000);
window.addEventListener('scroll', handleScroll)
}, [])
useEffect(() => {
......
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, Fragment } from 'react'
import { PublicApi } from '@/services/api'
import { GetManageContentColumnAllResponse } from '@/services/PassApi'
import ImageBox from '@/components/ImageBox'
......@@ -123,10 +123,10 @@ const Information: React.FC<InformationPropsType> = (props) => {
<div className={styles.information_list_item_body}>
{
(leadLeftNews && leadLeftNews.length > 0) && leadLeftNews.map((item, index) => index <= 3 && (
<>
<Fragment key={`news_list_item_left_${item.id}`}>
{
index === 0 ? (
<a href={toDetailLink(item.id)} key={`information_recommand_${item.id}`}>
<a href={toDetailLink(item.id)} >
<div className={styles.information_recommand}>
<div className={styles.information_recommand_img}>
<ImageBox width={220} height={146} imgUrl={item.imageUrl} />
......@@ -139,7 +139,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
</div>
</a>
) : (
<a href={toDetailLink(item.id)} key={`news_list_item_${item.id}`}>
<a href={toDetailLink(item.id)}>
<div className={styles.news_list_item}>
<div className={styles.news_list_item_title}>{item.title}</div>
<div className={styles.news_list_item_date}>{(moment(item.createTime).format('YYYY-MM-DD HH:mm:ss'))}</div>
......@@ -147,7 +147,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
</a>
)
}
</>
</Fragment>
))
}
</div>
......@@ -156,10 +156,10 @@ const Information: React.FC<InformationPropsType> = (props) => {
<div className={styles.information_list_item_body}>
{
(leadRightNews && leadRightNews.length > 0) && leadRightNews.map((item, index) => index <= 3 && (
<>
<Fragment key={`information_recommand_right_${item.id}`}>
{
index === 0 ? (
<a href={toDetailLink(item.id)} key={`information_recommand_${index}`}>
<a href={toDetailLink(item.id)} >
<div className={styles.information_recommand}>
<div className={styles.information_recommand_img}>
<ImageBox width={220} height={146} imgUrl={item.imageUrl} />
......@@ -172,7 +172,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
</div>
</a>
) : (
<a href={toDetailLink(item.id)} key={`news_list_item_${index}`}>
<a href={toDetailLink(item.id)}>
<div className={styles.news_list_item}>
<div className={styles.news_list_item_title}>{item.title}</div>
<div className={styles.news_list_item_date}>{(moment(item.createTime).format('YYYY-MM-DD HH:mm:ss'))}</div>
......@@ -180,7 +180,7 @@ const Information: React.FC<InformationPropsType> = (props) => {
</a>
)
}
</>
</Fragment>
))
}
</div>
......
......@@ -59,7 +59,7 @@
margin-top: 5px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
overflow: hidden;
-webkit-box-orient: vertical;
......
import React from 'react'
import React, { useState, useEffect } from 'react'
import { LeftOutlined, RightOutlined } from '@ant-design/icons'
import cx from 'classnames'
import ImageBox from '@/components/ImageBox'
import { LAYOUT_TYPE } from '@/constants'
import { priceFormat } from '@/utils/numberFomat'
import styles from './index.less'
import url from '*.svg'
const InterestedCommodity: React.FC = () => {
interface InterestedCommodityPropsType {
dataList: any,
layoutType?: LAYOUT_TYPE
}
const InterestedCommodity: React.FC<InterestedCommodityPropsType> = (props) => {
const { dataList, layoutType } = props
const [list, setList] = useState<any>([])
const arrGroup = (array, subGroupLength) => {
let index = 0;
let newArray = [];
while (index < array.length) {
newArray.push(array.slice(index, index += subGroupLength));
}
return newArray;
}
useEffect(() => {
if (dataList) {
setList(arrGroup(dataList, 5))
}
}, [dataList])
let mockList = []
for (let i = 0; i < 5; i++) {
mockList.push({
url: "https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1.jpg",
name: '0.8-1.0mm黑色手纹硬度适中偏软偏软偏软',
price: '79.00'
})
const getCommodityDetailLink = (item) => {
let link = ""
switch (layoutType) {
case LAYOUT_TYPE.channel:
link = `/channelmall/commodity/detail?id=${item.id}&type=${item.priceType}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
case LAYOUT_TYPE.ichannel:
link = `/ichannelmall/commodity/detail?id=${item.id}&type=${item.priceType}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
default:
link = `/shop/commodity/detail?id=${item.id}&type=${item.priceType}&shopId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
}
return link
}
return (
<div className={styles.interested_commodity}>
<div className={styles.interested_commodity_title}>
<span>您可能也感兴趣:</span>
<div className={styles.interested_commodity_pagination}>
{/* <div className={styles.interested_commodity_pagination}>
<div className={cx(styles.interested_commodity_pagination_btn, styles.disabled)}><LeftOutlined /></div>
<div className={cx(styles.interested_commodity_pagination_btn)}><RightOutlined /></div>
</div>
</div> */}
</div>
<div className={styles.interested_commodity_list}>
{
mockList.map(item => (
<div className={styles.interested_commodity_list_item}>
<div className={styles.interested_commodity_list_item_imgbox}>
<div className={styles.interested_commodity_list_item_imgbox_img} style={{ backgroundImage: `url(${item.url})` }}></div>
</div>
<div className={styles.interested_commodity_list_item_name}>{item.name}</div>
<div className={styles.interested_commodity_list_item_price}>
<i></i>
{item.price}
</div>
dataList && dataList.map((item, index) => index < 5 && (
<div className={styles.interested_commodity_list_item} key={`interested_commodity_list_item_${item.id}`}>
<a href={getCommodityDetailLink(item)} target="_blank">
<div className={styles.interested_commodity_list_item_imgbox}>
<ImageBox width={100} height={100} imgUrl={item.mainPic} direction="column" />
</div>
<div className={styles.interested_commodity_list_item_name}>{item.name}</div>
<div className={styles.interested_commodity_list_item_price}>
<i></i>
{priceFormat(item.min)}
</div>
</a>
</div>
))
}
</div>
</div>
)
......
import React from 'react'
import './index.less'
const Recommand: React.FC = () => {
const product_list = [
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
},
{
imgUrl: 'https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-6.jpg',
name: '0.8-1.0mm黑色手折纹胎水牛皮黄牛头层自然摔纹硬度适中偏软…',
price: '19.00'
import React, { useEffect, useState } from 'react'
import { PublicApi } from '@/services/api'
import ImageBox from '@/components/ImageBox'
import { inject, observer } from 'mobx-react'
import { message } from 'antd'
import { LAYOUT_TYPE } from '@/constants'
import { priceFormat } from '@/utils/numberFomat'
import styles from './index.less'
interface RecommandPropsType {
SiteStore?: any,
layoutType: LAYOUT_TYPE,
categoryIds: number[], // 商品品类集合
loading: boolean,
memberId?: number
}
const Recommand: React.FC<RecommandPropsType> = (props) => {
const { mallTemplateId } = props.SiteStore
const { layoutType, categoryIds, loading, memberId } = props
const [list, setList] = useState<any>([])
useEffect(() => {
if (loading) {
if (categoryIds && categoryIds.length > 0) {
getCommodityListByCategoryIds()
} else {
getCategoryComponents()
}
}
}, [loading])
const getCommodityListByCategoryIds = async () => {
let result = []
for (let id of categoryIds) {
let resList: any = await getListById(id)
result = [...result, ...resList]
if (result && result.length >= 5) {
setList(result)
break
}
}
if (result.length <= 0) {
getCategoryComponents()
}
}
const changeDataKey = (data) => {
return data.map(item => {
item.id = item.goodsId
item.mainPic = item.goodsPicUrl
item.name = item.goodsName
item.min = item.goodsPrice
item.storeId = item.shopId
return item
})
}
const getListById = (categoryId: number) => {
return new Promise((resolve) => {
let param: any = {
current: 1,
pageSize: 5,
categoryId
}
let headers = {}
let getListFn
switch (layoutType) {
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
param.channelMemberId = memberId
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
param.channelMemberId = memberId
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
default:
getListFn = PublicApi.postSearchShopEnterpriseGetCommodityList
break
}
getListFn && getListFn(param, { headers }).then(res => {
if (res.code === 1000) {
message.destroy()
resolve(res.data.data)
}
})
})
}
/**
* 获取所有一级品类信息
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplatePlatformFindAllFirstCategory().then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
/**
* 获取一级品类详细信息
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param = {
templateId: mallTemplateId,
categoryId
}
// @ts-ignore
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
const getCategoryComponents = async () => {
let firstCategory: any = await fetchFirstCategory()
let categoryDetail: any = await fetchCategoryById(firstCategory[0].id)
setList(changeDataKey(categoryDetail.goodsBOList))
}
const getCommodityDetailLink = (item) => {
let link = ""
switch (layoutType) {
case LAYOUT_TYPE.channel:
link = `/channelmall/commodity/detail?id=${item.id}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
case LAYOUT_TYPE.ichannel:
link = `/ichannelmall/commodity/detail?id=${item.id}&channelId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
default:
link = `/shop/commodity/detail?id=${item.id}&shopId=${btoa(JSON.stringify({ shopId: item.storeId, memberId: item.memberId }))}`
break
}
]
return link
}
return (
<div className="recommand">
<div className="recommand_title">买家还在看</div>
<div className="recommand_list">
<div className={styles.recommand}>
<div className={styles.recommand_title}>买家还在看</div>
<div className={styles.recommand_list}>
{
product_list.map((item, index) => (
<a href="/" key={`recommand_list_item_${index}`}>
<div className="recommand_list_item">
<div className="recommand_list_item_img">
<img src={item.imgUrl} />
list && list.map((item, index) => index < 5 && (
<a href={getCommodityDetailLink(item)} key={`recommand_list_item_${index}`} target="_blank">
<div className={styles.recommand_list_item}>
<div className={styles.recommand_list_item_img}>
<ImageBox width={224} height={224} imgUrl={item.mainPic} direction="column" />
</div>
<div className="recommand_list_item_price">
<div className={styles.recommand_list_item_price}>
<span></span>
{item.price}
{priceFormat(item.min)}
</div>
<div className="recommand_list_item_name">{item.name}</div>
<div className={styles.recommand_list_item_name}>{item.name}</div>
</div>
</a>
))
......@@ -56,4 +173,4 @@ const Recommand: React.FC = () => {
)
}
export default Recommand
export default inject('SiteStore')(observer(Recommand))
......@@ -96,39 +96,41 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
let firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id)
result.push(
<FloorLine
linkUrl={`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
anchor={`floorline_${item.id}`}
key={item.id}
title={item.name}
>
<FloorLine.Horizontal>
<FloorLine.Category
linkUrl={`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
subLinkUrl={`/commodity`}
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
secondCategoryList={categoryDetail.categoryBOList}
/>
<FloorLine.Vertical>
<FloorLine.FloorHeader
shopNum={categoryDetail.shopNum}
goodsNum={categoryDetail.goodsNum}
if (item.id) {
let categoryDetail: any = await fetchCategoryById(item.id)
result.push(
<FloorLine
linkUrl={`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
anchor={`floorline_${item.id}`}
key={item.id}
title={item.name}
>
<FloorLine.Horizontal>
<FloorLine.Category
linkUrl={`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
shopsLinkUrl={`/shops?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
>
<FloorLine.Banner advertList={categoryDetail.thirdAdvertList} />
</FloorLine.FloorHeader>
<FloorLine.Horizontal>
<FloorLine.Goods goodsList={categoryDetail.goodsBOList} linkUrl={`/shop/commodity/detail`} />
<FloorLine.Shops shopsList={categoryDetail.shopBOList} linkUrl={`/shop`} />
</FloorLine.Horizontal>
</FloorLine.Vertical>
</FloorLine.Horizontal>
<FloorLine.Brand brandList={categoryDetail.brandBOList} linkUrl='/commodity' />
</FloorLine>
)
subLinkUrl={`/commodity`}
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
secondCategoryList={categoryDetail.categoryBOList}
/>
<FloorLine.Vertical>
<FloorLine.FloorHeader
shopNum={categoryDetail.shopNum}
goodsNum={categoryDetail.goodsNum}
linkUrl={`/commodity?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
shopsLinkUrl={`/shops?categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
>
<FloorLine.Banner advertList={categoryDetail.thirdAdvertList} />
</FloorLine.FloorHeader>
<FloorLine.Horizontal>
<FloorLine.Goods goodsList={categoryDetail.goodsBOList} linkUrl={`/shop/commodity/detail`} />
<FloorLine.Shops shopsList={categoryDetail.shopBOList} linkUrl={`/shop`} />
</FloorLine.Horizontal>
</FloorLine.Vertical>
</FloorLine.Horizontal>
<FloorLine.Brand brandList={categoryDetail.brandBOList} linkUrl='/commodity' />
</FloorLine>
)
}
}
setCategoryComponents(result)
}
......
......@@ -6,13 +6,13 @@ import { Pagination } from 'antd'
import CommodityList from './list'
import SearchNoResult from '../components/SearchNoResult'
import isEmpty from 'lodash/isEmpty'
import { Spin } from 'antd'
import { Spin, message } from 'antd'
import { useLocalStore, observer } from 'mobx-react'
import { store } from '@/store'
import { PublicApi } from '@/services/api'
import { LAYOUT_TYPE } from '@/constants'
import cx from 'classnames'
import { GetSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import { PostSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import bannerImg from '@/assets/imgs/banner_2.png'
import styles from './index.less'
......@@ -48,7 +48,7 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
const { query: { categoryId, categoryName } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [showType, setShowType] = useState<number>(1) // 展示方式:1:矩阵排列; 2:列表排列
const [commodityList, setCommodityList] = useState<GetSearchShopEnterpriseGetCommodityListResponseDetail[]>([])
const [commodityList, setCommodityList] = useState<PostSearchShopEnterpriseGetCommodityListResponseDetail[]>([])
const [current, setCurrent] = useState<number>(1)
const [pageSize] = useState<number>(20)
const [totalCount, setTotalCount] = useState<number>(0)
......@@ -82,11 +82,8 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
}
setLoading(true)
let headers = {}
let getFn = PublicApi.getSearchShopScoreGetCommodityList
let getFn
switch (layoutType) {
case LAYOUT_TYPE.shop:
param.storeId = shopId
break
case LAYOUT_TYPE.channel:
case LAYOUT_TYPE.ichannel:
headers = {
......@@ -94,7 +91,10 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
}
param.channelMemberId = memberId
param.priceType = 3
getFn = PublicApi.getSearchShopChannelGetCommodityList
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
default:
getFn = PublicApi.postSearchShopScoreGetCommodityList
break
}
......@@ -102,6 +102,7 @@ const PointsMall: React.FC<CommodityPropsType> = (props) => {
getFn(param, { headers }).then(res => {
setLoading(false)
if (res.code === 1000) {
message.destroy()
setCommodityList(res.data.data)
setTotalCount(res.data.totalCount)
}
......
......@@ -8,6 +8,7 @@ import styles from './index.less'
import { PublicApi } from '@/services/api'
import { priceFormat, numFormat } from "@/utils/numberFomat"
import { useLocalStore, observer } from 'mobx-react'
import ImageBox from '@/components/ImageBox'
import { store } from '@/store'
import { LAYOUT_TYPE } from '@/constants'
import { GetSearchShopPurchaseGetPurchaseListResponse } from '@/services/SearchApi'
......@@ -30,12 +31,20 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
const [checkedList, setCheckedList] = useState([])
const [orderList, setOrderList] = useState([])
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [categoryIds, setCategoryIds] = useState<any>()
const [loading, setLoading] = useState<boolean>(false)
let countState = true
useEffect(() => {
fetchPurchaseList()
}, [])
useEffect(() => {
if (categoryIds) {
setLoading(true)
}
}, [categoryIds])
const fetchPurchaseList = (initState = false) => {
let getFn
switch (layoutType) {
......@@ -51,10 +60,26 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
getFn && getFn().then(res => {
if (res.code === 1000) {
initPurchaseList(res.data, initState)
getCategoryIds(res.data)
}
})
}
/**
* 获取进货单内商品品类id集合
* @param purchaseList
*/
const getCategoryIds = (purchaseList) => {
let ids = []
for (let item of purchaseList) {
let categoryId = item.commodityUnitPrice.commodity.customerCategory.id
if (!ids.includes(categoryId)) {
ids.push(categoryId)
}
}
setCategoryIds(ids)
}
const initPurchaseList = (list: GetSearchShopPurchaseGetPurchaseListResponse, initState) => {
let result = []
for (let item of list) {
......@@ -615,7 +640,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
</div>
<div className={cx(styles.order_list_item_item, styles.goods_info)}>
<div className={styles.order_list_item_item_imgbox}>
<div className={styles.order_list_item_item_imgbox_img} style={{ backgroundImage: `url(${childItem.commodityUnitPrice.commodityPic[0]})` }}></div>
<ImageBox width={80} height={80} imgUrl={childItem.commodityUnitPrice.commodityPic[0]} direction="column" />
</div>
<div>
<div className={styles.order_list_item_item_name}>{childItem.commodityUnitPrice.commodity.name}</div>
......@@ -690,7 +715,7 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
</Affix>
)
}
<Recommand />
<Recommand loading={loading} categoryIds={categoryIds} {...props} />
</div>
</div>
)
......
......@@ -170,8 +170,10 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
message.error('请先选择商城类型')
return false
}
productRowCtl.setSelectedRowKeys([])
productRowCtl.setSelectRow([])
// fix: 选中后无法回显
// productRowCtl.setSelectedRowKeys([])
// productRowCtl.setSelectRow([])
setVisibleChannelRroduct(true)
}
// 新增会员
......
import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { Rate, Pagination, Modal } from 'antd'
import { Rate, Pagination, Modal, message } from 'antd'
import { StarFilled } from '@ant-design/icons'
import shop_icon from '@/assets/imgs/shop_icon.png'
import credit_icon from '@/assets/imgs/credit_icon.png'
......@@ -67,10 +67,15 @@ const Shops: React.FC = () => {
}
const linkToDetail = (detail) => {
let el = document.createElement('a')
el.href = `/shop?shopId=${btoa(JSON.stringify({ shopId: detail.id, memberId: detail.memberId }))}`;
el.target = '_blank';
el.click()
if (detail.status === 1) {
let el = document.createElement('a')
el.href = `/shop?shopId=${btoa(JSON.stringify({ shopId: detail.id, memberId: detail.memberId }))}`;
el.target = '_blank';
el.click()
} else {
message.destroy()
message.info("该店铺已冻结")
}
}
return (
......
......@@ -270,10 +270,10 @@ const CommonOrderDetail: React.FC<CommonOrderDetailProps> = (props) => {
{pageStatus !== PageStatus.ADD && formData && <AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formData.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formData.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={formData.externalWorkflowFlowRecordLogResponses}
innerVerifySteps={formData.interiorWorkflowFlowRecordLogResponses}
outerVerifyCurrent={findLastIndexFlowState(formData.externalWorkflowFlowRecordLogResponses) || 0}
innerVerifyCurrent={findLastIndexFlowState(formData.interiorWorkflowFlowRecordLogResponses) || 0}
outerVerifySteps={formData.externalWorkflowFlowRecordLogResponses || []}
innerVerifySteps={formData.interiorWorkflowFlowRecordLogResponses || []}
></AuditProcess>}
{/* 商品列表 */}
......
......@@ -252,10 +252,10 @@ const CommonOrderDetail:React.FC<CommonOrderDetailProps> = (props) => {
{ pageStatus !== PageStatus.ADD && formData && <AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formData.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formData.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={formData.externalWorkflowFlowRecordLogResponses}
innerVerifySteps={formData.interiorWorkflowFlowRecordLogResponses}
outerVerifyCurrent={findLastIndexFlowState(formData.externalWorkflowFlowRecordLogResponses) || 0}
innerVerifyCurrent={findLastIndexFlowState(formData.interiorWorkflowFlowRecordLogResponses) || 0}
outerVerifySteps={formData.externalWorkflowFlowRecordLogResponses || []}
innerVerifySteps={formData.interiorWorkflowFlowRecordLogResponses || []}
></AuditProcess> }
{/* 商品列表 */}
......
......@@ -24,6 +24,9 @@ export const changeRouterTitleByStatus = () => {
// 找到最后一个可用的工作流状态的索引
export const findLastIndexFlowState = (data: any[]) => {
if (!Array.isArray(data)) {
return 0
}
for (let item = 0; item < data.length; item++) {
if (data[item].isExecute === 0) {
return item > 0 ? --item : 0
......
......@@ -449,6 +449,9 @@ export const addBillSchema: ISchema = {
enum: [],
'x-component-props': {
allowClear: true,
style: {
width: 100,
},
},
'x-rules': [
{
......
......@@ -101,25 +101,25 @@ export const warehouseDetailSchema: ISchema = {
title: '仓库名称',
'x-component-props': {
placeholder: '请输入',
},
},
'x-rules': [
{
required: true,
message: '请输入仓库名称',
},
{
limitByte: true, // 自定义校验规则
maxByte: 20,
}
],
required: true,
},
MEGA_LAYOUT1: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
label: '仓库名称',
label: '仓库地址',
wrapperCol: 24,
'x-rules': [
{
required: true,
message: '请输入仓库名称',
},
{
limitByte: true, // 自定义校验规则
maxByte: 20,
}
],
},
properties: {
MEGA_LAYOUT1_1: {
......
import React from 'react';
import React, { useState } from 'react';
import { Tabs, Row, Col, Button } from 'antd';
import { createFormActions } from '@formily/antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import MellowCard from '@/components/MellowCard';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
import { Pie } from '@/components/Charts';
import Mood from '@/components/Mood';
import NiceForm from '@/components/NiceForm';
import { searchSchema } from './schema';
import Shelves from '../components/Shelves';
import RecordList from '../components/RecordList';
import styles from './index.less';
const { TabPane } = Tabs;
const receivedFormActions = createFormActions();
const sentFormActions = createFormActions();
const PAGE_SIZE = 10;
interface ReceivedSearch {
/**
* 评价星级(1-5)
*/
star: string
/**
* 交易时间开始
*/
dealTimeStart: string
/**
* 交易时间结束
*/
dealTimeEnd: string
/**
* 评价方名称
*/
memberName: string
};
const Analysis: React.FC = () => {
const [historyPage, setHistoryPage] = useState(1);
const [historySize, setHistorySize] = useState(PAGE_SIZE);
const [receivedPage, setReceivedPage] = useState(1);
const [receivedSize, setReceivedSize] = useState(PAGE_SIZE);
const [receivedSearchVal, setReceivedSearchVal] = useState<ReceivedSearch>({
star: '0',
dealTimeStart: '',
dealTimeEnd: '',
memberName: '',
});
const [receivedList, setReceivedList] = useState([]);
// 获取评价汇总
const getTradeSummary = () => {
PublicApi.getMemberCommentSupplyCountSupplyTradeSummary().then(res => {
if (res.code === 1000) {
}
});
};
// 获取评价记录
const getTradeHistory = () => {
PublicApi.getMemberCommentSupplyCountSupplyTradeHistoryPage({
memberId: '0',
validateId: '0',
starLevel: null,
current: `${historyPage}`,
pageSize: `${historySize}`,
}).then(res => {
if (res.code === 1000) {
}
});
};
// 获取收到的评价列表
const getReceivedList = () => {
PublicApi.getMemberCommentSupplySupplyTradeHistoryPage({
...receivedSearchVal,
current: `${receivedPage}`,
pageSize: `${receivedSize}`,
}).then(res => {
});
};
const evaluateColumns: EditableColumns[] = [
{
title: ' ',
......@@ -89,6 +152,29 @@ const Analysis: React.FC = () => {
},
];
const handleTabsChange = key => {
console.log('key', key)
switch (key) {
case '1': {
break;
}
case '2': {
break;
}
case '3': {
break;
}
default:
break;
}
};
return (
<PageHeaderWrapper>
<MellowCard
......@@ -96,7 +182,10 @@ const Analysis: React.FC = () => {
padding: '0 24px 24px',
}}
>
<Tabs className={styles.tabs}>
<Tabs
className={styles.tabs}
onChange={handleTabsChange}
>
<TabPane tab="概览" key="1">
<Shelves title="评价统计">
<Row gutter={24}>
......@@ -128,39 +217,14 @@ const Analysis: React.FC = () => {
<Shelves title="评价记录">
<RecordList list={[]} />
<div
style={{
padding: '24px 0',
textAlign: 'center',
}}
>
<Button>查看更多评论</Button>
</div>
</Shelves>
</TabPane>
<TabPane tab="收到的评价" key="2">
<NiceForm
actions={receivedFormActions}
onSubmit={values => {}}
effects={($, actions) => {
}}
schema={searchSchema}
/>
<TabPane tab="收到的评价" key="2">
<RecordList list={[]} />
</TabPane>
<TabPane tab="发出的评价" key="3">
<NiceForm
actions={sentFormActions}
onSubmit={values => {}}
effects={($, actions) => {
}}
schema={searchSchema}
/>
<TabPane tab="发出的评价" key="3">
<RecordList list={[]} />
</TabPane>
</Tabs>
......
......@@ -141,9 +141,9 @@ const EvaluationList = props => {
<img src={item.good ? item.good.pic : ''} />
</div>
<div className="goodInfo-right">
<div className="goodInfo-title">进口头层黄牛皮荔枝纹/红色/XL</div>
<div className="goodInfo-desc">20 平方英尺</div>
<div className="goodInfo-price">¥ 400.00</div>
<div className="goodInfo-title">{item.good.productName}</div>
<div className="goodInfo-desc">{item.good.purchaseCount || ''}</div>
<div className="goodInfo-price">{`¥ ${item.good.price}`}</div>
</div>
</div>
</Col>
......
import React from 'react';
import { Button, Rate } from 'antd';
import React, { useState, useEffect } from 'react';
import { Button, Rate, Spin } from 'antd';
import { createFormActions } from '@formily/antd';
import NiceForm from '@/components/NiceForm';
import { searchSchema } from './schema';
import styles from './index.less';
const formActions = createFormActions();
const PAGE_SIZE = 10;
export interface Search {
/**
* 评价星级(1-5)
*/
star: string
/**
* 交易时间开始
*/
dealTimeStart: string
/**
* 交易时间结束
*/
dealTimeEnd: string
/**
* 评价方名称
*/
memberName: string
};
export interface ListParams extends Search {
/**
* 当前页
*/
current: string
/**
* 每页行数
*/
pageSize: string
};
export interface RecordItem {
/**
* 记录id
*/
id: number
/**
* 评价星级(1-5)
*/
star: number
/**
* 评价内容
*/
comment: string
/**
* 商品信息
*/
product: string
/**
* 备注(订单号)
*/
remark: string
/**
* 交易时间
*/
dealTime: {}
/**
* 评价方
*/
memberName: string
};
export interface RecordRes {
data: RecordItem[];
totalCount: number;
};
interface RecordListProps {
list: [];
fetchList: (params: ListParams) => Promise<RecordRes>;
};
const RecordList: React.FC<RecordListProps> = () => {
const RecordList: React.FC<RecordListProps> = ({
fetchList,
}) => {
const [hasMore, setHasMore] = useState(false);
const [page, setPage] = useState(1);
const [size, setSize] = useState(PAGE_SIZE);
const [searchVal, setSearchVal] = useState<Search>({
star: '0',
dealTimeStart: '',
dealTimeEnd: '',
memberName: '',
});
const [receivedList, setReceivedList] = useState<RecordRes>({ data: [], totalCount: 0 });
const [loading, setLoading] = useState(false);
// 获取列表数据
const getRecordList = (): Promise<RecordRes> => {
if (!fetchList) {
return Promise.reject();
}
setLoading(true);
return new Promise((resolve, reject) => {
fetchList({
...searchVal,
current: `${page}`,
pageSize: `${size}`,
}).then(res => {
resolve(res);
}).catch(err => {
reject(err);
}).finally(() => {
setLoading(false);
});
});
};
useEffect(() => {
getRecordList().then(res => {
setReceivedList(res);
});
}, []);
// 查询列表
const handleSearch = values => {
setPage(1);
setSearchVal(values);
getRecordList().then(res => {
setReceivedList(res);
});
};
// 加载更多
const handleLoadMore = () => {
if (!hasMore || loading) {
return;
}
setSize(size + 1);
getRecordList().then(res => {
setReceivedList({
...receivedList,
data: receivedList.data.concat(res.data),
});
});
};
return (
<ul className={styles.record}>
<li className={styles['record-item']}>
<div className={styles['record-item-good']}>
<div className={styles['record-item-good-name']}>
进口头层黄牛皮荔枝纹/红色/XL
</div>
<div>
<span className={styles['record-item-good-price']}>¥400.00</span>
<span className={styles['record-item-good-desc']}>20 平方英尺</span>
<>
<NiceForm
actions={formActions}
onSubmit={handleSearch}
effects={($, actions) => {
}}
schema={searchSchema}
/>
<ul className={styles.record}>
<li className={styles['record-item']}>
<div className={styles['record-item-good']}>
<div className={styles['record-item-good-name']}>
进口头层黄牛皮荔枝纹/红色/XL
</div>
<div>
<span className={styles['record-item-good-price']}>¥400.00</span>
<span className={styles['record-item-good-desc']}>20 平方英尺</span>
</div>
</div>
</div>
<div className={styles['record-item-extra']}>
<div className={styles['record-item-extra-item']}>
<div className={styles['record-item-extra-item-label']}>
交易时间:
</div>
<div className={styles['record-item-extra-item-control']}>
2020-05-20 17:09
</div>
<div className={styles['record-item-extra']}>
<div className={styles['record-item-extra-item']}>
<div className={styles['record-item-extra-item-label']}>
交易时间:
</div>
<div className={styles['record-item-extra-item-control']}>
2020-05-20 17:09
</div>
</div>
<div className={styles['record-item-extra-item']}>
<div className={styles['record-item-extra-item-label']}>
评价方:
</div>
<div className={styles['record-item-extra-item-control']}>
温州龙昌手袋有限公司
</div>
</div>
</div>
<div className={styles['record-item-extra-item']}>
<div className={styles['record-item-extra-item-label']}>
评价方:
</div>
<div className={styles['record-item-extra-item-control']}>
温州龙昌手袋有限公司
</div>
<div className={styles['record-item-comment']}>
<Rate value={2} disabled />
<div className={styles['record-item-comment-main']}>
付款准时,合作愉快。付款准时,合作愉快。付款准时,合作愉快。付款准时,合作愉快。付款准时…
</div>
</div>
</div>
<div className={styles['record-item-comment']}>
<Rate value={2} disabled />
<div className={styles['record-item-comment-main']}>
付款准时,合作愉快。付款准时,合作愉快。付款准时,合作愉快。付款准时,合作愉快。付款准时…
<div className={styles['record-item-actions']}>
<Button type="link">查看</Button>
</div>
</li>
</ul>
{(hasMore && !loading) && (
<div
style={{
padding: '24px 0',
textAlign: 'center',
}}
>
<Button onClick={handleLoadMore}>查看更多评论</Button>
</div>
<div className={styles['record-item-actions']}>
<Button type="link">查看</Button>
)}
{loading && (
<div
style={{
padding: '24px 0',
textAlign: 'center',
}}
>
<Spin />
</div>
</li>
</ul>
)}
</>
);
};
......
/*
* @Author: XieZhiXiong
* @Date: 2020-09-22 20:34:49
* @Date: 2020-10-19 18:08:51
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-22 20:52:53
* @LastEditTime: 2020-10-19 18:09:31
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -28,7 +28,7 @@ export const searchSchema: ISchema = {
},
},
},
'[startDate, endDate]': {
'[dealTimeStart, dealTimeEnd]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
......@@ -40,7 +40,7 @@ export const searchSchema: ISchema = {
},
},
},
name: {
memberName: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
......
import {
PurchaseOrderOutWorkState,
SaleOrderInsideWorkState,
} from '@/constants';
// 订单外部状态 StatusTag map
export const ORDER_INNER_STATUS_TYPE = {
[PurchaseOrderOutWorkState.FINISH_ORDER]: 'success',
};
// 订单内部状态 Tag badge map
export const ORDER_INNER_STATUS_BADGE_COLOR = {
[SaleOrderInsideWorkState.FILLING_ORDER]: '#00B37A',
};
// 订单内部状态 text
export const ORDER_INNER_STATUS_TXT_FINISHING = {
[SaleOrderInsideWorkState.FILLING_ORDER]: '已完成',
};
\ No newline at end of file
import React from 'react';
import React, { useState, useEffect } from 'react';
import {
PageHeader,
Descriptions,
......@@ -11,9 +11,13 @@ import { FormOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import { createFormActions, FormEffectHooks, FormPath } from '@formily/antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetOrderPurchaseOrderDetailsResponse } from '@/services/OrderApi';
import { normalizeFiledata } from '@/utils';
import AvatarWrap from '@/components/AvatarWrap';
import NiceForm from '@/components/NiceForm';
import { normalizeUnevaluatedList } from '../../utils';
import { evaluateSchema } from './schema';
import { createEffects } from './effects';
import EvaluationList from '../../components/EvaluationList';
......@@ -21,10 +25,88 @@ import styles from './index.less';
const formActions = createFormActions();
interface Unevaluated {
good: {
pic: string,
name: string,
price: string,
desc: string,
};
star: number;
comment: string;
picture: string[];
smile: number;
};
interface OrderInfo extends GetOrderPurchaseOrderDetailsResponse {
unevaluatedList: Unevaluated[];
};
const EvaluateOrder: React.FC = () => {
const { id } = usePageStatus();
const [orderInfo, setOrderInfo] = useState<OrderInfo>(null);
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
const getOrderInfo = () => {
setInfoLoading(true);
PublicApi.getOrderPurchaseOrderDetails({
id,
}).then(res => {
if (res.code === 1000) {
const { orderProductRequests } = res.data;
setOrderInfo({
...res.data,
unevaluatedList: normalizeUnevaluatedList(orderProductRequests),
});
}
}).finally(() => {
setInfoLoading(false);
});
};
useEffect(() => {
getOrderInfo();
}, []);
const handleSubmit = values => {
console.log('values', values);
setSubmitLoading(true);
const payload = values.map(item => {
const {
comment,
good,
picture,
star,
} = item;
return {
memberId: orderInfo.supplyMembersId,
roleId: '暂无',
memberName: orderInfo.supplyMembersName,
star,
comment,
product: JSON.stringify(good),
remark: orderInfo.orderNo,
orderId: orderInfo.id,
dealTime: orderInfo.createTime,
dealCount: good.purchaseCount,
price: good.price,
totalPrice: orderInfo.sumPrice,
pics: picture.map(item => item.status === 'done' && item.data).filter(Boolean),
};
});
PublicApi.postMemberCommentSupplyOrderTradeSubmit({
commentSubmitDetailList: payload,
}).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack();
}, 800);
}
}).finally(() => {
setSubmitLoading(false);
});
};
const beforeUpload = file => {
......@@ -50,62 +132,69 @@ const EvaluateOrder: React.FC = () => {
);
return (
<PageHeaderWrapper
title={
<>
<PageHeader
style={{ padding: '0' }}
onBack={() => history.goBack()}
title={
<AvatarWrap
info={{
aloneTxt: '单',
name: '订单号:DPTY12'
}}
/>
}
extra={(
<>
<Button
type="primary"
icon={<FormOutlined />}
onClick={() => formActions.submit()}
>
发布
</Button>
</>
)}
>
<Descriptions
size="small"
column={3}
style={{
padding: '0 32px',
}}
<Spin spinning={infoLoading}>
<PageHeaderWrapper
title={
<>
<PageHeader
style={{ padding: '0' }}
onBack={() => history.goBack()}
title={
<AvatarWrap
info={{
aloneTxt: '单',
name: orderInfo?.orderNo,
}}
/>
}
extra={(
<>
<Button
type="primary"
icon={<FormOutlined />}
disabled={!orderInfo || !orderInfo.id}
loading={submitLoading}
onClick={() => formActions.submit()}
>
发布
</Button>
</>
)}
>
<Descriptions.Item label="采购会员">BPTY12</Descriptions.Item>
<Descriptions.Item label="下单时间" span={2}>2020-08-25 08:49</Descriptions.Item>
</Descriptions>
</PageHeader>
</>
}
>
<NiceForm
actions={formActions}
expressionScope={{
UploadTip,
beforeUpload,
}}
onSubmit={handleSubmit}
components={{
EvaluationList,
}}
effects={($, actions) => {
createEffects($, actions);
}}
schema={evaluateSchema}
/>
</PageHeaderWrapper>
<Descriptions
size="small"
column={3}
style={{
padding: '0 32px',
}}
>
<Descriptions.Item label="采购会员">{'暂无'}</Descriptions.Item>
<Descriptions.Item label="下单时间" span={2}>{orderInfo?.createTime}</Descriptions.Item>
</Descriptions>
</PageHeader>
</>
}
>
<NiceForm
actions={formActions}
initialValues={{
comments: orderInfo ? orderInfo.unevaluatedList : [],
}}
expressionScope={{
UploadTip,
beforeUpload,
}}
onSubmit={handleSubmit}
components={{
EvaluationList,
}}
effects={($, actions) => {
createEffects($, actions);
}}
schema={evaluateSchema}
/>
</PageHeaderWrapper>
</Spin>
);
};
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-09-23 17:00:24
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-09-29 16:40:00
* @LastEditTime: 2020-10-19 16:23:24
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -14,14 +14,7 @@ export const evaluateSchema: ISchema = {
comments: {
type: 'array',
'x-component': 'EvaluationList',
default: [
{
name: '杰尼',
age: 24,
small: 1,
star2: 0,
},
],
default: [],
items: {
type: 'object',
properties: {
......@@ -50,28 +43,32 @@ export const evaluateSchema: ISchema = {
'x-component': 'Rating',
'x-component-props': {
allowHalf: false,
},
},
'x-rules': [
{
required: true,
message: '请选择满意程度',
},
],
},
comment: {
type: 'string',
title: '评价',
required: true,
'x-component': 'TextArea',
'x-component-props': {
rows: 4,
},
},
},
picture: {
type: 'string',
title: '图片',
required: true,
'x-component': 'Upload',
'x-component-props': {
listType: 'card',
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: '/test/',
prefix: '/supplierEvaluation/',
},
beforeUpload: '{{beforeUpload}}',
accept: '.png, .jpg, .jpeg',
......
import React, { useState, useRef } from 'react';
import { Card, Badge, Button } from 'antd';
import { Link } from 'umi';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { createFormActions } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { Link } from 'umi';
import { ORDER_TYPE2, SaleOrderInsideWorkStateTexts, PayOutWorkStateTexts } from '@/constants';
import {
ORDER_INNER_STATUS_TYPE,
ORDER_INNER_STATUS_BADGE_COLOR,
ORDER_INNER_STATUS_TXT_FINISHING,
} from '../constans';
import { PublicApi } from '@/services/api';
import EyePreview from '@/components/EyePreview';
import NiceForm from '@/components/NiceForm';
import StatusTag from '@/components/StatusTag';
......@@ -16,29 +22,6 @@ import styles from './index.less';
const formActions = createFormActions();
const mock = [
{
orderNo: 'DPTY12',
abstract: '进口头层黄牛皮荔枝纹',
member: '广州白马皮具交易有限公司',
created: '2020-09-22 11:16:00',
amount: '¥ 50,000.00',
orderType: '现货采购',
outerStatusName: '已完成',
innerStatusName: '已完成',
},
{
orderNo: 'DPTY13',
abstract: '进口头层黄牛皮荔枝纹',
member: '广州白马皮具交易有限公司',
created: '2020-09-22 11:16:00',
amount: '¥ 50,000.00',
orderType: '现货采购',
outerStatusName: '已完成',
innerStatusName: '已完成',
},
];
const Unevaluated: React.FC = () => {
const ref = useRef<any>({});
......@@ -58,48 +41,50 @@ const Unevaluated: React.FC = () => {
},
{
title: '订单摘要',
dataIndex: 'abstract',
align: 'center',
dataIndex: 'orderThe',
align: 'center',
ellipsis: true,
},
{
title: '采购会员',
dataIndex: 'member',
dataIndex: 'memberName',
align: 'center',
render: (text, record) => <>{text}</>,
},
{
title: '下单时间',
dataIndex: 'created',
dataIndex: 'createTime',
align: 'center',
render: (text, record) => <>{text}</>,
},
{
title: '订单总额',
dataIndex: 'amount',
dataIndex: 'sumPrice',
align: 'center',
},
{
title: '订单类型',
dataIndex: 'orderType',
align: 'center',
dataIndex: 'type',
align: 'center',
render: text => ORDER_TYPE2[text],
},
{
title: '外部状态',
dataIndex: 'outerStatusName',
dataIndex: 'externalState',
align: 'center',
filters: [],
onFilter: (value, record) => record.outerStatus === value,
render: (text, record) => (
<StatusTag type="warnning" title="已完成" />
<StatusTag type="success" title="已完成" />
),
},
{
title: '内部状态',
dataIndex: 'innerStatusName',
dataIndex: 'purchaseOrderInteriorState',
align: 'center',
filters: [],
onFilter: (value, record) => record.innerStatus === value,
render: (text, record) => <Badge color="#606266" text="已完成" />,
render: (text, record) => <Badge color="#41CC9E" text="已完成" />,
},
{
title: '操作',
......@@ -107,7 +92,7 @@ const Unevaluated: React.FC = () => {
align: 'center',
render: (text, record) => (
<>
<Link to={`/memberCenter/tranactionAbility/supplierEvaluation/unevaluated/evaluate`}>
<Link to={`/memberCenter/tranactionAbility/supplierEvaluation/unevaluated/evaluate?id=${record.id}`}>
<Button
type="link"
>
......@@ -122,17 +107,20 @@ const Unevaluated: React.FC = () => {
const [columns, setColumns] = useState<any[]>(defaultColumns);
const fetchListData = (params: any) => {
return Promise.resolve({
total: 2,
data: mock,
return new Promise((resolve, reject) => {
PublicApi.getOrderEvaluatedList(params)
.then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject();
})
.catch(() => {
reject();
});
});
};
// 初始化高级筛选选项
const fetchSelectOptions = async () => {
return {};
};
return (
<PageHeaderWrapper>
<Card>
......@@ -154,10 +142,6 @@ const Unevaluated: React.FC = () => {
'name',
FORM_FILTER_PATH,
);
useAsyncInitSelect(
['innerStatus', 'outerStatus'],
fetchSelectOptions,
);
}}
schema={listSearchSchema}
/>
......
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { UPLOAD_TYPE } from '@/constants';
import {
ORDER_TYPE2_INQUIRY,
ORDER_TYPE2_DEMAND,
ORDER_TYPE2_SPOT,
ORDER_TYPE2_CENTRALIZED,
ORDER_TYPE2_POINTS,
ORDER_TYPE2_CHANNEL_DIRECT,
ORDER_TYPE2_CHANNEL_SPOT,
ORDER_TYPE2_CHANNEL_POINTS,
ORDER_TYPE2,
} from '@/constants';
export const listSearchSchema: ISchema = {
type: 'object',
......@@ -28,7 +38,7 @@ export const listSearchSchema: ISchema = {
columns: 6,
},
properties: {
memberTypeId: {
supplyMembersName: {
type: 'string',
default: undefined,
'x-component-props': {
......@@ -48,30 +58,45 @@ export const listSearchSchema: ISchema = {
orderType: {
type: 'string',
default: undefined,
enum: [],
enum: [
{
label: ORDER_TYPE2[ORDER_TYPE2_INQUIRY],
value: ORDER_TYPE2_INQUIRY,
},
{
label: ORDER_TYPE2[ORDER_TYPE2_DEMAND],
value: ORDER_TYPE2_DEMAND,
},
{
label: ORDER_TYPE2[ORDER_TYPE2_SPOT],
value: ORDER_TYPE2_SPOT,
},
{
label: ORDER_TYPE2[ORDER_TYPE2_CENTRALIZED],
value: ORDER_TYPE2_CENTRALIZED,
},
{
label: ORDER_TYPE2[ORDER_TYPE2_POINTS],
value: ORDER_TYPE2_POINTS,
},
{
label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_DIRECT],
value: ORDER_TYPE2_CHANNEL_DIRECT,
},
{
label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_SPOT],
value: ORDER_TYPE2_CHANNEL_SPOT,
},
{
label: ORDER_TYPE2[ORDER_TYPE2_CHANNEL_POINTS],
value: ORDER_TYPE2_CHANNEL_POINTS,
},
],
'x-component-props': {
placeholder: '订单类型',
allowClear: true,
},
},
outerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '外部状态(全部)',
allowClear: true,
},
},
innerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '内部状态(全部)',
allowClear: true,
},
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
......
/*
* @Author: XieZhiXiong
* @Date: 2020-10-19 16:02:53
* @LastEditors: XieZhiXiong
* @LastEditTime: 2020-10-19 17:10:42
* @Description:
*/
// 初始化待评价列表
export const normalizeUnevaluatedList = (arr: {[key: string]: any}[]) => {
const ret = [];
if (!Array.isArray(arr)) {
return ret;
}
arr.forEach(item => {
const atom = {
good: {
pic: '',
quantity: item.productAttributeJson || '',
productId: item.productId,
orderId: item.orderId,
productName: item.productName,
category: item.category,
brand: item.brand,
unit: item.unit,
price: item.price,
memberPrice: item.memberPrice,
purchaseCount: item.purchaseCount, // 采购数量
taxInclusive: item.taxInclusive,
money: item.money,
inventory: item.inventory,
productAttributeJson: item.productAttributeJson,
},
star: 0, // 评分星星
comment: '', // 评价
picture: [],
smile: 1, // 笑脸
};
ret.push(atom);
});
return ret;
};
\ No newline at end of file
......@@ -40,6 +40,28 @@ const getItemText = (key: number) => {
return result
}
const changeAttributeDate = (list) => {
if (!list) {
return []
}
let flag = false
list = list.map(item => {
delete item.customerAttributeName
if (item.customerAttributeValueList && item.customerAttributeValueList.length <= 0) {
delete item.customerAttributeValueList
delete item.customerAttributeId
flag = true
} else {
item.customerAttributeValueList = item.customerAttributeValueList.map(attrItem => {
delete attrItem.name
return attrItem
})
}
return item
})
return flag ? [] : list
}
class FilterStore {
/**
* 筛选条件列表
......@@ -120,7 +142,7 @@ class FilterStore {
for (let filterItem of newFilterList) {
switch (filterItem.type) {
case FILTER_TYPE.category:
tempFilterParam.categoryId = filterItem.key[0]
tempFilterParam.categoryId = Number(filterItem.key[0])
break
case FILTER_TYPE.brand:
tempFilterParam.brandId = filterItem.key
......@@ -158,7 +180,9 @@ class FilterStore {
tempFilterParam.orderType = 4
break
case FILTER_TYPE.attribute:
tempFilterParam.customerAttributeList = filterItem.key
let attributeList = JSON.parse(filterItem.key)
attributeList = changeAttributeDate(attributeList)
tempFilterParam.customerAttributeList = attributeList
break
case FILTER_TYPE.shopArea:
tempFilterParam.areaCode = filterItem.key
......
......@@ -444,6 +444,22 @@ export const normalizeFiledata = url => {
};
};
/**
* 检查是否还有更多
* @param {Number} curPage 当前页码
* @param {Number} curSize 当前页数
* @param {Number} dataLen 当前数据长度
* @param {Number} dataTotal 数据总长度
*/
export const checkMore = (curPage, curSize, dataLen, dataTotal) => {
let hasMore = true;
if (!dataLen || dataLen + (curPage - 1) * curSize >= +dataTotal) {
hasMore = false;
}
return hasMore;
};
export default {
isArray,
isObject,
......
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