ranking.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view :style="[boxStyle]">
  3. <view class="pt-24 pb-24 pl-24" :style="[boxContentStyle]" @tap="goRank">
  4. <view class="flex-between-center pr-24">
  5. <text class="fs-32 fw-500" v-if="titleConfig">{{titleTxtConfig}}</text>
  6. <image :src="titleImg" class="w-102 h-32" v-else></image>
  7. <text class="fs-24 text--w111-999" :style="[headerBntColor]">
  8. {{headerBtnText}} <text class="iconfont icon-ic_rightarrow fs-24"></text>
  9. </text>
  10. </view>
  11. <scroll-view scroll-x="true" class="white-nowrap vertical-middle w-full mt-32"
  12. show-scrollbar="false" v-if="styleConfig == 0">
  13. <view class="inline-block mr-20">
  14. <view class="rank-card" :style="[rankCardStyle]">
  15. <view class="fs-28 lh-40rpx fw-600 flex-y-center" :style="[rankItemTitleStyle]">
  16. <text class="iconfont icon-ic_fire fs-32"></text>
  17. <text class="pl-8 font-color">销量榜</text>
  18. </view>
  19. <view class="rd-12rpx bg--w111-fff mt-18 p-14 h-400" v-if="sales.length">
  20. <view class="rank-pro-item flex-y-center" v-for="(item,index) in sales" :key="index">
  21. <view class="w-108 h-108 relative">
  22. <easy-loadimage
  23. :image-src="item.image"
  24. width="108rpx"
  25. height="108rpx"
  26. :borderRadius="imgStyle"></easy-loadimage>
  27. <view class="rank_count fs-24 text--w111-fff flex-center" :class="'rank-count' + (index + 1)">{{index + 1}}</view>
  28. </view>
  29. <view class="pl-16">
  30. <view class="w-130 line1 fs-26 lh-36rpx mb-8">{{item.store_name}}</view>
  31. <baseMoney :money="item.price" symbolSize="20" integerSize="28" decimalSize="28" :color="priceColor" weight></baseMoney>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="inline-block mr-20">
  38. <view class="rank-card" :style="[rankCardStyle]">
  39. <view class="fs-28 lh-40rpx fw-600 flex-y-center" :style="[rankItemTitleStyle]">
  40. <text class="iconfont icon-ic_fire fs-32"></text>
  41. <text class="pl-8 font-color">收藏榜</text>
  42. </view>
  43. <view class="rd-12rpx bg--w111-fff mt-18 p-14 h-400" v-if="collect.length">
  44. <view class="rank-pro-item flex-y-center" v-for="(item,index) in collect" :key="index">
  45. <view class="w-108 h-108 relative">
  46. <easy-loadimage
  47. :image-src="item.image"
  48. width="108rpx"
  49. height="108rpx"
  50. :borderRadius="imgStyle"></easy-loadimage>
  51. <view class="rank_count fs-24 text--w111-fff flex-center" :class="'rank-count' + (index + 1)">{{index + 1}}</view>
  52. </view>
  53. <view class="pl-16">
  54. <view class="w-130 line1 fs-26 lh-36rpx mb-8">{{item.store_name}}</view>
  55. <baseMoney :money="item.price" symbolSize="20" integerSize="28" decimalSize="28" :color="priceColor" weight></baseMoney>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="inline-block mr-20">
  62. <view class="rank-card" :style="[rankCardStyle]">
  63. <view class="fs-28 lh-40rpx fw-600 flex-y-center" :style="[rankItemTitleStyle]">
  64. <text class="iconfont icon-ic_fire fs-32"></text>
  65. <text class="pl-8 font-color">好评榜</text>
  66. </view>
  67. <view class="rd-12rpx bg--w111-fff mt-18 p-14 h-400" v-if="star.length">
  68. <view class="rank-pro-item flex-y-center" v-for="(item,index) in star" :key="index">
  69. <view class="w-108 h-108 relative">
  70. <easy-loadimage
  71. :image-src="item.image"
  72. width="108rpx"
  73. height="108rpx"
  74. :borderRadius="imgStyle"></easy-loadimage>
  75. <view class="rank_count fs-24 text--w111-fff flex-center" :class="'rank-count' + (index + 1)">{{index + 1}}</view>
  76. </view>
  77. <view class="pl-16">
  78. <view class="w-130 line1 fs-26 lh-36rpx mb-8">{{item.store_name}}</view>
  79. <baseMoney :money="item.price" symbolSize="20" integerSize="28" decimalSize="28" :color="priceColor" weight></baseMoney>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </scroll-view>
  86. <!-- <scroll-view scroll-x="true" class="white-nowrap vertical-middle w-full mt-28"
  87. show-scrollbar="false" v-else>
  88. <view class="inline-block mr-20" v-for="item in 4" :key="item">
  89. <view>
  90. <view class="w-204 h-204 relative">
  91. <image class="w-full h-full rd-16rpx" src="https://test-pro30.crmeb.net/uploads/thumb_water/0998eb5cef0946cc00eb5f0e17ca3e94.png"></image>
  92. <image class="abs-lt w-72 h-72"
  93. :src="`${imgHost}/statics/images/product/rank_icon${item}.png`" v-if="item < 4"></image>
  94. </view>
  95. <view class="w-204 mt-20 mb-10 fs-26 line1">小米新款高配说不定是你的房间看</view>
  96. <baseMoney money="350.00" symbolSize="20" integerSize="28" decimalSize="28" color="#e93323" weight></baseMoney>
  97. </view>
  98. </view>
  99. </scroll-view> -->
  100. <view class="mt-26" v-else>
  101. <scroll-view scroll-x="true" class="white-nowrap vertical-middle w-full mt-20"
  102. show-scrollbar="false" >
  103. <view class="inline-block type-3 rd-16rpx mr-24" :style="[rankCardStyle]" v-if="sales.length">
  104. <view class="fs-26 fw-500" :style="[rankItemTitleStyle]">销量榜</view>
  105. <view class="flex mt-20">
  106. <view class="w-296 h-296 relative mr-12">
  107. <image :src="sales[0].image" class="w-full h-full" :style="{borderRadius:imgStyle}"></image>
  108. <image class="abs-lt w-72 h-72" :src="`${imgHost}/statics/images/product/rank_icon1.png`"></image>
  109. </view>
  110. <view>
  111. <view class="relative">
  112. <easy-loadimage
  113. :image-src="sales[1].image"
  114. width="142rpx"
  115. height="142rpx"
  116. :borderRadius="imgStyle"></easy-loadimage>
  117. <image class="abs-lt w-48 h-48" :src="`${imgHost}/statics/images/product/rank_icon2.png`"></image>
  118. </view>
  119. <view class="w-142 h-142 relative mt-12">
  120. <easy-loadimage
  121. :image-src="sales[2].image"
  122. width="142rpx"
  123. height="142rpx"
  124. :borderRadius="imgStyle"></easy-loadimage>
  125. <image class="abs-lt w-48 h-48" :src="`${imgHost}/statics/images/product/rank_icon3.png`"></image>
  126. </view>
  127. </view>
  128. </view>
  129. <view class="mt-20 fs-26 w-280 line1">{{sales[0].store_name}}</view>
  130. <view class="flex items-baseline mt-10">
  131. <baseMoney :money="sales[0].price" symbolSize="20" integerSize="28" decimalSize="28" :color="priceColor" weight></baseMoney>
  132. <text class="fs-20 text--w111-999 text-line pl-8">¥{{sales[0].ot_price}}</text>
  133. </view>
  134. </view>
  135. <view class="inline-block type-3 rd-16rpx mr-24" :style="[rankCardStyle]" v-if="star.length">
  136. <view class="fs-26 fw-500" :style="[rankItemTitleStyle]">好评榜</view>
  137. <view class="flex mt-20">
  138. <view class="w-296 h-296 relative mr-12">
  139. <image :src="star[0].image" class="w-full h-full" :style="{borderRadius:imgStyle}"></image>
  140. <image class="abs-lt w-72 h-72" :src="`${imgHost}/statics/images/product/rank_icon1.png`"></image>
  141. </view>
  142. <view>
  143. <view class="w-142 h-142 relative">
  144. <easy-loadimage
  145. :image-src="star[1].image"
  146. width="142rpx"
  147. height="142rpx"
  148. :borderRadius="imgStyle"></easy-loadimage>
  149. <image class="abs-lt w-48 h-48" :src="`${imgHost}/statics/images/product/rank_icon2.png`"></image>
  150. </view>
  151. <view class="w-142 h-142 relative mt-12">
  152. <easy-loadimage
  153. :image-src="star[2].image"
  154. width="142rpx"
  155. height="142rpx"
  156. :borderRadius="imgStyle"></easy-loadimage>
  157. <image class="abs-lt w-48 h-48" :src="`${imgHost}/statics/images/product/rank_icon3.png`"></image>
  158. </view>
  159. </view>
  160. </view>
  161. <view class="mt-20 fs-26 w-280 line1">{{star[0].store_name}}</view>
  162. <view class="flex items-baseline mt-10">
  163. <baseMoney :money="star[0].price" symbolSize="20" integerSize="28" decimalSize="28" :color="priceColor" weight></baseMoney>
  164. <text class="fs-20 text--w111-999 text-line pl-8">¥{{star[0].ot_price}}</text>
  165. </view>
  166. </view>
  167. <view class="inline-block type-3 rd-16rpx mr-24" :style="[rankCardStyle]" v-if="collect.length">
  168. <view class="fs-26 fw-500" :style="[rankItemTitleStyle]">收藏榜</view>
  169. <view class="flex mt-20">
  170. <view class="w-296 h-296 relative mr-12">
  171. <image :src="collect[0].image" class="w-full h-full" :style="{borderRadius:imgStyle}"></image>
  172. <image class="abs-lt w-72 h-72" :src="`${imgHost}/statics/images/product/rank_icon1.png`"></image>
  173. </view>
  174. <view>
  175. <view class="w-142 h-142 relative">
  176. <easy-loadimage
  177. :image-src="collect[1].image"
  178. width="142rpx"
  179. height="142rpx"
  180. :borderRadius="imgStyle"></easy-loadimage>
  181. <image class="abs-lt w-48 h-48" :src="`${imgHost}/statics/images/product/rank_icon2.png`"></image>
  182. </view>
  183. <view class="w-142 h-142 relative mt-12">
  184. <easy-loadimage
  185. :image-src="collect[2].image"
  186. width="142rpx"
  187. height="142rpx"
  188. :borderRadius="imgStyle"></easy-loadimage>
  189. <image class="abs-lt w-48 h-48" :src="`${imgHost}/statics/images/product/rank_icon3.png`"></image>
  190. </view>
  191. </view>
  192. </view>
  193. <view class="mt-20 fs-26 w-280 line1">{{collect[0].store_name}}</view>
  194. <view class="flex items-baseline mt-10">
  195. <baseMoney :money="collect[0].price" symbolSize="20" integerSize="28" decimalSize="28" :color="priceColor" weight></baseMoney>
  196. <text class="fs-20 text--w111-999 text-line pl-8">¥{{collect[0].ot_price}}</text>
  197. </view>
  198. </view>
  199. </scroll-view>
  200. </view>
  201. </view>
  202. </view>
  203. </template>
  204. <script>
  205. import { HTTP_REQUEST_URL } from '@/config/app';
  206. import { diyRankApi } from "@/api/activity.js"
  207. export default {
  208. name:'ranking',
  209. props:{
  210. dataConfig: {
  211. type: Object,
  212. default: () => {}
  213. },
  214. },
  215. data(){
  216. return {
  217. imgHost: HTTP_REQUEST_URL,
  218. collect:[],
  219. sales:[],
  220. star:[]
  221. }
  222. },
  223. computed:{
  224. boxStyle(){
  225. return {
  226. padding: `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  227. marginTop: `${this.dataConfig.mbConfig.val * 2}rpx`,
  228. background: this.dataConfig.bottomBgColor.color[0].item,
  229. }
  230. },
  231. boxContentStyle() {
  232. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  233. if (this.dataConfig.fillet.type) {
  234. borderRadius =
  235. `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
  236. }
  237. return {
  238. borderRadius,
  239. background: `linear-gradient(90deg, ${this.dataConfig.moduleColor.color[0].item} 0%, ${this.dataConfig.moduleColor.color[1].item} 100%)`,
  240. };
  241. },
  242. styleConfig(){
  243. return this.dataConfig.styleConfig.tabVal
  244. },
  245. /*标题是文本还是图片*/
  246. titleConfig(){
  247. return this.dataConfig.titleConfig.tabVal
  248. },
  249. /*标题文本*/
  250. titleTxtConfig(){
  251. return this.dataConfig.titleTxtConfig.value
  252. },
  253. /*标题图片*/
  254. titleImg(){
  255. return this.dataConfig.imgConfig.url
  256. },
  257. /*卡片颜色和圆角*/
  258. rankCardStyle(){
  259. let filletBg = this.dataConfig.filletBg.type;
  260. let valListBg = this.dataConfig.filletBg.valList;
  261. let filletValBg = this.dataConfig.filletBg.val;
  262. return {
  263. borderRadius: this.filletBg ? valListBg[0].val+ 'px ' +valListBg[1].val+ 'px ' + valListBg[3].val + 'px ' + valListBg[2].val +'px': filletValBg +'px',
  264. background: `linear-gradient(90deg,${this.dataConfig.listBgColor.color[0].item} 0%,${this.dataConfig.listBgColor.color[1].item} 100%)`
  265. }
  266. },
  267. /*商品图片圆角样式*/
  268. imgStyle(){
  269. let borderRadius = `${this.dataConfig.filletImg.val * 2}rpx`;
  270. if (this.dataConfig.filletImg.type) {
  271. borderRadius =
  272. `${this.dataConfig.filletImg.valList[0].val * 2}rpx ${this.dataConfig.filletImg.valList[1].val * 2}rpx ${this.dataConfig.filletImg.valList[2].val * 2}rpx ${this.dataConfig.filletImg.valList[3].val * 2}rpx`;
  273. }
  274. return borderRadius
  275. },
  276. rankItemTitleStyle(){
  277. return {
  278. color: this.dataConfig.toneConfig.tabVal ? this.dataConfig.classColor.color[0].item : 'var(--view-theme)'
  279. }
  280. },
  281. /* 价格颜色 */
  282. priceColor(){
  283. return this.dataConfig.toneConfig.tabVal ? this.dataConfig.goodsPriceColor.color[0].item : 'var(--view-theme)'
  284. },
  285. /*头部按钮样式*/
  286. headerBntColor(){
  287. return {
  288. color: this.styleConfig ? this.dataConfig.headerBntColor.color[0].item : '#999999',
  289. fontSize: `${this.dataConfig.bntNumber.val * 2}rpx`
  290. }
  291. },
  292. headerBtnText(){
  293. return this.dataConfig.rightBntConfig.value
  294. }
  295. },
  296. mounted() {
  297. this.getList();
  298. },
  299. methods:{
  300. getList(){
  301. diyRankApi().then(res=>{
  302. this.collect = res.data.collect;
  303. this.sales = res.data.sales;
  304. this.star = res.data.star;
  305. })
  306. },
  307. goRank(){
  308. uni.navigateTo({
  309. url:'/pages/columnGoods/rank/index'
  310. })
  311. }
  312. }
  313. }
  314. </script>
  315. <style>
  316. .rank-card {
  317. width: 372rpx;
  318. padding: 22rpx 16rpx 18rpx;
  319. }
  320. .rank_count{
  321. width:30rpx;
  322. height:32rpx;
  323. position: absolute;
  324. top:0;
  325. left:0;
  326. background-size: cover;
  327. }
  328. .rank-count1{
  329. background-image:url('@/static/img/rank1_icon.png');
  330. }
  331. .rank-count2{
  332. background-image:url('@/static/img/rank2_icon.png');
  333. }
  334. .rank-count3{
  335. background-image:url('@/static/img/rank3_icon.png');
  336. }
  337. .type-3{
  338. padding: 20rpx 36rpx 20rpx 18rpx;
  339. }
  340. .rank-pro-item ~ .rank-pro-item{
  341. margin-top: 16rpx;
  342. }
  343. </style>