doum
2025-09-15 7d480ead3785aa2c9bfa2559e09441d754b3241c
small-program/pages/demand-hall/demand-hall.vue
@@ -242,40 +242,61 @@
         }else if(flag =='2'){//发单方进行中
            this.status = 3 
         }else if(flag =='3'){//发单方待评价
            this.status = 5
            this.status = 6
         }else if(flag =='4'){//接单方已接单
            this.status =2            
         }else if(flag =='5'){//接单方进行中
            this.status =3   
         }else if(flag =='6'){//接单方已完成
            this.status =4
         }else if(flag =='0'){
            this.status = -1
         }
         console.log(getApp().globalData,this.status ,"=====================================")
         this.typeViewId = 0
         if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}'){
            console.log('已登陆')
            this.isLogin = true
            if (this.userInfo && this.userInfo.useIdentity == 1) {
               this.typeViewId = 1
            }
         /*    this.getOrderList()
            if (!this.isOnce) {
               this.commentStatus = ''
               this.orderList = []
               this.next = true
               this.page = 1
               this.getOrderList()
            }
            } */
         } else {
            this.isLogin = false
            console.log('未登陆')
         }
         if(this.isLogin){
            if(this.typeViewId !== this.userInfo.useIdentity || flag !=null){
               this.typeViewId = this.userInfo.useIdentity || 0
               //如果发生
               this.initOrderList()
            }else{
               //如果未发生变化不刷新
               this.typeViewId = this.userInfo.useIdentity || 0
               if(!this.orderList || !this.orderList.length){
                  this.initOrderList()
               }else{
                  if( this.tempOrderId){
                     this.getOrderData()
                  }
               }
               console.log('this.tempOrderId',this.tempOrderId)
            }
         }
         getApp().globalData.orderStatus =null
      },
      data() {
         return {
            show: false,
            isLogin: false,
            typeViewId: 0,
            typeViewId: -1,
            tempOrderId:null,
            list: [
               { name: '全部', id: '' },
               { name: '全部', id: -1 },
               { name: '已接单', id: 2 },
               { name: '进行中', id: 3 },
               { name: '待支付', id: 5 },
@@ -283,7 +304,7 @@
               // { name: '已取消', id: 99 },
            ],
            list1: [
               { name: '全部', id: '' },
               { name: '全部', id: -1 },
               { name: '待支付', id: 0 },
               { name: '待接单', id: 1 },
               { name: '已接单', id: 2 },
@@ -293,9 +314,8 @@
               { name: '待评价', id: 6 }
            ],
            orderId: null,
            status: '',
            status: -1,
            commentStatus: '',
            next: true,
            page: 1,
            orderList: [],
@@ -304,7 +324,7 @@
      },
      async onLoad() {
         await this.$onLaunched;
         uni.$on('refresh', (data) => {
         /* uni.$on('refresh', (data) => {
            console.log('我的订单页刷新');
            this.status = ''
            this.commentStatus = ''
@@ -312,17 +332,26 @@
            this.next = true
            this.page = 1
            this.getOrderList()
         })
         this.getOrderList()
         }) */
      },
      onReachBottom() {
         if(this.isLogin){
         this.getOrderList()
         }
      },
      methods: {
         toLogin() {
            uni.navigateTo({
               url: '/pages/login/login'
            })
         },
         initOrderList() {
            this.commentStatus = ''
            this.orderList = []
            this.next = true
            this.page = 1
            this.getOrderList()
         },
         startJobs(orderId) {
            this.$u.api.begin({ orderId })
@@ -342,9 +371,11 @@
            uni.navigateTo({
               url: `/pages/order-details/order-details?id=${item.id}&flag=${flag}`
            })
            this.tempOrderId = item.id
         },
         // 修改
         jumpEdit(item) {
            this.tempOrderId =item.id
            if (item.type === 0 && item.workType === 0) {
               uni.navigateTo({
                  url: `/pages/using-workers/using-workers?id=${item.id}`
@@ -374,13 +405,48 @@
                  this.page = 1
                  this.getOrderList()
               }
            })
         },
         phoneCall(phoneNumber) {
            uni.makePhoneCall({
               phoneNumber
            });
         },
         getOrderData(){
            var that = this
            var param ={ orderId:that.tempOrderId}
            this.$u.api.getDetail(param).then(res =>{
               if(res.code ===200 && res.data){
                  var isDel = false
                  var tempIndex = -1
                  that.orderList.forEach((item,index) =>{
                     if(item.id == res.data.id){
                        item.status = res.data.status
                        item.isUpdate = res.data.isUpdate
                        item.commentStatus = res.data.commentStatus
                        tempIndex = index
                     }
                  })
                  if(tempIndex > -1 ){
                     console.log(tempIndex,that.status,res.data.status,"===================")
                     if(that.status >=0 ){
                        //如果有标签页
                        if(that.status ===6 && res.data.commentStatus == 1){
                           isDel =true
                           console.log(tempIndex,that.status,res.data.status,"==================1")
                        }else if(that.status !=6 && that.status !== res.data.status){
                           isDel =true
                           console.log(tempIndex,that.status,res.data.status,"===================2")
                        }
                     }
                     if(isDel){
                        console.log(tempIndex,that.status,res.data.status,"===================3")
                        that.orderList.splice(tempIndex,1)
                     }
                  }
               }
             })
         },
         // 订单分页
         getOrderList() {
@@ -390,7 +456,7 @@
               page: this.page,
               model: {
                  queryMyOrderType: this.userInfo.useIdentity,
                  status: this.status === 6 ? 4 : this.status,
                  status:  this.status === 6 ? 4 : (this.status ==-1?"":this.status),
                  commentStatus: this.status === 6 ? 0 : '',
                  queryLat: this.latitude,
                  queryLgt: this.longitude
@@ -410,8 +476,7 @@
                  }
               })
               this.orderList = [...this.orderList, ...res.data.records]
               if (this.orderList.length === res.data.total) {
               if (this.orderList.length >= res.data.total) {
                  this.next = false
               } else {
                  this.page += 1
@@ -419,13 +484,8 @@
            })
         },
         clickOrderType(id) {
            // if (typeof id === 5) {
            //    this.status = 5
            //    // this.commentStatus = 0
            // } else {
               this.commentStatus = ''
               this.status = id
            // }
            this.orderList = []
            this.next = true
            this.page = 1