index.wxml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!--components/couponWrap/index.wxml-->
  2. <block wx:if= "{{list.length>0}}">
  3. <view class="coupon-list">
  4. <view wx:for="{{list}}" wx:key="coupon" class="coupon-item coupon-item-ex-class">
  5. <!-- 礼包 -->
  6. <view class="coupon-card">
  7. <view class="coupon-card-left">
  8. <view class="coupon-prices {{nums.priceClass(item)}}">
  9. <block wx:if="{{item.type.value == 'C'}}">
  10. <text>{{nums.formatReduceCost(item)}}</text>
  11. <text class="_unit">元</text>
  12. </block>
  13. <block wx:elif="{{item.type.value == 'D'}}">
  14. <text>{{nums.formatDiscount(item)}}</text>
  15. <text class="_unit">折</text>
  16. </block>
  17. </view>
  18. <view class="coupon-condition">{{nums.formatLeastCost(item)}}</view>
  19. </view>
  20. <view class="coupon-card-right">
  21. <view class="_title">{{item.title}}</view>
  22. <view class="_time_des">{{item.validTimesStr}}</view>
  23. </view>
  24. <block wx:if="{{item.isSn}}">
  25. <view wx:if="{{item.couponState == 0}}" class="coupon-card-btn">
  26. <jumpmallapp>立即使用</jumpmallapp>
  27. </view>
  28. <view wx:elif="{{item.couponState == 1}}" class="coupon-card-btn gray">
  29. 已使用
  30. </view>
  31. <view class="coupon-card-btn gray" wx:else>
  32. 已作废
  33. </view>
  34. </block>
  35. <view class="coupon-card-num" wx:else>
  36. {{item.num}}张
  37. </view>
  38. </view>
  39. <view class="coupon-split">
  40. <view class="coupon-circule _left coupon-circule-ex-class" ></view>
  41. <view class="coupon-circule _right coupon-circule-ex-class"></view>
  42. </view>
  43. <view class="coupon-detail">
  44. <view class="fold-title" data-index= "{{index}}" catchtap="exFoldPanel">使用规则
  45. <image wx:if="{{!flodMap[index]}}" class="fold-btn" src="../../images/welfareMall/down-ico.png" />
  46. <image wx:else class="fold-btn" src="../../images/welfareMall/up-ico.png" />
  47. </view>
  48. <block wx:if="{{flodMap[index]}}">
  49. <view class="coupon-detail-line" style="margin-top: 22rpx;">
  50. <text class="_key">适用门店:</text>
  51. <block wx:if="{{item.bindShopType == 1}}">
  52. <text>全国所有门店</text>
  53. </block>
  54. <block wx:elif="{{item.bindShopType == 2 || item.bindShopType == 4}}">
  55. <text>适用部分门店</text>
  56. <text class="look_more_txt" data-index="{{index}}" catchtap="toFixStorePage">点击查看>></text>
  57. </block>
  58. <block wx:elif="{{item.bindShopType == 3 }}">
  59. <text>随领取门店可用</text>
  60. </block>
  61. </view>
  62. <view class="coupon-detail-line">
  63. <text class="_key">适用商品:</text>
  64. <block wx:if="{{item.bindGoodsType == 1}}">
  65. <text>特价商品除外</text>
  66. </block>
  67. <block wx:elif="{{item.bindGoodsType == 2 || item.bindGoodsType == 4}}">
  68. <text>适用部分商品</text>
  69. <text class="look_more_txt" data-index="{{index}}" catchtap="toFixFoodPage">点击查看>></text>
  70. </block>
  71. </view>
  72. <view class="coupon-detail-line">
  73. <text class="_key">适用场景:</text>
  74. <text>门店</text>
  75. </view>
  76. <view class="coupon-detail-line">
  77. <text class="_key">使用规则:</text>
  78. </view>
  79. <view class="coupon-detail-des">
  80. {{item.description}}
  81. </view>
  82. </block>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 弹窗 -->
  87. </block>
  88. <wxs module="nums">
  89. module.exports.formatReduceCost = function (item) {
  90. if (item.formatReduceCost) {
  91. return item.formatReduceCost;
  92. } else if (item.reduceCost) {
  93. return parseFloat(parseInt(item.reduceCost * 100) / 10000)
  94. }
  95. return 0
  96. }
  97. module.exports.formatLeastCost = function (item) {
  98. if (!item.formatLeastCost) {
  99. item.formatLeastCost = parseFloat(parseInt((item.leastCost || 0) * 100) / 10000)
  100. }
  101. if (item.formatLeastCost == 0) {
  102. return "无限制"
  103. }
  104. return "满" + item.formatLeastCost + "元"
  105. }
  106. module.exports.formatDiscount = function(item) {
  107. if (item.formatDiscount) {
  108. return item.formatDiscount
  109. } else if (item.discount) {
  110. return parseFloat(parseInt((item.discount || 0) * 10) / 100)
  111. }
  112. return 0
  113. }
  114. module.exports.priceClass = function(item) {
  115. if (item.type.value == "C") {
  116. if (item.reduceCost >= 100) {
  117. return "_small"
  118. }
  119. return 100
  120. }
  121. if (item.type.value == "D" ) {
  122. if (item.discount >= 10) {
  123. return "_small"
  124. }
  125. return ""
  126. }
  127. return ""
  128. }
  129. </wxs>