index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view class="inspage-content" :style="{'--status-bar-': statusBarHeight}">
  3. <view class="inspage-content-info">
  4. <!-- 头部主要内容 开始 -->
  5. <view class="inspage-content-header">
  6. <customNavbar
  7. title="统计分销"
  8. bgColor="#fff"
  9. :contentStyle="{color: '#000'}"
  10. ></customNavbar>
  11. </view>
  12. <!-- 头部主要内容 结束 -->
  13. <!-- userInfo内容 开始 -->
  14. <view class="inspage-content-userinfo">
  15. <view class="inspage-userinfo-info">
  16. <view class="inspage-userinfo-title"><text>我邀请的(人数)</text></view>
  17. <view class="inspage-userinfo-count">
  18. <view
  19. class="inspage-userinfo-item"
  20. v-for="(item,index) in tool"
  21. :key="index"
  22. >
  23. <text>
  24. <u-count-to :decimals="item.num<100000?item.decimals:2" :startVal="0" :endVal="numFormat(item.num)" color="#fff" />
  25. <text v-if="item.num>=100000" class="inspage-userinfo-util">万</text>
  26. </text>
  27. <text>{{ item.title }}</text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- userInfo内容 结束 -->
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { navigateTo } from "@/utils/util.js"
  38. export default {
  39. data() {
  40. return {
  41. title: '统计分销',
  42. statusBarHeight: 0, // 状态栏安全距离
  43. tool: [ // 我的工具
  44. { title: "邀请总人数",num: 0,decimals:0 },
  45. { title: "待核销票数",num: 0,decimals:0 },
  46. { title: "已核销票数",num: 0,decimals:0 },
  47. ],
  48. retailStatistics: {}, // 统计信息
  49. }
  50. },
  51. onLoad() {
  52. },
  53. onShow() {
  54. this.statusBarHeight = getApp().globalData.statusBarHeight
  55. this.getRetailStatistics()
  56. },
  57. methods: {
  58. /**
  59. * @author ygh
  60. * @data 2023-12-20
  61. */
  62. navigateToFun(item){
  63. navigateTo(item.url)
  64. },
  65. /**
  66. * 数字显示格式化
  67. *
  68. */
  69. numFormat(num=0) {
  70. if(num<100000) {
  71. return num
  72. }else if(num>100000){
  73. return (num/10000).toFixed(2)
  74. }
  75. },
  76. /** 获取数据 */
  77. async getRetailStatistics(){
  78. try{
  79. let res = await this.$u.api.getRetailStatistics({
  80. noSign: 1,
  81. userid: this.distribution_user_info.userId
  82. })
  83. if(res && res.code ===200) {
  84. this.retailStatistics = res.data
  85. let list = [].concat(this.tool)
  86. list[0].num = this.retailStatistics.retailMemberNum
  87. list[1].num = this.retailStatistics.retailNouseNum
  88. list[2].num = this.retailStatistics.retailUseNum
  89. this.tool = [].concat(list)
  90. }
  91. }catch(e){
  92. //TODO handle the exception
  93. console.error("e===",e)
  94. }
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .inspage-content {
  101. display: flex;
  102. flex-direction: column;
  103. align-items: center;
  104. justify-content: center;
  105. --header-h: 90rpx;
  106. .inspage-content-info {
  107. width: 100%;
  108. box-sizing: border-box;
  109. }
  110. }
  111. /** 头部主要内容 开始 */
  112. .inspage-content-header {
  113. width: 100%;
  114. height: var(--header-h);
  115. box-sizing: border-box;
  116. ::v-deep .u-search {
  117. padding: 0 30rpx !important;
  118. }
  119. ::v-deep .u-search__action {
  120. color: #fff !important;
  121. }
  122. }
  123. /** 头部主要内容 结束 **/
  124. /** userInfo内容 开始 */
  125. .inspage-content-userinfo {
  126. width: 100%;
  127. padding: 24rpx 40rpx 0;
  128. box-sizing: border-box;
  129. .inspage-userinfo-info {
  130. width: 100%;
  131. height: 320rpx;
  132. box-sizing: border-box;
  133. background-image: url("#{$image-beas-url}invitationStatistics/bgm.png");
  134. background-size: 100% 100%;
  135. background-repeat: no-repeat;
  136. border-radius: 20rpx;
  137. box-shadow: 0rpx 0 20rpx 2rpx rgba(205, 205, 205, 0.50);
  138. display: flex;
  139. flex-direction: column;
  140. align-items: flex-start;
  141. justify-content: space-between;
  142. color: #fff;
  143. font-size: 28rpx;
  144. font-family: SourceHanSansCN, SourceHanSansCN;
  145. padding: 38rpx 0;
  146. .inspage-userinfo-title {
  147. display: flex;
  148. font-weight: 600;
  149. width: 100%;
  150. box-sizing: border-box;
  151. padding: 0 36rpx;
  152. }
  153. .inspage-userinfo-count {
  154. width: 100%;
  155. display: flex;
  156. box-sizing: border-box;
  157. .inspage-userinfo-item {
  158. flex: 1;
  159. display: flex;
  160. justify-content: center;
  161. align-items: center;
  162. flex-direction: column;
  163. > text:nth-child(1) {
  164. .inspage-userinfo-util {
  165. font-size: 24rpx;
  166. margin-left: 5rpx;
  167. }
  168. ::v-deep .u-count-num {
  169. font-weight: bold !important;
  170. font-size: 32rpx !important;
  171. }
  172. }
  173. > text:nth-child(2) {
  174. margin-top: 20rpx;
  175. font-size: 24rpx;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. /** userInfo内容 结束 **/
  182. </style>