From a690229b69cfa0aba5a0352772c2bdc1cf9fdab0 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 25 二月 2026 18:41:12 +0800
Subject: [PATCH] 调试
---
mini-program/pagesA/pages/withdraw/withdraw.vue | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 158 insertions(+), 11 deletions(-)
diff --git a/mini-program/pagesA/pages/withdraw/withdraw.vue b/mini-program/pagesA/pages/withdraw/withdraw.vue
index edd8dd0..4e83961 100644
--- a/mini-program/pagesA/pages/withdraw/withdraw.vue
+++ b/mini-program/pagesA/pages/withdraw/withdraw.vue
@@ -3,14 +3,15 @@
<view class="bg">
<view class="bg-a">鍙彁鐜颁綑棰�(鍏�)</view>
<view class="bg-b">
- <text>1000</text>
- <text>.00</text>
+ <text>{{(shop.amount || 0).toFixed(2)}}</text>
+ <text></text>
</view>
<view class="form">
<view class="form-a">
<view class="form-a-label">鎻愮幇鑷�</view>
- <view class="form-a-val">
- <text>鏆傛棤閾惰淇℃伅锛岀偣鍑绘坊鍔�</text>
+ <view class="form-a-val" @click="jumpBank" >
+ <text v-if="!selectBank || !selectBank.id " class="text-grey">鏆傛棤閾惰淇℃伅锛岀偣鍑绘坊鍔�</text>
+ <text v-if="selectBank && selectBank.id ">{{selectBank.bankInfo || ''}}</text>
<u-icon name="arrow-right" color="#999999" size="16"></u-icon>
</view>
</view>
@@ -18,22 +19,165 @@
<view class="form-title">鎻愮幇閲戦</view>
<view class="form-input">
<view class="form-input-dw">锟�</view>
- <input type="text" placeholder="0" />
- <view class="form-input-tx">鍏ㄩ儴鎻愮幇</view>
+ <input type="text" placeholder="0" v-model="form.amount" :focus='focus' @blur="focus=false"/>
+ <view class="form-input-tx" @click="inputAll">鍏ㄩ儴鎻愮幇</view>
</view>
- <view class="form-error">杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦</view>
- <view class="form-btn disable">鎻愪氦鐢宠</view>
+ <view class="form-error">{{tips}}</view>
+ <view class="form-btn disable" v-if="!validForm">鎻愪氦鐢宠</view>
+ <view class="form-btn" v-if="validForm" @click="confirm()">鎻愪氦鐢宠</view>
</view>
</view>
+ <u-popup :show="show" round="15" :safeAreaInsetBottom="false" mode="center">
+ <view class="tc">
+ <view class="tc-contemt">
+ <view class="tc-contemt-title">鎿嶄綔鎻愮ず</view>
+ <view class="tc-contemt-nr">
+ 鎮ㄧ‘璁ゅ彂璧锋娆℃彁鐜扮敵璇峰悧锛�
+ </view>
+ </view>
+ <view class="tc-btn">
+ <view class="tc-btn-item" @click="confirm() ">鎴戝啀鎯虫兂</view>
+ <view class="tc-btn-item" style="color: #004096;" @click="applyDo">纭</view>
+ </view>
+ </view>
+ </u-popup>
</view>
</template>
<script>
+ import { mapState } from 'vuex'
export default {
+ computed: {
+ ...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken']),
+ validForm() {
+ this.tips =''
+ if(! this.selectBank || !this.selectBank.id){
+ this.tips ='璇峰厛閫夋嫨鎮ㄩ渶瑕佹彁鐜扮殑閾惰璐︽埛淇℃伅'
+ return false
+ }
+ this.form.bankId = this.selectBank.id
+ if(!this.form.amount ||this.form.amount <=0){
+ this.tips ='璇疯緭鍏ユ彁鐜伴噾棰�'
+ this.focus=true
+ return false
+ }
+ if(this.form.amount >( this.shop.amount||0)){
+ this.tips ='杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦'
+ this.focus=true
+ return false
+ }
+ return true
+ }
+ },
data() {
- return {
+ return {
+ show:false,
+ tips:'',
+ focus:false,
+ valid:false,
+ bankList:[],
+ selectBank:[],
+ form: { amount:null,bankId:null},
+ shop:{},
+ info:{}
+ }
+ },
+ onLoad(options) {
+ this.info={}
+ this.tips=''
+ this.shop ={}
+ this.bankList = []
+ this.show=false
+ this.focus=false
+ this.selectBank={}
+ this.checkShopLogin()
+ this.shop = this.shopInfo || {}
+ this.getBankList()
+ var that =this
+ uni.$on('selectBank',function(data){
+ console.log('鐩戝惉鍒颁簨浠舵潵鑷� selectBank锛�' ,data);
+ that.selectBank = data.info
+ })
+ },
+ methods:{
+ confirm(){
+ this.tips = '';
+ if(! this.selectBank || !this.selectBank.id){
+ this.tips ='璇峰厛閫夋嫨鎮ㄩ渶瑕佹彁鐜扮殑閾惰璐︽埛淇℃伅'
+ return
+ }
+ this.form.bankId = this.selectBank.id
+ if(!this.form.amount){
+ this.tips ='璇疯緭鍏ユ纭殑鎻愮幇閲戦'
+ this.focus=true
+ return
+ }
+ if(this.form.amount >( this.shop.amount||0)){
+ this.tips ='杈撳叆鐨勯噾棰濆凡缁忚秴杩囧彲鎻愮幇閲戦'
+ this.focus=true
+ return
+ }
+ this.show = !this.show
+ },
+ applyDo(){
+ var that =this
+ this.$u.api.withdrawApply(this.form)
+ .then(res => {
+ if (res.code === 200) {
+ uni.showToast({
+ title:'鎿嶄綔鎴愬姛',
+ icon:'success'
+ })
+ uni.$emit('accountListReload',{})
+ uni.redirectTo({url:"/pagesA/pages/withdraw-success/withdraw-success?id="+res.data})
+ }
+ }).catch(e=>{
+ uni.showToast({
+ title:'鎿嶄綔澶辫触',
+ icon:'error'
+ })
+ })
+ },
+ inputAll(){
+ this.form.amount = this.shop.amount ||0
+ },
+ jumpBank(){
+ if(this.selectBank && this.selectBank.id){
+ uni.navigateTo({
+ url: '/pagesA/pages/withdraw-select/withdraw-select?item='+JSON.stringify(this.selectBank)
+ })
+ }else{
+ uni.navigateTo({
+ url: '/pagesA/pages/withdraw-select/withdraw-select'
+ })
+ }
+ },
+ async getBankList(){
+ var that =this
+ let res = await that.$u.api.getBankList({tokenType:1 })
+ if (res.code === 200) {
+ that.bankList = res.data || []
+ if(that.bankList.length>0){
+ that.selectBank = that.bankList[0]
+ }
+ }
- };
+ },
+ async checkShopLogin(){
+ var that =this
+ if( this.shopInfo ==null || this.shopInfo.id==null || this.shopToken==null || this.shopToken==''){
+ uni.navigateTo({
+ url: '/pages/login/login'
+ })
+ }else{
+ let res = await that.$u.api.getShopInfo({tokenType:1 })
+ if (res.code === 200) {
+ await that.$store.commit('setShopInfo', res.data)
+ this.shop = res.data || {}
+ }
+ }
+
+ }
}
}
</script>
@@ -101,9 +245,12 @@
text {
font-weight: 400;
font-size: 28rpx;
- color: #999999;
margin-right: 20rpx;
}
+ .text-grey {
+ color: #999999;
+ }
+
}
}
.form-xian {
--
Gitblit v1.9.3