Kaynağa Gözat

工单详情图片回显

xyg 2 yıl önce
ebeveyn
işleme
b16dc3aa82

+ 12 - 8
nngkxxdp/src/main/resources/mapper/SRepairDao.xml

@@ -200,10 +200,12 @@
         select count(*) from s_repair
         where user_id = #{userId}
         AND is_del = 0
-        AND status in
-        <foreach collection="status" item="s" index="index" open="(" close=")" separator=",">
-            #{s}
-        </foreach>
+        <if test="status != null and status.size > 0">
+            AND status in
+            <foreach collection="status" item="s" index="index" open="(" close=")" separator=",">
+                #{s}
+            </foreach>
+        </if>
     </select>
 
     <select id="getMyOrder" resultMap="SRepairMap">
@@ -212,10 +214,12 @@
         from s_repair
         where user_id = #{userId}
         AND is_del = 0
-        AND status in
-        <foreach collection="status" item="s" index="index" open="(" close=")" separator=",">
-            #{s}
-        </foreach>
+        <if test="status != null and status.size > 0">
+            AND status in
+            <foreach collection="status" item="s" index="index" open="(" close=")" separator=",">
+                #{s}
+            </foreach>
+        </if>
         limit #{page}, #{limit}
 
     </select>

+ 2 - 2
nnzwminiapp/pages/nais/nais.js

