From 4b48bacef8646cee8b66f5e10b0ed7124534e93e Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 12 五月 2023 17:10:47 +0800
Subject: [PATCH] 首页修改

---
 miniprogram/pages/manager/report/detail/index.ts |  196 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 138 insertions(+), 58 deletions(-)

diff --git a/miniprogram/pages/manager/report/detail/index.ts b/miniprogram/pages/manager/report/detail/index.ts
index 00b04df..532039f 100644
--- a/miniprogram/pages/manager/report/detail/index.ts
+++ b/miniprogram/pages/manager/report/detail/index.ts
@@ -4,86 +4,166 @@
 
 Page({
     data: {
+        valuereject: '',
+        showreject: false,
+        arraySex: [
+            { sex: '鐢�', id: 1 },
+            { sex: '濂�', id: 0 }
+        ],
+        sex: '鐢�',
+        sexId: 0,
+        datae: null,
+        idCardMaterials: [], //  韬唤璇�
+        contractMaterials: [],//  鍚堝悓
+        transactionMaterials: [],//  浜ゆ槗
+        elseMaterials: [],//  鍏朵粬
         reportDetail: {},
         isShow: false,
         causeList: [],
-        causeIndex: 0,
-        images:[],
-        array:["2022/08/19/5040f71639fd44b48228ce0e5c242727.jpeg", "2022/08/19/47bbd7c1d7bd4c07a0b17d671fe47010.jpeg"]
+        causeIndex: null,
+        images: [],
+        array: ["2022/08/19/5040f71639fd44b48228ce0e5c242727.jpeg", "2022/08/19/47bbd7c1d7bd4c07a0b17d671fe47010.jpeg"]
     },
+    onChangereject(e) {
+        console.log(e);
+        this.setData({
+            valuereject: e.detail
+        })
+    },
+    deny() {
+        this.setData({ showreject: true });
+    },
+    subreject() {
+        console.log('6666666666');
+        let parms = {
+            id: this.data.reportDetail.id,
+            reason: this.data.valuereject
+        }
+        wx.request(
+            {
+                url: managerReportDetail.globalData.url + "/report/reject",
+                method: "POST",
+                data: parms,
+                header: { 'token': wx.getStorageSync('token') },
+                success: (res) => {
+                    console.log(res);
+                    wx.reLaunch({
+                        url: '/pages/user/index'
+                    })
+                }
+            })
+    },
+
+    onClose() {
+        this.setData({ showreject: false });
+    },
+
     // 浜嬩欢澶勭悊鍑芥暟
     bindViewTap() {
         wx.navigateTo({
             url: '../logs/logs',
         })
     },
-//鏌ョ湅鍥剧墖
-face(){
-    wx.previewMedia({
-        sources:[{url:managerCauseDetail.globalData.imageUrl+"/img/"+this.data.reportDetail.pic}]
-    })
-},
-    //閫夋嫨妗堜欢
-    pickCause(e) {
-        this.data.reportDetail.causeId = this.data.causeList[e.detail.value].id
-        console.log(this.data.reportDetail)
+    bindPickerChangeSex(e) {
+        console.log(e);
 
+        this.setData({
+            sexId: e.detail.value
+        })
+        this.setData({
+            sex: this.data.arraySex[e.detail.value].sex
+        })
+    },
+    //鏌ョ湅鍥剧墖
+    face() {
+        wx.previewMedia({
+            sources: [{ url: managerReportDetail.globalData.imageUrl + "/img/" + this.data.reportDetail.pic }]
+        })
+    },
+    //閫夋嫨妗堜欢
+    pickCause(e: { detail: { value: string | number; }; }) {
+        console.log(e);
+        this.setData({
+            causeIndex: e.detail.value
+        })
+        this.data.reportDetail.causeId = this.data.causeList[e.detail.value].id
+    },
+    cancel() {
+        console.log("cancel")
+        wx.navigateBack({
+        })
     },
     //閫氳繃
-    pass(){
-        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'
-                })
-            }   
-    })   
-   
-
-},
-    onLoad(e) {
-        console.log(e)
-        wx.request(
-            {
-                url:managerReportDetail.globalData.url+"/report/" + e.id,
-                method: "GET",
-                // header: { 'token':wx.getStorageSync('token') },
-                success: (res) => {
-                    this.setData({
-                        reportDetail: res.data.data,
-                        images:res.data.data.reportMaterials.split(",")
-                    })
-                  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]=managerCauseDetail.globalData.imageUrl+"/img/"+this.data.images[index]
-                        }  else{
-                            this.data.images=[]
-                        } 
-                    }
-                    this.setData({
-                        images:this.data.images
-                    })
-                  console.log(this.data.images)
-                }
+    pass() {
+        if (this.data.reportDetail.causeId == null) {
+            wx.showToast({
+                title: "璇烽�夋嫨鍏宠仈妗堜欢",
+                icon: "error"
             })
+        } 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'
+                        })
+                    }
+                })
+        }
+    },
+    onChangeTabs(e) {
+        console.log(e);
+
+    },
+    onLoad(e) {
         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.data.causeList = res.data.data.records
                     this.setData({
                         causeList: res.data.data.records
                     })
+                    this.getDataList(e)
                 }
             })
+    },
+    getDataList(e) {
+        wx.request(
+            {
+                url: managerReportDetail.globalData.url + "/report/" + e.id,
+                method: "GET",
+                header: { 'token': wx.getStorageSync('token') },
+                success: (res) => {
+                    let detail = res.data.data
+                    console.log(this.data.causeList);
+                    this.setData({
+                        causeIndex: this.data.causeList.findIndex(val => { return val.id == detail.causeId }),
+                        reportDetail: detail,
+                        sex: detail.sex,
+                        contractMaterials: this.materialStringToArray(detail.contractMaterials),
+                        idCardMaterials: this.materialStringToArray(detail.idCardMaterials),
+                        transactionMaterials: this.materialStringToArray(detail.transactionMaterials),
+                        elseMaterials: this.materialStringToArray(detail.elseMaterials)
+                    })
+                    console.log(this.data.idCardMaterials);
+                }
+            })
+    },
+    materialStringToArray(s: string): string[] {
+        if (s == '' || s == null) {
+            return []
+        } else {
+            return s.split(',').map(i => managerReportDetail.globalData.imageUrl + "/img/" + i)
+        }
     }
 })

--
Gitblit v1.8.0