123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- <template>
- <view class="box">
- <view class="tixiancs">
- <view class="tixiancsLeft"></view>
- <view class="tixiancsRight" @click="goRouter('../referral/extractList?type=2')">提现明细</view>
- </view>
- <view class="header">
- <view class="title">提现金额</view>
- <view class="moneyView">
- <text class="icon">¥</text>
- <input type="digit" class="moneyInput" placeholder-style="color:#999999; font-size:30rpx"
- v-model="money" @input="inputValue" />
- <view class="allBtn" @click="allBtn">全部提现</view>
- </view>
- <view class="zongMoney">可提现金额: <span style="padding: 0 10rpx;">{{canMoney.toFixed(2)}} 元 </span> </view>
-
- </view>
- <view class="sureBtn" @click="sure">申请提现</view>
- <view class="tishi" style="padding:20rpx 20rpx 100rpx 20rpx ; ">
- <view class="tishi-title" style="color: #999999;padding-left: 18rpx;">
- 提现说明:
- </view>
- <rich-text class="tishiText" :nodes="description"></rich-text>
- <!-- <view class="tishiLine">
- <view class="tishiTxt">1.最小提现金额:<span class="tishiTxtColor">{{minCash}}</span>元</view>
- </view>
- <view class="tishiLine">
- <view class="tishiTxt">2.只允许一笔提现在途</view>
- </view> -->
- <!-- <view class="tishiLine">
- <view class="tishiTxt">1.提现冻结天数:<span class="tishiTxtColor">{{detail.explain&&detail.explain.freezeDay}}</span>天</view>
- </view>
- <view class="tishiLine">
- <view class="tishiTxt">2.最小提现金额:<span class="tishiTxtColor">{{detail.explain&&detail.explain.singleLow}}</span>元</view>
- </view>
- <view class="tishiLine">
- <view class="tishiTxt">3.每月可提现次数:<span class="tishiTxtColor">{{detail.explain&&detail.explain.monthlyMost}}</span>次</view>
- </view> -->
- </view>
-
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- okMoney: '',
- money: 0,
- name: '',
- account: '',
- detail: {},
- alreadyMoney: 0,
- canMoney: 0,
- inMoney: 0,
- sumMoney: 0,
- minCash: 0.1,
- couContent: '', //提现规则
- cashState:null,
- timer :null,
- appId:'',
- mchId:'',
- outBatchNo:'',
- packageInfo:'',
- state:'',
- jkcashid:'',
- maxCash:0,
- description:'',
- }
- },
- onLoad() {
- this.getDetailData()
- },
- methods: {
- goRouter(url){
- uni.navigateTo({
- url:url
- })
- },
- getDetailData() {
- uni.showLoading({
- title: '加载中'
- })
-
- this.$http('jkCashout/getCashoutData', {}, 'GET').then(res => {
- uni.hideLoading();
- this.alreadyMoney = res.data.AlreadyMoney
- this.canMoney = res.data.CanMoney
- this.inMoney = res.data.InMoney
- this.sumMoney = res.data.SumMoney
- this.minCash = res.data.MinCash
- this.cashState = res.data.CashState
- this.maxCash = res.data.MaxCash
- this.description = res.data.description
- })
- },
- inputValue(event) {
- if (event.detail.value < 0) {
- setTimeout(() => {
- this.money = 0; // 解决
- }, 0)
- } else {
- this.money = event.detail.value;
- }
- },
- allBtn() {
- setTimeout(() => {
- this.money = this.canMoney; // 解决
- }, 0)
- },
- sure() {
- if (this.money > this.canMoney) {
- uni.showToast({
- title: '提现金额不能大于可提现金额',
- icon: 'none',
- duration: 3000,
- });
- return;
- }
- if (this.money <= 0) {
- uni.showToast({
- title: '提现金额不能为0',
- icon: 'none',
- duration: 3000,
- });
- return;
- }
- if (this.money < this.minCash) {
- uni.showToast({
- title: '提现金额最低为'+this.minCash,
- icon: 'none',
- duration: 3000,
- });
- return;
- }
- if (this.money > this.maxCash) {
- uni.showToast({
- title: '提现金额最高为'+this.maxCash,
- icon: 'none',
- duration: 3000,
- });
- return;
- }
- this.postData();
- },
- postData() {
- uni.showLoading({
- title: '提现申请中..'
- })
- let url = 'jkCashout/applyJkCashout',
- params = {
- money: this.money,
-
- }
- this.$http(url, params, 'POST').then(res => {
- //uni.hideLoading();
- console.log(res)
- if(res.code ==0){
- this.canMoney = this.canMoney - this.money
- }
- //人工审核
- if(res.code==0 && this.cashState==1){
- uni.showModal({
- title: '提交成功',
- content: '请耐心等待平台审核',
- showCancel:false,
- confirmText:'知道了',
- success: function(res) {
- uni.hideLoading();
- }
- });
- }else if(res.code==0 && this.cashState==0){
- //自动审核
- //轮询查询状态
- uni.showToast({
- title: '审核成功请等待..',
- icon: 'success',
- duration: 3000,
- });
- this.appId = res.data.appId
- this.mchId = res.data.mchId
- this.outBatchNo = res.data.outBatchNo
- this.packageInfo = res.data.packageInfo
- this.state = res.data.state
- this.jkcashid = res.data.jkcashid
- if(res.data.state =='WAIT_USER_CONFIRM'){
- this.getWechatMoney()
- }else{
- this.checkOrderStatus()
- }
- }else if(res.code==0 && this.cashState==2){
- //线下
- uni.showToast({
- title: '申请成功请等待平台审核',
- icon: 'success',
- duration: 3000,
- });
-
- }
- })
- },
- async checkOrderStatus() {
- try {
- this.$http('jkCashout/checkJkCashoutState', {
- outBatchNo:this.outBatchNo,
- jkcashid:this.jkcashid
- }, 'POST').then(res => {
- console.log(res);
- if(res.code == 0 && res.data.state =='WAIT_USER_CONFIRM'){
- uni.hideLoading();
- clearTimeout(this.timer);
- this.getWechatMoney();
- }
- else if(res.code == 0 && res.data.state =='SUCCESS'){
- //成功页面
- console.log("领取成功-跳转成功页面");
- clearTimeout(this.timer);
- this.goRouter('../subPack/extractSuccess?money='+this.money);
- }
- else if(res.code == 0 && res.data.state =='FAIL'){
- //失败页面
- console.log("领取失败-跳转失败页面");
- clearTimeout(this.timer);
- this.goRouter('../subPack/extractFail?money='+this.money)
- }else if(res.code == 1){
- clearTimeout(this.timer);
- }
- else{
- this.timer = setTimeout(this.checkOrderStatus, 2000);
- }
- })
- } catch (error) {
- console.error('查询订单状态失败:', error);
- // 出错时也继续轮询
- clearTimeout(this.timer);
- }
- },
- checkOrderStatusMounted() {
- this.checkOrderStatus(); // 立即执行第一次查询
- },
- beforeDestroy() {
- clearTimeout(this.timer);
- },
- getWechatMoney(){
- if (wx.canIUse('requestMerchantTransfer')) {
- wx.requestMerchantTransfer({
- mchId: this.mchId,
- appId: this.appId,
- package: this.packageInfo,
- success: (res) => {
- // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表付款成功
- console.log(res);
- if (res.errMsg === 'requestMerchantTransfer:ok') {
- this.checkOrderStatusMounted();
- }
-
- },
- fail: (res) => {
-
- }
- });
- }
- }
- }
- }
- </script>
- <style>
- .box {
- min-height: 100vh;
- background: #F4F5F7;
- padding-top: 20rpx;
- }
- .tishiLine{
- display: flex;padding-top: 20rpx;
- color: #999999;
- }
- .tishiY{
- width: 10rpx;
- height: 10rpx;
- background: #DDDDDD;
- margin-top: 16rpx;
- border-radius: 50%;
- }
- .tishiTxt{
- padding-left: 18rpx;
- color: #999999;
- }
- .tixiancs{
- display: flex;
- justify-content: space-between;
- font-size: 24rpx;
- padding-left: 24rpx;
- padding-right: 24rpx;
- padding-bottom: 20rpx;
- }
- .tixiancsLeft{
- color: #999999;
- }
- .tixiancsRight{
- color:#596999;
- }
- .tishiTxtColor{
- color: #999999;
- }
- .header {
- background-color: #FFFFFF;
- margin: 0 24rpx;
- border-radius: 10rpx;
- padding: 30rpx 20rpx;
-
- }
- .title {
- font-size: 28rpx;
- color: #3C3C3C;
-
- }
- .moneyView {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin: 15rpx 0;
- }
- .icon {
- font-size: 50rpx;
- color: #222222;
-
- }
- .moneyInput {
- font-size: 70rpx;
- color: #222222;
- /* flex-grow: 1; */
- height: 98rpx;
- width: 100%;
- }
- .allBtn {
- font-size: 30rpx;
- color: #596999;
- width: 200rpx;
- height: 50rpx;
- line-height: 50rpx;
- margin-left: 10rpx;
- text-align: right;
- }
- .zongMoney {
- font-size: 25rpx;
- color: #999999;
- border-top: solid 3rpx #F4F4F4;
- padding-top: 25rpx;
- }
- .line {
- background-color: #EEEEEE;
- height: 1rpx;
- }
- .name {
- display: flex;
- justify-content: flex-start;
- padding: 28rpx 0;
- }
- .leftTitle {
- font-size: 30rpx;
- color: #3C3C3C;
- margin-right: 90rpx;
- }
- .Input {
- font-size: 30rpx;
- color: #333333;
- }
- .tishi {
- padding: 0 44rpx;
- font-size: 26rpx;
- color: #999999;
- line-height: 1.5;
-
- }
- .sureBtn {
- width: 690rpx;
- margin: 20rpx 30rpx;
- border-radius: 15rpx;
- height: 74rpx;
- background: #EB0F0A;
- color: #FFFFFF;
- font-size: 25rpx;
- text-align: center;
- line-height: 74rpx;
- }
- </style>
|