金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.4 KiB

  1. <template>
  2. <!--优惠券-->
  3. <view class="coupon-warp-box" :style="'margin-bottom: ' + meta.margin_bottom + 'px'" v-if="indexCoupon && indexCoupon.length">
  4. <view class="coupon-item-box" :style="'background: ' + config.mainColor" v-for="(item, index) in indexCoupon" :key="index">
  5. <view class="coupon-item">
  6. <view class="left">
  7. <block v-if="item.associate.action_type.type == 'cash'">
  8. <span class="money">
  9. </span>
  10. <span class="num">
  11. {{ item.associate.action_type.value }}
  12. </span>
  13. </block>
  14. <block v-if="item.associate.action_type.type == 'discount'">
  15. <span class="num">
  16. {{ item.associate.action_type.value }}
  17. </span>
  18. <span class="money">
  19. </span>
  20. </block>
  21. </view>
  22. <view class="right">
  23. <view class="label">
  24. {{item.associate.title}}
  25. </view>
  26. <view class="btn" :style="'color: ' + config.mainColor" :data-code="item.associate.code" :data-index="index" v-if="!item.associate.has_get" @tap="getCoupon">
  27. 点击领取
  28. </view>
  29. <view class="btn" :data-id="item.associate_id" v-else catchtap="_jumpList">
  30. 去使用
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {};
  41. },
  42. props: {
  43. config: {
  44. type: Object,
  45. value: ''
  46. },
  47. indexCoupon: {
  48. type: Array,
  49. value: ''
  50. },
  51. show: {
  52. type: Number,
  53. value: ''
  54. },
  55. meta: {
  56. type: Object,
  57. value: ""
  58. }
  59. },
  60. //组件的方法
  61. methods: {
  62. //分发事件出去
  63. getCoupon(e) {
  64. var code = e.currentTarget.dataset.code;
  65. var index = e.currentTarget.dataset.index;
  66. var myEventDetail = {
  67. code: code,
  68. index: index
  69. };
  70. this.$emit('myGetCoupon', myEventDetail);
  71. },
  72. _jumpList(e) {
  73. var id = e.currentTarget.dataset.id;
  74. wx.navigateTo({
  75. url: '/pages/coupon/goods/goods?id=' + id
  76. });
  77. }
  78. }
  79. };
  80. </script>
  81. <style rel="stylesheet/less" lang="less">
  82. @import "index-coupon";
  83. </style>