index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="statistics" :style="{background:'url('+ bannerImage +')'}">
  3. <view><nav-bar title="none" icon="none" background="transparent" border-color="transparent"
  4. ></nav-bar></view>
  5. <view class="logo"><re-image imgSrc="/retail/main/img_logo.png" width="300" height="56"></re-image></view>
  6. <view class="content">
  7. <view class="news">
  8. <view class="info flex">
  9. <image :src="info.avatar || defaultAvatar" class="img"></image>
  10. <view class="info-text flex-column jcsa">
  11. <view class="info-top flex">
  12. <view class="name">{{info.name}}</view>
  13. <view class="level flex aic">
  14. <re-image imgSrc="/retail/main/ic_chuji.png" width="40" height="44"></re-image>
  15. <view class="level-text">{{info.lvName}}</view>
  16. </view>
  17. </view>
  18. <view class="phone">{{info.username}}</view>
  19. </view>
  20. </view>
  21. <view class="news-total flex jcsa">
  22. <view class="total-item">
  23. <view class="item-num">{{info.sumPayNum}}</view>
  24. <view class="item-text">总销订单</view>
  25. </view>
  26. <view class="total-item">
  27. <view class="item-num">{{info.sumGameCurrency}}</view>
  28. <view class="item-text">总销游戏币</view>
  29. </view>
  30. <view class="total-item">
  31. <view class="item-num orange">¥{{info.sumIncome}}</view>
  32. <view class="item-text">预估总收益</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="performance">
  37. <view class="per-top flex jcsb">
  38. <view class="left flex">
  39. <re-image width="40" height="40" imgSrc="/retail/statistics/ic_yeji.png"></re-image><text style="margin-left: 16rpx">分销业绩</text>
  40. </view>
  41. <view class="right flex aic" @click="show = true">
  42. <text>{{date}}</text><re-icon name="icon-xiala" :customStyle="{ fontSize: '10rpx',marginLeft:'10rpx'}"></re-icon>
  43. </view>
  44. </view>
  45. <view class="per-con flex">
  46. <view class="con-item flex">
  47. <re-image imgSrc="/retail/statistics/ic_dell.png" width="56" height="56"></re-image>
  48. <view class="con-new">
  49. <view class="new-text">总销订单</view>
  50. <view class="new-num">{{orderNum || 0}}</view>
  51. </view>
  52. </view>
  53. <view class="con-item flex">
  54. <re-image imgSrc="/retail/statistics/ic_youxibi.png" width="56" height="56"></re-image>
  55. <view class="con-new">
  56. <view class="new-text">总销游戏币</view>
  57. <view class="new-num">{{sumGameCurrency || 0}}</view>
  58. </view>
  59. </view>
  60. <view class="con-item con-btom flex">
  61. <re-image imgSrc="/retail/statistics/ic_money.png" width="56" height="56"></re-image>
  62. <view class="con-new">
  63. <view class="new-text">总充值金额</view>
  64. <view class="new-num"><text style="font-size:24rpx">¥</text>{{sumPay || 0}}</view>
  65. </view>
  66. </view>
  67. <view class="con-item con-btom flex">
  68. <re-image imgSrc="/retail/statistics/ic_money.png" width="56" height="56"></re-image>
  69. <view class="con-new">
  70. <view class="new-text">预估总收益</view>
  71. <view class="new-num"><text style="font-size:24rpx">¥</text>{{income || 0}}</view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="grade">
  77. <view class="per-top">
  78. <view class="left_dec flex aic">
  79. <re-image width="40" height="40" imgSrc="/retail/statistics/ic_yeji.png"></re-image><text style="margin-left: 16rpx">分销等级说明</text>
  80. </view>
  81. <rich-text :nodes="nodes"></rich-text>
  82. </view>
  83. </view>
  84. </view>
  85. <u-picker ref="uPicker" :show="show" :columns="columns" keyName="label" :closeOnClickOverlay="true" @confirm="confirm" @change="changeHandler" @close="show = false" @cancel="show = false"></u-picker>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. toRpx
  91. } from '@/utils/calculate.js'
  92. import defaultConfig from '@/config/default.js'
  93. import { statistics,getConfig } from '@/apis/statistic'
  94. import { getUserInfo } from '@/apis/user'
  95. export default {
  96. components: {},
  97. computed: {
  98. statusBarHeight() {
  99. return this.$store.state.info.systemInfo?.statusBarHeight
  100. },
  101. },
  102. data() {
  103. return {
  104. show:false,
  105. date:'今日',
  106. columns:[
  107. [{
  108. label:'今日',
  109. id:1
  110. },{
  111. label:'昨日',
  112. id:2
  113. },{
  114. label:'近一周',
  115. id:3
  116. },{
  117. label:'近一月',
  118. id:4
  119. },{
  120. label:'近一年',
  121. id:5
  122. }]
  123. ],
  124. bannerImage: defaultConfig.ossImgUrl + '/retail/main/img_bgtop.png',
  125. navBarHeight: uni.getStorageSync('navBarHeight'),
  126. nodes:'',
  127. income:'',
  128. orderNum:'',
  129. sumGameCurrency:'',
  130. sumPay:'',
  131. info: '',
  132. defaultAvatar:'../../static/image/img_touxiang.png',
  133. // sumPayNum: uni.getStorageSync('userInfo').sumPayNum,// 总销订单
  134. // sumGameCurrency: uni.getStorageSync('userInfo').sumGameCurrency,// 总销游戏币
  135. // sumIncome: uni.getStorageSync('userInfo').sumIncome,//预估总收益,
  136. // name:'',
  137. // username:'',
  138. }
  139. },
  140. onLoad() {
  141. },
  142. methods: {
  143. changeHandler(e) {
  144. console.log(e,'e');
  145. const {
  146. columnIndex,
  147. value,
  148. values, // values为当前变化列的数组内容
  149. index,
  150. // 微信小程序无法将picker实例传出来,只能通过ref操作
  151. picker = this.$refs.uPicker
  152. } = e
  153. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  154. // if (columnIndex === 0) {
  155. // // picker为选择器this实例,变化第二列对应的选项
  156. // picker.setColumnValues(1, this.columnData[index])
  157. // }
  158. },
  159. // 回调参数为包含columnIndex、value、values
  160. confirm(e) {
  161. console.log('confirm', e)
  162. this.show = false
  163. const date = e.value[0].id
  164. this.date = e.value[0].label
  165. this.getData(date)
  166. },
  167. async getInfo(){
  168. const userInfo = await getUserInfo()
  169. if(userInfo){
  170. this.info = userInfo
  171. }
  172. },
  173. // 获取统计
  174. async getData(type=1){
  175. uni.showLoading()
  176. const res = await statistics({type:type})
  177. const { income,orderNum,sumGameCurrency,sumPay } = res
  178. this.income = income
  179. this.orderNum = orderNum
  180. this.sumGameCurrency = sumGameCurrency
  181. this.sumPay = sumPay
  182. uni.hideLoading()
  183. },
  184. // 获取规则
  185. async getRule(){
  186. const res = await getConfig()
  187. this.nodes = res.lvRule
  188. }
  189. },
  190. onShow() {
  191. this.getData()
  192. this.getRule()
  193. this.getInfo()
  194. },
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. .statistics {
  199. background-repeat: no-repeat !important;
  200. background-size: contain !important;
  201. // background-position: top;
  202. width: 100%;
  203. position: absolute;
  204. top: 0;
  205. bottom: 0;
  206. .logo {
  207. margin-top: 16rpx;
  208. margin-left: 24rpx;
  209. }
  210. .content {
  211. padding: 0 32rpx;
  212. .news {
  213. background: #FFFFFF;
  214. box-shadow: 0rpx 6rpx 16rpx 0rpx #E3E6F2;
  215. border-radius: 24rpx;
  216. margin-top: 48rpx;
  217. padding: 40rpx;
  218. .info {
  219. .img{
  220. flex-shrink: 0;
  221. width: 104rpx;
  222. height: 104rpx;
  223. border-radius: 8rpx;
  224. margin-right: 20rpx;
  225. }
  226. .info-text {
  227. .info-top {
  228. .name {
  229. font-weight: 500;
  230. font-size: 32rpx;
  231. color: #363531;
  232. }
  233. .level {
  234. margin-left: 12rpx;
  235. .level-text {
  236. width: 80rpx;
  237. height: 36rpx;
  238. padding: 6rpx 12rpx 6rpx 20rpx;
  239. background: linear-gradient(130deg, #FFB873 0%, #FEC287 0%, #E69349 100%);
  240. border-radius: 0rpx 18rpx 18rpx 0rpx;
  241. font-weight: 500;
  242. font-size: 24rpx;
  243. color: #FFFFFF;
  244. line-height: 24rpx;
  245. margin-left: -12rpx;
  246. // text-align: left;
  247. }
  248. }
  249. }
  250. }
  251. .phone {
  252. font-weight: 400;
  253. font-size: 28rpx;
  254. color: #989897;
  255. }
  256. }
  257. .news-total {
  258. margin-top: 44rpx;
  259. .item-num {
  260. font-weight: bold;
  261. font-size: 40rpx;
  262. color: #363531;
  263. }
  264. .orange {
  265. color: #FF6400;
  266. }
  267. .item-text {
  268. font-weight: 400;
  269. font-size: 28rpx;
  270. color: #9598A6;
  271. }
  272. }
  273. }
  274. .performance{
  275. background: #fff;
  276. padding: 32rpx 32rpx 52rpx;
  277. box-shadow: 0rpx 4rpx 12rpx 0rpx #EBECF1;
  278. border-radius: 24rpx;
  279. margin-top: 22rpx;
  280. .per-top{
  281. .right{
  282. // width: 112rpx;
  283. // height: 48rpx;
  284. background: #FFD370;
  285. border-radius: 8rpx;
  286. font-weight: 500;
  287. font-size: 28rpx;
  288. color: #2A200A;
  289. line-height: 48rpx;
  290. padding: 0 16rpx;
  291. white-space: nowrap;
  292. }
  293. }
  294. .per-con{
  295. margin-top: 44rpx;
  296. flex-wrap: wrap;
  297. .con-item{
  298. width: 50%;
  299. .con-new{
  300. margin-left: 20rpx;
  301. .new-text{
  302. font-weight: 400;
  303. font-size: 28rpx;
  304. color: #9598A6;
  305. }
  306. .new-num{
  307. margin-top: 20rpx;
  308. font-weight: bold;
  309. font-size: 40rpx;
  310. color: #363531;
  311. line-height: 40rpx;
  312. }
  313. }
  314. }
  315. .con-btom{
  316. margin-top: 44rpx;
  317. }
  318. }
  319. }
  320. .grade{
  321. padding: 32rpx;
  322. background: linear-gradient( 135deg, #FFDFDF 0%, #FFE4A4 100%);
  323. border-radius: 24rpx;
  324. margin-top: 22rpx;
  325. .left_dec{
  326. margin-bottom: 28rpx;
  327. }
  328. }
  329. }
  330. }
  331. </style>