index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="box">
  3. <view v-if="giveList.length>0 || gotList.length > 0 ">
  4. <view style="margin: 32rpx 0;">
  5. <text v-if="giveList.length>0" >我收到的亲情卡</text>
  6. </view>
  7. <view class="getCard Card" v-for="item in gotList" @click="jumpToDetail(item)">
  8. <view style="display: flex;align-items: center">
  9. <u-avatar :src="item.url || '/static/me/ud4.png'"></u-avatar>
  10. <text style="margin:0 10rpx;color:#FFFFFF ">{{ item.presentUserName }}{{ item.presentUserNo }}送的亲情卡</text>
  11. </view>
  12. <view class="Lines">
  13. <view style="float: contour;margin:0 10rpx;color:#FFFFFF;text-align: center">
  14. <text >可用额度</text>
  15. <view style="font-size: 48rpx;font-weight: bold">{{ item.totalBalance || 0 }}</view>
  16. </view>
  17. <view style="float: contour;margin:0 10rpx;color:#FFFFFF;text-align: center">
  18. <text >已用额度</text>
  19. <view style="font-size: 48rpx;font-weight: bold">{{ item.amount || 0 }}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <view style="margin: 32rpx 0;">
  24. <text v-if="giveList.length>0" >我赠送的亲情卡</text>
  25. </view>
  26. <view class="postCard Card" v-for="item in giveList" @click="jumpToDetail(item)">
  27. <view style="display: flex;align-items: center">
  28. <u-avatar :src="item.url || '/static/me/ud4.png'"></u-avatar>
  29. <text style="margin:0 10rpx;">{{ item.userName }}{{ item.userNo }}</text>
  30. </view>
  31. <view class="Lines">
  32. <view style="text-align: center">
  33. <text >可用额度</text>
  34. <view style="font-size: 48rpx;font-weight: bold;text-align: center">{{ item.totalBalance || 0 }}</view>
  35. </view>
  36. <view>
  37. <text >已用额度</text>
  38. <view style="font-size: 48rpx;font-weight: bold;text-align: center">{{ item.amount || 0 }}</view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-if="giveList.length == 0 && gotList.length == 0 " style="text-align: center" >
  44. <image style="transform: scale(0.5)" src="../../static/logo.png" ></image>
  45. <h1 style="font-size: 28px;margin: 15px">亲情卡</h1>
  46. <p>让支付更简单</p>
  47. <p style="color: #b4b4b4">暂无亲情卡</p>
  48. </view>
  49. <view class="bottonStyle">
  50. <view class="agreement-content">
  51. <u-icon v-if="choose" name="/static/order/isCheck.png" color="#2979ff" size="20" @click="changeChoose"></u-icon>
  52. <u-icon v-else name="/static/order/notCheck.png" color="#01a520" size="20" @click="changeChoose"></u-icon>
  53. <view class="agreement">
  54. <text>我已阅读并同意</text>
  55. <text @click="gotoAgreement('1','会员须知')" class="text-color">使用说明</text>
  56. </view>
  57. </view>
  58. <button class="buttonStyle" @click="jumpToGive" >
  59. <text style="font-size: 18px;" >
  60. 赠送亲情卡
  61. </text>
  62. </button>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. name: "index",
  69. data() {
  70. return {
  71. choose:false,
  72. giveList: [],
  73. gotList: []
  74. }
  75. },
  76. onShow() {
  77. this.getGiveList()
  78. this.getGotList()
  79. },
  80. onPullDownRefresh(){
  81. this.getGiveList()
  82. this.getGotList()
  83. uni.stopPullDownRefresh()
  84. },
  85. methods: {
  86. changeChoose(){
  87. this.choose =!this.choose
  88. },
  89. // 去协议页面
  90. gotoAgreement(type, name) {
  91. uni.navigateTo({
  92. url: '/myPages/TermsOfService/index?name=' + name + '&type=' + type,
  93. })
  94. },
  95. jumpToGive() {
  96. if(!this.choose){
  97. uni.showToast({
  98. icon: 'none',
  99. duration: 3000,
  100. title: '请勾选使用说明'
  101. });
  102. }else {
  103. uni.navigateTo({
  104. url: '/myPages/familyCard/giveFamilyCard/giveFamilyCard'
  105. })
  106. }
  107. },
  108. jumpToDetail(item) {
  109. uni.navigateTo({
  110. url: '/myPages/familyCard/unbindFamilyCard/unbindFamilyCard?data=' + JSON.stringify(item)
  111. })
  112. },
  113. getImgUrlByOssId(list, number) {
  114. if (list) {
  115. list.forEach((e) => {
  116. let data = null
  117. if (number == 1) {
  118. data = e.presentUserPhoto
  119. } else {
  120. data = e.userPhoto
  121. }
  122. if (data) {
  123. this.$api.getImage(data).then(res => {
  124. e.url = res.data.data[0].url.replace(/^http:/, "https:")
  125. });
  126. }
  127. })
  128. this.$forceUpdate()
  129. }
  130. },
  131. getGiveList() {
  132. this.$api.getMyPresentList().then((res) => {
  133. this.giveList = res.data.data
  134. this.getImgUrlByOssId(this.giveList, 1)
  135. })
  136. },
  137. getGotList() {
  138. this.$api.getMyReceiveList().then((res) => {
  139. this.gotList = res.data.data
  140. this.getImgUrlByOssId(this.giveList, 2)
  141. })
  142. }
  143. }
  144. }
  145. </script>
  146. <style scoped >
  147. @import "/myPages/familyCard/index.scss";
  148. .agreement-content {
  149. margin: 18px;
  150. display: flex;
  151. color: #999999;
  152. align-items: center;
  153. }
  154. .text-color {
  155. color: #032574;
  156. }
  157. .agreement {
  158. color: rgb(96, 98, 102);
  159. padding: 0 20rpx;
  160. font-size: 30rpx;
  161. }
  162. </style>