list.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="assemble-container">
  3. <view class="top-box">
  4. <view class="inner-tab">
  5. <scroll-view scroll-X="true" show-scrollbar="false" class="scroll-X">
  6. <view class="tab-list">
  7. <view :class="assemble_activity_id == item.assemble_activity_id ? 'item active' : 'item'" v-for="(item, index) in categorys"
  8. :key="index" @click="tabTypeFunc(index, item.assemble_activity_id)">
  9. {{ item.title }}
  10. </view>
  11. </view>
  12. </scroll-view>
  13. </view>
  14. <!--图片-->
  15. <view class="banner-image d-c-c" v-if="listData.detail">
  16. <image :src="listData.detail.file_path"></image>
  17. </view>
  18. <!--活动时间-->
  19. <view class="ad-datetime p-30-0 d-c-c pb0" v-if="listData.detail">
  20. <Countdown ref='countdown' :config="countdownConfig" @ @returnVal="returnValFunc"></Countdown>
  21. </view>
  22. </view>
  23. <!--内容-->
  24. <view class="assemble-list" v-if="!loading">
  25. <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50">
  26. <!--列表-->
  27. <view class="list d-s-c f-w">
  28. <view class="item d-s-s d-stretch" v-for="(item, index) in listData.list" :key="index">
  29. <view class="product-cover pr">
  30. <image :src="item.product.file_path" mode="aspectFit"></image>
  31. </view>
  32. <view class="product-info d-b-c d-c">
  33. <view class="product-title text-ellipsis-2">{{ item.product.product_name }}</view>
  34. <view class="people-num price">
  35. <text class="f24">¥</text>
  36. <text class="f36 fb">{{ item.assemble_price }}</text>
  37. <text class="ml10 text-d-line gray9 f24">¥{{ item.product_price }}</text>
  38. </view>
  39. <view class="d-b-c ww100">
  40. <view class="f22">
  41. <text class="redF6">{{ item.assemble_num }}人团</text>
  42. <text class="ml10 gray9 <f22></f22>">已拼{{ item.product_sales }}件</text>
  43. </view>
  44. <view class="right-btn"><button type="primary" @click="gotoDetail(item)">去开团</button></view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </scroll-view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import Countdown from '@/components/countdown/countdown.vue'
  55. export default {
  56. components: {
  57. Countdown
  58. },
  59. data() {
  60. return {
  61. /*手机高度*/
  62. phoneHeight: 0,
  63. /*可滚动视图区域高度*/
  64. scrollviewHigh: 0,
  65. /*活动类别*/
  66. categorys: [],
  67. /*当前活动Is*/
  68. assemble_activity_id: 0,
  69. /*商品列表*/
  70. listData: [],
  71. /*倒计时配置*/
  72. countdownConfig: {
  73. /*开始时间*/
  74. startstamp: 0,
  75. /*结束时间*/
  76. endstamp: 0
  77. },
  78. /*是否正在加载*/
  79. loading: true
  80. };
  81. },
  82. computed: {},
  83. onLoad(e) {},
  84. onShow() {
  85. /*获取产品列表*/
  86. this.getCategory();
  87. },
  88. mounted() {
  89. this.init();
  90. },
  91. onReachBottom() {},
  92. methods: {
  93. /*初始化*/
  94. init() {
  95. let _this = this;
  96. uni.getSystemInfo({
  97. success(res) {
  98. _this.phoneHeight = res.windowHeight;
  99. // 计算组件的高度
  100. let view = uni.createSelectorQuery().select('.top-box');
  101. view.boundingClientRect(data => {
  102. let h = _this.phoneHeight - data.height;
  103. _this.scrollviewHigh = h;
  104. }).exec();
  105. }
  106. });
  107. },
  108. /*类别切换*/
  109. tabTypeFunc(e, n) {
  110. this.type_active = e;
  111. this.assemble_activity_id = n;
  112. this.productList = [];
  113. this.getProdct();
  114. },
  115. /*获取数据*/
  116. getCategory() {
  117. let self = this;
  118. let param = {};
  119. let index = self.type_active;
  120. self._get('plus.assemble.product/active', {
  121. param
  122. }, function(res) {
  123. self.categorys = res.data.list;
  124. self.assemble_activity_id = self.categorys[0].assemble_activity_id;
  125. self.getProdct();
  126. });
  127. },
  128. /*获取商品*/
  129. getProdct() {
  130. let self = this;
  131. uni.showLoading({
  132. title: '加载中'
  133. });
  134. let assemble_activity_id = self.assemble_activity_id;
  135. self.loading = true;
  136. self._get(
  137. 'plus.assemble.product/product', {
  138. assemble_activity_id: assemble_activity_id
  139. },
  140. function(res) {
  141. self.listData = res.data;
  142. self.countdownConfig.endstamp = res.data.detail.end_time;
  143. self.countdownConfig.startstamp = res.data.detail.start_time;
  144. uni.hideLoading();
  145. self.loading = false;
  146. }
  147. );
  148. },
  149. /*跳转产品列表*/
  150. gotoDetail(e) {
  151. console.log(e);
  152. this.$refs.countdown.clear();
  153. let url = 'pages/plus/assemble/detail/detail?assemble_product_id=' + e.assemble_product_id
  154. this.gotoPage(url);
  155. },
  156. /*跳转搜索页面*/
  157. gotoSearch() {
  158. this.page = 1;
  159. this.getData();
  160. },
  161. /*倒计时返回值*/
  162. returnValFunc(e) {
  163. console.log(e);
  164. },
  165. }
  166. };
  167. </script>
  168. <style lang="scss">
  169. page {
  170. background: #F2F2F2;
  171. }
  172. .assemble-container .inner-tab {
  173. background: #ffffff;
  174. }
  175. .assemble-container .inner-tab .tab-list {
  176. height: 100rpx;
  177. display: flex;
  178. justify-content: flex-start;
  179. align-items: center;
  180. background: #FFFFFF;
  181. }
  182. .assemble-container .inner-tab .item {
  183. height: 100rpx;
  184. line-height: 100rpx;
  185. white-space: nowrap;
  186. padding: 0 30rpx;
  187. font-size: 30rpx;
  188. color: #333333;
  189. }
  190. .assemble-container .inner-tab .item.active,
  191. .assemble-container .inner-tab .item .arrow.active .iconfont {
  192. background: #FFFFFF;
  193. font-size: 32rpx;
  194. color: $dominant-color;
  195. position: relative;
  196. }
  197. .assemble-container .inner-tab .item.active::after {
  198. content: '';
  199. width: 60%;
  200. height: 4rpx;
  201. background: $dominant-color;
  202. border-radius: 2rpx;
  203. position: absolute;
  204. bottom: 17rpx;
  205. left: 0;
  206. right: 0;
  207. margin: auto;
  208. }
  209. .assemble-container .inner-tab .box {
  210. display: flex;
  211. justify-content: center;
  212. align-items: center;
  213. flex-direction: row;
  214. }
  215. .assemble-container .inner-tab .arrows {
  216. margin-left: 10rpx;
  217. line-height: 0;
  218. }
  219. .assemble-container .inner-tab .iconfont {
  220. line-height: 24rpx;
  221. font-size: 24rpx;
  222. }
  223. .assemble-container .inner-tab .arrow,
  224. .assemble-container .inner-tab .svg-icon {
  225. width: 20rpx;
  226. height: 20rpx;
  227. }
  228. .assemble-container .banner-image {
  229. width: 100%;
  230. box-sizing: border-box;
  231. }
  232. .assemble-container .banner-image image {
  233. width: 750rpx;
  234. height: 365rpx;
  235. }
  236. .assemble-container .ad-datetime::v-deep text {
  237. color: #333333;
  238. font-size: 28rpx;
  239. }
  240. .assemble-container .ad-datetime::v-deep .box {
  241. padding: 4rpx;
  242. border-radius: 4rpx;
  243. background: $dominant-color;
  244. color: #ffffff;
  245. }
  246. .assemble-list .list {
  247. padding: 20rpx;
  248. }
  249. .assemble-list .list .item {
  250. width: 100%;
  251. padding: 30rpx;
  252. margin-bottom: 20rpx;
  253. box-sizing: border-box;
  254. border-radius: 16rpx;
  255. background: #ffffff;
  256. }
  257. .assemble-list .product-cover {
  258. padding: 4rpx;
  259. }
  260. .assemble-list .product-cover image {
  261. width: 200rpx;
  262. height: 200rpx;
  263. border-radius: 12rpx;
  264. }
  265. .assemble-list .product-info {
  266. flex: 1;
  267. padding-left: 20rpx;
  268. overflow: hidden;
  269. }
  270. .assemble-list .product-cover .people-num {
  271. position: absolute;
  272. right: 0;
  273. bottom: 0;
  274. left: 0;
  275. height: 50rpx;
  276. padding: 0 20rpx;
  277. line-height: 50rpx;
  278. font-size: 24rpx;
  279. box-sizing: border-box;
  280. background: rgba(0, 0, 0, 0.6);
  281. }
  282. .assemble-list .product-title {
  283. width: 100%;
  284. height: 40rpx;
  285. line-height: 40rpx;
  286. font-size: 26rpx;
  287. color: #333333;
  288. }
  289. .assemble-list .people-num {
  290. width: 100%;
  291. }
  292. .assemble-list .already-sale {
  293. padding: 4rpx 0;
  294. color: #999;
  295. font-size: 24rpx;
  296. }
  297. .assemble-list .price {
  298. width: 100%;
  299. color: $dominant-color;
  300. font-size: 24rpx;
  301. }
  302. .assemble-list .price .num {
  303. padding: 0 4rpx;
  304. }
  305. .assemble-list .slider-box .slider {
  306. margin-top: 10rpx;
  307. height: 10rpx;
  308. background: #cccccc;
  309. border-radius: 5rpx;
  310. }
  311. .assemble-list .slider-box .slider-inner {
  312. height: 10rpx;
  313. background: $dominant-color;
  314. border-radius: 5rpx;
  315. }
  316. .assemble-list .right-btn button {
  317. height: 60rpx;
  318. line-height: 60rpx;
  319. border-radius: 30rpx;
  320. background: linear-gradient(90deg, #FF6B6B 4%, #F6220C 100%);
  321. color: #ffffff;
  322. font-size: 32rpx;
  323. }
  324. </style>