index.wxml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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)}}" style="color: {{config.secColor?config.secColor:'#B01717'}};">
  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" style="color: {{config.secColor?config.secColor:'#B01717'}};">{{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" style="background: {{config.mainColor?config.mainColor:'#B01717'}};">
  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 style="background: {{config.mainColor?config.mainColor:'#B01717'}};">
  39. {{item.num}}张
  40. </view>
  41. </view>
  42. <view class="coupon-split" style="color: {{config.mainColor?config.mainColor:'#B01717'}};">
  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" style="color: {{config.secColor?config.secColor:'#B01717'}};">点击查看>></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" style="color: {{config.secColor?config.secColor:'#B01717'}};">点击查看>></text>
  73. </block>
  74. <block wx:if="{{item.bindGoodsType == 3}}">
  75. <text>不适用商品</text>
  76. <text class="look_more_txt" data-index="{{index}}" catchtap="toFixFoodPageNo" style="color: {{config.secColor?config.secColor:'#B01717'}};">点击查看>></text>
  77. </block>
  78. </view>
  79. <view class="coupon-detail-line">
  80. <text class="_key">适用场景:</text>
  81. <text>门店</text>
  82. </view>
  83. <view class="coupon-detail-line">
  84. <text class="_key">使用规则:</text>
  85. </view>
  86. <view class="coupon-detail-des">
  87. {{item.description}}
  88. </view>
  89. </block>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 弹窗 -->
  94. </block>
  95. <wxs module="nums">
  96. module.exports.formatReduceCost = function (item) {
  97. if (item.formatReduceCost) {
  98. return item.formatReduceCost;
  99. } else if (item.reduceCost) {
  100. return parseFloat(parseInt(item.reduceCost * 100) / 10000)
  101. }
  102. return 0
  103. }
  104. module.exports.formatLeastCost = function (item) {
  105. if (!item.formatLeastCost) {
  106. item.formatLeastCost = parseFloat(parseInt((item.leastCost || 0) * 100) / 10000)
  107. }
  108. if (item.formatLeastCost == 0) {
  109. return "无限制"
  110. }
  111. return "满" + item.formatLeastCost + "元"
  112. }
  113. module.exports.formatDiscount = function(item) {
  114. if (item.formatDiscount) {
  115. return item.formatDiscount
  116. } else if (item.discount) {
  117. return parseFloat(parseInt((item.discount || 0) * 10) / 100)
  118. }
  119. return 0
  120. }
  121. module.exports.priceClass = function(item) {
  122. if (item.type.value == "C") {
  123. if (item.reduceCost >= 100) {
  124. return "_small"
  125. }
  126. return 100
  127. }
  128. if (item.type.value == "D" ) {
  129. if (item.discount >= 10) {
  130. return "_small"
  131. }
  132. return ""
  133. }
  134. return ""
  135. }
  136. </wxs>