coupon.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <view >
  3. <view class="box_head">
  4. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="button" activeColor="#2F4379"></uni-segmented-control>
  5. </view>
  6. <view class="box">
  7. <view >
  8. <view v-show="current === 0">
  9. <view class="content" v-for="(item,index) in list1" :key="index">
  10. <view>
  11. <u-row >
  12. <u-col span="4" >
  13. <view class="price_box">
  14. <text class="price_num">{{item.price}}</text>
  15. <text class="price_unit">元</text>
  16. </view>
  17. </u-col>
  18. <u-col span="8" >
  19. <view style="margin-top: 20rpx;">
  20. <u-row >
  21. <u-col span="6" >
  22. <view class="coupon_title">
  23. 课程现金券
  24. </view>
  25. </u-col>
  26. <u-col span="4" offset="2">
  27. <view class="coupon_btn">
  28. 立即使用
  29. </view>
  30. </u-col>
  31. </u-row>
  32. </view>
  33. <view class="date">
  34. 有效期:
  35. </view>
  36. <view class="time">
  37. {{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
  38. </view>
  39. <view class="tip">
  40. 仅部分课程使用
  41. </view>
  42. </u-col>
  43. </u-row>
  44. </view>
  45. </view>
  46. </view>
  47. <view v-show="current === 1">
  48. <view class="content" v-for="(item,index) in list2" :key="index">
  49. <view>
  50. <u-row >
  51. <u-col span="4" >
  52. <view class="price_box">
  53. <text class="price_num">{{item.price}}</text>
  54. <text class="price_unit">折</text>
  55. </view>
  56. </u-col>
  57. <u-col span="8" >
  58. <view style="margin-top: 20rpx;">
  59. <u-row >
  60. <u-col span="6" >
  61. <view class="coupon_title">
  62. 课程折扣券
  63. </view>
  64. </u-col>
  65. <u-col span="4" offset="2">
  66. <view class="coupon_btn">
  67. 立即使用
  68. </view>
  69. </u-col>
  70. </u-row>
  71. </view>
  72. <view class="date">
  73. 有效期:
  74. </view>
  75. <view class="time">
  76. {{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
  77. </view>
  78. <view class="tip">
  79. 仅部分课程可使用
  80. </view>
  81. </u-col>
  82. </u-row>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="footer">
  89. <view class="footer_btn" @click="openPopup">
  90. 失效券
  91. </view>
  92. </view>
  93. <u-popup v-model="show" mode="bottom" :safe-area-inset-bottom="true">
  94. <view class="popup_box" >
  95. <scroll-view scroll-y="true" class="popup_list" >
  96. <view class="content" v-for="(item,index) in list3" :key="index" v-show="current === 0">
  97. <view style="position: relative;">
  98. <u-row >
  99. <u-col span="4" >
  100. <view class="price_box">
  101. <text class="price_num">20</text>
  102. <text class="price_unit">元</text>
  103. </view>
  104. </u-col>
  105. <u-col span="8" >
  106. <view style="margin-top: 20rpx;">
  107. <u-row >
  108. <u-col span="6" >
  109. <view class="coupon_title">
  110. 课程现金券
  111. </view>
  112. </u-col>
  113. </u-row>
  114. </view>
  115. <view class="date">
  116. 有效期:
  117. </view>
  118. <view class="time">
  119. {{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
  120. </view>
  121. <view class="tip">
  122. 仅部分课程可使用
  123. </view>
  124. </u-col>
  125. </u-row>
  126. <view>
  127. <image :src="item" class="status_img"></image>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="content" v-for="(item,index) in list4" :key="index" v-show="current === 1">
  132. <view style="position: relative;">
  133. <u-row >
  134. <u-col span="4" >
  135. <view class="price_box">
  136. <text class="price_num">5.5</text>
  137. <text class="price_unit">折</text>
  138. </view>
  139. </u-col>
  140. <u-col span="8" >
  141. <view style="margin-top: 20rpx;">
  142. <u-row >
  143. <u-col span="6" >
  144. <view class="coupon_title">
  145. 课程折扣券
  146. </view>
  147. </u-col>
  148. </u-row>
  149. </view>
  150. <view class="date">
  151. 有效期:
  152. </view>
  153. <view class="time">
  154. {{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
  155. </view>
  156. <view class="tip">
  157. 仅部分课程可使用
  158. </view>
  159. </u-col>
  160. </u-row>
  161. <view>
  162. <image :src="item" class="status_img"></image>
  163. </view>
  164. </view>
  165. </view>
  166. </scroll-view>
  167. </view>
  168. </u-popup>
  169. </view>
  170. </template>
  171. <script>
  172. export default {
  173. data() {
  174. return {
  175. items: [
  176. '现金券(0)',
  177. '折扣券(0)'
  178. ],
  179. list:[],
  180. current:0,
  181. show:false,
  182. list2:[],
  183. list1:['/static/coupon/overdue.png',
  184. '/static/coupon/used.png','/static/coupon/used.png',
  185. '/static/coupon/overdue.png','/static/coupon/overdue.png'],
  186. paramList: [
  187. {
  188. pageNum: 1,
  189. pageSize: 10,
  190. total: 0,
  191. showStatus: 0,
  192. couponType:0,
  193. userStatus:0
  194. },
  195. {
  196. pageNum: 1,
  197. pageSize: 10,
  198. total: 0,
  199. showStatus: 0,
  200. couponType:1,
  201. userStatus:0
  202. }
  203. ],
  204. list1: [],
  205. list2: [],
  206. list3: [],
  207. list4: [],
  208. userParamList: [
  209. {
  210. pageNum: 1,
  211. pageSize: 10,
  212. total: 0,
  213. couponType:0,
  214. userStatus:2
  215. },
  216. {
  217. pageNum: 1,
  218. pageSize: 10,
  219. total: 0,
  220. couponType:1,
  221. userStatus:2
  222. }
  223. ],
  224. }
  225. },
  226. onReachBottom() {
  227. console.log(32423)
  228. },
  229. onLoad(option) {
  230. this.getList1()
  231. this.getList2()
  232. this.getList3()
  233. this.getList4()
  234. },
  235. onShow(){
  236. },
  237. methods: {
  238. getList1(){
  239. let self = this
  240. let param = this.paramList[0]
  241. self.$api.configurationlistCoupon(param).then(res => {
  242. self.list1 = res.data.rows;
  243. self.paramList[0].total = res.data.total;
  244. self.items[0] = '现金券('+res.data.total+')'
  245. });
  246. },
  247. getList2(){
  248. let self = this
  249. let param = this.paramList[1]
  250. self.$api.configurationlistCoupon(param).then(res => {
  251. self.list2 = res.data.rows;
  252. self.paramList[1].total = res.data.total;
  253. self.items[1] = '折扣券('+res.data.total+')'
  254. });
  255. },
  256. getList3(){
  257. let self = this
  258. let param = this.userParamList[0]
  259. self.$api.configurationlistCoupon(param).then(res => {
  260. self.list3 = res.data.rows;
  261. self.userParamList[0].total = res.data.total;
  262. });
  263. },
  264. getList4(){
  265. let self = this
  266. let param = this.userParamList[1]
  267. self.$api.configurationlistCoupon(param).then(res => {
  268. self.list4 = res.data.rows;
  269. self.userParamList[1].total = res.data.total;
  270. });
  271. },
  272. onClickItem(e){
  273. this.current = e.currentIndex
  274. },
  275. openPopup(){
  276. this.show = true
  277. }
  278. },
  279. }
  280. </script>
  281. <style>
  282. ::-webkit-scrollbar{
  283. width: 0;
  284. height: 0;
  285. color: transparent;
  286. }
  287. .u-drawer-content-visible{
  288. border-radius: 32rpx 32rpx 0rpx 0rpx;
  289. overflow: hidden;
  290. }
  291. </style>
  292. <style scope>
  293. .status_img{
  294. width: 161rpx;
  295. height: 161rpx;
  296. position: absolute;
  297. top: 40rpx;
  298. left: 20%;
  299. }
  300. .popup_list{
  301. border-radius: 32rpx 32rpx 0rpx 0rpx;
  302. height: 580rpx;
  303. margin-bottom: 20rpx;
  304. }
  305. .popup_box{
  306. height: 600rpx;
  307. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  308. border-radius: 32rpx 32rpx 0rpx 0rpx;
  309. background: #F2F3F6;
  310. padding-left: 20rpx;
  311. padding-right: 20rpx;
  312. }
  313. .footer_btn{
  314. width: 686rpx;
  315. height: 88rpx;
  316. background: #FFFFFF;
  317. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  318. border-radius: 32rpx;
  319. text-align: center;
  320. line-height: 88rpx;
  321. margin: 0 auto;
  322. margin-top: 10rpx;
  323. }
  324. .footer{
  325. position: fixed;
  326. bottom: 0;
  327. width: 100%;
  328. height: 120rpx;
  329. background: #F2F3F6;
  330. text-align: center;
  331. }
  332. .price_box view{
  333. padding: 0;
  334. }
  335. .date{
  336. font-size: 20rpx;
  337. color: #636A75;
  338. margin-top: 20rpx;
  339. }
  340. .time{
  341. font-size: 20rpx;
  342. color: #636A75;
  343. margin-top: 20rpx;
  344. }
  345. .tip{
  346. font-size: 20rpx;
  347. color: #636A75;
  348. opacity: 0.5;
  349. margin-top: 20rpx;
  350. }
  351. .coupon_btn{
  352. width: 112rpx;
  353. height: 48rpx;
  354. background: #32467B;
  355. border-radius: 16rpx;
  356. line-height: 48rpx;
  357. text-align: center;
  358. font-size: 20rpx;
  359. color: #FFFFFF;
  360. }
  361. .coupon_title{
  362. width: 140rpx;
  363. height: 48rpx;
  364. background: #FFFFFF;
  365. border: 2rpx solid #32467B;
  366. border-radius: 16rpx;
  367. font-size: 24rpx;
  368. color: #636A75;
  369. line-height: 48rpx;
  370. text-align: center;
  371. }
  372. .price_box{
  373. text-align: center;
  374. vertical-align: middle;
  375. height: 240rpx;
  376. border-right:1px dashed #EEEEEE;
  377. }
  378. .price_unit{
  379. font-size: 24rpx;
  380. color: #636A75;
  381. }
  382. .price_num{
  383. font-size: 88rpx;
  384. font-family: Impact;
  385. font-weight: bold;
  386. color: #32467B;
  387. line-height: 240rpx;
  388. }
  389. .box_head{
  390. z-index: 999;
  391. padding: 20rpx 100rpx;
  392. height: 96rpx;
  393. position: fixed;
  394. width: 100%;
  395. background-color: #F2F3F6;
  396. text-align: center;
  397. }
  398. .box{
  399. padding-top: 96rpx;
  400. padding-left: 20rpx;
  401. padding-right: 20rpx;
  402. padding-bottom: 120rpx;
  403. overflow-x: hidden;
  404. overflow-y: auto;
  405. }
  406. .c_log{
  407. font-size: 20rpx;
  408. font-family: PingFang SC;
  409. font-weight: 400;
  410. color: #2F4379;
  411. position: absolute;
  412. bottom: 10rpx;
  413. }
  414. .c_title{
  415. font-size: 30rpx;
  416. font-family: PingFang SC;
  417. font-weight: bold;
  418. color: #2F4379;
  419. padding-top: 10rpx;
  420. }
  421. .c_img{
  422. width: 278rpx;
  423. height: 134rpx;
  424. }
  425. .c_t1{
  426. font-size: 20rpx;
  427. color: #2F4379;
  428. padding: 15rpx;
  429. }
  430. .content{
  431. margin-top: 20rpx;
  432. width: 100%;
  433. height: 240rpx;
  434. background: #FFFFFF;
  435. border-radius: 32rpx;
  436. position: relative;
  437. }
  438. .content:after {
  439. content: '';
  440. position: absolute;
  441. top: 0px;
  442. bottom: 0px;
  443. left: -35rpx;
  444. width: 70rpx;
  445. height: 100%;
  446. background: radial-gradient(circle, #F2F3F6, #F2F3F6 30rpx, transparent 35rpx);
  447. }
  448. .content:before {
  449. content: '';
  450. position: absolute;
  451. top: 0px;
  452. bottom: 0px;
  453. right: -35rpx;
  454. width: 70rpx;
  455. height: 100%;
  456. background: radial-gradient(circle, #F2F3F6, #F2F3F6 30rpx, transparent 35rpx);
  457. }
  458. .segmented-control__text{
  459. font-size: 24rpx !important;
  460. }
  461. .segmented-control{
  462. height: 56rpx !important;
  463. background-color: #F8F9FF;
  464. }
  465. page {
  466. background: #F2F3F6;
  467. }
  468. </style>