invite-new-user.vue 12 KB

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