store_cate2.vue 20 KB

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