index.vue 9.8 KB

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