index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="box">
  3. <text v-if="gotList.length>0" style="margin-bottom: 24rpx">我收到的亲情卡</text>
  4. <view class="getCard Card" v-for="item in gotList" @click="jumpToDetail(item)">
  5. <view style="display: flex;align-items: center">
  6. <u-avatar :src="item.url || '/static/me/ud4.png'"></u-avatar>
  7. <text style="margin:0 10rpx;color:#FFFFFF ">会员{{ item.userNo }}送的亲情卡</text>
  8. </view>
  9. <view class="Lines">
  10. <text style="float: right;margin:0 10rpx;color:#FFFFFF ">已用额度</text>
  11. <view style="font-size: 48rpx;font-weight: bold;color: #FFFFFF;text-align: center">{{ item.amount || 0 }}</view>
  12. </view>
  13. </view>
  14. <view style="display: flex;justify-content:space-between;margin: 32rpx 0;">
  15. <text>我赠送的亲情卡</text>
  16. <view style="color: #FFAF36;transform: translateY(-10rpx)" @click="jumpToGive">
  17. <image style="width: 40rpx;height: 40rpx;transform: translateY(10rpx)"
  18. src="/static/familyCard/icon-give.png"></image>
  19. <text>
  20. 赠送亲情卡
  21. </text>
  22. </view>
  23. </view>
  24. <view class="postCard Card" v-for="item in giveList" @click="jumpToDetail(item.id)">
  25. <view style="display: flex;align-items: center">
  26. <u-avatar :src="item.url || '/static/me/ud4.png'"></u-avatar>
  27. <text style="margin:0 10rpx;">会员{{ item.userNo }}送的亲情卡</text>
  28. </view>
  29. <view class="Lines">
  30. <text style="float: right;margin:0 10rpx;">已用额度</text>
  31. <view style="font-size: 48rpx;font-weight: bold;text-align: center">{{ item.amount || 0 }}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. name: "index",
  39. data() {
  40. return {
  41. giveList: [],
  42. gotList: []
  43. }
  44. },
  45. onLoad() {
  46. },
  47. onShow() {
  48. this.getGiveList()
  49. this.getGotList()
  50. },
  51. onPullDownRefresh(){
  52. this.getGiveList()
  53. this.getGotList()
  54. uni.stopPullDownRefresh()
  55. },
  56. methods: {
  57. jumpToGive() {
  58. uni.navigateTo({
  59. url: '/myPages/familyCard/giveFamilyCard/giveFamilyCard'
  60. })
  61. },
  62. jumpToDetail(item) {
  63. uni.navigateTo({
  64. url: '/myPages/familyCard/unbindFamilyCard/unbindFamilyCard?data=' + JSON.stringify(item)
  65. })
  66. },
  67. getImgUrlByOssId(list, number) {
  68. if (list) {
  69. list.forEach((e) => {
  70. let data = null
  71. if (number == 1) {
  72. data = e.presentUserPhoto
  73. } else {
  74. data = e.userPhoto
  75. }
  76. if (data) {
  77. this.$api.getImage(data).then(res => {
  78. e.url = res.data.data[0].url.replace(/^http:/, "https:")
  79. });
  80. }
  81. })
  82. this.$forceUpdate()
  83. }
  84. },
  85. getGiveList() {
  86. this.$api.getMyPresentList().then((res) => {
  87. this.giveList = res.data.data
  88. this.getImgUrlByOssId(this.giveList, 1)
  89. })
  90. },
  91. getGotList() {
  92. this.$api.getMyReceiveList().then((res) => {
  93. this.gotList = res.data.data
  94. this.getImgUrlByOssId(this.giveList, 2)
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style scoped>
  101. @import "/myPages/familyCard/index.scss";
  102. </style>