| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586 |
- <template>
- <div class="mobile-pay-center mobile-fix-content mobile-centerfix-content" id="mobileFixContent" @click="setShowSelect('all', false)">
- <div class="mp-head">
- <span class="inline-block" :class="{'active': switchType === 'record'}" @click="setSwitchType('record')">交易记录</span>
- <span class="inline-block" :class="{'active': switchType === 'account'}" @click="setSwitchType('account')">付款账户</span>
- </div>
- <div class="mp-content" v-if="switchType == 'account'">
- <p class="mp-content-header">已设置的账户信息<span class="fr" @click="openAddAccount"><i class="iconfont icon-xinzeng"></i>新增账户</span></p>
- <ul class="mp-list">
- <li v-for="account in accountList">
- <div class="content-line">
- <span class="inline-block title">开户银行:</span>
- <span class="inline-block content text-ellipse">{{account.bankname}}</span>
- </div>
- <div class="content-line">
- <span class="inline-block title">开户支行:</span>
- <span class="inline-block content text-ellipse">{{account.branchname}}</span>
- </div>
- <div class="content-line">
- <span class="inline-block title">银行账户:</span>
- <span class="inline-block content text-ellipse">{{account.number}}</span>
- </div>
- <div class="content-line">
- <span class="inline-block title">开户名称:</span>
- <span class="inline-block content text-ellipse">{{account.accountname}}</span>
- </div>
- <div class="content-line clearfix">
- <span class="inline-block title">操作:</span>
- <a class="fr inline-block default-icon" v-if="account.num == 1">默认账户</a>
- <a class="fr inline-block set-default-icon" v-if="account.num != 1" @click="setDefaultAccount(account)">设为默认</a>
- <a class="fr inline-block" @click="deleteAccount(account)">删除</a>
- </div>
- </li>
- </ul>
- </div>
- <div class="mp-record" v-if="switchType == 'record'">
- <div class="search-content">
- <input type="text" placeholder="卖家名称/订单号" v-model="filterParams.keyword" @keyup.13="filterRecord">
- <span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>
- </div>
- <!--<div class="filters-wrap">
- <div class="date-wrap">
- <label>
- <i class="iconfont icon-ico-date"></i>
- <input type="date" v-model="dateObj.fromDate" @change="setDate('fromDate')">
- <p v-if="filterParams.fromDate">{{filterParams.fromDate | date}}</p>
- </label>
- <span>—</span>
- <label>
- <i class="iconfont icon-ico-date"></i>
- <input type="date" v-model="dateObj.toDate" @change="setDate('toDate')">
- <p v-if="filterParams.toDate">{{filterParams.toDate | date}}</p>
- </label>
- </div>
- <ul class="select-wrap">
- <li class="inline-block">
- <div @click.stop="setShowSelect('method', !showSelectMethod)">{{filterParams.method ? filterParams.method == 1103 ? '线下支付' : '线上支付' : '交易方式'}}</div>
- <ul class="select-list" v-show="showSelectMethod">
- <li @click.stop="setSelect('method', null)">交易方式</li>
- <li @click.stop="setSelect('method', 1103)">线下支付</li>
- <li @click.stop="setSelect('method', 1102)">线上支付</li>
- </ul>
- </li>
- <li class="inline-block">
- <div @click.stop="setShowSelect('currencyName', !showSelectCurrency)">{{filterParams.currencyName || '币种'}}</div>
- <ul class="select-list" v-show="showSelectCurrency">
- <li @click.stop="setSelect('currencyName', null)">币种</li>
- <li @click.stop="setSelect('currencyName', 'RMB')">RMB</li>
- <li @click.stop="setSelect('currencyName', 'USD')">USD</li>
- </ul>
- </li>
- <li class="inline-block">
- <div @click.stop="setShowSelect('status', !showSelectStatus)">{{filterParams.status || '状态'}}</div>
- <ul class="select-list" v-show="showSelectStatus">
- <li @click.stop="setSelect('status', null)">状态</li>
- <li @click.stop="setSelect('status', '支付成功')">支付成功</li>
- </ul>
- </li>
- </ul>
- </div>-->
- <div class="filters-wrap">
- <base-filter
- v-for="filterOption in filterOptions"
- :key="filterOption.selectOption"
- :selectItems="filterOption.selectItems"
- :defaultVal="filterOption.defaultVal"
- :selectOption="filterOption.selectOption"
- @selectAction="onSelectAction"
- :title="filterOption.title"></base-filter>
- </div>
- <ul class="mp-list record-list">
- <li v-for="record in recordList">
- <div class="content-line">
- <span class="inline-block title">订单号:</span>
- <nuxt-link :to="`/mobile/order/details?uuid=${baseUtils.enidfilter(record.orderid)}&type=buyer`" class="inline-block content link">{{record.orderid}}</nuxt-link>
- </div>
- <div class="content-line">
- <span class="inline-block title">金额:</span>
- <span class="inline-block content">{{record.currencyName | currencyFilter}}{{record.ensurePrice}}</span>
- </div>
- <div class="content-line">
- <span class="inline-block title">卖家:</span>
- <span class="inline-block content">{{record.sellername}}</span>
- </div>
- <!--<div class="content-line">
- <span class="inline-block title">交易方式:</span>
- <span class="inline-block content text-ellipse">{{record.paytype == 1103 ? '线下支付' : '线上支付'}}</span>
- </div>-->
- <div class="content-line">
- <span class="inline-block title">收款方式:</span>
- <span class="inline-block content">卖家收款</span>
- </div>
- <div class="content-line">
- <span class="inline-block title">时间:</span>
- <span class="inline-block content">{{record.paytime | time}}</span>
- </div>
- <div class="content-line">
- <span class="inline-block title">状态:</span>
- <span class="inline-block content">支付成功</span>
- </div>
- </li>
- </ul>
- </div>
- <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
- <pull-up :fixId="'mobileFixContent'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
- <!-- 新增账户弹框start -->
- <div class="mobile-modal account-modal" @click="showSimilar = false" v-if="showModal">
- <div class="account-modal-wrap add-account-modal">
- <div class="account-modal">
- <p class="title">新增账户</p>
- <div class="modal-content-line">
- <span class="inline-block"><i>*</i>开户银行:</span>
- <input type="text" readonly placeholder="例如:中国银行" v-model="bankAccountObj.bankname" @click.stop="showSimilar = !showSimilar">
- <ul v-if="showSimilar" class="similar">
- <li class="text-ellipse" v-for="bank in bankList" @click.stop="setBankName(bank)">{{bank}}</li>
- </ul>
- </div>
- <div class="modal-content-line">
- <span class="inline-block"><i>*</i>开户支行:</span>
- <input type="text" placeholder="例如:乔香支行" v-model="bankAccountObj.branchname" @blur="checkBranchname">
- </div>
- <div class="modal-content-line">
- <span class="inline-block"><i>*</i>银行账号:</span>
- <input type="text" placeholder="请填写银行账号" v-model="bankAccountObj.number" @blur="checkNumber">
- </div>
- <div class="modal-content-line">
- <span class="inline-block"><i>*</i>开户名称:</span>
- <input type="text" placeholder="请填写开户人姓名或企业名称" v-model="bankAccountObj.accountname" @blur="checkAccountname">
- </div>
- <div class="modal-content-line clearfix">
- <p class="remind"><i>*</i>为保障您的资金安全,账户信息加密显示且不可修改,只能删除后重新提交。</p>
- </div>
- <div class="am-btn-wrap">
- <button @click="showModal = false">取消</button>
- <button @click="addAccount">确认</button>
- </div>
- </div>
- </div>
- </div>
- <empty-status v-if="isEmpty" :text="switchType == 'record' ? '暂无支付记录,请下单购买商品吧!' : '暂无账户信息'" :showLink="true"></empty-status>
- <!-- 新增账户弹框end -->
- </div>
- </template>
- <script>
- import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
- import { ModalWrapper, BaseFilter } from '~components/mobile/base'
- export default {
- layout: 'mobile',
- middleware: 'authenticated',
- data () {
- return {
- remindText: '',
- timeoutCount: '',
- page: 1,
- count: 10,
- accountList: [],
- recordList: [],
- switchType: 'record',
- // 分页重置标志
- isChange: false,
- showModal: false,
- bankList: [],
- showSimilar: false,
- bankAccountObj: {
- bankname: '',
- branchname: '',
- number: '',
- accountname: ''
- },
- validBankAccountObj: {
- bankname: false,
- branchname: false,
- number: false,
- accountname: false
- },
- filterParams: {
- keyword: '',
- fromDate: '',
- toDate: '',
- currencyName: '',
- // 交易方式
- method: ''
- },
- showSelectMethod: false,
- showSelectCurrency: false,
- showSelectStatus: false,
- dateObj: {
- fromDate: '',
- toDate: ''
- },
- filterOptions: [
- // {
- // title: '交易方式',
- // selectOption: 'method',
- // selectItems: [{key: '全部',
- // val: 0
- // }, {
- // key: '卖家收款',
- // val: 1
- // }, {
- // key: '平台代收',
- // val: 2
- // }],
- // defaultVal: 0
- // },
- {
- title: '交易币种',
- selectOption: 'currencyName',
- selectItems: [{key: '全部',
- val: 0
- }, {
- key: 'RMB',
- val: 'RMB'
- }, {
- key: 'USD',
- val: 'USD'
- }],
- defaultVal: 0
- },
- // {
- // title: '交易状态',
- // selectOption: 'status',
- // selectItems: [{key: '全部',
- // val: 0
- // }, {
- // key: '已付款',
- // val: 1
- // }, {
- // key: '待付款',
- // val: 2
- // }],
- // defaultVal: 0
- // },
- {
- title: '交易时间',
- selectOption: 'date',
- selectItems: [{key: '全部',
- val: 0
- }, {
- key: '一个月',
- val: 1
- }, {
- key: '三个月',
- val: 2
- }, {
- key: '六个月',
- val: 3
- }, {
- key: '自定义',
- val: 4
- }],
- defaultVal: 0
- }
- ]
- }
- },
- components: {
- RemindBox,
- PullUp,
- ModalWrapper,
- EmptyStatus,
- BaseFilter
- },
- fetch ({store}) {
- return Promise.all([
- // store.dispatch('payCenter/loadBuyerAccount', {count: 10, page: 1, sorting: {num: 'ASC'}, type: 'buyer'})
- store.dispatch('payCenter/loadBuyerRecord', {count: 10, page: 1, sorting: {'paytime': 'DESC'}})
- ])
- },
- watch: {
- 'buyerAccount': {
- handler: function (val) {
- if (val && val.content) {
- if (this.isChange) {
- this.accountList = []
- this.isChange = false
- }
- this.accountList = [...this.accountList, ...val.content]
- }
- }
- },
- 'buyerRecord': {
- handler: function (val) {
- if (val && val.content) {
- if (this.isChange) {
- this.recordList = []
- this.isChange = false
- }
- this.recordList = [...this.recordList, ...val.content]
- }
- },
- immediate: true
- }
- },
- computed: {
- accountData () {
- return this.$store.state.payCenter.data.buyerAccount
- },
- recordData () {
- return this.$store.state.payCenter.data.buyerRecord
- },
- buyerAccount () {
- return this.accountData.data
- },
- buyerRecord () {
- return this.recordData.data
- },
- fetching () {
- return this.switchType === 'account' ? this.accountData.fetching : this.recordData.fetching
- },
- allPage () {
- return this.switchType === 'account' ? this.buyerAccount.totalPages : this.buyerRecord.totalPages
- },
- isEmpty () {
- return (this.switchType === 'record' && this.recordList.length === 0) || (this.switchType === 'account' && this.accountList.length === 0)
- }
- },
- methods: {
- setRemindText: function (str) {
- this.remindText = str
- this.timeoutCount++
- },
- reloadList () {
- if (this.switchType === 'account') {
- this.$store.dispatch('payCenter/loadBuyerAccount', {
- count: this.count,
- page: this.page,
- sorting: {num: 'ASC'},
- type: 'buyer'
- })
- } else {
- this.$store.dispatch('payCenter/loadBuyerRecord', {
- count: this.count,
- page: this.page,
- sorting: {'paytime': 'DESC'},
- currencyName: this.filterParams.currencyName || null,
- fromDate: this.filterParams.fromDate || null,
- toDate: this.filterParams.toDate || null,
- method: this.filterParams.method || null,
- keyword: this.filterParams.keyword || null
- })
- }
- },
- initList () {
- this.isChange = true
- this.page = 1
- this.reloadList()
- },
- onPullUpAction () {
- this.page++
- this.reloadList()
- },
- setSwitchType (type) {
- this.switchType = type
- if (type === 'record') {
- this.initFilterParams()
- }
- this.initList()
- },
- initFilterParams () {
- this.filterParams = {
- keyword: '',
- fromDate: '',
- toDate: '',
- currencyName: '',
- method: ''
- }
- },
- filterRecord () {
- this.isChange = true
- this.reloadList()
- },
- setShowSelect (type, flag) {
- if (type === 'all') {
- this.showSelectMethod = flag
- this.showSelectCurrency = flag
- this.showSelectStatus = flag
- } else if (type === 'method') {
- this.showSelectMethod = flag
- this.showSelectCurrency = false
- this.showSelectStatus = false
- } else if (type === 'currencyName') {
- this.showSelectCurrency = flag
- this.showSelectStatus = false
- this.showSelectMethod = false
- } else if (type === 'status') {
- this.showSelectStatus = flag
- this.showSelectMethod = false
- this.showSelectCurrency = false
- }
- },
- setSelect (type, val) {
- // if (type === 'method') {
- // this.filterParams.method = val
- // this.setShowSelect('method', false)
- // } else if (type === 'currencyName') {
- // this.filterParams.currencyName = val
- // this.setShowSelect('currencyName', false)
- // } else if (type === 'status') {
- // this.filterParams.status = val
- // this.setShowSelect('status', false)
- // }
- if (type === 'date') {
- if (val) {
- this.filterParams.fromDate = val.fromDate
- this.filterParams.toDate = val.toDate
- } else {
- this.filterParams.fromDate = null
- this.filterParams.toDate = null
- }
- } else {
- this.filterParams[type] = val
- }
- this.filterRecord()
- },
- onSelectAction (selectObj) {
- this.setSelect(selectObj.key, selectObj.value)
- },
- setDate (type) {
- if (this.dateObj[type]) {
- this.filterParams[type] = new Date(this.dateObj[type]).getTime() - 8 * 60 * 60 * 1000
- if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate > this.filterParams.toDate) {
- if (type === 'fromDate') {
- this.setRemindText('起始时间不能大于结束时间')
- } else {
- this.setRemindText('结束时间不能小于起始时间')
- }
- this.filterParams[type] = null
- this.dateObj[type] = null
- } else {
- if (this.filterParams.fromDate && this.filterParams.toDate && this.filterParams.fromDate === this.filterParams.toDate) {
- // 23:59:59
- this.filterParams.toDate += 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
- }
- this.filterRecord()
- }
- } else {
- this.filterParams[type] = null
- this.filterRecord()
- }
- },
- setDefaultAccount (account) {
- this.$http.get(`/trade/bankInfo/setDefaultAccount/${account.id}`).then(() => {
- this.setRemindText('设置完成')
- this.initList()
- })
- },
- deleteAccount (account) {
- this.$http.delete(`/trade/bankInfo/delete/${account.id}`).then(res => {
- if (res.data === 'success') {
- this.setRemindText('删除成功')
- this.initList()
- }
- })
- },
- initAccount () {
- this.bankAccountObj = {
- bankname: '',
- branchname: '',
- number: '',
- accountname: ''
- }
- this.validBankAccountObj = {
- bankname: false,
- branchname: false,
- number: false,
- accountname: false
- }
- },
- openAddAccount () {
- if (!this.bankList || !this.bankList.length) {
- this.$http.get('/data/bank.json').then(res => {
- this.bankList = res.data.list
- this.initAccount()
- this.showModal = true
- })
- } else {
- this.initAccount()
- this.showModal = true
- }
- },
- setBankName (name) {
- this.bankAccountObj.bankname = name
- this.showSimilar = false
- this.validBankAccountObj.bankname = true
- },
- checkBranchname () {
- this.validBankAccountObj.branchname = true
- if (!(this.bankAccountObj.branchname && this.bankAccountObj.branchname.length)) {
- this.setRemindText('开户支行不能为空')
- this.validBankAccountObj.branchname = false
- } else if (this.baseUtils.getRealLen(this.bankAccountObj.branchname) > 40) {
- this.setRemindText('开户支行不能大于40字符')
- this.validBankAccountObj.branchname = false
- } else if (!/^[\u2E80-\u9FFF]+$/.test(this.bankAccountObj.branchname)) {
- this.setRemindText('请输入正确的开户支行')
- this.validBankAccountObj.branchname = false
- }
- },
- checkNumber () {
- this.validBankAccountObj.number = true
- if (!(this.bankAccountObj.number && this.bankAccountObj.number.length)) {
- this.validBankAccountObj.number = false
- this.setRemindText('银行账号不能为空')
- } else if (this.baseUtils.getRealLen(this.bankAccountObj.number) > 30) {
- this.setRemindText('银行账号不能大于30字符')
- this.validBankAccountObj.number = false
- } else if (!/^[0-9]+$/.test(this.bankAccountObj.number)) {
- this.setRemindText('请输入正确的银行账号')
- this.validBankAccountObj.number = false
- }
- if (this.validBankAccountObj.number) {
- this.$http.get('/trade/bankInfo/number/count', {params: {type: 1061, number: this.bankAccountObj.number}}).then(res => {
- if (res.data.success) {
- this.validBankAccountObj.number = res.data.data === 0
- } else {
- this.validBankAccountObj.number = false
- this.setRemindText(res.data.message || '银行账号校验失败')
- }
- }, err => {
- this.validBankAccountObj.number = false
- this.setRemindText(err.response.data || '银行账号校验失败')
- console.log(err)
- })
- }
- },
- checkAccountname () {
- this.validBankAccountObj.accountname = true
- if (!(this.bankAccountObj.accountname && this.bankAccountObj.accountname.length)) {
- this.validBankAccountObj.accountname = false
- this.setRemindText('账户名称不能为空')
- } else if (this.baseUtils.getRealLen(this.bankAccountObj.accountname) > 100) {
- this.setRemindText('账户名称不能大于100个字符')
- this.validBankAccountObj.accountname = false
- }
- },
- addAccount () {
- if (!this.validBankAccountObj.bankname) {
- this.setRemindText('请选择开户银行')
- } else if (!this.validBankAccountObj.branchname) {
- this.setRemindText('请填写正确的开户支行')
- } else if (!this.validBankAccountObj.number) {
- this.setRemindText('请填写正确的银行账号')
- } else if (!this.validBankAccountObj.accountname) {
- this.setRemindText('请填写正确的开户名称')
- } else {
- this.$http.post('/trade/bankInfo/save/personal?type=buyer', this.bankAccountObj).then(res => {
- if (res.data.id) {
- this.setRemindText('新增账户成功')
- this.initList()
- this.showModal = false
- } else {
- this.setRemindText('新增账户失败')
- }
- }, err => {
- this.setRemindText(err.response.data || '新增账户失败')
- console.log(err)
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '~assets/scss/mobilePayCenter';
- </style>
|