调解系统PC端服务

respondentPay.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div>
  3. <el-dialog :title="resPayTitle" v-if="openResPay" :visible="openResPay" @close="payCancel" width="800px" append-to-body
  4. :destroy-on-close="true" center>
  5. <el-descriptions title="订单信息">
  6. <el-descriptions-item label="案件编号">{{
  7. formResPayDetail.caseNum
  8. }}</el-descriptions-item>
  9. <el-descriptions-item label="申请人">{{
  10. formResPay.applicationName || ''
  11. }}</el-descriptions-item>
  12. <!-- <el-descriptions-item label="案件标的">{{
  13. formResPayDetail.caseSubjectAmount
  14. }}</el-descriptions-item> -->
  15. <el-descriptions-item label="被申请人应缴费用">{{
  16. formResPayDetail.feePayable
  17. }}</el-descriptions-item>
  18. <el-descriptions-item label="被申请人">{{
  19. formResPay.respondentName
  20. }}</el-descriptions-item>
  21. <el-descriptions-item label="案件状态">
  22. <el-tag size="mini" type='danger' effect="dark">
  23. {{ formResPayDetail.caseStatusName }}
  24. </el-tag>
  25. </el-descriptions-item>
  26. <el-descriptions-item label="驳回原因" v-if="formResPayDetail.reason">
  27. <el-tag size="mini" type='danger' effect="dark">
  28. {{ formResPayDetail.reason }}
  29. </el-tag>
  30. </el-descriptions-item>
  31. </el-descriptions>
  32. <div class="paySelectType">
  33. <el-radio-group v-model="paySelect" @input="changPayType">
  34. <el-radio :label="0">线上支付</el-radio>
  35. <el-radio :label="1">线下支付</el-radio>
  36. </el-radio-group>
  37. </div>
  38. <div class="payupload">
  39. <span>上传支付凭证:</span>
  40. <div class="uploadBtn">
  41. <el-upload class="upload-demo" ref="upload" :action="UploadUrl()" :headers="headers" :data="filedata"
  42. :on-preview="handlePreview" :on-remove="handleRemove" :on-change="beforeUpload" :on-success="handlSuccess" :file-list="fileList"
  43. >
  44. <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
  45. <!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button> -->
  46. <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
  47. </el-upload>
  48. </div>
  49. </div>
  50. <div class="payType" v-if="paySelect == 0">
  51. <span>请选择支付方式:</span>
  52. <i class="iconfont icon-weixinzhifu" @click="pay(0)"></i>
  53. <i class="iconfont icon-zhifubao" @click="pay(1)"></i>
  54. </div>
  55. <div class="payImg">
  56. <div id="qrcodeImg"></div>
  57. </div>
  58. <div class="resPayTitle">{{ payMain }}</div>
  59. <div slot="footer" class="dialog-footer">
  60. <el-button @click="payCancel" class="endbutton" round><span>取 消</span></el-button>
  61. <el-button @click="submitUpload" class="endbutton" type="primary" round><span>确认缴费</span></el-button>
  62. </div>
  63. </el-dialog>
  64. </div>
  65. </template>
  66. <script>
  67. import { casePay, confirmPayDig } from "@/api/pay/pay";
  68. import QRCode from "qrcodejs2";
  69. import { getToken } from "@/utils/auth";
  70. export default {
  71. props: ["openResPay", "resPayTitle", "formResPayDetail", "resPayForm", "queryParams","resPayId","formResPay"],
  72. data() {
  73. return {
  74. // key: value
  75. // 支付文字
  76. payMain: "",
  77. timer: null,
  78. paySelect: 1,//支付线上/线下
  79. fileList: [],
  80. headers: {
  81. Authorization: "Bearer " + getToken(),
  82. },
  83. filedata: {
  84. annexType: 9,
  85. },
  86. submitForm:{
  87. payType:1,
  88. payOrderList:[],
  89. caseId:null
  90. }
  91. };
  92. },
  93. methods: {
  94. UploadUrl() {
  95. return window.location.origin + "/API/common/upload";
  96. },
  97. //选择支付方式(线上,线下)
  98. changPayType(data) {
  99. if(data == 1){
  100. document.getElementById("qrcodeImg").innerHTML = "";
  101. this.payMain = ""
  102. }
  103. this.submitForm.payType = data;
  104. },
  105. beforeUpload(flie, fileList) {
  106. this.fileList = fileList;
  107. },
  108. // 文件上传成功
  109. handlSuccess(res, file) {
  110. this.submitForm.payOrderList.push({
  111. annexId: res.annexId,
  112. annexName:res.annexName
  113. });
  114. },
  115. submitUpload() {
  116. if (this.fileList.length < 1) {
  117. this.$modal.msgError("请上传缴费凭证");
  118. return
  119. }
  120. this.submitForm.caseFlowId = this.formResPayDetail.caseFlowId;
  121. confirmPayDig(this.submitForm).then(res=>{
  122. this.$modal.msgSuccess("成功");
  123. this.payCancel()
  124. this.$emit("getList", this.queryParams);
  125. })
  126. },
  127. handleRemove(file, fileList) {
  128. (this.submitForm.payOrderList = []),
  129. fileList.forEach((item) => {
  130. this.submitForm.payOrderList.push({ annexId:item.response.data.annexId,annexName:item.response.data.annexName });
  131. });
  132. },
  133. handlePreview(file) {
  134. },
  135. // 生成二维码
  136. qrcode(url) {
  137. // 前端根据 URL 生成微信支付二维码
  138. document.getElementById("qrcodeImg").innerHTML = "";
  139. return new QRCode("qrcodeImg", {
  140. width: 200,
  141. height: 200,
  142. text: url,
  143. colorDark: "#000",
  144. colorLight: "#fff",
  145. });
  146. },
  147. // 支付
  148. pay(val) {
  149. if (this.resPayForm.feePayable == 0 || !this.resPayForm.feePayable) {
  150. this.$message({
  151. message: "此案件无需缴费",
  152. type: "error",
  153. });
  154. return;
  155. }
  156. let payType = "";
  157. if (val == 0) {
  158. payType = "wxpay";
  159. this.payMain = "请使用微信扫二维码支付";
  160. } else if (val == 1) {
  161. payType = "alipay";
  162. this.payMain = "请使用支付宝扫二维码支付";
  163. }
  164. casePay({
  165. totalFee: this.resPayForm.feePayable * 100,
  166. caseId: this.resPayForm.caseId,
  167. tradeType: "native",
  168. platform: payType,
  169. }).then((res) => {
  170. this.paySrc = res.data.code_url;
  171. this.qrcode(this.paySrc);
  172. });
  173. },
  174. payCancel() {
  175. this.$emit("paycancelRes");
  176. this.payMain = "";
  177. },
  178. },
  179. watch:{
  180. openResPay(val){
  181. if(val){
  182. this.submitForm.payOrderList = []
  183. this.paySelect = 1;
  184. this.fileList = [];
  185. this.filedata.id = this.resPayId;
  186. this.submitForm.caseId = this.resPayId;
  187. }
  188. }
  189. }
  190. };
  191. </script>
  192. <style lang="scss" scoped>
  193. .payType {
  194. height: 80px;
  195. line-height: 80px;
  196. display: flex;
  197. .icon-weixinzhifu {
  198. font-size: 24px;
  199. color: #27a56f;
  200. margin-right: 15px;
  201. }
  202. .icon-zhifubao {
  203. font-size: 24px;
  204. color: #1d76cc;
  205. }
  206. }
  207. .paySelectType {
  208. margin-top: 20px;
  209. margin-bottom: 20px;
  210. }
  211. .payupload {
  212. display: flex;
  213. .uploadBtn {}
  214. }
  215. .payImg {
  216. width: 100%;
  217. display: flex;
  218. justify-content: center;
  219. }
  220. .resPayTitle {
  221. margin-top: 20px;
  222. width: 100%;
  223. text-align: center;
  224. }
  225. ::v-deep .el-dialog {
  226. width: 800px;
  227. background: #ffffff;
  228. border-radius: 20px;
  229. }
  230. .endbutton {
  231. width: 154px;
  232. height: 37px;
  233. background: #ffffff;
  234. border: 1px solid #d0d0d0;
  235. border-radius: 19px;
  236. span {
  237. width: 31px;
  238. height: 13px;
  239. font-size: 16px;
  240. font-family: Microsoft YaHei;
  241. font-weight: 400;
  242. color: #959595;
  243. }
  244. }
  245. </style>