index.vue 3.9 KB

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