作者 朱振飞

优化保单新增及修改部分

@@ -4,7 +4,7 @@ App({ @@ -4,7 +4,7 @@ App({
4 post: function(url, data) { 4 post: function(url, data) {
5 wx.showNavigationBarLoading() 5 wx.showNavigationBarLoading()
6 wx.showLoading({ 6 wx.showLoading({
7 - title: '', 7 + title: '加载中',
8 }) 8 })
9 var promise = new Promise((resolve, reject) => { 9 var promise = new Promise((resolve, reject) => {
10 let that = this; 10 let that = this;
@@ -19,12 +19,10 @@ App({ @@ -19,12 +19,10 @@ App({
19 }, 19 },
20 success: function(res) { 20 success: function(res) {
21 resolve(res) 21 resolve(res)
22 - setTimeout(function() {  
23 wx.hideLoading() 22 wx.hideLoading()
24 - }, 600)  
25 wx.hideNavigationBarLoading() 23 wx.hideNavigationBarLoading()
26 }, 24 },
27 - error: function(e) { 25 + fail: function(e) {
28 reject(''); 26 reject('');
29 wx.hideLoading() 27 wx.hideLoading()
30 wx.hideNavigationBarLoading() 28 wx.hideNavigationBarLoading()
@@ -36,7 +34,6 @@ App({ @@ -36,7 +34,6 @@ App({
36 } 34 }
37 }) 35 })
38 }); 36 });
39 - wx.hideLoading()  
40 return promise; 37 return promise;
41 console.log(promise) 38 console.log(promise)
42 }, 39 },
@@ -7,9 +7,8 @@ Page({ @@ -7,9 +7,8 @@ Page({
7 */ 7 */
8 data: { 8 data: {
9 currentTab: 2, 9 currentTab: 2,
10 - Status: '',  
11 - KeyWord: '',  
12 - list: '', 10 + Status:'',
  11 + KeyWord:'',
13 mainid: '', 12 mainid: '',
14 vip_state: false 13 vip_state: false
15 }, 14 },
@@ -41,56 +40,21 @@ Page({ @@ -41,56 +40,21 @@ Page({
41 let url = 'counselor/familylist'; 40 let url = 'counselor/familylist';
42 let param = { 41 let param = {
43 UserId: app.globalData.UserId, 42 UserId: app.globalData.UserId,
44 - Status: that.data.currentTab, 43 + Status: this.data.currentTab,
45 KeyWord: that.data.KeyWord 44 KeyWord: that.data.KeyWord
46 } 45 }
  46 + console.log(param)
47 app.post(url, param).then((res) => { 47 app.post(url, param).then((res) => {
48 - console.log(res)  
49 - if (res.data.code == 200) { 48 + let data = res.data;
  49 + console.log(data.code)
  50 + console.log(res.data.data.list)
  51 + if (data.code == 200) {
  52 + console.log(1)
  53 + console.log(data.data.list)
50 that.setData({ 54 that.setData({
51 - list: res.data.data.list,  
52 - // cid: res.data.data.list[0].users[0].cid,  
53 - KeyWord: '',  
54 - // vip_state: true 55 + list: data.data.list
55 }) 56 })
56 57
57 - // if (res.data.data.type == '-13') {  
58 - // wx.showToast({  
59 - // title: '会员到期,请充值',  
60 - // icon: 'none'  
61 - // }, 2000)  
62 - // that.setData({  
63 - // vip_state: false  
64 - // })  
65 - // } else if (res.data.data.type == '-12') {  
66 - // wx.showToast({  
67 - // title: '您已经被禁用,请联系管理员',  
68 - // icon: 'none'  
69 - // }, 2000)  
70 - // that.setData({  
71 - // vip_state: false  
72 - // })  
73 - // } else if (res.data.data.type == '-11') {  
74 - // wx.showToast({  
75 - // title: '您的权限不足',  
76 - // icon: 'none'  
77 - // }, 2000)  
78 - // that.setData({  
79 - // vip_state: false  
80 - // })  
81 - // } else if (res.data.data.type == '1') {  
82 - // that.setData({  
83 - // list: res.data.data.list,  
84 - // // cid: res.data.data.list[0].users[0].cid,  
85 - // KeyWord: '',  
86 - // // vip_state: true  
87 - // })  
88 - // if (res.data.data.list[0].users[0].cid != '') {  
89 - // that.setData({  
90 - // cid: res.data.data.list[0].users[0].cid,  
91 - // })  
92 - // }  
93 - // }  
94 } 58 }
95 }).catch((errMsg) => { 59 }).catch((errMsg) => {
96 // console.log(errMsg) 60 // console.log(errMsg)
@@ -106,7 +70,6 @@ Page({ @@ -106,7 +70,6 @@ Page({
106 UserId: app.globalData.UserId, 70 UserId: app.globalData.UserId,
107 } 71 }
108 app.post(url, param).then((res) => { 72 app.post(url, param).then((res) => {
109 - console.log(res, res.data.data.type)  
110 if (res.data.code == 200) { 73 if (res.data.code == 200) {
111 if (res.data.data.type == 5) { 74 if (res.data.data.type == 5) {
112 wx.showToast({ 75 wx.showToast({
@@ -126,15 +89,8 @@ Page({ @@ -126,15 +89,8 @@ Page({
126 }) 89 })
127 } else{ 90 } else{
128 that.setData({ 91 that.setData({
129 - list: res.data.data.list,  
130 - KeyWord: '',  
131 vip_state: true 92 vip_state: true
132 }) 93 })
133 - if (res.data.data.list[0].users[0].cid != '') {  
134 - that.setData({  
135 - cid: res.data.data.list[0].users[0].cid,  
136 - })  
137 - }  
138 } 94 }
139 } 95 }
140 }).catch((errMsg) => { 96 }).catch((errMsg) => {
@@ -183,6 +139,7 @@ Page({ @@ -183,6 +139,7 @@ Page({
183 wx.navigateTo({ 139 wx.navigateTo({
184 url: '../addNewFamily/addNewFamily?flag=' + flag, 140 url: '../addNewFamily/addNewFamily?flag=' + flag,
185 }) 141 })
  142 + wx.setStorageSync('familyid', '')
186 }, 143 },
187 144
188 //管理成员 145 //管理成员
@@ -191,14 +148,15 @@ Page({ @@ -191,14 +148,15 @@ Page({
191 wx.navigateTo({ 148 wx.navigateTo({
192 url: '../addNewFamily/addNewFamily?familyid=' + familyid, 149 url: '../addNewFamily/addNewFamily?familyid=' + familyid,
193 }) 150 })
  151 + wx.setStorageSync('familyid', familyid)
194 }, 152 },
195 153
196 /** 154 /**
197 * 生命周期函数--监听页面加载 155 * 生命周期函数--监听页面加载
198 */ 156 */
199 onLoad: function(options) { 157 onLoad: function(options) {
200 - this.getdata()  
201 - this.getInfo() 158 + // this.getdata()
  159 +
202 }, 160 },
203 161
204 /** 162 /**
@@ -257,7 +257,7 @@ Page({ @@ -257,7 +257,7 @@ Page({
257 console.log(list.sex, list.sex == '') 257 console.log(list.sex, list.sex == '')
258 if (list.name == "") { 258 if (list.name == "") {
259 warn = "请填写您的姓名"; 259 warn = "请填写您的姓名";
260 - } else if (list.sex !=0 && list.sex!=1) { 260 + } else if (!list.sex) {
261 warn = "请填写您的性别"; 261 warn = "请填写您的性别";
262 } else if (list.family_role == '') { 262 } else if (list.family_role == '') {
263 warn = '请填写您的家庭角色' 263 warn = '请填写您的家庭角色'
@@ -292,9 +292,13 @@ Page({ @@ -292,9 +292,13 @@ Page({
292 wx.showToast({ 292 wx.showToast({
293 title: '录入成功', 293 title: '录入成功',
294 }) 294 })
295 - wx.navigateTo({  
296 - url: '/pages/index/addNewFamily/addNewFamily?familyid=' + res.data.data.family_id,  
297 - }) 295 + wx.setStorageSync('familyid', res.data.data.family_id)
  296 + setTimeout(()=>{
  297 + wx.navigateBack()
  298 + },1500)
  299 + // wx.navigateTo({
  300 + // url: '/pages/index/addNewFamily/addNewFamily?familyid=' + res.data.data.family_id,
  301 + // })
298 } 302 }
299 }).catch((errMsg) => { 303 }).catch((errMsg) => {
300 console.log(errMsg) 304 console.log(errMsg)
@@ -360,7 +364,6 @@ Page({ @@ -360,7 +364,6 @@ Page({
360 onLoad: function(options) { 364 onLoad: function(options) {
361 this.labelInfo() 365 this.labelInfo()
362 this.setData({ 366 this.setData({
363 - DefId: options.DefId,  
364 familyid: options.familyid 367 familyid: options.familyid
365 }) 368 })
366 if (options.DefId == undefined) { 369 if (options.DefId == undefined) {
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 <view class='item_list'> 40 <view class='item_list'>
41 <view class='list_title'>手机号 </view> 41 <view class='list_title'>手机号 </view>
42 <view class='list_input'> 42 <view class='list_input'>
43 - <input type='text' placeholder='请输入手机号' value='{{list.mobile}}' bindinput='setMobile'></input> 43 + <input type='number' placeholder='请输入手机号' value='{{list.mobile}}' bindinput='setMobile'></input>
44 </view> 44 </view>
45 </view> 45 </view>
46 46
@@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
101 <!-- 上传图片 --> 101 <!-- 上传图片 -->
102 <view class='upload_box'> 102 <view class='upload_box'>
103 <view class='popup_img' wx:if='{{hasimg}}' bindtap='chooseImg'> 103 <view class='popup_img' wx:if='{{hasimg}}' bindtap='chooseImg'>
104 - <image src='{{list.picurl}}' bindtap='viewImg'></image> 104 + <image src='{{list.picurl}}' bindtap='viewImg' mode='WidthFix'></image>
105 </view> 105 </view>
106 <view bindtap='chooseImg' wx:else> 106 <view bindtap='chooseImg' wx:else>
107 <view class='iconfont icon-add'></view> 107 <view class='iconfont icon-add'></view>
@@ -128,7 +128,6 @@ @@ -128,7 +128,6 @@
128 </view> 128 </view>
129 </view> 129 </view>
130 </view> 130 </view>
131 -  
132 <!-- 底部按钮 --> 131 <!-- 底部按钮 -->
133 <view class='null_box'></view> 132 <view class='null_box'></view>
134 <view class='bottom_box'> 133 <view class='bottom_box'>
@@ -227,3 +227,6 @@ page { @@ -227,3 +227,6 @@ page {
227 color: #fff; 227 color: #fff;
228 background: rgba(2, 134, 255, 1); 228 background: rgba(2, 134, 255, 1);
229 } 229 }
  230 +.popup_img image{
  231 + width: 100%
  232 +}
1 // pages/addListDetail/addListDetail.js 1 // pages/addListDetail/addListDetail.js
2 const app = getApp() 2 const app = getApp()
3 Page({ 3 Page({
4 -  
5 /** 4 /**
6 * 页面的初始数据 5 * 页面的初始数据
7 */ 6 */
@@ -255,7 +254,6 @@ Page({ @@ -255,7 +254,6 @@ Page({
255 if (projectlist[index].choose_status) { 254 if (projectlist[index].choose_status) {
256 projectlist[index].num = e.detail.value 255 projectlist[index].num = e.detail.value
257 } 256 }
258 - console.log(main_risk)  
259 this.setData({ 257 this.setData({
260 projectlist: projectlist 258 projectlist: projectlist
261 }) 259 })
@@ -837,11 +835,11 @@ Page({ @@ -837,11 +835,11 @@ Page({
837 }, 835 },
838 836
839 //家庭成员 837 //家庭成员
840 - familyMember() { 838 + familyMember(id) {
841 var FamilyId = this.data.FamilyId 839 var FamilyId = this.data.FamilyId
842 let url = 'counselor/familyname' 840 let url = 'counselor/familyname'
843 let params = { 841 let params = {
844 - FamilyId: FamilyId, 842 + FamilyId: FamilyId||id,
845 } 843 }
846 app.post(url, params).then((res) => { 844 app.post(url, params).then((res) => {
847 // console.log(res) 845 // console.log(res)
@@ -1150,10 +1148,10 @@ Page({ @@ -1150,10 +1148,10 @@ Page({
1150 1148
1151 1149
1152 //获取编辑保单接口 1150 //获取编辑保单接口
1153 - getlistVerify() { 1151 + getlistVerify(id) {
1154 let url = 'counselor/infordef' 1152 let url = 'counselor/infordef'
1155 let params = { 1153 let params = {
1156 - InfoId: this.data.inforid, 1154 + InfoId: this.data.inforid||id,
1157 } 1155 }
1158 app.post(url, params).then((res) => { 1156 app.post(url, params).then((res) => {
1159 if (res.data.code == 200) { 1157 if (res.data.code == 200) {
@@ -1228,24 +1226,37 @@ Page({ @@ -1228,24 +1226,37 @@ Page({
1228 * 生命周期函数--监听页面加载 1226 * 生命周期函数--监听页面加载
1229 */ 1227 */
1230 onLoad: function(options) { 1228 onLoad: function(options) {
  1229 +
1231 this.ensureProjectList() 1230 this.ensureProjectList()
1232 - this.setData({  
1233 - def_id: options.def_id, 1231 + let that = this;
  1232 + // this.setData({
  1233 + // def_id: options.def_id,
  1234 + // inforid: options.inforid,
  1235 + // FamilyId: options.FamilyId,
  1236 + // recognizee_name: options.name
  1237 + // })
  1238 + // if (options.inforid == undefined) {
  1239 + // this.setData({
  1240 + // inforid: 0
  1241 + // })
  1242 + // }
  1243 + options.inforid ? (that.getlistVerify(options.inforid),that.setData({
1234 inforid: options.inforid, 1244 inforid: options.inforid,
1235 - FamilyId: options.FamilyId,  
1236 - recognizee_name: options.name  
1237 - })  
1238 - if (options.inforid == undefined) {  
1239 - this.setData({  
1240 - inforid: 0  
1241 - })  
1242 - }  
1243 - if (options.FamilyId != '') {  
1244 - this.familyMember()  
1245 - }  
1246 - if (options.inforid != undefined) {  
1247 - this.getlistVerify()  
1248 - } 1245 + edit_state: true
  1246 + })): ""
  1247 + options.def_id ? that.setData({
  1248 + def_id: options.def_id,
  1249 + }) : ""
  1250 + options.FamilyId ? (that.familyMember(options.FamilyId),that.setData({
  1251 + FamilyId: options.FamilyId
  1252 + })):'';
  1253 +
  1254 + // if (options.FamilyId != '') {
  1255 + // this.familyMember()
  1256 + // }
  1257 + // if (options.inforid != undefined) {
  1258 + // this.getlistVerify()
  1259 + // }
1249 1260
1250 if (wx.getStorageSync('storge_state') && options.inforid == undefined) { 1261 if (wx.getStorageSync('storge_state') && options.inforid == undefined) {
1251 this.getStorage() 1262 this.getStorage()
@@ -54,9 +54,9 @@ @@ -54,9 +54,9 @@
54 <view class='list_title'>被保险人</view> 54 <view class='list_title'>被保险人</view>
55 <view class='list_input'> 55 <view class='list_input'>
56 <!-- bindchange='recognizeeSelect' --> 56 <!-- bindchange='recognizeeSelect' -->
57 - <view class='picker' range='{{recognizee}}' value='{{recognizeeindex}}'> 57 + <picker class='picker' range='{{recognizee}}' value='{{recognizeeindex}}' bindchange='recognizeeSelect'>
58 <input placeholder='请选择' value='{{recognizee_name}}' disabled='true'></input> 58 <input placeholder='请选择' value='{{recognizee_name}}' disabled='true'></input>
59 - </view> 59 + </picker>
60 </view> 60 </view>
61 </view> 61 </view>
62 <view> 62 <view>
@@ -54,7 +54,7 @@ Page({ @@ -54,7 +54,7 @@ Page({
54 let that = this; 54 let that = this;
55 let url = 'counselor/family'; 55 let url = 'counselor/family';
56 app.post(url, { 56 app.post(url, {
57 - FamilyId: this.data.familyid 57 + FamilyId: this.data.familyid || wx.getStorageSync('familyid')
58 }).then((res) => { 58 }).then((res) => {
59 console.log(res) 59 console.log(res)
60 if (res.data.code == 200) { 60 if (res.data.code == 200) {
@@ -175,13 +175,12 @@ Page({ @@ -175,13 +175,12 @@ Page({
175 onLoad: function(options) { 175 onLoad: function(options) {
176 console.log(options.familyid) 176 console.log(options.familyid)
177 let that = this; 177 let that = this;
178 - that.setData({  
179 - flag: options.flag, 178 + options.flag ? that.setData({
  179 + flag: options.flag
  180 + }) : ""
  181 + options.familyid ? (that.setData({
180 familyid: options.familyid 182 familyid: options.familyid
181 - })  
182 - if (options.familyid != '') {  
183 - that.getdata()  
184 - } 183 + }) && that.getdata() && wx.setStorageSync('familyid', options.familyid)):""
185 }, 184 },
186 185
187 /** 186 /**
@@ -195,9 +194,9 @@ Page({ @@ -195,9 +194,9 @@ Page({
195 * 生命周期函数--监听页面显示 194 * 生命周期函数--监听页面显示
196 */ 195 */
197 onShow: function() { 196 onShow: function() {
198 - if (this.data.familyid != '') {  
199 - this.getdata()  
200 - } 197 + let familyid = wx.getStorageSync('familyid');
  198 + console.log(familyid)
  199 + familyid ? this.getdata():console.log(2)
201 }, 200 },
202 201
203 /** 202 /**
@@ -22,11 +22,16 @@ @@ -22,11 +22,16 @@
22 </view> 22 </view>
23 </block> 23 </block>
24 <block wx:else> 24 <block wx:else>
25 - <view class='add_btn_box'> 25 + <view class='add_btn' bindtap='addPerson' wx:if="{{user_list.length<1}}">
  26 + <view class='iconfont icon-tianjia '></view>
  27 + <view>添加成员</view>
  28 + </view>
  29 + <view class='add_btn_box' wx:else>
26 <view class='' bindtap='addPerson'> 30 <view class='' bindtap='addPerson'>
27 <view class='iconfont icon-tianjia '></view> 31 <view class='iconfont icon-tianjia '></view>
28 <view>添加成员</view> 32 <view>添加成员</view>
29 </view> 33 </view>
  34 +
30 <view class='' bindtap='setDel' wx:if='{{del_icon}}'> 35 <view class='' bindtap='setDel' wx:if='{{del_icon}}'>
31 <view class='iconfont icon-bianji '></view> 36 <view class='iconfont icon-bianji '></view>
32 <view>删除</view> 37 <view>删除</view>
@@ -170,15 +170,13 @@ Page({ @@ -170,15 +170,13 @@ Page({
170 }) 170 })
171 } else { 171 } else {
172 that.setData({ 172 that.setData({
173 - list: res.data.data.list,  
174 - KeyWord: '',  
175 vip_state: true 173 vip_state: true
176 }) 174 })
177 - if (res.data.data.list[0].users[0].cid != '') {  
178 - that.setData({  
179 - cid: res.data.data.list[0].users[0].cid,  
180 - })  
181 - } 175 + // if (res.data.data.list[0].users[0].cid != '') {
  176 + // that.setData({
  177 + // cid: res.data.data.list[0].users[0].cid,
  178 + // })
  179 + // }
182 } 180 }
183 } 181 }
184 }).catch((errMsg) => { 182 }).catch((errMsg) => {
@@ -376,10 +376,10 @@ Page({ @@ -376,10 +376,10 @@ Page({
376 onLoad: function(options) { 376 onLoad: function(options) {
377 this.getcompany(); 377 this.getcompany();
378 this.getjobTitle(); 378 this.getjobTitle();
379 -  
380 - this.setData({ 379 + options.sharetext ? this.setData({
381 sharetext: options.sharetext, 380 sharetext: options.sharetext,
382 - }) 381 + }):''
  382 +
383 383
384 if (options.sharetext != undefined) { 384 if (options.sharetext != undefined) {
385 this.signType() 385 this.signType()
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 </view> 38 </view>
39 <view class='item_list'> 39 <view class='item_list'>
40 <view class='list_title'>职业名称</view> 40 <view class='list_title'>职业名称</view>
41 - <view class='list_input' bindtap='chargePicker'> 41 + <view class='list_input'>
42 <picker class='list_picker' value='{{titleindex}}' range='{{jobTitle_array}}' bindchange="jobTitle"> 42 <picker class='list_picker' value='{{titleindex}}' range='{{jobTitle_array}}' bindchange="jobTitle">
43 <input placeholder='请选择当前职位' value='{{jobTitle_array[titleindex]}}' disabled='true' placeholder-class='pl_style'></input> 43 <input placeholder='请选择当前职位' value='{{jobTitle_array[titleindex]}}' disabled='true' placeholder-class='pl_style'></input>
44 <view class='iconfont icon-xiala'></view> 44 <view class='iconfont icon-xiala'></view>
@@ -35,10 +35,10 @@ Page({ @@ -35,10 +35,10 @@ Page({
35 app.globalData.UserStatus = res.data.data.UserStatus; //用户状态(1初次登录,2多次登录)" 35 app.globalData.UserStatus = res.data.data.UserStatus; //用户状态(1初次登录,2多次登录)"
36 app.globalData.UserType = res.data.data.UserType; //用户类型(2为普通会员,3为顾问,4为推广) 36 app.globalData.UserType = res.data.data.UserType; //用户类型(2为普通会员,3为顾问,4为推广)
37 app.globalData.checkstatus = res.data.data.checkstatus; //分享参数(0无,1保单,2注册,3文章) 37 app.globalData.checkstatus = res.data.data.checkstatus; //分享参数(0无,1保单,2注册,3文章)
38 - that.setData({ 38 + res.data.data.PublishId ? that.setData({
39 PublishId: res.data.data.PublishId 39 PublishId: res.data.data.PublishId
40 - })  
41 - console.log(that.data.PublishId) 40 + }):''
  41 +
42 if (res.data.data.UserType == 4) { 42 if (res.data.data.UserType == 4) {
43 app.globalData.temp_UserType = 3 43 app.globalData.temp_UserType = 3
44 } 44 }