ledger.vue 13 KB

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