index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="page" :style="{'height':windowHeight}">
  3. <view class="flex-col" v-if="countsList.length === 0">
  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="flex-col" :class="{'grayscale' : item.reachPrice*1 >standardPrice*1 }" v-for="(item,index) in countsList" @click="clickCoupons(item,index)" :key="index">
  24. <view class="row-list flex-row justify-start">
  25. <view class="h-text flex-col justify-center ">
  26. <view class="money">
  27. <text>{{item.discountsPrice}}</text>
  28. </view>
  29. <view class="desc">
  30. <text>满{{item.reachPrice}}可用</text>
  31. </view>
  32. </view>
  33. <view class="h-center-content flex-col justify-around">
  34. <view class="h-value">
  35. <text>{{item.name}}</text>
  36. </view>
  37. <!-- <view class="title">-->
  38. <!-- 使用平台:<text v-if="item.strategyType == '0'">全平台</text>-->
  39. <!-- <text v-else-if="item.strategyType == '1'">个人优惠卷</text>-->
  40. <!-- </view>-->
  41. <view class="title">
  42. 使用次数:{{item.degree}}
  43. </view>
  44. <view class="title">
  45. 到期时间:{{item.endTime.substring(0,10)}}
  46. </view>
  47. <view class="title flex-row">
  48. <text @click.stop="showRemark(item)">使用说明</text>
  49. <u-icon v-if="item.id == showRemarkId" name="arrow-down-fill" color="" size="12"></u-icon>
  50. <u-icon v-else name="play-right-fill" color="" size="12" @click.stop="showRemark(item)"></u-icon>
  51. </view>
  52. </view>
  53. <view class="h-right-content flex-col justify-center">
  54. <view class="flex-row justify-center" v-if="item.reachPrice*1 >standardPrice*1 ">
  55. <view class="h-btn-img">
  56. <image class="h-btn-img" src="/static/coupon/u2110.png" mode=""></image>
  57. </view>
  58. </view>
  59. <view class="flex-row justify-center" v-else>
  60. <u-icon v-if="item.isUse " name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  61. <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
  62. </view>
  63. </view>
  64. </view>
  65. <view v-if="showRemarkId == item.id" class="remark">
  66. <text>{{item.remark}}</text>
  67. </view>
  68. </view>
  69. </scroll-view>
  70. </view>
  71. <view>
  72. <view class="btn" @click="useCoupons">
  73. <text>确定</text>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. export default {
  81. data() {
  82. return {
  83. showRemarkId:'',
  84. countsList:[],
  85. noUse:true,
  86. windowHeight:'',
  87. scrollViewHeight:'',
  88. standardPrice:0,
  89. };
  90. },
  91. onLoad(e) {
  92. let sysInfo = uni.getSystemInfoSync()
  93. this.windowHeight =sysInfo.windowHeight +'px'
  94. this.scrollViewHeight =sysInfo.windowHeight -(sysInfo.windowWidth/750)*252 +'px'
  95. this.getMyCouponList()
  96. if (e.standardPrice){
  97. console.log('++++++++++++++', e.standardPrice)
  98. this.standardPrice = e.standardPrice
  99. }
  100. },
  101. computed: {
  102. },
  103. methods: {
  104. showRemark(item){
  105. if (this.showRemarkId == item.id ){
  106. this.showRemarkId = ''
  107. }else {
  108. this.showRemarkId = item.id
  109. }
  110. },
  111. useCoupons(){
  112. let useCoupons = []
  113. for (const useCoupon of this.countsList) {
  114. if (useCoupon.isUse){
  115. useCoupons.push(useCoupon)
  116. }
  117. }
  118. uni.$emit('getUseCoupons',useCoupons)
  119. uni.navigateBack({
  120. data:1
  121. })
  122. },
  123. noUseChange(){
  124. this.noUse = !this.noUse
  125. if (this.noUse){
  126. this.countsList.forEach(item=>{
  127. item.isUse = false
  128. })
  129. }
  130. },
  131. clickCoupons(item,index){
  132. if (item.reachPrice*1 > this.standardPrice*1){
  133. return
  134. }
  135. //关闭多选开始
  136. this.countsList.forEach(item=>{
  137. item.isUse = false
  138. })
  139. //关闭多选结束
  140. console.log(item)
  141. this.noUse = false
  142. item.isUse = !item.isUse
  143. this.$set(this.countsList,index,item)
  144. let flag = true
  145. this.countsList.forEach(item=>{
  146. if (item.isUse){
  147. flag = false
  148. }
  149. })
  150. this.noUse = flag
  151. },
  152. // 查询可领取的优惠劵
  153. getMyCouponList(){
  154. let that = this;
  155. // 用户绑定门店
  156. this.$api.getMyCouponList({
  157. type:0,
  158. pageNum: 1,
  159. pageSize: 1000,
  160. }).then((res)=>{
  161. console.log(res)
  162. this.countsList = res.data.rows;
  163. }).catch(() =>{
  164. uni.showToast({
  165. title: "操作失败"
  166. })
  167. })
  168. },
  169. },
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. @import '/common/css/common.css';
  174. @import './index.rpx.scss';
  175. </style>