invite-new-user.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <layout title="邀请好友得现金" :isGoBack="true" padding="0">
  3. <template #right>
  4. <!-- nav right -->
  5. <img @click="onRightHandle" src="~assets/image/activity/invite-user/invite-new-user/nav-right.png" alt="">
  6. </template>
  7. <!-- 微信环境提示浏览器打开 -->
  8. <WxPopTpis v-if="isWeChatBrowser" />
  9. <!-- container -->
  10. <div v-else class="invite-container">
  11. <!-- 分享按钮 -->
  12. <van-button @click="shareHandle" class="share-btn mb-8" round />
  13. <div class="day-statistics mb-3">今日邀请注册人数:{{ registerCount }}</div>
  14. <div class="user-main pt-3 pr-3 pb-3 pl-3 mb-3">
  15. <div class="userinfo">
  16. <img class="avatar mr-1" src="~assets/image/activity/invite-user/invite-new-user/avatar.png" alt="">
  17. <div class="userinfo-text ml-1">
  18. <div class="userinfo-name">{{ nickname }}</div>
  19. </div>
  20. </div>
  21. <div class="possess-warp mb-3">
  22. <div class="withdrawal-text">可提现<span class="withdrawal-money ml-2">¥{{ withdrawalBalance }}</span></div>
  23. <div class="withdrawal-btn" :class="{'disable': withdrawalBalance < withdrawalThreshold || withdrawalBalance === 0 }" @click="()=>(withdrawalBalance >= withdrawalThreshold && withdrawalHandle())">提现</div>
  24. </div>
  25. <div class="userinfo-detail">
  26. <div class="userinfo-detail-item pt-4 pr-3 pb-3 pl-3">
  27. <div class="userinfo-detail-item-content">{{ inviteBuyAmount }}</div>
  28. <div class="userinfo-detail-item-title">累计邀请购买</div>
  29. </div>
  30. <div style="flex: 0 0 11px"></div>
  31. <div class="userinfo-detail-item pt-4 pr-3 pb-3 pl-3">
  32. <div class="userinfo-detail-item-content">{{ accumulatedWithdrawal }}</div>
  33. <div class="userinfo-detail-item-title">累计提现</div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="record-wrap">
  38. <van-tabs v-model="activeTab" shrink background="#FFFBE2">
  39. <van-tab v-for="(tab, i) in tabs" :title="tab.title" :key="i">
  40. <!-- 邀请记录 -->
  41. <RecordList
  42. v-if="activeTab === 0"
  43. class="mt-3 pr-1 pl-1 list-wrqp"
  44. :data="tab.data"
  45. :key="i"
  46. />
  47. <!-- 购买记录 -->
  48. <BuyRecordList class="mt-3 pr-1 pl-1 list-wrqp" v-if="activeTab === 1" :data="tab.data"/>
  49. <!-- 提现记录 -->
  50. <WithdrawalRecord
  51. v-if="activeTab === 2"
  52. class="mt-3 pr-1 pl-1 list-wrqp"
  53. :data="tab.data"
  54. :key="i"
  55. />
  56. <!-- 分页 -->
  57. <InvitePagination v-if="tab.total" :total="tab.total" :pageSize="tab.query.pageSize" :currentPage="tab.query.pageNum" @onPageChange="pageChangeHandle" />
  58. </van-tab>
  59. </van-tabs>
  60. </div>
  61. <!-- 分享弹窗 -->
  62. <SharePopup ref="sharePopup" :qrText="qrText" :nickname="nickname" />
  63. </div>
  64. </layout>
  65. </template>
  66. <script>
  67. !!window?.native?.goneBack && window.native.goneBack();
  68. /**
  69. * Date: 2025-4-3 oem商户拉新分佣活动
  70. */
  71. import { Dialog } from 'vant';
  72. import layout from './components/layout';
  73. import RecordList from './components/RecordList';
  74. import InvitePagination from './components/InvitePagination';
  75. import BuyRecordList from './components/BuyRecordList';
  76. import WithdrawalRecord from './components/WithdrawalRecord';
  77. import SharePopup from './components/SharePopup';
  78. import WxPopTpis from './components/WxPopTpis';
  79. export default {
  80. auth: false,
  81. name: 'OemInviteNewUser',
  82. head: {
  83. title: '邀请好友得现金',
  84. },
  85. components: { layout, RecordList, InvitePagination, BuyRecordList, WithdrawalRecord, SharePopup, WxPopTpis },
  86. data() {
  87. return {
  88. qrText: '', // 生成二维码的文本
  89. registerCount: 0, // 今日注册人数
  90. nickname: '', // 用户昵称
  91. withdrawalBalance: 0, // 可提现余额
  92. withdrawalThreshold: 0, // 提现门槛值
  93. inviteBuyAmount: 0, // 累计邀请金额
  94. accumulatedWithdrawal: 0, // 累计提现金额,
  95. // 查询参数
  96. queryData: {
  97. activityId: '', // 活动ID
  98. },
  99. activeTab: 0,
  100. tabs: [{
  101. title: '邀请记录',
  102. requireMethod: 'getInviteRecordList', // 请求定义的方法key
  103. query: {
  104. pageNum: 1, // 页码
  105. pageSize: 5, // 每页数量
  106. },
  107. data: [],
  108. total: 0,
  109. },{
  110. title: '购买记录',
  111. requireMethod: 'getInviteBuyRecordList', // 请求定义的方法key
  112. query: {
  113. pageNum: 1,
  114. pageSize: 5,
  115. },
  116. data: [],
  117. total: 0,
  118. },{
  119. title: '提现记录',
  120. requireMethod: 'getInviteBuyRecordList', // 请求定义的方法key
  121. query: {
  122. pageNum: 1,
  123. pageSize: 5,
  124. },
  125. data: [],
  126. total: 0,
  127. }],
  128. }
  129. },
  130. // 页面初始化后触发
  131. async fetch() {
  132. !!window?.native?.goneBack && window.native.goneBack();
  133. // 获取参数的token值
  134. let token = this.$route.query.token;
  135. if(!token) {return this.$toast('用户信息获取失败')}
  136. // token参数会自动被系统获取,请求接口自动带上token
  137. await this.getActivityData();
  138. await this.getInviteRecordList();
  139. await this.getInviteBuyRecordList();
  140. await this.getInviteWithdrawalRecordList();
  141. // await this.getActivityRule(this.queryData.activityId);
  142. },
  143. computed: {
  144. // 是否为微信浏览器环境
  145. isWeChatBrowser() {
  146. return this.$userAgent.isWx;
  147. }
  148. },
  149. methods: {
  150. // nav right菜单点击事件
  151. onRightHandle() {
  152. this.$router.push({ path: '/activity/invite-user/invite-new-user-rule', query: { activityId: this.queryData.activityId} })
  153. },
  154. // 分享按钮点击事件
  155. shareHandle() {
  156. this.$refs.sharePopup.showPopup();
  157. },
  158. // 分页点击事件
  159. pageChangeHandle(page) {
  160. let active = this.activeTab;
  161. this.tabs[active].query.pageNum = page;
  162. // 发起请求
  163. this[this.tabs[active].requireMethod]();
  164. },
  165. // 提现按钮点击
  166. withdrawalHandle() {
  167. Dialog.alert({
  168. message: '请到APP内-我的-联系客服提现',
  169. confirmButtonColor: '#1A96D2',
  170. });
  171. },
  172. // 获取活动页上部分数据
  173. async getActivityData() {
  174. const res = await this.$axios.$get('/activity/v5/activity/inviteNewUser/getInviteNewUserPageData');
  175. let {
  176. registerCount, // 今日注册人数
  177. nickname, // 用户昵称
  178. withdrawalBalance, // 可提现余额
  179. withdrawalThreshold, // 提现门槛值
  180. inviteBuyAmount, // 累计邀请金额
  181. activityId, // 活动ID
  182. accumulatedWithdrawal, // 累计提现金额
  183. jumpAddress, // 分享的链接
  184. } = res.data;
  185. // 页面展示数据
  186. this.registerCount = registerCount;
  187. this.nickname = nickname;
  188. this.withdrawalBalance = withdrawalBalance;
  189. this.withdrawalThreshold = withdrawalThreshold;
  190. this.inviteBuyAmount = inviteBuyAmount;
  191. this.accumulatedWithdrawal = accumulatedWithdrawal;
  192. // 查询参数
  193. this.queryData.activityId = activityId;
  194. jumpAddress;
  195. // 生成二维码的文本
  196. this.qrText = jumpAddress;
  197. },
  198. // 获取活动页好友注册记录列表
  199. async getInviteRecordList() {
  200. let {status, success, data} = await this.$axios.$post(
  201. '/activity/v5/activity/inviteNewUser/getInviteNewRegisterUserData',
  202. { ...this.queryData, ...this.tabs[0].query },
  203. );
  204. if(status === 0 && success) {
  205. this.tabs[0].data = data.list;
  206. this.tabs[0].total = data.total;
  207. }
  208. /*
  209. 友注册记录列表数据格式
  210. {
  211. id: 1,
  212. name: '1305677',
  213. phoneNumber: '13800138000',
  214. createTime: '2025-04-03 10:00:00',
  215. money: '100.00',
  216. status: '已提现',
  217. }
  218. */
  219. },
  220. // 获取活动页好友购买记录列表
  221. async getInviteBuyRecordList() {
  222. let {status, success, data} = await this.$axios.$post(
  223. '/activity/v5/activity/inviteNewUser/getInviteNewUserBuyData',
  224. { ...this.queryData, ...this.tabs[1].query },
  225. );
  226. if(status === 0 && success) {
  227. this.tabs[1].data = data.list;
  228. this.tabs[1].total = data.total;
  229. }
  230. /*
  231. 友购买记录列表数据格式
  232. {
  233. id: 1,
  234. newPhone: '13800138000',
  235. finishTime: '2025-04-03 10:00:00',
  236. totalAmount: '100.00',
  237. rakeBackAmount: '30.00',
  238. }
  239. */
  240. },
  241. // 获取活动页好友提现记录列表
  242. async getInviteWithdrawalRecordList() {
  243. let {status, success, data} = await this.$axios.$post(
  244. '/activity/v5/activity/inviteNewUser/getInviteNewUserWithdrawalRecodeList',
  245. {...this.queryData,...this.tabs[2].query },
  246. );
  247. if(status === 0 && success) {
  248. this.tabs[2].data = data.list;
  249. this.tabs[2].total = data.total;
  250. }
  251. /*
  252. 友提现记录列表数据格式
  253. {
  254. withdrawalTime: '2025-04-03 10:00:00',
  255. withdrawalMoney: '100.00',
  256. }
  257. */
  258. },
  259. // 获取邀请url地址,用于生成二维码 id: 活动ID
  260. async getActivityRule(id) {
  261. let {status, success, data} = await this.$axios.$get('/activity/activity/basic/getDetailsById',{
  262. params: { id }
  263. });
  264. if(status === 0 && success) {
  265. // 生成二维码的文本
  266. this.qrText = `${data?.activityInviteNewUser?.jumpAddress}?activityId=${id}&invitationUserName=${this.nickname}`;
  267. }
  268. }
  269. }
  270. }
  271. </script>
  272. <style lang="scss" scoped>
  273. .mb-12{
  274. margin-bottom: 12px;
  275. }
  276. // 动态生成 从 0 到 100px 的样式
  277. @for $i from 0 through 100 {
  278. .mb-#{$i} {
  279. margin-bottom: #{$i}px;
  280. }
  281. .mt-#{$i} {
  282. margin-top: #{$i}px;
  283. }
  284. .ml-#{$i} {
  285. margin-left: #{$i}px;
  286. }
  287. .mr-#{$i} {
  288. margin-right: #{$i}px;
  289. }
  290. }
  291. $-radeus-12: 12px;
  292. $-bg-yellow: rgb(255, 253, 241);
  293. .invite-container {
  294. font-size: 12px;
  295. height: 100%;
  296. width: 100%;
  297. display: flex;
  298. flex-direction: column;
  299. background-image: url('~assets/image/activity/invite-user/invite-new-user/bg-img.png');
  300. background-size: 100% auto;
  301. background-position: top;
  302. background-repeat: no-repeat;
  303. background-color: #EB3043;
  304. padding: 372px 16px 16px;
  305. .share-btn {
  306. height: 56px;
  307. // background-color: #FF505C;
  308. background-image: url('~/assets/image/activity/invite-user/invite-new-user/share-to-earn-commission.png');
  309. background-size: 100% 100%;
  310. background-repeat: no-repeat;
  311. background-position: center;
  312. background-origin: padding-box;
  313. z-index: 0;
  314. }
  315. .day-statistics{
  316. line-height: 32px;
  317. font-size: 14px;
  318. color: #FA393A;
  319. font-weight: 500;
  320. border-radius: $-radeus-12;
  321. background-color: $-bg-yellow;
  322. text-align: center;
  323. }
  324. .user-main{
  325. display: flex;
  326. flex-direction: column;
  327. background-color: $-bg-yellow;
  328. border-radius: $-radeus-12;
  329. .userinfo{
  330. display: flex;
  331. align-items: center;
  332. .avatar{
  333. width: 40px;
  334. height: 40px;
  335. border-radius: 50%;
  336. }
  337. .userinfo-text{
  338. display: flex;
  339. flex-direction: column;
  340. .userinfo-name{
  341. font-size: 14px;
  342. color: #242424;
  343. }
  344. .userinfo-id{
  345. color: #979797;
  346. }
  347. }
  348. }
  349. .possess-warp{
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. .withdrawal-text{
  354. color: #0A132B;
  355. .withdrawal-money{
  356. color: #FA393A;
  357. font-size: 24px;
  358. font-weight: bold;
  359. }
  360. }
  361. .withdrawal-btn{
  362. width: 70px;
  363. line-height: 26px;
  364. border-radius: $-radeus-12;
  365. background-color: #FA393A;
  366. color: #fff;
  367. font-size: 14px;
  368. text-align: center;
  369. &.disable{
  370. background-color: #E0E0E0;
  371. color: #979797;
  372. }
  373. }
  374. }
  375. .userinfo-detail{
  376. display: flex;
  377. align-items: center;
  378. justify-content: space-between;
  379. .userinfo-detail-item{
  380. flex: 1;
  381. display: flex;
  382. flex-direction: column;
  383. align-items: start;
  384. background-color: rgb(255, 242, 231);
  385. border-radius: 12px;
  386. .userinfo-detail-item-content{
  387. font-size: 18px;
  388. font-weight: bold;
  389. color: #242424;
  390. }
  391. .userinfo-detail-item-title{
  392. font-weight: 400;
  393. color: #979797;
  394. }
  395. }
  396. }
  397. }
  398. .record-wrap{
  399. min-height: 220px;
  400. background-color: $-bg-yellow;
  401. border-radius: $-radeus-12;
  402. overflow: hidden;
  403. }
  404. }
  405. </style>