Files
miniapp/pages/handlecase/component/payList.vue
T

275 lines
7.1 KiB
Vue
Raw Normal View History

2024-02-05 18:14:59 +08:00
<template>
<view class="from">
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<view class="box">
<uni-forms-item label="案件编号:" name="caseNum" label-width="120px" required>
<uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.caseNum" placeholder="" />
</uni-forms-item>
<uni-forms-item label="申请人:" name="applicantName" label-width="120px" required>
2024-04-07 14:33:07 +08:00
<uni-easyinput :inputBorder="false" :disabled='true' v-model="affiliate"
2024-02-05 18:14:59 +08:00
placeholder="" />
</uni-forms-item>
<uni-forms-item label="被申请人:" name="respondentName" label-width="120px" required>
2024-04-07 14:33:07 +08:00
<uni-easyinput :inputBorder="false" :disabled='true' v-model="affiliateRes"
2024-02-05 18:14:59 +08:00
placeholder="" />
</uni-forms-item>
2024-02-23 13:57:53 +08:00
<!-- <uni-forms-item label="案件标的:" name="caseSubjectAmount" label-width="120px" required>
2024-02-05 18:14:59 +08:00
<uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.caseSubjectAmount"
placeholder="" />
2024-02-23 13:57:53 +08:00
</uni-forms-item> -->
2024-02-05 18:14:59 +08:00
<uni-forms-item label="应缴费用:" name="feePayable" label-width="120px" required>
<uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.feePayable" placeholder="" />
2024-02-21 18:30:30 +08:00
</uni-forms-item>
2024-02-23 13:57:53 +08:00
<uni-forms-item label="驳回原因:" name="reason" label-width="120px" required v-if="formData.reason">
2024-02-21 18:30:30 +08:00
<uni-easyinput :inputBorder="false" :disabled='true' v-model="formData.reason" placeholder="" />
2024-02-05 18:14:59 +08:00
</uni-forms-item>
</view>
</uni-forms>
<uni-forms-item label="缴费方式">
<uni-data-checkbox v-model="payType" :localdata="payTypes" @change="changeType" />
</uni-forms-item>
2024-02-06 15:36:34 +08:00
<uni-forms-item label="缴费平台" v-if="payType == 0">
2024-02-05 18:14:59 +08:00
<uni-data-checkbox v-model="payPlatform" :localdata="payPlatforms" @change="changePayType" />
</uni-forms-item>
<div class="payImg" v-if="payType == 0">
<canvas canvas-id="qrcode" v-show="qrShow" style="width: 300rpx;margin: 0 auto;" />
</div>
<div class="payTitle" v-if="payType == 0">{{ payMain }}</div>
<uni-forms-item label="上传证据" name="headImage">
<uni-file-picker ref="files" :auto-upload="false" return-type='object' v-model="fileList"
file-mediatype="all" @select="select" :limit='1' />
</uni-forms-item>
<button type="primary" @click="submitPay">确认提交</button>
</view>
</template>
<script>
import {
selectById
} from '../../../api/handlecase/index.js'
import {
casePay,
confirmPayment
} from '../../../api/pay/index.js'
import moment from 'moment'
import uQRCode from '../../common/uqrcode.js'
import {
getToken
} from '@/utils/auth'
import config from '@/config'
const baseUrl = config.baseUrlTJ
const app = getApp()
export default {
data() {
return {
2024-03-06 14:52:54 +08:00
formData: {},
2024-04-07 14:33:07 +08:00
affiliate:"",
affiliateRes:"",
2024-02-05 18:14:59 +08:00
selectFlag: false,
rules: {},
payPlatforms: [{
text: '微信',
value: 0
}, {
text: '支付宝',
value: 1
}, ],
payPlatform: null,
payType: 1,
payTypes: [{
text: '线上缴费',
value: 0
}, {
text: '线下缴费',
value: 1
}, ],
payMain: '',
qrShow: false,
tempFilePaths: null,
fileList: {},
submitForm: {
payType: 1,
payOrderList: [],
caseId: null
2024-02-20 17:21:44 +08:00
},
dataType:{},
formDataVal:{}
2024-02-05 18:14:59 +08:00
}
},
methods: {
/**获取案件缴费信息*/
getData(parms) {
selectById(parms).then(res => {
2024-02-20 17:21:44 +08:00
this.formData = res.data
2024-04-07 14:33:07 +08:00
this.affiliate = res.data.affiliate.applicant.map(item =>item.applicant.name).join(',')
this.affiliateRes = res.data.affiliate.res.map(item =>item.res.name).join(',')
2024-04-01 17:54:48 +08:00
res.data.affiliate.applicant.forEach((item,index) =>{
if(item.res!=null){
this.affiliateRes = {name:item.res.name}
2024-04-07 14:33:07 +08:00
}
2024-04-01 17:54:48 +08:00
})
2024-02-20 17:21:44 +08:00
if(this.dataType.type==4){
this.formDataVal ={
annexType: 4,
id: this.formData.id
}
}else if(this.dataType.type==9){
this.formDataVal ={
annexType: 9,
id: this.formData.id
}
}
2024-02-05 18:14:59 +08:00
})
},
/**生成二维码*/
qrcode(url) {
this.qrShow = true
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: url,
size: 150,
margin: 0,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
errorCorrectLevel: uQRCode.errorCorrectLevel.H,
success: res => {}
})
},
/**选择缴费方式*/
changeType(val) {
2024-02-06 15:36:34 +08:00
this.submitForm.payType = val.detail.value;
2024-02-05 18:14:59 +08:00
},
/**文件上传*/
select(e) {
2024-02-20 17:16:52 +08:00
this.submitForm.payOrderList = [];
2024-02-05 18:14:59 +08:00
this.tempFilePaths = e.tempFilePaths;
// loading
uni.showLoading({
title: '上传中'
});
uni.uploadFile({
url: baseUrl + '/common/upload',
filePath: this.tempFilePaths[0],
header: {
Authorization: getToken() || '',
},
2024-02-20 17:21:44 +08:00
formData:this.formDataVal,
2024-02-05 18:14:59 +08:00
name: 'file',
success: (res) => {
let {
data
} = res
data = JSON.parse(data);
this.submitForm.payOrderList.push({
annexId: data.annexId,
annexName: data.fileName
});
uni.showToast({
title: '上传成功',
icon: 'none',
duration: 1000
})
uni.hideLoading();
},
fail: (err) => {
uni.showToast({
title: '上传失败',
icon: 'none',
duration: 1000
})
uni.hideLoading()
}
})
},
/**选择缴费平台*/
changePayType(val) {
if (this.formData.feePayable == 0 || !this.formData.feePayable) {
uni.showToast({
title: '此案件无需缴费',
icon: 'none',
duration: 1000
})
return;
}
let payType = "";
if (val.detail.value == 0) {
payType = "wxpay";
this.payMain = "请使用微信扫二维码支付";
} else if (val.detail.value == 1) {
payType = "alipay";
this.payMain = "请使用支付宝扫二维码支付";
}
casePay({
totalFee: this.formData.feePayable * 100,
caseId: this.formData.id,
tradeType: "native",
platform: payType,
}).then((res) => {
this.qrcode(res.data.code_url);
});
},
confirmPaymentFn(data) {
confirmPayment(data).then(res => {
uni.showToast({
title: '确认成功',
icon: 'none',
duration: 1000
});
uni.navigateBack({
delta: 1
})
})
},
/**确认缴费*/
submitPay() {
2024-02-20 17:16:52 +08:00
if (this.submitForm.payOrderList.length < 1) {
uni.showToast({
title: '请上传缴费凭证',
icon: 'none',
duration: 1000
});
return
}
2024-02-05 18:14:59 +08:00
this.submitForm.caseId = this.formData.id;
this.submitForm.caseFlowId = this.formData.caseFlowId;
this.confirmPaymentFn(this.submitForm);
}
},
2024-02-20 17:21:44 +08:00
onLoad(data) {
this.dataType = data
2024-02-05 18:14:59 +08:00
this.getData({
id: data.id
});
},
}
</script>
<style>
.from {
padding: 20rpx;
}
.payImg,
.payTitle {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 20rpx;
}
.select-picker {
display: flex;
box-sizing: border-box;
flex-direction: row;
align-items: center;
border: 1px solid #DCDFE6;
border-radius: 8rpx;
width: 100%;
height: 100%;
padding: 0 24rpx;
font-size: 28rpx;
}
</style>