store_cate2.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. <template>
  2. <view class="one">
  3. <!-- 顶部搜索框 -->
  4. <!-- #ifndef MP -->
  5. <view class="header">
  6. <!-- #endif -->
  7. <!-- #ifdef MP -->
  8. <view class="header" :style="'height:'+(statusBarHeight+163)+'px;'">
  9. <!-- #endif -->
  10. <image :src="imgHost+'/statics/images/store-header.png'" mode="" class="header-img"></image>
  11. <!-- #ifdef MP -->
  12. <view class="input-wrapper acea-row row-middle" :style="'top:'+statusBarHeight+'px'">
  13. <button v-if="info.store_splicing_switch" class="group-button acea-row row-middle" hover-class="none" @tap="onCollage">
  14. <text class="iconfont icon-pindan"></text>拼单
  15. </button>
  16. <navigator url="/pages/goods/goods_search/index" class="input acea-row row-center-wrapper" hover-class="none">
  17. <view class="search on acea-row row-middle" style="height: 43px;">
  18. <view class="searchCon">
  19. <text class="iconfont icon-xiazai5"></text>
  20. </view>
  21. </view>
  22. </navigator>
  23. </view>
  24. <!-- #endif -->
  25. <!-- #ifndef MP -->
  26. <view class="input-wrapper acea-row row-middle">
  27. <button v-if="isSplicingPlatform && info.store_splicing_switch" class="group-button acea-row row-middle" hover-class="none" @tap="onCollage">
  28. <text class="iconfont icon-pindan"></text>拼单
  29. </button>
  30. <navigator url="/pages/goods/goods_search/index" class="input acea-row row-center-wrapper" hover-class="none">
  31. <view class="search">
  32. <text class="iconfont icon-xiazai5"></text>
  33. </view>
  34. </navigator>
  35. </view>
  36. <!-- #endif -->
  37. <!-- 门店地址 -->
  38. <!-- #ifndef MP -->
  39. <view class="address">
  40. <!-- #endif -->
  41. <!-- #ifdef MP -->
  42. <view class="address" :style="'top:'+(statusBarHeight+68)+'px;'">
  43. <!-- #endif -->
  44. <view class="left">
  45. <view class="left-title" @click="goMap">
  46. <text class="iconfont icon-mendian"></text>
  47. <text class="text line1">{{info.name || '暂无门店'}}</text>
  48. <text class="iconfont icon-xiangyou"></text>
  49. </view>
  50. <!-- 营业时间 -->
  51. <view class="time">
  52. 营业时间:{{info.day_time || '-'}}
  53. </view>
  54. <view class="distance">
  55. <text class="iconfont icon-chakanditu"></text>
  56. 距您<text>{{info.range||0}}km</text>
  57. <text class="distance-name">{{info.detailed_address}}</text>
  58. </view>
  59. </view>
  60. <!-- 客服 -->
  61. <view class="right">
  62. <view class="kefu" @click="goKefu()">
  63. <text class="iconfont icon-kefu-mendian" />
  64. <text>客服</text>
  65. </view>
  66. <view class="goods" @click="shoppCart">
  67. <!-- <view class="cartNum" v-if="cart_num>0">
  68. {{cart_num}}
  69. </view>
  70. <text class="iconfont icon-gouwuche-mendian" /> -->
  71. <uni-badge class="uni-badge-left-margin" :text="cart_num" absolute="rightTop">
  72. <view class="iconfont icon-gouwuche-mendian"></view>
  73. </uni-badge>
  74. <text>购物车</text>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 商品排序条件 -->
  80. <view class="content">
  81. <view class="nav">
  82. <view @click="set_where(1)" :class="{'activeColor':active == 1}">
  83. 综合排序
  84. </view>
  85. <view @click='set_where(2)' :class="{'activeColor':active == 2}">
  86. 价格
  87. <image v-if="price==1" src="../../static/images/up.png" alt="" class="nav-img"></image>
  88. <image v-else-if="price==2" src='../../static/images/down.png' class="nav-img"></image>
  89. <image v-else src='../../static/images/horn.png' class="nav-img"></image>
  90. </view>
  91. <view @click='set_where(3)' :class="{'activeColor':active == 3}">
  92. 销量
  93. <image v-if="stock==1" src="../../static/images/up.png" alt="" class="nav-img"></image>
  94. <image v-else-if="stock==2" src='../../static/images/down.png' class="nav-img"></image>
  95. <image v-else src='../../static/images/horn.png' class="nav-img"></image>
  96. </view>
  97. <view @click="set_where(4)">
  98. <text class="iconfont icon-shaixuan"></text>
  99. 筛选
  100. </view>
  101. </view>
  102. </view>
  103. <!-- 商品列表 -->
  104. <view class="list waterList" >
  105. <waterfallsFlow ref="waterfallsFlow" :list="productList" @wapper-lick="godDetail">
  106. <!-- #ifdef MP-WEIXIN -->
  107. <view v-for="(item, index) of productList" :key="index" slot="slot{{index}}">
  108. <view class="waterfalls">
  109. <view class='name line2'>{{item.store_name}}</view>
  110. <span class="label"
  111. v-if="item.activity && item.activity.type === '1' && !promotions_type">秒杀</span>
  112. <span class="label"
  113. v-if="item.activity && item.activity.type === '2' && !promotions_type">砍价</span>
  114. <span class="label"
  115. v-if="item.activity && item.activity.type === '3' && !promotions_type">拼团</span>
  116. <text class="label" v-if="item.promotions.title">{{item.promotions.title}}</text>
  117. <view class="vip acea-row row-middle">
  118. <view class='money font-color'>
  119. ¥<text class='num'>{{item.price.toString().split(".")[0]}}</text>
  120. <text class='nums'
  121. v-if="item.price.toString().split('.').length>1">.{{item.price.toString().split(".")[1]}}</text>
  122. </view>
  123. <view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">
  124. <view>¥{{item.vip_price}}</view>
  125. <!-- <image src='../../static/images/vip.png' v-if="item.price_type == 'member'"></image> -->
  126. <view class="icon on" v-if="item.price_type && item.price_type == 'member'"><text
  127. class="iconfont icon-huangguan4"></text>SVIP</view>
  128. <view class="icon" v-if="item.price_type && item.price_type == 'level'"><text
  129. class="iconfont icon-dengjitubiao"></text>{{item.level_name}}</view>
  130. </view>
  131. </view>
  132. <view class='vip acea-row row-between-wrapper'>
  133. <view>已售{{item.sales}}{{item.unit_name || '件'}}</view>
  134. <view>评分 {{item.star}}</view>
  135. </view>
  136. </view>
  137. </view>
  138. <!-- #endif -->
  139. <!-- #ifndef MP-WEIXIN -->
  140. <template v-slot:default="item">
  141. <view class="waterfalls">
  142. <view class='name line2'>{{item.store_name}}</view>
  143. <span class="label"
  144. v-if="item.activity && item.activity.type === '1' && !promotions_type">秒杀</span>
  145. <span class="label"
  146. v-if="item.activity && item.activity.type === '2' && !promotions_type">砍价</span>
  147. <span class="label"
  148. v-if="item.activity && item.activity.type === '3' && !promotions_type">拼团</span>
  149. <text class="label" v-if="item.promotions.title">{{item.promotions.title}}</text>
  150. <view class="vip acea-row row-middle">
  151. <view class='money font-color'>
  152. ¥<text class='num'>{{item.price.toString().split(".")[0]}}</text>
  153. <text class='nums'
  154. v-if="item.price.toString().split('.').length>1">.{{item.price.toString().split(".")[1]}}</text>
  155. </view>
  156. <view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">
  157. <view>¥{{item.vip_price}}</view>
  158. <view class="icon on" v-if="item.price_type && item.price_type == 'member'"><text
  159. class="iconfont icon-huangguan4"></text>SVIP</view>
  160. <view class="icon" v-if="item.price_type && item.price_type == 'level'"><text
  161. class="iconfont icon-v"></text>{{item.level_name}}</view>
  162. </view>
  163. </view>
  164. <view class='vip acea-row row-between-wrapper'>
  165. <view>已售{{item.sales}}{{item.unit_name || '件'}}</view>
  166. <view>评分 {{item.star}}</view>
  167. </view>
  168. </view>
  169. </template>
  170. <!-- #endif -->
  171. </waterfallsFlow>
  172. <view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
  173. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  174. </view>
  175. </view>
  176. <!-- 商品列表 -->
  177. <view class="default" v-if="productList.length==0 && where.page > 1">
  178. <image :src="imgHost+'/statics/images/no-thing.png'" mode="" class="img"></image>
  179. <view class="text">
  180. 暂无商品,去添加点什么吧
  181. </view>
  182. </view>
  183. <!-- 筛选弹窗 -->
  184. <filterPopup ref="popup" :storeCategory="storeCategory" :storeBrand="storeBrand" @brandChange="brandChange"
  185. @categoryChange="categoryChange" @submitFn="submitFn"></filterPopup>
  186. <!-- 客服弹窗 -->
  187. <Kefu ref="kefu" @closeKefu="closeKefu" :customerList="customerList" :customerType="customerType"></Kefu>
  188. <!-- #ifdef H5 || MP -->
  189. <view v-if="isSplicingPlatform" :class="{ mask: collageVisible }" @tap="onCollageClose"></view>
  190. <view v-if="isSplicingPlatform" :class="{ 'dialog-footer': isFooter, active: collageVisible }" class="dialog">
  191. <view class="dialog-head">
  192. <view v-for="item in deliveryList" :key="item.key" :class="{ active: collageDelivery == item.key }" class="button" @tap="collageDeliveryChange(item.key)">
  193. <text :class="['iconfont', item.icon]"></text>{{ item.name }}
  194. </view>
  195. </view>
  196. <view class="dialog-body">
  197. <view class="">{{ collageDelivery == 1 ? '配送地址' : '自提门店' }}</view>
  198. <view class="dialog-body-main">
  199. <view class="dialog-body-main-inner">
  200. <view v-if="collageDelivery == 2 || collageAddress.id" class="dialog-body-left">
  201. <view class="dialog-body-name">
  202. {{ collageDelivery == 1 ? `${collageAddress.province}${collageAddress.city}${collageAddress.district}${collageAddress.detail}` : collageStore.name }}
  203. <text v-if="collageDelivery == 2" class="tag">距离{{ collageStore.range || 0 }}km</text>
  204. </view>
  205. <view class="dialog-body-info">
  206. <view v-if="collageDelivery == 2" class="item">
  207. {{ collageStore.detailed_address }}
  208. </view>
  209. <view v-if="collageDelivery == 1" class="item">
  210. {{ collageAddress.real_name }} {{ collageAddress.phone }}
  211. </view>
  212. <view v-else class="item">
  213. <text class="iconfont"></text>营业时间:{{ collageStore.day_time || '-' }}
  214. </view>
  215. </view>
  216. </view>
  217. <view v-if="collageDelivery == 1 && !collageAddress.id" class="dialog-body-left">您还未选择配送地址,先去选择您的收货地址再下单吧~</view>
  218. <view v-if="collageDelivery == 2" class="dialog-body-right" @tap="showMaoLocation"><text class="iconfont icon-dingwei2"></text></view>
  219. </view>
  220. <view class="dialog-body-main-btn">
  221. <view v-if="collageDelivery == 1" class="" @tap="onAddress">{{ collageAddress.id ? '切换地址' : '选择地址' }}<text class="iconfont icon-xiangyou"></text></view>
  222. <view v-if="collageDelivery == 2" class="" @tap="goMap(1)">切换门店<text class="iconfont icon-xiangyou"></text></view>
  223. </view>
  224. </view>
  225. </view>
  226. <view class="dialog-foot">
  227. <button class="button" hover-class="none" @tap="onCollageClose">我再想想</button>
  228. <button class="button primary" hover-class="none" @tap="initCollage">发起拼单</button>
  229. </view>
  230. </view>
  231. <addressWindow v-if="isSplicingPlatform" ref="addressWindow" :isFooter='isFooter' :address="address" :pagesUrl="pagesUrl" @changeClose="onAddress" @OnChangeAddress="onAddressChange"></addressWindow>
  232. <!-- #endif -->
  233. <!-- #ifdef MP -->
  234. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  235. <!-- #endif -->
  236. </view>
  237. </template>
  238. <script>
  239. let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  240. import waterfallsFlow from "@/components/maramlee-waterfalls-flow/maramlee-waterfalls-flow.vue";
  241. import filterPopup from "@/components/filterPopup/index.vue";
  242. import Kefu from "@/components/kefu/index.vue"
  243. import {
  244. mapState,
  245. mapGetters
  246. } from 'vuex';
  247. import {
  248. getProducts,
  249. getCustomerList,
  250. getStoreCategory,
  251. getStoreBrand
  252. } from '@/api/new_store.js';
  253. import {
  254. goShopDetail
  255. } from '@/libs/order.js';
  256. import {
  257. HTTP_REQUEST_URL
  258. } from '@/config/app';
  259. import {
  260. hasCollage,
  261. initCollage,
  262. isWithin,
  263. } from '@/api/store.js';
  264. // #ifdef H5 || MP
  265. import { getAddressDefault } from '@/api/user.js';
  266. import addressWindow from '@/components/addressWindow';
  267. // #endif
  268. // #ifdef H5
  269. import {
  270. toLogin
  271. } from '@/libs/login.js';
  272. // #endif
  273. export default {
  274. components: {
  275. filterPopup,
  276. waterfallsFlow,
  277. Kefu,
  278. // #ifdef H5 || MP
  279. addressWindow
  280. // #endif
  281. },
  282. props: {
  283. info: {
  284. type: Object,
  285. default: {}
  286. },
  287. customerType:{
  288. type:Number,
  289. default:1
  290. },
  291. cart_num:{
  292. type:Number,
  293. default:0
  294. },
  295. isFooter: {
  296. type: Boolean,
  297. default: false
  298. }
  299. },
  300. computed: {
  301. ...mapState({
  302. cartNum: state => state.indexData.cartNum
  303. }),
  304. ...mapGetters(['isLogin', 'uid', 'cartNum']),
  305. },
  306. data() {
  307. return {
  308. statusBarHeight:statusBarHeight,
  309. imgHost: HTTP_REQUEST_URL,
  310. price: 0,
  311. stock: 0,
  312. productList: [], // 商品数据
  313. customerList: [], // 客服数据
  314. storeCategory: [], // 分类数据
  315. storeBrand: [], // 品牌数据
  316. show: false,
  317. active: 1,
  318. where: {
  319. cid: 0,
  320. sid: 0,
  321. keyword: '',
  322. priceOrder: '',
  323. salesOrder: '',
  324. news: 0,
  325. page: 1,
  326. limit: 5,
  327. store_id: 0,
  328. brand_id: '',
  329. },
  330. loading: false,
  331. loadend: false,
  332. loadTitle: '加载更多',
  333. deliveryList: [
  334. {name:'自提',key:2,icon:'icon-ziti'},
  335. {name:'配送',key:1,icon:'icon-peisong1'},
  336. ],
  337. // #ifdef H5 || MP
  338. collageVisible: false,
  339. collageDelivery: 2,
  340. collageAddress: {},
  341. collageStore: this.info,
  342. address: {
  343. address: false
  344. },
  345. pagesUrl: '',
  346. isShowAuth: false,
  347. // #endif
  348. // #ifdef MP
  349. isSplicingPlatform: true,
  350. // #endif
  351. // #ifndef MP
  352. isSplicingPlatform: false,
  353. // #endif
  354. }
  355. },
  356. mounted() {
  357. // #ifdef H5
  358. this.isSplicingPlatform = this.$wechat.isWeixin();
  359. // #endif
  360. // #ifdef H5 || MP
  361. if (this.isSplicingPlatform && this.info.store_splicing_switch) {
  362. this.collageDelivery = this.info.is_store ? 2 : 1;
  363. uni.$on('activeFn', data => {
  364. this.collageStore = data;
  365. });
  366. uni.$on('addressChange', data => {
  367. this.collageAddress = data;
  368. this.address.addressId = data.id;
  369. });
  370. }
  371. // #endif
  372. },
  373. methods: {
  374. // #ifdef H5 || MP
  375. showMaoLocation() {
  376. let data = {
  377. latitude: Number(this.collageStore.latitude),
  378. longitude: Number(this.collageStore.longitude),
  379. name: this.collageStore.name,
  380. address: `${this.collageStore.address}-${this.collageStore.detailed_address}`,
  381. };
  382. // #ifdef H5
  383. if (this.$wechat.isWeixin()) {
  384. data.scale = 13;
  385. return this.$wechat.seeLocation(data);
  386. }
  387. // #endif
  388. uni.openLocation(data);
  389. },
  390. // #endif
  391. // #ifdef MP
  392. // 授权关闭
  393. authColse: function(e) {
  394. this.isShowAuth = e
  395. },
  396. // 授权回调
  397. onLoadFun() {
  398. setTimeout(function(){
  399. this.isShowAuth = false;
  400. },10)
  401. },
  402. // #endif
  403. // 选择品牌
  404. brandChange(val) {
  405. this.where.brand_id=val
  406. },
  407. // 选择分类
  408. categoryChange(val) {
  409. this.where.cid = val.cid
  410. this.where.sid = val.sid
  411. },
  412. // 确认提交
  413. submitFn(val) {
  414. if (val == 1) {
  415. this.getProducts(true)
  416. this.$refs.popup.visible = false
  417. } else if (val == 2) {
  418. this.where.brand_id = ""
  419. this.where.cid = ""
  420. this.where.sid = ""
  421. this.getProducts(true)
  422. this.$refs.popup.visible = false
  423. }
  424. },
  425. // 打开附近门店
  426. goMap(val = 0) {
  427. uni.navigateTo({
  428. url: `/pages/store/store_list/index?storeFrom=1&type=1&storeId=${val ? this.collageStore.id : this.info.id}&isCollage=${val}`
  429. });
  430. },
  431. // 打开客服
  432. goKefu() {
  433. this.getCustomerList()
  434. this.$refs.kefu.show = true
  435. },
  436. // 购物车
  437. shoppCart() {
  438. uni.switchTab({
  439. url: "/pages/order_addcart/order_addcart"
  440. })
  441. },
  442. // 关闭客服
  443. closeKefu() {
  444. this.$refs.kefu.show = false
  445. },
  446. // 获取客服列表数据
  447. getCustomerList() {
  448. getCustomerList(this.where.store_id).then(res => {
  449. this.customerList = res.data
  450. })
  451. },
  452. // 去详情页
  453. godDetail(item) {
  454. this.currentPage = false
  455. if (this.promotions_type) {
  456. uni.navigateTo({
  457. url: `/pages/goods_details/index?id=${item.id}`
  458. })
  459. } else {
  460. goShopDetail(item, this.uid).then(res => {
  461. uni.navigateTo({
  462. url: `/pages/goods_details/index?id=${item.id}`
  463. })
  464. })
  465. }
  466. },
  467. // 操作
  468. set_where: function(e) {
  469. switch (e) {
  470. case 1:
  471. this.active = 1
  472. this.where.priceOrder = ""
  473. this.where.salesOrder = ""
  474. this.where.brand_id = ""
  475. this.price= 0
  476. break;
  477. case 2:
  478. if (this.price == 0) this.price = 1;
  479. else if (this.price == 1) this.price = 2;
  480. else if (this.price == 2) this.price = 0;
  481. if (this.price == 1) {
  482. this.where.priceOrder = "asc"
  483. } else if (this.price == 2) {
  484. this.where.priceOrder = "desc"
  485. } else {
  486. this.where.priceOrder = ""
  487. }
  488. this.active = 2
  489. this.stock = 0;
  490. break;
  491. case 3:
  492. if (this.stock == 0) this.stock = 1;
  493. else if (this.stock == 1) this.stock = 2;
  494. else if (this.stock == 2) this.stock = 0;
  495. if (this.stock == 1) {
  496. this.where.priceOrder = ""
  497. this.where.salesOrder = "asc"
  498. } else if (this.stock == 2) {
  499. this.where.priceOrder = ""
  500. this.where.salesOrder = "desc"
  501. } else {
  502. this.where.salesOrder = ""
  503. }
  504. this.active = 3
  505. this.price = 0
  506. break;
  507. case 4:
  508. console.log('1111111111');
  509. this.getStoreCategory()
  510. this.getStoreBrand()
  511. this.$refs.popup.visible = true
  512. this.loadend = false;
  513. this.loading = false;
  514. break;
  515. }
  516. if(e<4){
  517. this.loadend = false;
  518. this.$set(this.where, 'page', 1);
  519. this.getProducts(true)
  520. }
  521. },
  522. // 商品列表
  523. getProducts(isPage) {
  524. let that = this;
  525. if (that.loadend) return;
  526. if (that.loading) return;
  527. if (isPage === true) {
  528. that.$refs.waterfallsFlow.refresh();
  529. that.where.page = 1;
  530. that.$set(that, 'productList', []);
  531. }
  532. that.loading = true;
  533. that.loadTitle = '';
  534. getProducts(this.where).then(res => {
  535. let list = res.data;
  536. let productList = that.$util.SplitArray(list, that.productList);
  537. let loadend = list.length < that.where.limit;
  538. that.loadend = loadend;
  539. that.loading = false;
  540. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  541. that.$set(that, 'productList', productList);
  542. that.$set(that.where, 'page', that.where.page + 1);
  543. }).catch(err => {
  544. that.loading = false;
  545. that.loadTitle = '加载更多'
  546. });
  547. },
  548. // 筛选-分类数据
  549. getStoreCategory() {
  550. let data = {
  551. pid: 0
  552. }
  553. getStoreCategory(data).then(res => {
  554. res.data.map(item => {
  555. this.$set(item, 'disabled', false)
  556. this.$set(item, 'current', -1)
  557. item.children.unshift({
  558. 'id': 0,
  559. 'cate_name': '全部'
  560. })
  561. })
  562. this.storeCategory = res.data
  563. })
  564. },
  565. // 筛选-品牌数据
  566. getStoreBrand() {
  567. getStoreBrand(this.where).then(res => {
  568. this.storeBrand = res.data
  569. })
  570. },
  571. // 触底刷新
  572. onReachBottom() {
  573. this.getProducts()
  574. },
  575. // #ifdef H5 || MP
  576. // 用户默认地址
  577. getAddressDefault() {
  578. getAddressDefault().then(res => {
  579. const data = res.data;
  580. if (Array.isArray(data)) {
  581. return;
  582. }
  583. this.onAddressChange(data.id, data, true);
  584. });
  585. },
  586. onCollage() {
  587. if (!this.isLogin) {
  588. return toLogin();
  589. }
  590. hasCollage().then(res => {
  591. const collageId = res.data.collageId;
  592. if (collageId) {
  593. uni.navigateTo({
  594. url: `/pages/store/group_buy/index?collage_id=${collageId}`
  595. });
  596. } else{
  597. this.getAddressDefault();
  598. this.$refs.addressWindow.getAddressList();
  599. this.collageVisible = true;
  600. }
  601. });
  602. },
  603. onCollageClose() {
  604. this.collageVisible = false;
  605. },
  606. initCollage() {
  607. let data = {
  608. store_id: this.collageStore.id,
  609. address_id: this.collageAddress.id || 0,
  610. shipping_type: this.collageDelivery == 1 ? 3 : 2
  611. };
  612. initCollage(data).then(res => {
  613. this.collageVisible = false;
  614. uni.navigateTo({
  615. url: `/pages/store/group_buy/index?collage_id=${res.data.collageId}`
  616. });
  617. }).catch(err => {
  618. this.$util.Tips({
  619. title: err
  620. });
  621. });
  622. },
  623. collageDeliveryChange(key) {
  624. if (key != 2 || this.info.is_store) {
  625. this.collageDelivery = key;
  626. }
  627. },
  628. onAddress() {
  629. this.address.address = !this.address.address;
  630. this.pagesUrl = `/pages/users/user_address_list/index?isCollage=1&store_id=${this.info.id}`
  631. this.$refs.addressWindow.getAddressList();
  632. },
  633. onAddressChange(id, data, isInit) {
  634. isWithin({
  635. store_id: this.collageStore.id,
  636. address_id: id
  637. }).then(() => {
  638. if (!isInit) {
  639. this.onAddress();
  640. }
  641. this.collageAddress = data;
  642. this.address.addressId = data;
  643. }).catch(() => {
  644. if (!isInit) {
  645. this.$util.Tips({
  646. title: '您选择的地址超出门店配送范围,请重新选择'
  647. });
  648. }
  649. });
  650. },
  651. // #endif
  652. }
  653. }
  654. </script>
  655. <style lang="scss">
  656. page {
  657. background-color: #F5F5F5 !important;
  658. }
  659. .activeColor {
  660. color: var(--view-theme) !important;
  661. }
  662. .header {
  663. // #ifndef MP
  664. margin-bottom: 40rpx;
  665. // #endif
  666. .header-img {
  667. width: 100%;
  668. height: 300rpx;
  669. display: block;
  670. }
  671. .search {
  672. // position: absolute;
  673. // #ifndef MP
  674. // top: 56rpx;
  675. // #endif
  676. // left: 20rpx;
  677. // #ifdef MP
  678. // width: 520rpx;
  679. // #endif
  680. // #ifndef MP
  681. // width: 710rpx;
  682. // #endif
  683. flex: 1;
  684. height: 64rpx;
  685. background: rgba(255, 255, 255, 0.2800);
  686. border-radius: 43rpx;
  687. font-weight: 400;
  688. color: #FFFFFF;
  689. font-size: 26rpx;
  690. line-height: 64rpx;
  691. &.on{
  692. background:unset;
  693. }
  694. .searchCon{
  695. width: 100%;
  696. height: 64rpx;
  697. background: rgba(255, 255, 255, 0.2800);
  698. border-radius: 43rpx;
  699. }
  700. .icon-xiazai5 {
  701. margin-left: 32rpx;
  702. margin-right: 12rpx;
  703. }
  704. }
  705. .address {
  706. position: absolute;
  707. top: 160rpx;
  708. margin: 0 20rpx;
  709. width: 710rpx;
  710. height: 192rpx;
  711. background: #fff;
  712. border-radius: 14rpx;
  713. padding: 30rpx 20rpx;
  714. display: flex;
  715. justify-content: space-between;
  716. .left {
  717. .left-title {
  718. height: 30rpx;
  719. line-height: 30rpx;
  720. display: flex;
  721. image {
  722. width: 30rpx;
  723. height: 28rpx;
  724. }
  725. .text {
  726. font-weight: 600;
  727. color: #333333;
  728. font-size: 30rpx;
  729. margin: 0 10rpx;
  730. max-width: 390rpx;
  731. }
  732. .icon-xiangyou {
  733. color: #333;
  734. font-size: 24rpx;
  735. }
  736. }
  737. .time {
  738. margin: 20rpx 0;
  739. font-size: 22rpx;
  740. font-weight: 400;
  741. color: #666666;
  742. }
  743. .distance {
  744. width: 500rpx;
  745. font-size: 22rpx;
  746. color: #666666;
  747. font-weight: 400;
  748. .icon-chakanditu {
  749. margin-right: 8rpx;
  750. font-size: 28rpx;
  751. color: #ccc;
  752. }
  753. .distance-name {
  754. display: inline-block;
  755. width: 286rpx;
  756. height: 22rpx;
  757. border-left: 1px solid #000;
  758. margin-left: 16rpx;
  759. line-height: 22rpx;
  760. text-align: left;
  761. padding-left: 16rpx;
  762. white-space: nowrap;
  763. overflow: hidden;
  764. text-overflow: ellipsis;
  765. }
  766. }
  767. }
  768. .right {
  769. margin-top: 36rpx;
  770. display: flex;
  771. font-size: 20rpx;
  772. color: #333333;
  773. .kefu {
  774. margin-right: 30rpx;
  775. display: flex;
  776. flex-direction: column;
  777. align-items: center;
  778. .icon-kefu-mendian {
  779. font-size: 36rpx;
  780. }
  781. }
  782. }
  783. .goods {
  784. position: relative;
  785. display: flex;
  786. flex-direction: column;
  787. align-items: center;
  788. .icon-gouwuche-mendian {
  789. font-size: 36rpx;
  790. }
  791. .cartNum {
  792. position: absolute;
  793. top: -8rpx;
  794. right: 2rpx;
  795. width: 30rpx;
  796. height: 30rpx;
  797. line-height: 30rpx;
  798. text-align: center;
  799. font-weight: 500;
  800. color: #FFFFFF;
  801. border-radius: 50%;
  802. background: var(--view-theme);
  803. border: 1px solid #FFFFFF;
  804. }
  805. }
  806. }
  807. }
  808. .goods-list {
  809. padding: 0 30rpx;
  810. margin-bottom: 50rpx !important;
  811. }
  812. .content {
  813. height: 100%;
  814. position: -webkit-sticky;
  815. position: sticky;
  816. top: var(--window-top);
  817. z-index: 99;
  818. // margin-bottom: 200rpx;
  819. .nav {
  820. padding: 40rpx 50rpx 40rpx 50rpx;
  821. display: flex;
  822. justify-content: space-between;
  823. font-size: 28rpx;
  824. font-weight: 500;
  825. color: #666666;
  826. background: #f5f5f5;
  827. .nav-img {
  828. width: 15rpx;
  829. height: 18rpx;
  830. margin-left: 10rpx;
  831. }
  832. .icon-shaixuan {
  833. font-size: 24rpx;
  834. margin-right: 10rpx;
  835. }
  836. }
  837. }
  838. .vip {
  839. margin: 20rpx 0 10rpx 0;
  840. .price {
  841. font-size: 34rpx;
  842. font-weight: 600;
  843. color: var(--view-theme);
  844. }
  845. .sold {
  846. font-size: 24rpx;
  847. font-weight: 400;
  848. color: #999999;
  849. }
  850. }
  851. .list {
  852. padding: 0 20rpx 90rpx 20rpx;
  853. }
  854. .list .waterList {
  855. margin-bottom: 60rpx;
  856. // margin-top: 192rpx;
  857. }
  858. .default {
  859. margin-top: 100rpx;
  860. display: flex;
  861. flex-direction: column;
  862. align-items: center;
  863. .img {
  864. width: 414rpx;
  865. height: 256rpx;
  866. }
  867. .text {
  868. font-size: 26rpx;
  869. font-weight: 400;
  870. color: #999999;
  871. }
  872. }
  873. .waterfalls {
  874. padding: 10rpx 16rpx 16rpx 16rpx;
  875. color: #222;
  876. .name {
  877. font-size: 28rpx;
  878. }
  879. .label {
  880. font-size: 20rpx;
  881. color: var(--view-theme);
  882. border-radius: 4rpx;
  883. border: 1px solid var(--view-theme);
  884. padding: 0 6rpx;
  885. display: inline-block;
  886. margin-top: 10rpx;
  887. margin-right: 10rpx;
  888. }
  889. .money {
  890. font-size: 26rpx;
  891. font-weight: 700;
  892. .num {
  893. font-size: 34rpx;
  894. }
  895. .nums {
  896. font-size: 28rpx;
  897. }
  898. }
  899. .vip {
  900. font-size: 22rpx;
  901. color: #aaa;
  902. margin-top: 6rpx;
  903. .vip-money {
  904. font-size: 24rpx;
  905. color: #282828;
  906. font-weight: bold;
  907. .icon{
  908. font-size: 15rpx;
  909. background: #FF9500;
  910. color: #fff;
  911. border-radius: 18rpx;
  912. padding: 1rpx 6rpx;
  913. margin-left: 10rpx;
  914. min-width: 60rpx;
  915. .iconfont {
  916. font-size: 15rpx;
  917. margin-right: 5rpx;
  918. }
  919. &.on {
  920. background: #333;
  921. color: #FDDAA4;
  922. min-width: unset;
  923. }
  924. }
  925. image {
  926. width: 46rpx;
  927. height: 21rpx;
  928. margin-left: 4rpx;
  929. }
  930. }
  931. }
  932. }
  933. .input-wrapper {
  934. position: absolute;
  935. left: 20rpx;
  936. /* #ifndef MP */
  937. top: 56rpx;
  938. right: 20rpx;
  939. /* #endif */
  940. /* #ifdef MP */
  941. width: 520rpx;
  942. /* #endif */
  943. .input {
  944. flex: 1;
  945. }
  946. .group-button {
  947. height: 64rpx;
  948. padding: 0 24rpx;
  949. border: 1rpx solid #DDDDDD;
  950. border-radius: 32rpx;
  951. margin-right: 40rpx;
  952. font-weight: 500;
  953. font-size: 26rpx;
  954. color: #333333;
  955. .iconfont {
  956. margin-right: 10rpx;
  957. font-size: 26rpx;
  958. color: var(--view-theme);
  959. }
  960. }
  961. }
  962. /* #ifdef H5 || MP */
  963. .dialog {
  964. position: fixed;
  965. right: 0;
  966. left: 0;
  967. z-index: 101;
  968. padding: 36rpx 40rpx 40rpx;
  969. border-radius: 12rpx 12rpx 0 0;
  970. background-color: #FFFFFF;
  971. transform: translateY(100%);
  972. transition: 0.3s;
  973. /* #ifdef H5 */
  974. bottom: 94rpx;
  975. bottom: calc(94rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  976. bottom: calc(94rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  977. /* #endif */
  978. /* #ifdef MP */
  979. bottom: 0rpx;
  980. bottom: calc(0rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  981. bottom: calc(0rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  982. /* #endif */
  983. &.dialog-footer {
  984. /* #ifdef MP */
  985. bottom: 98rpx;
  986. bottom: calc(98rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  987. bottom: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  988. /* #endif */
  989. }
  990. &.active {
  991. transform: translateY(0);
  992. }
  993. }
  994. .dialog-head {
  995. display: flex;
  996. .button {
  997. flex: 1;
  998. display: flex;
  999. justify-content: center;
  1000. align-items: center;
  1001. height: 138rpx;
  1002. border: 4rpx solid #DDDDDD;
  1003. border-radius: 12rpx;
  1004. font-weight: 500;
  1005. font-size: 32rpx;
  1006. color: #333333;
  1007. cursor: pointer;
  1008. +.button {
  1009. margin-left: 46rpx;
  1010. }
  1011. .iconfont {
  1012. margin-right: 40rpx;
  1013. font-size: 80rpx;
  1014. color: #999999;
  1015. }
  1016. &.active {
  1017. border: 4rpx solid var(--view-theme);
  1018. .iconfont {
  1019. color: var(--view-theme);
  1020. }
  1021. }
  1022. }
  1023. }
  1024. .dialog-body {
  1025. margin-top: 60rpx;
  1026. font-size: 24rpx;
  1027. color: #999999;
  1028. .dialog-body-main {
  1029. .dialog-body-main-inner {
  1030. display: flex;
  1031. margin-top: 32rpx;
  1032. }
  1033. .dialog-body-main-btn {
  1034. display: flex;
  1035. justify-content: center;
  1036. align-items: center;
  1037. margin-top: 56rpx;
  1038. .iconfont {
  1039. margin-left: 12rpx;
  1040. font-size: 22rpx;
  1041. color: #666666;
  1042. }
  1043. }
  1044. }
  1045. .dialog-body-left {
  1046. flex: 1;
  1047. min-width: 0;
  1048. margin-right: 20rpx;
  1049. }
  1050. .dialog-body-right {
  1051. display: flex;
  1052. justify-content: center;
  1053. align-items: center;
  1054. width: 40rpx;
  1055. height: 40rpx;
  1056. border-radius: 50%;
  1057. background-color: var(--view-minorColorT);
  1058. font-size: 22rpx;
  1059. color: var(--view-theme);
  1060. cursor: pointer;
  1061. }
  1062. .dialog-body-name {
  1063. font-weight: 500;
  1064. font-size: 24rpx;
  1065. line-height: 1.2;
  1066. color: #333333;
  1067. .tag {
  1068. margin-left: 14rpx;
  1069. font-size: 24rpx;
  1070. color: #888888;
  1071. }
  1072. }
  1073. .dialog-body-info {
  1074. margin-top: 28rpx;
  1075. .item {
  1076. display: flex;
  1077. font-size: 22rpx;
  1078. line-height: 1.5;
  1079. color: #888888;
  1080. +.item {
  1081. margin-top: 20rpx;
  1082. }
  1083. }
  1084. }
  1085. }
  1086. .dialog-foot {
  1087. display: flex;
  1088. margin-top: 78rpx;
  1089. .button {
  1090. display: flex;
  1091. justify-content: center;
  1092. align-items: center;
  1093. flex: 1;
  1094. min-width: 0;
  1095. height: 92rpx;
  1096. border-radius: 46rpx;
  1097. background-color: #EEEEEE;
  1098. font-size: 30rpx;
  1099. color: #666666;
  1100. cursor: pointer;
  1101. +.button {
  1102. margin-left: 46rpx;
  1103. }
  1104. &.primary {
  1105. background-color: var(--view-theme);
  1106. color: #FFFFFF;
  1107. }
  1108. }
  1109. }
  1110. /* #endif */
  1111. </style>