MrShi
23 小时以前 9fb9e0b5b7c2664552f06a683fe1204525d8fd4e
mini-program/pagesA/pages/my-membership/my-membership.vue
@@ -4,56 +4,148 @@
         <u-search
            placeholder="搜索会员昵称/手机号"
            :showAction="false"
            @search="getFirstPageData()"
            bgColor="#F8F9FB"
            placeholderColor="#999999"
            searchIconSize="28"
            height="36"
            v-model="keyword" />
            v-model="memberInfo" />
         <view class="head-cate">
            <view class="head-cate-item">
               <text class="num">5,323</text>
               <text class="num">{{totalAll}}</text>
               <text class="title">会员总数</text>
            </view>
            <view class="head-cate-item">
               <text class="num">3,289</text>
               <text class="num">{{countData.orderNum||0}}</text>
               <text class="title">订单总数</text>
            </view>
            <view class="head-cate-item">
               <view class="price">
                  <text>5,323</text>
                  <text>.00</text>
                  <text>{{countData.saleTotalNum||0}}</text>
                  <text>{{countData.saleTotalFloat||'.00'}}</text>
               </view>
               <text class="title">订单金额</text>
            </view>
         </view>
      </view>
      <view class="list">
         <view class="list-item">
         <view class="list-item" v-for="(item,index) in dataList">
            <view class="tx">
               <image src="/static/logo.png" mode="widthFix"></image>
               <image :src="item.imgFullUrl?item.imgFullUrl:'/static/icon/defualt.png'" mode="widthFix"></image>
            </view>
            <view class="info">
               <view class="info-a">
                  <text>李婷平</text>
                  <text>1815****5556</text>
                  <text>{{item.name || item.nickname || ''}}</text>
                  <text>{{item.phone || ''}}</text>
               </view>
               <view class="info-date">关联时间:2024-04-18 19:29:01</view>
               <view class="info-num">
               <view class="info-date">关联时间:{{item.bindShopDate || ''}}</view>
                <!-- <view class="info-num">
                  <text>订单量:3</text>
                  <text>订单金额:¥3678.00</text>
               </view>
               </view> -->
            </view>
         </view>
         <view v-if="!hasNext" class="nomore">已加载全部</view>
      </view>
   </view>
</template>
<script>
   import { mapState } from 'vuex'
   export default {
      computed: {
         ...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
      },
      data() {
         return {
            memberInfo:'',
            shop:{},
            currentPage:1,
            totalAll:0,
            total:0,
            hasNext:true,
            dataList:[],
            countData:{},
         };
      },
      onShow() {
         this.shop  ={}
         this.checkShopLogin()
         this.shop = this.shopInfo || {}
         this.getFirstPageData()
         this.getCountData()
      },
      onReachBottom(){
         this.getDataList( );
      },
      methods:{
         async  getCountData(index){
               var that =this
               let res = await that.$u.api.saleReport({tokenType:1  })
               if (res.code === 200) {
                  this.active = index
                  this.countData = res.data
                  this.countData.profitTotal = (this.countData.profitTotal||0.00 ).toFixed(2)
                  this.countData.saleTotal = (this.countData.saleTotal||0.00).toFixed(2)
                  this.countData.profitTotalNum = Math.floor(this.countData.profitTotal)
                  this.countData.saleTotalNum = Math.floor( this.countData.saleTotal)
                  var t1 =(this.countData.profitTotal - this.countData.profitTotalNum).toFixed(2)
                  var t2 =(this.countData.saleTotal - this.countData.saleTotalNum).toFixed(2)
                  this.countData.profitTotalFloat =( t1+'').slice(1, 4)
                  this.countData.saleTotalFloat = ( t2+'').slice(1, 4)
               }
         },
         getFirstPageData(){
            this.currentPage = 0
            this.hasNext=true
            this.total=0
            this.dataList=[]
            this.getDataList()
         },
         async  getDataList(){
               if(this.loading || !this.hasNext){
                  return
               }
               this.loading=true
               this.currentPage =   this.currentPage+1
               if(this.currentPage == 1){
                  this.hasNext =true
                  this.dataList=[]
               }
               var that =this
               let res = await that.$u.api.myCustomer({
                     capacity:10,
                     model: {
                        memberInfo: this.memberInfo
                     },
                     page:this.currentPage
                  });
                  console.log(res)
               if (res.code === 200 ) {
                  if(res.data && this.memberInfo ==''&&this.currentPage==1){
                     this.totalAll = res.data.total||0
                  }
                  if ( res.data && res.data.page ===this.currentPage) {
                     res.data.records = res.data.records||[]
                      that.dataList.push(...res.data.records)
                      that.total=res.data.total
                      if( this.currentPage >= res.data.pageCount||0){
                         that.hasNext=false
                      }else{
                         that.hasNext=true
                      }
                  }
               }
               this.loading=false
         },
         checkShopLogin(){
            var that =this
            if( this.shopInfo ==null || this.shopInfo.id==null ||  this.shopToken==null || this.shopToken==''){
               uni.navigateTo({
                  url: '/pages/login/login'
               })
            }
         }
      }
   }
</script>
@@ -130,6 +222,7 @@
         margin-top: 20rpx;
         background-color: #ffffff;
         padding: 0 30rpx;
         padding-bottom: 60rpx;
         box-sizing: border-box;
         .list-item {
            width: 100%;