提交 75e7b55e6e77d9f41bc3e3bb76a153b16fdfc0b8

作者 wangyu
1 个父辈 aaf62e0d

优化

1 -// pages/main/addtionalreduce/home.js  
2 -var app = getApp();  
3 -var baseUrl = app.globalData.baseUrl;  
4 -Page({  
5 -  
6 - /**  
7 - * Page initial data  
8 - */  
9 - data: {  
10 - datas: ["",""],  
11 - is_declared: false,  
12 - additionlist:[],  
13 - declareStatus: {  
14 - "to_declare ": "待申报",  
15 - "declaring": "申报中",  
16 - "success": "审核成功",  
17 - "failed": "审核失败"  
18 - },  
19 - datas02: ["子女教育", "继续教育", "赡养老人", "大病医疗", "住房贷款利息"]  
20 - },  
21 -  
22 - /**  
23 - * Lifecycle function--Called when page load  
24 - */  
25 - onLoad: function(options) {  
26 - console.log("onLoad");  
27 - },  
28 -  
29 - godeclare: function() {  
30 - wx.navigateTo({  
31 - url: 'godeclare/godeclare',  
32 - })  
33 - },  
34 -  
35 - godetail: function() {  
36 - wx.navigateTo({  
37 - url: 'godetail/godetail',  
38 - })  
39 - },  
40 -  
41 - lookandadd: function(e) {  
42 - console.log("lookandadd", e);  
43 - wx.navigateTo({  
44 - url: 'lookandupdate/lookandupdate?index=' + e.currentTarget.id,  
45 - })  
46 - },  
47 -  
48 - /**  
49 - * Lifecycle function--Called when page is initially rendered  
50 - */  
51 - onReady: function() {  
52 - console.log("onReady");  
53 - },  
54 -  
55 - /**  
56 - * Lifecycle function--Called when page show  
57 - */  
58 - onShow: function() {  
59 - console.log("onShow");  
60 - var that = this  
61 - this.getAdditionList()  
62 - },  
63 -  
64 - getAdditionList: function() {  
65 - var that = this;  
66 - var Authorization = getApp().globalData.Authorization;  
67 - wx.request({  
68 - url: baseUrl + 'persontax/v1/person-additions',  
69 - data: {  
70 - limit: 10,  
71 - offset: 0  
72 - },  
73 - header: {  
74 - 'content-type': 'application/json',  
75 - "Authorization": Authorization  
76 - },  
77 - success: function(res) {  
78 - if(res&&res.data){  
79 - console.log("res",res)  
80 - that.setData({  
81 - additionlist:res.data.items  
82 - })  
83 - }  
84 - }  
85 - })  
86 - },  
87 -  
88 - /**  
89 - * Lifecycle function--Called when page hide  
90 - */  
91 - onHide: function() {  
92 -  
93 - },  
94 -  
95 - /**  
96 - * Lifecycle function--Called when page unload  
97 - */  
98 - onUnload: function() {  
99 -  
100 - },  
101 -  
102 - /**  
103 - * Page event handler function--Called when user drop down  
104 - */  
105 - onPullDownRefresh: function() {  
106 -  
107 - },  
108 -  
109 - /**  
110 - * Called when page reach bottom  
111 - */  
112 - onReachBottom: function() {  
113 -  
114 - },  
115 -  
116 - /**  
117 - * Called when user click on the top right corner to share  
118 - */  
119 - onShareAppMessage: function() {  
120 -  
121 - }  
122 -})  
1 -<!--pages/main/addtionalreduce/home.wxml-->  
2 -<view class='page'>  
3 -  
4 - <view style='margin-bottom:30rpxbackground:#fff'>  
5 - <view wx:for="{{additionlist}}" wx:key="" style='display:flex;flex-direction:column'>  
6 - <view style='margin:30rpx 44rpx;float:left;display:flex;flex-direction:column'>  
7 - <text class=' text_333_40 float_left'>{{item.legal_entity}}</text>  
8 - <view wx:if="{{item.status=='to_declare'}}" class='view_godeclare_wrap '>  
9 - <text class='text_godeclare_wrap '>立即申报</text>  
10 - </view>  
11 - </view>  
12 - <view wx:if="{{item.addition_items&&item.addition_items.length>0}}">  
13 - <block wx:for="{{datas02}}" wx:key="">  
14 - <view hidden="{{false}}">  
15 - <view class='divide_line' style='margin:0 50rpx'></view>  
16 - <view style='padding:30rpx 40rpx;display:flex;flex-direction:column '>  
17 - <view style='height:40rpx'>  
18 - <text class='text_333_32 float_left' wx:if="true">住房</text>  
19 - <image class='arrow_img_wrap float_right' src="/images/arrow_right.png"></image>  
20 - <text class='text_999_28' style='margin-bottom:8rpx;float:right' bindtap='lookandadd' id='{{index}}'>查看</text>  
21 - </view>  
22 - <view style='width:100%;padding:20rpx 20rpx;display:flex;flex-direction:row '>  
23 - <view class='float_left' style='flex:1'>  
24 - <text class='text_999_24 '>扣除方式</text>  
25 - <text class='text_gray_28' style='margin-left:20rpx'>年度</text>  
26 - </view>  
27 - <view class='float_right' style='flex:1'>  
28 - <text class='text_999_24 '>可扣除金额</text>  
29 - <text class='text_orange_28 ' style='margin-left:20rpx'>¥12000/年</text>  
30 - </view>  
31 - </view>  
32 -  
33 - <!-- <view>  
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>  
36 - <text wx:if="{{datas02[index].message!='大病医疗 '}}" class='text_blue_28 float_right ' bindtap='lookandadd ' id='{{index}} '>查看并调整</text>  
37 - <text wx:else class='text_blue_28 float_right ' bindtap='lookandadd ' id='{{index}} '>提交抵扣凭据</text>  
38 - </view>  
39 - <view style='margin-top:20rpx '>  
40 - <text class='text_gray_22 float_left '>累计已使用额度:4890.00</text>  
41 - <text class='text_gray_22 float_right '>本月可用额度:12810.00</text>  
42 - </view> -->  
43 - </view>  
44 - </view>  
45 - </block>  
46 - </view>  
47 - <view style='width:100%;height:20rpx;background:#F5F5F5'></view>  
48 - </view>  
49 - </view>  
50 -  
51 -  
52 -</view>  
1 -// pages/main/guide/guide.js  
2 -var baseUrl = getApp().globalData.baseUrl;  
3 -Page({  
4 -  
5 - /**  
6 - * 页面的初始数据  
7 - */  
8 - data: {  
9 -  
10 - },  
11 -  
12 - /**  
13 - * 生命周期函数--监听页面加载  
14 - */  
15 - onLoad: function(options) {  
16 -  
17 - },  
18 -  
19 - /**  
20 - * 生命周期函数--监听页面初次渲染完成  
21 - */  
22 - onReady: function() {  
23 -  
24 - },  
25 -  
26 - /**  
27 - * 生命周期函数--监听页面显示  
28 - */  
29 - onShow: function() {  
30 - this.taxconfirm();  
31 - },  
32 -  
33 - taxconfirm: function() {  
34 - var that = this;  
35 - var Authorization = getApp().globalData.Authorization;  
36 - console.log("Authorization", Authorization)  
37 - if (Authorization && Authorization.length > 10) {  
38 - wx.request({  
39 - url: baseUrl + 'persontax/v1/personal-taxes-confirm',  
40 - header: {  
41 - 'content-type': 'application/json',  
42 - "Authorization": Authorization  
43 - },  
44 - success: function(res) {  
45 - console.log("taxconfirm", res)  
46 - if (res.data && (res.data.status == '1' || res.data.status == '2')) { //未完善  
47 - that.showModal(res.data)  
48 - }  
49 - }  
50 - })  
51 - }  
52 - },  
53 -  
54 - showModal: function(data) {  
55 - wx.showModal({  
56 - title: '温馨提示',  
57 - content: '您的自然人基础信息尚未完善,请先完善基础信息',  
58 - confirmText: '立即完善',  
59 - showCancel: false,  
60 - confirmColor: '#357aeb',  
61 - success(res) {  
62 - if(res.confirm){  
63 - if (data.status == '1' && data.id) {  
64 - wx.navigateTo({  
65 - url: '../taxperson/editinfo/editinfo?id=' + data.id,  
66 - })  
67 - } else if (data.status == '1') {  
68 - wx.navigateTo({  
69 - url: '../taxperson/taxperson/addinfo/addinfo',  
70 - })  
71 - }  
72 - }  
73 - }  
74 - })  
75 - },  
76 -  
77 - /**  
78 - * 自然人信息采集  
79 - */  
80 - gotaxPerson: function() {  
81 - wx.navigateTo({  
82 - url: '../taxperson/home',  
83 - })  
84 - },  
85 -  
86 - /**  
87 - * 专项附加扣除  
88 - */  
89 - goAdditionalDiduction: function() {  
90 - wx.navigateTo({  
91 - url: '../addtionalreduce/home',  
92 - })  
93 - },  
94 -  
95 - /**  
96 - * 预扣预缴  
97 - */  
98 - goAdvancePayment: function() {  
99 - wx.navigateTo({  
100 - url: '../advancepayment/home',  
101 - })  
102 - },  
103 -  
104 - /**  
105 - * 汇算清缴  
106 - */  
107 - goFinalPayment: function() {  
108 - wx.navigateTo({  
109 - url: '../finalpayment/home',  
110 - })  
111 - },  
112 -  
113 - gochat: function() {  
114 - wx.navigateTo({  
115 - url: '../smartchat/chat',  
116 - })  
117 - },  
118 -  
119 - /**  
120 - * 生命周期函数--监听页面隐藏  
121 - */  
122 - onHide: function() {  
123 -  
124 - },  
125 -  
126 - /**  
127 - * 生命周期函数--监听页面卸载  
128 - */  
129 - onUnload: function() {  
130 -  
131 - },  
132 -  
133 - /**  
134 - * 页面相关事件处理函数--监听用户下拉动作  
135 - */  
136 - onPullDownRefresh: function() {  
137 -  
138 - },  
139 -  
140 - /**  
141 - * 页面上拉触底事件的处理函数  
142 - */  
143 - onReachBottom: function() {  
144 -  
145 - },  
146 -  
147 - /**  
148 - * 用户点击右上角分享  
149 - */  
150 - onShareAppMessage: function() {  
151 -  
152 - }  
153 -})  
1 -// pages/home/home.js  
2 -var app = getApp();  
3 -var baseUrl = app.globalData.baseUrl;  
4 -Page({  
5 -  
6 - /**  
7 - * 页面的初始数据  
8 - */  
9 - data: {  
10 - load_finish: false,  
11 - text_tip: "自然人信息不完善,立即完善",  
12 - taxlist: ['']  
13 - },  
14 -  
15 - /**  
16 - * 生命周期函数--监听页面加载  
17 - */  
18 - onLoad: function(options) {  
19 - console.log('onLoad')  
20 - if (app.globalData.OSSUrl.length == 0) {  
21 - app.configOssUrl()  
22 - }  
23 -  
24 - },  
25 -  
26 - /**  
27 - * 生命周期函数--监听页面初次渲染完成  
28 - */  
29 - onReady: function() {  
30 -  
31 - },  
32 -  
33 - /**  
34 - * 生命周期函数--监听页面显示  
35 - */  
36 - onShow: function() {  
37 -  
38 - console.log('onShow')  
39 - this.getTaxList()  
40 - },  
41 -  
42 - getTaxList: function() {  
43 - var that = this;  
44 - wx.showLoading({  
45 - title: '加载中',  
46 - })  
47 - var Authorization = app.globalData.Authorization;  
48 - console.log('Authorization', Authorization)  
49 - if (!Authorization || Authorization.length < 10) {  
50 - return  
51 - }  
52 - wx.request({  
53 - url: baseUrl + 'persontax/v1/personal-taxes',  
54 - method: "GET",  
55 - header: {  
56 - 'content-type': 'application/json', // 默认值  
57 - "Authorization": Authorization  
58 - },  
59 - data: {  
60 - 'all': true  
61 - },  
62 - success: function(res) {  
63 - console.log('succ',res)  
64 - if(res.statusCode ==200){  
65 - that.handleData(res.data);  
66 - }else{  
67 - wx.showModal({  
68 - title: res.data.message,  
69 - content: '',  
70 - showCancel:false,  
71 - success: function (res) {  
72 - if (res.confirm) {  
73 - console.log('用户点击确定')  
74 - wx.redirectTo({  
75 - url: '../../getPhone/getPhone',  
76 - })  
77 - } else if (res.cancel) {  
78 - console.log('用户点击取消')  
79 - }  
80 - }  
81 - })  
82 - }  
83 - },  
84 - fail(res) {  
85 - console.log(res.data)  
86 - },  
87 - complete() {  
88 - wx.hideLoading()  
89 - that.setData({  
90 - load_finish: true  
91 - })  
92 - }  
93 - })  
94 - },  
95 -  
96 - handleData: function(data) {  
97 - if (data.items && data.items.length > 0) {  
98 - var datalist = []  
99 -  
100 - for (var i = 0; i < data.items.length; i++) {  
101 - data.items[i].newmobile = this.formatMobile(data.items[i].mobile)  
102 - data.items[i].newidnum = this.formatIdNum(data.items[i].id_card_no)  
103 - if (i==0){  
104 - data.items[i].relative = "本人"  
105 - }else{  
106 - data.items[i].relative = data.items[i].family_ties  
107 - }  
108 - datalist.push(data.items[i])  
109 - }  
110 - this.setData({  
111 - taxlist: datalist  
112 - })  
113 - this.getStatus(datalist)  
114 - }  
115 - console.log('handleData', this.data.taxlist)  
116 - },  
117 -  
118 - formatMobile: function(mobile) {  
119 - if (mobile && mobile > 7) {  
120 - return mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');  
121 - } else {  
122 - return mobile  
123 - }  
124 - },  
125 -  
126 - formatIdNum: function(idnum) {  
127 - if (idnum && idnum.length >= 6 && idnum.length < 10) {  
128 - return idnum.substring(0, 2) + '****' + idnum.substring(idnum.length - 2, idnum.length);  
129 - } else if (idnum.length >= 10) {  
130 - return idnum.substring(0, 4) + '****' + idnum.substring(idnum.length - 4, idnum.length);  
131 - } else {  
132 - return idnum  
133 - }  
134 - },  
135 -  
136 - getStatus: function(data) {  
137 - console.log('data', data)  
138 - if (data[0].family_ties.length < 1 && data[0].name.length > 0 && data[0].taxpayer_status.length > 0 && data[0].id_card_type.length > 0 && data[0].id_card_no.length > 0 && data[0].mobile.length > 0 && data[0].is_investor.length > 0 && data[0].is_specific_profession.length > 0) {  
139 - this.setData({  
140 - text_tip: '去查看'  
141 - })  
142 - } else {  
143 - this.setData({  
144 - text_tip: '自然人信息不完善,立即完善'  
145 - })  
146 - }  
147 - },  
148 -  
149 - goadd: function(e) {  
150 - console.log(e)  
151 - wx.navigateTo({  
152 - url: 'addinfo/addinfo',  
153 - })  
154 - },  
155 -  
156 - goedit: function(e) {  
157 - console.log(e)  
158 - wx.navigateTo({  
159 - url: 'editinfo/editinfo?id=' + e.currentTarget.id,  
160 - })  
161 - },  
162 -  
163 - /**  
164 - * 生命周期函数--监听页面隐藏  
165 - */  
166 - onHide: function() {  
167 -  
168 - },  
169 -  
170 - /**  
171 - * 生命周期函数--监听页面卸载  
172 - */  
173 - onUnload: function() {  
174 -  
175 - },  
176 -  
177 - /**  
178 - * 页面相关事件处理函数--监听用户下拉动作  
179 - */  
180 - onPullDownRefresh: function() {  
181 -  
182 - },  
183 -  
184 - /**  
185 - * 页面上拉触底事件的处理函数  
186 - */  
187 - onReachBottom: function() {  
188 -  
189 - },  
190 -  
191 - /**  
192 - * 用户点击右上角分享  
193 - */  
194 - onShareAppMessage: function() {  
195 -  
196 - }  
197 -})  
注册登录 后发表评论