payCenter.vue 29 KB

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