order-coupon-detail.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <style-dialog
  3. v-if="visible"
  4. @close="handleClose"
  5. title="优惠明细">
  6. <view class="page pt-20 pr-40 pl-40">
  7. <view v-if="mode===0">
  8. <view
  9. class="item mt-20 "
  10. v-for="(item, index) in rightsList"
  11. :key="index">
  12. <image class="full-percent" src="../../pages-charge/static/discount-bg.png"></image>
  13. <view class="absolute-full flex pt-8 pb-8">
  14. <view class="left flex-justify-center pl-48">
  15. <view class="item-content_left">
  16. <view class="flex-align-end">
  17. <view class="item-header__left">
  18. <image class="width-84" src="/static/images/discount-rights-card.png" mode="widthFix"></image>
  19. <view class="fs-48 lh-58 color-000 fw-500 ml-16">
  20. {{ (item.discount / 10).toFixed(1) }}折
  21. </view>
  22. <view class="fs-26 color-999 ml-16" v-if="mode === 0"
  23. >抵扣充电服务费
  24. </view>
  25. </view>
  26. </view>
  27. <block>
  28. <view class="fs-26 color-999 mt-8"
  29. @click.stop="to(`/pages-common/activity/activity?id=${item.activityId}`)">
  30. <view class="fs-26 color-999">到期时间:{{ item.endTime }}</view>
  31. <view class="flex-align-center" v-if="mode === 0">
  32. <view class="fs-24 color-999">享受{{ (item.discount / 10).toFixed(1) }}折服务费权益,本次充电优惠:{{ fenToYuan(item.orderDiscountAmount) }}元
  33. <text class="color-primary">详细规则</text>
  34. <text class="fs-24 ml-4 color-primary">>></text>
  35. </view>
  36. </view>
  37. </view>
  38. </block>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view v-if="mode===1">
  45. <view
  46. class="item mt-20 "
  47. v-for="(item, index) in couponList"
  48. :class="item.collected?'inactive':''"
  49. :key="index">
  50. <image class="full-percent" src="/static/images/discount-bg.png"></image>
  51. <view class="absolute-full flex pt-8 pb-8">
  52. <view class="left flex-justify-center pl-48">
  53. <view class="item-content_left">
  54. <view class="flex-align-end">
  55. <view class="item-header__left">
  56. <image
  57. class="width-84"
  58. src="/static/images/discount-coupon.png"
  59. mode="widthFix"
  60. ></image>
  61. <view></view>
  62. <view class="fs-48 lh-58 color-000 fw-500 ml-16" v-if="item.couponType=='FullDiscount'">
  63. {{ fenToYuan(item.discount) }}元
  64. </view>
  65. <view class="fs-48 lh-58 color-000 fw-500 ml-16" v-else>
  66. {{ (item.discount / 10).toFixed(1) }}折
  67. </view>
  68. <view class="fs-26 color-999 ml-16">
  69. 充电服务费:{{ item.couponType == 'FullDiscount' ? '满减券' : '折扣券' }}
  70. </view>
  71. </view>
  72. </view>
  73. <block>
  74. <view class="fs-26 color-999 mt-8"
  75. @click.stop="to(`/pages-common/activity/activity?id=${item.activityId}`)">
  76. <view class="fs-26 color-999">到期时间:{{ item.endTime }}</view>
  77. <view class="flex-align-center">
  78. <view class="fs-26 color-999">本次充电优惠:{{ fenToYuan(item.orderDiscountAmount) }}元
  79. <text class="color-primary">详细规则</text>
  80. <text class="fs-24 ml-4 color-primary">>></text>
  81. </view>
  82. </view>
  83. </view>
  84. </block>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. >
  92. </style-dialog>
  93. </template>
  94. <script setup lang="ts">
  95. import {ref} from "vue";
  96. import {fetchOrderDiscount} from "@/api/user";
  97. import {to} from "@/utils/navigate";
  98. import { fenToYuan } from "@/utils/money";
  99. const mode = ref(0);
  100. const rightsList = ref<any[]>([]);
  101. const couponList = ref<any[]>([]);
  102. const visible = ref(false);
  103. const handleClose = () => {
  104. visible.value = false;
  105. }
  106. const open = (startChargeSeq: string, discountType: string) => {
  107. visible.value = true;
  108. fetchOrderDiscount(startChargeSeq, discountType).then((res) => {
  109. if (res) {
  110. if (discountType == "RechargeRights") {
  111. rightsList.value = [res]
  112. mode.value = 0;
  113. } else {
  114. couponList.value = [res]
  115. mode.value = 1;
  116. }
  117. }
  118. })
  119. }
  120. defineExpose({
  121. open
  122. })
  123. </script>
  124. <style lang="scss" scoped>
  125. @use "../../styles/coupon-card.scss";
  126. </style>