123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <template>
- <view :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']"
- class="bodycont">
- <tm-menubars ref="fenleig" title="分类" :shadow="0" :showback="true"></tm-menubars>
- <div class="cont">
- <tm-sliderNav :activeIndex="activeIndex" class="zuo fl" @change="change" :list="list" text color="red"></tm-sliderNav>
- <view class="fr you">
- <view class="huadong">
- <view class="py-10 text-size-g dianz mingri text-align-center mt-40">
- <image src="/static/img/88.png" mode="widthFix"></image>
- <text class="text-white">精选推荐</text>
- </view>
- <view class="yiguicla mt-20 fl" v-for="item in quanbuList" @click="sort(item.id)">
- <view class="waicont">
- <image :src="item.src" mode="widthFix"></image>
- <view class="wenzi text-align-center text-size-m mt-8">{{item.text}}</view>
- </view>
- </view>
- <tm-empty v-if="quanbuList.length ==0" label="暂无数据" color="white" icon="icon-paperplane-fill"></tm-empty>
- <view style="width:100%;height:40px;clear: both;"></view>
- </view>
- </view>
- <view style="clear: both;"></view>
- </div>
- <!-- 弹出层消息 -->
- <tm-message ref="toast"></tm-message>
- </view>
- </template>
- <script>
- import {
- myRequest
- } from '@/api/request.js'
- export default {
- data() {
- return {
- list: [],
- quanbuList: {},
- activeIndex:0,
- frist:2,
- };
- },
- onLoad(e) {
- this.activeIndex=e.index?e.index:0;
- this.frist=e.index?1:2;
- console.log(this.activeIndex)
- },
- created() {
- this.sys = uni.getSystemInfoSync();
- this.getTop();
- },
- methods: {
- // 获取一级分类
- getTop() {
- let that = this;
- myRequest({
- url: '/api/ShopGoods/getMallClassification',
- method: 'get',
- data: that.reqData
- }).then(res => {
- if (res.data.code == 200) {
- res.data.data.forEach(item => {
- that.list.push({
- id: item.id,
- img: item.image,
- title: item.category_name
- })
- })
- this.change(this.activeIndex)
- } else {
- that.$refs.toast.show({
- model: 'error',
- label: res.data.msg
- })
- }
- })
- },
- // 切换更换二级分类
- change(e) {
- let that = this;
- if(this.frist==2){
- this.activeIndex=e;
- }
- this.frist=2;
- console.log(e)
- myRequest({
- url: '/api/ShopGoods/getMallChildrenClassification',
- method: 'post',
- data: {
- 'id': that.list[e].id
- }
- }).then(res => {
- if (res.data.code == 200) {
- that.quanbuList = [];
- res.data.data.forEach(item => {
- that.quanbuList.push({
- id:item.id,
- src: item.image,
- text: item.category_name
- })
- })
- } else {
- that.$refs.toast.show({
- model: 'error',
- label: res.data.msg
- })
- }
- })
- // uni.$tm.toast(`您选中了:${e}`)
- },
- sort(id){
- console.log(id);
- uni.navigateTo({
- url:'/pages/sort/index?id='+id
- })
- }
- },
- }
- </script>
- <style lang="scss">
- page,uni-page-body,.bodycont{
- height: 100% !important;
- overflow: hidden;
- }
- // /deep/ .tm-menubars .body {
- // background-color: #1b1b1b !important;
- // }
- .huadong{
- width: 90%;
- margin: 0 auto;
- }
- /deep/ .cont {
- overflow: hidden;
- height: calc(100% - 45px) !important;
- }
- /deep/ .kuang {
- margin: 0 !important;
- padding: 0px !important;
- }
- /deep/ .zuo .grey-darken-4.bk {
- background-color: #0D0D0D !important;
- }
- // /deep/ .zuo .uni-scroll-view-content {
- // background-color: #0D0D0D !important;
- // }
- /deep/ .cont .shadow-white-5 {
- padding: 0px !important;
- margin: 0px !important
- }
- /deep/ .zuo .border-red-l-2.bk {
- border-left-color: #0178FD !important;
- }
- /deep/ .zuo .text-red,
- /deep/ .zuo .text-grey-darken-1 {
- color: white !important;
- }
- .yiguicla image {
- width: 100%;
- display: block;
-
- margin-top: 5px;
- border-radius: 10px;
- }
- .waicont{
- overflow: hidden;
- border-radius: 10px;
- width: 80%;
- height: 100%;
- margin: 0 auto;
- position: relative;
- }
- .yiguicla{
- width: 50%;
- position: relative;
- padding: 0px !important;
- text-align: center;
- }
- .wenzi {
- position: absolute;
- bottom: 0px;
- background: rgba(158,165,172,0.8);
- color: white;
- width: 100%;
- height: 27px;
- line-height: 27px;
- font-size: 13px;
- }
- .mingri image {
- width: 25px;
- margin-right: 12px;
- vertical-align: middle;
- }
- .mingri text {
- vertical-align: middle;
- }
- .you {
- width: calc(100% - 80px);
- overflow: auto;
- background-color: #1b1b1b !important;
- height: 100%;
- overflow: auto;
- }
- .zuo {
- overflow: hidden;
- width: 80px !important;
- text-align: center;
- background-color: #0D0D0D !important;
- }
- /deep/ uni-scroll-view{
- width: 80px !important;
- }
- </style>
|