|
@@ -25,8 +25,8 @@
|
|
|
</div>
|
|
|
<!-- 按钮 -->
|
|
|
<div class="btnList">
|
|
|
- <div class="cutBank" @click="delBank(2)">解绑</div>
|
|
|
- <div class="changeBank" @click="replaceCard(3)">更换</div>
|
|
|
+ <div class="cutBank" @click="$refs.UnBindBank && $refs.UnBindBank.handleOpen(bankArr)">解绑</div>
|
|
|
+ <div class="changeBank" @click="$refs.EditModal && $refs.EditModal.handleOpen({ ...bankArr, id: bankArr.shopId })">更换</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -47,345 +47,47 @@
|
|
|
</div>
|
|
|
<!-- 按钮 -->
|
|
|
<div class="btnList">
|
|
|
- <div class="changeBank" @click="bindCard(1)">立即绑定</div>
|
|
|
+ <div class="changeBank" @click="$refs.EditModal && $refs.EditModal.handleOpen({ id: '' })">立即绑定</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
|
|
|
- <!-- 弹框开始 -->
|
|
|
- <el-dialog
|
|
|
- :title="dialogData.title" :visible.sync="dialogData.isVisible" width="500px" :close-on-click-modal="false"
|
|
|
- center @close="closeDialog"
|
|
|
- >
|
|
|
- <!-- 绑定银行卡 -->
|
|
|
- <el-form v-if="dialogData.type === 1" ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
- <el-form-item label="持卡人姓名" prop="cardName">
|
|
|
- <el-input v-model="form.cardName" maxlength="20" @onblur="btKeyUp" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="卡号" prop="cardNumber">
|
|
|
- <el-input v-model="form.cardNumber" maxlength="19" oninput="value=value.replace(/[^\d]/g,'')" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="银行" prop="bank">
|
|
|
- <el-select v-model="form.bank" filterable placeholder="请选择所属银行">
|
|
|
- <el-option v-for="item in options" :key="item.dictName" :label="item.dictName" :value="item.dictId" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="注册手机号" prop="phone">
|
|
|
- <el-input
|
|
|
- v-model="form.phone" oninput="value=value.replace(/[^\d]/g,'')" maxlength="11"
|
|
|
- style="width: 120px;"
|
|
|
- />
|
|
|
- <el-button class="sendCode" type="primary" :loading="codeloading" @click="sendCode(form.phone)">
|
|
|
- <span v-if="!codeloading">获取验证码</span>
|
|
|
- <span v-else>{{ count }} s</span>
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="验证码" prop="code">
|
|
|
- <el-input v-model="form.code" style="width: 120px;" oninput="value=value.replace(/[^\d]/g,'')" maxlength="6" />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <!-- 解绑 -->
|
|
|
- <el-form v-if="dialogData.type === 2" ref="unbind" :model="unbinds" :rules="rules" label-width="120px">
|
|
|
- <el-form-item label="注册手机号" prop="phone">
|
|
|
- <el-input v-model="unbinds.phone" maxlength="11" style="width: 120px;" />
|
|
|
- <el-button class="sendCode" type="primary" :loading="codeloading" @click="sendCode(unbinds.phone)">
|
|
|
- <span v-if="!codeloading">获取验证码</span>
|
|
|
- <span v-else>{{ count }} s</span>
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="验证码" prop="code">
|
|
|
- <el-input v-model="unbinds.code" style="width: 120px;" />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <!-- 更换银行卡 -->
|
|
|
- <el-form v-if="dialogData.type === 3" ref="card" :model="card" :rules="rules" label-width="120px">
|
|
|
- <!-- <p class="card">原绑定信息</p>
|
|
|
- <el-form-item label="原持卡人姓名" prop="cardName">
|
|
|
- <el-input v-model="card.cardName" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="原银行卡号" prop="oldCardNumber">
|
|
|
- <el-input v-model="card.oldCardNumber" />
|
|
|
- </el-form-item>
|
|
|
- <p class="card">新绑定信息</p> -->
|
|
|
- <el-form-item label="持卡人姓名" prop="cardName">
|
|
|
- <el-input v-model="card.cardName" maxlength="20" @onblur="btKeyUp" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="卡号" prop="cardNumber">
|
|
|
- <el-input
|
|
|
- v-if="cardNumberShow" :value="hidden(card.cardNumber, 3, 4)" oninput="value=value.replace(/[^\d]/g,'')"
|
|
|
- maxlength="19" @focus="focusCardNunberInput"
|
|
|
- />
|
|
|
- <el-input v-else v-model="card.cardNumber" maxlength="19" oninput="value=value.replace(/[^\d]/g,'')" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="银行" prop="bank">
|
|
|
- <el-select v-model="card.bank" filterable placeholder="请选择所属银行">
|
|
|
- <el-option v-for="item in options" :key="item.dictName" :label="item.dictName" :value="item.dictId" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="注册手机号" prop="phone">
|
|
|
- <el-input
|
|
|
- v-if="phoneShow" :value="hidden(card.phone, 3, 4)" oninput="value=value.replace(/[^\d]/g,'')"
|
|
|
- maxlength="11" style="width: 120px;" @focus="focusPhoneInput"
|
|
|
- />
|
|
|
- <el-input
|
|
|
- v-else v-model="card.phone" oninput="value=value.replace(/[^\d]/g,'')" maxlength="11"
|
|
|
- style="width: 120px;"
|
|
|
- />
|
|
|
- <el-button class="sendCode" type="primary" :loading="codeloading" @click="sendCode(card.phone)">
|
|
|
- <span v-if="!codeloading">获取验证码</span>
|
|
|
- <span v-else>{{ count }} s</span>
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="验证码" prop="code">
|
|
|
- <el-input v-model="card.code" oninput="value=value.replace(/[^\d]/g,'')" maxlength="6" style="width: 120px;" />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <p slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="confirm(formList[dialogData.type])">{{ dialogData.confirm || '确定' }}</el-button>
|
|
|
- <el-button @click="dialogData.isVisible = false">取 消</el-button>
|
|
|
- </p>
|
|
|
- </el-dialog>
|
|
|
+ <!-- 新增编辑 -->
|
|
|
+ <EditModal ref="EditModal" @success="getList" />
|
|
|
+ <!-- 解绑银行卡 -->
|
|
|
+ <UnBindBank ref="UnBindBank" @success="getList" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {
|
|
|
- accountGetById,
|
|
|
- getSelect,
|
|
|
- bankDelete,
|
|
|
- bankUpdate,
|
|
|
- bankAdd,
|
|
|
- getCode
|
|
|
-} from '@/api/account'
|
|
|
+import EditModal from './components/EditModal'
|
|
|
+import UnBindBank from './components/UnBindBank'
|
|
|
+import { accountGetById } from '@/api/account'
|
|
|
import defaultBank from '@/assets/images/bank/default_bank_3x.png'
|
|
|
-const TIME_COUNT = 60 // 更改倒计时时间
|
|
|
+
|
|
|
export default {
|
|
|
+ name: 'Account',
|
|
|
+ components: {
|
|
|
+ EditModal,
|
|
|
+ UnBindBank
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
err: '账 号:',
|
|
|
- bankArr: '',
|
|
|
+ bankArr: {},
|
|
|
show: true,
|
|
|
- codeloading: false,
|
|
|
- dialogData: {},
|
|
|
- count: '',
|
|
|
- mobile: '13444444444',
|
|
|
- options: [],
|
|
|
- formList: {
|
|
|
- 1: 'form',
|
|
|
- 2: 'unbind',
|
|
|
- 3: 'card'
|
|
|
- },
|
|
|
- // 绑定银行卡
|
|
|
- form: {
|
|
|
- cardName: '',
|
|
|
- cardNumber: '',
|
|
|
- bank: '',
|
|
|
- phone: '',
|
|
|
- code: ''
|
|
|
- },
|
|
|
- // 解绑
|
|
|
- unbinds: {
|
|
|
- phone: '',
|
|
|
- code: ''
|
|
|
- },
|
|
|
- // 更换
|
|
|
- card: {
|
|
|
- cardName: '',
|
|
|
- cardNumber: '',
|
|
|
- bank: '',
|
|
|
- phone: '',
|
|
|
- code: ''
|
|
|
- },
|
|
|
- rules: {
|
|
|
- cardName: [
|
|
|
- { required: true, message: '请输入持卡人姓名', trigger: 'blur' }
|
|
|
- ],
|
|
|
- cardNumber: [
|
|
|
- { required: true, message: '请输入银行卡号', trigger: 'blur' }
|
|
|
- ],
|
|
|
- phone: [ { required: true, message: '请输入手机号', trigger: 'blur' } ],
|
|
|
- code: [ { required: true, message: '请输入验证码', trigger: 'blur' } ],
|
|
|
- bank: [ { required: true, message: '请输入选择银行', trigger: 'blur' } ],
|
|
|
- oldCardNumber: [
|
|
|
- { required: true, message: '请输入原银行卡号', trigger: 'blur' }
|
|
|
- ]
|
|
|
- },
|
|
|
privacyTime: 0,
|
|
|
- cardNumberShow: true, // 是否显示卡号脱敏
|
|
|
- phoneShow: true, // 是否显示手机号脱敏
|
|
|
- oldCardNumber: '',
|
|
|
- oldPhone: '',
|
|
|
defaultBank
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.bankDetails()
|
|
|
- this.bankName()
|
|
|
+ this.getList()
|
|
|
this.privacyTime = localStorage.getItem('privacyTime')
|
|
|
- console.log(this.privacyTime)
|
|
|
},
|
|
|
methods: {
|
|
|
- closeDialog() {
|
|
|
- this.card.cardNumber = this.card.cardNumber ? this.card.cardNumber : this.oldCardNumber
|
|
|
- this.card.phone = this.card.phone ? this.card.phone : this.oldPhone
|
|
|
- },
|
|
|
- focusPhoneInput() {
|
|
|
- this.phoneShow = false,
|
|
|
- this.card.phone = ''
|
|
|
- },
|
|
|
- focusCardNunberInput() {
|
|
|
- this.cardNumberShow = false
|
|
|
- this.card.cardNumber = ''
|
|
|
- },
|
|
|
- // 获取验证码
|
|
|
- async sendCode(phone) {
|
|
|
- var myreg = /^1[3-9]\d{9}$/
|
|
|
- if (phone === '') {
|
|
|
- this.$message.error('请填写电话号码')
|
|
|
- return
|
|
|
- } else if (!myreg.test(phone)) {
|
|
|
- this.$message({
|
|
|
- message: '请输入正确手机号',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- return false
|
|
|
- }
|
|
|
- if (!this.timer) {
|
|
|
- const res = await getCode({ phone })
|
|
|
- if (res.code === '') {
|
|
|
- this.$message({
|
|
|
- message: '发送成功,请注意查看手机短信',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- }
|
|
|
- this.codeloading = true
|
|
|
- this.count = TIME_COUNT
|
|
|
- this.timer = setInterval(() => {
|
|
|
- if (this.count > 0 && this.count <= TIME_COUNT) {
|
|
|
- this.count--
|
|
|
- } else {
|
|
|
- this.show = true
|
|
|
- clearInterval(this.timer) // 清除定时器
|
|
|
- this.timer = null
|
|
|
- this.codeloading = false
|
|
|
- }
|
|
|
- }, 1000)
|
|
|
- }
|
|
|
- },
|
|
|
- btKeyUp(e) {
|
|
|
- e.target.value = e.target.value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、' ']/g, '')
|
|
|
- },
|
|
|
- // 解绑
|
|
|
- async unbind(v) {
|
|
|
- const res = await bankDelete(this.unbinds)
|
|
|
- if (res.code === '') {
|
|
|
- this.$message({
|
|
|
- message: '解绑成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.bankDetails()
|
|
|
- this.dialogData.isVisible = false
|
|
|
- }
|
|
|
- },
|
|
|
- // 更换银行卡
|
|
|
- replaceCard(v) {
|
|
|
- this.dialogData = {
|
|
|
- title: '更换银行卡',
|
|
|
- isVisible: true,
|
|
|
- confirm: '更换',
|
|
|
- type: v
|
|
|
- }
|
|
|
- this.card = this.bankArr
|
|
|
- this.cardNumberShow = true
|
|
|
- this.oldCardNumber = this.card.cardNumber
|
|
|
- this.oldPhone = this.card.phone
|
|
|
- },
|
|
|
- // 绑定银行卡
|
|
|
- bindCard(v) {
|
|
|
- this.dialogData = {
|
|
|
- title: '绑定银行卡',
|
|
|
- isVisible: true,
|
|
|
- confirm: '绑定',
|
|
|
- type: v
|
|
|
- }
|
|
|
- this.card = {
|
|
|
- cardName: '',
|
|
|
- cardNumber: '',
|
|
|
- bank: '',
|
|
|
- phone: '',
|
|
|
- code: ''
|
|
|
- }
|
|
|
- },
|
|
|
- // 解绑银行卡
|
|
|
- delBank(v) {
|
|
|
- this.dialogData = {
|
|
|
- title: '解绑银行卡',
|
|
|
- isVisible: true,
|
|
|
- confirm: '解绑',
|
|
|
- type: v
|
|
|
- }
|
|
|
- },
|
|
|
- // 确认
|
|
|
- confirm(formName) {
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- console.log(formName)
|
|
|
- if (formName === 'card') {
|
|
|
- this.changeBank()
|
|
|
- } else if (formName === 'form') {
|
|
|
- this.addBank()
|
|
|
- } else if (formName === 'unbind') {
|
|
|
- this.unbind()
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log('error submit!!')
|
|
|
- return false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 更换账户
|
|
|
- async changeBank() {
|
|
|
- var regExp = /^([1-9]{1})(\d{8,17})$/
|
|
|
- if (!regExp.test(this.card.cardNumber)) {
|
|
|
- this.$message({
|
|
|
- message: '请输入正确银行卡号,卡号必须为以数字开头,10~19位的卡号!!!',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- return false
|
|
|
- }
|
|
|
- const res = await bankUpdate(this.card)
|
|
|
- if (res.code === '') {
|
|
|
- this.$message({
|
|
|
- message: '更换成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.bankDetails()
|
|
|
- this.dialogData.isVisible = false
|
|
|
- }
|
|
|
- },
|
|
|
- // 绑定账户
|
|
|
- async addBank() {
|
|
|
- var regExp = /^([1-9]{1})(\d{8,17})$/
|
|
|
- if (!regExp.test(this.form.cardNumber)) {
|
|
|
- this.$message({
|
|
|
- message: '请输入正确银行卡号,卡号必须为以数字开头,10~19位的卡号!!!',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- return false
|
|
|
- }
|
|
|
- const res = await bankAdd(this.form)
|
|
|
- if (res.code === '') {
|
|
|
- this.$message({
|
|
|
- message: '绑定成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.bankDetails()
|
|
|
- this.dialogData.isVisible = false
|
|
|
- }
|
|
|
- },
|
|
|
// 查询账户
|
|
|
- async bankDetails() {
|
|
|
+ async getList() {
|
|
|
const res = await accountGetById({})
|
|
|
if (res.code === '') {
|
|
|
console.log(JSON.stringify(res.data))
|
|
@@ -398,11 +100,6 @@ export default {
|
|
|
console.log(this.show)
|
|
|
}
|
|
|
},
|
|
|
- async bankName() {
|
|
|
- const res = await getSelect({ dictName: '所属银行' })
|
|
|
- this.options = res.data
|
|
|
- console.log(this.options)
|
|
|
- },
|
|
|
// 中间部分
|
|
|
hidden(str, frontLen, endLen) {
|
|
|
if (str && frontLen && endLen) {
|