| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- <template>
- <view v-if="XCXIsSelect=='是'">
- <!-- #ifdef H5 -->
- <view class="hdSwiper flex justify-center" style="top: 80rpx;">
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <view class="hdSwiper flex justify-center">
- <!-- #endif -->
-
- <view class="hdSwiper-box">
- <swiper :circular="true" :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000">
- <swiper-item >
- <!-- v-for="(item,index) in huodongList.activityImage.split(',')" :key="index" -->
- <image :src="imageUrl" style="width: 100%;height: 100%;border-radius: 24rpx;" mode="aspectFill"></image>
- </swiper-item>
- </swiper>
- </view>
- </view>
- <!-- #ifdef H5 -->
- <view style="position: fixed;top: 360rpx;width: 100%;z-index: 999;">
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <view style="position: fixed;top: 290rpx;width: 100%;z-index: 999;">
- <!-- #endif -->
- <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="#FCD202" 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="#FCD202" size="28"></u-icon>
- </view>
- </view>
- </view>
- </view>
- <!-- #ifdef H5 -->
- <view class="padding-lr-sm" style="margin-top: 140px;">
- <!-- #endif -->
- <!-- #ifndef H5 -->
- <view class="padding-lr-sm" style="margin-top: 400rpx;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;"></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%;">
- <u-icon name="star-fill" color="#FD6416" size="28"></u-icon>
- <text class="text-lg" style=""> {{item.shopScore?item.shopScore:0}}</text>
- <text
- class="text-gray flex-sub margin-left-xs">销量{{item.shopSales?item.shopSales:0}}</text>
- <text class="text-gray margin-left-xs">{{item.errandTime}}分钟</text>
- <text class="text-gray margin-left-xs">{{item.distance}}</text>
- </view>
- <view class="text-gray margin-top-xs flex justify-between">
- <view>起送 ¥{{item.minimumDelivery}} 配送 ¥{{item.errandMoney?item.errandMoney:0}}
- </view>
- <!-- <view style="color: #FCD202;">{{item.autoSendOrder==1?'商家配送':'平台配送'}}</view> -->
- </view>
- <view class="text-gray margin-top-xs" v-if="item.businessHours&&item.lockHours">
- 营业时间:{{item.businessHours}}-{{item.lockHours}}</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: 4rpx;background-color: #ffffff;color: red;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: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;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>
- </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 {
- 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:'',
- huodongList:[],
- activityTitle:'',
- activityId:'',
- imageUrl:'',
- }
- },
- onLoad(e) {
- console.log(e,'ll')
- this.imageUrl=e.imageUrl
- this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
- if (this.XCXIsSelect == '否') {
- this.getGuize()
- 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()
- if(e.activityTitle){
- that.activityTitle = e.activityTitle
- uni.setNavigationBarTitle({
- title: e.activityTitle
- });
- // that.getHuoDongList()
- this.getShopList()
- }
- if(e.activityId){
- this.activityId = e.activityId
- uni.setNavigationBarTitle({
- title: '推荐商家'
- });
- this.getShopList()
- // that.getHuoDongList()
- }
- },
- methods: {
- // 跳转商品详情
- 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'
- })
- },
- //活动列表
- getHuoDongList(){
- let data = {
- activityTitle:this.activityTitle,
- activityId:this.activityId?this.activityId:''
- }
- this.$Request.getT('/app/activityManage/getActivityList',data).then(res => {
- if (res.code === 0) {
- this.huodongList = res.data.records[0]
- this.activityId = this.huodongList.activityId
- this.getShopList()
- }
- });
- },
- 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() {
- let data = {
- page: this.page,
- limit: this.limit,
- screen: this.current,
- shopTypeId: this.shopTypeId,
- lng: uni.getStorageSync('lng'),
- lat: uni.getStorageSync('lat'),
- city:this.city
- }
- this.$Request.getT('/app/goods/selectShop', data).then(res => {
- if (res.code == 0) {
- var totalCount=res.data.totalCount
- let data = {
- page: this.page,
- limit: totalCount,
- }
- this.$Request.getT(`/app/activity-shop/activity-shop-page/${this.activityId}`, data).then(res => {
- console.log(res,'hhhhhh2h')
- if (res.code == 0) {
- var huodongList=[]
- huodongList=res.data.list
- let data = {
- page: this.page,
- limit: totalCount,
- screen: this.current,
- shopTypeId: this.shopTypeId,
- lng: uni.getStorageSync('lng'),
- lat: uni.getStorageSync('lat'),
- city:this.city
- }
- this.$Request.getT('/app/goods/selectShop', data).then(res => {
- if (res.code == 0) {
- this.totalCount = res.data.totalCount
- res.data.list.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.shopScore = ret.shopScore.toFixed(1)
- 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)
- })
-
- var shopList=[]
- shopList=res.data.list
- for (let i = 0; i < shopList.length; i++) {
- let item1 = shopList[i];
- // 内层循环遍历array2
- for (let j = 0; j < huodongList.length; j++) {
- let item2 = huodongList[j];
- // 检查id是否相等
- if (item1.shopId === item2.shopId) {
- // 如果相等,将对象添加到matchedArray
- this.shopList.push(item1);
- // 如果只需要添加一次,则可以在这里退出内层循环
- // break;
- }
- }
- }
- }
- uni.stopPullDownRefresh();
- uni.hideLoading()
- })
- }
- })
- }
- uni.stopPullDownRefresh();
- uni.hideLoading()
- })
- },
- // 商户类型
- 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(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">
- .select {
- color: #FCD202;
- }
- .shopli{
-
- }
- .hdSwiper{
- width: 100%;
- height: 290rpx;
- position: fixed;
- top: 0;
- z-index: 999;
- background-color: #ffffff;
- .hdSwiper-box{
- width: 686rpx;
- height: 100%;
- border-radius: 24rpx;
- }
- }
- .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>
|