完善服务分类
This commit is contained in:
parent
26e596dd21
commit
c0090dacdf
|
@ -61,7 +61,12 @@ export default {
|
||||||
y: y - this.$utils.rpx2px(40),
|
y: y - this.$utils.rpx2px(40),
|
||||||
};
|
};
|
||||||
// 加载分类
|
// 加载分类
|
||||||
await this.loadHot();
|
this.data.push({
|
||||||
|
id: 0,
|
||||||
|
name: "热门推荐",
|
||||||
|
cover: "",
|
||||||
|
child: await this.hotCate(),
|
||||||
|
});
|
||||||
this.loadCate();
|
this.loadCate();
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
|
@ -70,27 +75,23 @@ export default {
|
||||||
onPullDownRefresh() {},
|
onPullDownRefresh() {},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* 热门推荐
|
* 推荐
|
||||||
*/
|
*/
|
||||||
async loadHot() {
|
async hotCate() {
|
||||||
|
let list = [];
|
||||||
await this.$request({
|
await this.$request({
|
||||||
api: "service.hotCate",
|
api: "service.hotCate",
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
let child = [];
|
|
||||||
response.data.forEach((item) => {
|
response.data.forEach((item) => {
|
||||||
child.push({
|
list.push({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
cover: item.more,
|
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,
|
config: (state) => state.system.config,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
async onLoad(e) {
|
onLoad(e) {
|
||||||
if (!e.id) {
|
if (!e.id) {
|
||||||
this.$utils.toast("参数错误");
|
this.$utils.toast("参数错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await this.loadList(e.id);
|
this.loadList(e.id);
|
||||||
// 赋值,触发watch
|
|
||||||
this.currentId = e.id;
|
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
|
@ -60,8 +58,8 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 加载列表
|
* 加载列表
|
||||||
*/
|
*/
|
||||||
async loadList(cateId) {
|
loadList(cateId) {
|
||||||
await this.$request({
|
this.$request({
|
||||||
api: "service.list",
|
api: "service.list",
|
||||||
query: "id=" + cateId,
|
query: "id=" + cateId,
|
||||||
})
|
})
|
||||||
|
@ -83,6 +81,8 @@ export default {
|
||||||
cover: item.more,
|
cover: item.more,
|
||||||
child: goods,
|
child: goods,
|
||||||
});
|
});
|
||||||
|
// 赋值,触发watch
|
||||||
|
this.currentId = cateId;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((e) => {});
|
.catch((e) => {});
|
||||||
|
|
Loading…
Reference in New Issue