From b4661f300194a13c4bc391f2f45a3f7a0a8dff08 Mon Sep 17 00:00:00 2001
From: 安瑾然 <m17681517455@outlook.com>
Date: 星期二, 21 三月 2023 17:26:38 +0800
Subject: [PATCH] fix bug

---
 miniprogram/pages/user/report/submitReport/index.ts   |  382 ++++++++++++++++------------
 miniprogram/pages/user/report/detail/index.ts         |   32 +-
 miniprogram/pages/manager/index.ts                    |    2 
 miniprogram/pages/user/index.ts                       |    2 
 miniprogram/pages/user/loginInfo/index.ts             |    1 
 miniprogram/pages/index/index.ts                      |    2 
 miniprogram/pages/manager/report/detail/index.ts      |   85 +++---
 miniprogram/pages/user/report/index.ts                |   75 +++--
 miniprogram/pages/user/report/submitReport/index.wxml |  166 +++--------
 miniprogram/pages/user/report/index.wxml              |    2 
 10 files changed, 365 insertions(+), 384 deletions(-)

diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts
index 0af5646..6a8219e 100644
--- a/miniprogram/pages/index/index.ts
+++ b/miniprogram/pages/index/index.ts
@@ -82,7 +82,6 @@
                     },
                     method: "GET",
                     success:(res)=>{
-                        console.log(res);
                         wx.setStorageSync('phone', res.data.msg)
                         if (res.data.data==2) {
                             wx.redirectTo(
@@ -114,7 +113,6 @@
                 //     },
                 //     method: "GET",
                 //     success: (res) => {
-                //         console.log(res);
                 //         //  濡傛灉鐢ㄦ埛宸茬粡娉ㄥ唽鐩存帴杩涘叆  鏈敞鍐岃繘鍏ュ浼�   role == 0鐢ㄦ埛  1璀﹀憳
                 //         wx.setStorageSync('token', res.data.data.token)
                 //         wx.setStorageSync('role', res.data.data.role)
diff --git a/miniprogram/pages/manager/index.ts b/miniprogram/pages/manager/index.ts
index 9f7c165..2b1c95d 100644
--- a/miniprogram/pages/manager/index.ts
+++ b/miniprogram/pages/manager/index.ts
@@ -30,7 +30,6 @@
             },
             method: "GET",
             success: (res) => {
-                console.log(res);
                 wx.setStorageSync('token', res.data.data.token)
                 wx.setStorageSync('role', res.data.data.role)
                 wx.setStorageSync('id', res.data.data.id)
@@ -38,7 +37,6 @@
                }})
     },
     getReport() {
-        console.log("xxx")
         wx.navigateTo({
             url: '../manager/report/index'
         })
diff --git a/miniprogram/pages/manager/report/detail/index.ts b/miniprogram/pages/manager/report/detail/index.ts
index a288fa7..cd4c26e 100644
--- a/miniprogram/pages/manager/report/detail/index.ts
+++ b/miniprogram/pages/manager/report/detail/index.ts
@@ -8,8 +8,8 @@
         isShow: false,
         causeList: [],
         causeIndex: null,
-        images:[],
-        array:["2022/08/19/5040f71639fd44b48228ce0e5c242727.jpeg", "2022/08/19/47bbd7c1d7bd4c07a0b17d671fe47010.jpeg"]
+        images: [],
+        array: ["2022/08/19/5040f71639fd44b48228ce0e5c242727.jpeg", "2022/08/19/47bbd7c1d7bd4c07a0b17d671fe47010.jpeg"]
     },
     // 浜嬩欢澶勭悊鍑芥暟
     bindViewTap() {
@@ -17,12 +17,12 @@
             url: '../logs/logs',
         })
     },
-//鏌ョ湅鍥剧墖
-face(){
-    wx.previewMedia({
-        sources:[{url:managerReportDetail.globalData.imageUrl+"/img/"+this.data.reportDetail.pic}]
-    })
-},
+    //鏌ョ湅鍥剧墖
+    face() {
+        wx.previewMedia({
+            sources: [{ url: managerReportDetail.globalData.imageUrl + "/img/" + this.data.reportDetail.pic }]
+        })
+    },
     //閫夋嫨妗堜欢
     pickCause(e: { detail: { value: string | number; }; }) {
         console.log(e);
@@ -31,67 +31,68 @@
         })
         this.data.reportDetail.causeId = this.data.causeList[e.detail.value].id
     },
