index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <view :style="viewColor" class="page-container">
  3. <view class='topic-home' :style="'background-color: '+bgColor+''">
  4. <!-- #ifdef H5 -->
  5. <view class="header">
  6. <view class="head-menu">
  7. <view class="iconfont icon-xiangzuo" @click="goback"></view>
  8. <view v-if="merchant" class="iconfont merchant" @click="goStore(topicData.group_mer_id)">
  9. <image class="icon_merchant" :src="merchant.mer_avatar"></image>
  10. </view>
  11. <view v-else class="iconfont icon-shouye4" @click="goHome"></view>
  12. </view>
  13. </view>
  14. <!-- #endif -->
  15. <view class="main_count">
  16. <view class="topic_image">
  17. <image :src="topicData.image" class="picture" mode="widthFix"></image>
  18. </view>
  19. <view class="main">
  20. <!-- 轮播 -->
  21. <view class="slider-wrapper" v-if="imgUrls.length>0">
  22. <swiper indicator-dots="true" :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration"
  23. indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
  24. <block v-for="(item,index) in imgUrls" :key="index">
  25. <swiper-item>
  26. <view class='slide-navigator acea-row row-between-wrapper'>
  27. <image :src="item" class="slide-image"></image>
  28. </view>
  29. </swiper-item>
  30. </block>
  31. </swiper>
  32. </view>
  33. <!--商品-->
  34. <view class="product_list" :class="['theme'+theme, {'acea-row row-between-wrapper': (theme == 2 || theme == '')}]">
  35. <view class='item' v-for="(item,index) in activety_goods" :key="index" hover-class='none' @tap="goDetail(item)">
  36. <view class='pictrue'>
  37. <!-- <image class="image" :src='item.image'></image> -->
  38. <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage>
  39. </view>
  40. <view class="text">
  41. <view class='name line2'>
  42. {{item.store_name}}
  43. </view>
  44. <view class="acea-row row-middle">
  45. <view class='money'>¥<text class='num'>{{item.price}}</text></view>
  46. </view>
  47. <view v-if="theme != 1" class="score">{{item.rate}}评分 {{item.reply_count}}条评论</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <home></home>
  55. <!-- #ifndef H5 -->
  56. <passwordPopup></passwordPopup>
  57. <!-- #endif -->
  58. </view>
  59. </template>
  60. <script>
  61. // +----------------------------------------------------------------------
  62. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  63. // +----------------------------------------------------------------------
  64. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  65. // +----------------------------------------------------------------------
  66. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  67. // +----------------------------------------------------------------------
  68. // | Author: CRMEB Team <admin@crmeb.com>
  69. // +----------------------------------------------------------------------
  70. import {mapGetters} from "vuex";
  71. import {getTopicDetail,getTopicProLst,initiateAssistApi } from '../../../api/activity.js';
  72. import { goShopDetail } from '@/libs/order.js'
  73. import home from '@/components/home/index.vue'
  74. // #ifndef H5
  75. import passwordPopup from '@/components/passwordPopup';
  76. // #endif
  77. import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue';
  78. import { toLogin } from '@/libs/login.js';
  79. const app = getApp();
  80. export default {
  81. computed: mapGetters(['isLogin','uid','viewColor']),
  82. components: {
  83. // #ifndef H5
  84. passwordPopup,
  85. // #endif
  86. home,
  87. easyLoadimage,
  88. },
  89. data() {
  90. return {
  91. group_id: '',
  92. systemInfo: app.globalData.statusBarHeight,
  93. bgColor: '',
  94. activety_goods: [],
  95. page: 1,
  96. limit: 30,
  97. loading: false,
  98. loadend: false,
  99. pageloading: false,
  100. autoplay: true,
  101. circular: true,
  102. interval: 3000,
  103. duration: 500,
  104. theme: 1,
  105. topicData: {},
  106. imgUrls: [],
  107. label_id: '',
  108. merchant: {}
  109. }
  110. },
  111. onLoad(options) {
  112. this.group_id = options.id
  113. this.getTopicDetail();
  114. },
  115. methods: {
  116. goback: function() {
  117. uni.navigateBack();
  118. },
  119. // 首页
  120. goHome() {
  121. uni.switchTab({
  122. url: '/pages/index/index'
  123. });
  124. },
  125. // 进入商户首页
  126. goStore(id){
  127. uni.navigateTo({
  128. url: `/pages/store/home/index?id=${id}`
  129. })
  130. },
  131. getTopicDetail(){
  132. let that = this;
  133. getTopicDetail(that.group_id).then(res => {
  134. that.$set(that, 'topicData', res.data)
  135. that.$set(that, 'theme', res.data.type)
  136. that.$set(that, 'bgColor', res.data.color)
  137. that.$set(that, 'imgUrls', res.data.banner)
  138. that.$set(that, 'label_id', res.data.label_id)
  139. that.$set(that, 'merchant', res.data.merchant)
  140. that.getProList()
  141. })
  142. .catch(err => {
  143. return this.$util.Tips({
  144. title: err
  145. }, {
  146. tab: 3,
  147. url: 1
  148. });
  149. });
  150. },
  151. getProList: function() {
  152. var that = this;
  153. var data = {
  154. page: that.page,
  155. limit: that.limit,
  156. labels: that.label_id,
  157. mer_id: that.topicData.group_mer_id
  158. };
  159. if (that.loadend) return;
  160. if (that.pageloading) return;
  161. this.pageloading = true
  162. getTopicProLst(data).then(res => {
  163. var activety_goods = res.data.list;
  164. var loadend = activety_goods.length < that.limit;
  165. that.page++;
  166. that.activety_goods = that.activety_goods.concat(activety_goods),
  167. that.page = that.page;
  168. that.pageloading = false;
  169. that.loadend = loadend;
  170. }).catch(err => {
  171. that.pageloading = false
  172. });
  173. },
  174. goDetail(item) {
  175. goShopDetail(item, this.uid).then(res => {
  176. if (this.isLogin) {
  177. initiateAssistApi(item.activity_id).then(res => {
  178. let id = res.data.product_assist_set_id;
  179. uni.hideLoading();
  180. uni.navigateTo({
  181. url: '/pages/activity/assist_detail/index?id=' + id
  182. });
  183. }).catch((err) => {
  184. uni.showToast({
  185. title: err,
  186. icon: 'none'
  187. })
  188. });
  189. } else {
  190. toLogin()
  191. }
  192. })
  193. }
  194. },
  195. /**
  196. * 页面上拉触底事件的处理函数
  197. */
  198. onReachBottom: function() {
  199. this.getProList()
  200. },
  201. // 滚动监听
  202. onPageScroll(e) {
  203. // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
  204. uni.$emit('scroll');
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. .header {
  210. position: absolute;
  211. z-index: 6;
  212. display: flex;
  213. align-items: center;
  214. padding-right: 34rpx;
  215. height: 43px;
  216. padding-left: 33rpx;
  217. .head-menu {
  218. display: -webkit-box;
  219. display: -webkit-flex;
  220. display: flex;
  221. -webkit-box-align: center;
  222. -webkit-align-items: center;
  223. align-items: center;
  224. height: 27px;
  225. width: 70px;
  226. background: rgba(0, 0, 0, 0.3);
  227. border-radius: 13px;
  228. .icon-xiangzuo {
  229. font-size: 32rpx;
  230. color: #FFFFFF;
  231. }
  232. .iconfont {
  233. -webkit-box-flex: 1;
  234. -webkit-flex: 1;
  235. flex: 1;
  236. text-align: center;
  237. color: #fff;
  238. box-sizing: border-box;
  239. &.icon-xiangzuo {
  240. border-right: 1px solid #fff;
  241. }
  242. }
  243. .merchant{
  244. width: 36rpx;
  245. height: 36rpx;
  246. .icon_merchant{
  247. width: 36rpx;
  248. height: 36rpx;
  249. border-radius: 100%;
  250. }
  251. }
  252. }
  253. }
  254. .topic-home{
  255. position: relative;
  256. min-height: 100vh;
  257. padding-bottom: 30rpx;
  258. .topic_image{
  259. line-height: 0;
  260. .picture{
  261. width: 750rpx;
  262. }
  263. }
  264. }
  265. .main_count{
  266. .main{
  267. padding: 0 20rpx;
  268. }
  269. .slider-wrapper{
  270. width: 710rpx;
  271. height: 250rpx;
  272. margin: 40rpx 0;
  273. uni-swiper{
  274. height: 250rpx;
  275. }
  276. .slide-image{
  277. width: 710rpx;
  278. height: 250rpx;
  279. border-radius: 16rpx;
  280. }
  281. }
  282. .product_list{
  283. .item{
  284. background-color: #fff;
  285. }
  286. .image {
  287. width: 100%;
  288. height: 100%;
  289. border-radius: 20rpx 20rpx 0 0;
  290. }
  291. .text{
  292. color: #222222;
  293. }
  294. .money {
  295. display: flex;
  296. align-items: center;
  297. font-size: 26rpx;
  298. font-weight: bold;
  299. margin-top: 8rpx;
  300. color: var(--view-priceColor);
  301. }
  302. .score {
  303. margin-top: 10rpx;
  304. color: #737373;
  305. font-size: 20rpx;
  306. }
  307. &.theme2,&.theme{
  308. .item{
  309. position: relative;
  310. width: 345rpx;
  311. margin-bottom: 20rpx;
  312. border-radius: 20rpx;
  313. .pictrue {
  314. position: relative;
  315. width: 100%;
  316. height: 345rpx;
  317. }
  318. /deep/image,/deep/.easy-loadimage,uni-image{
  319. height: 345rpx;
  320. }
  321. .text {
  322. padding: 20rpx 17rpx 26rpx 17rpx;
  323. }
  324. .name{
  325. font-size: 13px;
  326. color: #282828;
  327. margin: 11px 0 5px 0;
  328. overflow: hidden;
  329. text-overflow: ellipsis;
  330. display: -webkit-box;
  331. -webkit-line-clamp: 2;
  332. -webkit-box-orient: vertical;
  333. }
  334. }
  335. }
  336. &.theme1{
  337. .item{
  338. display: inline-block;
  339. width: 225rpx;
  340. margin: 0 19rpx 16rpx 0;
  341. border-radius: 10rpx;
  342. &:nth-child(3n){
  343. margin-right: 0;
  344. }
  345. }
  346. .pictrue {
  347. position: relative;
  348. width: 100%;
  349. height: 226rpx;
  350. .image{
  351. border-radius: 10rpx 10rpx 0 0;
  352. }
  353. }
  354. /deep/image,/deep/.easy-loadimage,uni-image{
  355. width: 100%;
  356. height: 226rpx;
  357. border-radius: 10rpx 10rpx 0 0;
  358. }
  359. .text{
  360. padding: 12rpx 14rpx 16rpx;
  361. .name{
  362. font-size: 13px;
  363. color: #282828;
  364. margin-bottom: 10rpx;
  365. overflow: hidden;
  366. text-overflow: ellipsis;
  367. display: -webkit-box;
  368. -webkit-line-clamp: 2;
  369. -webkit-box-orient: vertical;
  370. line-height: 35rpx;
  371. height: 70rpx;
  372. }
  373. .money {
  374. font-size: 22rpx;
  375. }
  376. }
  377. }
  378. &.theme2{
  379. display: flex;
  380. justify-content: space-between;
  381. flex-wrap: wrap;
  382. .pictrue,/deep/image,/deep/.easy-loadimage,uni-image{
  383. border-radius: 20rpx 20rpx 0 0;
  384. }
  385. }
  386. &.theme3{
  387. .item{
  388. width: 710rpx;
  389. border-radius: 20rpx;
  390. margin-bottom: 30rpx;
  391. }
  392. .num{
  393. font-family: 'PingFangSC-Semibold';
  394. font-size: 32rpx;
  395. }
  396. .pictrue {
  397. position: relative;
  398. width: 710rpx;
  399. height: 710rpx;
  400. .image{
  401. border-radius: 20rpx 20rpx 0 0;
  402. }
  403. }
  404. /deep/image,/deep/.easy-loadimage,uni-image{
  405. width: 710rpx;
  406. height: 710rpx;
  407. max-height: 710rpx;
  408. border-radius: 20rpx 20rpx 0 0;
  409. }
  410. .text{
  411. padding: 24rpx 30rpx 34rpx;
  412. position: relative;
  413. .name{
  414. color: #222222;
  415. font-size: 34rpx;
  416. margin-bottom: 16rpx;
  417. overflow:hidden;
  418. text-overflow: ellipsis;
  419. display: -webkit-box;
  420. -webkit-line-clamp: 2;
  421. -webkit-box-orient: vertical;
  422. }
  423. .money{
  424. font-size: 22rpx;
  425. font-family: 'PingFangSC-Semibold';
  426. font-weight: bold;
  427. }
  428. .score{
  429. color: #737373;
  430. display: inline-block;
  431. float: right;
  432. position: relative;
  433. top: -34rpx;
  434. margin-top: 0;
  435. }
  436. }
  437. }
  438. }
  439. }
  440. </style>