1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429 |
- <template>
- <view class="container">
- <view class="headerBg">
- <image :src="info.background_image" mode="aspectFill" class="image"></image>
- <view class="shade"></view>
- <!-- #ifdef MP || APP -->
- <view :style="{height: getHeight.barTop+'px'}"></view>
- <view :style="{height: getHeight.barHeight+'px'}"></view>
- <!-- #endif -->
- <view style="height: 224rpx;"></view>
- </view>
- <view class="page">
- <view class="search-box" :style="{height: headerHeight ? (headerHeight+'px') : 'auto'}">
- <view class="input-box" id="input-box" :class="{fixed: scrollTop > 0}">
- <!-- #ifdef MP || APP -->
- <view :style="{height: getHeight.barTop+'px'}"></view>
- <!-- #endif -->
- <!-- 顶部搜索框 -->
- <!-- #ifdef MP -->
- <view class="input-wrapper acea-row row-middle" :style="{height: getHeight.barHeight+'px'}">
- <view class="menu_box flex-center" @tap="moreNav">
- <text class="iconfont icon-a-icon_menu1x"></text>
- </view>
- <navigator url="/pages/goods/goods_search/index" class="input acea-row row-middle" hover-class="none">
- <text class="iconfont icon-ic_search"></text>搜索商品
- </navigator>
- <view v-if="info.store_splicing_switch" class="group-btn" @click="onCollage">
- <image :src="imgHost+'/statics/images/group-btn.png'" mode="aspectFit" class="img"></image>
- </view>
- <view :style="{width: getHeight.barWidth+'px'}"></view>
- </view>
- <!-- #endif -->
- <!-- #ifndef MP -->
- <view class="input-wrapper acea-row row-middle">
- <view class="menu_box flex-center" @tap="moreNav">
- <text class="iconfont icon-a-icon_menu1x"></text>
- </view>
- <navigator url="/pages/goods/goods_search/index" class="input acea-row row-middle" hover-class="none">
- <text class="iconfont icon-ic_search"></text>搜索商品
- </navigator>
- <!-- #ifdef H5 -->
- <view v-if="info.store_splicing_switch && $wechat.isWeixin()" class="group-btn" @click="onCollage">
- <image :src="imgHost+'/statics/images/group-btn.png'" mode="aspectFit" class="img"></image>
- </view>
- <!-- #endif -->
- </view>
- <!-- #endif -->
- </view>
- </view>
- <!-- <scroll-view scroll-y="true" class="scroll-view" @scroll="goodsListScroll" @scrolltolower="getProducts"> -->
- <!-- 门店地址 -->
- <view class="store-section">
- <view class="panel">
- <view class="acea-row row-middle store-name">
- <view class="name-wrap">
- <navigator :url="'/pages/store/info/index?store_id='+info.id" hover-class="none" class="acea-row row-middle name-inner">
- <text class="iconfont icon-ic_mall"></text>
- <view class="name line1">{{info.name}}</view>
- <text class="iconfont icon-ic_rightarrow"></text>
- </navigator>
- </view>
- <!-- <view class="tips">门店支持自提</view> -->
- <view class="switch acea-row" v-if="deliveryList.length > 1">
- <view v-for="(item, index) in deliveryList" :key="item.key" :class="{ on: switchNum == item.key }" class="btn" @click="swithFn(item.key)">{{item.name}}</view>
- </view>
- <view class="tips" v-else-if="deliveryList.length == 1">门店支持{{deliveryList[0].name}}</view>
- </view>
- <view class="acea-row row-bottom address-wrap">
- <view class="address-box">
- <view class="time">营业时间:{{info.day_time}}</view>
- <view class="address-info">
- <text class="distance">距您{{info.range}}km</text>
- {{info.address}}{{info.detailed_address}}
- </view>
- </view>
- <view class="acea-row btn-box">
- <view class="btn" @click="showMaoLocation">
- <text class="iconfont icon-ic_location5"></text>
- <view class="">地图</view>
- </view>
- <view class="btn" @click="goKefu">
- <text class="iconfont icon-ic_customerservice"></text>
- <view class="">客服</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 商品排序条件 -->
- <view class="nav-box" id="nav-box">
- <view class="nav acea-row row-middle" :class="{ fixed: scrollTop && conterTop <= headerHeight }" :style="{ top: headerHeight+'px' }">
- <view class="flex-1 acea-row row-around row-middle">
- <view @click="set_where(1)" :class="{'activeColor':active == 1}">
- 默认排序
- </view>
- <view @click='set_where(2)' :class="{'activeColor':active == 2}">
- 价格
- <text v-if="price==2" class="iconfont icon-ic_down2"></text>
- <text v-else class="iconfont icon-ic_up2"></text>
- </view>
- <view @click='set_where(3)' :class="{'activeColor':active == 3}">
- 销量
- <text v-if="stock==2" class="iconfont icon-ic_down2"></text>
- <text v-else class="iconfont icon-ic_up2"></text>
- </view>
- </view>
- <view @click="set_where(4)" class="filter-btn">
- <view class="line-left"></view>
- 筛选
- <text class="iconfont icon-ic_sort"></text>
- </view>
- </view>
- </view>
- <!-- 商品列表 -->
- <view class="list waterList">
- <WaterfallsFlow ref="waterfallsFlow" :wfList="productList" @itemTap="godDetail"></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">
- <emptyPage title="暂无商品,去看点别的吧~"></emptyPage>
- </view>
- <!-- </scroll-view> -->
- <view class="footer">
- <view class="inner-box" :class="{ open: footerOpen }">
- <view class="inner acea-row row-between row-middle">
- <view class="acea-row row-bottom" style="flex-wrap: nowrap;">
- <BaseMoney :money="totalPrice" symbolSize="32" integerSize="48" decimalSize="32" color="#FFFFFF"></BaseMoney>
- <view class="detail-btn" style="white-space: nowrap;" @click="getCartLists">查看明细<text class="iconfont icon-ic_uparrow"></text></view>
- </view>
- <view class="btn" @click="subOrder">去结算({{cartNum}})</view>
- </view>
- </view>
- <view class="cartIcon" @click="getCartLists">
- <uni-badge :text="cartNum" absolute="rightTop" :offset="[6, 4]" :custom-style="{background: 'var(--view-theme)'}">
- <view class="image-wrap">
- <image src="@/static/img/cart_pic.png" class="image"></image>
- </view>
- </uni-badge>
- </view>
- </view>
- </view>
- <!-- 筛选弹窗 -->
- <filterPopup ref="popup" :level="level" :storeCategory="storeCategory" :storeBrand="storeBrand" @brandChange="brandChange" @categoryChange="categoryChange" @submitFn="submitFn"></filterPopup>
- <!-- 客服弹窗 -->
- <Kefu ref="kefu" @closeKefu="closeKefu" :customerList="customerList" :customerType="customerType"></Kefu>
- <!-- #ifdef H5 || MP -->
- <tuiDrawer :visible="collageVisible" :zIndex="970" :maskZIndex="960" mode="bottom" backgroundColor="transparent" @close="onCollageClose">
- <view class="dialog">
- <view class="dialog-head acea-row row-between row-middle">
- <view>发起「一起拼」</view>
- <view class="btn" @click="onCollageClose">
- <text class="iconfont icon-ic_close"></text>
- </view>
- </view>
- <view class="dialog-body">
- <view class="navbar">
- <view class="navbar-bg"></view>
- <view class="active-bg acea-row row-bottom" :class="{'row-right':collageDelivery==1}">
- <image v-if="collageDelivery==1" class="image2" src="../static/navbar-right-2.png"></image>
- <image class="image1" src="../static/navbar-left-1.png"></image>
- <image v-if="collageDelivery==2" class="image2" src="../static/navbar-left-2.png"></image>
- </view>
- <view class="inner acea-row">
- <view v-for="(item, index) in deliveryList" :key="item.key" :class="{ on: collageDelivery == item.key }" class="item acea-row row-center-wrapper"
- @click="collageDeliveryChange(item, index)">
- <text :class="'iconfont '+item.icon"></text>
- {{item.name}}
- </view>
- </view>
- </view>
- <view class="dialog-content" :class="{
- btl:collageIndex==deliveryList.length-1,
- btr:!collageIndex
- }">
- <scroll-view v-if="collageDelivery == 1 && addressList.length" scroll-y="true" class="address-box">
- <view class="list">
- <view v-for="(item, index) in addressList" :key="item.id" :class="{ on: item.id == addressId }" class="item acea-row row-middle" @click="onAddressChange(item)">
- <view class="text">
- <view class="info">{{item.province}}{{item.city}}{{item.district}}{{item.street}}{{item.detail}}</view>
- <view class="name">{{item.real_name}} {{item.phone}}</view>
- </view>
- <text class="iconfont icon-ic_complete"></text>
- </view>
- </view>
- </scroll-view>
- <navigator v-if="collageDelivery == 1 && !addressList.length" class="link" url="/pages/users/user_address/index?fromType=1" hover-class="none">
- <view class="title acea-row row-between-wrapper">
- <view>添加配送地址</view>
- <text class="iconfont icon-ic_rightarrow"></text>
- </view>
- <view>您还未添加配送地址,先去添加地址再下单吧~</view>
- </navigator>
- <view v-if="collageDelivery == 2" class="store-box acea-row">
- <view class="text">
- <view class="name">{{collageStore.name}}</view>
- <view class="info acea-row">
- <text class="iconfont icon-ic_location51"></text>
- <view class="value">{{collageStore.address}}{{collageStore.detailed_address}}</view>
- </view>
- <view class="info acea-row">
- <text class="iconfont icon-icon_clock"></text>
- <view class="value">营业时间:{{collageStore.day_time}}</view>
- </view>
- </view>
- <view class="map-box">
- <image src="../static/map2.png" class="map"></image>
- <view class="img-box">
- <image :src="collageStore.image" class="img"></image>
- <view class="range">距您{{collageStore.range}}km</view>
- <view class="dot"></view>
- </view>
- </view>
- </view>
- <view class="btn-box acea-row row-center-wrapper" v-if="collageDelivery == 1 && addressList.length">
- <navigator url="/pages/users/user_address/index?fromType=1" hover-class="none">
- 添加地址
- <text class="iconfont icon-ic_rightarrow"></text>
- </navigator>
- </view>
- </view>
- </view>
- <view class="dialog-foot">
- <view class="btn" @click="initCollage">发起拼单</view>
- </view>
- </view>
- </tuiDrawer>
- <!-- 商品属性弹窗 -->
- <productWindow :attr="attr" :isShow="1" :iSplus="1" :iScart="1" :type="2" @myevent="onMyEvent" @attrVal="attrVal" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNumDuo"
- @iptCartNum="iptCartNum" @goCat="goCatNum">
- </productWindow>
- <!-- #endif -->
- <homeList :currentPage="currentPage" :navH="getHeight.barTop+40" :openNavList="diyProduct.navList"></homeList>
- <cartList :marginBottom="74" :cartData="cartData" @closeList="closeList" @ChangeCartNumDan="ChangeCartList" @ChangeSubDel="ChangeSubDel" @ChangeOneDel="ChangeOneDel"></cartList>
- </view>
- </template>
- <script>
- import filterPopup from "@/components/filterPopup/index.vue";
- import Kefu from "@/components/kefu/index.vue";
- import WaterfallsFlow from "@/components/WaterfallsFlow/WaterfallsFlow.vue";
- import productWindow from "@/components/productWindow/index.vue";
- import emptyPage from "@/components/emptyPage.vue";
- import homeList from "@/components/homeList/index.vue";
- import cartList from "@/components/cartList/index.vue";
- import tuiDrawer from "@/components/tui-drawer/tui-drawer.vue";
- import {
- mapState,
- mapGetters
- } from 'vuex';
- import {
- vcartList,
- getCartCounts,
- cartDel
- } from '@/api/order.js';
- import {
- getProducts,
- getCustomerList,
- getStoreCategory,
- getStoreBrand
- } from '@/api/new_store.js';
- import {
- goShopDetail
- } from '@/libs/order.js';
- import {
- HTTP_REQUEST_URL
- } from '@/config/app';
- import {
- // #ifdef MP || H5
- hasCollage,
- // #endif
- getAttr,
- initCollage,
- isWithin,
- } from '@/api/store.js';
- // #ifdef H5 || MP
- import {
- getAddressList,
- } from '@/api/user.js';
- // #endif
- // #ifdef H5
- import {
- toLogin
- } from '@/libs/login.js';
- // #endif
- import skuSelect from '@/mixins/skuSelect.js';
- export default {
- components: {
- filterPopup,
- Kefu,
- WaterfallsFlow,
- productWindow,
- emptyPage,
- homeList,
- cartList,
- tuiDrawer,
- },
- props: {
- info: {
- type: Object,
- default: {}
- },
- customerType: {
- type: Number,
- default: 1
- },
- cart_num: {
- type: Number,
- default: 0
- },
- },
- mixins: [skuSelect],
- computed: {
- ...mapState({
- // cartNum: state => state.indexData.cartNum
- }),
- ...mapGetters(['isLogin', 'uid', 'cartNum', 'diyProduct', 'diyCategory']),
- level() {
- return this.diyCategory.level
- },
- },
- provide: {
- parent: {}
- },
- data() {
- return {
- id: 0,
- getHeight: this.$util.getWXStatusHeight(),
- imgHost: HTTP_REQUEST_URL,
- price: 0,
- stock: 0,
- productList: [], // 商品数据
- customerList: [], // 客服数据
- storeCategory: [], // 分类数据
- storeBrand: [], // 品牌数据
- show: false,
- active: 1,
- where: {
- cid: 0,
- sid: 0,
- tid: 0,
- keyword: '',
- priceOrder: '',
- salesOrder: '',
- news: 0,
- page: 1,
- limit: 5,
- store_id: 0,
- brand_id: '',
- },
- loading: false,
- loadend: false,
- loadTitle: '加载更多',
- deliveryList: [{
- name: '自提',
- key: 2,
- icon: 'icon-icon_shop1'
- },
- {
- name: '配送',
- key: 1,
- icon: 'icon-icon_electromobile'
- },
- ],
- switchNum: 1,
- // #ifdef H5 || MP
- collageVisible: false,
- collageDelivery: 2,
- collageIndex: 0,
- collageAddress: {},
- collageStore: {},
- // #endif
- // #ifdef MP
- isSplicingPlatform: true,
- // #endif
- // #ifndef MP
- isSplicingPlatform: false,
- // #endif
- drawervisible: true,
- footerOpen: false,
- totalPrice: 0,
- cartData: {
- cartList: [],
- iScart: false
- },
- attr: {
- cartAttr: false,
- productAttr: [],
- productSelect: {},
- deliveryType: [],
- },
- is_vip: 0, //是否是会员
- storeInfo: {},
- attrValue: '', //已选属性
- currentPage: false,
- tempArr: [],
- headerHeight: 0,
- conterTop: 0,
- scrollTop: 0, //已滚动的距离
- addressId: 0, // 配送地址id
- addressList: [], // 配送地址列表
- }
- },
- mounted() {
- let default_delivery = this.info.default_delivery;
- for (let i = 0; i < this.deliveryList.length; i++) {
- if (this.deliveryList[i].key == 2 && (!this.info.store_self_mention || !this.info.is_store)) {
- this.deliveryList.splice(i, 1);
- i--;
- }
- }
- if (this.deliveryList.length == 1) {
- default_delivery = this.deliveryList[0].key;
- }
- this.collageStore = this.info;
- this.where.store_id = this.info.id;
- this.switchNumFun(default_delivery);
- // #ifdef H5
- this.isSplicingPlatform = this.$wechat.isWeixin();
- // #endif
- // #ifdef H5 || MP
- if (this.isSplicingPlatform && this.info.store_splicing_switch) {
- this.collageDelivery = this.info.is_store ? 2 : 1;
- uni.$on('activeFn', data => {
- this.collageStore = data;
- });
- }
- // #endif
- this.$eventHub.$on('onCartAddChange', (data) => {
- let index = -1;
- for (let i = 0; i < this.productList.length; i++) {
- if (this.productList[i].id == data.id) {
- index = i;
- break;
- }
- }
- if (data.spec_type) {
- this.goCartDuo(data);
- } else {
- this.goCartDan(data, index);
- }
- });
- let view = uni.createSelectorQuery().in(this).select("#nav-box");
- // 页面滚动
- uni.$on('onPageScroll', ({
- scrollTop
- }) => {
- this.scrollTop = scrollTop;
- this.footerOpen = false;
- view
- .boundingClientRect((data) => {
- this.conterTop = data.top;
- })
- .exec();
- });
- // 页面滚动到底部
- uni.$on('onReachBottom', () => {
- this.getProducts();
- });
- uni.$on('activeAddress', () => {
- this.getAddressList();
- });
- this.getProducts(true);
- this.getCartNum();
- this.getCartList(1);
- this.getAddressList();
- },
- methods: {
- productslist() {
- this.getProducts(true);
- },
- // #ifdef H5 || MP
- showMaoLocation() {
- let data = {
- latitude: Number(this.collageStore.latitude),
- longitude: Number(this.collageStore.longitude),
- name: this.collageStore.name,
- address: `${this.collageStore.address}`,
- };
- // #ifdef H5
- if (this.$wechat.isWeixin()) {
- data.scale = 13;
- return this.$wechat.seeLocation(data);
- }
- // #endif
- uni.openLocation(data);
- },
- // #endif
- // 选择品牌
- brandChange(val) {
- this.where.brand_id = val
- },
- // 选择分类
- categoryChange(val) {
- this.where.cid = val.cid
- this.where.sid = val.sid
- this.where.tid = val.tid
- },
- // 确认提交
- 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(val = 0) {
- uni.navigateTo({
- url: `/pages/store/store_list/index?storeFrom=1&type=1&storeId=${val ? this.collageStore.id : this.info.id}&isCollage=${val}`
- });
- },
- // 打开客服
- 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).catch(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:
- 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 = '';
- that.where.delivery_type = that.delivery_type;
- 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);
- that.$set(that, 'tempArr', productList);
- this.$nextTick(() => {
- const query = uni.createSelectorQuery().in(this);
- query
- .select("#input-box")
- .boundingClientRect((data) => {
- this.headerHeight = data.height;
- })
- .exec();
- // query
- // .select("#nav-box")
- // .boundingClientRect((data) => {
- // this.conterTop = data.top;
- // })
- // .exec();
- })
- }).catch(err => {
- that.loading = false;
- that.loadTitle = '加载更多'
- });
- },
- // 切换自提方式
- swithFn(num) {
- this.switchNumFun(num);
- this.page = 1;
- this.loadend = false;
- this.tempArr = []
- this.getProducts(true)
- },
- switchNumFun(num) {
- switch (num) {
- case 1:
- this.switchNum = 1
- this.delivery_type = '3'
- break;
- case 2:
- this.switchNum = 2
- this.delivery_type = '2'
- break;
- }
- },
- // 筛选-分类数据
- getStoreCategory() {
- let data = {
- pid: 0
- }
- getStoreCategory(data).then(res => {
- res.data.map(item => {
- this.$set(item, 'disabled', false)
- this.$set(item, 'current', 0)
- // item.children.unshift({
- // 'id': 0,
- // 'cate_name': '全部'
- // })
- item.children.map(items => {
- this.$set(items, 'disabled', false)
- this.$set(items, 'current', 0)
- // item.children.unshift({
- // 'id': 0,
- // 'cate_name': '全部'
- // })
- })
- })
- this.storeCategory = res.data
- })
- },
- // 筛选-品牌数据
- getStoreBrand() {
- getStoreBrand(this.where).then(res => {
- this.storeBrand = res.data
- })
- },
- // #ifdef H5 || MP
- onCollage() {
- if (!this.isLogin) {
- return toLogin();
- }
- hasCollage().then(res => {
- const collageId = res.data.collageId;
- if (collageId) {
- uni.navigateTo({
- url: `/pages/store/group_buy/index?collage_id=${collageId}`
- });
- } else {
- this.collageVisible = true;
- }
- });
- },
- onCollageClose() {
- this.collageVisible = false;
- },
- initCollage() {
- let data = {
- store_id: this.collageStore.id,
- address_id: this.collageAddress.id || 0,
- shipping_type: this.collageDelivery == 1 ? 3 : 2
- };
- initCollage(data).then(res => {
- this.collageVisible = false;
- uni.navigateTo({
- url: `/pages/store/group_buy/index?collage_id=${res.data.collageId}`
- });
- }).catch(err => {
- this.$util.Tips({
- title: err
- });
- });
- },
- collageDeliveryChange(item, index) {
- if (item.key != 2 || this.info.is_store) {
- this.collageDelivery = item.key;
- this.collageIndex = index;
- }
- },
- onAddressChange(data) {
- isWithin({
- store_id: this.collageStore.id,
- address_id: data.id
- }).then(() => {
- this.addressId = data.id;
- }).catch(() => {
- this.$util.Tips({
- title: '您选择的地址超出门店配送范围,请重新选择'
- });
- });
- },
- // #endif
- // 生成订单;
- subOrder: function() {
- let that = this,
- list = that.cartData.cartList,
- ids = [];
- if (list.length) {
- list.forEach(item => {
- if (item.attrStatus && item.status) {
- ids.push(item.id)
- }
- });
- uni.navigateTo({
- url: '/pages/goods/order_confirm/index?is_store=1&cartId=' + ids.join(',') + '&delivery_type=' + that.delivery_type + '&store_id=' + that.info.id
- });
- that.cartData.iScart = false;
- } else {
- return that.$util.Tips({
- title: '请选择产品'
- });
- }
- },
- // 计算总价;
- getTotalPrice: function() {
- let that = this,
- list = that.cartData.cartList,
- totalPrice = 0.00;
- list.forEach(item => {
- if (item.attrStatus && item.status) {
- totalPrice = that.$util.$h.Add(totalPrice, that.$util.$h.Mul(item.cart_num, item
- .truePrice));
- }
- })
- // if(num){
- // data.forEach(item => {
- // totalPrice = that.$util.$h.Sub(totalPrice, that.$util.$h.Mul(item.cart_num, item.sum_price));
- // })
- // }
- that.$set(that, 'totalPrice', totalPrice);
- },
- getCartLists(iSshow) {
- if (this.footerOpen) {
- this.getCartList();
- } else {
- this.footerOpen = true;
- }
- },
- getCartList(iSshow) {
- let that = this;
- let data = {
- store_id: that.info.id
- };
- vcartList(data).then(res => {
- that.$set(that.cartData, 'cartList', res.data);
- if (res.data.length) {
- that.$set(that.cartData, 'iScart', iSshow ? false : !that.cartData.iScart);
- } else {
- that.$set(that.cartData, 'iScart', false);
- }
- that.getTotalPrice();
- })
- },
- // 商品详情接口;
- getAttrs(id) {
- let that = this;
- getAttr(id, 0).then(res => {
- // uni.hideLoading();
- that.$set(that.attr, 'productAttr', res.data.productAttr);
- that.$set(that, 'productValue', res.data.productValue);
- that.$set(that, 'is_vip', res.data.storeInfo.is_vip);
- that.$set(that, 'storeInfo', res.data.storeInfo);
- that.DefaultSelect();
- })
- },
- moreNav() {
- this.currentPage = !this.currentPage;
- },
- goodsListScroll() {
- this.footerOpen = false;
- this.currentPage = false;
- },
- getCartNum: function() {
- let that = this;
- getCartCounts(0, that.info.id).then(res => {
- this.$store.commit('indexData/setCartNum', res.data.count)
- });
- },
- closeList(e) {
- this.$set(this.cartData, 'iScart', e);
- },
- getAddressList() {
- getAddressList({
- page: 1,
- limit: 100
- }).then(res => {
- let addressList = res.data;
- this.addressList = addressList;
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .container {}
- .activeColor {
- color: var(--view-theme) !important;
- }
- .headerBg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- .image {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
- .shade {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: linear-gradient(180deg, rgba(0, 0, 0, 0.4047) 0%, #F5F5F5 100%);
- }
- }
- .nav-box {
- height: 98rpx;
- }
- .nav {
- top: 0;
- right: 0;
- left: 0;
- z-index: 10;
- height: 98rpx;
- font-size: 30rpx;
- color: #666666;
- background: #F5F5F5;
- &.fixed {
- background: #FFFFFF;
- }
- .iconfont {
- margin-left: 6rpx;
- vertical-align: middle;
- font-size: 14rpx;
- }
- .icon-ic_sort {
- margin-left: 8rpx;
- font-size: 28rpx;
- }
- }
- .list {
- padding: 0 20rpx;
- background: #F5F5F5;
- }
- .list .waterList {
- margin-bottom: 60rpx;
- }
- .default {
- padding: 0 20rpx;
- }
- .input-wrapper {
- position: relative;
- height: 78rpx;
- padding: 0 24rpx;
- .input {
- flex: 1;
- min-width: 0;
- height: 58rpx;
- padding-left: 24rpx;
- border-radius: 29rpx;
- background: rgba(255, 255, 255, 0.2);
- font-size: 24rpx;
- color: #FFFFFF;
- .iconfont {
- margin-right: 16rpx;
- font-size: 32rpx;
- }
- }
- .group-btn {
- width: 80rpx;
- height: 64rpx;
- border-radius: 50%;
- margin-left: 16rpx;
- .img {
- width: 100%;
- height: 100%;
- }
- }
- }
- /* #ifdef H5 || MP */
- .dialog {
- padding: 44rpx 20rpx 0;
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- border-radius: 40rpx 40rpx 0 0;
- background: linear-gradient(180deg, #F5F5F5 0%, #F5F5F5 0%, #FFFFFF 100%);
- }
- .dialog-head {
- padding: 0 24rpx;
- font-weight: 500;
- font-size: 32rpx;
- color: #333333;
- .btn {
- width: 40rpx;
- height: 40rpx;
- cursor: pointer;
- .iconfont {
- font-size: 40rpx;
- color: #BBBBBB;
- }
- }
- }
- .dialog-body {
- margin-top: 48rpx;
- .navbar {
- flex-shrink: 0;
- position: relative;
- height: 82rpx;
- .navbar-bg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 190rpx;
- border-radius: 16rpx 16rpx 0 0;
- background: #EEEEEE;
- }
- .active-bg {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 96rpx;
- .image1 {
- width: 50%;
- height: 100%;
- }
- .image2 {
- width: 48rpx;
- height: 78rpx;
- }
- }
- .inner {
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 100%;
- .item {
- flex: 1;
- min-width: 0;
- font-size: 28rpx;
- line-height: 44rpx;
- color: #666666;
- .iconfont {
- display: none;
- margin-right: 8rpx;
- font-size: 36rpx;
- }
- &.on {
- font-weight: 500;
- font-size: 32rpx;
- color: var(--view-theme);
- .iconfont {
- display: inline-block;
- }
- }
- }
- }
- }
- .dialog-content {
- position: relative;
- border-radius: 0 0 16rpx 16rpx;
- background: #FFFFFF;
- &.btl {
- border-top-left-radius: 24rpx;
- }
- &.btr {
- border-top-right-radius: 24rpx;
- }
- .link {
- padding: 40rpx 32rpx;
- font-size: 22rpx;
- line-height: 30rpx;
- color: #999999;
- .title {
- margin-bottom: 16rpx;
- font-weight: 500;
- font-size: 28rpx;
- line-height: 40rpx;
- color: #333333;
- }
- .iconfont {
- font-size: 32rpx;
- }
- }
- }
- .address-box {
- height: 388rpx;
- .list {
- padding: 36rpx 32rpx;
- background-color: transparent;
- }
- .item {
- margin-top: 32rpx;
- color: #333333;
- &:first-child {
- margin-top: 0;
- }
- .text {
- flex: 1;
- }
- .info {
- font-weight: 500;
- font-size: 28rpx;
- line-height: 40rpx;
- }
- .name {
- margin-top: 8rpx;
- font-size: 22rpx;
- line-height: 30rpx;
- color: #999999;
- }
- .iconfont {
- visibility: hidden;
- font-size: 36rpx;
- }
- &.on {
- color: var(--view-theme);
- .name {
- color: var(--view-theme);
- }
- .iconfont {
- visibility: visible;
- }
- }
- }
- }
- .btn-box {
- height: 88rpx;
- font-size: 24rpx;
- line-height: 34rpx;
- color: #666666;
- .iconfont {
- margin-left: 4rpx;
- font-size: 24rpx;
- }
- }
- .store-box {
- padding: 40rpx 28rpx 40rpx 32rpx;
- .text {
- flex: 1;
- }
- .name {
- font-weight: 500;
- font-size: 28rpx;
- line-height: 40rpx;
- color: #333333;
- }
- .info {
- margin-top: 16rpx;
- font-size: 22rpx;
- line-height: 30rpx;
- color: #999999;
- }
- .value {
- flex: 1;
- }
- .iconfont {
- margin-right: 12rpx;
- font-size: 22rpx;
- }
- .map-box {
- position: relative;
- width: 188rpx;
- height: 104rpx;
- margin-left: 32rpx;
- .map {
- width: 100%;
- height: 100%;
- }
- .img-box {
- position: absolute;
- bottom: 16rpx;
- left: 50%;
- width: 52rpx;
- height: 52rpx;
- padding: 6rpx;
- border-radius: 6rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0, 0, 0, 0.0784);
- transform: translateX(-50%);
- }
- .img {
- width: 100%;
- height: 100%;
- border-radius: 6rpx;
- }
- .range {
- position: absolute;
- top: -40rpx;
- left: 50%;
- height: 36rpx;
- padding: 0 16rpx;
- border-radius: 6rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0, 0, 0, 0.0784);
- transform: translateX(-50%);
- white-space: nowrap;
- font-size: 20rpx;
- line-height: 36rpx;
- color: #333333;
- &::after {
- content: "";
- position: absolute;
- bottom: 0;
- left: 50%;
- width: 0;
- height: 0;
- border-width: 5rpx 9rpx;
- border-style: solid;
- border-color: #FFFFFF transparent transparent;
- transform: translate(-50%, 100%);
- }
- }
- .dot {
- position: absolute;
- bottom: -10rpx;
- left: 50%;
- width: 6rpx;
- height: 6rpx;
- border-radius: 50%;
- background: var(--view-theme);
- transform: translateX(-50%);
- }
- }
- }
- }
- .dialog-foot {
- padding: 20rpx 0;
- .btn {
- height: 72rpx;
- border-radius: 36rpx;
- background: var(--view-theme);
- text-align: center;
- font-weight: 500;
- font-size: 26rpx;
- line-height: 72rpx;
- color: #FFFFFF;
- }
- }
- /* #endif */
- .page {
- position: relative;
- }
- .store-section {
- padding: 20rpx;
- .panel {
- padding: 0 32rpx 32rpx;
- border-radius: 16rpx;
- background: #FFFFFF;
- }
- .store-name {
- height: 92rpx;
- .name-wrap {
- flex: 1;
- min-width: 0;
- }
- .name-inner {
- display: inline-flex;
- max-width: 100%;
- }
- .name {
- flex: 1;
- min-width: 0;
- margin: 0 8rpx 0 10rpx;
- font-weight: 500;
- font-size: 30rpx;
- color: #333333;
- }
- .iconfont {
- font-size: 32rpx;
- color: #333333;
- }
- .tips {
- font-size: 24rpx;
- color: var(--view-theme);
- }
- }
- .address-wrap {
- .address-box {
- flex: 1;
- min-width: 0;
- font-size: 22rpx;
- color: #666666;
- }
- .address-info {
- margin-top: 20rpx;
- line-height: 34rpx;
- }
- .distance {
- position: relative;
- padding-right: 12rpx;
- margin-right: 12rpx;
- &::after {
- content: "";
- position: absolute;
- top: 50%;
- right: 0;
- width: 1rpx;
- height: 18rpx;
- background: #CCCCCC;
- transform: translateY(-50%);
- }
- }
- .btn {
- position: relative;
- padding-left: 24rpx;
- margin-left: 24rpx;
- text-align: center;
- font-size: 20rpx;
- color: #333333;
- &::before {
- content: "";
- position: absolute;
- top: 50%;
- left: 0;
- width: 2rpx;
- height: 24rpx;
- background: #EEEEEE;
- transform: translateY(-50%);
- }
- &:first-child::before {
- display: none;
- }
- .iconfont {
- display: inline-block;
- margin-bottom: 8rpx;
- font-size: 40rpx;
- }
- }
- }
- .switch {
- width: 192rpx;
- height: 48rpx;
- background: #F5F5F5;
- border-radius: 24rpx;
- .btn {
- width: 96rpx;
- height: 48rpx;
- border-radius: 24rpx;
- text-align: center;
- font-size: 24rpx;
- line-height: 48rpx;
- color: #999999;
- &.on {
- background: var(--view-theme);
- color: #FFFFFF;
- }
- }
- }
- }
- .line-left {
- position: absolute;
- top: 50%;
- left: 0;
- width: 1rpx;
- height: 26rpx;
- background: #CCCCCC;
- transform: translateY(-50%);
- }
- .filter-btn {
- position: relative;
- padding: 0 32rpx;
- }
- </style>
|