popular.vue 9.6 KB

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