index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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.image" mode="scaleToFill"></image></view>
  28. <view class="right-wrapper">
  29. <view class="right-title clamp">{{ items.title }}</view>
  30. <view class="ex-addr">
  31. <image src="../../../static/img/shop.png" mode="" class="name-img"></image>
  32. {{items.unit_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.people }}人团</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. if (type === 'refresh') {
  96. // 清空数组
  97. obj.goodsList = [];
  98. }
  99. obj.goodsList = obj.goodsList.concat(e.data);
  100. //判断是否还有下一页,有是more 没有是nomore
  101. if (obj.limit == e.data.length) {
  102. obj.page++;
  103. obj.loadingType = 'more';
  104. } else {
  105. obj.loadingType = 'nomore';
  106. }
  107. if (type === 'refresh') {
  108. if (loading == 1) {
  109. uni.hideLoading();
  110. } else {
  111. uni.stopPullDownRefresh();
  112. }
  113. }
  114. })
  115. .catch();
  116. },
  117. goProduct(e) {
  118. uni.navigateTo({
  119. url: '/pages/product/groupBooking/productGroup?id=' + e.id
  120. });
  121. }
  122. }
  123. };
  124. </script>
  125. <style lang="scss">
  126. page {
  127. height: 100%;
  128. }
  129. // 拼团列表
  130. .lyy-f-a {
  131. margin: 0px 15px;
  132. .lyy-flex {
  133. /* 内部模块1*/
  134. display: flex;
  135. justify-content: space-between;
  136. }
  137. .lyy-f-b {
  138. flex-wrap: wrap;
  139. .lyy-f-c {
  140. flex: 0 0 50%;
  141. /* width: 50%; */
  142. margin: 10px 0px 0px 0px;
  143. }
  144. .item:nth-child(2n + 1) .content {
  145. margin: 0px 7.5px 0px 0px;
  146. border-radius: 10px;
  147. }
  148. }
  149. .lyy-f-b .content {
  150. background-color: white;
  151. .lyy-f-image {
  152. width: 100%;
  153. height: 340rpx;
  154. border-radius: 10rpx 10rpx 0rpx 0rpx;
  155. }
  156. .ellipsis {
  157. width: 165px;
  158. white-space: nowrap;
  159. overflow: hidden;
  160. text-overflow: ellipsis;
  161. }
  162. .lyy-f-jl {
  163. padding: 5px 7px;
  164. }
  165. .lyy-f-word1 {
  166. font-size: 12px;
  167. color: rgba(50, 50, 50, 1);
  168. line-height: 20px;
  169. width: 300rpx;
  170. white-space: nowrap;
  171. overflow: hidden;
  172. text-overflow: ellipsis;
  173. }
  174. }
  175. .item:nth-child(2n) .content {
  176. margin: 0px 0 0px 7.5px;
  177. border-radius: 10px;
  178. }
  179. .lyy-f-word3 {
  180. font-size: 12px;
  181. text-decoration: line-through;
  182. color: rgba(139, 139, 139, 1);
  183. }
  184. .lyy-f-word5 {
  185. font-size: 20rpx;
  186. color: rgba(153, 153, 153, 1);
  187. margin: 20rpx 0px 0px 0px;
  188. }
  189. .lyy-f-word4 {
  190. height: 26px;
  191. background: #6fb22f;
  192. color: white;
  193. text-align: center;
  194. }
  195. .lyy-f-d {
  196. height: 24rpx;
  197. border: 1px solid rgba(252, 91, 98, 1);
  198. border-radius: 3px;
  199. font-size: 20rpx;
  200. text-align: center;
  201. width: 50rpx;
  202. color: rgba(252, 91, 98, 1);
  203. margin: 23rpx 0rpx 0rpx 0rpx;
  204. line-height: 24rpx;
  205. }
  206. .lyy-flex2 {
  207. display: flex;
  208. padding-right: 10rpx;
  209. align-items: center;
  210. .lyy-flex3 {
  211. flex: 1;
  212. .lyy-f-word2 {
  213. font-size: 14px;
  214. color: rgba(241, 13, 59, 1);
  215. }
  216. }
  217. &.lyy-a-tu2 {
  218. height: 34rpx;
  219. background: rgba(255, 255, 255, 1);
  220. border: 1px solid #fc5b62;
  221. border-radius: 2px;
  222. margin: 10rpx 0rpx;
  223. .lyy-a-tu3 {
  224. height: 30rpx;
  225. background-color: #fc5b62;
  226. padding: 0px 6px;
  227. text-align: center;
  228. .lyy-a-tu5 {
  229. width: 20rpx;
  230. height: 20rpx;
  231. margin-top: 6rpx;
  232. display: block;
  233. }
  234. }
  235. .lyy-a-tu4 {
  236. margin-left: 4rpx;
  237. font-size: 24rpx;
  238. line-height: 30rpx;
  239. color: #fc5b62;
  240. padding: 0px 10rpx;
  241. text-align: center;
  242. }
  243. }
  244. }
  245. }
  246. .good-wrapper {
  247. width: 710rpx;
  248. background-color: #f7f5f5;
  249. margin: 20rpx auto 0;
  250. .spgood {
  251. width: 710rpx;
  252. height: 280rpx;
  253. background: #FFFFFF;
  254. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  255. border-radius: 8rpx;
  256. padding: 40rpx 20rpx;
  257. display: flex;
  258. margin-bottom: 21rpx;
  259. .left-wrapper {
  260. width: 190rpx;
  261. height: 200rpx;
  262. border-radius: 10rpx;
  263. image {
  264. width: 190rpx;
  265. height: 200rpx;
  266. border-radius: 10rpx;
  267. }
  268. }
  269. .right-wrapper {
  270. padding-left: 22rpx;
  271. width: 100%;
  272. height: 200rpx;
  273. // background-color: red;
  274. .right-title {
  275. padding-top: 8rpx;
  276. width: 400rpx;
  277. // height: 29rpx;
  278. font-size: 30rpx;
  279. font-weight: bold;
  280. color: #333333;
  281. }
  282. .right-addr {
  283. margin-top: 18rpx;
  284. display: flex;
  285. .shop-img {
  286. width: 26rpx;
  287. height: 23rpx;
  288. margin: 0 4rpx 0 0;
  289. image {
  290. width: 100%;
  291. height: 100%;
  292. }
  293. }
  294. .shop-name {
  295. // height: 22rpx;
  296. font-size: 22rpx;
  297. font-weight: 500;
  298. color: #dcb876;
  299. }
  300. .point-img {
  301. width: 16rpx;
  302. height: 23rpx;
  303. margin: 0 4rpx 0 14rpx;
  304. image {
  305. width: 100%;
  306. height: 21rpx;
  307. }
  308. }
  309. .point-disc {
  310. font-size: 24rpx;
  311. font-weight: 500;
  312. padding-top: 3rpx;
  313. color: #dcb876;
  314. }
  315. }
  316. .ex-addr {
  317. margin-top: 16rpx;
  318. // padding-left: 22rpx;
  319. height: 24rpx;
  320. font-size: 24rpx;
  321. font-weight: 500;
  322. color: #dcb876;
  323. image {
  324. height: 22rpx;
  325. }
  326. .name-img {
  327. // vertical-align: ;
  328. width: 26rpx;
  329. margin: 0 4rpx -3rpx 0;
  330. }
  331. .point-img {
  332. width: 16rpx;
  333. margin: 0 4rpx -3rpx 14rpx;
  334. }
  335. }
  336. .pepple-num {
  337. // width: 99rpx;
  338. display: inline-block;
  339. padding-right: 15rpx;
  340. height: 36rpx;
  341. // color: #ff3366;
  342. // background: #FC7A0C;
  343. background-color: #fee4ce;
  344. // opacity: 0.2;
  345. border-radius: 18rpx;
  346. font-size: 20rpx;
  347. font-weight: 500;
  348. color: #ff3366;
  349. line-height: 36rpx;
  350. padding-left: 12rpx;
  351. margin-top: 33rpx;
  352. image {
  353. width: 17rpx;
  354. height: 20rpx;
  355. margin-right: 10rpx;
  356. // padding-right: rpx;
  357. }
  358. }
  359. .right-bottom {
  360. margin-top: 2rpx;
  361. // justify-items: flex-end;
  362. display: flex;
  363. justify-content: space-between;
  364. .sp-price {
  365. height: 60rpx;
  366. display: flex;
  367. vertical-align: bottom;
  368. line-height: 60rpx;
  369. .now-price {
  370. font-size: 30rpx;
  371. font-weight: bold;
  372. color: #901b21;
  373. margin-right: 16rpx;
  374. }
  375. .old-price {
  376. font-size: 22rpx;
  377. font-weight: 500;
  378. text-decoration: line-through;
  379. color: #aaaaaa;
  380. }
  381. }
  382. .sp-btn {
  383. width: 160rpx;
  384. height: 60rpx;
  385. border-radius: 30rpx;
  386. font-size: 26rpx;
  387. text-align: center;
  388. line-height: 60rpx;
  389. font-weight: 400;
  390. color: #ffffff;
  391. background-color: #901b21;
  392. }
  393. }
  394. }
  395. }
  396. }
  397. </style>