index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <view>
  3. <view class="promoter-list">
  4. <view class='promoterHeader bg-color'>
  5. <view class='headerCon acea-row row-between-wrapper'>
  6. <view>
  7. <view class='name'>推广人数</view>
  8. <view><text class='num'>{{userInfo.spread_total}}</text>人</view>
  9. </view>
  10. <view class='iconfont icon-tuandui'></view>
  11. </view>
  12. </view>
  13. <view class='nav acea-row row-around'>
  14. <view :class="grade == 0 ? 'item on' : 'item'" @click='setType(0)'>一级({{userInfo.one_level_count}})</view>
  15. <view :class="grade == 1 ? 'item on' : 'item'" @click='setType(1)'>二级({{userInfo.two_level_count}})</view>
  16. </view>
  17. <!-- <form @submit.prevent="submitForm">
  18. </form> -->
  19. <view class='search acea-row row-between-wrapper'>
  20. <view class='input'><input placeholder='点击搜索会员名称' placeholder-class='placeholder' v-model="keyword" @confirm="submitForm" confirm-type='search' name="search"></input></view>
  21. <button class='iconfont icon-sousuo2' @click="submitForm"></button>
  22. </view>
  23. <view class='list'>
  24. <view class="sortNav acea-row row-middle">
  25. <view class="sortItem" @click='setSort("spread_count ASC")' v-if="sort == 'spread_count DESC'">团队排序
  26. <image src='/static/images/sort1.png'></image>
  27. </view>
  28. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'spread_count ASC'">团队排序
  29. <image src='/static/images/sort3.png'></image>
  30. </view>
  31. <view class="sortItem" @click='setSort("spread_count DESC")' v-else>团队排序
  32. <image src='/static/images/sort2.png'></image>
  33. </view>
  34. <view class="sortItem" @click='setSort("pay_price ASC")' v-if="sort == 'pay_price DESC'">金额排序
  35. <image src='/static/images/sort1.png'></image>
  36. </view>
  37. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'pay_price ASC'">金额排序
  38. <image src='/static/images/sort3.png'></image>
  39. </view>
  40. <view class="sortItem" @click='setSort("pay_price DESC")' v-else>金额排序
  41. <image src='/static/images/sort2.png'></image>
  42. </view>
  43. <view class="sortItem" @click='setSort("pay_count ASC")' v-if="sort == 'pay_count DESC'">订单排序
  44. <image src='/static/images/sort1.png'></image>
  45. </view>
  46. <view class="sortItem" @click='setSort("")' v-else-if="sort == 'pay_count ASC'">订单排序
  47. <image src='/static/images/sort3.png'></image>
  48. </view>
  49. <view class="sortItem" @click='setSort("pay_count DESC")' v-else>订单排序
  50. <image src='/static/images/sort2.png'></image>
  51. </view>
  52. </view>
  53. <block v-for="(item,index) in recordList" :key="index">
  54. <view class='item acea-row row-between-wrapper'>
  55. <view class="picTxt acea-row row-between-wrapper">
  56. <view class='pictrue'>
  57. <image :src='item.avatar ? item.avatar : "/static/images/f.png"'></image>
  58. </view>
  59. <view class='text'>
  60. <view class='name line1'>{{item.nickname}}</view>
  61. <view>加入时间: {{item.spread_time}}</view>
  62. </view>
  63. </view>
  64. <view class="right">
  65. <view><text class='num font-color'>{{item.spread_count ? item.spread_count : 0}}</text>人</view>
  66. <view><text class="num">{{item.pay_count ? item.pay_count : 0}}</text>单</view>
  67. <view><text class="num">{{item.pay_price ? item.pay_price : 0}}</text>元</view>
  68. </view>
  69. </view>
  70. </block>
  71. </view>
  72. </view>
  73. <!-- #ifdef MP -->
  74. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  75. <!-- #endif -->
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. spreadPeople,
  81. getUserInfo,
  82. spreadInfo
  83. } from '@/api/user.js';
  84. import {
  85. toLogin
  86. } from '@/libs/login.js';
  87. import {
  88. mapGetters
  89. } from "vuex";
  90. // #ifdef MP
  91. import authorize from '@/components/Authorize';
  92. // #endif
  93. export default {
  94. components: {
  95. // #ifdef MP
  96. authorize
  97. // #endif
  98. },
  99. data() {
  100. return {
  101. total: 0,
  102. totalLevel: 0,
  103. teamCount: 0,
  104. page: 1,
  105. limit: 20,
  106. keyword: '',
  107. sort: '',
  108. grade: 0,
  109. status: false,
  110. recordList: [],
  111. isAuto: false, //没有授权的不会自动授权
  112. isShowAuth: false, //是否隐藏授权
  113. userInfo:{}
  114. };
  115. },
  116. computed: mapGetters(['isLogin']),
  117. onLoad() {
  118. if (this.isLogin) {
  119. this.userSpreadNewList();
  120. this.getUserInfo()
  121. } else {
  122. // #ifdef H5 || APP-PLUS
  123. toLogin();
  124. // #endif
  125. // #ifdef MP
  126. this.isAuto = true;
  127. this.$set(this, 'isShowAuth', true)
  128. // #endif
  129. }
  130. },
  131. onShow: function() {
  132. if (this.is_show){
  133. this.userSpreadNewList();
  134. this.getUserInfo();
  135. }
  136. },
  137. onHide: function() {
  138. this.is_show = true;
  139. },
  140. methods: {
  141. getUserInfo(){
  142. spreadInfo().then(res => {
  143. this.userInfo = res.data
  144. });
  145. },
  146. onLoadFun: function(e) {
  147. this.isShowAuth = false;
  148. this.userSpreadNewList();
  149. this.getUserInfo()
  150. },
  151. // 授权关闭
  152. authColse: function(e) {
  153. this.isShowAuth = e
  154. },
  155. setSort: function(sort) {
  156. let that = this;
  157. that.sort = sort;
  158. that.page = 1;
  159. that.limit = 20;
  160. that.status = false;
  161. that.$set(that, 'recordList', []);
  162. that.userSpreadNewList();
  163. },
  164. // setKeyword: function(e) {
  165. // this.keyword = e.detail.value;
  166. // },
  167. submitForm: function() {
  168. this.page = 1;
  169. this.limit = 20;
  170. this.status = false;
  171. this.$set(this, 'recordList', []);
  172. this.userSpreadNewList();
  173. },
  174. setType: function(grade) {
  175. if (this.grade != grade) {
  176. this.grade = grade;
  177. this.page = 1;
  178. this.limit = 20;
  179. this.keyword = '';
  180. this.sort = '';
  181. this.status = false;
  182. this.$set(this, 'recordList', []);
  183. this.userSpreadNewList();
  184. }
  185. },
  186. userSpreadNewList: function() {
  187. let that = this;
  188. let page = that.page;
  189. let limit = that.limit;
  190. let status = that.status;
  191. let keyword = that.keyword;
  192. let sort = that.sort;
  193. let grade = that.grade;
  194. let recordList = that.recordList;
  195. let recordListNew = [];
  196. if (status == true) return;
  197. spreadPeople({
  198. page: page,
  199. limit: limit,
  200. keyword: keyword,
  201. level: grade+1,
  202. sort: sort,
  203. }).then(res => {
  204. let len = res.data.list.length;
  205. let recordListData = res.data.list;
  206. recordListNew = recordList.concat(recordListData);
  207. that.total = res.data.total;
  208. that.totalLevel = res.data.totalLevel;
  209. that.teamCount = that.$util.$h.Add(Number(res.data.total), Number(res.data.totalLevel));
  210. that.status = limit > len;
  211. that.page = page + 1;
  212. that.$set(that, 'recordList', recordListNew);
  213. });
  214. }
  215. },
  216. onReachBottom: function() {
  217. this.userSpreadNewList();
  218. }
  219. }
  220. </script>
  221. <style scoped lang="scss">
  222. .promoter-list .nav {
  223. background-color: #fff;
  224. height: 86rpx;
  225. line-height: 86rpx;
  226. font-size: 28rpx;
  227. color: #282828;
  228. border-bottom: 1rpx solid #eee;
  229. }
  230. .promoter-list .nav .item.on {
  231. border-bottom: 5rpx solid #e93323;
  232. color: #e93323;
  233. }
  234. .promoter-list .search {
  235. width: 100%;
  236. background-color: #fff;
  237. height: 86rpx;
  238. padding-left: 30rpx;
  239. box-sizing: border-box;
  240. }
  241. .promoter-list .search .input {
  242. width: 610rpx;
  243. height: 60rpx;
  244. border-radius: 50rpx;
  245. background-color: #f5f5f5;
  246. text-align: center;
  247. position: relative;
  248. }
  249. .promoter-list .search .input input {
  250. height: 100%;
  251. font-size: 26rpx;
  252. width: 610rpx;
  253. text-align: center;
  254. }
  255. .promoter-list .search .input .placeholder {
  256. color: #bbb;
  257. }
  258. .promoter-list .search .input .iconfont {
  259. position: absolute;
  260. right: 28rpx;
  261. color: #999;
  262. font-size: 28rpx;
  263. top: 50%;
  264. transform: translateY(-50%);
  265. }
  266. .promoter-list .search .iconfont {
  267. font-size: 45rpx;
  268. color: #515151;
  269. width: 110rpx;
  270. height: 60rpx;
  271. line-height: 60rpx;
  272. }
  273. .promoter-list .list {
  274. margin-top: 12rpx;
  275. }
  276. .promoter-list .list .sortNav {
  277. background-color: #fff;
  278. height: 76rpx;
  279. border-bottom: 1rpx solid #eee;
  280. color: #333;
  281. font-size: 28rpx;
  282. }
  283. .promoter-list .list .sortNav .sortItem {
  284. text-align: center;
  285. flex: 1;
  286. }
  287. .promoter-list .list .sortNav .sortItem image {
  288. width: 24rpx;
  289. height: 24rpx;
  290. margin-left: 6rpx;
  291. vertical-align: -3rpx;
  292. }
  293. .promoter-list .list .item {
  294. background-color: #fff;
  295. border-bottom: 1rpx solid #eee;
  296. height: 152rpx;
  297. padding: 0 30rpx 0 20rpx;
  298. font-size: 24rpx;
  299. color: #666;
  300. }
  301. .promoter-list .list .item .picTxt {
  302. width: 440rpx;
  303. }
  304. .promoter-list .list .item .picTxt .pictrue {
  305. width: 106rpx;
  306. height: 106rpx;
  307. border-radius: 50%;
  308. }
  309. .promoter-list .list .item .picTxt .pictrue image {
  310. width: 100%;
  311. height: 100%;
  312. border-radius: 50%;
  313. border: 3rpx solid #fff;
  314. box-shadow: 0 0 10rpx #aaa;
  315. box-sizing: border-box;
  316. }
  317. .promoter-list .list .item .picTxt .text {
  318. width: 304rpx;
  319. font-size: 24rpx;
  320. color: #666;
  321. }
  322. .promoter-list .list .item .picTxt .text .name {
  323. font-size: 28rpx;
  324. color: #333;
  325. margin-bottom: 13rpx;
  326. }
  327. .promoter-list .list .item .right {
  328. width: 240rpx;
  329. text-align: right;
  330. font-size: 22rpx;
  331. color: #333;
  332. }
  333. .promoter-list .list .item .right .num{
  334. margin-right: 7rpx;
  335. }
  336. </style>