roose 4 年之前
父節點
當前提交
1b275580ba
共有 2 個文件被更改,包括 164 次插入76 次删除
  1. 149 66
      pages/collectInfo/collectInfo.js
  2. 15 10
      pages/collectInfo/collectInfo.wxml

+ 149 - 66
pages/collectInfo/collectInfo.js

@@ -35,9 +35,21 @@ Page({
       }
     ],
     nameArr: [],
+    oldCard: [{
+      name: false
+    }],
+    oldCard1: [{
+      name: false
+    }],
+    oldCard2: [{
+      name: false
+    }],
     // tab1老人信息
     oldInfo: [{
       name: '',
+      isSameWithAddress: [{
+        name: '现居地址与户籍地址一致'
+      }],
       oldSex: [{
         name: '男'
       }, {
@@ -547,8 +559,20 @@ Page({
       },
       success: (res) => {
         if (res.data.code == 0) {
+          this.data.oldCard.push({
+            name: false
+          })
+          this.data.oldCard1.push({
+            name: false
+          })
+          this.data.oldCard2.push({
+            name: false
+          })
           this.data.oldInfo.push({
             name: this.data.addOldname1,
+            isSameWithAddress: [{
+              name: '现居地址与户籍地址一致'
+            }],
             oldSex: [{
               name: '男'
             }, {
@@ -558,7 +582,7 @@ Page({
             idNumber: '',
             phone: '',
             chooseAdressArr: [],
-      chooseAdressArr1: [],
+            chooseAdressArr1: [],
             oldMarry: [{
               name: "未婚"
             }, {
@@ -1112,33 +1136,55 @@ Page({
   // 身份证号
   tab1Change4: function (e) {
     console.log('身份证变化了')
+    let Info = 'oldCard[' + this.data.activeIndex + '].name'
+    let Info1 = 'oldCard1[' + this.data.activeIndex + '].name'
     if (e.detail.value == null || e.detail.value == '') {
       this.setData({
-        oldCard: true,
-        oldCard1: false
+        [Info]: true
       })
       return
     } else {
       this.setData({
-        oldCard: false
+        [Info]: false
       })
     }
     if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e.detail.value)) && e.detail.value.length != 18) {
       this.setData({
-        oldCard1: true
+        [Info1]: true
       })
       return
     } else {
       this.setData({
-        oldCard1: false
+        [Info1]: false
       })
-      let idNumber = 'oldInfo[' + this.data.activeIndex + '].idNumber'
+    }
+    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) {
+      age++;
+    }
+    if (age < 60) {
       this.setData({
-        [idNumber]: e.detail.value
+        [Info2]: true
       })
-      this.SubmitOldmanInfo({
-        id: this.data.nameArr[this.data.activeIndex]._id,
-        idNumber: e.detail.value
+    }else{
+      this.setData({
+        [Info2]: false
       })
     }
   },
@@ -1169,27 +1215,45 @@ Page({
       })
     }
   },
-    // 补充户籍地址
-    tab1Change6(e) {
-      console.log(e.detail.value)
+  // 补充户籍地址
+  tab1Change6(e) {
+    console.log(e.detail.value)
+    this.SubmitOldmanInfo({
+      id: this.data.nameArr[this.data.activeIndex]._id,
+      nativePlaceExt: e.detail.value
+    })
+  },
+  // 现居地址与户籍地址一致
+  tab1change6_1(e) {
+    console.log(e.detail.value)
+    let Info = 'oldInfo[' + this.data.activeIndex + '].chooseAdressArr1'
+    if (e.detail.value[0] == '现居地址与户籍地址一致') {
       this.SubmitOldmanInfo({
         id: this.data.nameArr[this.data.activeIndex]._id,
-        nativePlaceExt: e.detail.value
-      })
-    },
-    // 现居地址与户籍地址一致
-    tab1change6_1(e) {
-      console.log(e)
-  
-    },
-      // 补充现居住地址
-    tab1Change7(e) {
-      console.log(e.detail.value)
+        isSameWithAddress: '是'
+      })
+      this.setData({
+        [Info]: this.data.oldInfo[this.data.activeIndex].chooseAdressArr,
+      })
+    } else {
       this.SubmitOldmanInfo({
         id: this.data.nameArr[this.data.activeIndex]._id,
-        addressExt: e.detail.value
+        isSameWithAddress: '否'
+      })
+      this.setData({
+        [Info]: null
       })
-    },
+      console.log(this.data.oldInfo[this.data.activeIndex].chooseAdressArr1)
+    }
+  },
+  // 补充现居住地址
+  tab1Change7(e) {
+    console.log(e.detail.value)
+    this.SubmitOldmanInfo({
+      id: this.data.nameArr[this.data.activeIndex]._id,
+      addressExt: e.detail.value
+    })
+  },
   // 婚姻以及配偶情况
   tab1Change8: function (e) {
     console.log(e.detail.value)
@@ -2590,17 +2654,9 @@ Page({
       regularsInfo: JSON.stringify(this.data.regularsInfo[this.data.activeIndex])
     })
   },
-
-
-
   formSubmit(e) {
     console.log('form发生了submit事件,携带数据为:', e.detail.value)
   },
-  chooseAdress() {
-    this.setData({
-      adressShow: true
-    })
-  },
   removeExcess(data) {
     if (data) {
       data = JSON.parse(data);
@@ -2615,14 +2671,16 @@ Page({
       this.setData({
         showBj: false,
         showBj1: false,
+        showAdress: false,
+        showAdress1: false,
         nameArr: [],
         activeIndex: 0,
         familyFid: id,
         color: 'transparent',
       })
-      console.log(this.data.showBj , "关闭提示添加");
-      
-      
+      console.log(this.data.showBj, "关闭提示添加");
+
+
       var that = this;
       wx.request({
         url: util.globalData.publicUrl + '/wxinfo/listByFid',
@@ -2682,24 +2740,6 @@ Page({
             name: "女"
           }];
           let abc = data.map(item => {
-            let visitWays = [{
-              name: '电话问候'
-            }, {
-              name: '上门巡访'
-            }, {
-              name: '其它'
-            }];
-            let visitTimes = [{
-              name: '每天'
-            }, {
-              name: '每周'
-            }, {
-              name: '每月'
-            }, {
-              name: '每季'
-            }, {
-              name: '其它'
-            }];
             let otherInfo = ''
             let imgPath = ''
             if (item.photo) {
@@ -2923,8 +2963,6 @@ Page({
             if (item.oldType.includes("失能老人")) {
               oldTypeArr[7].checked = true;
             }
-
-
             disabilityAyyss.forEach(itemss => {
               item.disabilityCategory.forEach(item => {
                 if (itemss.name == item) {
@@ -2947,6 +2985,7 @@ Page({
                 }
               })
             })
+           
             loveRequire.forEach(itemss => {
               item.demand.forEach(item => {
                 if (itemss.name == item) {
@@ -2954,6 +2993,26 @@ 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.address && item.nativePlaceId) {
+              let address = item.address.split('/');
+              let addressId = item.addressId.split(',');
+              chooseAdressArr1 = address.map((item, i) => ({
+                CIVILREGIONALISMNAME: item,
+                CIVILREGIONALISMID: addressId[i]
+              }));
+            }
+
+
             return {
               ...item,
               oldSex: oldSex.map(items => {
@@ -3013,7 +3072,9 @@ Page({
               liveStatus: accompanyArr,
               oftenMan: lookAfterArr,
               loveRequire: loveRequire,
-              oldType: oldTypeArr
+              oldType: oldTypeArr,
+              chooseAdressArr: chooseAdressArr,
+              chooseAdressArr1: chooseAdressArr1,
             }
           })
           let def = data.map(item => {
@@ -3324,7 +3385,6 @@ Page({
       })
     } else {
       console.log("我是没有fid的");
-
       let oldInfo = [{
         name: '',
         oldSex: [{
@@ -3332,11 +3392,14 @@ Page({
         }, {
           name: '女'
         }],
+        isSameWithAddress: [{
+          name: '现居地址与户籍地址一致'
+        }],
         nation: '', //民族
         idNumber: '', //身份证号
         phone: '',
         chooseAdressArr: [],
-      chooseAdressArr1: [],
+        chooseAdressArr1: [],
         oldMarry: [{
           name: "未婚"
         }, {
@@ -3591,6 +3654,8 @@ Page({
       }]
       this.setData({
         showBj: true,
+        showAdress: false,
+        showAdress1: false,
         nameArr: [],
         oldInfo: oldInfo,
         childInfo: childInfo,
@@ -3603,6 +3668,7 @@ Page({
 
   },
   chooseAdress() {
+    console.log(this.data.oldInfo[this.data.activeIndex].chooseAdressArr)
     if (this.data.oldInfo[this.data.activeIndex].chooseAdressArr.length == 0) {
       wx.request({
         url: util.globalData.publicUrl + '/civilregionalism/deptList',
@@ -3615,6 +3681,7 @@ Page({
             showAdress: true,
             provinceArr: res.data.data
           })
+          console.log(this.data.provinceArr)
         }
       })
     }
@@ -3672,9 +3739,17 @@ Page({
           })
         }
         if (this.data.oldInfo[this.data.activeIndex].chooseAdressArr.length == 5) {
+          let nativePlaceId = '';
+          let nativePlace = '';
+          for (let value of this.data.oldInfo[this.data.activeIndex].chooseAdressArr) {
+            nativePlace += value.CIVILREGIONALISMNAME + '/'
+            nativePlaceId += value.CIVILREGIONALISMID + ','
+            console.log(value, "打印下");
+          }
           this.SubmitOldmanInfo({
             id: this.data.nameArr[this.data.activeIndex]._id,
-            // childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
+            nativePlace: nativePlace.substring(0, nativePlace.length - 1),
+            nativePlaceId: nativePlaceId.substring(0, nativePlaceId.length - 1),
           })
         }
         console.log(this.data.oldInfo[this.data.activeIndex].chooseAdressArr, '我是添加的数组')
@@ -3711,12 +3786,20 @@ Page({
           })
         }
         if (this.data.oldInfo[this.data.activeIndex].chooseAdressArr1.length == 5) {
+          let addressId = '';
+          let address = '';
+          for (let value of this.data.oldInfo[this.data.activeIndex].chooseAdressArr1) {
+            address += value.CIVILREGIONALISMNAME + '/'
+            addressId += value.CIVILREGIONALISMID + ','
+            console.log(value, "打印下");
+          }
           this.SubmitOldmanInfo({
             id: this.data.nameArr[this.data.activeIndex]._id,
-            // childInfo: JSON.stringify(this.data.childInfo[this.data.activeIndex].Info)
+            address: address.substring(0, address.length - 1),
+            addressId: addressId.substring(0, addressId.length - 1),
           })
         }
-        console.log(this.data.oldInfo[this.data.activeIndex].chooseAdressArr, '我是添加的数组')
+        console.log(this.data.oldInfo[this.data.activeIndex].chooseAdressArr1, '我是添加的数组')
         wx.hideLoading()
       }
     })
@@ -3861,8 +3944,8 @@ Page({
     this.setData({
       showBj: false
     })
-    console.log(this.data.showBj , "我关闭页面隐藏属性");
-    
+    console.log(this.data.showBj, "我关闭页面隐藏属性");
+
   },
   //获取位置
   getSelfLocation: function (varSendOrgId) {

+ 15 - 10
pages/collectInfo/collectInfo.wxml

@@ -1,7 +1,7 @@
 <wxs module="urls" src="../../utils/photoUrl.wxs"></wxs>
 <view class="container1">
-<!--  wx:if="{{showBj}}" -->
-	<view class="{{showBj ? 'writeOldmanName':'none'}} " hidden="{{!showBj}}"   >
+	<!--  wx:if="{{showBj}}" -->
+	<view class="{{showBj ? 'writeOldmanName':'none'}} " hidden="{{!showBj}}">
 		<view class="   OldmanName_box">
 			<view class="oldmanname">请输入老人姓名1111111111</view>
 			<!--   -->
@@ -35,7 +35,7 @@
 			</view>
 		</view>
 	</van-popup>
-		<van-popup show="{{ showAdress1 }}" round position="bottom" custom-style="height: 70%" bind:close="closeAdress1">
+	<van-popup show="{{ showAdress1 }}" round position="bottom" custom-style="height: 70%" bind:close="closeAdress1">
 		<view class="choosedAdress_box">
 			<view class="choosedAdress" wx:for='{{oldInfo[activeIndex].chooseAdressArr1}}' bindtap="reSelect1" data-index="{{index}}" data-value="{{item}}">
 				<image src="../../images/mz/step_finish.png" style="width:30rpx;height:30rpx;margin-left:10rpx;marign-right:20rpx"></image>{{item.CIVILREGIONALISMNAME}}
@@ -114,19 +114,24 @@
 						{{oldInfo[activeIndex].nation}}
 					</view>
 				</picker>
-				<view class="block"><text class="red">*</text>身份证号<input class="{{oldInfo[activeIndex].status == '3' ? 'huiColor' : ''}}" bindblur="tab1Change4" disabled="{{oldInfo[activeIndex].status == '3'}}" placeholder="请填写老人身份证号" value="{{oldInfo[activeIndex].idNumber}}" /></view>
-				<view wx:if="{{oldCard}}" class="required">老人身份证号不能为空哦!</view>
-				<view wx:if="{{oldCard1}}" class="required">老人身份证号格式不对哦!</view>
+			<view class="block"><text class="red">*</text>身份证号<input class="{{oldInfo[activeIndex].status == '3' ? 'huiColor' : ''}}" bindblur="tab1Change4" disabled="{{oldInfo[activeIndex].status == '3'}}" placeholder="请填写老人身份证号" value="{{oldInfo[activeIndex].idNumber}}" /></view>
+				<view wx:if="{{oldCard[activeIndex].name}}" class="required">老人身份证号不能为空哦!</view>
+				<view wx:if="{{oldCard1[activeIndex].name}}" class="required">老人身份证号格式不对哦!</view>
+				<view wx:if="{{oldCard2[activeIndex].name}}" class="required">不可采集低于60岁老人的信息哦</view>
 				<view class="block"><text class="red">*</text>联系电话<input bindblur="tab1Change5" placeholder="请填写联系电话" value="{{oldInfo[activeIndex].phone}}" /></view>
 				<view wx:if="{{oldPhone}}" class="required">老人联系电话不能为空哦!</view>
 				<view wx:if="{{oldPhone1}}" class="required">老人联系电话格式不对哦!</view>
 				<view class="block"><text class="red">*</text>户籍地址<text bindtap="chooseAdress" style="color:#2087f7;font-size:24rpx;margin-left:20rpx">点我选择户籍地址</text>
-					<textarea class="otherinput" style="height:auto" disabled="true"  wx:if="{{oldInfo[activeIndex].chooseAdressArr.length==5}}">{{oldInfo[activeIndex].chooseAdressArr[0].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[1].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[2].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[3].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[4].CIVILREGIONALISMNAME}}</textarea>
-					<input bindblur="tab1Change6" placeholder="请填写补充户籍地址"/>
+					<textarea class="otherinput" style="height:auto" disabled="true" wx:if="{{oldInfo[activeIndex].chooseAdressArr.length==5}}">{{oldInfo[activeIndex].chooseAdressArr[0].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[1].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[2].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[3].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr[4].CIVILREGIONALISMNAME}}</textarea>
+					<input bindblur="tab1Change6" placeholder="请填写补充户籍地址" />
 				</view>
-				<checkbox color="#fff" style="margin-top:20rpx" bindchange="tab1change6_1"/>现居地址与户籍地址一致
+				      <checkbox-group bindchange="tab1change6_1">
+					<label wx:for="{{oldInfo[activeIndex].isSameWithAddress}}" wx:key="{{item.name}}">
+						<checkbox value="{{item.name}}" color="#fff" checked="{{item.checked}}" />{{item.name}}
+					</label>
+				</checkbox-group>
 				<view class="block"><text class="red">*</text>现居地址<text bindtap="chooseAdress1" style="color:#2087f7;font-size:24rpx;margin-left:20rpx">点我选择现居地址</text>
-				<textarea class="otherinput" style="height:auto" disabled="true"  wx:if="{{oldInfo[activeIndex].chooseAdressArr1.length==5}}">{{oldInfo[activeIndex].chooseAdressArr1[0].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[1].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[2].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[3].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[4].CIVILREGIONALISMNAME}}</textarea>
+					<textarea class="otherinput" style="height:auto" disabled="true" wx:if="{{oldInfo[activeIndex].chooseAdressArr1.length==5}}">{{oldInfo[activeIndex].chooseAdressArr1[0].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[1].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[2].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[3].CIVILREGIONALISMNAME}},{{oldInfo[activeIndex].chooseAdressArr1[4].CIVILREGIONALISMNAME}}</textarea>
 					<input bindblur="tab1Change7" placeholder="请填写补充现居地址" name="name" />
 				</view>
 				<view class="block">