店播抖音版小程序

index.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <template>
  2. <view>
  3. <page-head title="home"></page-head>
  4. <view class="tabbar-container" :style="'padding-top:'+ safeAreaTop+'px'">
  5. <view class="searchView">
  6. <i class="iconfont icon-search_icon"></i>
  7. <input type="text" value="" placeholder="搜直播、品牌、商品、小店、达人" />
  8. <button>搜索</button>
  9. </view>
  10. <!-- 昨日数据 -->
  11. <view class="yesterdayData">
  12. <image src="../../static/img/pingtai_icon@2x.png" class="bg_img" mode="widthFix"></image>
  13. <view class="yesterday_title">
  14. <text class="text">昨日平台数据</text>
  15. <image class="image" src="../../static/img/zuori_icon@2x.png" mode="widthFix"></image>
  16. </view>
  17. <view class="yesterdayInfo">
  18. <view class="info">
  19. <text class="text">123.4w</text>
  20. <view class="view">平台销售额</view>
  21. </view>
  22. <view class="info">
  23. <text class="text">123.4w</text>
  24. <view class="view">平台销量</view>
  25. </view>
  26. <view class="info">
  27. <text class="text">123.4w</text>
  28. <view class="view">UV价值</view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 入口板块 -->
  33. <view class="entrance">
  34. <view class="entranceInfo" v-for="(item,index) in entranceList" :key="index">
  35. <image :src="item.img" mode="widthFix" class="image"></image>
  36. <text class="text">{{item.name}}</text>
  37. </view>
  38. </view>
  39. <!-- 正在直播 -->
  40. <view class="plate">
  41. <view class="titleView">
  42. <view class="title">
  43. <text class="text">正在直播</text>
  44. <image src="https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/live.gif" mode="widthFix" class="image"></image>
  45. </view>
  46. <view class="more">更多</view>
  47. </view>
  48. <scroll-view class="liveView" scroll-x="true">
  49. <view class="liveInfo" v-for="(item,index) in liveUserList" :key="item.live_id">
  50. <view class="info">
  51. <image :src="item.live_cover_url" class="cover" mode="aspectFill"></image>
  52. <view class="infoMask">
  53. <view class="liveing">直<br/>播<br/>中</view>
  54. <view class="shopView" v-if="item.user_info">
  55. <image :src="item.user_info.headurl" mode="widthFix" class="shopImage"></image>
  56. <view class="shopName">{{item.user_info.user_name}}</view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="liveData">
  61. <text class="text1">销售额</text>
  62. <text class="text2">{{item.sell_money_sum?$NumberHandle(item.sell_money_sum):'-'}}</text>
  63. </view>
  64. </view>
  65. </scroll-view>
  66. </view>
  67. <!-- 账号销售榜 -->
  68. <view class="plate plateRank">
  69. <view class="titleView">
  70. <view class="title title2">
  71. <image src="https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/icon1.png?v=1" mode="widthFix" class="title_bg"></image>
  72. <text class="text">账号销售榜</text>
  73. <text class="time">{{rankTime}}</text>
  74. </view>
  75. <view class="more">更多</view>
  76. </view>
  77. <view class="rankBox">
  78. <view class="rankItem" v-for="(item,index) in sellTopUserList" :key="index">
  79. <view class="rankInfo">
  80. <view class="imageBox">
  81. <image :src="item.headurl" mode="widthFix" class="userImg"></image>
  82. <image v-if="index<3" :src="'https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/top'+ (index+1) + '.png'" mode="widthFix" class="topImg"></image>
  83. </view>
  84. <view class="info">
  85. <view class="name">{{item.user_name?item.user_name:'-'}}</view>
  86. <view class="price">
  87. 粉丝数 <text>{{item.follower_count?$NumberHandle(item.follower_count):'-'}}</text>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="rankData">
  92. <text>{{item.sales_money?$NumberHandle(item.sales_money):'-'}}</text>
  93. <view>销售额</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 品牌销售榜 -->
  99. <view class="plate plateRank">
  100. <view class="titleView">
  101. <view class="title title2">
  102. <image src="https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/icon1.png?v=1" mode="widthFix" class="title_bg"></image>
  103. <text class="text">品牌销售榜</text>
  104. <text class="time">{{rankTime}}</text>
  105. </view>
  106. <view class="more">更多</view>
  107. </view>
  108. <view class="rankBox">
  109. <view class="rankItem" v-for="(item,index) in sellTopBrandList" :key="index">
  110. <view class="rankInfo">
  111. <view class="imageBox">
  112. <image :src="item.icon" mode="widthFix" class="userImg"></image>
  113. <image v-if="index<3" :src="'https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/top'+ (index+1) + '.png'" mode="widthFix" class="topImg"></image>
  114. </view>
  115. <view class="info">
  116. <view class="name">{{item.brand_name?item.brand_name:'-'}}</view>
  117. <view class="price">
  118. 销量 <text>{{item.sales_number?$NumberHandle(item.sales_number):'-'}}</text>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="rankData">
  123. <text>{{item.sales_money?$NumberHandle(item.sales_money):'-'}}</text>
  124. <view>销售额</view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. <!-- 商品销售榜 -->
  130. <view class="plate plateRank">
  131. <view class="titleView">
  132. <view class="title title2">
  133. <image src="https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/icon1.png?v=1" mode="widthFix" class="title_bg"></image>
  134. <text class="text">商品销售榜</text>
  135. <text class="time">{{rankTime}}</text>
  136. </view>
  137. <view class="more">更多</view>
  138. </view>
  139. <view class="rankBox">
  140. <view class="rankItem" v-for="(item,index) in goodsSalesList" :key="index">
  141. <view class="rankInfo">
  142. <view class="imageBox" style="border-radius: 4rpx;">
  143. <image :src="item.cover" mode="widthFix" class="userImg" style="border-radius: 4rpx;"></image>
  144. <image v-if="index<3" :src="'https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/top'+ (index+1) + '.png'" mode="widthFix" class="topImg"></image>
  145. </view>
  146. <view class="info">
  147. <view class="name">{{item.title?item.title:'-'}}</view>
  148. <view class="price">
  149. 价格 <text>{{(item.price_min||item.price_max) ? (item.price_max==item.price_max?'¥'+item.price_max:('¥'+item.price_min + '-' + '¥'+item.price_max)):'-'}}</text>
  150. </view>
  151. </view>
  152. </view>
  153. <view class="rankData">
  154. <text>{{item.sell_money?$NumberHandle(item.sell_money):'-'}}</text>
  155. <view>销售额</view>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. <!-- 商品热推榜 -->
  161. <view class="plate plateRank">
  162. <view class="titleView">
  163. <view class="title title2">
  164. <image src="https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/icon1.png?v=1" mode="widthFix" class="title_bg"></image>
  165. <text class="text">商品热推榜</text>
  166. <text class="time">{{rankTime}}</text>
  167. </view>
  168. <view class="more">更多</view>
  169. </view>
  170. <view class="rankBox">
  171. <view class="rankItem" v-for="(item,index) in goodsHotList" :key="index">
  172. <view class="rankInfo">
  173. <view class="imageBox" style="border-radius: 4rpx;">
  174. <image :src="item.cover" mode="widthFix" class="userImg" style="border-radius: 4rpx;"></image>
  175. <image v-if="index<3" :src="'https://kx-bigdata.oss-cn-beijing.aliyuncs.com/shop_live/top'+ (index+1) + '.png'" mode="widthFix" class="topImg"></image>
  176. </view>
  177. <view class="info">
  178. <view class="name">{{item.title?item.title:'-'}}</view>
  179. <view class="price">
  180. 价格 <text>{{(item.price_min||item.price_max) ? (item.price_max==item.price_max?'¥'+item.price_max:('¥'+item.price_min + '-' + '¥'+item.price_max)):'-'}}</text>
  181. </view>
  182. </view>
  183. </view>
  184. <view class="rankData">
  185. <text>{{item.sell_money?$NumberHandle(item.sell_money):'-'}}</text>
  186. <view>销售额</view>
  187. </view>
  188. </view>
  189. </view>
  190. </view>
  191. </view>
  192. <tabbar selected='homePage'></tabbar>
  193. </view>
  194. </template>
  195. <script>
  196. import tabbar from '@/components/tabbar.vue'
  197. export default {
  198. components:{
  199. tabbar,
  200. },
  201. data() {
  202. return {
  203. safeAreaTop:this.$store.state.systemInfo.safeAreaTop,
  204. entranceList:[
  205. {img:'../../static/img/daihuo_icon@2x.png',name:'直播带货榜'},
  206. {img:'../../static/img/zhangfen_icon@2x.png',name:'直播涨粉榜'},
  207. {img:'../../static/img/zhagnhaoxiaoshou_icon@2x.png',name:'账号销售榜'},
  208. {img:'../../static/img/zhanghaozhangfen_icon@2x.png',name:'账号涨粉榜'},
  209. {img:'../../static/img/pinpai_icon@2x.png',name:'品牌销售榜'},
  210. {img:'../../static/img/douyinxiaoliang_icon@2x.png',name:'商品销售榜'},
  211. {img:'../../static/img/retui_icon@2x.png',name:'商品热推榜'},
  212. {img:'../../static/img/shishi_icon@2x.png',name:'实时销量榜'},
  213. ],
  214. liveUserList:[],
  215. sellTopUserList:[],
  216. rankTime:'',
  217. sellTopBrandList:[],
  218. goodsSalesList:[],
  219. goodsHotList:[]
  220. }
  221. },
  222. async onLoad() {
  223. await this.$onLaunched;
  224. if(new Date().getHours()<6){//6点以前是前天,6点以后是昨天
  225. this.rankTime = this.$getDay(-2, false)
  226. }else{
  227. this.rankTime = this.$getDay(-1, false)
  228. }
  229. var time_arr = this.rankTime.split('-')
  230. this.rankTime = time_arr[1]+'/'+time_arr[2]
  231. this.getLiveList()
  232. this.getSellTopUserList()
  233. this.getSellTopBrandList()
  234. this.getGoodsSalesList()
  235. this.getGoodsHotList()
  236. },
  237. methods:{
  238. getLiveList(){//正在直播
  239. this.$req(this.$api.home_onLiveUserList,'get',{page_size:5},(res)=>{
  240. if(res && res.errno == 0){
  241. this.liveUserList = res.rst;
  242. }else{
  243. }
  244. })
  245. },
  246. getSellTopUserList(){//账号销售榜
  247. this.$req(this.$api.home_sellTopUserList,'get',{page_size:3},(res)=>{
  248. if(res && res.errno == 0){
  249. this.sellTopUserList = res.rst;
  250. }else{
  251. }
  252. })
  253. },
  254. getSellTopBrandList(){//品牌销售榜
  255. this.$req(this.$api.home_sellTopBrandList,'get',{page_size:3},(res)=>{
  256. if(res && res.errno == 0){
  257. this.sellTopBrandList = res.rst;
  258. }else{
  259. }
  260. })
  261. },
  262. getGoodsSalesList(){//商品销售榜
  263. this.$req(this.$api.home_goodsSalesList,'get',{page_size:3},(res)=>{
  264. if(res && res.errno == 0){
  265. this.goodsSalesList = res.rst;
  266. }else{
  267. }
  268. })
  269. },
  270. getGoodsHotList(){//商品热推榜
  271. this.$req(this.$api.home_goodsHotList,'get',{page_size:3},(res)=>{
  272. if(res && res.errno == 0){
  273. this.goodsHotList = res.rst;
  274. }else{
  275. }
  276. })
  277. }
  278. }
  279. }
  280. </script>
  281. <style lang="scss" scoped>
  282. .searchView,.yesterdayData,.plate{
  283. width: 710rpx;
  284. margin: auto;
  285. }
  286. .searchView{
  287. margin: 20rpx auto;
  288. height: 70rpx;
  289. background: #FFFFFF;
  290. display: flex;
  291. align-items: center;
  292. padding: 12rpx;
  293. border-radius: 70rpx;
  294. .iconfont{
  295. color: #444444;
  296. font-size: 30rpx;
  297. margin: 0 14rpx;
  298. }
  299. input{
  300. font-size: 26rpx;
  301. flex: 1;
  302. }
  303. button{
  304. width: 104rpx;
  305. height: 52rpx;
  306. line-height: 52rpx;
  307. background: #FE9400;
  308. border-radius: 35rpx;
  309. color: #FFFFFF;
  310. padding: 0;
  311. font-size: 26rpx;
  312. }
  313. }
  314. .yesterdayData{
  315. height: 214rpx;
  316. background: linear-gradient(160deg, rgba(46, 44, 43, 0.92) 0%, #000000 100%);
  317. border-radius: 16rpx;
  318. position: relative;
  319. overflow: hidden;
  320. padding: 22rpx 24rpx;
  321. .bg_img{
  322. width: 110rpx;
  323. height: 108rpx;
  324. position: absolute;
  325. top: -1px;
  326. right: 0;
  327. }
  328. .yesterday_title{
  329. display: flex;
  330. align-items: center;
  331. .text{
  332. color: #FFFFFF;
  333. font-size: 30rpx;
  334. line-height: 42rpx;
  335. }
  336. .image{
  337. width: 30rpx;
  338. height: 30rpx;
  339. margin-left: 20rpx;
  340. }
  341. }
  342. .yesterdayInfo{
  343. display: flex;
  344. align-items: center;
  345. justify-content: space-between;
  346. margin-top: 20rpx;
  347. padding: 0 20rpx;
  348. .info{
  349. text-align: center;
  350. .text{
  351. color: #FFFFFF;
  352. font-size: 40rpx;
  353. line-height: 56rpx;
  354. font-weight: bold;
  355. }
  356. .view{
  357. color: #F1CBB4;
  358. font-size: 26rpx;
  359. line-height: 36rpx;
  360. margin-top: 8rpx;
  361. }
  362. }
  363. }
  364. }
  365. .entrance{
  366. display: flex;
  367. flex-wrap: wrap;
  368. margin-bottom: 36rpx;
  369. .entranceInfo{
  370. width: 25%;
  371. text-align: center;
  372. margin-top: 36rpx;
  373. .image{
  374. width: 72rpx;
  375. height: 72rpx;
  376. display: block;
  377. margin: auto;
  378. }
  379. .text{
  380. color: #000000;
  381. font-size: 24rpx;
  382. line-height: 34rpx;
  383. }
  384. }
  385. }
  386. .plate{
  387. background: #FFFFFF;
  388. border-radius: 16rpx;
  389. height: 492rpx;
  390. margin-bottom: 22rpx;
  391. .titleView{
  392. padding: 30rpx 26rpx;
  393. display: flex;
  394. align-items: center;
  395. justify-content: space-between;
  396. .title{
  397. display: flex;
  398. align-items: center;
  399. .text{
  400. color: #353C46;
  401. font-size: 38rpx;
  402. line-height: 52rpx;
  403. font-weight: bold;
  404. position: relative;
  405. }
  406. .image{
  407. width: 50rpx;
  408. height: 50rpx;
  409. margin-left: 10rpx;
  410. }
  411. .time{
  412. color: #A3A3A3;
  413. font-size: 26rpx;
  414. line-height: 36rpx;
  415. margin-left: 16rpx;
  416. }
  417. }
  418. .title2{
  419. position: relative;
  420. .title_bg{
  421. width: 70rpx;
  422. position: absolute;
  423. left: -10rpx;
  424. top: -20rpx;
  425. }
  426. }
  427. .more{
  428. width: 119rpx;
  429. height: 50rpx;
  430. line-height: 50rpx;
  431. text-align: center;
  432. background: #F6F6F6;
  433. border-radius: 30rpx;
  434. color: #FF6D28;
  435. font-size: 26rpx;
  436. }
  437. }
  438. }
  439. .liveView{
  440. width: calc(100% - 28rpx);
  441. white-space: nowrap;
  442. margin-left: 28rpx;
  443. .liveInfo{
  444. width: 236rpx;
  445. height: 344rpx;
  446. background: #F1F1F1;
  447. border-radius: 16rpx;
  448. overflow: hidden;
  449. display: inline-block;
  450. margin-right: 20rpx;
  451. .info{
  452. width: 100%;
  453. height: 298rpx;
  454. background: url(https://kx-bigdata.oss-cn-beijing.aliyuncs.com/blur_bg.png) no-repeat;
  455. background-size: 100% 100%;
  456. position: relative;
  457. .cover{
  458. width: 100%;
  459. height: 100%;
  460. }
  461. .infoMask{
  462. position: absolute;
  463. top: 0;
  464. left: 0;
  465. background: rgba(0,0,0,0.2);
  466. width: 100%;
  467. height: 100%;
  468. .liveing{
  469. width: 56rpx;
  470. height: 97rpx;
  471. background: #FF7217;
  472. border-radius: 0px 0px 200rpx 200rpx;
  473. color: #FFFFFF;
  474. font-size: 24rpx;
  475. font-weight: bold;
  476. text-align: center;
  477. line-height: 30rpx;
  478. position: absolute;
  479. top: 0;
  480. right: 20rpx;
  481. text-align: center;
  482. }
  483. .shopView{
  484. width: 100%;
  485. display: flex;
  486. align-items: center;
  487. position: absolute;
  488. bottom: 12rpx;
  489. left: 8rpx;
  490. .shopImage{
  491. width: 48rpx;
  492. height: 48rpx;
  493. border-radius: 50%;
  494. border: 2rpx solid #FFFFFF;
  495. margin-right: 16rpx;
  496. }
  497. .shopName{
  498. width: 144rpx;
  499. height: 34rpx;
  500. font-size: 24rpx;
  501. color: #FFFFFF;
  502. white-space: nowrap;
  503. text-overflow: ellipsis;
  504. overflow: hidden;
  505. word-break: break-all;
  506. }
  507. }
  508. }
  509. }
  510. .liveData{
  511. display: flex;
  512. line-height: 46rpx;
  513. justify-content: space-between;
  514. padding: 0 12rpx;
  515. .text1{
  516. color: #989898;
  517. font-size: 18rpx;
  518. }
  519. .text2{
  520. color: #000000;
  521. font-size: 24rpx;
  522. font-weight: blue($color: #000000);
  523. }
  524. }
  525. }
  526. }
  527. .rankBox{
  528. .rankItem{
  529. display: flex;
  530. align-items: center;
  531. padding: 30rpx 0;
  532. border-bottom: 1rpx solid #ECECEC;
  533. &:last-of-type{
  534. border-bottom: none;
  535. }
  536. .rankInfo{
  537. flex: 1;
  538. display: flex;
  539. align-items: center;
  540. margin-left: 30rpx;
  541. .imageBox{
  542. width: 100rpx;
  543. height: 100rpx;
  544. border-radius: 50%;
  545. position: relative;
  546. background: #f2f2f2;
  547. .userImg{
  548. width: 100%;
  549. height: 100%;
  550. border-radius: 50%;
  551. position: absolute;
  552. top: 0;
  553. bottom: 0;
  554. left: 0;
  555. margin: auto;
  556. }
  557. .topImg{
  558. width: 36rpx;
  559. height: 30rpx;
  560. position: absolute;
  561. top: -16rpx;
  562. right: 2rpx;
  563. }
  564. }
  565. .info{
  566. flex: 1;
  567. margin-left: 16rpx;
  568. .name{
  569. color: #353C46;
  570. font-size: 28rpx;
  571. line-height: 40rpx;
  572. width: 338rpx;
  573. white-space: nowrap;
  574. text-overflow: ellipsis;
  575. overflow: hidden;
  576. word-break: break-all;
  577. }
  578. .price{
  579. color: #A3A3A3;
  580. font-size: 24rpx;
  581. line-height: 34rpx;
  582. margin-top: 6rpx;
  583. text{
  584. color: #000000;
  585. margin-left: 10rpx;
  586. }
  587. }
  588. }
  589. }
  590. .rankData{
  591. margin-right: 30rpx;
  592. text-align: right;
  593. text{
  594. color: #353C46;
  595. font-size: 38rpx;
  596. line-height: 52rpx;
  597. font-weight: bold;
  598. }
  599. view{
  600. color: #A3A3A3;
  601. font-size: 24rpx;
  602. line-height: 34rpx;
  603. }
  604. }
  605. }
  606. }
  607. .plateRank{
  608. height: 602rpx;
  609. }
  610. </style>