coupon.vue 9.7 KB

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