123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <template>
- <view class="center">
- <!-- <view class="search-top">
- <view class="search flex">
- <view class="shop-name clamp">椒江区</view>
- <image class="shop-jt" src="../../static/icon/dsjh.png" mode=""></image>
- <view class="input-box flex">
- <view class=" input-content flex">
- <image src="../../static/icon/search-h.png" mode="" class="" style="width: 32rpx;height: 32rpx;"></image>
- <view class="input"><input type="text" value="输入关键字搜索" /></view>
- </view>
- </view>
- <view class="search-tit" @click.stop="clickSearch">搜索</view>
- </view>
- <view class="shop">
- <view class="shop-title">
- <view class="shop-item">
- <view class="sitem-font">智能排序</view>
- <image class="jt-down" src="../../static/sy/index06.png" mode=""></image>
- </view>
- <view class="shop-item">
- <view class="sitem-font">位置距离</view>
- <image class="jt-down" src="../../static/sy/index06.png" mode=""></image>
- </view>
- <view class="shop-item">
- <view class="sitem-font">折扣优惠</view>
- <image class="jt-down" src="../../static/sy/index06.png" mode=""></image>
- </view>
- <view class="shop-item">
- <view class="sitem-font">筛选</view>
- <image class="jt-down" src="../../static/sy/index06.png" mode=""></image>
- </view>
- </view>
- </view>
- </view> -->
- <!-- <view class="jg" style="height: 180rpx;"></view> -->
- <view class="shop">
- <view class="shop-main flex" v-for="(item, index) in stop" :key="index" @click="navTo('/pages/shoping/storeInfo?id=' + item.id)">
- <image class="main-left" :src="item.image" mode=""></image>
- <view class="main-right flex">
- <view class="shopm-info">
- <view class="shopm-title">
- <view class="shopmt-font clamp">{{ item.name }}</view>
- </view>
- <view class="address margin-t-10 text-success">分红额度:{{+item.give_award_range_ratio}}</view>
- <view class="shopmt-tip">{{ item.detailed_address }}</view>
- </view>
- <view class="right">
- <view class="mright-top" v-if="item.jl">
- <image class="mrt-image" src="../../static/sy/index10.png" mode=""></image>
- <view class="mrt-font">距离{{ item.jl }}KM</view>
- </view>
- <view class="mright-bottom">
- <image class="mrb-item" src="../../static/sy/index14.png" mode=""></image>
- <image class="mrb-item" src="../../static/sy/index11.png" mode=""></image>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { store_list } from '@/api/index.js';
- export default {
- data() {
- return {
- stop: [],
- longitude: '',
- latitude: ''
- };
- },
- onLoad() {
- this.loadData();
- },
- methods: {
- loadData() {
- let obj = this;
- // store_list({
- // page: 1,
- // limit: 100
- // }).then(e => {
- // if (e.data.length != 0) {
- // e.data.list.forEach(e => {
- // e.jl = this.getFlatternDistance(this.latitude, this.longitude, e.latitude, e.longitude);
- // });
- // }
- // obj.stop = e.data.list;
- // console.log(e);
- // });
- uni.getLocation({
- type: 'gcj02',
- success: res => {
- console.log('dizhi+++++++++++');
- this.longitude = res.longitude; //经度
- this.latitude = res.latitude; //纬度
- store_list({
- page: 1,
- limit: 100,
- latitude: res.latitude,
- longitude: res.longitude
- }).then(e => {
- if (e.data.length != 0) {
- e.data.list.forEach(e => {
- e.jl = this.getFlatternDistance(this.latitude, this.longitude, e.latitude, e.longitude);
- });
- }
- obj.stop = e.data.list;
- console.log(e);
- });
- },
- fail: err => {
- console.log(err);
- openMap().then(e => {
- this.getaddress();
- });
- }
- });
- },
- //根据经纬度计算距离
- getFlatternDistance(lat1, lng1, lat2, lng2) {
- let radLat1 = (lat1 * Math.PI) / 180.0;
- let radLat2 = (lat2 * Math.PI) / 180.0;
- let a = radLat1 - radLat2;
- let b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
- let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
- s = s * 6378.137;
- s = Math.round(s * 10000) / 10000;
- return s;
- },
- navTo(url) {
- uni.navigateTo({
- url,
- fail() {
- uni.switchTab({
- url
- });
- }
- });
- }
- }
- };
- </script>
- <style lang="less">
- .kong {
- height: 100vh;
- }
- .search-top {
- position: fixed;
- top: 0;
- z-index: 99;
- }
- .search {
- justify-content: flex-start;
- padding: 10rpx 32rpx 20rpx;
- align-items: center;
- background-color: #fff;
- .address {
- width: 32rpx;
- height: 38rpx;
- }
- .shop-name {
- height: 38rpx;
- position: relative;
- top: -4rpx;
- z-index: 100;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666;
- padding-left: 10rpx;
- }
- .shop-jt {
- margin-left: 8rpx;
- width: 16rpx;
- height: 10rpx;
- }
- .input-box {
- margin-left: 10rpx;
- position: relative;
- z-index: 99;
- width: 520rpx;
- height: 60rpx;
- // background: rgba(255, 255, 255, 0.4);
- border-radius: 30rpx;
- .input-content {
- position: relative;
- z-index: 11;
- // border-radius: 99rpx;
- flex-grow: 1;
- padding: 5rpx 30rpx;
- background: #f6f6f6;
- .iconsearch {
- font-size: 50rpx;
- color: #ffffff;
- }
- .input {
- margin-left: 19rpx;
- flex-grow: 1;
- color: #666;
- background: #f6f6f6;
- input {
- font-size: 28rpx;
- }
- }
- }
- .input-button {
- padding-left: 20rpx;
- // font-size: $font-base;
- height: 100%;
- }
- }
- .search-tit {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- flex-shrink: 0;
- padding-left: 10rpx;
- }
- }
- .shop {
- // margin-top: 20rpx;
- background: #ffffff;
- padding: 0 12rpx;
- .shop-title {
- padding: 30rpx 0 20rpx;
- display: flex;
- align-items: center;
- border-bottom: 1px solid #e3e6e7;
- .shop-item {
- width: 25%;
- display: flex;
- align-items: center;
- justify-content: center;
- .sitem-font {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- .jt-down {
- width: 10rpx;
- height: 8rpx;
- margin-left: 12rpx;
- }
- }
- }
- .shop-main {
- padding: 32rpx 18rpx 0 12rpx;
- align-items: flex-start;
- justify-content: flex-start;
- .main-left {
- width: 180rpx;
- height: 180rpx;
- border-radius: 10rpx;
- }
- .main-right {
- width: 500rpx;
- justify-content: space-between;
- align-items: flex-start;
- margin-left: 20rpx;
- padding: 13rpx 0 35rpx;
- border-bottom: 1px solid #eaeced;
- .shopm-info {
- max-width: 60%;
- line-height: 1;
- .shopm-title {
- display: flex;
- justify-content: flex-start;
- .shopmt-font {
- font-size: 34rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- }
- }
- .shopmt-tip {
- position: relative;
- margin-top: 92rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- }
- .right {
- height: 100%;
- margin-top: 5rpx;
- display: flex;
- flex-direction: column;
- .mright-top {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .mrt-image {
- width: 20rpx;
- height: 28rpx;
- }
- .mrt-font {
- margin-left: 8rpx;
- font-size: 22rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- }
- .mright-bottom {
- margin-top: 80rpx;
- display: flex;
- justify-content: flex-end;
- .mrb-item {
- width: 46rpx;
- height: 46rpx;
- margin-left: 14rpx;
- }
- }
- }
- }
- }
- }
- </style>
|