157 lines
3.9 KiB
Plaintext
157 lines
3.9 KiB
Plaintext
<template>
|
|
<view style=" padding: 30rpx 40rpx; background-color: #fff; ">
|
|
<view class="" style="font-size: 32rpx; font-weight: bold;">
|
|
收款人<text style="color: red;">*</text>
|
|
</view>
|
|
<view class="" style="margin-bottom: 20rpx;">
|
|
<up-input v-model="name" :customStyle="{'padding':'12rpx 0','height':'100rpx'}" fontSize='18'
|
|
placeholder="请输入真实姓名" border="bottom"></up-input>
|
|
</view>
|
|
<view class="" style="font-size: 32rpx; font-weight: bold;">
|
|
提现积分
|
|
</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; ">
|
|
当前积分 {{ userData.integral }}
|
|
</view>
|
|
</view>
|
|
|
|
<view class="action-buttons">
|
|
<u-button type="primary" @click="save" :custom-style="contactButtonStyle">立即提现</u-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: '75rpx',
|
|
borderRadius: '45rpx',
|
|
marginRight: '20rpx'
|
|
});
|
|
|
|
onLoad(() => {
|
|
getData()
|
|
});
|
|
|
|
onShow(() => {
|
|
|
|
});
|
|
|
|
|
|
const getData = () => {
|
|
vpMerchService.GetMerchAccInfo(1).then(res => {
|
|
if (res.code == 0) {
|
|
userData.value = res.data.merchAcc
|
|
} else {
|
|
Service.Msg(res.msg)
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
const save = () => {
|
|
if(!name.value ){
|
|
Service.Msg('请输入收款人姓名')
|
|
return
|
|
}
|
|
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, name.value).then(wxres => {
|
|
Service.LoadClose()
|
|
if (wxres.code == 0) {
|
|
if (wx.canIUse('requestMerchantTransfer')) {
|
|
wx.requestMerchantTransfer({
|
|
mchId: wxres.data.mchId,
|
|
appId: wxres.data.appId,
|
|
package: wxres.data.packInfo,
|
|
success: () => {
|
|
Service.Msg('提现成功!')
|
|
setTimeout(()=>{
|
|
Service.GoPageBack()
|
|
},1000)
|
|
},
|
|
fail: (res) => {
|
|
console.log('fail:', res);
|
|
},
|
|
});
|
|
} else {
|
|
wx.showModal({
|
|
content: '你的微信版本过低,请更新至最新版本。',
|
|
showCancel: false,
|
|
});
|
|
}
|
|
} else {
|
|
Service.Msg(wxres.msg)
|
|
}
|
|
})
|
|
} else {
|
|
Service.Msg(content.msg)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #f6f6f6;
|
|
}
|
|
|
|
.action-buttons {
|
|
display: flex;
|
|
padding: 30rpx 30rpx;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
background-color: #ffffff;
|
|
border-top: 1rpx solid #f0f0f0;
|
|
}
|
|
</style> |