doum
12 小时以前 4d1b99c033d27af5a83d8df7da5568dc3dcfbfc7
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 ">暂无银行信息,点击添加</text>
                  <text v-if="selectBank && selectBank.id  ">{{selectBank.name}}</text>
                  <u-icon name="arrow-right" color="#999999" size="16"></u-icon>
               </view>
            </view>
@@ -18,8 +19,8 @@
            <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" />
               <view class="form-input-tx" @click="inputAll">全部提现</view>
            </view>
            <view class="form-error">输入的金额已经超过可提现金额</view>
            <view class="form-btn disable">提交申请</view>
@@ -29,11 +30,69 @@
</template>
<script>
   import { mapState } from 'vuex'
   export default {
      computed: {
         ...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
      },
      data() {
         return {
            bankList:[],
            selectBank:[],
            id:null,
            form{
               amount:0
            },
            shop:{},
            info:{}
         };
      },
      onLoad(options) {
         this.id = options.id
         this.info={}
         this.shop  ={}
         this.bankList = []
         this.selectBank=[]
         this.checkShopLogin()
         this.shop = this.shopInfo || {}
         this.getBankList()
      },
      methods:{
         inputAll(){
            this.form.amount = this.shop.amount ||0
         },
         jumpBank( ){
            if(this.selectBank  && this.selectBank.id){
               uni.navigateTo({
                  url: '/pagesA/pages/withdraw-select/withdraw-select?id='+id
               })
            }else{
               url: '/pagesA/pages/withdraw-select/withdraw-select'
            }
         },
         async getBankList(){
            let res = await that.$u.api.getShopInfo({tokenType:1  })
            if (res.code === 200) {
               await that.$store.commit('setShopInfo', res.data)
               this.shop = res.data || {}
            }
         },
         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>