popular.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='hotList skeleton-rect index-wrapper' v-if="isShow && hotList.length">
  4. <!-- <view class='hot-bg'>
  5. </view> -->
  6. <!-- <view class='title acea-row row-between-wrapper'>
  7. <view class='text line1'>
  8. <text class='label'><text class="iconfont icon-paihangbang"></text>{{titleInfo[0].val}}</text>
  9. {{titleInfo[1].val}}
  10. </view>
  11. <view class='more' hover-class="none" @click="gopage(titleInfo[2].val)">
  12. 更多
  13. <text class="iconfont icon-jiantou"></text>
  14. </view>
  15. </view> -->
  16. <view class='title acea-row row-between-wrapper'>
  17. <view class='text'>
  18. <view class='name line1'>
  19. <text class="iconfont icon-shoufaxinpin"></text>
  20. {{$t(titleInfo[0].val)}}
  21. <!-- <text class='new font-color'>NEW~</text> -->
  22. </view>
  23. <view class='line1 txt-btn'>{{$t(titleInfo[1].val)}}</view>
  24. </view>
  25. <view class='more' @click="gopage(titleInfo[2].val)">
  26. {{$t(`更多`)}}
  27. <text class='iconfont icon-jiantou'></text>
  28. </view>
  29. </view>
  30. <view class='list'>
  31. <scroll-view class="scroll-view_x" scroll-x style="width:auto;overflow:hidden;">
  32. <block v-for="(item,index) in hotList" :key='index'>
  33. <view class='item' @click="gopage('/pages/goods_details/index?id='+item.id)">
  34. <view class='pictrue'>
  35. <easy-loadimage mode="widthFix" :image-src="item.image"></easy-loadimage>
  36. <image v-if="index == 0" src='/static/images/one.png' class='numPic'></image>
  37. <image v-else-if="index == 1" src='/static/images/two.png' class='numPic'></image>
  38. <image v-else-if="index == 2" src='/static/images/three.png' class='numPic'></image>
  39. </view>
  40. <view class="rectangle">
  41. {{$t(`热度 TOP`)}} {{index+1}}
  42. </view>
  43. <view class='name line1'>{{item.store_name}}</view>
  44. <!-- <view class='money font-color'>
  45. <text class='num'>{{item.price}}</text>
  46. </view> -->
  47. </view>
  48. </block>
  49. </scroll-view>
  50. </view>
  51. </view>
  52. <view class='hotList index-wrapper' v-if="!isShow && isIframe && hotList.length">
  53. <!-- <view class='hot-bg'>
  54. <view class='title acea-row row-between-wrapper'>
  55. <view class='text line1'>
  56. <text class='label'><text class="iconfont icon-paihangbang"></text>{{titleInfo[0].val}}</text>
  57. {{titleInfo[1].val}}
  58. </view>
  59. <view class='more' hover-class="none" @click="gopage(titleInfo[2].val)">
  60. 更多
  61. <text class="iconfont icon-jiantou"></text>
  62. </view>
  63. </view>
  64. </view> -->
  65. <view class='title acea-row row-between-wrapper'>
  66. <view class='text'>
  67. <view class='name line1'>
  68. <text class="iconfont icon-shoufaxinpin"></text>
  69. {{titleInfo[0].val}}
  70. <!-- <text class='new font-color'>NEW~</text> -->
  71. </view>
  72. <view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
  73. </view>
  74. <view class='more' @click="gopage(titleInfo[2].val)">
  75. {{$t(`更多`)}}
  76. <text class='iconfont icon-jiantou'></text>
  77. </view>
  78. </view>
  79. <view class='list acea-row row-middle'>
  80. <block v-for="(item,index) in hotList" :key='index'>
  81. <view class='item' @click="gopage('/pages/goods_details/index?id='+item.id)">
  82. <view class='pictrue'>
  83. <image :src='item.image'></image>
  84. <image v-if="index == 0" src='/static/images/one.png' class='numPic'></image>
  85. <image v-else-if="index == 1" src='/static/images/two.png' class='numPic'></image>
  86. <image v-else-if="index == 2" src='/static/images/three.png' class='numPic'></image>
  87. </view>
  88. <view class='name line1'>{{item.store_name}}</view>
  89. <!-- <view class='money font-color'>
  90. <text class='num'>{{item.price}}</text>
  91. </view> -->
  92. </view>
  93. </block>
  94. </view>
  95. </view>
  96. <view class='hotList index-wrapper' v-if="isIframe && !hotList.length">
  97. <view class='title acea-row row-between-wrapper'>
  98. <view class='text'>
  99. <view class='name line1'>
  100. <text class="iconfont icon-shoufaxinpin"></text>
  101. {{titleInfo[0].val}}
  102. <!-- <text class='new font-color'>NEW~</text> -->
  103. </view>
  104. <view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
  105. </view>
  106. <view class='more' @click="gopage(titleInfo[2].val)">
  107. {{$t(`更多`)}}
  108. <text class='iconfont icon-jiantou'></text>
  109. </view>
  110. </view>
  111. <!-- <view class='hot-bg'>
  112. <view class='title acea-row row-between-wrapper'>
  113. <view class='text line1'>
  114. <text class='label'><text class="iconfont icon-paihangbang"></text>{{titleInfo[0].val}}</text>
  115. {{titleInfo[1].val}}
  116. </view>
  117. <view class='more' hover-class="none" @click="gopage(titleInfo[2].val)">
  118. 更多
  119. <text class="iconfont icon-jiantou"></text>
  120. </view>
  121. </view>
  122. </view> -->
  123. <view class="empty-img">{{$t(`排行榜、暂无数据`)}}</view>
  124. </view>
  125. </view>
  126. </template>
  127. <script>
  128. let app = getApp()
  129. import colors from "@/mixins/color";
  130. import {
  131. mapState
  132. } from 'vuex';
  133. import {
  134. goPage
  135. } from '@/libs/order.js';
  136. import {
  137. getHomeProducts
  138. } from '@/api/store.js';
  139. export default {
  140. name: 'goodList',
  141. mixins: [colors],
  142. props: {
  143. dataConfig: {
  144. type: Object,
  145. default: () => {}
  146. }
  147. },
  148. watch: {
  149. dataConfig: {
  150. immediate: true,
  151. handler(nVal, oVal) {
  152. if (nVal) {
  153. this.isShow = nVal.isShow.val;
  154. this.selectType = nVal.tabConfig.tabVal;
  155. this.$set(this, 'selectId', nVal.selectConfig && nVal.selectConfig.activeValue ? nVal.selectConfig
  156. .activeValue : '');
  157. this.$set(this, 'type', nVal.selectSortConfig && nVal.selectSortConfig.activeValue ? nVal
  158. .selectSortConfig.activeValue : '');
  159. this.salesOrder = nVal.goodsSort.type == 1 ? 'desc' : '';
  160. this.newsOrder = nVal.goodsSort.type == 2 ? 'news' : '';
  161. this.ids = nVal.ids ? nVal.ids.join(',') : '';
  162. this.numConfig = nVal.numConfig.val;
  163. this.titleInfo = nVal.titleInfo.list;
  164. this.productslist();
  165. }
  166. }
  167. }
  168. },
  169. created() {},
  170. mounted() {},
  171. data() {
  172. return {
  173. hotList: [],
  174. name: this.$options.name,
  175. isShow: true,
  176. isIframe: app.globalData.isIframe,
  177. selectType: 0,
  178. selectId: '',
  179. salesOrder: '',
  180. newsOrder: '',
  181. ids: '',
  182. page: 1,
  183. limit: this.$config.LIMIT,
  184. type: '',
  185. numConfig: 0,
  186. titleInfo: []
  187. }
  188. },
  189. methods: {
  190. // 产品列表
  191. productslist: function() {
  192. let that = this;
  193. let data = {};
  194. if (that.selectType) {
  195. data = {
  196. page: that.page,
  197. limit: that.limit,
  198. type: that.type,
  199. ids: that.ids,
  200. selectType: that.selectType
  201. }
  202. } else {
  203. data = {
  204. page: that.page,
  205. limit: that.numConfig <= that.limit ? that.numConfig : that.limit,
  206. type: that.type,
  207. newsOrder: that.newsOrder,
  208. salesOrder: that.salesOrder,
  209. selectId: that.selectId,
  210. selectType: that.selectType
  211. }
  212. }
  213. getHomeProducts(data).then(res => {
  214. that.hotList = res.data.list;
  215. }).catch(err => {
  216. that.$util.Tips({
  217. title: err
  218. });
  219. });
  220. },
  221. gopage(url) {
  222. goPage().then(res => {
  223. this.$util.JumpPath(url);
  224. })
  225. }
  226. }
  227. }
  228. </script>
  229. <style lang="scss" scoped>
  230. /deep/.uni-scroll-view-content,
  231. .scroll-view_x {
  232. display: flex;
  233. flex-wrap: nowrap;
  234. }
  235. .hotList {
  236. background-color: #fff;
  237. margin: $uni-index-margin-row $uni-index-margin-col;
  238. border-radius: 12rpx;
  239. }
  240. .hotList .hot-bg {
  241. width: 100%;
  242. height: 120rpx;
  243. box-sizing: border-box;
  244. font-size: 24rpx;
  245. color: #282828;
  246. margin-top: 15rpx;
  247. }
  248. // .hotList .title {
  249. // padding: 20rpx 20rpx 0 20rpx;
  250. // .iconfont {
  251. // color: var(--view-theme);
  252. // font-size: 36rpx;
  253. // margin-top: 4rpx;
  254. // margin-right: 12rpx;
  255. // }
  256. // }
  257. .hotList .title .text {
  258. display: flex;
  259. .txt-btn {
  260. display: flex;
  261. align-items: flex-end;
  262. margin-bottom: 8rpx;
  263. margin-left: 12rpx;
  264. }
  265. }
  266. // .hotList .title .text .label {
  267. // font-size: $uni-index-title-font-size;
  268. // font-weight: bold;
  269. // color: #282828;
  270. // margin-right: 12rpx;
  271. // }
  272. // .hotList .title .more {
  273. // font-size: 26rpx;
  274. // color: #999999;
  275. // ;
  276. // }
  277. // .hotList .title .more .iconfont {
  278. // font-size: 25rpx;
  279. // margin-left: 10rpx;
  280. // }
  281. .hotList .list {
  282. border-radius: 20rpx;
  283. background-color: #fff;
  284. margin: 0rpx auto 0 auto;
  285. padding: 20rpx 20rpx;
  286. box-sizing: border-box;
  287. display: flex;
  288. justify-content: space-between;
  289. width: 100%;
  290. white-space: nowrap;
  291. }
  292. .hotList .list .item {
  293. width: 200rpx;
  294. background: var(--view-op-ten);
  295. border-radius: 12rpx;
  296. margin-right: 20rpx;
  297. display: inline-block;
  298. .rectangle {
  299. margin: 0 auto;
  300. border-radius: 30rpx;
  301. text-align: center;
  302. margin-top: -30rpx;
  303. font-size: 24rpx;
  304. color: #fff;
  305. z-index: 99;
  306. position: relative;
  307. width: 172rpx;
  308. background-color: var(--view-theme);
  309. }
  310. }
  311. .hotList .list .item~.item {
  312. // margin-left: 25rpx;
  313. }
  314. .hotList .list .item .pictrue {
  315. width: 180rpx;
  316. height: 180rpx;
  317. position: relative;
  318. margin: 8rpx;
  319. border-radius: 12rpx;
  320. }
  321. .hotList .list .item .pictrue image {
  322. width: 100%;
  323. height: 100%;
  324. border-radius: 12rpx;
  325. }
  326. .hotList .list .item .pictrue {
  327. /deep/,
  328. /deep/image,
  329. /deep/.easy-loadimage,
  330. /deep/uni-image {
  331. width: 180rpx;
  332. height: 180rpx;
  333. border-radius: 12rpx;
  334. }
  335. }
  336. .hotList .list .item .pictrue .numPic {
  337. width: 50rpx;
  338. height: 50rpx;
  339. border-radius: 50%;
  340. position: absolute;
  341. top: 7rpx;
  342. left: 7rpx;
  343. }
  344. .hotList .list .item .name {
  345. font-size: 26rpx;
  346. color: var(--view-theme);
  347. margin-top: 12rpx;
  348. padding: 0 10rpx 10rpx 10rpx;
  349. }
  350. .hotList .list .item .money {
  351. font-size: 20rpx;
  352. font-weight: bold;
  353. margin-top: 4rpx;
  354. text-align: center;
  355. }
  356. .hotList .list .item .money .num {
  357. font-size: 28rpx;
  358. }
  359. .empty-img {
  360. width: 100%;
  361. height: 340rpx;
  362. line-height: 340rpx;
  363. background: #ccc;
  364. font-size: 40rpx;
  365. color: #000;
  366. border-radius: 14rpx;
  367. text-align: center;
  368. font-size: 30rpx;
  369. }
  370. .font-color {
  371. color: var(--view-priceColor);
  372. }
  373. </style>