MrShi
5 小时以前 a690229b69cfa0aba5a0352772c2bdc1cf9fdab0
mini-program/pagesA/pages/virtual-account/virtual-account.vue
@@ -3,120 +3,103 @@
      <view class="data">
         <view class="hezi">
            <view class="hezi-a">
               <text>账户余额(元)</text>
               <u-icon name="eye" color="#ffffff" size="16"></u-icon>
               <text style="margin-right: 10rpx; ">账户余额(元)</text>
               <u-icon v-if="showMoney" name="eye" color="#ffffff" size="18" @click="showMoney = !showMoney"></u-icon>
               <u-icon v-if="!showMoney" name="eye-off" color="#eeeeee" size="18" @click="showMoney = !showMoney"></u-icon>
            </view>
            <view class="hezi-b">
               <view class="hezi-b-price">
                  <text>12,000</text>
                  <text>.00</text>
                  <text v-if="showMoney">{{(countData.surplusIntegral || 0).toFixed(2)}}</text>
                  <text v-if="showMoney"></text>
                  <text  v-if="!showMoney">****</text>
               </view>
               <view class="hezi-b-btn">提现</view>
               <view class="hezi-b-btn" @click="jumpWithdraw">提现</view>
            </view>
            <view class="hezi-c">
               <view class="hezi-c-item">
                  <text class="hezi-c-item-title">待结算(元)</text>
                  <view class="hezi-c-item-price">
                     <text>560</text>
                     <text>.00</text>
                     <text  v-if="showMoney">{{(countData.waitPayAmount || 0).toFixed(2)}}</text>
                     <text v-if="showMoney"></text>
                     <text  v-if="!showMoney">****</text>
                  </view>
               </view>
               <view class="hezi-c-item">
                  <text class="hezi-c-item-title">待结算(元)</text>
                  <text class="hezi-c-item-title">累计提现(元)</text>
                  <view class="hezi-c-item-price">
                     <text>560</text>
                     <text>.00</text>
                     <text v-if="showMoney">{{(countData.withdrawAmount || 0).toFixed(2)}}</text>
                     <text v-if="showMoney"></text>
                     <text  v-if="!showMoney">****</text>
                  </view>
               </view>
            </view>
         </view>
         <view class="tx">
            提现中:¥400.00
            <text v-if="showMoney">提现中:¥{{(countData.withdrawIngAmount || 0).toFixed(2)}}</text>
            <text v-if="!showMoney">提现中:****</text>
         </view>
      </view>
      <view class="sele">
         <text>全部</text>
      <view class="sele" :style="'width:'+wordsWidth+'rpx;'" @click="openShow()">
         <text>{{words}}</text>
         <u-icon name="arrow-down" color="#222222" size="16"></u-icon>
      </view>
      <view class="box-list">
         <view class="item">
            <view class="item-date">
               <view class="item-date-top">
                  <text>2025年11月</text>
                  <image src="/static/icon/ic_open@2x.png" mode="widthFix"></image>
               <view class="item-date-top" @click="openShow1()">
               <!--    <template>
                   <picker mode="date" :value="dateStr" @change="onDateChange">
                      <view style="display: flex;align-items: center;">
                         <text class="picker">{{ dateStr }}</text>
                         <image src="/static/icon/ic_open@2x.png" mode="widthFix"></image>
                      </view>
                   </picker>
                  </template> -->
                   <text v-if="dateType == 0">{{year}}年{{month}}月</text>
                   <text v-if="dateType == 1">{{startDate +' '}}至{{' '+endDate}}</text>
                  <image src="/static/icon/ic_open@2x.png" mode="widthFix"></image>
               </view>
               <view class="item-date-bottom">
                  <text>销售额:¥20000.00</text>
                  <text>结算利润:¥2000.00</text>
                  <text>收入:¥{{(countDataList.inAmount || 0).toFixed(2)}}</text>
                  <text>支出:¥{{(countDataList.outAmount || 0).toFixed(2)}}</text>
               </view>
            </view>
            <view class="item-list">
               <view class="item-list-item">
               <view class="item-list-item"  v-for="(item, index) in dataList" :key="index" @click="jumpDetail(item)">
                  <view class="image">
                     <image src="/static/logo.png" mode="widthFix"></image>
                     <image  v-if="item.objType === 16" src="/pagesA/static/ic_shouru@2x.png" mode="widthFix"></image>
                     <image  v-if="item.objType === 17" src="/pagesA/static/ic_tixian@2x.png" mode="widthFix"></image>
                     <image  v-if="item.objType === 19 || item.objType === 25" src="/pagesA/static/ic_tuikuan@2x.png" mode="widthFix"></image>
                  </view>
                  <view class="info">
                     <view class="info-a">
                        <view class="info-a-label">自提单</view>
                        <view class="info-a-price">
                           <text>4000</text>
                           <text>.00</text>
                     <view class="info">
                        <view class="info-a">
                           <view class="info-a-label">{{item.title || ''}}
                           <template  v-if="item.objType === 17  ">
                              <text style="color: #999999;"  v-if="item.withdrawStatus == 2">未通过</text>
                              <text style="color: #004096;" v-else-if="item.withdrawStatus == 1">已通过</text>
                              <text style="color: red;" v-else>审批中</text>
                           </template>
                           </view>
                           <view class="info-a-price">
                              <text>{{item.type==1?'-':'+'}}{{(item.num ||0).toFixed(2)}}</text>
                              <text></text>
                           </view>
                        </view>
                     </view>
                     <view class="info-b">
                        <text>李婷平-1815****5556</text>
                        <text>利润¥400.00</text>
                     </view>
                     <view class="info-b">
                        <text>订单号:713792839842</text>
                        <text>11月21日 17:32:21</text>
                        <view class="info-b">
                           <text v-if="item.objType === 16 ||item.objType === 25 ">订单号:{{item.orderCode || ''}}</text>
                           <text v-if="item.objType === 17 ||item.objType === 19 ">提现流水号:{{item.orderCode || ''}}</text>
                           <template  v-if="item.objType === 17  ">
                              <text style="color: #004096;font-size: 24rpx;" >查看</text>
                           </template>
                        </view>
                        <view class="info-b">
                           <text>{{item.createDate || ''}}</text>
                        </view>
                     </view>
                  </view>
               </view>
               <view class="item-list-item">
                  <view class="image">
                     <image src="/static/logo.png" mode="widthFix"></image>
                  </view>
                  <view class="info">
                     <view class="info-a">
                        <view class="info-a-label">配送订单</view>
                        <view class="info-a-price">
                           <text>4000</text>
                           <text>.00</text>
                        </view>
                     </view>
                     <view class="info-b">
                        <text>李婷平-1815****5556</text>
                        <text>利润¥400.00</text>
                     </view>
                     <view class="info-b">
                        <text>订单号:713792839842</text>
                        <text>11月21日 17:32:21</text>
                     </view>
                  </view>
               </view>
               <view class="item-list-item">
                  <view class="image">
                     <image src="/static/logo.png" mode="widthFix"></image>
                  </view>
                  <view class="info">
                     <view class="info-a">
                        <view class="info-a-label">配送订单</view>
                        <view class="info-a-price">
                           <text>4000</text>
                           <text>.00</text>
                        </view>
                     </view>
                     <view class="info-b">
                        <text>李婷平-1815****5556</text>
                        <text style="color: #E4001D;">已退款 -¥7800.00</text>
                     </view>
                     <view class="info-b">
                        <text>订单号:713792839842</text>
                        <text>11月21日 17:32:21</text>
                     </view>
                  </view>
               </view>
               <view v-if="!hasNext" class="nomore">已加载全部</view>
            </view>
         </view>
      </view>
