index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <div class="couponBox warp" :class="['terminal' + terminal,'arrange'+(componentContent.arrangeActiveIndex+1),'color'+(componentContent.colorActiveIndex+1)]">
  3. <div class="couponListBox" v-if="componentContent.selectedCoupon">
  4. <div class="listItemBox" v-for="(item,index) in couponsData" :key="index" :class="item.state && item.state !== 3 && 'isReceive'">
  5. <div class="listItemBoxInner">
  6. <div class="itemInfo">
  7. <i class="flag" :class="'flag'+item.couponType"></i>
  8. <div class="amount">
  9. <b v-if="item.couponType !== 2">¥</b>
  10. <span v-if="typeId !== 1">
  11. {{item.couponContent}}
  12. </span>
  13. <span v-else>
  14. {{item.reduceMoney}}
  15. </span>
  16. <b v-if="item.couponType == 2">折</b>
  17. </div>
  18. <div class="couponInfo">
  19. <p>{{item.content}}</p>
  20. </div>
  21. </div>
  22. <!-- <div class="itemInfo" v-else>-->
  23. <!-- <div class="amount">-->
  24. <!-- <b>¥</b><span>{{item.reduceMoney}}<i>满减券</i></span>-->
  25. <!-- </div>-->
  26. <!-- <div class="couponInfo">-->
  27. <!-- <p>{{item.content}}</p>-->
  28. <!-- </div>-->
  29. <!-- </div>-->
  30. <div v-if="item.state === 0" class="receiveBtn">
  31. <span>己领取</span>
  32. </div>
  33. <div v-else-if="item.state === 1" class="receiveBtn">
  34. <span>已使用</span>
  35. </div>
  36. <div v-else-if="item.state === 2" class="receiveBtn">
  37. <span>已过期</span>
  38. </div>
  39. <div v-else class="receiveBtn" @click="receiveCoupon(item)">
  40. <span>立即领取</span>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import {commonMixin} from '../mixin'
  49. export default {
  50. mixins: [commonMixin]
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .couponBox {
  55. min-height: 177px;
  56. margin: 0 auto;
  57. padding: 20px 0;
  58. .couponListBox {
  59. flex-wrap: wrap;
  60. /**默认**/
  61. .listItemBox {
  62. //background-image:url('../../../static/images/coupon/border_L1.png'), url('../../../static/images/coupon/border_R1.png');
  63. //background-repeat: no-repeat, no-repeat;
  64. //background-position: left top, right top;
  65. box-sizing: border-box;
  66. margin-bottom: 20px;
  67. .listItemBoxInner {
  68. width: 100%;
  69. height: 150px;
  70. display: flex;
  71. background-color: #FAFAFA;
  72. align-items: center;
  73. justify-content: space-between;
  74. position: relative;
  75. .flag{
  76. display: block;
  77. width: 71px;
  78. height: 71px;
  79. background-repeat: no-repeat;
  80. position: absolute;
  81. top: 0;
  82. left: 0;
  83. &.flag1{
  84. background-image: url("../../../static/images/coupon/flag-coupon.png");
  85. }
  86. &.flag2{
  87. background-image: url("../../../static/images/coupon/flag-coupon2.png");
  88. }
  89. }
  90. .itemInfo {
  91. flex: 1;
  92. }
  93. .amount {
  94. max-width: 90%;
  95. margin: 0 auto;
  96. display: flex;
  97. align-items: baseline;
  98. justify-content: center;
  99. line-height: 60px;
  100. b {
  101. font-size: 30px;
  102. }
  103. span {
  104. font-size: 60px;
  105. font-weight: bold;
  106. }
  107. i {
  108. font-style: normal;
  109. font-size: 18px;
  110. margin-left: 5px;
  111. }
  112. }
  113. .couponInfo {
  114. text-align: center;
  115. p {
  116. display: inline-block;
  117. padding: 0 42px;
  118. text-align: center;
  119. font-size: 18px;
  120. line-height: 40px;
  121. color: #C83732;
  122. background: #F5E5E5;
  123. }
  124. }
  125. }
  126. .receiveBtn {
  127. width: 72px;
  128. margin-right: 5px;
  129. background: #C5AA7B;
  130. height: 100%;
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. cursor: pointer;
  135. position: relative;
  136. &:before,&:after{
  137. content: '';
  138. display: block;
  139. width: 25px;
  140. height: 25px;
  141. background-color: #fff;
  142. position: absolute;
  143. left: -12.5px;
  144. border-radius: 50%;
  145. }
  146. &:before{
  147. top: -12.5px;
  148. }
  149. &:after{
  150. bottom: -12.5px;
  151. }
  152. span {
  153. color: #FFFFFF !important;
  154. writing-mode: vertical-lr;
  155. font-size: 19px;
  156. }
  157. }
  158. &.isReceive {
  159. //background-image:url('../../../static/images/coupon/border_L4.png'), url('../../../static/images/coupon/border_R4.png');
  160. .listItemBoxInner {
  161. .flag{
  162. &.flag1{
  163. background-image: url("../../../static/images/coupon/flag-coupon-r.png");
  164. }
  165. &.flag2{
  166. background-image: url("../../../static/images/coupon/flag-coupon2-r.png");
  167. }
  168. }
  169. .itemInfo {
  170. color: #999;
  171. .couponInfo {
  172. p {
  173. color: #999;
  174. background: #F1F1F1;
  175. }
  176. }
  177. }
  178. .receiveBtn {
  179. cursor: auto;
  180. background: #999;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. @mixin cardColor($bgColor: #FF3737,$fontColor: #fff) {
  187. .couponListBox {
  188. .listItemBox {
  189. .listItemBoxInner{
  190. background: $bgColor;
  191. }
  192. .itemInfo {
  193. .amount {
  194. b {
  195. color: #EC4B42;
  196. }
  197. span {
  198. color: #EC4B42;
  199. i {
  200. color: #EC4B42;
  201. }
  202. }
  203. }
  204. .couponInfo {
  205. color:#EC4B42;
  206. }
  207. }
  208. .receiveBtn {
  209. span {
  210. color: #EC4B42;
  211. }
  212. }
  213. &.cardStyle3{
  214. .itemInfo {
  215. .amount {
  216. span {
  217. color: $bgColor;
  218. i {
  219. color: $bgColor;
  220. }
  221. }
  222. }
  223. .couponInfo {
  224. color:$bgColor;
  225. }
  226. }
  227. }
  228. &.cardStyle4{
  229. border: 2px solid $bgColor;
  230. padding: 5px;
  231. .listItemBoxInner{
  232. padding: 20px 15px;
  233. height: 85px;
  234. border: 1px solid $bgColor;
  235. }
  236. .itemInfo {
  237. .amount {
  238. span {
  239. color: $bgColor;
  240. i {
  241. color: $bgColor;
  242. }
  243. }
  244. }
  245. .couponInfo {
  246. color:$bgColor;
  247. }
  248. }
  249. .receiveBtn {
  250. border-left: 1px $bgColor dashed;
  251. span {
  252. color: $bgColor;
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. &.arrange1{
  260. }
  261. &.arrange2{
  262. max-width: 100%;
  263. .couponListBox{
  264. display: flex;
  265. flex-wrap: wrap;
  266. justify-content: space-between;
  267. .listItemBox{
  268. width: 48%;
  269. }
  270. }
  271. }
  272. &.arrange3{
  273. max-width: 100%;
  274. .couponListBox{
  275. display: flex;
  276. flex-wrap: wrap;
  277. justify-content: space-between;
  278. .listItemBox{
  279. width: 32%;
  280. }
  281. }
  282. }
  283. &.arrange4{
  284. max-width: 100%;
  285. .couponListBox{
  286. display: flex;
  287. overflow: hidden;
  288. .listItemBox{
  289. width: 268px;
  290. flex: 0 0 268px;
  291. margin:0 25px 25px 0;
  292. &:nth-child(4n){
  293. margin-right: 0;
  294. }
  295. }
  296. }
  297. }
  298. //&.color1{
  299. // .listItemBox {
  300. // background-image:url('../../../static/images/coupon/border_L1.png'), url('../../../static/images/coupon/border_R1.png');
  301. // .listItemBoxInner {
  302. // border-top: 1px solid #EC4B42;
  303. // border-bottom: 1px solid #EC4B42;
  304. // .itemInfo {
  305. // color: #EC4B42;
  306. // .amount {
  307. // border-bottom: 1px solid #EC4B42;
  308. // }
  309. // .couponInfo {
  310. // p {
  311. // color: #EC4B42;
  312. // }
  313. // }
  314. // }
  315. // .receiveBtn {
  316. // background: #EC4B42;
  317. // }
  318. // }
  319. // }
  320. //}
  321. &.color2{
  322. .listItemBox {
  323. background-image:url('../../../static/images/coupon/border_L2.png'), url('../../../static/images/coupon/border_R2.png');
  324. .listItemBoxInner {
  325. border-top: 1px solid #FF7800;
  326. border-bottom: 1px solid #FF7800;
  327. .itemInfo {
  328. color: #FF7800;
  329. .amount {
  330. border-bottom: 1px solid #FF7800;
  331. }
  332. .couponInfo {
  333. p {
  334. color: #FF7800;
  335. }
  336. }
  337. }
  338. .receiveBtn {
  339. background: #FF7800;
  340. }
  341. }
  342. }
  343. }
  344. &.color3{
  345. .listItemBox {
  346. background-image:url('../../../static/images/coupon/border_L3.png'), url('../../../static/images/coupon/border_R3.png');
  347. .listItemBoxInner {
  348. border-top: 1px solid #86A7FF;
  349. border-bottom: 1px solid #86A7FF;
  350. .itemInfo {
  351. color: #86A7FF;
  352. .amount {
  353. border-bottom: 1px solid #86A7FF;
  354. }
  355. .couponInfo {
  356. p {
  357. color: #86A7FF;
  358. }
  359. }
  360. }
  361. .receiveBtn {
  362. background: #86A7FF;
  363. }
  364. }
  365. }
  366. }
  367. }
  368. </style>