酷炫直播运营系统小程序版本

liveSituation.vue 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="con">
  3. <view class="time_con">
  4. <timeFiltrate @getchildTime="getchildTime"></timeFiltrate>
  5. </view>
  6. <view class="ec-table">
  7. <view class="flex ex-thead">
  8. <view class="cellItem">日期</view>
  9. <view class="cellItem" style="width: 300rpx;">账号</view>
  10. <view class="cellItem" v-for="(i,idx) in infoList_title" :key="idx" :id="'demo1'+idx" :class="i.key == sort_type ? 'xiangxia_active' : ''" @click="init_title(i.key)">
  11. <text>{{i.name}}</text>
  12. <text v-if="i.support_sort == 1" class="iconfont icon-xiangxia_icon f18 lMar8"></text>
  13. </view>
  14. <view class="iconfont icon-bianji_icon" @click="showDrawer"></view>
  15. </view>
  16. <view class="ex-tbody">
  17. <view v-if="infoList&&infoList.length>0">
  18. <view v-for="item in infoList" :key="item.id" class="flex ex-tbody_item">
  19. <view class="cellItem">{{item.date}}</view>
  20. <view class="cellItem" style="width: 300rpx;display: inline-block;">
  21. <view class="flex" style="justify-content: center" v-for="ise in item.seller_info_list" :key="ise.sellerId">
  22. <img :src="ise.head" alt="" class="useImg">
  23. <text>{{ise.name}}</text>
  24. </view>
  25. </view>
  26. <view class="cellItem" v-for="(i,idx) in infoList_title" :key="idx" :id="'demo2'+idx" :class="i.key == sort_type ? 'xiangxia_active' : ''">
  27. <text v-if="i.key.substring(i.key.length - 4) == 'rate'">
  28. {{$formatNum(item[i.key] * 100)}}%
  29. </text>
  30. <text v-else-if="i.key == 'work_duration' || i.key == 'live_duration'">
  31. {{$formateHours(item[i.key])}}
  32. </text>
  33. <text v-else> {{item[i.key] || item[i.key] == 0 ? $formatNum(item[i.key]) : '-' }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- <noData v-else></noData>-->
  38. </view>
  39. </view>
  40. <view class="text-center f26 loadinfo" v-if="noMoreShow">没有更多了...</view>
  41. <view class="text-center f26 loadinfo" v-if="loadingShow">加载中...</view>
  42. <uni-drawer ref="showselfMask" mode="left">
  43. <selfIndicators ref="indicatorsRef" v-on:closeindicatorDrawer="closeindicatorDrawer"></selfIndicators>
  44. </uni-drawer>
  45. <wm-watermark :text="real_name"></wm-watermark>
  46. </view>
  47. </template>
  48. <script>
  49. import noData from "../../components/noData";
  50. import timeFiltrate from '@/components/timeFiltrate.vue'
  51. import selfIndicators from "../../components/selfIndicators";
  52. export default {
  53. components:{
  54. noData,
  55. timeFiltrate,
  56. selfIndicators
  57. },
  58. data() {
  59. return{
  60. real_name:'',
  61. infoList_title:[],
  62. sort_type: 'sell_money',
  63. infoList: [],
  64. start_time: this.$getDay(-30, false),
  65. end_time: this.$getDay(0, false),
  66. total: 0,
  67. page: 1,
  68. page_size: 20,
  69. noMoreShow:false,
  70. loadingShow:false
  71. }
  72. } ,
  73. computed:{
  74. timeChange(){
  75. const { start_time,end_time } = this
  76. return {
  77. start_time,
  78. end_time
  79. }
  80. }
  81. },
  82. watch:{
  83. timeChange(){//同时监听两个数据变化
  84. this.$show_init_loading()
  85. this.init_title()
  86. }
  87. },
  88. async onLoad(){
  89. await this.$onLaunched;
  90. this.$show_init_loading()
  91. this.real_name = uni.getStorageSync('userInfo').info.real_name;
  92. this.init_title()
  93. },
  94. onPullDownRefresh(){
  95. this.init_title()
  96. },
  97. onReachBottom(){
  98. if(this.noMoreShow){
  99. return false
  100. }
  101. this.loadingShow = true
  102. setTimeout(()=>{
  103. this.page = Number(this.page)+1
  104. this.init()
  105. },1000)
  106. },
  107. methods:{
  108. showDrawer(){
  109. this.$refs.showselfMask.open();
  110. this.$refs.indicatorsRef.get_all_dot()
  111. },
  112. closeindicatorDrawer(num){
  113. this.$refs.showselfMask.close();
  114. if(num == 1){
  115. this.init_title()
  116. }
  117. },
  118. getchildTime(st, et){
  119. this.start_time = st
  120. this.end_time = et
  121. },
  122. init_title (sort) {
  123. this.infoList = []
  124. this.page = 1
  125. sort ? this.sort_type = sort : ''
  126. this.$req(this.$api.search_config_checked,'get',{
  127. type: "SMALLAPP_LIVE_EFFECT_LIST"
  128. },(res)=>{
  129. if(res && res.errno == 0){
  130. this.infoList_title = res.rst
  131. // if (sort) { // 自定义指标确认后,判断有没有销售额,只在初始化和确认修改时用
  132. // // 判断销售额是否存在,否的话传列表第一个
  133. // let sellFlag = false
  134. // this.infoList_title.forEach((i_key) => {
  135. // if (i_key.key == 'sell_money') {
  136. // sellFlag = true
  137. // }
  138. // })
  139. // this.sort_type = sellFlag ? 'sell_money' : this.infoList_title[0].key
  140. // }
  141. this.init()
  142. }else{
  143. }
  144. })
  145. },
  146. init () {
  147. this.$req(this.$api.live_situation,'get',{
  148. st_date: this.start_time,
  149. en_date: this.end_time,
  150. sort_column: this.sort_type,
  151. page: this.page,
  152. page_size: this.page_size,
  153. from_type:2
  154. },(res)=>{
  155. if(res && res.errno == 0){
  156. this.$hide_init_loading()
  157. uni.stopPullDownRefresh()
  158. this.loadingShow = false
  159. this.noMoreShow = false
  160. this.infoList = [...this.infoList,...res.rst.data]
  161. this.page = res.rst.pageInfo.page;
  162. if(res.rst.data.length < this.page_size){
  163. this.noMoreShow = true
  164. }
  165. }
  166. })
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. .con{
  173. .time_con{
  174. padding: 0 20rpx;background: #333947;
  175. position: sticky;
  176. top: 0;
  177. z-index: 1;
  178. }
  179. .icon-bianji_icon{
  180. position: fixed;
  181. right: 0;
  182. background: #1C222E;
  183. line-height: 78rpx;
  184. padding: 0 10rpx;
  185. top: 92rpx;
  186. }
  187. .ec-table{
  188. overflow: auto;
  189. position: relative;
  190. .cellItem{
  191. width: 200rpx;
  192. line-height: 80rpx;
  193. display: flex;
  194. align-items: center;
  195. justify-content: center;
  196. flex-shrink: 0;
  197. }
  198. .ex-thead{
  199. font-size: 28rpx;
  200. color: #B8B8B8;
  201. //position: sticky;
  202. //top: 0;
  203. view{
  204. text-align: center;
  205. }
  206. .cellItem{
  207. background: #1C222E;
  208. }
  209. }
  210. .ex-tbody{
  211. //background-color: #373E4E;
  212. //overflow: auto;
  213. view{
  214. text-align: center;
  215. }
  216. .ex-tbody_item{
  217. font-size: 26rpx;
  218. padding: 10rpx 0;
  219. border-bottom: 1px solid #3D4453;
  220. width: fit-content;
  221. .useImg{
  222. width: 50rpx;
  223. height: 50rpx;
  224. border-radius: 50%;
  225. margin-right: 8rpx;
  226. flex-shrink: 0;
  227. }
  228. }
  229. }
  230. .xiangxia_active{
  231. color: #2E67FF;
  232. }
  233. }
  234. }
  235. </style>