DiscountCoupon.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <template>
  2. <view class="content" :class="['qn-page-' + theme]">
  3. <view class="sort-sel-view">
  4. <block v-for="(item, index) in tabList" :key="index">
  5. <view class="sort-btn">
  6. <span :class="[type === item.index?'actives primary-color':'']" @click="toggleTab(item.index)">
  7. {{ item.tabName }}
  8. </span>
  9. <span
  10. class="split-line primary-btn"
  11. v-if="type === item.index"
  12. ></span>
  13. </view>
  14. </block>
  15. </view>
  16. <scroll-view scroll-y="true" class="out-scroll" @scrolltolower="scrolltolower">
  17. <!-- 空白页 -->
  18. <Aempty text="您还没有优惠券哦~~" src="https://onlineimg.qianniao.vip/coupon.png" v-if="discountList.length === 0"></Aempty>
  19. <block v-if="type === 5">
  20. <view class="discount-mian">
  21. <block v-for="(item, index) in discountList" :key="index">
  22. <view class="discount-mian-list clearfix">
  23. <image src="https://onlineimg.qianniao.vip/coupon/coupon_bg.png" class="mian-list-img" alt="" />
  24. <view class="mian-Icon-top"></view>
  25. <view class="mian-Icon-bottom"></view>
  26. <view class="mian-list-left">
  27. <view class="list-title-mian primary-color">
  28. <span style="font-size: 56upx;font-weight:500;">{{ Number(item.reducePrice) }}</span>
  29. </view>
  30. <view class="list-title-subheading primary-color">
  31. {{ item.applyRange === 10 ? '全店商品通用' : item.applyRange === 20 ? '指定分类商品可用' : item.applyRange === 30 ? '指定品牌商品可用' : '' }}
  32. </view>
  33. </view>
  34. <view class="mian-list-right">
  35. <view class="list-right-shop">{{ item.name }}</view>
  36. <view class="list-right-time">有效期至:{{ $_utils.formatDate(item.endTime, 'yyyy-MM-dd') }}</view>
  37. </view>
  38. <view
  39. class="liet-right-click primary-btn-pain"
  40. @click="goPage('/pages/classification/cate', 'switchTab')"
  41. >
  42. 立即使用
  43. </view>
  44. <view class="coupon-ruls" v-if="item.minPrice === '不限金额' || Number(item.minPrice) === 0">无门槛使用</view>
  45. <view class="coupon-ruls" v-else>满{{ item.minPrice }}元可用</view>
  46. </view>
  47. </block>
  48. </view>
  49. </block>
  50. <block v-if="type === 4">
  51. <view class="discount-mian used-main">
  52. <block v-for="(item, index) in discountList" :key="index">
  53. <view class="discount-mian-list clearfix">
  54. <image src="https://onlineimg.qianniao.vip/coupon/coupon_bg.png" class="mian-list-img" alt="" />
  55. <view class="mian-Icon-top"></view>
  56. <view class="mian-Icon-bottom"></view>
  57. <view class="mian-list-left">
  58. <view class="list-title-mian primary-color">
  59. <span style="font-size: 56upx;font-weight:500;">{{ Number(item.reducePrice) }}</span>
  60. </view>
  61. <view class="list-title-subheading primary-color">
  62. {{ item.applyRange === 10 ? '全店商品通用' : item.applyRange === 20 ? '指定分类商品可用' : item.applyRange === 30 ? '指定品牌商品可用' : '' }}
  63. </view>
  64. </view>
  65. <view class="mian-list-right">
  66. <view class="list-right-shop">{{ item.name }}</view>
  67. <view class="list-right-time">有效期至:{{ $_utils.formatDate(item.endTime, 'yyyy-MM-dd') }}</view>
  68. </view>
  69. <text class="coupon-tag ibonfont ibonyishiyong" style="color: #c77556"></text>
  70. <view class="coupon-ruls" v-if="item.minPrice === '不限金额'">无门槛使用</view>
  71. <view class="coupon-ruls" v-else>满{{ item.minPrice }}元可用</view>
  72. </view>
  73. </block>
  74. </view>
  75. </block>
  76. <block v-if="type === 3">
  77. <view class="discount-mian void-main">
  78. <block v-for="(item, index) in discountList" :key="index">
  79. <view class="discount-mian-list clearfix">
  80. <image src="https://onlineimg.qianniao.vip/coupon/coupon_bg.png" class="mian-list-img" alt="" />
  81. <view class="mian-list-left">
  82. <view class="list-title-mian">
  83. <span style="font-size: 56upx;font-weight:500;">{{ Number(item.reducePrice) }}</span>
  84. </view>
  85. <view class="list-title-subheading">
  86. {{ item.applyRange === 10 ? '全店商品通用' : item.applyRange === 20 ? '指定分类商品可用' : item.applyRange === 30 ? '指定品牌商品可用' : '' }}
  87. </view>
  88. </view>
  89. <view class="mian-list-right">
  90. <view class="list-right-shop">{{ item.name }}</view>
  91. <view class="list-right-time">有效期至:{{ $_utils.formatDate(item.endTime, 'yyyy-MM-dd') }}</view>
  92. </view>
  93. <text class="coupon-tag ibonfont ibonyiguoqi" style="color: #999999"></text>
  94. <view class="coupon-ruls" v-if="item.minPrice === '不限金额'">无门槛使用</view>
  95. <view class="coupon-ruls" v-else>满{{ item.minPrice }}元可用</view>
  96. </view>
  97. </block>
  98. </view>
  99. </block>
  100. <u-loadmore margin-top="20" v-if="discountList.length" :status="loading_status" />
  101. </scroll-view>
  102. <view class="buttom-btn">
  103. <text class="float_left get-coupon" @click="goCoupon('get')">领券中心</text>
  104. <text class="line"></text>
  105. <text class="float_right my-coupon" @click="goCoupon('mine')">我的优惠券</text>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. export default {
  111. data() {
  112. return {
  113. loading_status: 'loadmore',
  114. type: 5,
  115. tabList: [
  116. {
  117. tabName: '待使用',
  118. index: 5
  119. },
  120. {
  121. tabName: '已使用',
  122. index: 4
  123. },
  124. {
  125. tabName: '已过期',
  126. index: 3
  127. }
  128. ],
  129. page: 1,
  130. pageSize: 10,
  131. pageTotal: 0,
  132. discountList: []
  133. };
  134. },
  135. onLoad() {
  136. this.getData();
  137. },
  138. methods: {
  139. toggleTab(index) {
  140. this.type = index;
  141. this.getData();
  142. },
  143. scrolltolower() {
  144. if (this.pageTotal / this.pageSize > this.page) {
  145. this.page += 1;
  146. this.getData();
  147. }
  148. },
  149. getData() {
  150. this.loading_status = 'loading';
  151. this.$u.api.couponAll({
  152. type: this.type,
  153. page: this.page,
  154. pageSize: this.pageSize
  155. }).then(({ data, pageTotal })=>{
  156. this.pageTotal = pageTotal;
  157. if (this.page === 1) {
  158. this.discountList = data;
  159. } else {
  160. this.discountList = data.concat(data);
  161. }
  162. this.loading_status = this.$_utils.loadStatus(this.discountList.length, data.pageTotal);
  163. });
  164. },
  165. // 页面跳转
  166. goCoupon(row) {
  167. const text = row;
  168. if (text === 'get') {
  169. this.goPage('/pagesT/user/GetCoupon', 'redirectTo');
  170. } else {
  171. // this.$api.msg('您已在我的优惠券列表页面');
  172. }
  173. }
  174. }
  175. };
  176. </script>
  177. <style>
  178. page {
  179. background: #f5f5f5;
  180. }
  181. </style>
  182. <style lang="scss">
  183. .content {
  184. width: 750rpx;
  185. // height: calc(100vh - 200upx);
  186. // overflow: scroll;
  187. }
  188. .out-scroll {
  189. height: calc(100vh - 180upx);
  190. }
  191. // 底部按钮
  192. .buttom-btn {
  193. background-color: #ffffff;
  194. position: fixed;
  195. bottom: 0;
  196. width: 100%;
  197. z-index: 95;
  198. box-shadow: 0 0 10upx 1px #e7e7e7;
  199. display: flex;
  200. .get-coupon {
  201. flex: 2;
  202. border-right: 1upx solid #f4f4f4;
  203. text-align: center;
  204. font-size: 28rpx;
  205. line-height: 88upx;
  206. color: #333;
  207. }
  208. .my-coupon {
  209. flex: 2;
  210. text-align: center;
  211. font-size: 28rpx;
  212. line-height: 88upx;
  213. color: #333;
  214. }
  215. }
  216. .sort-sel-view {
  217. display: flex;
  218. background: #fff;
  219. }
  220. .sort-sel-view .sort-btn {
  221. flex: 3;
  222. text-align: center;
  223. color: #111111;
  224. line-height: 80upx;
  225. font-weight: 300;
  226. position: relative;
  227. font-size: 24upx;
  228. }
  229. .split-line {
  230. position: absolute;
  231. display: block;
  232. width: 48upx;
  233. height: 6upx;
  234. background: $base-btn-bg;
  235. border-radius: 8upx;
  236. bottom: 6upx;
  237. left: 50%;
  238. transform: translateX(-24upx);
  239. }
  240. .sort-sel-view .sort-btn:last-child {
  241. border-right: 0 none;
  242. }
  243. .sort-sel-view .sort-btn .actives {
  244. color: #6eb74b;
  245. font-weight: 500;
  246. font-size: 28upx;
  247. }
  248. .discount-mian {
  249. width: 750rpx;
  250. height: auto;
  251. }
  252. .discount-mian-list {
  253. border-radius: 10rpx;
  254. background-color: #FFFFFF;
  255. width: 700upx;
  256. height: 200upx;
  257. position: relative;
  258. margin: 24upx auto 0;
  259. box-shadow: 0px 38upx 14upx -30upx #e7e7e7;
  260. }
  261. .mian-list-img {
  262. width: 700upx;
  263. height: 200upx;
  264. border-radius: 6px;
  265. }
  266. .mian-list-left {
  267. width: 200upx;
  268. height: 200upx;
  269. position: absolute;
  270. left: 0upx;
  271. top: 0upx;
  272. z-index: 10;
  273. }
  274. .mian-list-left-stock {
  275. width: 200upx;
  276. height: 200upx;
  277. border-right: 1upx dashed rgba(157, 113, 53, 0.5);
  278. position: absolute;
  279. left: 0upx;
  280. top: 0upx;
  281. z-index: 10;
  282. }
  283. .mian-list-left-color {
  284. width: 200upx;
  285. height: 200upx;
  286. border-right: 1upx dashed rgba(152, 152, 152, 0.5);
  287. position: absolute;
  288. left: 0upx;
  289. top: 0upx;
  290. z-index: 10;
  291. }
  292. .mian-Icon-top {
  293. height: 12upx;
  294. width: 24upx;
  295. position: absolute;
  296. left: 190upx;
  297. top: 0upx;
  298. border-radius: 0 0 100upx 100upx;
  299. z-index: 999;
  300. }
  301. .mian-Icon-bottom {
  302. height: 12upx;
  303. width: 24upx;
  304. position: absolute;
  305. left: 190upx;
  306. top: 190upx;
  307. border-radius: 100upx 100upx 0 0;
  308. z-index: 999;
  309. }
  310. .list-left-title {
  311. height: 140upx;
  312. width: 140upx;
  313. position: absolute;
  314. left: 30upx;
  315. top: 30upx;
  316. }
  317. .list-title-mian {
  318. font-size: 28upx;
  319. color: #45a418;
  320. position: absolute;
  321. top: 16upx;
  322. font-weight: 300;
  323. left: 0;
  324. text-align: center;
  325. width: 200upx;
  326. }
  327. .list-title-mian-color {
  328. color: #9c9c9c;
  329. }
  330. .list-title-mian-stock {
  331. font-size: 30upx;
  332. color: #c89857;
  333. position: absolute;
  334. top: 45upx;
  335. left: 45upx;
  336. }
  337. .list-title-mian-stock > span {
  338. font-size: 42upx;
  339. }
  340. .list-title-mian-color > span {
  341. font-size: 42upx;
  342. }
  343. .list-title-mian > span {
  344. font-size: 42upx;
  345. }
  346. .list-title-subheading {
  347. font-size: 24upx;
  348. color: #45a418;
  349. position: absolute;
  350. top: 75upx;
  351. left: 0;
  352. font-weight: 300;
  353. padding-top: 12upx;
  354. width: 216upx;
  355. text-align: center;
  356. }
  357. .list-title-subheading-color {
  358. color: #9c9c9c;
  359. }
  360. .list-title-subheading-stock {
  361. font-size: 26upx;
  362. color: #c89857;
  363. position: absolute;
  364. top: 105upx;
  365. left: 0;
  366. }
  367. .mian-list-right {
  368. width: 320upx;
  369. height: 200upx;
  370. position: absolute;
  371. left: 200upx;
  372. top: 36upx;
  373. z-index: 10;
  374. color: #333;
  375. }
  376. .list-right-shop {
  377. font-size: 30upx;
  378. line-height: 36upx;
  379. padding-bottom: 10upx;
  380. width: 100%;
  381. overflow: hidden;
  382. height: 36upx;
  383. text-overflow: -o-ellipsis-lastline;
  384. text-overflow: ellipsis;
  385. display: -webkit-box;
  386. -webkit-line-clamp: 1;
  387. line-clamp: 1;
  388. -webkit-box-orient: vertical;
  389. }
  390. .list-right-annotation {
  391. font-size: 24upx;
  392. position: absolute;
  393. top: 80upx;
  394. left: 30upx;
  395. font-weight: 300;
  396. }
  397. .coupon-ruls {
  398. font-size: 24upx;
  399. color: #666;
  400. font-weight: 300;
  401. position: absolute;
  402. bottom: 14upx;
  403. left: 24upx;
  404. }
  405. .list-right-time {
  406. font-size: 24upx;
  407. /* position: absolute;
  408. top: 100upx;
  409. left: 30upx; */
  410. font-weight: 300;
  411. }
  412. .liet-right-click {
  413. font-size: 24upx;
  414. color: $uni-color-primary;
  415. width: 132upx;
  416. height: 50upx;
  417. border-radius: 8upx;
  418. text-align: center;
  419. line-height: 50upx;
  420. font-weight: 300;
  421. position: absolute;
  422. right: 30upx;
  423. top: 45upx;
  424. border: 1px solid $uni-color-primary;
  425. }
  426. .coupon-tag {
  427. position: absolute;
  428. right: 30upx;
  429. top: 45upx;
  430. width: 128upx;
  431. height: 128upx;
  432. font-size: 120rpx;
  433. }
  434. .void-main .list-title-mian,
  435. .void-main .list-title-subheading,
  436. .void-main .mian-list-right {
  437. color: #999;
  438. }
  439. .used-main .list-title-mian {
  440. // color: #a8e063;
  441. opacity: 0.6;
  442. }
  443. </style>