From 6b9d5c4153de771a080ccaee56f6bbbcb0112af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Thu, 23 Mar 2023 00:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/apis.js | 3 --- src/core/models/service.js | 24 ------------------------ src/core/models/system.js | 28 ++++++++++++++++++++++++---- src/pages/index/index.vue | 24 +++++++----------------- src/pages/service/other/other.vue | 21 +++++++++++++++++---- 5 files changed, 48 insertions(+), 52 deletions(-) diff --git a/src/core/apis.js b/src/core/apis.js index 0ef40de..8cd9934 100644 --- a/src/core/apis.js +++ b/src/core/apis.js @@ -100,9 +100,6 @@ export default { insurance: { url: "/wxapp/index/getyiwai", }, - aftermarket: { - url: "/wxapp/index/category2", - }, hotCate: { url: "/wxapp/index/hotcategory", }, diff --git a/src/core/models/service.js b/src/core/models/service.js index 077c9e1..e1ef5c1 100644 --- a/src/core/models/service.js +++ b/src/core/models/service.js @@ -36,30 +36,6 @@ export default { }); }); }, - /** - * 售后分类 - */ - getAfterMarketCate() { - return new Promise((resolve, reject) => { - prototype.$request({ - api: "service.aftermarket", - }).then((response) => { - if (response.code == 1) { - let list = []; - response.data.forEach((item) => { - list.push({ - id: item.id, - name: item.name, - cover: item.more, - page: item.name == "货物配送" ? "/pages/service/other/distribution" : "/pages/demand/demand", - }); - }); - return resolve(list); - } - return reject(response.msg); - }); - }); - }, /** * 保险价格 */ diff --git a/src/core/models/system.js b/src/core/models/system.js index c36f031..6a2e404 100644 --- a/src/core/models/system.js +++ b/src/core/models/system.js @@ -27,13 +27,33 @@ export default { api: "index.nav", }).then(response => { if (response.code == 1) { - let list = []; - response.data.forEach(item => { - list.push({ + let list = { + install: [], + aftermarket: [], + other: [], + }; + response.data.lists1.forEach(item => { + list.install.push({ id: item.id, cover: item.logo, name: item.title, - page: item.url, + page: item.types, + }) + }); + response.data.lists2.forEach(item => { + list.aftermarket.push({ + id: item.id, + cover: item.logo, + name: item.title, + page: item.types, + }) + }); + response.data.lists3.forEach(item => { + list.other.push({ + id: item.id, + cover: item.logo, + name: item.title, + page: item.types, }) }); return resolve(list); diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 1c9d1c4..c52a224 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -33,12 +33,7 @@ 建材安装服务 - + {{ item.name }} @@ -53,7 +48,7 @@ class="service-item" v-for="(item, index) in aftermarketServiceList" :key="index" - @click="utils.toPage(item.page)" + @click="toPage(item.page)" > @@ -139,15 +134,10 @@ export default { this.$models.system.notifyList().then((list) => { this.notifyList = list; }); - // 安装服务 + // 导航 this.$models.system.navList().then((list) => { - this.installServiceList = list; - }); - /** - * 维修售后 - */ - this.$models.service.getAfterMarketCate().then((list) => { - this.aftermarketServiceList = list; + this.installServiceList = list.install; + this.aftermarketServiceList = list.aftermarket; }); }, onShow() {}, @@ -156,9 +146,9 @@ export default { onPullDownRefresh() {}, methods: { /** - * 点击导航 + * 跳转 */ - toService(page) { + toPage(page) { const params = this.$utils.getUrlParams(page); if (page.indexOf("service/cate") > 0) { this.$store.commit("system/currentCateId", params.id); diff --git a/src/pages/service/other/other.vue b/src/pages/service/other/other.vue index 95c58e2..f3557f2 100644 --- a/src/pages/service/other/other.vue +++ b/src/pages/service/other/other.vue @@ -3,10 +3,10 @@ 其他服务 - + - {{ item.title }} + {{ item.name }} @@ -29,14 +29,27 @@ export default { }, onLoad() { this.$models.system.navList().then((list) => { - this.list = list; + this.list = list.other; }); }, onShow() {}, onReady() {}, onReachBottom() {}, onPullDownRefresh() {}, - methods: {}, + methods: { + /** + * 跳转 + */ + toPage(page) { + const params = this.$utils.getUrlParams(page); + if (page.indexOf("service/cate") > 0) { + this.$store.commit("system/currentCateId", params.id); + this.$utils.toPage(page, {}, "switch"); + } else { + this.$utils.toPage(page); + } + }, + }, };