123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <view class="div ui-category-body" :style="'padding-top:'+navHeight+'px'">
- <view class="div category-flex">
- <view class="div pb-30" v-if="items">
- <view class="div" v-for="item in items" :key="item.id">
- <view class="div container pb-5">
- <view class='div title pt-5'>
- <view class='div storegc_name'>{{item.value}}</view>
- </view>
- <view class='div child-wrapper pt-5'>
- <view class='div child' v-for="(child,index) in item.children" :key='index' >
- <view class='childitem' @click="goProduct(child.id)">
- {{child.value}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { urlencode } from '@/util/common'
- import { getStoreGoodsClass } from '../../../api/homestoredetail'
- export default {
- data () {
- return {
- navHeight:0,
- query:{},
- items: false,
- currentItem: false
- }
- },
- computed: {
- },
- mounted(){
- // #ifdef MP-WEIXIN
- this.navHeight = uni.getMenuButtonBoundingClientRect().top
- // #endif
- var pages = getCurrentPages()
- var page = pages[pages.length - 1]
- this.query = page.options
- this.getGoodsclassList()
- },
- methods: {
- onItemClick (item) {
- this.currentItem = item
- },
- getGoodsclassList () {
- if (!(this.items && this.items.length)) {
- uni.showLoading({ title: '加载中' })
- }
- getStoreGoodsClass(this.query.id).then((res) => {
- this.items = res.result.store_goods_class
- if (this.items.length > 0) {
- this.currentItem = this.items[0]
- }
- uni.hideLoading()
- }, (error) => {
- uni.showToast({icon:'none',title: error.message})
- uni.hideLoading()
- })
- },
- goProduct (id) {
- let params = { id:this.query.id,'gc_id': id }
- uni.navigateTo({url: '/pages/home/storegoodslist/Goodslist'+'?'+urlencode( params )})
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .ui-category-body{
- width: 100%;
- position: absolute;
- bottom: 0;
- top: var(--status-bar-height);
- .category-flex {
- height: 100%;
- box-sizing: border-box;
- padding-top:$headerHeight;
- background: #fff;
- .container {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: stretch;
- background-color: #fff;
- padding: 0 $pageSpace;
- .title{
- font-size: .8rem;
- color: #333;
- font-weight: bold;
- display: flex;
- align-items: center;
- }
- .child-wrapper{
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- .child{
- width: 23%;
- margin-right: 1%;
- font-size: .6rem;
- background:#f6f6f6;
- border-radius: 1.5rem;
- padding: .4rem .3rem;
- box-sizing: border-box;
- text-align: center;
- white-space: nowrap;
- margin-bottom: .5rem;
- overflow: hidden;
- .iconfont{
- font-size: .6rem;
- margin-right: .2rem;
- }
- }
- .child:not(:nth-child(4n)) {
- margin-right: calc(4% / 3);
- }
- }
- }
- }
- }
- </style>
|