store_cate2.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. <template>
  2. <view class="one">
  3. <!-- 顶部搜索框 -->
  4. <view class="header">
  5. <image :src="imgHost+'/statics/images/store-header.png'" mode="" class="header-img"></image>
  6. <navigator url="/pages/goods/goods_search/index" class="input acea-row row-center-wrapper"
  7. hover-class="none">
  8. <!-- #ifndef MP -->
  9. <view class="search">
  10. <!-- #endif -->
  11. <!-- #ifdef MP -->
  12. <view class="search on acea-row row-middle" style="height: 43px;"
  13. :style="'top:'+statusBarHeight+'px'">
  14. <view class="searchCon">
  15. <!-- #endif -->
  16. <text class="iconfont icon-xiazai5"></text>
  17. 搜索店内商品
  18. </view>
  19. <!-- #ifdef MP -->
  20. </view>
  21. <!-- #endif -->
  22. </navigator>
  23. <!-- 门店地址 -->
  24. <view class="address">
  25. <view class="left">
  26. <view class="left-title" @click="goMap">
  27. <text class="iconfont icon-mendian"></text>
  28. <text class="text line1">{{info.name || '暂无门店'}}</text>
  29. <text class="iconfont icon-xiangyou"></text>
  30. </view>
  31. <!-- 营业时间 -->
  32. <view class="time">
  33. 营业时间:{{info.day_time || '-'}}
  34. </view>
  35. <view class="distance">
  36. <text class="iconfont icon-chakanditu"></text>
  37. 距您<text>{{info.range||0}}km</text>
  38. <text class="distance-name">{{info.detailed_address}}</text>
  39. </view>
  40. </view>
  41. <!-- 客服 -->
  42. <view class="right">
  43. <view class="kefu" @click="goKefu()">
  44. <text class="iconfont icon-kefu-mendian" />
  45. <text>客服</text>
  46. </view>
  47. <view class="goods" @click="shoppCart">
  48. <view class="cartNum" v-if="cartNum>0">
  49. {{cartNum}}
  50. </view>
  51. <text class="iconfont icon-gouwuche-mendian" />
  52. <text>购物车</text>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 商品排序条件 -->
  58. <view class="content">
  59. <view class="nav">
  60. <view @click="set_where(1)" :class="{'activeColor':active == 1}">
  61. 综合排序
  62. </view>
  63. <view @click='set_where(2)' :class="{'activeColor':active == 2}">
  64. 价格
  65. <image v-if="price==1" src="../../static/images/up.png" alt="" class="nav-img"></image>
  66. <image v-else-if="price==2" src='../../static/images/down.png' class="nav-img"></image>
  67. <image v-else src='../../static/images/horn.png' class="nav-img"></image>
  68. </view>
  69. <view @click='set_where(3)' :class="{'activeColor':active == 3}">
  70. 销量
  71. <image v-if="stock==1" src="../../static/images/up.png" alt="" class="nav-img"></image>
  72. <image v-else-if="stock==2" src='../../static/images/down.png' class="nav-img"></image>
  73. <image v-else src='../../static/images/horn.png' class="nav-img"></image>
  74. </view>
  75. <view @click="set_where(4)">
  76. <text class="iconfont icon-shaixuan"></text>
  77. 筛选
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 商品列表 -->
  82. <view class="list waterList">
  83. <waterfallsFlow ref="waterfallsFlow" :list="productList" @wapper-lick="godDetail">
  84. <!-- #ifdef MP-WEIXIN -->
  85. <view v-for="(item, index) of productList" :key="index" slot="slot{{index}}">
  86. <view class="waterfalls">
  87. <view class='name line2'>{{item.store_name}}</view>
  88. <span class="label"
  89. v-if="item.activity && item.activity.type === '1' && !promotions_type">秒杀</span>
  90. <span class="label"
  91. v-if="item.activity && item.activity.type === '2' && !promotions_type">砍价</span>
  92. <span class="label"
  93. v-if="item.activity && item.activity.type === '3' && !promotions_type">拼团</span>
  94. <text class="label" v-if="item.promotions.title">{{item.promotions.title}}</text>
  95. <view class="vip acea-row row-middle">
  96. <view class='money font-color'>
  97. ¥<text class='num'>{{item.price.toString().split(".")[0]}}</text>
  98. <text class='nums'
  99. v-if="item.price.toString().split('.').length>1">.{{item.price.toString().split(".")[1]}}</text>
  100. </view>
  101. <view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">
  102. <view>¥{{item.vip_price}}</view>
  103. <!-- <image src='../../static/images/vip.png' v-if="item.price_type == 'member'"></image> -->
  104. <view class="icon on" v-if="item.price_type && item.price_type == 'member'"><text
  105. class="iconfont icon-huangguan4"></text>SVIP</view>
  106. <view class="icon" v-if="item.price_type && item.price_type == 'level'"><text
  107. class="iconfont icon-dengjitubiao"></text>{{item.level_name}}</view>
  108. </view>
  109. </view>
  110. <view class='vip acea-row row-between-wrapper'>
  111. <view>已售{{item.sales}}{{item.unit_name || '件'}}</view>
  112. <view>评分 {{item.star}}</view>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- #endif -->
  117. <!-- #ifndef MP-WEIXIN -->
  118. <template v-slot:default="item">
  119. <view class="waterfalls">
  120. <view class='name line2'>{{item.store_name}}</view>
  121. <span class="label"
  122. v-if="item.activity && item.activity.type === '1' && !promotions_type">秒杀</span>
  123. <span class="label"
  124. v-if="item.activity && item.activity.type === '2' && !promotions_type">砍价</span>
  125. <span class="label"
  126. v-if="item.activity && item.activity.type === '3' && !promotions_type">拼团</span>
  127. <text class="label" v-if="item.promotions.title">{{item.promotions.title}}</text>
  128. <view class="vip acea-row row-middle">
  129. <view class='money font-color'>
  130. ¥<text class='num'>{{item.price.toString().split(".")[0]}}</text>
  131. <text class='nums'
  132. v-if="item.price.toString().split('.').length>1">.{{item.price.toString().split(".")[1]}}</text>
  133. </view>
  134. <view class='vip-money acea-row row-middle' v-if="item.vip_price && item.vip_price > 0">
  135. <view>¥{{item.vip_price}}</view>
  136. <view class="icon on" v-if="item.price_type && item.price_type == 'member'"><text
  137. class="iconfont icon-huangguan4"></text>SVIP</view>
  138. <view class="icon" v-if="item.price_type && item.price_type == 'level'"><text
  139. class="iconfont icon-v"></text>{{item.level_name}}</view>
  140. </view>
  141. </view>
  142. <view class='vip acea-row row-between-wrapper'>
  143. <view>已售{{item.sales}}{{item.unit_name || '件'}}</view>
  144. <view>评分 {{item.star}}</view>
  145. </view>
  146. </view>
  147. </template>
  148. <!-- #endif -->
  149. </waterfallsFlow>
  150. <view class='loadingicon acea-row row-center-wrapper' v-if='productList.length > 0'>
  151. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  152. </view>
  153. </view>
  154. <!-- 商品列表 -->
  155. <view class="default" v-if="productList.length==0 && where.page > 1">
  156. <image :src="imgHost+'/statics/images/no-thing.png'" mode="" class="img"></image>
  157. <view class="text">
  158. 暂无商品,去添加点什么吧
  159. </view>
  160. </view>
  161. <!-- 筛选弹窗 -->
  162. <filterPopup ref="popup" :storeCategory="storeCategory" :storeBrand="storeBrand" @brandChange="brandChange"
  163. @categoryChange="categoryChange" @submitFn="submitFn"></filterPopup>
  164. <!-- 客服弹窗 -->
  165. <Kefu ref="kefu" @closeKefu="closeKefu" :customerList="customerList" :customerType="customerType"></Kefu>
  166. </view>
  167. </template>
  168. <script>
  169. let statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  170. import waterfallsFlow from "@/components/maramlee-waterfalls-flow/maramlee-waterfalls-flow.vue";
  171. import filterPopup from "@/components/filterPopup/index.vue";
  172. import Kefu from "@/components/kefu/index.vue"
  173. import {
  174. mapState,
  175. mapGetters
  176. } from 'vuex';
  177. import {
  178. getProducts,
  179. getCustomerList,
  180. getStoreCategory,
  181. getStoreBrand
  182. } from '@/api/new_store.js';
  183. import {
  184. goShopDetail
  185. } from '@/libs/order.js';
  186. import {
  187. HTTP_REQUEST_URL
  188. } from '@/config/app';
  189. export default {
  190. components: {
  191. filterPopup,
  192. waterfallsFlow,
  193. Kefu
  194. },
  195. props: {
  196. info: {
  197. type: Object,
  198. default: {}
  199. },
  200. customerType: {
  201. type: Number,
  202. default: 1
  203. }
  204. },
  205. computed: {
  206. ...mapState({
  207. cartNum: state => state.indexData.cartNum
  208. }),
  209. ...mapGetters(['isLogin', 'uid', 'cartNum']),
  210. },
  211. data() {
  212. return {
  213. statusBarHeight: statusBarHeight,
  214. imgHost: HTTP_REQUEST_URL,
  215. price: 0,
  216. stock: 0,
  217. productList: [], // 商品数据
  218. customerList: [], // 客服数据
  219. storeCategory: [], // 分类数据
  220. storeBrand: [], // 品牌数据
  221. show: false,
  222. active: 1,
  223. where: {
  224. cid: 0,
  225. sid: 0,
  226. keyword: '',
  227. priceOrder: '',
  228. salesOrder: '',
  229. news: 0,
  230. page: 1,
  231. limit: 5,
  232. store_id: 0,
  233. brand_id: '',
  234. },
  235. loading: false,
  236. loadend: false,
  237. loadTitle: '加载更多',
  238. }
  239. },
  240. mounted() {},
  241. methods: {
  242. // 选择品牌
  243. brandChange(val) {
  244. this.where.brand_id = val
  245. },
  246. // 选择分类
  247. categoryChange(val) {
  248. this.where.cid = val.cid
  249. this.where.sid = val.sid
  250. },
  251. // 确认提交
  252. submitFn(val) {
  253. if (val == 1) {
  254. this.getProducts(true)
  255. this.$refs.popup.visible = false
  256. } else if (val == 2) {
  257. this.where.brand_id = ""
  258. this.where.cid = ""
  259. this.where.sid = ""
  260. this.getProducts(true)
  261. this.$refs.popup.visible = false
  262. }
  263. },
  264. // 打开附近门店
  265. goMap() {
  266. uni.navigateTo({
  267. url: "/pages/store/map/index?type=1&storeId=" + this.info.id
  268. })
  269. },
  270. // 打开客服
  271. goKefu() {
  272. this.getCustomerList()
  273. this.$refs.kefu.show = true
  274. },
  275. // 购物车
  276. shoppCart() {
  277. uni.switchTab({
  278. url: "/pages/order_addcart/order_addcart"
  279. })
  280. },
  281. // 关闭客服
  282. closeKefu() {
  283. this.$refs.kefu.show = false
  284. },
  285. // 获取客服列表数据
  286. getCustomerList() {
  287. getCustomerList(this.where.store_id).then(res => {
  288. this.customerList = res.data
  289. })
  290. },
  291. // 去详情页
  292. godDetail(item) {
  293. this.currentPage = false
  294. if (this.promotions_type) {
  295. uni.navigateTo({
  296. url: `/pages/goods_details/index?id=${item.id}`
  297. })
  298. } else {
  299. goShopDetail(item, this.uid).then(res => {
  300. uni.navigateTo({
  301. url: `/pages/goods_details/index?id=${item.id}`
  302. })
  303. })
  304. }
  305. },
  306. // 操作
  307. set_where: function(e) {
  308. switch (e) {
  309. case 1:
  310. this.active = 1
  311. this.where.priceOrder = ""
  312. this.where.salesOrder = ""
  313. this.where.brand_id = ""
  314. this.price = 0
  315. break;
  316. case 2:
  317. if (this.price == 0) this.price = 1;
  318. else if (this.price == 1) this.price = 2;
  319. else if (this.price == 2) this.price = 0;
  320. if (this.price == 1) {
  321. this.where.priceOrder = "asc"
  322. } else if (this.price == 2) {
  323. this.where.priceOrder = "desc"
  324. } else {
  325. this.where.priceOrder = ""
  326. }
  327. this.active = 2
  328. this.stock = 0;
  329. break;
  330. case 3:
  331. if (this.stock == 0) this.stock = 1;
  332. else if (this.stock == 1) this.stock = 2;
  333. else if (this.stock == 2) this.stock = 0;
  334. if (this.stock == 1) {
  335. this.where.priceOrder = ""
  336. this.where.salesOrder = "asc"
  337. } else if (this.stock == 2) {
  338. this.where.priceOrder = ""
  339. this.where.salesOrder = "desc"
  340. } else {
  341. this.where.salesOrder = ""
  342. }
  343. this.active = 3
  344. this.price = 0
  345. break;
  346. case 4:
  347. console.log('1111111111');
  348. this.getStoreCategory()
  349. this.getStoreBrand()
  350. this.$refs.popup.visible = true
  351. this.loadend = false;
  352. this.loading = false;
  353. break;
  354. }
  355. if (e < 4) {
  356. this.loadend = false;
  357. this.$set(this.where, 'page', 1);
  358. this.getProducts(true)
  359. }
  360. },
  361. // 商品列表
  362. getProducts(isPage) {
  363. let that = this;
  364. if (that.loadend) return;
  365. if (that.loading) return;
  366. if (isPage === true) {
  367. that.$refs.waterfallsFlow.refresh();
  368. that.where.page = 1;
  369. that.$set(that, 'productList', []);
  370. }
  371. that.loading = true;
  372. that.loadTitle = '';
  373. getProducts(this.where).then(res => {
  374. let list = res.data;
  375. let productList = that.$util.SplitArray(list, that.productList);
  376. let loadend = list.length < that.where.limit;
  377. that.loadend = loadend;
  378. that.loading = false;
  379. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  380. that.$set(that, 'productList', productList);
  381. that.$set(that.where, 'page', that.where.page + 1);
  382. }).catch(err => {
  383. that.loading = false;
  384. that.loadTitle = '加载更多'
  385. });
  386. },
  387. // 筛选-分类数据
  388. getStoreCategory() {
  389. let data = {
  390. pid: 0
  391. }
  392. getStoreCategory(data).then(res => {
  393. res.data.map(item => {
  394. this.$set(item, 'disabled', false)
  395. this.$set(item, 'current', -1)
  396. item.children.unshift({
  397. 'id': 0,
  398. 'cate_name': '全部'
  399. })
  400. })
  401. this.storeCategory = res.data
  402. })
  403. },
  404. // 筛选-品牌数据
  405. getStoreBrand() {
  406. getStoreBrand(this.where).then(res => {
  407. this.storeBrand = res.data
  408. })
  409. },
  410. // 触底刷新
  411. onReachBottom() {
  412. this.getProducts()
  413. }
  414. }
  415. }
  416. </script>
  417. <style lang="scss">
  418. page {
  419. background-color: #F5F5F5;
  420. }
  421. .activeColor {
  422. color: var(--view-theme) !important;
  423. }
  424. .header {
  425. margin-bottom: 40rpx;
  426. .header-img {
  427. width: 100%;
  428. height: 300rpx;
  429. display: block;
  430. }
  431. .search {
  432. position: absolute;
  433. // #ifndef MP
  434. top: 56rpx;
  435. // #endif
  436. left: 20rpx;
  437. // #ifdef MP
  438. width: 520rpx;
  439. // #endif
  440. // #ifndef MP
  441. width: 710rpx;
  442. // #endif
  443. height: 64rpx;
  444. background: rgba(255, 255, 255, 0.2800);
  445. border-radius: 43rpx;
  446. font-weight: 400;
  447. color: #FFFFFF;
  448. font-size: 26rpx;
  449. line-height: 64rpx;
  450. &.on {
  451. background: unset;
  452. }
  453. .searchCon {
  454. width: 100%;
  455. height: 64rpx;
  456. background: rgba(255, 255, 255, 0.2800);
  457. border-radius: 43rpx;
  458. }
  459. .icon-xiazai5 {
  460. margin-left: 32rpx;
  461. margin-right: 12rpx;
  462. }
  463. }
  464. .address {
  465. position: absolute;
  466. top: 160rpx;
  467. margin: 0 20rpx;
  468. width: 710rpx;
  469. height: 192rpx;
  470. background: #fff;
  471. border-radius: 14rpx;
  472. padding: 30rpx 20rpx;
  473. display: flex;
  474. justify-content: space-between;
  475. .left {
  476. .left-title {
  477. height: 30rpx;
  478. line-height: 30rpx;
  479. display: flex;
  480. image {
  481. width: 30rpx;
  482. height: 28rpx;
  483. }
  484. .text {
  485. font-weight: 600;
  486. color: #333333;
  487. font-size: 30rpx;
  488. margin: 0 10rpx;
  489. max-width: 390rpx;
  490. }
  491. .icon-xiangyou {
  492. color: #333;
  493. font-size: 24rpx;
  494. }
  495. }
  496. .time {
  497. margin: 20rpx 0;
  498. font-size: 22rpx;
  499. font-weight: 400;
  500. color: #666666;
  501. }
  502. .distance {
  503. width: 500rpx;
  504. font-size: 22rpx;
  505. color: #666666;
  506. font-weight: 400;
  507. .icon-chakanditu {
  508. margin-right: 8rpx;
  509. font-size: 28rpx;
  510. color: #ccc;
  511. }
  512. .distance-name {
  513. display: inline-block;
  514. width: 286rpx;
  515. height: 22rpx;
  516. border-left: 1px solid #000;
  517. margin-left: 16rpx;
  518. line-height: 22rpx;
  519. text-align: left;
  520. padding-left: 16rpx;
  521. white-space: nowrap;
  522. overflow: hidden;
  523. text-overflow: ellipsis;
  524. }
  525. }
  526. }
  527. .right {
  528. margin-top: 36rpx;
  529. display: flex;
  530. font-size: 20rpx;
  531. color: #333333;
  532. .kefu {
  533. margin-right: 30rpx;
  534. display: flex;
  535. flex-direction: column;
  536. align-items: center;
  537. .icon-kefu-mendian {
  538. font-size: 36rpx;
  539. }
  540. }
  541. }
  542. .goods {
  543. position: relative;
  544. display: flex;
  545. flex-direction: column;
  546. align-items: center;
  547. .icon-gouwuche-mendian {
  548. font-size: 36rpx;
  549. }
  550. .cartNum {
  551. position: absolute;
  552. top: -8rpx;
  553. right: 2rpx;
  554. width: 30rpx;
  555. height: 30rpx;
  556. line-height: 30rpx;
  557. text-align: center;
  558. font-weight: 500;
  559. color: #FFFFFF;
  560. border-radius: 50%;
  561. background: var(--view-theme);
  562. border: 1px solid #FFFFFF;
  563. }
  564. }
  565. }
  566. }
  567. .goods-list {
  568. padding: 0 30rpx;
  569. margin-bottom: 50rpx !important;
  570. }
  571. .content {
  572. height: 100%;
  573. // margin-bottom: 200rpx;
  574. .nav {
  575. padding: 40rpx 50rpx 40rpx 50rpx;
  576. display: flex;
  577. justify-content: space-between;
  578. font-size: 28rpx;
  579. font-weight: 500;
  580. color: #666666;
  581. .nav-img {
  582. width: 15rpx;
  583. height: 18rpx;
  584. margin-left: 10rpx;
  585. }
  586. .icon-shaixuan {
  587. font-size: 24rpx;
  588. margin-right: 10rpx;
  589. }
  590. }
  591. }
  592. .vip {
  593. margin: 20rpx 0 10rpx 0;
  594. .price {
  595. font-size: 34rpx;
  596. font-weight: 600;
  597. color: var(--view-theme);
  598. }
  599. .sold {
  600. font-size: 24rpx;
  601. font-weight: 400;
  602. color: #999999;
  603. }
  604. }
  605. .list {
  606. padding: 0 20rpx 90rpx 20rpx;
  607. }
  608. .list .waterList {
  609. margin-bottom: 60rpx;
  610. // margin-top: 192rpx;
  611. }
  612. .default {
  613. margin-top: 100rpx;
  614. display: flex;
  615. flex-direction: column;
  616. align-items: center;
  617. .img {
  618. width: 414rpx;
  619. height: 256rpx;
  620. }
  621. .text {
  622. font-size: 26rpx;
  623. font-weight: 400;
  624. color: #999999;
  625. }
  626. }
  627. .waterfalls {
  628. padding: 10rpx 16rpx 16rpx 16rpx;
  629. color: #222;
  630. .name {
  631. font-size: 28rpx;
  632. }
  633. .label {
  634. font-size: 20rpx;
  635. color: var(--view-theme);
  636. border-radius: 4rpx;
  637. border: 1px solid var(--view-theme);
  638. padding: 0 6rpx;
  639. display: inline-block;
  640. margin-top: 10rpx;
  641. margin-right: 10rpx;
  642. }
  643. .money {
  644. font-size: 26rpx;
  645. font-weight: 700;
  646. .num {
  647. font-size: 34rpx;
  648. }
  649. .nums {
  650. font-size: 28rpx;
  651. }
  652. }
  653. .vip {
  654. font-size: 22rpx;
  655. color: #aaa;
  656. margin-top: 6rpx;
  657. .vip-money {
  658. font-size: 24rpx;
  659. color: #282828;
  660. font-weight: bold;
  661. .icon {
  662. font-size: 15rpx;
  663. background: #FF9500;
  664. color: #fff;
  665. border-radius: 18rpx;
  666. padding: 1rpx 6rpx;
  667. margin-left: 10rpx;
  668. min-width: 60rpx;
  669. .iconfont {
  670. font-size: 15rpx;
  671. margin-right: 5rpx;
  672. }
  673. &.on {
  674. background: #333;
  675. color: #FDDAA4;
  676. min-width: unset;
  677. }
  678. }
  679. image {
  680. width: 46rpx;
  681. height: 21rpx;
  682. margin-left: 4rpx;
  683. }
  684. }
  685. }
  686. }
  687. </style>