You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xxdj1/user/pages/cash-out.vue

226 lines
5.7 KiB

2 years ago
<template>
<view class="technician-income-cash-out" v-if="isLoad">
2 years ago
<view class="mt-md ml-lg mr-lg f-paragraph fill-base section" style="overflow: hidden;">
<view class="fill-space b-1px-b" style="padding:40rpx 30rpx">
<view class="flex-between">
<view style="font-size: 30rpx;font-family: PingFang SC;font-weight: 500;color: #333333;">备注</view>
2 years ago
<input v-model="text" class="flex-1 f-paragraph ml-md" type="text" placeholder="请输入到账信息" />
</view>
</view>
<view class="pd-lg">
2 years ago
<view style="font-size: 30rpx;font-weight: 500;color: #999999;">提现金额</view>
<view class="flex-y-center b-1px-b" style="padding:50rpx 0">
2 years ago
<view class="text-bold">¥</view>
<input v-on:input="checkInput($event,'apply_price')" v-model="apply_price"
class="flex-1 f-paragraph ml-sm" type="digit" placeholder="请输入提现金额" />
</view>
2 years ago
<view @tap.stop="withAll" class="f-caption c-caption pt-md" style="display:flex;justify-content: space-between;">
<view class="">
<text>可提现余额</text>
<text style="font-size:30rpx;color:#08BF77">{{cash}}</text>
2 years ago
</view>
2 years ago
<view style="font-size: 30rpx;font-weight: 500;color: #08BF77;">全部提现</view>
2 years ago
</view>
<view class="flex-y-center f-caption c-caption pt-sm">最低提现额度<view class="ml-md c-warning">
2 years ago
<text style="font-size:30rpx;color:#08BF77">{{configInfo.cash_mini || 0}}</text>
2 years ago
</view>
</view>
<view class="space-lg"></view>
<view class="space-lg"></view>
2 years ago
2 years ago
<!-- <view class="flex-center f-caption c-caption mt-md" v-if="options.type == 'technician'">
每笔订单收取{{balance}}%手续费</view> -->
</view>
</view>
2 years ago
<view @tap.stop="submit" class="cash-out-btn flex-center f-title c-base radius-16"
:style="{background:primaryColor}">确认提现</view>
2 years ago
</view>
</template>
<script>
import {
mapState,
mapActions
} from "vuex"
export default {
components: {},
data() {
return {
options: {},
isLoad: false,
detail: {},
balance: '',
cash: '',
apply_price: '',
text: '',
type: 1,
lockTap: false,
}
},
computed: mapState({
primaryColor: state => state.config.configInfo.primaryColor,
subColor: state => state.config.configInfo.subColor,
configInfo: state => state.config.configInfo,
userInfo: state => state.user.userInfo,
}),
async onLoad(options) {
this.$util.showLoading()
this.options = options
await this.initIndex()
},
methods: {
...mapActions(['getConfigInfo']),
async initIndex(refresh = false) {
// #ifdef H5
2 years ago
if (!refresh && this.$jweixin.isWechat()) {
await this.$jweixin.initJssdk();
this.$jweixin.wxReady(() => {
this.$jweixin.hideOptionMenu()
})
}
2 years ago
// #endif
if (!this.configInfo.id) {
await this.getConfigInfo()
}
let {
type
} = this.options
// type technician 技师;carfee 车费;distribution 分销商
switch (type) {
case 'technician':
let {
detail
} = await this.$util.getPage(-1)
let {
cap_cash
} = detail
let {
balance
} = detail.coach_level
this.balance = 100 - balance
this.cash = cap_cash
break
case 'carfee':
let {
car_price
} = this.$util.getPage(-1).coach_info
this.cash = car_price
break
case 'distribution':
let {
new_cash
} = await this.$util.getPage(-1).detail
this.cash = new_cash
break
}
this.$util.setNavigationBarColor({
bg: this.primaryColor
})
this.$util.hideAll()
this.isLoad = true
},
initRefresh() {
this.initIndex(true)
},
withAll() {
this.apply_price = this.cash
},
checkInput(e, key) {
let val = this.$util.formatMoney(e.detail.value)
this.$nextTick(() => {
this[key] = val
})
},
async submit() {
if (this.apply_price == '0.0') {
this.$nextTick(() => {
this.apply_price = '0'
})
}
let {
cash,
apply_price,
text,
} = this
let {
cash_mini
} = this.configInfo
text = text ? text.replace(/(^\s*)|(\s*$)/g, "") : ''
if (!text || !apply_price) {
this.$util.showToast({
title: !text ? `请输入到账信息` : `请输入提现金额`
})
return
}
if (parseFloat(apply_price) < parseFloat(cash_mini)) {
this.$util.showToast({
title: `提现金额不能低于最低提现金额${cash_mini}`
})
return
}
if (parseFloat(apply_price) > parseFloat(cash)) {
this.$util.showToast({
title: `提现金额不能大于可提现金额${cash}`
})
return
}
if (this.lockTap) return
this.lockTap = true
this.$util.showLoading()
try {
let {
type
} = this.options
let methodModel = type == 'distribution' ? 'mine' : 'technician'
await this.$api[methodModel].applyWallet(type == 'distribution' ? {
apply_price,
text
} : {
apply_price,
text,
type: type == 'technician' ? 1 : 2
})
this.$util.hideAll()
this.$util.showToast({
title: `提交成功`,
});
setTimeout(() => {
this.$util.back()
this.$util.goUrl({
url: 1,
openType: 'navigateBack'
})
}, 1000)
} catch (e) {
setTimeout(() => {
this.lockTap = false
this.$util.hideAll()
}, 2000)
}
}
}
}
</script>
<style lang="scss">
.technician-income-cash-out {
.cash-out-btn {
2 years ago
// width: 622rpx;
// height: 88rpx;
width:84%;
text-align: center;
padding:31rpx 0;
2 years ago
margin: 0 auto;
2 years ago
margin-top:60rpx;
background: #08BF77;
border-radius: 45px;
2 years ago
}
}
2 years ago
.section{
border-radius:30rpx;
}
2 years ago
</style>