完善服务分类
This commit is contained in:
parent
26e596dd21
commit
c0090dacdf
|
@ -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;
|
||||
},
|
||||
/**
|
||||
* 分类
|
||||
|
|
|
@ -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) => {});
|
||||
|
|
Loading…
Reference in New Issue