调解系统PC端服务

respondentPay.vue 7.3KB

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