setting.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <div id="app" v-cloak>
  2. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div slot="header">
  4. <div class="flex flex-x-between flex-y-center">
  5. <span>商户号设置</span>
  6. </div>
  7. </div>
  8. </el-card>
  9. <div class="content">
  10. <el-form
  11. :model="formData"
  12. ref="elForm"
  13. label-width="180px"
  14. style="position: relative"
  15. size="small"
  16. :rules="rules"
  17. >
  18. <el-row>
  19. <el-col :span="24">
  20. <div class="form-body">
  21. <!-- 银典分账 -->
  22. <div class="title padding-top">
  23. <span class="title-line"></span>
  24. <span>银典分账</span>
  25. </div>
  26. <el-col :span="24">
  27. <!-- 分账账户申请链接 -->
  28. <el-form-item label="分账账户申请链接">
  29. <div class="link">
  30. <el-input :disabled="true" v-model="link"></el-input>
  31. <span @click="jump">打开链接</span>
  32. </div>
  33. <span class="tip">
  34. 此链接用作申请银典子商户号,子商户号用作接收用户货款,请您务必进行账号申请;
  35. 进行账号申请后,请将申请的商户编号填入下方,为确保交易无误,请确保填入的商户编号无误!否则因为填写错误造成的损失将由您自行承担!
  36. </span>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="24">
  40. <!-- 商户编号 -->
  41. <el-form-item label="商户编号" prop="mcht_cd">
  42. <el-input v-model="formData.mcht_cd"></el-input>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="24">
  46. <!-- 银行卡账户 -->
  47. <el-form-item label="银行卡账户" prop="bank_account">
  48. <el-input v-model="formData.bank_account"></el-input>
  49. <span class="tip">
  50. 用于快速到账,银行卡账户账号必须是和商户编号对应的账号,如填写错误会导致无法快速到账
  51. </span>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="24">
  55. <!-- 账户名称 -->
  56. <el-form-item label="账户名称" prop="name">
  57. <el-input v-model="formData.name"></el-input>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="24">
  61. <!-- 账户名称 -->
  62. <el-form-item label="账户类型" prop="bank_account_type">
  63. <el-radio-group v-model="formData.bank_account_type">
  64. <el-radio :label="1">对私</el-radio>
  65. <el-radio :label="2">对公</el-radio>
  66. </el-radio-group>
  67. </el-form-item>
  68. </el-col>
  69. <div></div>
  70. <el-col :span="24">
  71. <el-form-item size="large">
  72. <el-button type="primary" size="small" @click="submitForm">提交</el-button>
  73. <el-button size="small" @click="resetForm">重置</el-button>
  74. </el-form-item>
  75. </el-col>
  76. </div>
  77. </el-col>
  78. </el-row>
  79. </el-form>
  80. </div>
  81. </div>
  82. <script>
  83. const app = new Vue({
  84. el: '#app',
  85. data() {
  86. return {
  87. rules: {
  88. mcht_cd: [
  89. {
  90. required: true,
  91. message: '商户编号不能为空'
  92. }
  93. ],
  94. bank_account: [
  95. {
  96. required: true,
  97. message: '银行卡账户不能为空'
  98. }
  99. ],
  100. name: [
  101. {
  102. required: true,
  103. message: '账户名称不能为空'
  104. }
  105. ],
  106. bank_account_type: [
  107. {
  108. required: true,
  109. message: '请选择账户类型'
  110. }
  111. ],
  112. },
  113. formData: {
  114. mcht_cd: '',
  115. bank_account: '',
  116. name: '',
  117. bank_account_type: 1,
  118. },
  119. link: '',
  120. }
  121. },
  122. methods: {
  123. jump() {
  124. this.link && window.open(this.link)
  125. },
  126. readConfig() {
  127. request({
  128. params: {
  129. r: 'store/client/merchant/setting',
  130. },
  131. method: 'get',
  132. }).then(e => {
  133. this.submitLoading = false
  134. if (e.data.code === 0 && e.data.data) {
  135. this.formData = e.data.data.setting
  136. this.link = e.data.data.link
  137. this.formData.bank_account_type = parseInt(this.formData.bank_account_type)
  138. }
  139. }).catch(e => {
  140. })
  141. },
  142. resetForm() {
  143. this.$refs['elForm'].resetFields()
  144. },
  145. submitForm() {
  146. this.$refs['elForm'].validate(valid => {
  147. if (valid) {
  148. this.submitLoading = true;
  149. request({
  150. params: {
  151. r: 'store/client/merchant/save-setting',
  152. },
  153. method: 'post',
  154. data: this.formData,
  155. }).then(e => {
  156. this.submitLoading = false
  157. if (e.data.code === 0) {
  158. this.$message.success(e.data.msg)
  159. } else {
  160. this.$message.error(e.data.msg)
  161. }
  162. }).catch(e => {
  163. })
  164. } else {
  165. this.$message.error('部分参数验证不通过')
  166. }
  167. })
  168. },
  169. },
  170. created() {
  171. this.readConfig()
  172. },
  173. })
  174. </script>
  175. <style>
  176. .form-body {
  177. padding-bottom: 5px;
  178. display: flex;
  179. flex-direction: column;
  180. }
  181. .title {
  182. display: flex;
  183. align-items: center;
  184. padding: 18px 20px;
  185. /* border-top: 1px solid #F3F3F3; */
  186. border-bottom: 1px solid #F3F3F3;
  187. background-color: #fff;
  188. }
  189. .title-line {
  190. width: 4px;
  191. height: 20px;
  192. background-color: #1479F0;
  193. margin-right: 10px;
  194. }
  195. .padding-top {
  196. margin-bottom: 10px;
  197. }
  198. .tip {
  199. color: #c72a29;
  200. }
  201. .link {
  202. display: flex;
  203. }
  204. .link span {
  205. cursor: pointer;
  206. color: #5eaae9;
  207. text-align: center;
  208. width: 100px;
  209. }
  210. </style>