index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. <template>
  2. <view class="ledger-container">
  3. <JHeader title="推广中心" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view class="top-bg"></view>
  5. <view class="top-bar">
  6. <text class="textCenter">佣金明细</text>
  7. <text class="linkRight">提现记录</text>
  8. </view>
  9. <!-- 主体 -->
  10. <view class="container">
  11. <!-- 帐号 -->
  12. <view v-if="userType == '0'" class="account">
  13. <image class="avatar" :src="common.seamingImgUrl(userInfo.headImage)" alt=""></image>
  14. <view class="name">
  15. <text class="UserName">{{ platformShopData.shopName }}</text>
  16. <span class="UserAccount">商家代号:{{ platformShopData.shopCode }}</span>
  17. </view>
  18. </view>
  19. <view v-else class="account">
  20. <image class="avatar" :src="common.seamingImgUrl(userInfo.headImage)" alt=""></image>
  21. <view class="name">
  22. <text class="UserName">{{ platformUserData.name }}</text>
  23. <span class="UserAccount">策划师代号:{{ platformUserData.username }}</span>
  24. </view>
  25. </view>
  26. <!-- 信息面板 -->
  27. <view class="info-panel">
  28. <view class="infoBox">
  29. <view class="infoItem">
  30. <p>
  31. 粉丝人数
  32. </p>
  33. <span>
  34. {{ userListData.userNum || '0.00' }}<span v-if="userListData.toDayCount > 0" class="todayCount">
  35. +{{
  36. userListData.toDayCount }}
  37. </span>
  38. </span>
  39. <a href="#">查看详情</a>
  40. </view>
  41. <view class="infoItem">
  42. <p>
  43. 佣金余额
  44. </p>
  45. <!-- <span v-if="commissionData.commissionToday > 0 && typeOf(commissionData) !== 'object'" class="todayCount">+{{ commissionData.commissionToday }}</span> -->
  46. <span>{{ commissionData.userCommission.totalAmount || '0.00' }}</span>
  47. <a href="#">去提现</a>
  48. </view>
  49. <view class="infoItem">
  50. <p>
  51. 今日收入(元)
  52. </p>
  53. <span>{{ typeof commissionData.commissionToday === 'object' ? 0.00 : commissionData.commissionToday }}</span>
  54. </view>
  55. <view class="infoItem">
  56. <p>
  57. 累计收入(元)
  58. </p>
  59. <span>{{ commissionData.userCommission.remainAmount }}</span>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 图表 -->
  64. <view class="chart">
  65. <view class="now">{{ new Date().toLocaleDateString() + ' ' + new Date().toLocaleTimeString("en-GB") }}</view>
  66. <view class="type">
  67. <span :class="type == 1 ? 'on' : ''" @click="type = 1">佣金流水</span>
  68. <span :class="type == 2 ? 'on' : ''" @click="type = 2">粉丝列表</span>
  69. </view>
  70. <view id="chart" class="Records">
  71. <view v-if="type == 1" class="RecordsTbaleOne">
  72. <tui-time-axis>
  73. <tui-timeaxis-item v-for="item in commissionData.commissionRecord" :key="item.orderSn">
  74. <template #content>
  75. <view>
  76. <view class="order-title">订单编号: {{ item.orderSn }}</view>
  77. <view class="order-desc">来源: {{ getTpye(item.type) }}, 入账额度: + {{ item.amount }}</view>
  78. <view class="order-time">{{ item.createTime }}</view>
  79. </view>
  80. </template>
  81. </tui-timeaxis-item>
  82. </tui-time-axis>
  83. </view>
  84. <!-- 预留给echarts图表的位置,需要兼容性,后续开发 -->
  85. <tui-list-view v-if="type == 2">
  86. <tui-list-cell
  87. v-for="item in userListData.userList" :key="item" :arrow="false"
  88. @click="giftVoucher(item.platformUserId)"
  89. >
  90. <view slot="label" class="userName">
  91. {{ item.name }}
  92. </view>
  93. <view slot="right-icon" class="rightArrow">
  94. <span>赠送代金卷 ></span>
  95. </view>
  96. </tui-list-cell>
  97. </tui-list-view>
  98. </view>
  99. </view>
  100. <!-- 按钮 -->
  101. <view class="share">
  102. <button @click="getInfoCodeImage">立即邀请会员,赚取现金奖励</button>
  103. </view>
  104. <tui-popup :show="modelShow" mode="fade" style="background-color: rgba(0,0,0,0.4);">
  105. <view class="invitationCode">
  106. <span class="headerText">微信扫一扫</span>
  107. <image class="codeImage" :src="codeImage" mode=""></image>
  108. <view class="myname">
  109. <view class="myInfo">
  110. <view v-if="userType == '0'" class="info">昵称: {{ platformShopData.shopName }}</view>
  111. <view v-else class="info">昵称: {{ platformUserData.name }}</view>
  112. <view class="info">推广码: {{ codeData.invitationCode }}</view>
  113. </view>
  114. </view>
  115. </view>
  116. </tui-popup>
  117. <tui-popup :show="inputShow" mode="fade" style="background-color: rgba(0,0,0,0.4);">
  118. <view class="inputBox">
  119. <view class="shurukuang" style="margin-top: 45rpx;">
  120. <u-input v-model="giftNumber" type="number" :border="true" />
  121. <button class="giftButton" @click="qnmdVoucher">点击赠送</button>
  122. </view>
  123. </view>
  124. </tui-popup>
  125. </view>
  126. </view>
  127. </template>
  128. <script>
  129. import { getPlatformShopUserApi, getPlatformUserUserApi, getCommissionUserApi, getUserListUserApi, getUserInfoCodeApi, updateTransferVoucherShopHoldApi } from '../../../api/anotherTFInterface'
  130. export default {
  131. name: 'Ledger',
  132. data() {
  133. return {
  134. modelShow: false,
  135. inputShow: false,
  136. transferId: '',
  137. giftNumber: 0,
  138. codeData: {},
  139. codeImage: '',
  140. type: 1,
  141. userType: 0,
  142. userInfo: {},
  143. platformShopData: {},
  144. platformUserData: {},
  145. commissionData: {
  146. userCommission: {}
  147. },
  148. userListData: {}
  149. }
  150. },
  151. onLoad() {
  152. this.userInfo = this.$store.getters.userInfo
  153. this.userType = this.userInfo.type
  154. if (this.userType == '0') {
  155. getPlatformShopUserApi({ platformUserId: this.userInfo.platformUserId }).then((res) => { // 获取绑定的商家信息
  156. this.platformShopData = res.data
  157. })
  158. .catch((err) => {
  159. console.log(err)
  160. })
  161. } else {
  162. getPlatformUserUserApi({ platformUserId: this.userInfo.platformUserId }).then((res) => { // 绑定的策划师或分公司角色信息
  163. this.platformUserData = res.data
  164. })
  165. .catch((err) => {
  166. console.log(err)
  167. })
  168. }
  169. getCommissionUserApi({ // 用户佣金统计+记录
  170. platformUserId: this.userInfo.platformUserId,
  171. type: this.userType
  172. }).then((res) => {
  173. this.commissionData = res.data
  174. })
  175. .catch((err) => {
  176. console.log(err)
  177. })
  178. getUserListUserApi({ // 用户粉丝统计+列表
  179. platformUserId: this.userInfo.platformUserId,
  180. type: this.userType
  181. }).then((res) => {
  182. this.userListData = res.data
  183. })
  184. .catch((err) => {
  185. console.log(err)
  186. })
  187. },
  188. methods: {
  189. getTpye(typeNumber) { // (0代金券,1现金,2会员升级)
  190. const arr = ['代金卷', '现金', '会员升级']
  191. return arr[typeNumber]
  192. },
  193. getInfoCodeImage() {
  194. this.modelShow = true
  195. getUserInfoCodeApi({
  196. type: this.userType
  197. }).then((res) => {
  198. this.codeData = res.data
  199. this.codeImage = this.codeData.urlCode
  200. })
  201. },
  202. giftVoucher(ID) {
  203. this.inputShow = true
  204. this.transferId = ID
  205. },
  206. qnmdVoucher() {
  207. updateTransferVoucherShopHoldApi({
  208. buyerUserId: this.transferId,
  209. voucherNum: this.giftNumber
  210. }).then((res) => {
  211. this.giftNumber = 0
  212. console.log(res)
  213. })
  214. this.inputShow = false
  215. }
  216. }
  217. }
  218. </script>
  219. <style lang="less" scoped>
  220. * {
  221. text-decoration: none;
  222. }
  223. .ledger-container {
  224. background: linear-gradient(180deg, #ffc475 25%, #f5f5f5 36%);
  225. min-height: 100vh;
  226. box-sizing: border-box;
  227. .top-bg {
  228. // background-image: linear-gradient(#011375, #011375);
  229. background-size: 100% 100%;
  230. position: absolute;
  231. top: 60upx;
  232. left: 0;
  233. width: 100%;
  234. height: 368rpx;
  235. z-index: 1;
  236. }
  237. .top-bar {
  238. width: 100%;
  239. height: 88rpx;
  240. line-height: 88rpx;
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: center;
  244. color: #fff;
  245. padding: 0 30rpx;
  246. position: relative;
  247. z-index: 2;
  248. padding-top: 30rpx;
  249. }
  250. .top-bar .backImg {
  251. width: 80rpx;
  252. height: 70rpx;
  253. font-size: 42rpx;
  254. font-weight: bold;
  255. }
  256. .top-bar .textCenter {
  257. font-size: 36rpx;
  258. }
  259. .top-bar .linkRight {
  260. height: 88rpx;
  261. font-size: 28rpx;
  262. }
  263. .container {
  264. width: 100%;
  265. padding: 0 35rpx 0 35rpx;
  266. position: relative;
  267. z-index: 2;
  268. }
  269. /* 帐号信息 */
  270. .account {
  271. width: 100%;
  272. display: flex;
  273. align-items: center;
  274. padding-top: 40rpx;
  275. }
  276. .account .avatar {
  277. box-sizing: border-box;
  278. width: 125rpx;
  279. height: 125rpx;
  280. padding: 15rpx;
  281. border-radius: 50%;
  282. margin-right: 20rpx;
  283. background-color: #fff;
  284. }
  285. .account .name {
  286. display: flex;
  287. align-items: flex-start;
  288. flex-direction: column;
  289. justify-content: center;
  290. color: #ffffff;
  291. }
  292. .account .name .UserName {
  293. font-size: 38rpx;
  294. }
  295. .account .name .UserAccount {
  296. margin-top: 20rpx;
  297. font-size: 32rpx;
  298. }
  299. /* 信息面板 */
  300. .info-panel {
  301. width: 100%;
  302. height: auto;
  303. overflow: hidden;
  304. margin-top: 85rpx;
  305. background: #ffffff;
  306. border-radius: 15rpx;
  307. position: relative;
  308. padding-bottom: .1rpx;
  309. box-shadow: 0 0 2rpx rgba(0, 0, 0, 10rpx);
  310. margin-bottom: 65rpx;
  311. }
  312. .info-panel::before {
  313. content: "";
  314. position: absolute;
  315. z-index: 3;
  316. height: 3.05rpx;
  317. width: .01rpx;
  318. background: #f4f4f4;
  319. top: .35rpx;
  320. left: 50%;
  321. transform: translateX(-50%);
  322. }
  323. .info-panel::after {
  324. content: "";
  325. position: absolute;
  326. z-index: 3;
  327. width: 5.15rpx;
  328. height: .01rpx;
  329. background: #f4f4f4;
  330. left: .35rpx;
  331. top: 50%;
  332. transform: translateY(-50%);
  333. }
  334. .info-panel .infoBox {
  335. outline: none;
  336. list-style: none;
  337. width: 100%;
  338. display: flex;
  339. justify-content: center;
  340. align-items: center;
  341. flex-wrap: wrap;
  342. }
  343. .info-panel .infoBox .infoItem {
  344. width: 50%;
  345. height: 170rpx;
  346. display: flex;
  347. flex-direction: column;
  348. align-items: center;
  349. justify-content: flex-start;
  350. position: relative;
  351. padding-top: 38rpx;
  352. padding-bottom: 5rpx;
  353. }
  354. .info-panel .infoBox .infoItem p {
  355. font-size: 26rpx;
  356. color: #8a8a8a;
  357. display: flex;
  358. align-items: center;
  359. letter-spacing: 4rpx;
  360. }
  361. .info-panel .infoBox .infoItem p .fuckicon {
  362. width: 28rpx;
  363. height: 28rpx;
  364. margin-right: 10rpx;
  365. color: #92a9f9;
  366. position: relative;
  367. }
  368. .todayCount {
  369. position: absolute;
  370. color: red !important;
  371. font-size: 12rpx;
  372. transform: scale(0.8);
  373. top: 56rpx;
  374. left: 190rpx;
  375. }
  376. .info-panel .infoBox .infoItem span {
  377. font-size: 36rpx;
  378. font-weight: bold;
  379. color: #333;
  380. padding: 15rpx 0 5rpx 0;
  381. }
  382. .info-panel .infoBox .infoItem a {
  383. margin-top: 5rpx;
  384. font-size: 22rpx;
  385. color: #8a8a8a;
  386. }
  387. /* 图表 */
  388. .chart {
  389. width: 100%;
  390. height: auto;
  391. overflow: hidden;
  392. position: relative;
  393. padding-top: 50rpx;
  394. }
  395. .chart .Records {
  396. margin-top: 15rpx;
  397. border-radius: 15rpx;
  398. width: 100%;
  399. min-height: 660rpx;
  400. max-height: 660rpx;
  401. background-color: #fff;
  402. overflow: hidden;
  403. overflow-y: auto;
  404. }
  405. .RecordsTbaleOne {
  406. padding-left: 28rpx;
  407. padding-top: 15rpx;
  408. }
  409. .avater {
  410. width: 60rpx;
  411. height: 60rpx;
  412. }
  413. .userName {
  414. margin-top: 15rpx;
  415. margin-left: 20rpx;
  416. }
  417. .rightArrow {
  418. display: flex;
  419. align-items: center;
  420. color: #909399;
  421. }
  422. .arrow {
  423. width: 60rpx;
  424. height: 60rpx;
  425. }
  426. .chart .now {
  427. font-size: 28rpx;
  428. position: absolute;
  429. right: 0;
  430. top: 5rpx;
  431. color: #adadad;
  432. }
  433. .chart .type {
  434. position: absolute;
  435. left: 40rpx;
  436. top: 0;
  437. font-size: 28rpx;
  438. z-index: 999;
  439. }
  440. .chart .type span {
  441. margin-right: 20rpx;
  442. position: relative;
  443. padding: 0 2rpx 10rpx 2rpx;
  444. color: #8a8a8a;
  445. }
  446. .chart .type span.on {
  447. color: #021375;
  448. }
  449. .chart .type span.on::after {
  450. content: "";
  451. display: block;
  452. position: absolute;
  453. bottom: 0;
  454. left: 0;
  455. width: 100%;
  456. height: 5rpx;
  457. background: #ffc475;
  458. }
  459. /* 分享 */
  460. .share {
  461. position: fixed;
  462. bottom: 46rpx;
  463. left: 50%;
  464. width: 80%;
  465. transform: translateX(-50%);
  466. }
  467. .share button {
  468. width: 100%;
  469. height: 90rpx;
  470. line-height: 90rpx;
  471. border-radius: 90rpx;
  472. background: #ffb575;
  473. color: #ffffff;
  474. font-size: 30rpx;
  475. cursor: pointer;
  476. }
  477. .order-title {
  478. color: #333333;
  479. font-weight: bold;
  480. font-size: 32rpx;
  481. }
  482. .order-desc {
  483. margin-top: 4rpx;
  484. color: rgb(150, 150, 150);
  485. font-size: 34rpx;
  486. margin-bottom: 6rpx;
  487. }
  488. .order-time {
  489. color: rgb(200, 200, 200);
  490. font-size: 28rpx;
  491. }
  492. .invitationCode {
  493. width: 550rpx;
  494. // height: 700rpx;
  495. display: flex;
  496. flex-direction: column;
  497. align-items: center;
  498. .headerText {
  499. letter-spacing: 8rpx;
  500. margin-top: 38rpx;
  501. font-size: 45rpx;
  502. font-weight: 600;
  503. color: #ff8821;
  504. padding-bottom: 10rpx;
  505. border-bottom: 2rpx solid #ff8821;
  506. }
  507. }
  508. .codeImage {
  509. margin-top: 5rpx;
  510. width: 420rpx;
  511. height: 420rpx;
  512. }
  513. .myname {
  514. display: flex;
  515. align-items: center;
  516. justify-content: space-around;
  517. box-sizing: content-box;
  518. width: 80%;
  519. height: 100rpx;
  520. padding-bottom: 20rpx;
  521. .logoimg {
  522. width: 80rpx;
  523. height: 80rpx;
  524. }
  525. .myInfo {
  526. display: flex;
  527. flex-direction: column;
  528. justify-content: space-around;
  529. margin-left: 10rpx;
  530. .info {
  531. color: #535555e0;
  532. font-size: 30rpx;
  533. letter-spacing: 2rpx;
  534. }
  535. }
  536. }
  537. .inputBox {
  538. width: 500rpx;
  539. height: 230rpx;
  540. display: flex;
  541. flex-direction: column;
  542. align-items: center;
  543. }
  544. .giftInput {
  545. height: 40rpx;
  546. font-size: 32rpx;
  547. }
  548. .shurukuang {
  549. width: 360rpx;
  550. height: 40rpx;
  551. }
  552. /deep/ .uni-input-input {
  553. font-size: 38rpx;
  554. }
  555. .giftButton {
  556. font-size: 24rpx;
  557. font-weight: 600;
  558. margin-top: 20rpx;
  559. width: 160rpx;
  560. height: 60rpx;
  561. }
  562. }
  563. </style>