index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <!-- <view class="lyy-bg4">
  3. <view class="lyy-f-a">
  4. <view class="lyy-f-b lyy-flex">
  5. <view class="lyy-f-c item" @click="goProduct(items)" v-for="(items, ind) in goodsList" :key="ind">
  6. <view class="content">
  7. <view><image :src="items.image" class="lyy-f-image" /></view>
  8. <view class="lyy-f-word1 lyy-f-jl ellipsis">{{ items.title }}</view>
  9. <view class="lyy-flex2">
  10. <view class="lyy-flex3">
  11. <view class="lyy-f-word2 lyy-f-jl">¥{{ items.price * 1 }}</view>
  12. </view>
  13. <view class="lyy-a-tu2 lyy-flex2">
  14. <view class="lyy-a-tu3"><image src="../../../static/img/img11.png" class="lyy-a-tu5" /></view>
  15. <view class="lyy-a-tu4">{{ items.people }}人拼</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <uni-load-more :status="loadingType"></uni-load-more>
  23. </view> -->
  24. <view class="czpt">
  25. <view class="good-wrapper">
  26. <view class="spgood" @click="goProduct(items)" v-for="(items, ind) in goodsList" :key="ind">
  27. <view class="left-wrapper"><image :src="items.product.image" mode="scaleToFill"></image></view>
  28. <view class="right-wrapper">
  29. <view class="right-title clamp">{{ items.product.store_name }}</view>
  30. <view class="ex-addr">
  31. <image src="../../../static/img/shop.png" mode="" class="name-img"></image>
  32. {{items.merchant.mer_name}}
  33. <image src="../../../static/img/point.png" mode="" class="point-img"></image>
  34. 200m
  35. </view>
  36. <view class="pepple-num"><image src="../../../static/icon/hot.png" mode="scaleToFill"></image>{{ items.buying_num }}人团</view>
  37. <view class="right-bottom">
  38. <view class="sp-price">
  39. <view class="now-price">¥{{ items.price * 1 }}</view>
  40. <view class="old-price">¥{{ items.product.price * 1 }}</view>
  41. </view>
  42. <view class="sp-btn">马上拼团</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  51. import { getCombinationList } from '@/api/product.js';
  52. export default {
  53. components: {
  54. uniLoadMore
  55. },
  56. data() {
  57. return {
  58. goodsList: [],
  59. loadingType: 'more', //加载更多状态
  60. limit: 20, //每次加载数据条数
  61. page: 1 //当前页数
  62. };
  63. },
  64. onLoad(options) {
  65. this.loadData();
  66. },
  67. //下拉刷新
  68. onPullDownRefresh() {
  69. this.loadData('refresh');
  70. },
  71. //监听页面是否滚动到底部加载更多
  72. onReachBottom() {
  73. this.loadData();
  74. },
  75. methods: {
  76. //加载商品 ,带下拉刷新和上滑加载
  77. async loadData(type = 'add', loading) {
  78. let obj = this;
  79. let data = {
  80. page: obj.page,
  81. limit: obj.limit
  82. };
  83. //没有更多直接返回
  84. if (type === 'add') {
  85. if (obj.loadingType === 'nomore') {
  86. return;
  87. }
  88. obj.loadingType = 'loading';
  89. } else {
  90. obj.loadingType = 'more';
  91. }
  92. // 加载商品信息
  93. getCombinationList(data)
  94. .then(e => {
  95. console.log(e,'++++++++++++e+++++++')
  96. if (type === 'refresh') {
  97. // 清空数组
  98. obj.goodsList = [];
  99. }
  100. obj.goodsList = obj.goodsList.concat(e.data.list);
  101. //判断是否还有下一页,有是more 没有是nomore
  102. if (obj.limit == e.data.list.length) {
  103. obj.page++;
  104. obj.loadingType = 'more';
  105. } else {
  106. obj.loadingType = 'nomore';
  107. }
  108. if (type === 'refresh') {
  109. if (loading == 1) {
  110. uni.hideLoading();
  111. } else {
  112. uni.stopPullDownRefresh();
  113. }
  114. }
  115. })
  116. .catch();
  117. },
  118. goProduct(e) {
  119. uni.navigateTo({
  120. url: '/pages/product/groupBooking/productGroup?id=' + e.product_group_id
  121. });
  122. }
  123. }
  124. };
  125. </script>
  126. <style lang="scss">
  127. page {
  128. height: 100%;
  129. }
  130. // 拼团列表
  131. .lyy-f-a {
  132. margin: 0px 15px;
  133. .lyy-flex {
  134. /* 内部模块1*/
  135. display: flex;
  136. justify-content: space-between;
  137. }
  138. .lyy-f-b {
  139. flex-wrap: wrap;
  140. .lyy-f-c {
  141. flex: 0 0 50%;
  142. /* width: 50%; */
  143. margin: 10px 0px 0px 0px;
  144. }
  145. .item:nth-child(2n + 1) .content {
  146. margin: 0px 7.5px 0px 0px;
  147. border-radius: 10px;
  148. }
  149. }
  150. .lyy-f-b .content {
  151. background-color: white;
  152. .lyy-f-image {
  153. width: 100%;
  154. height: 340rpx;
  155. border-radius: 10rpx 10rpx 0rpx 0rpx;
  156. }
  157. .ellipsis {
  158. width: 165px;
  159. white-space: nowrap;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. }
  163. .lyy-f-jl {
  164. padding: 5px 7px;
  165. }
  166. .lyy-f-word1 {
  167. font-size: 12px;
  168. color: rgba(50, 50, 50, 1);
  169. line-height: 20px;
  170. width: 300rpx;
  171. white-space: nowrap;
  172. overflow: hidden;
  173. text-overflow: ellipsis;
  174. }
  175. }
  176. .item:nth-child(2n) .content {
  177. margin: 0px 0 0px 7.5px;
  178. border-radius: 10px;
  179. }
  180. .lyy-f-word3 {
  181. font-size: 12px;
  182. text-decoration: line-through;
  183. color: rgba(139, 139, 139, 1);
  184. }
  185. .lyy-f-word5 {
  186. font-size: 20rpx;
  187. color: rgba(153, 153, 153, 1);
  188. margin: 20rpx 0px 0px 0px;
  189. }
  190. .lyy-f-word4 {
  191. height: 26px;
  192. background: #6fb22f;
  193. color: white;
  194. text-align: center;
  195. }
  196. .lyy-f-d {
  197. height: 24rpx;
  198. border: 1px solid rgba(252, 91, 98, 1);
  199. border-radius: 3px;
  200. font-size: 20rpx;
  201. text-align: center;
  202. width: 50rpx;
  203. color: rgba(252, 91, 98, 1);
  204. margin: 23rpx 0rpx 0rpx 0rpx;
  205. line-height: 24rpx;
  206. }
  207. .lyy-flex2 {
  208. display: flex;
  209. padding-right: 10rpx;
  210. align-items: center;
  211. .lyy-flex3 {
  212. flex: 1;
  213. .lyy-f-word2 {
  214. font-size: 14px;
  215. color: rgba(241, 13, 59, 1);
  216. }
  217. }
  218. &.lyy-a-tu2 {
  219. height: 34rpx;
  220. background: rgba(255, 255, 255, 1);
  221. border: 1px solid #fc5b62;
  222. border-radius: 2px;
  223. margin: 10rpx 0rpx;
  224. .lyy-a-tu3 {
  225. height: 30rpx;
  226. background-color: #fc5b62;
  227. padding: 0px 6px;
  228. text-align: center;
  229. .lyy-a-tu5 {
  230. width: 20rpx;
  231. height: 20rpx;
  232. margin-top: 6rpx;
  233. display: block;
  234. }
  235. }
  236. .lyy-a-tu4 {
  237. margin-left: 4rpx;
  238. font-size: 24rpx;
  239. line-height: 30rpx;
  240. color: #fc5b62;
  241. padding: 0px 10rpx;
  242. text-align: center;
  243. }
  244. }
  245. }
  246. }
  247. .good-wrapper {
  248. width: 710rpx;
  249. background-color: #f7f5f5;
  250. margin: 20rpx auto 0;
  251. .spgood {
  252. width: 710rpx;
  253. height: 280rpx;
  254. background: #FFFFFF;
  255. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  256. border-radius: 8rpx;
  257. padding: 40rpx 20rpx;
  258. display: flex;
  259. margin-bottom: 21rpx;
  260. .left-wrapper {
  261. width: 190rpx;
  262. height: 200rpx;
  263. border-radius: 10rpx;
  264. image {
  265. width: 190rpx;
  266. height: 200rpx;
  267. border-radius: 10rpx;
  268. }
  269. }
  270. .right-wrapper {
  271. padding-left: 22rpx;
  272. width: 100%;
  273. height: 200rpx;
  274. // background-color: red;
  275. .right-title {
  276. padding-top: 8rpx;
  277. width: 400rpx;
  278. // height: 29rpx;
  279. font-size: 30rpx;
  280. font-weight: bold;
  281. color: #333333;
  282. }
  283. .right-addr {
  284. margin-top: 18rpx;
  285. display: flex;
  286. .shop-img {
  287. width: 26rpx;
  288. height: 23rpx;
  289. margin: 0 4rpx 0 0;
  290. image {
  291. width: 100%;
  292. height: 100%;
  293. }
  294. }
  295. .shop-name {
  296. // height: 22rpx;
  297. font-size: 22rpx;
  298. font-weight: 500;
  299. color: #dcb876;
  300. }
  301. .point-img {
  302. width: 16rpx;
  303. height: 23rpx;
  304. margin: 0 4rpx 0 14rpx;
  305. image {
  306. width: 100%;
  307. height: 21rpx;
  308. }
  309. }
  310. .point-disc {
  311. font-size: 24rpx;
  312. font-weight: 500;
  313. padding-top: 3rpx;
  314. color: #dcb876;
  315. }
  316. }
  317. .ex-addr {
  318. margin-top: 16rpx;
  319. // padding-left: 22rpx;
  320. height: 24rpx;
  321. font-size: 24rpx;
  322. font-weight: 500;
  323. color: #dcb876;
  324. image {
  325. height: 22rpx;
  326. }
  327. .name-img {
  328. // vertical-align: ;
  329. width: 26rpx;
  330. margin: 0 4rpx -3rpx 0;
  331. }
  332. .point-img {
  333. width: 16rpx;
  334. margin: 0 4rpx -3rpx 14rpx;
  335. }
  336. }
  337. .pepple-num {
  338. // width: 99rpx;
  339. display: inline-block;
  340. padding-right: 15rpx;
  341. height: 36rpx;
  342. // color: #ff3366;
  343. // background: #FC7A0C;
  344. background-color: #fee4ce;
  345. // opacity: 0.2;
  346. border-radius: 18rpx;
  347. font-size: 20rpx;
  348. font-weight: 500;
  349. color: #ff3366;
  350. line-height: 36rpx;
  351. padding-left: 12rpx;
  352. margin-top: 33rpx;
  353. image {
  354. width: 17rpx;
  355. height: 20rpx;
  356. margin-right: 10rpx;
  357. // padding-right: rpx;
  358. }
  359. }
  360. .right-bottom {
  361. margin-top: 2rpx;
  362. // justify-items: flex-end;
  363. display: flex;
  364. justify-content: space-between;
  365. .sp-price {
  366. height: 60rpx;
  367. display: flex;
  368. vertical-align: bottom;
  369. line-height: 60rpx;
  370. .now-price {
  371. font-size: 30rpx;
  372. font-weight: bold;
  373. color: #901b21;
  374. margin-right: 16rpx;
  375. }
  376. .old-price {
  377. font-size: 22rpx;
  378. font-weight: 500;
  379. text-decoration: line-through;
  380. color: #aaaaaa;
  381. }
  382. }
  383. .sp-btn {
  384. width: 160rpx;
  385. height: 60rpx;
  386. border-radius: 30rpx;
  387. font-size: 26rpx;
  388. text-align: center;
  389. line-height: 60rpx;
  390. font-weight: 400;
  391. color: #ffffff;
  392. background-color: #901b21;
  393. }
  394. }
  395. }
  396. }
  397. }
  398. </style>