payCenter.vue 31 KB

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