index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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. .listItemBoxInner {
  67. width: 100%;
  68. height: 150px;
  69. display: flex;
  70. background-color: #FAFAFA;
  71. align-items: center;
  72. justify-content: space-between;
  73. position: relative;
  74. .flag{
  75. display: block;
  76. width: 71px;
  77. height: 71px;
  78. background-repeat: no-repeat;
  79. position: absolute;
  80. top: 0;
  81. left: 0;
  82. &.flag1{
  83. background-image: url("../../../static/images/coupon/flag-coupon.png");
  84. }
  85. &.flag2{
  86. background-image: url("../../../static/images/coupon/flag-coupon2.png");
  87. }
  88. }
  89. .itemInfo {
  90. flex: 1;
  91. }
  92. .amount {
  93. max-width: 90%;
  94. margin: 0 auto;
  95. display: flex;
  96. align-items: baseline;
  97. justify-content: center;
  98. line-height: 60px;
  99. b {
  100. font-size: 30px;
  101. }
  102. span {
  103. font-size: 60px;
  104. font-weight: bold;
  105. }
  106. i {
  107. font-style: normal;
  108. font-size: 18px;
  109. margin-left: 5px;
  110. }
  111. }
  112. .couponInfo {
  113. text-align: center;
  114. p {
  115. display: inline-block;
  116. padding: 0 42px;
  117. text-align: center;
  118. font-size: 18px;
  119. line-height: 40px;
  120. color: #C83732;
  121. background: #F5E5E5;
  122. }
  123. }
  124. }
  125. .receiveBtn {
  126. width: 72px;
  127. margin-right: 5px;
  128. background: #C5AA7B;
  129. height: 100%;
  130. display: flex;
  131. align-items: center;
  132. justify-content: center;
  133. cursor: pointer;
  134. position: relative;
  135. &:before,&:after{
  136. content: '';
  137. display: block;
  138. width: 25px;
  139. height: 25px;
  140. background-color: #fff;
  141. position: absolute;
  142. left: -12.5px;
  143. border-radius: 50%;
  144. }
  145. &:before{
  146. top: -12.5px;
  147. }
  148. &:after{
  149. bottom: -12.5px;
  150. }
  151. span {
  152. color: #FFFFFF !important;
  153. writing-mode: vertical-lr;
  154. font-size: 19px;
  155. }
  156. }
  157. &.isReceive {
  158. //background-image:url('../../../static/images/coupon/border_L4.png'), url('../../../static/images/coupon/border_R4.png');
  159. .listItemBoxInner {
  160. .flag{
  161. &.flag1{
  162. background-image: url("../../../static/images/coupon/flag-coupon-r.png");
  163. }
  164. &.flag2{
  165. background-image: url("../../../static/images/coupon/flag-coupon2-r.png");
  166. }
  167. }
  168. .itemInfo {
  169. color: #999;
  170. .couponInfo {
  171. p {
  172. color: #999;
  173. background: #F1F1F1;
  174. }
  175. }
  176. }
  177. .receiveBtn {
  178. cursor: auto;
  179. background: #999;
  180. }
  181. }
  182. }
  183. }
  184. }
  185. @mixin cardColor($bgColor: #FF3737,$fontColor: #fff) {
  186. .couponListBox {
  187. .listItemBox {
  188. .listItemBoxInner{
  189. background: $bgColor;
  190. }
  191. .itemInfo {
  192. .amount {
  193. b {
  194. color: #EC4B42;
  195. }
  196. span {
  197. color: #EC4B42;
  198. i {
  199. color: #EC4B42;
  200. }
  201. }
  202. }
  203. .couponInfo {
  204. color:#EC4B42;
  205. }
  206. }
  207. .receiveBtn {
  208. span {
  209. color: #EC4B42;
  210. }
  211. }
  212. &.cardStyle3{
  213. .itemInfo {
  214. .amount {
  215. span {
  216. color: $bgColor;
  217. i {
  218. color: $bgColor;
  219. }
  220. }
  221. }
  222. .couponInfo {
  223. color:$bgColor;
  224. }
  225. }
  226. }
  227. &.cardStyle4{
  228. border: 2px solid $bgColor;
  229. padding: 5px;
  230. .listItemBoxInner{
  231. padding: 20px 15px;
  232. height: 85px;
  233. border: 1px solid $bgColor;
  234. }
  235. .itemInfo {
  236. .amount {
  237. span {
  238. color: $bgColor;
  239. i {
  240. color: $bgColor;
  241. }
  242. }
  243. }
  244. .couponInfo {
  245. color:$bgColor;
  246. }
  247. }
  248. .receiveBtn {
  249. border-left: 1px $bgColor dashed;
  250. span {
  251. color: $bgColor;
  252. }
  253. }
  254. }
  255. }
  256. }
  257. }
  258. &.arrange1{
  259. }
  260. &.arrange2{
  261. max-width: 100%;
  262. .couponListBox{
  263. display: flex;
  264. flex-wrap: wrap;
  265. justify-content: space-between;
  266. .listItemBox{
  267. width: 48%;
  268. }
  269. }
  270. }
  271. &.arrange3{
  272. max-width: 100%;
  273. .couponListBox{
  274. display: flex;
  275. flex-wrap: wrap;
  276. justify-content: space-between;
  277. .listItemBox{
  278. width: 32%;
  279. }
  280. }
  281. }
  282. &.arrange4{
  283. max-width: 100%;
  284. .couponListBox{
  285. display: flex;
  286. overflow: hidden;
  287. .listItemBox{
  288. width: 268px;
  289. flex: 0 0 268px;
  290. margin:0 25px 25px 0;
  291. &:nth-child(4n){
  292. margin-right: 0;
  293. }
  294. }
  295. }
  296. }
  297. //&.color1{
  298. // .listItemBox {
  299. // background-image:url('../../../static/images/coupon/border_L1.png'), url('../../../static/images/coupon/border_R1.png');
  300. // .listItemBoxInner {
  301. // border-top: 1px solid #EC4B42;
  302. // border-bottom: 1px solid #EC4B42;
  303. // .itemInfo {
  304. // color: #EC4B42;
  305. // .amount {
  306. // border-bottom: 1px solid #EC4B42;
  307. // }
  308. // .couponInfo {
  309. // p {
  310. // color: #EC4B42;
  311. // }
  312. // }
  313. // }
  314. // .receiveBtn {
  315. // background: #EC4B42;
  316. // }
  317. // }
  318. // }
  319. //}
  320. &.color2{
  321. .listItemBox {
  322. background-image:url('../../../static/images/coupon/border_L2.png'), url('../../../static/images/coupon/border_R2.png');
  323. .listItemBoxInner {
  324. border-top: 1px solid #FF7800;
  325. border-bottom: 1px solid #FF7800;
  326. .itemInfo {
  327. color: #FF7800;
  328. .amount {
  329. border-bottom: 1px solid #FF7800;
  330. }
  331. .couponInfo {
  332. p {
  333. color: #FF7800;
  334. }
  335. }
  336. }
  337. .receiveBtn {
  338. background: #FF7800;
  339. }
  340. }
  341. }
  342. }
  343. &.color3{
  344. .listItemBox {
  345. background-image:url('../../../static/images/coupon/border_L3.png'), url('../../../static/images/coupon/border_R3.png');
  346. .listItemBoxInner {
  347. border-top: 1px solid #86A7FF;
  348. border-bottom: 1px solid #86A7FF;
  349. .itemInfo {
  350. color: #86A7FF;
  351. .amount {
  352. border-bottom: 1px solid #86A7FF;
  353. }
  354. .couponInfo {
  355. p {
  356. color: #86A7FF;
  357. }
  358. }
  359. }
  360. .receiveBtn {
  361. background: #86A7FF;
  362. }
  363. }
  364. }
  365. }
  366. }
  367. </style>