index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="page" :style="{'height':windowHeight}">
  3. <view class="flex-col" v-if="!equityList">
  4. <view class="flex-row justify-center">
  5. <image class="empty" src="/static/imageIcon/empty.png" mode="widthFix"></image>
  6. </view>
  7. <view class="emptyText flex-row justify-center">
  8. <text>暂无内容</text>
  9. </view>
  10. </view>
  11. <view v-else>
  12. <view class="flex-row">
  13. <view class="flex-col justify-center" @click="noUseChange">
  14. <u-icon v-if="noUse" name="checkmark-circle-fill" color="#38db38" size="25" ></u-icon>
  15. <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
  16. </view>
  17. <view class="noUse">
  18. <text>不使用权益券</text>
  19. </view>
  20. </view>
  21. <view :style="{'height':scrollViewHeight}">
  22. <scroll-view class="scroll " :style="{'height':scrollViewHeight}" scroll-y>
  23. <view class="row-list flex-row justify-start" :class="{'grayscale' :item.serviceProjectId.indexOf(serviceProjectId) === -1 || serviceObjectId != item.serviceObjectId }" v-for="(item,index) in equityList" @click="clickCoupons(item,index)" :key="index">
  24. <view class="h-text flex-col justify-center ">
  25. <view class="money">
  26. <text>¥{{item.faceValue}}</text>
  27. </view>
  28. <!-- <view class="desc">-->
  29. <!-- <text>{{item.name}}</text>-->
  30. <!-- </view>-->
  31. </view>
  32. <view class="h-center-content flex-col ">
  33. <view class="h-value">
  34. <text>{{item.title}}</text>
  35. </view>
  36. <view class="title">
  37. 适用项目:{{item.serviceProjectName || ''}}
  38. </view>
  39. <view class="title">
  40. 绑定对象:{{item.serviceObjectName}}
  41. </view>
  42. <view class="title">
  43. 结束期限:{{item.effectiveEndTime.substring(0,10)}}
  44. </view>
  45. </view>
  46. <view class="h-right-content flex-col justify-center">
  47. <view class="flex-row justify-center" v-if="item.serviceProjectId.indexOf(serviceProjectId) === -1 || serviceObjectId != item.serviceObjectId ">
  48. <view class="h-btn-img">
  49. <image class="h-btn-img" src="/static/coupon/u2110.png" mode=""></image>
  50. </view>
  51. </view>
  52. <view class="flex-row justify-center" v-else>
  53. <u-icon v-if="item.isUse " name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  54. <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
  55. </view>
  56. </view>
  57. </view>
  58. </scroll-view>
  59. </view>
  60. <view>
  61. <view class="btn" @click="useCoupons">
  62. <text>确定</text>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. equityList:[],
  73. noUse:true,
  74. windowHeight:'',
  75. scrollViewHeight:'',
  76. serviceObjectId:'',
  77. serviceProjectId:'',
  78. };
  79. },
  80. onLoad(e) {
  81. this.serviceProjectId = e.serviceProjectId
  82. this.serviceObjectId = e.serviceObjectId
  83. let sysInfo = uni.getSystemInfoSync()
  84. this.windowHeight =sysInfo.windowHeight +'px'
  85. this.scrollViewHeight =sysInfo.windowHeight -(sysInfo.windowWidth/750)*252 +'px'
  86. this.myEquityCardList()
  87. },
  88. computed: {
  89. },
  90. methods: {
  91. useCoupons(){
  92. let equitys = []
  93. for (const equity of this.equityList) {
  94. if (equity.isUse){
  95. equitys.push(equity)
  96. }
  97. }
  98. uni.$emit('getEquity',equitys)
  99. uni.navigateBack({
  100. data:1
  101. })
  102. },
  103. noUseChange(){
  104. this.noUse = !this.noUse
  105. if (this.noUse){
  106. this.equityList.forEach(item=>{
  107. item.isUse = false
  108. })
  109. }
  110. },
  111. clickCoupons(item,index){
  112. if (item.serviceProjectId.indexOf(this.serviceProjectId) === -1 || this.serviceObjectId != item.serviceObjectId){
  113. return
  114. }
  115. //关闭多选开始
  116. this.equityList.forEach(item=>{
  117. item.isUse = false
  118. })
  119. //关闭多选结束
  120. console.log(item)
  121. this.noUse = false
  122. item.isUse = !item.isUse
  123. this.$set(this.equityList,index,item)
  124. let flag = true
  125. this.equityList.forEach(item=>{
  126. if (item.isUse){
  127. flag = false
  128. }
  129. })
  130. this.noUse = flag
  131. },
  132. myEquityCardList(){
  133. this.$api.myEquityCardList().then(res=>{
  134. console.log(res)
  135. this.equityList = res.data.data
  136. })
  137. },
  138. },
  139. };
  140. </script>
  141. <style lang="scss" scoped>
  142. @import '/common/css/common.css';
  143. @import './index.rpx.scss';
  144. </style>