index.vue 8.9 KB

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