From d9687af294a85b72bab88657bcae70c99ca0b6ae Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期二, 21 三月 2023 11:27:31 +0800
Subject: [PATCH] 修改我要报案

---
 miniprogram/pages/user/report/submitReport/index.ts |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 106 insertions(+), 7 deletions(-)

diff --git a/miniprogram/pages/user/report/submitReport/index.ts b/miniprogram/pages/user/report/submitReport/index.ts
index 086251a..0f0207d 100644
--- a/miniprogram/pages/user/report/submitReport/index.ts
+++ b/miniprogram/pages/user/report/submitReport/index.ts
@@ -1,16 +1,28 @@
 // index.ts
 const submitReport =getApp()
+import Toast from '@vant/weapp/toast/toast';
 Page({
     data: {
+        beforList:'a',
+        amountInvolved:'',
+        workingLocation:'',
+        Location:'',
+        userIdCard:'',
+        sex:'鐢�',
+        realName:'',
+        phone:wx.getStorageSync('phone'),
         fileImgList: [],
+        transactionReceiptList:[],
+        otherList:[],
         causeIndex: null,
         items:  { name: '鏃ユ湡鏃堕棿閫夋嫨', value: 'dateTime' },
         mode: 'dateTime',
         reportDetail: {},
         causeList: [],
         imagesFile: [],
+        cardIdList:[],
         images: [],
-        materials:"",
+        materials:'',
         cheatTime:"",
         arraySex: [
              {sex:'鐢�',id:1},
@@ -18,7 +30,44 @@
             ],
             sexId:0
     },
-    afterReadImg(event: { detail: { file: any; }; }){
+    getrealName(e){
+        this.setData({
+            realName:e.detail
+        })
+    },
+    getsex(e){
+        this.setData({
+            sex:e.detail
+        })
+    },
+    getuserIdCard(e){
+        this.setData({
+            userIdCard:e.detail
+        })
+    },
+    getLocation(e){
+        this.setData({
+            Location:e.detail
+        })
+    },
+    getworkingLocation(e){
+        this.setData({
+            workingLocation:e.detail
+        })
+    },
+    getamountInvolved(e){
+        this.setData({
+            amountInvolved:e.detail
+        })
+    },
+    onChangeTabs(e){
+        this.setData({
+            beforList:e.detail.name
+        })
+    },
+    afterReadImg(event: { detail: { file: any; }; },name){
+        console.log(event,name);
+        
         const { file } = event.detail;
         let that=this
         console.log(file);
@@ -37,11 +86,24 @@
           success(res) {
             // 涓婁紶瀹屾垚闇�瑕佹洿鏂� fileList
             const { fileImgList = [] } = that.data;
-            fileImgList.push({ ...file, url: res.data });
-            that.setData({ fileImgList });
-
-
-            const result = JSON.parse(res.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+","
@@ -110,6 +172,9 @@
 this.setData({
     sexId:e.detail.value
 })
+this.setData({
+    sex:this.data.arraySex[e.detail.value].sex
+})
 },
 getMoney:function(e){
  console.log(e.detail.value)
@@ -130,7 +195,41 @@
        })
     },
     pass() {
+        console.log(this.data.realName);
+        if (this.data.realName=='') {
+            Toast('璇疯緭鍏ュ鍚嶏紒');
+            return
+        } else if(this.data.userIdCard=='') {
+            Toast('璇疯緭鍏ヨ韩浠借瘉锛�');
+            return
+        }else if(this.data.Location=='') {
+            Toast('璇疯緭鍏ョ幇浣忓潃锛�');
+            return
+        }else if(this.data.workingLocation=='') {
+            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
+        }
         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

--
Gitblit v1.8.0