payCenter.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  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" readonly placeholder="例如:中国银行" v-model="bankAccountObj.bankname" @click.stop="showNewSimilar = !showNewSimilar">
  15. <ul v-if="showNewSimilar" class="similar">
  16. <li class="text-ellipse" v-for="bank in bankList" @click.stop="setBankName(bank)">{{bank}}</li>
  17. </ul>
  18. </div>
  19. <div class="new-content-line">
  20. <span class="inline-block"><i>*</i>开户支行:</span>
  21. <input type="text" placeholder="例如:乔香支行" v-model="bankAccountObj.branchname" @blur="checkBranchname">
  22. </div>
  23. <div class="new-content-line">
  24. <span class="inline-block"><i>*</i>银行账号:</span>
  25. <input type="text" placeholder="请填写银行账号" v-model="bankAccountObj.number" @blur="checkNumber">
  26. </div>
  27. <div class="new-content-line">
  28. <span class="inline-block"><i>*</i>开户名称:</span>
  29. <input type="text" placeholder="请填写开户人姓名或企业名称" v-model="bankAccountObj.accountname" @blur="checkAccountname">
  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.bankname}}</span>
  54. </div>
  55. <div class="content-line">
  56. <span class="inline-block title">开户支行:</span>
  57. <span class="inline-block content text-ellipse">{{account.branchname}}</span>
  58. </div>
  59. <div class="content-line">
  60. <span class="inline-block title">银行账户:</span>
  61. <span class="inline-block content text-ellipse">{{account.number}}</span>
  62. </div>
  63. <div class="content-line">
  64. <span class="inline-block title">开户名称:</span>
  65. <span class="inline-block content text-ellipse">{{account.accountname}}</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" readonly placeholder="例如:中国银行" v-model="bankAccountObj.bankname" @click.stop="showSimilar = !showSimilar">
  146. <ul v-if="showSimilar" class="similar">
  147. <li class="text-ellipse" v-for="bank in bankList" @click.stop="setBankName(bank)">{{bank}}</li>
  148. </ul>
  149. </div>
  150. <div class="modal-content-line">
  151. <span class="inline-block"><i>*</i>开户支行:</span>
  152. <input type="text" placeholder="例如:乔香支行" v-model="bankAccountObj.branchname" @blur="checkBranchname">
  153. </div>
  154. <div class="modal-content-line">
  155. <span class="inline-block"><i>*</i>银行账号:</span>
  156. <input type="text" placeholder="请填写银行账号" v-model="bankAccountObj.number" @blur="checkNumber">
  157. </div>
  158. <div class="modal-content-line">
  159. <span class="inline-block"><i>*</i>开户名称:</span>
  160. <input type="text" placeholder="请填写开户人姓名或企业名称" v-model="bankAccountObj.accountname" @blur="checkAccountname">
  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. },
  239. validBankAccountObj: {
  240. bankname: false,
  241. branchname: false,
  242. number: false,
  243. accountname: false
  244. },
  245. filterParams: {
  246. keyword: '',
  247. fromDate: '',
  248. toDate: '',
  249. remitteeType: ''
  250. },
  251. currentId: '',
  252. showReuseModal: false,
  253. totalRecordPrice: 0,
  254. file: '',
  255. dateObj: {
  256. fromDate: '',
  257. toDate: ''
  258. },
  259. filterOptions: [
  260. {
  261. title: '交易方式',
  262. selectOption: 'remitteeType',
  263. selectItems: [{key: '全部',
  264. val: null
  265. }, {
  266. key: '买家付款',
  267. val: 'PAIDTOVENDOR'
  268. }, {
  269. key: '平台代付',
  270. val: 'PLATFORMPAIDTOVENDOR'
  271. }],
  272. defaultVal: null
  273. },
  274. // {
  275. // title: '交易状态',
  276. // selectOption: 'status',
  277. // selectItems: [{key: '全部',
  278. // val: 0
  279. // }, {
  280. // key: '已收款',
  281. // val: 1
  282. // }, {
  283. // key: '待收款',
  284. // val: 2
  285. // }],
  286. // defaultVal: 0
  287. // },
  288. {
  289. title: '交易时间',
  290. selectOption: 'date',
  291. selectItems: [{key: '全部',
  292. val: null
  293. }, {
  294. key: '一个月',
  295. val: 1
  296. }, {
  297. key: '三个月',
  298. val: 2
  299. }, {
  300. key: '六个月',
  301. val: 3
  302. }, {
  303. key: '自定义',
  304. val: 4
  305. }],
  306. defaultVal: null
  307. }
  308. ],
  309. totalMoney: 0
  310. }
  311. },
  312. components: {
  313. RemindBox,
  314. PullUp,
  315. ModalWrapper,
  316. EmptyStatus,
  317. BaseFilter
  318. },
  319. fetch ({store, route}) {
  320. return route.query.type ? Promise.all([store.dispatch('payCenter/loadVendorAccount', {count: 10, page: 1, sorting: {num: 'ASC'}, type: 'sup'})
  321. ]) : Promise.all([store.dispatch('payCenter/loadVendorRecord', {count: 10, page: 1, sorting: {'transferTime': 'DESC'}, type: 'sup'})])
  322. },
  323. async asyncData({route}) {
  324. let { data } = await axios.get('/trade/transfer/vendor/bankTransfer/ledger?type=sup')
  325. return {
  326. totalMoney: data.code === 1 ? data.data : 0,
  327. fromUserPage: Boolean(route.query.type),
  328. switchType: route.query.switchType || 'record'
  329. }
  330. },
  331. mounted () {
  332. if (!this.bankList || !this.bankList.length) {
  333. this.$http.get('/data/bank.json').then(res => {
  334. this.bankList = res.data.list
  335. })
  336. }
  337. },
  338. watch: {
  339. 'vendorAccount': {
  340. handler: function (val) {
  341. if (val && val.content) {
  342. if (this.isChange) {
  343. this.accountList = []
  344. this.isChange = false
  345. }
  346. this.accountList = [...this.accountList, ...val.content]
  347. }
  348. },
  349. immediate: true
  350. },
  351. 'vendorRecord': {
  352. handler: function (val) {
  353. if (val && val.content) {
  354. if (this.isChange) {
  355. this.recordList = []
  356. this.isChange = false
  357. this.totalRecordPrice = 0
  358. }
  359. // this.totalRecordPrice = this.baseUtils.priceFixed(this.totalRecordPrice + this.recordData.data.data.total)
  360. this.recordList = [...this.recordList, ...val.content]
  361. }
  362. },
  363. immediate: true
  364. }
  365. },
  366. filters: {
  367. bankStatusFilter: function (status) {
  368. let result = '未知状态'
  369. switch (status) {
  370. case 101 :
  371. result = '待审核'
  372. break
  373. case 104:
  374. result = '使用中'
  375. break
  376. case 103:
  377. result = '未通过'
  378. break
  379. case 105:
  380. result = '已失效'
  381. break
  382. case 112:
  383. result = '已删除'
  384. break
  385. }
  386. return result
  387. },
  388. payTypeFilter: function (type) {
  389. if (type === 'PAIDTOVENDOR') {
  390. return '买家付款'
  391. } else if (type === 'PLATFORMPAIDTOVENDOR') {
  392. return '平台代付'
  393. } else {
  394. return '其他'
  395. }
  396. }
  397. },
  398. computed: {
  399. accountData () {
  400. return this.$store.state.payCenter.data.vendorAccount
  401. },
  402. recordData () {
  403. return this.$store.state.payCenter.data.vendorRecord
  404. },
  405. vendorAccount () {
  406. return this.accountData.data
  407. },
  408. vendorRecord () {
  409. return this.recordData.data.data ? this.recordData.data.data.data : []
  410. },
  411. fetching () {
  412. return this.switchType === 'account' ? this.accountData.fetching : this.recordData.fetching
  413. },
  414. allPage () {
  415. return this.switchType === 'account' ? this.vendorAccount.totalPages : this.vendorRecord.totalPages
  416. },
  417. isEmpty () {
  418. return (this.switchType === 'record' && this.recordList.length === 0)
  419. },
  420. currencySymbol () {
  421. return this.recordList[0] ? this.recordList[0].currencyName : 'RMB'
  422. }
  423. },
  424. methods: {
  425. setRemindText: function (str) {
  426. this.remindText = str
  427. this.timeoutCount++
  428. },
  429. reloadList () {
  430. if (this.switchType === 'account') {
  431. this.$store.dispatch('payCenter/loadVendorAccount', {
  432. count: this.count,
  433. page: this.page,
  434. sorting: {num: 'ASC'},
  435. type: 'sup'
  436. })
  437. } else {
  438. this.$store.dispatch('payCenter/loadVendorRecord', {
  439. count: this.count,
  440. page: this.page,
  441. sorting: {'transferTime': 'DESC'},
  442. type: 'sup',
  443. fromDate: this.filterParams.fromDate || null,
  444. toDate: this.filterParams.toDate || null,
  445. keyword: this.filterParams.keyword || null,
  446. remitteeType: this.filterParams.remitteeType || null
  447. })
  448. }
  449. },
  450. initList () {
  451. this.isChange = true
  452. this.page = 1
  453. this.reloadList()
  454. },
  455. onPullUpAction () {
  456. this.page++
  457. this.reloadList()
  458. },
  459. setSwitchType (type) {
  460. this.switchType = type
  461. if (type === 'record') {
  462. this.initFilterParams()
  463. }
  464. this.initList()
  465. },
  466. initFilterParams () {
  467. this.filterParams = {
  468. keyword: '',
  469. fromDate: '',
  470. toDate: '',
  471. currencyName: '',
  472. method: ''
  473. }
  474. },
  475. filterRecord () {
  476. this.isChange = true
  477. this.page = 1
  478. this.reloadList()
  479. },
  480. onSelectAction (selectObj) {
  481. this.setSelect(selectObj.key, selectObj.value)
  482. },
  483. setSelect (type, val) {
  484. if (type === 'date') {
  485. if (val) {
  486. this.filterParams.fromDate = val.fromDate
  487. this.filterParams.toDate = val.toDate
  488. } else {
  489. this.filterParams.fromDate = null
  490. this.filterParams.toDate = null
  491. }
  492. } else {
  493. this.filterParams[type] = val
  494. }
  495. this.filterRecord()
  496. },
  497. setDate (type) {
  498. if (this.dateObj[type]) {
  499. this.filterParams[type] = new Date(this.dateObj[type]).getTime() - 8 * 60 * 60 * 1000
  500. if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate > this.filterParams.toDate) {
  501. if (type === 'fromDate') {
  502. this.setRemindText('起始时间不能大于结束时间')
  503. } else {
  504. this.setRemindText('结束时间不能小于起始时间')
  505. }
  506. this.filterParams[type] = null
  507. this.dateObj[type] = null
  508. } else {
  509. if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate === this.filterParams.toDate) {
  510. // 23:59:59
  511. this.filterParams.toDate += 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
  512. }
  513. this.filterRecord()
  514. }
  515. } else {
  516. this.filterParams[type] = null
  517. this.filterRecord()
  518. }
  519. },
  520. reuseAccount (account) {
  521. if (account.status !== 105) {
  522. this.setRemindText(`该账户${this.$options.filters.bankStatusFilter(account.status)}`)
  523. } else {
  524. this.currentId = account.id
  525. this.showReuseModal = true
  526. }
  527. },
  528. setDefaultAccount () {
  529. this.$http.get(`/trade/bankInfo/setDefaultAccount/${this.currentId}`).then(() => {
  530. this.setRemindText('重新使用完成')
  531. this.initList()
  532. this.showReuseModal = false
  533. })
  534. },
  535. deleteAccount (account) {
  536. this.$http.delete(`/trade/bankInfo/delete/${account.id}`).then(res => {
  537. if (res.data === 'success') {
  538. this.setRemindText('删除成功')
  539. this.initList()
  540. }
  541. })
  542. },
  543. initAccount () {
  544. this.bankAccountObj = {
  545. bankname: '',
  546. branchname: '',
  547. number: '',
  548. accountname: ''
  549. }
  550. this.validBankAccountObj = {
  551. bankname: false,
  552. branchname: false,
  553. number: false,
  554. accountname: false
  555. }
  556. this.file = ''
  557. },
  558. openAddAccount () {
  559. if (!this.bankList || !this.bankList.length) {
  560. this.$http.get('/data/bank.json').then(res => {
  561. this.bankList = res.data.list
  562. this.initAccount()
  563. this.showModal = true
  564. })
  565. } else {
  566. this.initAccount()
  567. this.showModal = true
  568. }
  569. },
  570. setBankName (name) {
  571. this.bankAccountObj.bankname = name
  572. this.showSimilar = false
  573. this.showNewSimilar = false
  574. this.validBankAccountObj.bankname = true
  575. },
  576. checkBranchname () {
  577. this.validBankAccountObj.branchname = true
  578. if (!(this.bankAccountObj.branchname && this.bankAccountObj.branchname.length)) {
  579. this.setRemindText('开户支行不能为空')
  580. this.validBankAccountObj.branchname = false
  581. } else if (this.baseUtils.getRealLen(this.bankAccountObj.branchname) > 40) {
  582. this.setRemindText('开户支行不能大于40字符')
  583. this.validBankAccountObj.branchname = false
  584. } else if (!/^[\u2E80-\u9FFF]+$/.test(this.bankAccountObj.branchname)) {
  585. this.setRemindText('请输入正确的开户支行')
  586. this.validBankAccountObj.branchname = false
  587. }
  588. },
  589. checkNumber () {
  590. this.validBankAccountObj.number = true
  591. if (!(this.bankAccountObj.number && this.bankAccountObj.number.length)) {
  592. this.validBankAccountObj.number = false
  593. this.setRemindText('银行账号不能为空')
  594. } else if (this.baseUtils.getRealLen(this.bankAccountObj.number) > 30) {
  595. this.setRemindText('银行账号不能大于30字符')
  596. this.validBankAccountObj.number = false
  597. } else if (!/^[0-9]+$/.test(this.bankAccountObj.number)) {
  598. this.setRemindText('请输入正确的银行账号')
  599. this.validBankAccountObj.number = false
  600. }
  601. if (this.validBankAccountObj.number) {
  602. this.$http.get('/trade/bankInfo/number/count', {params: {type: 1061, number: this.bankAccountObj.number}}).then(res => {
  603. if (res.data.success) {
  604. if (res.data.data === 0) {
  605. this.validBankAccountObj.number = true
  606. } else {
  607. this.validBankAccountObj.number = false
  608. this.setRemindText('银行账号校验失败')
  609. }
  610. } else {
  611. this.validBankAccountObj.number = false
  612. this.setRemindText(res.data.message || '银行账号校验失败')
  613. }
  614. }, err => {
  615. this.validBankAccountObj.number = false
  616. this.setRemindText(err.response.data || '银行账号校验失败')
  617. console.log(err)
  618. })
  619. }
  620. },
  621. checkAccountname () {
  622. this.validBankAccountObj.accountname = true
  623. if (!(this.bankAccountObj.accountname && this.bankAccountObj.accountname.length)) {
  624. this.validBankAccountObj.accountname = false
  625. this.setRemindText('账户名称不能为空')
  626. } else if (this.baseUtils.getRealLen(this.bankAccountObj.accountname) > 100) {
  627. this.setRemindText('账户名称不能大于100个字符')
  628. this.validBankAccountObj.accountname = false
  629. }
  630. },
  631. addAccount () {
  632. if (!this.validBankAccountObj.bankname) {
  633. this.setRemindText('请选择开户银行')
  634. } else if (!this.validBankAccountObj.branchname) {
  635. this.setRemindText('请填写正确的开户支行')
  636. } else if (!this.validBankAccountObj.number) {
  637. this.setRemindText('请填写正确的银行账号')
  638. } else if (!this.validBankAccountObj.accountname) {
  639. this.setRemindText('请填写正确的开户名称')
  640. } else {
  641. let param = new FormData()
  642. // param.append('file', this.file, this.file.name)
  643. param.append('bankInfo', JSON.stringify(this.bankAccountObj))
  644. let config = {
  645. headers: {'Content-Type': 'multipart/form-data'}
  646. }
  647. this.$http.post('/trade/bankInfo/save/enterprise?type=sup', param, config).then(res => {
  648. if (res.data.id) {
  649. this.setRemindText('新增账户成功')
  650. this.initList()
  651. this.initAccount()
  652. this.showModal = false
  653. } else {
  654. this.setRemindText('新增账户失败')
  655. }
  656. }, err => {
  657. this.setRemindText(err.response.data || '新增账户失败')
  658. console.log(err)
  659. })
  660. }
  661. },
  662. onUpload (e) {
  663. let file = e.target.files[0]
  664. let arr = file.name.split('.')
  665. let type = arr[arr.length - 1]
  666. if ('pdf/png/jpg/jpeg'.indexOf(type.toLowerCase()) === -1) {
  667. this.setRemindText('仅支持jpg/jpeg/png/pdf格式的文件')
  668. } else if (file.size > 1024 * 1024 * 3) {
  669. this.setRemindText('请勿大于3M')
  670. } else {
  671. this.file = file
  672. }
  673. }
  674. }
  675. }
  676. </script>
  677. <style lang="scss">
  678. @import '~assets/scss/mobilePayCenter';
  679. .new-account {
  680. padding: .24rem;
  681. background: #fff;
  682. i {
  683. font-style: normal;
  684. color: #ff0000;
  685. }
  686. .new-content-line {
  687. margin-bottom: .3rem;
  688. position: relative;
  689. span {
  690. width: 2.5rem;
  691. color: #226ce7;
  692. font-size: .28rem;
  693. text-align: right;
  694. }
  695. input[type='text'] {
  696. width: 3.59rem;
  697. height: .56rem;
  698. font-size: .24rem;
  699. border-radius: .04rem;
  700. border: 1px solid #d2d2d2;
  701. padding: 0 .2rem;
  702. }
  703. input[readonly] {
  704. background: url('/images/mobile/select-arrow.png') no-repeat;
  705. background-size: .24rem .15rem;
  706. background-position: 3.1rem .2rem;
  707. }
  708. .similar {
  709. position: absolute;
  710. left: 2.5rem;
  711. border: 1px solid $base-color;
  712. border-radius: .04rem;
  713. top: .56rem;
  714. width: 3.59rem;
  715. background: #fff;
  716. z-index: 1;
  717. max-height: 3.96rem;
  718. overflow-y: auto;
  719. li {
  720. height: .66rem;
  721. line-height: .66rem;
  722. padding: 0 .19rem;
  723. font-size: .24rem;
  724. &:active, &:focus {
  725. background: #f7f7f7;
  726. }
  727. }
  728. }
  729. }
  730. .remind {
  731. color: #666;
  732. font-size: .24rem;
  733. width: 3.59rem;
  734. float: right;
  735. margin-right: .44rem;
  736. line-height: .37rem;
  737. i {
  738. margin-right: .05rem;
  739. }
  740. }
  741. .am-btn-wrap {
  742. margin-top: .74rem;
  743. button {
  744. width: 92%;
  745. height: .77rem;
  746. line-height: .77rem;
  747. color: #fff;
  748. font-size: .32rem;
  749. border-radius: .08rem;
  750. background: #bfbfbf;
  751. &:last-child {
  752. background: $base-color;
  753. margin-left: .3rem;
  754. }
  755. }
  756. }
  757. }
  758. .ra-remind {
  759. width: 6.3rem;
  760. height: 3.5rem;
  761. position: absolute;
  762. top: 50%;
  763. left: 50%;
  764. margin-top: -1.75rem;
  765. margin-left: -3.15rem;
  766. border-radius: .15rem;
  767. .header {
  768. height: .6rem;
  769. line-height: .6rem;
  770. background: #3976f4;
  771. border-top-left-radius: .15rem;
  772. border-top-right-radius: .15rem;
  773. i {
  774. font-size: .32rem;
  775. color: #fff;
  776. float: right;
  777. margin-right: .28rem;
  778. }
  779. }
  780. .content {
  781. background: #fff;
  782. padding: .53rem .77rem;
  783. span {
  784. font-size: .32rem;
  785. }
  786. i {
  787. font-size: .44rem;
  788. color: #3976f4;
  789. float: left;
  790. margin-right: .2rem;
  791. }
  792. }
  793. .footer {
  794. background: #fff;
  795. padding-bottom: .37rem;
  796. text-align: center;
  797. border-bottom-left-radius: .15rem;
  798. border-bottom-right-radius: .15rem;
  799. margin-top: -0.05rem;
  800. button {
  801. width: 2.22rem;
  802. height: .77rem;
  803. line-height: .77rem;
  804. color: #fff;
  805. font-size: .32rem;
  806. border-radius: .08rem;
  807. background: #bfbfbf;
  808. &:last-child {
  809. background: $base-color;
  810. margin-left: .3rem;
  811. }
  812. }
  813. }
  814. }
  815. .record-list {
  816. margin-bottom: 1.26rem
  817. }
  818. .upload {
  819. input[disabled] {
  820. background: #eee;
  821. width: 2.18rem !important;
  822. }
  823. .upload-btn {
  824. display: inline-block;
  825. vertical-align: middle;
  826. width: 1.2rem;
  827. height: .56rem;
  828. line-height: .56rem;
  829. text-align: center;
  830. color: #fff;
  831. background: #fe9d03;
  832. position: relative;
  833. left: .2rem;
  834. border-radius: .04rem;
  835. font-size: .24rem;
  836. font-weight: normal;
  837. margin: 0;
  838. input {
  839. opacity: 0;
  840. width: 1.2rem;
  841. height: .56rem;
  842. position: absolute;
  843. top: 0;
  844. }
  845. }
  846. }
  847. .fix-count-wrap {
  848. position: fixed;
  849. bottom: .98rem;
  850. height: 1.25rem;
  851. text-align: right;
  852. background: #fff;
  853. border-radius: .02rem;
  854. border-top: 1px solid #bfbfbf;
  855. line-height: .62rem;
  856. font-size: .28rem;
  857. width: 100%;
  858. padding-right: .3rem;
  859. .content {
  860. margin-left: .39rem;
  861. &:first-child {
  862. span {
  863. color: #fd0303;
  864. }
  865. }
  866. &:nth-of-type(2) {
  867. span {
  868. color: #15b262;
  869. }
  870. }
  871. }
  872. }
  873. .mp-list .content-line .icon-tixing {
  874. font-size: .32rem;
  875. color: $base-color;
  876. margin-left: .05rem;
  877. }
  878. .am-remind-text {
  879. font-size: .26rem;
  880. color: #999;
  881. margin-top: .29rem;
  882. padding: .45rem 0;
  883. border-top: 1px solid #d2d2d2;
  884. i {
  885. color: #fd0303;
  886. width: 12%;
  887. }
  888. .fr {
  889. width: 88%;
  890. }
  891. }
  892. .vendor-pay {
  893. padding-bottom: 1rem;
  894. .mobile-modal .mobile-modal-wrapper {
  895. left: .2rem !important;
  896. right: .2rem !important;
  897. }
  898. }
  899. .vendor-pay-record {
  900. /*bottom: 2.23rem !important;*/
  901. padding-bottom: 1.25rem !important;
  902. }
  903. </style>