payCenter.vue 33 KB

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