完成导航

This commit is contained in:
TOP糯米 2023-03-23 00:51:30 +08:00
parent d8ddbbdecd
commit 6b9d5c4153
5 changed files with 48 additions and 52 deletions

View File

@ -100,9 +100,6 @@ export default {
insurance: {
url: "/wxapp/index/getyiwai",
},
aftermarket: {
url: "/wxapp/index/category2",
},
hotCate: {
url: "/wxapp/index/hotcategory",
},

View File

@ -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);
});
});
},
/**
* 保险价格
*/

View File

@ -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);

View File

@ -33,12 +33,7 @@
<view class="common-service-nav-group">
<text class="section-title">建材安装服务</text>
<view class="group g1">
<view
class="service-item"
v-for="(item, index) in installServiceList"
:key="index"
@click="toService(item.page, item.id)"
>
<view class="service-item" v-for="(item, index) in installServiceList" :key="index" @click="toPage(item.page)">
<image class="service-icon" :src="item.cover" mode="scaleToFill" />
<text class="service-name limit-line clamp-1">
{{ 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)"
>
<image class="service-icon" :src="item.cover" mode="scaleToFill" />
<text class="service-name limit-line clamp-1">
@ -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);

View File

@ -3,10 +3,10 @@
<view class="common-service-nav-group">
<text class="section-title">其他服务</text>
<view class="group g1">
<view class="service-item" v-for="(item, index) in list" :key="index" @click="utils.toPage(item.page)">
<view class="service-item" v-for="(item, index) in list" :key="index" @click="toPage(item.page)">
<image class="service-icon" :src="item.cover" mode="scaleToFill" />
<text class="service-name limit-line clamp-1">
{{ item.title }}
{{ item.name }}
</text>
</view>
</view>
@ -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);
}
},
},
};
</script>