Commit 8edf469f714f2033a5b07646519152361a5d2310

Authored by wangjialin
1 parent 92ac9472c2
Exists in dev_wjl and in 1 other branch dev-wrh

添加户籍地址回显

Showing 5 changed files with 101 additions and 1 deletions

littleApp_child/packageA/pages/editAddress/editAddress.js View file @ 8edf469
1 1 // packageA/pages/editAddress/editAddress.js
2 2 import { AreaPicker } from "../../../utils/areaSelector/selector.js"
  3 +import { province } from "../../../utils/areaSelector/province.js"
3 4 import api from "../../../utils/apiFile.js";
4 5 var networkUtil = require('../../../utils/network_util.js')
5 6 Page(Object.assign({}, AreaPicker,{
6 7  
... ... @@ -12,8 +13,91 @@
12 13 this.setData({
13 14 id: options.id
14 15 })
  16 + this.getdz(options.id)
  17 +
15 18 }
16 19 },
  20 + findNameById(id,data) {
  21 + for (let i = 0; i < data.length; i++) {
  22 + if (data[i].id == id) {
  23 + return data[i].name;
  24 + }
  25 + }
  26 + return null;
  27 + },
  28 + getdz(id){
  29 + let self=this
  30 + networkUtil._get(api.getKosekiInfo,{babyId:id}, function(res) {
  31 + if(0 == res.data.errorcode){
  32 + if(res.data.object){
  33 + let hhh={}
  34 + let arr=[]
  35 + let str=''
  36 +
  37 + var addr = 'https://app-member-api.healthbaby.com.cn/vqhdfy/archiveBuildRegions'
  38 + // debugger
  39 + if(res.data.object.babyProvinceId){
  40 + arr.push({id:res.data.object.babyProvinceId})
  41 + str=str+self.findNameById(res.data.object.babyProvinceId,province)
  42 + hhh.details=str
  43 + self.setData({
  44 + currentAddress: hhh
  45 + })
  46 + if(res.data.object.babyCityId){
  47 + arr.push({id:res.data.object.babyCityId})
  48 + networkUtil._getAddress(addr, { parentId: res.data.object.babyProvinceId, hospitalId: getApp().globalData.hospitalId ? getApp().globalData.hospitalId : ''}, function (res1) {
  49 + str=str+self.findNameById(res.data.object.babyCityId,res1.data.list)
  50 + hhh.details=str
  51 + self.setData({
  52 + currentAddress: hhh
  53 + })
  54 + if(res.data.object.babyAreaId){
  55 + arr.push({id:res.data.object.babyAreaId})
  56 + networkUtil._getAddress(addr, { parentId: res.data.object.babyCityId, hospitalId: getApp().globalData.hospitalId ? getApp().globalData.hospitalId : ''}, function (res2) {
  57 + str=str+self.findNameById(res.data.object.babyAreaId,res2.data.list)
  58 + hhh.details=str
  59 + self.setData({
  60 + currentAddress: hhh
  61 + })
  62 + if(res.data.object.babyStreetId){
  63 + arr.push({id:res.data.object.babyStreetId})
  64 + networkUtil._getAddress(addr, { parentId: res.data.object.babyAreaId, hospitalId: getApp().globalData.hospitalId ? getApp().globalData.hospitalId : ''}, function (res3) {
  65 + str=str+self.findNameById(res.data.object.babyStreetId,res3.data.list)
  66 + hhh.details=str
  67 + self.setData({
  68 + currentAddress: hhh
  69 + })
  70 + }, function (res3) {
  71 + wx.showToast({ title: `获取地区失败`})
  72 + })
  73 + }
  74 + }, function (res2) {
  75 + wx.showToast({ title: `获取地区失败`})
  76 + })
  77 + }
  78 + }, function (res1) {
  79 + wx.showToast({ title: `获取地区失败`})
  80 + })
  81 + }
  82 + }
  83 + if(res.data.object.babyAddress){
  84 + self.setData({
  85 + babyAddress:res.data.object.babyAddress
  86 + })
  87 + }
  88 + console.log('str',str);
  89 + hhh.addEntry=arr
  90 + hhh.details=str
  91 + self.setData({
  92 + currentAddress: hhh
  93 + })
  94 + }
  95 + console.log('res',res);
  96 + }
  97 + }, function(res) {
  98 + networkUtil.showErrorToast(res.errormsg)
  99 + })
  100 + },
17 101 onAreaCommit(locationList, e) {//当用户更换地区
18 102 // console.log('选择地址后', locationList)
19 103 var self = this;
... ... @@ -68,6 +152,8 @@
68 152 data.babyStreetId = this.data.currentAddress.addEntry[3].id;
69 153 }
70 154 data.babyAddress = this.data.babyAddress;
  155 + console.log('data',data);
  156 + console.log('data1',this.data.currentAddress);
71 157 networkUtil._get(api.editAddress,data, function(res) {
72 158 if(0 == res.data.errorcode){
73 159 wx.showModal({
littleApp_child/pages/Setting/Setting.js View file @ 8edf469
... ... @@ -46,7 +46,7 @@
46 46 param.type = 2
47 47 }
48 48 networkUtil._get(api.userInfo + app.globalData.currentId, param, function (res) {
49   - // console.log('获取用户信息', res)
  49 + console.log('获取用户信息', res)
50 50 self.setData({
51 51 babyname:res.data.data.username,
52 52 babyid:res.data.data.id
littleApp_child/pages/home/home.js View file @ 8edf469
... ... @@ -929,6 +929,8 @@
929 929 }
930 930 networkUtil._post(api.getBabyBuildPidInfo,param,function(res){
931 931 if (res.data.data) {
  932 + console.log('params',param);
  933 + console.log('res.data.data.id',res.data.data.id);
932 934 wx.navigateTo({url: '/packageA/pages/editAddress/editAddress?id=' + res.data.data.id })
933 935 }
934 936 },function(res){
littleApp_child/pages/vipService/vipService.js View file @ 8edf469
... ... @@ -11,6 +11,7 @@
11 11 data: {
12 12 vipList: [],
13 13 isVip: false,
  14 + isVip1: false,
14 15 phone: '',
15 16 hospitalId:null
16 17 },
... ... @@ -43,6 +44,15 @@
43 44 isVip: false
44 45 })
45 46 }
  47 + if (app.globalData.userInfo.bzstatus == 1) {
  48 + self.setData({
  49 + isVip1: true
  50 + })
  51 + } else {
  52 + self.setData({
  53 + isVip1: false
  54 + })
  55 + }
46 56 },
47 57 requestData() {
48 58 var self = this
littleApp_child/utils/apiFile.js View file @ 8edf469
... ... @@ -95,6 +95,8 @@
95 95 addBuildArticle: 'baby/babyBuildArticle',
96 96 //儿童建档-修改户籍地址
97 97 editAddress: '/baby/updateKosekiInfo',
  98 + //儿童建档-查询户籍地址
  99 + getKosekiInfo: '/baby/getKosekiInfo',
98 100 //儿童疾病护理获取医生列表
99 101 getWxDoctors:'baby/getWxDoctors',
100 102 //添加用药记录