collectInfo.js 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233
  1. const util = require('../../utils/util.js');
  2. const tools = require('../../utils/tools.js');
  3. Page({
  4. data: {
  5. currentActiveIndex: 0,
  6. addOldname: '',
  7. addOldname1: '',
  8. showAdress: false,
  9. pleaseChoose: true,
  10. chooseAdressArr: [],
  11. currentIndex: 0,
  12. showBj: true,
  13. showBj1: false,
  14. src1: '../../images/mz/5.png',
  15. src2: '../../images/mz/1.png',
  16. src3: '../../images/mz/6.png',
  17. src4: '../../images/mz/2.png',
  18. src5: '../../images/mz/7.png',
  19. src6: '../../images/mz/3.png',
  20. src7: '../../images/mz/8.png',
  21. src8: '../../images/mz/4.png',
  22. sexArr: [{
  23. value: '男',
  24. name: '男'
  25. },
  26. {
  27. value: '女',
  28. name: '女',
  29. }
  30. ],
  31. nameArr: [],
  32. // tab1老人信息
  33. oldInfo: [{
  34. name: '',
  35. oldSex: [{
  36. name: '男'
  37. }, {
  38. name: '女'
  39. }],
  40. nation: '', //民族
  41. idNumber: '', //身份证号
  42. phone: '',
  43. oldMarry: [{
  44. name: "未婚"
  45. }, {
  46. name: "已婚"
  47. }, {
  48. name: "离异"
  49. }, {
  50. name: "丧偶"
  51. }],
  52. partnerName: '',
  53. partnerIdNumber: '',
  54. healthAyy: [{
  55. name: "健康",
  56. disabled: false
  57. }, {
  58. name: "残疾",
  59. disabled: false
  60. }, {
  61. name: "患重特大疾病",
  62. disabled: false
  63. }, {
  64. name: "老年人慢性病",
  65. disabled: false
  66. }],
  67. ableStatus: ["完全自理", "半失能(部分自理)", "完全失能"],
  68. }],
  69. mzArr: ["汉族", "壮族", "满族", "回族", "苗族", "维吾尔族", "土家族", "彝族", "蒙古族", "藏族", "布依族", "侗族", "瑶族", "朝鲜族", "白族", "哈尼族",
  70. "哈萨克族", "黎族", "傣族", "畲族", "傈僳族", "仡佬族", "东乡族", "高山族", "拉祜族", "水族", "佤族", "纳西族", "羌族", "土族", "仫佬族", "锡伯族",
  71. "柯尔克孜族", "达斡尔族", "景颇族", "毛南族", "撒拉族", "布朗族", "塔吉克族", "阿昌族", "普米族", "鄂温克族", "怒族", "京族", "基诺族", "德昂族", "保安族",
  72. "俄罗斯族", "裕固族", "乌孜别克族", "门巴族", "鄂伦春族", "独龙族", "塔塔尔族", "赫哲族", "珞巴族"
  73. ],
  74. // name: '', //老人姓名
  75. chooseAdressArr: [],
  76. // oldMarry: [
  77. // "未婚", "已婚", "离异", "丧偶"
  78. // ],
  79. // healthAyy: [{
  80. // name: "健康",
  81. // disabled: false
  82. // }, {
  83. // name: "残疾",
  84. // disabled: false
  85. // }, {
  86. // name: "患重特大疾病",
  87. // disabled: false
  88. // }, {
  89. // name: "老年人慢性病",
  90. // disabled: false
  91. // }],
  92. disabilityAyy: [
  93. "视力残疾", "听力残疾", "言语残疾", "肢体残疾", "智力残疾", "精神残疾", "多重残疾"
  94. ],
  95. sickType: [
  96. "重大器官类疾病", "心脑血管类疾病", "神经与代谢类疾病", "肢体与病毒类疾病", "恶性肿瘤"
  97. ],
  98. disableLeval: ["一级", "二级", "三级", "四级"],
  99. // ableStatus: ["完全自理", "半失能(部分自理)", "完全失能"],
  100. moneyStatus: ["建档立卡贫困户", "一般家庭", "低保", "特困供养人员"],
  101. moneyFromAyy: ["家庭经营性收入", "工资性收入", "转移性收入", "财产性收入", "其它"],
  102. payMoney: ["5000元以下", "5000-10000元", "10000元以上"],
  103. familyHelpArr: [
  104. "低保", "建档立卡贫困户", "医疗救助", "临时救助", "老年人福利津贴", "残疾人两项补贴(或一项补贴)", "其他救助"
  105. ],
  106. loneArr: ["是", "否"],
  107. liveStatus: [{
  108. name: "无人陪伴居住",
  109. disabled: false
  110. }, {
  111. name: "配偶",
  112. disabled: false
  113. }, {
  114. name: "近亲属",
  115. disabled: false
  116. }, {
  117. name: "未成年孙子女",
  118. disabled: false
  119. }, {
  120. name: "其他情形",
  121. disabled: false
  122. }],
  123. oftenMan: [{
  124. name: "无人照料",
  125. disabled: false
  126. }, {
  127. name: "近亲属",
  128. disabled: false
  129. }, {
  130. name: "配偶",
  131. disabled: false
  132. }, {
  133. name: "邻里互助",
  134. disabled: false
  135. }, {
  136. name: "购买养老服务",
  137. disabled: false
  138. }, {
  139. name: "其他人员",
  140. disabled: false
  141. }],
  142. lookafterSex: ["男", "女"],
  143. loveRequire: ["生活照料", "生产帮助", "精神慰藉", "医疗保健", "权益维护", "安全监护", "文化娱乐", "紧急救助", "其它"],
  144. oldType: [{
  145. name: "农村留守老年人",
  146. disable: false,
  147. checked: false
  148. }, {
  149. name: "分散供养特困老年人",
  150. disable: false,
  151. checked: false
  152. }, {
  153. name: "计划生育特殊家庭老人",
  154. disable: false,
  155. checked: false
  156. }, {
  157. name: "空巢老年人",
  158. disable: false,
  159. checked: false
  160. }, {
  161. name: "独居老年人",
  162. disable: false,
  163. checked: false
  164. }, {
  165. name: "重残老年人",
  166. disable: false,
  167. checked: false
  168. }, {
  169. name: "高龄老年人",
  170. disable: false,
  171. checked: false
  172. }],
  173. isHavePhoto: false,
  174. // tab2
  175. childNums: [
  176. '0个', '1个', '2个', '3个', '3个以上'
  177. ],
  178. childInfo: [],
  179. ischildName: [false, false, false],
  180. childSexArr: ['男', '女'],
  181. ischildPhone: [false, false, false],
  182. childIsout: ['是', '否'],
  183. showchildOut: [false, false, false],
  184. ischildOutReason: [false, false, false],
  185. region0: [
  186. ['', '', ''],
  187. ['', '', ''],
  188. ['', '', '']
  189. ],
  190. childLeaveDate: ['', '', ''],
  191. childIsMArry: ['是', '否'],
  192. ischildMarry: [false, false, false],
  193. ischildMarryName: [false, false, false],
  194. ischildMarryPhone: [false, false, false],
  195. childTfTimes: ['0次', '1次', '2次及以上'],
  196. // tab3
  197. otherInfo: {
  198. name: '', // 其他赡养人姓名,
  199. sex: '', //其他赡养人性别
  200. phone: '', //其他赡养人电话,
  201. relation: '', //与被赡养人关系 如果选了其他也是必填 单选
  202. relationExt: '', //与被赡养人关系--其他
  203. isHasGoOut: '', //是否外出
  204. outgoingCause: '', //外出原因
  205. outgoingplace: '', // 外出地点
  206. outgoingTime: '', // 最后一次离家时间
  207. isHasPartner: '', //是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0:是 1:否
  208. name2: '',
  209. phone2: '',
  210. visit: '', //平均一年探望次数
  211. },
  212. othersyrArr: ['是', '否'],
  213. othersyrSexArr: ['男', '女'],
  214. othersyrRelation: [
  215. "近亲属", "孙子女", "兄弟姐妹", "其他"
  216. ],
  217. othersyrIsout: ['是', '否'],
  218. region: ['', '', ''],
  219. // customItem: '其它',
  220. othersyrIsMarry: ['是', '否'],
  221. othersyrTfTimes: [
  222. '0次', '1次', '2次及以上'
  223. ],
  224. // tab4
  225. regularsInfo: {
  226. visitMode: '', //巡访方式 如果选了其他也是必填 多选
  227. visitModeExt: '', //巡访方式--其它
  228. visitCount: '', //巡访频次, 如果选了其他也是必填 单选
  229. visitCountExt: '', //巡访频次--其它
  230. },
  231. visitWays: [{
  232. name: '电话问候'
  233. }, {
  234. name: '上门巡防'
  235. }, {
  236. name: '其它'
  237. }],
  238. visitTimes: [{
  239. name: '每天'
  240. }, {
  241. name: '每周'
  242. }, {
  243. name: '每月'
  244. }, {
  245. name: '每季'
  246. }, {
  247. name: '其它'
  248. }],
  249. // syrIndex:
  250. },
  251. // 左侧点击
  252. turn(e) {
  253. let index = e.currentTarget.dataset.index
  254. this.setData({
  255. currentIndex: index
  256. })
  257. },
  258. addOldName(e) {
  259. this.setData({
  260. addOldname: e.detail.value
  261. })
  262. },
  263. addOldName1(e) {
  264. this.setData({
  265. addOldname1: e.detail.value
  266. })
  267. },
  268. qx() {
  269. wx.switchTab({
  270. url: '/pages/index/index',
  271. })
  272. },
  273. qx1() {
  274. this.setData({
  275. showBj1: false
  276. })
  277. },
  278. switchNameTab(e) {
  279. this.setData({
  280. currentActiveIndex: e.currentTarget.dataset.index,
  281. })
  282. wx.request({
  283. url: util.globalData.publicUrl + '/wxinfo/one',
  284. method: "get",
  285. header: {
  286. appletsId: wx.getStorageSync('openId')
  287. },
  288. data: {
  289. id: e.currentTarget.dataset.item._id
  290. },
  291. success: (res) => {
  292. if (res.data.code == 0) {
  293. // this.setData({
  294. // name: res.data.data.name
  295. // })
  296. // // 判断性别有没有
  297. // if (res.data.data.sex) {
  298. // this.setData({
  299. // oldSex: [{
  300. // name: '男',
  301. // checked: false
  302. // }, {
  303. // name: '女',
  304. // checked: false
  305. // }]
  306. // })
  307. // let sexIndex = this.data.oldSex.findIndex(v => v.name == res.data.data.sex)
  308. // this.data.oldSex[sexIndex].checked = "true"
  309. // this.setData({
  310. // oldSex: this.data.oldSex
  311. // })
  312. // } else {
  313. // this.setData({
  314. // oldSex: [{
  315. // name: '男',
  316. // checked: false
  317. // }, {
  318. // name: '女',
  319. // checked: false
  320. // }]
  321. // })
  322. // }
  323. // if (res.data.data.idNumber) {
  324. // this.setData({
  325. // idNumber: res.data.data.idNumber
  326. // })
  327. // } else {
  328. // this.setData({
  329. // idNumber: ''
  330. // })
  331. // }
  332. }
  333. }
  334. })
  335. },
  336. sure() {
  337. let han = /^[\u4e00-\u9fa5]+$/;
  338. if (this.data.addOldname == '' || this.data.addOldname == null) {
  339. wx.showModal({
  340. showCancel: false,
  341. content: '老人姓名不可以为空哦'
  342. })
  343. return false
  344. }
  345. if (!han.test(this.data.addOldname)) {
  346. wx.showModal({
  347. showCancel: false,
  348. content: '您输入的内容不是汉字哦'
  349. })
  350. return false;
  351. };
  352. if (this.data.addOldname.length < 2) {
  353. wx.showModal({
  354. showCancel: false,
  355. content: '老人姓名不可以少于两个字哦'
  356. })
  357. return false
  358. }
  359. this.setData({
  360. showBj: false
  361. })
  362. wx.request({
  363. url: util.globalData.publicUrl + '/wxinfo/add',
  364. method: "post",
  365. header: {
  366. appletsId: wx.getStorageSync('openId')
  367. },
  368. data: {
  369. name: this.data.addOldname
  370. },
  371. success: (res) => {
  372. if (res.data.code == 0) {
  373. let name = 'oldInfo[' + this.data.currentActiveIndex + '].name'
  374. this.setData({
  375. nameArr: this.data.nameArr.concat(res.data.data),
  376. familyFid: res.data.data.fid,
  377. [name]: this.data.addOldname
  378. })
  379. }
  380. }
  381. })
  382. },
  383. sure1() {
  384. let han = /^[\u4e00-\u9fa5]+$/;
  385. if (this.data.addOldname1 == '' || this.data.addOldname1 == null) {
  386. wx.showModal({
  387. showCancel: false,
  388. content: '老人姓名不可以为空哦'
  389. })
  390. return false
  391. }
  392. if (!han.test(this.data.addOldname1)) {
  393. wx.showModal({
  394. showCancel: false,
  395. content: '您输入的内容不是汉字哦'
  396. })
  397. return false;
  398. };
  399. if (this.data.addOldname1.length < 2) {
  400. wx.showModal({
  401. showCancel: false,
  402. content: '老人姓名不可以少于两个字哦'
  403. })
  404. return false
  405. }
  406. this.setData({
  407. showBj1: false
  408. })
  409. wx.request({
  410. url: util.globalData.publicUrl + '/wxinfo/add',
  411. method: "post",
  412. header: {
  413. appletsId: wx.getStorageSync('openId')
  414. },
  415. data: {
  416. name: this.data.addOldname1,
  417. fid: this.data.familyFid
  418. },
  419. success: (res) => {
  420. if (res.data.code == 0) {
  421. this.data.oldInfo.push({
  422. name: this.data.addOldname1,
  423. oldSex: [{
  424. name: '男'
  425. }, {
  426. name: '女'
  427. }],
  428. nation: '',
  429. idNumber: '',
  430. phone: '',
  431. oldMarry: [{
  432. name: "未婚"
  433. }, {
  434. name: "已婚"
  435. }, {
  436. name: "离异"
  437. }, {
  438. name: "丧偶"
  439. }],
  440. partnerName: '',
  441. partnerIdNumber: '',
  442. healthAyy: [{
  443. name: "健康",
  444. disabled: false
  445. }, {
  446. name: "残疾",
  447. disabled: false
  448. }, {
  449. name: "患重特大疾病",
  450. disabled: false
  451. }, {
  452. name: "老年人慢性病",
  453. disabled: false
  454. }],
  455. })
  456. console.log(this.data.oldInfo)
  457. this.setData({
  458. currentActiveIndex: this.data.nameArr.concat(res.data.data).length - 1,
  459. nameArr: this.data.nameArr.concat(res.data.data),
  460. oldInfo: this.data.oldInfo
  461. })
  462. }
  463. }
  464. })
  465. },
  466. // 删除上方名字
  467. deleteName(e) {
  468. let index = e.currentTarget.dataset.index
  469. wx.showModal({
  470. showCancel: true,
  471. content: '确认删除该条记录吗',
  472. success: (res) => {
  473. if (res.cancel) {
  474. //点击取消,默认隐藏弹框
  475. } else {
  476. if (this.data.currentActiveIndex == index || this.data.currentActiveIndex > index) {
  477. this.setData({
  478. currentActiveIndex: this.data.currentActiveIndex - 1
  479. })
  480. }
  481. wx.request({
  482. url: util.globalData.publicUrl + '/wxinfo/delete',
  483. method: "get",
  484. header: {
  485. appletsId: wx.getStorageSync('openId')
  486. },
  487. data: {
  488. id: e.currentTarget.dataset.item._id
  489. },
  490. success: (res) => {
  491. console.log(res)
  492. if (res.data.code == 0) {
  493. this.data.nameArr.splice(index, 1)
  494. console.log(this.data.nameArr, "我是删除名字后的老人数组")
  495. this.setData({
  496. nameArr: this.data.nameArr
  497. })
  498. if (this.data.nameArr.length == 0) {
  499. wx.switchTab({
  500. url: '/pages/index/index',
  501. })
  502. }
  503. }
  504. }
  505. })
  506. }
  507. }
  508. })
  509. },
  510. // 添加带fid的老人
  511. addFamilyOldman() {
  512. this.setData({
  513. showBj1: true,
  514. addOldname1: ''
  515. })
  516. },
  517. goOcr() {
  518. wx.showLoading({
  519. title: '加载中',
  520. })
  521. let _this = this
  522. wx.request({
  523. url: util.globalData.publicUrl + '/applet/getToken',
  524. method: "GET",
  525. header: {
  526. appletsId: wx.getStorageSync('openId')
  527. },
  528. success: (res) => {
  529. console.log(res.data, "0000");
  530. if (res.data.data.status == 200) {
  531. let token = res.data.data.token;
  532. if (token) {
  533. wx.chooseImage({
  534. count: 1, // 默认9
  535. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  536. sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  537. success: function (res) {
  538. // 拿文件转换base64
  539. wx.getFileSystemManager().readFile({
  540. filePath: res.tempFilePaths[0],
  541. encoding: 'base64',
  542. success: res1 => {
  543. //返回临时文件路径
  544. let img = 'data:image/png;base64,' + res1.data
  545. wx.request({
  546. url: 'https://aip.baidubce.com/rest/2.0/ocr/v1/idcard?access_token=' + token,
  547. method: 'POST',
  548. header: {
  549. 'content-type': 'application/x-www-form-urlencoded'
  550. },
  551. data: {
  552. id_card_side: 'front',
  553. image: img
  554. },
  555. dataType: 'json',
  556. success: (e) => {
  557. // 扫描后赋值
  558. if (e.data.idcard_number_type == 1) {
  559. console.log(e.data.words_result, '我是ocr识别出来的内容')
  560. // let result = e.data.words_result
  561. // console.log(result, "00000000");
  562. // _this.data.parameter.forEach(item => {
  563. // if (item.name == result['性别'].words) {
  564. // item.checked = true;
  565. // }
  566. // })
  567. // result['性别'].words,
  568. _this.setData({
  569. name: result['姓名'].words,
  570. idNumber: result['公民身份号码'].words,
  571. })
  572. } else {
  573. wx.showToast({
  574. title: "身份证OCR识别失败",
  575. icon: 'none',
  576. duration: 2000,
  577. })
  578. }
  579. },
  580. complete: (e) => {
  581. wx.hideLoading();
  582. }
  583. })
  584. },
  585. // 错误信息
  586. fail: console.error
  587. })
  588. },
  589. fail: function () {
  590. wx.hideLoading();
  591. }
  592. })
  593. } else {
  594. wx.showToast({
  595. title: '身份证识别失败,token失效',
  596. icon: 'none',
  597. duration: 2000,
  598. })
  599. }
  600. }
  601. },
  602. })
  603. },
  604. // 老人姓名
  605. tab1Change1: function (e) {
  606. if (e.detail.value == null || e.detail.value == '') {
  607. this.setData({
  608. oldName: true
  609. })
  610. return
  611. } else {
  612. this.setData({
  613. oldName: false
  614. })
  615. }
  616. this.SubmitOldmanInfo({
  617. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  618. name: e.detail.value
  619. })
  620. },
  621. // 性别单选
  622. tab1Change2(e) {
  623. let data = this.data.oldInfo[this.data.currentActiveIndex].oldSex.map(v => {
  624. if (v.name == e.detail.value) {
  625. return {
  626. name: v.name,
  627. checked: true
  628. }
  629. }
  630. return {
  631. name: v.name,
  632. checked: false
  633. }
  634. })
  635. let oldSex = 'oldInfo[' + this.data.currentActiveIndex + '].oldSex'
  636. this.setData({
  637. [oldSex]: data
  638. })
  639. this.SubmitOldmanInfo({
  640. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  641. sex: e.detail.value
  642. })
  643. },
  644. // 民族选择
  645. tab1Change3: function (e) {
  646. console.log('picker发送选择改变,携带值为', e.detail.value)
  647. let nation = 'oldInfo[' + this.data.currentActiveIndex + '].nation'
  648. this.setData({
  649. [nation]: this.data.mzArr[e.detail.value]
  650. })
  651. this.SubmitOldmanInfo({
  652. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  653. nation: this.data.mzArr[e.detail.value]
  654. })
  655. },
  656. // 身份证号
  657. tab1Change4: function (e) {
  658. console.log('身份证变化了')
  659. if (e.detail.value == null || e.detail.value == '') {
  660. this.setData({
  661. oldCard: true,
  662. oldCard1: false
  663. })
  664. return
  665. } else {
  666. this.setData({
  667. oldCard: false
  668. })
  669. }
  670. if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e.detail.value)) && e.detail.value.length != 18) {
  671. this.setData({
  672. oldCard1: true
  673. })
  674. return
  675. } else {
  676. this.setData({
  677. oldCard1: false
  678. })
  679. let idNumber = 'oldInfo[' + this.data.currentActiveIndex + '].idNumber'
  680. this.setData({
  681. [idNumber]: e.detail.value
  682. })
  683. this.SubmitOldmanInfo({
  684. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  685. idNumber: e.detail.value
  686. })
  687. }
  688. },
  689. // 联系电话
  690. tab1Change5: function (e) {
  691. if (e.detail.value == null || e.detail.value == '') {
  692. this.setData({
  693. oldPhone: true
  694. })
  695. return
  696. } else {
  697. this.setData({
  698. oldPhone: false
  699. })
  700. }
  701. if (!(/^[0-9]*$/.test(e.detail.value))) {
  702. this.setData({
  703. oldPhone1: true
  704. })
  705. return
  706. } else {
  707. this.setData({
  708. oldPhone1: false
  709. })
  710. this.SubmitOldmanInfo({
  711. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  712. phone: e.detail.value
  713. })
  714. }
  715. },
  716. // 婚姻以及配偶情况
  717. tab1Change8: function (e) {
  718. console.log(e.detail.value)
  719. if (e.detail.value == '已婚') {
  720. this.setData({
  721. oldisMarry: true
  722. })
  723. } else {
  724. this.setData({
  725. oldisMarry: false,
  726. oldisMarryName: false,
  727. oldisMarryPhone: false
  728. })
  729. }
  730. let data = this.data.oldInfo[this.data.currentActiveIndex].oldMarry.map(v => {
  731. if (v.name == e.detail.value) {
  732. console.log("我选了")
  733. return {
  734. name: v.name,
  735. checked: true
  736. }
  737. }
  738. return {
  739. name: v.name,
  740. checked: false
  741. }
  742. })
  743. console.log(data)
  744. let oldMarry = 'oldInfo[' + this.data.currentActiveIndex + '].oldMarry'
  745. this.setData({
  746. [oldMarry]: data
  747. })
  748. console.log(this.data.oldInfo)
  749. this.SubmitOldmanInfo({
  750. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  751. partnerState: e.detail.value
  752. })
  753. },
  754. //配偶的姓名
  755. tab1Change8_1(e) {
  756. if (e.detail.value == '' || e.detail.value == null) {
  757. this.setData({
  758. oldisMarryName: true
  759. })
  760. return
  761. } else {
  762. this.setData({
  763. oldisMarryName: false
  764. })
  765. }
  766. let partnerName = 'oldInfo[' + this.data.currentActiveIndex + '].partnerName'
  767. this.setData({
  768. [partnerName]: e.detail.value
  769. })
  770. this.SubmitOldmanInfo({
  771. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  772. partnerName: e.detail.value
  773. })
  774. },
  775. //配偶身份证号
  776. tab1Change8_2(e) {
  777. if (e.detail.value == '' || e.detail.value == null) {
  778. this.setData({
  779. oldisMarryPhone: true
  780. })
  781. return
  782. } else {
  783. this.setData({
  784. oldisMarryPhone: false
  785. })
  786. }
  787. if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(e.detail.value)) && e.detail.value.length != 18) {
  788. this.setData({
  789. oldisMarryPhoneGs: true
  790. })
  791. return
  792. } else {
  793. let partnerIdNumber = 'oldInfo[' + this.data.currentActiveIndex + '].partnerIdNumber'
  794. this.setData({
  795. oldisMarryPhoneGs: false,
  796. [partnerIdNumber]: e.detail.value
  797. })
  798. this.SubmitOldmanInfo({
  799. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  800. partnerIdNumber: e.detail.value
  801. })
  802. }
  803. },
  804. //老人健康状况
  805. tab1Change9: function (e) {
  806. console.log(e.detail.value)
  807. const items = this.data.oldInfo[this.data.currentActiveIndex].healthAyy
  808. const values = e.detail.value
  809. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  810. items[i].checked = false
  811. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  812. if (items[i].name === values[j]) {
  813. items[i].checked = true
  814. break
  815. }
  816. }
  817. }
  818. let healthAyy = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy'
  819. this.setData({
  820. [healthAyy]: items
  821. })
  822. console.log(this.data.oldInfo)
  823. let revise1 = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy[1].disabled'
  824. let revise2 = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy[2].disabled'
  825. let revise3 = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy[3].disabled'
  826. let rev1 = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy[1].checked'
  827. let rev2 = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy[2].checked'
  828. let rev3 = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy[3].checked'
  829. if (e.detail.value.length == 0) {
  830. this.setData({
  831. oldHealth1: true,
  832. [revise1]: false,
  833. [revise2]: false,
  834. [revise3]: false,
  835. })
  836. return
  837. } else {
  838. this.setData({
  839. oldHealth1: false
  840. })
  841. }
  842. let index = e.detail.value.indexOf('健康');
  843. let index1 = e.detail.value.indexOf('残疾');
  844. let index2 = e.detail.value.indexOf('患重特大疾病');
  845. if (index >= 0) {
  846. this.setData({
  847. [revise1]: true,
  848. [revise2]: true,
  849. [revise3]: true,
  850. [rev1]: false,
  851. [rev2]: false,
  852. [rev3]: false
  853. })
  854. this.SubmitOldmanInfo({
  855. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  856. health: JSON.stringify(['健康'])
  857. })
  858. } else {
  859. this.setData({
  860. [revise1]: false,
  861. [revise2]: false,
  862. [revise3]: false,
  863. })
  864. }
  865. if (index1 >= 0 && index < 0) {
  866. this.setData({
  867. oldHealth2: true
  868. })
  869. } else {
  870. this.setData({
  871. oldHealth2: false,
  872. oldDisableType: false,
  873. issickTypeNull: false
  874. })
  875. }
  876. if (index2 >= 0 && index < 0) {
  877. this.setData({
  878. isSick: true
  879. })
  880. } else {
  881. this.setData({
  882. isSick: false,
  883. oldDisableType: false,
  884. issickTypeNull: false
  885. })
  886. }
  887. // let data = this.data.oldInfo[this.data.currentActiveIndex].healthAyy.map(v => {
  888. // if (e.detail.value.indexOf(v.name) >= 0) {
  889. // return {
  890. // name: v.name,
  891. // checked: true
  892. // }
  893. // }
  894. // return {
  895. // name: v.name,
  896. // checked: false
  897. // }
  898. // })
  899. // let healthAyy = 'oldInfo[' + this.data.currentActiveIndex + '].healthAyy'
  900. // console.log(healthAyy)
  901. // this.setData({
  902. // [healthAyy]: data
  903. // })
  904. if (index < 0 && e.detail.value.length != 0) {
  905. this.SubmitOldmanInfo({
  906. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  907. health: JSON.stringify(e.detail.value)
  908. })
  909. }
  910. },
  911. // 残疾类别
  912. tab1Change10: function (e) {
  913. if (e.detail.value == null || e.detail.value == '') {
  914. this.setData({
  915. oldDisableType: true
  916. })
  917. return
  918. } else {
  919. this.setData({
  920. oldDisableType: false
  921. })
  922. }
  923. this.SubmitOldmanInfo({
  924. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  925. disabilityCategory: JSON.stringify(e.detail.value)
  926. })
  927. },
  928. // 重特大疾病类别 无接口
  929. tab1Change10_1: function (e) {
  930. if (e.detail.value.length == 0) {
  931. this.setData({
  932. issickTypeNull: true
  933. })
  934. return
  935. } else {
  936. this.setData({
  937. issickTypeNull: false
  938. })
  939. }
  940. this.SubmitOldmanInfo({
  941. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  942. majorDiseases: JSON.stringify(e.detail.value)
  943. })
  944. },
  945. // 残疾人等级
  946. tab1Change11: function (e) {
  947. this.setData({
  948. levalIndex: e.detail.value
  949. })
  950. this.SubmitOldmanInfo({
  951. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  952. disabilityLevel: this.data.disableLeval[e.detail.value]
  953. })
  954. },
  955. // 老年人能力情况
  956. tab1Change12: function (e) {
  957. console.log(e.detail.value)
  958. this.setData({
  959. ableIndex: e.detail.value
  960. })
  961. if (e.detail.value == 2) {
  962. this.setData({
  963. oldType: this.data.oldType.concat({
  964. name: "失能老人",
  965. disable: true,
  966. checked: true
  967. })
  968. })
  969. }
  970. this.SubmitOldmanInfo({
  971. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  972. ability: this.data.disableLeval[e.detail.value]
  973. })
  974. },
  975. // 生活经济情况
  976. tab1Change13: function (e) {
  977. this.setData({
  978. moneyIndex: e.detail.value
  979. })
  980. this.SubmitOldmanInfo({
  981. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  982. livingCondition: this.data.moneyStatus[e.detail.value]
  983. })
  984. },
  985. // 收入来源
  986. tab1Change14: function (e) {
  987. // moneyOtherQt
  988. if (e.detail.value.length == 0) {
  989. this.setData({
  990. moneyFromOther: true
  991. })
  992. return
  993. } else {
  994. this.setData({
  995. moneyFromOther: false
  996. })
  997. }
  998. let index = e.detail.value.indexOf('其它')
  999. if (index >= 0) {
  1000. this.setData({
  1001. moneyOtherQt: true
  1002. })
  1003. } else {
  1004. this.setData({
  1005. moneyOtherQt: false,
  1006. moneyOtherQtnull: false
  1007. })
  1008. }
  1009. this.SubmitOldmanInfo({
  1010. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1011. sourceOfIncome: JSON.stringify(e.detail.value)
  1012. })
  1013. },
  1014. // 其他收入来源sourceOfIncomeExt
  1015. tab1Change14_1: function (e) {
  1016. if (e.detail.value == null || e.detail.value == '') {
  1017. this.setData({
  1018. moneyOtherQtnull: true
  1019. })
  1020. } else {
  1021. this.setData({
  1022. moneyOtherQtnull: false
  1023. })
  1024. this.SubmitOldmanInfo({
  1025. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1026. sourceOfIncomeExt: e.detail.value
  1027. })
  1028. }
  1029. },
  1030. // 本人上年度可支配收入
  1031. tab1Change15: function (e) {
  1032. this.setData({
  1033. payIndex: e.detail.value
  1034. })
  1035. this.SubmitOldmanInfo({
  1036. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1037. income: this.data.payMoney[e.detail.value]
  1038. })
  1039. },
  1040. // 家庭救助帮扶情况
  1041. tab1Change16: function (e) {
  1042. if (e.detail.value.length == 0) {
  1043. this.setData({
  1044. familyHelp: true
  1045. })
  1046. return
  1047. } else {
  1048. this.setData({
  1049. familyHelp: false
  1050. })
  1051. }
  1052. let index = e.detail.value.indexOf('其他救助')
  1053. if (index >= 0) {
  1054. this.setData({
  1055. familyHelpQt: true
  1056. })
  1057. } else {
  1058. this.setData({
  1059. familyHelpQt: false,
  1060. otherhelpQtnull: false
  1061. })
  1062. }
  1063. this.SubmitOldmanInfo({
  1064. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1065. rescueState: JSON.stringify(e.detail.value)
  1066. })
  1067. },
  1068. // 其他家庭救助帮扶情况
  1069. tab1Change16_1: function (e) {
  1070. if (e.detail.value == null || e.detail.value == '') {
  1071. this.setData({
  1072. otherhelpQtnull: true
  1073. })
  1074. } else {
  1075. this.setData({
  1076. otherhelpQtnull: false
  1077. })
  1078. this.SubmitOldmanInfo({
  1079. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1080. rescueStateExt: e.detail.value
  1081. })
  1082. }
  1083. },
  1084. // 是否为失独家庭
  1085. tab1Change17: function (e) {
  1086. console.log(e.detail.value)
  1087. this.SubmitOldmanInfo({
  1088. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1089. isLoss: e.detail.value
  1090. })
  1091. },
  1092. // 陪伴居住情况
  1093. tab1Change18: function (e) {
  1094. console.log(e.detail.value)
  1095. const items = this.data.liveStatus
  1096. const values = e.detail.value
  1097. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1098. items[i].checked = false
  1099. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1100. if (items[i].name === values[j]) {
  1101. items[i].checked = true
  1102. break
  1103. }
  1104. }
  1105. }
  1106. this.setData({
  1107. liveStatus: items
  1108. })
  1109. let revise1 = "liveStatus[1].disabled";
  1110. let revise2 = "liveStatus[2].disabled";
  1111. let revise3 = "liveStatus[3].disabled";
  1112. let revise4 = "liveStatus[4].disabled";
  1113. let rev1 = "liveStatus[1].checked";
  1114. let rev2 = "liveStatus[2].checked";
  1115. let rev3 = "liveStatus[3].checked";
  1116. let rev4 = "liveStatus[4].checked";
  1117. if (e.detail.value.length == 0) {
  1118. this.setData({
  1119. isliveNull: true
  1120. })
  1121. } else {
  1122. this.setData({
  1123. isliveNull: false
  1124. })
  1125. }
  1126. let index = e.detail.value.indexOf('无人陪伴居住');
  1127. let index1 = e.detail.value.indexOf('其他情形');
  1128. if (index >= 0) {
  1129. this.setData({
  1130. [revise1]: true,
  1131. [revise2]: true,
  1132. [revise3]: true,
  1133. [revise4]: true,
  1134. [rev1]: false,
  1135. [rev2]: false,
  1136. [rev3]: false,
  1137. [rev4]: false,
  1138. })
  1139. this.SubmitOldmanInfo({
  1140. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1141. health: JSON.stringify(['无人陪伴居住'])
  1142. })
  1143. } else {
  1144. this.setData({
  1145. [revise1]: false,
  1146. [revise2]: false,
  1147. [revise3]: false,
  1148. [revise4]: false
  1149. })
  1150. }
  1151. if (index1 >= 0) {
  1152. this.setData({
  1153. isliveQt: true
  1154. })
  1155. } else {
  1156. this.setData({
  1157. isliveQt: false,
  1158. isliveQtNull: false
  1159. })
  1160. }
  1161. if (index < 0 && e.detail.value.length != 0) {
  1162. this.SubmitOldmanInfo({
  1163. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1164. accompany: JSON.stringify(e.detail.value)
  1165. })
  1166. }
  1167. },
  1168. // 其他陪伴居住情况
  1169. tab1Change18_1: function (e) {
  1170. if (e.detail.value == null || e.detail.value == '') {
  1171. this.setData({
  1172. isliveQtNull: true
  1173. })
  1174. } else {
  1175. this.setData({
  1176. isliveQtNull: false
  1177. })
  1178. this.SubmitOldmanInfo({
  1179. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1180. accompanyExt: e.detail.value
  1181. })
  1182. }
  1183. },
  1184. // 日常生活照料人
  1185. tab1Change19: function (e) {
  1186. console.log(e.detail.value)
  1187. const items = this.data.oftenMan
  1188. const values = e.detail.value
  1189. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  1190. items[i].checked = false
  1191. for (let j = 0, lenJ = values.length; j < lenJ; ++j) {
  1192. if (items[i].name === values[j]) {
  1193. items[i].checked = true
  1194. break
  1195. }
  1196. }
  1197. }
  1198. this.setData({
  1199. oftenMan: items
  1200. })
  1201. let revise1 = "oftenMan[1].disabled";
  1202. let revise2 = "oftenMan[2].disabled";
  1203. let revise3 = "oftenMan[3].disabled";
  1204. let revise4 = "oftenMan[4].disabled";
  1205. let revise5 = "oftenMan[5].disabled";
  1206. let rev1 = "oftenMan[1].checked";
  1207. let rev2 = "oftenMan[2].checked";
  1208. let rev3 = "oftenMan[3].checked";
  1209. let rev4 = "oftenMan[4].checked";
  1210. let rev5 = "oftenMan[5].checked";
  1211. if (e.detail.value.length == 0) {
  1212. this.setData({
  1213. isoftenManNull: true
  1214. })
  1215. } else {
  1216. this.setData({
  1217. isoftenManNull: false
  1218. })
  1219. }
  1220. let index = e.detail.value.indexOf('无人照料');
  1221. let index1 = e.detail.value.indexOf('其他人员');
  1222. if (index >= 0) {
  1223. this.setData({
  1224. [revise1]: true,
  1225. [revise2]: true,
  1226. [revise3]: true,
  1227. [revise4]: true,
  1228. [revise5]: true,
  1229. [rev1]: false,
  1230. [rev2]: false,
  1231. [rev3]: false,
  1232. [rev4]: false,
  1233. [rev5]: false,
  1234. })
  1235. this.SubmitOldmanInfo({
  1236. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1237. health: JSON.stringify(['无人照料'])
  1238. })
  1239. } else {
  1240. this.setData({
  1241. [revise1]: false,
  1242. [revise2]: false,
  1243. [revise3]: false,
  1244. [revise4]: false,
  1245. [revise5]: false
  1246. })
  1247. }
  1248. if (index1 >= 0) {
  1249. this.setData({
  1250. isoftenManQt: true
  1251. })
  1252. } else {
  1253. this.setData({
  1254. isoftenManQt: false,
  1255. isoftenReaNull: false
  1256. })
  1257. }
  1258. if (index < 0 && e.detail.value.length != 0) {
  1259. this.setData({
  1260. ofenmanDetail: true
  1261. })
  1262. this.SubmitOldmanInfo({
  1263. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1264. lookAfter: JSON.stringify(e.detail.value)
  1265. })
  1266. } else {
  1267. this.setData({
  1268. ofenmanDetail: false
  1269. })
  1270. }
  1271. },
  1272. // 其他人员关系
  1273. tab1Change20: function (e) {
  1274. if (e.detail.value == null || e.detail.value == '') {
  1275. this.setData({
  1276. isoftenReaNull: true
  1277. })
  1278. } else {
  1279. this.setData({
  1280. isoftenReaNull: false
  1281. })
  1282. this.SubmitOldmanInfo({
  1283. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1284. lookAfterExt: e.detail.value
  1285. })
  1286. }
  1287. },
  1288. // 主要照料人姓名
  1289. tab1Change21: function (e) {
  1290. if (e.detail.value == null || e.detail.value == '') {
  1291. this.setData({
  1292. lookAfterName: true
  1293. })
  1294. } else {
  1295. this.setData({
  1296. lookAfterName: false
  1297. })
  1298. this.SubmitOldmanInfo({
  1299. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1300. mainLookName: e.detail.value
  1301. })
  1302. }
  1303. },
  1304. // 主要照料人性别
  1305. tab1Change22: function (e) {
  1306. this.SubmitOldmanInfo({
  1307. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1308. mainLookSex: e.detail.value
  1309. })
  1310. },
  1311. // 主要照料人电话
  1312. tab1Change23: function (e) {
  1313. if (e.detail.value == '' || e.detail.value == null) {
  1314. this.setData({
  1315. islookPhoneNull: true
  1316. })
  1317. } else {
  1318. this.setData({
  1319. islookPhoneNull: false
  1320. })
  1321. this.SubmitOldmanInfo({
  1322. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1323. mainLookPhone: e.detail.value
  1324. })
  1325. }
  1326. },
  1327. // 关爱服务需求
  1328. tab1Change24: function (e) {
  1329. if (e.detail.value == '' || e.detail.value == null) {
  1330. this.setData({
  1331. isloveNull: true
  1332. })
  1333. } else {
  1334. this.setData({
  1335. isloveNull: false
  1336. })
  1337. this.SubmitOldmanInfo({
  1338. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1339. demand: JSON.stringify(e.detail.value)
  1340. })
  1341. }
  1342. let index = e.detail.value.indexOf('其它')
  1343. if (index >= 0) {
  1344. this.setData({
  1345. isloveQt: true
  1346. })
  1347. } else {
  1348. this.setData({
  1349. isloveQt: false,
  1350. isloveQtNull: false
  1351. })
  1352. }
  1353. },
  1354. // 其他关爱服务需求
  1355. tab1change25: function (e) {
  1356. if (e.detail.value == '' || e.detail.value == null) {
  1357. this.setData({
  1358. isloveQtNull: true
  1359. })
  1360. } else {
  1361. this.setData({
  1362. isloveQtNull: false,
  1363. })
  1364. this.SubmitOldmanInfo({
  1365. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1366. demandExt: e.detail.value
  1367. })
  1368. }
  1369. },
  1370. // 老年人类别
  1371. tab1Change26: function (e) {
  1372. console.log(e.detail.value)
  1373. if (e.detail.value == '' || e.detail.value == null) {
  1374. this.setData({
  1375. isoldtypeNull: true
  1376. })
  1377. } else {
  1378. this.setData({
  1379. isoldtypeNull: false,
  1380. })
  1381. }
  1382. let index1 = e.detail.value.indexOf('农村留守老年人')
  1383. let index2 = e.detail.value.indexOf('分散供养特困老年人')
  1384. let index3 = e.detail.value.indexOf('计划生育特殊家庭老人')
  1385. let index4 = e.detail.value.indexOf('空巢老年人')
  1386. let revise1 = "oldType[0].disable";
  1387. let revise2 = "oldType[1].disable";
  1388. let revise3 = "oldType[2].disable";
  1389. let revise4 = "oldType[3].disable";
  1390. this.SubmitOldmanInfo({
  1391. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1392. oldType: JSON.stringify(e.detail.value)
  1393. })
  1394. if (index1 >= 0) {
  1395. this.setData({
  1396. [revise2]: true,
  1397. [revise3]: true,
  1398. [revise4]: true
  1399. })
  1400. return false;
  1401. } else {
  1402. this.setData({
  1403. [revise2]: false,
  1404. [revise3]: false,
  1405. [revise4]: false
  1406. })
  1407. }
  1408. if (index2 >= 0) {
  1409. this.setData({
  1410. [revise1]: true,
  1411. [revise3]: true,
  1412. [revise4]: true
  1413. })
  1414. return false;
  1415. } else {
  1416. this.setData({
  1417. [revise1]: false,
  1418. [revise3]: false,
  1419. [revise4]: false
  1420. })
  1421. }
  1422. if (index3 >= 0) {
  1423. this.setData({
  1424. [revise1]: true,
  1425. [revise2]: true,
  1426. [revise4]: true
  1427. })
  1428. return false;
  1429. } else {
  1430. this.setData({
  1431. [revise1]: false,
  1432. [revise2]: false,
  1433. [revise4]: false
  1434. })
  1435. }
  1436. if (index4 >= 0) {
  1437. this.setData({
  1438. [revise1]: true,
  1439. [revise2]: true,
  1440. [revise3]: true
  1441. })
  1442. return false;
  1443. } else {
  1444. this.setData({
  1445. [revise1]: false,
  1446. [revise2]: false,
  1447. [revise3]: false
  1448. })
  1449. }
  1450. },
  1451. goPhoto() {
  1452. let that = this;
  1453. wx.chooseImage({
  1454. count: 1,
  1455. sizeType: ['compressed'],
  1456. sourceType: ['camera'],
  1457. success: function (res) {
  1458. let tempFilePaths = res.tempFilePaths
  1459. wx.uploadFile({
  1460. url: util.globalData.publicUrl + '/sys/user/upload',
  1461. filePath: tempFilePaths[0],
  1462. name: 'uploadFile',
  1463. formData: {
  1464. "user": "test",
  1465. },
  1466. header: {
  1467. appletsId: wx.getStorageSync('openId'),
  1468. },
  1469. success: function (res) {
  1470. console.log(JSON.parse(res.data), "45454545");
  1471. let datas = JSON.parse(res.data)
  1472. if (datas.code == 0) {
  1473. that.setData({
  1474. oldPhotoImg: datas.data,
  1475. isHavePhoto: true
  1476. })
  1477. console.log(datas.data)
  1478. }
  1479. }
  1480. })
  1481. }
  1482. })
  1483. },
  1484. closeImage(e) {
  1485. this.setData({
  1486. isTrue: true,
  1487. imgPath: '',
  1488. })
  1489. },
  1490. // 子女个数
  1491. tab2Change1: function (e) {
  1492. this.setData({
  1493. childIndex: e.detail.value,
  1494. })
  1495. if (e.detail.value == 0) {
  1496. this.setData({
  1497. childforTimes: Number(e.detail.value)
  1498. })
  1499. } else if (e.detail.value == 1) {
  1500. this.setData({
  1501. childforTimes: Number(e.detail.value),
  1502. childInfo: [{
  1503. name: '', // 姓名
  1504. sex: '',
  1505. phone: '', // 常用联系电话,
  1506. isHasGoOut: '', // 子女是否外出
  1507. outgoingplace: '', // 外出地点
  1508. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  1509. name2: '', // 子女配偶姓名
  1510. phone2: '', // 子女配偶电话
  1511. outgoingTime: '', // 最后一次离家时间
  1512. outgoingCause: '', // 外出原因
  1513. visit: '', // 平均一年探望次数
  1514. }]
  1515. })
  1516. } else if (e.detail.value == 2) {
  1517. this.setData({
  1518. childforTimes: Number(e.detail.value),
  1519. childInfo: [{
  1520. name: '', // 姓名
  1521. sex: '',
  1522. phone: '', // 常用联系电话,
  1523. isHasGoOut: '', // 子女是否外出
  1524. outgoingplace: '', // 外出地点
  1525. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  1526. name2: '', // 子女配偶姓名
  1527. phone2: '', // 子女配偶电话
  1528. outgoingTime: '', // 最后一次离家时间
  1529. outgoingCause: '', // 外出原因
  1530. visit: '', // 平均一年探望次数
  1531. }, {
  1532. name: '', // 姓名
  1533. sex: '',
  1534. phone: '', // 常用联系电话,
  1535. isHasGoOut: '', // 子女是否外出
  1536. outgoingplace: '', // 外出地点
  1537. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  1538. name2: '', // 子女配偶姓名
  1539. phone2: '', // 子女配偶电话
  1540. outgoingTime: '', // 最后一次离家时间
  1541. outgoingCause: '', // 外出原因
  1542. visit: '', // 平均一年探望次数
  1543. }]
  1544. })
  1545. } else {
  1546. this.setData({
  1547. childforTimes: Number(e.detail.value),
  1548. childInfo: [{
  1549. name: '', // 姓名
  1550. sex: '',
  1551. phone: '', // 常用联系电话,
  1552. isHasGoOut: '', // 子女是否外出
  1553. outgoingplace: '', // 外出地点
  1554. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  1555. name2: '', // 子女配偶姓名
  1556. phone2: '', // 子女配偶电话
  1557. outgoingTime: '', // 最后一次离家时间
  1558. outgoingCause: '', // 外出原因
  1559. visit: '', // 平均一年探望次数
  1560. }, {
  1561. name: '', // 姓名
  1562. sex: '',
  1563. phone: '', // 常用联系电话,
  1564. isHasGoOut: '', // 子女是否外出
  1565. outgoingplace: '', // 外出地点
  1566. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  1567. name2: '', // 子女配偶姓名
  1568. phone2: '', // 子女配偶电话
  1569. outgoingTime: '', // 最后一次离家时间
  1570. outgoingCause: '', // 外出原因
  1571. visit: '', // 平均一年探望次数
  1572. }, {
  1573. name: '', // 姓名
  1574. sex: '',
  1575. phone: '', // 常用联系电话,
  1576. isHasGoOut: '', // 子女是否外出
  1577. outgoingplace: '', // 外出地点
  1578. isHasPartner: '', // 是否有配偶 当是的时候 子女配偶姓名 子女配偶电话 必填 0: 是 1: 否
  1579. name2: '', // 子女配偶姓名
  1580. phone2: '', // 子女配偶电话
  1581. outgoingTime: '', // 最后一次离家时间
  1582. outgoingCause: '', // 外出原因
  1583. visit: '', // 平均一年探望次数
  1584. }]
  1585. })
  1586. }
  1587. this.SubmitOldmanInfo({
  1588. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1589. childrenNum: this.data.childNums[e.detail.value]
  1590. })
  1591. },
  1592. // 子女姓名
  1593. tab2Change2: function (e) {
  1594. let val = 'ischildName[' + e.currentTarget.dataset.index + ']';
  1595. let child = 'childInfo[' + e.currentTarget.dataset.index + '].name';
  1596. if (e.detail.value == '' || e.detail.value == null) {
  1597. this.setData({
  1598. [val]: true
  1599. })
  1600. } else {
  1601. this.setData({
  1602. [val]: false,
  1603. [child]: e.detail.value
  1604. })
  1605. this.SubmitOldmanInfo({
  1606. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1607. childInfo: JSON.stringify(this.data.childInfo)
  1608. })
  1609. }
  1610. },
  1611. // 子女性别
  1612. tab2Change3: function (e) {
  1613. let child = 'childInfo[' + e.currentTarget.dataset.index + '].sex';
  1614. this.setData({
  1615. [child]: e.detail.value
  1616. })
  1617. this.SubmitOldmanInfo({
  1618. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1619. childInfo: JSON.stringify(this.data.childInfo)
  1620. })
  1621. },
  1622. // 子女联系电话
  1623. tab2Change4: function (e) {
  1624. let val = 'ischildPhone[' + e.currentTarget.dataset.index + ']';
  1625. let child = 'childInfo[' + e.currentTarget.dataset.index + '].phone';
  1626. if (e.detail.value == null || e.detail.value == '') {
  1627. this.setData({
  1628. [val]: true
  1629. })
  1630. } else {
  1631. this.setData({
  1632. [val]: false,
  1633. [child]: e.detail.value
  1634. })
  1635. this.SubmitOldmanInfo({
  1636. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1637. childInfo: JSON.stringify(this.data.childInfo)
  1638. })
  1639. }
  1640. },
  1641. // 子女是否外出
  1642. tab2Change5: function (e) {
  1643. console.log(e.detail.value)
  1644. let child = 'childInfo[' + e.currentTarget.dataset.index + '].isHasGoOut';
  1645. let out = 'showchildOut[' + e.currentTarget.dataset.index + ']';
  1646. this.setData({
  1647. [child]: e.detail.value
  1648. })
  1649. this.SubmitOldmanInfo({
  1650. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1651. childInfo: JSON.stringify(this.data.childInfo)
  1652. })
  1653. if (e.detail.value == '是') {
  1654. this.setData({
  1655. [out]: true
  1656. })
  1657. } else {
  1658. this.setData({
  1659. [out]: false
  1660. })
  1661. }
  1662. },
  1663. //外出原因
  1664. tab2Change6: function (e) {
  1665. let val = 'ischildOutReason[' + e.currentTarget.dataset.index + ']';
  1666. let child = 'childInfo[' + e.currentTarget.dataset.index + '].outgoingCause';
  1667. if (e.detail.value == null || e.detail.value == '') {
  1668. this.setData({
  1669. [val]: true
  1670. })
  1671. } else {
  1672. this.setData({
  1673. [val]: false,
  1674. [child]: e.detail.value
  1675. })
  1676. this.SubmitOldmanInfo({
  1677. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1678. childInfo: JSON.stringify(this.data.childInfo)
  1679. })
  1680. }
  1681. },
  1682. // 外出地点
  1683. tab2Change7: function (e) {
  1684. let child = 'childInfo[' + e.currentTarget.dataset.index + '].outgoingplace';
  1685. let re = 'region0[' + e.currentTarget.dataset.index + ']';
  1686. this.setData({
  1687. [re]: e.detail.value,
  1688. [child]: e.detail.value
  1689. })
  1690. this.SubmitOldmanInfo({
  1691. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1692. childInfo: JSON.stringify(this.data.childInfo)
  1693. })
  1694. },
  1695. // 最后一次离家时间
  1696. tab2Change8: function (e) {
  1697. let child = 'childInfo[' + e.currentTarget.dataset.index + '].outgoingTime';
  1698. let re = 'childLeaveDate[' + e.currentTarget.dataset.index + ']';
  1699. this.setData({
  1700. [re]: e.detail.value,
  1701. [child]: e.detail.value
  1702. })
  1703. this.SubmitOldmanInfo({
  1704. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1705. childInfo: JSON.stringify(this.data.childInfo)
  1706. })
  1707. },
  1708. // 是否有配偶
  1709. tab2Change9: function (e) {
  1710. console.log(e.detail.value)
  1711. let child = 'childInfo[' + e.currentTarget.dataset.index + '].isHasPartner';
  1712. let out = 'ischildMarry[' + e.currentTarget.dataset.index + ']';
  1713. if (e.detail.value == '是') {
  1714. this.setData({
  1715. [out]: true,
  1716. [child]: e.detail.value
  1717. })
  1718. } else {
  1719. this.setData({
  1720. [out]: false,
  1721. [child]: e.detail.value
  1722. })
  1723. }
  1724. this.SubmitOldmanInfo({
  1725. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1726. childInfo: JSON.stringify(this.data.childInfo)
  1727. })
  1728. },
  1729. // 配偶姓名
  1730. tab2Change10: function (e) {
  1731. let val = 'ischildMarryName[' + e.currentTarget.dataset.index + ']';
  1732. let child = 'childInfo[' + e.currentTarget.dataset.index + '].name2';
  1733. if (e.detail.value == null || e.detail.value == '') {
  1734. this.setData({
  1735. [val]: true
  1736. })
  1737. } else {
  1738. this.setData({
  1739. [val]: false,
  1740. [child]: e.detail.value
  1741. })
  1742. this.SubmitOldmanInfo({
  1743. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1744. childInfo: JSON.stringify(this.data.childInfo)
  1745. })
  1746. }
  1747. },
  1748. // 配偶联系电话
  1749. tab2Change11: function (e) {
  1750. let val = 'ischildMarryPhone[' + e.currentTarget.dataset.index + ']';
  1751. let child = 'childInfo[' + e.currentTarget.dataset.index + '].phone2';
  1752. if (e.detail.value == null || e.detail.value == '') {
  1753. this.setData({
  1754. [val]: true
  1755. })
  1756. } else {
  1757. this.setData({
  1758. [val]: false,
  1759. [child]: e.detail.value
  1760. })
  1761. this.SubmitOldmanInfo({
  1762. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1763. childInfo: JSON.stringify(this.data.childInfo)
  1764. })
  1765. }
  1766. },
  1767. // 一年探望次数
  1768. tab2Change12: function (e) {
  1769. let child = 'childInfo[' + e.currentTarget.dataset.index + '].visit';
  1770. this.setData({
  1771. [child]: e.detail.value
  1772. })
  1773. this.SubmitOldmanInfo({
  1774. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1775. childInfo: JSON.stringify(this.data.childInfo)
  1776. })
  1777. },
  1778. // tab3是否有赡养人状态改变
  1779. tab3Change1: function (e) {
  1780. console.log('picker发送选择改变,携带值为', e.detail.value)
  1781. if (e.detail.value == 0) {
  1782. this.setData({
  1783. isHaveOther: true,
  1784. syrIndex: e.detail.value
  1785. })
  1786. } else {
  1787. this.setData({
  1788. isHaveOther: false,
  1789. syrIndex: e.detail.value
  1790. })
  1791. }
  1792. this.SubmitOldmanInfo({
  1793. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1794. isHasOther: this.data.othersyrArr[e.detail.value]
  1795. })
  1796. },
  1797. // 其他赡养人性别
  1798. tab2Change3: function (e) {
  1799. let info = 'otherInfo.sex';
  1800. this.setData({
  1801. [info]: e.detail.value
  1802. })
  1803. this.SubmitOldmanInfo({
  1804. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1805. otherInfo: JSON.stringify(this.data.otherInfo)
  1806. })
  1807. },
  1808. // 其他赡养人姓名
  1809. tab3Change2: function (e) {
  1810. let info = 'otherInfo.name';
  1811. if (e.detail.value == null || e.detail.value == '') {
  1812. this.setData({
  1813. isothersyrName: true
  1814. })
  1815. } else {
  1816. this.setData({
  1817. isothersyrName: false,
  1818. [info]: e.detail.value
  1819. })
  1820. this.SubmitOldmanInfo({
  1821. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1822. otherInfo: JSON.stringify(this.data.otherInfo)
  1823. })
  1824. }
  1825. },
  1826. // 其他赡养人电话
  1827. tab3Change4: function (e) {
  1828. let info = 'otherInfo.phone';
  1829. console.log(e.detail.value)
  1830. if (e.detail.value == null || e.detail.value == '') {
  1831. this.setData({
  1832. isothersyrPhone: true
  1833. })
  1834. } else {
  1835. this.setData({
  1836. isothersyrPhone: false,
  1837. [info]: e.detail.value
  1838. })
  1839. this.SubmitOldmanInfo({
  1840. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1841. otherInfo: JSON.stringify(this.data.otherInfo)
  1842. })
  1843. }
  1844. },
  1845. // 与被赡养人关系状态改变
  1846. tab3Change5: function (e) {
  1847. let info = 'otherInfo.relation';
  1848. this.setData({
  1849. othersyrRelationIndex: e.detail.value,
  1850. [info]: this.data.othersyrRelation[e.detail.value]
  1851. })
  1852. if (e.detail.value == 3) {
  1853. this.setData({
  1854. syrRelationQT: true
  1855. })
  1856. } else {
  1857. this.setData({
  1858. syrRelationQT: false
  1859. })
  1860. }
  1861. this.SubmitOldmanInfo({
  1862. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1863. otherInfo: JSON.stringify(this.data.otherInfo)
  1864. })
  1865. },
  1866. // 输选择其他时入与被赡养人其他关系
  1867. tab3Change6: function (e) {
  1868. let info = 'otherInfo.relationExt';
  1869. if (e.detail.value == null || e.detail.value == '') {
  1870. this.setData({
  1871. isothersyRelation: true
  1872. })
  1873. } else {
  1874. this.setData({
  1875. isothersyRelation: false,
  1876. [info]: e.detail.value
  1877. })
  1878. this.SubmitOldmanInfo({
  1879. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1880. otherInfo: JSON.stringify(this.data.otherInfo)
  1881. })
  1882. }
  1883. },
  1884. // 是否外出
  1885. tab3Change7: function (e) {
  1886. console.log('picker发送选择改变,携带值为', e.detail.value)
  1887. let info = 'otherInfo.isHasGoOut';
  1888. this.setData({
  1889. othersyrIsoutIndex: e.detail.value,
  1890. [info]: this.data.othersyrIsout[e.detail.value]
  1891. })
  1892. if (e.detail.value == 0) {
  1893. this.setData({
  1894. showothersyrOut: true
  1895. })
  1896. } else {
  1897. this.setData({
  1898. showothersyrOut: false
  1899. })
  1900. }
  1901. this.SubmitOldmanInfo({
  1902. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1903. otherInfo: JSON.stringify(this.data.otherInfo)
  1904. })
  1905. },
  1906. // 外出原因
  1907. tab3Change8: function (e) {
  1908. let info = 'otherInfo.outgoingCause';
  1909. if (e.detail.value == null || e.detail.value == '') {
  1910. this.setData({
  1911. isOutReason: true
  1912. })
  1913. } else {
  1914. this.setData({
  1915. isOutReason: false,
  1916. [info]: e.detail.value
  1917. })
  1918. this.SubmitOldmanInfo({
  1919. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1920. otherInfo: JSON.stringify(this.data.otherInfo)
  1921. })
  1922. }
  1923. },
  1924. // 外出地点改变
  1925. tab3Change9: function (e) {
  1926. let info = 'otherInfo.outgoingplace';
  1927. console.log('picker发送选择改变,携带值为', e.detail.value)
  1928. this.setData({
  1929. region: e.detail.value,
  1930. [info]: e.detail.value
  1931. })
  1932. this.SubmitOldmanInfo({
  1933. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1934. otherInfo: JSON.stringify(this.data.otherInfo)
  1935. })
  1936. },
  1937. //最后一次离家时间
  1938. tab3Change10: function (e) {
  1939. let info = 'otherInfo.outgoingTime';
  1940. console.log('picker发送选择改变,携带值为', e.detail.value)
  1941. this.setData({
  1942. date: e.detail.value,
  1943. [info]: e.detail.value
  1944. })
  1945. this.SubmitOldmanInfo({
  1946. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1947. otherInfo: JSON.stringify(this.data.otherInfo)
  1948. })
  1949. },
  1950. //是否有配偶
  1951. tab3Change11: function (e) {
  1952. console.log('picker发送选择改变,携带值为', e.detail.value)
  1953. let info = 'otherInfo.isHasPartner';
  1954. this.setData({
  1955. othersyrIsMarryIndex: e.detail.value,
  1956. [info]: this.data.othersyrIsMarry[e.detail.value]
  1957. })
  1958. if (e.detail.value == 0) {
  1959. this.setData({
  1960. isMarry: true
  1961. })
  1962. } else {
  1963. this.setData({
  1964. isMarry: false
  1965. })
  1966. }
  1967. this.SubmitOldmanInfo({
  1968. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1969. otherInfo: JSON.stringify(this.data.otherInfo)
  1970. })
  1971. },
  1972. // 配偶姓名
  1973. tab3Change12: function (e) {
  1974. let info = 'otherInfo.name2';
  1975. if (e.detail.value == null || e.detail.value == '') {
  1976. this.setData({
  1977. isMarryName: true
  1978. })
  1979. } else {
  1980. this.setData({
  1981. isMarryName: false,
  1982. [info]: e.detail.value
  1983. })
  1984. this.SubmitOldmanInfo({
  1985. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  1986. otherInfo: JSON.stringify(this.data.otherInfo)
  1987. })
  1988. }
  1989. },
  1990. // 配偶电话
  1991. tab3Change13: function (e) {
  1992. let info = 'otherInfo.phone2';
  1993. if (e.detail.value == null || e.detail.value == '') {
  1994. this.setData({
  1995. isMarryPhone: true
  1996. })
  1997. } else {
  1998. this.setData({
  1999. isMarryPhone: false,
  2000. [info]: e.detail.value
  2001. })
  2002. this.SubmitOldmanInfo({
  2003. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  2004. otherInfo: JSON.stringify(this.data.otherInfo)
  2005. })
  2006. }
  2007. },
  2008. //平均一年探望次数
  2009. tab3Change14: function (e) {
  2010. let info = 'otherInfo.visit';
  2011. console.log('picker发送选择改变,携带值为', e.detail.value)
  2012. this.setData({
  2013. othersyrTfTimesIndex: e.detail.value,
  2014. [info]: this.data.othersyrTfTimes[e.detail.value]
  2015. })
  2016. this.SubmitOldmanInfo({
  2017. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  2018. otherInfo: JSON.stringify(this.data.otherInfo)
  2019. })
  2020. },
  2021. // tab4巡访方式
  2022. tab4Change1(e) {
  2023. let info = 'regularsInfo.visitMode'
  2024. let index = e.detail.value.indexOf('其它')
  2025. if (e.detail.value.length == 0) {
  2026. this.setData({
  2027. isnull1: true
  2028. })
  2029. } else {
  2030. this.setData({
  2031. isnull1: false,
  2032. [info]: e.detail.value
  2033. })
  2034. this.SubmitOldmanInfo({
  2035. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  2036. regularsInfo: JSON.stringify(this.data.regularsInfo)
  2037. })
  2038. }
  2039. if (index >= 0) {
  2040. this.setData({
  2041. isVisitways: true
  2042. })
  2043. } else {
  2044. this.setData({
  2045. isVisitways: false,
  2046. isVisitwaysnull: false
  2047. })
  2048. }
  2049. },
  2050. tab4Change2(e) {
  2051. let info = 'regularsInfo.visitModeExt'
  2052. if (e.detail.value == null || e.detail.value == '') {
  2053. this.setData({
  2054. isVisitwaysnull: true
  2055. })
  2056. } else {
  2057. this.setData({
  2058. isVisitwaysnull: false,
  2059. [info]: e.detail.value
  2060. })
  2061. this.SubmitOldmanInfo({
  2062. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  2063. regularsInfo: JSON.stringify(this.data.regularsInfo)
  2064. })
  2065. }
  2066. },
  2067. // tab4巡访频次状态改变
  2068. tab4Change3(e) {
  2069. console.log(e.detail.value)
  2070. let info = 'regularsInfo.visitCount'
  2071. if (e.detail.value.length == 0) {
  2072. this.setData({
  2073. isnull2: true
  2074. })
  2075. } else {
  2076. this.setData({
  2077. isnull2: false,
  2078. [info]: e.detail.value
  2079. })
  2080. }
  2081. if (e.detail.value == '其它') {
  2082. this.setData({
  2083. isVisittimes: true
  2084. })
  2085. } else {
  2086. this.setData({
  2087. isVisittimes: false,
  2088. isVisittimesnull: false
  2089. })
  2090. }
  2091. this.SubmitOldmanInfo({
  2092. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  2093. regularsInfo: JSON.stringify(this.data.regularsInfo)
  2094. })
  2095. },
  2096. tab4change4(e) {
  2097. let info = 'regularsInfo.visitCountExt'
  2098. if (e.detail.value == null || e.detail.value == '') {
  2099. this.setData({
  2100. isVisittimesnull: true
  2101. })
  2102. } else {
  2103. this.setData({
  2104. isVisittimesnull: false,
  2105. [info]: e.detail.value
  2106. })
  2107. this.SubmitOldmanInfo({
  2108. id: this.data.nameArr[this.data.currentActiveIndex]._id,
  2109. regularsInfo: JSON.stringify(this.data.regularsInfo)
  2110. })
  2111. }
  2112. },
  2113. formSubmit(e) {
  2114. console.log('form发生了submit事件,携带数据为:', e.detail.value)
  2115. },
  2116. chooseAdress() {
  2117. this.setData({
  2118. adressShow: true
  2119. })
  2120. },
  2121. onLoad() {
  2122. const app = getApp()
  2123. console.log(app.globalData.id);
  2124. console.log(app.globalData.name);
  2125. },
  2126. onShow() {
  2127. this.setData({
  2128. showBj: true,
  2129. addOldname: ''
  2130. })
  2131. },
  2132. chooseAdress() {
  2133. wx.request({
  2134. url: util.globalData.publicUrl + '/civilregionalism/deptList',
  2135. method: "get",
  2136. header: {
  2137. appletsId: wx.getStorageSync('openId')
  2138. },
  2139. success: (res) => {
  2140. console.log(res.data.data)
  2141. this.setData({
  2142. showAdress: true,
  2143. provinceArr: res.data.data
  2144. })
  2145. }
  2146. })
  2147. },
  2148. provinceClick(e) {
  2149. console.log(e.currentTarget.dataset.item)
  2150. this.data.chooseAdressArr.push(e.currentTarget.dataset.item)
  2151. console.log(this.data.chooseAdressArr)
  2152. wx.request({
  2153. url: util.globalData.publicUrl + '/civilregionalism/deptList',
  2154. method: "get",
  2155. header: {
  2156. appletsId: wx.getStorageSync('openId')
  2157. },
  2158. data: {
  2159. fid: e.currentTarget.dataset.item.CIVILREGIONALISMID
  2160. },
  2161. success: (res) => {
  2162. this.setData({
  2163. provinceArr: res.data.data,
  2164. isAdress: true,
  2165. chooseAdressArr: this.data.chooseAdressArr
  2166. })
  2167. if (res.data.data.length == 0) {
  2168. this.setData({
  2169. pleaseChoose: false
  2170. })
  2171. }
  2172. }
  2173. })
  2174. },
  2175. closeAdress() {
  2176. this.setData({
  2177. showAdress: false
  2178. })
  2179. },
  2180. reSelect(e) {
  2181. this.setData({
  2182. chooseAdressArr: this.data.chooseAdressArr.slice(0, e.currentTarget.dataset.index)
  2183. })
  2184. let fid;
  2185. if (this.data.chooseAdressArr.length != 0) {
  2186. fid = this.data.chooseAdressArr[this.data.chooseAdressArr.length - 1].CIVILREGIONALISMID;
  2187. } else {
  2188. fid = ''
  2189. }
  2190. wx.request({
  2191. url: util.globalData.publicUrl + '/civilregionalism/deptList',
  2192. method: "get",
  2193. header: {
  2194. appletsId: wx.getStorageSync('openId')
  2195. },
  2196. data: {
  2197. fid
  2198. },
  2199. success: (res) => {
  2200. this.setData({
  2201. provinceArr: res.data.data,
  2202. isAdress: true,
  2203. chooseAdressArr: this.data.chooseAdressArr
  2204. })
  2205. if (res.data.data.length == 0) {
  2206. this.setData({
  2207. pleaseChoose: false
  2208. })
  2209. }
  2210. }
  2211. })
  2212. },
  2213. // 提交老人采集信息
  2214. SubmitOldmanInfo(data) {
  2215. console.log(data, ' 提交老人信息带过来的数据')
  2216. console.log(this.data.nameArr[this.data.currentActiveIndex])
  2217. wx.request({
  2218. url: util.globalData.publicUrl + '/wxinfo/update',
  2219. method: "post",
  2220. header: {
  2221. appletsId: wx.getStorageSync('openId')
  2222. },
  2223. data,
  2224. success: (res) => {
  2225. console.log(res)
  2226. }
  2227. })
  2228. }
  2229. })