@@ -127,38 +110,354 @@
            <view class="sear-item">
               <view class="sear-item-label">收支类型</view>
               <view class="sear-item-list">
                  <view class="sear-item-list-item active">全部</view>
                  <view class="sear-item-list-item">收入</view>
                  <view class="sear-item-list-item">支出</view>
                  <view @click="checkActive(0)" :class="tempActive == 0?'sear-item-list-item active':'sear-item-list-item'">全部</view>
                  <view @click="checkActive(1)" :class="tempActive == 1?'sear-item-list-item active':'sear-item-list-item'">收入</view>
                  <view @click="checkActive(2)" :class="tempActive == 2?'sear-item-list-item active':'sear-item-list-item'">支出</view>
                  <view style="width: 216rpx; height: 0;"></view>
               </view>
            </view>
            <view class="sear-item">
               <view class="sear-item-label">交易类型</view>
               <view class="sear-item-list">
                  <view class="sear-item-list-item active">全部</view>
                  <view class="sear-item-list-item">订单结算</view>
                  <view class="sear-item-list-item">提现</view>
                  <view class="sear-item-list-item">订单结算退回</view>
                  <view class="sear-item-list-item">提现退回</view>
                  <view  @click="checkType(0)" :class="tempType == 0?'sear-item-list-item active':'sear-item-list-item'">全部</view>
                  <view  @click="checkType(1)" :class="tempType == 1?'sear-item-list-item active':'sear-item-list-item'">订单结算</view>
                  <view  @click="checkType(2)" :class="tempType == 2?'sear-item-list-item active':'sear-item-list-item'">提现</view>
                  <view  @click="checkType(3)" :class="tempType == 3?'sear-item-list-item active':'sear-item-list-item'">订单结算退回</view>
                  <view  @click="checkType(4)" :class="tempType == 4?'sear-item-list-item active':'sear-item-list-item'">提现退回</view>
                  <view style="width: 216rpx; height: 0;"></view>
               </view>
            </view>
            <view class="sear-footer">
               <view class="sear-footer-btn1">重置</view>
               <view class="sear-footer-btn2">确认</view>
               <view class="sear-footer-btn1" @click="comfirm(false)">重置</view>
               <view class="sear-footer-btn2" @click="comfirm(true)">确认</view>
            </view>
         </view>
      </u-popup>
      <u-popup :show="show1" mode="bottom" :safeAreaInsetBottom="false"  round="15"  @close="comfirmDate(false)">
         <view class="sear" style="min-height: 500rpx;">
            <view class="sear-item" style="margin-top:10px">
               <view class="sear-item-list">
                  <view @click="checkDateType(0)" :class="tempDateType == 0?'sear-item-list-item1 active1':'sear-item-list-item1'">选择年月</view>
                  <view @click="checkDateType(1)" :class="tempDateType == 1?'sear-item-list-item1 active1':'sear-item-list-item1'">选择时间段</view>
                  <view style="width: 216rpx; height: 0;"></view>
               </view>
            </view>
            <picker-view v-if="tempDateType==0" :indicator-style="indicatorStyle" :value="dateValue" @change="bindChange" class="picker-view">
                        <picker-view-column>
                            <view class="picker-item" v-for="(item,index) in years" :key="index">{{item}}年</view>
                        </picker-view-column>
                        <picker-view-column>
                            <view class="picker-item" v-for="(item,index) in months" :key="index">{{item}}月</view>
                        </picker-view-column>
            </picker-view>
            <template  v-if="tempDateType==1">
               <view style="display: flex;justify-items: center;align-items: flex-end;text-align: center;">
                  <view style="display: flex;flex-direction: column;text-align: center;width: 300rpx;">
                     <view  class="picker3" >开始时间</view>
                     <picker :value="tempStartDate"  @change="bindChange1" mode="date" >
                        <view class="picker2">
                                {{ tempStartDate }}
                         </view>
                     </picker>
                  </view>
                  <view style="width: 50rpx;">
                     <view class="picker3"></view>
                     <view class="picker3">止</view>
                  </view>
                  <view style="display: flex;flex-direction: column;text-align: center;width: 300rpx;">
                     <view class="picker3">结束时间</view>
                     <picker :value="tempEndDate"   @change="bindChange2" mode="date">
                        <view class="picker2">
                              {{ tempEndDate }}
                         </view>
                      </picker>
                  </view>
               </view>
            </template>
             <view class="sear-footer">
               <view class="sear-footer-btn1" @click="comfirmDate(false)">重置</view>
               <view class="sear-footer-btn2" @click="comfirmDate(true)">确认</view>
            </view>
         </view>
      </u-popup>
   </view>
