index.wxml 7.3 KB

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