quanwei
2 days ago 73b874c72ad55eb9eef21c36160ac0de58f0189e
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
171
172
173
174
175
176
177
178
179
180
181
<template>
    <view class="store-list-body" :class="Visible ? 'store-list_open' : 'store-list_close'">
        <view class="popup-bg" @click="closePopup"></view>
        <view class="main">
            <!-- 搜索框 -->
            <view class="index-search-box d-b-c" id="searchBox">
                <view class="index-search t-c flex-1">
                    <span class="icon iconfont icon-sousuo"></span>
                    <input type="text" v-model="keyWord" class="flex-1 ml10 f30 gray3" value="" placeholder-class="f24 gray6"
                     placeholder="请输入商家门店名称" confirm-type="search" @confirm="storeSearch()"/>
                </view>
                <!--<button class="btn ml10" @click="search()" type="default">搜索</button>-->
            </view>
            <view class="store-list bg-white">
                <scroll-view scroll-y="true" class="scroll-Y" style="height:500px;" lower-threshold="50">
                    <view class="address p30 d-s-c border-b-e" v-for="(item,index) in storeList" :key="index">
                        <view class="info flex-1" @click="onSelectedStore(item)">
                            <view class="user f34">
                                <text>{{item.store_name}}</text>
                            </view>
                            <!-- 选中状态 -->
                            <view v-if="item.store_id == selectedId" class="shop-item__right">
                                <text class="iconfont icon-iconfontduihaocopy"></text>
                            </view>
                        </view>
                    </view>
                </scroll-view>    
                <!-- 无数据提供的页面 -->
                <view v-if="!isLoading && !storeList.length">
                    <view class="yoshop-notcont">
                        <text class="iconfont icon-wushuju"></text>
                        <text class="cont">亲,暂无可选择的门店哦</text>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>
 
 
<script>
    export default {
        data() {
            return {
                /*数据*/
                listData: [],
                isLoading: true, // 是否正在加载中
                storeList: [], // 门店列表,
                selectedId: -1,
                Visible:false,
                url: '',
                /*没有更多*/
                no_more: false,
                /*当前页面*/
                page: 1,
                search: '',
                list_rows: 100,
                last_page: 0,
                keyWord: '',
            }
        },
        props: ['showStore'],
        watch:{
            showStore(val){
                this.Visible=val;
                if(val){
                    //#ifdef H5
                    if(this.isWeixin()){
                        this.url = window.location.href;
                    }
                    //#endif
                    /*获取地址列表*/
                    
                }
            }
        },
        mounted() {
            this.getData();
        },
        methods: {
            /*获取数据*/
            getData() {
                let self = this;
                self.isLoading = true;
                self._get('store.store/storelist', {
                    search: self.search,
                    page: self.page || 1,
                    list_rows: self.list_rows,
                    sortType: ''
                }, function(res) {
                    self.isLoading = false;
                    self.storeList = self.storeList.concat(res.data.list.data);
                    self.last_page = res.data.list.last_page;
                    if (res.data.list.last_page <= 1) {
                        self.no_more = true;
                    }
                });
            },
            /* 选择门店 */
            onSelectedStore(e) {
                let self = this;
                self.selectedId = e;
                // 设置上级页面的门店id
                self.$fire.fire('selectStoreId',e);    
                this.$emit('close',e);
            },
            closePopup(e) {
                this.$emit('close', e);
            },
            /*搜索*/
            storeSearch(str) {
                let self = this;
                let search = null;
                if(str != null){
                    search = str;
                }else{
                    if(typeof self.keyWord != "undefined" && self.keyWord != null && self.keyWord != ''){
                        search = self.keyWord;
                    }else{
                        return;
                    }
                }
                self.search = search;
                self.page = 1;
                self.storeList = [];
                self.getData();
            },
        }
    }
</script>
 
<style>
    .store-list {
        padding-bottom: 90rpx;
    }
 
    .foot-btns {
        padding: 0;
    }
 
    .foot-btns .btn-red {
        width: 100%;
        height: 90rpx;
        line-height: 90rpx;
        border-radius: 0;
    }
    
    .popup-bg {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99;
    }
    .store-list-body .main {
        position: fixed;
        width: 100%;
        left: 0;
        top: 0;
        min-height: 800rpx;
        max-height: 1400rpx; 
        background-color: #fff;
        transform: translate3d(0, 980rpx, 0);
        transition: transform 0.2s cubic-bezier(0, 0, 0.25, 1);
        padding-bottom: env(safe-area-inset-bottom);
        z-index: 99;
    }
    
    .store-list_open .main {
        transform: translate3d(0, 0, 0);
    }
    
    .store-list_close .popup-bg {
        display: none;
    }
    .store-list_close .main {
        display: none;
    }
</style>