coupon.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template name="coupon">
  2. <view class="coupon-template">
  3. <view class="coupon-title" @tap.stop="showPopup">
  4. <text class="text">优惠券:</text>
  5. <text class="iconfont icon-xiayibu"></text>
  6. </view>
  7. <!-- 优惠券 -->
  8. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup">
  9. <view class="tui-popup-box clearfix">
  10. <view class="title">
  11. <view class="title-l">优惠券</view>
  12. <view class="title-r" @click="showExchangePopup">兑换优惠券</view>
  13. </view>
  14. <div class="tui-popup-main coupon">
  15. <scroll-view class="tui-popup-scroll" scroll-y="true">
  16. <view v-for="(coupon,index) in dataList" :key="index" :id="coupon.id" class="coupon-list" @click.stop="checkedCoupon(coupon,index)">
  17. <view class="list-cell-le">
  18. <view class="coupon-maxMoney">
  19. <text class="small">¥</text>
  20. {{ coupon.maxMoney }}
  21. </view>
  22. <view class="coupon-minMoney">
  23. 满{{ coupon.minMoney }}可用
  24. </view>
  25. </view>
  26. <view class="list-cell-ri">
  27. <view class="list-cell-top">
  28. <view class="list-cell-type">
  29. <view class="list-cell-tags">
  30. <text class="tags">{{ coupon.couponType | TypeFormat }}</text>
  31. </view>
  32. <view class="list-cell-texts">
  33. <text v-if="coupon.useType == 1">{{ coupon.useType | TypeFormatText }}</text>
  34. <text v-if="coupon.useType == 2">{{ coupon.useType | TypeFormatText }}</text>
  35. <text v-if="coupon.useType == 3">{{ coupon.useType | TypeFormatText }}{{ coupon.couponText }}的商品</text>
  36. </view>
  37. </view>
  38. <view class="list-cell-btn">
  39. <view class="list-cell-checkbox">
  40. <view class="checkbox iconfont"
  41. :class="[coupon.ischecked ?'icon-yixuanze':'icon-weixuanze']"
  42. >
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="list-cell-time">{{ coupon.couponTime }}</view>
  48. </view>
  49. </view>
  50. </scroll-view>
  51. </div>
  52. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
  53. <view class="tui-flex-1">
  54. <view class="tui-button" @click="hidePopup">确定</view>
  55. </view>
  56. </view>
  57. </view>
  58. </tui-bottom-popup>
  59. </view>
  60. </template>
  61. <script>
  62. export default{
  63. name:"coupon",
  64. props:{
  65. },
  66. data() {
  67. return{
  68. popupShow:false,
  69. isIphoneX:this.$store.state.isIphoneX,
  70. checkedIndex:null,
  71. dataList:[
  72. {
  73. maxMoney:5000,
  74. minMoney:1000,
  75. couponType:1,
  76. couponTime:'2021.06.28~2021.07.28',
  77. couponText:'华熙生物技术有限公司',
  78. useType:1,
  79. couponBtnType:0,
  80. ischecked:false
  81. },
  82. {
  83. maxMoney:2000,
  84. minMoney:200,
  85. couponType:2,
  86. couponTime:'2021.06.28~2021.07.28',
  87. couponText:'华熙生物技术有限公司',
  88. useType:2,
  89. couponBtnType:0,
  90. ischecked:false
  91. },
  92. {
  93. maxMoney:4000,
  94. minMoney:800,
  95. couponType:3,
  96. couponTime:'2021.06.28~2021.07.28',
  97. couponText:'华熙生物技术有限公司',
  98. useType:3,
  99. couponBtnType:0,
  100. ischecked:false
  101. },
  102. {
  103. maxMoney:6000,
  104. minMoney:1000,
  105. couponType:4,
  106. couponTime:'2021.06.28~2021.07.28',
  107. couponText:'华熙生物技术有限公司',
  108. useType:1,
  109. couponBtnType:0,
  110. ischecked:false
  111. },
  112. {
  113. maxMoney:6000,
  114. minMoney:1000,
  115. couponType:5,
  116. couponTime:'2021.06.28~2021.07.28',
  117. couponText:'华熙生物技术有限公司',
  118. useType:2,
  119. couponBtnType:0,
  120. ischecked:false
  121. }
  122. ],
  123. }
  124. },
  125. filters:{
  126. NumFormat(value) {//处理金额
  127. return Number(value).toFixed(2);
  128. },
  129. totalprice(val,count){//单件商品的价格 × 数量
  130. return (val * count).toFixed(2)
  131. },
  132. TypeFormat:function(value) {
  133. switch (value) {
  134. case 1:
  135. return '活动券';
  136. break;
  137. case 2:
  138. return '品类券';
  139. break;
  140. case 3:
  141. return '店铺券';
  142. break;
  143. case 4:
  144. return '专享券';
  145. break;
  146. case 5:
  147. return '新用户券';
  148. break;
  149. }
  150. },
  151. TypeFormatText:function(value) {
  152. switch (value) {
  153. case 1:
  154. return '全商城商品通用';
  155. break;
  156. case 2:
  157. return '仅限购买仪器类商品';
  158. break;
  159. case 3:
  160. return '仅可购买店铺';
  161. break;
  162. }
  163. }
  164. },
  165. created(){
  166. },
  167. computed: {
  168. },
  169. methods:{
  170. checkedCoupon(coupon,idx){// 选择优惠券
  171. this.checkedIndex = idx;
  172. this.dataList.forEach((el,index) => {
  173. if(this.checkedIndex == index){
  174. el.ischecked = !el.ischecked;
  175. }else{
  176. el.ischecked = false
  177. }
  178. })
  179. console.log('this.dataList===>',this.dataList)
  180. },
  181. showExchangePopup(){
  182. this.popupShow = false
  183. this.$parent.isExchangePopup = true
  184. },
  185. showPopup(){
  186. this.popupShow = true
  187. },
  188. hidePopup(){
  189. this.popupShow = false
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss">
  195. .coupon-template{
  196. width: 100%;
  197. height: auto;
  198. background: #FFFFFF;
  199. float: left;
  200. margin-top: 24rpx;
  201. .coupon-title{
  202. width: 702rpx;
  203. padding: 0 24rpx;
  204. height: 88rpx;
  205. line-height: 88rpx;
  206. position: relative;
  207. .text{
  208. font-size: $font-size-28;
  209. color: $text-color;
  210. }
  211. .iconfont{
  212. width: 50rpx;
  213. height: 88rpx;
  214. line-height: 88rpx;
  215. color: #999999;
  216. display: block;
  217. position: absolute;
  218. right: 0;
  219. top: 0;
  220. }
  221. }
  222. }
  223. .tui-popup-box {
  224. position: relative;
  225. box-sizing: border-box;
  226. min-height: 220rpx;
  227. padding:24rpx 24rpx 0 24rpx;
  228. .title{
  229. font-size: $font-size-34;
  230. color: $text-color;
  231. line-height: 88rpx;
  232. text-align: center;
  233. float: left;
  234. width: 100%;
  235. height: 88rpx;
  236. display: flex;
  237. box-sizing: border-box;
  238. padding: 0 24rpx;
  239. .title-l{
  240. flex: 1;
  241. text-align: left;
  242. }
  243. .title-r{
  244. flex: 1;
  245. text-align: right;
  246. color: #f94b4b;
  247. }
  248. }
  249. .tui-popup-main{
  250. width: 100%;
  251. float: left;
  252. padding-top: 10rpx;
  253. .tui-popup-scroll{
  254. width: 100%;
  255. height: 500rpx;
  256. .coupon-list{
  257. width: 100%;
  258. height: 200rpx;
  259. margin-bottom: 24rpx;
  260. box-sizing: border-box;
  261. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-uesb@2x.png);
  262. background-size: cover;
  263. .list-cell-le{
  264. width: 224rpx;
  265. height: 100%;
  266. box-sizing: border-box;
  267. padding: 37rpx 0;
  268. float: left;
  269. .coupon-maxMoney{
  270. width: 100%;
  271. height: 78rpx;
  272. line-height: 78rpx;
  273. font-size: 56rpx;
  274. color: #FFFFFF;
  275. text-align: center;
  276. .small{
  277. font-size: $font-size-24;
  278. }
  279. }
  280. .coupon-minMoney{
  281. width: 100%;
  282. height: 33rpx;
  283. line-height: 33rpx;
  284. font-size: $font-size-24;
  285. color: #FFFFFF;
  286. text-align: center;
  287. }
  288. }
  289. .list-cell-ri{
  290. width: 478rpx;
  291. height: 100%;
  292. box-sizing: border-box;
  293. padding: 20rpx 24rpx 0 24rpx;
  294. float: right;
  295. .list-cell-top{
  296. width: 100%;
  297. height: 121rpx;
  298. float: left;
  299. border-bottom: 1px solid #e1e1e1;
  300. .list-cell-type{
  301. width: 286rpx;
  302. height: 100%;
  303. float: left;
  304. .list-cell-tags{
  305. width: 100%;
  306. height: 32rpx;
  307. margin-bottom: 7rpx;
  308. .tags{
  309. display: inline-block;
  310. padding: 0 10rpx;
  311. height: 32rpx;
  312. line-height: 32rpx;
  313. background-color: #ffdcce;
  314. color: #f94b4b;
  315. font-size: $font-size-20;
  316. border-radius: 8rpx;
  317. text-align: center;
  318. float: left;
  319. }
  320. }
  321. .list-cell-texts{
  322. width: 100%;
  323. height: auto;
  324. line-height:35rpx;
  325. text-overflow:ellipsis;
  326. display: -webkit-box;
  327. word-break: break-all;
  328. -webkit-box-orient: vertical;
  329. -webkit-line-clamp: 2;
  330. overflow: hidden;
  331. font-size: 26rpx;
  332. color: #333333;
  333. }
  334. }
  335. .list-cell-btn{
  336. width: 128rpx;
  337. height: 100%;
  338. float: right;
  339. .list-cell-checkbox{
  340. width: 100%;
  341. height: 50%;
  342. .checkbox{
  343. width: 40rpx;
  344. line-height: 60rpx;
  345. float: right;
  346. box-sizing: border-box;
  347. text-align: center;
  348. text-decoration: none;
  349. -webkit-tap-highlight-color: transparent;
  350. overflow: hidden;
  351. color: #f94b4b;
  352. }
  353. }
  354. }
  355. }
  356. .list-cell-time{
  357. width: 100%;
  358. height: 58rpx;
  359. line-height: 58rpx;
  360. text-align: left;
  361. font-size: $font-size-20;
  362. color: #999999;
  363. }
  364. }
  365. }
  366. }
  367. .tui-popup-coupon{
  368. width: 100%;
  369. height: 500rpx;
  370. box-sizing: border-box;
  371. padding:30rpx 20rpx;
  372. .tui-popup-h1{
  373. width: 100%;
  374. height: 66rpx;
  375. display: flex;
  376. align-items: center;
  377. .tui-popup-text{
  378. flex: 1;
  379. height: 66rpx;
  380. line-height: 66rpx;
  381. font-size: $font-size-30;
  382. color: #333333;
  383. &.red{
  384. color: #f94b4b;
  385. }
  386. &.bold{
  387. font-weight: bold;
  388. }
  389. &.left{
  390. text-align: left;
  391. }
  392. &.right{
  393. text-align: right;
  394. }
  395. }
  396. }
  397. }
  398. }
  399. .tui-popup-btn {
  400. width: 100%;
  401. height: auto;
  402. float: left;
  403. margin-top: 24rpx;
  404. .tui-button{
  405. width: 100%;
  406. height: 88rpx;
  407. background: $btn-confirm;
  408. line-height: 88rpx;
  409. text-align: center;
  410. color: #FFFFFF;
  411. font-size: $font-size-28;
  412. border-radius: 44rpx;
  413. }
  414. }
  415. }
  416. </style>