提交 835d99ba41248518a5fa0f6497a0a411874ed0cf

作者 pangy
1 个父辈 2f09c3f4

国家列表 改成接口数据

1 1 // pages/main/addtionalreduce/addextrainfo/addextrainfo.js
2 2 var format = require('../../../../utils/util.js');
3   -var countryInfo = require('../../../../utils/country.js');
  3 +// var countryInfo = require('../../../../utils/country.js');
4 4 var OSSInit;
5 5 var app = getApp();
6 6 var baseUrl = app.globalData.baseUrl;
... ... @@ -557,7 +557,7 @@ Page({
557 557 // deduction_amount = Deduce_amounts_year[nameKey] ? Deduce_amounts_year[nameKey] : 0
558 558 }
559 559 if ("children_education" == options.status) {
560   - this.loadCountry()
  560 + this.getCountry()
561 561 if (options.isedit != 'true'){
562 562 this.getTaxList()
563 563 }
... ... @@ -722,16 +722,56 @@ Page({
722 722 }
723 723 })
724 724 },
725   - loadCountry: function() {
726   - countryInfo.init(this)
727   - var countrylist = this.data.country
728   - var country_data = this.data.schoolCountryData
729   - for (var i = 0; i < countrylist.length; i++) {
730   - country_data.values.push(countrylist[i].name)
731   - }
732   - console.log("countrydata", country_data)
733   - this.setData({
734   - schoolCountryData: country_data
  725 + // loadCountry: function() {
  726 + // countryInfo.init(this)
  727 + // var countrylist = this.data.country
  728 + // var country_data = this.data.schoolCountryData
  729 + // for (var i = 0; i < countrylist.length; i++) {
  730 + // country_data.values.push(countrylist[i].name)
  731 + // }
  732 + // console.log("countrydata", country_data)
  733 + // this.setData({
  734 + // schoolCountryData: country_data
  735 + // })
  736 + // },
  737 +
  738 + //****************获取国籍数据************/
  739 + getCountry: function () {
  740 + var that = this
  741 + wx.showLoading()
  742 + var Authorization = app.globalData.Authorization;
  743 + wx.request({
  744 + url: baseUrl + 'persontax/v1/nation-list',
  745 + method: "GET",
  746 + header: {
  747 + 'content-type': 'application/json', // 默认值
  748 + "Authorization": Authorization
  749 + },
  750 + success: function (res) {
  751 + var countrys = res.data.concat()
  752 + if (countrys.indexOf('中国') > -1) {
  753 + countrys.splice(countrys.indexOf('中国'), 1);
  754 + }
  755 + if (countrys.indexOf('中国台湾') > -1) {
  756 + countrys.splice(countrys.indexOf('中国台湾'), 1);
  757 + }
  758 + if (countrys.indexOf('香港') > -1) {
  759 + countrys.splice(countrys.indexOf('香港'), 1);
  760 + }
  761 + if (countrys.indexOf('澳门') > -1) {
  762 + countrys.splice(countrys.indexOf('澳门'), 1);
  763 + }
  764 + // that.data.countryData.values = countrys
  765 + that.data.schoolCountryData.values = res.data
  766 + that.countrys = countrys
  767 + that.setData({
  768 + // countryData: that.data.countryData,
  769 + schoolCountryData: that.data.schoolCountryData
  770 + })
  771 + },
  772 + complete() {
  773 + wx.hideLoading()
  774 + }
735 775 })
736 776 },
737 777 handlEditData: function (data) {
... ...
注册登录 后发表评论