</template>
<script>
<script>
   import { mapState } from 'vuex'
   export default {
      computed: {
         ...mapState(['navHeight', 'statusbarHeight','shopInfo', 'shopToken'])
      },
      data() {
         return {
            show: false
            currentPage:1,
            total:0,
            active:0,
            wordsWidth:250,
            tempActive :0,
            type:0,
            words:'全部',
            dateStr:'2026-02',
            tempType :0,
            dateType :0,
            tempDateType:0,
            dataList:[],
            startDate:null,
            endDate:null,
            tempStartDate:null,
            tempEndDate:null,
            showMoney:false,
            countData:{},
            countDataList:{},
            hasNext:true,
            show: false,
            show1:false,
            years:[],
            year:null,
            tempYear:null,
            months:null,
            month:null,
            tempMonth:null,
            dateValue: null,
            visible: true,
            indicatorStyle: `height: 50px;`,
            shop:{}
         };
      },
      onReachBottom(){
         this.getDataList( );
      },
      onLoad() {
          this.shop  ={}
          this.active=0
          this.wordsWidth=250
          this.words='全部'
          this.tempActive=0
          this.tempDateType=0
          this.dateType=0
          this.countData={}
          this.countDataList={}
          this.show=false
          this.checkShopLogin()
          this.initDateStr()
          this.shop = this.shopInfo || {}
          this.getCountData()
          this.getFirstPageData()
          var that =this
          uni.$on('accountListReload',function(data){
             console.log('监听到事件来自 accountListReload:' ,data);
             that.getFirstPageData()
          })
      },
      methods:{
         comfirmDate(flag){
            if(flag){
               if(new Date(this.tempEndDate+" 00:00:00").getTime() < new Date(this.tempStartDate+" 00:00:00").getTime()){
                  return uni.showToast({
                     title:'日期范围不正确',
                     icon:'error'
                  })
               }
               this.dateType =this.tempDateType
               this.year = this.tempYear
               this.month = this.tempMonth
               this.startDate =this.tempStartDate
               this.endDate =this.tempEndDate
               this.show1=false
               this.getFirstPageData()
            }else{
               this.initDateStr()
               this.tempDateType = this.dateType
               this.tempYear  = this.year
               this.tempMonth = this.month
               this.tempStartDate  = this.startDate
               this.tempEndDate = this.endDate
               this.show1=false
            }
         },
         checkDateType(index){
            console.log('33333',this.dateValue)
            this.tempDateType =index
         },
         bindChange (e) {
            const val = e.detail.value
            this.tempYear = this.years[val[0]]
            this.tempMonth = this.months[val[1]]
            console.log( e.detail.value)
         },
         bindChange1 (e) {
            this.tempStartDate = e.detail.value
         },
         bindChange2 (e) {
            this.tempEndDate= e.detail.value
         },
         formattedDateTime(currentDate) {
              const year = currentDate.getFullYear();
              const month = (currentDate.getMonth() + 1).toString().padStart(2, '0'); // 月份从 0 开始,需要加 1,并补齐两位
              const day = currentDate.getDate().toString().padStart(2, '0'); // 补齐两位
              const formattedDate = `${year}-${month}-${day}`;
              console.log(formattedDate); // 输出格式化后的日期,例如 "2023-10-24"
              return formattedDate;
         },
         initDateStr(){
            this.dateType = 0
            const date = new Date()
            this.dateValue=[0,0]
            this.startDate = this.formattedDateTime(date)
            this.endDate = this.formattedDateTime(date)
            this.years = []
            this.year = date.getFullYear()
            this. months = []
            this. month = date.getMonth() + 1
            for (let i =date.getFullYear(); i >=  1990; i--) {
               this.years.push(i)
            }
            for (let i = 1; i <= 12; i++) {
               this.months.push(i)
            }
            this.tempDateType = this.dateType
            this.tempYear  = this.year
            this.tempMonth = this.month
            this.tempStartDate  = this.startDate
            this.tempEndDate = this.endDate
            // this.dateValue =[this.years.length -Number(this.tempYear )+1989, Number(this.tempMonth) - 1]
         },
         openShow1(){
            this.dateValue[0]=[this.years.length -Number(this.year )+1989, ]
            this.dateValue[1]=Number(this.month) - 1
            this.tempDateType = this.dateType
            this.tempYear  = this.year
            this.tempMonth = this.month
            this.tempStartDate  = this.startDate
            this.tempEndDate = this.endDate
            this.show1=true
         },
         openShow(){
            this.tempActive =this.active
            this.tempType =this.type
            this.show=true
         },
         comfirm(flag){
            if(flag){
               this.active =this.tempActive
               this.type =this.tempType
               this.show=false
               this.wordsWidth =250
               if(this.active ===0 && this.type ===0){
                  this.words='全部'
               }else {
                  let t1 = this.active === 1?'收入 ':(this.active === 2?'支出 ':'');
                  let t2 = this.type === 1?'订单结算':( this.type === 2?'提现':( this.type === 3?'订单结算退回': (this.type === 4?'提现退回': '')))
                  if(t1!='' && t2!=''){
                     this.wordsWidth=350
                  }
                  this.words = t1+t2
               }
               this.getFirstPageData()
            }else{
               // this.tempActive =this.active
               // this.tempType =this.type
               this.tempActive = 0
               this.tempType =0
            }
         },
         checkActive(index){
            this.tempActive =index
         },
         checkType(index){
            this.tempType =index
         },
         async  getCountData(){
               var that =this
               let res = await that.$u.api.getIntegralData({  userType:2, tokenType:1  })
               if (res.code === 200) {
                  this.countData = res.data
               }
         },
         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 sDate = null
               let eDate = null
               if(this.dateType == 0){
                  let td = new Date(this.year+'-'+this.month+'-'+'01 00:00:00')
                  sDate = this.formattedDateTime(td)
                  td.setMonth(td.getMonth() + 1);
                  td.setDate(0); // 这会将日期设置为上一个月的最后一天
                  eDate= this.formattedDateTime(td)
               }else{
                  sDate = this.startDate
                  eDate =this.endDate
               }
               let res = await that.$u.api.findIntegralRecordPage({
                     capacity:10,
                     model: {
                        startDate:sDate,
                        endDate:eDate,
                        type: this.active === 1?0:(this.active===2?1:''),
                        objType: this.type === 1?16:( this.type === 2?17:( this.type === 3?25: (this.type === 4?1: ''))),
                        userType: 2
                     },
                     page:this.currentPage
                  });
                  console.log(res)
               if (res.code === 200 ) {
                  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(that.currentPage ==1){
                         that.countDataList = res.data.countData || {}
                      }
                      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'
               })
            }
         } ,
         jumpBack(){
            uni.navigateBack({ delta: 1 });
         },
         jumpWithdraw(){
            uni.navigateTo({
               url: '/pagesA/pages/withdraw/withdraw'
            })
         },
         jumpDetail(item){
            if(item.objType == 17 ){
               uni.navigateTo({
                  url: '/pagesA/pages/withdrawal-details/withdrawal-details?id='+item.objId
               })
            }
         }
      }
   }
