echart-demand.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="echart-content">
  3. <view class="echart-title">
  4. <view class="e-icon e4"><text class="iconfont icon-zixunjilu"></text></view>
  5. <view class="e-name">用户需求</view>
  6. </view>
  7. <view class="echart-search">
  8. <view class="echart-search-date">
  9. <view class="echart-search-date-input">
  10. <picker
  11. mode="date"
  12. :value="date"
  13. :start="startDate"
  14. :end="endDate"
  15. @change="bindStartDateChange($event, 2)"
  16. >
  17. <text class="input-text">{{ contactData.startTime }}</text>
  18. </picker>
  19. <text class="iconfont icon-riqi"></text>
  20. </view>
  21. <view class="line">-</view>
  22. <view class="echart-search-date-input">
  23. <picker
  24. mode="date"
  25. :value="date"
  26. :start="startDate"
  27. :end="endDate"
  28. @change="bindEndDateChange($event, 2)"
  29. >
  30. <text class="input-text">{{ contactData.endTime }}</text>
  31. </picker>
  32. <text class="iconfont icon-riqi"></text>
  33. </view>
  34. </view>
  35. <view class="echart-search-time">
  36. <view
  37. class="time-tab"
  38. v-for="(time, index) in timeList"
  39. :class="{ current: current === index }"
  40. :key="index"
  41. @click="handleTimeClick(time.current, index, 2)"
  42. >{{ time.label }}</view
  43. >
  44. </view>
  45. </view>
  46. <view class="echart-mains demand">
  47. <view class="echart-mains-data" v-if="labelsList.length > 0">
  48. <view class="list-label-list">
  49. <text class="list-label"
  50. :class="item.isChecked ? 'active' : ''"
  51. v-for="(item, index) in labelsList"
  52. :key="index"
  53. >
  54. {{ item }}
  55. </text>
  56. </view>
  57. </view>
  58. <view class="echart-mains-none" v-else>
  59. <image
  60. class="none-image"
  61. src="https://static.caimei365.com/app/img/bg/icon_echart_none@2x.png"
  62. mode=""
  63. ></image>
  64. <view class="none-text">暂无数据</view>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import { mapState, mapMutations } from 'vuex'
  71. import chartMixin from './mixins/chart.mixin.js'
  72. export default {
  73. mixins: [chartMixin],
  74. props:{
  75. clubId:{
  76. type:Number,
  77. default:0
  78. },
  79. totalNum:{
  80. type:Number,
  81. default:0
  82. }
  83. },
  84. data() {
  85. return {
  86. current: 0,
  87. remarksTotal:0,
  88. contactChartData:null,
  89. contactData:{
  90. startTime: '',
  91. endTime: '',
  92. remarksScopeNum:0
  93. },
  94. params:{
  95. clubId:0,// 机构id
  96. dateType:3,// 日期类别 0日 1月 2半年 3全年
  97. startTime:'',// 开始时间
  98. endTime:'',// 结束时间
  99. },
  100. labelsList:[]
  101. }
  102. },
  103. created() {
  104. this.params.clubId = this.clubId
  105. this.remarksTotal = this.totalNum
  106. this.getCustomDemand()
  107. },
  108. methods: {
  109. handleTimeClick(dateType,index,type) {
  110. //年月日点击
  111. console.log('dateType', dateType)
  112. this.current = index
  113. this.params.dateType = dateType
  114. this.params.startTime = ''
  115. this.params.endTime = ''
  116. this.getCustomDemand()
  117. },
  118. async getCustomDemand(){
  119. this.contactData.startTime = this.params.startTime
  120. this.contactData.endTime = this.params.endTime
  121. try {
  122. const res = await this.UserService.getCustomDemand(this.params)
  123. const data = res.data
  124. this.labelsList = data.list
  125. this.contactData.startTime = this.params.startTime = data.startTime
  126. this.contactData.endTime = this.params.endTime = data.endTime
  127. } catch (error) {
  128. this.$util.msg(error.msg, 2000)
  129. }
  130. }
  131. },
  132. onShow() {}
  133. }
  134. </script>
  135. <style lang="scss">
  136. .list-label-list{
  137. width: 100%;
  138. height: auto;
  139. box-sizing: border-box;
  140. .list-label{
  141. display: inline-block;
  142. padding: 0 20rpx;
  143. height: 48rpx;
  144. line-height: 48rpx;
  145. background: #F7F7F7;
  146. text-align: center;
  147. margin-right: 30rpx;
  148. margin-bottom: 30rpx;
  149. font-size: 26rpx;
  150. color: #666666;
  151. &.active{
  152. background: #FEF6F3;
  153. color: #FF5B00;
  154. }
  155. }
  156. }
  157. </style>