|
@@ -19,13 +19,13 @@
|
|
|
<view class="list-scroll-view">
|
|
|
<view class="list" v-for="(item,index) in list" :key="index">
|
|
|
<view class="title">
|
|
|
- {{item.name}}
|
|
|
+ {{item.label}}
|
|
|
</view>
|
|
|
<view class="market">
|
|
|
- <view class="marketList" v-for="(tag,indexs) in item.marketList" :key="indexs">
|
|
|
+ <view class="marketList" v-for="(tag,indexs) in item.children" :key="indexs">
|
|
|
<image class="image" :src="tag.url" mode=""></image>
|
|
|
<view class="name">
|
|
|
- {{tag.name}}
|
|
|
+ {{tag.label}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -40,93 +40,18 @@
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
- name: 'sort',
|
|
|
+ name: 'type',
|
|
|
data() {
|
|
|
return {
|
|
|
active: '0',
|
|
|
- typeList: [ //商品分类
|
|
|
- {
|
|
|
- name: '休闲食品'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '进口食品'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '粮油调味'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '酒饮冲调'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '时令水果'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '品质生鲜'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '居家用品'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '个护清洁'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '3C产品'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '母婴玩具'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '服饰配件'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '礼卡专区'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '植物饮食'
|
|
|
- }
|
|
|
- ],
|
|
|
- list: [ //
|
|
|
- {
|
|
|
- name: '商品一',
|
|
|
- marketList: [ //
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '核桃'
|
|
|
- },
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '核桃'
|
|
|
- },
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '核桃'
|
|
|
- },
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '核桃2'
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '商品二',
|
|
|
- marketList: [ //
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '核桃'
|
|
|
- },
|
|
|
- {
|
|
|
- url: require('@/static/test.png'),
|
|
|
- name: '核桃2'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
-
|
|
|
+ typeList: [],
|
|
|
+ list: []
|
|
|
};
|
|
|
},
|
|
|
onShow: function() {
|
|
|
const that = this;
|
|
|
- that.searchOther()
|
|
|
+ that.searchOther();
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
async searchOther() {
|
|
@@ -135,19 +60,35 @@
|
|
|
res = await that.$api(`/goodsTags`, 'GET', {
|
|
|
status: '0'
|
|
|
})
|
|
|
- if (res.errcode == '0') that.$set(that, `typeList`, res.data);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ that.$set(that, `typeList`, res.data);
|
|
|
+ if (res.total > 0) that.searchRight(res.data[0]);
|
|
|
+ }
|
|
|
},
|
|
|
toChange(index, e) {
|
|
|
const that = this;
|
|
|
- that.$set(that, `active`, index)
|
|
|
+ that.$set(that, `active`, index);
|
|
|
+ that.searchRight(e);
|
|
|
},
|
|
|
- // 公共跳转
|
|
|
- toCommon(e) {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/${e}`
|
|
|
+ // 查询左侧信息
|
|
|
+ async searchRight(e) {
|
|
|
+ const that = this;
|
|
|
+ let info = {};
|
|
|
+ if (e.id) info.pid = e.id;
|
|
|
+ const res = await that.$api(`/goodsTags/tree`, 'GET', {
|
|
|
+ ...info
|
|
|
})
|
|
|
- },
|
|
|
- }
|
|
|
+ if (res.errcode == '0' && res.data.length > 0) {
|
|
|
+ that.$set(that, `list`, res.data[0].children)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 公共跳转
|
|
|
+ toCommon(e) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/${e}`
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|