payCenter.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. <template>
  2. <div class="mobile-pay-center vendor-pay mobile-fix-content mobile-centerfix-content" :class="{'vendor-pay-record': switchType === 'record' && recordList.length}" id="mobileFixContent">
  3. <!--<div class="mp-head" v-if="!fromUserPage">-->
  4. <!--<span class="inline-block" :class="{'active': switchType === 'record'}" @click="setSwitchType('record')">交易记录</span>-->
  5. <!--<span class="inline-block" :class="{'active': switchType === 'account'}" @click="setSwitchType('account')">收款账户</span>-->
  6. <!--</div>-->
  7. <!-- 账户信息start -->
  8. <div class="mp-content" v-if="switchType == 'account'">
  9. <!--<p class="mp-content-header">已设置的账户信息<span class="fr" @click="openAddAccount"><i class="iconfont icon-xinzeng"></i>新增账户</span></p>-->
  10. <template v-if="accountList && accountList.length === 0">
  11. <div class="new-account">
  12. <div class="new-content-line">
  13. <span class="inline-block"><i>*</i>开户名称:</span>
  14. <input type="text" placeholder="请填写开户人姓名或企业名称" v-model="bankAccountObj.accountname" @blur="checkAccountname">
  15. </div>
  16. <div class="new-content-line">
  17. <span class="inline-block"><i>*</i>银行账号:</span>
  18. <input type="text" placeholder="请填写银行账号" v-model="bankAccountObj.number" @blur="checkNumber">
  19. </div>
  20. <div class="new-content-line">
  21. <span class="inline-block"><i>*</i>开户银行:</span>
  22. <input type="text" readonly placeholder="例如:中国银行" v-model="bankAccountObj.bankname" @click.stop="showNewSimilar = !showNewSimilar">
  23. <ul v-if="showNewSimilar" class="similar">
  24. <li class="text-ellipse" v-for="bank in bankList" @click.stop="setBankName(bank)">{{bank}}</li>
  25. </ul>
  26. </div>
  27. <div class="new-content-line">
  28. <span class="inline-block"><i>*</i>开户支行:</span>
  29. <input type="text" placeholder="例如:侨香支行" v-model="bankAccountObj.branchname" @blur="checkBranchname">
  30. </div>
  31. <div class="am-btn-wrap">
  32. <button @click="addAccount">确认</button>
  33. </div>
  34. <p class="am-remind-text clearfix">
  35. <i class="fl">*声明:</i>
  36. <span class="fr">
  37. 1. 此账户为卖家收款账户,请仔细核对信息内容,若由信息错误造成的损失,优软商城不承担赔偿责任。
  38. <br/>
  39. 2. 卖家只能有唯一一个“使用中”的收款账户,新增账户审核通过后,原账户将自动失效。
  40. <br/>
  41. 3. 如您的企业名称、开户银行及账号变更,您须在优软商城开展资金结算前进行更正,否则发生转账错误优软商城不承担赔偿责任。
  42. <br/>
  43. 4. 更多的条款请阅读《优软商城代收代付协议》 。
  44. </span>
  45. </p>
  46. </div>
  47. </template>
  48. <template v-else>
  49. <ul class="mp-list">
  50. <li v-for="account in accountList">
  51. <div class="content-line">
  52. <span class="inline-block title">开户名称:</span>
  53. <span class="inline-block content text-ellipse">{{account.accountname}}</span>
  54. </div>
  55. <div class="content-line">
  56. <span class="inline-block title">银行账户:</span>
  57. <span class="inline-block content text-ellipse">{{account.number}}</span>
  58. </div>
  59. <div class="content-line">
  60. <span class="inline-block title">开户银行:</span>
  61. <span class="inline-block content text-ellipse">{{account.bankname}}</span>
  62. </div>
  63. <div class="content-line">
  64. <span class="inline-block title">开户支行:</span>
  65. <span class="inline-block content text-ellipse">{{account.branchname}}</span>
  66. </div>
  67. <div class="content-line">
  68. <span class="inline-block title">状态:</span>
  69. <span class="inline-block content text-ellipse">
  70. {{account.status | bankStatusFilter}}
  71. <i v-if="account.status == 101" class="iconfont icon-tixing"></i>
  72. </span>
  73. </div>
  74. <div class="btn-wrap clearfix">
  75. <a class="inline-block" @click="reuseAccount(account)"><i class="iconfont icon-gouxuan1"></i>重新使用</a><!-- v-if="account.status == 105"-->
  76. <a class="inline-block" @click="deleteAccount(account)"><i class="iconfont icon-lajitong"></i>删除</a>
  77. </div>
  78. </li>
  79. </ul>
  80. <div class="com-btn-wrap mp-btn-wrap">
  81. <button @click.stop="openAddAccount"><i class="iconfont icon-add"></i>新增账户</button>
  82. </div>
  83. </template>
  84. </div>
  85. <!-- 账户信息end -->
  86. <!-- 交易记录start -->
  87. <div class="mp-record" v-if="switchType == 'record'">
  88. <div class="search-content">
  89. <input type="text" placeholder="买家名称/订单号" v-model="filterParams.keyword" @keyup.13="filterRecord">
  90. <span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>
  91. </div>
  92. <div class="filters-wrap">
  93. <base-filter
  94. v-for="filterOption in filterOptions"
  95. :key="filterOption.selectOption"
  96. :selectItems="filterOption.selectItems"
  97. :defaultVal="filterOption.defaultVal"
  98. :selectOption="filterOption.selectOption"
  99. @selectAction="onSelectAction"
  100. :title="filterOption.title"></base-filter>
  101. </div>
  102. <ul class="mp-list record-list mp-list-record" v-if="recordList.length">
  103. <li v-for="record in recordList">
  104. <div class="content-line">
  105. <span class="inline-block title">订单号:</span>
  106. <nuxt-link :to="`/mobile/order/details?uuid=${baseUtils.enidfilter(record.puid)}&type=saler`" class="inline-block content text-ellipse link">{{record.orderid}}</nuxt-link>
  107. </div>
  108. <div class="content-line">
  109. <span class="inline-block title">金额:</span>
  110. <span class="inline-block content text-ellipse">{{record.currencyName | currencyFilter}}{{record.total}}</span>
  111. </div>
  112. <div class="content-line">
  113. <span class="inline-block title">买家:</span>
  114. <span class="inline-block content text-ellipse">{{record.buyerentername || record.buyername}}</span>
  115. </div>
  116. <div class="content-line">
  117. <span class="inline-block title">交易方式:</span>
  118. <span class="inline-block content text-ellipse">{{record.type | payTypeFilter}}</span>
  119. </div>
  120. <div class="content-line">
  121. <span class="inline-block title">时间:</span>
  122. <span class="inline-block content text-ellipse">{{record.transferTime | time}}</span>
  123. </div>
  124. <div class="content-line">
  125. <span class="inline-block title">状态:</span>
  126. <span class="inline-block content text-ellipse">收款成功</span>
  127. </div>
  128. </li>
  129. </ul>
  130. <div class="fix-count-wrap" v-if="recordList.length">
  131. <span class="content">已收总计:<span>{{currencySymbol | currencyFilter}}&nbsp;{{totalMoney}}</span></span>
  132. <!--<span class="content">支出总计:<span>{{currencySymbol | currencyFilter}}&nbsp;0</span></span>
  133. <p>结余:{{currencySymbol | currencyFilter}}&nbsp;{{totalRecordPrice}} (共计{{recordList.length || 0}}笔交易)</p>-->
  134. <p>结余:{{currencySymbol | currencyFilter}}&nbsp;{{totalMoney}} (共计{{recordData.data.data.data.totalElements || 0}}笔交易)</p>
  135. </div>
  136. </div>
  137. <!-- 交易记录end -->
  138. <!-- 新增账户弹框start -->
  139. <modal-wrapper :noHeader="true" :showModal="showModal" @closeAction="showModal = false">
  140. <div class="add-account-modal in-wrapper">
  141. <div class="account-modal">
  142. <p class="title">新增账户</p>
  143. <div class="modal-content-line">
  144. <span class="inline-block"><i>*</i>开户名称:</span>
  145. <input type="text" placeholder="请填写开户人姓名或企业名称" v-model="bankAccountObj.accountname" @blur="checkAccountname">
  146. </div>
  147. <div class="modal-content-line">
  148. <span class="inline-block"><i>*</i>银行账号:</span>
  149. <input type="text" placeholder="请填写银行账号" v-model="bankAccountObj.number" @blur="checkNumber">
  150. </div>
  151. <div class="modal-content-line">
  152. <span class="inline-block"><i>*</i>开户银行:</span>
  153. <input type="text" readonly placeholder="例如:中国银行" v-model="bankAccountObj.bankname" @click.stop="showSimilar = !showSimilar">
  154. <ul v-if="showSimilar" class="similar">
  155. <li class="text-ellipse" v-for="bank in bankList" @click.stop="setBankName(bank)">{{bank}}</li>
  156. </ul>
  157. </div>
  158. <div class="modal-content-line">
  159. <span class="inline-block"><i>*</i>开户支行:</span>
  160. <input type="text" placeholder="例如:侨香支行" v-model="bankAccountObj.branchname" @blur="checkBranchname">
  161. </div>
  162. <!--<div class="modal-content-line upload">
  163. <span class="inline-block"><i>*</i>上传开户许可证:</span>
  164. <input type="text" v-model="file.name" disabled>
  165. <label class="upload-btn">选择文件
  166. <input type="file" @change="onUpload($event)" accept="image/jpeg,image/jpg,image/png,.pdf">
  167. </label>
  168. </div>-->
  169. <div class="am-btn-wrap">
  170. <button @click="showModal = false">取消</button>
  171. <button @click="addAccount">确认</button>
  172. </div>
  173. <p class="am-remind-text clearfix">
  174. <i class="fl">*声明:</i>
  175. <span class="fr">
  176. 1. 此账户为卖家收款账户,请仔细核对信息内容,若由信息错误造成的损失,优软商城不承担赔偿责任。
  177. <br/>
  178. 2. 卖家只能有唯一一个“使用中”的收款账户,新增账户审核通过后,原账户将自动失效。
  179. <br/>
  180. 3. 如您的企业名称、开户银行及账号变更,您须在优软商城开展资金结算前进行更正,否则发生转账错误优软商城不承担赔偿责任。
  181. <br/>
  182. 4. 更多的条款请阅读《优软商城代收代付协议》 。
  183. <!--<br/>
  184. 5. 附件仅支持JPG、PNG、PDF格式,大小超过3M。-->
  185. </span>
  186. </p>
  187. </div>
  188. </div>
  189. </modal-wrapper>
  190. <!-- 新增账户弹框end -->
  191. <!-- 重新使用账户提示框start -->
  192. <div class="mobile-modal reuse-account-modal" v-show="showReuseModal">
  193. <div class="ra-remind">
  194. <div class="header"><i class="iconfont icon-guanbi1" @click="showReuseModal = false"></i></div>
  195. <div class="content"><i class="fa fa-exclamation-circle"></i>
  196. <span>此操作会让使用中的收款账户失效,是否确定重新使用?</span>
  197. </div>
  198. <div class="footer">
  199. <button @click="showReuseModal = false">取消</button>
  200. <button @click="setDefaultAccount()">确认</button>
  201. </div>
  202. </div>
  203. </div>
  204. <!-- 重新使用账户提示框end -->
  205. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  206. <pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  207. <empty-status v-if="isEmpty" :text="暂无交易记录" :showLink="true"></empty-status>
  208. </div>
  209. </template>
  210. <script>
  211. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  212. import { ModalWrapper, BaseFilter } from '~components/mobile/base'
  213. import axios from '~plugins/axios'
  214. export default {
  215. layout: 'mobile',
  216. middleware: 'authenticated',
  217. data () {
  218. return {
  219. fromUserPage: false,
  220. remindText: '',
  221. timeoutCount: '',
  222. page: 1,
  223. count: 10,
  224. accountList: [],
  225. recordList: [],
  226. switchType: 'record',
  227. // 分页重置标志
  228. isChange: false,
  229. showModal: false,
  230. bankList: [],
  231. showSimilar: false,
  232. showNewSimilar: false,
  233. bankAccountObj: {
  234. bankname: '',
  235. branchname: '',
  236. number: '',
  237. accountname: '',
  238. accountType: 'RECEIVE_TYPE'
  239. },
  240. validBankAccountObj: {
  241. bankname: false,
  242. branchname: false,
  243. number: false,
  244. accountname: false
  245. },
  246. filterParams: {
  247. keyword: '',
  248. fromDate: '',
  249. toDate: '',
  250. remitteeType: ''
  251. },
  252. currentId: '',
  253. showReuseModal: false,
  254. totalRecordPrice: 0,
  255. file: '',
  256. dateObj: {
  257. fromDate: '',
  258. toDate: ''
  259. },
  260. filterOptions: [
  261. {
  262. title: '交易方式',
  263. selectOption: 'remitteeType',
  264. selectItems: [{
  265. key: '平台代付',
  266. val: 'PLATFORMPAIDTOVENDOR'
  267. }, {
  268. key: '买家付款',
  269. val: 'PAIDTOVENDOR'
  270. }],
  271. defaultVal: 'PLATFORMPAIDTOVENDOR'
  272. },
  273. // {
  274. // title: '交易状态',
  275. // selectOption: 'status',
  276. // selectItems: [{key: '全部',
  277. // val: 0
  278. // }, {
  279. // key: '已收款',
  280. // val: 1
  281. // }, {
  282. // key: '待收款',
  283. // val: 2
  284. // }],
  285. // defaultVal: 0
  286. // },
  287. {
  288. title: '交易时间',
  289. selectOption: 'date',
  290. selectItems: [{
  291. key: '30天',
  292. val: 1
  293. }, {
  294. key: '90天',
  295. val: 2
  296. }, {
  297. key: '180天',
  298. val: 3
  299. }, {
  300. key: '自定义',
  301. val: 4
  302. }],
  303. defaultVal: 1
  304. }
  305. ],
  306. totalMoney: 0,
  307. fromDate: 0,
  308. toDate: 0
  309. }
  310. },
  311. components: {
  312. RemindBox,
  313. PullUp,
  314. ModalWrapper,
  315. EmptyStatus,
  316. BaseFilter
  317. },
  318. async asyncData({route}) {
  319. let { data } = await axios.get('/trade/transfer/vendor/bankTransfer/ledger?type=sup')
  320. return {
  321. totalMoney: data.code === 1 ? data.data : 0,
  322. fromUserPage: Boolean(route.query.type),
  323. switchType: route.query.switchType || 'record'
  324. }
  325. },
  326. created () {
  327. let currentTime = this.baseUtils.getClearDay(new Date())
  328. let fromDate = currentTime - 29 * 24 * 60 * 60 * 1000
  329. let toDate = currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
  330. if (this.$route.query.type) {
  331. this.$store.dispatch('payCenter/loadVendorAccount', {count: 10, page: 1, sorting: {num: 'ASC'}, type: 'sup'})
  332. } else {
  333. this.$store.dispatch('payCenter/loadVendorRecord', {count: 10, page: 1, sorting: {'transferTime': 'DESC'}, type: 'sup', fromDate: fromDate, toDate: toDate, remitteeType: 'PAIDTOPLATFORM'})
  334. }
  335. },
  336. mounted () {
  337. if (!this.bankList || !this.bankList.length) {
  338. this.$http.get('/data/bank.json').then(res => {
  339. this.bankList = res.data.list
  340. })
  341. }
  342. },
  343. watch: {
  344. 'vendorAccount': {
  345. handler: function (val) {
  346. if (val && val.content) {
  347. if (this.isChange) {
  348. this.accountList = []
  349. this.isChange = false
  350. }
  351. this.accountList = [...this.accountList, ...val.content]
  352. }
  353. }
  354. },
  355. 'vendorRecord': {
  356. handler: function (val) {
  357. if (val && val.content) {
  358. if (this.isChange) {
  359. this.recordList = []
  360. this.isChange = false
  361. this.totalRecordPrice = 0
  362. }
  363. // this.totalRecordPrice = this.baseUtils.priceFixed(this.totalRecordPrice + this.recordData.data.data.total)
  364. this.recordList = [...this.recordList, ...val.content]
  365. }
  366. }
  367. }
  368. },
  369. filters: {
  370. bankStatusFilter: function (status) {
  371. let result = '未知状态'
  372. switch (status) {
  373. case 101 :
  374. result = '待审核'
  375. break
  376. case 104:
  377. result = '使用中'
  378. break
  379. case 103:
  380. result = '未通过'
  381. break
  382. case 105:
  383. result = '已失效'
  384. break
  385. case 112:
  386. result = '已删除'
  387. break
  388. }
  389. return result
  390. },
  391. payTypeFilter: function (type) {
  392. if (type === 'PAIDTOVENDOR') {
  393. return '买家付款'
  394. } else if (type === 'PLATFORMPAIDTOVENDOR') {
  395. return '平台代付'
  396. } else {
  397. return '其他'
  398. }
  399. }
  400. },
  401. computed: {
  402. accountData () {
  403. return this.$store.state.payCenter.data.vendorAccount
  404. },
  405. recordData () {
  406. return this.$store.state.payCenter.data.vendorRecord
  407. },
  408. vendorAccount () {
  409. return this.accountData.data
  410. },
  411. vendorRecord () {
  412. return this.recordData.data.data ? this.recordData.data.data.data : []
  413. },
  414. fetching () {
  415. return this.switchType === 'account' ? this.accountData.fetching : this.recordData.fetching
  416. },
  417. allPage () {
  418. return this.switchType === 'account' ? this.vendorAccount.totalPages : this.vendorRecord.totalPages
  419. },
  420. isEmpty () {
  421. return (this.switchType === 'record' && this.recordList.length === 0)
  422. },
  423. currencySymbol () {
  424. return this.recordList[0] ? this.recordList[0].currencyName : 'RMB'
  425. }
  426. },
  427. methods: {
  428. setRemindText: function (str) {
  429. this.remindText = str
  430. this.timeoutCount++
  431. },
  432. reloadList () {
  433. if (this.switchType === 'account') {
  434. this.$store.dispatch('payCenter/loadVendorAccount', {
  435. count: this.count,
  436. page: this.page,
  437. sorting: {num: 'ASC'},
  438. type: 'sup'
  439. })
  440. } else {
  441. this.$store.dispatch('payCenter/loadVendorRecord', {
  442. count: this.count,
  443. page: this.page,
  444. sorting: {'transferTime': 'DESC'},
  445. type: 'sup',
  446. fromDate: this.filterParams.fromDate || null,
  447. toDate: this.filterParams.toDate || null,
  448. keyword: this.filterParams.keyword || null,
  449. remitteeType: this.filterParams.remitteeType || null
  450. })
  451. }
  452. },
  453. initList () {
  454. this.isChange = true
  455. this.page = 1
  456. this.reloadList()
  457. },
  458. onPullUpAction () {
  459. this.page++
  460. this.reloadList()
  461. },
  462. setSwitchType (type) {
  463. this.switchType = type
  464. if (type === 'record') {
  465. this.initFilterParams()
  466. }
  467. this.initList()
  468. },
  469. initFilterParams () {
  470. this.filterParams = {
  471. keyword: '',
  472. fromDate: '',
  473. toDate: '',
  474. currencyName: '',
  475. method: ''
  476. }
  477. },
  478. filterRecord () {
  479. this.isChange = true
  480. this.page = 1
  481. this.reloadList()
  482. },
  483. onSelectAction (selectObj) {
  484. this.setSelect(selectObj.key, selectObj.value)
  485. },
  486. setSelect (type, val) {
  487. if (type === 'date') {
  488. if (val) {
  489. this.filterParams.fromDate = val.fromDate
  490. this.filterParams.toDate = val.toDate
  491. } else {
  492. this.filterParams.fromDate = null
  493. this.filterParams.toDate = null
  494. }
  495. } else {
  496. this.filterParams[type] = val
  497. }
  498. this.filterRecord()
  499. },
  500. setDate (type) {
  501. if (this.dateObj[type]) {
  502. this.filterParams[type] = new Date(this.dateObj[type]).getTime() - 8 * 60 * 60 * 1000
  503. if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate > this.filterParams.toDate) {
  504. if (type === 'fromDate') {
  505. this.setRemindText('起始时间不能大于结束时间')
  506. } else {
  507. this.setRemindText('结束时间不能小于起始时间')
  508. }
  509. this.filterParams[type] = null
  510. this.dateObj[type] = null
  511. } else {
  512. if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate === this.filterParams.toDate) {
  513. // 23:59:59
  514. this.filterParams.toDate += 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
  515. }
  516. this.filterRecord()
  517. }
  518. } else {
  519. this.filterParams[type] = null
  520. this.filterRecord()
  521. }
  522. },
  523. reuseAccount (account) {
  524. if (account.status !== 105) {
  525. this.setRemindText(`该账户${this.$options.filters.bankStatusFilter(account.status)}`)
  526. } else {
  527. this.currentId = account.id
  528. this.showReuseModal = true
  529. }
  530. },
  531. setDefaultAccount () {
  532. this.$http.get(`/trade/bankInfo/setDefaultAccount/${this.currentId}`).then(() => {
  533. this.setRemindText('重新使用完成')
  534. this.initList()
  535. this.showReuseModal = false
  536. })
  537. },
  538. deleteAccount (account) {
  539. this.$http.delete(`/trade/bankInfo/delete/${account.id}`).then(res => {
  540. if (res.data === 'success') {
  541. this.setRemindText('删除成功')
  542. this.initList()
  543. }
  544. })
  545. },
  546. initAccount () {
  547. this.bankAccountObj = {
  548. bankname: '',
  549. branchname: '',
  550. number: '',
  551. accountname: '',
  552. accountType: 'RECEIVE_TYPE'
  553. }
  554. this.validBankAccountObj = {
  555. bankname: false,
  556. branchname: false,
  557. number: false,
  558. accountname: false
  559. }
  560. this.file = ''
  561. },
  562. openAddAccount () {
  563. if (!this.bankList || !this.bankList.length) {
  564. this.$http.get('/data/bank.json').then(res => {
  565. this.bankList = res.data.list
  566. this.initAccount()
  567. this.showModal = true
  568. })
  569. } else {
  570. this.initAccount()
  571. this.showModal = true
  572. }
  573. },
  574. setBankName (name) {
  575. this.bankAccountObj.bankname = name
  576. this.showSimilar = false
  577. this.showNewSimilar = false
  578. this.validBankAccountObj.bankname = true
  579. },
  580. checkBranchname () {
  581. this.validBankAccountObj.branchname = true
  582. if (!(this.bankAccountObj.branchname && this.bankAccountObj.branchname.length)) {
  583. this.setRemindText('开户支行不能为空')
  584. this.validBankAccountObj.branchname = false
  585. } else if (this.baseUtils.getRealLen(this.bankAccountObj.branchname) > 40) {
  586. this.setRemindText('开户支行不能大于40字符')
  587. this.validBankAccountObj.branchname = false
  588. } else if (!/^[\u2E80-\u9FFF]+$/.test(this.bankAccountObj.branchname)) {
  589. this.setRemindText('请输入正确的开户支行')
  590. this.validBankAccountObj.branchname = false
  591. }
  592. },
  593. checkNumber () {
  594. this.validBankAccountObj.number = true
  595. if (!(this.bankAccountObj.number && this.bankAccountObj.number.length)) {
  596. this.validBankAccountObj.number = false
  597. this.setRemindText('银行账号不能为空')
  598. } else if (this.baseUtils.getRealLen(this.bankAccountObj.number) > 30) {
  599. this.setRemindText('银行账号不能大于30字符')
  600. this.validBankAccountObj.number = false
  601. } else if (!/^[0-9]+$/.test(this.bankAccountObj.number)) {
  602. this.setRemindText('请输入正确的银行账号')
  603. this.validBankAccountObj.number = false
  604. }
  605. if (this.validBankAccountObj.number) {
  606. this.$http.get('/trade/bankInfo/number/count', {params: {accountType: 'RECEIVE_TYPE', number: this.bankAccountObj.number, type:1063}}).then(res => {
  607. if (res.data.success) {
  608. if (res.data.data === 0) {
  609. this.validBankAccountObj.number = true
  610. } else {
  611. this.validBankAccountObj.number = false
  612. this.setRemindText('银行账号校验失败')
  613. }
  614. } else {
  615. this.validBankAccountObj.number = false
  616. this.setRemindText(res.data.message || '银行账号校验失败')
  617. }
  618. }, err => {
  619. this.validBankAccountObj.number = false
  620. this.setRemindText(err.response.data || '银行账号校验失败')
  621. console.log(err)
  622. })
  623. }
  624. },
  625. checkAccountname () {
  626. this.validBankAccountObj.accountname = true
  627. if (!(this.bankAccountObj.accountname && this.bankAccountObj.accountname.length)) {
  628. this.validBankAccountObj.accountname = false
  629. this.setRemindText('账户名称不能为空')
  630. } else if (this.baseUtils.getRealLen(this.bankAccountObj.accountname) > 100) {
  631. this.setRemindText('账户名称不能大于100个字符')
  632. this.validBankAccountObj.accountname = false
  633. }
  634. },
  635. addAccount () {
  636. if (!this.validBankAccountObj.bankname) {
  637. this.setRemindText('请选择开户银行')
  638. } else if (!this.validBankAccountObj.branchname) {
  639. this.setRemindText('请填写正确的开户支行')
  640. } else if (!this.validBankAccountObj.number) {
  641. this.setRemindText('请填写正确的银行账号')
  642. } else if (!this.validBankAccountObj.accountname) {
  643. this.setRemindText('请填写正确的开户名称')
  644. } else {
  645. let param = new FormData()
  646. // param.append('file', this.file, this.file.name)
  647. param.append('bankInfo', JSON.stringify(this.bankAccountObj))
  648. let config = {
  649. headers: {'Content-Type': 'multipart/form-data'}
  650. }
  651. this.$http.post('/trade/bankInfo/save/enterprise?type=sup', param, config).then(res => {
  652. if (res.data.id) {
  653. this.setRemindText('新增账户成功')
  654. this.initList()
  655. this.initAccount()
  656. this.showModal = false
  657. } else {
  658. this.setRemindText('新增账户失败')
  659. }
  660. }, err => {
  661. this.setRemindText(err.response.data || '新增账户失败')
  662. console.log(err)
  663. })
  664. }
  665. },
  666. onUpload (e) {
  667. let file = e.target.files[0]
  668. let arr = file.name.split('.')
  669. let type = arr[arr.length - 1]
  670. if ('pdf/png/jpg/jpeg'.indexOf(type.toLowerCase()) === -1) {
  671. this.setRemindText('仅支持jpg/jpeg/png/pdf格式的文件')
  672. } else if (file.size > 1024 * 1024 * 3) {
  673. this.setRemindText('请勿大于3M')
  674. } else {
  675. this.file = file
  676. }
  677. }
  678. }
  679. }
  680. </script>
  681. <style lang="scss">
  682. @import '~assets/scss/mobilePayCenter';
  683. .new-account {
  684. padding: .24rem;
  685. background: #fff;
  686. i {
  687. font-style: normal;
  688. color: #ff0000;
  689. }
  690. .new-content-line {
  691. margin-bottom: .3rem;
  692. position: relative;
  693. span {
  694. width: 2.5rem;
  695. color: #226ce7;
  696. font-size: .28rem;
  697. text-align: right;
  698. }
  699. input[type='text'] {
  700. width: 3.59rem;
  701. height: .56rem;
  702. font-size: .24rem;
  703. border-radius: .04rem;
  704. border: 1px solid #d2d2d2;
  705. padding: 0 .2rem;
  706. }
  707. input[readonly] {
  708. background: url('/images/mobile/select-arrow.png') no-repeat;
  709. background-size: .24rem .15rem;
  710. background-position: 3.1rem .2rem;
  711. }
  712. .similar {
  713. position: absolute;
  714. left: 2.5rem;
  715. border: 1px solid $base-color;
  716. border-radius: .04rem;
  717. top: .56rem;
  718. width: 3.59rem;
  719. background: #fff;
  720. z-index: 1;
  721. max-height: 3.96rem;
  722. overflow-y: auto;
  723. li {
  724. height: .66rem;
  725. line-height: .66rem;
  726. padding: 0 .19rem;
  727. font-size: .24rem;
  728. &:active, &:focus {
  729. background: #f7f7f7;
  730. }
  731. }
  732. }
  733. }
  734. .remind {
  735. color: #666;
  736. font-size: .24rem;
  737. width: 3.59rem;
  738. float: right;
  739. margin-right: .44rem;
  740. line-height: .37rem;
  741. i {
  742. margin-right: .05rem;
  743. }
  744. }
  745. .am-btn-wrap {
  746. margin-top: .74rem;
  747. button {
  748. width: 92%;
  749. height: .77rem;
  750. line-height: .77rem;
  751. color: #fff;
  752. font-size: .32rem;
  753. border-radius: .08rem;
  754. background: #bfbfbf;
  755. &:last-child {
  756. background: $base-color;
  757. margin-left: .3rem;
  758. }
  759. }
  760. }
  761. }
  762. .ra-remind {
  763. width: 6.3rem;
  764. height: 3.5rem;
  765. position: absolute;
  766. top: 50%;
  767. left: 50%;
  768. margin-top: -1.75rem;
  769. margin-left: -3.15rem;
  770. border-radius: .15rem;
  771. .header {
  772. height: .6rem;
  773. line-height: .6rem;
  774. background: #3976f4;
  775. border-top-left-radius: .15rem;
  776. border-top-right-radius: .15rem;
  777. i {
  778. font-size: .32rem;
  779. color: #fff;
  780. float: right;
  781. margin-right: .28rem;
  782. }
  783. }
  784. .content {
  785. background: #fff;
  786. padding: .53rem .77rem;
  787. span {
  788. font-size: .32rem;
  789. }
  790. i {
  791. font-size: .44rem;
  792. color: #3976f4;
  793. float: left;
  794. margin-right: .2rem;
  795. }
  796. }
  797. .footer {
  798. background: #fff;
  799. padding-bottom: .37rem;
  800. text-align: center;
  801. border-bottom-left-radius: .15rem;
  802. border-bottom-right-radius: .15rem;
  803. margin-top: -0.05rem;
  804. button {
  805. width: 2.22rem;
  806. height: .77rem;
  807. line-height: .77rem;
  808. color: #fff;
  809. font-size: .32rem;
  810. border-radius: .08rem;
  811. background: #bfbfbf;
  812. &:last-child {
  813. background: $base-color;
  814. margin-left: .3rem;
  815. }
  816. }
  817. }
  818. }
  819. .record-list {
  820. margin-bottom: 1.26rem
  821. }
  822. .upload {
  823. input[disabled] {
  824. background: #eee;
  825. width: 2.18rem !important;
  826. }
  827. .upload-btn {
  828. display: inline-block;
  829. vertical-align: middle;
  830. width: 1.2rem;
  831. height: .56rem;
  832. line-height: .56rem;
  833. text-align: center;
  834. color: #fff;
  835. background: #fe9d03;
  836. position: relative;
  837. left: .2rem;
  838. border-radius: .04rem;
  839. font-size: .24rem;
  840. font-weight: normal;
  841. margin: 0;
  842. input {
  843. opacity: 0;
  844. width: 1.2rem;
  845. height: .56rem;
  846. position: absolute;
  847. top: 0;
  848. }
  849. }
  850. }
  851. .fix-count-wrap {
  852. position: fixed;
  853. bottom: .98rem;
  854. height: 1.25rem;
  855. text-align: right;
  856. background: #fff;
  857. border-radius: .02rem;
  858. border-top: 1px solid #bfbfbf;
  859. line-height: .62rem;
  860. font-size: .28rem;
  861. width: 100%;
  862. padding-right: .3rem;
  863. .content {
  864. margin-left: .39rem;
  865. &:first-child {
  866. span {
  867. color: #fd0303;
  868. }
  869. }
  870. &:nth-of-type(2) {
  871. span {
  872. color: #15b262;
  873. }
  874. }
  875. }
  876. }
  877. .mp-list .content-line .icon-tixing {
  878. font-size: .32rem;
  879. color: $base-color;
  880. margin-left: .05rem;
  881. }
  882. .am-remind-text {
  883. font-size: .26rem;
  884. color: #999;
  885. margin-top: .29rem;
  886. padding: .45rem 0;
  887. border-top: 1px solid #d2d2d2;
  888. i {
  889. color: #fd0303;
  890. width: 12%;
  891. }
  892. .fr {
  893. width: 88%;
  894. }
  895. }
  896. .vendor-pay {
  897. padding-bottom: 1rem;
  898. .mobile-modal .mobile-modal-wrapper {
  899. left: .2rem !important;
  900. right: .2rem !important;
  901. }
  902. }
  903. .vendor-pay-record {
  904. /*bottom: 2.23rem !important;*/
  905. padding-bottom: 1.25rem !important;
  906. }
  907. </style>