fastpay-setting.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <div id="app" v-cloak>
  2. <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div class="form_box">
  4. <template>
  5. <el-card>
  6. <el-form :model="basic" size="small" ref="ruleForm" label-width="135px">
  7. <!-- :rules="rules" -->
  8. <el-tabs v-model="activeName" type="card">
  9. <el-tab-pane label="快捷支付设置" name="basic">
  10. <el-row>
  11. <el-col :span="24">
  12. <div class="title"> </div>
  13. <div class="form-body">
  14. <el-form-item label="启用快捷支付" prop="joinpay_fast_pay_status">
  15. <el-switch v-model="basic.joinpay_fast_pay_status" :active-value="1" :inactive-value="0"></el-switch>
  16. </el-form-item>
  17. <el-form-item label="汇聚快捷支付私钥" prop="joinpay_fast_pay_private_key">
  18. <el-input v-model="basic.joinpay_fast_pay_private_key" type="textarea" :rows="5"></el-input>
  19. </el-form-item>
  20. <el-form-item label="汇聚快捷支付公钥" prop="joinpay_fast_pay_public_key">
  21. <el-input v-model="basic.joinpay_fast_pay_public_key" type="textarea" :rows="5"></el-input>
  22. </el-form-item>
  23. </div>
  24. </el-col>
  25. </el-row>
  26. </el-tab-pane>
  27. </el-tabs>
  28. <div style="border-top: 1px solid #dad9d9;">
  29. <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 10px;" @click="store('ruleForm')" size="small">保存
  30. </el-button>
  31. </div>
  32. </el-form>
  33. </el-card>
  34. </template>
  35. </div>
  36. <!-- 这个是复制用的容器,已隐藏 -->
  37. <textarea id="inputs" style="opacity: 0;width: 0;height: 0;">复制内容</textarea>
  38. </el-card>
  39. </div>
  40. <script>
  41. const app = new Vue({
  42. el: '#app',
  43. data() {
  44. return {
  45. activeName: 'basic',
  46. loading: false,
  47. btnLoading: false,
  48. basic: {
  49. joinpay_fast_pay_status: 0,
  50. joinpay_fast_pay_private_key: '',
  51. joinpay_fast_pay_public_key: '',
  52. },
  53. }
  54. },
  55. mounted: function() {
  56. this.loadData();
  57. },
  58. methods: {
  59. // 获取基础设置详情
  60. loadData() {
  61. this.loading = true;
  62. request({
  63. params: {
  64. r: 'join-pay/default/basic-setting',
  65. group: 'fastpay',
  66. },
  67. method: 'get'
  68. }).then(e => {
  69. this.loading = false;
  70. if (e.data.code == 0) {
  71. if (e.data.data.settings) {
  72. this.basic = e.data.data.settings;
  73. }
  74. } else {
  75. this.$message.error(e.data.msg)
  76. }
  77. }).catch(e => {
  78. this.loading = false;
  79. this.$message.error(e);
  80. })
  81. },
  82. store(formName) {
  83. if (this.basic.joinpay_fast_pay_status == 1) {
  84. if (!this.basic.joinpay_fast_pay_private_key || !this.basic.joinpay_fast_pay_public_key) {
  85. return this.$message.error('请完善汇聚快捷支付配置');
  86. }
  87. }
  88. this.btnLoading = true;
  89. request({
  90. params: {
  91. r: 'join-pay/default/basic-setting',
  92. },
  93. method: 'post',
  94. data: {
  95. group: 'fastpay',
  96. fastpay: this.basic,
  97. }
  98. }).then(e => {
  99. this.btnLoading = false;
  100. if (e.data.code == 0) {
  101. this.$message.success(e.data.msg);
  102. } else {
  103. this.$message.error(e.data.msg);
  104. }
  105. }).catch(e => {
  106. this.btnLoading = false;
  107. this.$message.error(e);
  108. })
  109. },
  110. }
  111. });
  112. </script>
  113. <style>
  114. .form_box {
  115. background-color: #f3f3f3;
  116. padding: 0 0 20px;
  117. }
  118. .button-item {
  119. margin-top: 12px;
  120. padding: 9px 25px;
  121. }
  122. .el-input-group__append {
  123. background-color: #fff;
  124. color: #353535;
  125. }
  126. .el-form-item {
  127. margin-bottom: 25px !important;
  128. }
  129. </style>