235 lines
5.5 KiB
Plaintext
235 lines
5.5 KiB
Plaintext
<template>
|
|
<view style=" padding: 60rpx 40rpx 20rpx; ">
|
|
|
|
<view class="" style="font-size: 26rpx;">
|
|
提现金额
|
|
</view>
|
|
<view class="" style="margin-bottom: 20rpx;">
|
|
<up-input v-model="account" type="digit" :customStyle="{'padding':'12rpx 0','height':'100rpx'}"
|
|
fontSize='18' prefixIconStyle="font-size: 28px;color: #000;font-weight:bold" placeholder="请输入金额"
|
|
border="bottom" prefixIcon="rmb"></up-input>
|
|
</view>
|
|
<view class="" style="font-size: 26rpx; display: flex; align-items: center; ">
|
|
<view class="" style="color: #999; ">
|
|
当前剩余 {{ Number(userData.integral).toFixed(2) }} 元
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="" style="margin: 40rpx 20rpx; ">
|
|
<u-button type="primary" @click="save" :custom-style="contactButtonStyle">立即提现</u-button>
|
|
</view>
|
|
<view class="" style="margin: 20rpx; padding: 20rpx 30rpx; background-color: #f6f6f6; border-radius: 20rpx; ">
|
|
<view class="" style="font-weight: bold; font-size: 30rpx;">
|
|
提示
|
|
</view>
|
|
|
|
<view class="" style="font-size: 28rpx;">
|
|
<view class="" style="text-indent: 1em; margin-top: 10rpx; ">
|
|
1.单笔最小提现1元
|
|
</view>
|
|
<view class="" style="text-indent: 1em; margin-top: 10rpx; ">
|
|
2.单笔最多可提现200元
|
|
</view>
|
|
<view class="" style="text-indent: 1em; margin-top: 10rpx; ">
|
|
3.每次最多一次申请提现
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="" v-if="withLog!==null"
|
|
style="margin: 20rpx; padding: 20rpx 30rpx 30rpx; background-color: #f6f6f6; border-radius: 10rpx; ">
|
|
<view class="" style="font-weight: bold; font-size: 30rpx; display: flex; gap: 6rpx; ">
|
|
<img :src="Service.GetIconImg('/static/index/pay/light.png')" style="width: 40rpx; height: 40rpx;" alt="" />
|
|
待收款提醒
|
|
</view>
|
|
|
|
<view class="" style="font-size: 28rpx; margin: 20rpx 0; text-indent: 2em; ">
|
|
金额: {{ Number(withLog.amount).toFixed(2) }}
|
|
</view>
|
|
<view class="" style="font-size: 28rpx; margin: 20rpx 0; text-indent: 2em; ">
|
|
时间: {{ withLog.addTime }}
|
|
</view>
|
|
<view class=""
|
|
style=" display: flex; justify-content: flex-end; width: 100%; ">
|
|
|
|
<button @click="withdrow(withdrowData)" class="button-withdrow" style=" ">确认收款</button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { onShow, onLoad } from "@dcloudio/uni-app";
|
|
import { ref } from "vue";
|
|
import { Service, vpMerchService } from '@/Service/vp/vpMerchService'
|
|
import { vpLoginService } from '@/Service/vp/vpLoginService'
|
|
import { vpUserService } from '@/Service/vp/vpUserService'
|
|
|
|
let name = ref('')
|
|
let account = ref<number>()
|
|
let userData = ref({
|
|
integral: 0,
|
|
merchId: ''
|
|
})
|
|
// 按钮样式
|
|
const contactButtonStyle = ref({
|
|
backgroundColor: '#FF6600',
|
|
borderColor: '#FF6600',
|
|
color: '#FFFFFF',
|
|
fontSize: '28rpx',
|
|
height: '90rpx',
|
|
borderRadius: '45rpx',
|
|
marginRight: '20rpx'
|
|
});
|
|
|
|
|
|
let withdrowData = ref({
|
|
data:{
|
|
appId: '',
|
|
mchId: '',
|
|
packInfo: '',
|
|
withId:''
|
|
}
|
|
})
|
|
|
|
let withLog = ref<any>(null)
|
|
|
|
|
|
|
|
onLoad(() => {
|
|
getData()
|
|
});
|
|
|
|
onShow(() => {
|
|
|
|
});
|
|
|
|
|
|
const getData = () => {
|
|
vpMerchService.GetMerchAccInfo('', 1).then(res => {
|
|
if (res.code == 0) {
|
|
userData.value = res.data.merchAcc
|
|
withLog.value = res.data.withLog
|
|
withdrowData.value.data.mchId = res.data.mchId
|
|
withdrowData.value.data.appId = res.data.appId
|
|
withdrowData.value.data.packInfo = res.data.withLog.packInfo
|
|
withdrowData.value.data.withId=res.data.withLog.withId
|
|
} else {
|
|
Service.Msg(res.msg)
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
const save = () => {
|
|
if (account.value === 0 || !account.value) {
|
|
Service.Msg('请输入金额')
|
|
return
|
|
}
|
|
if (account.value < 1) {
|
|
Service.Msg('单笔最小提现1元')
|
|
return
|
|
}
|
|
if (account.value > 200) {
|
|
Service.Msg('单笔最多可提现200元')
|
|
return
|
|
}
|
|
|
|
|
|
Service.LoadIng('提现中')
|
|
uni.getProvider({
|
|
service: 'oauth',
|
|
success: function (res : any) {
|
|
uni.login({
|
|
onlyAuthorize: true,
|
|
provider: res.provider,
|
|
success: function (loginRes) {
|
|
vpLoginService.GetOpenIdByWeixin(loginRes.code, res.provider == 'weixin' ? 1 : 3).then(content => {
|
|
if (content.code == 0) {
|
|
vpUserService.WxWith(content.data, account.value, '').then(wxres => {
|
|
Service.LoadClose()
|
|
if (wxres.code == 0) {
|
|
withdrow(wxres)
|
|
} else {
|
|
Service.Msg(wxres.msg)
|
|
}
|
|
})
|
|
} else {
|
|
Service.Msg(content.msg)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
const withdrow = (wxres) => {
|
|
if (wx.canIUse('requestMerchantTransfer')) {
|
|
wx.requestMerchantTransfer({
|
|
mchId: wxres.data.mchId,
|
|
appId: wxres.data.appId,
|
|
package: wxres.data.packInfo,
|
|
success: () => {
|
|
vpUserService.UpdateWith(wxres.data.withId).then(withdrow => {
|
|
|
|
})
|
|
|
|
Service.Msg('提现成功!')
|
|
setTimeout(() => {
|
|
Service.GoPageBack()
|
|
}, 1000)
|
|
},
|
|
fail: (res) => {
|
|
console.log('fail:', res);
|
|
},
|
|
});
|
|
} else {
|
|
wx.showModal({
|
|
content: '你的微信版本过低,请更新至最新版本。',
|
|
showCancel: false,
|
|
});
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #fff;
|
|
}
|
|
|
|
.action-buttons {
|
|
display: flex;
|
|
padding: 30rpx 30rpx;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
background-color: #ffffff;
|
|
border-top: 1rpx solid #f0f0f0;
|
|
}
|
|
|
|
|
|
.button-withdrow {
|
|
width: 36%;
|
|
color: #fff;
|
|
background-color: var(--nav-mian);
|
|
border-color: #f6f6f6;
|
|
border-radius: 16rpx;
|
|
font-size: 24rpx;
|
|
margin: 0;
|
|
}
|
|
|
|
.button-withdrow::after {
|
|
border: none;
|
|
}
|
|
</style> |