123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <template>
- <view class="content">
- <view class="flex nav-list">
- <view class="item" v-for="(item,index) in navList" :class="{'action': current == index}"
- @click="changeNavT(index)">
- {{item.tit}}
- </view>
- </view>
- <view class="" style="height: 20rpx;">
- </view>
- <view class="tab">
- <template v-if="current == 0">
- <view class="bd-wrap flex">
- <view class="bg-name">
- 真实姓名:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入真实姓名" class="val-ipt" v-model="bankInfo.fullname"
- ref="name" />
- </view>
- </view>
-
- <view class="bd-wrap flex">
- <view class="bg-name">
- 银行卡号:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入银行卡号" class="val-ipt" v-model="bankInfo.bankno"
- ref="address" />
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 开户行:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入开户行" class="val-ipt" v-model="bankInfo.bank"
- ref="storenamae" />
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 所属支行:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入所属支行" class="val-ipt" v-model="bankInfo.subbranch"
- ref="storenamae" />
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 手机号:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入手机号" class="val-ipt" v-model="bankInfo.phone"
- ref="phone" />
- </view>
- </view>
- </template>
- <template v-if="current == 1">
- <view class="bd-wrap flex">
- <view class="bg-name">
- 真实姓名:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入真实姓名" class="val-ipt" v-model="aliInfo.fullname"
- ref="name" />
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 支付宝账号:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入支付宝账号" class="val-ipt" v-model="aliInfo.alino"
- ref="name" />
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 收款码:
- </view>
- <view class="bg-val">
- <!-- #ifdef APP -->
- <image v-if="!aliInfo.qr" src="../../static/img/add.png" mode="" @click="openAuth(1)"></image>
- <image v-else :src="aliInfo.qr" mode="" @click="openAuth(1)"></image>
- <!-- #endif -->
- <!-- #ifndef APP -->
- <image v-if="!aliInfo.qr" src="../../static/img/add.png" mode="" @click="upimg(1)"></image>
- <image v-else :src="aliInfo.qr" mode="" @click="upimg(1)"></image>
- <!-- #endif -->
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 手机号:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入手机号" class="val-ipt" v-model="aliInfo.phone"
- ref="phone" />
- </view>
- </view>
- </template>
- <template v-if="current == 2">
- <view class="bd-wrap flex">
- <view class="bg-name">
- 真实姓名:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入真实姓名" class="val-ipt" v-model="wxInfo.fullname"
- ref="name" />
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 微信账号:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入微信账号" class="val-ipt" v-model="wxInfo.wxno"
- ref="name" />
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 收款码:
- </view>
- <view class="bg-val">
- <!-- #ifdef APP -->
- <image v-if="!wxInfo.qr" src="../../static/img/add.png" mode="" @click="openAuth()(2)"></image>
- <image v-else :src="wxInfo.qr" mode="" @click="openAuth(2)"></image>
- <!-- #endif -->
- <!-- #ifndef APP -->
- <image v-if="!wxInfo.qr" src="../../static/img/add.png" mode="" @click="upimg(2)"></image>
- <image v-else :src="wxInfo.qr" mode="" @click="upimg(2)"></image>
- <!-- #endif -->
- </view>
- </view>
- <view class="bd-wrap flex">
- <view class="bg-name">
- 手机号:
- </view>
- <view class="bg-val">
- <input type="text" value="" placeholder="请输入手机号" class="val-ipt" v-model="wxInfo.phone"
- ref="phone" />
- </view>
- </view>
- </template>
- <!-- <view class="bd-wrap flex">
- <view class="bg-name">
- 验证码:
- </view>
- <view class="bg-val flex">
- <input type="text" value="" placeholder="请输入验证码" class="val-iptt" v-model="captcha"
- ref="captcha" />
- <view class="code" @click="verification()">{{ countDown == 0 || countDown<0 ? '验证码' : countDown }}</view>
- </view>
- </view> -->
- </view>
- <view class="btm-btn" @click="bank">
- {{current == 0? '保存银行卡信息': (current == 1? '保存支付宝信息': '保存微信信息')}}
- </view>
- <yk-authpup ref="WRITE_EXTERNAL_STORAGE" type="top" @changeAuth="changeAuth"
- permissionID="WRITE_EXTERNAL_STORAGE"></yk-authpup>
- </view>
- </template>
- <script>
- import ykAuthpup from "@/components/yk-authpup/yk-authpup";
- import { register, verify } from '@/api/login.js';
- import {
- enroll
- } from '@/api/index.js'
- import {
- getLevelList,
- bank,
- bankInfo,
- setWx,
- setAli,
- getAli,
- getWx
- } from '@/api/user.js'
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import { upload } from '@/api/order.js';
- export default {
- components: {
- ykAuthpup
- },
- data() {
- return {
- captcha: '',
- countDown: 0 ,//倒计时
- current: 0,
- navList: [{
- tit: '银行卡',
- info: {},
- }, {
- tit: '支付宝',
- info: {}
- },
- {
- tit: '微信',
- info: {}
- }
- ],
- type: 1,
- aliInfo: {
- fultname: '',
- alino: '',
- qr: '',
- id: 0
- },
- wxInfo: {
- fultname: '',
- wxno: '',
- qr: '',
- id: 0
- },
- bankInfo: {
- fullname: '',
- phone: '',
- bankno: '',
- bank: '',
- subbranch: '',
- },
- loading: false,
- };
- },
- onLoad(opt) {
-
- },
- watch: {
- current(n, o) {
- }
- },
- onShow() {
- this.getbankInfo()
- },
- onReachBottom() {
- },
- computed: {
- ...mapState('user', ['userInfo'])
- },
- methods: {
- //发送验证码
- verification() {
- let obj = this;
- let index = this.current;
- let phone;
- if(index == 0) {
- phone = this.bankInfo.phone
- }else if(index == 1) {
- phone = this.aliInfo.phone
- }else if(index == 2) {
- phone = this.wxInfo.phone
- }
- if (!phone) {
- this.$api.msg('请输入手机号');
- return;
- }
- if (phone.length < 11) {
- this.$api.msg('请输入正确的手机号');
- return;
- }
- // 判断是否在倒计时
- if (obj.countDown > 0) {
- return false;
- } else {
- obj.countDown = 60;
- obj.time = setInterval(() => {
- obj.countDown--;
- }, 1000);
- //调用验证码接口
- verify({
- phone: phone,
- type: 'verify'
- })
- .then(({ data }) => {})
- .catch(err => {
- console.log(err);
- });
- }
- },
- openAuth(type) {
- this.typename = type
- this.$refs['WRITE_EXTERNAL_STORAGE'].open()
- },
- changeAuth() {
- this.upimg(this.typename)
- },
- upimg(type) {
- let that = this
- upload({
- file: ''
- })
- .then(e => {
- console.log(e,'e')
- if(type == 1) {
- that.aliInfo.qr = e[0].url
- }else {
- that.wxInfo.qr = e[0].url
- }
- })
- .catch(e => {});
- },
- changeNavT(index) {
- if (index == this.current) {
- return
- }
- this.current = index
- },
- getbankInfo() {
- bankInfo().then(res => {
- console.log(res);
- if (res.data && res.data.id) {
- this.bankInfo = res.data
- }
- })
- getAli().then(res => {
- if (res.data && res.data.id) {
- this.aliInfo = res.data
- }
- })
- getWx().then(res => {
- if (res.data && res.data.id) {
- this.wxInfo = res.data
- }
- })
- },
- // 选中城市切换
- onCityClick({
- data
- }) {
- // let address = this.addressData.address;
- // address.province = data[0];
- // address.city = data[1];
- // address.district = data[2];
- this.address = data.join('-');
- },
- bank() {
- let that = this
- let setInfo,qdata;
- if (that.loading) {
- return
- }
- if (that.current == 0) {
- // 校验银行卡
- setInfo = bank
- if (that.bankInfo.fullname == '') {
- return that.$api.msg('请输入您的姓名')
- }
- if (that.bankInfo.phone == '') {
- return that.$api.msg('请输入手机号')
- }
- if (that.bankInfo.bankno == '') {
- return that.$api.msg('请输入银行卡号')
- }
- if (that.bankInfo.bank == '') {
- return that.$api.msg('请输入银行')
- }
- if (that.bankInfo.subbranch == '') {
- return that.$api.msg('请输入所属支行')
- }
- qdata = that.bankInfo
- } else if (that.current == 1) {
- //校验支付宝
- setInfo = setAli
- if (that.aliInfo.fullname == '') {
- return that.$api.msg('请输入您的姓名')
- }
- if (that.aliInfo.wxno == '') {
- return that.$api.msg('请输入支付宝账号')
- }
- if (that.aliInfo.qr == '') {
- return that.$api.msg('请上传支付宝收款码')
- }
-
- qdata = that.aliInfo
- } else if (that.current == 2) {
- //校验微信
- setInfo = setWx
- if (that.wxInfo.fullname == '') {
- return that.$api.msg('请输入您的姓名')
- }
- if (that.wxInfo.wxno == '') {
- return that.$api.msg('请输入微信账号')
- }
- if (that.wxInfo.qr == '') {
- return that.$api.msg('请上传微信收款码')
- }
- qdata = that.wxInfo
- }
- // qdata.captcha = that.captcha
- that.loading = true
- setInfo(qdata).then(res => {
- console.log(res);
- uni.showToast({
- title: '提交成功',
- duration: 2000
- });
- }).catch(err => {
- console.log('err');
- that.loading = false
- })
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .tab {
- width: 690rpx;
- margin: auto;
- // height: 606rpx;
- background: #FFFFFF;
- border-radius: 10rpx;
- }
- .bd-wrap {
- width: 690rpx;
- // height: 100rpx;
- padding: 20rpx 0;
- background-color: #fff;
- border-bottom: 1px solid #f2f2f2;
- // line-height: 100rpx;
- font-size: 32rpx;
- position: relative;
- .code {
- position: absolute;
- width: 100rpx;
- height: 100rpx;
- right: 10rpx;
- color: #f64342;
- font-size: 23rpx;
- }
- .bg-name {
- width: 280rpx;
- height: 100%;
- padding-left: 20rpx;
- }
- .bg-val {
- width: 430rpx;
- height: 100%;
- .code {
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .val-ipt {
- padding-top: 10rpx;
- display: inline-block;
- width: 100%;
- height: 100%;
- // background-color: #009100;
- padding-left: 10rpx;
- }
- .val-iptt {
- width: 70%;
- }
- image {
- width: 150rpx;
- height: 150rpx;
- }
- }
- }
- .btm-btn {
- margin: 60rpx auto 0;
- font-size: 34rpx;
- font-weight: 500;
- color: #FFFFFF;
- text-align: center;
- line-height: 82rpx;
- width: 560rpx;
- height: 80rpx;
- background: #FA2740;
- border-radius: 40rpx;
- }
- .nav-list {
- justify-content: space-around;
- background-color: #fff;
- font-weight: 500;
- color: #333333;
- .item {
- padding: 28rpx 20rpx 16rpx;
- }
- .action {
- color: #EC5A54;
- border-bottom: 2px solid red;
- }
- }
- </style>
|