Commit d66023ca authored by XieZhiXiong's avatar XieZhiXiong
parents 4d6afff9 28c0ace3
...@@ -42,12 +42,12 @@ interface imgItemType { ...@@ -42,12 +42,12 @@ interface imgItemType {
const integralPayWay = [ const integralPayWay = [
{ {
payType: 5, payType: 0,
payVal: "积分支付", payVal: "积分支付",
payList: [ payList: [
{ {
id: 8, id: 0,
payType: 5, payType: 0,
way: "积分支付" way: "积分支付"
} }
] ]
......
...@@ -17,7 +17,7 @@ import SignModal from '@/components/SignModal' ...@@ -17,7 +17,7 @@ import SignModal from '@/components/SignModal'
import { isEmpty } from 'lodash' import { isEmpty } from 'lodash'
import { GlobalConfig } from '@/global/config' import { GlobalConfig } from '@/global/config'
import { getAuth } from '@/utils/auth' import { getAuth } from '@/utils/auth'
import { LAYOUT_TYPE, OrderModalType, COMMODITY_TYPE } from '@/constants' import { LAYOUT_TYPE, OrderModalType, COMMODITY_TYPE, ORDER_TYPE2_POINTS, ORDER_TYPE2_CHANNEL_POINTS } from '@/constants'
interface OrderPropsType { interface OrderPropsType {
location: any; location: any;
...@@ -232,13 +232,25 @@ const Order: React.FC<OrderPropsType> = (props) => { ...@@ -232,13 +232,25 @@ const Order: React.FC<OrderPropsType> = (props) => {
let mode = OrderModalType.PURCHASE_ORDER let mode = OrderModalType.PURCHASE_ORDER
switch (layoutType) { switch (layoutType) {
case LAYOUT_TYPE.channel: case LAYOUT_TYPE.channel:
mode = OrderModalType.CHANNEL_DIRECT_PURCHASE_ORDER if (Number(type) === COMMODITY_TYPE.integral) {
mode = 25
} else {
mode = OrderModalType.CHANNEL_DIRECT_PURCHASE_ORDER
}
break break
case LAYOUT_TYPE.ichannel: case LAYOUT_TYPE.ichannel:
mode = OrderModalType.CHANNEL_SPOT_PURCHASE_ORDER if (Number(type) === COMMODITY_TYPE.integral) {
mode = 25
} else {
mode = OrderModalType.CHANNEL_SPOT_PURCHASE_ORDER
}
break break
default: default:
mode = OrderModalType.PURCHASE_ORDER if (Number(type) === COMMODITY_TYPE.integral) {
mode = 24
} else {
mode = OrderModalType.PURCHASE_ORDER
}
break break
} }
return mode return mode
......
...@@ -94,19 +94,3 @@ ...@@ -94,19 +94,3 @@
color: #909399; color: #909399;
} }
} }
.pay_btn {
width: 160px;
height: 50px;
color: #ffffff;
text-align: center;
line-height: 50px;
background-color: #D32F2F;
cursor: pointer;
margin-top: 20px;
&:hover {
opacity: .9;
}
}
\ No newline at end of file
import React, { useState } from 'react' import React, { useState, useEffect } from 'react'
import cx from 'classnames' import cx from 'classnames'
import { LAYOUT_TYPE } from '@/constants'
import PasswordInput from '../passwordInput' import PasswordInput from '../passwordInput'
import { Button, message, Spin } from 'antd'
import { history } from 'umi'
import { GetOrderOrderPayDetailsResponse } from '@/services/OrderApi'
import { GetPayAssetAccountGetUserBalanceResponse } from "@/services/PayApi";
import { GetMemberSecurityGetResponse } from '@/services/MemberApi'
import { priceFormat } from '@/utils/numberFomat'
import { PublicApi } from '@/services/api'
import { linkToUrl } from '../../utils'
import styles from './index.less' import styles from './index.less'
interface BablancePayWayPropsType { interface BablancePayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse,
orderInfo: any,
orderId: number,
onChange: Function,
layoutType?: LAYOUT_TYPE,
shopUrlParam?: string
} }
const BablancePayWay: React.FC<BablancePayWayPropsType> = () => { const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
const { payInfo, orderId, orderInfo, layoutType, shopUrlParam } = props
const [balanceInfo, setBalanceInfo] = useState<GetPayAssetAccountGetUserBalanceResponse>(0)
const [securityInfo, setSecurityInfo] = useState<GetMemberSecurityGetResponse>()
const [payPassword, setPayPassword] = useState<string>('') const [payPassword, setPayPassword] = useState<string>('')
const [type, setType] = useState<string>('normal') // normal: 普通;member:会员 const [type, setType] = useState<string>('normal') // normal: 普通;member:会员
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [pageLoading, setPageLoading] = useState<boolean>(true)
const [payDisabled, setPayDisabled] = useState<boolean>(false)
const handlePasswordChange = (value: string) => { const handlePasswordChange = (value: string) => {
setPayPassword(value) setPayPassword(value)
} }
useEffect(() => {
if (orderInfo) {
fetchBalanceInfo()
fetchSecurity()
}
}, [orderInfo])
const fetchBalanceInfo = () => {
let param = {
parentMemberId: orderInfo.supplyMembersId,
parentMemberRoleId: orderInfo.supplyMembersRoleId
}
PublicApi.getPayAssetAccountGetUserBalance(param).then(res => {
if (res.code === 1000) {
setBalanceInfo(res.data)
setPageLoading(false)
}
})
}
const fetchSecurity = () => {
PublicApi.getMemberSecurityGet().then(res => {
if (res.code === 1000) {
setSecurityInfo(res.data)
}
})
}
const pay = () => {
if(balanceInfo < payInfo.payPrice) {
message.info("账户余额不足")
return
}
if (!payPassword || payPassword.length < 6) {
message.info("请输入支付密码")
return
}
let param = {
id: Number(orderId),
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: Number(payPassword)
}
setConfirmLoading(true)
//@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => {
if (res.code === 1000) {
message.destroy()
message.success("支付成功")
linkToUrl(`/pay/result?orderId=${orderId}`, layoutType, shopUrlParam)
} else {
setConfirmLoading(false)
message.destroy()
message.error(res.message)
}
}).catch(() => {
setConfirmLoading(false)
})
}
return ( return (
<> <Spin spinning={pageLoading}>
<div className={styles.common_title}> <div className={styles.common_title}>
<span>余额支付</span> <span>余额支付</span>
<div className={styles.common_title_amount}> <div className={styles.common_title_amount}>
<label>当前需支付:</label> <label>当前需支付:</label>
<span>20,000</span> <span>{priceFormat(payInfo?.payPrice)}</span>
<label>RMB</label> <label>RMB</label>
</div> </div>
</div> </div>
...@@ -31,25 +113,34 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = () => { ...@@ -31,25 +113,34 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = () => {
<div className={styles.pay_point_way_list_item_title}>账户可用余额</div> <div className={styles.pay_point_way_list_item_title}>账户可用余额</div>
<div className={styles.pay_point_way_list_item_content}> <div className={styles.pay_point_way_list_item_content}>
<div className={styles.pay_point_way_list_item_point}> <div className={styles.pay_point_way_list_item_point}>
<label>30,000</label> <label>{balanceInfo}</label>
<span>RMB</span> <span>RMB</span>
</div> </div>
<div className={styles.pay_point_way_list_item_split}></div> <div className={styles.pay_point_way_list_item_split}></div>
<div className={styles.pay_point_way_list_item_needpay}> <div className={styles.pay_point_way_list_item_needpay}>
<label>当前需支付:</label> <label>当前需支付:</label>
<span>20,000</span> <span>{priceFormat(payInfo?.payPrice)}</span>
<label>RMB</label> <label>RMB</label>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div className={styles.pay_wray}> {
<div className={styles.pay_wray_title}>请输入支付密码</div> securityInfo && securityInfo.hasPayPassword === 1 ? (
<PasswordInput value={payPassword} onChange={handlePasswordChange} /> <div className={styles.pay_wray}>
<div className={styles.pay_btn}>立即支付</div> <div className={styles.pay_wray_title}>请输入支付密码</div>
</div> <PasswordInput value={payPassword} onChange={handlePasswordChange} />
</> <Button loading={confirmLoading} className={styles.pay_btn} onClick={() => pay()}>立即支付</Button>
</div>
) : (
<div className={styles.pay_wray}>
<div className={styles.pay_wray_title}>您还没有设置支付密码</div>
<Button loading={confirmLoading} disabled={payDisabled} className={styles.pay_btn} onClick={() => history.push(`/memberCenter/systemSetting/accountSetting/paycode?backPay=true`)} >去设置密码</Button>
</div>
)
}
</Spin>
) )
} }
......
...@@ -76,19 +76,3 @@ ...@@ -76,19 +76,3 @@
color: #909399; color: #909399;
} }
} }
.pay_btn {
width: 160px;
height: 50px;
color: #ffffff;
text-align: center;
line-height: 50px;
background-color: #D32F2F;
cursor: pointer;
margin-top: 20px;
&:hover {
opacity: .9;
}
}
\ No newline at end of file
import React, { useState } from 'react' import React, { useState, useEffect } from 'react'
import cx from 'classnames' import cx from 'classnames'
import PasswordInput from '../passwordInput' import PasswordInput from '../passwordInput'
import { LAYOUT_TYPE } from '@/constants'
import { history } from 'umi'
import { GetOrderOrderPayDetailsResponse } from '@/services/OrderApi'
import { GetMemberSecurityGetResponse } from '@/services/MemberApi'
import { Button, message } from 'antd'
import { numFormat } from '@/utils/numberFomat'
import { PublicApi } from '@/services/api'
import { linkToUrl } from '../../utils'
import styles from './index.less' import styles from './index.less'
interface PointPayWayPropsType { interface PointPayWayPropsType {
payInfo: GetOrderOrderPayDetailsResponse,
orderInfo: any,
orderId: number,
onChange: Function,
layoutType?: LAYOUT_TYPE,
shopUrlParam?: string
} }
const PointPayWay: React.FC<PointPayWayPropsType> = () => { const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
const { payInfo, orderId, orderInfo, layoutType, shopUrlParam } = props
const [securityInfo, setSecurityInfo] = useState<GetMemberSecurityGetResponse>()
const [payPassword, setPayPassword] = useState<string>('') const [payPassword, setPayPassword] = useState<string>('')
const [type, setType] = useState<string>('normal') // normal: 普通;member:会员 const [type, setType] = useState<string>('normal') // normal: 普通;member:会员
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [payDisabled, setPayDisabled] = useState<boolean>(false)
const handlePasswordChange = (value: string) => { const handlePasswordChange = (value: string) => {
setPayPassword(value) setPayPassword(value)
...@@ -19,13 +36,57 @@ const PointPayWay: React.FC<PointPayWayPropsType> = () => { ...@@ -19,13 +36,57 @@ const PointPayWay: React.FC<PointPayWayPropsType> = () => {
setType(type) setType(type)
} }
useEffect(() => {
if (orderInfo) {
fetchSecurity()
}
}, [orderInfo])
const fetchSecurity = () => {
PublicApi.getMemberSecurityGet().then(res => {
if (res.code === 1000) {
setSecurityInfo(res.data)
}
})
}
const pay = () => {
if (!payPassword || payPassword.length < 6) {
message.error("请输入支付密码")
return
}
let param = {
id: Number(orderId),
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: Number(payPassword)
}
setConfirmLoading(true)
//@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => {
if (res.code === 1000) {
message.destroy()
message.success("支付成功")
linkToUrl(`/pay/result?orderId=${orderId}`, layoutType, shopUrlParam)
} else {
setConfirmLoading(false)
message.destroy()
message.error(res.message)
}
}).catch(() => {
setConfirmLoading(false)
})
}
return ( return (
<> <>
<div className={styles.common_title}> <div className={styles.common_title}>
<span>积分支付</span> <span>积分支付</span>
<div className={styles.common_title_amount}> <div className={styles.common_title_amount}>
<label>当前需支付:</label> <label>当前需支付:</label>
<span>20,000</span> <span>{numFormat(payInfo?.payPrice)}</span>
<label>积分</label> <label>积分</label>
</div> </div>
</div> </div>
...@@ -53,11 +114,20 @@ const PointPayWay: React.FC<PointPayWayPropsType> = () => { ...@@ -53,11 +114,20 @@ const PointPayWay: React.FC<PointPayWayPropsType> = () => {
</div> </div>
</div> </div>
</div> </div>
<div className={styles.pay_wray}> {
<div className={styles.pay_wray_title}>请输入支付密码</div> securityInfo && securityInfo.hasPayPassword === 1 ? (
<PasswordInput value={payPassword} onChange={handlePasswordChange} /> <div className={styles.pay_wray}>
<div className={styles.pay_btn}>立即支付</div> <div className={styles.pay_wray_title}>请输入支付密码</div>
</div> <PasswordInput value={payPassword} onChange={handlePasswordChange} />
<Button loading={confirmLoading} className={styles.pay_btn} onClick={() => pay()}>立即支付</Button>
</div>
) : (
<div className={styles.pay_wray}>
<div className={styles.pay_wray_title}>您还没有设置支付密码</div>
<Button loading={confirmLoading} disabled={payDisabled} className={styles.pay_btn} onClick={() => history.push(`/memberCenter/systemSetting/accountSetting/paycode?backPay=true`)} >去设置密码</Button>
</div>
)
}
</> </>
) )
} }
......
...@@ -15,11 +15,12 @@ ...@@ -15,11 +15,12 @@
&_imgbox { &_imgbox {
padding: 20px; padding: 20px;
width: 180px;
height: 180px;
border: 1px solid rgba(245, 245, 245, 1); border: 1px solid rgba(245, 245, 245, 1);
&>img { &>img {
width: 200px; width: 200px;
height: 200px; height: 200px;
} }
} }
......
...@@ -2,9 +2,10 @@ import React, { useEffect } from 'react' ...@@ -2,9 +2,10 @@ import React, { useEffect } from 'react'
import { GetOrderOrderPayDetailsResponse } from '@/services/OrderApi' import { GetOrderOrderPayDetailsResponse } from '@/services/OrderApi'
import { LAYOUT_TYPE } from '@/constants' import { LAYOUT_TYPE } from '@/constants'
import wechatIcon from '@/assets/imgs/wechat_icon.png' import wechatIcon from '@/assets/imgs/wechat_icon.png'
import wechatImg from '@/assets/imgs/wechat.png'
import { priceFormat } from '@/utils/numberFomat' import { priceFormat } from '@/utils/numberFomat'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { message, Spin } from 'antd'
import QRCode from 'qrcode'
import styles from './index.less' import styles from './index.less'
import { useState } from 'react' import { useState } from 'react'
...@@ -19,12 +20,23 @@ interface WechatPayWayPropsType { ...@@ -19,12 +20,23 @@ interface WechatPayWayPropsType {
const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => { const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
const { payInfo, orderId, onChange, orderInfo, layoutType, shopUrlParam } = props const { payInfo, orderId, onChange, orderInfo, layoutType, shopUrlParam } = props
const [wechatPayUrl, setWechatPayUrl] = useState<string>('') const [wechatPayUrl, setWechatPayUrl] = useState<any>('')
const [pageLoading, setPageLoading] = useState<boolean>(true)
useEffect(() => { useEffect(() => {
pay() pay()
}, []) }, [])
const generateQrCode = (path: any) => {
// 生成二维码
QRCode.toDataURL(path).then((url: any) => {
setWechatPayUrl(url)
})
.catch((err: any) => {
console.error(err)
})
}
const pay = () => { const pay = () => {
let param = { let param = {
id: Number(orderId), id: Number(orderId),
...@@ -34,14 +46,20 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => { ...@@ -34,14 +46,20 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
} }
//@ts-ignore //@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => { PublicApi.postOrderPendingOrderPay(param).then(res => {
if(res.code === 1000) {
message.destroy()
generateQrCode(res.data)
}
setPageLoading(false)
// setWechatPayUrl(res.data) // setWechatPayUrl(res.data)
}).catch(() => { }).catch(() => {
onChange(false) onChange(false)
setPageLoading(false)
}) })
} }
return ( return (
<> <Spin spinning={pageLoading}>
<div className={styles.common_title}> <div className={styles.common_title}>
<div className={styles.common_title_icon}><img src={wechatIcon} /></div> <div className={styles.common_title_icon}><img src={wechatIcon} /></div>
<span>微信支付</span> <span>微信支付</span>
...@@ -49,7 +67,7 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => { ...@@ -49,7 +67,7 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
<div className={styles.wechat_payway}> <div className={styles.wechat_payway}>
<p className={styles.wechat_payway_title}>使用微信扫一扫下方二维码</p> <p className={styles.wechat_payway_title}>使用微信扫一扫下方二维码</p>
<div className={styles.wechat_payway_imgbox}> <div className={styles.wechat_payway_imgbox}>
<img src={wechatImg} /> {wechatPayUrl && <img src={wechatPayUrl} />}
</div> </div>
<div className={styles.wechat_payway_needpay}> <div className={styles.wechat_payway_needpay}>
<label>当前需支付:</label> <label>当前需支付:</label>
...@@ -57,7 +75,7 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => { ...@@ -57,7 +75,7 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
<label>RMB</label> <label>RMB</label>
</div> </div>
</div> </div>
</> </Spin>
) )
} }
......
...@@ -22,7 +22,7 @@ interface PayPagePropsType { ...@@ -22,7 +22,7 @@ interface PayPagePropsType {
} }
enum PayWayType { enum PayWayType {
point = 'point', // 积分支付 point = 0, // 积分支付
balance = 4, // 余额支付 balance = 4, // 余额支付
credit = 6, // 授信额度支付 credit = 6, // 授信额度支付
wechat = 2, // 微信支付 wechat = 2, // 微信支付
...@@ -101,15 +101,15 @@ const PayPage: React.FC<PayPagePropsType> = (props) => { ...@@ -101,15 +101,15 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
switch (payInfo.paymentChannelsId) { switch (payInfo.paymentChannelsId) {
case PayWayType.point: case PayWayType.point:
return <PointPayWay /> return <PointPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} />
case PayWayType.balance: case PayWayType.balance:
return <BablancePayWay /> return <BablancePayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} />
case PayWayType.credit: case PayWayType.credit:
return <CreditPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} /> return <CreditPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} />
case PayWayType.wechat: case PayWayType.wechat:
return <WechatPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} /> return <WechatPayWay payInfo={payInfo} orderInfo={orderInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} />
case PayWayType.bank: case PayWayType.bank:
return <BankPayWay /> return <BankPayWay />
case PayWayType.transfer: case PayWayType.transfer:
return <TransferPayWay payInfo={payInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} /> return <TransferPayWay payInfo={payInfo} orderId={orderId} onChange={(state) => handlePayChangge(state)} {...props} />
default: default:
......
...@@ -103,6 +103,7 @@ export const CREDIT_INNER_STATUS_BADGE_MAP = { ...@@ -103,6 +103,7 @@ export const CREDIT_INNER_STATUS_BADGE_MAP = {
'6': { title: '支付中', type: 'processing' }, '6': { title: '支付中', type: 'processing' },
'7': { title: '支付失败', type: 'danger' }, '7': { title: '支付失败', type: 'danger' },
'8': { title: '确认到账', type: 'success' }, '8': { title: '确认到账', type: 'success' },
'9': { title: '支付成功', type: 'success' },
} }
// 流转状态 // 流转状态
......
...@@ -126,7 +126,7 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => { ...@@ -126,7 +126,7 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
const fetchProductList = async (params) => { const fetchProductList = async (params) => {
const shopType = addSchemaAction.getFieldValue('shopType') const shopType = addSchemaAction.getFieldValue('shopType')
const res = await PublicApi.getProductCommodityCommonGetCommodityListBySeller({ const res = await PublicApi.getProductCommodityCommonGetCommodityListByStock({
...params, ...params,
shopType, shopType,
environment: 1, environment: 1,
...@@ -245,12 +245,12 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => { ...@@ -245,12 +245,12 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
const fetchMemberList = async (params) => { const fetchMemberList = async (params) => {
const shopType = addSchemaAction.getFieldValue('shopType'); const shopType = addSchemaAction.getFieldValue('shopType');
// 当商城类型为 渠道商城、渠道自由商城和渠道积分商城时,需要带上下面两个参数 // 当商城类型为 渠道商城、渠道自由商城和渠道积分商城时,需要带上下面两个参数
const { channelMemberIdList, channelMemberRoleId } = productState; const { channelMemberIdList, channelMemberRoleIdList } = productState;
const data = { const data = {
...params, ...params,
shopType: shopType, shopType: shopType,
memberIds: channelMemberIdList, memberIds: channelMemberIdList,
// roleId: channelMemberRoleId roleIds: channelMemberRoleIdList
} }
const res = await PublicApi.postMemberManageAllPageByshoptype(data, {ctlType: 'none'}); const res = await PublicApi.postMemberManageAllPageByshoptype(data, {ctlType: 'none'});
return res.data return res.data
......
...@@ -76,11 +76,15 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -76,11 +76,15 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const { run, loading } = useHttpRequest(PublicApi.postOrderPendingOrderPay) const { run, loading } = useHttpRequest(PublicApi.postOrderPendingOrderPay)
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [checked, setChecked] = useState<any>({}) const [checked, setChecked] = useState<any>({})
const [current, setCurrent] = useState(0) // 0选择方式 1线下支付方式 2授信支付 3余额支付 1000清除 const [current, setCurrent] = useState(0) // 0选择方式 1线下支付方式 2授信支付 3余额支付 4微信支付 1000清除
const [payStep, setPayStep] = useState(0) // 支付模态框的步骤 0选方式 1下一步的具体操作 2输入支付密码 const [payStep, setPayStep] = useState(0) // 支付模态框的步骤 0选方式 1下一步的具体操作 2输入支付密码
const [code, setCode] = useState('') const [code, setCode] = useState('')
const [number, setNumber] = useState([0,1,2,3,4,5]) const [number, setNumber] = useState([0,1,2,3,4,5])
const { currentRef, confirm } = props const { currentRef, confirm } = props
const [currentPayInfo, setCurrentPayInfo] = useState<any>()
const [creditInfo, setCreditInfo] = useState<any>()
const [balanceInfo, setBalanceInfo] = useState<any>()
useEffect(() => { useEffect(() => {
if (currentRef) { if (currentRef) {
currentRef.current = { currentRef.current = {
...@@ -98,19 +102,43 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -98,19 +102,43 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
} }
}, [visible]) }, [visible])
const handleConfirm = async () => { const handleConfirm = () => {
console.log(data,'data')
if (current === 0) { if (current === 0) {
if (checked.id) { if (checked.id) {
if (checked.id === 5) { // 线下支付 if (checked.id === 5) { // 线下支付
setCurrent(1) setCurrent(1)
setPayStep(1) setPayStep(1)
} else if (checked.id === 6) { // 授信额度支付 } else if (checked.id === 6) { // 授信额度支付
console.log('选择了授信支付')
PublicApi.getPayCreditGetCredit({parentMemberId: data.supplyMembersId, parentMemberRoleId: data.supplyMembersRoleId}).then(res => {
if(res.code === 1000) {
setCreditInfo(res.data)
} else {
message.error(res.message)
}
})
setCurrent(2) setCurrent(2)
setPayStep(1) setPayStep(1)
} else if (checked.id === 4) { } else if (checked.id === 4) { // 余额支付
console.log('选择了余额支付')
PublicApi.getPayAssetAccountGetUserBalance({parentMemberId: data.supplyMembersId, parentMemberRoleId: data.supplyMembersRoleId}).then(res => {
if(res.code === 1000) {
setBalanceInfo(res.data)
} else {
message.error(res.message)
}
})
setCurrent(3) setCurrent(3)
setPayStep(1) setPayStep(1)
} else { }
// else if(checked.id === 2) {
// console.log('选择了微信支付')
// setCurrent(4)
// setPayStep(1)
// handleSubmitPay()
// }
else {
message.error('暂只支持线下支付、授信额度支付、余额支付方式') message.error('暂只支持线下支付、授信额度支付、余额支付方式')
} }
} else { } else {
...@@ -118,7 +146,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -118,7 +146,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
} }
return; return;
} }
// console.log(confirm, current, payStep, '119') let payPrice = data.paymentInformationResponses.filter(item => item.id === Number(currentPayInfoId))[0].payPrice
// 开始提交线下支付数据 // 开始提交线下支付数据
if(current === 1) { if(current === 1) {
const payOrderUrls = formRef.current.urlList const payOrderUrls = formRef.current.urlList
...@@ -131,33 +159,25 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -131,33 +159,25 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
message.error('未选择支付方式') message.error('未选择支付方式')
return; return;
} }
handleSubmitPay()
// 当前选中的支付信息
let PayInfoObj = data.paymentInformationResponses.filter(item => item.id === Number(currentPayInfoId))[0]
const params = {
id: Number(id),
payOrderUrls: payOrderUrls.join(','),
paymentInformationId: PayInfoObj.id,
payTypeId: PayInfoObj.channel,
// // 预留
// payPassword,
// remark
}
const { code } = await run(params)
if (code === 1000) {
history.goBack()
}
} else if (current === 2) { } else if (current === 2) {
// 开始提交授信支付数据 (需要输入支付密码) // 开始提交授信支付数据 (需要输入支付密码)
console.log('开始提交授信支付数据') console.log('开始提交授信支付数据', payPrice)
setPayStep(2) if(payPrice <= creditInfo.canUseQuota){
setCurrent(1000) setPayStep(2)
setCurrent(1000)
} else {
message.error('您的授信可用额度不足')
}
} else if(current === 3) { } else if(current === 3) {
// 开始提交余额支付数据 (需要输入支付密码) // 开始提交余额支付数据 (需要输入支付密码)
console.log('开始提交余额支付数据') console.log('开始提交余额支付数据', payPrice)
setPayStep(2) if(payPrice <= balanceInfo){
setCurrent(1000) setPayStep(2)
setCurrent(1000)
} else {
message.error('您的账户余额不足')
}
} }
confirm && confirm() confirm && confirm()
...@@ -172,6 +192,36 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -172,6 +192,36 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
} }
} }
const handleSubmitPay = async () => {
const payOrderUrls = formRef.current.urlList
// 当前选中的支付信息
let PayInfoObj = data.paymentInformationResponses.filter(item => item.id === Number(currentPayInfoId))[0]
let params: any = {
id: Number(id),
paymentInformationId: PayInfoObj.id,
payTypeId: checked.id,
}
if(payStep === 2) {
if(code.length != number.length){
return message.error('请输入支付密码')
}
params.payPassword = code
} else if(current === 1) {
params.payOrderUrls = payOrderUrls.join(',')
}
const res = await run(params)
if (res.code === 1000) {
if(current != 4) {
history.goBack()
} else {
console.log(res, '二维码信息')
}
}
}
const handleUploadChange = (e) => { const handleUploadChange = (e) => {
const { fileList } = e const { fileList } = e
const urlList = fileList.map(v => v.response && v.response.code === 1000 ? v.response.data : '') const urlList = fileList.map(v => v.response && v.response.code === 1000 ? v.response.data : '')
...@@ -193,10 +243,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -193,10 +243,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
setCode(v) setCode(v)
} }
useEffect(() => {
console.log(code)
}, [code])
const renderModalFooter = () => { const renderModalFooter = () => {
let footer = null; let footer = null;
if(current){ if(current){
...@@ -211,7 +257,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -211,7 +257,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
] ]
} else if (payStep === 2) { } else if (payStep === 2) {
footer = [ footer = [
<Button key="submit" type="primary" loading={loading} onClick={handleConfirm} style={{width: '100%'}}> <Button key="submit" type="primary" loading={loading} onClick={handleSubmitPay} style={{width: '100%'}}>
确认支付 确认支付
</Button> </Button>
] ]
...@@ -288,7 +334,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -288,7 +334,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
可用授信额度(元): 可用授信额度(元):
</span> </span>
<span className={style.amount}> <span className={style.amount}>
30,000.00 {creditInfo?.canUseQuota?.toFixed(2)}
</span> </span>
</p> </p>
<p> <p>
...@@ -296,7 +342,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -296,7 +342,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
总授信额度(元): 总授信额度(元):
</span> </span>
<span className={cx(style.amount, style.amount1)}> <span className={cx(style.amount, style.amount1)}>
500,000.00 {creditInfo?.quota?.toFixed(2)}
</span> </span>
</p> </p>
<p> <p>
...@@ -304,7 +350,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -304,7 +350,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
已用授信额度(元): 已用授信额度(元):
</span> </span>
<span className={cx(style.amount, style.amount1)}> <span className={cx(style.amount, style.amount1)}>
20,000.00 {creditInfo?.useQuota?.toFixed(2)}
</span> </span>
</p> </p>
<p> <p>
...@@ -312,7 +358,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -312,7 +358,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
本次需支付(元): 本次需支付(元):
</span> </span>
<span className={cx(style.amount, style.amount2)}> <span className={cx(style.amount, style.amount2)}>
48,000.00 {data?.paymentInformationResponses?.filter(item => item.id === Number(currentPayInfoId))[0]?.payPrice?.toFixed(2)}
</span> </span>
</p> </p>
</div> </div>
...@@ -327,7 +373,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -327,7 +373,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
账户可用余额(元): 账户可用余额(元):
</span> </span>
<span className={style.amount}> <span className={style.amount}>
500,000.00 {balanceInfo?.toFixed(2)}
</span> </span>
</p> </p>
<p> <p>
...@@ -335,11 +381,21 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -335,11 +381,21 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
本次需支付(元): 本次需支付(元):
</span> </span>
<span className={cx(style.amount, style.amount2)}> <span className={cx(style.amount, style.amount2)}>
48,000.00 {data?.paymentInformationResponses?.filter(item => item.id === Number(currentPayInfoId))[0]?.payPrice?.toFixed(2)}
</span> </span>
</p> </p>
</div> </div>
} }
{/* 微信扫码支付 */}
{
current === 4 &&
<div>
<p>微信扫码支付</p>
<div>
</div>
</div>
}
{/* 输入支付密码 payStep===2 */} {/* 输入支付密码 payStep===2 */}
{ {
payStep === 2 && payStep === 2 &&
......
...@@ -339,8 +339,8 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => { ...@@ -339,8 +339,8 @@ const OrderProductTable:React.FC<OrderProductTableProps> = ({editable}) => {
dataIndex: 'logistics', dataIndex: 'logistics',
align: 'center', align: 'center',
key: 'logistics', key: 'logistics',
render: (text) => (text && text && text.deliveryType === 2) ? render: (text) => (text && text.deliveryType && text.deliveryType === 2) ?
<AddressPop pickInfo={text}>{DELIVERY_TYPE[text.deliveryType]}</AddressPop> : DELIVERY_TYPE[text.deliveryType] <AddressPop pickInfo={text}>{DELIVERY_TYPE[text.deliveryType]}</AddressPop> : DELIVERY_TYPE[text?.deliveryType]
} }
] ]
......
...@@ -393,8 +393,8 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => { ...@@ -393,8 +393,8 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
dataIndex: 'logistics', dataIndex: 'logistics',
align: 'center', align: 'center',
key: 'logistics', key: 'logistics',
render: (text) => (text && text && text.deliveryType === 2) ? render: (text) => (text && text.deliveryType && text.deliveryType === 2) ?
<AddressPop pickInfo={text}>{DELIVERY_TYPE[text.deliveryType]}</AddressPop> : DELIVERY_TYPE[text.deliveryType] <AddressPop pickInfo={text}>{DELIVERY_TYPE[text.deliveryType]}</AddressPop> : DELIVERY_TYPE[text?.deliveryType]
}, },
{ {
title: '仓位库存扣减记录', title: '仓位库存扣减记录',
......
...@@ -265,9 +265,9 @@ export const productInfoColumns: any[] = [ ...@@ -265,9 +265,9 @@ export const productInfoColumns: any[] = [
}, },
{ {
title: '单价(元)', title: '单价(元)',
dataIndex: 'unitPrice', dataIndex: 'price',
align: 'left', align: 'left',
key: 'unitPrice', key: 'price',
render: text => <PriceComp priceSection={text}/> render: text => <PriceComp priceSection={text}/>
}, },
{ {
...@@ -305,7 +305,14 @@ export const productInfoColumns: any[] = [ ...@@ -305,7 +305,14 @@ export const productInfoColumns: any[] = [
dataIndex: 'logistics', dataIndex: 'logistics',
align: 'center', align: 'center',
key: 'logistics', key: 'logistics',
render: text => (text && text.render) || '' render: (t, r) => {
if(r.logistics?.deliveryType === 1)
return "物流(默认)"
else if(r.logistics?.deliveryType === 2)
return "自提"
else if(r.logistics?.deliveryType === 3)
return "无需配送"
}
}, },
{ {
title: '操作', title: '操作',
......
...@@ -87,7 +87,6 @@ export const useEditHideField = () => { ...@@ -87,7 +87,6 @@ export const useEditHideField = () => {
export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => { export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => { FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => {
const { value } = state const { value } = state
console.log(value)
const payInfoData = ctx.getFieldValue('paymentInformationResponses') const payInfoData = ctx.getFieldValue('paymentInformationResponses')
// 强制渲染一次, 用于触发金额总数 // 强制渲染一次, 用于触发金额总数
update() update()
......
...@@ -181,6 +181,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => { ...@@ -181,6 +181,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
v.isMemberPrice = Number(v.isMemberPrice) v.isMemberPrice = Number(v.isMemberPrice)
v.memberPrice = parseInt(v.memberPrice) v.memberPrice = parseInt(v.memberPrice)
v.imgUrl = v.mainPic v.imgUrl = v.mainPic
v.minOrder = v.minOrder
// v.productId = v.id // v.productId = v.id
// v.productName = v.name // v.productName = v.name
// v.category = v.customerCategoryName // v.category = v.customerCategoryName
......
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