123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308 |
- <template>
- <view class="content">
- <view class="box">
- <view class="item top">
- <text>真实姓名</text>
- <input type="text" v-model="name" value="" placeholder="请输入真实姓名" />
- </view>
- <view class="item top">
- <text>支付宝账号</text>
- <input type="text" v-model="id" value="" placeholder="请输入支付宝账号" />
- </view>
- <!-- <view class="item top">
- <text>手机号</text>
- <input type="text" v-model="phone" value="" placeholder="请输入手机号" />
- </view> -->
- <view class="item top">
- <text>验证码</text>
- <view class="login_name flex">
- <input class="uni-input" v-model="code" focus placeholder="请输入验证码" />
- <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
- </view>
- </view>
- <view class="erweima">
- <text>收款码</text>
- <view class="img" @click="uploads()">
- <image src="../../static/user/erweima.png" mode="" v-if="image == ''"></image>
- <image :src="image" mode="scaleToFill" v-else></image>
- </view>
- </view>
- </view>
- <view class="button" @click="confirm()">确认</view>
- <canvas canvas-id="canvas" v-if="canvasStatus"
- :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
- <uni-popup ref="popup" type="center">
- <view class="alertprogress">
- {{progress}}%
- </view>
- </uni-popup>
- <codeImage @openCode='getCode' loginType="" @close='showAlert=false' :phone="userInfo.phone" ref="alertImage"
- :show='showAlert'></codeImage>
- </view>
- </template>
- <script>
- import {
- upload
- } from '@/api/order.js'
- import {
- getUserInfo
- } from '@/api/user.js';
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- auction,
- pay_list
- } from '@/api/wallet.js';
- import codeImage from '@/components/codeImage.vue';
- export default {
- data() {
- return {
- name: '',
- id: '',
- phone: '',
- countDown: 0, //倒计时
- code: '', //验证码
- time: '',
- image: '',
- upFileLoding: false,
- userInfo: {},
- canvasStatus: false,
- canvasWidth: 0,
- canvasHeight: 0,
- progress: 0,
- showAlert:false,
- };
- },
- components: {
- codeImage
- },
- watch: {
- // 监听倒计时
- countDown(i) {
- if (i == 0) {
- clearInterval(this.time);
- }
- }
- },
- onShow() {
- getUserInfo().then((res) => {
- this.userInfo = res.data;
- })
- },
- onLoad() {
- pay_list().then(({
- data
- }) => {
- if (data.zfb != '') {
- this.name = data.zfb.name
- this.id = data.zfb.payment
- this.phone = data.zfb.phone
- this.image = data.zfb.image
- }
- })
- },
- methods: {
- close() {
- this.showAlert = false;
- },
- // 发送验证码
- getCode() {
- const obj = this;
- obj.countDown = 60;
- obj.time = setInterval(() => {
- obj.countDown--;
- }, 1000);
- //调用验证码接口
- },
- uploads() {
- const that = this;
- if (that.upFileLoding) {
- return
- }
- that.upFileLoding = true;
- setTimeout(() => {
- that.upFileLoding = false;
- }, 1000);
- that.canvasStatus = true;
- upload({
- filename: '',
- file_name: 'collection/zfb/' + that.userInfo.uid
- }, (res) => {
- that.image = res[0].url;
- that.canvasStatus = false
- }, (res) => {
- that.canvasStatus = false
- }, (res) => {
- that.canvasWidth = res.w
- that.canvasHeight = res.h
- }, (res) => {
- // console.log(res,'res');
- if (res.progress == 100) {
- this.$refs.popup.close()
- uni.showToast({
- title: '上传成功'
- });
- } else if (res.progress == 0) {
- this.$refs.popup.open()
- }
- that.progress = res.progress;
- // console.log(res,'进度条');
- })
- },
- verification() {
- let obj = this;
- if (!this.userInfo.phone) {
- this.$api.msg('请绑定手机号');
- return;
- }
- // 判断是否在倒计时
- if (obj.countDown > 0) {
- return false;
- } else {
- obj.showAlert = true;
- obj.$refs.alertImage.getImage()
- }
- },
- confirm() {
- let obj = this;
- if (!obj.name) {
- return this.$api.msg('请输入提款人姓名');
- }
- if (!obj.id) {
- return this.$api.msg('请输入支付宝账号');
- }
- // if (!obj.phone) {
- // return this.$api.msg('请输入手机号码');
- // }
- if (!obj.code) {
- return this.$api.msg('请输入验证码');
- }
- if (!obj.image) {
- return this.$api.msg('请上传支付凭证');
- }
- auction({
- type: 2,
- name: obj.name,
- payment: obj.id,
- phone: obj.userInfo.phone,
- captcha: obj.code,
- image: obj.image,
- })
- .then(e => {
- obj.$api.msg('修改成功');
- uni.redirectTo({
- url: './collection',
- });
- })
- .catch(e => {
- console.log(e);
- });
- },
- }
- };
- </script>
- <style lang="scss">
- page,
- .content {
- height: 100%;
- padding: 0;
- margin: 0;
- }
- .top {
- border-bottom: 1rpx solid #f3f3f3;
- }
- .box {
- background: #ffffff;
- margin: 20rpx 0 70rpx 0;
- .item {
- display: flex;
- align-items: center;
- text {
- margin: 0 40rpx 0 25rpx;
- width: 150rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 100rpx;
- }
- input {
- height: 100rpx;
- display: inline-block;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #999999;
- line-height: 100rpx;
- }
- .uni-input {
- text-align: left;
- width: 325rpx;
- font-size: 28rpx !important;
- }
- .login_name {
- color: #333333;
- }
- .code {
- color: #db292b;
- font-size: 23rpx;
- border-left: 1px solid #eeeeee;
- width: 150rpx;
- flex-shrink: 0;
- text-align: center;
- }
- }
- }
- .button {
- text-align: center;
- width: 560rpx;
- height: 80rpx;
- background: #FD3B39;
- border-radius: 40rpx;
- font-size: 30rpx;
- font-family: PingFangSC;
- font-weight: 500;
- color: #ffffff;
- line-height: 80rpx;
- margin: 0 auto;
- }
- .erweima {
- padding: 30rpx 0;
- display: flex;
- text {
- margin: 0 30rpx;
- width: 150rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #333333;
- }
- .img {
- width: 160rpx;
- height: 160rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- </style>
|