collectInfo.js 58 KB

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