index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="box">
  3. <text 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. methods: {
  52. jumpToGive() {
  53. uni.navigateTo({
  54. url: '/myPages/familyCard/giveFamilyCard/giveFamilyCard'
  55. })
  56. },
  57. jumpToDetail(item) {
  58. uni.navigateTo({
  59. url: '/myPages/familyCard/unbindFamilyCard/unbindFamilyCard?data=' + JSON.stringify(item)
  60. })
  61. },
  62. getImgUrlByOssId(list, number) {
  63. if (list) {
  64. list.forEach((e) => {
  65. let data = null
  66. if (number == 1) {
  67. data = e.presentUserPhoto
  68. } else {
  69. data = e.userPhoto
  70. }
  71. if (data) {
  72. this.$api.getImage(data).then(res => {
  73. e.url = res.data.data[0].url.replace(/^http:/, "https:")
  74. });
  75. }
  76. })
  77. this.$forceUpdate()
  78. }
  79. },
  80. getGiveList() {
  81. this.$api.getMyPresentList().then((res) => {
  82. this.giveList = res.data.data
  83. this.getImgUrlByOssId(this.giveList, 1)
  84. })
  85. },
  86. getGotList() {
  87. this.$api.getMyReceiveList().then((res) => {
  88. this.gotList = res.data.data
  89. this.getImgUrlByOssId(this.giveList, 2)
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped>
  96. @import "/myPages/familyCard/index.scss";
  97. </style>