dt_coupon.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view class="dt-voucher">
  3. <block v-if="!isEnable">
  4. <!-- outdate -->
  5. <image v-if="dataDetail.status==1" class="outdate" src="http://139.9.103.171:1888/img/image/voucher_outdate.png" mode="widthFix"></image>
  6. <!-- used -->
  7. <image v-if="dataDetail.status==2" class="used" src="http://139.9.103.171:1888/img/image/voucher_used.png" mode="widthFix"></image>
  8. </block>
  9. <block v-else>
  10. <!-- receive -->
  11. <image v-if="!dataDetail.isReceive" class="unreceive" src="http://139.9.103.171:1888/img/image/unreceive.png" mode="widthFix"></image>
  12. </block>
  13. <!-- border -->
  14. <image class="bg-top-border" :src="borderSrc" mode="widthFix"></image>
  15. <view class="mn-wrap">
  16. <view class="left" :class="{'dis-able':!isEnable}">
  17. <block v-if="dataDetail.voucher_type == 1">
  18. <view class="worth">6.8<text class="suffix">折</text></view>
  19. <view class="type-name">折扣券</view>
  20. </block>
  21. <block v-else>
  22. <view class="worth"><text class="prefix">¥</text>{{dataDetail.amt}}</view>
  23. <view class="type-name">抵价券</view>
  24. </block>
  25. </view>
  26. <view class="mid">
  27. <view class="apply-to-name fn-text-row-two" :class="{'dis-able':!isEnable}">{{dataDetail.name}}</view>
  28. <view v-if="dataDetail.minimumPrice>0" class="apply-condition" :class="{'dis-able':!isEnable}">满 {{dataDetail.minimumPrice}} 元可使用</view>
  29. </view>
  30. <view v-if="isEnable" class="right">
  31. <button v-if="dataDetail.isReceive" class="dt-btn-submit get-btn" @tap="tapBack">立即使用</button>
  32. <button v-else class="dt-btn-submit get-btn" @tap="tapReceive">立即领取</button>
  33. </view>
  34. </view>
  35. <view class="ft-wrap">
  36. <view class="ft" @tap="$emit('visible')">
  37. <view class="des" :class="{'dis-able':!isEnable}">
  38. <text>详细信息</text>
  39. <image class="arrow-up" :class="{ 'active':!dataDetail.isShowDetail }" src="http://139.9.103.171:1888/img/image/arrow_up.png" mode="widthFix"></image>
  40. </view>
  41. <view class="date" :class="{'dis-able':!isEnable}">{{ dataDetail.beginDate| dateFormat('yyyy-MM-dd') }} 至 {{ dataDetail.endDate| dateFormat('yyyy-MM-dd') }}</view>
  42. </view>
  43. </view>
  44. <view v-if="dataDetail.isShowDetail" class="ext-wrap"><text v-if="dataDetail.minimumPrice>0">满{{dataDetail.minimumPrice}}元可使用;</text>不可叠加使用</view>
  45. </view>
  46. </template>
  47. <script>
  48. import DtCheck from '../comps/dt_check.vue'
  49. export default {
  50. components:{
  51. DtCheck
  52. },
  53. props: {
  54. isEnable: {// 是否可用优惠券
  55. type: Boolean,
  56. default: true
  57. },
  58. dataDetail: {
  59. type: Object,
  60. default: () => { }
  61. },
  62. },
  63. data() {
  64. return {
  65. }
  66. },
  67. computed: {
  68. borderSrc() {
  69. return this.isEnable ? 'http://139.9.103.171:1888/img/image/flowerborder.png' : 'http://139.9.103.171:1888/img/image/flowerborder_grey.png'
  70. }
  71. },
  72. methods: {
  73. tapReceive() {
  74. this.$emit('receive', this.dataDetail)
  75. },
  76. tapBack() {
  77. this.$emit('use')
  78. },
  79. }
  80. }
  81. </script>
  82. <style lang="scss">
  83. .fn-text-row-two {
  84. display: -webkit-box !important;
  85. -webkit-box-orient: vertical !important;
  86. -webkit-line-clamp: 2 !important;
  87. overflow: hidden !important;
  88. text-overflow: ellipsis !important;
  89. }
  90. .dt-voucher {
  91. position: relative;
  92. display: flex;
  93. flex-wrap: wrap;
  94. width: 690upx;
  95. // min-height:220upx;
  96. box-sizing: border-box;
  97. border-radius: 10upx;
  98. font-size: 28upx;
  99. background-color: #fff;
  100. .dis-able {
  101. color: #999 !important;
  102. }
  103. .unreceive {
  104. position: absolute;
  105. top: 0;
  106. left: 0;
  107. width: 90upx;
  108. height: 90upx;
  109. }
  110. .outdate,
  111. .used {
  112. position: absolute;
  113. top: 0;
  114. right: 0;
  115. width: 165upx;
  116. height: 86upx;
  117. }
  118. .bg-top-border {
  119. width: 100%;
  120. height: 15upx;
  121. }
  122. .mn-wrap {
  123. display: flex;
  124. width: 100%;
  125. height: 154upx;
  126. margin: 0 30upx;
  127. .left {
  128. display: flex;
  129. flex-direction: column;
  130. justify-content: center;
  131. align-items: center;
  132. min-width: 136upx;
  133. font-size: 22upx;
  134. color: #ff7171;
  135. .worth {
  136. font-size: 60upx;
  137. line-height: 1;
  138. .prefix {
  139. font-size: 30upx;
  140. }
  141. .suffix {
  142. font-size: 24upx;
  143. }
  144. }
  145. .type-name {
  146. text-align: center;
  147. }
  148. }
  149. .mid {
  150. flex: 1;
  151. display: flex;
  152. flex-direction: column;
  153. justify-content: center;
  154. margin: 0 30upx;
  155. .apply-to-name {
  156. max-height: 61upx;
  157. font-size: 26upx;
  158. line-height: 1.2;
  159. color: #333;
  160. }
  161. .apply-condition {
  162. padding-top: 20upx;
  163. color: #666666;
  164. font-size: 22upx;
  165. }
  166. }
  167. .get-btn {
  168. margin: 47upx 0;
  169. width: 160upx;
  170. height: 60upx;
  171. line-height: 60upx;
  172. border-radius: 6upx;
  173. font-size: 28upx;
  174. font-weight: 400;
  175. padding: 0;
  176. background-color: #ff7171;
  177. color: #fff;
  178. }
  179. }
  180. .ft-wrap {
  181. position: relative;
  182. display: flex;
  183. flex-wrap: wrap;
  184. width: 100%;
  185. margin: 0 30upx;
  186. color: #666;
  187. .ft {
  188. position: relative;
  189. display: flex;
  190. justify-content: space-between;
  191. width: 100%;
  192. height: 50upx;
  193. line-height: 50upx;
  194. font-size: 20upx;
  195. .des {
  196. .arrow-up {
  197. margin-left: 10upx;
  198. width: 18upx;
  199. height: 9upx;
  200. }
  201. .arrow-up.active {
  202. transform: rotate(180deg);
  203. }
  204. }
  205. }
  206. .ft:before {
  207. position: absolute;
  208. top: 0;
  209. left: 0;
  210. width: 100%;
  211. height: 1upx;
  212. border-top: 1upx dashed #cccccc;
  213. content: "";
  214. }
  215. }
  216. .ft-wrap:before,
  217. .ft-wrap:after {
  218. position: absolute;
  219. top: -14upx;
  220. width: 28upx;
  221. height: 28upx;
  222. border-radius: 50%;
  223. background-color: #f2f2f2;
  224. content: "";
  225. }
  226. .ft-wrap:before {
  227. left: -44upx;
  228. }
  229. .ft-wrap:after {
  230. right: -44upx;
  231. }
  232. .ext-wrap {
  233. padding: 0 30upx 20upx;
  234. width: 100%;
  235. color: #999;
  236. font-size: 20upx;
  237. }
  238. }
  239. </style>