提交 762b570805233192dc08d0bdc92c67b1d567fc0a

作者 wangyu
1 个父辈 cdd66ab7

完成收入详情5个附表对应的查询添加相关逻辑

@@ -6,9 +6,11 @@ Page({ @@ -6,9 +6,11 @@ Page({
6 * Page initial data 6 * Page initial data
7 */ 7 */
8 data: { 8 data: {
  9 + settlement_record_id: "",
9 year: "2019", 10 year: "2019",
10 showAddView: false, 11 showAddView: false,
11 infoList: [{}], 12 infoList: [{}],
  13 + total_account:0,
12 project: ["正常工资薪金", "劳务报酬", "稿酬", "特许经营权使用费"], 14 project: ["正常工资薪金", "劳务报酬", "稿酬", "特许经营权使用费"],
13 deductcontent: ["高级专家延长离退休期间工薪免征个人所得税", "解除劳动合同当地工资3倍以内免税", "符合条件的津补贴免征个人所得税", "生育津贴和生育医疗费免税", "工伤保险免税", "符合条件的外交人员免征个人所得税", "外籍个人出差补贴免税", "外籍个人探亲费、语言训练费、子女教育费免税", "外籍个人生活费用免税", "符合条件的外籍来华专家工资薪金所得免征个人所得税", "薪金所得免征个人所得数", "横琴、香港、澳门居民免税", "平潭台湾居民免税", "安家费、退职费、退休工资、离休工资、离休生活补助费免税"], 15 deductcontent: ["高级专家延长离退休期间工薪免征个人所得税", "解除劳动合同当地工资3倍以内免税", "符合条件的津补贴免征个人所得税", "生育津贴和生育医疗费免税", "工伤保险免税", "符合条件的外交人员免征个人所得税", "外籍个人出差补贴免税", "外籍个人探亲费、语言训练费、子女教育费免税", "外籍个人生活费用免税", "符合条件的外籍来华专家工资薪金所得免征个人所得税", "薪金所得免征个人所得数", "横琴、香港、澳门居民免税", "平潭台湾居民免税", "安家费、退职费、退休工资、离休工资、离休生活补助费免税"],
14 deductproperty: ["其他"], 16 deductproperty: ["其他"],
@@ -22,6 +24,9 @@ Page({ @@ -22,6 +24,9 @@ Page({
22 * Lifecycle function--Called when page load 24 * Lifecycle function--Called when page load
23 */ 25 */
24 onLoad: function (options) { 26 onLoad: function (options) {
  27 + this.setData({
  28 + settlement_record_id: options.id
  29 + })
25 this.getInfoList() 30 this.getInfoList()
26 }, 31 },
27 32
@@ -42,11 +47,13 @@ Page({ @@ -42,11 +47,13 @@ Page({
42 }, 47 },
43 data: { 48 data: {
44 "years": that.data.year, 49 "years": that.data.year,
  50 + "settlement_record_id": that.data.settlement_record_id
45 }, 51 },
46 success: function (result) { 52 success: function (result) {
47 console.log("infoList", result) 53 console.log("infoList", result)
48 if (result.statusCode == 200) { 54 if (result.statusCode == 200) {
49 that.setData({ 55 that.setData({
  56 + total_account: result.data.total_account,
50 infoList: result.data.items, 57 infoList: result.data.items,
51 income_item: "", 58 income_item: "",
52 reduction_item: "", 59 reduction_item: "",
@@ -150,6 +157,7 @@ Page({ @@ -150,6 +157,7 @@ Page({
150 method: "POST", 157 method: "POST",
151 data: { 158 data: {
152 "years": that.data.year, 159 "years": that.data.year,
  160 + "settlement_record_id": that.data.settlement_record_id,
153 "income_item": that.data.income_item, 161 "income_item": that.data.income_item,
154 "reduction_item": that.data.reduction_item, 162 "reduction_item": that.data.reduction_item,
155 "reduction_nature": that.data.reduction_nature, 163 "reduction_nature": that.data.reduction_nature,
1 <view > 1 <view >
2 <view style="background:#fff;padding:0 30rpx;"> 2 <view style="background:#fff;padding:0 30rpx;">
3 <text class="text_gray7_34">减免税额合计</text> 3 <text class="text_gray7_34">减免税额合计</text>
4 - <text class="text_black3_34 float_right">{{3000}}</text> 4 + <text class="text_black3_34 float_right">{{total_account}}</text>
5 </view> 5 </view>
6 6
7 <!-- 列表数据,不可修改 --> 7 <!-- 列表数据,不可修改 -->
@@ -7,26 +7,39 @@ Page({ @@ -7,26 +7,39 @@ Page({
7 * Page initial data 7 * Page initial data
8 */ 8 */
9 data: { 9 data: {
  10 + settlement_record_id:"",
10 year: "2019", 11 year: "2019",
11 - infoList:[{}],  
12 - deductPick:["30%","100%"], 12 + showAddView: false,
  13 + infoList: [{}],
  14 + total_account: 0,
  15 + deductPick: ["30%", "100%"],
  16 + "donated_unit_code": "",
  17 + "donated_unit_name": "",
  18 + "donation_code": "",
  19 + "donation_year": "",
  20 + "donation_account": "",
  21 + "deduction_ratio": "", //扣除比例
  22 + "comment": "",
13 }, 23 },
14 24
15 /** 25 /**
16 * Lifecycle function--Called when page load 26 * Lifecycle function--Called when page load
17 */ 27 */
18 - onLoad: function (options) { 28 + onLoad: function(options) {
  29 + this.setData({
  30 + settlement_record_id: options.id
  31 + })
19 this.getInfoList() 32 this.getInfoList()
20 }, 33 },
21 34
22 /** 35 /**
23 * Lifecycle function--Called when page is initially rendered 36 * Lifecycle function--Called when page is initially rendered
24 */ 37 */
25 - onReady: function () { 38 + onReady: function() {
26 39
27 }, 40 },
28 41
29 - getInfoList: function () { 42 + getInfoList: function() {
30 var that = this 43 var that = this
31 this.Authorization = getApp().globalData.Authorization; 44 this.Authorization = getApp().globalData.Authorization;
32 wx.request({ 45 wx.request({
@@ -36,12 +49,21 @@ Page({ @@ -36,12 +49,21 @@ Page({
36 }, 49 },
37 data: { 50 data: {
38 "years": that.data.year, 51 "years": that.data.year,
  52 + "settlement_record_id": that.data.settlement_record_id
39 }, 53 },
40 - success: function (result) { 54 + success: function(result) {
41 console.log("infoList", result) 55 console.log("infoList", result)
42 if (result.statusCode == 200) { 56 if (result.statusCode == 200) {
43 that.setData({ 57 that.setData({
44 - infoList: result.data.items 58 + total_account: result.data.total_account,
  59 + infoList: result.data.items,
  60 + "donated_unit_code": "",
  61 + "donated_unit_name": "",
  62 + "donation_code": "",
  63 + "donation_year": "",
  64 + "donation_account": "",
  65 + "deduction_ratio": "", //扣除比例
  66 + "comment": "",
45 }) 67 })
46 } 68 }
47 }, 69 },
@@ -52,21 +74,135 @@ Page({ @@ -52,21 +74,135 @@ Page({
52 /** 74 /**
53 * Lifecycle function--Called when page show 75 * Lifecycle function--Called when page show
54 */ 76 */
55 - onShow: function () { 77 + onShow: function() {
56 78
57 }, 79 },
58 80
59 - addItem: function () {//继续添加  
60 - var info = this.data.infoList;  
61 - console.log(info);  
62 - info.push(this.data.infoList.length); 81 + getInputInfo:function(e){//
  82 + console.log("输入框", e.currentTarget.id,e.detail.value)
  83 + var key = e.currentTarget.id+""
  84 + if ("donated_unit_code"==key){
  85 + this.setData({"donated_unit_code": e.detail.value,})
  86 + }
  87 + if ("donated_unit_name" == key) {
  88 + this.setData({ "donated_unit_name": e.detail.value, })
  89 + }
  90 + if ("donation_code" == key) {
  91 + this.setData({ "donation_code": e.detail.value, })
  92 + }
  93 + if ("donation_year" == key) {
  94 + this.setData({ "donation_year": e.detail.value, })
  95 + }
  96 + if ("donation_account" == key) {
  97 + this.setData({ "donation_account": e.detail.value, })
  98 + }
  99 + if ("comment" == key) {
  100 + this.setData({ "comment": e.detail.value, })
  101 + }
  102 + },
  103 +
  104 + deductRatioPicker:function(e){//捐赠比例
  105 + console.log('picker,携带值为', e.detail.value)
  106 + var new_data = this.data.deductPick[e.detail.value]
63 this.setData({ 107 this.setData({
64 - infoList: info  
65 - }); 108 + deduction_ratio: new_data ? new_data.replace("%",""):""
  109 + })
66 }, 110 },
67 111
68 - goSubmit: function (e) {  
69 - console.log('form发生了submit事件,携带数据为:', e.detail.value) 112 + addItem: function() { //继续添加
  113 + if (!this.data.showAddView) {//是否新增了view
  114 + this.setData({
  115 + showAddView: true
  116 + })
  117 + return
  118 + }
  119 + if (!this.data.donated_unit_code || this.data.donated_unit_code.length < 1) {
  120 + this.showToast("请填写受赠单位纳税人识别号")
  121 + return
  122 + }
  123 + if (!this.data.donated_unit_name || this.data.donated_unit_name.length < 1) {
  124 + this.showToast("请填写受赠单位名称")
  125 + return
  126 + }
  127 + if (!this.data.donation_code || this.data.donation_code.length < 1) {
  128 + this.showToast("请填写捐赠凭证码")
  129 + return
  130 + }
  131 + if (!this.data.donation_year || this.data.donation_year.length < 1) {
  132 + this.showToast("请填写捐赠年度")
  133 + return
  134 + }
  135 + if (!this.data.donation_account || this.data.donation_account.length < 1) {
  136 + this.showToast("请填写扣除金额")
  137 + return
  138 + }
  139 + if (!this.data.deduction_ratio || this.data.deduction_ratio.length < 1) {
  140 + this.showToast("请选择扣除比例")
  141 + return
  142 + }
  143 + this.goSubmit("1")
  144 + },
  145 +
  146 + goSubmit: function(type) {//type=“1”,继续添加(当前页面),type=2保存,返回列表
  147 + if (!this.data.donated_unit_code || this.data.donated_unit_code.length < 1) {
  148 + this.showToast("请填写受赠单位纳税人识别号")
  149 + return
  150 + }
  151 + if (!this.data.donated_unit_name || this.data.donated_unit_name.length < 1) {
  152 + this.showToast("请填写受赠单位名称")
  153 + return
  154 + }
  155 + if (!this.data.donation_code || this.data.donation_code.length < 1) {
  156 + this.showToast("请填写捐赠凭证码")
  157 + return
  158 + }
  159 + if (!this.data.donation_year || this.data.donation_year.length < 1) {
  160 + this.showToast("请填写捐赠年度")
  161 + return
  162 + }
  163 + if (!this.data.donation_account || this.data.donation_account.length < 1) {
  164 + this.showToast("请填写扣除金额")
  165 + return
  166 + }
  167 + if (!this.data.deduction_ratio || this.data.deduction_ratio.length < 1) {
  168 + this.showToast("请选择扣除比例")
  169 + return
  170 + }
  171 + var that = this
  172 + this.Authorization = app.globalData.Authorization;
  173 + wx.request({
  174 + url: baseUrl + "payroll/v1/settlement-tax/donation-deduction",
  175 + header: {
  176 + 'Authorization': this.Authorization
  177 + },
  178 + method: "POST",
  179 + data: {
  180 + "years": that.data.year,
  181 + "settlement_record_id": that.data.settlement_record_id,
  182 + "donated_unit_code": that.data.donated_unit_code,
  183 + "donated_unit_name": that.data.donated_unit_name,
  184 + "donation_code": that.data.donation_code,
  185 + "donation_year": that.data.donation_year,
  186 + "donation_account": parseFloat(that.data.donation_account),
  187 + "deduction_ratio": parseFloat(that.data.deduction_ratio),
  188 + "comment":that.data.comment
  189 + },
  190 + success: function (result) {
  191 + console.log("infoList", result)
  192 + if (result.statusCode == 200) {
  193 + if (type == '1') {
  194 + that.getInfoList()
  195 + that.setData({
  196 + showAddView: true
  197 + })
  198 + } else {
  199 + wx.navigateBack({
  200 + delat: 1
  201 + })
  202 + }
  203 + }
  204 + },
  205 + })
70 }, 206 },
71 207
72 /** 208 /**
@@ -83,24 +219,34 @@ Page({ @@ -83,24 +219,34 @@ Page({
83 219
84 }, 220 },
85 221
  222 + showToast: function (data) {
  223 + if (data && data.length > 0) {
  224 + wx.showToast({
  225 + title: data,
  226 + icon: "none",
  227 + duration: 2000
  228 + })
  229 + }
  230 + },
  231 +
86 /** 232 /**
87 * Page event handler function--Called when user drop down 233 * Page event handler function--Called when user drop down
88 */ 234 */
89 - onPullDownRefresh: function () { 235 + onPullDownRefresh: function() {
90 236
91 }, 237 },
92 238
93 /** 239 /**
94 * Called when page reach bottom 240 * Called when page reach bottom
95 */ 241 */
96 - onReachBottom: function () { 242 + onReachBottom: function() {
97 243
98 }, 244 },
99 245
100 /** 246 /**
101 * Called when user click on the top right corner to share 247 * Called when user click on the top right corner to share
102 */ 248 */
103 - onShareAppMessage: function () { 249 + onShareAppMessage: function() {
104 250
105 } 251 }
106 }) 252 })
1 <view> 1 <view>
2 <view style="background:#fff;padding:0 30rpx;"> 2 <view style="background:#fff;padding:0 30rpx;">
3 <text class="text_gray7_34">准予扣除的捐赠额合计</text> 3 <text class="text_gray7_34">准予扣除的捐赠额合计</text>
4 - <text class="text_black3_34 float_right">{{300090}}</text> 4 + <text class="text_black3_34 float_right">{{total_account}}</text>
5 </view> 5 </view>
6 6
  7 + <!-- 列表数据,不可修改 -->
7 <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx"> 8 <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx">
8 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx;display: flex;"> 9 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx;display: flex;">
9 <view style="font-size: 32rpx;color: #777777;text-align: center;width:320rpx;display:flex;align-items: center;">受赠单位纳税人识别号(统一社会信用代码)</view> 10 <view style="font-size: 32rpx;color: #777777;text-align: center;width:320rpx;display:flex;align-items: center;">受赠单位纳税人识别号(统一社会信用代码)</view>
10 - <input style='text-align:right;color:#000;font-size: 30rpx;height:104rpx;width:366rpx' placeholder='请输入' name='name' maxlength="20" bindblur="" value="{{}}"></input> 11 + <input style='text-align:right;color:#000;font-size: 30rpx;height:104rpx;width:366rpx' disabled="true" value="{{item.donated_unit_code}}"></input>
11 </view> 12 </view>
12 <view class="divide_line_30"></view> 13 <view class="divide_line_30"></view>
13 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 14 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
14 <text class='red_star_right_10'>*</text> 15 <text class='red_star_right_10'>*</text>
15 <text class="text_gray7_34">受赠单位名称</text> 16 <text class="text_gray7_34">受赠单位名称</text>
16 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' bindblur="" value="{{}}"></input> 17 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.donated_unit_name}}"></input>
17 </view> 18 </view>
18 <view class="divide_line_30"></view> 19 <view class="divide_line_30"></view>
19 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 20 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
20 <text class="text_gray7_34">报捐赠凭证号</text> 21 <text class="text_gray7_34">报捐赠凭证号</text>
21 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' bindblur="" value="{{}}"></input> 22 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.donation_code}}"></input>
22 </view> 23 </view>
23 <view class="divide_line_30"></view> 24 <view class="divide_line_30"></view>
24 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 25 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
25 <text class='red_star_right_10'>*</text> 26 <text class='red_star_right_10'>*</text>
26 <text class="text_gray7_34">捐赠年度</text> 27 <text class="text_gray7_34">捐赠年度</text>
27 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' bindblur="" value="{{}}"></input> 28 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.donation_year}}"></input>
28 </view> 29 </view>
29 <view class="divide_line_30"></view> 30 <view class="divide_line_30"></view>
30 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 31 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
31 <text class='red_star_right_10'>*</text> 32 <text class='red_star_right_10'>*</text>
32 <text class="text_gray7_34">捐赠金额</text> 33 <text class="text_gray7_34">捐赠金额</text>
33 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input> 34 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.donation_account}}"></input>
34 </view> 35 </view>
35 <view class="divide_line_30"></view> 36 <view class="divide_line_30"></view>
36 - <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="" range="{{deductPick}}"> 37 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="" range="{{deductPick}}">
37 <text class='red_star_right_10'>*</text> 38 <text class='red_star_right_10'>*</text>
38 <text class="text_gray7_34">扣除比例</text> 39 <text class="text_gray7_34">扣除比例</text>
39 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image> 40 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
40 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' name='' value="{{}}"></input> 41 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.deduction_ratio}}%"></input>
  42 + </view>
  43 + <view class="divide_line_30"></view>
  44 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  45 + <text class="text_gray7_34">备注</text>
  46 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.comment}}"></input>
  47 + </view>
  48 + </view>
  49 +
  50 + <!-- 添加项,可编辑 -->
  51 + <view wx:if="{{showAddView}}" style="background:#fff;margin-top:20rpx">
  52 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx;display: flex;">
  53 + <view style="font-size: 32rpx;color: #777777;text-align: center;width:320rpx;display:flex;align-items: center;">受赠单位纳税人识别号(统一社会信用代码)</view>
  54 + <input style='text-align:right;color:#000;font-size: 30rpx;height:104rpx;width:366rpx' placeholder='请输入' id="donated_unit_code" maxlength="20" bindblur="getInputInfo" value="{{donated_unit_code}}"></input>
  55 + </view>
  56 + <view class="divide_line_30"></view>
  57 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  58 + <text class='red_star_right_10'>*</text>
  59 + <text class="text_gray7_34">受赠单位名称</text>
  60 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' id="donated_unit_name" bindblur="getInputInfo" value="{{donated_unit_name}}"></input>
  61 + </view>
  62 + <view class="divide_line_30"></view>
  63 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  64 + <text class="text_gray7_34">报捐赠凭证号</text>
  65 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' id="donation_code" bindblur="getInputInfo" value="{{donation_code}}"></input>
  66 + </view>
  67 + <view class="divide_line_30"></view>
  68 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  69 + <text class='red_star_right_10'>*</text>
  70 + <text class="text_gray7_34">捐赠年度</text>
  71 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' id="donation_year" type="number" bindblur="getInputInfo" maxlength="4" value="{{donation_year}}"></input>
  72 + </view>
  73 + <view class="divide_line_30"></view>
  74 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  75 + <text class='red_star_right_10'>*</text>
  76 + <text class="text_gray7_34">捐赠金额</text>
  77 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" id="donation_account" bindblur="getInputInfo" value="{{donation_account}}"></input>
  78 + </view>
  79 + <view class="divide_line_30"></view>
  80 + <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="selector" bindchange="deductRatioPicker" range="{{deductPick}}">
  81 + <text class='red_star_right_10'>*</text>
  82 + <text class="text_gray7_34">扣除比例</text>
  83 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  84 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' name='' value="{{deduction_ratio}}%"></input>
41 </picker> 85 </picker>
42 <view class="divide_line_30"></view> 86 <view class="divide_line_30"></view>
43 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 87 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
44 <text class="text_gray7_34">备注</text> 88 <text class="text_gray7_34">备注</text>
45 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' bindblur="" value="{{}}"></input> 89 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' id="comment" bindblur="getInputInfo" value="{{comment}}"></input>
46 </view> 90 </view>
47 </view> 91 </view>
48 92
@@ -6,9 +6,11 @@ Page({ @@ -6,9 +6,11 @@ Page({
6 * Page initial data 6 * Page initial data
7 */ 7 */
8 data: { 8 data: {
  9 + settlement_record_id: "",
9 year: "2019", 10 year: "2019",
10 showAddView:false, 11 showAddView:false,
11 infoList: [{}], 12 infoList: [{}],
  13 + total_account: 0,
12 project: ["正常工资薪金", "劳务报酬", "稿酬", "特许经营权使用费"], 14 project: ["正常工资薪金", "劳务报酬", "稿酬", "特许经营权使用费"],
13 deductcontent: ["高级专家延长离退休期间工薪免征个人所得税", "解除劳动合同当地工资3倍以内免税", "符合条件的津补贴免征个人所得税", "生育津贴和生育医疗费免税", "工伤保险免税", "符合条件的外交人员免征个人所得税", "外籍个人出差补贴免税", "外籍个人探亲费、语言训练费、子女教育费免税", "外籍个人生活费用免税", "符合条件的外籍来华专家工资薪金所得免征个人所得税", "薪金所得免征个人所得数", "横琴、香港、澳门居民免税", "平潭台湾居民免税", "安家费、退职费、退休工资、离休工资、离休生活补助费免税"], 15 deductcontent: ["高级专家延长离退休期间工薪免征个人所得税", "解除劳动合同当地工资3倍以内免税", "符合条件的津补贴免征个人所得税", "生育津贴和生育医疗费免税", "工伤保险免税", "符合条件的外交人员免征个人所得税", "外籍个人出差补贴免税", "外籍个人探亲费、语言训练费、子女教育费免税", "外籍个人生活费用免税", "符合条件的外籍来华专家工资薪金所得免征个人所得税", "薪金所得免征个人所得数", "横琴、香港、澳门居民免税", "平潭台湾居民免税", "安家费、退职费、退休工资、离休工资、离休生活补助费免税"],
14 deductproperty: ["其他"], 16 deductproperty: ["其他"],
@@ -22,6 +24,9 @@ Page({ @@ -22,6 +24,9 @@ Page({
22 * Lifecycle function--Called when page load 24 * Lifecycle function--Called when page load
23 */ 25 */
24 onLoad: function(options) { 26 onLoad: function(options) {
  27 + this.setData({
  28 + settlement_record_id: options.id
  29 + })
25 this.getInfoList() 30 this.getInfoList()
26 }, 31 },
27 32
@@ -42,11 +47,13 @@ Page({ @@ -42,11 +47,13 @@ Page({
42 }, 47 },
43 data: { 48 data: {
44 "years": that.data.year, 49 "years": that.data.year,
  50 + "settlement_record_id": that.data.settlement_record_id
45 }, 51 },
46 success: function(result) { 52 success: function(result) {
47 console.log("infoList", result) 53 console.log("infoList", result)
48 if (result.statusCode == 200) { 54 if (result.statusCode == 200) {
49 that.setData({ 55 that.setData({
  56 + total_account: result.data.total_account,
50 infoList: result.data.items, 57 infoList: result.data.items,
51 income_item: "", 58 income_item: "",
52 reduction_item: "", 59 reduction_item: "",
@@ -150,6 +157,7 @@ Page({ @@ -150,6 +157,7 @@ Page({
150 method: "POST", 157 method: "POST",
151 data: { 158 data: {
152 "years": that.data.year, 159 "years": that.data.year,
  160 + "settlement_record_id": that.data.settlement_record_id,
153 "income_item": that.data.income_item, 161 "income_item": that.data.income_item,
154 "reduction_item": that.data.reduction_item, 162 "reduction_item": that.data.reduction_item,
155 "reduction_nature": that.data.reduction_nature, 163 "reduction_nature": that.data.reduction_nature,
1 <view> 1 <view>
2 <view style="background:#fff;padding:0 30rpx;"> 2 <view style="background:#fff;padding:0 30rpx;">
3 <text class="text_gray7_34">免税收入合计</text> 3 <text class="text_gray7_34">免税收入合计</text>
4 - <text class="text_black3_34 float_right">{{3000}}</text> 4 + <text class="text_black3_34 float_right">{{total_account}}</text>
5 </view> 5 </view>
6 6
7 <!-- 列表数据,不可修改 --> 7 <!-- 列表数据,不可修改 -->
@@ -7,6 +7,7 @@ Page({ @@ -7,6 +7,7 @@ Page({
7 * Page initial data 7 * Page initial data
8 */ 8 */
9 data: { 9 data: {
  10 + settlement_record_id:"",
10 currentTab:1, 11 currentTab:1,
11 year:"2019", 12 year:"2019",
12 incomeInfo:{}, 13 incomeInfo:{},
@@ -63,6 +64,7 @@ Page({ @@ -63,6 +64,7 @@ Page({
63 console.log("incomeInfo", result) 64 console.log("incomeInfo", result)
64 if (result.statusCode == 200) { 65 if (result.statusCode == 200) {
65 that.setData({ 66 that.setData({
  67 + settlement_record_id:result.data.id,
66 incomeInfo:result.data.item 68 incomeInfo:result.data.item
67 }) 69 })
68 } 70 }
@@ -73,28 +75,28 @@ Page({ @@ -73,28 +75,28 @@ Page({
73 // 免税收入附表 75 // 免税收入附表
74 freeIncomeDetail: function () { 76 freeIncomeDetail: function () {
75 wx.navigateTo({ 77 wx.navigateTo({
76 - url: '../freeIncomeDetail/freeIncomeDetail', 78 + url: '../freeIncomeDetail/freeIncomeDetail?id=' + this.data.settlement_record_id,
77 }) 79 })
78 }, 80 },
79 81
80 // 其他扣除附表 82 // 其他扣除附表
81 otherDeductDetail:function(){ 83 otherDeductDetail:function(){
82 wx.navigateTo({ 84 wx.navigateTo({
83 - url: '../otherDeductDetail/otherDeductDetail', 85 + url: '../otherDeductDetail/otherDeductDetail?id=' + this.data.settlement_record_id + "&health_account=" + this.data.incomeInfo.commercial_insurance + "&endowment_account=" + this.data.incomeInfo.tax_extension,
84 }) 86 })
85 }, 87 },
86 88
87 // 捐赠明细 89 // 捐赠明细
88 donationDetail:function(){ 90 donationDetail:function(){
89 wx.navigateTo({ 91 wx.navigateTo({
90 - url: '../donationDetail/donationDetail', 92 + url: '../donationDetail/donationDetail?id=' + this.data.settlement_record_id,
91 }) 93 })
92 }, 94 },
93 95
94 // 减免/已缴纳税额明细 96 // 减免/已缴纳税额明细
95 deductOrPayedDetail:function(){ 97 deductOrPayedDetail:function(){
96 wx.navigateTo({ 98 wx.navigateTo({
97 - url: '../deductOrPayedDetail/deductOrPayedDetail', 99 + url: '../deductOrPayedDetail/deductOrPayedDetail?id=' + this.data.settlement_record_id,
98 }) 100 })
99 }, 101 },
100 102
1 // pages/main/finalpay/otherDeductDetail/endowmentInsurDetail.js 1 // pages/main/finalpay/otherDeductDetail/endowmentInsurDetail.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 /**
7 * Page initial data 8 * Page initial data
8 */ 9 */
9 data: { 10 data: {
  11 + settlement_record_id: "",
10 year: "2019", 12 year: "2019",
11 infoList: [{}], 13 infoList: [{}],
  14 + total_account:0,
  15 + showAddView: false,
  16 + option_start_date: "",
  17 + option_end_date: "",
  18 +
  19 + "tax_extension_account": "",
  20 + "option_start_time": "", //申报扣除月份起,
  21 + "option_end_time": "", //申报扣除月份止,
  22 + "tax_check_code": "",
  23 + "year_premium": "", //年度保费,
  24 + "month_premium": "", //月度保费
  25 + "year_deduction": "", //本年扣除金额
12 }, 26 },
13 27
14 /** 28 /**
15 * Lifecycle function--Called when page load 29 * Lifecycle function--Called when page load
16 */ 30 */
17 - onLoad: function (options) { 31 + onLoad: function(options) {
  32 + this.setData({
  33 + settlement_record_id: options.id
  34 + })
18 this.getInfoList() 35 this.getInfoList()
19 }, 36 },
20 37
21 /** 38 /**
22 * Lifecycle function--Called when page is initially rendered 39 * Lifecycle function--Called when page is initially rendered
23 */ 40 */
24 - onReady: function () { 41 + onReady: function() {
25 42
26 }, 43 },
27 44
28 - getInfoList: function () { 45 + getInfoList: function() {
29 var that = this 46 var that = this
30 this.Authorization = getApp().globalData.Authorization; 47 this.Authorization = getApp().globalData.Authorization;
31 wx.request({ 48 wx.request({
@@ -35,70 +52,240 @@ Page({ @@ -35,70 +52,240 @@ Page({
35 }, 52 },
36 data: { 53 data: {
37 "years": that.data.year, 54 "years": that.data.year,
  55 + "settlement_record_id": that.data.settlement_record_id
38 }, 56 },
39 - success: function (result) { 57 + success: function(result) {
40 console.log("infoList", result) 58 console.log("infoList", result)
41 if (result.statusCode == 200) { 59 if (result.statusCode == 200) {
42 that.setData({ 60 that.setData({
43 - infoList: result.data.items 61 + total_account: result.data.total_account,
  62 + infoList: that.handleData(result.data.items),
  63 +
  64 + option_start_date: "",
  65 + option_end_date: "",
  66 + "tax_extension_account": "",
  67 + "option_start_time": "", //申报扣除月份起,
  68 + "option_end_time": "", //申报扣除月份止,
  69 + "tax_check_code": "",
  70 + "year_premium": "", //年度保费,
  71 + "month_premium": "", //月度保费
  72 + "year_deduction": "", //本年扣除金额
44 }) 73 })
45 } 74 }
46 }, 75 },
47 }) 76 })
48 }, 77 },
49 78
  79 + handleData: function(items) { //解析列表数据时间戳
  80 + for (var i = 0; i < items.length; i++) {
  81 + if (items[i].option_start_time && items[i].option_start_time > 1000) {
  82 + items[i].option_start_time = format.formatTime_date(items[i].option_start_time)
  83 + } else {
  84 + items[i].option_start_time = ""
  85 + }
  86 + if (items[i].option_end_time && items[i].option_end_time > 1000) {
  87 + items[i].option_end_time = format.formatTime_date(items[i].option_end_time)
  88 + } else {
  89 + items[i].option_end_time = ""
  90 + }
  91 + }
  92 + return items
  93 + },
  94 +
  95 + bindDatePicker: function(e) { //时间选择
  96 + var datelong = Date.parse(new Date(e.detail.value)) / 1000
  97 + console.log("picker", e)
  98 + if ("option_start_time" == e.currentTarget.id) {
  99 + this.setData({
  100 + option_start_date: e.detail.value,
  101 + option_start_time: datelong
  102 + })
  103 + } else if ("option_end_time" == e.currentTarget.id) {
  104 + this.setData({
  105 + option_end_date: e.detail.value,
  106 + option_end_time: datelong
  107 + })
  108 + }
  109 +
  110 + },
  111 +
  112 + getInputInfo: function(e) { //
  113 + console.log("输入框", e.currentTarget.id, e.detail.value)
  114 + var key = e.currentTarget.id + ""
  115 + if ("tax_extension_account" == key) {
  116 + this.setData({
  117 + "tax_extension_account": e.detail.value,
  118 + })
  119 + }
  120 + if ("tax_check_code" == key) {
  121 + this.setData({
  122 + "tax_check_code": e.detail.value,
  123 + })
  124 + }
  125 + if ("year_premium" == key) {
  126 + this.setData({
  127 + "year_premium": e.detail.value,
  128 + })
  129 + }
  130 + if ("month_premium" == key) {
  131 + this.setData({
  132 + "month_premium": e.detail.value,
  133 + })
  134 + }
  135 + if ("year_deduction" == key) {
  136 + this.setData({
  137 + "year_deduction": e.detail.value,
  138 + })
  139 + }
  140 + },
  141 +
50 /** 142 /**
51 * Lifecycle function--Called when page show 143 * Lifecycle function--Called when page show
52 */ 144 */
53 - onShow: function () { 145 + onShow: function() {
54 146
55 }, 147 },
56 148
57 - addItem: function () {//继续添加  
58 - var info = this.data.infoList;  
59 - console.log(info);  
60 - info.push(this.data.infoList.length);  
61 - this.setData({  
62 - infoList: info  
63 - }); 149 + addItem: function() { //继续添加
  150 + if (!this.data.showAddView) { //是否新增了view
  151 + this.setData({
  152 + showAddView: true
  153 + })
  154 + return
  155 + }
  156 + if (!this.data.tax_extension_account || this.data.tax_extension_account.length < 1) {
  157 + this.showToast("请填写税延养老账号编号")
  158 + return
  159 + }
  160 + if (!this.data.option_start_time || this.data.option_start_time.length < 1000 || !this.data.option_end_time || this.data.option_end_time.length < 1000) {
  161 + this.showToast("请选择申报扣除起止月")
  162 + return
  163 + }
  164 + if (!this.data.tax_check_code || this.data.tax_check_code.length < 1) {
  165 + this.showToast("请填写报税校验码")
  166 + return
  167 + }
  168 + if (!this.data.year_premium || this.data.year_premium.length < 1) {
  169 + this.showToast("请填写年度保费")
  170 + return
  171 + }
  172 + if (!this.data.month_premium || this.data.month_premium.length < 1) {
  173 + this.showToast("请填写月度保费")
  174 + return
  175 + }
  176 + if (!this.data.year_deduction || this.data.year_deduction.length < 1) {
  177 + this.showToast("请填写本年扣除金额")
  178 + return
  179 + }
  180 + this.goSubmit("1")
64 }, 181 },
65 182
66 - goSubmit: function (e) {  
67 - console.log('form发生了submit事件,携带数据为:', e.detail.value) 183 + goSubmit: function(type) {
  184 + if (!this.data.tax_extension_account || this.data.tax_extension_account.length < 1) {
  185 + this.showToast("请填写税延养老账号编号")
  186 + return
  187 + }
  188 + if (!this.data.option_start_time || this.data.option_start_time.length < 1000 || !this.data.option_end_time || this.data.option_end_time.length < 1000) {
  189 + this.showToast("请选择申报扣除起止月")
  190 + return
  191 + }
  192 + if (!this.data.tax_check_code || this.data.tax_check_code.length < 1) {
  193 + this.showToast("请填写报税校验码")
  194 + return
  195 + }
  196 + if (!this.data.year_premium || this.data.year_premium.length < 1) {
  197 + this.showToast("请填写年度保费")
  198 + return
  199 + }
  200 + if (!this.data.month_premium || this.data.month_premium.length < 1) {
  201 + this.showToast("请填写月度保费")
  202 + return
  203 + }
  204 + if (!this.data.year_deduction || this.data.year_deduction.length < 1) {
  205 + this.showToast("请填写本年扣除金额")
  206 + return
  207 + }
  208 +
  209 + var that = this
  210 + this.Authorization = app.globalData.Authorization;
  211 + wx.request({
  212 + url: baseUrl + "payroll/v1/settlement-tax/tax-extension",
  213 + header: {
  214 + 'Authorization': this.Authorization
  215 + },
  216 + method: "POST",
  217 + data: {
  218 + "years": that.data.year,
  219 + "settlement_record_id": that.data.settlement_record_id,
  220 + "tax_extension_account": that.data.tax_extension_account,
  221 + "option_start_time": that.data.option_start_time, //申报扣除月份起,
  222 + "option_end_time": that.data.option_end_time, //申报扣除月份止,
  223 + "tax_check_code": that.data.tax_check_code,
  224 + "year_premium": parseFloat(that.data.year_premium), //年度保费,
  225 + "month_premium": parseFloat(that.data.month_premium), //月度保费
  226 + "year_deduction": parseFloat(that.data.year_deduction), //本年扣除金额
  227 + },
  228 + success: function(result) {
  229 + console.log("infoList", result)
  230 + if (result.statusCode == 200) {
  231 + if (type == '1') {
  232 + that.getInfoList()
  233 + that.setData({
  234 + showAddView: true
  235 + })
  236 + } else {
  237 + wx.navigateBack({
  238 + delta: 2
  239 + })
  240 + }
  241 + }
  242 + }
  243 + })
68 }, 244 },
69 245
70 /** 246 /**
71 * Lifecycle function--Called when page hide 247 * Lifecycle function--Called when page hide
72 */ 248 */
73 - onHide: function () { 249 + onHide: function() {
74 250
75 }, 251 },
76 252
77 /** 253 /**
78 * Lifecycle function--Called when page unload 254 * Lifecycle function--Called when page unload
79 */ 255 */
80 - onUnload: function () { 256 + onUnload: function() {
81 257
82 }, 258 },
83 259
  260 + showToast: function(data) {
  261 + if (data && data.length > 0) {
  262 + wx.showToast({
  263 + title: data,
  264 + icon: "none",
  265 + duration: 2000
  266 + })
  267 + }
  268 + },
  269 +
  270 +
84 /** 271 /**
85 * Page event handler function--Called when user drop down 272 * Page event handler function--Called when user drop down
86 */ 273 */
87 - onPullDownRefresh: function () { 274 + onPullDownRefresh: function() {
88 275
89 }, 276 },
90 277
91 /** 278 /**
92 * Called when page reach bottom 279 * Called when page reach bottom
93 */ 280 */
94 - onReachBottom: function () { 281 + onReachBottom: function() {
95 282
96 }, 283 },
97 284
98 /** 285 /**
99 * Called when user click on the top right corner to share 286 * Called when user click on the top right corner to share
100 */ 287 */
101 - onShareAppMessage: function () { 288 + onShareAppMessage: function() {
102 289
103 } 290 }
104 }) 291 })
@@ -2,50 +2,96 @@ @@ -2,50 +2,96 @@
2 <view> 2 <view>
3 <view style="background:#fff;padding:0 30rpx;"> 3 <view style="background:#fff;padding:0 30rpx;">
4 <text class="text_gray7_34">税延养老保险合计</text> 4 <text class="text_gray7_34">税延养老保险合计</text>
5 - <text class="text_black3_34 float_right">{{3000}}</text> 5 + <text class="text_black3_34 float_right">{{total_account}}</text>
6 </view> 6 </view>
7 7
  8 + <!-- 列表数据,不可修改 -->
8 <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx"> 9 <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx">
9 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 10 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
10 <text class='red_star_right_10'>*</text> 11 <text class='red_star_right_10'>*</text>
11 <text class="text_gray7_34">税延养老账号编号</text> 12 <text class="text_gray7_34">税延养老账号编号</text>
12 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' bindblur="bindIncome" value="{{}}"></input> 13 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.tax_extension_account}}"></input>
13 </view> 14 </view>
14 <view class="divide_line_30"></view> 15 <view class="divide_line_30"></view>
15 - <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDeductContent"> 16 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDeductContent">
16 <text class='red_star_right_10'>*</text> 17 <text class='red_star_right_10'>*</text>
17 <text class="text_gray7_34">申报扣除期起</text> 18 <text class="text_gray7_34">申报扣除期起</text>
18 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image> 19 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
19 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' name='' value="{{}}"></input> 20 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.option_start_time}}"></input>
  21 + </view>
  22 + <view class="divide_line_30"></view>
  23 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDeductContent">
  24 + <text class='red_star_right_10'>*</text>
  25 + <text class="text_gray7_34">申报扣除期止</text>
  26 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  27 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.option_end_time}}"></input>
  28 + </view>
  29 + <view class="divide_line_30"></view>
  30 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  31 + <text class='red_star_right_10'>*</text>
  32 + <text class="text_gray7_34">报税校验码</text>
  33 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.tax_check_code}}"></input>
  34 + </view>
  35 + <view class="divide_line_30"></view>
  36 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  37 + <text class="text_gray7_34">年度保费</text>
  38 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.year_premium}}"></input>
  39 + </view>
  40 + <view class="divide_line_30"></view>
  41 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  42 + <text class="text_gray7_34">月度保费</text>
  43 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.month_premium}}"></input>
  44 + </view>
  45 + <view class="divide_line_30"></view>
  46 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  47 + <text class='red_star_right_10'>*</text>
  48 + <text class="text_gray7_34">本年扣除金额</text>
  49 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.year_deduction}}"></input>
  50 + </view>
  51 + </view>
  52 +
  53 + <!-- 添加项,可编辑 -->
  54 + <view wx:if="{{showAddView}}" style="background:#fff;margin-top:20rpx">
  55 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  56 + <text class='red_star_right_10'>*</text>
  57 + <text class="text_gray7_34">税延养老账号编号</text>
  58 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' id="tax_extension_account" bindblur="getInputInfo" value="{{tax_extension_account}}"></input>
  59 + </view>
  60 + <view class="divide_line_30"></view>
  61 + <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDatePicker" id="option_start_time">
  62 + <text class='red_star_right_10'>*</text>
  63 + <text class="text_gray7_34">申报扣除期起</text>
  64 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  65 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' value="{{option_start_date}}"></input>
20 </picker> 66 </picker>
21 <view class="divide_line_30"></view> 67 <view class="divide_line_30"></view>
22 - <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDeductContent"> 68 + <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDatePicker" id="option_end_time">
23 <text class='red_star_right_10'>*</text> 69 <text class='red_star_right_10'>*</text>
24 <text class="text_gray7_34">申报扣除期止</text> 70 <text class="text_gray7_34">申报扣除期止</text>
25 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image> 71 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
26 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' name='' value="{{}}"></input> 72 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' value="{{option_end_date}}"></input>
27 </picker> 73 </picker>
28 <view class="divide_line_30"></view> 74 <view class="divide_line_30"></view>
29 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 75 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
30 <text class='red_star_right_10'>*</text> 76 <text class='red_star_right_10'>*</text>
31 <text class="text_gray7_34">报税校验码</text> 77 <text class="text_gray7_34">报税校验码</text>
32 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' bindblur="bindIncome" value="{{}}"></input> 78 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' id="tax_check_code" bindblur="getInputInfo" value="{{tax_check_code}}"></input>
33 </view> 79 </view>
34 <view class="divide_line_30"></view> 80 <view class="divide_line_30"></view>
35 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 81 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
36 <text class="text_gray7_34">年度保费</text> 82 <text class="text_gray7_34">年度保费</text>
37 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input> 83 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" id="year_premium" bindblur="getInputInfo" value="{{year_premium}}"></input>
38 </view> 84 </view>
39 <view class="divide_line_30"></view> 85 <view class="divide_line_30"></view>
40 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 86 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
41 <text class="text_gray7_34">月度保费</text> 87 <text class="text_gray7_34">月度保费</text>
42 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input> 88 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" id="month_premium" bindblur="getInputInfo" value="{{month_premium}}"></input>
43 </view> 89 </view>
44 <view class="divide_line_30"></view> 90 <view class="divide_line_30"></view>
45 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 91 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
46 <text class='red_star_right_10'>*</text> 92 <text class='red_star_right_10'>*</text>
47 <text class="text_gray7_34">本年扣除金额</text> 93 <text class="text_gray7_34">本年扣除金额</text>
48 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input> 94 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" id="year_deduction" bindblur="getInputInfo" value="{{year_deduction}}"></input>
49 </view> 95 </view>
50 </view> 96 </view>
51 97
1 // pages/main/finalpay/otherDeductDetail/healthInsurDetail.js 1 // pages/main/finalpay/otherDeductDetail/healthInsurDetail.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 /**
7 * Page initial data 8 * Page initial data
8 */ 9 */
9 data: { 10 data: {
  11 + settlement_record_id:"",
10 year: "2019", 12 year: "2019",
  13 + showAddView: false,
11 infoList: [{}], 14 infoList: [{}],
  15 + total_account:0,
  16 + effect_date:"",
  17 +
  18 + "tax_code": "",
  19 + "date_policy": "", //保单生效日期,
  20 + "year_premium": "", //年度保费
  21 + "month_premium": "", //月度保费
  22 + "year_deduction": "", //本年扣除金额
12 }, 23 },
13 24
14 /** 25 /**
15 * Lifecycle function--Called when page load 26 * Lifecycle function--Called when page load
16 */ 27 */
17 - onLoad: function (options) { 28 + onLoad: function(options) {
  29 + this.setData({
  30 + settlement_record_id: options.id
  31 + })
18 this.getInfoList() 32 this.getInfoList()
19 }, 33 },
20 34
21 /** 35 /**
22 * Lifecycle function--Called when page is initially rendered 36 * Lifecycle function--Called when page is initially rendered
23 */ 37 */
24 - onReady: function () { 38 + onReady: function() {
25 39
26 }, 40 },
27 41
28 - getInfoList: function () { 42 + getInfoList: function() {
29 var that = this 43 var that = this
30 this.Authorization = getApp().globalData.Authorization; 44 this.Authorization = getApp().globalData.Authorization;
31 wx.request({ 45 wx.request({
@@ -35,71 +49,205 @@ Page({ @@ -35,71 +49,205 @@ Page({
35 }, 49 },
36 data: { 50 data: {
37 "years": that.data.year, 51 "years": that.data.year,
  52 + "settlement_record_id": that.data.settlement_record_id
38 }, 53 },
39 - success: function (result) { 54 + success: function(result) {
40 console.log("infoList", result) 55 console.log("infoList", result)
41 if (result.statusCode == 200) { 56 if (result.statusCode == 200) {
42 that.setData({ 57 that.setData({
43 - infoList: result.data.items 58 + total_account: result.data.total_account,
  59 + infoList: that.handleData(result.data.items) ,
  60 + "tax_code": "",
  61 + "date_policy": "",
  62 + "year_premium": "",
  63 + "month_premium": "",
  64 + "year_deduction": "",
44 }) 65 })
45 } 66 }
46 }, 67 },
47 }) 68 })
48 }, 69 },
49 70
  71 + handleData: function (items){
  72 + for (var i = 0; i < items.length; i++) {
  73 + if (items[i].date_policy && items[i].date_policy>1000){
  74 + items[i].date_policy = format.formatTime_date(items[i].date_policy)
  75 + }else{
  76 + items[i].date_policy = ""
  77 + }
  78 + }
  79 + return items
  80 + },
50 81
51 /** 82 /**
52 * Lifecycle function--Called when page show 83 * Lifecycle function--Called when page show
53 */ 84 */
54 - onShow: function () { 85 + onShow: function() {
55 86
56 }, 87 },
57 88
58 - addItem: function () {//继续添加  
59 - var info = this.data.infoList;  
60 - console.log(info);  
61 - info.push(this.data.infoList.length); 89 + getInputInfo: function(e) { //
  90 + console.log("输入框", e.currentTarget.id, e.detail.value)
  91 + var key = e.currentTarget.id + ""
  92 + if ("tax_code" == key) {
  93 + this.setData({
  94 + "tax_code": e.detail.value,
  95 + })
  96 + }
  97 + if ("year_premium" == key) {
  98 + this.setData({
  99 + "year_premium": e.detail.value,
  100 + })
  101 + }
  102 + if ("month_premium" == key) {
  103 + this.setData({
  104 + "month_premium": e.detail.value,
  105 + })
  106 + }
  107 + if ("year_deduction" == key) {
  108 + this.setData({
  109 + "year_deduction": e.detail.value,
  110 + })
  111 + }
  112 + },
  113 +
  114 + datePolicyPicker: function(e) {
  115 + var datelong = Date.parse(new Date(e.detail.value)) / 1000
  116 + console.log("日期", e.detail.value, datelong)
62 this.setData({ 117 this.setData({
63 - infoList: info  
64 - }); 118 + effect_date: e.detail.value,
  119 + date_policy: datelong
  120 + })
65 }, 121 },
66 122
67 - goSubmit: function (e) {  
68 - console.log('form发生了submit事件,携带数据为:', e.detail.value) 123 + addItem: function() { //继续添加
  124 + if (!this.data.showAddView) {//是否新增了view
  125 + this.setData({
  126 + showAddView: true
  127 + })
  128 + return
  129 + }
  130 + if (!this.data.tax_code || this.data.tax_code.length < 1) {
  131 + this.showToast("请填写税优识别码")
  132 + return
  133 + }
  134 + if (!this.data.date_policy || this.data.date_policy.length < 1000) {
  135 + this.showToast("请选择保单生效日期")
  136 + return
  137 + }
  138 + if (!this.data.year_premium || this.data.year_premium.length < 1) {
  139 + this.showToast("请填写年度保费")
  140 + return
  141 + }
  142 + if (!this.data.month_premium || this.data.month_premium.length < 1) {
  143 + this.showToast("请填写月度保费")
  144 + return
  145 + }
  146 + if (!this.data.year_deduction || this.data.year_deduction.length < 1) {
  147 + this.showToast("请填写本年扣除金额")
  148 + return
  149 + }
  150 + this.goSubmit("1")
  151 + },
  152 +
  153 + goSubmit: function (type) {//type=“1”,继续添加(当前页面),type=2保存,返回列表
  154 + if (!this.data.tax_code || this.data.tax_code.length < 1) {
  155 + this.showToast("请填写税优识别码")
  156 + return
  157 + }
  158 + if (!this.data.date_policy || this.data.date_policy.length < 1000) {
  159 + this.showToast("请选择保单生效日期")
  160 + return
  161 + }
  162 + if (!this.data.year_premium || this.data.year_premium.length < 1) {
  163 + this.showToast("请填写年度保费")
  164 + return
  165 + }
  166 + if (!this.data.month_premium || this.data.month_premium.length < 1) {
  167 + this.showToast("请填写月度保费")
  168 + return
  169 + }
  170 + if (!this.data.year_deduction || this.data.year_deduction.length < 1) {
  171 + this.showToast("请填写本年扣除金额")
  172 + return
  173 + }
  174 + var that = this
  175 + this.Authorization = app.globalData.Authorization;
  176 + wx.request({
  177 + url: baseUrl + "payroll/v1/settlement-tax/commercial-insurance-tax",
  178 + header: {
  179 + 'Authorization': this.Authorization
  180 + },
  181 + method: "POST",
  182 + data: {
  183 + "years": that.data.year,
  184 + "settlement_record_id": that.data.settlement_record_id,
  185 + "tax_code": that.data.tax_code,
  186 + "date_policy": that.data.date_policy , //保单生效日期,
  187 + "year_premium": parseFloat(that.data.year_premium) ,//年度保费,
  188 + "month_premium": parseFloat(that.data.month_premium), //月度保费
  189 + "year_deduction": parseFloat(that.data.year_deduction), //本年扣除金额
  190 + },
  191 + success: function (result) {
  192 + console.log("infoList", result)
  193 + if (result.statusCode == 200) {
  194 + if (type == '1') {
  195 + that.getInfoList()
  196 + that.setData({
  197 + showAddView: true
  198 + })
  199 + } else {
  200 + wx.navigateBack({
  201 + delta: 2
  202 + })
  203 + }
  204 + }
  205 + },
  206 + })
69 }, 207 },
70 208
71 /** 209 /**
72 * Lifecycle function--Called when page hide 210 * Lifecycle function--Called when page hide
73 */ 211 */
74 - onHide: function () { 212 + onHide: function() {
75 213
76 }, 214 },
77 215
78 /** 216 /**
79 * Lifecycle function--Called when page unload 217 * Lifecycle function--Called when page unload
80 */ 218 */
81 - onUnload: function () { 219 + onUnload: function() {
  220 +
  221 + },
82 222
  223 + showToast: function (data) {
  224 + if (data && data.length > 0) {
  225 + wx.showToast({
  226 + title: data,
  227 + icon: "none",
  228 + duration: 2000
  229 + })
  230 + }
83 }, 231 },
84 232
85 /** 233 /**
86 * Page event handler function--Called when user drop down 234 * Page event handler function--Called when user drop down
87 */ 235 */
88 - onPullDownRefresh: function () { 236 + onPullDownRefresh: function() {
89 237
90 }, 238 },
91 239
92 /** 240 /**
93 * Called when page reach bottom 241 * Called when page reach bottom
94 */ 242 */
95 - onReachBottom: function () { 243 + onReachBottom: function() {
96 244
97 }, 245 },
98 246
99 /** 247 /**
100 * Called when user click on the top right corner to share 248 * Called when user click on the top right corner to share
101 */ 249 */
102 - onShareAppMessage: function () { 250 + onShareAppMessage: function() {
103 251
104 } 252 }
105 }) 253 })
1 <view> 1 <view>
2 <view style="background:#fff;padding:0 30rpx;"> 2 <view style="background:#fff;padding:0 30rpx;">
3 <text class="text_gray7_34">商业健康保险合计</text> 3 <text class="text_gray7_34">商业健康保险合计</text>
4 - <text class="text_black3_34 float_right">{{3000}}</text> 4 + <text class="text_black3_34 float_right">{{total_account}}</text>
5 </view> 5 </view>
6 6
  7 + <!-- 列表数据,不可修改 -->
7 <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx"> 8 <view wx:for="{{infoList}}" style="background:#fff;margin-top:20rpx">
8 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 9 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
9 <text class='red_star_right_10'>*</text> 10 <text class='red_star_right_10'>*</text>
10 <text class="text_gray7_34">税优识别码</text> 11 <text class="text_gray7_34">税优识别码</text>
11 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' bindblur="bindIncome" value="{{}}"></input> 12 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.tax_code}}"></input>
12 </view> 13 </view>
13 <view class="divide_line_30"></view> 14 <view class="divide_line_30"></view>
14 <view class="divide_line_30"></view> 15 <view class="divide_line_30"></view>
15 - <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDeductContent"> 16 + <view style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="bindDeductContent">
16 <text class='red_star_right_10'>*</text> 17 <text class='red_star_right_10'>*</text>
17 <text class="text_gray7_34">保单生效日期</text> 18 <text class="text_gray7_34">保单生效日期</text>
18 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image> 19 <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
19 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' name='' value="{{}}"></input> 20 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.date_policy}}"></input>
  21 + </view>
  22 + <view class="divide_line_30"></view>
  23 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  24 + <text class="text_gray7_34">年度保费</text>
  25 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.year_premium}}"></input>
  26 + </view>
  27 + <view class="divide_line_30"></view>
  28 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  29 + <text class="text_gray7_34">月度保费</text>
  30 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true" value="{{item.month_premium}}"></input>
  31 + </view>
  32 + <view class="divide_line_30"></view>
  33 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  34 + <text class='red_star_right_10'>*</text>
  35 + <text class="text_gray7_34">本年扣除金额</text>
  36 + <input class='input_wrap' style='text-align: right;color:#000;' disabled="true"value="{{item.year_deduction}}"></input>
  37 + </view>
  38 + </view>
  39 +
  40 + <!-- 添加项,可编辑 -->
  41 + <view wx:if="{{showAddView}}" style="background:#fff;margin-top:20rpx">
  42 + <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
  43 + <text class='red_star_right_10'>*</text>
  44 + <text class="text_gray7_34">税优识别码</text>
  45 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' id="tax_code" bindblur="getInputInfo" value="{{tax_code}}"></input>
  46 + </view>
  47 + <view class="divide_line_30"></view>
  48 + <view class="divide_line_30"></view>
  49 + <picker style="height:104rpx;padding-left: 30rpx;background-color:#fff" mode="date" bindchange="datePolicyPicker">
  50 + <text class='red_star_right_10'>*</text>
  51 + <text class="text_gray7_34">保单生效日期</text>
  52 + <image class='arrow_wrap float_right' src='/images/arrow_right.png'></image>
  53 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请选择' value="{{effect_date}}"></input>
20 </picker> 54 </picker>
21 <view class="divide_line_30"></view> 55 <view class="divide_line_30"></view>
22 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 56 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
23 <text class="text_gray7_34">年度保费</text> 57 <text class="text_gray7_34">年度保费</text>
24 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input> 58 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" id="year_premium" bindblur="getInputInfo" value="{{year_premium}}"></input>
25 </view> 59 </view>
26 <view class="divide_line_30"></view> 60 <view class="divide_line_30"></view>
27 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 61 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
28 <text class="text_gray7_34">月度保费</text> 62 <text class="text_gray7_34">月度保费</text>
29 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input> 63 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" id="month_premium" bindblur="getInputInfo" value="{{month_premium}}"></input>
30 </view> 64 </view>
31 <view class="divide_line_30"></view> 65 <view class="divide_line_30"></view>
32 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx"> 66 <view style="height:104rpx;padding:0 30rpx;background-color:#fff;margin-bottom:1rpx">
33 <text class='red_star_right_10'>*</text> 67 <text class='red_star_right_10'>*</text>
34 <text class="text_gray7_34">本年扣除金额</text> 68 <text class="text_gray7_34">本年扣除金额</text>
35 - <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' name='name' type="digit" bindblur="bindIncome" value="{{}}"></input> 69 + <input class='input_wrap' style='text-align: right;color:#000;' placeholder='请输入' type="digit" id="year_deduction" bindblur="getInputInfo" value="{{year_deduction}}"></input>
36 </view> 70 </view>
37 </view> 71 </view>
38 72
@@ -5,76 +5,83 @@ Page({ @@ -5,76 +5,83 @@ Page({
5 * Page initial data 5 * Page initial data
6 */ 6 */
7 data: { 7 data: {
8 - 8 + settlement_record_id: "",
  9 + endowment_account: "0",
  10 + health_account: "0"
9 }, 11 },
10 12
11 /** 13 /**
12 * Lifecycle function--Called when page load 14 * Lifecycle function--Called when page load
13 */ 15 */
14 - onLoad: function (options) {  
15 - 16 + onLoad: function(options) {
  17 + console.log("id", options)
  18 + this.setData({
  19 + settlement_record_id: options.id,
  20 + endowment_account: options.endowment_account,
  21 + health_account: options.health_account
  22 + })
16 }, 23 },
17 24
18 /** 25 /**
19 * Lifecycle function--Called when page is initially rendered 26 * Lifecycle function--Called when page is initially rendered
20 */ 27 */
21 - onReady: function () { 28 + onReady: function() {
22 29
23 }, 30 },
24 31
25 /** 32 /**
26 * Lifecycle function--Called when page show 33 * Lifecycle function--Called when page show
27 */ 34 */
28 - onShow: function () { 35 + onShow: function() {
29 36
30 }, 37 },
31 38
32 -// 商业健康保险  
33 - healthInsurDetail:function(){ 39 + // 商业健康保险
  40 + healthInsurDetail: function() {
34 wx.navigateTo({ 41 wx.navigateTo({
35 - url: 'healthInsurDetail', 42 + url: 'healthInsurDetail?id=' + this.data.settlement_record_id,
36 }) 43 })
37 }, 44 },
38 45
39 -// 税延养老保险  
40 - endowmentInsurDetail: function () { 46 + // 税延养老保险
  47 + endowmentInsurDetail: function() {
41 wx.navigateTo({ 48 wx.navigateTo({
42 - url: 'endowmentInsurDetail', 49 + url: 'endowmentInsurDetail?id=' + this.data.settlement_record_id,
43 }) 50 })
44 - }, 51 + },
45 52
46 /** 53 /**
47 * Lifecycle function--Called when page hide 54 * Lifecycle function--Called when page hide
48 */ 55 */
49 - onHide: function () { 56 + onHide: function() {
50 57
51 }, 58 },
52 59
53 /** 60 /**
54 * Lifecycle function--Called when page unload 61 * Lifecycle function--Called when page unload
55 */ 62 */
56 - onUnload: function () { 63 + onUnload: function() {
57 64
58 }, 65 },
59 66
60 /** 67 /**
61 * Page event handler function--Called when user drop down 68 * Page event handler function--Called when user drop down
62 */ 69 */
63 - onPullDownRefresh: function () { 70 + onPullDownRefresh: function() {
64 71
65 }, 72 },
66 73
67 /** 74 /**
68 * Called when page reach bottom 75 * Called when page reach bottom
69 */ 76 */
70 - onReachBottom: function () { 77 + onReachBottom: function() {
71 78
72 }, 79 },
73 80
74 /** 81 /**
75 * Called when user click on the top right corner to share 82 * Called when user click on the top right corner to share
76 */ 83 */
77 - onShareAppMessage: function () { 84 + onShareAppMessage: function() {
78 85
79 } 86 }
80 }) 87 })
@@ -2,12 +2,12 @@ @@ -2,12 +2,12 @@
2 <view style="background:#fff;padding:0 30rpx;" bindtap="healthInsurDetail"> 2 <view style="background:#fff;padding:0 30rpx;" bindtap="healthInsurDetail">
3 <text class="text_gray7_34">商业健康保险合计</text> 3 <text class="text_gray7_34">商业健康保险合计</text>
4 <image class='arrow_wrap' style='margin-top: 32rpx' src='/images/arrow_right.png'></image> 4 <image class='arrow_wrap' style='margin-top: 32rpx' src='/images/arrow_right.png'></image>
5 - <text class="text_black3_34 float_right">{{3000}}</text> 5 + <text class="text_black3_34 float_right">{{health_account}}</text>
6 </view> 6 </view>
7 <view class="divide_line_30"></view> 7 <view class="divide_line_30"></view>
8 <view style="background:#fff;padding:0 30rpx;" bindtap="endowmentInsurDetail"> 8 <view style="background:#fff;padding:0 30rpx;" bindtap="endowmentInsurDetail">
9 <text class="text_gray7_34">税延养老保险合计</text> 9 <text class="text_gray7_34">税延养老保险合计</text>
10 <image class='arrow_wrap' style='margin-top: 32rpx' src='/images/arrow_right.png'></image> 10 <image class='arrow_wrap' style='margin-top: 32rpx' src='/images/arrow_right.png'></image>
11 - <text class="text_black3_34 float_right">{{5000}}</text> 11 + <text class="text_black3_34 float_right">{{endowment_account}}</text>
12 </view> 12 </view>
13 </view> 13 </view>
注册登录 后发表评论