payCenter.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. <template>
  2. <div class="vendor-payCnter">
  3. <div class="order-tab">
  4. <div class="order-tab-wrapper clearfix">
  5. <nuxt-link class="fl tab" to="/mobile/center/user/btobarCheck" tag="div" >
  6. B2B
  7. </nuxt-link>
  8. <div class="fl active tab">商城</div>
  9. </div>
  10. </div>
  11. <div class="mobile-pay-center mobile-fix-content mobile-centerfix-content" :style="switchType === 'account' ? 'padding-bottom: 1rem;' : ''" id="mobileFixContent" @click="setShowSelect('all', false)">
  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. <div class="mp-content" v-if="switchType == 'account'">
  17. <!--<p class="mp-content-header">已设置的账户信息<span class="fr" @click="openAddAccount"><i class="iconfont icon-xinzeng"></i>新增账户</span></p>-->
  18. <template v-if="accountList && accountList.length === 0">
  19. <div class="new-account">
  20. <div class="new-content-line">
  21. <span class="inline-block"><i>*</i>开户名称:</span>
  22. <input type="text" placeholder="请填写开户人姓名或企业名称" v-model="bankAccountObj.accountname" @blur="checkAccountname">
  23. </div>
  24. <div class="new-content-line">
  25. <span class="inline-block"><i>*</i>银行账号:</span>
  26. <input type="text" placeholder="请填写银行账号" v-model="bankAccountObj.number" @blur="checkNumber">
  27. </div>
  28. <div class="new-content-line">
  29. <span class="inline-block"><i>*</i>开户银行:</span>
  30. <input type="text" readonly placeholder="例如:中国银行" v-model="bankAccountObj.bankname" @click.stop="showSimilar = !showSimilar">
  31. <ul v-if="showSimilar" class="similar">
  32. <li class="text-ellipse" v-for="bank in bankList" @click.stop="setBankName(bank)">{{bank}}</li>
  33. </ul>
  34. </div>
  35. <div class="new-content-line">
  36. <span class="inline-block"><i>*</i>开户支行:</span>
  37. <input type="text" placeholder="例如:侨香支行" v-model="bankAccountObj.branchname" @blur="checkBranchname">
  38. </div>
  39. <div class="new-content-line clearfix">
  40. <p class="remind"><i>*</i>为保障您的资金安全,账户信息加密显示且不可修改,只能删除后重新提交。</p>
  41. </div>
  42. <div class="am-btn-wrap">
  43. <button @click="addAccount">确认</button>
  44. </div>
  45. </div>
  46. </template>
  47. <template v-else>
  48. <ul class="mp-list">
  49. <li v-for="account in accountList">
  50. <div class="content-line">
  51. <span class="inline-block title">开户名称:</span>
  52. <span class="inline-block content text-ellipse">{{account.accountname}}</span>
  53. </div>
  54. <div class="content-line">
  55. <span class="inline-block title">银行账户:</span>
  56. <span class="inline-block content text-ellipse">{{account.number}}</span>
  57. </div>
  58. <div class="content-line">
  59. <span class="inline-block title">开户银行:</span>
  60. <span class="inline-block content text-ellipse">{{account.bankname}}</span>
  61. </div>
  62. <div class="content-line">
  63. <span class="inline-block title">开户支行:</span>
  64. <span class="inline-block content text-ellipse">{{account.branchname}}</span>
  65. </div>
  66. <!-- <div class="content-line clearfix">
  67. <span class="inline-block title">操作:</span>
  68. <a class="fr inline-block default-icon" v-if="account.num == 1">默认账户</a>
  69. <a class="fr inline-block set-default-icon" v-if="account.num != 1" @click="setDefaultAccount(account)">设为默认</a>
  70. <a class="fr inline-block" @click="deleteAccount(account)">删除</a>
  71. </div>-->
  72. <div class="btn-wrap">
  73. <a class="inline-block default-icon" v-if="account.num == 1" @click="setRemindText('该账户是默认账户')"><i class="iconfont icon-gouxuan1"></i>默认账户</a>
  74. <a class="inline-block" v-if="account.num != 1" @click="setDefaultAccount(account)"><i class="iconfont icon-gouxuan1"></i>设为默认</a>
  75. <a class="inline-block" @click="deleteAccount(account)"><i class="iconfont icon-lajitong"></i>删除</a>
  76. </div>
  77. </li>
  78. </ul>
  79. <div class="com-btn-wrap mp-btn-wrap">
  80. <button @click.stop="openAddAccount"><i class="iconfont icon-add"></i>新增账户</button>
  81. </div>
  82. </template>
  83. </div>
  84. <div class="mp-record" v-if="switchType == 'record'">
  85. <div class="search-content">
  86. <input type="text" placeholder="卖家名称/订单号" v-model="filterParams.keyword" @keyup.13="filterRecord">
  87. <span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>
  88. </div>
  89. <!--<div class="filters-wrap">
  90. <div class="date-wrap">
  91. <label>
  92. <i class="iconfont icon-ico-date"></i>
  93. <input type="date" v-model="dateObj.fromDate" @change="setDate('fromDate')">
  94. <p v-if="filterParams.fromDate">{{filterParams.fromDate | date}}</p>
  95. </label>
  96. <span>—</span>
  97. <label>
  98. <i class="iconfont icon-ico-date"></i>
  99. <input type="date" v-model="dateObj.toDate" @change="setDate('toDate')">
  100. <p v-if="filterParams.toDate">{{filterParams.toDate | date}}</p>
  101. </label>
  102. </div>
  103. <ul class="select-wrap">
  104. <li class="inline-block">
  105. <div @click.stop="setShowSelect('method', !showSelectMethod)">{{filterParams.method ? filterParams.method == 1103 ? '线下支付' : '线上支付' : '交易方式'}}</div>
  106. <ul class="select-list" v-show="showSelectMethod">
  107. <li @click.stop="setSelect('method', null)">交易方式</li>
  108. <li @click.stop="setSelect('method', 1103)">线下支付</li>
  109. <li @click.stop="setSelect('method', 1102)">线上支付</li>
  110. </ul>
  111. </li>
  112. <li class="inline-block">
  113. <div @click.stop="setShowSelect('currencyName', !showSelectCurrency)">{{filterParams.currencyName || '币种'}}</div>
  114. <ul class="select-list" v-show="showSelectCurrency">
  115. <li @click.stop="setSelect('currencyName', null)">币种</li>
  116. <li @click.stop="setSelect('currencyName', 'RMB')">RMB</li>
  117. <li @click.stop="setSelect('currencyName', 'USD')">USD</li>
  118. </ul>
  119. </li>
  120. <li class="inline-block">
  121. <div @click.stop="setShowSelect('status', !showSelectStatus)">{{filterParams.status || '状态'}}</div>
  122. <ul class="select-list" v-show="showSelectStatus">
  123. <li @click.stop="setSelect('status', null)">状态</li>
  124. <li @click.stop="setSelect('status', '支付成功')">支付成功</li>
  125. </ul>
  126. </li>
  127. </ul>
  128. </div>-->
  129. <div class="filters-wrap">
  130. <base-filter
  131. v-for="filterOption in filterOptions"
  132. :key="filterOption.selectOption"
  133. :selectItems="filterOption.selectItems"
  134. :defaultVal="filterOption.defaultVal"
  135. :selectOption="filterOption.selectOption"
  136. @selectAction="onSelectAction"
  137. @valueAction="onValueAction"
  138. :title="filterOption.title"></base-filter>
  139. </div>
  140. <ul class="mp-list record-list mp-list-record">
  141. <li v-for="record in recordList">
  142. <div class="content-line">
  143. <span class="inline-block title">订单号:</span>
  144. <nuxt-link :to="`/mobile/order/details?uuid=${baseUtils.enidfilter(record.orderid)}&type=buyer`" class="inline-block content link">{{record.orderid}}</nuxt-link>
  145. </div>
  146. <div class="content-line">
  147. <span class="inline-block title">金额:</span>
  148. <span class="inline-block content">{{record.currencyName | currencyFilter}}{{record.ensurePrice}}</span>
  149. </div>
  150. <div class="content-line">
  151. <span class="inline-block title">卖家:</span>
  152. <span class="inline-block content">{{record.sellername}}</span>
  153. </div>
  154. <!--<div class="content-line">
  155. <span class="inline-block title">交易方式:</span>
  156. <span class="inline-block content text-ellipse">{{record.paytype == 1103 ? '线下支付' : '线上支付'}}</span>
  157. </div>-->
  158. <div class="content-line">
  159. <span class="inline-block title">交易方式:</span>
  160. <span class="inline-block content">{{record.remitteeType | payTypeFilter}}</span>
  161. </div>
  162. <div class="content-line">
  163. <span class="inline-block title">时间:</span>
  164. <span class="inline-block content">{{record.paytime | time}}</span>
  165. </div>
  166. <div class="content-line">
  167. <span class="inline-block title">状态:</span>
  168. <span class="inline-block content">支付成功</span>
  169. </div>
  170. </li>
  171. </ul>
  172. </div>
  173. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  174. <pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  175. <!-- 新增账户弹框start -->
  176. <div class="mobile-modal account-modal" @click="showSimilar = false" v-if="showModal">
  177. <div class="account-modal-wrap add-account-modal">
  178. <div class="account-modal">
  179. <p class="title">新增账户</p>
  180. <div class="modal-content-line">
  181. <span class="inline-block"><i>*</i>开户名称:</span>
  182. <input type="text" placeholder="请填写开户人姓名或企业名称" v-model="bankAccountObj.accountname" @blur="checkAccountname">
  183. </div>
  184. <div class="modal-content-line">
  185. <span class="inline-block"><i>*</i>银行账号:</span>
  186. <input type="text" placeholder="请填写银行账号" v-model="bankAccountObj.number" @blur="checkNumber">
  187. </div>
  188. <div class="modal-content-line">
  189. <span class="inline-block"><i>*</i>开户银行:</span>
  190. <input type="text" readonly placeholder="例如:中国银行" v-model="bankAccountObj.bankname" @click.stop="showSimilar = !showSimilar">
  191. <ul v-if="showSimilar" class="similar">
  192. <li class="text-ellipse" v-for="bank in bankList" @click.stop="setBankName(bank)">{{bank}}</li>
  193. </ul>
  194. </div>
  195. <div class="modal-content-line">
  196. <span class="inline-block"><i>*</i>开户支行:</span>
  197. <input type="text" placeholder="例如:侨香支行" v-model="bankAccountObj.branchname" @blur="checkBranchname">
  198. </div>
  199. <div class="modal-content-line clearfix">
  200. <p class="remind"><i>*</i>为保障您的资金安全,账户信息加密显示且不可修改,只能删除后重新提交。</p>
  201. </div>
  202. <div class="am-btn-wrap">
  203. <button @click="showModal = false">取消</button>
  204. <button @click="addAccount">确认</button>
  205. </div>
  206. </div>
  207. </div>
  208. </div>
  209. <empty-status v-if="isEmpty" :text="'暂无支付记录,请下单购买商品吧!'" :showLink="true"></empty-status>
  210. <!-- 新增账户弹框end -->
  211. </div>
  212. </div>
  213. </template>
  214. <script>
  215. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  216. import { ModalWrapper, BaseFilter } from '~components/mobile/base'
  217. export default {
  218. layout: 'mobile',
  219. middleware: 'authenticated',
  220. data () {
  221. return {
  222. fromUserPage: false,
  223. remindText: '',
  224. timeoutCount: '',
  225. page: 1,
  226. count: 10,
  227. accountList: [],
  228. recordList: [],
  229. switchType: 'record',
  230. // 分页重置标志
  231. isChange: false,
  232. showModal: false,
  233. bankList: [],
  234. showSimilar: false,
  235. bankAccountObj: {
  236. bankname: '',
  237. branchname: '',
  238. number: '',
  239. accountname: '',
  240. accountType: 'PAY_TYPE'
  241. },
  242. validBankAccountObj: {
  243. bankname: false,
  244. branchname: false,
  245. number: false,
  246. accountname: false
  247. },
  248. filterParams: {
  249. keyword: '',
  250. fromDate: '',
  251. toDate: '',
  252. currencyName: '',
  253. // 交易方式
  254. remitteeType: ''
  255. },
  256. showSelectMethod: false,
  257. showSelectCurrency: false,
  258. showSelectStatus: false,
  259. dateObj: {
  260. fromDate: '',
  261. toDate: ''
  262. },
  263. filterOptions: [
  264. {
  265. title: '交易方式',
  266. selectOption: 'remitteeType',
  267. selectItems: [{
  268. key: '平台代收',
  269. val: 'PAIDTOPLATFORM'
  270. }, {
  271. key: '卖家收款',
  272. val: 'PAIDTOVENDOR'
  273. }],
  274. defaultVal: 'PAIDTOPLATFORM'
  275. },
  276. {
  277. title: '交易币种',
  278. selectOption: 'currencyName',
  279. selectItems: [{
  280. key: 'RMB',
  281. val: 'RMB'
  282. }, {
  283. key: 'USD',
  284. val: 'USD'
  285. }],
  286. defaultVal: 'RMB'
  287. },
  288. // {
  289. // title: '交易状态',
  290. // selectOption: 'status',
  291. // selectItems: [{key: '全部',
  292. // val: null
  293. // }, {
  294. // key: '已付款',
  295. // val: 1
  296. // }, {
  297. // key: '待付款',
  298. // val: 2
  299. // }],
  300. // defaultVal: null
  301. // },
  302. {
  303. title: '交易时间',
  304. selectOption: 'date',
  305. selectItems: [{
  306. key: '30天',
  307. val: 1
  308. }, {
  309. key: '90天',
  310. val: 2
  311. }, {
  312. key: '180天',
  313. val: 3
  314. }, {
  315. key: '自定义',
  316. val: 4
  317. }],
  318. defaultVal: 1
  319. }
  320. ]
  321. }
  322. },
  323. components: {
  324. RemindBox,
  325. PullUp,
  326. ModalWrapper,
  327. EmptyStatus,
  328. BaseFilter
  329. },
  330. filters: {
  331. payTypeFilter: function (type) {
  332. if (type === 'PAIDTOVENDOR') {
  333. return '卖家收款'
  334. } else if (type === 'PAIDTOPLATFORM') {
  335. return '平台代收'
  336. } else {
  337. return '其他'
  338. }
  339. }
  340. },
  341. asyncData({route}) {
  342. return {
  343. fromUserPage: route.query.type ? true : false,
  344. switchType: route.query.switchType || 'record'
  345. }
  346. },
  347. watch: {
  348. 'buyerAccount': {
  349. handler: function (val) {
  350. if (val && val.content) {
  351. if (this.isChange) {
  352. this.accountList = []
  353. this.isChange = false
  354. }
  355. this.accountList = [...this.accountList, ...val.content]
  356. }
  357. }
  358. },
  359. 'buyerRecord': {
  360. handler: function (val) {
  361. if (val && val.content) {
  362. if (this.isChange) {
  363. this.recordList = []
  364. this.isChange = false
  365. }
  366. this.recordList = [...this.recordList, ...val.content]
  367. }
  368. }
  369. }
  370. },
  371. created () {
  372. let currentTime = this.baseUtils.getClearDay(new Date())
  373. let fromDate = currentTime - 29 * 24 * 60 * 60 * 1000
  374. let toDate = currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
  375. if (this.$route.query.type) {
  376. this.$store.dispatch('payCenter/loadBuyerAccount', {count: 10, page: 1, sorting: {num: 'ASC'}, type: 'buyer'})
  377. } else {
  378. this.$store.dispatch('payCenter/loadBuyerRecord', {count: 10, page: 1, sorting: {'paytime': 'DESC'}, fromDate: fromDate, toDate: toDate, remitteeType: 'PAIDTOPLATFORM'})
  379. }
  380. },
  381. mounted () {
  382. this.$http.get('/data/bank.json').then(res => {
  383. this.bankList = res.data.list
  384. })
  385. },
  386. computed: {
  387. accountData () {
  388. return this.$store.state.payCenter.data.buyerAccount
  389. },
  390. recordData () {
  391. return this.$store.state.payCenter.data.buyerRecord
  392. },
  393. buyerAccount () {
  394. return this.accountData.data
  395. },
  396. buyerRecord () {
  397. return this.recordData.data
  398. },
  399. fetching () {
  400. return this.switchType === 'account' ? this.accountData.fetching : this.recordData.fetching
  401. },
  402. allPage () {
  403. return this.switchType === 'account' ? this.buyerAccount.totalPages : this.buyerRecord.totalPages
  404. },
  405. isEmpty () {
  406. return (this.switchType === 'record' && this.recordList.length === 0)
  407. }
  408. },
  409. methods: {
  410. setRemindText: function (str) {
  411. this.remindText = str
  412. this.timeoutCount++
  413. },
  414. reloadList () {
  415. if (this.switchType === 'account') {
  416. this.$store.dispatch('payCenter/loadBuyerAccount', {
  417. count: this.count,
  418. page: this.page,
  419. sorting: {num: 'ASC'},
  420. type: 'buyer'
  421. })
  422. } else {
  423. this.$store.dispatch('payCenter/loadBuyerRecord', {
  424. count: this.count,
  425. page: this.page,
  426. sorting: {'paytime': 'DESC'},
  427. currencyName: this.filterParams.currencyName || null,
  428. fromDate: this.filterParams.fromDate || null,
  429. toDate: this.filterParams.toDate || null,
  430. remitteeType: this.filterParams.remitteeType || null,
  431. keyword: this.filterParams.keyword || null
  432. })
  433. }
  434. },
  435. initList () {
  436. this.isChange = true
  437. this.page = 1
  438. this.reloadList()
  439. },
  440. onPullUpAction () {
  441. this.page++
  442. this.reloadList()
  443. },
  444. setSwitchType (type) {
  445. this.switchType = type
  446. if (type === 'record') {
  447. this.initFilterParams()
  448. }
  449. this.initList()
  450. },
  451. initFilterParams () {
  452. this.filterParams = {
  453. keyword: '',
  454. fromDate: '',
  455. toDate: '',
  456. currencyName: '',
  457. method: ''
  458. }
  459. },
  460. filterRecord () {
  461. this.page = 1
  462. this.isChange = true
  463. this.reloadList()
  464. },
  465. setShowSelect (type, flag) {
  466. if (type === 'all') {
  467. this.showSelectMethod = flag
  468. this.showSelectCurrency = flag
  469. this.showSelectStatus = flag
  470. } else if (type === 'method') {
  471. this.showSelectMethod = flag
  472. this.showSelectCurrency = false
  473. this.showSelectStatus = false
  474. } else if (type === 'currencyName') {
  475. this.showSelectCurrency = flag
  476. this.showSelectStatus = false
  477. this.showSelectMethod = false
  478. } else if (type === 'status') {
  479. this.showSelectStatus = flag
  480. this.showSelectMethod = false
  481. this.showSelectCurrency = false
  482. }
  483. },
  484. setSelect (type, val, isReload) {
  485. // if (type === 'method') {
  486. // this.filterParams.method = val
  487. // this.setShowSelect('method', false)
  488. // } else if (type === 'currencyName') {
  489. // this.filterParams.currencyName = val
  490. // this.setShowSelect('currencyName', false)
  491. // } else if (type === 'status') {
  492. // this.filterParams.status = val
  493. // this.setShowSelect('status', false)
  494. // }
  495. if (type === 'date') {
  496. if (val) {
  497. this.filterParams.fromDate = val.fromDate
  498. this.filterParams.toDate = val.toDate
  499. } else {
  500. this.filterParams.fromDate = null
  501. this.filterParams.toDate = null
  502. }
  503. } else {
  504. this.filterParams[type] = val
  505. }
  506. isReload && this.filterRecord()
  507. },
  508. onSelectAction (selectObj) {
  509. this.setSelect(selectObj.key, selectObj.value, true)
  510. },
  511. onValueAction (selectObj) {
  512. this.setSelect(selectObj.key, selectObj.value, false)
  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. setDefaultAccount (account) {
  538. this.$http.get(`/trade/bankInfo/setDefaultAccount/${account.id}`).then(() => {
  539. this.setRemindText('设置完成')
  540. this.initList()
  541. })
  542. },
  543. deleteAccount (account) {
  544. this.$http.delete(`/trade/bankInfo/delete/${account.id}`).then(res => {
  545. if (res.data === 'success') {
  546. this.setRemindText('删除成功')
  547. this.initList()
  548. }
  549. })
  550. },
  551. initAccount () {
  552. this.bankAccountObj = {
  553. bankname: '',
  554. branchname: '',
  555. number: '',
  556. accountname: '',
  557. accountType: 'PAY_TYPE'
  558. }
  559. this.validBankAccountObj = {
  560. bankname: false,
  561. branchname: false,
  562. number: false,
  563. accountname: false
  564. }
  565. },
  566. openAddAccount () {
  567. if (!this.bankList || !this.bankList.length) {
  568. this.$http.get('/data/bank.json').then(res => {
  569. this.bankList = res.data.list
  570. this.initAccount()
  571. this.showModal = true
  572. })
  573. } else {
  574. this.initAccount()
  575. this.showModal = true
  576. }
  577. },
  578. setBankName (name) {
  579. this.bankAccountObj.bankname = name
  580. this.showSimilar = false
  581. this.validBankAccountObj.bankname = true
  582. },
  583. checkBranchname () {
  584. this.validBankAccountObj.branchname = true
  585. if (!(this.bankAccountObj.branchname && this.bankAccountObj.branchname.length)) {
  586. this.setRemindText('开户支行不能为空')
  587. this.validBankAccountObj.branchname = false
  588. } else if (this.baseUtils.getRealLen(this.bankAccountObj.branchname) > 40) {
  589. this.setRemindText('开户支行不能大于40字符')
  590. this.validBankAccountObj.branchname = false
  591. } else if (!/^[\u2E80-\u9FFF]+$/.test(this.bankAccountObj.branchname)) {
  592. this.setRemindText('请输入正确的开户支行')
  593. this.validBankAccountObj.branchname = false
  594. }
  595. },
  596. checkNumber () {
  597. this.validBankAccountObj.number = true
  598. if (!(this.bankAccountObj.number && this.bankAccountObj.number.length)) {
  599. this.validBankAccountObj.number = false
  600. this.setRemindText('银行账号不能为空')
  601. } else if (this.baseUtils.getRealLen(this.bankAccountObj.number) > 30) {
  602. this.setRemindText('银行账号不能大于30字符')
  603. this.validBankAccountObj.number = false
  604. } else if (!/^[0-9]+$/.test(this.bankAccountObj.number)) {
  605. this.setRemindText('请输入正确的银行账号')
  606. this.validBankAccountObj.number = false
  607. }
  608. if (this.validBankAccountObj.number) {
  609. this.$http.get('/trade/bankInfo/number/count', {params: {accountType: 'PAY_TYPE', number: this.bankAccountObj.number,type:1061}}).then(res => {
  610. if (res.data.success) {
  611. this.validBankAccountObj.number = res.data.data === 0
  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. this.$http.post('/trade/bankInfo/save/personal?type=buyer', this.bankAccountObj).then(res => {
  644. if (res.data.id) {
  645. this.setRemindText('新增账户成功')
  646. this.initList()
  647. this.initAccount()
  648. this.showModal = false
  649. } else {
  650. this.setRemindText('新增账户失败')
  651. }
  652. }, err => {
  653. this.setRemindText(err.response.data || '新增账户失败')
  654. console.log(err)
  655. })
  656. }
  657. }
  658. }
  659. }
  660. </script>
  661. <style lang="scss" scoped>
  662. @import '~assets/scss/mobilePayCenter';
  663. .vendor-payCnter {
  664. .order-tab {
  665. background: #3f84f6;
  666. padding-bottom: 0.2rem;
  667. margin-top: 1.26rem;
  668. .order-tab-wrapper {
  669. border: solid 1px #ffffff;
  670. width: 7.06rem;
  671. margin: 0 auto;
  672. border-radius: 0.04rem;
  673. line-height: 0.72rem;
  674. height: 0.72rem;
  675. overflow: hidden;
  676. div {
  677. color: #ffffff;
  678. font-size: 0.28rem;
  679. text-align: center;
  680. width: 50%;
  681. &.active {
  682. background-color: #ffffff;
  683. color: #3f84f6;
  684. }
  685. }
  686. }
  687. }
  688. }
  689. .mobile-centerfix-content {
  690. top: 2.185rem;
  691. }
  692. .new-account {
  693. padding: .24rem;
  694. background: #fff;
  695. i {
  696. font-style: normal;
  697. color: #ff0000;
  698. }
  699. .new-content-line {
  700. margin-bottom: .3rem;
  701. position: relative;
  702. span {
  703. width: 2.5rem;
  704. color: #226ce7;
  705. font-size: .28rem;
  706. text-align: right;
  707. }
  708. input[type='text'] {
  709. width: 3.59rem;
  710. height: .56rem;
  711. font-size: .24rem;
  712. border-radius: .04rem;
  713. border: 1px solid #d2d2d2;
  714. padding: 0 .2rem;
  715. }
  716. input[readonly] {
  717. background: url('/images/mobile/select-arrow.png') no-repeat;
  718. background-size: .24rem .15rem;
  719. background-position: 3.1rem .2rem;
  720. }
  721. .similar {
  722. position: absolute;
  723. left: 2.5rem;
  724. border: 1px solid $base-color;
  725. border-radius: .04rem;
  726. top: .56rem;
  727. width: 3.59rem;
  728. background: #fff;
  729. z-index: 1;
  730. max-height: 3.96rem;
  731. overflow-y: auto;
  732. li {
  733. height: .66rem;
  734. line-height: .66rem;
  735. padding: 0 .19rem;
  736. font-size: .24rem;
  737. &:active, &:focus {
  738. background: #f7f7f7;
  739. }
  740. }
  741. }
  742. }
  743. .remind {
  744. color: #666;
  745. font-size: .24rem;
  746. width: 3.59rem;
  747. float: right;
  748. margin-right: .44rem;
  749. line-height: .37rem;
  750. i {
  751. margin-right: .05rem;
  752. }
  753. }
  754. .am-btn-wrap {
  755. margin-top: .74rem;
  756. button {
  757. width: 92%;
  758. height: .77rem;
  759. line-height: .77rem;
  760. color: #fff;
  761. font-size: .32rem;
  762. border-radius: .08rem;
  763. background: #bfbfbf;
  764. &:last-child {
  765. background: $base-color;
  766. margin-left: .3rem;
  767. }
  768. }
  769. }
  770. }
  771. .ra-remind {
  772. width: 6.3rem;
  773. height: 3.5rem;
  774. position: absolute;
  775. top: 50%;
  776. left: 50%;
  777. margin-top: -1.75rem;
  778. margin-left: -3.15rem;
  779. border-radius: .15rem;
  780. .header {
  781. height: .6rem;
  782. line-height: .6rem;
  783. background: #3976f4;
  784. border-top-left-radius: .15rem;
  785. border-top-right-radius: .15rem;
  786. i {
  787. font-size: .32rem;
  788. color: #fff;
  789. float: right;
  790. margin-right: .28rem;
  791. }
  792. }
  793. .content {
  794. background: #fff;
  795. padding: .53rem .77rem;
  796. span {
  797. font-size: .32rem;
  798. }
  799. i {
  800. font-size: .44rem;
  801. color: #3976f4;
  802. float: left;
  803. margin-right: .2rem;
  804. }
  805. }
  806. .footer {
  807. background: #fff;
  808. padding-bottom: .37rem;
  809. text-align: center;
  810. border-bottom-left-radius: .15rem;
  811. border-bottom-right-radius: .15rem;
  812. margin-top: -0.05rem;
  813. button {
  814. width: 2.22rem;
  815. height: .77rem;
  816. line-height: .77rem;
  817. color: #fff;
  818. font-size: .32rem;
  819. border-radius: .08rem;
  820. background: #bfbfbf;
  821. &:last-child {
  822. background: $base-color;
  823. margin-left: .3rem;
  824. }
  825. }
  826. }
  827. }
  828. </style>