Commit 3d5b83d4 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

Merge branch 'dev' into test

parents f0e03866 a63820dd
registry = "http://10.0.0.19:7001" registry="http://10.0.0.19:4873"
# registry = "https://registry.npmjs.org/" # registry = "https://registry.npmjs.org/"
...@@ -978,6 +978,7 @@ export enum DeliverySideState { ...@@ -978,6 +978,7 @@ export enum DeliverySideState {
// 订单外部显示文案 // 订单外部显示文案
export const PurchaseOrderOutWorkStateTexts = { export const PurchaseOrderOutWorkStateTexts = {
"-1": "取消订单", "-1": "取消订单",
0: '订单完成',
1: '待提交订单', 1: '待提交订单',
2: '待确认订单', 2: '待确认订单',
3: '待确认电子合同', 3: '待确认电子合同',
...@@ -1051,6 +1052,7 @@ export const SaleOrderInsideWorkStateTexts = { ...@@ -1051,6 +1052,7 @@ export const SaleOrderInsideWorkStateTexts = {
// 订单流转记录外部状态 // 订单流转记录外部状态
export const OrderTransformOutWorkStateTexts = { export const OrderTransformOutWorkStateTexts = {
"-1": '取消订单', "-1": '取消订单',
0: '订单完成',
1: '待确认', 1: '待确认',
2: '待确认电子合同', 2: '待确认电子合同',
3: '待支付', 3: '待支付',
...@@ -1074,6 +1076,7 @@ export const OrderTransformOutWorkStateTexts = { ...@@ -1074,6 +1076,7 @@ export const OrderTransformOutWorkStateTexts = {
// 采购订单流转记录内部状态 // 采购订单流转记录内部状态
export const PurchaseOrderTransformInsideWorkStateTexts = { export const PurchaseOrderTransformInsideWorkStateTexts = {
"-1": '取消订单', "-1": '取消订单',
0: '订单完成',
1: '待提交审核', 1: '待提交审核',
2: '提交审核通过', 2: '提交审核通过',
3: '审核通过', 3: '审核通过',
......
...@@ -33,7 +33,7 @@ const { Option } = Select ...@@ -33,7 +33,7 @@ const { Option } = Select
let _tableDataSource: any = [] let _tableDataSource: any = []
const PriceAttributeForm: React.FC<Iprops> = (props) => { const PriceAttributeForm: React.FC<Iprops> = (props) => {
const { onRef } = props const { onRef } = props
const priceFormRef = useRef() const priceFormRef = useRef()
const updateFlag = useRef(true) // 是否第一次构建 const updateFlag = useRef(true) // 是否第一次构建
...@@ -58,15 +58,15 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -58,15 +58,15 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const [colums, setColumns] = useState<ColumnType<any>[]>() const [colums, setColumns] = useState<ColumnType<any>[]>()
const { ProductStore } = store const { ProductStore } = store
const { const {
productName, productName,
selectedGoods, selectedGoods,
productSelectAttribute, productSelectAttribute,
setProductSelectAttribute, setProductSelectAttribute,
tableDataSource, tableDataSource,
setTableDataSource, setTableDataSource,
clearData, clearData,
setPriceAttributeParams, setPriceAttributeParams,
productInfoByEdit, productInfoByEdit,
getPriceAttributeFormParamsByEdit, getPriceAttributeFormParamsByEdit,
selectCategoryId, selectCategoryId,
...@@ -136,7 +136,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -136,7 +136,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => { useEffect(() => {
// 品类 变动清空form和属性组合 // 品类 变动清空form和属性组合
if(history.location.query?.id && !flagRef.current) { if(history.location.query?.id && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
// setProductSelectAttribute([]) // setProductSelectAttribute([])
priceForm.resetFields() priceForm.resetFields()
...@@ -147,7 +147,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -147,7 +147,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/** /**
* 添加clearPrice.current依赖,处理在未渲染价格属性前已经变动了价格属性组合,此时需要清空价格数据 * 添加clearPrice.current依赖,处理在未渲染价格属性前已经变动了价格属性组合,此时需要清空价格数据
* bug: 在不改变那价格属性组合情况下修改价格可以保留,当属性组合变动之后,修改价格再做其他修改时会清空价格(原因:clearPrice.current始终为true) * bug: 在不改变那价格属性组合情况下修改价格可以保留,当属性组合变动之后,修改价格再做其他修改时会清空价格(原因:clearPrice.current始终为true)
* 添加 tabClickItem * 添加 tabClickItem
* 价格属性变动引发的构建,清空价格(仅清空一次)之后置为false * 价格属性变动引发的构建,清空价格(仅清空一次)之后置为false
*/ */
useEffect(()=>{ useEffect(()=>{
...@@ -170,7 +170,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -170,7 +170,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(hasAttribute.length){ // 提取价格属性 属性名数组 属性值SKU数组 /*编辑情况下直接进入此页面length为空 此时需获取调用接口返回的数据生成*/ if(hasAttribute.length){ // 提取价格属性 属性名数组 属性值SKU数组 /*编辑情况下直接进入此页面length为空 此时需获取调用接口返回的数据生成*/
hasAttribute.map(_item=>{ hasAttribute.map(_item=>{
_attributeNameArr.push(_item.attributeName) // 用于列header _attributeNameArr.push(_item.attributeName) // 用于列header
_temp_attributeObjArr.push({attributeName: _item.attributeName, customerAttributeId: _item.customerAttributeId}) _temp_attributeObjArr.push({attributeName: _item.attributeName, customerAttributeId: _item.customerAttributeId})
let _tempArr = [] let _tempArr = []
let _tempObjArr = [] // 取id备用 //....若为日期属性,此处应获取日期段的每一天 进行特殊处理....// let _tempObjArr = [] // 取id备用 //....若为日期属性,此处应获取日期段的每一天 进行特殊处理....//
// if(_item.isDate){ // if(_item.isDate){
...@@ -273,14 +273,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -273,14 +273,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(_attributeNameArr?.length>0){ if(_attributeNameArr?.length>0){
_attributeNameArr.map( _attr => { _attributeNameArr.map( _attr => {
_col.push({ _col.push({
title: _attr, title: _attr,
dataIndex: _attr, dataIndex: _attr,
key: _attr key: _attr
}) })
}) })
} }
_col.push({ _col.push({
title: planPrice===3?'所需积分':'单价(元)', title: planPrice===3?'所需积分':'单价(元)',
dataIndex: '单价', dataIndex: '单价',
key: '单价', key: '单价',
width: 200, width: 200,
...@@ -389,21 +389,21 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -389,21 +389,21 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let _tempArr: any = [] let _tempArr: any = []
Array.isArray(item) ? item.map((_item, _index) => { /* code2 */ Array.isArray(item) ? item.map((_item, _index) => { /* code2 */
let _tempObject: any = {}; let _tempObject: any = {};
_tempObject.customerAttribute = { _tempObject.customerAttribute = {
id: attributeObjArr[_index].customerAttributeId, id: attributeObjArr[_index].customerAttributeId,
name: attributeObjArr[_index].attributeName name: attributeObjArr[_index].attributeName
} }
_tempObject.customerAttributeValue = { _tempObject.customerAttributeValue = {
id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id, id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id,
value: item[_index] value: item[_index]
} }
_tempArr.push(_tempObject) _tempArr.push(_tempObject)
}) : ( /* code3 */ }) : ( /* code3 */
// ** 可能是单一多选 attributeValObjArr可能为多个 // ** 可能是单一多选 attributeValObjArr可能为多个
_tempArr.push({ _tempArr.push({
customerAttribute: { customerAttribute: {
id: attributeObjArr[0].customerAttributeId, id: attributeObjArr[0].customerAttributeId,
name: attributeObjArr[0].attributeName name: attributeObjArr[0].attributeName
}, },
customerAttributeValue: { customerAttributeValue: {
...@@ -414,7 +414,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -414,7 +414,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
) /* code3 end */ /* code2 end */ ) /* code3 end */ /* code2 end */
_paramsArray.push({ _paramsArray.push({
goodsId: _tableDataSource[index] ? _tableDataSource[index]['对应货品'] : 0, goodsId: _tableDataSource[index] ? _tableDataSource[index]['对应货品'] : 0,
attributeAndValueList: _tempArr, attributeAndValueList: _tempArr,
unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价'], unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价'],
id: _tableDataSource[index]&&_tableDataSource[index]['规格ID'], id: _tableDataSource[index]&&_tableDataSource[index]['规格ID'],
}) /*带上货品id 带上单价*/ }) /*带上货品id 带上单价*/
...@@ -432,7 +432,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -432,7 +432,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/** /**
* @description table选择货品改变对应的data数据 * @description table选择货品改变对应的data数据
* @param v modal数据对象 * @param v modal数据对象
* @param record table行记录 * @param record table行记录
*/ */
const tableSelelctChange = (v: number, record: any) => { const tableSelelctChange = (v: number, record: any) => {
let _row = { ...record, 对应货品: v } let _row = { ...record, 对应货品: v }
...@@ -526,12 +526,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -526,12 +526,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(numberArray[0][0] === minOrder){ if(numberArray[0][0] === minOrder){
let tempArr = []; let tempArr = [];
numberArray.map((_item, _index) => { numberArray.map((_item, _index) => {
tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } }) tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } })
}) })
setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr}) setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
}else{ }else{
let tempArr = []; let tempArr = [];
tempArr.push({ numberPrice: null, numberRange: { numberMin: minOrder, numberMax: null } }) tempArr.push({ numberPrice: null, numberRange: { numberMin: minOrder, numberMax: null } })
setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr}) setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
} }
} }
...@@ -558,6 +558,25 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -558,6 +558,25 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 校验阶梯范围 // 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => { const validatorNumberRange = (rule, value, callback) => {
let minOrder = Number(minOrderNumber)
let precision;
if(Number.isInteger(minOrder)) { // 整数取1
precision = 1
} else { // 小数取最小精度(最多三位)
switch(minOrderNumber.toString().split(".")[1].length) {
case 1:
precision = 0.1
break;
case 2:
precision = 0.01
break;
case 3:
precision = 0.001
break;
default:
precision = 1
}
}
try { try {
if(Array.isArray(value)){ if(Array.isArray(value)){
let range = value.map(item => { let range = value.map(item => {
...@@ -565,6 +584,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -565,6 +584,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
return Object.values(item.numberRange) return Object.values(item.numberRange)
}).reduce( }).reduce(
function(a, b) { function(a, b) {
// 判断首位数是否满足精度
if(a.length && b.length) {
if((Number(b[0])*1000 - Number(a[a.length-1])*1000)/1000 !== precision) {
throw new Error('请正确输入阶梯数量范围');
}
}
return a.concat(b); return a.concat(b);
}, },
[] []
...@@ -589,8 +614,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -589,8 +614,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/** /**
* 按属性归类 * 按属性归类
* @param objectArray * @param objectArray
* @param {string} property * @param {string} property
*/ */
const groupBy = (objectArray, property) => { const groupBy = (objectArray, property) => {
...@@ -615,7 +640,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -615,7 +640,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// initialValues={productInfoByEdit?.id ? getPriceAttributeFormParamsByEdit : {isMemberPrice: false, priceType: planPrice}} // initialValues={productInfoByEdit?.id ? getPriceAttributeFormParamsByEdit : {isMemberPrice: false, priceType: planPrice}}
autoComplete="off" autoComplete="off"
> >
<Form.Item <Form.Item
name="unitId" name="unitId"
label={ label={
<span> <span>
...@@ -725,10 +750,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -725,10 +750,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
{ {
planPrice != 2 && productName && <Button type="text" style={{float: 'right'}} onClick={clickBatchSetPrice}><SettingOutlined />{planPrice === 3 ? '批量设置积分' : '批量设置价格'}</Button> planPrice != 2 && productName && <Button type="text" style={{float: 'right'}} onClick={clickBatchSetPrice}><SettingOutlined />{planPrice === 3 ? '批量设置积分' : '批量设置价格'}</Button>
} }
<Table <Table
rowKey="索引" rowKey="索引"
dataSource={tableDataSource} dataSource={tableDataSource}
columns={planPrice === 2 ? colums.slice(0, colums.length-2) : colums} columns={planPrice === 2 ? colums.slice(0, colums.length-2) : colums}
pagination={false} pagination={false}
locale={{emptyText:<>暂无数据<br />请先完善商品基本信息项!</>}} locale={{emptyText:<>暂无数据<br />请先完善商品基本信息项!</>}}
style={{clear: 'both'}} style={{clear: 'both'}}
...@@ -750,7 +775,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -750,7 +775,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
initialValues={{ladderPrice: false}} initialValues={{ladderPrice: false}}
autoComplete="off" autoComplete="off"
> >
{ {
planPrice!==3 && planPrice!==3 &&
<Form.Item <Form.Item
label="" label=""
...@@ -874,4 +899,4 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -874,4 +899,4 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</>) </>)
} }
export default observer(PriceAttributeForm) export default observer(PriceAttributeForm)
\ No newline at end of file
...@@ -197,7 +197,7 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -197,7 +197,7 @@ const FastModifyPrice: React.FC<{}> = () => {
let priceArray = Object.values(data) let priceArray = Object.values(data)
let tempArr = []; let tempArr = [];
numberArray.map((_item, _index) => { numberArray.map((_item, _index) => {
tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } }) tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } })
}) })
setForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr}) setForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
} }
...@@ -237,6 +237,25 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -237,6 +237,25 @@ const FastModifyPrice: React.FC<{}> = () => {
// 校验阶梯范围 // 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => { const validatorNumberRange = (rule, value, callback) => {
let minOrder = Number(currentRow.minOrder)
let precision;
if(Number.isInteger(minOrder)) { // 整数取1
precision = 1
} else { // 小数取最小精度(最多三位)
switch(minOrder.toString().split(".")[1].length) {
case 1:
precision = 0.1
break;
case 2:
precision = 0.01
break;
case 3:
precision = 0.001
break;
default:
precision = 1
}
}
try { try {
if(Array.isArray(value)){ if(Array.isArray(value)){
let range = value.map(item => { let range = value.map(item => {
...@@ -244,6 +263,12 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -244,6 +263,12 @@ const FastModifyPrice: React.FC<{}> = () => {
return Object.values(item.numberRange) return Object.values(item.numberRange)
}).reduce( }).reduce(
function(a, b) { function(a, b) {
// 判断首位数是否满足精度
if(a.length && b.length) {
if((Number(b[0])*1000 - Number(a[1])*1000)/1000 !== precision) {
throw new Error('请正确输入阶梯数量范围');
}
}
return a.concat(b); return a.concat(b);
}, },
[] []
...@@ -283,7 +308,7 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -283,7 +308,7 @@ const FastModifyPrice: React.FC<{}> = () => {
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => { FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => {
searchCustomerCategoryOptionEffect(actions, 'customerCategoryId') searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
}) })
}} }}
schema={fastSchema} schema={fastSchema}
/> />
} }
...@@ -406,9 +431,9 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -406,9 +431,9 @@ const FastModifyPrice: React.FC<{}> = () => {
label={priceType===3 ? "积分" : "单价"} label={priceType===3 ? "积分" : "单价"}
name="uniquePrice" name="uniquePrice"
rules={[ rules={[
{ {
required: true, required: true,
message: priceType===3 ? '请输入积分!' : '请输入单价!' message: priceType===3 ? '请输入积分!' : '请输入单价!'
}, },
{ {
pattern: priceType!==3 ? /^\d+(\.\d{1,4})?$/ : /^[1-9]\d*$/, pattern: priceType!==3 ? /^\d+(\.\d{1,4})?$/ : /^[1-9]\d*$/,
...@@ -425,4 +450,4 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -425,4 +450,4 @@ const FastModifyPrice: React.FC<{}> = () => {
) )
} }
export default FastModifyPrice export default FastModifyPrice
\ No newline at end of file
...@@ -14,10 +14,10 @@ import cx from 'classnames' ...@@ -14,10 +14,10 @@ import cx from 'classnames'
import ReutrnEle from '@/components/ReturnEle' import ReutrnEle from '@/components/ReturnEle'
import styles from "./index.less" import styles from "./index.less"
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { import {
GetProductCommodityGetCommodityResponse, GetProductCommodityGetCommodityResponse,
GetProductCommodityGetCommodityCheckRecordResponse, GetProductCommodityGetCommodityCheckRecordResponse,
GetProductCommodityGetShopResponse GetProductCommodityGetShopResponse
} from '@/services/ProductApi' } from '@/services/ProductApi'
import moment from 'moment' import moment from 'moment'
import { isGetAccessor } from 'typescript' import { isGetAccessor } from 'typescript'
...@@ -92,13 +92,13 @@ const viewProducts: React.FC<{}> = () => { ...@@ -92,13 +92,13 @@ const viewProducts: React.FC<{}> = () => {
setLogisticResourceSendAddress(provinceName + cityName + districtName + address) setLogisticResourceSendAddress(provinceName + cityName + districtName + address)
}) })
}, [productDetail]) }, [productDetail])
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'memberRoleId', dataIndex: 'memberRoleId',
key: 'memberRoleId', key: 'memberRoleId',
render: (t, c, i) => i + 1 render: (t, c, i) => i + 1
}, },
{ {
title: '角色', title: '角色',
...@@ -139,7 +139,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -139,7 +139,7 @@ const viewProducts: React.FC<{}> = () => {
title: '操作时间', title: '操作时间',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
render: (text: any) => moment(text).format("YYYY-MM-DD HH:mm:ss") render: (text: any) => moment(text).format("YYYY-MM-DD HH:mm:ss")
}, },
{ {
title: '意见', title: '意见',
...@@ -190,7 +190,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -190,7 +190,7 @@ const viewProducts: React.FC<{}> = () => {
component = null component = null
}else }else
if (status === 5) if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>) component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (status === 6) else if (status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>) component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
else else
...@@ -212,7 +212,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -212,7 +212,7 @@ const viewProducts: React.FC<{}> = () => {
<Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item> <Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item> <Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item>
{/* { {/* {
productDetail?.commodityShopList?.length>0 && productDetail?.commodityShopList?.length>0 &&
<Descriptions.Item label="上架商城"> <Descriptions.Item label="上架商城">
{ {
productDetail.commodityShopList.map((item, index)=><span key={index}><img width="24" height="24" style={{borderRadius: '50%', marginRight: 4}} src={item.logoUrl} title={item.name} alt={item.name}/></span>) productDetail.commodityShopList.map((item, index)=><span key={index}><img width="24" height="24" style={{borderRadius: '50%', marginRight: 4}} src={item.logoUrl} title={item.name} alt={item.name}/></span>)
...@@ -224,7 +224,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -224,7 +224,7 @@ const viewProducts: React.FC<{}> = () => {
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item> <Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item>
</Descriptions> </Descriptions>
</> </>
const renderPriceType = (type: number) => { const renderPriceType = (type: number) => {
if(type === 1 ) return '现货价格' if(type === 1 ) return '现货价格'
if(type === 2 ) return '价格需要询价' if(type === 2 ) return '价格需要询价'
...@@ -262,22 +262,22 @@ const viewProducts: React.FC<{}> = () => { ...@@ -262,22 +262,22 @@ const viewProducts: React.FC<{}> = () => {
}) })
attributeByValue.map(_ => { attributeByValue.map(_ => {
_col.push({ _col.push({
title: _.name, title: _.name,
dataIndex: _.name, dataIndex: _.name,
key: '索引' key: '索引'
}) })
}) })
} }
if(item.goods?.id){ // 存在货品 if(item.goods?.id){ // 存在货品
_col.push({ _col.push({
title: '对应货品', title: '对应货品',
dataIndex: '对应货品', dataIndex: '对应货品',
key: '索引', key: '索引',
}) })
} }
} }
_col.push({ _col.push({
title: product?.priceType===3?'所需积分':'单价(元)', title: product?.priceType===3?'所需积分':'单价(元)',
dataIndex: '单价', dataIndex: '单价',
key: '单价', key: '单价',
render: (text, record) => { render: (text, record) => {
...@@ -344,8 +344,8 @@ const viewProducts: React.FC<{}> = () => { ...@@ -344,8 +344,8 @@ const viewProducts: React.FC<{}> = () => {
return <> return <>
<p> <p>
{ {
str === 'area' str === 'area'
? ?
showDataSource.map((_item, _i) => <p key={_i}>{_item.provinceName+'/'+(_item.cityName||'')}</p>) showDataSource.map((_item, _i) => <p key={_i}>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
: :
showDataSource.map((_item, _i) => <p key={_i}>{_item.name}</p>) showDataSource.map((_item, _i) => <p key={_i}>{_item.name}</p>)
...@@ -419,7 +419,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -419,7 +419,7 @@ const viewProducts: React.FC<{}> = () => {
</Col> </Col>
</Row> </Row>
{ {
productDetail?.commodityShopList?.length>0 && productDetail?.commodityShopList?.length>0 &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>上架商城:</p> <p>上架商城:</p>
...@@ -438,7 +438,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -438,7 +438,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={8}> <Col span={8}>
<Card headStyle={{borderBottom:'none'}} title="物流信息" style={{height:'100%'}}> <Card headStyle={{borderBottom:'none'}} title="物流信息" style={{height:'100%'}}>
{ {
renderDeliveryType(productDetail?.logistics?.deliveryType) && renderDeliveryType(productDetail?.logistics?.deliveryType) &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>配送方式:</p> <p>配送方式:</p>
...@@ -460,7 +460,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -460,7 +460,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
productDetail?.logistics?.weight && productDetail?.logistics?.weight &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>重量:</p> <p>重量:</p>
...@@ -471,7 +471,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -471,7 +471,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
logisticTemplateName && logisticTemplateName &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>运费模版:</p> <p>运费模版:</p>
...@@ -482,7 +482,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -482,7 +482,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
logisticResourceCompanyName && logisticResourceCompanyName &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>物流公司:</p> <p>物流公司:</p>
...@@ -493,7 +493,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -493,7 +493,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
logisticResourceSendAddress && logisticResourceSendAddress &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>发货地址:</p> <p>发货地址:</p>
...@@ -613,7 +613,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -613,7 +613,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={6}> <Col span={6}>
<p> <p>
{ {
productDetail?.isMemberPrice && '允许使用会员折扣购买' productDetail?.isMemberPrice ? '允许使用会员折扣购买' : '无'
} }
</p> </p>
</Col> </Col>
...@@ -637,7 +637,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -637,7 +637,7 @@ const viewProducts: React.FC<{}> = () => {
{/* 没有价格属性默认一行直接显示图片 */} {/* 没有价格属性默认一行直接显示图片 */}
<div className={styles.productImgBox}> <div className={styles.productImgBox}>
{ {
productDetail?.unitPriceAndPicList[0].commodityPic.length>0 && productDetail?.unitPriceAndPicList[0].commodityPic.map((_item, index) => productDetail?.unitPriceAndPicList[0].commodityPic.length>0 && productDetail?.unitPriceAndPicList[0].commodityPic.map((_item, index) =>
<div key={index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/> <div key={index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>) </div>)
} }
...@@ -665,7 +665,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -665,7 +665,7 @@ const viewProducts: React.FC<{}> = () => {
<Divider /> <Divider />
<div className={styles.productImgBox}> <div className={styles.productImgBox}>
{ {
imageArrByImageRender.length>0 && imageArrByImageRender[index].map((_item, _index) => imageArrByImageRender.length>0 && imageArrByImageRender[index].map((_item, _index) =>
<div key={_index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/> <div key={_index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>) </div>)
} }
...@@ -680,7 +680,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -680,7 +680,7 @@ const viewProducts: React.FC<{}> = () => {
<Card headStyle={{borderBottom:'none'}} title="商品描述"> <Card headStyle={{borderBottom:'none'}} title="商品描述">
{/* 文字区块 */} {/* 文字区块 */}
{ {
productDetail?.commodityRemark?.word?.length>0 && productDetail?.commodityRemark?.word?.length>0 &&
<div className={cx(styles.descriptionBox, styles.descriptionWordBox)}> <div className={cx(styles.descriptionBox, styles.descriptionWordBox)}>
{ {
productDetail?.commodityRemark?.word.map((_item, _index) => productDetail?.commodityRemark?.word.map((_item, _index) =>
...@@ -691,7 +691,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -691,7 +691,7 @@ const viewProducts: React.FC<{}> = () => {
} }
{/* 视频区块 */} {/* 视频区块 */}
{ {
productDetail?.commodityRemark?.video?.length>0 && productDetail?.commodityRemark?.video?.length>0 &&
<div className={styles.descriptionBox}> <div className={styles.descriptionBox}>
{ {
productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}> productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
...@@ -704,7 +704,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -704,7 +704,7 @@ const viewProducts: React.FC<{}> = () => {
} }
{/* 图片区块 */} {/* 图片区块 */}
{ {
productDetail?.commodityRemark?.image?.length>0 && productDetail?.commodityRemark?.image?.length>0 &&
<div className={styles.descriptionBox}> <div className={styles.descriptionBox}>
{ {
productDetail?.commodityRemark?.image.map((_item, _index)=> _item && <div key={_index} className={styles.imgItem}> productDetail?.commodityRemark?.image.map((_item, _index)=> _item && <div key={_index} className={styles.imgItem}>
......
...@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react' ...@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
import cx from 'classnames' import cx from 'classnames'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { GetPayCreditGetCreditResponse } from '@/services/PayApi' import { GetPayCreditGetCreditResponse } from '@/services/PayApi'
import { message } from 'antd'
import { DownOutlined } from '@ant-design/icons' import { DownOutlined } from '@ant-design/icons'
import alipayIcon from '@/assets/imgs/alipay_icon.png' import alipayIcon from '@/assets/imgs/alipay_icon.png'
import wechatIcon from '@/assets/imgs/wechat_icon.png' import wechatIcon from '@/assets/imgs/wechat_icon.png'
...@@ -48,6 +49,7 @@ const PayWay: React.FC<PayWayProps> = (props) => { ...@@ -48,6 +49,7 @@ const PayWay: React.FC<PayWayProps> = (props) => {
} }
PublicApi.getPayCreditGetCredit(param).then(res => { PublicApi.getPayCreditGetCredit(param).then(res => {
message.destroy()
if(res.code === 1000) { if(res.code === 1000) {
setCreditInfo(res.data) setCreditInfo(res.data)
} }
......
...@@ -206,8 +206,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -206,8 +206,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
}).then(res => { }).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
setBalanceInfo(res.data) setBalanceInfo(res.data)
} else {
message.error(res.message)
} }
setIsSpin(false) setIsSpin(false)
}) })
......
...@@ -71,7 +71,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => { ...@@ -71,7 +71,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
orderProductList: logsiticsDataMaps.map(v => ({ orderProductList: logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId, templateId: v.logistics.templateId,
weight: v.logistics.weight, weight: v.logistics.weight,
count: v?.purchaseCount || null count: v?.purchaseCount || 0
})), })),
receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => { }, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
......
...@@ -9,7 +9,7 @@ import { message } from 'antd' ...@@ -9,7 +9,7 @@ import { message } from 'antd'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => { export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => {
const paywayData = useRef<any>({}) const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns) const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const { productSumPrice } = useContext(ReadyAddOrderDetailContext) // const { schemaActions, detailData } = useContext(ReadyAddOrderDetailContext)
const components = { const components = {
body: { body: {
row: EditableRow, row: EditableRow,
...@@ -68,6 +68,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -68,6 +68,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
// }) // })
// }, []) // }, [])
useEffect(() => { useEffect(() => {
// 当选择报价单/会员/商品时有memberId传入时 调用支付方式api // 当选择报价单/会员/商品时有memberId传入时 调用支付方式api
if(memberId) { if(memberId) {
...@@ -75,28 +76,36 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -75,28 +76,36 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
} }
}, [memberId]) }, [memberId])
// useEffect(() => {
// // 当有商品数据传入的时 判断商品只有是物流的才能使用到付
// if(orderProducts?.length) {
// const newColumns = [...columns]
// let options = newColumns[5].formItemProps.options
// if(orderProducts.filter(item => item.deliveryType === 1).length !== orderProducts.length) {
// if(options.filter(_item => _item.payType === 4).length) {
// options.filter(_item => _item.payType === 4)[0].disabled = true
// }
// } else {
// if(options.filter(_item => _item.payType === 4).length) {
// options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// // 多次支付也要禁用到付
// if(ctx.getFieldValue('paymentInformationResponses').length > 1) {
// if(options.filter(_item => _item.payType === 4).length)
// options.filter(_item => _item.payType === 4)[0].disabled = true
// } else {
// if(options.filter(_item => _item.payType === 4).length)
// options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// }, [orderProducts, columns])
useEffect(() => { useEffect(() => {
// 当有商品数据传入的时 判断商品只有是物流的才能使用到付
if(orderProducts?.length) { if(orderProducts?.length) {
const newColumns = [...columns] restrictArrivalPay(columns, orderProducts)
let options = newColumns[5].formItemProps.options
if(orderProducts.filter(item => item.deliveryType === 1).length !== orderProducts.length) {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true
} else {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false
}
// 多次支付也要禁用到付
if(ctx.getFieldValue('paymentInformationResponses').length > 1) {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true
} else {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false
}
} }
}, [orderProducts, columns]) }, [orderProducts])
const getPayLists = (memberId, memberRoleId) => { const getPayLists = (memberId, memberRoleId) => {
PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => { PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => {
...@@ -105,7 +114,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -105,7 +114,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
const newColumns = [...columns] const newColumns = [...columns]
newColumns[5].formItemProps.options = initPayWayList(data) newColumns[5].formItemProps.options = initPayWayList(data)
paywayData.current = data paywayData.current = data
restrictArrivalPay(newColumns, orderProducts)
setColumns(newColumns) setColumns(newColumns)
} else { } else {
message.error(res.message) message.error(res.message)
...@@ -113,6 +122,39 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -113,6 +122,39 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}) })
} }
// 限制使用到付(多次支付和商品仅有物流)
const restrictArrivalPay = (cols, pros) => {
if(pros?.length) {
// const newColumns = [...columns]
const newColumns = [...cols]
let options = newColumns[5].formItemProps.options
if(pros.filter(item => item.deliveryType === 1).length !== pros.length) {
if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = true
}
} else {
if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = false
}
}
setTimeout(() => {
let payment = ctx.getFieldValue('paymentInformationResponses')
// 多次支付也要禁用到付
if(payment?.length > 1) {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true
}
else {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false
}
} , 1000)
setColumns(newColumns)
}
}
const handleSave = row => { const handleSave = row => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('paymentInformationResponses')]; const newData = [...ctx.getFieldValue('paymentInformationResponses')];
......
...@@ -95,6 +95,9 @@ export const useSelfTable = () => { ...@@ -95,6 +95,9 @@ export const useSelfTable = () => {
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.DELIVERY_APPROVED_SUCCESS && { record.purchaseOrderInteriorState === SaleOrderInsideWorkState.DELIVERY_APPROVED_SUCCESS &&
<Button type='link' onClick={() => handlePreview(record)}>查看物流单</Button> <Button type='link' onClick={() => handlePreview(record)}>查看物流单</Button>
} }
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.NOT_ACCEPTED_DELIVERY &&
<Button type='link' onClick={() => handleModify(record)}>修改物流单</Button>
}
</> </>
} }
] ]
...@@ -115,6 +118,11 @@ export const useSelfTable = () => { ...@@ -115,6 +118,11 @@ export const useSelfTable = () => {
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail?id=${logisticsId}&invoicesTypeId=2`) history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail?id=${logisticsId}&invoicesTypeId=2`)
} }
const handleModify = async (record) => {
const logisticsId = record.logisticsId
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit?id=${logisticsId}`)
}
return { return {
columns: customOrderColumns columns: customOrderColumns
} }
......
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