index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="acea-row nav" v-show="(nav !== 3)">
  4. <view class="acea-row row-center-wrapper" :class="{ on: nav === 1 }" @click="navTab(1)">{{partnerStr}}
  5. </view>
  6. <!-- <view class="acea-row row-center-wrapper" :class="{ on: nav === 2 }" @click="navTab(2)">{{ $t(`绑定记录`) }}
  7. </view> -->
  8. </view>
  9. <view v-show="(nav === 2)" class="record-wrapper">
  10. <u-cell-group>
  11. <u-cell v-for="(item, index) in invoiceList" :key="index">
  12. <view slot="title" class="u-slot-title">
  13. <u--text mode="name" :text="item.userName" bold></u--text>
  14. <u--text :text="('前上级:' + item.beforeParentName)" size="12"></u--text>
  15. <u--text :text="('现上级:' + item.afterParentName)" size="12"></u--text>
  16. </view>
  17. <view slot="right-icon" style="margin-top: 20px">
  18. <u--text :text="item.typeMsg" bold align="right"></u--text>
  19. <u--text :text="item.updateTime" size="12"></u--text>
  20. </view>
  21. </u-cell>
  22. </u-cell-group>
  23. <view v-show="page === 2 && !invoiceList.length" class="nothing">
  24. <image :src="imgHost + '/statics/images/noInvoice.png'"></image>
  25. <view>{{ $t(`没有绑定信息哟~`) }}</view>
  26. </view>
  27. </view>
  28. <view v-show="(nav === 1)">
  29. <view class="list">
  30. <u-grid :border="true" col="2" @click="click">
  31. <u-grid-item v-for="(listItem, listIndex) in list" :key="listIndex">
  32. <text class="grid-text">{{ (listItem.title) }}{{ listIndex == 0 ? ' >' : '' }}</text>
  33. <text class="grid-text-amount">{{ listItem.count }}{{ listIndex <= 1 ? '元' : '' }}</text>
  34. </u-grid-item>
  35. </u-grid>
  36. <view class="imageUrl">
  37. <view class="imageUrlin" v-if="url">
  38. <ayQrcode ref="qrcode" qrcode_id="qrcode" :modal="modal_qr" :url="url" @hideQrcode="hideQrcode"
  39. :height="qr_height" :width="qr_width" />
  40. <!-- <u--image src="https://cdn.uviewui.com/uview/album/1.jpg" height="200px" width="100%"
  41. :showLoading="true">
  42. <view slot="error" style="font-size: 24rpx;">加载失败</view>
  43. </u--image> -->
  44. </view>
  45. </view>
  46. </view>
  47. <!-- <view v-show="page === 2 && !invoiceList.length" class="nothing">
  48. <image :src="imgHost + '/statics/images/noInvoice.png'"></image>
  49. <view>{{ $t(`没有消费商信息哟~`) }}</view>
  50. </view> -->
  51. <!-- <button v-if="isGongFu" class="add-link" :url="`/pages/goods_details/index?id=${gongFuId}&zoneType=8`">
  52. {{ $t(`邀请用户立即参与`) }}</button> -->
  53. <button v-if="isGongFu" class="add-link" open-type="share">
  54. {{ $t(`邀请用户立即参与`) }}</button>
  55. <navigator v-else class="add-link" :url="`/pages/goods/goods_list_mall/index?zoneType=8&title=共富1580`">
  56. {{ $t(`邀请用户立即参与`) }}</navigator>
  57. </view>
  58. <view v-show="(nav === 3)">
  59. <view class="list-nav3">
  60. <u-empty mode="permission" text="您还未参与共富1580" icon="http://cdn.uviewui.com/uview/empty/permission.png"
  61. :height="600">
  62. </u-empty>
  63. </view>
  64. <navigator v-if="isGongFu" class="add-link" :url="`/pages/goods_details/index?id=${gongFuId}&zoneType=8`">
  65. {{ $t(`立即参与`) }}</navigator>
  66. <navigator v-else class="add-link" :url="`/pages/goods/goods_list_mall/index?zoneType=8&title=共富1580`">
  67. {{ $t(`立即参与`) }}</navigator>
  68. </view>
  69. <!-- #ifndef MP -->
  70. <home></home>
  71. <!-- #endif -->
  72. </view>
  73. </template>
  74. <script>
  75. import ayQrcode from "@/components/ay-qrcode/ay-qrcode.vue"
  76. import home from '@/components/home';
  77. import {
  78. mapGetters
  79. } from "vuex";
  80. import {
  81. invoiceList,
  82. invoiceDelete,
  83. getUserInfo
  84. } from '@/api/user.js';
  85. import {
  86. postStatistics,
  87. linkedBindLogList,
  88. getGoodsInfo,
  89. postLinkedUrl
  90. } from '@/api/home.js';
  91. import {
  92. orderInvoiceList
  93. } from '@/api/order.js';
  94. import colors from '@/mixins/color.js';
  95. import { HTTP_REQUEST_URL } from '@/config/app';
  96. export default {
  97. components: {
  98. home,
  99. ayQrcode
  100. },
  101. mixins: [colors],
  102. data() {
  103. return {
  104. //二维码相关参数
  105. modal_qr: false,
  106. url: '', // 要生成的二维码值
  107. partnerStr: '',
  108. list: [{
  109. name: 'photo',
  110. title: '累计收益',
  111. count: 0
  112. },
  113. {
  114. name: 'lock',
  115. title: '今日收益',
  116. count: 0
  117. },
  118. {
  119. name: 'star',
  120. title: '直属伙伴',
  121. count: 0
  122. },
  123. {
  124. name: 'hourglass',
  125. title: '团队伙伴',
  126. count: 0
  127. },
  128. {
  129. name: 'home',
  130. title: '我的幸运数',
  131. count: 0
  132. },
  133. {
  134. name: 'star',
  135. title: '当前幸运数',
  136. count: 0
  137. },
  138. ],
  139. imgHost: HTTP_REQUEST_URL,
  140. orderList: [],
  141. invoiceList: [],
  142. nav: 1, // 1:发票记录 2:抬头管理
  143. page: 1,
  144. limit: 300,
  145. where: {
  146. zoneType: 8,
  147. current: 1,
  148. size: 20,
  149. },
  150. loading: false,
  151. finished: false,
  152. specialInvoice: true,
  153. storeInfo: {},
  154. promotionShare: '',
  155. isGongFu: true,
  156. gongFuId: true,
  157. qr_height: 200,
  158. qr_width: 200,
  159. };
  160. },
  161. watch: {
  162. nav: {
  163. immediate: true,
  164. handler(value) {
  165. this.page = 1;
  166. switch (value) {
  167. case 1:
  168. this.orderList = [];
  169. this.getStatistics();
  170. break;
  171. case 2:
  172. this.invoiceList = [];
  173. this.getInvoiceList();
  174. break;
  175. }
  176. }
  177. }
  178. },
  179. computed: mapGetters(['isLogin']),
  180. /**
  181. * 用户点击右上角分享
  182. */
  183. onShareAppMessage: function (res) {
  184. let userInfo = this.$Cache.get("USER_INFO", true)
  185. let that = this;
  186. return {
  187. title: userInfo.realName + "邀请您购买共富1580商品",
  188. imageUrl: "http://wine.gzzzyd.com/test/static/img/bg.a82f9752.jpg" || that.storeInfo.image,
  189. path: "/pages/goods_details/index?id=" + that.gongFuId + "&inviteCode=" + that.promotionShare
  190. +"&zoneType=8",
  191. };
  192. },
  193. onLoad(option) {
  194. let that = this
  195. if (option.from === 'invoice_form') {
  196. this.nav = 2;
  197. }
  198. uni.getSystemInfo({
  199. success: function (res) {
  200. that.qr_width = res.windowWidth * 0.4
  201. that.qr_height = res.windowWidth * 0.4
  202. },
  203. });
  204. this.getStatistics();
  205. },
  206. methods: {
  207. // 展示二维码
  208. showQrcode() {
  209. let _this = this;
  210. this.modal_qr = true;
  211. // uni.showLoading()
  212. setTimeout(function () {
  213. // uni.hideLoading()
  214. _this.$refs.qrcode.crtQrCode()
  215. }, 50)
  216. },
  217. //传入组件的方法
  218. hideQrcode() {
  219. this.modal_qr = false;
  220. },
  221. click(index) {
  222. if (index == 0) {
  223. uni.navigateTo({
  224. url: '/pages/users/user_earningsCount/index'
  225. })
  226. }
  227. if (index == 2) {
  228. uni.navigateTo({
  229. url: '/pages/users/user_directPartner/index'
  230. })
  231. }
  232. },
  233. getStatistics() {
  234. let that = this
  235. uni.showLoading({
  236. title: this.$t(`加载中`)
  237. });
  238. postStatistics({
  239. userId: this.$store.state.app.uid
  240. }
  241. ).then(res => {
  242. uni.hideLoading();
  243. if (res.data.isPartner == -1) {
  244. this.nav = 3
  245. } else {
  246. this.list[0].count = res.data.earningsCount || 0
  247. this.list[1].count = res.data.todayEarnings || 0
  248. this.list[2].count = res.data.oneCount || 0
  249. this.list[3].count = res.data.twoCount || 0
  250. this.list[4].count = res.data.sort || 0
  251. this.list[5].count = res.data.outSort || 0
  252. this.partnerStr = res.data.partnerStr
  253. this.specialInvoice = true
  254. if (res.data.sheraUrl) {
  255. this.url = res.data.sheraUrl
  256. this.showQrcode()
  257. }
  258. }
  259. });
  260. getGoodsInfo(that.where).then(res => {
  261. let list = res.data;
  262. if (that.where.zoneType == 8 && list.length == 1) {
  263. // 自动跳转共富1580商品详情参数准备
  264. that.gongFuId = list[0].id
  265. that.storeInfo = list[0]
  266. that.isGongFu = true
  267. // that.godDetail(list[0])
  268. } else {
  269. that.isGongFu = false
  270. }
  271. })
  272. postLinkedUrl().then(res => {
  273. this.promotionShare = res.data.promotionNo
  274. })
  275. },
  276. // 菜单切换
  277. navTab(nav) {
  278. if (this.nav !== nav) {
  279. this.nav = nav;
  280. }
  281. },
  282. // 记录列表
  283. getOrderList() {
  284. uni.showLoading({
  285. title: this.$t(`加载中`)
  286. });
  287. orderInvoiceList({
  288. page: this.page,
  289. limit: this.limit
  290. }).then(res => {
  291. const {
  292. data
  293. } = res;
  294. uni.hideLoading();
  295. this.orderList = this.orderList.concat(data);
  296. this.finished = data.length < this.limit;
  297. this.page += 1;
  298. }).catch(err => {
  299. uni.showToast({
  300. title: err.msg,
  301. icon: 'none'
  302. });
  303. });
  304. },
  305. // 发票列表
  306. getInvoiceList() {
  307. uni.showLoading({
  308. title: this.$t(`加载中`)
  309. });
  310. linkedBindLogList({
  311. userId: this.$store.state.app.uid,
  312. current: this.page,
  313. size: this.limit
  314. }).then(res => {
  315. const {
  316. data
  317. } = res;
  318. uni.hideLoading();
  319. this.invoiceList = this.invoiceList.concat(data);
  320. this.finished = data.length < this.limit;
  321. this.page += 1;
  322. }).catch(err => {
  323. uni.showToast({
  324. title: err.msg,
  325. icon: 'none'
  326. });
  327. });
  328. },
  329. // 编辑发票
  330. editInvoice(id) {
  331. uni.navigateTo({
  332. url: `/pages/users/user_invoice_form/index?id=${id}`
  333. });
  334. },
  335. // 删除发票
  336. deleteInvoice(id) {
  337. let that = this;
  338. uni.showModal({
  339. content: that.$t(`删除该发票?`),
  340. confirmColor: '#E93323',
  341. success(res) {
  342. if (res.confirm) {
  343. invoiceDelete(id).then(() => {
  344. that.$util.Tips({
  345. title: that.$t(`删除成功`),
  346. icon: 'success'
  347. }, () => {
  348. let index = that.invoiceList.findIndex(value => {
  349. return value.id == id;
  350. });
  351. that.invoiceList.splice(index, 1);
  352. });
  353. }).catch(err => {
  354. return that.$util.Tips({
  355. title: err
  356. });
  357. });
  358. }
  359. }
  360. });
  361. }
  362. }
  363. }
  364. </script>
  365. <style lang="scss" scoped>
  366. .imageUrl {
  367. margin-top: 30px;
  368. width: 100%;
  369. height: 100%;
  370. background-color: white;
  371. }
  372. .imageUrlin {
  373. width: 50%;
  374. height: 200px;
  375. margin-left: auto;
  376. margin-right: auto;
  377. }
  378. .grid-text {
  379. font-size: 16px;
  380. color: #3b3c3d;
  381. padding: 20rpx 20px 20rpx 0rpx;
  382. /* #ifndef APP-PLUS */
  383. box-sizing: border-box;
  384. /* #endif */
  385. }
  386. .grid-text-amount {
  387. font-size: 16px;
  388. color: #d82a64;
  389. padding: 10rpx 20px 20rpx 0rpx;
  390. /* #ifndef APP-PLUS */
  391. box-sizing: border-box;
  392. /* #endif */
  393. }
  394. .nav {
  395. position: fixed;
  396. top: 0;
  397. left: 0;
  398. z-index: 9;
  399. width: 100%;
  400. height: 90rpx;
  401. background-color: #FFFFFF;
  402. }
  403. .nav .acea-row {
  404. flex: 1;
  405. border-top: 3rpx solid transparent;
  406. border-bottom: 3rpx solid transparent;
  407. font-size: 30rpx;
  408. color: #282828;
  409. }
  410. .nav .on {
  411. border-bottom-color: var(--view-theme);
  412. color: var(--view-theme);
  413. }
  414. .list {
  415. padding: 14rpx 32rpx;
  416. margin-top: 90rpx;
  417. margin-bottom: 140rpx;
  418. background-color: white;
  419. }
  420. .list-nav3 {
  421. margin-top: 2rpx;
  422. height: 1200px;
  423. background-image: url('http://wine.gzzzyd.com/test/static/img/bg.a82f9752.jpg');
  424. }
  425. .list .item {
  426. padding: 28rpx 32rpx;
  427. background-color: #FFFFFF;
  428. }
  429. .list .item~.item {
  430. margin-top: 14rpx;
  431. }
  432. .list .item-hd .acea-row {
  433. flex: 1;
  434. min-width: 0;
  435. }
  436. .list .name {
  437. font-weight: 600;
  438. font-size: 30rpx;
  439. color: #282828;
  440. }
  441. .list .label {
  442. width: 56rpx;
  443. height: 28rpx;
  444. border: 1rpx solid var(--view-theme);
  445. margin-left: 18rpx;
  446. font-size: 20rpx;
  447. line-height: 26rpx;
  448. text-align: center;
  449. color: var(--view-theme);
  450. }
  451. .list .type {
  452. // width: 172rpx;
  453. height: 42rpx;
  454. margin-left: 30rpx;
  455. background-color: #FCF0E0;
  456. font-size: 24rpx;
  457. line-height: 42rpx;
  458. text-align: center;
  459. color: #D67300;
  460. }
  461. .list .type.special {
  462. background-color: #FDE9E7;
  463. color: #E93323;
  464. }
  465. .list .item-bd {
  466. margin-top: 18rpx;
  467. }
  468. .list .cell {
  469. font-size: 26rpx;
  470. color: #666666;
  471. }
  472. .list .cell~.cell {
  473. margin-top: 12rpx;
  474. }
  475. .list .item-ft {
  476. margin-top: 11rpx;
  477. }
  478. .list .btn {
  479. font-size: 26rpx;
  480. color: #282828;
  481. cursor: pointer;
  482. }
  483. .list .btn~.btn {
  484. margin-left: 35rpx;
  485. }
  486. .list .btn .iconfont {
  487. margin-right: 10rpx;
  488. font-size: 24rpx;
  489. color: #000000;
  490. }
  491. .add-link {
  492. position: fixed;
  493. right: 30rpx;
  494. bottom: 33rpx;
  495. left: 30rpx;
  496. height: 86rpx;
  497. border-radius: 43rpx;
  498. background-color: var(--view-theme);
  499. font-size: 30rpx;
  500. line-height: 86rpx;
  501. text-align: center;
  502. color: #FFFFFF;
  503. .iconfont {
  504. margin-right: 14rpx;
  505. font-size: 28rpx;
  506. }
  507. }
  508. .nothing {
  509. margin-top: 254rpx;
  510. font-size: 26rpx;
  511. text-align: center;
  512. color: #999999;
  513. .image {
  514. width: 400rpx;
  515. height: 260rpx;
  516. margin-bottom: 20rpx;
  517. }
  518. }
  519. .record-wrapper {
  520. margin-top: 90rpx;
  521. background-color: white;
  522. .item {
  523. padding-right: 30rpx;
  524. padding-left: 30rpx;
  525. border-radius: 6rpx;
  526. margin: 30rpx;
  527. background-color: #FFFFFF;
  528. .item-hd {
  529. padding-top: 36rpx;
  530. padding-bottom: 36rpx;
  531. .image {
  532. width: 78rpx;
  533. height: 78rpx;
  534. border-radius: 6rpx;
  535. }
  536. .text {
  537. flex: 1;
  538. display: -webkit-box;
  539. -webkit-box-orient: vertical;
  540. -webkit-line-clamp: 2;
  541. overflow: hidden;
  542. margin-left: 24rpx;
  543. font-size: 26rpx;
  544. line-height: 37rpx;
  545. color: #282828;
  546. }
  547. }
  548. .item-bd {
  549. padding: 26rpx 30rpx 25rpx 32rpx;
  550. border-radius: 20rpx;
  551. background-color: #F5F6F7;
  552. font-size: 26rpx;
  553. line-height: 37rpx;
  554. color: #818181;
  555. .name {
  556. margin-bottom: 8rpx;
  557. font-weight: bold;
  558. font-size: 26rpx;
  559. color: #282828;
  560. }
  561. .money {
  562. font-weight: bold;
  563. font-size: 24rpx;
  564. color: #282828;
  565. .num {
  566. font-size: 32rpx;
  567. }
  568. }
  569. }
  570. .item-ft {
  571. padding-top: 30rpx;
  572. padding-bottom: 30rpx;
  573. font-weight: bold;
  574. font-size: 28rpx;
  575. color: #282828;
  576. .link {
  577. width: 150rpx;
  578. height: 57rpx;
  579. border: 1rpx solid #707070;
  580. border-radius: 29rpx;
  581. font-weight: normal;
  582. font-size: 26rpx;
  583. line-height: 57rpx;
  584. text-align: center;
  585. color: #282828;
  586. }
  587. }
  588. }
  589. }
  590. </style>