hengmei-one/pages/tabbar/shop/shop.vue

138 lines
5.7 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'商城'" :statusBack="false" :statusTitle="true"></status-nav>
<!-- 搜索输入框 -->
<view class="search-input-box bacf" :style="{top: statusHNH+'px'}" style="position: fixed;left: 0;right: 0;">
<view class="disac pad-zy30 mar-s20">
<!-- 输入框 -->
<input style="border: 2rpx solid #E0E0E0;padding: 0rpx 20rpx;height: 80rpx;line-height: 80rpx;" class="width100 fon34 radius10" type="text" v-model="searchVal" placeholder="请输入商品名称"/>
<!-- 搜索 -->
<view class="flexs mar-z30 radius10 pad-zy40 fon34 colf" style="height: 80rpx;line-height: 80rpx;" :style="{background:publicColor}">搜索</view>
</view>
<!-- 分类标题 -->
<view style="background: #FFFFFF;font-size: 24rpx;" class="disjbac pad-zy20 pad-s20">
<view v-for="(item,index) in shopCate" @tap="chooseShopCate(index)" :class="activeIndex==index?'activecate':'shopMo'" :style="{background:activeIndex==index?publicColor:'#F2F2F2'}" :key="index"><span>{{item}}</span></view>
</view>
<!-- 筛选结果 -->
<view v-if="isClick" class="pad-zy50 disac fw pad-x20">
<view class="col3 fon28 mar-s30">筛选:</view>
<view v-for="(item,indexx) in shaiList" :key="indexx" style="background: #3875F6;color: #FFFFFF;border-radius: 30rpx;padding: 8rpx 20rpx;font-size: 24rpx;display: flex;align-items: center;margin-right: 20rpx;margin-top: 30rpx;">{{item}} <view class="mar-z10" @tap="deleteSX(indexx)">×</view></view>
</view>
<view v-if="isXiao">
<view class="pad-zy30">
<view class="mar-s50 mar-x20 fon28 bold">{{cateTitle}}</view>
<view class="disac fw">
<view @tap="chooseBing(indexb)" v-for="(itemb,indexb) in bingzList" class="mar-y30 fon26 mar-s30" :key="indexb" :class="bingIndex==indexb?'activebcate':'shopBMo'" :style="{background:bingIndex==indexb?publicColor:'#F2F2F2'}">{{itemb}}</view>
</view>
<view v-if="activeIndex==1">
<view class="fon28 bold mar-sx40">医生选择</view>
<input type="text" class="mar-x40" value="" style="height: 60rpx;border: 2rpx solid #E0E0E0;border-radius: 10rpx;width: 100%;box-sizing: border-box;padding-left: 20rpx;font-size: 24rpx;" placeholder="请输入医生姓名并选择" />
</view>
</view>
<!-- 重置、筛选 -->
<view class="disjbac pad-zy20 mar-s50 mar-x30 pad-s20">
<view @tap="chongz" style="font-size: 28rpx;width: 294rpx;height: 60rpx;border-radius: 10rpx;text-align: center;line-height: 60rpx; background: #E6E6E6;color: #4D4D4D;">重置</view>
<view @tap="shaix" style="font-size: 28rpx;width: 294rpx;height: 60rpx;border-radius: 10rpx;text-align: center;line-height: 60rpx; background: #3875F6;color: #FFFFFF;">筛选</view>
</view>
<view @tap="isXiao=false" style="background: rgba(0,0,0,.54);width: 100%;height: 600rpx;float: left;position: relative;"></view>
</view>
</view>
<!-- 底部tab -->
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='3'></foot-tab>
<!-- 购物车 -->
<navigator url="/pagesA/shopCart/shopCart" hover-class="none">
<view style="position: fixed;right: 30rpx;bottom: 200rpx;">
<view class="posir" style="width: 112rpx;height: 112rpx;">
<image src="/static/public/cart.png" mode="aspectFill" style="width: 112rpx;height: 112rpx;"></image>
<view class="posia" style="background: #F85050;width: 28rpx;height: 28rpx;border-radius: 100%;color: #FFFFFF;font-size: 24rpx;text-align: center;line-height: 28rpx;top: 20rpx;right: 20rpx;"><view style="transform: scale(.8);">99</view></view>
</view>
</view>
</navigator>
</view>
</template>
<script>
export default {
data() {
return {
titleList:[],
imgList:[],
statusHNH:uni.getStorageSync('statusHNH'),
publicColor:uni.getStorageSync('publicColor'),
activeIndex:'-1',
shopCate:['全部病种','全部医生','全部活动'],
cateTitle:'',
bingIndex:0,
bingzList:[],//小分类列表
isXiao:false,//
titleHeight:'',//标题高度
shaiList:[],//筛选后的结果列表
isClick:false,//是否点击了筛选
}
},
onShow() {
this.$toolAll.tools.isLogin()
},
onLoad() {
this.titleList = uni.getStorageSync('footTitle')
this.imgList = uni.getStorageSync('footimg')
// 缓存状态栏+标题栏的高度
const query = wx.createSelectorQuery()
query.select('.search-input-box').boundingClientRect((rect) => {
// console.log('状态栏+标题栏:',rect.height);
this.titleHeight = rect.height
}).exec()
},
methods: {
chooseShopCate(index){//大分类选择事件
this.activeIndex = index;
this.isClick = false;
this.bingIndex = 0;
if(!this.isXiao) {
this.isXiao = true;
}
if(this.activeIndex==0) {
this.cateTitle = '病种选择';
this.bingzList = ['全部','秃顶植发','眉毛种植','发际线种植','耳发种植','胡须种植','植发失败修复','其他'];
}
if(this.activeIndex==1) {
this.cateTitle = '职位选择';
this.bingzList = ['全部','植发','医师','主任'];
}
if(this.activeIndex==2) {
this.cateTitle = '活动选择';
this.bingzList = ['全部','拼团活动','团购活动','限时促销'];
}
},
chooseBing(index){//小分类选择事件
this.bingIndex = index;
let cun = this.shaiList.indexOf(this.bingzList[index]);
if(cun==-1){
this.shaiList.push(this.bingzList[index]);
}
console.log(this.shaiList);
},
chongz(){//重置
this.bingIndex = 0
this.isClick = false;
this.shaiList = []
},
shaix(){//筛选
this.isXiao = false
this.isClick = true;
},
deleteSX(index){//删除筛选
this.shaiList.splice(index,1);
if(this.shaiList.length==0){
this.isClick = false;
}
}
}
}
</script>
<style>
page{background: #F5F5F5;}
</style>