From 965bab31a44a500ff816d6b4bf925098140121fd Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期三, 22 三月 2023 11:24:52 +0800
Subject: [PATCH] 修改我要报案已驳回

---
 miniprogram/pages/user/group/message/index.wxml       |    3 +
 miniprogram/pages/user/report/submitReport/index.ts   |  105 +++++++++++++++++++++++++++++++++++++---------------
 miniprogram/pages/user/report/submitReport/index.wxml |    8 +++
 3 files changed, 84 insertions(+), 32 deletions(-)

diff --git a/miniprogram/pages/user/group/message/index.wxml b/miniprogram/pages/user/group/message/index.wxml
index 23324e9..2fab02d 100644
--- a/miniprogram/pages/user/group/message/index.wxml
+++ b/miniprogram/pages/user/group/message/index.wxml
@@ -6,9 +6,10 @@
         <view class="chat-left" wx:if="{{item.id!=uid}}">
             <image wx:if="{{item.role==1&&item.sex=='鐢�'}}" class="face" src="../../../../image/policeman.png"></image>
             <image wx:if="{{item.role==1&&item.sex=='濂�'}}" class="face" src="../../../../image/policewman.png"></image>
+            <image wx:if="{{item.role==1&&item.sex==null}}" class="face" src="../../../../image/policeman.png"></image>
             <image wx:if="{{item.role==0&&item.sex=='濂�'}}" class="face" src="../../../../image/userlady.jpg"></image>
             <image wx:if="{{item.role==0&&item.sex=='鐢�'}}" class="face" src="../../../../image/userman.jpg"></image>
-            <image wx:if="{{item.sex==null}}" class="face"  src="../../../../image/userman.jpg"></image>
+            <image wx:if="{{item.role==0&&item.sex==null}}" class="face"  src="../../../../image/userman.jpg"></image>
             <!-- <view class="chat-message-left">{{item.name}}-{{item.mobile}}</view> -->
             <view class="chat-context-left">{{item.text}}</view>
             <view class="chat-site-left"></view>
diff --git a/miniprogram/pages/user/report/submitReport/index.ts b/miniprogram/pages/user/report/submitReport/index.ts
index 39cdb1e..78ef684 100644
--- a/miniprogram/pages/user/report/submitReport/index.ts
+++ b/miniprogram/pages/user/report/submitReport/index.ts
@@ -1,8 +1,12 @@
 // index.ts
 const submitReport = getApp()
 import Toast from '@vant/weapp/toast/toast';
+import { formatTime } from 'miniprogram/utils/util';
 Page({
     data: {
+        isInGroup:'',
+        remarks: '',
+        addFig:false,
         aaaform: {},
         capture: ['camera'],
         beforList: 'a',
@@ -19,7 +23,9 @@
         causeIndex: null,
         items: { name: '鏃ユ湡鏃堕棿閫夋嫨', value: 'dateTime' },
         mode: 'dateTime',
-        reportDetail: {},
+        reportDetail: {
+            causeId:''
+        },
         causeList: [],
         imagesFile: [],
         cardIdList: [],
@@ -113,6 +119,8 @@
             causeIndex: e.detail.value
         })
         this.data.reportDetail.causeId = this.data.causeList[e.detail.value].id
+        console.log(e,this.data.causeIndex,this.data.reportDetail.causeId);
+        
     },
     uploadImage() {
         wx.chooseMedia({
@@ -147,7 +155,7 @@
                 }
             }
         })
