Commit 91cb585e authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理渠道商品修改无权限问题,处理新建采购订单未选择支付方式未校验问题,处理按会员类型和会员角色类型过滤下单类型的问题

parent 6cdba9dd
......@@ -226,7 +226,7 @@ const CommodityRoute: RouterChild = {
},
// 渠道直采商品-编辑
{
path: '/memberCenter/commodityAbility/commodity/products/directChannel/modifyDirectChannel',
path: '/memberCenter/commodityAbility/commodity/products/directChannel/edit',
name: 'editDirectChannel',
hideInMenu: true,
icon: 'smile',
......
......@@ -32,4 +32,22 @@
.radioBox {
display: flex;
flex-wrap: wrap;
}
.title {
display: inline-block;
width: 122px;
font-weight: 400;
}
.amount {
font-size: 24px;
font-weight: 500;
color: #172B4D;
}
.amount1 {
font-size: 16px;
}
.amount2 {
font-size: 16px;
color: #E63F3B;
}
\ No newline at end of file
......@@ -25,6 +25,7 @@ const HeaderTitle = ({ current }) => {
}
const transformPayData = (originData, data): any => {
console.log(originData, data, 'transformPayData')
const result = originData.reduce((prev, next) => {
const findItem = data.find(v => v.id === next.channel) || null
if (!findItem) {
......@@ -43,6 +44,21 @@ const transformPayData = (originData, data): any => {
return result
}
const formatting = (data, property) => {
let nweData = data.reduce(function (acc, obj) {
let key = obj[property];
if (!acc[key]) {
acc[key] = []
}
acc[key].push(obj)
return acc
}, {})
for(let i in nweData){
nweData[i] = nweData[i].map(item => ({ value: item.id, label: item.way, channel: item.payType }))
}
return nweData
}
const payTextList = ["",
'线上支付',
'线下支付',
......@@ -55,12 +71,12 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const { id } = usePageStatus()
const { data, payList } = useContext(OrderDetailContext)
const transformPayList: any = data ? transformPayData(data.paymentInformationResponses, payList) : []
// const transformPayList: any = data ? transformPayData(data.paymentInformationResponses, payList) : []
const transformPayList: any = data ? formatting(payList, "payType") : []
const { run, loading } = useHttpRequest(PublicApi.postOrderPendingOrderPay)
const [visible, setVisible] = useState(false)
const [checked, setChecked] = useState<any>({})
const [current, setCurrent] = useState(0)
const [current, setCurrent] = useState(0) // 1线下支付方式 2授信支付
const { currentRef, confirm } = props
useEffect(() => {
if (currentRef) {
......@@ -81,10 +97,12 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const handleConfirm = async () => {
if (current === 0) {
if (checked.id) {
if (checked.channel === 5) {
if (checked.id === 5) { // 线下支付
setCurrent(1)
} else if (checked.id === 6) { // 授信额度支付
setCurrent(2)
} else {
message.error('暂只支持线下支付方式')
message.error('暂只支持线下支付和授信额度支付方式')
}
} else {
message.error('请先选择支付方式')
......@@ -178,6 +196,45 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
</div>
}
{
current === 2 &&
<div>
<p>授信额度</p>
<p>
<span className={style.title}>
可用授信额度(元):
</span>
<span className={style.amount}>
30,000.00
</span>
</p>
<p>
<span className={style.title}>
总授信额度(元):
</span>
<span className={cx(style.amount, style.amount1)}>
500,000.00
</span>
</p>
<p>
<span className={style.title}>
已用授信额度(元):
</span>
<span className={cx(style.amount, style.amount1)}>
20,000.00
</span>
</p>
<p>
<span className={style.title}>
本次需支付(元):
</span>
<span className={cx(style.amount, style.amount2)}>
48,000.00
</span>
</p>
</div>
}
</Modal>
)
}
......
......@@ -52,6 +52,21 @@ export const orderCombination = {
OrderModalType.CHANNEL_DIRECT_MINING_ORDER,
OrderModalType.CHANNEL_SPOT_MANUAL_ORDER,
OrderModalType.CONSOLIDATED_ORDER
],
// 渠道会员专属下单类型
channelMemberOrderModal: [
OrderModalType.CHANNEL_DIRECT_PURCHASE_ORDER,
OrderModalType.CHANNEL_DIRECT_MINING_ORDER,
OrderModalType.CHANNEL_SPOT_PURCHASE_ORDER,
OrderModalType.CHANNEL_SPOT_MANUAL_ORDER
],
// 企业个人会员专属下单类型
individualsMemberOrderModal: [
OrderModalType.PURCHASE_ORDER,
OrderModalType.HAND_ORDER,
OrderModalType.INQUIRY_QUOTATION_ORDER,
OrderModalType.DEMAND_QUOTATION_ORDER,
OrderModalType.CONSOLIDATED_ORDER,
]
}
......
......@@ -115,22 +115,42 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
// 表单初始化时,对应操作
export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const { modelType = 0, spam_id } = history.location.query
const typeEnums = parseInt(modelType)
let auth = JSON.parse(localStorage.getItem('auth'))
FormEffectHooks.onFormMount$().subscribe(async () => {
// query中存在modelType参数, 则是从其他页面跳转而来,需禁用其余query选项
// 商城跳转过来的数据
const initValue = JSON.parse(window.sessionStorage.getItem(spam_id))
const typeEnums = parseInt(modelType)
ctx.setFieldState('orderModel', state => {
state.props.enum = state.props.enum.map(v => {
const assign: any = Object.assign({}, v)
if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
// 过滤服务提供者
if (auth.memberRoleType === 2) {
// 企业+个人
if ((auth.memberType === 1 || auth.memberType === 2) && assign.value > 9) {
assign.disabled = true
}
// 渠道(企业+个人)
if (auth.memberType === 3 || auth.memberType === 4 && assign.value < 10) {
assign.disabled = true
}
// 商城下单
if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
assign.disabled = true
}
} else {
assign.disabled = true
}
// if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
// assign.disabled = true
// }
return assign
}).sort((prev, next) => prev.disabled ? prev.value : next.value - prev.value)
})
// query中存在modelType参数, 则是从其他页面跳转而来,需禁用其余query选项
// 商城跳转过来的数据
const initValue = JSON.parse(window.sessionStorage.getItem(spam_id))
// 从商城跳转, 需回显数据
if (initValue) {
const fn = async (initValue) => {
......
......@@ -198,6 +198,17 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// theInvoiceInfo: (value.typeof value.theInvoiceId === 'object' ? value.theInvoiceId : null
// theInvoiceInfo: value.theInvoiceInfo
}
// 校验是否选择支付渠道
let judgement = params.paymentInformationResponses.map(item => {
if(item.channel && item.payWay){
return true
} else {
return false
}
})
if(judgement.includes(false)){
throw new Error('请选择支付方式或者支付渠道')
}
setBtnLoading(true)
fnResult = id ? await PublicApi.postOrderProcurementOrderUpdate({...params, id}) : await PublicApi.postOrderProcurementOrderAddReinsurancePolicy(params)
break;
......
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