应用层PC端前端服务

payDialog.vue 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div>
  3. <el-dialog
  4. :title="payTitle"
  5. :visible.sync="openPay"
  6. v-if="openPay"
  7. width="800px"
  8. append-to-body
  9. :destroy-on-close="true"
  10. center
  11. >
  12. <el-descriptions title="订单信息">
  13. <el-descriptions-item label="案件编号:">{{
  14. form.caseNum
  15. }}</el-descriptions-item>
  16. <el-descriptions-item label="申请人:">{{
  17. form.applicant
  18. }}</el-descriptions-item>
  19. <el-descriptions-item label="案件标的:">{{
  20. form.caseSubjectAmount
  21. }}</el-descriptions-item>
  22. <el-descriptions-item label="案件应缴费用:">{{
  23. form.feePayable
  24. }}</el-descriptions-item>
  25. <el-descriptions-item label="被申请人:">{{
  26. form.respondent
  27. }}</el-descriptions-item>
  28. <el-descriptions-item label="申请人仲裁诉求:">{{
  29. form.arbitratClaims
  30. }}</el-descriptions-item>
  31. <el-descriptions-item label="案件状态:">{{
  32. form.caseStatusName
  33. }}</el-descriptions-item>
  34. </el-descriptions>
  35. <div class="payType">
  36. <span>请选择支付方式:</span>
  37. <i class="iconfont icon-weixinzhifu" @click="pay(0)"></i>
  38. <i class="iconfont icon-zhifubao" @click="pay(1)"></i>
  39. </div>
  40. <div class="payImg">
  41. <div id="qrcodeImg"></div>
  42. </div>
  43. <div class="payTitle">{{ payMain }}</div>
  44. <div slot="footer" class="dialog-footer">
  45. <el-button @click="payCancel" class="endbutton"><span>取 消</span></el-button>
  46. </div>
  47. </el-dialog>
  48. </div>
  49. </template>
  50. <script>
  51. import { casePay } from "@/api/pay/pay";
  52. import QRCode from "qrcodejs2";
  53. export default {
  54. props: ["openPay", "payTitle", "form", "payForm"],
  55. data() {
  56. return {
  57. // key: value
  58. // 支付文字
  59. payMain: "",
  60. };
  61. },
  62. methods: {
  63. // 生成二维码
  64. qrcode(url) {
  65. // 前端根据 URL 生成微信支付二维码
  66. document.getElementById("qrcodeImg").innerHTML = "";
  67. return new QRCode("qrcodeImg", {
  68. width: 200,
  69. height: 200,
  70. text: url,
  71. colorDark: "#000",
  72. colorLight: "#fff",
  73. });
  74. },
  75. // 支付
  76. pay(val) {
  77. if (this.payForm.feePayable == 0 || !this.payForm.feePayable) {
  78. this.$message({
  79. message: "此案件无需缴费",
  80. type: "error",
  81. });
  82. return;
  83. }
  84. let payType = "";
  85. if (val == 0) {
  86. payType = "wxpay";
  87. this.payMain = "请使用微信扫二维码支付";
  88. } else if (val == 1) {
  89. payType = "alipay";
  90. this.payMain = "请使用支付宝扫二维码支付";
  91. }
  92. casePay({
  93. totalFee: this.payForm.feePayable * 100,
  94. caseId: this.payForm.caseId,
  95. tradeType: "native",
  96. platform: payType,
  97. }).then((res) => {
  98. this.paySrc = res.data.code_url;
  99. this.qrcode(this.paySrc);
  100. });
  101. },
  102. payCancel() {
  103. this.$emit("paycancelRow");
  104. this.payMain = "";
  105. },
  106. },
  107. };
  108. </script>
  109. <style lang="scss" scoped>
  110. .payType {
  111. height: 80px;
  112. line-height: 80px;
  113. .icon-weixinzhifu {
  114. font-size: 24px;
  115. color: #27a56f;
  116. margin-right: 15px;
  117. }
  118. .icon-zhifubao {
  119. font-size: 24px;
  120. color: #1d76cc;
  121. }
  122. }
  123. .payImg {
  124. width: 100%;
  125. display: flex;
  126. justify-content: center;
  127. }
  128. .payTitle {
  129. margin-top: 20px;
  130. width: 100%;
  131. text-align: center;
  132. }
  133. ::v-deep .el-dialog {
  134. width: 800px;
  135. background: #ffffff;
  136. border-radius: 20px;
  137. }
  138. .endbutton {
  139. width: 154px;
  140. height: 37px;
  141. background: #ffffff;
  142. border: 1px solid #d0d0d0;
  143. border-radius: 19px;
  144. span {
  145. width: 31px;
  146. height: 13px;
  147. font-size: 16px;
  148. font-family: Microsoft YaHei;
  149. font-weight: 400;
  150. color: #959595;
  151. }
  152. }
  153. </style>