client.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. title="我的会员"
  5. :placeholder="true"
  6. :autoBack="true"
  7. :safeAreaInsetTop="true"
  8. >
  9. </u-navbar>
  10. <view class="page-wrap">
  11. <view class="client">
  12. <img class="ico" src="../static/img/client-ico.png" alt="">
  13. <view class="left-text">
  14. <view class="title">会员总人数</view>
  15. <view class="con">Total number of members</view>
  16. </view>
  17. <view class="number-wrap">
  18. <text class="number">{{totalCount}}</text> 人
  19. </view>
  20. </view>
  21. <view class="statistics">
  22. <view class="title">会员统计</view>
  23. <view class="charts-box" v-if="totalCount>0">
  24. <qiun-data-charts
  25. type="column"
  26. :opts="opts"
  27. :chartData="chartData"
  28. />
  29. </view>
  30. <view v-else style="text-align: center;margin-top: 20px;">
  31. 暂无会员
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <!-- https://www.ucharts.cn/v2/#/document/index -->
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. totalCount:0,
  43. chartData: {},
  44. opts: {
  45. color: ["#FBBD4E","#FDE37F"],
  46. padding: [15,15,0,5],
  47. enableScroll: false,
  48. legend: {
  49. show:false
  50. },
  51. xAxis: {
  52. disableGrid: true
  53. },
  54. yAxis: {
  55. gridType:'dash',
  56. data: [
  57. {
  58. min: 0
  59. }
  60. ]
  61. },
  62. extra: {
  63. column: {
  64. type: "meter",
  65. width: 30,
  66. activeBgColor: "#000000",
  67. activeBgOpacity: 0.02,
  68. // barBorderCircle: true,
  69. barBorderRadius:[16,16,16,16],
  70. meterFillColor:"#eeeeee",
  71. meterBorder:0,
  72. linearType: "custom"
  73. },
  74. tooltip:{
  75. showBox:true
  76. }
  77. }
  78. }
  79. }
  80. },
  81. onShow() {
  82. this.getMemberSta();
  83. },
  84. onLoad() {
  85. },
  86. methods: {
  87. getMemberSta(){
  88. let chartData = {
  89. categories: [],
  90. series: [
  91. {
  92. name: "目标数量",
  93. data: [],
  94. },
  95. {
  96. name: "会员数量",
  97. data: []
  98. }
  99. ]
  100. };
  101. this.$u.api.memberSta().then(res=>{
  102. console.log('res',res.data);
  103. this.totalCount = res.data.totalCount;
  104. chartData.categories = res.data.levelStaList.map((item)=>{
  105. return item.name
  106. });
  107. // 会员数量
  108. chartData.series[1].data = res.data.levelStaList.map((item)=>{
  109. return item.count
  110. });
  111. // 填充目标值
  112. // const maxNumber = Math.max(...chartData.series[1].data);
  113. // for (let i=0;i<res.data.levelStaList.length;i++) {
  114. // chartData.series[0].data.push(maxNumber+10)
  115. // }
  116. this.chartData = JSON.parse(JSON.stringify(chartData));
  117. }).catch(err=>{
  118. console.log('memberSta',err);
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style>
  125. page{
  126. background-color: #f5f5f5;
  127. }
  128. </style>
  129. <style lang="scss" scoped>
  130. .client{
  131. margin-top: 40rpx;
  132. margin-bottom: 58rpx;
  133. height: 260rpx;
  134. background: url(../static/img/client-bg.png) no-repeat;
  135. background-size: 100%;
  136. position: relative;
  137. .ico{
  138. position: absolute;
  139. width: 93rpx;
  140. height: 93rpx;
  141. left: 30rpx;
  142. top: -40rpx;
  143. }
  144. .left-text{
  145. margin-left: 30rpx;
  146. padding-top: 63rpx;
  147. .title{
  148. font-size: 26rpx;
  149. font-weight: 600;
  150. color: rgba(255,255,255,0.99);
  151. line-height: 37rpx;
  152. margin-bottom: 10rpx;
  153. }
  154. .con{
  155. font-size: 20rpx;
  156. font-weight: 400;
  157. color: rgba(255,255,255,0.99);
  158. line-height: 28rpx;
  159. text-transform: uppercase;
  160. width: 185rpx;
  161. opacity: 30%;
  162. }
  163. }
  164. .number-wrap{
  165. position:absolute;
  166. right: 30rpx;
  167. bottom: 42rpx;
  168. color: #fff;
  169. font-size: 20rpx;
  170. .number{
  171. font-size: 70rpx;
  172. font-family: AlibabaPuHuiTi_2_115_Black;
  173. color: rgba(255,255,255,0.99);
  174. margin-right: 10rpx;
  175. }
  176. }
  177. }
  178. .statistics{
  179. .title{
  180. font-size: 32rpx;
  181. font-weight: 400;
  182. color: rgba(51,51,51,0.99);
  183. line-height: 45rpx;
  184. margin-bottom: 20rpx;
  185. }
  186. .charts-box {
  187. width: 100%;
  188. height: 300px;
  189. background-color: #fff;
  190. border-radius: 8rpx;
  191. padding: 50rpx 0;
  192. }
  193. }
  194. </style>