Files
Arbitrate-Frontend/src/views/caseManagement/components/payDialog.vue
T

272 lines
7.5 KiB
Vue
Raw Normal View History

2023-09-20 14:23:32 +08:00
<template>
<div>
2023-10-14 18:21:55 +08:00
<el-dialog :title="payTitle" :visible="openPay" @close="payCancel" width="800px" append-to-body
2023-09-26 17:56:02 +08:00
:destroy-on-close="true" center>
2023-09-20 14:23:32 +08:00
<el-descriptions title="订单信息">
2023-09-23 16:01:56 +08:00
<el-descriptions-item label="案件编号">{{
2023-09-20 14:23:32 +08:00
form.caseNum
}}</el-descriptions-item>
2023-09-23 16:01:56 +08:00
<el-descriptions-item label="申请人">{{
form.applicantName
2023-09-20 14:23:32 +08:00
}}</el-descriptions-item>
2023-09-23 16:01:56 +08:00
<el-descriptions-item label="案件标的">{{
2023-09-20 14:23:32 +08:00
form.caseSubjectAmount
}}</el-descriptions-item>
2023-09-23 16:01:56 +08:00
<el-descriptions-item label="案件应缴费用">{{
2023-09-20 14:23:32 +08:00
form.feePayable
}}</el-descriptions-item>
2023-09-23 16:01:56 +08:00
<el-descriptions-item label="被申请人">{{
form.respondentName
2023-09-20 14:23:32 +08:00
}}</el-descriptions-item>
2023-10-08 13:47:19 +08:00
<el-descriptions-item label="案件状态">
<el-tag size="mini" type='danger' effect="dark">
{{ form.caseStatusName }}
</el-tag>
</el-descriptions-item>
2023-09-23 16:01:56 +08:00
<el-descriptions-item label="申请人仲裁诉求">{{
form.arbitratClaims
}}</el-descriptions-item>
2023-09-20 14:23:32 +08:00
</el-descriptions>
2023-10-14 18:21:55 +08:00
<div class="paySelectType">
<el-radio-group v-model="paySelect" @input="changPayType">
<el-radio :label="0">线上支付</el-radio>
<el-radio :label="1">线下支付</el-radio>
</el-radio-group>
</div>
<div class="payupload">
<span>上传支付凭证:</span>
<div class="uploadBtn">
2023-10-15 19:31:45 +08:00
<el-upload class="upload-demo" ref="upload" :action="UploadUrl()" :headers="headers" :data="filedata"
:on-preview="handlePreview" :on-remove="handleRemove" :on-change="beforeUpload" :on-success="handlSuccess" :file-list="fileList"
>
2023-10-14 18:21:55 +08:00
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button> -->
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
</el-upload>
</div>
</div>
<div class="payType" v-if="paySelect == 0">
2023-09-20 14:23:32 +08:00
<span>请选择支付方式:</span>
<i class="iconfont icon-weixinzhifu" @click="pay(0)"></i>
<i class="iconfont icon-zhifubao" @click="pay(1)"></i>
</div>
<div class="payImg">
<div id="qrcodeImg"></div>
</div>
<div class="payTitle">{{ payMain }}</div>
<div slot="footer" class="dialog-footer">
2023-09-21 16:06:45 +08:00
<el-button @click="payCancel" class="endbutton"><span>取 消</span></el-button>
2023-10-14 18:21:55 +08:00
<el-button @click="submitUpload" class="endbutton"><span>确认缴费</span></el-button>
2023-09-20 14:23:32 +08:00
</div>
</el-dialog>
</div>
</template>
<script>
2023-10-15 19:31:45 +08:00
import { casePay, confirmPayDig } from "@/api/pay/pay";
2023-09-20 14:23:32 +08:00
import QRCode from "qrcodejs2";
2023-10-14 18:21:55 +08:00
import { getToken } from "@/utils/auth";
2023-09-20 14:23:32 +08:00
export default {
2023-10-15 19:31:45 +08:00
props: ["openPay", "payTitle", "form", "payForm", "queryParams","payId"],
2023-09-20 14:23:32 +08:00
data() {
return {
// key: value
// 支付文字
payMain: "",
2023-10-14 18:21:55 +08:00
timer: null,
2023-10-15 19:31:45 +08:00
paySelect: 1,//支付线上/线下
fileList: [],
headers: {
Authorization: "Bearer " + getToken(),
},
filedata: {
annexType: 8,
},
submitForm:{
payType:1,
payOrderList:[],
caseId:null
}
2023-09-20 14:23:32 +08:00
};
},
methods: {
2023-10-15 19:31:45 +08:00
UploadUrl() {
return window.location.origin + "/API/evidence/upload";
},
2023-10-14 18:21:55 +08:00
//选择支付方式(线上,线下)
changPayType(data) {
2023-10-15 19:31:45 +08:00
this.submitForm.payType = data;
2023-10-14 18:21:55 +08:00
},
beforeUpload(flie, fileList) {
this.fileList = fileList;
},
2023-10-15 19:31:45 +08:00
// 文件上传成功
handlSuccess(res, file) {
this.submitForm.payOrderList.push({
annexId: res.data.annexId,
annexName:res.data.annexName
});
},
2023-10-14 18:21:55 +08:00
submitUpload() {
if (this.fileList.length < 1) {
this.$modal.msgError("请上传缴费凭证");
return
}
2023-10-15 19:31:45 +08:00
confirmPayDig(this.submitForm).then(res=>{
this.$modal.msgSuccess("成功");
this.payCancel()
this.$emit("getcaseApply", this.queryParams);
// console.log(res,":::::::::::::::::::::::::::::::");
})
2023-10-14 18:21:55 +08:00
},
handleRemove(file, fileList) {
2023-10-15 19:31:45 +08:00
(this.submitForm.payOrderList = []),
fileList.forEach((item) => {
console.log(item.response.data,"item");
this.submitForm.payOrderList.push({ annexId:item.response.data.annexId,annexName:item.response.data.annexName });
});
2023-10-14 18:21:55 +08:00
},
handlePreview(file) {
console.log(file);
},
2023-09-20 14:23:32 +08:00
// 生成二维码
qrcode(url) {
// 前端根据 URL 生成微信支付二维码
document.getElementById("qrcodeImg").innerHTML = "";
return new QRCode("qrcodeImg", {
width: 200,
height: 200,
text: url,
colorDark: "#000",
colorLight: "#fff",
});
},
2023-09-26 17:56:02 +08:00
// 查询缴费状态
2023-10-15 19:31:45 +08:00
// selectCaseApplicationConfirmFn(parms) {
// selectCaseApplicationConfirm(parms).then(res => {
// // console.log(res, this.form, "KKKKKKKKKKKKKKKKKKKK");
// if (res && res.data && res.data.paymentStatus == 1) {
// // clearInterval(this.timer);
// // this.openPay = false;
// this.payCancel()
// this.$message({
// message: "缴费成功",
// type: "success",
// });
// this.$emit("getcaseApply", this.queryParams);
// }
// })
// },
2023-09-20 14:23:32 +08:00
// 支付
pay(val) {
if (this.payForm.feePayable == 0 || !this.payForm.feePayable) {
this.$message({
message: "此案件无需缴费",
type: "error",
});
return;
}
let payType = "";
if (val == 0) {
payType = "wxpay";
this.payMain = "请使用微信扫二维码支付";
} else if (val == 1) {
payType = "alipay";
this.payMain = "请使用支付宝扫二维码支付";
}
casePay({
totalFee: this.payForm.feePayable * 100,
caseId: this.payForm.caseId,
tradeType: "native",
platform: payType,
}).then((res) => {
this.paySrc = res.data.code_url;
this.qrcode(this.paySrc);
2023-10-15 19:31:45 +08:00
// this.timer = setInterval(() => {
// this.selectCaseApplicationConfirmFn({ id: this.form.id })
// }, 3000);
// setTimeout(() => {
// clearInterval(this.timer);
// }, 1000 * 60);
2023-09-20 14:23:32 +08:00
});
},
payCancel() {
this.$emit("paycancelRow");
this.payMain = "";
},
},
2023-10-15 19:31:45 +08:00
watch:{
openPay(val){
if(val){
this.filedata.id = this.payId;
this.submitForm.caseId = this.payId;
}
}
}
2023-09-20 14:23:32 +08:00
};
</script>
<style lang="scss" scoped>
.payType {
height: 80px;
line-height: 80px;
2023-10-14 18:21:55 +08:00
display: flex;
2023-09-20 14:23:32 +08:00
.icon-weixinzhifu {
font-size: 24px;
color: #27a56f;
margin-right: 15px;
}
.icon-zhifubao {
font-size: 24px;
color: #1d76cc;
}
}
2023-10-14 18:21:55 +08:00
.paySelectType {
margin-top: 20px;
margin-bottom: 20px;
}
.payupload {
display: flex;
.uploadBtn {}
}
2023-09-20 14:23:32 +08:00
.payImg {
width: 100%;
display: flex;
justify-content: center;
}
.payTitle {
margin-top: 20px;
width: 100%;
text-align: center;
}
2023-09-26 17:56:02 +08:00
2023-09-21 16:06:45 +08:00
::v-deep .el-dialog {
width: 800px;
background: #ffffff;
border-radius: 20px;
}
2023-09-26 17:56:02 +08:00
2023-09-21 16:06:45 +08:00
.endbutton {
width: 154px;
height: 37px;
background: #ffffff;
border: 1px solid #d0d0d0;
border-radius: 19px;
2023-09-26 17:56:02 +08:00
2023-09-21 16:06:45 +08:00
span {
width: 31px;
height: 13px;
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #959595;
}
}
2023-09-20 14:23:32 +08:00
</style>