ssfg преди 4 години
родител
ревизия
2080084f24
променени са 2 файла, в които са добавени 82 реда и са изтрити 101 реда
  1. 81 100
      pages/collectInfo/collectInfo.js
  2. 1 1
      pages/collectInfo/collectInfo.wxml

+ 81 - 100
pages/collectInfo/collectInfo.js

@@ -432,7 +432,7 @@ Page({
     multiIndex: [0, 0, 0, 0, 0]
   },
   chooseAdress() {
-   
+
     let arr = 'multiArray[0]'
     wx.request({
       url: util.globalData.publicUrl + '/civilregionalism/deptList',
@@ -462,7 +462,7 @@ Page({
     })
   },
   chooseAdress2(fid) {
-   
+
     console.log(fid)
     let mid;
     if (fid) {
@@ -494,7 +494,7 @@ Page({
     })
   },
   chooseAdress3(fid) {
-  
+
     console.log(fid)
     let mid;
     if (fid) {
@@ -526,7 +526,7 @@ Page({
     })
   },
   chooseAdress4(fid) {
-   
+
     console.log(fid)
     let mid;
     if (fid) {
@@ -558,7 +558,6 @@ Page({
     })
   },
   chooseAdress5(fid) {
-  
     console.log(fid)
     let mid;
     if (fid) {
@@ -590,35 +589,37 @@ Page({
     })
   },
   bindMultiPickerChange: function (e) {
-    console.log(this.data.multiArray,'我是数组111111111')
+    console.log(this.data.multiArray, '我是数组111111111')
     let arr = 'oldInfo[' + this.data.activeIndex + '].chooseAdressArr'
     let province = this.data.multiArray[0][e.detail.value[0]].CIVILREGIONALISMNAME;
     let city = this.data.multiArray[1][e.detail.value[1]].CIVILREGIONALISMNAME;
     let area = this.data.multiArray[2][e.detail.value[2]].CIVILREGIONALISMNAME;
     let town = this.data.multiArray[3][e.detail.value[3]].CIVILREGIONALISMNAME;
     let village = this.data.multiArray[4][e.detail.value[4]].CIVILREGIONALISMNAME;
+    let provinceCode = this.data.multiArray[0][e.detail.value[0]].CIVILREGIONALISMCODE;
+    let cityCode = this.data.multiArray[1][e.detail.value[1]].CIVILREGIONALISMCODE;
+    let areaCode = this.data.multiArray[2][e.detail.value[2]].CIVILREGIONALISMCODE;
+    let townCode = this.data.multiArray[3][e.detail.value[3]].CIVILREGIONALISMCODE;
+    let villageCode = this.data.multiArray[4][e.detail.value[4]].CIVILREGIONALISMCODE;
     this.setData({
       multiIndex: e.detail.value,
       [arr]: []
     })
+    let codeArr = [];
+    codeArr.push(provinceCode, cityCode, areaCode, townCode, villageCode)
     this.data.oldInfo[this.data.activeIndex].chooseAdressArr.push(province, city, area, town, village)
+    let a = this.data.oldInfo[this.data.activeIndex].chooseAdressArr.join("/");
+    let b = codeArr.join(",")
     this.SubmitOldmanInfo({
       id: this.data.nameArr[this.data.activeIndex]._id,
-      address: JSON.stringify(this.data.oldInfo[this.data.activeIndex].chooseAdressArr)
+      nativePlace: a,
+      nativePlaceId: b
     })
     this.setData({
       [arr]: this.data.oldInfo[this.data.activeIndex].chooseAdressArr
     })
   },
   bindMultiPickerColumnChange: function (e) {
-    // this.setData({
-    //   showLoading:true
-    // })
-    // this.data.showLoading=true;
-    // wx.showLoading({
-    //   title: '选择中',
-    //   mask:true
-    // })
     if (e.detail.column == 0) {
       this.chooseAdress2(this.data.multiArray[0][e.detail.value].CIVILREGIONALISMID);
     } else if (e.detail.column == 1) {
@@ -630,37 +631,36 @@ Page({
     }
   },
   bindMultiPickerChange1: function (e) {
-    console.log(this.data.multiArray,'我是数组2222222222')
+    console.log(this.data.multiArray, '我是数组2222222222')
     let arr = 'oldInfo[' + this.data.activeIndex + '].chooseAdressArr1'
     let province = this.data.multiArray[0][e.detail.value[0]].CIVILREGIONALISMNAME;
     let city = this.data.multiArray[1][e.detail.value[1]].CIVILREGIONALISMNAME;
     let area = this.data.multiArray[2][e.detail.value[2]].CIVILREGIONALISMNAME;
     let town = this.data.multiArray[3][e.detail.value[3]].CIVILREGIONALISMNAME;
     let village = this.data.multiArray[4][e.detail.value[4]].CIVILREGIONALISMNAME;
+    let provinceCode = this.data.multiArray[0][e.detail.value[0]].CIVILREGIONALISMCODE;
+    let cityCode = this.data.multiArray[1][e.detail.value[1]].CIVILREGIONALISMCODE;
+    let areaCode = this.data.multiArray[2][e.detail.value[2]].CIVILREGIONALISMCODE;
+    let townCode = this.data.multiArray[3][e.detail.value[3]].CIVILREGIONALISMCODE;
+    let villageCode = this.data.multiArray[4][e.detail.value[4]].CIVILREGIONALISMCODE;
     this.setData({
       multiIndex1: e.detail.value,
       [arr]: []
     })
+    let codeArr = [];
+    codeArr.push(provinceCode, cityCode, areaCode, townCode, villageCode)
     this.data.oldInfo[this.data.activeIndex].chooseAdressArr1.push(province, city, area, town, village)
+    let a = this.data.oldInfo[this.data.activeIndex].chooseAdressArr1.join("/");
+    let b = codeArr.join(",")
     this.SubmitOldmanInfo({
       id: this.data.nameArr[this.data.activeIndex]._id,
-      nativePlace: JSON.stringify(this.data.oldInfo[this.data.activeIndex].chooseAdressArr1)
+      address: a,
+      addressId:b
     })
     this.setData({
       [arr]: this.data.oldInfo[this.data.activeIndex].chooseAdressArr1
     })
   },
-  // bindMultiPickerColumnChange1: function (e) {
-  //   if (e.detail.column == 0) {
-  //     this.chooseAdress2(this.data.multiArray[0][e.detail.value].CIVILREGIONALISMID);
-  //   } else if (e.detail.column == 1) {
-  //     this.chooseAdress3(this.data.multiArray[1][e.detail.value].CIVILREGIONALISMID);
-  //   } else if (e.detail.column == 2) {
-  //     this.chooseAdress4(this.data.multiArray[2][e.detail.value].CIVILREGIONALISMID);
-  //   } else if (e.detail.column == 3) {
-  //     this.chooseAdress5(this.data.multiArray[3][e.detail.value].CIVILREGIONALISMID);
-  //   }
-  // },
   // 左侧点击
   turn(e) {
     let index = e.currentTarget.dataset.index
@@ -719,7 +719,7 @@ Page({
       })
       return false
     }
-    
+
     if (!han.test(this.data.addOldname)) {
       wx.showModal({
         showCancel: false,
@@ -1350,14 +1350,14 @@ Page({
     } else {
       console.log(this.data.nameArr)
       let han = /^[\u4e00-\u9fa5]+$/;
-      if (!han.test(e.detail.value )) {
+      if (!han.test(e.detail.value)) {
         wx.showModal({
           showCancel: false,
           content: '您输入的内容不是汉字哦'
         })
         return false;
       };
-      if (e.detail.value .length < 2) {
+      if (e.detail.value.length < 2) {
         wx.showModal({
           showCancel: false,
           content: '老人姓名不可以少于两个字哦'
@@ -1438,58 +1438,35 @@ Page({
         [Info1]: false
       })
     }
-    this.IdCard(e.detail.value)
-    let idNumber = 'oldInfo[' + this.data.activeIndex + '].idNumber'
-    this.setData({
-      [idNumber]: e.detail.value
-    })
-    this.SubmitOldmanInfo({
-      id: this.data.nameArr[this.data.activeIndex]._id,
-      idNumber: e.detail.value
-    })
-  },
-  IdCard(UUserCard) {
-    //获取年龄
     let Info2 = 'oldCard2[' + this.data.activeIndex + '].name'
     var myDate = new Date();
     var month = myDate.getMonth() + 1;
     var day = myDate.getDate();
-    var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
-    if (UUserCard.substring(10, 12) < month || UUserCard.substring(10, 12) == month && UUserCard.substring(12, 14) <= day) {
+    var age = myDate.getFullYear() - e.detail.value.substring(6, 10) - 1;
+    if (e.detail.value.substring(10, 12) < month || e.detail.value.substring(10, 12) == month && e.detail.value.substring(12, 14) <= day) {
       age++;
     }
     if (age < 60) {
       this.setData({
         [Info2]: true
       })
+      return
     } else {
       this.setData({
         [Info2]: false
       })
     }
+    let idNumber = 'oldInfo[' + this.data.activeIndex + '].idNumber'
+    this.setData({
+      [idNumber]: e.detail.value
+    })
+    this.SubmitOldmanInfo({
+      id: this.data.nameArr[this.data.activeIndex]._id,
+      idNumber: e.detail.value
+    })
   },
   // 联系电话
   tab1Change5: function (e) {
-    // if (e.detail.value == null || e.detail.value == '') {
-    //   this.setData({
-    //     oldPhone: true
-    //   })
-    //   return
-    // } else {
-    //   this.setData({
-    //     oldPhone: false
-    //   })
-    // }
-    // if (!(/^[0-9]*$/.test(e.detail.value))) {
-    //   this.setData({
-    //     oldPhone1: true
-    //   })
-    //   return
-    // } else {
-    //   this.setData({
-    //     oldPhone1: false
-    //   })
-    // }
     let phone = 'oldInfo[' + this.data.activeIndex + '].phone'
     this.setData({
       [phone]: e.detail.value
@@ -2300,7 +2277,7 @@ Page({
       })
     }
   },
-  tab1Change24_1:function(e){
+  tab1Change24_1: function (e) {
     let Info = 'oldInfo[' + this.data.activeIndex + '].demandExt'
     this.setData({
       [Info]: e.detail.value
@@ -2309,7 +2286,7 @@ Page({
       id: this.data.nameArr[this.data.activeIndex]._id,
       demandExt: e.detail.value
     })
-   
+
   },
   tab1change25: function (e) {
     if (e.detail.value == null || e.detail.value == '') {
@@ -2420,7 +2397,7 @@ Page({
         [revise5]: true
       })
       return false;
-    } else if(index4 >= 0){
+    } else if (index4 >= 0) {
       this.setData({
         [revise1]: false,
         [revise2]: false,
@@ -2428,13 +2405,13 @@ Page({
         [revise4]: false,
         [revise5]: true
       })
-    }else {
+    } else {
       this.setData({
         [revise1]: false,
         [revise2]: false,
         [revise3]: false,
         [revise4]: false,
-       
+
       })
     }
 
@@ -2614,14 +2591,14 @@ Page({
   // 子女姓名
   tab2Change2: function (e) {
     let han = /^[\u4e00-\u9fa5]+$/;
-    if (!han.test(e.detail.value )) {
+    if (!han.test(e.detail.value)) {
       wx.showModal({
         showCancel: false,
         content: '您输入的内容不是汉字哦'
       })
       return false;
     };
-    if (e.detail.value .length < 2) {
+    if (e.detail.value.length < 2) {
       wx.showModal({
         showCancel: false,
         content: '赡养人姓名不可以少于两个字哦'
@@ -2789,14 +2766,14 @@ Page({
   // 其他赡养人姓名
   tab3Change2: function (e) {
     let han = /^[\u4e00-\u9fa5]+$/;
-    if (!han.test(e.detail.value )) {
+    if (!han.test(e.detail.value)) {
       wx.showModal({
         showCancel: false,
         content: '您输入的内容不是汉字哦'
       })
       return false;
     };
-    if (e.detail.value .length < 2) {
+    if (e.detail.value.length < 2) {
       wx.showModal({
         showCancel: false,
         content: '赡养人姓名不可以少于两个字哦'
@@ -2979,7 +2956,7 @@ Page({
     let visitMode1 = 'regularsInfo[' + this.data.activeIndex + '].visitMode'
     this.setData({
       [visitMode]: items,
-      [visitMode1]:JSON.stringify( e.detail.value)
+      [visitMode1]: JSON.stringify(e.detail.value)
     })
     console.log(this.data.regularsInfo, "我是?????????????");
 
@@ -3719,14 +3696,27 @@ Page({
 
             let chooseAdressArr = [];
             let chooseAdressArr1 = [];
-
-            if (item.nativePlace && item.nativePlaceId) {
-              let nativePlaces = item.nativePlace.split('/');
-              let nativePlaceId = item.nativePlaceId.split(',');
-              chooseAdressArr = nativePlaces.map((item, i) => ({
-                CIVILREGIONALISMNAME: item,
-                CIVILREGIONALISMID: nativePlaceId[i]
-              }));
+            // if (item.nativePlace && item.nativePlaceId) {
+            //   let nativePlaces = item.nativePlace.split('/');
+            //   let nativePlaceId = item.nativePlaceId.split(',');
+            //   chooseAdressArr = nativePlaces.map((item, i) => ({
+            //     CIVILREGIONALISMNAME: item,
+            //     CIVILREGIONALISMID: nativePlaceId[i]
+            //   }));
+            //   if (item.isSameWithAddress == '是') {
+            //     isSameWithAddresss.forEach(item => {
+            //       item.checked = true;
+            //     })
+            //     chooseAdressArr1 = chooseAdressArr;
+            //   }else {
+            //     chooseAdressArr1 = [];
+            //   }
+            // }
+              if (item.nativePlace) {
+              let patrol =  this.removeExcess(item.nativePlace);
+              console.log(patrol,"返回。。。。。。。。。。。。。。。。。。。。。。。。。。");
+              
+              chooseAdressArr =  patrol;
               if (item.isSameWithAddress == '是') {
                 isSameWithAddresss.forEach(item => {
                   item.checked = true;
@@ -3744,16 +3734,10 @@ Page({
             if (item.nativePlaceExt) {
               nativePlaceExts = item.nativePlaceExt
             }
-            if (item.address && item.nativePlaceId) {
-              let address = item.address.split('/');
-              let addressId = item.addressId.split(',');
-              chooseAdressArr1 = address.map((item, i) => ({
-                CIVILREGIONALISMNAME: item,
-                CIVILREGIONALISMID: addressId[i]
-              }));
+            if (item.address ) {
+              let patrol =  this.removeExcess(item.address);
+              chooseAdressArr1 =  patrol;
             }
-
-
             return {
               ...item,
               sickType:sickType,
@@ -3857,7 +3841,7 @@ Page({
                 sexs.forEach(items => {
                   if (items.name == partol.sex) {
                     items.checked = true;
-                    sex =  partol.sex ;
+                    sex = partol.sex;
                   }
                 })
               }
@@ -3924,7 +3908,7 @@ Page({
                 name2: name2,
                 phone2: phone2,
                 othersyrSexArr: sexs,
-                sex :sex ,
+                sex: sex,
               }
 
             }
@@ -4404,7 +4388,7 @@ Page({
       wx.redirectTo({
         url: '/pages/login/login',
       })
-    }else {
+    } else {
       const app = getApp();
       if (isTwoOnshow) {
         isTwoOnshow = false;
@@ -4414,7 +4398,7 @@ Page({
         isonShow = false;
         return;
       };
-  
+
       this.setData({
         addOldname: '',
         currentIndex: 0
@@ -4487,7 +4471,7 @@ Page({
       wx.redirectTo({
         url: '/pages/login/login',
       })
-    }else {
+    } else {
       console.log(value, "onLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoadonLoad");
       this.chooseAdress();
       this.huixian1(value.id, value.name);
@@ -4715,8 +4699,6 @@ Page({
                 accompanyArr[4].checked = true;
               }
             }
-
-
             let lookAfterArr = [];
             if (item.lookAfter.includes("无人照料")) {
               for (let i = 0; i < 6; i++) {
@@ -5090,7 +5072,6 @@ Page({
                   Info.push(chlidInfos)
                 }
               }
-
             }
             return {
               ...item,

+ 1 - 1
pages/collectInfo/collectInfo.wxml

@@ -137,7 +137,7 @@
 				<view class="block"><text class="red">*</text>现居地址
 					<picker mode="multiSelector" bindchange="bindMultiPickerChange1" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex1}}" range="{{multiArray}}" range-key="{{'CIVILREGIONALISMNAME'}}">
 						<view class="picker1">
-							<view wx:if="{{oldInfo[activeIndex].chooseAdressArr1.length==0}}">点我选择户籍地址</view>
+							<view wx:if="{{oldInfo[activeIndex].chooseAdressArr1.length==0}}">点我选择现居地址</view>
 							<textarea style="width:450rpx;height:auto" disabled="true" wx:else>{{oldInfo[activeIndex].chooseAdressArr1}}</textarea>
 						</view>
 					</picker>