-
+ 
     },
     //琚獥鏃堕棿
     onPickerChange(e) {
@@ -156,6 +164,8 @@
     subSex(e) {
     },
     bindPickerChangeSex(e) {
+        console.log(e);
+        
         this.setData({
             sexId: e.detail.value
         })
@@ -179,6 +189,8 @@
         })
     },
     pass() {
+        console.log(this.data.reportDetail.causeId);
+        
         if (this.data.realName == '') {
             Toast('璇疯緭鍏ュ鍚嶏紒');
             return
@@ -191,15 +203,18 @@
         } else if (this.data.workingLocation == '') {
             Toast('璇疯緭鍏ュ伐浣滃崟浣嶏紒');
             return
+        }else if (this.data.reportDetail.causeId == '') {
+            Toast('璇烽�夋嫨鎻忚堪锛�');
+            return
         } else if (this.data.amountInvolved == '') {
             Toast('璇疯緭鍏ュ彈鎹熼噾棰濓紒');
             return
         } 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 {
             Toast('鐩稿叧鍚堝悓锛屼氦鏄撳嚟璇侊紝鍏朵粬;蹇呭~涓�椤癸紒');
             return
@@ -229,7 +244,7 @@
         wx.request(
             {
                 url: submitReport.globalData.url + "/wx/user/addReport",
-                method: "POST",
+                method: this.data.addFig?"PUT":"POST",
                 data: this.data.reportDetail,
                 header: {
                     'token': wx.getStorageSync('token'),
@@ -241,10 +256,13 @@
                 }
             })
     },
-    onLoad(e) {
+    onLoad:function(e) {
+        console.log(e);
+
         let that = this
+       
         let phone = wx.getStorageSync('phone')
-        this.setData({
+        that.setData({
             phone: phone
         })
         var date = new Date()
@@ -270,46 +288,72 @@
             secends = "0" + secends
         }
         this.data.cheatTime = date.getFullYear() + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + secends
-        this.loadData(e)
-        wx.request(
-            {
-                url: submitReport.globalData.url + "/cause/getVxCauseList?phone=" + that.data.phone,
-                method: "GET",
-                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
+        if (e.id ) {
+            this.loadData(e)
+        }else{
+            wx.request(
+                {
+                    url: submitReport.globalData.url + "/cause/getVxCauseList?phone=" + that.data.phone,
+                    method: "GET",
+                    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({                              
+                                causeIndex: causes.findIndex(i => i.id == that.data.aaaform.causeId)
+                            })
+                        }                       
+                        this.setData({
+                            causeList: causes,
+                            // causeIndex: causes.findIndex(i => i.id == that.data.aaaform.causeId)
                         })
+                        console.log(this.data.causeList,this.data.causeIndex);
+                        
                     }
-                    this.setData({
-                        causeList: causes,
-                        causeIndex: causes.findIndex(i => i.id == that.data.aaaform.causeId)
-                    })
-                }
-            })
+                })
+        }
+       
+      
     },
     loadData(e: any) {
+        console.log(e);
         let that = this
-        const { arraySex } = this.data
-        if (e.id) {
+        that.setData({
+            addFig:true
+        })
+        const { arraySex } = that.data
             wx.request({
                 url: submitReport.globalData.url + "/report/rejectReport/" + e.id,
                 method: "GET",
                 header: { 'token': wx.getStorageSync('token') },
                 success: res => {
                     let form = res.data.data
+                    console.log(arraySex,arraySex.findIndex(val=>{return val.sex == form.sex}),form.sex)
+                    
                     this.setData({
+                        remarks:form.remarks,
+                        isInGroup:form.isInGroup,
+                        reportDetail:{
+                            causeId:form.causeId,
+                            id:form.id
+                        },
+                        causeList:[{
+                            id:form.causeId,
+                            name:form.description
+                        }],
+                        causeIndex: 0,
                         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,
+                        sexId: arraySex.findIndex(val=>{return val.sex == form.sex}),
                         Location: form.location,
                         workingLocation: form.workingLocation,
                         cardIdList: form.idCardMaterials.split(',').map(i => {
@@ -347,7 +391,8 @@
                     })
                 }
             })
-        }
+      
+        
     },
     imgComplete(file: String): String {
         return submitReport.globalData.imageUrl + "/img/" + file
diff --git a/miniprogram/pages/user/report/submitReport/index.wxml b/miniprogram/pages/user/report/submitReport/index.wxml
index 63600f7..41b0c53 100644
--- a/miniprogram/pages/user/report/submitReport/index.wxml
+++ b/miniprogram/pages/user/report/submitReport/index.wxml
@@ -1,5 +1,11 @@
 <!--index.wxml-->
 <view>
+    <van-notice-bar
+    wx:if="{{isInGroup==2}}"
+  left-icon="volume-o"
+  text="{{'椹冲洖鍘熷洜锛�'+remarks}}"
+
+/>
     <view>
         <!-- <view class="content">{{reportDetail.reporterName}}</view>
         <view class="font-wenzi">鎶ユ浜哄鍚�</view> -->
@@ -28,7 +34,7 @@
         <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>
+            <view class="font-wenzi-cause"> <span class="list-sure">*</span>鎻忚堪</view>
             <picker bindchange="pickCause" class="content" value="{{causeIndex}}" range="{{causeList}}" range-key="{{'name'}}" mode="selector">
                 <view class="picker-cause">
                     {{causeIndex==null?'璇烽�夋嫨':causeList[causeIndex].name}}>

--
Gitblit v1.8.0