| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520 |
- <template>
- <view class="content">
- <!-- #ifdef MP-WEIXIN -->
- <uv-sticky>
- <view class="top-box" :class="showTopSearch?'':'hide'">
- <view :style="[{height: `${statusBarHeight}px`}]"></view>
- <view class="title" :style="[{height: `${statusBarHeight}px`}]">
- <text class="titlt-txt">门店列表</text>
- </view>
- </view>
- </uv-sticky>
- <!-- #endif -->
- <!-- #ifndef MP-WEIXIN -->
- <uv-navbar title="门店列表" placeholder leftIcon="" titleStyle="font-size:36rpx;color:#fff"></uv-navbar>
- <!-- #endif -->
- <!-- <uv-swiper :list="swiperList"></uv-swiper> -->
- <view class="shopListBox" v-if="list.length>0">
- <!-- 附近门店 -->
- <view class="item" v-for="(v, index) in list" :key="index" @click="goDetails(v)">
- <view class="shop-img">
- <image :src="v.logo" mode="aspectFill"></image>
- </view>
- <view class="right">
- <view class="title">{{v.businessName}}</view>
- <view class="score-box">
- <view class="score">
- <rate :value="Math.round(v.average)"></rate>
- </view>
- <text class="score-text">{{v.average}}分</text>
- <text class="ju">距离:{{Math.round(v.distance/1000*100)/100}}KM</text>
- </view>
- <view class="address-box">
- <view class="left">
- <image class="location1" :src="$handleImageUrl('/common/location-icon.png')">
- </image>
- <view class="district">{{v.address || '商户暂无地理位置'}}</view>
- </view>
- <view class="goShopping" @click.stop="openMap(v)">
- <text class="iconfont3"></text>
- <text class="text">去逛逛</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { getBusinessList } from '@/api/shop'
- import { ref, getCurrentInstance } from 'vue'
- import { onShow, onLoad, onPageScroll } from '@dcloudio/uni-app'
- const showTopSearch = ref(true);
- const statusBarHeight = ref(0);
- statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight;
- // const menuButtonHeight = ref(0);
- // menuButtonHeight.value = uni.getMenuButtonBoundingClientRect().height + 10;
- const list = ref([]);
- const param = ref({
- lon: "",
- lat: ""
- });
- onPageScroll((e) => {
- if (e.scrollTop > uni.upx2px(49 + 30)) {
- showTopSearch.value = false;
- } else {
- showTopSearch.value = true;
- }
- })
- const getList = () => {
- getBusinessList(param.value).then(res => {
- if (res.data && res.data.length > 0) {
- res.data.map(v => {
- v.average = v.average || 0
- })
- }
- list.value = res.data
- })
- }
- const openMap = (item) => {
- uni.openLocation({
- latitude: Number(item.latitude),
- longitude: Number(item.longitude),
- success: function () {
- console.log('success');
- },
- complete: (e) => {
- console.log(e);
- }
- });
- }
- const goDetails = (item) => {
- uni.setStorageSync('businessId', item.businessId);
- uni.switchTab({
- url: '/pages/tabtar/home'
- })
- }
- onLoad(() => {
- uni.getLocation({
- type: 'gcj02',
- geocode: true,
- success: (res) => {
- param.value.userLongitude = res.longitude;
- param.value.userLatitude = res.latitude;
- getList()
- },
- complete: (e) => {
- console.log(e);
- },
- });
- getList()
- })
- </script>
- <style lang="scss" scoped>
- ::v-deep .uv-navbar__content {
- background: linear-gradient(
- 132deg,
- #fd995d 1%,
- #feb771 45%,
- #ed9f61 95%
- ) !important;
- }
- .top-box {
- width: 100%;
- background: linear-gradient(132deg, #fd995d 1%, #feb771 45%, #ed9f61 95%);
- &.hide {
- .seat {
- display: block;
- }
- }
- .seat {
- display: none;
- height: 130rpx;
- }
- .title {
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- margin: 0 auto;
- padding: 0 30rpx;
- font-size: 36rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- color: #ffffff;
- text-align: center;
- .back-icon {
- position: absolute;
- left: 30rpx;
- top: 50%;
- transform: translateY(-50%);
- float: left;
- }
- image {
- width: 41rpx;
- height: 31rpx;
- margin-right: 4rpx;
- }
- .titlt-txt {
- font-size: 36rpx;
- }
- }
- .input-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- position: sticky;
- top: 0;
- z-index: 100;
- width: 100%;
- padding: 23rpx 30rpx 20rpx;
- .text {
- margin-right: 20rpx;
- margin-left: 0rpx;
- font-weight: 500;
- font-size: 28rpx;
- color: #fff;
- }
- .input-placeholder {
- // flex: 1;
- box-sizing: border-box;
- display: inline-block;
- vertical-align: middle;
- width: 690rpx;
- height: 70rpx;
- line-height: 66rpx;
- // background: rgba(2,81,43,0.3);
- background: #fff;
- padding-left: 80rpx;
- // color: #666666;
- background: rgba(255, 255, 255, 0.3);
- // background-image: url("/static/czd/search.png");
- background-size: 40rpx 40rpx;
- background-position: 24rpx 50%;
- background-repeat: no-repeat;
- border: 1rpx solid rgba(255, 255, 255, 0.36);
- border-radius: 36rpx;
- }
- text {
- margin-left: 10rpx;
- display: inline-block;
- vertical-align: middle;
- font-size: 42rpx;
- font-weight: 400;
- text-align: right;
- color: #ffffff;
- line-height: 42rpx;
- &.iconfont2 {
- font-size: 55rpx;
- }
- }
- .status-bar {
- display: none;
- }
- .msgCenter {
- position: relative;
- text {
- min-width: 50rpx;
- font-size: 20rpx;
- color: #ffffff;
- font-weight: 400;
- padding: 0 4rpx;
- background-color: #ff0000;
- border-radius: 13rpx;
- border: 2rpx solid #fff;
- text-align: center;
- position: absolute;
- left: 10rpx;
- top: -30rpx;
- line-height: normal;
- }
- }
- }
- .input-placeholder {
- color: #fee3cf;
- opacity: 0.74;
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: left;
- line-height: 70rpx;
- }
- }
- .shopListBox {
- padding: 0 30rpx;
- .shopListBox_item {
- margin-top: 30rpx;
- }
- .shopItem {
- // border-bottom: 1rpx solid #E6E6E6;
- padding-bottom: 40rpx;
- margin-bottom: 40rpx;
- .shopItem_title {
- font-size: 34rpx;
- color: #1a1a1a;
- font-weight: 700;
- margin-bottom: 20rpx;
- }
- .shopItem_data {
- display: flex;
- align-items: center;
- justify-content: space-between;
- font-size: 26rpx;
- image {
- width: 22rpx;
- height: 30rpx;
- }
- > view {
- display: flex;
- align-items: center;
- image {
- margin-right: 10rpx;
- }
- }
- .shopItem_data_distance {
- color: #666666;
- }
- }
- .gooodsBox {
- .gooods_item {
- display: flex;
- margin-top: 20rpx;
- image {
- width: 136rpx;
- height: 136rpx;
- margin-right: 35rpx;
- border-radius: 10rpx;
- flex-shrink: 0;
- }
- .gooods_item_r {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- > view {
- display: flex;
- align-items: center;
- }
- .gooods_item_r_title {
- font-size: 26rpx;
- color: #1a1a1a;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- .gooods_item_r_price {
- font-size: 36rpx;
- color: #fa6138;
- font-weight: 600;
- text {
- font-size: 20rpx;
- display: inline-block;
- margin-right: 10rpx;
- }
- }
- .gooods_item_r_expense {
- font-size: 26rpx;
- color: #666666;
- margin-left: 52rpx;
- }
- }
- }
- }
- .lookOther {
- font-size: 24rpx;
- color: #333333;
- width: 288rpx;
- height: 59rpx;
- border-radius: 8rpx;
- background: #f2f2f2;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 20rpx auto 0;
- }
- }
- .item {
- display: flex;
- align-items: center;
- padding: 30rpx 0;
- // border-bottom: 1rpx solid #e6e6e6;
- .shop-img {
- width: 162rpx;
- height: 158rpx;
- margin-right: 40rpx;
- border-radius: 10rpx;
- overflow: hidden;
- flex-shrink: 0;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .right {
- flex: 1;
- width: 0;
- .score-box,
- .address-box,
- .location2-box {
- display: flex;
- align-items: center;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- }
- .location1,
- .location2 {
- width: 20rpx;
- height: 27rpx;
- flex-shrink: 0;
- margin-right: 9rpx;
- }
- .location2 {
- width: 23rpx;
- height: 27rpx;
- }
- .light-start,
- .startt {
- width: 30rpx;
- height: 30rpx;
- margin-right: 12rpx;
- }
- .title {
- margin-bottom: 18rpx;
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- color: #1a1a1a;
- }
- .score-box {
- align-items: normal;
- margin-bottom: 10rpx;
- font-family: PingFang SC, PingFang SC-Semibold;
- color: #333333;
- .score {
- flex-shrink: 0;
- }
- .score-text {
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Medium;
- font-weight: 500;
- text-align: left;
- color: #333333;
- flex-shrink: 0;
- }
- .ju {
- margin-left: 23rpx;
- font-size: 24rpx;
- color: #808080;
- text-align: left;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .address-box {
- // margin-bottom: 10rpx;
- font-family: PingFang SC;
- color: #666666;
- justify-content: space-between;
- .left {
- flex: 1;
- width: 0;
- display: flex;
- align-items: center;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: left;
- color: #333333;
- }
- .district {
- color: #1a1a1a;
- margin-right: 40rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .goShopping {
- display: flex;
- align-items: center;
- font-size: 40rpx;
- color: #fa6138;
- flex-shrink: 0;
- .text {
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Medium;
- font-weight: 500;
- text-align: left;
- color: #666666;
- }
- }
- }
- .location2-box {
- color: #333333;
- view {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- }
- }
- </style>
|