Files
2025-04-30 14:04:34 +08:00

752 lines
22 KiB
Vue

<template>
<view class="page" :style="themeColor">
<!-- <view class="flex benben-position-layout flex flex-wrap align-center nearbyMerchants_flex_0"
:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
<view class='flex flex-wrap align-center justify-between flex-sub nearbyMerchants_fd0_0'>
<view class='flex flex-wrap align-stretch justify-center flex-sub'>
<text class='nearbyMerchants_fd0_0_c0_c0'>附近商家</text>
</view>
</view>
</view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view> -->
<!---flex布局flex布局开始-->
<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout nearbyMerchants_flex_1">
<view class='flex flex-wrap align-center justify-between'>
<view class='flex flex-wrap align-center flex-sub nearbyMerchants_fd1_0_c0'>
<image class='nearbyMerchants_fd1_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"53.png"'></image>
<input type="text" placeholder="请输入商家名称" confirm-type="done" :maxlength="-1"
placeholder-style="color:rgba(153, 153, 153, 1);font-size:28rpx" v-model="fd1_0_c0_c1" />
</view>
<text class='nearbyMerchants_fd1_0_c1'>搜索</text>
</view>
<view class='flex flex-wrap align-center justify-around nearbyMerchants_fd1_1'>
<view class='flex flex-wrap align-center justify-center nearbyMerchants_fd1_1_c0'
@tap.stop="stateFunctionFunc()">
<text class='nearbyMerchants_fd1_1_c0_c0' v-if="state=='1'"
@tap.stop="pickerDiy1684578784573=true">{{screeningMerchants_id}}</text><text
class='nearbyMerchants_fd1_1_c0_c0_1' v-if="state=='2'"
@tap.stop="pickerDiy1684578784573=true">{{screeningMerchants_id}}</text>
<image class='nearbyMerchants_fd1_1_c0_c1' :src='STATIC_URL+"92.png"' v-if="state=='1'"></image>
<image class='nearbyMerchants_fd1_1_c0_c1_1' :src='STATIC_URL+"93.png"' v-if="state=='2'"></image>
</view>
<view class='flex nearbyMerchants_fd1_1_c1'></view>
<view class='flex flex-wrap align-center justify-center nearbyMerchants_fd1_1_c2'
@tap.stop="stateFunctionFunc()">
<text class='nearbyMerchants_fd1_1_c2_c0' v-if="state=='1'"
@tap.stop="pickerDiy1684579546665=true">{{filterDistance_id}}</text><text
class='nearbyMerchants_fd1_1_c2_c0_1' v-if="state=='2'"
@tap.stop="pickerDiy1684579546665=true">{{filterDistance_id}}</text>
<image class='nearbyMerchants_fd1_1_c2_c1' :src='STATIC_URL+"93.png"' v-if="state=='1'"></image>
<image class='nearbyMerchants_fd1_1_c2_c1_1' :src='STATIC_URL+"92.png"' v-if="state=='2'"></image>
</view>
</view>
</view>
<!---flex布局flex布局结束-->
<!---flex布局flex布局开始-->
<!-- <view class="flex benben-flex-layout flex-wrap align-center nearbyMerchants_flex_2">
</view> -->
<block>
<map style="width: 750rpx; height: 200px;" :latitude="lat" :longitude="lng" scale="13" :markers="covers"></map>
</block>
<!---flex布局flex布局结束-->
<!---flex布局flex布局开始-->
<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout nearbyMerchants_flex_3">
<view class='flex flex-wrap align-center nearbyMerchants_fd3_0' v-for="(item, index) in list" :key="index">
<view class='flex flex-direction flex-wrap align-start'>
<view class='flex flex-wrap align-center justify-center nearbyMerchants_fd3_0_c0_c0'>
<text class='nearbyMerchants_fd3_0_c0_c0_c0'>积分</text>
<text class='nearbyMerchants_fd3_0_c0_c0_c1'>{{item.score_rate}}</text>
<text class='nearbyMerchants_fd3_0_c0_c0_c2'>%</text>
</view>
<view class='flex flex-wrap align-center'>
<image class='nearbyMerchants_fd3_0_c0_c1_c0' mode="aspectFill" :src='item.logo'></image>
</view>
</view>
<view class='flex flex-direction flex-wrap align-stretch flex-sub nearbyMerchants_fd3_0_c1'>
<view class='flex flex-wrap align-center justify-between'>
<view class='flex flex-wrap align-center'>
<text class='nearbyMerchants_fd3_0_c1_c0_c0_c0'>{{item.store_name}}</text>
</view>
<view class='flex flex-wrap align-center justify-center nearbyMerchants_fd3_0_c1_c0_c1'>
<image class='nearbyMerchants_fd3_0_c1_c0_c1_c0' mode="aspectFit" :src='STATIC_URL+"95.png"'></image>
<text class='nearbyMerchants_fd3_0_c1_c0_c1_c1'>到这里</text>
</view>
</view>
<view class='flex flex-wrap align-center nearbyMerchants_fd3_0_c1_c1'>
<image class='nearbyMerchants_fd3_0_c1_c1_c0' mode="aspectFit" :src='STATIC_URL+"31.png"'></image>
<text class='nearbyMerchants_fd3_0_c1_c1_c1'>{{item.score}}</text>
<text class='nearbyMerchants_fd3_0_c1_c1_c2'></text>
</view>
<view class='flex flex-wrap align-center justify-between nearbyMerchants_fd3_0_c1_c2'>
<view class='flex flex-wrap align-center'>
<text class='nearbyMerchants_fd3_0_c1_c2_c0_c0'>关注人数</text>
<text class='nearbyMerchants_fd3_0_c1_c2_c0_c1'>{{item.collect_num}}</text>
</view>
<view class='flex flex-wrap align-center'>
<text class='nearbyMerchants_fd3_0_c1_c2_c1_c0'>人均</text>
<text class='nearbyMerchants_fd3_0_c1_c2_c1_c1'>{{item.per_capita}}</text>
</view>
</view>
<view class='flex flex-wrap align-center justify-between nearbyMerchants_fd3_0_c1_c3'>
<view class='flex flex-wrap align-center'>
<text class='nearbyMerchants_fd3_0_c1_c3_c0_c0'>起送¥</text>
<text class='nearbyMerchants_fd3_0_c1_c3_c0_c1'>{{item.start_price}} </text>
</view>
<view class='flex flex-wrap align-center'>
<text class='nearbyMerchants_fd3_0_c1_c3_c1_c0'>{{item.distance}}</text>
<text class='nearbyMerchants_fd3_0_c1_c3_c1_c1'>km</text>
</view>
</view>
</view>
</view>
</view>
<!---flex布局flex布局结束-->
<!--筛选全部商家开始 -->
<!-- <benben-picker ref="benbenWritePickerCodepicker4" :visible.sync="pickerDiy1684578784573"
:label.sync='screeningMerchants_id' :options='screeningMerchants_list' mode='selector' :mask-show='true'
:timeout='true' :picker-height='88' default-type='value' :default-props='{"label":"name","value":"value"}'>
<template #picker-header>
<view class='flex flex-wrap align-center justify-between nearbyMerchants_picker4_0'>
<text @tap="$refs.benbenWritePickerCodepicker4.cancel()">取消</text>
<text>筛选全部商家</text>
<text class='nearbyMerchants_picker4_0_c2' @tap="$refs.benbenWritePickerCodepicker4.pickerConfirm()">确认</text>
</view>
</template>
</benben-picker> -->
<!--筛选全部商家结束 -->
<!--筛选距离开始 -->
<!-- <benben-picker ref="benbenWritePickerCodepicker5" :visible.sync="pickerDiy1684579546665"
:label.sync='filterDistance_id' :options='filterDistance_list' mode='selector' :mask-show='true' :timeout='true'
:picker-height='88' default-type='value' :default-props='{"label":"name","value":"value"}'>
<template #picker-header>
<view class='flex flex-wrap align-center justify-between nearbyMerchants_picker5_0'>
<text @tap="$refs.benbenWritePickerCodepicker5.cancel()">取消</text>
<text>筛选距离</text>
<text class='nearbyMerchants_picker5_0_c2' @tap="$refs.benbenWritePickerCodepicker5.pickerConfirm()">确认</text>
</view>
</template>
</benben-picker> -->
<!--筛选距离结束 -->
</view>
</template>
<script>
import amap from '@/common/amap-wx.js';
import {
validate
} from '@/common/utils/validate.js'
export default {
components: {},
data() {
return {
"pickerDiy1684579546665": false,
"pickerDiy1684578784573": false,
"fd1_0_c0_c1": "",
"data": [],
"screeningMerchants_id": "全部商家",
"screeningMerchants_list": [{
"name": "全部商家",
"value": "1",
"image": ""
}, {
"name": "美食",
"value": "2",
"image": ""
}, {
"name": "便利商超",
"value": "3",
"image": ""
}, {
"name": "生鲜水果",
"value": "4",
"image": ""
}, {
"name": "酒水饮料",
"value": "5",
"image": ""
}, {
"name": "蛋糕甜品",
"value": "6",
"image": ""
}],
"filterDistance_id": "距离筛选",
"filterDistance_list": [{
"name": "不限",
"value": "1",
"image": ""
}, {
"name": "0.5KM",
"value": "2",
"image": ""
}, {
"name": "1KM-2KM",
"value": "3",
"image": ""
}, {
"name": "2KM-3KM",
"value": "4",
"image": ""
}, {
"name": "3KM-4KM",
"value": "5",
"image": ""
}, {
"name": "5KM以上",
"value": "6",
"image": ""
}],
"state": "1",
lat: '',
lng: '',
list: [],
isShowLoading: false,
isInit: false,
status: 'more', // 表示是否有数据可以请求
page: 1,
covers: [],
amapPlugin: null, //new地图
key: '886bfe2d6c32bd8eac97c2e6d821ed0b'
};
},
computed: {
themeColor() {
return this.$store.getters.themeColor
},
},
watch: {},
onLoad(options) {
this.amapPlugin = new amap.AMapWX({
key: this.key
});
},
onUnload() {
},
onReady() {
},
onShow() {
// #ifdef APP-PLUS
this._getPermission()
// #endif
// #ifndef APP-PLUS
this._getLocation()
// #endif
},
onHide() {
},
onResize() {
},
onPullDownRefresh() {
// #ifdef APP-PLUS
this._getPermission()
// #endif
// #ifndef APP-PLUS
this._getLocation()
// #endif
// this.$refs.guess && this.$refs.guess.refresh();
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1000);
},
onReachBottom(e) {
this.getRecommendList();
},
onPageScroll(e) {
},
methods: {
/**
* 获取附近商家列表
* @param {Object} value
*/
getRecommendList(value) {
if (this.status != 'more') return;
this.status = 'loading';
let data = {
list_rows: 20,
page: this.page,
lat: this.lat,
lng: this.lng,
is_recommend: 0
};
// console.log('请求的数据', data);
if (this.page == 1 && value) {
this.isShowLoading = true;
}
this.$api
.post(global.apiUrls.getShopList, data)
.then(res => {
console.log('订单列表', res);
this.isShowLoading = false;
if (res.data.code == 1) {
var curPageData = res.data.data.data;
let covers = [];
curPageData.map((item) => {
covers.push({
latitude: item.address_lat,
longitude: item.address_lng,
iconPath: 'https://nongmangmang.oss-cn-qingdao.aliyuncs.com/uploads/images/20230522/2b835a1b9e763b62c44ae4b8b727a604.png?x-oss-process=image/resize,m_fixed,h_60,w_60/rounded-corners,r_40/format,png',
label: {
content: item.store_name
}
})
})
this.covers = covers;
if (this.page == 1) this.list = [];
this.list = this.list.concat(curPageData);
console.log('上拉加载', curPageData.length, this.size);
if (res.data.data.last_page > this.page) {
this.status = 'more';
this.page++;
} else {
this.status = 'noMore';
}
} else {
this.$message.info(res.data.msg);
}
this.isInit = true;
uni.stopPullDownRefresh();
})
.catch(err => {
this.isShowLoading = false;
uni.stopPullDownRefresh();
});
},
_getPermission() {
uni.getSystemInfo({
success: (res) => {
if (res.platform == 'android') {
let isLocation = uni.getStorageSync('LVTAI_USER_LOCATION') || false;
if (!isLocation) {
uni.showModal({
title: '温馨提示',
content: '我们需要获取您的定位权限以提供对应的服务',
// showCancel: false,
confirmText: '去获取',
success: res => {
if (res.confirm) {
this._getLocation();
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
} else {
this._getLocation();
}
} else {
this._getLocation();
}
}
});
},
// vue的method里编写如下代码
async requestAndroidPermission(permisionID) {
var permisionStatus = await permision.requestAndroidPermission(permisionID);
console.log(permisionStatus);
return permisionStatus;
},
_getLocation() {
// #ifdef H5
this.lat = '34.738695';
this.lng = '113.64328';
this.status = 'more';
this.page = 1;
this.isInit = false;
this.list = [];
this.address = '华城国际中心'
this.getRecommendList(true);
// #endif
// #ifdef APP-PLUS
this.amapPlugin.getRegeo({
success: res => {
console.log(res[0]);
uni.setStorageSync('LVTAI_USER_LOCATION', true);
this.address = res[0].regeocodeData.addressComponent.city;
this.lat = res[0].latitude;
this.lng = res[0].longitude;
this.status = 'more';
this.page = 1;
this.isInit = false;
this.list = [];
this.getRecommendList(true);
},
fail: err => {
}
});
// #endif
},
//切换状态
stateFunctionFunc() {
if (this.state == '1') {
this.state = '2';
} else if (this.state == '2') {
this.state = '1';
}
return
}
}
};
</script>
<style lang="scss" scoped>
.page {
width: 100vw;
overflow-x: hidden;
min-height: calc(100vh - var(--window-bottom));
background: rgba(246, 247, 249, 1);
background-size: 100% auto !important;
}
.nearbyMerchants_flex_0 {
background: rgba(255, 147, 0, 1);
width: 750rpx;
height: 88rpx;
overflow: hidden;
z-index: 10;
top: 0rpx;
background-size: 100% auto !important;
}
.nearbyMerchants_fd0_0_c0_c0 {
font-size: 36rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
line-height: 88rpx;
}
.nearbyMerchants_fd0_0 {
margin: 0rpx 32rpx 0rpx 32rpx;
}
.nearbyMerchants_flex_1 {
background: rgba(255, 255, 255, 1);
padding: 24rpx 32rpx 0rpx 32rpx;
background-size: 100% auto !important;
}
.nearbyMerchants_fd1_1_c2_c1_1 {
width: 10rpx;
height: 6rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 0rpx 0rpx 0rpx 8rpx;
}
.nearbyMerchants_fd1_1_c2_c1 {
width: 10rpx;
height: 6rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 0rpx 0rpx 0rpx 8rpx;
}
.nearbyMerchants_fd1_1_c2_c0_1 {
color: rgba(51, 51, 51, 1);
font-size: 28rpx;
font-weight: 400;
line-height: 30rpx;
}
.nearbyMerchants_fd1_1_c2_c0 {
color: rgba(102, 102, 102, 1);
font-size: 28rpx;
font-weight: 400;
line-height: 30rpx;
}
.nearbyMerchants_fd1_1_c2 {
width: 200rpx;
height: 51rpx;
}
.nearbyMerchants_fd1_1_c1 {
background: rgba(238, 238, 238, 1);
width: 1rpx;
height: 40rpx;
transform: scaleX(0.5);
}
.nearbyMerchants_fd1_1_c0_c1_1 {
width: 10rpx;
height: 6rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 0rpx 0rpx 0rpx 8rpx;
}
.nearbyMerchants_fd1_1_c0_c1 {
width: 10rpx;
height: 6rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 0rpx 0rpx 0rpx 8rpx;
}
.nearbyMerchants_fd1_1_c0_c0_1 {
color: rgba(102, 102, 102, 1);
font-size: 28rpx;
font-weight: 500;
line-height: 30rpx;
}
.nearbyMerchants_fd1_1_c0_c0 {
color: #333333;
font-size: 28rpx;
font-weight: 500;
line-height: 30rpx;
}
.nearbyMerchants_fd1_1_c0 {
width: 200rpx;
height: 51rpx;
}
.nearbyMerchants_fd1_1 {
padding: 32rpx 0rpx 28rpx 0rpx;
}
.nearbyMerchants_fd1_0_c1 {
color: #333333;
font-size: 32rpx;
font-weight: 400;
line-height: 32rpx;
}
.nearbyMerchants_fd1_0_c0_c0 {
width: 28rpx;
height: 28rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 0rpx 16rpx 0rpx 0rpx;
}
.nearbyMerchants_fd1_0_c0 {
background: rgba(246, 247, 249, 1);
margin: 0rpx 32rpx 0rpx 0rpx;
border-radius: 32rpx 32rpx 32rpx 32rpx;
background-size: 100% auto !important;
padding: 12rpx 24rpx 12rpx 24rpx;
}
.nearbyMerchants_flex_2 {
background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/49.png) no-repeat, #eee;
background-size: 100% auto !important;
width: 750rpx;
height: 400rpx;
}
.nearbyMerchants_flex_3 {
padding: 32rpx 24rpx 0rpx 24rpx;
}
.nearbyMerchants_fd3_0_c1_c3_c1_c1 {
color: #999999;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c3_c1_c0 {
color: #999999;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c3_c0_c1 {
color: #333333;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c3_c0_c0 {
color: #333333;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c3 {
margin: 18rpx 20rpx 0rpx 0rpx;
}
.nearbyMerchants_fd3_0_c1_c2_c1_c1 {
color: #333333;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c2_c1_c0 {
color: #333333;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c2_c0_c1 {
color: #333333;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c2_c0_c0 {
color: #333333;
font-size: 24rpx;
font-weight: 400;
line-height: 24rpx;
}
.nearbyMerchants_fd3_0_c1_c2 {
margin: 18rpx 20rpx 0rpx 0rpx;
}
.nearbyMerchants_fd3_0_c1_c1_c2 {
color: #FF9D00;
font-size: 28rpx;
font-weight: 700;
line-height: 30rpx;
}
.nearbyMerchants_fd3_0_c1_c1_c1 {
color: #FF9D00;
font-size: 28rpx;
font-weight: 700;
line-height: 30rpx;
}
.nearbyMerchants_fd3_0_c1_c1_c0 {
width: 20rpx;
height: 19rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 0rpx 8rpx 0rpx 0rpx;
}
.nearbyMerchants_fd3_0_c1_c1 {
margin: 18rpx 0rpx 0rpx 0rpx;
}
.nearbyMerchants_fd3_0_c1_c0_c1_c1 {
color: #FFFFFF;
font-size: 24rpx;
font-weight: 400;
line-height: 40rpx;
}
.nearbyMerchants_fd3_0_c1_c0_c1_c0 {
width: 24rpx;
height: 24rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin: 0rpx 4rpx 0rpx 0rpx;
}
.nearbyMerchants_fd3_0_c1_c0_c1 {
background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/94.png) no-repeat, #eee;
width: 128rpx;
height: 40rpx;
border-radius: 50rpx 0rpx 0rpx 50rpx;
background-size: 100% auto !important;
}
.nearbyMerchants_fd3_0_c1_c0_c0_c0 {
color: #333333;
font-size: 32rpx;
font-weight: 600;
line-height: 32rpx;
}
.nearbyMerchants_fd3_0_c1 {
margin: 0rpx 0rpx 0rpx 24rpx;
}
.nearbyMerchants_fd3_0_c0_c1_c0 {
width: 180rpx;
height: 180rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
}
.nearbyMerchants_fd3_0_c0_c0_c2 {
color: #FFFFFF;
font-size: 20rpx;
font-weight: 500;
line-height: 36rpx;
}
.nearbyMerchants_fd3_0_c0_c0_c1 {
color: #FFFFFF;
font-size: 20rpx;
font-weight: 500;
line-height: 36rpx;
}
.nearbyMerchants_fd3_0_c0_c0_c0 {
color: #FFFFFF;
font-size: 20rpx;
font-weight: 500;
line-height: 36rpx;
}
.nearbyMerchants_fd3_0_c0_c0 {
background: url(https://lvtai-files.oss-cn-beijing.aliyuncs.com/mini/23.png) no-repeat, rgba(255, 162, 31, 1);
width: 128rpx;
height: 36rpx;
background-size: 100% auto !important;
border-radius: 16rpx 0rpx 24rpx 0rpx;
position: absolute;
z-index: 10;
}
.nearbyMerchants_fd3_0 {
background: rgba(255, 255, 255, 1);
margin: 0rpx 0rpx 24rpx 0rpx;
border-radius: 16rpx 16rpx 16rpx 16rpx;
background-size: 100% auto !important;
padding: 24rpx 0rpx 24rpx 24rpx;
}
.nearbyMerchants_picker4_0_c2 {
color: #4781f5;
}
.nearbyMerchants_picker4_0 {
border-bottom: 1px solid #eee;
background: #fff;
padding: 0rpx 32rpx 0rpx 32rpx;
line-height: 88rpx;
border-radius: 25rpx 25rpx 0rpx 0rpx;
background-size: 100% auto !important;
}
.nearbyMerchants_picker5_0_c2 {
color: #4781f5;
}
.nearbyMerchants_picker5_0 {
border-bottom: 1px solid #eee;
background: #fff;
padding: 0rpx 32rpx 0rpx 32rpx;
line-height: 88rpx;
border-radius: 25rpx 25rpx 0rpx 0rpx;
background-size: 100% auto !important;
}
</style>