</script>
@@ -166,6 +465,33 @@
<style>
   page {
      background-color: #F9F9FB;
   }
   .picker-view {
      width: 750rpx;
      height: 600rpx;
      margin-top: 20rpx;
   }
   .picker-item {
      line-height: 72rpx;
      text-align: center;
   }
   .picker2{
      line-height: 72rpx;
      text-align: center;
      background: #F7F7F7;
      border-radius: 8rpx;
      font-weight: 400;
      font-size: 28rpx;
      background: rgba(0,64,150,0.1) !important;
      color: #004096 !important;
   }
   .picker3{
      line-height: 72rpx;
      text-align: center;
      border-radius: 8rpx;
      font-weight: 400;
      font-size: 28rpx;
      color: #333333;
   }
</style>
<style lang="scss" scoped>
@@ -202,6 +528,10 @@
                  background: rgba(0,64,150,0.1) !important;
                  color: #004096 !important;
               }
               .active1 {
                  border-bottom: 2rpx solid #004096 !important;
                  color: #004096 !important;
               }
               .sear-item-list-item {
                  width: 216rpx;
                  height: 72rpx;
@@ -209,6 +539,16 @@
                  text-align: center;
                  background: #F7F7F7;
                  border-radius: 8rpx;
                  font-weight: 400;
                  font-size: 28rpx;
                  color: #333333;
                  margin-bottom: 20rpx;
               }
               .sear-item-list-item1 {
                  width: 216rpx;
                  height: 72rpx;
                  line-height: 72rpx;
                  text-align: center;
                  font-weight: 400;
                  font-size: 28rpx;
                  color: #333333;
@@ -250,6 +590,7 @@
      .box-list {
         width: 100%;
         display: flex;
         padding-bottom: 30rpx;
         flex-direction: column;
         .item {
            width: 100%;
@@ -328,27 +669,23 @@
                           font-weight: 500;
                           font-size: 30rpx;
                           color: #222222;
                           display: flex;
                           text {
                              font-weight: 400;
                              font-size: 24rpx;
                              color: #999999;
                              margin-left: 20rpx;
                           }
                        }
                        .info-a-price {
                           display: flex;
                           align-items: baseline;
                           text {
                              &:nth-child(1) {
                                 font-weight: 600;
                                 font-size: 32rpx;
                                 color: #222222;
                                 &::before {
                                    content: "+";
                                    font-weight: 600;
                                    font-size: 32rpx;
                                    color: #222222;
                                 }
                              }
                              &:nth-child(2) {
                                 font-weight: 600;
                                 font-size: 24rpx;
                                 color: #222222;
                              }
                           }
                        }
                     }
@@ -382,6 +719,7 @@
         justify-content: space-between;
         margin-left: 30rpx;
         text {
            width: auto;
            font-weight: 400;
            font-size: 26rpx;
            color: #333333;