Recode.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. <template>
  2. <div class="agent-recode">
  3. <div class="recode-top">
  4. <div class="top-title">我的邀请</div>
  5. <div class="top-info">
  6. <div class="info-left">
  7. <div class="info-count">{{total_count}}人</div>
  8. <div class="info-text">邀请总人数</div>
  9. </div>
  10. </div>
  11. </div>
  12. <div class="recode-list">
  13. <div class="list-top">
  14. <div :class="[ iscur === 0 ? activeClass : '', 'list-left' ]" data-current="0" @click="changebar">一级分销</div>
  15. <div :class="[ iscur === 1 ? activeClass : '', 'list-right' ]" data-current="1" @click="changebar">二级分销</div>
  16. <div class="list-line" :style="tableft"></div>
  17. <div class="clear"></div>
  18. </div>
  19. <div class="list-center">
  20. <van-list v-model="isUpLoading" :finished="upFinished" finished-text="" @load="onLoadList" :offset="offset" v-if="iscur === 0">
  21. <div class="list-item" v-for="(item, index) in inlist" :key="index">
  22. <div class="item-top">
  23. <img :src="item.head" class="item-head" alt="">
  24. <div class="item-name" v-if="item.nickname">{{item.nickname}}</div>
  25. <div class="item-name" v-if="!item.nickname">微信用户</div>
  26. <!-- <div class="item-num">({{item.id}})</div> -->
  27. <div class="item-time">{{item.create_time | formatSTime}}</div>
  28. <div class="clear"></div>
  29. </div>
  30. </div>
  31. <div class="list-none" v-show="shownone">
  32. <img src="@/assets/img/h.png" class="none-img" alt="">
  33. <div class="none-text">当前数据为空</div>
  34. </div>
  35. </van-list>
  36. </div>
  37. <div class="list-center">
  38. <van-list v-model="isUpLoading1" :finished="upFinished1" finished-text="" @load="onLoadList1" :offset="offset1" v-if="iscur === 1">
  39. <div class="list-item" v-for="(item, index) in outlist" :key="index">
  40. <div class="item-top">
  41. <img :src="item.head" class="item-head" alt="" v-if="item.head">
  42. <img src="@/assets/img/wx.png" class="item-head" alt="" v-if="!item.head">
  43. <div class="item-name" v-if="item.nickname">{{item.nickname}}</div>
  44. <div class="item-name" v-if="!item.nickname">微信用户</div>
  45. <!-- <div class="item-num">({{item.id}})</div> -->
  46. <div class="item-time">{{item.create_time | formatSTime}}</div>
  47. <div class="clear"></div>
  48. </div>
  49. </div>
  50. <div class="list-none" v-show="shownone1">
  51. <img src="@/assets/img/h.png" class="none-img" alt="">
  52. <div class="none-text">当前数据为空</div>
  53. </div>
  54. </van-list>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { mapGetters } from 'vuex'
  61. export default {
  62. name: '',
  63. props: {
  64. },
  65. data () {
  66. return {
  67. shownone: false,
  68. shownone1: false,
  69. inlist: [],
  70. intotal: 0,
  71. outlist: [],
  72. outtotal: 0,
  73. activeClass: 'active',
  74. iscur: 0,
  75. tableft: {
  76. left: '0.96rem'
  77. },
  78. recode: {},
  79. page: 1,
  80. per_page: 10,
  81. page1: 1,
  82. per_page1: 10,
  83. offset: 5,
  84. offset1: 5,
  85. isUpLoading: false,
  86. upFinished: false,
  87. isUpLoading1: false,
  88. upFinished1: false,
  89. tab: true,
  90. tab1: true,
  91. total_count: '',
  92. id: 0
  93. }
  94. },
  95. created () {
  96. // this.$store.dispatch('userInfo')
  97. // this.getrecode()
  98. // if (this.$route.query.invite_id) {
  99. // this.id = this.$route.query.invite_id
  100. // }
  101. },
  102. components: {},
  103. computed: {
  104. ...mapGetters(['userInfo'])
  105. },
  106. beforeMount() {},
  107. mounted() {},
  108. methods: {
  109. in () {
  110. this.$get({
  111. url: `v1/invite/${this.$route.query.id}/list`,
  112. data: {
  113. page: this.page,
  114. per_page: this.per_page,
  115. }
  116. }).then((res) => {
  117. this.total_count = res.total_count
  118. this.tab = false
  119. if (this.page === 1) {
  120. this.inlist = []
  121. this.intotal = 0
  122. }
  123. this.page++
  124. this.isUpLoading = false
  125. this.inlist = this.inlist.concat(res.list || [])
  126. this.intotal = res.list_count
  127. if (this.inlist.length >= this.intotal) {
  128. this.upFinished = true
  129. }
  130. if (this.intotal === 0) {
  131. setTimeout(() => {
  132. this.shownone = true
  133. }, 100)
  134. } else {
  135. this.shownone = false
  136. }
  137. })
  138. },
  139. out () {
  140. this.$get({
  141. url: `v1/invite/${this.$route.query.id}/frend/list`,
  142. data: {
  143. page: this.page1,
  144. per_page: this.per_page1,
  145. }
  146. }).then((res) => {
  147. this.tab1 = false
  148. if (this.page1 === 1) {
  149. this.outlist = []
  150. this.outtotal = 0
  151. }
  152. this.page1++
  153. this.isUpLoading1 = false
  154. this.outlist = this.outlist.concat(res.list || [])
  155. this.outtotal = res.list_count
  156. if (this.outlist.length >= this.outtotal) {
  157. this.upFinished1 = true
  158. }
  159. if (this.outtotal === 0) {
  160. setTimeout(() => {
  161. this.shownone1 = true
  162. }, 100)
  163. } else {
  164. this.shownone1 = false
  165. }
  166. })
  167. },
  168. onLoadList () {
  169. setTimeout(() => {
  170. this.in()
  171. }, 100)
  172. },
  173. onLoadList1 () {
  174. setTimeout(() => {
  175. this.out()
  176. }, 100)
  177. },
  178. getrecode () {
  179. this.$get({
  180. url: 'v1/agent/invite_mater',
  181. data: {
  182. }
  183. }).then((res) => {
  184. this.recode = res
  185. })
  186. },
  187. changebar (e) {
  188. if (this.iscur === parseInt(e.target.dataset.current)) {
  189. return false
  190. } else {
  191. this.iscur = parseInt(e.target.dataset.current)
  192. if (this.iscur === 0) {
  193. this.tableft.left = '0.96rem'
  194. } else if (this.iscur === 1) {
  195. this.tableft.left = '4.32rem'
  196. }
  197. }
  198. }
  199. },
  200. watch: {
  201. // 'userInfo': function (val) {
  202. // console.log(val)
  203. // this.id = val.wx_user.id
  204. // }
  205. }
  206. }
  207. </script>
  208. <style lang='less' scoped>
  209. .agent-recode {
  210. background: #eeeeed;
  211. min-height: 100%;
  212. overflow: hidden;
  213. text-align: left;
  214. .recode-top {
  215. width: 7.1rem;
  216. margin: 0.2rem auto;
  217. background: #fff;
  218. box-sizing: border-box;
  219. padding: 0 0.2rem;
  220. border-radius: 0.1rem;
  221. overflow: hidden;
  222. .top-title {
  223. color: #acbac3;
  224. font-size: 0.32rem;
  225. font-weight: 600;
  226. padding-top: 0.25rem;
  227. padding-bottom: 0.25rem;
  228. }
  229. .top-info {
  230. display: flex;
  231. display: -webkit-flex;
  232. justify-content: space-between;
  233. flex-wrap: nowrap;
  234. text-align: center;
  235. margin-bottom: 0.3rem;
  236. .info-left {
  237. flex-grow: 1;
  238. height: 1.1rem;
  239. border-right: 0.02rem solid #eee;
  240. .info-count {
  241. font-size: 0.26rem;
  242. color: #ff595d;
  243. margin-top: 0.1rem;
  244. margin-bottom: 0.1rem;
  245. }
  246. .info-text {
  247. font-size: 0.26rem;
  248. color: #999999;
  249. }
  250. }
  251. .info-center {
  252. flex-grow: 1;
  253. height: 1.1rem;
  254. border-right: 0.02rem solid #eee;
  255. .info-count {
  256. font-size: 0.26rem;
  257. color: #4c4c4c;
  258. margin-top: 0.1rem;
  259. margin-bottom: 0.1rem;
  260. }
  261. .info-text {
  262. font-size: 0.26rem;
  263. color: #999999;
  264. }
  265. }
  266. .info-right {
  267. flex-grow: 1;
  268. height: 1.1rem;
  269. .info-count {
  270. font-size: 0.26rem;
  271. color: #4c4c4c;
  272. margin-top: 0.1rem;
  273. margin-bottom: 0.1rem;
  274. }
  275. .info-text {
  276. font-size: 0.26rem;
  277. color: #999999;
  278. }
  279. }
  280. }
  281. }
  282. .recode-list {
  283. background: #fff;
  284. border-radius: 0.1rem;
  285. box-sizing: border-box;
  286. padding: 0 0.2rem 0.2rem;
  287. margin: 0.2rem auto 0.2rem;
  288. width: 7.1rem;
  289. position: relative;
  290. .list-top {
  291. height: 0.75rem;
  292. width: 100%;
  293. border-bottom: 0.02rem solid #eee;
  294. position: relative;
  295. .list-left {
  296. width: 50%;
  297. color: #acbac3;
  298. text-align: center;
  299. float: left;
  300. font-size: 0.26rem;
  301. height: 0.75rem;
  302. line-height: 0.75rem;
  303. }
  304. .list-right {
  305. width: 50%;
  306. color: #acbac3;
  307. text-align: center;
  308. float: left;
  309. font-size: 0.26rem;
  310. height: 0.72rem;
  311. line-height: 0.72rem;
  312. }
  313. .list-line {
  314. width: 1.45rem;
  315. height: 0.02rem;
  316. background: #28cd5e;
  317. position: absolute;
  318. left: 0;
  319. bottom: 0;
  320. transition: left 0.4s;
  321. }
  322. .active {
  323. color: #28cd5e;
  324. }
  325. }
  326. .list-center {
  327. .list-none {
  328. position: absolute;
  329. top: 2.5rem;
  330. left: 50%;
  331. transform: translateX(-50%);
  332. .none-img {
  333. height: 2.1rem;
  334. width: 1.7rem;
  335. }
  336. .none-text {
  337. color: #999;
  338. font-size: 0.26rem;
  339. padding-top: 0.2rem;
  340. }
  341. }
  342. .list-item {
  343. // height: 1.6rem;
  344. width: 100%;
  345. margin-top: 0.2rem;
  346. background: #fff;
  347. box-sizing: border-box;
  348. padding: 0 0.2rem;
  349. .item-top {
  350. // height: 0.88rem;
  351. border-bottom: 0.02rem solid #ccc;
  352. width: 100%;
  353. padding-bottom: 0.25rem;
  354. .item-head {
  355. height: 0.5rem;
  356. width: 0.5rem;
  357. // background: pink;
  358. border-radius: 50%;
  359. float: left;
  360. margin-right: 0.2rem;
  361. margin-top: 0.2rem;
  362. }
  363. .item-name {
  364. color: #4c4c4c;
  365. font-size: 0.26rem;
  366. margin-right: 0.2rem;
  367. float: left;
  368. margin-top: 0.26rem;
  369. overflow: hidden;
  370. text-overflow:ellipsis;
  371. white-space: nowrap;
  372. max-width: 2.5rem;
  373. }
  374. .item-num {
  375. color: #4c4c4c;
  376. font-size: 0.26rem;
  377. float: left;
  378. margin-top: 0.26rem;
  379. }
  380. .item-time {
  381. color: #708fa3;
  382. font-size: 0.26rem;
  383. float: right;
  384. margin-top: 0.28rem;
  385. }
  386. }
  387. .item-bottom {
  388. padding-bottom: 0.3rem;
  389. .bottom-left {
  390. float: left;
  391. color: #4c4c4c;
  392. font-size: 0.26rem;
  393. margin-top: 0.2rem;
  394. }
  395. .bottom-right {
  396. float: right;
  397. color: #4c4c4c;
  398. font-size: 0.26rem;
  399. margin-top: 0.2rem;
  400. }
  401. .bottom-bottom {
  402. color: #4c4c4c;
  403. font-size: 0.26rem;
  404. margin-top: 0.2rem;
  405. }
  406. }
  407. }
  408. }
  409. }
  410. }
  411. </style>