index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view>
  3. <view class="leader-info">
  4. <image :src="selfObj.headimg || '/static/bed2-bg.png' "></image>
  5. <view class="leader-column">
  6. <view>
  7. <!-- <text>晚霞</text><text class="invite">我</text> -->
  8. <text>{{ selfObj.name || '-' }}</text>
  9. <text class="mySelf">{{ selfObj.role || '我' }}</text>
  10. </view>
  11. <view>
  12. <text style="color:#ccc">{{ selfObj.phone || '-' }}</text>
  13. <!-- <text style="color:#ccc;font-size: 28rpx;">188****2600</text> -->
  14. </view>
  15. </view>
  16. </view>
  17. <view v-for="(item, index) in teamList" :key="index" @click.stop="showChild(index)">
  18. <view class="leader-info">
  19. <image :src="!arrowFlagList[index] ? '/static/arrow-right3.png' : '/static/arrow-down.png'" class="arrow-style"></image>
  20. <image :src="item.headimg || '/static/bed2-bg.png' "></image>
  21. <view class="leader-column">
  22. <view class="teamLevel-box">
  23. <view style="white-space: nowrap;">{{ item.name || '-'}}</view>
  24. <view class="invite">一级分销</view>
  25. </view>
  26. <view>
  27. <text style="color:#ccc;font-size: 28rpx;">{{ item.phone || '-' }}</text>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="leader-info" v-show="arrowFlagList[index]" v-for="childItem in item.child" :key="childItem.id">
  32. <image src="/static/arrow-right3.png" class="arrow-style" style="visibility: hidden;"></image>
  33. <image :src="childItem.headimg || '/static/bed2-bg.png' "></image>
  34. <view class="leader-column">
  35. <view class="teamLevel-box">
  36. <view style="white-space: nowrap;">{{ childItem.name || '-'}}</view>
  37. <view class="invited">二级分销</view>
  38. </view>
  39. <view>
  40. <text style="color:#ccc;font-size: 28rpx;">{{ childItem.phone || '-'}}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. var md5 = require('../../../common/md5.js')
  49. export default {
  50. data() {
  51. return {
  52. title: 'selfCenter',
  53. arrowFlagList: [],
  54. selfObj: {},
  55. teamList: [
  56. // {
  57. // name: '晚霞',
  58. // role: '我',
  59. // phone: '188****2600',
  60. // id: 1
  61. // },
  62. // {
  63. // name: '午霞',
  64. // role: '一级分销',
  65. // phone: '158****2666',
  66. // id: 2,
  67. // child: [
  68. // {
  69. // name: '早霞',
  70. // role: '二级分销',
  71. // phone: '168****2688',
  72. // id: 3
  73. // },
  74. // {
  75. // name: '早霞666',
  76. // role: '二级分销',
  77. // phone: '168****2688',
  78. // id: 656
  79. // }
  80. // ]
  81. // },
  82. // {
  83. // name: '午霞2',
  84. // role: '一级分销',
  85. // phone: '158****2666',
  86. // id: 4,
  87. // child: [
  88. // {
  89. // name: '早霞2',
  90. // role: '二级分销',
  91. // phone: '168****2688',
  92. // id: 5
  93. // }
  94. // ]
  95. // }
  96. ]
  97. };
  98. },
  99. onLoad() {
  100. this.getTeamRequest();
  101. },
  102. methods: {
  103. filterSelf(arr) {
  104. let that = this;
  105. let obj = arr.filter((item, index) => {
  106. return item.role === '我';
  107. });
  108. that.selfObj = obj[0];
  109. arr = arr.filter((item, index) => {
  110. return item.role !== '我';
  111. });
  112. for (let i = 0; i < arr.length; i++) {
  113. that.arrowFlagList.push(false);
  114. }
  115. return arr;
  116. },
  117. getTeamRequest(){
  118. uni.showLoading({
  119. title: '加载中',
  120. });
  121. let that = this;
  122. uni.request({
  123. url: getApp().globalData.shareUrl, //需要设置为全局
  124. method: 'POST',
  125. header: {
  126. 'content-type': 'application/x-www-form-urlencoded'
  127. },
  128. data: {
  129. method: 'getUserTeamList',
  130. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  131. uid:getApp().globalData.user_id,
  132. sign: md5('getUserTeamList' + getApp().globalData.globalTimestamp)
  133. },
  134. success: res => {
  135. if (res.data.code === 200) {
  136. uni.hideLoading();
  137. that.teamList = that.filterSelf(res.data.msg)
  138. }
  139. }
  140. });
  141. },
  142. showChild(index) {
  143. this.arrowFlagList.splice(index, 1, !this.arrowFlagList[index]);
  144. }
  145. }
  146. };
  147. </script>
  148. <style>
  149. .leader-info {
  150. display: flex;
  151. align-items: center;
  152. background: #fff;
  153. padding: 20rpx;
  154. border-bottom: 1px solid #ccc;
  155. }
  156. .leader-column {
  157. display: flex;
  158. flex-direction: column;
  159. justify-content: space-between;
  160. height: 90rpx;
  161. font-size: 30rpx;
  162. }
  163. .leader-info image {
  164. height: 75rpx;
  165. width: 75rpx;
  166. border-radius: 50%;
  167. border: 1px solid #eee;
  168. margin-right: 3%;
  169. }
  170. .invite {
  171. background: red;
  172. color: #fff;
  173. font-size: 22rpx;
  174. padding: 4rpx;
  175. border-radius: 8rpx;
  176. margin-left: 5%;
  177. width: 55px;
  178. text-align: center;
  179. }
  180. .mySelf {
  181. background: orange;
  182. color: #fff;
  183. font-size: 22rpx;
  184. padding: 4rpx;
  185. border-radius: 8rpx;
  186. margin-left: 5%;
  187. width: 55px;
  188. }
  189. .invited {
  190. background: grey;
  191. color: #fff;
  192. font-size: 22rpx;
  193. padding: 4rpx;
  194. border-radius: 8rpx;
  195. margin-left: 5%;
  196. width: 55px;
  197. }
  198. .teamLevel-box {
  199. display: flex;
  200. align-items: center;
  201. }
  202. .arrow-style {
  203. width: 40rpx !important;
  204. height: 40rpx !important;
  205. border: none !important;
  206. }
  207. </style>