鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
9.3 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar>
  4. <image class="icon-nav" src="@/pages_order/static/partner/icon-nav.png" mode="widthFix"></image>
  5. </navbar>
  6. <view class="main">
  7. <view class="advantage">
  8. <view class="flex advantage-content">
  9. <view class="flex advantage-item" v-for="(item, aIdx) in advantages" :key="aIdx">
  10. <image class="icon" src="@/static/image/icon-checkmark-circle-fill.png" mode="widthFix"></image>
  11. <view>{{ item }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="card">
  16. <view class="flex user">
  17. <view class="avatar">
  18. <image class="img" :src="userInfo.headImage" mode="scaleToFill"></image>
  19. <view :class="['tag', `tag-${userInfo.role}`]">{{ userInfo.roleDesc || '' }}</view>
  20. </view>
  21. <view class="flex summary">
  22. <view class="flex flex-column summary-item name">
  23. <view class="summary-item-content text-ellipsis">{{ userInfo.nickName }}</view>
  24. <view class="summary-item-label text-ellipsis">{{ `ID:${userInfo.id}` }}</view>
  25. </view>
  26. <template v-if="isPartner">
  27. <view class="flex flex-column summary-item" @click="jumpToAchievement">
  28. <view class="summary-item-content">{{ userCenterData.spreadNum }}</view>
  29. <view class="summary-item-label nowrap">推广人数</view>
  30. </view>
  31. <view class="flex flex-column summary-item">
  32. <view class="summary-item-content">{{ userCenterData.commission }}</view>
  33. <view class="summary-item-label nowrap">总佣金</view>
  34. </view>
  35. </template>
  36. <template v-else>
  37. <view class="flex summary-item operate">
  38. <button class="btn" @click="onApplyPartner">成为合伙人</button>
  39. </view>
  40. </template>
  41. </view>
  42. </view>
  43. <view class="flex bar" v-if="isPartner">
  44. <button class="flex col btn" @click="jumpToTeam">
  45. <image class="icon" src="@/pages_order/static/partner/icon-team.png" mode="widthFix"></image>
  46. <view>我的团队</view>
  47. </button>
  48. <view class="flex divider">
  49. <view class="line"></view>
  50. </view>
  51. <button class="flex col btn" @click="openPosterPopup">
  52. <image class="icon" src="@/pages_order/static/partner/icon-qrcode.png" mode="widthFix"></image>
  53. <view>邀请二维码</view>
  54. </button>
  55. <view class="flex divider">
  56. <view class="line"></view>
  57. </view>
  58. <button class="flex col btn" @click="jumpToWithdraw">
  59. <image class="icon" src="@/pages_order/static/partner/icon-cash.png" mode="widthFix"></image>
  60. <view>提现</view>
  61. </button>
  62. </view>
  63. <!-- todo: check -->
  64. <button class="btn-apply" @click="onApplyPartner">
  65. <image class="bg" src="@/pages_order/static/partner/apply.png" mode="widthFix"></image>
  66. </button>
  67. <view class="list" v-if="isPartner && list.length">
  68. <view class="flex list-item" v-for="item in list" :key="item.id">
  69. <view class="flex col info">
  70. <view class="avatar">
  71. <image class="img" :src="item.commissionUser.headImage" mode="scaleToFill"></image>
  72. </view>
  73. <view>{{ item.commissionUser.nickName }}</view>
  74. </view>
  75. <view class="col price">{{ `${item.amount}` }}</view>
  76. <view class="col desc">{{ $dayjs(item.createTime).format('YYYY-MM-DD') }}</view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <posterPopup ref="posterPopup"></posterPopup>
  82. <tabber select="partner" />
  83. </view>
  84. </template>
  85. <script>
  86. import { mapState } from 'vuex'
  87. import mixinsList from '@/mixins/list.js'
  88. import tabber from '@/components/base/tabbar.vue'
  89. import posterPopup from '@/components/base/posterPopup.vue'
  90. export default {
  91. mixins: [mixinsList],
  92. components: {
  93. tabber,
  94. posterPopup,
  95. },
  96. data() {
  97. return {
  98. advantages: ['收益高', '品类全', '到账快', '城市多'],
  99. // todo: fetch
  100. isPartner: true,
  101. mixinsListApi: 'queryCommissionList',
  102. }
  103. },
  104. computed: {
  105. ...mapState(['userCenterData']),
  106. },
  107. onLoad() {
  108. if(uni.getStorageSync('token')){
  109. this.$store.commit('getUserInfo')
  110. this.$store.commit('getUserCenterData')
  111. }
  112. },
  113. onShow() {
  114. // todo: refresh is partner?
  115. },
  116. methods: {
  117. onApplyPartner() {
  118. // todo: check
  119. return
  120. this.$utils.navigateTo(`/pages_order/partner/apply`)
  121. },
  122. jumpToTeam() {
  123. this.$utils.navigateTo(`/pages_order/partner/team`)
  124. },
  125. openPosterPopup() {
  126. const path = `pages/index/index?shareId=${this.userInfo.id}`
  127. this.$refs.posterPopup.open(path)
  128. },
  129. jumpToWithdraw() {
  130. this.$utils.navigateTo(`/pages_order/partner/withdraw`)
  131. },
  132. },
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. @import '../../components/member/styles/tag.scss';
  137. .page__view {
  138. min-height: 100vh;
  139. background: linear-gradient(to right, #21FEEC, #019AF9);
  140. /deep/ .nav-bar__view {
  141. position: fixed;
  142. top: 0;
  143. left: 0;
  144. }
  145. .icon-nav {
  146. width: 168rpx;
  147. height: auto;
  148. }
  149. /deep/ .tabbar-box {
  150. height: auto;
  151. padding-bottom: 0;
  152. }
  153. }
  154. .main {
  155. // min-height: 100vh;
  156. // padding: calc(var(--status-bar-height) + 130rpx) 0 calc(120rpx + env(safe-area-inset-bottom)) 0;
  157. padding-top: calc(var(--status-bar-height) + 130rpx);
  158. box-sizing: border-box;
  159. }
  160. .advantage {
  161. padding: 0 40rpx 32rpx 40rpx;
  162. &-content {
  163. justify-content: space-between;
  164. padding: 16rpx;
  165. background: #1FB2FD99;
  166. border: 2rpx solid #FFFFFF4D;
  167. border-radius: 16rpx;
  168. }
  169. &-item {
  170. column-gap: 8rpx;
  171. padding-right: 16rpx;
  172. font-size: 26rpx;
  173. color: #FFFFFF;
  174. .icon {
  175. width: 40rpx;
  176. height: auto;
  177. }
  178. }
  179. }
  180. .card {
  181. width: 100%;
  182. // height: 100%;
  183. $advantage-height: 54px;
  184. // min-height: calc(100vh - #{$advantage-height} - (var(--status-bar-height) + 130rpx) - (120rpx + env(safe-area-inset-bottom)));
  185. min-height: calc(100vh - #{$advantage-height} - (var(--status-bar-height) + 130rpx));
  186. padding: 40rpx;
  187. padding-bottom: calc(40rpx + 120rpx + env(safe-area-inset-bottom));
  188. box-sizing: border-box;
  189. font-family: PingFang SC;
  190. font-weight: 400;
  191. line-height: 1.4;
  192. background: linear-gradient(#DAF3FF, #FBFEFF 400rpx, #FBFEFF);
  193. border: 2rpx solid #FFFFFF;
  194. border-top-left-radius: 48rpx;
  195. border-top-right-radius: 48rpx;
  196. }
  197. .user {
  198. justify-content: space-between;
  199. padding: 32rpx 40rpx;
  200. background: linear-gradient(#DAF3FF, #FBFEFF 70%, #FBFEFF);
  201. border: 2rpx solid #FFFFFF;
  202. border-radius: 48rpx;
  203. column-gap: 24rpx;
  204. .avatar {
  205. flex: none;
  206. position: relative;
  207. width: 128rpx;
  208. height: 128rpx;
  209. border-radius: 24rpx;
  210. overflow: hidden;
  211. .img {
  212. width: 100%;
  213. height: 100%;
  214. }
  215. }
  216. .summary {
  217. flex: 1;
  218. column-gap: 26rpx;
  219. &-item {
  220. flex: 1;
  221. row-gap: 8rpx;
  222. &.name {
  223. min-width: 0;
  224. // flex: none;
  225. align-items: flex-start;
  226. }
  227. &.operate {
  228. justify-content: flex-end;
  229. }
  230. &-content {
  231. width: 100%;
  232. font-size: 32rpx;
  233. font-weight: 600;
  234. color: #000000;
  235. }
  236. &-label {
  237. width: 100%;
  238. font-size: 24rpx;
  239. color: #939393;
  240. }
  241. }
  242. }
  243. .btn {
  244. padding: 8rpx 24rpx;
  245. font-size: 28rpx;
  246. font-weight: 500;
  247. line-height: 1.4;
  248. color: #FFFFFF;
  249. background: linear-gradient(to right, #21FEEC, #019AF9);
  250. border-radius: 28rpx;
  251. }
  252. }
  253. .btn-apply {
  254. margin-top: 32rpx;
  255. width: 100%;
  256. height: auto;
  257. padding: 0;
  258. background: none;
  259. font-size: 0;
  260. .bg {
  261. width: 100%;
  262. height: auto;
  263. }
  264. }
  265. .bar {
  266. margin-top: 24rpx;
  267. flex-wrap: nowrap;
  268. padding: 16rpx 24rpx;
  269. .col {
  270. flex: none;
  271. }
  272. .divider {
  273. flex: 1;
  274. .line {
  275. width: 2rpx;
  276. height: 44rpx;
  277. background: #00A9FF;
  278. }
  279. }
  280. .btn {
  281. column-gap: 8rpx;
  282. font-size: 24rpx;
  283. color: #181818;
  284. .icon {
  285. width: 64rpx;
  286. height: auto;
  287. }
  288. }
  289. }
  290. .list {
  291. margin-top: 32rpx;
  292. background: #FFFFFF;
  293. border: 2rpx solid #F0F0F0;
  294. border-radius: 24rpx;
  295. overflow: hidden;
  296. &-item {
  297. margin-top: 16rpx;
  298. padding: 16rpx 32rpx;
  299. font-size: 28rpx;
  300. color: #333333;
  301. background: #FFFFFF;
  302. border-bottom: 2rpx solid #F1F1F1;
  303. &:last-child {
  304. border: none;
  305. }
  306. .col {
  307. flex: 1;
  308. text-align: center;
  309. }
  310. .info {
  311. justify-content: flex-start;
  312. column-gap: 24rpx;
  313. .avatar {
  314. width: 72rpx;
  315. height: 72rpx;
  316. border-radius: 50%;
  317. overflow: hidden;
  318. .img {
  319. width: 100%;
  320. height: 100%;
  321. }
  322. }
  323. }
  324. .desc {
  325. font-size: 26rpx;
  326. color: #A3A3A3;
  327. }
  328. }
  329. }
  330. </style>