index.wxml 6.2 KB

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