123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502 |
- <template>
- <view class="container-shop">
- <navbar :config="config" backColor="#666"></navbar>
- <view class="header">
- <view class="banner" v-if="shopInfo.store_images">
- <image :src="shopInfo.store_images.split(',')[0]" mode="aspectFill"></image>
- </view>
- <view class="shop-name">
- <view class="title">
- <view class="title-label omit">
- {{shopInfo.shop_name}}
- </view>
- <view class="score">
- <rate :value="Math.round(shopInfo.average)"></rate>
- <view class="score-txt omit" v-if="shopInfo.average">{{shopInfo.average.toFixed(2)}}分</view>
- </view>
- <view class="tip">
- <text class="iconfont3 notice"></text>
- <text class="notice-text omit">{{shopInfo.special_offers || '暂无优惠信息'}}</text>
- </view>
- </view>
- <image class="shop-logo" :src="shopInfo.logo" mode="aspectFill"></image>
- <view class="help">
- <view class="btn" @click="callPhone">
- <view class="iconfont3 help-icon"></view>
- <view>打电话</view>
- </view>
- <view class="btn" @click="jumpNavigator">
- <view class="iconfont3 help-icon"></view>
- <view>导航去</view>
- </view>
- </view>
- </view>
- </view>
- <view class="tabs" :class="{'tabSticky': sticky}" :style="{'top': stickyHeight + 'px'}">
- <view class="tab" :class="{'activeTab': currentTab == index}" v-for="(item, index) in tabs" :key="item.i"
- @click="tabsChange(index)">
- <view class="label">
- {{item.label}}
- </view>
- </view>
- </view>
- <view v-if="sticky" :style="{'height': viewHeight + 'px'}"></view>
- <view class="mian" :style="{'height': mainHeight + 'px'}">
- <view class="body">
- <template v-if="currentTab == 0">
- <scroll-view class="scrollview" scroll-y="true">
- <view class="classifyTab" :class="{'classifyActiveTab': classifyCurrentTab == index}"
- v-for="(item, index) in classifyTabs" :key="item.id" @click="classifyChange(index, item)">
- <view class="class-name">
- {{item.name}}
- </view>
- </view>
- </scroll-view>
- <scroll-view class="scrollview" scroll-y="true">
- <view v-for="(item, index) in goodsList" :key="item.id" @click="jumpGoogsDetail(item)">
- <shop-goods :goodsDetail="item"></shop-goods>
- </view>
- <noData v-if="goodsList.length<=0"></noData>
- </scroll-view>
- </template>
- <template v-if="currentTab == 1">
- <view class="introduction">
- <view class="shop-text">
- <view class="label">
- <view class="iconfont3 text-icon"></view>
- 门店简介:
- </view>
- <view class="text">
- {{shopInfo.remark}}
- </view>
- </view>
- <view class="shop-text">
- <view class="label">
- <view class="iconfont3 text-icon"></view>
- 营业时间:
- </view>
- <view class="text">
- {{shopInfo.time_quantum}}
- </view>
- </view>
- <view class="shop-text">
- <view class="label">
- <view class="iconfont3 text-icon"></view>
- 门店地址:
- </view>
- <view class="text">
- {{shopInfo.address}}
- </view>
- </view>
- </view>
- </template>
- </view>
- </view>
- </view>
- </template>
- <script>
- import rate from "@/components/rate.vue";
- import shopGoods from "@/components/shop-goods.vue";
- import noData from "@/components/noData/nodata.vue"
- export default {
- components: {
- rate,
- shopGoods,
- noData
- },
- data() {
- return {
- config: {
- back: true,
- title: '门店',
- color: '#1a1a1a',
- backgroundColor: [1, "#fff"],
- statusBarFontColor: '#FFFFFF',
- leftSlot: true
- },
- headerHeight: 0,
- stickyHeight: 0,
- viewHeight: 0,
- mainHeight: 0,
- sticky: false,
- shopId: '',
- shopInfo: {},
- tabs: [{
- label: '商品',
- i: 0
- },
- {
- label: '商家简介',
- i: 1
- }
- ],
- currentTab: 0,
- classifyTabs: [],
- classifyCurrentTab: 0,
- goodsList: []
- }
- },
- onLoad(options) {
- if (options && options.shopId) {
- this.shopId = options.shopId
- this.getShopInfo(options.shopId)
- this.getGoodsClassify(options.shopId)
- }
- },
- onShow() {
- this.$nextTick(() => {
- let sysInfo = uni.getSystemInfoSync()
- this.$u.getRect('.header').then(res => {
- this.headerHeight = res.height
- this.stickyHeight = sysInfo.statusBarHeight + 44
- })
- this.$u.getRect('.tabs').then(res => {
- this.viewHeight = res.height
- this.mainHeight = sysInfo.screenHeight - sysInfo.statusBarHeight - 44 - res.height
- })
- })
- },
- onReady() {},
- onPageScroll(e) {
- if (e.scrollTop >= this.headerHeight) {
- this.sticky = true
- } else {
- this.sticky = false
- }
- },
- methods: {
- // 获取店铺信息
- getShopInfo(shopId) {
- this.$http.get("/yxt/shop/info/" + shopId).then((res) => {
- // uni.stopPullDownRefresh();
- // this.loading = false;
- if (res.data && res.code == 200) {
- this.shopInfo = res.data;
- }
- });
- },
- // 获取商品分类
- getGoodsClassify(shopId) {
- this.$http.get("/offlinetype/goods/list", {
- shopId: shopId,
- isGoods: 0
- }).then(res => {
- if (res.code == 200) {
- if (res.list.length > 0) {
- this.classifyTabs = res.list
- this.getClassifyGoods(res.list[0].id, shopId)
- }
- }
- })
- },
- // 获取商品
- getClassifyGoods(classifyId, shopId) {
- this.$http.get("/offline/goods/page", {
- isUp: 1,
- typeId: classifyId,
- isGoods: 0,
- shopId: shopId,
- }).then(res => {
- if (res.code == 200) {
- this.goodsList = res.page.list
- }
- })
- },
- tabsChange(i) {
- if (this.currentTab == i) {
- return false
- }
- this.currentTab = i
- },
- classifyChange(i, item) {
- if (this.classifyCurrentTab == i) {
- return false
- }
- this.classifyCurrentTab = i
- this.getClassifyGoods(item.id, item.shop_id)
- },
- callPhone() {
- if (!this.shopInfo.mobile) {
- return this.$mUtil.toast('暂无客服热线')
- }
- this.$mUtil.callup(this.shopInfo.mobile)
- },
- jumpNavigator() {
- if (!this.shopInfo.tx_latitude || !this.shopInfo.tx_longitude) {
- return this.$mUtil.toast('暂无地址')
- }
- this.$mUtil.jumpLocation(this.shopInfo.tx_latitude, this.shopInfo.tx_longitude)
- },
- jumpGoogsDetail(item) {
- uni.navigateTo({
- url: `/pages/nearbyShop/goodsDetail?goodsId=${item.id}&shopId=${item.shop_id}`
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container-shop {
- .header {
- width: 100%;
- height: auto;
- background-color: #fff;
- .banner {
- width: 100%;
- height: 290rpx;
- image {
- width: 100%;
- height: 100% !important;
- vertical-align: middle;
- }
- }
- .shop-name {
- position: relative;
- width: 720rpx;
- height: 306rpx;
- margin: -84rpx auto 0;
- background-color: #fff;
- background: url('@/static/shop/shop-bg.png') no-repeat;
- background-size: 100% 100%;
- .title {
- max-width: 400rpx;
- margin-bottom: 30rpx;
- padding: 34rpx 0 0 45rpx;
- font-size: 30rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- }
- .title-label {
- margin-bottom: 14rpx;
- color: #333333;
- }
- .shop-logo {
- position: absolute;
- top: -57rpx;
- right: 45rpx;
- width: 226rpx;
- height: 221rpx !important;
- flex-shrink: 0;
- border-radius: 20rpx;
- }
- .score {
- display: flex;
- align-items: center;
- margin-bottom: 15rpx;
- font-weight: 500;
- /deep/ .box {
- display: flex;
- align-items: center;
- }
- .score-txt {
- flex: 1;
- width: 0;
- }
- }
- .tip {
- display: flex;
- align-items: center;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- .notice {
- font-size: 26rpx;
- color: #FA6138;
- margin-right: 4rpx;
- }
- }
- .omit {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .help {
- display: flex;
- width: 690rpx;
- margin: 0 auto;
- border-top: 1rpx solid #f2f2f2;
- .btn {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 50%;
- padding: 30rpx 0 20rpx;
- text-align: center;
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- color: #333333;
- .help-icon {
- margin-right: 7rpx;
- color: #ff6600;
- font-size: 36rpx;
- }
- }
- }
- }
- }
- .tabs {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- padding: 0 202rpx 30rpx;
- background-color: #fff;
- .tab {
- position: relative;
- padding: 12rpx 0 9rpx;
- color: #1A1A1A;
- font-size: 30px;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- }
- .activeTab {
- color: #FA6138;
- &::after {
- display: block;
- content: '';
- position: absolute;
- bottom: 0;
- width: 100%;
- height: 4rpx;
- background: #FA6138;
- border-radius: 2rpx;
- z-index: 3;
- }
- }
- }
- .tabSticky {
- position: fixed;
- z-index: 9;
- }
- .mian {
- .body {
- height: 100%;
- display: flex;
- .scrollview {
- height: 100%;
- }
- .scrollview:first-child {
- width: 180rpx;
- flex-shrink: 0;
- background-color: #f6f6f6;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #666666;
- .classifyTab {
- position: relative;
- text-align: center;
- line-height: 120rpx;
- background-color: #f6f6f6;
- display: flex;
- justify-content: center;
- .class-name {
- width: 80%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .classifyActiveTab {
- background-color: #fff;
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- color: #FA6138;
- &::before {
- display: block;
- content: '';
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- width: 6rpx;
- height: 40rpx;
- background-color: #FA6138;
- }
- }
- }
- .scrollview:last-child {
- padding-left: 36rpx;
- padding-right: 30rpx;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- color: #181818;
- /deep/ .no-data-view {
- margin-top: 0 !important;
- }
- }
- .introduction {
- padding: 40rpx;
- .shop-text {
- margin-bottom: 17rpx;
- }
- .label {
- display: flex;
- align-items: center;
- margin-bottom: 10rpx;
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- color: #1a1a1a;
- .text-icon {
- font-size: 40rpx;
- color: #FF6600;
- margin-right: 5rpx;
- }
- }
- .text {
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: left;
- color: #666666;
- line-height: 40rpx;
- }
- }
- }
- }
- }
- </style>
|