-    cancel(){
+    cancel() {
         console.log("cancel")
         wx.navigateBack({
-
         })
     },
     //閫氳繃
-    pass(){
-        if(this.data.reportDetail.causeId==null){
+    pass() {
+        if (this.data.reportDetail.causeId == null) {
             wx.showToast({
-                title:"璇烽�夋嫨鍏宠仈妗堜欢",
-                icon:"error"
+                title: "璇烽�夋嫨鍏宠仈妗堜欢",
+                icon: "error"
             })
-        }else{
+        } else {
             wx.request(
                 {
-                    url: managerReportDetail.globalData.url +"/report/audit" ,
-                    method:"POST",
-                    data:this.data.reportDetail,
-                    header: { 'token':wx.getStorageSync('token') ,
-                    'content-type': 'application/json'
-                } ,success:(res)=>{
-                    console.log(res)
-                     wx.reLaunch({
-                        url:'../../cause/index'
-                    })
-                }   
-        })   
+                    url: managerReportDetail.globalData.url + "/report/audit",
+                    method: "POST",
+                    data: this.data.reportDetail,
+                    header: {
+                        'token': wx.getStorageSync('token'),
+                        'content-type': 'application/json'
+                    }, success: (res) => {
+                        console.log(res)
+                        wx.reLaunch({
+                            url: '../../cause/index'
+                        })
+                    }
+                })
         }
-},
+    },
     onLoad(e) {
-        console.log(e)
         wx.request(
             {
-                url:managerReportDetail.globalData.url+"/report/" + e.id,
+                url: managerReportDetail.globalData.url + "/report/" + e.id,
                 method: "GET",
-                header: { 'token':wx.getStorageSync('token') },
+                header: { 'token': wx.getStorageSync('token') },
                 success: (res) => {
+                    let contractMaterials = res.data.data.contractMaterials.split(",")
+                    let elseMaterials = res.data.data.elseMaterials.split(",")
+                    let idCardMaterials = res.data.data.idCardMaterials.split(",")
+                    let transactionMaterials = res.data.data.transactionMaterials.split(",")
                     this.setData({
                         reportDetail: res.data.data,
-                        images:res.data.data.reportMaterials.split(",")
+                        images: [...idCardMaterials,...contractMaterials,...transactionMaterials,...elseMaterials]
                     })
-                  console.log(this.data.reportDetail)
                     for (let index = 0; index < this.data.images.length; index++) {
-                        if(this.data.images!=null&&this.data.images[index]!=""&&this.data.images!=undefined){
-                            this.data.images[index]=managerReportDetail.globalData.imageUrl+"/img/"+this.data.images[index]
-                        }  else{
-                            this.data.images=[]
-                        } 
+                        if (this.data.images != null && this.data.images[index] != "" && this.data.images != undefined) {
+                            this.data.images[index] = managerReportDetail.globalData.imageUrl + "/img/" + this.data.images[index]
+                        } else {
+                            this.data.images = []
+                        }
                     }
                     this.setData({
-                        images:this.data.images
+                        images: this.data.images
                     })
-                  console.log(this.data.images)
                 }
             })
         wx.request(
             {
-                url: managerReportDetail.globalData.url+  "/cause/getCauseList",
+                url: managerReportDetail.globalData.url + "/cause/getCauseList",
                 method: "GET",
-                header: { 'token': wx.getStorageSync('token')},
+                header: { 'token': wx.getStorageSync('token') },
                 success: (res) => {
                     this.setData({
                         causeList: res.data.data.records
diff --git a/miniprogram/pages/user/index.ts b/miniprogram/pages/user/index.ts
index 284c23d..1fe27cb 100644
--- a/miniprogram/pages/user/index.ts
+++ b/miniprogram/pages/user/index.ts
@@ -26,7 +26,6 @@
             },
             method: "GET",
             success: (res) => {
-                console.log(res);
                 wx.setStorageSync('token', res.data.data.token)
                 wx.setStorageSync('role', res.data.data.role)
                 wx.setStorageSync('id', res.data.data.id)
@@ -61,7 +60,6 @@
        
     },
     getReport() {
-        console.log("xxx")
         wx.navigateTo({
             url: '../user/report/index'
         })
diff --git a/miniprogram/pages/user/loginInfo/index.ts b/miniprogram/pages/user/loginInfo/index.ts
index c9dd48e..1308f7a 100644
--- a/miniprogram/pages/user/loginInfo/index.ts
+++ b/miniprogram/pages/user/loginInfo/index.ts
@@ -67,7 +67,6 @@
                     },
                     method: "GET",
                     success: (res) => {
-                        console.log(res);
                         wx.setStorageSync('token', res.data.data.token)
                         wx.setStorageSync('role', res.data.data.role)
                         wx.setStorageSync('id', res.data.data.id)
diff --git a/miniprogram/pages/user/report/detail/index.ts b/miniprogram/pages/user/report/detail/index.ts
index 3b2e148..c961571 100644
--- a/miniprogram/pages/user/report/detail/index.ts
+++ b/miniprogram/pages/user/report/detail/index.ts
@@ -7,33 +7,30 @@
 
 Page({
     data: {
-        remarks:'',
+        remarks: '',
         reportDetail: {},
         isShow: false,
         causeIndex: 0,
-        images:[]
+        images: []
     },
 
-//鏌ョ湅鍥剧墖
-face(){
-    wx.previewMedia({
-        sources:[{url:userDetail.globalData.imageUrl+"/img/"+this.data.reportDetail.pic}]
-    })
-},
- 
-     onLoad(e) {
-       wx.request(
+    //鏌ョ湅鍥剧墖
+    face() {
+        wx.previewMedia({
+            sources: [{ url: userDetail.globalData.imageUrl + "/img/" + this.data.reportDetail.pic }]
+        })
+    },
+
+    onLoad(e) {
+        wx.request(
             {
                 url: userDetail.globalData.url + "/report/" + e.id,
                 method: "GET",
                 header: { 'token': wx.getStorageSync('token') },
                 success: (res) => {
-                    console.log(res)
-                    if (res.data.data.reportMaterials != null) {
-                        this.setData({
-                            images: res.data.data.reportMaterials.split(",").map(i=>userDetail.globalData.imageUrl + "/img/" +i)
-                        })
-                    }
+                    this.setData({
+                        images: [...res.data.data.idCardMaterials.split(","), ...res.data.data.contractMaterials.split(","), ...res.data.data.elseMaterials.split(","), ...res.data.data.transactionMaterials.split(",")].map(i => userDetail.globalData.imageUrl + "/img/" + i)
+                    })
                     this.setData({
                         reportDetail: res.data.data
                     })
@@ -48,7 +45,6 @@
                     // this.setData({
                     //     images: this.data.images
                     // })
-                    console.log(this.data.images)
                 }
             })
 
diff --git a/miniprogram/pages/user/report/index.ts b/miniprogram/pages/user/report/index.ts
index 844b17e..3672873 100644
--- a/miniprogram/pages/user/report/index.ts
+++ b/miniprogram/pages/user/report/index.ts
@@ -3,41 +3,44 @@
 const userReport = getApp()
 
 Page({
-  data: {
-      reportList:[],
-    isShow:false
-  },
-  // 浜嬩欢澶勭悊鍑芥暟
-  bindViewTap() {
-    wx.navigateTo({
-      url: '../logs/logs',
-    })
-  },
-  getDetail(e){
- wx.navigateTo({
-     url:'../report/detail/index?id='+e.currentTarget.id 
- })
-  },
-report(){
- wx.navigateTo({
-     url:'../report/submitReport/index'
- })
-},
-  onLoad() {
-      wx.request(  
-        {
-          url:userReport.globalData.url+"/wx/user/cause",
-          method:"GET",
-          header:{'token':wx.getStorageSync('token')},
-          data:{
-              id:wx.getStorageSync('id')
-          },
-          success:(res)=>{
-              console.log(res)
-              this.setData({
-                reportList:res.data.data
-              })
-          }
-              })
+    data: {
+        reportList: [],
+        isShow: false
+    },
+    // 浜嬩欢澶勭悊鍑芥暟
+    bindViewTap() {
+        wx.navigateTo({
+            url: '../logs/logs',
+        })
+    },
+    getDetail(e) {
+        let url = '../report/detail/index?id=' + e.currentTarget.id
+        if (e.currentTarget.dataset.word == 2) {
+            url = '../report/submitReport/index?id=' + e.currentTarget.id
+        }
+        wx.navigateTo({
+            url
+        })
+    },
+    report() {
+        wx.navigateTo({
+            url: '../report/submitReport/index'
+        })
+    },
+    onLoad() {
+        wx.request(
+            {
+                url: userReport.globalData.url + "/wx/user/cause",
+                method: "GET",
+                header: { 'token': wx.getStorageSync('token') },
+                data: {
+                    id: wx.getStorageSync('id')
+                },
+                success: (res) => {
+                    this.setData({
+                        reportList: res.data.data
+                    })
+                }
+            })
     }
 })
diff --git a/miniprogram/pages/user/report/index.wxml b/miniprogram/pages/user/report/index.wxml
index 0d8b1cf..cf0627a 100644
--- a/miniprogram/pages/user/report/index.wxml
+++ b/miniprogram/pages/user/report/index.wxml
@@ -5,7 +5,7 @@
        
     </van-empty>
         <view wx:for="{{reportList}}" wx:key="id">
-            <view class="conter" id="{{item.id}}" bindtap="getDetail">
+            <view class="conter" id="{{item.id}}" bindtap="getDetail" data-word="{{item.isInGroup}}">
                 <view class="inGroup" wx:if="{{item.isInGroup==1}}">宸茶繘缇�</view>
                 <view class="noInGroup" wx:if="{{item.isInGroup==0}}">鏈繘缇�</view>
                 <view class="noInGroup" wx:if="{{item.isInGroup==2}}">宸查┏鍥�</view>
diff --git a/miniprogram/pages/user/report/submitReport/index.ts b/miniprogram/pages/user/report/submitReport/index.ts
index 60046d8..39cdb1e 100644
--- a/miniprogram/pages/user/report/submitReport/index.ts
+++ b/miniprogram/pages/user/report/submitReport/index.ts
@@ -1,121 +1,114 @@
 // index.ts
-const submitReport =getApp()
+const submitReport = getApp()
 import Toast from '@vant/weapp/toast/toast';
 Page({
     data: {
-        capture:['camera'],
-        beforList:'a',
-        amountInvolved:'',
-        workingLocation:'',
-        Location:'',
-        userIdCard:'',
-        sex:'鐢�',
-        realName:'',
-        phone:'',
+        aaaform: {},
+        capture: ['camera'],
+        beforList: 'a',
+        amountInvolved: '',
+        workingLocation: '',
+        Location: '',
+        userIdCard: '',
+        sex: '鐢�',
+        realName: '',
+        phone: '',
         fileImgList: [],
-        transactionReceiptList:[],
-        otherList:[],
+        transactionReceiptList: [],
+        otherList: [],
         causeIndex: null,
-        items:  { name: '鏃ユ湡鏃堕棿閫夋嫨', value: 'dateTime' },
+        items: { name: '鏃ユ湡鏃堕棿閫夋嫨', value: 'dateTime' },
         mode: 'dateTime',
         reportDetail: {},
         causeList: [],
         imagesFile: [],
-        cardIdList:[],
+        cardIdList: [],
         images: [],
-        materials:'',
-        cheatTime:"",
+        materials: '',
+        cheatTime: "",
         arraySex: [
-             {sex:'鐢�',id:1},
-             {sex:'濂�',id:0}
-            ],
-            sexId:0
+            { sex: '鐢�', id: 1 },
+            { sex: '濂�', id: 0 }
+        ],
+        sexId: 0
     },
-    getrealName(e){
+    getrealName(e) {
         this.setData({
-            realName:e.detail
+            realName: e.detail
         })
     },
-    getsex(e){
+    getsex(e) {
         this.setData({
-            sex:e.detail
+            sex: e.detail
         })
     },
-    getuserIdCard(e){
+    getuserIdCard(e) {
         this.setData({
-            userIdCard:e.detail
+            userIdCard: e.detail
         })
     },
-    getLocation(e){
+    getLocation(e) {
         this.setData({
-            Location:e.detail
+            Location: e.detail
         })
     },
-    getworkingLocation(e){
+    getworkingLocation(e) {
         this.setData({
-            workingLocation:e.detail
+            workingLocation: e.detail
         })
     },
-    getamountInvolved(e){
+    getamountInvolved(e) {
         this.setData({
-            amountInvolved:e.detail
+            amountInvolved: e.detail
         })
     },
-    onChangeTabs(e){
+    onChangeTabs(e) {
         this.setData({
-            beforList:e.detail.name
+            beforList: e.detail.name
         })
     },
-    afterReadImg(event: { detail: { file: any; }; },name){
-        console.log(event,name);
-        
+    afterReadImg(event: { detail: { file: any; }; }, name) {
         const { file } = event.detail;
-        let that=this
-        console.log(file);
-        
+        let that = this
         // 褰撹缃� mutiple 涓� true 鏃�, file 涓烘暟缁勬牸寮忥紝鍚﹀垯涓哄璞℃牸寮�
         wx.uploadFile({
             // filePath:  this.data.imagesFile[index].tempFilePath,
-                        header: {
-                            'token': wx.getStorageSync('token'),
-                            'content-type': 'application/json'
-                        },
-          url: submitReport.globalData.url+"/minio/upload", 
-          filePath: file.url,
-          name: 'file',
-          formData: { user: 'test' },
-          success(res) {
-            // 涓婁紶瀹屾垚闇�瑕佹洿鏂� fileList
-            const { fileImgList = [] } = that.data;
-            const { transactionReceiptList = [] } = that.data;
-            const { otherList = [] } = that.data;
-            const { cardIdList = [] } = that.data;
-            let result = JSON.parse(res.data)
-            if (that.data.beforList=='a') {
-                cardIdList.push({ ...file, url: res.data });
-                that.setData({ cardIdList });
-            }else if(that.data.beforList=='b'){
-                fileImgList.push({ ...file, url: res.data });
-                that.setData({ fileImgList });
-            }else if(that.data.beforList=='c'){
-                transactionReceiptList.push({ ...file, url: res.data });
-                that.setData({ transactionReceiptList });
-            }else if(that.data.beforList=='d'){
-                otherList.push({ ...file, url: res.data });
-                that.setData({ otherList });
-            }
-           
-           
-            that.setData({
-                materials: that.data.materials+=result.data+","
-            })
-            console.log(that.data.materials);
-          },
+            header: {
+                'token': wx.getStorageSync('token'),
+                'content-type': 'application/json'
+            },
+            url: submitReport.globalData.url + "/minio/upload",
+            filePath: file.url,
+            name: 'file',
+            formData: { user: 'test' },
+            success(res) {
+                // 涓婁紶瀹屾垚闇�瑕佹洿鏂� fileList
+                const { fileImgList = [] } = that.data;
+                const { transactionReceiptList = [] } = that.data;
+                const { otherList = [] } = that.data;
+                const { cardIdList = [] } = that.data;
+                let result = JSON.parse(res.data)
+                if (that.data.beforList == 'a') {
+                    cardIdList.push({ ...file, url: result.data });
+                    that.setData({ cardIdList });
+                } else if (that.data.beforList == 'b') {
+                    fileImgList.push({ ...file, url: result.data });
+                    that.setData({ fileImgList });
+                } else if (that.data.beforList == 'c') {
+                    transactionReceiptList.push({ ...file, url: result.data });
+                    that.setData({ transactionReceiptList });
+                } else if (that.data.beforList == 'd') {
+                    otherList.push({ ...file, url: result.data });
+                    that.setData({ otherList });
+                }
+                that.setData({
+                    materials: that.data.materials += result.data + ","
+                })
+            },
         });
     },
     //閫夋嫨妗堜欢
     pickCause(e: { detail: { value: string | number; }; }) {
-        console.log(e);
         this.setData({
             causeIndex: e.detail.value
         })
@@ -123,117 +116,109 @@
     },
     uploadImage() {
         wx.chooseMedia({
-            sourceType:['camera'],
+            sourceType: ['camera'],
             mediaType: ['image'],
             success: res => {
                 this.setData({
                     imagesFile: res.tempFiles
                 })
-                console.log(this.data.imagesFile);
-                
-                for (let index = 0; index <  this.data.imagesFile.length; index++) {
+                for (let index = 0; index < this.data.imagesFile.length; index++) {
                     wx.uploadFile({
-                        filePath:  this.data.imagesFile[index].tempFilePath,
+                        filePath: this.data.imagesFile[index].tempFilePath,
                         name: "file",
                         header: {
                             'token': wx.getStorageSync('token'),
                             'content-type': 'application/json'
                         },
-                        url: submitReport.globalData.url+"/minio/upload",
+                        url: submitReport.globalData.url + "/minio/upload",
                         success: res => {
                             const result = JSON.parse(res.data)
-                                this.data.images.push({
-                                    url:submitReport.globalData.imageUrl+"/img/"+result.data
-                                })
-                                this.setData({
-                                    images:this.data.images
-                                })  
-                                this.setData({
-                                    materials: this.data.materials+=result.data+","
-                                })
-                                console.log(this.data.materials);
-                        } 
-                    })            
+                            this.data.images.push({
+                                url: submitReport.globalData.imageUrl + "/img/" + result.data
+                            })
+                            this.setData({
+                                images: this.data.images
+                            })
+                            this.setData({
+                                materials: this.data.materials += result.data + ","
+                            })
+                        }
+                    })
                 }
             }
         })
-   
-    },
-//琚獥鏃堕棿
-onPickerChange(e){
-    console.log(e)
-    this.data.cheatTime=e.detail.value
-},
-subSex(e){
-console.log(e);
 
-},
-bindPickerChangeSex(e){
-console.log(e);
-this.setData({
-    sexId:e.detail.value
-})
-this.setData({
-    sex:this.data.arraySex[e.detail.value].sex
-})
-},
-getMoney:function(e){
- console.log(e.detail.value)
- this.data.reportDetail.amountInvolved=e.detail.value
-},
-getDe:function(e){
-    console.log(e.detail.value)
-    this.data.reportDetail.reportDescription=e.detail.value
-   },
-   getInfor:function(e){
-    this.data.reportDetail.information=e.detail.value
-    console.log(e.detail.value)
-   },
+    },
+    //琚獥鏃堕棿
+    onPickerChange(e) {
+        this.data.cheatTime = e.detail.value
+    },
+    subSex(e) {
+    },
+    bindPickerChangeSex(e) {
+        this.setData({
+            sexId: e.detail.value
+        })
+        this.setData({
+            sex: this.data.arraySex[e.detail.value].sex
+        })
+    },
+    getMoney: function (e) {
+        this.data.reportDetail.amountInvolved = e.detail.value
+    },
+    getDe: function (e) {
+        this.data.reportDetail.reportDescription = e.detail.value
+    },
+    getInfor: function (e) {
+        this.data.reportDetail.information = e.detail.value
+    },
     //閫氳繃
-    cancel(){
-       wx.navigateBack({
-        delta:1
-       })
+    cancel() {
+        wx.navigateBack({
+            delta: 1
+        })
     },
     pass() {
-        console.log(this.data.realName);
-        if (this.data.realName=='') {
+        if (this.data.realName == '') {
             Toast('璇疯緭鍏ュ鍚嶏紒');
             return
-        } else if(this.data.userIdCard=='') {
+        } else if (this.data.userIdCard == '') {
             Toast('璇疯緭鍏ヨ韩浠借瘉锛�');
             return
-        }else if(this.data.Location=='') {
+        } else if (this.data.Location == '') {
             Toast('璇疯緭鍏ョ幇浣忓潃锛�');
             return
-        }else if(this.data.workingLocation=='') {
+        } else if (this.data.workingLocation == '') {
             Toast('璇疯緭鍏ュ伐浣滃崟浣嶏紒');
             return
-        }else if(this.data.amountInvolved=='') {
+        } else if (this.data.amountInvolved == '') {
             Toast('璇疯緭鍏ュ彈鎹熼噾棰濓紒');
             return
-        }else if(this.data.cardIdList.length!=2) {
+        } else if (this.data.cardIdList.length != 2) {
             Toast('璇烽�夋嫨韬唤璇佺収鐗囷紒');
             return
         }
-        if (this.data.fileImgList.length!=0||this.data.transactionReceiptList.length!=0||this.data.otherList.length!=0) {
-          
-        }else{
-           
+        if (this.data.fileImgList.length != 0 || this.data.transactionReceiptList.length != 0 || this.data.otherList.length != 0) {
+
+        } else {
             Toast('鐩稿叧鍚堝悓锛屼氦鏄撳嚟璇侊紝鍏朵粬;蹇呭~涓�椤癸紒');
             return
         }
-        this.data.materials=this.data.materials.substring(0,this.data.materials.length-1);
-        this.data.reportDetail.amountInvolved=this.data.amountInvolved,
-        this.data.reportDetail.workingLocation=this.data.workingLocation,
-        this.data.reportDetail.Location=this.data.Location,
-        this.data.reportDetail.userIdCard=this.data.userIdCard,
-        this.data.reportDetail.sex=this.data.sex,
-        this.data.reportDetail.realName=this.data.realName,
-        this.data.reportDetail.phone=this.data.phone,
-        this.data.reportDetail.reportMaterials=this.data.materials
-        this.data.reportDetail.userId=wx.getStorageSync('id')
-        this.data.reportDetail.cheatTime=this.data.cheatTime
+        this.data.materials = this.data.materials.substring(0, this.data.materials.length - 1);
+        this.data.reportDetail.amountInvolved = this.data.amountInvolved
+        this.data.reportDetail.workingLocation = this.data.workingLocation
+        this.data.reportDetail.location = this.data.Location
+        this.data.reportDetail.userIdCard = this.data.userIdCard
+        this.data.reportDetail.sex = this.data.sex
+        this.data.reportDetail.realName = this.data.realName
+        this.data.reportDetail.phone = this.data.phone
+        this.data.reportDetail.reportMaterials = this.data.materials
+        this.data.reportDetail.userId = wx.getStorageSync('id')
+        this.data.reportDetail.cheatTime = this.data.cheatTime
+        this.data.reportDetail.idCardMaterials = this.data.cardIdList.map(res => res.url).join(',')
+        this.data.reportDetail.contractMaterials = this.data.fileImgList.map(res => res.url).join(',')
+        this.data.reportDetail.transactionMaterials = this.data.transactionReceiptList.map(res => res.url).join(',')
+        this.data.reportDetail.elseMaterials = this.data.otherList.map(res => res.url).join(',')
         // if (  this.data.reportDetail.information==null||  this.data.reportDetail.reportDescription==null) {
         //     wx.showToast({
         //         icon: "none",
@@ -243,33 +228,31 @@
         // }
         wx.request(
             {
-                url: submitReport.globalData.url+"/wx/user/addReport",
+                url: submitReport.globalData.url + "/wx/user/addReport",
                 method: "POST",
                 data: this.data.reportDetail,
                 header: {
                     'token': wx.getStorageSync('token'),
                     'content-type': 'application/json'
                 }, success: (res) => {
-                    console.log(res)
                     wx.reLaunch({
-                        url:'../../report/index'
+                        url: '../../report/index'
                     })
                 }
             })
-
-
     },
     onLoad(e) {
+        let that = this
         let phone = wx.getStorageSync('phone')
         this.setData({
-            phone:phone
+            phone: phone
         })
         var date = new Date()
         var month = date.getMonth() + 1
         var day = date.getDate()
-        var hours=date.getHours()
-        var minutes=date.getMinutes()
-        var secends=date.getSeconds()
+        var hours = date.getHours()
+        var minutes = date.getMinutes()
+        var secends = date.getSeconds()
         var time
         if (month < 10) {
             month = "0" + month
@@ -286,18 +269,87 @@
         if (secends < 10) {
             secends = "0" + secends
         }
-        this.data.cheatTime = date.getFullYear() + "-" + month + "-" + day + " " + hours+":"+minutes+":"+secends
-        console.log( this.data.cheatTime)
+        this.data.cheatTime = date.getFullYear() + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + secends
+        this.loadData(e)
         wx.request(
             {
-                url: submitReport.globalData.url+  "/cause/getCauseList",
+                url: submitReport.globalData.url + "/cause/getVxCauseList?phone=" + that.data.phone,
                 method: "GET",
-                header: { 'token': wx.getStorageSync('token')},
+                header: { 'token': wx.getStorageSync('token') },
                 success: (res) => {
+                    let causes = res.data.data
+                    console.log(that.data.aaaform);
+                    if (e.id) {
+                        causes.push({
+                            id: that.data.aaaform.causeId,
+                            name: that.data.aaaform.description
+                        })
+                    }
                     this.setData({
-                        causeList: res.data.data.records
+                        causeList: causes,
+                        causeIndex: causes.findIndex(i => i.id == that.data.aaaform.causeId)
                     })
                 }
             })
+    },
+    loadData(e: any) {
+        let that = this
+        const { arraySex } = this.data
+        if (e.id) {
+            wx.request({
+                url: submitReport.globalData.url + "/report/rejectReport/" + e.id,
+                method: "GET",
+                header: { 'token': wx.getStorageSync('token') },
+                success: res => {
+                    let form = res.data.data
+                    this.setData({
+                        aaaform: form,
+                        realName: form.realName,
+                        phone: form.mobile,
+                        userIdCard: form.userIdCard,
+                        amountInvolved: form.amountInvolved,
+                        sex: form.sex,
+                        sexId: arraySex.filter(i => i.sex == form.sex)[0].code,
+                        Location: form.location,
+                        workingLocation: form.workingLocation,
+                        cardIdList: form.idCardMaterials.split(',').map(i => {
+                            return {
+                                thumb: that.imgComplete(i),
+                                url: i,
+                                type: "image",
+                                size: 999999
+                            }
+                        }),
+                        fileImgList: form.contractMaterials.split(',').map(i => {
+                            return {
+                                thumb: that.imgComplete(i),
+                                url: i,
+                                type: "image",
+                                size: 999999
+                            }
+                        }),
+                        transactionReceiptList: form.transactionMaterials.split(',').map(i => {
+                            return {
+                                thumb: that.imgComplete(i),
+                                url: i,
+                                type: "image",
+                                size: 999999
+                            }
+                        }),
+                        otherList: form.elseMaterials.split(',').map(i => {
+                            return {
+                                thumb: that.imgComplete(i),
+                                url: i,
+                                type: "image",
+                                size: 999999
+                            }
+                        })
+                    })
+                }
+            })
+        }
+    },
+    imgComplete(file: String): String {
+        return submitReport.globalData.imageUrl + "/img/" + file
     }
 })
\ No newline at end of file
diff --git a/miniprogram/pages/user/report/submitReport/index.wxml b/miniprogram/pages/user/report/submitReport/index.wxml
index 206154e..63600f7 100644
--- a/miniprogram/pages/user/report/submitReport/index.wxml
+++ b/miniprogram/pages/user/report/submitReport/index.wxml
@@ -6,128 +6,64 @@
         <view class="text">涓烘洿蹇鏍革紝璇峰瀹炲~鍐欑浉鍏充俊鎭紝*涓哄繀濉」</view>
     </view>
     <van-cell-group>
-  <van-field
-  bind:input="getrealName"
-     required
-    value="{{ realName }}"
-    label="濮撳悕"
-    placeholder="璇疯緭鍏ュ鍚�"
-  />
-  <!-- <van-field
+        <van-field bind:input="getrealName" required value="{{ realName }}" label="濮撳悕" placeholder="璇疯緭鍏ュ鍚�" />
+        <!-- <van-field
   bind:input="getsex"
   required
     value="{{ sex }}"
     label="鎬у埆"
     placeholder="璇疯緭鍏ュ鍚�"
   /> -->
-  <view class="listSex">
-        <view > <span class="list-sure">*</span>鎬у埆</view>
-        <picker bindchange="bindPickerChangeSex" value="{{sexId}}" range="{{arraySex}}" range-key="sex" >
-    <view class="picker">
-      褰撳墠閫夋嫨锛歿{arraySex[sexId].sex}}
-    </view>
-  </picker>
-    </view>
- 
-  <van-field
-  bind:input="getuserIdCard"
-    required
-    value="{{ userIdCard }}"
-    label="韬唤璇�"
-    placeholder="璇疯緭鍏ヨ韩浠借瘉"
-  />
-  <van-field
-    disabled
-    required
-    value="{{ phone }}"
-    label="鑱旂郴鐢佃瘽"
-    placeholder="璇疯緭鍏ヨ仈绯荤數璇�"
-    
-  />
-  <van-field
-  bind:input="getLocation"
-    required
-    value="{{ Location }}"
-    label="鐜颁綇鍧�"
-    placeholder="璇疯緭鍏ョ幇浣忓潃"
-   
-  />
-  <van-field
-  bind:input="getworkingLocation"
-    required
-    value="{{ workingLocation }}"
-    label="宸ヤ綔鍗曚綅"
-    placeholder="璇疯緭鍏ュ伐浣滃崟浣�"
-   
-  />
-  <view class="cause">
-    <view class="font-wenzi-cause">鎻忚堪</view>
-        <picker bindchange="pickCause" class="content" value="{{causeIndex}}" range="{{causeList}}" range-key="{{'name'}}" mode="selector">
-                    <view class="picker-cause">
-            {{causeIndex==null?'璇烽�夋嫨':causeList[causeIndex].name}}>
-            </view>
-        </picker>
-       
-    </view>
-  <van-field
-  bind:input="getamountInvolved"
-    required
-    value="{{ amountInvolved }}"
-    label="鍙楁崯閲戦"
-    placeholder="璇疯緭鍏ュ彈鎹熼噾棰�"
-  />
-  <van-field
-    required
-    readonly
-    value="{{  }}"
-    label="浣滆瘉鏉愭枡"
-    placeholder=" "
-  >
+        <view class="listSex">
+            <view> <span class="list-sure">*</span>鎬у埆</view>
+            <picker bindchange="bindPickerChangeSex" value="{{sexId}}" range="{{arraySex}}" range-key="sex">
+                <view class="picker">
+                    褰撳墠閫夋嫨锛歿{arraySex[sexId].sex}}
+                </view>
+            </picker>
+        </view>
 
-</van-field>
-<van-notice-bar
-  left-icon="volume-o"
-  text="韬唤璇佹鍙嶅繀濉�,鐩稿叧鍚堝悓锛屼氦鏄撳嚟璇侊紝鍏朵粬锛涗笁涓繀椤昏濉啓涓�涓�"
+        <van-field bind:input="getuserIdCard" required value="{{ userIdCard }}" label="韬唤璇�" placeholder="璇疯緭鍏ヨ韩浠借瘉" />
+        <van-field disabled required value="{{ phone }}" label="鑱旂郴鐢佃瘽" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" />
+        <van-field bind:input="getLocation" required value="{{ Location }}" label="鐜颁綇鍧�" placeholder="璇疯緭鍏ョ幇浣忓潃" />
+        <van-field bind:input="getworkingLocation" required value="{{ workingLocation }}" label="宸ヤ綔鍗曚綅" placeholder="璇疯緭鍏ュ伐浣滃崟浣�" />
+        <view class="cause">
+            <view class="font-wenzi-cause">鎻忚堪</view>
+            <picker bindchange="pickCause" class="content" value="{{causeIndex}}" range="{{causeList}}" range-key="{{'name'}}" mode="selector">
+                <view class="picker-cause">
+                    {{causeIndex==null?'璇烽�夋嫨':causeList[causeIndex].name}}>
+                </view>
+            </picker>
 
-/>
-<!-- <view class="upload" bindtap="uploadImage">
+        </view>
+        <van-field bind:input="getamountInvolved" required value="{{ amountInvolved }}" label="鍙楁崯閲戦" placeholder="璇疯緭鍏ュ彈鎹熼噾棰�" />
+        <van-field required readonly value="{{  }}" label="浣滆瘉鏉愭枡" placeholder=" ">
+
+        </van-field>
+        <van-notice-bar left-icon="volume-o" text="韬唤璇佹鍙嶅繀濉�,鐩稿叧鍚堝悓锛屼氦鏄撳嚟璇侊紝鍏朵粬锛涗笁涓繀椤昏濉啓涓�涓�" />
+        <!-- <view class="upload" bindtap="uploadImage">
                 <image class="imageUp" src="../../../icon/Photograph.png"></image>
                 <view class="upload-wenzi">鎷嶆憚韬唤璇佺収鐗�</view>
             </view>
             <view class="imagess" wx:for="{{images}}" wx:key="index">
                 <image class="image" style="width: 100%;" src="{{item.url}}" mode="aspectFill"></image>
             </view> -->
-<van-tabs active="a" ellipsis="{{false}}" bind:change="onChangeTabs">
-  <van-tab title="韬唤璇佹鍙嶉潰"   name="a">
-    <van-uploader
-  file-list="{{ cardIdList }}"
-  max-count="2"
-  bind:after-read="afterReadImg"
-  capture="{{ capture }}"
-  accept="image"
-/>
+        <van-tabs active="a" ellipsis="{{false}}" bind:change="onChangeTabs">
+            <van-tab title="韬唤璇佹鍙嶉潰" name="a">
+                <van-uploader file-list="{{ cardIdList }}" max-count="2" bind:after-read="afterReadImg" capture="{{ capture }}" accept="image" />
 
-  </van-tab>
-  <van-tab title="鐩稿叧鍚堝悓" name="b">
-    <van-uploader
-  file-list="{{ fileImgList }}"
-  bind:after-read="afterReadImg"
-/>
-  </van-tab>
-  <van-tab title="浜ゆ槗鍑瘉" name="c">
-    <van-uploader
-  file-list="{{ transactionReceiptList }}"
-  bind:after-read="afterReadImg"
-/>
-  </van-tab>
-  <van-tab title="鍏朵粬"  name="d">
-    <van-uploader
-  file-list="{{ otherList }}"
-  bind:after-read="afterReadImg"
-/>
-</van-tab>
-</van-tabs>
-</van-cell-group>
+            </van-tab>
+            <van-tab title="鐩稿叧鍚堝悓" name="b">
+                <van-uploader file-list="{{ fileImgList }}" bind:after-read="afterReadImg" />
+            </van-tab>
+            <van-tab title="浜ゆ槗鍑瘉" name="c">
+                <van-uploader file-list="{{ transactionReceiptList }}" bind:after-read="afterReadImg" />
+            </van-tab>
+            <van-tab title="鍏朵粬" name="d">
+                <van-uploader file-list="{{ otherList }}" bind:after-read="afterReadImg" />
+            </van-tab>
+        </van-tabs>
+    </van-cell-group>
 
     <!-- <view class="list1">
         <picker bindchange="cheatTime" class="content"  mode="time">璇烽�夋嫨 </picker>
@@ -167,7 +103,7 @@
         <input bindinput="getInfor" maxlength="140"  class="content" placeholder="璇疯緭鍏�"  />
         <view class="font-wenzi">琛ュ厖淇℃伅</view>
     </view> -->
-        <!-- <view>
+    <!-- <view>
             <view class="font-wenzi-1">鎶ユ鏉愭枡</view>
             <view class="upload" bindtap="uploadImage">
                 <image class="imageUp" src="../../../icon/Photograph.png"></image>
@@ -178,14 +114,14 @@
             </view>
         </view> -->
 
-        <!-- <view class="list1">
+    <!-- <view class="list1">
         <picker bindchange="pickCause" class="content" value="{{causeIndex}}" range="{{causeList}}" range-key="{{'name'}}" mode="selector">璇烽�夋嫨 >
         </picker>
         <view class="font-wenzi">鍏宠仈妗堜欢</view>
     </view> -->
-        <view class="button">
-            <button class="button2" size="mini" bindtap="pass">鎻愪氦</button>
-            <button class="button1" size="mini" bindtap="cancel">鍙栨秷</button>
-        </view>
-        <van-toast id="van-toast" />
-    </view>
\ No newline at end of file
+    <view class="button">
+        <button class="button2" size="mini" bindtap="pass">鎻愪氦</button>
+        <button class="button1" size="mini" bindtap="cancel">鍙栨秷</button>
+    </view>
+    <van-toast id="van-toast" />
+</view>
\ No newline at end of file

--
Gitblit v1.8.0