popular.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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. uni.navigateTo({
  224. url: url
  225. })
  226. })
  227. }
  228. }
  229. }
  230. </script>
  231. <style lang="scss" scoped>
  232. /deep/.uni-scroll-view-content,
  233. .scroll-view_x {
  234. display: flex;
  235. flex-wrap: nowrap;
  236. }
  237. .hotList {
  238. background-color: #fff;
  239. margin: $uni-index-margin-row $uni-index-margin-col;
  240. border-radius: 12rpx;
  241. }
  242. .hotList .hot-bg {
  243. width: 100%;
  244. height: 120rpx;
  245. box-sizing: border-box;
  246. font-size: 24rpx;
  247. color: #282828;
  248. margin-top: 15rpx;
  249. }
  250. // .hotList .title {
  251. // padding: 20rpx 20rpx 0 20rpx;
  252. // .iconfont {
  253. // color: var(--view-theme);
  254. // font-size: 36rpx;
  255. // margin-top: 4rpx;
  256. // margin-right: 12rpx;
  257. // }
  258. // }
  259. .hotList .title .text {
  260. display: flex;
  261. .txt-btn {
  262. display: flex;
  263. align-items: flex-end;
  264. margin-bottom: 8rpx;
  265. margin-left: 12rpx;
  266. }
  267. }
  268. // .hotList .title .text .label {
  269. // font-size: $uni-index-title-font-size;
  270. // font-weight: bold;
  271. // color: #282828;
  272. // margin-right: 12rpx;
  273. // }
  274. // .hotList .title .more {
  275. // font-size: 26rpx;
  276. // color: #999999;
  277. // ;
  278. // }
  279. // .hotList .title .more .iconfont {
  280. // font-size: 25rpx;
  281. // margin-left: 10rpx;
  282. // }
  283. .hotList .list {
  284. border-radius: 20rpx;
  285. background-color: #fff;
  286. margin: 0rpx auto 0 auto;
  287. padding: 20rpx 20rpx;
  288. box-sizing: border-box;
  289. display: flex;
  290. justify-content: space-between;
  291. width: 100%;
  292. white-space: nowrap;
  293. }
  294. .hotList .list .item {
  295. width: 200rpx;
  296. background: var(--view-op-ten);
  297. border-radius: 12rpx;
  298. margin-right: 20rpx;
  299. display: inline-block;
  300. .rectangle {
  301. margin: 0 auto;
  302. border-radius: 30rpx;
  303. text-align: center;
  304. margin-top: -30rpx;
  305. font-size: 24rpx;
  306. color: #fff;
  307. z-index: 99;
  308. position: relative;
  309. width: 172rpx;
  310. background-color: var(--view-theme);
  311. }
  312. }
  313. .hotList .list .item~.item {
  314. // margin-left: 25rpx;
  315. }
  316. .hotList .list .item .pictrue {
  317. width: 180rpx;
  318. height: 180rpx;
  319. position: relative;
  320. margin: 8rpx;
  321. border-radius: 12rpx;
  322. }
  323. .hotList .list .item .pictrue image {
  324. width: 100%;
  325. height: 100%;
  326. border-radius: 12rpx;
  327. }
  328. .hotList .list .item .pictrue {
  329. /deep/,
  330. /deep/image,
  331. /deep/.easy-loadimage,
  332. /deep/uni-image {
  333. width: 180rpx;
  334. height: 180rpx;
  335. border-radius: 12rpx;
  336. }
  337. }
  338. .hotList .list .item .pictrue .numPic {
  339. width: 50rpx;
  340. height: 50rpx;
  341. border-radius: 50%;
  342. position: absolute;
  343. top: 7rpx;
  344. left: 7rpx;
  345. }
  346. .hotList .list .item .name {
  347. font-size: 26rpx;
  348. color: var(--view-theme);
  349. margin-top: 12rpx;
  350. padding: 0 10rpx 10rpx 10rpx;
  351. }
  352. .hotList .list .item .money {
  353. font-size: 20rpx;
  354. font-weight: bold;
  355. margin-top: 4rpx;
  356. text-align: center;
  357. }
  358. .hotList .list .item .money .num {
  359. font-size: 28rpx;
  360. }
  361. .empty-img {
  362. width: 100%;
  363. height: 340rpx;
  364. line-height: 340rpx;
  365. background: #ccc;
  366. font-size: 40rpx;
  367. color: #000;
  368. border-radius: 14rpx;
  369. text-align: center;
  370. font-size: 30rpx;
  371. }
  372. .font-color {
  373. color: var(--view-priceColor);
  374. }
  375. </style>