完善服务分类

This commit is contained in:
TOP糯米 2023-03-08 14:30:06 +08:00
parent 26e596dd21
commit c0090dacdf
2 changed files with 18 additions and 17 deletions

View File

@ -61,7 +61,12 @@ export default {
y: y - this.$utils.rpx2px(40),
};
//
await this.loadHot();
this.data.push({
id: 0,
name: "热门推荐",
cover: "",
child: await this.hotCate(),
});
this.loadCate();
},
onShow() {},
@ -70,27 +75,23 @@ export default {
onPullDownRefresh() {},
methods: {
/**
* 热门推荐
* 推荐
*/
async loadHot() {
async hotCate() {
let list = [];
await this.$request({
api: "service.hotCate",
}).then((response) => {
let child = [];
response.data.forEach((item) => {
child.push({
list.push({
id: item.id,
name: item.name,
cover: item.more,
});
});
this.data.push({
id: 0,
name: "热门推荐",
cover: "",
child: child,
});
});
return list;
},
/**
* 分类

View File

@ -43,14 +43,12 @@ export default {
config: (state) => state.system.config,
}),
},
async onLoad(e) {
onLoad(e) {
if (!e.id) {
this.$utils.toast("参数错误");
return;
}
await this.loadList(e.id);
// watch
this.currentId = e.id;
this.loadList(e.id);
},
onShow() {},
onReady() {},
@ -60,8 +58,8 @@ export default {
/**
* 加载列表
*/
async loadList(cateId) {
await this.$request({
loadList(cateId) {
this.$request({
api: "service.list",
query: "id=" + cateId,
})
@ -83,6 +81,8 @@ export default {
cover: item.more,
child: goods,
});
// watch
this.currentId = cateId;
});
})
.catch((e) => {});