doum
2025-09-15 7d480ead3785aa2c9bfa2559e09441d754b3241c
前端
已修改1个文件
128 ■■■■ 文件已修改
small-program/pages/demand-hall/demand-hall.vue 128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
small-program/pages/demand-hall/demand-hall.vue
@@ -18,18 +18,18 @@
            <!-- 发单方 -->
            <view class="index-labs" v-if="typeViewId === 0" :style="{ top: statusbarHeight + navHeight + 'px' }">
                <scroll-view scroll-x class="scroll-view_H" :scroll-into-view="'view'+status">
                    <view :class="item.id === status ? 'index-labs-row active' : 'index-labs-row'" v-for="(item, index) in list1" :id="'view'+item.id" :key="item.id" @click="clickOrderType(item.id)">
                    <view :class=" item.id === status ? 'index-labs-row active' : 'index-labs-row'" v-for="(item, index) in list1" :id="'view'+item.id" :key="item.id" @click="clickOrderType(item.id)">
                        {{item.name}}
                        <view class="index-labs-row-x" v-if="item.id === status"></view>
                        <view class="index-labs-row-x" v-if=" item.id === status"></view>
                    </view>
                </scroll-view>
            </view>
            <!-- 接单方 -->
            <view class="index-labs" v-if="typeViewId === 1" :style="{ top: statusbarHeight + navHeight + 'px' }">
                <scroll-view scroll-x class="scroll-view_H" :scroll-into-view="'view'+status">
                    <view :class="item.id === status ? 'index-labs-row active' : 'index-labs-row'" v-for="(item, index) in list" :id="'view'+item.id" :key="item.id" @click="clickOrderType(item.id)">
                    <view :class=" item.id === status ? 'index-labs-row active' : 'index-labs-row'" v-for="(item, index) in list" :id="'view'+item.id" :key="item.id" @click="clickOrderType(item.id)">
                        {{item.name}}
                        <view class="index-labs-row-x" v-if="item.id === status"></view>
                        <view class="index-labs-row-x" v-if=" item.id === status "></view>
                    </view>
                </scroll-view>
            </view>
@@ -232,7 +232,7 @@
        },
        async onShow(options) {
            var flag = getApp().globalData.orderStatus
                console.log(getApp().globalData,"=====================================")
            console.log(getApp().globalData,"=====================================")
            // this.status = ''
            // this.commentStatus=''
            // status: this.status === 5 ? 4 : this.status,
@@ -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: '',
                commentStatus: '',
                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() {
            this.getOrderList()
            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}`
@@ -373,14 +404,49 @@
                        this.next = true
                        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
@@ -409,23 +475,17 @@
                            item.wayInfo = JSON.parse(item.wayInfo)
                        }
                    })
                    this.orderList = [...this.orderList, ...res.data.records]
                    if (this.orderList.length === res.data.total) {
                    this.orderList = [...this.orderList, ...res.data.records]
                    if (this.orderList.length >= res.data.total) {
                        this.next = false
                    } else {
                        this.page += 1
                    }
                })
            },
            clickOrderType(id) {
                // if (typeof id === 5) {
                //     this.status = 5
                //     // this.commentStatus = 0
                // } else {
                    this.commentStatus = ''
                    this.status = id
                // }
            clickOrderType(id) {
                this.commentStatus = ''
                this.status = id
                this.orderList = []
                this.next = true
                this.page = 1