diff --git a/src/assets/api.js b/src/assets/api.js index f2a33408..d8745964 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -7,8 +7,8 @@ if (process.env.NODE_ENV == 'test' || process.env.NODE_ENV == 'development') { // 测试环境 baseurl = 'http://192.168.6.75' window.baseurl = 'http://192.168.6.75' - // baseurl = 'http://192.168.6.148:8056' - // window.baseurl = 'http://192.168.6.148:8056' + // baseurl = 'http://192.168.6.116:8056' + // window.baseurl = 'http://192.168.6.116:8056' } if (process.env.NODE_ENV == 'production') { // 生成环境 @@ -870,4 +870,9 @@ export const getVoucherWarningAccount = () => { return req('get', baseurl + '/auth/admin/voucherWarningAccount') } +// 加款 +export const addFund = (data, id) => { + return req('post', baseurl + `/codes/voucher/fund/${id}`, data) +} + export { req } diff --git a/src/pages/plan/knockGold/Dialog.jsx b/src/pages/plan/knockGold/Dialog.jsx index f21e63ba..8bfd9a8d 100644 --- a/src/pages/plan/knockGold/Dialog.jsx +++ b/src/pages/plan/knockGold/Dialog.jsx @@ -5,7 +5,7 @@ import Form from '../../../components/form/main' import FormItem from '../../../components/form-item/main' import rules from './rules' import { Button, Notify } from 'zent' - +import { addFund, handelResponse } from '../../../assets/api' export default ({ data, onChangeMoney }) => { const [stateData, setStateData] = useState({ addNew: '' }) const ref = useRef() @@ -19,7 +19,22 @@ export default ({ data, onChangeMoney }) => { Number(stateData?.recharge_amount) + Number(stateData.addNew) < Number(stateData?.all_budget) ) { - onChangeMoney(false, Number(stateData.addNew)) + addFund({ recharge_amount: stateData.addNew }, data.goods_id).then( + (res) => { + handelResponse( + res, + (req, msg) => { + Notify.error('加款成功') + setTimeout(() => { + onChangeMoney(false, Number(stateData.addNew)) + }, 1000) + }, + (err) => { + Notify.error(err) + } + ) + } + ) } else { Notify.error('加款失败') }