123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- <template>
- <view class="one">
- <!-- 顶部搜索框 -->
- <!-- #ifndef MP -->
- <view class="header">
- <!-- #endif -->
- <!-- #ifdef MP -->
- <view class="header" :style="'height:'+(statusBarHeight+163)+'px;'">
- <!-- #endif -->
- <image :src="imgHost+'/statics/images/store-header.png'" mode="" class="header-img"></image>
- <navigator url="/pages/goods/goods_search/index" class="input acea-row row-center-wrapper" hover-class="none">
- <!-- #ifndef MP -->
- <view class="search">
- <!-- #endif -->
- <!-- #ifdef MP -->
- <view class="search on acea-row row-middle" style="height: 43px;" :style="'top:'+statusBarHeight+'px'">
- <view class="searchCon">
- <!-- #endif -->
- <text class="iconfont icon-xiazai5"></text>
- 搜索店内商品
- </view>
- <!-- #ifdef MP -->
- </view>
- <!-- #endif -->
- </navigator>
- <!-- 门店地址 -->
- <!-- #ifndef MP -->
- <view class="address">
- <!-- #endif -->
- <!-- #ifdef MP -->
- <view class="address" :style="'top:'+(statusBarHeight+68)+'px;'">
- <!-- #endif -->
- <view class="left">
- <view class="left-title" @click="goMap">
- <text class="iconfont icon-mendian"></text>
- <text class="text line1">{{info.name || '暂无门店'}}</text>
- <text class="iconfont icon-xiangyou"></text>
- </view>
- <!-- 营业时间 -->
- <view class="time">
- 营业时间:{{info.day_time || '-'}}
- </view>
- <view class="distance">
- <text class="iconfont icon-chakanditu"></text>
- 距您<text>{{info.range||0}}km</text>
- <text class="distance-name">{{info.detailed_address}}</text>
- </view>
-
- </view>
- <!-- 客服 -->
- <view class="right">
- <view class="kefu" @click="goKefu()">
- <text class="iconfont icon-kefu-mendian" />
- <text>客服</text>
- </view>
- <view class="goods" @click="shoppCart">
- <view class="cartNum" v-if="cart_num>0">
- {{cart_num}}
- </view>
- <text class="iconfont icon-gouwuche-mendian" />
- <text>购物车</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 商品排序条件 -->
- <view class="content">
- <view class="nav">
- <view @click="set_where(1)" :class="{'activeColor':active == 1}">
- 综合排序
- </view>
- <view @click='set_where(2)' :class="{'activeColor':active == 2}">
- 价格
- <image v-if="price==1" src="../../static/images/up.png" alt="" class="nav-img"></image>
- <image v-else-if="price==2" src='../../static/images/down.png' class="nav-img"></image>
- <image v-else src='../../static/images/horn.png' class="nav-img"></image>
- </view>
- <view @click='set_where(3)' :class="{'activeColor':active == 3}">
- 销量
- <image v-if="stock==1" src="../../static/images/up.png" alt="" class="nav-img"></image>
- <image v-else-if="stock==2" src='../../static/images/down.png' class="nav-img"></image>
- <image v-else src='../../static/images/horn.png' class="nav-img"></image>
- </view>
- <view @click="set_where(4)">
- <text class="iconfont icon-shaixuan"></text>
- 筛选
- </view>
- </view>
- </view>
- <!-- 商品列表 -->
- <view class="list waterList" >
- <waterfallsFlow ref="waterfallsFlow" :list="productList" @wapper-lick="godDetail">
- <!-- #ifdef MP-WEIXIN -->
- <view v-for="(item, index) of productList" :key="index" slot="slot{{index}}">
- <view class="waterfalls">
- <view class='name line2'>{{item.store_name}}</view>
- <span class="label"
- v-if="item.activity && item.activity.type === '1' && !promotions_type">秒杀</span>
- <span class="label"
- v-if="item.activity && item.activity.type === '2' && !promotions_type">砍价</span>
- <span class="label"
- v-if="item.activity && item.activity.type === '3' && !promotions_type">拼团</span>
- <text class="label" v-if="item.promotions.title">{{item.promotions.title}}</text>
- <view class="vip acea-row row-middle">
- <view class='money font-color'>
- ¥<text class='num'>{{item.price.toString().split(".")[0]}}</text>
- <text class='nums'
- v-if="item.price.toString().split('.').length>1">.{{item.price.toString().split(".")[1]}}</text>
- </view>
- <view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">
- <view>¥{{item.vip_price}}</view>
- <!-- <image src='../../static/images/vip.png' v-if="item.price_type == 'member'"></image> -->
- <view class="icon on" v-if="item.price_type && item.price_type == 'member'"><text
- class="iconfont icon-huangguan4"></text>SVIP</view>
- <view class="icon" v-if="item.price_type && item.price_type == 'level'"><text
- class="iconfont icon-dengjitubiao"></text>{{item.level_name}}</view>
- </view>
- </view>
- <view class='vip acea-row row-between-wrapper'>
- <view>已售{{item.sales}}{{item.unit_name || '件'}}</view>
- <view>评分 {{item.star}}</view>
- </view>
- </view>
- </view>
- <!-- #endif -->
-
- <!-- #ifndef MP-WEIXIN -->
- <template v-slot:default="item">
- <view class="waterfalls">
- <view class='name line2'>{{item.store_name}}</view>
- <span class="label"
- v-if="item.activity && item.activity.type === '1' && !promotions_type">秒杀</span>
- <span class="label"
- v-if="item.activity && item.activity.type === '2' && !promotions_type">砍价</span>
- <span class="label"
- v-if="item.activity && item.activity.type === '3' && !promotions_type">拼团</span>
- <text class="label" v-if="item.promotions.title">{{item.promotions.title}}</text>
- <view class="vip acea-row row-middle">
- <view class='money font-color'>
- ¥<text class='num'>{{item.price.toString().split(".")[0]}}</text>
- <text class='nums'
- v-if="item.price.toString().split('.').length>1">.{{item.price.toString().split(".")[1]}}</text>
- </view>
- <view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">
- <view>¥{{item.vip_price}}</view>
- <view class="icon on" v-if="item.price_type && item.price_type == 'member'"><text
- class="iconfont icon-huangguan4"></text>SVIP</view>
- <view class="icon" v-if="item.price_type && item.price_type == 'level'"><text
- class="iconfont icon-v"></text>{{item.level_name}}</view>
- </view>
- </view>
- <view class='vip acea-row row-between-wrapper'>
- <view>已售{{item.sales}}{{item.unit_name || '件'}}</view>
- <view>评分 {{item.star}}</view>
- </view>
- </view>
- </template>
- <!-- #endif -->
- </waterfallsFlow>
- <view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
- <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
- </view>
- </view>
- <!-- 商品列表 -->
- <view class="default" v-if="productList.length==0 && where.page > 1">
- <image :src="imgHost+'/statics/images/no-thing.png'" mode="" class="img"></image>
- <view class="text">
- 暂无商品,去添加点什么吧
- </view>
- </view>
- <!-- 筛选弹窗 -->
- <filterPopup ref="popup" :storeCategory="storeCategory" :storeBrand="storeBrand" @brandChange="brandChange"
- @categoryChange="categoryChange" @submitFn="submitFn"></filterPopup>
- <!-- 客服弹窗 -->
- <Kefu ref="kefu" @closeKefu="closeKefu" :customerList="customerList" :customerType="customerType"></Kefu>
- </view>
- </template>
- <script>
- let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
- import waterfallsFlow from "@/components/maramlee-waterfalls-flow/maramlee-waterfalls-flow.vue";
- import filterPopup from "@/components/filterPopup/index.vue";
- import Kefu from "@/components/kefu/index.vue"
- import {
- mapState,
- mapGetters
- } from 'vuex';
- import {
- getProducts,
- getCustomerList,
- getStoreCategory,
- getStoreBrand
- } from '@/api/new_store.js';
- import {
- goShopDetail
- } from '@/libs/order.js';
- import {
- HTTP_REQUEST_URL
- } from '@/config/app';
- export default {
- components: {
- filterPopup,
- waterfallsFlow,
- Kefu
- },
- props: {
- info: {
- type: Object,
- default: {}
- },
- customerType:{
- type:Number,
- default:1
- },
- cart_num:{
- type:Number,
- default:0
- }
- },
- computed: {
- ...mapState({
- cartNum: state => state.indexData.cartNum
- }),
- ...mapGetters(['isLogin', 'uid', 'cartNum']),
- },
- data() {
- return {
- statusBarHeight:statusBarHeight,
- imgHost: HTTP_REQUEST_URL,
- price: 0,
- stock: 0,
- productList: [], // 商品数据
- customerList: [], // 客服数据
- storeCategory: [], // 分类数据
- storeBrand: [], // 品牌数据
- show: false,
- active: 1,
- where: {
- cid: 0,
- sid: 0,
- keyword: '',
- priceOrder: '',
- salesOrder: '',
- news: 0,
- page: 1,
- limit: 5,
- store_id: 0,
- brand_id: '',
- },
- loading: false,
- loadend: false,
- loadTitle: '加载更多',
- }
- },
- mounted() {},
- methods: {
- // 选择品牌
- brandChange(val) {
- this.where.brand_id=val
- },
- // 选择分类
- categoryChange(val) {
- this.where.cid = val.cid
- this.where.sid = val.sid
- },
- // 确认提交
- submitFn(val) {
- if (val == 1) {
- this.getProducts(true)
- this.$refs.popup.visible = false
- } else if (val == 2) {
- this.where.brand_id = ""
- this.where.cid = ""
- this.where.sid = ""
- this.getProducts(true)
- this.$refs.popup.visible = false
- }
- },
- // 打开附近门店
- goMap() {
- uni.navigateTo({
- url: "/pages/store/map/index?storeFrom=1&type=1&storeId="+this.info.id
- })
- },
- // 打开客服
- goKefu() {
- this.getCustomerList()
- this.$refs.kefu.show = true
- },
- // 购物车
- shoppCart() {
- uni.switchTab({
- url: "/pages/order_addcart/order_addcart"
- })
- },
- // 关闭客服
- closeKefu() {
- this.$refs.kefu.show = false
- },
- // 获取客服列表数据
- getCustomerList() {
- getCustomerList(this.where.store_id).then(res => {
- this.customerList = res.data
- })
- },
- // 去详情页
- godDetail(item) {
- this.currentPage = false
- if (this.promotions_type) {
- uni.navigateTo({
- url: `/pages/goods_details/index?id=${item.id}`
- })
- } else {
- goShopDetail(item, this.uid).then(res => {
- uni.navigateTo({
- url: `/pages/goods_details/index?id=${item.id}`
- })
- })
- }
- },
- // 操作
- set_where: function(e) {
- switch (e) {
- case 1:
- this.active = 1
- this.where.priceOrder = ""
- this.where.salesOrder = ""
- this.where.brand_id = ""
- this.price= 0
- break;
- case 2:
- if (this.price == 0) this.price = 1;
- else if (this.price == 1) this.price = 2;
- else if (this.price == 2) this.price = 0;
- if (this.price == 1) {
- this.where.priceOrder = "asc"
- } else if (this.price == 2) {
- this.where.priceOrder = "desc"
- } else {
- this.where.priceOrder = ""
- }
- this.active = 2
- this.stock = 0;
- break;
- case 3:
- if (this.stock == 0) this.stock = 1;
- else if (this.stock == 1) this.stock = 2;
- else if (this.stock == 2) this.stock = 0;
- if (this.stock == 1) {
- this.where.priceOrder = ""
- this.where.salesOrder = "asc"
- } else if (this.stock == 2) {
- this.where.priceOrder = ""
- this.where.salesOrder = "desc"
- } else {
- this.where.salesOrder = ""
- }
- this.active = 3
- this.price = 0
- break;
- case 4:
- console.log('1111111111');
- this.getStoreCategory()
- this.getStoreBrand()
- this.$refs.popup.visible = true
- this.loadend = false;
- this.loading = false;
- break;
- }
- if(e<4){
- this.loadend = false;
- this.$set(this.where, 'page', 1);
- this.getProducts(true)
- }
- },
- // 商品列表
- getProducts(isPage) {
- let that = this;
- if (that.loadend) return;
- if (that.loading) return;
- if (isPage === true) {
- that.$refs.waterfallsFlow.refresh();
- that.where.page = 1;
- that.$set(that, 'productList', []);
- }
- that.loading = true;
- that.loadTitle = '';
- getProducts(this.where).then(res => {
- let list = res.data;
- let productList = that.$util.SplitArray(list, that.productList);
- let loadend = list.length < that.where.limit;
- that.loadend = loadend;
- that.loading = false;
- that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
- that.$set(that, 'productList', productList);
- that.$set(that.where, 'page', that.where.page + 1);
-
- }).catch(err => {
- that.loading = false;
- that.loadTitle = '加载更多'
- });
- },
- // 筛选-分类数据
- getStoreCategory() {
- let data = {
- pid: 0
- }
- getStoreCategory(data).then(res => {
- res.data.map(item => {
- this.$set(item, 'disabled', false)
- this.$set(item, 'current', -1)
- item.children.unshift({
- 'id': 0,
- 'cate_name': '全部'
- })
- })
- this.storeCategory = res.data
- })
- },
- // 筛选-品牌数据
- getStoreBrand() {
- getStoreBrand(this.where).then(res => {
- this.storeBrand = res.data
- })
- },
- // 触底刷新
- onReachBottom() {
- this.getProducts()
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #F5F5F5 !important;
- }
- .activeColor {
- color: var(--view-theme) !important;
- }
- .header {
- // #ifndef MP
- margin-bottom: 40rpx;
- // #endif
- .header-img {
- width: 100%;
- height: 300rpx;
- display: block;
- }
- .search {
- position: absolute;
- // #ifndef MP
- top: 56rpx;
- // #endif
- left: 20rpx;
- // #ifdef MP
- width: 520rpx;
- // #endif
- // #ifndef MP
- width: 710rpx;
- // #endif
- height: 64rpx;
- background: rgba(255, 255, 255, 0.2800);
- border-radius: 43rpx;
- font-weight: 400;
- color: #FFFFFF;
- font-size: 26rpx;
- line-height: 64rpx;
- &.on{
- background:unset;
- }
- .searchCon{
- width: 100%;
- height: 64rpx;
- background: rgba(255, 255, 255, 0.2800);
- border-radius: 43rpx;
- }
- .icon-xiazai5 {
- margin-left: 32rpx;
- margin-right: 12rpx;
- }
- }
- .address {
- position: absolute;
- top: 160rpx;
- margin: 0 20rpx;
- width: 710rpx;
- height: 192rpx;
- background: #fff;
- border-radius: 14rpx;
- padding: 30rpx 20rpx;
- display: flex;
- justify-content: space-between;
- .left {
- .left-title {
- height: 30rpx;
- line-height: 30rpx;
- display: flex;
- image {
- width: 30rpx;
- height: 28rpx;
- }
- .text {
- font-weight: 600;
- color: #333333;
- font-size: 30rpx;
- margin: 0 10rpx;
- max-width: 390rpx;
- }
- .icon-xiangyou {
- color: #333;
- font-size: 24rpx;
- }
- }
- .time {
- margin: 20rpx 0;
- font-size: 22rpx;
- font-weight: 400;
- color: #666666;
- }
- .distance {
- width: 500rpx;
- font-size: 22rpx;
- color: #666666;
- font-weight: 400;
- .icon-chakanditu {
- margin-right: 8rpx;
- font-size: 28rpx;
- color: #ccc;
- }
- .distance-name {
- display: inline-block;
- width: 286rpx;
- height: 22rpx;
- border-left: 1px solid #000;
- margin-left: 16rpx;
- line-height: 22rpx;
- text-align: left;
- padding-left: 16rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- }
- .right {
- margin-top: 36rpx;
- display: flex;
- font-size: 20rpx;
- color: #333333;
- .kefu {
- margin-right: 30rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- .icon-kefu-mendian {
- font-size: 36rpx;
- }
- }
- }
- .goods {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- .icon-gouwuche-mendian {
- font-size: 36rpx;
- }
- .cartNum {
- position: absolute;
- top: -8rpx;
- right: 2rpx;
- width: 30rpx;
- height: 30rpx;
- line-height: 30rpx;
- text-align: center;
- font-weight: 500;
- color: #FFFFFF;
- border-radius: 50%;
- background: var(--view-theme);
- border: 1px solid #FFFFFF;
- }
- }
- }
- }
- .goods-list {
- padding: 0 30rpx;
- margin-bottom: 50rpx !important;
- }
- .content {
- height: 100%;
- position: -webkit-sticky;
- position: sticky;
- top: var(--window-top);
- z-index: 99;
- // margin-bottom: 200rpx;
- .nav {
- padding: 40rpx 50rpx 40rpx 50rpx;
- display: flex;
- justify-content: space-between;
- font-size: 28rpx;
- font-weight: 500;
- color: #666666;
- background: #f5f5f5;
- .nav-img {
- width: 15rpx;
- height: 18rpx;
- margin-left: 10rpx;
- }
- .icon-shaixuan {
- font-size: 24rpx;
- margin-right: 10rpx;
- }
- }
- }
- .vip {
- margin: 20rpx 0 10rpx 0;
- .price {
- font-size: 34rpx;
- font-weight: 600;
- color: var(--view-theme);
- }
- .sold {
- font-size: 24rpx;
- font-weight: 400;
- color: #999999;
- }
- }
- .list {
- padding: 0 20rpx 90rpx 20rpx;
- }
- .list .waterList {
- margin-bottom: 60rpx;
- // margin-top: 192rpx;
- }
- .default {
- margin-top: 100rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- .img {
- width: 414rpx;
- height: 256rpx;
- }
- .text {
- font-size: 26rpx;
- font-weight: 400;
- color: #999999;
- }
- }
- .waterfalls {
- padding: 10rpx 16rpx 16rpx 16rpx;
- color: #222;
-
- .name {
- font-size: 28rpx;
- }
-
- .label {
- font-size: 20rpx;
- color: var(--view-theme);
- border-radius: 4rpx;
- border: 1px solid var(--view-theme);
- padding: 0 6rpx;
- display: inline-block;
- margin-top: 10rpx;
- margin-right: 10rpx;
- }
-
- .money {
- font-size: 26rpx;
- font-weight: 700;
-
- .num {
- font-size: 34rpx;
- }
-
- .nums {
- font-size: 28rpx;
- }
- }
-
- .vip {
- font-size: 22rpx;
- color: #aaa;
- margin-top: 6rpx;
-
- .vip-money {
- font-size: 24rpx;
- color: #282828;
- font-weight: bold;
- .icon{
- font-size: 15rpx;
- background: #FF9500;
- color: #fff;
- border-radius: 18rpx;
- padding: 1rpx 6rpx;
- margin-left: 10rpx;
- min-width: 60rpx;
-
- .iconfont {
- font-size: 15rpx;
- margin-right: 5rpx;
- }
-
- &.on {
- background: #333;
- color: #FDDAA4;
- min-width: unset;
- }
- }
-
- image {
- width: 46rpx;
- height: 21rpx;
- margin-left: 4rpx;
- }
- }
- }
- }
- </style>
|