这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容
", + title: "", + times: 0, + images: [], + content: "", + price: 0, }, }; }, @@ -110,16 +108,40 @@ export default { config: (state) => state.system.config, }), }, - onLoad() { - this.$nextTick(() => { - this.setTabHeight(); - }); + onLoad(e) { + if (e.id) { + this.id = e.id; + } else { + this.$utils.toast("参数错误"); + return; + } + + this.getDetail(); }, onShow() {}, onReady() {}, onReachBottom() {}, onPullDownRefresh() {}, methods: { + getDetail() { + this.$request({ + api: "service.goodsDetail", + data: { + id: this.id, + }, + }).then((response) => { + this.detail = { + title: response.data.goods.post_title, + times: response.data.goods.post_hits, + images: response.data.goods.image, + content: response.data.goods.post_content, + price: response.data.goods.money, + }; + this.$nextTick(() => { + this.setTabHeight(); + }); + }); + }, share() { uni.showToast({ title: "分享", diff --git a/src/pages/service/list.vue b/src/pages/service/list.vue index 86f3b26..b386d82 100644 --- a/src/pages/service/list.vue +++ b/src/pages/service/list.vue @@ -49,12 +49,43 @@ export default { this.$utils.toast("参数错误"); return; } + this.loadList(); }, onShow() {}, onReady() {}, onReachBottom() {}, onPullDownRefresh() {}, methods: { + /** + * 加载列表 + */ + loadList() { + this.$request({ + api: "service.list", + query: "id=" + this.cateId, + }) + .then((response) => { + response.data.forEach((item) => { + let goods = []; + item.goods.forEach((v) => { + goods.push({ + id: v.id, + name: v.post_title, + times: v.post_hits, + icon: v.thumbnail, + price: v.money, + }); + }); + this.data.push({ + id: item.id, + name: item.name, + icon: item.more, + child: goods, + }); + }); + }) + .catch((e) => {}); + }, createOrder() { this.$utils.toPage("/pages/order/create"); },