| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644 |
- <template>
- <view v-if="XCXIsSelect=='是'">
- <view style="position: fixed;top: 0;width: 100%;z-index: 999;">
- <view class="flex justify-between align-center bg-white padding-tb padding-lr-sm">
- <view class="flex-sub text-center" :class="current==1?'select':''" @click="confirm(1)">综合排序</view>
- <view class="flex-sub text-center" :class="current==3?'select':''" @click="confirm(3)">距离优先</view>
- <view class="flex-sub text-center" :class="current==4?'select':''" @click="confirm(4)">销量优先</view>
- <view class="flex-sub text-center flex" @click="isShow = !isShow">
- <view class="flex align-center" style="margin: 0 auto;">
- <view :class="isShow?'select':''">筛选</view>
- <u-icon v-if="!isShow" name="arrow-down" size="28"></u-icon>
- <u-icon v-if="isShow" name="arrow-up" color="#558C83" size="28"></u-icon>
- </view>
- </view>
- </view>
- <view v-if="isShow"
- style="position: absolute;top: 90rpx;width: 100%;z-index: 1000;background: rgba(0,0,0,.5);height: 100vh;"
- @click="isShow =false">
- <view class="padding-lr bg-white">
- <view class="flex justify-between align-center padding-tb-sm u-border-bottom"
- v-for="(item,index) in options4" :key='index' @click.stop="getSelect(item)">
- <view class="text-df" :class="item.select?'select':''">{{item.shopTypeName}}</view>
- <u-icon v-if="item.select" name="checkmark" color="#558C83" size="28"></u-icon>
- </view>
- </view>
- </view>
- </view>
-
- <!-- #ifdef H5 -->
- <view class="hd flex justify-center" style="position: fixed;top: 90rpx;" v-if="hdlist.length>0">
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <view class="hd flex justify-center" style="position: fixed;top: 90rpx;" v-if="hdlist.length>0">
- <!-- #endif -->
- <view class="hd-box">
- <scroll-view scroll-x="true" class="scroll-view_H">
- <view class="hd-box-item" :style="currenthd==index?'background-color:#558C83;font-weight:bold':''" @click="searchhd(index,item.activityId)" v-for="(item,index) in hdlist" :key="index">{{item.activityTitle}}</view>
- </scroll-view>
- </view>
- </view>
-
- <!-- #ifdef H5 -->
- <view class="padding-lr-sm" style="margin-top: 80rpx;">
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <view class="padding-lr-sm" style="margin-top: 36px;min-height: 100vh; /* 设置最小高度为视口高度 */">
- <!-- #endif -->
- <view class="shopli" v-for="(item,index) in shopList" :key='index'>
- <view class="margin-tb-sm flex justify-between bg-white padding"
- @click="goNav(item.shopId,item,item.shopActivityList)">
- <image :src="item.shopCover" class="radius" style="width: 160rpx;height: 160rpx;" mode="aspectFill"></image>
- <view class=" margin-left-sm" style="width: 450rpx;">
- <view class=" flex flex-direction justify-between">
- <view class="text-lg text-bold text-black">{{item.shopName}}</view>
- <view class="flex align-center margin-top-xs" style="width: 100%;">
- <text style="color: #FF8205;"> {{item.shopScore?item.shopScore:0}}分</text>
- <text
- class="text-gray flex-sub margin-left-xs">销量{{item.shopSales?item.shopSales:0}}</text>
- <view style="border: 2rpx solid #CCC6C6; border-radius: 8rpx;color: #707070;font-size: 20rpx;padding: 5rpx 8rpx; ">{{item.autoSendOrder==1?'商家配送':'平台配送'}}</view>
- </view>
- <view class="text-gray margin-top-xs flex justify-between">
- <view>起送 ¥{{item.minimumDelivery}} 配送 ¥{{item.errandMoney?item.errandMoney:0}}
- </view>
- <view>
- <text class="text-gray margin-left-xs">{{item.errandTime}}分钟</text>
- <text class="text-gray margin-left-xs">{{item.distance}}</text>
- </view>
- </view>
- <view style="display: flex;" v-if="item.businessHours&&item.lockHours">
- <view class="text-gray margin-top-xs" style="background-color: #FFF5EB;color: #FF8205;border-radius: 8rpx;padding: 5rpx 16rpx;">
- 营业时间:{{item.businessHours}}-{{item.lockHours}}
- </view>
- </view>
- <view class="flex margin-top-xs justify-between align-start" style="width: 100%;">
- <view class="flex flex-wrap align-center" style="width: 100%;height: 100%;overflow: hidden;">
- <view class="lable flex justify-center align-center" v-if="item.enableFullReductionFlag==0&&item.exemptMinMoney">
- 满{{item.exemptMinMoney}}免配送费</view>
- <!-- <view class="lable flex justify-center align-center" v-if="item.exemptMinMoney">满{{item.exemptMinMoney}}免配送费</view> -->
- <view v-for="(ite,ind) in item.shopActivityList" :key='ind' v-if="item.shopActivityList && ite.activityType!='1'">
- <view class="lable flex justify-center align-center" style="border-radius: 8rpx;background-color: #ffffff;color: #FF0000;box-sizing: border-box;">
- <text v-if="ite.activityType=='2'">时段</text>
- <text v-if="ite.activityType=='3'">满额</text>
- <text v-if="ite.activityType=='4'">全场</text>
- <text style="margin-left: 3px;">|</text>
- <text style="margin-left: 3px;">{{ite.activityName}}</text>
- </view>
- <!-- <view class="lable flex justify-center align-center"
- style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;"
- >{{ite.activityName}}
- </view> -->
- </view>
- <view class="lable flex justify-center align-center" v-for="(ite,ind) in item.shopLable" :key='ind'
- v-if="item.shopLable">
- {{ite}}
- </view>
- <view class="lable flex justify-center align-center" v-if="item.couponList" style="border-radius: 8rpx;border: 1rpx solid #F97A7A;background-color: #ffffff;color: #FF0000;box-sizing: border-box;" v-for="(it,ide) in item.couponList" :key="ide">
- <text>优惠券</text>
- <text style="margin-left: 3px;">|</text>
- <text style="margin-left: 3px;">满{{it.minMoney}}减{{it.money}}</text>
- </view>
- <!-- <view class="lable flex justify-center align-center" v-if="item.couponList" style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;" v-for="(it,ide) in item.couponList" :key="ide">满{{it.minMoney}}减{{it.money}}</view> -->
- </view>
- </view>
- </view>
- <view class="flex margin-top-xs">
- <view v-for="(ite,ind) in item.goodsList" :key='ind'
- @click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
- <image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;" class="radius"
- mode=""></image>
- <view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
- <view class="text-bold margin-top-xs" style="color: #FD6416;">
- <text class="text-sm">¥</text> {{ite.goodsMoney}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <empty v-if="!shopList.length"></empty>
-
- <!-- 打样提示 -->
- <view v-if="hintShow" class="hintPopul" @click.stop="hintShow=false">
- <view class="content_">
- <image src="../../../static/images/index/shop.png" mode="" style="width: 200rpx;height: 180rpx;">
- </image>
- <view class="text-xl text-bold">店铺打烊啦</view>
- <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
- <view class="margin-top-xs text-gray margin-bottom">{{shop.businessHours}}-{{shop.lockHours}}</view>
- <view class="skuBtn" @click="hintShow=false">知道了</view>
- </view>
- </view>
- </view>
- <view v-else>
- <view style="font-size: 28upx;" v-html="content"></view>
- </view>
- </template>
- <script>
- import empty from '@/components/empty.vue'
- export default {
- components: {
- empty
- },
- data() {
- return {
- currenthd:-1,
- hdlist:[],
- activityId:'',
- isShow: false,
- hintShow: false,
- shop: {},
- page: 1,
- limit: 10,
- shopList: [],
- current: 1,
- shopTypeId: '',
- userId: '',
- lng: '',
- lat: '',
- value1: 0,
- value2: 0,
- value3: 0,
- value4: 0,
- options1: [{
- label: '综合排序',
- value: 1,
- }],
- options2: [{
- value: '3',
- label: "距离优先"
- }],
- options3: [{
- value: '4',
- label: "销量优先"
- }],
- options4: [{
- id: '',
- select: true,
- shopTypeName: "全部"
- }],
- title: '综合排序',
- title1: '距离优先',
- title2: '销量优先',
- title3: '筛选',
- totalCount: 0,
- XCXIsSelect: '否',
- content:'',
- hintShow: false,
- }
- },
- onLoad(e) {
- console.log(e)
-
- this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
- if (this.XCXIsSelect == '否') {
- this.getGuize()
- uni.setNavigationBarTitle({
- title: '隐私政策'
- });
- } else {
- uni.setNavigationBarTitle({
- title: '店铺列表'
- });
- }
- let that = this
- uni.showLoading({
- title: '加载中',
- mask: true, // 是否显示透明蒙层,防止触摸穿透
- })
- that.shopTypeId = e.value ? e.value : ''
- that.value2 = e.value ? e.value : 0
- that.userId = uni.getStorageSync('userId')
- that.getShopType()
- uni.getLocation({
- type: 'gcj02', //返回可以用于uni.openLocation的经纬度
- success: function(res) {
- that.lat = res.latitude;
- that.lng = res.longitude;
- }
- });
- that.getShopList()
- that.gethdlist();
- },
- methods: {
- //筛选活动
- searchhd(index,activityId){
- if(index==this.currenthd){
- this.currenthd = -1
- this.activityId = '';
- this.getShopList()
- }else{
- this.currenthd = index;
- this.activityId=activityId;
- this.getShopList()
- }
- },
- //获取所有活动
- gethdlist(){
- this.$Request.get("/app/activityManage/getActivityList").then(res => {
- if (res.code == 0) {
- res.data.records.map((item,index)=>{
- if(item.activityId==14){
- res.data.records.splice(index, 1)
- }
- })
- this.hdlist = res.data.records
- }
- });
- },
- // 跳转商品详情
- goDet(goodsId, shopId) {
- let userId = this.$queue.getData('userId');
- // if (!userId) {
- // uni.navigateTo({
- // url: '/pages/public/login'
- // })
- // return
- // }
- uni.navigateTo({
- url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
- })
- },
- getGuize() {
- this.$Request.getT('/app/common/type/237').then(res => {
- if (res.code == 0) {
- this.content = res.data.value;
- // this.tit = res.data.min
- }
- });
- },
- goBack() {
- uni.navigateBack({
- })
- },
- getSelect(e) {
- console.log(e)
- this.options4.forEach(res => {
- if (res.id == e.id) {
- res.select = true
- this.page = 1
- this.shopTypeId = e.id
- this.getShopList();
- this.isShow = false
- } else {
- res.select = false
- }
- })
- },
- confirm(e) {
- console.log(e)
- this.page = 1
- this.current = e;
- this.getShopList();
- },
- confirm2(e) {
- console.log(e)
- this.page = 1
- this.current = e;
- this.getShopList();
- },
- confirm3(e) {
- console.log(e)
- this.page = 1
- this.current = e;
- this.getShopList();
- },
- confirm4(e) {
- console.log(e)
- this.page = 1
- this.shopTypeId = e
- this.getShopList();
- },
- // 商户列表
- getShopList() {
- // this.lng = uni.getStorageSync('lng')
- // this.lat = uni.getStorageSync('lat')
- let data = {
- page: this.page,
- limit: this.limit,
- screen: this.current,
- shopTypeId: this.shopTypeId,
- lng: uni.getStorageSync('lng'),
- lat: uni.getStorageSync('lat'),
- vipPromotion:1
- // activityId: this.activityId,
- }
- console.log(data,'输入数据')
- this.$Request.getT('/app/goods/selectShop', data).then(res => {
- uni.hideLoading()
- if (res.code == 0) {
- console.log(res.data.list)
- this.totalCount = res.data.totalCount
- // 先筛选出 vipPromotion 为 1 的数据
- const vipPromotionList = res.data.list//.filter(ret => ret.vipPromotion === '1');
- vipPromotionList.forEach(ret => {
- if (ret.distance > 1000) {
- ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
- } else {
- if (ret.distance == 0) {
- ret.distance = "0m";
- } else {
- ret.distance = Number(ret.distance).toFixed(1) + "m";
- }
- }
- ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
- ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
- 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.png'
- ret.errandTime = Math.round(ret.errandTime)
- ret.shopScore = ret.shopScore.toFixed(1)
- })
- if (this.page == 1) {
- this.shopList = vipPromotionList
- } else {
- this.shopList = [...this.shopList, ...vipPromotionList]
- }
- console.log(this.shopList)
- }
- })
- },
- // 商户类型
- getShopType() {
- this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
- if (res.code == 0) {
- res.data.forEach(res => {
- res.select = false
- })
- this.options4 = [...this.options4, ...res.data]
- }
- })
- },
- goNav(url,e,shuzu) {
- this.shop = e
- // console.log(e, '当前店铺')
-
- let myDate = new Date();
- let hours = myDate.getHours();
- let minute = myDate.getMinutes();
- let openTime = this.shop.businessHours.split(':')[0] //开始小时
- let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
- let closeTime = this.shop.lockHours.split(':')[0] //结束小时
- let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
- // console.log(hours)
- // console.log(minute)
- // console.log(openTime)
- // console.log(openTime1)
-
- // console.log(closeTime)
- // console.log(closeTime1)
- // console.log(minute >= closeTime1)
- if (hours < openTime) {
- this.hintShow = true
- return
- } else if (hours == openTime && minute < openTime1) {
- this.hintShow = true
- return
- } else if (hours > closeTime) {
- this.hintShow = true
- return
- } else if (hours == closeTime && minute >= closeTime1) {
- this.hintShow = true
- return
- }
-
- // console.log(url)
- let items = encodeURIComponent(JSON.stringify(shuzu));
- // if (this.userId) {
- uni.navigateTo({
- url:'/pages/index/shop/index?shopId='+url+'&huoListss='+items+'&shopTypeId='+e.shopTypeId
- })
- // } else {
- // uni.navigateTo({
- // url: '/pages/public/login'
- // })
- // }
- },
- goShopDet(url, e) {
- this.shop = e
- // console.log(e, '当前店铺')
- // let myDate = new Date();
- // let hours = myDate.getHours();
- // let minute = myDate.getMinutes();
- // let openTime = this.shop.businessHours.split(':')[0] //开始小时
- // let closeTime = this.shop.lockHours.split(':')[0] //结束小时
- // let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
- // let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
- // console.log(hours)
- // console.log(minute)
- // console.log(openTime)
- // console.log(openTime1)
- // console.log(closeTime)
- // console.log(closeTime1)
- // console.log(minute >= closeTime1)
- // if (hours < openTime) {
- // this.hintShow = true
- // return
- // } else if (hours == openTime && minute < openTime1) {
- // this.hintShow = true
- // return
- // } else if (hours >= closeTime) {
- // this.hintShow = true
- // return
- // } else if (hours == closeTime && minute >= closeTime1) {
- // this.hintShow = true
- // return
- // }
- console.log(url)
- if (this.userId) {
- uni.navigateTo({
- url
- })
- } else {
- uni.navigateTo({
- url: '/pages/public/login'
- })
- }
- },
- },
- onReachBottom: function() {
- if (this.shopList.length < this.totalCount) {
- this.page = this.page + 1;
- this.getShopList()
- } else {
- uni.showToast({
- title: '已经到底了',
- icon: 'none'
- })
- }
- },
- }
- </script>
- <style lang="scss">
- .hd{
- width: 100%;
- height: auto;
- background-color: rgb(248, 248, 248);
- padding: 20rpx 0 20rpx 0;
- z-index: 1;
- // margin-top: 20rpx;
- .hd-box{
- width: 686rpx;
- height: 100%;
- .scroll-view_H{
- width: 100%;
- white-space: nowrap;
- }
- .hd-box-item{
- display: inline-block;
- padding: 10rpx 20rpx 10rpx 20rpx;
- background-color: #ffffff;
- font-size: 24rpx;
- border-radius: 8rpx;
- margin-right: 10rpx;
- }
-
- }
- }
- .shopli{
-
- }
- .select {
- padding-bottom: 5rpx;
- border-bottom: 6rpx solid #568D84;
- }
- .tabs {
- margin: 20rpx 0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .tabs_name {
- flex: 1;
- /* display: inline-block; */
- text-align: center;
- margin-bottom: 30rpx 0;
- position: relative;
- display: flex;
- /* justify-content: space-between; */
- align-items: center;
- }
- .tabs_name view {
- margin: 0 auto;
- display: flex;
- align-items: center;
- }
- .tabs_2 {
- /* width: 30%; */
- }
- .actives {
- color: #007AFF;
- }
- .tabsicon {
- position: absolute;
- top: 0;
- right: 22rpx;
- width: 20rpx;
- height: 40rpx;
- z-index: 1;
- }
- .tabs_icon {
- width: 12rpx;
- height: 8rpx;
- z-index: 1;
- margin-left: 10rpx;
- }
- .icon1 {
- /* position: absolute; */
- /* top: 6rpx; */
- }
- .icon2 {
- position: absolute;
- bottom: 6rpx;
- }
- .hintPopul {
- width: 100%;
- height: 100vh;
- position: fixed;
- top: 0;
- background: rgba(0, 0, 0, .4);
- z-index: 999;
- }
- .content_ {
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- margin: auto;
- text-align: center;
- width: 500rpx;
- height: 400rpx;
- border-radius: 20rpx;
- background-color: #fff;
- padding-top: 120rpx;
- }
- .content_ image {
- position: absolute;
- top: -50rpx;
- left: 0;
- right: 0;
- margin: auto;
- }
- .hintText {
- font-size: 30rpx;
- }
- .skuBtn {
- width: 460rpx;
- height: 60rpx;
- line-height: 60rpx;
- text-align: center;
- background: #FCD202;
- font-size: 28rpx;
- border: 2rpx solid #FCD202;
- color: #333333;
- border-radius: 50rpx;
- font-weight: 700;
- margin: auto;
- }
- .lable {
- border: 1rpx solid #FFE6D9;
- height: 40rpx;
- padding: 0 14rpx;
- background: #FFE6D9;
- border-radius: 4rpx;
- font-weight: 500;
- color: #FD6416;
- font-size: 20rpx;
- margin-right: 10rpx;
- margin-bottom: 10rpx;
- }
- </style>
|