oneMallList.vue
3.16 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
<template>
<view>
<headerComp :leftImgSrc="leftSrc" @leftClick="backClick" :title="titleStr"></headerComp>
<searchBox @handleEvent="searchFun"></searchBox>
<view class="list">
<view class="listItem" @click="itemFun(item)" v-for="item in list">
<text>{{item.name}}</text>
</view>
</view>
<!-- <uni-list>
<uni-list-item :title="this.$t('index').allStore" @click="selectStore(id)"></uni-list-item>
<uni-list-item :title="item.name" @click="selectStore(item.id,item.name)" v-for="item in list"></uni-list-item>
</uni-list> -->
</view>
</template>
<script>
import headerComp from '../../components/header'
import searchBox from '../../components/search'
export default{
data(){
return{
aa:"aa",
leftSrc:'../../static/header/backArrow.png',
titleStr:this.$t('index').storeSelect,
id:'',
atoken:'',
list:[],
allList:[],
accountName:'',
url:'',
selectSrc:'../../static/list/select.png',
unSelectSrc:'../../static/list/unselect.png',
selectIdArr:[],
selectNameArr:[],
type:''
}
},
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
// this.atoken=option.atoken;
// this.id=option.accountId;
this.url=option.url;
this.type=option.type;
uni.getStorage({
key:'accountName',
success:(res)=>{
this.accountName=res.data;
}
})
uni.getStorage({
key:'accountId',
success:(res)=>{
this.id=res.data;
}
})
uni.getStorage({
key:'atoken',
success:(res)=>{
this.atoken=res.data;
}
})
this.getListData();
},
computed: {
i18n(){
return this.$t('index')
}
},
components:{
headerComp,searchBox
},
methods: {
searchFun(val){
this.list=[];
this.allList.forEach(item=>{
if(item.name.indexOf(val)!=-1){
this.list.push(item)
}
})
},
itemFun(item){
this.selectIdArr=[];
this.selectNameArr=[]
this.selectNameArr.push(item.name)
this.selectIdArr.push(item.id)
this.confirmFun();
},
confirmFun(){
uni.removeStorage({
key: 'selectGateNameArr',
success: function (res) {
console.log('success');
}
});
uni.removeStorage({
key: 'selectFloorNameArr',
success: function (res) {
console.log('success');
}
});
uni.setStorage({
key:'selectAccountIdArr',
data:JSON.stringify(this.selectIdArr)
})
uni.setStorage({
key:'selectAccountNameArr',
data:JSON.stringify(this.selectNameArr)
})
uni.reLaunch({
url:this.url+'?type='+this.type,
})
},
getListData(){
uni.getStorage({
key:'accountList',
success:(res)=>{
this.allList=JSON.parse(res.data);
this.list=JSON.parse(res.data);
}
})
},
backClick() {
uni.navigateBack({
delta:1
})
}
},
}
</script>
<style>
.listItem{
border-bottom: 1px solid #979797;
height: 72.46upx;
line-height: 72.46upx;
font-size: 23.55upx;
background: #FFFFFF;
position: relative;
}
.listItem>image{
width: 28.98upx;
height: 28.98upx;
position: absolute;
top:23.55upx;
left: 25.36upx;
}
.listItem text{
margin-left: 77.89upx;
}
</style>