123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- <template>
- <view class="container flex-col":style="{height: winHeight + 'px'}">
- <!-- #ifdef MP -->
- <view class="cart_nav">
- <nav-bar iconColor='#fff' ref="navBarRef" navTitle="美食" backgroundColor="#FF6702" :isBackgroundColor="false">
- </nav-bar>
- </view>
- <!-- #endif -->
- <view class="box-color"></view>
- <view class="box-merchant flex-col">
- <view class="top-merchant">
- <view class="flex-y-center">
- <image style="width: 80rpx; height: 80rpx;" src="/static/img/ic-message.png"></image>
- <view style="margin-left: 15rpx;">
- <view class="mer-name">BOOS盖饭·农家大碗香(德思勤店)</view>
- <view>
- <text>今日推荐</text>
- <text>4.8</text>
- <text>月销7000+</text>
- <text>配送约¥0</text>
- </view>
- </view>
- </view>
- <view style="position: absolute;right: 20rpx;top: 20rpx;">进店</view>
- <view class="flex-y-center" style="margin: 15rpx 0;">
- <view class="cert-box">28减1</view>
- <view class="cert-box">50减2</view>
- <view class="cert-box">1元优惠券</view>
- <view class="cert-box">2元优惠券</view>
- </view>
- <scroll-view :scroll-x="true" scroll-with-animation style="height: 130px;white-space: nowrap;">
- <view class="top-box-item">
- <image style="width: 100%; height: 120rpx;border-radius: 10rpx;" src="/static/img/ic-message.png"></image>
- <view class="name">请炒土豆丝|放就爱哦但是见附件就能看</view>
- <view>
- <text :class="$bg-color-primary">¥</text><text class="bg-color">2.88</text>
- <text style="text-decoration: line-through;">¥6</text>
- </view>
- </view>
- <view class="top-box-item">
- <image style="width: 100%; height: 120rpx;border-radius: 10rpx;" src="/static/img/ic-message.png"></image>
- <view class="name">肉末茄子|放就爱哦但是见附件就能看</view>
- <view>
- <text :class="$bg-color-primary">¥</text><text class="bg-color">2.88</text>
- <text style="text-decoration: line-through;">¥6</text>
- </view>
- </view>
- <view class="top-box-item">
- <image style="width: 100%; height: 120rpx;border-radius: 10rpx;" src="/static/img/ic-message.png"></image>
- <view class="name">辣椒炒肉盖饭|放就爱哦但是见附件就能看</view>
- <view>
- <text :class="$bg-color-primary">¥</text><text class="bg-color">2.88</text>
- <text style="text-decoration: line-through;">¥6</text>
- </view>
- </view>
- </scroll-view>
- </view>
- <scroll-view :scroll-x="true" scroll-with-animation style="white-space: nowrap;margin: 20rpx 0rpx;">
- <view style="display: inline-block;margin-right: 30rpx;" v-for="(item, index) in optionData">
- <view class="flex-col flex-center">
- <image style="border-radius: 50%;width: 80rpx;height: 80rpx;" src="/static/img/ic-message.png"></image>
- <view class="name">{{item.name}}</view>
- </view>
- </view>
- </scroll-view>
- <!-- 销量排行 -->
- <view class="tab-list" style="margin-top: 10rpx;">
- <view :class=" item.checked ? 'tab-item2' : 'tab-item2-false' " v-for="item in labelList" :key="item.id" @click="item2Click(item)">{{item.label}}</view>
- </view>
- <scroll-view scroll-y scroll-with-animation style="flex: 1;overflow: hidden;">
- <view class="content-goods2" v-for="item in merchantList" :key="item.id" @click="merchantTab(item)">
- <view>
- <image :src="item.pcLogo" style="width: 230rpx;height: 230rpx;"></image>
- </view>
- <view style="margin-left: 20rpx;flex: 1;">
- <view class="">
- <text class="goods-title">{{item.name}}</text>
- <image src="/static/img/ic-close.png" style="width: 32rpx;height: 32rpx;float: right; "></image>
- </view>
- <view style="margin-top: 10rpx;">
- <text class="goods-score">{{item.score}}</text>
- <text class="goods-info" style="margin-left: 10rpx;">月销 {{item.salesVolume}}</text>
- <text class="goods-info" style="margin-left: 25rpx;">人均 ¥ {{item.perCapita}}</text>
- </view>
- <view style="margin-top: 10rpx;display: flex;align-items: center;">
- <text class="goods-info">起送 ¥ {{item.perCapita}}</text>
- <text v-if="!item.isfreeDeliverfee" class="goods-info" style="color: #E5AD21;margin-left: 18rpx;">免配送费</text>
- <view v-if="!item.isfreeDeliverfee" style="color: #999999;font-size: 21rpx;margin-left: 10rpx;text-decoration: line-through;">¥
- {{item.freeDeliverFee}}</view>
- <text v-if="item.isfreeDeliverfee" style="color: #999999;font-size: 21rpx;margin-left: 10rpx;">配送费¥
- {{item.distCosts}}</text>
- <text class="goods-info" style="margin-left: 38rpx;">10分钟</text>
- <text class="goods-info" style="margin-left: 10rpx;">{{item.distance}}</text>
- </view>
- <view style="margin-top: 22rpx;"><text class="goods-sales">已售卖{{item.salesVolume}}件</text></view>
- <view style="margin-top: 14rpx;">
- <text class="goods-labels" v-for="(item2,index2) in item.discountLabel" :key="index2">{{item2}}</text>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- // +----------------------------------------------------------------------
- // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
- // +----------------------------------------------------------------------
- // | Author: CRMEB Team <admin@crmeb.com>
- // +----------------------------------------------------------------------
- import navBar from '@/components/navBar';
- import {
- getMerchantList,
- getHomeInfo
- } from '@/api/home.js';
- let app = getApp();
- var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'rpx';
- export default {
- components: {
- navBar
- },
- data() {
- return {
- winHeight: 0,
- optionData: [{
- id: 1,
- name: '全部',
- icon: '/static/img/ic-message.png'
- },
- {
- id: 2,
- name: '饺子混沌',
- icon: '/static/img/ic-message.png'
- },
- {
- id: 3,
- name: '汉堡薯条',
- icon: '/static/img/ic-message.png'
- },
- {
- id: 4,
- name: '意面披萨',
- icon: '/static/img/ic-message.png'
- },
- {
- id: 5,
- name: '包子粥店',
- icon: '/static/img/ic-message.png'
- },
- {
- id: 6,
- name: '快餐',
- icon: '/static/img/ic-message.png'
- },
- ],
- labelList: [{
- id: 1,
- label: "销量排行",
- checked: true
- }, {
- id: 2,
- label: "满减大促",
- checked: false
- }, {
- id: 3,
- label: "首单立减",
- checked: false
- }, {
- id: 4,
- label: "减配送费",
- checked: false
- }],
- merchantList: [],
- }
- },
- onLoad(options) {
- let that = this;
- uni.getSystemInfo({
- success: function(res) {
- that.winHeight = res.windowHeight
- },
- });
- uni.getLocation({
- type: 'wgs84',
- geocode: true, //设置该参数为true可直接获取经纬度及城市信息
- success: function(res) {
- getMerchantList({
- latitude: res.latitude,
- longitude: res.longitude
- }).then(res => {
- // that.merchantList = res.data.list;
- that.merchantList.push(res.data.list[0]);
- that.merchantList.push(res.data.list[0]);
- that.merchantList.push(res.data.list[0]);
- that.merchantList.push(res.data.list[0]);
- that.merchantList.push(res.data.list[0]);
- console.log('商品信息:', that.merchantList);
- });
- },
- fail: function() {
- uni.showToast({
- title: '获取地址失败,将导致部分功能不可用',
- icon: 'none'
- });
- }
- })
- },
- methods: {
- item2Click(item) {
- item.checked = !item.checked;
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- overflow: hidden;
- position: relative;
- }
- .box-color {
- width: 100%;
- height: 200rpx;
- margin-top: -1px;
- background-color: $bg-color-primary;
- position: absolute;
- z-index: -1;
- }
- .box-merchant {
- background-color: #F5F5F5;
- border-radius: 30rpx 30rpx 0 0;
- padding: 20rpx 20rpx 0 20rpx;
- margin-top: 30rpx;
- overflow: hidden;
- flex: 1;
- }
- .top-merchant {
- background-color: #fff;
- position: relative;
- padding: 20rpx;
- border-radius: 20rpx;
- .mer-name {
- font-weight: 600;
- font-size: 27rpx;
- color: #141414;
- }
- .cert-box {
- color: #FF4B4B;
- border: 2rpx solid #FF4B4B;
- border-radius: 8rpx;
- background: rgba(255, 75, 75, 0.05);
- padding: 10rpx;
- margin-right: 10rpx;
- }
- .top-box-item {
- width: 31%;
- margin-right: 20rpx;
- display: inline-block;
- .name {
- font-weight: 400;
- font-size: 23rpx;
- color: #141414;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- .bg-color {
- color: $bg-color-primary;
- font-size: 30rpx;
- }
- .tab-list {
- display: flex;
- /* 启用弹性布局 */
- flex-direction: row;
- /* 横向排列 */
- justify-content: space-between;
- /* 均匀分布子项 */
- flex-wrap: wrap;
- /* 允许换行(适用于屏幕宽度不足时) */
- .tab-item2 {
- width: 23%;
- /* 5个元素平分宽度,留2%作为间隙 */
- text-align: center;
- background-color: #FFC127;
- border-radius: 8rpx;
- font-size: 23rpx;
- padding: 6rpx;
- font-weight: 400;
- }
- .tab-item2-false {
- width: 23%;
- /* 5个元素平分宽度,留2%作为间隙 */
- text-align: center;
- background-color: #fff;
- border-radius: 8rpx;
- font-size: 23rpx;
- padding: 6rpx;
- font-weight: 400;
- }
- }
- .content-goods2 {
- background: #FFFFFF;
- border-radius: 23rpx;
- margin-top: 10rpx;
- padding: 20rpx;
- display: flex;
- .goods-title {
- color: #141414;
- font-size: 26rpx;
- font-weight: 600;
- }
- .goods-desc {
- color: #646464;
- font-size: 21rpx;
- margin-top: 10rpx;
- }
- .goods-price {
- color: #FF9805;
- font-size: 34rpx;
- font-weight: 600;
- }
- .goods-score {
- color: #FD6716;
- font-size: 26rpx;
- }
- .goods-info {
- color: #999999;
- font-size: 21rpx;
- }
- .goods-info3 {
- color: #999999;
- font-size: 21rpx;
- margin-left: 10rpx;
- text-decoration: line-through;
- }
- .goods-sales {
- background-color: #FEEFE5;
- color: #FF6702;
- border-radius: 8rpx;
- font-size: 21rpx;
- padding: 4rpx 20rpx;
- }
- .goods-labels {
- background-color: #FFF6F6;
- color: #FF4B4B;
- border: 2rpx solid #FF4B4B;
- border-radius: 8rpx;
- font-size: 21rpx;
- padding: 4rpx 16rpx;
- margin-right: 20rpx;
- }
- }
- </style>
|