diff --git a/src/views/user/user-table/index.vue b/src/views/user/user-table/index.vue index eecddaf..8edc80d 100644 --- a/src/views/user/user-table/index.vue +++ b/src/views/user/user-table/index.vue @@ -91,7 +91,7 @@ - - + --> + + + + + + + {{ + item.country.aliasName || item.country.enName + }} + + { that.permissionValidationLoading = false; }, 3 * 1000); }, + methods: { renderData(isReset) { const that = this; @@ -934,18 +968,21 @@ export default { that.searchLoading = that.listLoading = false; }); }, + handleSearch() { this.searchLoading = true; this.renderData(true); }, - querySearch(queryString, cb) { - var restaurants = this.allCountryList; - var results = queryString - ? restaurants.filter(this.createFilter(queryString)) - : restaurants; - // 调用 callback 返回建议列表的数据 - cb(results); - }, + + // querySearch(queryString, cb) { + // var restaurants = this.allCountryList; + // var results = queryString + // ? restaurants.filter(this.createFilter(queryString)) + // : restaurants; + // // 调用 callback 返回建议列表的数据 + // cb(results); + // }, + createFilter(queryString) { return restaurant => { if ( @@ -982,24 +1019,70 @@ export default { ); }; }, - handleDelCountryCodeClick() { - this.listQuery.countryCode = ""; - this.countryCodeStr = ""; - this.handleSearch(); - }, - handleCountryCodeClick(item) { - this.listQuery.countryCode = item.alphaTwo; - this.countryCodeStr = item.phonePrefix + " " + item.countryName; - this.handleSearch(); - }, - loadCountryAlls() { + + // handleDelCountryCodeClick() { + // this.listQuery.countryCode = ""; + // this.countryCodeStr = ""; + // this.handleSearch(); + // }, + + // handleCountryCodeClick(item) { + // this.listQuery.countryCode = item.alphaTwo; + // this.countryCodeStr = item.phonePrefix + " " + item.countryName; + // this.handleSearch(); + // }, + + // loadCountryAlls() { + // const that = this; + // getCountryAlls() + // .then(res => { + // that.allCountryList = res.result || {}; + // }) + // .catch(er => {}); + // }, + + // 获取国家列表 + loadOpenCountry() { const that = this; - getCountryAlls() + + that.loadingCountry = true; + listPayOpenCountry() .then(res => { - that.allCountryList = res.result || {}; + that.loadingCountry = false; + that.countryList = res.body || []; + that.listQuery.countryCode = ""; + that.selectedCountry = {}; + // that.renderData(); }) - .catch(er => {}); + .catch(er => { + that.loadingCountry = false; + console.error(er); + }); }, + + // 选择国家 + changeCountry(val) { + const that = this; + console.log("val", val); + + if (!val) { + // 如果没有选择国家,清空相关字段 + that.listQuery.countryCode = ""; + that.selectedCountry = {}; + } else { + // 选择了一个国家 + that.selectedCountry = + this.countryList.find(item => item.country.alphaTwo === val) || {}; + + // 使用传统的方式访问嵌套属性 + that.listQuery.countryCode = that.selectedCountry.country + ? that.selectedCountry.country.alphaTwo + : ""; + } + + this.renderData(); + }, + getAccountText(userInfo) { if (!userInfo) { return "";