You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

263 lines
5.9 KiB

3 months ago
  1. <template>
  2. <div class="quality-recommend" :data-theme="theme">
  3. <view class="saleBox" v-if="typeInfo.pic"></view>
  4. <view class="header skeleton-rect" v-if="typeInfo.pic">
  5. <view class="borRadius14">
  6. <image :src="typeInfo.pic" class="slide-image borRadius14" lazy-load></image>
  7. </view>
  8. </view>
  9. <div class="title acea-row row-center-wrapper">
  10. <div class="line"></div>
  11. <div class="name">
  12. <span class="iconfont icon-jingpintuijian" ></span> {{typeInfo.name}}
  13. </div>
  14. <div class="line"></div>
  15. </div>
  16. <view class="wrapper">
  17. <view class="list">
  18. <view class="item acea-row row-middle" v-for="(item,index) in tempArr" :key="index" @click="toDetail(item.id)">
  19. <view class="img_box">
  20. <image class="pictrue" :src="item.image"></image>
  21. <view :style="{ backgroundImage: `url(${item.activityStyle})` }" class="border-picture"></view>
  22. </view>
  23. <view class="ml_11 flex-column justify-between">
  24. <view class="goods_name">{{item.storeName}}</view>
  25. <view class="price flex justify-between">
  26. <view>
  27. <text class="price_bdg"></text>{{item.price}}
  28. <text class="otPrice">{{item.otPrice}}</text>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class='loadingicon acea-row row-center-wrapper' v-if="goodScroll">
  35. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>
  36. </view>
  37. <view class="txt-bar" v-if="tempArr.length > 0">我也是有底线的~</view>
  38. <emptyPage title="暂无数据~" v-if="tempArr.length == 0"></emptyPage>
  39. </view>
  40. </div>
  41. </template>
  42. <script>
  43. import emptyPage from '@/components/emptyPage.vue';
  44. import GoodList from '@/components/goodList/index';
  45. import {getGroomList} from '@/api/store';
  46. import {goPage} from '@/libs/order.js';
  47. import {productRank} from '@/api/api.js'
  48. import Loading from '@/components/Loading/index.vue';
  49. import animationType from '@/utils/animationType.js'
  50. let app = getApp()
  51. export default {
  52. name: 'HotNewGoods',
  53. components: {
  54. GoodList,
  55. emptyPage,
  56. Loading
  57. },
  58. data: function() {
  59. return {
  60. circular:true,
  61. theme:app.globalData.theme,
  62. typeInfo:{},
  63. loading:false,
  64. params: { //精品推荐分页
  65. page: 1,
  66. limit: 10,
  67. },
  68. loading: false,
  69. goodScroll: true, //精品推荐开关
  70. tempArr:[],
  71. };
  72. },
  73. onLoad: function(e) {
  74. this.typeInfo = e;
  75. uni.setNavigationBarTitle({
  76. title: this.typeInfo.name
  77. });
  78. if(this.typeInfo.name == '商品排行'){
  79. this.getProductRank();
  80. }else{
  81. this.getGroomList();
  82. }
  83. },
  84. methods: {
  85. getGroomList() {
  86. this.loading = true
  87. if (!this.goodScroll) return
  88. getGroomList(this.typeInfo.type, this.params).then(({data}) => {
  89. this.goodScroll = data.list.length >= this.params.limit
  90. this.loading = false
  91. this.params.page++
  92. this.tempArr = this.tempArr.concat(data.list)
  93. })
  94. },
  95. getProductRank(){
  96. productRank().then(res=>{
  97. this.tempArr = res.data;
  98. })
  99. },
  100. toDetail(id){
  101. uni.navigateTo({
  102. animationType: animationType.type,
  103. animationDuration: animationType.duration,
  104. url:'/pages/goods/goods_details/index?id=' + id
  105. })
  106. }
  107. },
  108. onReachBottom() {
  109. if (this.params.page != 1) {
  110. this.getGroomList();
  111. }
  112. },
  113. }
  114. </script>
  115. <style lang="scss">
  116. /deep/ .quality-recommend {
  117. background-color: #f5f5f5;
  118. }
  119. .saleBox{
  120. width: 100%;
  121. height: 298rpx;
  122. /* #ifdef MP */
  123. height: 300rpx;
  124. /* #endif */
  125. @include main_bg_color(theme);
  126. border-radius: 0 0 50rpx 50rpx;
  127. }
  128. .quality-recommend .header {
  129. width: 710rpx;
  130. height: 330rpx;
  131. margin: -276rpx auto 0 auto;
  132. border-radius: 14rpx;
  133. overflow: hidden;
  134. .slide-image{
  135. height: 330rpx !important;
  136. border-radius: 14rpx;
  137. overflow: hidden;
  138. }
  139. }
  140. .quality-recommend .header image {
  141. width: 100%;
  142. height: 100%;
  143. border-radius: 14rpx;
  144. overflow: hidden;
  145. img{
  146. border-radius: 14rpx;
  147. }
  148. }
  149. .quality-recommend {
  150. .wrapper {
  151. // background: #fff;
  152. .list {
  153. width: 690rpx;
  154. border-radius: 20rpx;
  155. background-color: #fff;
  156. margin: 0rpx auto 0 auto;
  157. padding: 20rpx 20rpx 30rpx;
  158. box-sizing: border-box;
  159. .item {
  160. background: #fff;
  161. margin-top: 26rpx;
  162. .img_box{
  163. width: 180rpx;
  164. height: 180rpx;
  165. background: #F3F3F3;
  166. position: relative;
  167. .pictrue{
  168. width:100%;
  169. height:100%;
  170. border-radius: 10rpx;
  171. }
  172. .rank_bdg{
  173. width: 100%;
  174. height: 46rpx;
  175. position: absolute;
  176. bottom: 0;
  177. left: 0;
  178. right: 0;
  179. margin: auto;
  180. text-align: center;
  181. color: #fff;
  182. font-size: 24rpx;
  183. line-height: 46rpx;
  184. }
  185. }
  186. .ml_11{
  187. margin-left: 22rpx;
  188. border-bottom: 1px solid #eee;
  189. padding-bottom: 20rpx;
  190. }
  191. .goods_name{
  192. width: 420rpx;
  193. height: 80rpx;
  194. font-size: 30rpx;
  195. font-weight: 400;
  196. color: #333333;
  197. line-height: 40rpx;
  198. overflow: hidden;
  199. text-overflow:ellipsis;
  200. white-space: wrap;
  201. }
  202. }
  203. }
  204. }
  205. .title {
  206. height: 120rpx;
  207. font-size: 32rpx;
  208. color: #282828;
  209. background-color: #f5f5f5;
  210. .name {
  211. margin: 0 20rpx;
  212. .iconfont {
  213. margin-right: 10rpx;
  214. }
  215. }
  216. .line {
  217. width: 230rpx;
  218. height: 2rpx;
  219. background-color: #e9e9e9;
  220. }
  221. }
  222. }
  223. .price{
  224. margin-top: 60rpx;
  225. font-size: 34rpx;
  226. font-weight: 600;
  227. @include price_color(theme);
  228. .price_bdg{
  229. font-size: 26rpx;
  230. }
  231. .otPrice{
  232. font-size: 24rpx;
  233. color: #999999;
  234. font-weight: 400;
  235. padding-left: 12rpx;
  236. text-decoration: line-through;
  237. }
  238. .cart_icon{
  239. width: 48rpx;
  240. height: 48rpx;
  241. border-radius: 50%;
  242. @include main_bg_color(theme);
  243. text-align: center;
  244. line-height: 40rpx;
  245. .iconfont{
  246. font-size: 28rpx;
  247. font-weight: 400;
  248. color: #fff;
  249. }
  250. }
  251. }
  252. .txt-bar {
  253. padding: 20rpx 0;
  254. text-align: center;
  255. font-size: 26rpx;
  256. color: #666;
  257. background-color: #f5f5f5;
  258. }
  259. </style>