提交 5c34e993bc35b958ef990cc5f0b92857b87b42ed

作者 wangyu
1 个父辈 d5750763

优化专项附加扣除部分功能

1 // pages/main/addtionalreduce/home.js 1 // pages/main/addtionalreduce/home.js
2 var app = getApp(); 2 var app = getApp();
3 var baseUrl = app.globalData.baseUrl; 3 var baseUrl = app.globalData.baseUrl;
  4 +var format = require('../../../utils/util.js');
4 Page({ 5 Page({
5 6
6 /** 7 /**
@@ -12,6 +13,9 @@ Page({ @@ -12,6 +13,9 @@ Page({
12 hascompleted:false, 13 hascompleted:false,
13 additionlist: [], 14 additionlist: [],
14 complete_item:[], 15 complete_item:[],
  16 + choosed_date: '',
  17 + show_modal:false,
  18 + tip_detail:"尊敬的用户您好!2020年度的专项附加扣除申报已经启动,请您及时确认填报信息,确保专项附加扣除能正常享受扣除。",
15 declareStatus: { 19 declareStatus: {
16 "to_declare ": "待申报", 20 "to_declare ": "待申报",
17 "declaring": "申报中", 21 "declaring": "申报中",
@@ -40,6 +44,10 @@ Page({ @@ -40,6 +44,10 @@ Page({
40 */ 44 */
41 onLoad: function (options) { 45 onLoad: function (options) {
42 console.log("onLoad"); 46 console.log("onLoad");
  47 + var mydate = new Date();
  48 + this.setData({
  49 + choosed_date: mydate.getFullYear() ,
  50 + })
43 }, 51 },
44 52
45 godeclare: function (e) { 53 godeclare: function (e) {
@@ -67,7 +75,7 @@ Page({ @@ -67,7 +75,7 @@ Page({
67 lookandadd: function (e) { 75 lookandadd: function (e) {
68 var str = e.currentTarget.id.split('-') 76 var str = e.currentTarget.id.split('-')
69 var data = this.data.additionlist; 77 var data = this.data.additionlist;
70 - console.log("lookandadd", str); 78 + console.log("lookandadd", str,data);
71 79
72 wx.navigateTo({ 80 wx.navigateTo({
73 url: 'lookandupdate/lookandupdate?status=' + data[str[0]].addition_items[str[1]].addition_category + "&employee_status=" + data[str[0]].employee_status + "&legal_entity_id=" + data[str[0]].legal_entity_id + "&legal_entity=" + data[str[0]].legal_entity, 81 url: 'lookandupdate/lookandupdate?status=' + data[str[0]].addition_items[str[1]].addition_category + "&employee_status=" + data[str[0]].employee_status + "&legal_entity_id=" + data[str[0]].legal_entity_id + "&legal_entity=" + data[str[0]].legal_entity,
@@ -87,29 +95,32 @@ Page({ @@ -87,29 +95,32 @@ Page({
87 onShow: function () { 95 onShow: function () {
88 console.log("onShow"); 96 console.log("onShow");
89 var that = this 97 var that = this
90 - wx.showLoading({  
91 - title: '',  
92 - })  
93 this.getAdditionList() 98 this.getAdditionList()
94 }, 99 },
95 100
  101 + //获取申报列表
96 getAdditionList: function () { 102 getAdditionList: function () {
  103 + wx.showLoading({
  104 + title: '',
  105 + })
97 var that = this; 106 var that = this;
98 var Authorization = getApp().globalData.Authorization; 107 var Authorization = getApp().globalData.Authorization;
99 wx.request({ 108 wx.request({
100 url: baseUrl + 'persontax/v1/person-additions', 109 url: baseUrl + 'persontax/v1/person-additions',
101 - // data: {  
102 - // limit: 10,  
103 - // offset: 0  
104 - // }, 110 + data: {
  111 + years:that.data.choosed_date
  112 + // limit: 10,
  113 + // offset: 0
  114 + },
105 header: { 115 header: {
106 'content-type': 'application/json', 116 'content-type': 'application/json',
107 "Authorization": Authorization 117 "Authorization": Authorization
108 }, 118 },
109 success: function (res) { 119 success: function (res) {
110 if (res && res.data) { 120 if (res && res.data) {
111 - console.log("res", res) 121 + console.log("show_modal", !res.data.new_addition_status)
112 that.setData({ 122 that.setData({
  123 + show_modal: !res.data.new_addition_status,
113 complete_item: res.data.complete_item, 124 complete_item: res.data.complete_item,
114 additionlist: that.handleData(res.data.items) 125 additionlist: that.handleData(res.data.items)
115 }) 126 })
@@ -145,9 +156,64 @@ Page({ @@ -145,9 +156,64 @@ Page({
145 } 156 }
146 } 157 }
147 } 158 }
148 - console.log('ddddd', items) 159 + console.log('items', items)
149 return items 160 return items
150 }, 161 },
  162 +
  163 + datePickerChange: function (e) {
  164 + console.log("e", e)
  165 + var timestamp = Date.parse(new Date(e.detail.value)) / 1000
  166 + this.setData({
  167 + choosed_date: format.yearFormString(timestamp)
  168 + })
  169 + this.getAdditionList()
  170 + },
  171 +
  172 +// 暂不确认
  173 + doNotConfirm:function(){
  174 + this.setData({
  175 + show_modal: false
  176 + })
  177 + },
  178 +
  179 +// 立即确认
  180 + doConfirm: function () {
  181 + this.setData({
  182 + show_modal: false
  183 + })
  184 + this.quickAdd()
  185 + },
  186 +
  187 +// 一键带入
  188 + quickAdd:function(){
  189 + var that = this;
  190 + var Authorization = getApp().globalData.Authorization;
  191 + wx.request({
  192 + url: baseUrl + 'persontax/v1/person-additions-update',
  193 + method:"POST",
  194 + data: {
  195 + id_card_no: app.globalData.userInfo?app.globalData.userInfo.id:""
  196 + },
  197 + header: {
  198 + 'content-type': 'application/json',
  199 + "Authorization": Authorization
  200 + },
  201 + success: function (res) {
  202 + if (res && res.data) {
  203 + console.log("res", res)
  204 + that.setData({
  205 + choosed_date: "2020"
  206 + })
  207 + that.getAdditionList()
  208 + }
  209 + wx.hideLoading()
  210 + },
  211 + complete(res) {
  212 + console.log(res.data)
  213 + }
  214 + })
  215 + },
  216 +
151 /** 217 /**
152 * Lifecycle function--Called when page hide 218 * Lifecycle function--Called when page hide
153 */ 219 */
1 <!--pages/main/addtionalreduce/home.wxml--> 1 <!--pages/main/addtionalreduce/home.wxml-->
2 <view class='page'> 2 <view class='page'>
3 - 3 + <!-- 新增日期选择器 -->
  4 + <picker mode="date" fields="year" start="2019-01-01" end="2020-01-01" bindchange="datePickerChange">
  5 + <view style="height:80rpx;width:280rpx">
  6 + <text style="line-height:80rpx;margin:0 20rpx;font-size: 28rpx;color: #999;">年份: </text>
  7 + <text style="line-height:80rpx;font-size: 28rpx;color: #333;">{{choosed_date}} </text>
  8 + <image style=" width: 24rpx;height: 16rpx;align-items: center;" src="/images/arrow_down.png"></image>
  9 + </view>
  10 + </picker>
  11 + <view style='height:20rpx;background:#F5F5F5'></view>
  12 + <!-- 新增弹窗 -->
  13 + <view wx:if="{{show_modal}}" class="mask"></view>
  14 + <view wx:if="{{show_modal}}" style='top:320rpx;position:absolute;z-index:10;width:650rpx;right:0;left:0;margin:auto;'>
  15 + <image class='modal_img' src="/images/home_tip.png"></image>
  16 + <view style="background:white;">
  17 + <view style='font-size:30rpx;color:#666;padding:20rpx 40rpx'>{{tip_detail}}</view>
  18 + <view class="divide_line" style="margin-top:40rpx"></view>
  19 + <view style='height:100rpx;width:100%;display: flex;'>
  20 + <text class='text_cancel' bindtap='doNotConfirm'>暂不确认</text>
  21 + <view style='width:1px;background:#e5e5e5;'></view>
  22 + <text class='text_confirm' bindtap='doConfirm'>立即确认</text>
  23 + </view>
  24 + </view>
  25 + </view>
  26 + <!-- 数据列表 -->
4 <view wx:if="{{additionlist.length>0}}" style='margin-bottom:30rpx;background:#fff'> 27 <view wx:if="{{additionlist.length>0}}" style='margin-bottom:30rpx;background:#fff'>
5 - <view wx:for="{{additionlist}}" wx:key="" style='display:flex;flex-direction:column' wx:for-index="idx01" wx:for-item="item"> 28 + <view wx:for="{{additionlist}}" wx:key="" style='display:flex;flex-direction:column' wx:for-index="idx01" wx:for-item="item">
6 <view style='margin:30rpx 44rpx;float:left;display:flex;flex-direction:column'> 29 <view style='margin:30rpx 44rpx;float:left;display:flex;flex-direction:column'>
7 <text class=' text_333_40 float_left'>{{item.legal_entity}}</text> 30 <text class=' text_333_40 float_left'>{{item.legal_entity}}</text>
8 <view wx:if="{{item.employee_status!='inactive'&&item.addition_items.length<1&&item.status=='init'}}" class='view_godeclare_wrap' bindtap='godeclare' id='{{idx01}}'> 31 <view wx:if="{{item.employee_status!='inactive'&&item.addition_items.length<1&&item.status=='init'}}" class='view_godeclare_wrap' bindtap='godeclare' id='{{idx01}}'>
@@ -17,7 +40,7 @@ @@ -17,7 +40,7 @@
17 <block wx:for="{{item.addition_items}}" wx:key="" wx:for-item="itemData" wx:for-index="idx02"> 40 <block wx:for="{{item.addition_items}}" wx:key="" wx:for-item="itemData" wx:for-index="idx02">
18 <view wx:if="{{itemData.addition_category!='medical_fund'}}"> 41 <view wx:if="{{itemData.addition_category!='medical_fund'}}">
19 <view style='margin:0 50rpx;background:#e5e5e5;height:2rpx;'></view> 42 <view style='margin:0 50rpx;background:#e5e5e5;height:2rpx;'></view>
20 - <view style='padding:30rpx 40rpx;display:flex;flex-direction:column ' bindtap='lookandadd' id='{{idx01}}-{{idx02}}'> 43 + <view style='padding:30rpx 40rpx;display:flex;flex-direction:column ' bindtap='lookandadd' id='{{idx01}}-{{idx02}}'>
21 <view style='height:40rpx'> 44 <view style='height:40rpx'>
22 <text class='text_333_32 float_left'>{{additiontitle[itemData.addition_category]}}</text> 45 <text class='text_333_32 float_left'>{{additiontitle[itemData.addition_category]}}</text>
23 <text class='text_333_32 float_left' hidden="{{(itemData.addition_category=='continuing_education'||itemData.addition_category=='house_fund')||itemData.count<2}}">({{itemData.count}})</text> 46 <text class='text_333_32 float_left' hidden="{{(itemData.addition_category=='continuing_education'||itemData.addition_category=='house_fund')||itemData.count<2}}">({{itemData.count}})</text>
@@ -41,7 +64,7 @@ @@ -41,7 +64,7 @@
41 </view> 64 </view>
42 </view> 65 </view>
43 </view> 66 </view>
44 - <view wx:for="{{itemData.professions}}" wx:key="" wx:for-item="profession"> 67 + <view wx:for="{{itemData.professions}}" wx:key="" wx:for-item="profession">
45 <view wx:if="{{index==0}}"> 68 <view wx:if="{{index==0}}">
46 <text wx:if='{{itemData.professions.length>1}}' style='font-size:28rpx;color:#666'>职业资格继续教育 ({{itemData.professions.length}})</text> 69 <text wx:if='{{itemData.professions.length>1}}' style='font-size:28rpx;color:#666'>职业资格继续教育 ({{itemData.professions.length}})</text>
47 <text wx:else style='font-size:28rpx;color:#666'>职业资格继续教育</text> 70 <text wx:else style='font-size:28rpx;color:#666'>职业资格继续教育</text>
@@ -108,9 +131,20 @@ @@ -108,9 +131,20 @@
108 <!-- <view wx:else> 131 <!-- <view wx:else>
109 <image style='width:55%;height:254rpx;margin:166rpx;' src='/images/noreduce_img.png'></image> 132 <image style='width:55%;height:254rpx;margin:166rpx;' src='/images/noreduce_img.png'></image>
110 </view> --> 133 </view> -->
111 - 134 +
  135 + </view>
  136 + <view wx:if="{{hascompleted&&additionlist.length<1&&choosed_date!=2020}}" style='background:#fff;'>
  137 + <image style='width:55%;height:254rpx;margin:400rpx 166rpx 0 166rpx;' src='/images/noreduce_img.png'></image>
112 </view> 138 </view>
113 - <view wx:if="{{hascompleted&&additionlist.length<1}}" style='background:#fff;'>  
114 - <image style='width:55%;height:254rpx;margin:400rpx 166rpx 0 166rpx;' src='/images/noreduce_img.png'></image> 139 + <view wx:if="{{hascompleted&&additionlist.length<1&&choosed_date==2020}}" style='background:#fef6e9;padding:40rpx 30rpx;display:flex;'>
  140 + <view style="margin-right:20rpx;margin-top:10rpx">
  141 + <image style='width:40rpx;height:40rpx;' src='/images/warn_yellow.png'></image>
  142 + </view>
  143 + <view >
  144 + <text style="font-size: 32rpx;color: #2B2B2B;">您还没有填报2020年度的专项附加扣除,点击</text>
  145 + <text style="font-size: 32rpx;color: #357AEB;" bindtap="quickAdd"> [一键带入] </text>
  146 + <text style="font-size: 32rpx;color: #2B2B2B;">将2019年度已填报的扣除信息在2020年度继续填报。</text>
115 </view> 147 </view>
  148 +
  149 + </view>
116 </view> 150 </view>
@@ -117,3 +117,43 @@ line-height: 17px; @@ -117,3 +117,43 @@ line-height: 17px;
117 line-height: 13px; 117 line-height: 13px;
118 padding: 10rpx 30rpx; 118 padding: 10rpx 30rpx;
119 } 119 }
  120 +
  121 +/* 遮罩层 */
  122 +
  123 +.mask {
  124 + width: 100%;
  125 + height: 100%;
  126 + position: fixed;
  127 + top: 0;
  128 + left: 0;
  129 + background: #000;
  130 + opacity: 0.7;
  131 + z-index: 10;
  132 +}
  133 +
  134 +.modal_img {
  135 + width: 650rpx;
  136 + height: 160rpx;
  137 + margin: 0 auto;
  138 + display: block;
  139 +}
  140 +
  141 +.text_cancel {
  142 + font-family:PingFangSC-Regular,PingFang SC;
  143 + font-size: 36rpx;
  144 + color: #999;
  145 + letter-spacing: 0;
  146 + text-align: center;
  147 + flex: 1;
  148 + padding: 30rpx;
  149 +}
  150 +
  151 +.text_confirm {
  152 + font-family:PingFangSC-Regular,PingFang SC;
  153 + font-size: 36rpx;
  154 + color: #108ee9;
  155 + letter-spacing: 0;
  156 + text-align: center;
  157 + flex: 1;
  158 + padding: 30rpx;
  159 +}
注册登录 后发表评论