payCenter.vue 29 KB

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