index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <view class="page">
  3. <view class="scroll-y">
  4. <view class="title">
  5. <text>我收到的亲情卡</text>
  6. </view>
  7. <view class="loveCard" v-if="gotList.length === 0">
  8. <view class="flex-row justify-center">
  9. <image src="/static/me/zhanwu.png" class="nullIcon"></image>
  10. </view>
  11. <view class="flex-row justify-center nullMsg">
  12. <text>暂无收到的亲情卡</text>
  13. </view>
  14. </view>
  15. <view v-else>
  16. <view class="loveCard" v-for="(item,index) in gotList" :key="index" @click="jumpToDetail(item)">
  17. <image src="/static/familyCard/shoudaoLove.png" class="imgBack"></image>
  18. <view class="loveCardMsg">
  19. <view class="flex-row">
  20. <view>
  21. <image :src="item.url || '/static/me/ud4.png'" class="avatar"></image>
  22. </view>
  23. <view class="flex-col">
  24. <text class="name">{{item.presentUserName}}</text>
  25. <text class="vipNo">{{item.presentUserNo}}</text>
  26. </view>
  27. </view>
  28. <view class="flex-row justify-between">
  29. <view class="flex-col priceView">
  30. <text class="priceTitle">可用额度</text>
  31. <view>
  32. <!--<text class="priceSymbol">¥</text>-->
  33. <text class="price">{{item.totalBalance || 0}}</text>
  34. </view>
  35. </view>
  36. <view class="flex-col priceView borderRight1">
  37. <text class="priceTitle">已用额度</text>
  38. <view>
  39. <!--<text class="priceSymbol">¥</text>-->
  40. <text class="price">{{item.amount || 0}}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="title">
  48. <text>我赠送的亲情卡</text>
  49. </view>
  50. <view class="loveCard" v-if="giveList.length === 0">
  51. <view class="flex-row justify-center">
  52. <image src="/static/me/zhanwu.png" class="nullIcon"></image>
  53. </view>
  54. <view class="flex-row justify-center nullMsg">
  55. <text>暂无赠送的亲情卡</text>
  56. </view>
  57. </view>
  58. <view v-else>
  59. <view class="loveCard" v-for="(item, index) in giveList" :key="index" @click="jumpToDetail(item)">
  60. <image src="/static/familyCard/zengsLove.png" class="imgBack"></image>
  61. <view class="loveCardMsg">
  62. <view class="flex-row">
  63. <view>
  64. <image :src="item.url || '/static/me/ud4.png'" class="avatar"></image>
  65. </view>
  66. <view class="flex-col">
  67. <text class="name">{{item.userName}}</text>
  68. <text class="vipNo">{{item.userNo}}</text>
  69. </view>
  70. </view>
  71. <view class="flex-row justify-between">
  72. <view class="flex-col priceView">
  73. <text class="priceTitle">可用额度</text>
  74. <view>
  75. <!--<text class="priceSymbol">¥</text>-->
  76. <text class="price">{{item.totalBalance || 0}}</text>
  77. </view>
  78. </view>
  79. <view class="flex-col priceView borderRight2">
  80. <text class="priceTitle">已用额度</text>
  81. <view>
  82. <!--<text class="priceSymbol">¥</text>-->
  83. <text class="price">{{item.amount || 0}}</text>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="bottom">
  92. <view class="flex-row justify-center agreementView">
  93. <u-icon name="/static/me/o1.png" size="20" v-if="choose" @click="changeChoose"></u-icon>
  94. <u-icon name="/static/me/o.png" size="20" v-else @click="changeChoose"></u-icon>
  95. <text class="read">我已阅读并同意</text>
  96. <text class="agreement" @click="gotoAgreement">使用说明</text>
  97. </view>
  98. <view class="zsBtn" @click="jumpToGive">赠送亲情卡</view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. export default {
  104. name: "index",
  105. data() {
  106. return {
  107. choose: false,
  108. giveList: [],
  109. gotList: []
  110. }
  111. },
  112. onShow() {
  113. this.getGiveList()
  114. this.getGotList()
  115. },
  116. onPullDownRefresh() {
  117. this.getGiveList()
  118. this.getGotList()
  119. uni.stopPullDownRefresh()
  120. },
  121. methods: {
  122. changeChoose() {
  123. this.choose = !this.choose
  124. },
  125. // 去协议页面
  126. gotoAgreement(type, name) {
  127. uni.navigateTo({
  128. url: '/myPages/TermsOfService/index?name=' + name + '&type=' + type,
  129. })
  130. },
  131. jumpToGive() {
  132. if (!this.choose) {
  133. uni.showToast({
  134. icon: 'none',
  135. duration: 3000,
  136. title: '请勾选使用说明'
  137. });
  138. } else {
  139. uni.navigateTo({
  140. url: '/myPages/familyCard/giveFamilyCard/giveFamilyCard'
  141. })
  142. }
  143. },
  144. jumpToDetail(item) {
  145. uni.navigateTo({
  146. url: '/myPages/familyCard/unbindFamilyCard/unbindFamilyCard?data=' + JSON.stringify(item)
  147. })
  148. },
  149. getImgUrlByOssId(list, number) {
  150. if (list) {
  151. list.forEach((e) => {
  152. let data = null
  153. if (number == 1) {
  154. data = e.presentUserPhoto
  155. } else {
  156. data = e.userPhoto
  157. }
  158. if (data) {
  159. this.$api.getImage(data).then(res => {
  160. e.url = res.data.data[0].url.replace(/^http:/, "https:")
  161. });
  162. }
  163. })
  164. this.$forceUpdate()
  165. }
  166. },
  167. getGiveList() {
  168. this.$api.getMyPresentList().then((res) => {
  169. this.giveList = res.data.data
  170. this.getImgUrlByOssId(this.giveList, 1)
  171. })
  172. },
  173. getGotList() {
  174. this.$api.getMyReceiveList().then((res) => {
  175. this.gotList = res.data.data
  176. this.getImgUrlByOssId(this.giveList, 2)
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style scoped lang="scss">
  183. @import "../familyCard/index.scss";
  184. </style>