提交 1f4e2e329fba1adde30b8a5b0de61ed4e4ffc84b

作者 wangyu
1 个父辈 c2284753

优化

... ... @@ -68,13 +68,30 @@ Page({
68 68 * Lifecycle function--Called when page load
69 69 */
70 70 onLoad: function (options) {
  71 + var that = this
71 72 console.log("options", options);
72 73 this.setData({
73 74 cur_index: options.index
74 75 })
75   - wx.setNavigationBarTitle({
76   - title: this.data.title_arr[this.data.cur_index]
  76 + wx.getStorage({
  77 + key: 'selectitems',
  78 + success: function (res) {
  79 + console.log("selectitems", res.data)
  80 + var new_title = '添加'+res.data[options.index].message
  81 + if (new_title == '添加住房') {
  82 + new_title = '添加'+res.data[options.index].extra_message
  83 + }
  84 + wx.setNavigationBarTitle({
  85 + title: new_title,
  86 + })
  87 + that.setData({
  88 + title: new_title,
  89 + datas02: res.data
  90 + })
  91 + },
77 92 })
  93 +
  94 +
78 95 this.initOSS()
79 96 },
80 97
... ... @@ -124,6 +141,10 @@ Page({
124 141 },
125 142
126 143 gosave:function(){
  144 + wx.setStorage({
  145 + key: 'image',
  146 + data: this.data.img_path,
  147 + })
127 148 wx.navigateBack({
128 149 delta: 1
129 150 })
... ...
... ... @@ -9,21 +9,25 @@ Page({
9 9 flag_housing02: false,
10 10 selectIndex: [{
11 11 message: '子女教育',
  12 + disable_change: '',
12 13 sureid: false
13 14 }, {
14   - message: '继续教育',
  15 + message: '继续教育',
  16 + disable_change: '',
15 17 sureid: false
16 18 }, {
17 19 message: '赡养老人',
  20 + disable_change: '',
18 21 sureid: false
19 22 }, {
20   - message: '大病医疗',
  23 + message: '大病医疗',
  24 + disable_change: '',
21 25 sureid: false
22 26 }, {
23 27 message: '住房',
24 28 sureid: false,
25   - housing01:false,
26   - extra_message :''
  29 + disable_change: '',
  30 + extra_message: ''
27 31 }, ],
28 32 unitData: {
29 33 label: '选择申报单位',
... ... @@ -44,12 +48,12 @@ Page({
44 48 // wx.clearStorage()
45 49 wx.getStorage({
46 50 key: 'selectitems',
47   - success: function (res) {
  51 + success: function(res) {
48 52 console.log("selectitems", res.data)
49 53 that.setData({
50 54 selectIndex: res.data,
51   - flag_housing01: res.data[res.data.length - 1].housing01,
52   - flag_housing02: !res.data[res.data.length - 1].housing01
  55 + flag_housing01: res.data[res.data.length - 1].extra_message == '住房贷款利息',
  56 + flag_housing02: res.data[res.data.length - 1].extra_message == '住房租金'
53 57 })
54 58 },
55 59 })
... ... @@ -79,8 +83,14 @@ Page({
79 83 },
80 84
81 85 selectRep: function(e) {
82   - let index = e.currentTarget.dataset.selectindex; //当前点击元素的自定义数据,这个很关键
  86 + let index = e.currentTarget.dataset.selectindex;
83 87 let selectIndex = this.data.selectIndex; //取到data里的selectIndex
  88 + if (selectIndex[index].disable_change) {
  89 + wx.showToast({
  90 + title: '该选项不可修改',
  91 + })
  92 + return;
  93 + }
84 94 selectIndex[index].sureid = !selectIndex[index].sureid; //点击就赋相反的值
85 95 this.setData({
86 96 selectIndex: selectIndex //将已改变属性的json数组更新
... ... @@ -88,6 +98,13 @@ Page({
88 98 },
89 99
90 100 housing01: function(e) {
  101 + let selectIndex = this.data.selectIndex;
  102 + if (selectIndex[selectIndex.length - 1].disable_change) {
  103 + wx.showToast({
  104 + title: '该选项不可修改',
  105 + })
  106 + return;
  107 + }
91 108 this.setData({
92 109 flag_housing01: !this.data.flag_housing01
93 110 })
... ... @@ -99,6 +116,13 @@ Page({
99 116 },
100 117
101 118 housing02: function(e) {
  119 + let selectIndex = this.data.selectIndex;
  120 + if (selectIndex[selectIndex.length - 1].disable_change) {
  121 + wx.showToast({
  122 + title: '该选项不可修改',
  123 + })
  124 + return;
  125 + }
102 126 this.setData({
103 127 flag_housing02: !this.data.flag_housing02
104 128 })
... ... @@ -110,38 +134,39 @@ Page({
110 134 },
111 135
112 136 gocommit: function() {
113   - if (!this.data.unitData.selected || !this.data.unitData.selected.length>0){
  137 + if (!this.data.unitData.selected || !this.data.unitData.selected.length > 0) {
114 138 wx.showToast({
115 139 title: '请选择申报单位',
116 140 })
117 141 return;
118 142 }
119   - var selectjson = new Array();
120   - for (var i = 0; i < this.data.selectIndex.length; i++) {
  143 + var selectjson = this.data.selectIndex
  144 + var flag_count = 0
  145 + for (var i = 0; i < selectjson.length; i++) {
121 146 if (this.data.selectIndex[i].sureid) {
122   - selectjson.push(this.data.selectIndex[i]);
  147 + selectjson[i].disable_change = true
  148 + flag_count++
123 149 }
124 150 }
125   - console.log("selectjson01",selectjson)
126   - if (selectjson.length<1) {
  151 + console.log("selectjson01", selectjson)
  152 + if (flag_count < 1) {
127 153 wx.showToast({
128 154 title: '请选择专项附加扣除',
129 155 })
130 156 return;
131 157 } else {
132   - if (selectjson[selectjson.length - 1].sureid ) {
133   - if(this.data.flag_housing01 || this.data.flag_housing02){
134   - selectjson[selectjson.length - 1].housing01 = true;
135   - selectjson[selectjson.length - 1].extra_message = this.data.flag_housing01 ? "住房贷款利息" :"住房租金" ;
  158 + if (selectjson[selectjson.length - 1].sureid) {
  159 + if (this.data.flag_housing01 || this.data.flag_housing02) {
  160 + selectjson[selectjson.length - 1].extra_message = this.data.flag_housing01 ? "住房贷款利息" : "住房租金";
136 161 this.setData({
137   - selectIndex: selectjson
  162 + selectIndex: selectjson
  163 + })
  164 + } else {
  165 + wx.showToast({
  166 + title: '请选择住房类型',
138 167 })
  168 + return;
139 169 }
140   - } else {
141   - wx.showToast({
142   - title: '请选择住房类型',
143   - })
144   - return;
145 170 }
146 171 }
147 172 wx.setStorage({
... ...
... ... @@ -3,13 +3,14 @@
3 3 <view class='text_gray_30' style='padding:30rpx'>您在“北京小爱科技”申报的专项附加扣除项已添加完成,请完善各项的具体申报内容。</view>
4 4 <view style='padding-left:30rpx;padding-right:30rpx'>
5 5 <image class='icon_wrap' src="/images/rectangle_icon.png"></image>
6   - <text style='padding-left:20rpx' class='text_gray_32'>北京小爱科技公司</text>
  6 + <text style='padding-left:20rpx' class='text_gray_32'>北京小爱智能科技</text>
7 7 <view class='divide_line_f5f5f5' style='margin-top:30rpx' ></view>
8 8 </view>
9 9 <view wx:if="true">
10 10 <view wx:for="{{datas02}}">
11   - <view class='card_rectangle_bg_column' style='padding:30rpx;margin-top:30rpx'>
12   - <text class='text_black_32'>{{datas02[index].message}}</text>
  11 + <view hidden='{{!datas02[index].sureid}}' class='card_rectangle_bg_column' style='padding:30rpx;margin-top:30rpx'>
  12 + <text class='text_black_32' wx:if="{{datas02[index].message!='住房'}}">{{datas02[index].message}}</text>
  13 + <text class='text_black_32' wx:if="{{datas02[index].message=='住房'}}">{{datas02[index].extra_message}}</text>
13 14 <view style='margin:20rpx 0'>
14 15 <text class='text_gray_22 float_left'>已抵扣额度:4890.00</text>
15 16 <text class='text_gray_22 float_right'>剩余可抵扣额度:12810.00</text>
... ...
... ... @@ -31,7 +31,8 @@
31 31 <view class='divide_line'></view>
32 32 <view style='padding:44rpx 30rpx;display:flex;flex-direction:column'>
33 33 <view>
34   - <text class='text_666_30 float_left'>{{datas02[index].message}}</text>
  34 + <text class='text_666_30 float_left' wx:if="datas02[index].message!='住房'">{{datas02[index].message}}</text>
  35 + <text class='text_666_30 float_left' wx:if="datas02[index].message=='住房'">{{datas02[index].extra_message}}</text>
35 36 <text class='text_blue_28 float_right' bindtap='lookandadd' id='{{index}}'>查看并调整</text>
36 37 </view>
37 38 <view style='margin-top:20rpx'>
... ...
... ... @@ -23,11 +23,15 @@ Page({
23 23 key: 'selectitems',
24 24 success: function (res) {
25 25 console.log("selectitems", res.data)
  26 + var new_title = res.data[options.index].message
  27 + if (new_title=='住房'){
  28 + new_title = res.data[options.index].extra_message
  29 + }
26 30 wx.setNavigationBarTitle({
27   - title: res.data[options.index].message,
  31 + title: new_title,
28 32 })
29 33 that.setData({
30   - title: res.data[options.index].message,
  34 + title: new_title,
31 35 datas02: res.data
32 36 })
33 37 },
... ...
... ... @@ -25,7 +25,7 @@
25 25 <view class='divide_line_f5f5f5'></view>
26 26 <view style='margin:30rpx;' class='card_rectangle_bg_column'>
27 27 <!-- 子女教育 -->
28   - <view wx:if="{{title=='子女教育'}}" style='display:flex;flex-direction:column;padding:30rpx;'>
  28 + <view wx:if="{{title=='子女教育'}}" style='display:flex;flex-direction:column;padding: 30rpx 30rpx 0 30rpx;'>
29 29 <view style='height:40rpx'>
30 30 <text class='text_999_28 float_left'>子女姓名</text>
31 31 <text class='text_333_28 float_right'>纳兰嫣然</text>
... ... @@ -57,7 +57,7 @@
57 57 </view>
58 58
59 59 <!-- 继续教育 -->
60   - <view wx:if="{{title=='继续教育'}}" style='display:flex;flex-direction:column;padding:30rpx;'>
  60 + <view wx:if="{{title=='继续教育'}}" style='display:flex;flex-direction:column;padding:30rpx 30rpx 0 30rpx;'>
61 61 <view style='height:40rpx'>
62 62 <text class='text_999_28 float_left'>教育类型</text>
63 63 <text class='text_333_28 float_right'>消防工程师</text>
... ... @@ -73,7 +73,7 @@
73 73 </view>
74 74
75 75 <!-- 赡养老人 -->
76   - <view wx:if="{{title=='赡养老人'}}" style='display:flex;flex-direction:column;padding:30rpx;'>
  76 + <view wx:if="{{title=='赡养老人'}}" style='display:flex;flex-direction:column;padding:30rpx 30rpx 0 30rpx;'>
77 77 <view style='height:40rpx'>
78 78 <text class='text_999_28 float_left'>老人姓名</text>
79 79 <text class='text_333_28 float_right'>任我行</text>
... ... @@ -97,7 +97,7 @@
97 97 </view>
98 98
99 99 <!-- 大病医疗 -->
100   - <view wx:if="{{title=='大病医疗'}}" style='display:flex;flex-direction:column;padding:30rpx;'>
  100 + <view wx:if="{{title=='大病医疗'}}" style='display:flex;flex-direction:column;padding:30rpx 30rpx 0 30rpx;'>
101 101 <view style='height:40rpx'>
102 102 <text class='text_999_28 float_left'>扣除金额</text>
103 103 <text class='text_333_28 float_right'>42895</text>
... ... @@ -105,7 +105,7 @@
105 105 </view>
106 106
107 107 <!-- 住房 -->
108   - <view wx:if="{{title=='住房贷款利息'||title=='住房租金'}}" style='display:flex;flex-direction:column;padding:30rpx;'>
  108 + <view wx:if="{{title=='住房贷款利息'||title=='住房租金'}}" style='display:flex;flex-direction:column;padding:30rpx 30rpx 0 30rpx;'>
109 109 <view style='height:40rpx'>
110 110 <text class='text_999_28 float_left'>配偶姓名</text>
111 111 <text class='text_333_28 float_right'>刘顺丰</text>
... ... @@ -115,7 +115,7 @@
115 115 <text class='text_333_28 float_right'>42902384023855252</text>
116 116 </view>
117 117 </view>
118   - <view style='height:40rpx;padding:0 30rpx;'>
  118 + <view style='height:40rpx;padding:0 30rpx 30rpx 30rpx;'>
119 119 <text class='text_999_28 float_left'>扣除时间</text>
120 120 <text class='text_333_28 float_right'>2019年10月</text>
121 121 </view>
... ... @@ -126,7 +126,7 @@
126 126
127 127 <view class='rectangle_dashed_bg' bindtap='goadd'>
128 128 <view class='text_blue_28' style='line-height:90rpx'>
129   -{{add_text_arr[cur_index]}}
  129 +添加{{title}}
130 130 </view>
131 131 </view>
132 132 </view>
... ...
注册登录 后发表评论