2021-08-19 06:40:59 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view>
|
|
|
|
|
<!-- 状态栏 -->
|
2021-10-11 10:21:06 +00:00
|
|
|
|
<status-nav :titleVal="'商城'" :statusBack="false" :statusTitle="true"></status-nav>
|
2022-04-11 02:12:11 +00:00
|
|
|
|
<view class="bacf shop-nav-box" :style="{marginTop:statusHeight+'px'}">
|
2022-03-09 10:06:05 +00:00
|
|
|
|
<view class="disac pad-zy30 mar-sx20 pad-s20">
|
2021-10-11 10:21:06 +00:00
|
|
|
|
<!-- 输入框 -->
|
2021-11-04 07:41:53 +00:00
|
|
|
|
<input class="width100 fon34 radius10" type="text" @confirm="searchEv" v-model="searchVal" placeholder="请输入商品名称"/>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
<!-- 搜索 -->
|
2021-10-22 03:07:32 +00:00
|
|
|
|
<view class="flexs mar-z30 radius10 pad-zy40 fon34 colf" @tap="searchEv" :style="{background:publicColor}">搜索</view>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
</view>
|
2022-03-04 08:48:40 +00:00
|
|
|
|
<!-- 自定义轮播 -->
|
|
|
|
|
<swiper-pu :bannerList="bannerList" :isplay="isAutoPlay"></swiper-pu>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 搜索输入框 -->
|
2022-04-11 02:12:11 +00:00
|
|
|
|
<view class="search-input-box bacf shop-nav-box" :style="{top: statusHeight+'px',position:positionMode}" style="padding-top: 10rpx;left: 0;right: 0;z-index: 3;">
|
2021-10-11 10:21:06 +00:00
|
|
|
|
<!-- 分类标题 -->
|
|
|
|
|
<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>
|
2021-11-10 11:23:11 +00:00
|
|
|
|
<view v-if="bingVal!=''">{{bingVal}}<view class="mar-z10" @tap="deleteSX(0)">×</view></view>
|
|
|
|
|
<view v-if="doctorVal!=''">{{doctorVal}}<view class="mar-z10" @tap="deleteSX(1)">×</view></view>
|
|
|
|
|
<view v-if="activityVal!=''">{{activityVal}}<view class="mar-z10" @tap="deleteSX(2)">×</view></view>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
</view>
|
2022-03-21 01:44:07 +00:00
|
|
|
|
<view v-if="isXiao" @tap="doctorBlur">
|
2021-10-11 10:21:06 +00:00
|
|
|
|
<view class="pad-zy30">
|
|
|
|
|
<view class="mar-s50 mar-x20 fon28 bold">{{cateTitle}}</view>
|
|
|
|
|
<view class="disac fw">
|
2021-11-08 07:50:30 +00:00
|
|
|
|
<view @tap.stop="chooseBing(indexb)" v-for="(itemb,indexb) in bingzList" class="mar-y30 fon26 mar-s30" :key="indexb" :class="itemb.isActive?'activebcate':'shopBMo'" :style="{background:itemb.isActive?publicColor:'#F2F2F2'}">{{itemb.title}}</view>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view v-if="activeIndex==1">
|
|
|
|
|
<view class="fon28 bold mar-sx40">医生选择</view>
|
2021-11-04 07:41:53 +00:00
|
|
|
|
<view class="posir">
|
2022-03-24 08:32:33 +00:00
|
|
|
|
<input @tap.stop="chooseEv" type="text" disabled class="mar-x40" v-model="doctor_name" placeholder="请点击选择医生" />
|
2022-03-21 01:44:07 +00:00
|
|
|
|
<view v-if="showDoctor" class="posia" style="top: 52px;left: 0;right: 0;border: 1rpx solid #E6E6E6;padding: 20rpx;background: #FFFFFF;max-height: 400rpx;overflow: hidden;overflow-y: scroll;">
|
|
|
|
|
<view @tap.stop="chooseDoctor(index)" class="disjbac fon28 col9" v-for="(item,index) in doctorList" :key="index">
|
2021-11-04 07:41:53 +00:00
|
|
|
|
<span>姓名:{{item.doctor_extra.name}}</span>
|
2022-01-24 05:53:00 +00:00
|
|
|
|
<!-- <span>部门:{{item.doctor_extra.skill}}</span> -->
|
2021-11-04 07:41:53 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 重置、筛选 -->
|
|
|
|
|
<view class="disjbac pad-zy20 mar-s50 mar-x30 pad-s20">
|
2022-03-21 01:44:07 +00:00
|
|
|
|
<view @tap.stop="chongz">重置</view>
|
2021-11-08 07:50:30 +00:00
|
|
|
|
<view @tap.stop="shaix">筛选</view>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2022-03-21 01:44:07 +00:00
|
|
|
|
<view v-if="isXiao" @tap="closePop" class="moban"></view>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
<!-- 数据列表 -->
|
2022-02-15 08:02:16 +00:00
|
|
|
|
<!-- <view v-if="loading" :style="{marginTop:statusHNH+titleHeight+(isClick?52:0)+'px'}"> -->
|
2022-03-04 08:48:40 +00:00
|
|
|
|
<view v-if="loading" :style="{marginTop:(gaodu==242?titleHeight : 0)+'px'}">
|
2021-11-10 11:23:11 +00:00
|
|
|
|
<view v-if="dataList.length!=0 && search_result" class="pad20 ">
|
|
|
|
|
<view style="width: 48.6%;float: left;" class="pad-x180">
|
|
|
|
|
<view v-if="index1%2==0" v-for="(item1,index1) in dataList" :key="index1" class="bacf radius15 mar-x20 animated fadeIn posir" @tap="goPage(item1.id,index1)">
|
|
|
|
|
<image :src="item1.imgSrc" mode="aspectFill" style="width: 100%;border-top-left-radius: 15rpx;border-top-right-radius: 15rpx;height: 325rpx;"></image>
|
|
|
|
|
<view class="pad-zy20 pad-s10 pad-x30">
|
|
|
|
|
<view class="fon28 bold col3 clips2">{{item1.title}}</view>
|
|
|
|
|
<view class="disac fon20 mar-sx20" v-if="!item1.isIntegral">
|
|
|
|
|
<view class="radius10 colf mar-y10" style="padding: 6rpx 10rpx;" :style="{background:publicColor}">{{item1.disease_name}}</view>
|
|
|
|
|
<view class="radius10 colf" v-if="item1.isTuan" style="padding: 6rpx 10rpx;background: #F85050;">团购</view>
|
|
|
|
|
<view class="radius10 colf" v-if="item1.isPing" style="padding: 6rpx 10rpx;background: #F85050;">拼团活动</view>
|
|
|
|
|
<view class="radius10 colf" v-if="item1.isXian" style="padding: 6rpx 10rpx;background: #F85050;">限时促销</view>
|
|
|
|
|
</view>
|
2022-04-08 09:54:56 +00:00
|
|
|
|
<view class="disjbac" :class="item1.isIntegral ? '' : 'fw'">
|
2022-02-28 06:46:40 +00:00
|
|
|
|
<view class="disac">
|
|
|
|
|
<view class="fon28 bold" style="color: #F85050;margin-right: 8rpx;">
|
|
|
|
|
<view v-if="item1.isIntegral" class="mar-s20">
|
|
|
|
|
<view>积分:{{item1.integral}}</view>
|
|
|
|
|
<view class="disac mar-s20" v-if="item1.grade!=0">
|
|
|
|
|
<image src="/static/public/huiy.png" style="width: 40rpx;height: 33rpx;" mode=""></image>
|
|
|
|
|
<view class="fon24 col3 mar-z10">{{item1.level_text}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-else>
|
|
|
|
|
<span v-if="item1.isPing">拼团价</span>
|
|
|
|
|
<span v-if="item1.isXian">促销价</span>
|
|
|
|
|
¥{{item1.zhePrice}}
|
2021-11-10 11:23:11 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2022-02-28 06:46:40 +00:00
|
|
|
|
<!-- <view v-if="item1.isXian || item1.isPing || item1.isTuan" class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥{{item1.yuanPrice}}</view> -->
|
|
|
|
|
<view class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥{{item1.yuanPrice}}</view>
|
2021-11-10 11:23:11 +00:00
|
|
|
|
</view>
|
2022-04-08 09:54:56 +00:00
|
|
|
|
<view class="fon24 flexs" style="color: #C7C7C7;">销量:{{item1.amount}}</view>
|
2021-11-10 11:23:11 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view v-if="item1.isPing" class="disjbac mar-s20">
|
|
|
|
|
<view class="fon24 col80">已拼团{{item1.activity_group_num}}组</view>
|
|
|
|
|
<view class="disac">
|
|
|
|
|
<image v-for="(itemm,indexm) in item1.activity_group_cover" :key="indexm" :src="itemm" mode="" style="width: 40rpx;height: 40rpx;border-radius: 100%;margin-left: -20rpx;"></image>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="item1.isXian || item1.isPing || item1.isTuan" class="fon24 col80 mar-s20">结束时间:{{item1.activity_end_at}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view style="width: 48.6%;float: right;" class="pad-x180">
|
|
|
|
|
<view v-if="index1%2!=0" v-for="(item1,index1) in dataList" :key="index1" class="bacf radius15 mar-x20 animated fadeIn posir" @tap="goPage(item1.id,index1)">
|
|
|
|
|
<image :src="item1.imgSrc" mode="aspectFill" style="width: 100%;border-top-left-radius: 15rpx;border-top-right-radius: 15rpx;height: 325rpx;"></image>
|
|
|
|
|
<view class="pad-zy20 pad-s10 pad-x30">
|
|
|
|
|
<view class="fon28 bold col3 clips2">{{item1.title}}</view>
|
|
|
|
|
<view class="disac fon20 mar-sx20" v-if="!item1.isIntegral">
|
|
|
|
|
<view class="radius10 colf mar-y10" style="padding: 6rpx 10rpx;" :style="{background:publicColor}">{{item1.disease_name}}</view>
|
|
|
|
|
<view class="radius10 colf" v-if="item1.isTuan" style="padding: 6rpx 10rpx;background: #F85050;">团购</view>
|
|
|
|
|
<view class="radius10 colf" v-if="item1.isPing" style="padding: 6rpx 10rpx;background: #F85050;">拼团活动</view>
|
|
|
|
|
<view class="radius10 colf" v-if="item1.isXian" style="padding: 6rpx 10rpx;background: #F85050;">限时促销</view>
|
|
|
|
|
</view>
|
2022-04-08 10:41:09 +00:00
|
|
|
|
<view class="disjbac" :class="item1.isIntegral ? '' : 'fw'">
|
2022-02-28 06:46:40 +00:00
|
|
|
|
<view class="disac">
|
|
|
|
|
<view class="fon28 bold" style="color: #F85050;margin-right: 8rpx;">
|
|
|
|
|
<view v-if="item1.isIntegral" class="mar-s20">
|
|
|
|
|
<view>积分:{{item1.integral}}</view>
|
|
|
|
|
<view class="disac mar-s20" v-if="item1.grade!=0">
|
|
|
|
|
<image src="/static/public/huiy.png" style="width: 40rpx;height: 33rpx;" mode=""></image>
|
|
|
|
|
<view class="fon24 col3 mar-z10">{{item1.level_text}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-else>
|
|
|
|
|
<span v-if="item1.isPing">拼团价</span>
|
|
|
|
|
<span v-if="item1.isXian">促销价</span>
|
|
|
|
|
¥{{item1.zhePrice}}
|
2021-11-10 11:23:11 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2022-02-28 06:46:40 +00:00
|
|
|
|
<!-- <view v-if="item1.isXian || item1.isPing || item1.isTuan" class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥{{item1.yuanPrice}}</view> -->
|
|
|
|
|
<view class="fon24" style="text-decoration: line-through;color: #C7C7C7;">¥{{item1.yuanPrice}}</view>
|
2021-11-10 11:23:11 +00:00
|
|
|
|
</view>
|
2022-04-08 09:54:56 +00:00
|
|
|
|
<view class="fon24 flexs" style="color: #C7C7C7;">销量:{{item1.amount}}</view>
|
2021-11-10 11:23:11 +00:00
|
|
|
|
</view>
|
|
|
|
|
<view v-if="item1.isPing" class="disjbac mar-s20">
|
|
|
|
|
<view class="fon24 col80">已拼团{{item1.activity_group_num}}组</view>
|
|
|
|
|
<view class="disac">
|
|
|
|
|
<image v-for="(itemm,indexm) in item1.activity_group_cover" :key="indexm" :src="itemm" mode="" style="width: 40rpx;height: 40rpx;border-radius: 100%;margin-left: -20rpx;"></image>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view v-if="item1.isXian || item1.isPing || item1.isTuan" class="fon24 col80 mar-s20">结束时间:{{item1.activity_end_at}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 弹框 -->
|
|
|
|
|
<pu-po :isShowT="isShowT" :contentVal="pu_content" @comfirmev="submitQu" @cancleev="isShowT=false"></pu-po>
|
|
|
|
|
</view>
|
2021-11-08 07:50:30 +00:00
|
|
|
|
<nothing-page v-if="dataList.length==0" :content="`暂无更多商品列表`"></nothing-page>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
</view>
|
2021-08-19 06:40:59 +00:00
|
|
|
|
<!-- 底部tab -->
|
2021-08-19 09:27:37 +00:00
|
|
|
|
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='3'></foot-tab>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
<!-- 购物车 -->
|
2023-01-04 07:09:21 +00:00
|
|
|
|
<navigator :url="'/pagesA/shopCart/shopCart?isScore=false'" hover-class="none">
|
2021-10-22 03:07:32 +00:00
|
|
|
|
<view class="cart-box">
|
|
|
|
|
<view class="posir">
|
|
|
|
|
<image src="/static/public/cart.png" mode="aspectFill"></image>
|
2021-11-02 10:23:53 +00:00
|
|
|
|
<view class="posia" v-if="cartNum!=0"><view>{{cartNum}}</view></view>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</navigator>
|
2022-03-04 08:48:40 +00:00
|
|
|
|
<!-- 用户信息授权,手机号授权 -->
|
|
|
|
|
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
2021-08-19 06:40:59 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
import shopList from '@/components/shop-list.vue';
|
2022-02-15 08:02:16 +00:00
|
|
|
|
import swiperPu from '@/components/swiper-pu.vue';
|
|
|
|
|
import {cartNum,checkBanner} from '@/jsFile/publicAPI.js';
|
2021-08-19 06:40:59 +00:00
|
|
|
|
export default {
|
2021-10-11 10:21:06 +00:00
|
|
|
|
components:{
|
2022-02-15 08:02:16 +00:00
|
|
|
|
shopList,
|
|
|
|
|
swiperPu
|
2021-10-11 10:21:06 +00:00
|
|
|
|
},
|
2021-08-19 06:40:59 +00:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
2021-10-11 10:21:06 +00:00
|
|
|
|
activeIndex:'-1',
|
2021-12-02 09:31:26 +00:00
|
|
|
|
shopCate:['全部分类','全部医生','全部活动'],
|
2021-10-11 10:21:06 +00:00
|
|
|
|
cateTitle:'',
|
|
|
|
|
bingzList:[],//小分类列表
|
2021-10-22 03:07:32 +00:00
|
|
|
|
zanBingArr:[],//暂存小分类
|
2021-10-11 10:21:06 +00:00
|
|
|
|
isXiao:false,//
|
|
|
|
|
titleHeight:'',//标题高度
|
|
|
|
|
shaiList:[],//筛选后的结果列表
|
|
|
|
|
isClick:false,//是否点击了筛选
|
2021-10-22 03:07:32 +00:00
|
|
|
|
dataList:[],
|
|
|
|
|
searchVal:'',//关键词
|
|
|
|
|
doctor_role:'',//医生从职位标识 从商品筛选条件接口获取 目前为doctor=医生 design=设计师
|
|
|
|
|
doctor_name:'',//医生姓名 模糊搜索
|
|
|
|
|
activity:'',//活动类型 不填为普通商品+活动商品 normal=普通商品;group_make=拼团;group_buy=团购;limit_time=限时促销
|
|
|
|
|
disease_id:'',//病种ID
|
2021-11-02 10:23:53 +00:00
|
|
|
|
loading:false,
|
2021-11-04 07:41:53 +00:00
|
|
|
|
cartNum:0,
|
|
|
|
|
doctorList:[],
|
2021-11-10 11:23:11 +00:00
|
|
|
|
showDoctor:false,
|
|
|
|
|
timeList:[],//时间列表
|
|
|
|
|
zanArr:[],
|
|
|
|
|
timer:null,
|
|
|
|
|
search_result:false,
|
|
|
|
|
bingVal:'',
|
|
|
|
|
doctorVal:'',
|
2022-02-09 00:52:28 +00:00
|
|
|
|
activityVal:'',
|
2022-02-15 08:02:16 +00:00
|
|
|
|
bannerList:[],//轮播图
|
|
|
|
|
isAutoPlay:false,
|
2022-02-09 00:52:28 +00:00
|
|
|
|
optionObj:{},
|
2022-02-15 08:02:16 +00:00
|
|
|
|
positionMode:'sticky',
|
2022-06-14 05:32:53 +00:00
|
|
|
|
gaodu:0,
|
2023-01-03 06:28:18 +00:00
|
|
|
|
shareData:[],
|
2021-08-19 06:40:59 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-04-02 09:56:53 +00:00
|
|
|
|
computed: {
|
|
|
|
|
// 底部标题
|
|
|
|
|
titleList() {
|
|
|
|
|
return this.$store.state.titleList
|
|
|
|
|
},
|
|
|
|
|
// 底部图标
|
|
|
|
|
imgList() {
|
|
|
|
|
return this.$store.state.imgList
|
|
|
|
|
},
|
|
|
|
|
// 主题颜色
|
|
|
|
|
publicColor() {
|
|
|
|
|
return this.$store.state.publicColor
|
2022-04-11 02:12:11 +00:00
|
|
|
|
},
|
|
|
|
|
statusHeight() {
|
|
|
|
|
return this.$store.state.statusHeight
|
2022-04-02 09:56:53 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-02-15 08:02:16 +00:00
|
|
|
|
onHide() {
|
|
|
|
|
this.isAutoPlay = false;
|
|
|
|
|
},
|
|
|
|
|
onUnload() {
|
|
|
|
|
this.isAutoPlay = false;
|
|
|
|
|
},
|
|
|
|
|
onPageScroll(e) {
|
2022-03-04 08:48:40 +00:00
|
|
|
|
if(e.scrollTop>=242){
|
2022-02-15 08:02:16 +00:00
|
|
|
|
this.positionMode = "fixed";
|
2022-03-04 08:48:40 +00:00
|
|
|
|
this.gaodu = 242;
|
2022-02-15 08:02:16 +00:00
|
|
|
|
} else {
|
|
|
|
|
this.positionMode = "sticky";
|
|
|
|
|
this.gaodu = 0;
|
|
|
|
|
}
|
2021-08-22 08:53:12 +00:00
|
|
|
|
},
|
2022-06-14 05:32:53 +00:00
|
|
|
|
onShareAppMessage(res) {
|
|
|
|
|
// 调用tools.js中的种植埋点事件
|
|
|
|
|
this.$toolAll.tools.plantPoint(6);
|
|
|
|
|
if(`${this.shareData.spu_share_img}` !== ''){
|
|
|
|
|
return {
|
|
|
|
|
title: '', // 默认是小程序的名称(可以写slogan等)
|
|
|
|
|
path: `/pages/tabbar/shop/shop?invite_code=${uni.getStorageSync('invite_code')}` ,// 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
|
|
imageUrl: `${this.$http}${this.shareData.spu_share_img}`//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
return {
|
|
|
|
|
title: '', // 默认是小程序的名称(可以写slogan等)
|
|
|
|
|
path: `/pages/tabbar/shop/shop?invite_code=${uni.getStorageSync('invite_code')}` ,// 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-04-02 09:56:53 +00:00
|
|
|
|
onShow() {
|
2023-01-04 07:09:21 +00:00
|
|
|
|
if(uni.getStorageSync('authorization')==1){
|
|
|
|
|
if(uni.getStorageSync('phone')!=0 && uni.getStorageSync('is_active')!=0) {
|
|
|
|
|
this.cartNumEv();//查询购物车数量
|
|
|
|
|
}
|
|
|
|
|
}else{
|
2022-04-02 09:56:53 +00:00
|
|
|
|
this.cartNumEv();//查询购物车数量
|
|
|
|
|
}
|
|
|
|
|
this.isAutoPlay = true;
|
2022-06-14 05:32:53 +00:00
|
|
|
|
this.$requst.post('index/base-config').then(res=>{
|
|
|
|
|
this.shareData = res.data;
|
|
|
|
|
},error => {})
|
2022-04-02 09:56:53 +00:00
|
|
|
|
},
|
2022-02-09 00:52:28 +00:00
|
|
|
|
onLoad(options) {
|
|
|
|
|
this.optionObj = options;
|
2021-10-11 10:21:06 +00:00
|
|
|
|
// 缓存状态栏+标题栏的高度
|
|
|
|
|
const query = wx.createSelectorQuery()
|
|
|
|
|
query.select('.search-input-box').boundingClientRect((rect) => {
|
|
|
|
|
// console.log('状态栏+标题栏:',rect.height);
|
2021-12-02 09:31:26 +00:00
|
|
|
|
this.titleHeight = rect.height;
|
2021-10-11 10:21:06 +00:00
|
|
|
|
}).exec()
|
2022-03-04 08:48:40 +00:00
|
|
|
|
|
|
|
|
|
// 调用tools.js中的种植埋点事件
|
|
|
|
|
this.$toolAll.tools.plantPoint(12);
|
|
|
|
|
|
2022-02-15 08:02:16 +00:00
|
|
|
|
// 调用查询轮播事件
|
|
|
|
|
this.checkSwi();
|
2022-03-04 08:48:40 +00:00
|
|
|
|
|
2022-12-30 08:39:15 +00:00
|
|
|
|
// if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
|
2022-03-04 08:48:40 +00:00
|
|
|
|
this.checkSX();
|
2022-12-30 08:39:15 +00:00
|
|
|
|
// }
|
2021-08-19 09:27:37 +00:00
|
|
|
|
},
|
2021-08-19 06:40:59 +00:00
|
|
|
|
methods: {
|
2022-02-15 08:02:16 +00:00
|
|
|
|
// 顶部轮播查询事件
|
|
|
|
|
checkSwi(){
|
|
|
|
|
checkBanner({position:'home-banner'}).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
if(res.data.length!=0){
|
|
|
|
|
res.data.forEach(item=>{
|
|
|
|
|
let isVideo = false
|
|
|
|
|
if(item.type!='img') isVideo = true
|
|
|
|
|
let banObj = {
|
|
|
|
|
imgSrc:this.$http + item.src,
|
|
|
|
|
url:item.url,
|
|
|
|
|
isVideo:isVideo,
|
|
|
|
|
poster:this.$http + item.src,
|
|
|
|
|
}
|
|
|
|
|
this.bannerList.push(banObj)
|
|
|
|
|
})
|
|
|
|
|
console.log(this.bannerList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2021-11-04 07:41:53 +00:00
|
|
|
|
chooseDoctor(index){//选择医生
|
2021-11-08 07:50:30 +00:00
|
|
|
|
this.shaiList = [];
|
|
|
|
|
this.doctor_name = this.doctorList[index].doctor_extra.name;
|
|
|
|
|
this.shaiList.push(this.doctor_name);
|
2021-11-04 07:41:53 +00:00
|
|
|
|
this.showDoctor = false;
|
|
|
|
|
},
|
|
|
|
|
chooseEv(){//查询医生列表
|
2022-03-21 01:44:07 +00:00
|
|
|
|
this.$requst.post('user/doctor-list',{page:1,size:1000}).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
this.doctor_name = '';
|
|
|
|
|
if(res.data.list.length!=0){
|
|
|
|
|
this.showDoctor = true;
|
|
|
|
|
this.doctorList = res.data.list;
|
|
|
|
|
} else this.$toolAll.tools.showToast('暂无医生可选');
|
|
|
|
|
} else this.$toolAll.tools.showToast(res.msg);
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 医生选择失去焦点
|
|
|
|
|
doctorBlur(){
|
|
|
|
|
setTimeout(()=>{
|
2022-02-28 06:46:40 +00:00
|
|
|
|
this.showDoctor = false;
|
2022-03-21 01:44:07 +00:00
|
|
|
|
},500)
|
|
|
|
|
},
|
|
|
|
|
closePop(){
|
|
|
|
|
this.isXiao = false;
|
|
|
|
|
this.showDoctor = false;
|
2021-11-04 07:41:53 +00:00
|
|
|
|
},
|
2021-11-02 10:23:53 +00:00
|
|
|
|
cartNumEv(){//购物车数量
|
|
|
|
|
this.$requst.post('order/shopping-cart-count',{type:'spu'}).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
this.cartNum = res.data.count;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2021-10-22 03:07:32 +00:00
|
|
|
|
async checkSX(){//商品筛选条件
|
|
|
|
|
this.$requst.get('spu/condition').then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
this.zanBingArr = res.data;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
await this.checkShopList();
|
|
|
|
|
},
|
2021-10-11 10:21:06 +00:00
|
|
|
|
chooseShopCate(index){//大分类选择事件
|
2021-10-22 03:07:32 +00:00
|
|
|
|
if(this.activeIndex==index && this.isXiao) {
|
|
|
|
|
this.isXiao = false;
|
|
|
|
|
} else this.isXiao = true;
|
|
|
|
|
this.bingzList = [];
|
2021-11-08 07:50:30 +00:00
|
|
|
|
this.doctor_name = '';//清空医生列表
|
2021-10-11 10:21:06 +00:00
|
|
|
|
this.isClick = false;
|
2021-10-22 03:07:32 +00:00
|
|
|
|
this.activeIndex = index;
|
|
|
|
|
let arr = [];
|
|
|
|
|
let obj = {};
|
2021-10-11 10:21:06 +00:00
|
|
|
|
if(this.activeIndex==0) {
|
2021-12-02 09:31:26 +00:00
|
|
|
|
this.cateTitle = '项目选择';
|
2021-10-22 03:07:32 +00:00
|
|
|
|
this.zanBingArr.disease.forEach(item=>{
|
|
|
|
|
obj = {
|
|
|
|
|
pid: item.pid,
|
|
|
|
|
title: item.name,
|
|
|
|
|
id: item.id,
|
|
|
|
|
sort: item.sort,
|
|
|
|
|
isActive:false
|
|
|
|
|
}
|
|
|
|
|
arr.push(obj);
|
|
|
|
|
})
|
|
|
|
|
this.bingzList = arr;
|
|
|
|
|
this.bingzList.unshift({pid: '', title: "全部", id: '', sort: '',isActive:true});
|
|
|
|
|
this.bingzList.push({pid: '', title: "其他", id: '', sort: ''});
|
2021-10-11 10:21:06 +00:00
|
|
|
|
}
|
|
|
|
|
if(this.activeIndex==1) {
|
|
|
|
|
this.cateTitle = '职位选择';
|
2021-10-22 03:07:32 +00:00
|
|
|
|
this.zanBingArr.doctor_roles.forEach(item=>{
|
|
|
|
|
obj = {
|
|
|
|
|
id: item.id,
|
|
|
|
|
name: item.name,
|
|
|
|
|
title: item.title,
|
|
|
|
|
pid: item.pid,
|
|
|
|
|
is_group: item.is_group,
|
|
|
|
|
isActive:false
|
|
|
|
|
}
|
|
|
|
|
arr.push(obj);
|
|
|
|
|
})
|
|
|
|
|
this.bingzList = arr;
|
|
|
|
|
this.bingzList.unshift({id: '', name: '', title: "全部", pid: '', is_group: '',isActive:true});
|
2021-10-11 10:21:06 +00:00
|
|
|
|
}
|
|
|
|
|
if(this.activeIndex==2) {
|
|
|
|
|
this.cateTitle = '活动选择';
|
2021-10-22 03:07:32 +00:00
|
|
|
|
this.zanBingArr.activity.forEach(item=>{
|
|
|
|
|
obj = {
|
|
|
|
|
name: item.name,
|
|
|
|
|
title: item.title,
|
|
|
|
|
isActive:false
|
|
|
|
|
}
|
|
|
|
|
arr.push(obj);
|
|
|
|
|
})
|
|
|
|
|
this.bingzList = arr;
|
|
|
|
|
this.bingzList.unshift({name: '', title: "全部",isActive:true});
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-11-10 11:23:11 +00:00
|
|
|
|
checkShopList(){//查询商品的收藏列表
|
2021-11-08 07:50:30 +00:00
|
|
|
|
let keyWord = this.searchVal;
|
|
|
|
|
if(this.shaiList.length!=0) keyWord = this.shaiList.filter(item=>item!=null).join(',');
|
2021-10-22 03:07:32 +00:00
|
|
|
|
let params = {
|
2021-11-08 07:50:30 +00:00
|
|
|
|
keyword:'',//商品关键字 支持模糊搜索
|
2021-10-22 03:07:32 +00:00
|
|
|
|
page:1,
|
2021-11-02 10:23:53 +00:00
|
|
|
|
size:2000,
|
2021-10-22 03:07:32 +00:00
|
|
|
|
doctor_role:this.doctor_role,//医生从职位标识 从商品筛选条件接口获取 目前为doctor=医生 design=设计师
|
|
|
|
|
doctor_name:this.doctor_name,//医生姓名 模糊搜索
|
|
|
|
|
activity:this.activity,//活动类型 不填为普通商品+活动商品 normal=普通商品;group_make=拼团;group_buy=团购;limit_time=限时促销
|
|
|
|
|
disease_id:this.disease_id//病种ID
|
2021-10-11 10:21:06 +00:00
|
|
|
|
}
|
2021-11-02 10:23:53 +00:00
|
|
|
|
uni.request({
|
2022-02-17 03:49:34 +00:00
|
|
|
|
url:`${uni.getStorageSync('hostapi')}spu/list`,
|
2021-11-02 10:23:53 +00:00
|
|
|
|
data:params,
|
|
|
|
|
method:'post',
|
|
|
|
|
header:{
|
|
|
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
|
|
|
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
|
|
|
|
|
},
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if(res.data.code==0){
|
2021-11-10 11:23:11 +00:00
|
|
|
|
clearInterval(this.timer);
|
|
|
|
|
// if(this.page==1) {
|
|
|
|
|
this.zanArr = [];
|
|
|
|
|
this.dataList = [];
|
|
|
|
|
this.timeList = [];
|
|
|
|
|
// }
|
|
|
|
|
this.total = res.data.total;
|
2021-11-02 10:23:53 +00:00
|
|
|
|
if(res.data.data.list.length!=0){
|
|
|
|
|
res.data.data.list.forEach(item=>{
|
|
|
|
|
let tuan = false,ping = false,xian = false,integral = false;
|
|
|
|
|
if(item.activity_type=='group_make') ping = true;
|
|
|
|
|
if(item.activity_type=='group_buy') tuan = true;
|
|
|
|
|
if(item.activity_type=='limit_time') xian = true;
|
|
|
|
|
let group_cover = [];
|
|
|
|
|
if(item.activity_group_cover.length!=0) {
|
|
|
|
|
item.activity_group_cover.forEach(item=>{
|
2022-04-08 09:54:56 +00:00
|
|
|
|
// group_cover.push(this.$http + item)
|
|
|
|
|
group_cover.push(item)
|
2021-11-02 10:23:53 +00:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let obj = {
|
|
|
|
|
id:item.id,
|
|
|
|
|
imgSrc: this.$http + item.cover,
|
|
|
|
|
title: item.name,
|
|
|
|
|
zhePrice:item.price/100,
|
|
|
|
|
yuanPrice:item.original_price/100,
|
|
|
|
|
integral:'',
|
2022-02-28 06:46:40 +00:00
|
|
|
|
amount:item.amount,//销量
|
2021-11-02 10:23:53 +00:00
|
|
|
|
isTuan:tuan,//是否是团购
|
|
|
|
|
isPing:ping,//是否是拼团活动
|
|
|
|
|
isXian:xian,//是否是限时活动
|
|
|
|
|
isIntegral:integral,//是否是积分
|
|
|
|
|
grade:'',
|
|
|
|
|
disease_name:item.disease_name,//病种名称
|
|
|
|
|
reponseTime:res.header.Date,//接口响应时间
|
|
|
|
|
activity_end_at:item.activity_end_at,//限时结束时间
|
|
|
|
|
activity_group_cover:group_cover,//参团人的头像
|
|
|
|
|
activity_group_num:item.activity_group_num,//已经参团人数
|
2022-02-15 08:02:16 +00:00
|
|
|
|
activity_id:item.activity_id,
|
|
|
|
|
spu_type:item.spu_type//是否是虚拟商品
|
2021-11-02 10:23:53 +00:00
|
|
|
|
}
|
2021-11-10 11:23:11 +00:00
|
|
|
|
this.zanArr.push(obj)
|
|
|
|
|
})
|
|
|
|
|
this.zanArr.forEach((item,index)=>{
|
|
|
|
|
if(item.activity_end_at!='') {
|
|
|
|
|
let obj = {
|
|
|
|
|
id:item.id,
|
|
|
|
|
reponseTime:item.reponseTime,
|
|
|
|
|
time:item.activity_end_at,
|
|
|
|
|
nIndex:index
|
|
|
|
|
}
|
|
|
|
|
this.timeList.push(obj);
|
|
|
|
|
}
|
2021-11-02 10:23:53 +00:00
|
|
|
|
})
|
2021-12-02 09:31:26 +00:00
|
|
|
|
if(this.timeList.length!=0){
|
2021-11-10 11:23:11 +00:00
|
|
|
|
this.$toolAll.tools.showToast('加载中...')
|
|
|
|
|
this.timer = setInterval(()=>{//定时器
|
|
|
|
|
if(this.timeList.length!=0){
|
|
|
|
|
this.timeList.forEach((item,index)=>{
|
|
|
|
|
if(item.id==this.zanArr[item.nIndex].id){
|
|
|
|
|
let endTime = new Date(this.timeList[index].time).getTime();//把结束时间转时间戳
|
|
|
|
|
this.timeList[index].reponseTime = new Date(this.timeList[index].reponseTime).getTime() + 1000;//请求接口的时间递增,即:开始时间
|
|
|
|
|
if(this.timeList[index].reponseTime - endTime >=0) {//如果开始时间的时间戳 - 结束时间的时间戳 >= 0 活动结束
|
|
|
|
|
this.zanArr[item.nIndex].activity_end_at = "活动已结束";
|
|
|
|
|
} else {
|
|
|
|
|
// 继续进行倒计时
|
|
|
|
|
this.zanArr[item.nIndex].activity_end_at = this.$toolAll.tools.dayTime(this.timeList[index].time,this.timeList[index].reponseTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-04-29 11:14:21 +00:00
|
|
|
|
uni.hideToast();
|
2021-11-10 11:23:11 +00:00
|
|
|
|
},1000)
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
this.dataList = this.zanArr;
|
|
|
|
|
this.search_result = true;
|
|
|
|
|
this.loading = true;
|
|
|
|
|
},1000)
|
|
|
|
|
} else {
|
|
|
|
|
this.dataList = this.zanArr;
|
2021-12-02 09:31:26 +00:00
|
|
|
|
this.search_result = true;
|
|
|
|
|
this.loading = true;
|
2021-11-10 11:23:11 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.search_result = true;
|
2021-11-02 10:23:53 +00:00
|
|
|
|
}
|
2021-10-22 03:07:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
2021-10-11 10:21:06 +00:00
|
|
|
|
},
|
2021-11-10 11:23:11 +00:00
|
|
|
|
goPage(id,index){//进入商品详情事件
|
2021-12-20 08:02:27 +00:00
|
|
|
|
let is_activity = 0;
|
|
|
|
|
let shopId = 0;
|
|
|
|
|
if(this.dataList[index].isTuan==true || this.dataList[index].isPing==true || this.dataList[index].isXian==true) {
|
|
|
|
|
is_activity = 1;
|
|
|
|
|
shopId = this.dataList[index].activity_id;
|
|
|
|
|
} else {
|
|
|
|
|
shopId = id;
|
|
|
|
|
}
|
2021-11-10 11:23:11 +00:00
|
|
|
|
uni.navigateTo({
|
2021-12-20 08:02:27 +00:00
|
|
|
|
url:`/pagesB/shopDetail/shopDetail?id=${shopId}&isIntegral=${this.dataList[index].isIntegral}&is_activity=${is_activity}`
|
2021-11-10 11:23:11 +00:00
|
|
|
|
})
|
|
|
|
|
},
|
2021-10-11 10:21:06 +00:00
|
|
|
|
chooseBing(index){//小分类选择事件
|
2021-11-02 10:23:53 +00:00
|
|
|
|
this.bingzList.forEach(item=>{
|
|
|
|
|
item.isActive = false;
|
|
|
|
|
})
|
|
|
|
|
this.bingzList[index].isActive = true;
|
2021-11-10 11:23:11 +00:00
|
|
|
|
|
2021-11-08 07:50:30 +00:00
|
|
|
|
// 病种id
|
2021-11-10 11:23:11 +00:00
|
|
|
|
if(this.activeIndex===0) {
|
|
|
|
|
this.disease_id = this.bingzList[index].id;
|
|
|
|
|
this.bingVal = this.bingzList[index].title;
|
|
|
|
|
}
|
2021-11-08 07:50:30 +00:00
|
|
|
|
// 医生职位
|
2021-11-10 11:23:11 +00:00
|
|
|
|
if(this.activeIndex===1) {
|
|
|
|
|
this.doctor_role = this.bingzList[index].name;
|
|
|
|
|
this.doctorVal = this.bingzList[index].title;
|
|
|
|
|
}
|
2021-11-08 07:50:30 +00:00
|
|
|
|
// 活动type
|
2021-11-10 11:23:11 +00:00
|
|
|
|
if(this.activeIndex===2) {
|
|
|
|
|
this.activity = this.bingzList[index].name;
|
|
|
|
|
this.activityVal = this.bingzList[index].title;
|
|
|
|
|
}
|
2021-10-11 10:21:06 +00:00
|
|
|
|
},
|
|
|
|
|
chongz(){//重置
|
|
|
|
|
this.isClick = false;
|
2021-11-10 11:23:11 +00:00
|
|
|
|
this.bingVal = '';
|
|
|
|
|
this.doctorVal = '';
|
|
|
|
|
this.activityVal = '';
|
2021-10-11 10:21:06 +00:00
|
|
|
|
},
|
|
|
|
|
shaix(){//筛选
|
|
|
|
|
this.isXiao = false
|
|
|
|
|
this.isClick = true;
|
2021-10-22 03:07:32 +00:00
|
|
|
|
this.checkShopList();
|
2021-10-11 10:21:06 +00:00
|
|
|
|
},
|
|
|
|
|
deleteSX(index){//删除筛选
|
2021-11-10 11:23:11 +00:00
|
|
|
|
if(index==0) {
|
|
|
|
|
this.disease_id = '';
|
|
|
|
|
this.bingVal = '';
|
|
|
|
|
}
|
|
|
|
|
if(index==1) {
|
|
|
|
|
this.doctor_role = '';
|
|
|
|
|
this.doctorVal = '';
|
|
|
|
|
}
|
|
|
|
|
if(index==2) {
|
|
|
|
|
this.activity = '';
|
|
|
|
|
this.activityVal = '';
|
|
|
|
|
}
|
|
|
|
|
if(this.activity=='' && this.doctorVal == '' && this.activityVal == ''){
|
2021-10-11 10:21:06 +00:00
|
|
|
|
this.isClick = false;
|
|
|
|
|
}
|
2021-11-08 07:50:30 +00:00
|
|
|
|
this.checkShopList();
|
2021-10-22 03:07:32 +00:00
|
|
|
|
},
|
2021-11-04 07:41:53 +00:00
|
|
|
|
searchEv(){//搜索事件
|
2021-11-02 10:23:53 +00:00
|
|
|
|
uni.navigateTo({
|
2021-11-04 07:41:53 +00:00
|
|
|
|
url:`/pagesB/shopSearch/shopSearch?keyWorld=${this.searchVal}`
|
2021-11-02 10:23:53 +00:00
|
|
|
|
})
|
2021-10-11 10:21:06 +00:00
|
|
|
|
}
|
2021-08-19 06:40:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
2021-10-11 10:21:06 +00:00
|
|
|
|
page{background: #F5F5F5;}
|
2021-10-22 03:07:32 +00:00
|
|
|
|
.activecate,.shopMo{width: 216rpx;height: 65rpx;border-radius: 20rpx;line-height: 65rpx;text-align: center;background-color: #f2f2f2;color: #333333;}
|
|
|
|
|
.activecate{color: #FFFFFF;}
|
|
|
|
|
.shopMo span::after,.activecate span::after{display: inline-block;content: '';width: 16rpx;height: 13rpx;margin-left: 6rpx;}
|
|
|
|
|
.shopMo span::after{background: url(/static/public/shopSJ.png) no-repeat;background-size: 100% 90%;}
|
|
|
|
|
.activecate span::after{background: url(/static/public/shopSJ-active.png) no-repeat;background-size: 100% 90%;transform: rotate(180deg);background-position: 0 2rpx;}
|
2021-08-19 06:40:59 +00:00
|
|
|
|
</style>
|