| | |
| | | // 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', |
| | |
| | | causeIndex: null, |
| | | items: { name: '日期时间选择', value: 'dateTime' }, |
| | | mode: 'dateTime', |
| | | reportDetail: {}, |
| | | reportDetail: { |
| | | causeId:'' |
| | | }, |
| | | causeList: [], |
| | | imagesFile: [], |
| | | cardIdList: [], |
| | |
| | | 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({ |
| | |
| | | } |
| | | } |
| | | }) |
| | | |
| | | |
| | | }, |
| | | //被骗时间 |
| | | onPickerChange(e) { |
| | |
| | | subSex(e) { |
| | | }, |
| | | bindPickerChangeSex(e) { |
| | | console.log(e); |
| | | |
| | | this.setData({ |
| | | sexId: e.detail.value |
| | | }) |
| | |
| | | }) |
| | | }, |
| | | pass() { |
| | | console.log(this.data.reportDetail.causeId); |
| | | |
| | | if (this.data.realName == '') { |
| | | Toast('请输入姓名!'); |
| | | return |
| | |
| | | } 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 |
| | |
| | | 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'), |
| | |
| | | } |
| | | }) |
| | | }, |
| | | 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() |
| | |
| | | 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 => { |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | }, |
| | | imgComplete(file: String): String { |
| | | return submitReport.globalData.imageUrl + "/img/" + file |