You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
3.2 KiB

3 weeks ago
<template>
<view>
<!-- 选择门店 -->
<uni-popup ref="share" type="share">
<view class="allcon">
<view class="hcon">
<view class="htitle">选择门店 <view class="bottom-line"></view></view>
<view class="rclose" @tap="_cancel">
取消
</view>
</view>
<view class="selcon">
<view class="sitem" v-for="(item,index) in areas" :key="index">
<view class="sname">{{item.value_name}}</view>
<view class="selbtn" :class="item.value_name==city?'cur':''" @click="changeArea(item)" >选择</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { myCache } from '../../utils/utils.js';
export default {
props: {
city: {
type: String,
default: myCache('mycity'),
},
},
data() {
return {
areas:[]
};
},
mounted() {
console.log('mounted')
this.loadarea();
},
computed:{
selcity(){
return this.city;
},
},
methods: {
_show() {
console.log('_show')
this.$refs.share.open();
},
_hide() {
this.$refs.share.close();
},
_cancel() {
this._hide();
this.$emit("cancel", "");
},
changeArea(item){
myCache('mycity',item.value_name);
this.$emit("change", item.value_name);
this._hide();
},
async loadarea(){
const {data: ress} = await uni.$http.get('/api/dict/CITY');
if(ress.data){
this.areas=ress.data;
}
},
}
}
</script>
<style lang="scss" scoped>
.allcon{
width: 750rpx;
/* #ifdef MP-ALIPAY */
height: calc(100vh/2 + 300rpx);
/* #endif */
/* #ifdef MP-WEIXIN */
height: calc(100vh - var(--window-top));
/* #endif */
/* #ifdef H5 */
height: calc(100vh - var(--window-top));
/* #endif */
overflow: hidden;
background-color: #FFFFFF;
margin: 0 auto;
}
.hcon{
display: flex;
flex-direction: row;
padding: 20rpx 20rpx 20rpx;
.htitle{
flex:1;
justify-content: flex-start;
font-size: 32rpx;
font-weight: 600;
letter-spacing: 5rpx;
padding-left: 10rpx;
}
.rclose{
width: 70rpx;
display: flex;
justify-content: flex-start;
font-size: 28rpx;
color:#949494;
}
}
.selcon{
padding: 0;
position: relative;
display: block;
overflow-y: auto;
/* #ifdef MP-ALIPAY */
height: calc(100vh/2 + 200rpx);
/* #endif */
/* #ifdef MP-WEIXIN */
height: calc(100vh - var(--window-top) - 120rpx);
/* #endif */
/* #ifdef H5 */
height: calc(100vh - var(--window-top) - var(--window-bottom) - 120rpx);
/* #endif */
.lineb{
height: 50rpx;
}
.sitem {
display: flex;
flex-direction: row;
background-color: #FFFFFF;
border-top: 1rpx solid #eeeeee;
margin: 16rpx 0;
.selbtn{
width: 100rpx;
height: 44rpx;
display: flex;
justify-content: center;
align-items: center;
margin-right: 20rpx;
background-color: #f0f0f0;
border-radius: 6rpx;
font-size: 26rpx;
color: #999;
margin-top: 16rpx;
}
.selbtn.cur{
background-color: rgb(30, 209, 162);
color: #FFF;
}
.sname{
display: flex;
flex: 1;
justify-content: flex-start;
align-items: center;
flex-direction: row;
font-size: 28rpx;
font-weight: 600;
color: rgb(29, 29, 29);
padding: 10rpx 10rpx 0 10rpx;
margin-left: 20rpx;
}
}
}
</style>