Browse Source

fix 提现界面、上传界面

feature-1.0
da da 3 years ago
parent
commit
379bff350d
  1. 2
      main.js
  2. 879
      pages-userInfo/withdraw/withdraw.vue
  3. 20
      pages/index/upload/upload.vue

2
main.js

@ -10,7 +10,7 @@ const baseURL = 'https://service.bnyer.cn'
Vue.prototype.$baseURL = baseURL; Vue.prototype.$baseURL = baseURL;
Vue.prototype.$uploadURL = "/file/upload"; // ”/file/uploadBatch“ /file/upload Vue.prototype.$uploadURL = "/file/uploadBatch"; // ”/file/uploadBatch“ /file/upload
Vue.prototype.$uploadType = "file"; // files file Vue.prototype.$uploadType = "file"; // files file
Vue.prototype.$noMultipleClicks = common.noMultipleClicks; Vue.prototype.$noMultipleClicks = common.noMultipleClicks;

879
pages-userInfo/withdraw/withdraw.vue

@ -1,425 +1,456 @@
<template> <template>
<view class="page-bg"> <view class="page-bg">
<view class="main-container"> <view class="main-container">
<view class="withdraw-input-box"> <view class="withdraw-input-box">
<view class="withdraw-title">提现金额</view> <view class="withdraw-title">提现金额</view>
<view class="input-box"> <view class="input-box">
¥ <input type="text" placeholder="输入金额" placeholder-class="pch" ¥ <input type="text" placeholder="输入金额" placeholder-class="pch" class="input-value"
class="input-value" @blur="checkAmt()" value="" v-model="amt"/> @blur="checkAmt()" value="" v-model="amt" />
</view> </view>
<view class="withdraw-amount"> <view class="withdraw-amount">
<span>当前余额为{{userInfo.amt}}</span> <span>当前余额为{{userInfo.amt}}</span>
<span class="all-withdraw" v-if="userInfo.amt > 0" @click="allWithdraw">全部提现</span> <span class="all-withdraw" v-if="userInfo.amt > 0" @click="allWithdraw">全部提现</span>
</view> </view>
<view class="withdraw-amount-tip">小贴士提现金额不少于1元 </view> <view class="withdraw-amount-tip">小贴士提现金额不少于1元 </view>
</view> </view>
<view class="error-message" v-if="checkFlag == true">输入金额超过或少于可提现余额</view> <view class="error-message" v-if="checkFlag == true">输入金额超过或少于可提现余额</view>
<view class="withdraw-title tl-title-margin">选择提现至</view> <view class="withdraw-title tl-title-margin">选择提现至</view>
<view class="withdraw-account-list"> <view class="withdraw-account-list">
<radio-group @change="radioChange" :style="'width: 100%'"> <radio-group @change="radioChange" :style="'width: 100%'">
<label v-for="(item, index) in creatorAccountList" :key="index"> <label v-for="(item, index) in creatorAccountList" :key="index">
<view class="withdrawBox"> <view class="withdrawBox">
<view class="withdrawBox-title"> <view class="withdrawBox-title">
<view class="account-icon" v-if="item.type == '0'"> <view class="account-icon" v-if="item.type == '0'">
<uni-icons custom-prefix="iconfont" :type="payType[0].icon" size="20" :color="payType[0].color" ></uni-icons> <uni-icons custom-prefix="iconfont" :type="payType[0].icon" size="20"
</view> :color="payType[0].color"></uni-icons>
<view class="account-icon" v-if="item.type == '1'"> </view>
<uni-icons custom-prefix="iconfont" :type="payType[1].icon" size="20" :color="payType[1].color" ></uni-icons> <view class="account-icon" v-if="item.type == '1'">
</view> <uni-icons custom-prefix="iconfont" :type="payType[1].icon" size="20"
<view class="account-icon" v-if="item.type == '2'"> :color="payType[1].color"></uni-icons>
<uni-icons custom-prefix="iconfont" :type="payType[2].icon" size="20" :color="payType[2].color" ></uni-icons> </view>
</view><!-- 0->微信 1->银行卡 2->支付宝 --> <view class="account-icon" v-if="item.type == '2'">
<view class="account-title" v-if="item.type == '0'"> <uni-icons custom-prefix="iconfont" :type="payType[2].icon" size="20"
{{payType[0].title}} {{item.accountNo}} :color="payType[2].color"></uni-icons>
</view> </view><!-- 0->微信 1->银行卡 2->支付宝 -->
<view class="account-title" v-if="item.type == '1'"> <view class="account-title" v-if="item.type == '0'">
{{payType[1].title}} {{item.accountNo}} {{payType[0].title}} {{item.accountNo}}
</view> </view>
<view class="account-title" v-if="item.type == '2'"> <view class="account-title" v-if="item.type == '1'">
{{payType[2].title}} {{item.accountNo}} {{payType[1].title}} {{item.accountNo}}
</view> </view>
</view> <view class="account-title" v-if="item.type == '2'">
<view> {{payType[2].title}} {{item.accountNo}}
<radio :value="JSON.stringify(item)" color="#0b6375" :checked="item.isUse === '1'" class="radioStyle"/> </view>
<!-- <uni-data-checkbox v-model="item" :localdata="range" @change="change"></uni-data-checkbox> --> </view>
</view> <view>
</view> <radio :value="JSON.stringify(item)" color="#0b6375" :checked="item.isUse === '1'"
</label> class="radioStyle" />
</radio-group> <!-- <uni-data-checkbox v-model="item" :localdata="range" @change="change"></uni-data-checkbox> -->
</view> </view>
<view class="tl-footer"> </view>
<button class="withdraw-btn" @click="$noMultipleClicks(withdraw)">提现</button> </label>
</view> </radio-group>
</view>
</view> <view class="tl-footer">
</view> <button class="withdraw-btn" @click="$noMultipleClicks(withdraw)">提现</button>
</template> </view>
<script> </view>
import { </view>
getWithdrawList,getCreatorAccount, </template>
checkWithdraw,withdraw,
getCreatorInfo <script>
} from '@/api/userInfo.js' import {
export default { getWithdrawList,
data() { getCreatorAccount,
return { checkWithdraw,
amt: '', withdraw,
userInfo: {}, getCreatorInfo
checkFlag: false, } from '@/api/userInfo.js'
noClick:true, // export default {
creatorAccountList:[], data() {
accountNo: '', return {
accountRealNo: '', // amt: '',
type: '', userInfo: {},
current: 0, checkFlag: false,
payType: [ noClick: true, //
{ creatorAccountList: [],
icon: 'icon-weixin', accountNo: '',
title: '微信', accountRealNo: '', //
color: '#15ba11' type: '',
}, current: 0,
{ payType: [{
icon: 'icon-yinhangka', icon: 'icon-weixin',
title: '银行卡', title: '微信',
color: '#0b6375' color: '#15ba11'
}, },
{ {
icon: 'icon-zhifubao', icon: 'icon-yinhangka',
title: '支付宝', title: '银行卡',
color: '#027aff' color: '#0b6375'
} },
], {
} icon: 'icon-zhifubao',
}, title: '支付宝',
created() { color: '#027aff'
const userInfo = uni.getStorageSync('userInfo') }
if (!userInfo) { ],
console.log('havent userInfo') }
uni.showModal({ },
content: '艺术家账户过期,请重新登录!', onShow() {
showCancel: false, const userInfo = uni.getStorageSync('userInfo')
success() { if (!userInfo) {
// console.log('havent userInfo')
uni.reLaunch({ uni.showModal({
url: '/pages/login/login' content: '艺术家账户过期,请重新登录!',
}); showCancel: false,
} success() {
}); //
} else { uni.reLaunch({
this.userInfo = userInfo; url: '/pages/login/login'
console.log('have userInfo') });
this.getCreatorAccount(); }
} });
} else {
}, this.userInfo = userInfo;
methods: { console.log('have userInfo')
// this.getCreatorAccount();
async getCreatorAccount() { }
let that = this;
const res = await getCreatorAccount(that.userInfo.id) },
console.log('res', res) methods: {
if (res.data.code === 200) { //
that.creatorAccountList.push(...res.data.data) async getCreatorAccount() {
for (let param of res.data.data) { let that = this;
if(param.isUse === '1'){ const res = await getCreatorAccount(that.userInfo.id)
that.accountNo = param.accountNo; if (res.data.code === 200) {
that.accountRealNo = param.accountRealNo; if (!res.data.data.length) {
that.type = param.type; return uni.showModal({
} title: '提示',
} content: '当前暂无银行卡,请点确认绑定',
console.log('creatorAccountList', that.creatorAccountList) success: ({
} else { confirm,
uni.showModal({ cancel
content: '获取艺术家账户列表数据加载失败!', }) => {
showCancel: false confirm && uni.navigateTo({
}); url: '/pages-userInfo/creatorAccount/createAccount'
} })
}, cancel && uni.navigateBack()
radioChange: function(evt) { }
const param = JSON.parse(evt.detail.value); })
let that = this; }
that.type = param.type; that.creatorAccountList.push(...res.data.data)
that.accountNo = param.accountNo; for (let param of res.data.data) {
}, if (param.isUse === '1') {
that.accountNo = param.accountNo;
//1 that.accountRealNo = param.accountRealNo;
checkAmt:function(){ that.type = param.type;
let that = this; }
if(parseFloat(that.amt) > parseFloat(that.userInfo.amt)){ }
that.checkFlag = true; console.log('creatorAccountList', that.creatorAccountList)
}else if(parseFloat(that.amt) < parseFloat(1)){ } else {
that.checkFlag = true; uni.showModal({
}else{ content: '获取艺术家账户列表数据加载失败!',
that.checkFlag = false; showCancel: false
} });
}, }
allWithdraw() { },
let that = this;
if (that.userInfo.amt > 0) radioChange: function(evt) {
that.amt = that.userInfo.amt; const param = JSON.parse(evt.detail.value);
}, let that = this;
// that.type = param.type;
async withdraw(){ that.accountNo = param.accountNo;
let that = this; },
console.log('点击了提现,金额为',that.type)
if(that.amt == null || that.amt == ''){ //1
uni.showModal({ checkAmt: function() {
content: '请输入提现金额!', let that = this;
showCancel: false if (parseFloat(that.amt) > parseFloat(that.userInfo.amt)) {
}); that.checkFlag = true;
} } else if (parseFloat(that.amt) < parseFloat(1)) {
if(that.checkFlag == true){ that.checkFlag = true;
//console.log('that.checkFlag',that.checkFlag) } else {
uni.showModal({ that.checkFlag = false;
content: '输入金额超过或少于可提现余额!', }
showCancel: false },
}); allWithdraw() {
}else{ let that = this;
// if (that.userInfo.amt > 0)
const param = { that.amt = that.userInfo.amt;
creatorId: that.userInfo.id, },
amt: that.amt //
} async withdraw() {
const checkRes = await checkWithdraw(param); let that = this;
if(checkRes.data.code === 200){ console.log('点击了提现,金额为', that.type)
//true if (that.amt == null || that.amt == '') {
if(checkRes.data.data === true){ uni.showModal({
const withdrawParam = { content: '请输入提现金额!',
creatorId: that.userInfo.id, showCancel: false
amt: that.amt, });
accountNo: that.accountRealNo, }
channel: that.type if (that.checkFlag == true) {
} //console.log('that.checkFlag',that.checkFlag)
console.log('withdrawParam',withdrawParam) uni.showModal({
const withdrawRes = await withdraw(withdrawParam); content: '输入金额超过或少于可提现余额!',
if(withdrawRes.data.code === 200){ showCancel: false
// });
const creatorInfo = await getCreatorInfo(that.userInfo.id); } else {
console.log('creatorInfo',creatorInfo) //
if(creatorInfo.data.code === 200){ const param = {
uni.setStorage({ creatorId: that.userInfo.id,
key: 'userInfo', amt: that.amt
data: creatorInfo.data.data, }
success() { const checkRes = await checkWithdraw(param);
uni.showModal({ if (checkRes.data.code === 200) {
title: '提示', //true
content: '发起提现成功,请等待审核!', if (checkRes.data.data === true) {
showCancel: false, const withdrawParam = {
success() { creatorId: that.userInfo.id,
uni.reLaunch({ amt: that.amt,
url: '/pages-userInfo/withdraw/withdrawIndex' accountNo: that.accountRealNo,
}); channel: that.type
} }
}); console.log('withdrawParam', withdrawParam)
} const withdrawRes = await withdraw(withdrawParam);
}) if (withdrawRes.data.code === 200) {
}else{ //
uni.showModal({ const creatorInfo = await getCreatorInfo(that.userInfo.id);
content: '获取艺术家信息失败!', console.log('creatorInfo', creatorInfo)
showCancel: false if (creatorInfo.data.code === 200) {
}); uni.setStorage({
} key: 'userInfo',
data: creatorInfo.data.data,
success() {
}else{ uni.showModal({
uni.showModal({ title: '提示',
content: '发起提现申请失败!', content: '发起提现成功,请等待审核!',
showCancel: false showCancel: false,
}); success() {
} uni.reLaunch({
}else{ url: '/pages-userInfo/withdraw/withdrawIndex'
// });
uni.showModal({ }
content: '输入金额超过或少于可提现余额!', });
showCancel: false }
}); })
} } else {
}else{ uni.showModal({
uni.showModal({ content: '获取艺术家信息失败!',
content: '检查艺术家是否可提现失败!', showCancel: false
showCancel: false });
}); }
}
// await checkWithdraw(param).then(res =>{ } else {
// if(res.data.code === 200){ uni.showModal({
// if(res.data.data === true){ content: '发起提现申请失败!',
// // showCancel: false
// const withdrawParam = { });
// creatorId: that.userInfo.id, }
// amt: that.amt, } else {
// accountNo: that.accountNo, //
// channel: that.type uni.showModal({
// } content: '输入金额超过或少于可提现余额!',
// await withdraw(withdrawParam).then(resp =>{ showCancel: false
// if(res.data.code === 200){ });
// uni.showToast({ }
// title: ',!', } else {
// duration: 2000, uni.showModal({
// success() { content: '检查艺术家是否可提现失败!',
// uni.reLaunch({ showCancel: false
// url: '/pages-userInfo/withdraw/withdrawIndex' });
// }); }
// }
// }); // await checkWithdraw(param).then(res =>{
// }else{ // if(res.data.code === 200){
// uni.showModal({ // if(res.data.data === true){
// content: '', // //
// showCancel: false // const withdrawParam = {
// }); // creatorId: that.userInfo.id,
// } // amt: that.amt,
// }) // accountNo: that.accountNo,
// }else{ // channel: that.type
// // // }
// uni.showModal({ // await withdraw(withdrawParam).then(resp =>{
// content: '', // if(res.data.code === 200){
// showCancel: false // uni.showToast({
// }); // title: ',!',
// } // duration: 2000,
// }else{ // success() {
// uni.showModal({ // uni.reLaunch({
// content: '', // url: '/pages-userInfo/withdraw/withdrawIndex'
// showCancel: false // });
// }); // }
// } // });
// }) // }else{
} // uni.showModal({
} // content: '',
} // showCancel: false
} // });
</script> // }
// })
<style lang="scss" scoped> // }else{
.page-bg { // //
// uni.showModal({
.main-container { // content: '',
width: 670rpx; // showCancel: false
margin: 0 auto; // });
display: flex; // }
flex-direction: column; // }else{
margin-top: 36rpx; // uni.showModal({
// content: '',
} // showCancel: false
// });
} // }
.withdraw-input-box{ // })
width: 590rpx; }
padding: 40rpx; }
background: $uni-bg-base-color; }
border-radius: 10rpx; }
} </script>
.withdraw-title{
font-size: 28rpx; <style lang="scss" scoped>
font-weight: 400; .page-bg {
color: $uni-white;
} .main-container {
.withdraw-amount{ width: 670rpx;
font-size: 28rpx; margin: 0 auto;
font-weight: 400; display: flex;
color: $uni-secondary-color; flex-direction: column;
margin-top: 18rpx; margin-top: 36rpx;
display: flex;
justify-content: space-between; }
.all-withdraw { }
color: $uni-primary;
} .withdraw-input-box {
} width: 590rpx;
.withdraw-amount-tip{ padding: 40rpx;
font-size: 28rpx; background: $uni-bg-base-color;
font-weight: 400; border-radius: 10rpx;
color: $uni-white; }
margin-top: 18rpx;
} .withdraw-title {
font-size: 28rpx;
.input-box { font-weight: 400;
height: 100rpx; color: $uni-white;
width: 590rpx; }
display: flex;
justify-content: space-between; .withdraw-amount {
align-items: center; font-size: 28rpx;
font-size: 60rpx; font-weight: 400;
font-weight: bold; color: $uni-secondary-color;
color: $uni-white; margin-top: 18rpx;
opacity: 1; display: flex;
border-bottom: 2rpx solid $uni-secondary-color;; justify-content: space-between;
}
.input-box .input-value { .all-withdraw {
flex: 1 auto; color: $uni-primary;
margin-left: 10rpx; }
height: 80rpx; }
}
.withdraw-amount-tip {
.tl-flex-row{ font-size: 28rpx;
display: flex; font-weight: 400;
justify-content: space-around; color: $uni-white;
align-items: center; margin-top: 18rpx;
flex-wrap: wrap; }
text-align: center;
} .input-box {
.withdraw-account-list{ height: 100rpx;
width: 590rpx; width: 590rpx;
padding: 40rpx; display: flex;
background: $uni-bg-base-color; justify-content: space-between;
border-radius: 10rpx; align-items: center;
} font-size: 60rpx;
.tl-title-margin{ font-weight: bold;
margin: 20rpx 0; color: $uni-white;
} opacity: 1;
border-bottom: 2rpx solid $uni-secondary-color;
.error-message{ ;
font-size: 26rpx; }
font-weight: 400;
color: #E04646; .input-box .input-value {
margin: 20rpx 0 0; flex: 1 auto;
} margin-left: 10rpx;
height: 80rpx;
}
.tl-text{
width: 450rpx; .tl-flex-row {
display: -webkit-box; /*弹性伸缩盒子模型显示*/ display: flex;
-webkit-box-orient: vertical; /*排列方式*/ justify-content: space-around;
-webkit-line-clamp: 1; /*显示文本行数(这里控制多少行隐藏)*/ align-items: center;
overflow: hidden; /*溢出隐藏*/ flex-wrap: wrap;
} text-align: center;
}
.withdrawBox{
display: flex; .withdraw-account-list {
justify-content: space-between; width: 590rpx;
align-items: center; padding: 40rpx;
margin: 20rpx 0; background: $uni-bg-base-color;
border-radius: 10rpx;
.withdrawBox-title { }
display: flex;
align-items: center; .tl-title-margin {
line-height: 48rpx; margin: 20rpx 0;
} }
.account-icon { .error-message {
height: 48rpx; font-size: 26rpx;
width: 48rpx; font-weight: 400;
text-align: center; color: #E04646;
margin-right: 20rpx; margin: 20rpx 0 0;
} }
.account-title {
font-size: 26rpx; .tl-text {
color: $uni-white; width: 450rpx;
display: -webkit-box;
} /*弹性伸缩盒子模型显示*/
} -webkit-box-orient: vertical;
/*排列方式*/
.tl-footer{ -webkit-line-clamp: 1;
margin-top: 120rpx; /*显示文本行数(这里控制多少行隐藏)*/
} overflow: hidden;
/*溢出隐藏*/
.withdraw-btn { }
color: $uni-btn-text-color;
} .withdrawBox {
display: flex;
justify-content: space-between;
align-items: center;
margin: 20rpx 0;
.withdrawBox-title {
display: flex;
align-items: center;
line-height: 48rpx;
}
.account-icon {
height: 48rpx;
width: 48rpx;
text-align: center;
margin-right: 20rpx;
}
.account-title {
font-size: 26rpx;
color: $uni-white;
}
}
.tl-footer {
margin-top: 120rpx;
}
.withdraw-btn {
color: $uni-btn-text-color;
}
</style> </style>

20
pages/index/upload/upload.vue

@ -205,11 +205,13 @@
}, },
// //
selectHandler(e){ selectHandler(e){
console.log(e,1111)
if (!e.tempFiles) { if (!e.tempFiles) {
return; return;
} }
let that = this; let that = this;
that.fileList = [...that.fileList, ...e.tempFilePaths]; that.fileList = [...that.fileList, ...e.tempFilePaths];
console.log(that.fileList,333)
// //
if(that.uploadedNum >= 50){ if(that.uploadedNum >= 50){
uni.showModal({ uni.showModal({
@ -251,17 +253,19 @@
title: "上传中" title: "上传中"
}); });
const tempFilePaths = e; const tempFilePaths = e;
console.log(tempFilePaths,111)
for (var i = 0; i < tempFilePaths.length; i++) { for (var i = 0; i < tempFilePaths.length; i++) {
//const tempFile = e.tempFiles[i]; //const tempFile = e.tempFiles[i];
const [error, res] = await uni.uploadFile({ const [error, res] = await uni.uploadFile({
url: `${that.$baseURL}${that.$uploadURL}`, url: `${that.$baseURL}${that.$uploadURL}`,
name: `${that.$uploadType}`, filePath: tempFilePaths[i],
// url: 'http://pc2zer.natappfree.cc/file/uploadBatch', name: `files`,
// name: 'files', formData: {
fileType:that.typeCurrent + 1
},
header:{ header:{
"Content-Type": "multipart/form-data" "Content-Type": "multipart/form-data",
}, },
filePath: tempFilePaths[i],
// success:(uploadFileRes) => { // success:(uploadFileRes) => {
// // uni.hideLoading(); // // uni.hideLoading();
// const back = JSON.parse(uploadFileRes.data); // const back = JSON.parse(uploadFileRes.data);
@ -279,9 +283,9 @@
// uni.hideLoading(); // uni.hideLoading();
// } // }
}); });
const back = JSON.parse(res.data); const {data,code} = JSON.parse(res.data);
if (back.code == 200) { if (code == 200) {
that.imgList.push(back.data); that.imgList.push(data[0])
} }
} }

Loading…
Cancel
Save