修复服务分类页面高度设置问题,新增服务详情页面

This commit is contained in:
TOP糯米 2023-02-11 14:02:24 +08:00
parent 4f27f78409
commit e573c5f473
5 changed files with 72 additions and 34 deletions

View File

@ -59,7 +59,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'; import { mapState } from "vuex";
import CateTmpl from "@/components/cate/template/cate"; import CateTmpl from "@/components/cate/template/cate";
import ListTmpl from "@/components/cate/template/list"; import ListTmpl from "@/components/cate/template/list";
export default { export default {
@ -98,24 +98,26 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
config: state => state.system.config, config: (state) => state.system.config,
bodyPaddingTop: (state) => state.system.bodyPaddingTop, bodyPaddingTop: (state) => state.system.bodyPaddingTop,
}) }),
}, },
created() {}, created() {},
mounted() { mounted() {
this.getMenuItemTop(); this.getMenuItemTop();
let headerHeight = this.$utils.rpx2px(this.bodyPaddingTop); setTimeout(() => {
let offsetHeight = this.$utils.rpx2px(this.offsetHeight); let headerHeight = this.$utils.rpx2px(this.bodyPaddingTop);
const { windowHeight, statusBarHeight } = this.config; let offsetHeight = this.$utils.rpx2px(this.offsetHeight);
// - - = const { windowHeight, statusBarHeight } = this.config;
this.wrapHeight = windowHeight - headerHeight - offsetHeight; // - - =
// #ifdef MP-WEIXIN this.wrapHeight = windowHeight - headerHeight - offsetHeight;
// tabbar // #ifdef MP-WEIXIN
if (this.cateType == 'cate') { // tabbar
this.wrapHeight += this.$utils.rpx2px(100); if (this.cateType == "cate") {
} this.wrapHeight += this.$utils.rpx2px(100);
// #endif }
// #endif
}, 20);
}, },
destroyed() {}, destroyed() {},
methods: { methods: {

View File

@ -8,21 +8,21 @@
class="thumb-box" class="thumb-box"
v-for="(child, index1) in data.child" v-for="(child, index1) in data.child"
:key="index1" :key="index1"
@click="clickItem(child.id, child.name)"
> >
<image <image
class="cover-image" class="cover-image"
mode="aspectFill" mode="aspectFill"
:src="child.icon" :src="child.icon"
@click="clickItem(child.id, child.name)"
></image> ></image>
<view class="item-box"> <view class="item-box" @click="clickItem(child.id, child.name)">
<view class="title">{{ child.name }}</view> <view class="title">{{ child.name }}</view>
<view class="text-box"> <view class="text-box">
{{ "已服务113256次" }} {{ "已服务113256次" }}
</view> </view>
<view class="price">158元起</view> <view class="price">158元起</view>
<mini-add class="component-add" :initNumber="child.buyNumber" />
</view> </view>
<mini-add class="component-add" :initNumber="child.buyNumber" />
</view> </view>
</view> </view>
</view> </view>
@ -64,10 +64,17 @@ export default {
flex-wrap: wrap; flex-wrap: wrap;
} }
.thumb-box { .thumb-box {
position: relative;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-top: 40rpx; margin-top: 40rpx;
.component-add {
position: absolute;
right: 0;
bottom: 8rpx;
}
} }
.thumb-box:nth-child(3n) { .thumb-box:nth-child(3n) {
margin-right: 0; margin-right: 0;
@ -80,7 +87,6 @@ export default {
border: 2rpx solid #d8d8d8; border: 2rpx solid #d8d8d8;
} }
.item-box { .item-box {
position: relative;
width: 300rpx; width: 300rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -99,10 +105,5 @@ export default {
font-size: 30rpx; font-size: 30rpx;
color: #ec7655; color: #ec7655;
} }
.component-add {
position: absolute;
right: 0;
bottom: 8rpx;
}
} }
</style> </style>

View File

@ -22,7 +22,7 @@
{ {
"path": "pages/member/address", "path": "pages/member/address",
"style": { "style": {
"navigationBarTitleText": "分类" "navigationBarTitleText": "地址管理"
} }
}, },
{ {
@ -34,7 +34,13 @@
{ {
"path": "pages/service/list", "path": "pages/service/list",
"style": { "style": {
"navigationBarTitleText": "分类" "navigationBarTitleText": "服务列表"
}
},
{
"path": "pages/service/detail",
"style": {
"navigationBarTitleText": "服务详情"
} }
} }
], ],

View File

@ -0,0 +1,25 @@
<template>
<app-layout backgroundColor="#00418c" :title="title" textColor="light">
</app-layout>
</template>
<script>
import AppLayout from "@/components/layout/layout";
export default {
name: "service-detail",
data() {
return {
title: "服务详情",
};
},
components: { AppLayout },
onLoad() {},
onShow() {},
onReady() {},
onReachBottom() {},
onPullDownRefresh() {},
methods: {},
};
</script>
<style lang="less" scoped></style>

View File

@ -1,9 +1,9 @@
<template> <template>
<app-layout btnType="back" title="服务列表" pageBackgroundColor="#FFFFFF"> <app-layout btnType="back" title="服务列表" pageBackgroundColor="#FFFFFF">
<view class="cate"> <view class="cate">
<app-cate :data="data" cateType="list" /> <app-cate :data="data" cateType="list" @clickItem="clickItem" />
</view> </view>
<view class="buy-components" :style="{bottom: bottom + 'rpx'}"> <view class="buy-components" :style="{ bottom: bottom + 'rpx' }">
<view class="cart"> <view class="cart">
<view class="cart-icon"> <view class="cart-icon">
<text class="iconfont icon-gouwuche"></text> <text class="iconfont icon-gouwuche"></text>
@ -22,7 +22,7 @@
<script> <script>
import AppLayout from "@/components/layout/layout"; import AppLayout from "@/components/layout/layout";
import AppCate from "@/components/cate/cate"; import AppCate from "@/components/cate/cate";
import { mapState } from 'vuex'; import { mapState } from "vuex";
export default { export default {
name: "service-list", name: "service-list",
data() { data() {
@ -91,19 +91,23 @@ export default {
components: { AppLayout, AppCate }, components: { AppLayout, AppCate },
computed: { computed: {
...mapState({ ...mapState({
config: (state) => state.system.config config: (state) => state.system.config,
}) }),
}, },
onLoad() { onLoad() {
this.bottom = this.$utils.px2rpx(this.config.safeAreaInsets.bottom); this.bottom = this.$utils.px2rpx(this.config.safeAreaInsets.bottom);
}, },
onShow() {}, onShow() {},
onReady() { onReady() {},
},
onReachBottom() {}, onReachBottom() {},
onPullDownRefresh() {}, onPullDownRefresh() {},
methods: {}, methods: {
clickItem(id) {
uni.navigateTo({
url: "/pages/service/detail?id=" + id,
});
},
},
}; };
</script> </script>