coupon.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view ref="container">
  3. <view class="search-cont">
  4. <view class="inner">
  5. <image class="icon-search" src="/static/images/search.png" mode=""></image>
  6. <input type="text" value="" placeholder="输入订单号" confirm-type="搜索" @confirm="goSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
  7. </view>
  8. </view>
  9. <view class="tui-coupon-list">
  10. <view class="tui-coupon-item tui-top20" v-for="(item, index) in couponsList" :key="index">
  11. <image src="/static/images/bg_coupon_3x.png" class="tui-coupon-bg" mode="widthFix"></image>
  12. <view class="tui-coupon-item-left">
  13. <view class="tui-coupon-price-box" :class="{ 'tui-color-grey': item.receiveCount>0 }">
  14. <view class="tui-coupon-price-sign">¥</view>
  15. <view class="tui-coupon-price" :class="{ 'tui-price-small': false }">{{ item.couponPrice }}</view>
  16. </view>
  17. <view class="tui-coupon-intro">满{{ item.useMinPrice }}元可用</view>
  18. </view>
  19. <view class="tui-coupon-item-right">
  20. <view class="tui-coupon-content">
  21. <view class="tui-coupon-title-box">
  22. <view class="tui-coupon-title">{{ item.couponName }}</view>
  23. </view>
  24. <view class="tui-coupon-rule">
  25. <view class="tui-rule-box tui-padding-btm">
  26. <view class="tui-coupon-circle"></view>
  27. <view class="tui-coupon-text">不可叠加使用</view>
  28. </view>
  29. <view class="tui-rule-box">
  30. <view class="tui-coupon-circle"></view>
  31. <view class="tui-coupon-text">{{ item.limitTime }} 到期</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="tui-btn-box">
  37. <view class="btn receive" @click="show(item)">查看</view>
  38. </view>
  39. </view>
  40. </view>
  41. <Loading :loaded="loadend" :loading="loading"></Loading>
  42. <!--暂无优惠券-->
  43. <view v-if="couponsList.length == 0 && page > 1" class="no-data-box" >
  44. <image src="/static/images/no_data.png" mode="aspectFit"></image>
  45. <view class="empty-title">暂无数据</view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import { getCompanyCouponIssueList, receive } from '@/api/coupon'
  51. import Loading from '@/components/Loading'
  52. export default {
  53. name: 'getCoupon',
  54. components: {
  55. Loading,
  56. },
  57. props: {},
  58. data: function() {
  59. return {
  60. searchKey:null,
  61. limit: 10,
  62. couponsList: [],
  63. loading: false,
  64. loadend: false,
  65. page: 1,
  66. limit: 10,
  67. }
  68. },
  69. onLoad(options) {
  70. },
  71. mounted: function() {
  72. },
  73. onShow() {
  74. this.getCompanyCouponIssueList()
  75. },
  76. onReachBottom() {
  77. !this.loading && this.getCompanyCouponIssueList()
  78. },
  79. methods: {
  80. goSearch(e) {
  81. this.searchKey=e.detail.value;
  82. this.page=1;
  83. this.couponsList=[];
  84. this.getCompanyCouponIssueList()
  85. },
  86. show(item){
  87. uni.navigateTo({
  88. url: '../couponDetails?id=' +item.id+"&type=1"
  89. })
  90. },
  91. getCompanyCouponIssueList() {
  92. if (this.loading) return //阻止下次请求(false可以进行请求);
  93. if (this.loadend) return //阻止结束当前请求(false可以进行请求);
  94. this.loading = true
  95. var q=null;
  96. if(this.searchKey!=null){
  97. q = { couponPrice:this.searchKey, page: this.page, pageSize: this.limit,couponType:2 }
  98. }
  99. else{
  100. q = { page: this.page, pageSize: this.limit,couponType:2 }
  101. }
  102. getCompanyCouponIssueList(q).then(res => {
  103. this.loading = false
  104. this.couponsList.push.apply(this.couponsList, res.data.list)
  105. this.loadend = res.data.list.length < this.limit //判断所有数据是否加载完成;
  106. this.page = this.page + 1
  107. })
  108. },
  109. },
  110. }
  111. </script>
  112. <style lang="less" scoped>
  113. page {
  114. background-color: #f5f5f5;
  115. }
  116. .container {
  117. padding-bottom: env(safe-area-inset-bottom);
  118. }
  119. .search-cont{
  120. width: 100%;
  121. z-index: 999;
  122. position: fixed;
  123. top: 0;
  124. left: 0;
  125. padding: 0upx 30upx;
  126. background-color: #FFFFFF;
  127. .inner{
  128. box-sizing: border-box;
  129. width: 100%;
  130. height: 72upx;
  131. line-height: 72upx;
  132. background: #F7F7F7;
  133. border-radius: 36upx;
  134. display: flex;
  135. align-items: center;
  136. padding: 0 30upx;
  137. .icon-search{
  138. width: 28upx;
  139. height: 28upx;
  140. margin-right: 20upx;
  141. }
  142. input{
  143. height: 60upx;
  144. line-height: 60upx;
  145. flex: 1;
  146. }
  147. }
  148. }
  149. .tui-coupon-list {
  150. margin-top: 72rpx;
  151. width: 100%;
  152. padding: 0 25rpx;
  153. box-sizing: border-box;
  154. }
  155. .tui-coupon-item {
  156. width: 100%;
  157. height: 210rpx;
  158. position: relative;
  159. display: flex;
  160. align-items: center;
  161. padding-right: 30rpx;
  162. box-sizing: border-box;
  163. overflow: hidden;
  164. }
  165. .tui-coupon-bg {
  166. width: 100%;
  167. height: 210rpx;
  168. position: absolute;
  169. left: 0;
  170. top: 0;
  171. z-index: 1;
  172. }
  173. .tui-coupon-sign {
  174. height: 110rpx;
  175. width: 110rpx;
  176. position: absolute;
  177. z-index: 9;
  178. top: -30rpx;
  179. right: 40rpx;
  180. }
  181. .tui-coupon-item-left {
  182. width: 218rpx;
  183. height: 210rpx;
  184. position: relative;
  185. z-index: 2;
  186. display: flex;
  187. align-items: center;
  188. justify-content: center;
  189. flex-direction: column;
  190. flex-shrink: 0;
  191. }
  192. .tui-coupon-price-box {
  193. display: flex;
  194. color: #e41f19;
  195. align-items: flex-end;
  196. }
  197. .tui-coupon-price-sign {
  198. font-size: 30rpx;
  199. }
  200. .tui-coupon-price {
  201. font-size: 32rpx;
  202. line-height: 68rpx;
  203. font-weight: bold;
  204. }
  205. .tui-price-small {
  206. font-size: 58rpx !important;
  207. line-height: 56rpx !important;
  208. }
  209. .tui-coupon-intro {
  210. background: #f7f7f7;
  211. padding: 8rpx 10rpx;
  212. font-size: 26rpx;
  213. line-height: 26rpx;
  214. font-weight: 400;
  215. color: #666;
  216. margin-top: 18rpx;
  217. }
  218. .tui-coupon-item-right {
  219. flex: 1;
  220. height: 210rpx;
  221. position: relative;
  222. z-index: 2;
  223. display: flex;
  224. align-items: center;
  225. justify-content: space-between;
  226. padding-left: 24rpx;
  227. box-sizing: border-box;
  228. overflow: hidden;
  229. }
  230. .tui-coupon-content {
  231. width: 82%;
  232. display: flex;
  233. flex-direction: column;
  234. justify-content: center;
  235. }
  236. .tui-coupon-title-box {
  237. display: flex;
  238. align-items: center;
  239. }
  240. .tui-coupon-btn {
  241. padding: 6rpx;
  242. background: #ffebeb;
  243. color: #e41f19;
  244. font-size: 25rpx;
  245. line-height: 25rpx;
  246. display: flex;
  247. align-items: center;
  248. justify-content: center;
  249. transform: scale(0.9);
  250. transform-origin: 0 center;
  251. border-radius: 4rpx;
  252. flex-shrink: 0;
  253. }
  254. .tui-color-grey {
  255. color: #888 !important;
  256. }
  257. .tui-bg-grey {
  258. background: #f0f0f0 !important;
  259. color: #888 !important;
  260. }
  261. .tui-coupon-title {
  262. width: 100%;
  263. font-size: 26rpx;
  264. color: #333;
  265. white-space: nowrap;
  266. overflow: hidden;
  267. text-overflow: ellipsis;
  268. }
  269. .tui-coupon-rule {
  270. padding-top: 52rpx;
  271. }
  272. .tui-rule-box {
  273. display: flex;
  274. align-items: center;
  275. transform: scale(0.8);
  276. transform-origin: 0 100%;
  277. }
  278. .tui-padding-btm {
  279. padding-bottom: 6rpx;
  280. }
  281. .tui-coupon-circle {
  282. width: 8rpx;
  283. height: 8rpx;
  284. background: rgb(160, 160, 160);
  285. border-radius: 50%;
  286. }
  287. .tui-coupon-text {
  288. font-size: 28rpx;
  289. line-height: 28rpx;
  290. font-weight: 400;
  291. color: #666;
  292. padding-left: 8rpx;
  293. white-space: nowrap;
  294. }
  295. .tui-top20 {
  296. margin-top: 20rpx;
  297. }
  298. .tui-coupon-title {
  299. font-size: 28rpx;
  300. line-height: 28rpx;
  301. }
  302. .tui-coupon-radio {
  303. transform: scale(0.7);
  304. transform-origin: 100% center;
  305. }
  306. .tui-btn-box {
  307. position: absolute;
  308. right: 20rpx;
  309. bottom: 40rpx;
  310. z-index: 10;
  311. .btn{
  312. width: 155upx;
  313. height: 64upx;
  314. line-height: 64upx;
  315. font-size: 26upx;
  316. font-family: PingFang SC;
  317. font-weight: 500;
  318. text-align: center;
  319. border-radius: 32upx;
  320. margin-left: 15upx;
  321. &.cancel{
  322. border: 1px solid red;
  323. color: red;
  324. }
  325. &.receive{
  326. background: red;
  327. color: #FFFFFF;
  328. }
  329. }
  330. }
  331. </style>