invite-new-user.vue 13 KB

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