| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570 |
- <template>
- <view class="takeout-index iPhone-bottom flex-common-css box-border-box">
- <view class="bg-index"></view>
- <view class="">
- <Nav :leftShow='false' :customNav='true' :bgckgroundBox='bgckgroundBox'>
- <template>
- <view slot="custom" class="">
- <view class="align-items-center mb-28 s-input-f">
- <uni-icons @click="toBack()" type="left" size="20"></uni-icons>
- <view v-if="!isScroll" class="fs-40 ml-10 fw-600">外卖</view>
- <view v-else class="s-input s-input-c" :class="isScroll?'w-454':'w-100100'">
- <view class="input-icon s-left">
- <uni-icons type="search" size="22" color="#999"></uni-icons>
- </view>
- <input v-model="search" type="text" placeholder="请输入商家或者商品名称">
- </view>
- </view>
- </view>
- </template>
- </Nav>
- </view>
- <scroll-view scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower" @scroll="scrollFun">
- <view class="">
- <view class="s-input box-border-box plr-24">
- <view class="input-icon">
- <uni-icons type="search" size="22" color="#999"></uni-icons>
- </view>
- <input v-model="search" type="text" placeholder="请输入商家或者商品名称">
- <view class="fs-28 fc-f index-search-box-buttom" @click="searchClick">搜索</view>
- </view>
- <!-- <view class="p-24 box-border-box">
- <view class="index-search-box box-border-box align-items-center">
- <uni-icons type="search" size="22" color="#999"></uni-icons>
- <view class="fs-28 fc-9 ml-10">搜索店铺名称或者商品名称</view>
- <view class="fs-28 fc-f index-search-box-buttom">搜索</view>
- </view>
- </view> -->
- <view class="box-border-box plr-24">
- <view class="shop-box mb-32 box-border-box p-16">
- <image class="shop-box-bg" src="@/static/img/takeout/bg.png" mode="scaleToFill"></image>
- <swiper class="swiper-tj" :circular='false' indicator-active-color='#FF7F00'
- indicator-color='#FDC583' :indicator-dots="false" :current='BanenerCurrent'
- @change="onSwiperChange" :autoplay="true" :interval="3000" :duration="300">
- <swiper-item v-for="(item,i) in topShopData" :key="i" @click="toShop(item)">
- <view class="swiper-item display-flex">
- <view class="left-img-box">
- <image class="left-img" :src="item.shop_logo" mode="aspectFill"></image>
- <view class="status-box fc-f" v-if="item.status != 1">
- 休息中
- </view>
- </view>
- <view class="right-box flex-1">
- <view class="align-items-center mb-8">
- <view class="right-box-title fs-32 fw-600 text-overflow-ellipsis-one">
- {{item.shop_name}}
- </view>
- <image class="right-box-title-img" src="@/static/img/toRight.png" mode="">
- </image>
- </view>
- <view class="align-items-center mb-12">
- <image class="img-x mr-12" src="@/static/img/my/wdpj.png" mode=""></image>
- <view class="fs-26 fw-600 fc-FF7F00 mr-12">{{item.shop_score}}分</view>
- <view class="fc-6 fs-24 mr-12">| 预计{{item.delivery_time}}分钟 |</view>
- <view class="fc-6 fs-24 mr-12">{{item.shop_sales}}人购买</view>
- </view>
- <view class="align-items-center flex-wrap-wrap">
- <view class="quan-list display-flex mr-12 mb-12"
- v-for="(itemCoupon,iCoupon) in item.coupon" :key="iCoupon">
- <view class="quan-list-1 fs-24 fc-f">券</view>
- <view class="quan-list-2 fs-24 fc-FB3D03">{{itemCoupon.money}}元</view>
- </view>
- </view>
- </view>
- </view>
- </swiper-item>
- </swiper>
- <view class="align-items-center dot-f">
- <view :class="BanenerCurrent === i?'dot-box-s':'dot-box'" v-for="(item,i) in topShopData"
- :key="i">
- </view>
- </view>
- </view>
- </view>
- <view class="box-border-box plr-24 nav-type-box-f" :class="isScroll?'nav-bg':''">
- <scroll-view class="nav-type-box" scroll-x="true">
- <view class="nav-type-list" @click="clickClass(0)">
- <image src="@/static/img/takeout/all.png" mode=""></image>
- <view :class="category_id == 0?'fc-41ABF5':''" class="fs-24 fw-400 text-align-center">全部
- </view>
- </view>
- <view class="nav-type-list" v-for="(item,i) in navList" :key="i" @click="clickClass(item.id)">
- <image :src="item.img" mode=""></image>
- <view class="fs-24 fw-400" :class="category_id == item.id?'fc-41ABF5':''">{{item.name}}
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="box-border-box plr-24 mt-24">
- <EnBlank :customSrc='true' v-if="listData<= 0">
- <template v-slot:blankImg>
- <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
- </template>
- </EnBlank>
- <view v-else class="goos-list-box box-border-box p-24 display-flex" v-for="(item,i) in listData"
- :key='i' @click="toShop(item)">
- <view class="left-img-box">
- <image class="left-img" :src="item.shop_logo" mode="aspectFill"></image>
- <view class="status-box fc-f" v-if="item.status != 1">
- 休息中
- </view>
- </view>
- <view class="flex-1">
- <view class="align-items-center mb-8">
- <view class="right-box-title fs-32 fw-600 text-overflow-ellipsis-one">
- {{item.shop_name}}
- </view>
- <image class="right-box-title-img" src="@/static/img/toRight.png" mode=""></image>
- </view>
- <view class="align-items-center mb-8">
- <image class="img-x mr-12" src="@/static/img/my/wdpj.png" mode=""></image>
- <view class="fs-26 fw-600 fc-FF7F00 mr-12">{{item.shop_score}}分</view>
- <view class="fc-6 fs-24 mr-12">| 预计{{item.delivery_time}}分钟 |</view>
- <view class="fc-6 fs-24 mr-12">{{item.shop_sales}}人购买</view>
- </view>
- <view class="align-items-center flex-wrap-wrap">
- <view class="quan-list display-flex mr-12 mb-12"
- v-for="(itemCoupon,iCoupon) in item.coupon" :key="iCoupon">
- <view class="quan-list-1 fs-24 fc-f">券</view>
- <view class="quan-list-2 fs-24 fc-FB3D03">{{itemCoupon.money}}元</view>
- </view>
- </view>
- <view class="goods-items-list display-flex view-nowrap">
- <view class="goods-items-list-box" v-for="(info,iGoods) in item.goods" :key='iGoods'>
- <image class="mb-12" :src="info.goods_image" mode="scaleToFill"></image>
- <view class="mb-8 fw-600 text-overflow-ellipsis-one fs-26">{{info.goods_name}}
- </view>
- <view class="">
- <span class="fs-24 fc-FB3D03">¥</span>
- <span class="fs-32 fc-FB3D03 fw-b">{{info.price}}</span>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import EnBlank from "@/components/en-utils/en-blank/en-blank";
- import {
- shopTop
- } from "@/api/shop.js"
- import {
- getGoodsList
- } from "@/api/goods.js"
- import {
- getTakeaway
- } from "@/api/category.js"
- import {
- shopInfo
- } from "@/api/shop.js"
- import tools from "@/service/tools";
- export default {
- components: {
- EnBlank
- },
- data() {
- return {
- bgckgroundBox: 'transparent',
- BanenerCurrent: 0,
- search: '',
- category_id: 0,
- isScroll: false,
- topShopData: [],
- page: 1,
- listData: [],
- navList: []
- }
- },
- mounted() {
- this.shopTop()
- this.getGoodsList()
- this.getTakeaway()
- },
- methods: {
- searchClick() {
- console.log("898989898998");
- this.listData = []
- this.getGoodsList()
- },
- clickClass(id) {
- if (this.category_id == id) {
- return
- }
- this.category_id = id
- this.listData = []
- this.getGoodsList()
- },
- toBack() {
- tools.leftClick()
- },
- onSwiperChange(e) {
- this.BanenerCurrent = e.detail.current;
- },
- scrollFun(e) {
- if (e.target.scrollTop > 60) {
- this.isScroll = true;
- } else {
- this.isScroll = false;
- }
- },
- scrolltolower() {
- console.log('触底');
- },
- toShop(item) {
- const operate_id = uni.getStorageSync('operate_id')
- shopInfo({
- operate_id: operate_id,
- shop_id: item.shop_id
- }).then((res) => {
- if (res.code == 1) {
- uni.navigateTo({
- url: '/pages-takeout/shop?shop_id=' + item.shop_id
- })
- } else {
- tools.error(res.msg)
- }
- })
- },
- shopTop() {
- const operate_id = uni.getStorageSync('operate_id')
- shopTop({
- operate_id: operate_id
- }).then((res) => {
- if (res.code == 1) {
- this.topShopData = res.data
- }
- })
- },
- getGoodsList() {
- const operate_id = uni.getStorageSync('operate_id')
- getGoodsList({
- operate_id: operate_id,
- category_id: this.category_id,
- search: this.search,
- page: this.page
- }).then((res) => {
- if (res.code == 1) {
- if (res.data.items.length > 0) {
- this.listData.push(...res.data.items)
- }
- }
- })
- },
- getTakeaway() {
- getTakeaway().then((res) => {
- if (res.code == 1) {
- this.navList = res.data
- }
- })
- }
- },
- }
- </script>
- <style scoped lang="scss">
- .index-search-box-buttom {
- width: 120rpx;
- height: 60rpx;
- position: absolute;
- z-index: 100;
- right: 30rpx;
- top: 6rpx;
- background: linear-gradient(90deg, #57CAFF 0%, #41ABF5 100%);
- border-radius: 200rpx;
- margin-left: auto;
- line-height: 60rpx;
- text-align: center;
- }
- .takeout-index {
- position: relative;
- .s-input-f {
- position: relative;
- .s-input-c {
- position: absolute;
- top: -16rpx;
- left: 50rpx;
- }
- }
- .bg-index {
- width: 100%;
- height: 272rpx;
- position: absolute;
- top: 0;
- left: 0;
- background-image: linear-gradient(#E0F6FB, #F5F4F9);
- z-index: -1;
- }
- .w-100100 {
- width: 100%;
- }
- .w-454 {
- width: 454rpx;
- }
- .s-input {
- margin-bottom: 24rpx;
- height: 72rpx;
- box-sizing: border-box;
- position: relative;
- .s-left {
- left: 24rpx !important;
- }
- .input-icon {
- position: absolute;
- left: 44rpx;
- top: 16rpx;
- }
- input {
- font-size: 32rpx;
- width: 100%;
- height: 72rpx;
- background: #FFFFFF;
- border-radius: 200rpx;
- box-sizing: border-box;
- padding: 0 20rpx 0 78rpx;
- border: 1rpx solid #41ABF5;
- }
- }
- .shop-box {
- width: 100%;
- height: 242rpx;
- position: relative;
- .shop-box-bg {
- width: 100%;
- height: 242rpx;
- position: absolute;
- top: 0;
- left: 0;
- z-index: -1;
- }
- .swiper-tj {
- width: 100%;
- height: 172rpx;
- border-radius: 20rpx;
- .swiper-item {
- width: 100%;
- height: 100%;
- border-radius: 20rpx;
- background-color: #fff;
- box-sizing: border-box;
- padding: 16rpx;
- .left-img-box {
- width: 140rpx;
- height: 140rpx;
- margin-right: 14rpx;
- position: relative;
- .left-img {
- width: 140rpx;
- height: 140rpx;
- border-radius: 12rpx;
- }
- .status-box {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- padding: 10rpx 0;
- text-align: center;
- background: rgba(0, 0, 0, 0.5);
- font-size: 20rpx;
- border-radius: 0 0 12rpx 12rpx;
- }
- }
- .right-box {}
- }
- }
- .dot-f {
- margin: 20rpx auto;
- justify-content: center;
- .dot-box {
- width: 8rpx;
- height: 6rpx;
- background: #FEC683;
- border-radius: 200rpx;
- margin: 0 6rpx;
- }
- .dot-box-s {
- width: 16rpx;
- height: 6rpx;
- background: #FF7F00;
- border-radius: 200rpx;
- margin: 0 6rpx;
- }
- }
- }
- .nav-bg {
- background-image: linear-gradient(#F0F4FA, #FFFFFF);
- padding: 24rpx !important;
- }
- .nav-type-box-f {
- position: sticky;
- top: 0;
- left: 0;
- z-index: 9999;
- .nav-type-box {
- width: 100%;
- height: 120rpx;
- display: flex;
- // overflow: scroll;
- white-space: nowrap;
- .nav-type-list {
- display: inline-block;
- height: 120rpx;
- width: 96rpx !important;
- text-align: center;
- margin-right: 44rpx;
- image {
- display: block;
- width: 80rpx;
- height: 80rpx;
- margin: 0 8rpx 12rpx 8rpx;
- }
- }
- }
- }
- .goos-list-box {
- width: 100%;
- // min-height: 428rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(51, 51, 51, 0.1);
- border-radius: 20rpx;
- margin-bottom: 20rpx;
- .goods-items-list {
- width: 530rpx;
- overflow-y: scroll;
- .goods-items-list-box {
- width: 140rpx;
- margin-right: 16rpx;
- image {
- width: 140rpx;
- height: 140rpx;
- border-radius: 12rpx
- }
- }
- }
- }
- .left-img-box {
- width: 100rpx;
- height: 100rpx;
- margin-right: 16rpx;
- position: relative;
- .left-img {
- width: 100rpx;
- height: 100rpx;
- border-radius: 12rpx;
- }
- .status-box {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- padding: 4rpx 0;
- text-align: center;
- background: rgba(0, 0, 0, 0.5);
- font-size: 17rpx;
- border-radius: 0 0 12rpx 12rpx;
- }
- }
- .img-x {
- width: 24rpx;
- height: 24rpx;
- }
- .right-box-title {
- width: 438rpx;
- }
- .right-box-title-img {
- width: 32rpx;
- height: 32rpx;
- margin-left: auto;
- }
- .quan-list {
- .quan-list-1 {
- width: 32rpx;
- height: 34rpx;
- background: #FB3D03;
- border-radius: 5rpx 0rpx 0rpx 5rpx;
- text-align: center;
- }
- .quan-list-2 {
- box-sizing: border-box;
- padding: 0 2rpx;
- height: 34rpx;
- border-radius: 0 5rpx 5rpx 0;
- border: 1rpx solid #FB3D03;
- text-align: center;
- }
- }
- }
- .index-search-box {
- width: 100%;
- height: 72rpx;
- padding: 0 6rpx 0 24rpx;
- border-radius: 200rpx;
- border: 2rpx solid #4FB3EF;
- .index-search-box-buttom {
- width: 120rpx;
- height: 60rpx;
- background: linear-gradient(90deg, #57CAFF 0%, #41ABF5 100%);
- border-radius: 200rpx;
- margin-left: auto;
- line-height: 60rpx;
- text-align: center;
- }
- }
- </style>
|