鸿宇研学生前端代码
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.

399 lines
9.9 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" v-if="userInfo.id">
  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. <button class="btn-apply" @click="onApplyPartner">
  64. <image class="bg" src="@/pages_order/static/partner/apply.png" mode="widthFix"></image>
  65. </button>
  66. <view class="list" v-if="list.length">
  67. <view class="flex list-item" v-for="item in list" :key="item.id">
  68. <view class="flex col info">
  69. <view class="avatar">
  70. <image class="img" :src="item.commissionUser.headImage" mode="scaleToFill"></image>
  71. </view>
  72. <view>{{ item.commissionUser.nickName }}</view>
  73. </view>
  74. <view class="col price">{{ `${item.amount}` }}</view>
  75. <view class="col desc">{{ $dayjs(item.createTime).format('YYYY-MM-DD') }}</view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <posterPopup ref="posterPopup"></posterPopup>
  81. <tabber select="partner" />
  82. </view>
  83. </template>
  84. <script>
  85. import { mapState } from 'vuex'
  86. import mixinsList from '@/mixins/list.js'
  87. import tabber from '@/components/base/tabbar.vue'
  88. import posterPopup from '@/components/base/posterPopup.vue'
  89. export default {
  90. mixins: [mixinsList],
  91. components: {
  92. tabber,
  93. posterPopup,
  94. },
  95. data() {
  96. return {
  97. advantages: ['收益高', '品类全', '到账快', '城市多'],
  98. partnerInfo: {},
  99. mixinsListApi: '',
  100. }
  101. },
  102. computed: {
  103. ...mapState(['userCenterData']),
  104. isPartner() {
  105. // 审核状态status:0-审核中 1-已通过 2-未通过
  106. const { status } = this.partnerInfo
  107. return status == '1'
  108. },
  109. },
  110. onLoad() {
  111. if(uni.getStorageSync('token')){
  112. this.$store.commit('getUserInfo')
  113. this.$store.commit('getUserCenterData')
  114. }
  115. },
  116. onShow() {
  117. if(uni.getStorageSync('token')){
  118. this.fetchPartner()
  119. this.mixinsListApi = 'queryCommissionList'
  120. console.log('onShow getData')
  121. this.getData()
  122. }
  123. },
  124. // 下拉刷新
  125. async onPullDownRefresh() {
  126. await this.fetchPartner()
  127. uni.stopPullDownRefresh()
  128. },
  129. methods: {
  130. async fetchPartner() {
  131. try {
  132. const result = await this.$fetch('queryPartner')
  133. this.partnerInfo = result || {}
  134. } catch (err) {
  135. }
  136. },
  137. onApplyPartner() {
  138. this.$utils.navigateTo(`/pages_order/partner/apply?readonly=${this.isPartner ? 1 : 0}`)
  139. },
  140. jumpToTeam() {
  141. this.$utils.navigateTo(`/pages_order/partner/team`)
  142. },
  143. openPosterPopup() {
  144. const path = `pages/index/index?shareId=${this.userInfo.id}`
  145. this.$refs.posterPopup.open(path)
  146. },
  147. jumpToWithdraw() {
  148. this.$utils.navigateTo(`/pages_order/partner/withdraw`)
  149. },
  150. },
  151. }
  152. </script>
  153. <style scoped lang="scss">
  154. @import '../../components/member/styles/tag.scss';
  155. .page__view {
  156. min-height: 100vh;
  157. background: linear-gradient(to right, #21FEEC, #019AF9);
  158. /deep/ .nav-bar__view {
  159. position: fixed;
  160. top: 0;
  161. left: 0;
  162. }
  163. .icon-nav {
  164. width: 168rpx;
  165. height: auto;
  166. }
  167. /deep/ .tabbar-box {
  168. height: auto;
  169. padding-bottom: 0;
  170. }
  171. }
  172. .main {
  173. // min-height: 100vh;
  174. // padding: calc(var(--status-bar-height) + 130rpx) 0 calc(120rpx + env(safe-area-inset-bottom)) 0;
  175. padding-top: calc(var(--status-bar-height) + 130rpx);
  176. box-sizing: border-box;
  177. }
  178. .advantage {
  179. padding: 0 40rpx 32rpx 40rpx;
  180. &-content {
  181. justify-content: space-between;
  182. padding: 16rpx;
  183. background: #1FB2FD99;
  184. border: 2rpx solid #FFFFFF4D;
  185. border-radius: 16rpx;
  186. }
  187. &-item {
  188. column-gap: 8rpx;
  189. padding-right: 16rpx;
  190. font-size: 26rpx;
  191. color: #FFFFFF;
  192. .icon {
  193. width: 40rpx;
  194. height: auto;
  195. }
  196. }
  197. }
  198. .card {
  199. width: 100%;
  200. // height: 100%;
  201. $advantage-height: 54px;
  202. // min-height: calc(100vh - #{$advantage-height} - (var(--status-bar-height) + 130rpx) - (120rpx + env(safe-area-inset-bottom)));
  203. min-height: calc(100vh - #{$advantage-height} - (var(--status-bar-height) + 130rpx));
  204. padding: 40rpx;
  205. padding-bottom: calc(40rpx + 120rpx + env(safe-area-inset-bottom));
  206. box-sizing: border-box;
  207. font-family: PingFang SC;
  208. font-weight: 400;
  209. line-height: 1.4;
  210. background: linear-gradient(#DAF3FF, #FBFEFF 400rpx, #FBFEFF);
  211. border: 2rpx solid #FFFFFF;
  212. border-top-left-radius: 48rpx;
  213. border-top-right-radius: 48rpx;
  214. }
  215. .user {
  216. justify-content: space-between;
  217. padding: 32rpx 40rpx;
  218. background: linear-gradient(#DAF3FF, #FBFEFF 70%, #FBFEFF);
  219. border: 2rpx solid #FFFFFF;
  220. border-radius: 48rpx;
  221. column-gap: 24rpx;
  222. .avatar {
  223. flex: none;
  224. position: relative;
  225. width: 128rpx;
  226. height: 128rpx;
  227. border-radius: 24rpx;
  228. overflow: hidden;
  229. .img {
  230. width: 100%;
  231. height: 100%;
  232. }
  233. }
  234. .summary {
  235. flex: 1;
  236. column-gap: 26rpx;
  237. &-item {
  238. flex: 1;
  239. row-gap: 8rpx;
  240. &.name {
  241. min-width: 0;
  242. // flex: none;
  243. align-items: flex-start;
  244. }
  245. &.operate {
  246. justify-content: flex-end;
  247. }
  248. &-content {
  249. width: 100%;
  250. font-size: 32rpx;
  251. font-weight: 600;
  252. color: #000000;
  253. }
  254. &-label {
  255. width: 100%;
  256. font-size: 24rpx;
  257. color: #939393;
  258. }
  259. }
  260. }
  261. .btn {
  262. padding: 8rpx 24rpx;
  263. font-size: 28rpx;
  264. font-weight: 500;
  265. line-height: 1.4;
  266. color: #FFFFFF;
  267. background: linear-gradient(to right, #21FEEC, #019AF9);
  268. border-radius: 28rpx;
  269. }
  270. }
  271. .btn-apply {
  272. margin-top: 32rpx;
  273. width: 100%;
  274. height: auto;
  275. padding: 0;
  276. background: none;
  277. font-size: 0;
  278. .bg {
  279. width: 100%;
  280. height: auto;
  281. }
  282. }
  283. .bar {
  284. margin-top: 24rpx;
  285. flex-wrap: nowrap;
  286. padding: 16rpx 24rpx;
  287. .col {
  288. flex: none;
  289. }
  290. .divider {
  291. flex: 1;
  292. .line {
  293. width: 2rpx;
  294. height: 44rpx;
  295. background: #00A9FF;
  296. }
  297. }
  298. .btn {
  299. column-gap: 8rpx;
  300. font-size: 24rpx;
  301. color: #181818;
  302. .icon {
  303. width: 64rpx;
  304. height: auto;
  305. }
  306. }
  307. }
  308. .list {
  309. margin-top: 32rpx;
  310. background: #FFFFFF;
  311. border: 2rpx solid #F0F0F0;
  312. border-radius: 24rpx;
  313. overflow: hidden;
  314. &-item {
  315. margin-top: 16rpx;
  316. padding: 16rpx 32rpx;
  317. font-size: 28rpx;
  318. color: #333333;
  319. background: #FFFFFF;
  320. border-bottom: 2rpx solid #F1F1F1;
  321. &:last-child {
  322. border: none;
  323. }
  324. .col {
  325. flex: 1;
  326. text-align: center;
  327. }
  328. .info {
  329. justify-content: flex-start;
  330. column-gap: 24rpx;
  331. .avatar {
  332. width: 72rpx;
  333. height: 72rpx;
  334. border-radius: 50%;
  335. overflow: hidden;
  336. .img {
  337. width: 100%;
  338. height: 100%;
  339. }
  340. }
  341. }
  342. .desc {
  343. font-size: 26rpx;
  344. color: #A3A3A3;
  345. }
  346. }
  347. }
  348. </style>