diff --git a/src/core/models/service.js b/src/core/models/service.js index e1ef5c1..587754f 100644 --- a/src/core/models/service.js +++ b/src/core/models/service.js @@ -3,12 +3,13 @@ let prototype = Vue.prototype; export default { /** - * 安装分类 + * 服务分类 */ - getInstallCate() { + getCate(data) { return new Promise((resolve, reject) => { prototype.$request({ api: "service.cate", + data: data }).then((response) => { if (response.code == 1) { let list = []; diff --git a/src/pages/demand/demand.vue b/src/pages/demand/demand.vue index 1b04db9..cdba47c 100644 --- a/src/pages/demand/demand.vue +++ b/src/pages/demand/demand.vue @@ -251,17 +251,21 @@ export default { }); // #endif this.$store.dispatch("service/insurancePrice"); - this.$models.service.getInstallCate().then((list) => { - this.cateList = list; - if (e.id && e.id > 0) { - list.forEach((item) => { - if (item.id == e.id) { - this.cateId = item.id; - this.cateText = item.name; - } - }); - } - }); + this.$models.service + .getCate({ + type: 0, + }) + .then((list) => { + this.cateList = list; + if (e.id && e.id > 0) { + list.forEach((item) => { + if (item.id == e.id) { + this.cateId = item.id; + this.cateText = item.name; + } + }); + } + }); }, onShow() {}, onReady() {}, diff --git a/src/pages/service/cate.vue b/src/pages/service/cate.vue index e03d6cd..7f6b126 100644 --- a/src/pages/service/cate.vue +++ b/src/pages/service/cate.vue @@ -126,31 +126,15 @@ export default { * 分类 */ loadCate() { - this.$request({ - api: "service.cate", - data: { + let that = this; + this.$models.service + .getCate({ keys: this.keywords, - }, - }) - .then((response) => { - response.data.forEach((item) => { - let child = []; - item.child.forEach((v) => { - child.push({ - id: v.id, - name: v.name, - cover: v.more, - }); - }); - this.data.push({ - id: item.id, - name: item.name, - cover: item.more, - child: child, - }); - }); + type: 1, }) - .catch((e) => {}); + .then((list) => { + that.data = this.data.concat(list); + }); }, onScroll(id) { this.newId = id;