mall.vue
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
<view class="page">
<view class="bg">
<image src="/static/bg.jpg"></image>
</view>
<view class="back" @click="home">
<image src="../../static/left.png"></image>
</view>
<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
<view class="content">
<view class="search-index">
<view class="search">
<view class="iconfont">
<image src="../../static/search.png"></image>
</view>
<text class="shu">|</text>
<input type="text" placeholder="请输入关键词" />
</view>
</view>
<!-- 分类数据 -->
<view class="classify-data">
<view class="classify-one">
<scroll-view scroll-y class="classify-list">
<!-- <view class="list action">
<text>全部</text>
</view> -->
<view class="list" @click="dhxz(index,item.name)" :class="{ 'action': item.checked }" v-for="(item,index) in navigation" :key="index">
<text>{{item.name}}</text>
</view>
</scroll-view>
</view>
<view class="classify-two-three">
<scroll-view scroll-y class="scroll">
<view class="goods-list" v-for="item in list">
<view class="goods">
<view class="thumb">
<image :src="Baseapi + item.productImage" mode=""></image>
</view>
<view class="item">
<view class="goods-name">
<view class="goods-name-title">{{item.productName}}</view>
<view>{{item.briefIntro}}</view>
</view>
<view class="status-btn" @click="mallgoods(item)">
<view class="btn">
<text>购买</text>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
<!-- tabbar -->
<TabBar :tabBarShow="2"></TabBar>
</view>
</template>
<script>
import TabBar from '../../components/TabBar/TabBar.vue';
export default {
components: {
TabBar
},
data() {
return {
Baseapi:"http://zhmz.rsxmzj.cn:8536",
nvConfig: {
title: "殡葬公共服务",
bgColor: "#ffffff",
color: "#000000",
fixedAssist: {
hide: true,
},
transparent: {
initColor: "#000",
},
back: {
hide: true
},
},
navigation:[
{
name:"全部",
checked:true
},
{
name:"分类一",
checked:false
},
{
name:"分类二",
checked:false
},
],
list:[],
lists:[],
};
},
onPageScroll(e) {
this.$refs.nv.pageScroll(e)
},
computed: {
pageTop() {
return parseInt(88 * uni.getSystemInfoSync().windowWidth / 750) + uni.getSystemInfoSync().statusBarHeight
}
},
onLoad() {
uni.hideTabBar();
this.getcpxq();
},
onshow(){
this.getcpxq();
},
methods: {
home() {
uni.navigateTo({
url: '/pages/home/home'
})
},
mallgoods(item) {
var info = JSON.stringify(item)
uni.navigateTo({
url: '/pages/mallgoods/mallgoods?info=' + info
})
},
// 导航选择
dhxz(index,name){
console.log(index,name);
this.list = []
for(let i = 0;i < this.navigation.length;i++){
if(index == i){
this.navigation[i].checked = true
}else{
this.navigation[i].checked = false
}
}
for(var i = 0;i < this.lists.length;i++){
if(name == '全部'){
this.list = this.lists
return
}
console.log(this.lists[i].productCategory,name);
if(this.lists[i].productCategory == name){
this.list.push(this.lists[i])
}
}
},
// 获取列表数据
getcpxq(){
this.API.getcpxq().then(res=>{
console.log("列表数据",res);
this.list = res.rows;
this.lists = res.rows;
})
},
}
}
</script>
<style scoped lang="scss">
@import 'mall.scss';
</style>