efps-version
ljl 1 year ago
parent 615a966aa5
commit 827746be00

@ -37,6 +37,7 @@ class RechargeController extends AbstractController
'cardNo' => $user->card_no ?? '', 'cardNo' => $user->card_no ?? '',
'mobile' => $user->mobile ?? '', 'mobile' => $user->mobile ?? '',
'bankCardNo' => $bankCard->bank_card_no ?? '', 'bankCardNo' => $bankCard->bank_card_no ?? '',
'amount' => intval($prePayLog->amount / 100),
]; ];
} }
return $this->success([ return $this->success([
@ -51,15 +52,19 @@ class RechargeController extends AbstractController
throw new BusinessException('请输入姓名'); throw new BusinessException('请输入姓名');
} }
$amount = $request->input('amount'); $amount = $request->input('amount');
if (empty($amount)) { if ($prePayLog->amount == 0) {
throw new BusinessException('请输入金额'); $amount = $request->input('amount');
} if (empty($amount)) {
if (!is_numeric($amount)) { throw new BusinessException('请输入金额');
throw new BusinessException('请输入金额'); }
} if (!is_numeric($amount)) {
if ($amount <= 0) { throw new BusinessException('请输入金额');
throw new BusinessException('金额需大于0'); }
if ($amount <= 0) {
throw new BusinessException('金额需大于0');
}
} }
$cardNo = $request->input('cardNo'); $cardNo = $request->input('cardNo');
if (empty($cardNo)) { if (empty($cardNo)) {
throw new BusinessException('请输入身份证号'); throw new BusinessException('请输入身份证号');
@ -86,7 +91,8 @@ class RechargeController extends AbstractController
if ($bankCard) { if ($bankCard) {
$outOrderNo = $prePayLog->out_order_no; $outOrderNo = $prePayLog->out_order_no;
$nextStep = 'confirm-pay'; $nextStep = 'confirm-pay';
$bizData = $this->paymentService->protocolPayPreRequest($this->buildPrepayParams($prePayLog->out_member_id, $outOrderNo, $bankCard->protocol, intval($amount * 100), $app)); $amount = $prePayLog->amount > 0 ? $prePayLog->amount : intval($amount * 100);
$bizData = $this->paymentService->protocolPayPreRequest($this->buildPrepayParams($prePayLog->out_member_id, $outOrderNo, $bankCard->protocol, $amount, $app));
} else { } else {
$mchOrderNo = StringHelper::generateBankCardOrderNo(); $mchOrderNo = StringHelper::generateBankCardOrderNo();
$nextStep = 'confirm-bind'; $nextStep = 'confirm-bind';

@ -340,6 +340,16 @@ class PaymentService extends AbstractService
if (!$reqData['outMemberId']) { if (!$reqData['outMemberId']) {
throw new BusinessException('用户ID不能为空'); throw new BusinessException('用户ID不能为空');
} }
if (isset($reqData['amount']) {
if (!is_numeric($reqData['amount'])) {
throw new BusinessException('请输入金额');
}
if ($reqData['amount'] <= 100 || $reqData['amount'] > 300000) {
throw new BusinessException('充值金额必须为100~300000');
}
}
if (!$reqData['notifyUrl']) { if (!$reqData['notifyUrl']) {
throw new BusinessException('通知地址不能为空'); throw new BusinessException('通知地址不能为空');
} }
@ -355,6 +365,7 @@ class PaymentService extends AbstractService
$log = new PrePayLog(); $log = new PrePayLog();
$log->app_id = $app->app_id; $log->app_id = $app->app_id;
$log->out_order_no = $reqData['outOrderNo']; $log->out_order_no = $reqData['outOrderNo'];
$log->amount = $reqData['amount'] ?: 0;
$log->out_member_id = $reqData['outMemberId']; $log->out_member_id = $reqData['outMemberId'];
$log->notify_url = $reqData['notifyUrl']; $log->notify_url = $reqData['notifyUrl'];
$log->redirect_url = $reqData['redirectUrl'] ?? ''; $log->redirect_url = $reqData['redirectUrl'] ?? '';

@ -27,7 +27,7 @@
<el-input v-model="form.bankCardNo"></el-input> <el-input v-model="form.bankCardNo"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="充值金额"> <el-form-item label="充值金额">
<el-input-number v-model="form.amount" :min="1" :max="3000" label="充值金额"></el-input-number> <el-input-number v-model="form.amount" :min="1" :max="3000" label="充值金额" :readonly="amountReadonly"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="备注"> <el-form-item label="备注">
<el-input type="textarea" v-model="form.remark"></el-input> <el-input type="textarea" v-model="form.remark"></el-input>
@ -98,7 +98,8 @@
bankCardNo: '', bankCardNo: '',
amount: 1, amount: 1,
remark: '' remark: ''
} },
amountReadonly: false
} }
}, },
created() { created() {
@ -204,6 +205,10 @@
this.form.cardNo = result.user.cardNo; this.form.cardNo = result.user.cardNo;
this.form.mobile = result.user.mobile; this.form.mobile = result.user.mobile;
this.form.bankCardNo = result.user.bankCardNo; this.form.bankCardNo = result.user.bankCardNo;
if (this.form.amount > 0) {
this.form.amount = result.user.amount;
this.amountReadonly = true;
}
} }
}) })
.catch((error) => { .catch((error) => {

Loading…
Cancel
Save