index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="distribution">
  3. <!-- header -->
  4. <cu-custom isBack bgColor="bg-gradual-blue"><view slot="content">分销中心</view></cu-custom>
  5. <view class="grid col-3 text-center bg-white padding">
  6. <view>
  7. <view>合计购买次数</view>
  8. <view class="text-bold text-black margin-top">{{params.sum_count}}</view>
  9. </view>
  10. <view>
  11. <view>累计现金收益</view>
  12. <view class="text-bold text-black margin-top">{{params.sum_cash}}</view>
  13. </view>
  14. <view>
  15. <view>累计积分收益</view>
  16. <view class="text-bold text-black margin-top">{{params.sum_point}}</view>
  17. </view>
  18. </view>
  19. <view class="cu-bar search bg-white border">
  20. <view class="search-form round">
  21. <text class="cuIcon-search"></text>
  22. <input :value="searchInput" @input="searchChange" type="text" placeholder="下级分销商姓名" confirm-type="search"></input>
  23. </view>
  24. <view class="action">
  25. <button @click="handler" class="cu-btn bg-green shadow-blur round">搜索</button>
  26. <button v-if="searchInput" @click="resetFunc" class="cu-btn margin-left-sm shadow-blur round">重置</button>
  27. </view>
  28. </view>
  29. <view class="flex border padding-lr bg-white">
  30. <view class="text-center text-black text-cut text-bold lineheight">序号</view>
  31. <view class="text-center text-black text-cut text-bold lineheight ">姓名</view>
  32. <view class="text-center text-black text-cut text-bold lineheight ">消费金额</view>
  33. <view class=" text-center text-black text-cut text-bold lineheight ">消费积分</view>
  34. </view>
  35. <view class="flex border padding-lr bg-white">
  36. <view class="text-center text-black text-cut text-bold lineheight ">合计</view>
  37. <view class="text-center text-black text-cut text-bold lineheight "> </view>
  38. <view class="text-center text-black text-cut text-bold lineheight ">{{params.sum_amount}}</view>
  39. <view class="text-center text-black text-cut text-bold lineheight ">{{params.total_point}}</view>
  40. </view>
  41. <!-- section -->
  42. <view class="bg-white">
  43. <cu-scrollView @scroll="scrollFunc" @refresherpulling="refresherpulling" :height="height">
  44. <view class="section padding">
  45. <view v-for="(item,index) in ListValue" :key="index" class="row">
  46. <view class="cell text-center padding-tb-sm text-cut bordera">{{index+1}}</view>
  47. <view class="cell text-center padding-tb-sm text-cut bordera">{{item.name}}</view>
  48. <view class="cell text-center padding-tb-sm text-cut bordera">{{item.total_amount}}</view>
  49. <view class="cell text-center padding-tb-sm text-cut bordera">{{item.total_point}}</view>
  50. </view>
  51. </view>
  52. <!-- 状态管理 -->
  53. <view class="cu-load" :class="{ loading: currentPage <= totalPage, over: currentPage > totalPage }"></view>
  54. </cu-scrollView>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {CustomBarHeight} from "@/common/device/index.js";
  60. import api from "./api.js";
  61. export default {
  62. data(){
  63. return {
  64. searchInput:"",
  65. ListValue:[],
  66. totalPage:1,
  67. currentPage:1,
  68. params:{}
  69. }
  70. },
  71. async onShow(){
  72. await this.requestList(true);
  73. },
  74. methods:{
  75. handler(){
  76. this.requestList(true,this.searchInput)
  77. },
  78. searchChange(e){
  79. this.searchInput=e.detail.value;
  80. },
  81. async resetFunc(){
  82. this.searchInput='';
  83. await this.requestList(true);
  84. },
  85. async requestList (status,name){
  86. let {currentPage,totalPage,ListValue}=this;
  87. if (status){
  88. currentPage=1,totalPage=1;ListValue=[]
  89. };
  90. if(currentPage>totalPage) return false;
  91. let params =name ? {limit:20,page:currentPage,name} :{limit:20,page:currentPage};
  92. var result=await api.detail(params);
  93. if(result.code!=0) return false;
  94. this.currentPage=currentPage+1;
  95. this.totalPage = result.totalPage;
  96. this.ListValue =ListValue.concat(result.data.data);
  97. this.params=result.data.footer;
  98. },
  99. async refresherpulling(){
  100. await this.requestList(true);
  101. },
  102. async scrollFunc(){
  103. await this.requestList();
  104. }
  105. },
  106. computed:{
  107. height(){
  108. let value=CustomBarHeight;
  109. return `calc(100vh - ${value}px - 420rpx)`
  110. }
  111. },
  112. watch:{
  113. searchInput:function(newVal,oldVal){
  114. if(newVal) this.requestList(true,newVal);
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss" scoped>
  120. .distribution{
  121. .border{
  122. position: relative;
  123. &::after{
  124. content:"";
  125. width: 100%;
  126. position: absolute;
  127. bottom: 0;left: 0;
  128. border-bottom: 1upx solid #ccc;
  129. transform: scale(1,0.5);
  130. }
  131. }
  132. .lineheight{
  133. line-height: 80upx;
  134. &:nth-child(1){
  135. width: 10%;
  136. }
  137. &:not(:nth-child(1)){
  138. width: 30%;
  139. }
  140. }
  141. .bordera{
  142. position: relative;
  143. &::after{
  144. content:"";
  145. width: 100%;
  146. position: absolute;
  147. bottom: 0;left: 0;
  148. border-bottom: 1upx solid #eee;
  149. transform: scale(1,0.5);
  150. }
  151. }
  152. .section{
  153. display: table;
  154. width: 100vw;
  155. box-sizing: border-box;
  156. .row{
  157. display: table-row;
  158. .cell{
  159. display: table-cell;
  160. }
  161. .cell:nth-child(1){
  162. width: 10%;
  163. }
  164. .cell:not(:nth-child(1)){
  165. width: 30%;
  166. }
  167. }
  168. .fixed{
  169. position: fixed;left: 0;
  170. width: 100vw;
  171. }
  172. }
  173. }
  174. </style>