billPush-qrcode-pay.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <el-dialog
  3. title="付款码"
  4. :visible.sync="showDialog"
  5. :modal-append-to-body="true"
  6. style="text-align: center;"
  7. width="43%"
  8. @close="closeDialog"
  9. append-to-body
  10. :close-on-click-modal="false"
  11. >
  12. <el-row :gutter="20">
  13. <el-col :span="12">
  14. <el-image class="qucode" src="http://rccs.oss-cn-hangzhou.aliyuncs.com/jp_housekeeper/img/%E5%BE%AE%E4%BF%A1%E6%94%AF%E4%BB%98.png"></el-image>
  15. <div class="grid-content bg-purple" id="wxQuCode" ref="wxQuCode"></div>
  16. </el-col>
  17. <el-col :span="12">
  18. <el-image class="qucode" src="http://rccs.oss-cn-hangzhou.aliyuncs.com/jp_housekeeper/img/%E6%94%AF%E4%BB%98%E5%AE%9D%E6%94%AF%E4%BB%98.png"></el-image>
  19. <div class="grid-content bg-purple" id="alipayQuCode" ref="alipayQuCode"></div>
  20. </el-col>
  21. </el-row>
  22. </el-dialog>
  23. </template>
  24. <script>
  25. import Constant from "@/constant";
  26. import billPushApi from "@/api/business/billPush";
  27. import QRCode from 'qrcodejs2';
  28. export default {
  29. props: ["businessKey", "title","orderId"],
  30. data(){
  31. return{
  32. loading:false,
  33. showDialog:true,
  34. submitting: false,
  35. }
  36. },
  37. methods:{
  38. closeDialog() {
  39. this.$emit("close", false);
  40. },
  41. },
  42. mounted: function() {
  43. var self = this;
  44. billPushApi.wxQucode(self.orderId).then((response)=>{
  45. var jsonData = response.data;
  46. if(jsonData.result){
  47. var qucode = jsonData.data;
  48. new QRCode(this.$refs.wxQuCode, {
  49. text: qucode,
  50. width: 300,
  51. height: 300,
  52. colorDark: "#333333", //二维码颜色
  53. colorLight: "#ffffff", //二维码背景色
  54. correctLevel: QRCode.CorrectLevel.L//容错率,L/M/H
  55. })
  56. }
  57. else{
  58. self.$message.error(jsonData.message + "");
  59. }
  60. });
  61. billPushApi.alipayCode(self.orderId).then((response)=>{
  62. var jsonData = response.data;
  63. if(jsonData.result){
  64. var qucode = jsonData.data;
  65. new QRCode(this.$refs.alipayQuCode, {
  66. text: qucode,
  67. width: 300,
  68. height: 300,
  69. colorDark: "#333333", //二维码颜色
  70. colorLight: "#ffffff", //二维码背景色
  71. correctLevel: QRCode.CorrectLevel.L//容错率,L/M/H
  72. })
  73. }
  74. else{
  75. self.$message.error(jsonData.message + "");
  76. }
  77. });
  78. }
  79. }
  80. </script>
  81. <style scoped>
  82. .el-row {
  83. margin-bottom: 20px;
  84. }
  85. .el-col {
  86. border-radius: 4px;
  87. }
  88. .grid-content {
  89. border-radius: 4px;
  90. min-height: 36px;
  91. }
  92. .row-bg {
  93. padding: 10px 0;
  94. }
  95. .qucode{
  96. width: 70%;
  97. height: 70%;
  98. }
  99. </style>