修改分类获取入参

This commit is contained in:
TOP糯米 2023-04-01 14:54:59 +08:00
parent 2d1f0f79e0
commit 4173ba1ec2
3 changed files with 25 additions and 36 deletions

View File

@ -3,12 +3,13 @@ let prototype = Vue.prototype;
export default { export default {
/** /**
* 安装分类 * 服务分类
*/ */
getInstallCate() { getCate(data) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
prototype.$request({ prototype.$request({
api: "service.cate", api: "service.cate",
data: data
}).then((response) => { }).then((response) => {
if (response.code == 1) { if (response.code == 1) {
let list = []; let list = [];

View File

@ -251,17 +251,21 @@ export default {
}); });
// #endif // #endif
this.$store.dispatch("service/insurancePrice"); this.$store.dispatch("service/insurancePrice");
this.$models.service.getInstallCate().then((list) => { this.$models.service
this.cateList = list; .getCate({
if (e.id && e.id > 0) { type: 0,
list.forEach((item) => { })
if (item.id == e.id) { .then((list) => {
this.cateId = item.id; this.cateList = list;
this.cateText = item.name; if (e.id && e.id > 0) {
} list.forEach((item) => {
}); if (item.id == e.id) {
} this.cateId = item.id;
}); this.cateText = item.name;
}
});
}
});
}, },
onShow() {}, onShow() {},
onReady() {}, onReady() {},

View File

@ -126,31 +126,15 @@ export default {
* 分类 * 分类
*/ */
loadCate() { loadCate() {
this.$request({ let that = this;
api: "service.cate", this.$models.service
data: { .getCate({
keys: this.keywords, keys: this.keywords,
}, type: 1,
})
.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,
});
});
}) })
.catch((e) => {}); .then((list) => {
that.data = this.data.concat(list);
});
}, },
onScroll(id) { onScroll(id) {
this.newId = id; this.newId = id;