@@ -43,7 +43,7 @@ Page({
 			}
 		],
 		scholarly2: [{
-				count: '43',
+				count: '44',
 				name: '小学'
 			},
 			{
@@ -55,7 +55,7 @@ Page({
 				name: '初级中学'
 			},
 			{
-				count: '7',
+				count: '8',
 				name: '完全中学'
 			},
 			{

+ 118 - 73
nnzwminiapp/pagesPublic/pages/work-order-detail/work-order-detail.js

@@ -22,6 +22,7 @@ Page({
         statusText2: '待审核',
         statusText3: '待上门',
         statusText4: '待确认',
+        tempFileList: []
     },
 
     /**
@@ -29,72 +30,84 @@ Page({
      */
     onLoad(options) {
         console.info(options);
-        let that = this;
-        that.setData({
+        this.setData({
             isUser: options.isuser
         });
-
-        wx.request({
-            url: baseUrl + '/mini/worker/orderInfo',
+        request({
+            url: '/mini/worker/orderInfo',
             method: 'GET',
-            header: {
-                'mini-token': wx.getStorageSync('token')
-            },
             data: {
                 'id': options.id
-            },
-            dataType: 'json',
-            success: function (res) {
-                console.info(res)
-                let data = res.data.data;
-                that.setData({
-                    type: data.repairType,
-                    address: data.maintenanceAddress,
-                    phone: data.phoneNum,
-                    arriveTime: data.appointmentTime,
-                    description: data.userDescription,
-                    image: data.repairPic
-                });
-                if (data.status == 0) {
-                    that.setData({
-                        checked2: '',
-                        checked3: '',
-                        checked4: '',
-                    });
-                } else if (data.status == 1) {
-                    that.setData({
-                        checked2: 'checked',
-                        checked3: '',
-                        checked4: '',
-                        statusText2: '已审核'
-                    });
-                } else if (data.status == 2) {
-                    that.setData({
-                        checked2: 'checked',
-                        checked3: 'checked',
-                        checked4: '',
-                        statusText2: '已审核',
-                        statusText3: '已上门'
-                    });
-                } else if (data.status == 3) {
-                    that.setData({
-                        checked2: 'checked',
-                        checked3: 'checked',
-                        checked4: 'checked',
-                        statusText2: '已审核',
-                        statusText3: '已上门',
-                        statusText4: '已确认'
-                    });
-                } else {
-                    that.setData({
-                        checked2: 'checked',
-                        checked3: 'checked',
-                        checked4: 'checked',
-                        statusText2: '已审核',
-                        statusText3: '已上门',
-                        statusText4: '已确认'
+            }
+        }).then(res => {
+            console.info(res)
+            let data = res.data;
+            this.setData({
+                type: data.repairType,
+                address: data.maintenanceAddress,
+                phone: data.phoneNum,
+                arriveTime: data.appointmentTime,
+                description: data.userDescription
+            });
+
+            request({
+                url: '/food/getFoodPicByPicId',
+                method: 'GET',
+                data: {
+                    'picId': data.repairPic
+                }
+            }).then(re => {
+                console.info(re)
+                if (re.data && re.data.length > 0) {
+                    let arr = [];
+                    for (let i in re.data) {
+                        arr.push(baseUrl + '/' + re.data[i].path);
+                    }
+                    this.setData({
+                        image: arr
                     });
                 }
+            });
+
+            if (data.status == 0) {
+                this.setData({
+                    checked2: '',
+                    checked3: '',
+                    checked4: '',
+                });
+            } else if (data.status == 1) {
+                this.setData({
+                    checked2: 'checked',
+                    checked3: '',
+                    checked4: '',
+                    statusText2: '已审核'
+                });
+            } else if (data.status == 2) {
+                this.setData({
+                    checked2: 'checked',
+                    checked3: 'checked',
+                    checked4: '',
+                    statusText2: '已审核',
+                    statusText3: '已上门'
+                });
+            } else if (data.status == 3) {
+                this.setData({
+                    checked2: 'checked',
+                    checked3: 'checked',
+                    checked4: 'checked',
+                    statusText2: '已审核',
+                    statusText3: '已上门',
+                    statusText4: '已确认'
+                });
+            } else {
+                this.setData({
+                    checked2: 'checked',
+                    checked3: 'checked',
+                    checked4: 'checked',
+                    statusText2: '已审核',
+                    statusText3: '已上门',
+                    statusText4: '已确认'
+                });
             }
         });
     },
@@ -128,20 +141,6 @@ Page({
     },
 
     /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
      * 点击返回上一层页面
      */
     backTap() {
@@ -173,6 +172,15 @@ Page({
         wx.chooseMedia({
             success(res) {
                 console.info(res);
+                if (res.errMsg == 'chooseMedia:ok') {
+                    let tempList = this.data.tempFileList;
+                    for (let i in res.tempFiles) {
+                        tempList.push(res.tempFiles[i].tempFilePath);
+                    }
+                    this.setData({
+                        tempFileList: tempList
+                    });
+                }
             }
         });
     },
@@ -187,5 +195,42 @@ Page({
             });
             return;
         }
+
+        let formData = new FormData();
+        if (complete) {
+            formData.append('status', 3);
+        } else {
+            formData.append('status', -1);
+        }
+        formData.append('workerDescription', e.detail.value.reason);
+        // formData.append('userId', wx.getStorageSync('userid'));
+        for (let i in tempList) {
+            formData.appendFile('files', tempList[i]);
+        }
+        let data = formData.getData();
+        request({
+            url: '/mini/worker/closeOrder',
+            method: 'POST',
+            data: data.buffer,
+            contentType: data.contentType
+        }).then(res => {
+            console.info(res)
+            if (res.result) {
+                wx.showToast({
+                    title: '提交成功',
+                    icon: 'success',
+                    mask: true,
+                });
+                setTimeout(() => {
+                    wx.navigateBack();
+                }, 1500);
+            } else {
+                wx.showToast({
+                    title: '提交失败',
+                    icon: 'error',
+                    mask: true
+                });
+            }
+        });
     },
 })

+ 3 - 0
nnzwminiapp/pagesPublic/pages/work-order-detail/work-order-detail.wxml

@@ -117,6 +117,9 @@
             <view class="report-row" style="align-items: flex-start;" wx:if="{{complete}}">
                 <label for="" class="report-label">维修结果:</label>
                 <image class="report-photo" src="/pages/images/photo2.png" mode="" bindtap="uploadImage" />
+                <view wx:for="{{tempFileList}}" wx:key="index" wx:for-item="item">
+                    <image class="form-image" src="{{item}}" mode="" />
+                </view>
             </view>
             <view class="report-row" wx:else="{{complete}}">
                 <label for="" class="report-label">原因:</label>

+ 75 - 83
nnzwminiapp/pagesPublic/pages/work-order/work-order.js

@@ -2,8 +2,6 @@
 var dateTimePicker = require('../../../utils/dateTimePicker');
 const FormData = require('../../pages/menu/formData.js');
 const twoHours = 7200000;
-let page = 1;
-let page2 = 1;
 const limit = 10;
 
 import {
@@ -17,6 +15,8 @@ Page({
      * 页面的初始数据
      */
     data: {
+        page: 1,
+        page2: 1,
         isUser: true,
         currentIndex: 0,
         date: '2023-01-01',
@@ -31,7 +31,9 @@ Page({
         completeList: [],
         tempFileList: [],
         nodata: false,
-        nodata2: false
+        nodata2: false,
+        total: 0,
+        total2: 0
     },
 
     /**
@@ -93,7 +95,7 @@ Page({
     onPullDownRefresh() {
         console.log("下拉刷新...");
         if (this.data.currentIndex == 1) {
-            page2 = 1;
+            this.setData({ page2: 1 });
             if (this.data.isUser) {
                 this.loadMyApplication();
             } else {
@@ -101,7 +103,7 @@ Page({
             }
         } else {
             if (!this.data.isUser) {
-                page = 1;
+                this.setData({ page: 1 });
                 this.loadTobeRepair();
             }
         }
@@ -113,15 +115,27 @@ Page({
     onReachBottom() {
         console.log("上拉加载....");
         if (this.data.currentIndex == 1) {
-            page2++;
+            if (this.data.total2 <= limit) {
+                return;
+            }
+            if (this.data.list.length == this.data.total2 || this.data.completeList.length == this.data.total2) {
+                return;
+            }
+            this.setData({ page2: this.data.page2++ });
             if (this.data.isUser) {
                 this.loadMyApplication(true);
             } else {
                 this.loadComplete(true);
             }
         } else {
+            if (this.data.total <= limit) {
+                return;
+            }
+            if (this.data.repairList.length == this.data.total) {
+                return;
+            }
             if (!this.data.isUser) {
-                page++;
+                this.setData({ page: this.data.page++ });
                 this.loadTobeRepair(true);
             }
         }
@@ -257,83 +271,58 @@ Page({
                         return;
                     }
                     if (res.confirm) {
-                        let formData = new FormData();
-                        formData.append('repairType', e.detail.value.type);
-                        formData.append('userDescription', e.detail.value.description);
-                        formData.append('phoneNum', e.detail.value.phone);
-                        formData.append('appointmentTime', e.detail.value.arriveTime);
-                        formData.append('maintenanceAddress', e.detail.value.address);
-                        formData.append('userId', wx.getStorageSync('userid'));
-                        for (let i in tempList) {
-                            formData.appendFile('files', tempList[i]);
-                        }
-                        let data = formData.getData();
-                        request({
-                            url: '/mini/worker/addOrder',
-                            method: 'POST',
-                            data: data.buffer,
-                            contentType: data.contentType
-                        }).then(res => {
-                            console.info(res)
-                            if (res.result) {
-                                wx.showToast({
-                                    title: '提交成功',
-                                    icon: 'success',
-                                    mask: true,
-                                });
-                                setTimeout(() => {
-                                    wx.navigateBack();
-                                }, 1500);
-                            } else {
-                                wx.showToast({
-                                    title: '提交失败',
-                                    icon: 'error',
-                                    mask: true
-                                });
-                            }
-                        });
+                        this.addOrder(e);
                     }
                 }
             });
         } else {
-            let formData = new FormData();
-            formData.append('repairType', e.detail.value.type);
-            formData.append('userDescription', e.detail.value.description);
-            formData.append('phoneNum', e.detail.value.phone);
-            formData.append('appointmentTime', e.detail.value.arriveTime);
-            formData.append('maintenanceAddress', e.detail.value.address);
-            formData.append('userId', wx.getStorageSync('userid'));
-            for (let i in tempList) {
-                formData.appendFile('files', tempList[i]);
-            }
-            let data = formData.getData();
-            request({
-                url: '/mini/worker/addOrder',
-                method: 'POST',
-                data: data.buffer,
-                contentType: data.contentType
-            }).then(res => {
-                console.info(res)
-                if (res.result) {
-                    wx.showToast({
-                        title: '提交成功',
-                        icon: 'success',
-                        mask: true,
-                    });
-                    setTimeout(() => {
-                        wx.navigateBack();
-                    }, 1500);
-                } else {
-                    wx.showToast({
-                        title: '提交失败',
-                        icon: 'error',
-                        mask: true
-                    });
-                }
-            });
+            this.addOrder(e);
         }
     },
 
+    addOrder(e) {
+        wx.showLoading({
+            title: '加载中...',
+        });
+        let tempList = this.data.tempFileList;
+        let formData = new FormData();
+        formData.append('repairType', e.detail.value.type);
+        formData.append('userDescription', e.detail.value.description);
+        formData.append('phoneNum', e.detail.value.phone);
+        formData.append('appointmentTime', e.detail.value.arriveTime);
+        formData.append('maintenanceAddress', e.detail.value.address);
+        formData.append('userId', wx.getStorageSync('userid'));
+        for (let i in tempList) {
+            formData.appendFile('files', tempList[i]);
+        }
+        let data = formData.getData();
+        request({
+            url: '/mini/worker/addOrder',
+            method: 'POST',
+            data: data.buffer,
+            contentType: data.contentType
+        }).then(res => {
+            console.info(res)
+            if (res.result) {
+                wx.showToast({
+                    title: '提交成功',
+                    icon: 'success',
+                    mask: true,
+                });
+                setTimeout(() => {
+                    wx.navigateBack();
+                }, 1500);
+            } else {
+                wx.showToast({
+                    title: '提交失败',
+                    icon: 'error',
+                    mask: true
+                });
+            }
+            wx.hideLoading();
+        });
+    },
+
     /**
      * 上传报修图片
      */
@@ -391,7 +380,7 @@ Page({
             url: '/mini/worker/myOrder',
             method: 'GET',
             data: {
-                page: page2,
+                page: this.data.page2,
                 limit: limit,
                 userId: wx.getStorageSync('userid'),
                 isUser: true
@@ -413,7 +402,8 @@ Page({
                     data = data.concat(this.data.list);
                 }
                 this.setData({
-                    list: data
+                    list: data,
+                    total2: res.count
                 });
             } else {
                 if (!ispullup) {
@@ -436,7 +426,7 @@ Page({
             url: '/mini/worker/myOrder',
             method: 'GET',
             data: {
-                page: page,
+                page: this.data.page,
                 limit: limit,
                 userId: wx.getStorageSync('userid'),
                 todo: true
@@ -449,7 +439,8 @@ Page({
                     data = data.concat(this.data.repairList);
                 }
                 this.setData({
-                    repairList: data
+                    repairList: data,
+                    total: res.count
                 });
             } else {
                 if (!ispullup) {
@@ -472,7 +463,7 @@ Page({
             url: '/mini/worker/myOrder',
             method: 'GET',
             data: {
-                page: page2,
+                page: this.data.page2,
                 limit: limit,
                 userId: wx.getStorageSync('userid'),
                 close: true
@@ -485,7 +476,8 @@ Page({
                     data = data.concat(this.data.completeList);
                 }
                 this.setData({
-                    completeList: data
+                    completeList: data,
+                    total2: res.count
                 });
             } else {
                 if (!ispullup) {

+ 1 - 1
nnzwminiapp/pagesPublic/pages/work-order/work-order.wxss

@@ -3,7 +3,7 @@ Page {
     /* 全局样式 */
     background: #FFFFFF;
     height: 100%;
-    position: fixed;
+    /* position: fixed; */
 }
 
 .fontColorBox,