my-team.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="flex-common-css iPhone-bottom box-border-box seckill-box">
  3. <Nav title="我的团队" bgckgroundBox='transparent' leftColor='#fff' titleColor='#fff'></Nav>
  4. <view class="p-24 box-border-box">
  5. <view class="zzc-box b-rad-20 bgc-f">
  6. <view class="flex-direction align-items-center flex-justify-center user-box">
  7. <image class="user-image mb-20 b-rad-50" :src="userImg" mode=""></image>
  8. <view class="fs-32 fc-3 fw-400">
  9. {{userName}}
  10. </view>
  11. </view>
  12. <view class="ewm-box bgc-FAE5E2 align-items-center" @click="openPop">
  13. <uni-icons type="image" size="18" color="#F0372F" class="mr-8"></uni-icons>
  14. <view class="fc-F0372F fs-28">
  15. 推广码
  16. </view>
  17. </view>
  18. <view class="total-box align-items-center box-border-box">
  19. <view class="fs-28 fc-9 mr-40">
  20. 一级人数:<text class="fs-28 fc-3">{{one_num || 0}}人</text>
  21. </view>
  22. <view class="fs-28 fc-9">
  23. 二级人数:<text class="fs-28 fc-3">{{two_num || 0}}人</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="plr-24 box-border-box">
  29. <view class="p-24 box-border-box bgc-f sx-box align-items-center flex-justify-space">
  30. <view class="fs-32 fc-3 fw-600">
  31. 团队列表
  32. </view>
  33. <view class="b-rad-200 bgc-F2F2F2 box-border-box align-items-center">
  34. <view class="title-box b-rad-200 box-border-box text-align-center" @click="titleBut(1)"
  35. :class="titleId === 1?'bgc-4FB3EF fc-f':'fc-9'">
  36. 一级
  37. </view>
  38. <view class="title-box b-rad-200 box-border-box text-align-center" @click="titleBut(2)"
  39. :class="titleId === 2?'bgc-4FB3EF fc-f':'fc-9'">
  40. 二级
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <scroll-view :scroll-y="true" class="scroll-view-css plr-24 box-border-box" @scrolltolower="scrolltolower">
  46. <view class="bgc-f plr-32 box-border-box">
  47. <view v-if="listData.length == 0" class="scroll-view-css">
  48. <EnBlank :customSrc='true'>
  49. <template v-slot:blankImg>
  50. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  51. </template>
  52. </EnBlank>
  53. </view>
  54. <view class="ptb-24 item-box align-items-center" v-for="(item,index) in listData" :key="index">
  55. <image class="item-img mr-16 b-rad-50" :src="item.head_img" mode=""></image>
  56. <view class="">
  57. <view class="fs-30 fc-3 mb-8">
  58. {{item.nickname}}
  59. </view>
  60. <view class="fs-24 fc-9">
  61. {{item.created_at}}
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. <uni-popup ref="popup" type="center" border-radius="10px 10px 10px 10px">
  68. <image class="code-image mb-20" :src="codeImg" mode="aspectFit"></image>
  69. <view class="plr-24 box-border-box">
  70. <view class="pop-but fs-30 fc-f b-rad-200 bgc-4FB3EF text-align-center b-r-ccc" @click="saveImg">
  71. 保存推广码
  72. </view>
  73. </view>
  74. </uni-popup>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. memberShare
  80. } from "@/api/member.js"
  81. import {
  82. memberClanList,
  83. memberClanTotal
  84. } from "@/api/memberClan.js"
  85. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  86. export default {
  87. components: {
  88. EnBlank
  89. },
  90. data() {
  91. const currentDate = this.getDate({
  92. format: true
  93. })
  94. return {
  95. userImg: '',
  96. userName: '',
  97. codeImg: '',
  98. titleId: 1,
  99. listData: [],
  100. page: 1,
  101. total: 0,
  102. one_num: 0,
  103. two_num: 0
  104. };
  105. },
  106. onLoad(data) {
  107. if (data) {
  108. this.userImg = data.img
  109. this.userName = data.name
  110. }
  111. },
  112. mounted() {
  113. this.memberShare()
  114. this.memberClanList()
  115. this.memberClanTotal()
  116. },
  117. methods: {
  118. memberClanTotal() {
  119. memberClanTotal().then((res) => {
  120. if (res.code === 1) {
  121. this.one_num = res.data.one_num
  122. this.two_num = res.data.two_num
  123. }
  124. })
  125. },
  126. saveImg() {
  127. // 调用 uni.downloadFile 下载图片
  128. uni.downloadFile({
  129. url: this.codeImg,
  130. success: (downloadRes) => {
  131. if (downloadRes.statusCode === 200) {
  132. // 下载成功,将临时文件保存到相册
  133. uni.saveImageToPhotosAlbum({
  134. filePath: downloadRes.tempFilePath,
  135. success: () => {
  136. uni.showToast({
  137. title: '图片保存成功',
  138. icon: 'success',
  139. duration: 2000
  140. });
  141. },
  142. fail: (saveErr) => {
  143. uni.showToast({
  144. title: '保存图片到相册失败',
  145. icon: 'none',
  146. duration: 2000
  147. });
  148. }
  149. });
  150. } else {
  151. uni.showToast({
  152. title: '图片下载失败',
  153. icon: 'none',
  154. duration: 2000
  155. });
  156. }
  157. },
  158. fail: (downloadErr) => {
  159. uni.showToast({
  160. title: '图片下载失败',
  161. icon: 'none',
  162. duration: 2000
  163. });
  164. }
  165. });
  166. },
  167. openPop() {
  168. this.$refs.popup.open()
  169. },
  170. memberShare() {
  171. memberShare().then((res) => {
  172. if (res.code === 1) {
  173. this.codeImg = res.data.share_img
  174. }
  175. })
  176. },
  177. memberClanList() {
  178. memberClanList({
  179. type: this.titleId,
  180. page: this.page
  181. }).then((res) => {
  182. if (res.code === 1) {
  183. this.listData.push(...res.data.list)
  184. this.total = res.data.total
  185. }
  186. })
  187. },
  188. bindDateChange(e) {
  189. this.tiem = e.detail.value
  190. this.page = 1;
  191. this.listData = [];
  192. this.memberClanList();
  193. },
  194. titleBut(item) {
  195. if (item.water_key === this.titleId) {
  196. return
  197. }
  198. this.titleId = item.water_key
  199. this.page = 1;
  200. this.listData = [];
  201. this.memberClanList();
  202. },
  203. getDate(type) {
  204. const date = new Date();
  205. let year = date.getFullYear();
  206. let month = date.getMonth() + 1;
  207. let day = date.getDate();
  208. if (type === 'start') {
  209. year = year - 60;
  210. } else if (type === 'end') {
  211. year = year + 2;
  212. }
  213. month = month > 9 ? month : '0' + month;
  214. day = day > 9 ? day : '0' + day;
  215. return `${year}-${month}-${day}`;
  216. },
  217. scrolltolower() {
  218. if (this.listData.length < this.total) {
  219. ++this.page
  220. this.memberClanList()
  221. }
  222. }
  223. },
  224. }
  225. </script>
  226. <style lang="scss" scoped>
  227. .item-img {
  228. width: 88rpx;
  229. height: 88rpx;
  230. }
  231. .user-box {
  232. padding: 40rpx 0;
  233. }
  234. .total-box {
  235. padding: 32rpx 24rpx;
  236. border-top: 1rpx solid #E6E7E9;
  237. }
  238. .pop-but {
  239. width: 100%;
  240. height: 70rpx;
  241. line-height: 70rpx;
  242. }
  243. .pop-box {
  244. width: 70vw;
  245. max-height: 60vh;
  246. }
  247. .user-image {
  248. width: 112rpx;
  249. height: 112rpx;
  250. }
  251. .item-box {
  252. border-bottom: 1rpx solid #EEEEEE;
  253. }
  254. .item-box:last-child {
  255. border: none;
  256. }
  257. .right {
  258. width: 32rpx;
  259. height: 32rpx;
  260. }
  261. .sx-box {
  262. border-radius: 20rpx 20rpx 0 0;
  263. }
  264. .seckill-box {
  265. background: linear-gradient(to bottom, #4FB3EF, #F5F5F5, #F5F5F5);
  266. }
  267. .zzc-box {
  268. width: 100%;
  269. height: auto;
  270. position: relative;
  271. }
  272. .ewm-box {
  273. position: absolute;
  274. right: 0;
  275. top: 65rpx;
  276. border-radius: 200rpx 0 0 200rpx;
  277. padding: 10rpx 20rpx 10rpx 27rpx;
  278. }
  279. .scroll-view_H {
  280. white-space: nowrap;
  281. width: 100%;
  282. }
  283. .title-box {
  284. min-width: 104rpx;
  285. height: 52rpx;
  286. line-height: 52rpx;
  287. }
  288. .code-image {
  289. width: 80vw;
  290. height: 60vh;
  291. border-radius: 20rpx;
  292. }
  293. </style>