index.wxml 5.7 KB

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