index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view class="pages">
  3. <!-- 切换选项 -->
  4. <view class="nav">
  5. <view @tap="change(0)" :class="{nav_btna:status == 0}">可使用</view>
  6. <view @tap="change(1)" :class="{nav_btna:status == 1}">已使用</view>
  7. <view @tap="change(2)" :class="{nav_btna:status == 2}">已失效</view>
  8. </view>
  9. <!-- 全部订单 -->
  10. <view class="cont_one">
  11. <view class="cont_one_ce" v-for="(item,index) in dataList" :key='index'>
  12. <view class="cont_one_top">
  13. <view class="cont_one_top_le flex align-center">
  14. <image :src="item.shopId==0 || item.shopId==null?imgtype2:imgtype1" style="margin-right: 10rpx;width: 65rpx;height: 35rpx;border-radius: 8rpx;" mode=""></image>
  15. {{item.couponName}}
  16. </view>
  17. <view class="cont_one_top_ri"><text>¥</text>{{item.money}}</view>
  18. </view>
  19. <view class="cont_one_text" style="font-size: 28upx;">
  20. <text>有效期至{{item.expirationTime}}</text>
  21. <view v-if="item.minMoney" >满{{item.minMoney}}元可用</view>
  22. <view v-if="!item.minMoney" >无门槛优惠券</view>
  23. </view>
  24. <view class="cont_one_bottom">
  25. <view class="cont_one_bottom_le" >
  26. 优惠券一张
  27. </view>
  28. <view class="cont_one_bottom_ri flex justify-center align-center" @click="use(item)" v-if="status == 0">立即使用</view>
  29. </view>
  30. <view class="cont_one_img" v-if="status == 1">
  31. <image src="../static/coupon/has.png" mode=""></image>
  32. </view>
  33. <view class="cont_one_img" v-if="status == 2">
  34. <image src="../static/coupon/failure.png" mode=""></image>
  35. </view>
  36. </view>
  37. </view>
  38. <empty v-if="!dataList.length" ></empty>
  39. <u-popup v-model="popupShow" closeable mode="center" border-radius="20">
  40. <view class="margin-tb text-center text-lg text-bold">使用规则</view>
  41. <view class="padding-lr padding-bottom">
  42. <view style="color: #333333;font-size: 28upx;width: 550rpx;height: 70vh;" v-html="content"></view>
  43. </view>
  44. </u-popup>
  45. </view>
  46. </template>
  47. <script>
  48. import empty from '@/components/empty.vue'
  49. export default {
  50. components: {
  51. empty
  52. },
  53. data() {
  54. return {
  55. imgtype1:'https://www.daweilinli.com/file/uploadPath/2022/11/23/24b686b872b3001f0342eae67db6d482.png',
  56. imgtype2:'https://www.daweilinli.com/file/uploadPath/2022/11/23/7716e0595580f34c4778ce5626dae262.png',
  57. btnnum: 0,
  58. page: 1,
  59. limit: 10,
  60. status: 0, //0正常 1已使用 2已失效
  61. dataList: [],
  62. popupShow: false,
  63. content: '',
  64. totalCount: 0
  65. };
  66. },
  67. onLoad() {
  68. this.getData()
  69. // this.getGuize()
  70. },
  71. methods: {
  72. change(e) {
  73. this.status = e
  74. this.page = 1
  75. this.dataList = []
  76. this.getData()
  77. },
  78. getData() {
  79. let data = {
  80. status: this.status,
  81. page: this.page,
  82. limit: this.limit,
  83. }
  84. this.$Request.get("/app/coupon/CouponList", data).then(res => {
  85. if (res.code == 0) {
  86. this.totalCount = res.data.totalCount
  87. if (this.page == 1) {
  88. this.dataList = res.data.list
  89. } else {
  90. this.dataList = [...this.dataList, ...res.data.list]
  91. }
  92. }
  93. });
  94. },
  95. //优惠卷兑换规则
  96. getGuize() {
  97. this.$Request.getT('/app/common/type/240').then(res => {
  98. if (res.code == 0) {
  99. this.content = res.data.value;
  100. }
  101. })
  102. },
  103. use(item) {
  104. if(!item.shopId){
  105. uni.switchTab({
  106. url: '/pages/index/index'
  107. })
  108. }else{
  109. uni.navigateTo({
  110. url: '/pages/index/shop/index?shopId=' + item.shopId
  111. });
  112. }
  113. }
  114. },
  115. onReachBottom: function() {
  116. if(this.dataList.length<this.totalCount) {
  117. this.page = this.page + 1;
  118. this.getData()
  119. } else {
  120. uni.showToast({
  121. title: '已经到底了',
  122. icon: 'none'
  123. })
  124. }
  125. },
  126. }
  127. </script>
  128. <style scoped>
  129. /* 切换选项 */
  130. .nav {
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. background-color: #FFFFFF;
  135. color: #999999;
  136. }
  137. .nav view {
  138. flex-grow: 1;
  139. margin: 3% 9% 2%;
  140. text-align: center;
  141. }
  142. .nav_btna {
  143. font-size: 38rpx;
  144. line-height: 34rpx;
  145. border-bottom: 14rpx solid #FCD202;
  146. color: #000000;
  147. font-weight: bold;
  148. }
  149. /* 内容 */
  150. /* 全部订单 */
  151. .cont_one {
  152. /* display: none; */
  153. width: 94%;
  154. margin: 0 auto;
  155. }
  156. .cont_one_ce {
  157. width: 100%;
  158. padding: 3% 3% 2%;
  159. margin: 3% 0 0;
  160. background-color: #FFFFFF;
  161. border-radius: 18rpx;
  162. position: relative;
  163. }
  164. .cont_one_top {
  165. display: flex;
  166. width: 100%;
  167. }
  168. .cont_one_top_le {
  169. flex: 2;
  170. font-size: 35rpx;
  171. font-weight: 800;
  172. color: #000000;
  173. line-height: 32rpx;
  174. }
  175. .cont_one_top_le2 {
  176. flex: 2;
  177. font-size: 35rpx;
  178. font-weight: 800;
  179. color: #999999;
  180. line-height: 32rpx;
  181. }
  182. .cont_one_top_ri {
  183. flex: 1;
  184. font-size: 40rpx;
  185. text-align: right;
  186. font-family: DINPro;
  187. font-weight: 500;
  188. color: #FF130A;
  189. line-height: 32rpx;
  190. }
  191. .cont_one_top_ri text {
  192. font-size: 30rpx;
  193. }
  194. .cont_one_text {
  195. font-size: 30rpx;
  196. margin: 2% 0 1%;
  197. font-weight: 400;
  198. color: #999999;
  199. display: flex;
  200. justify-content: space-between;
  201. }
  202. .cont_one_bottom {
  203. width: 100%;
  204. padding: 3% 0 0;
  205. margin-top: 3%;
  206. display: flex;
  207. border-top: 2rpx dotted #E6E6E6;
  208. }
  209. .cont_one_bottom_le {
  210. width: 80%;
  211. /* font-size: 30rpx; */
  212. font-weight: 500;
  213. color: #999999;
  214. line-height: 2;
  215. }
  216. .cont_one_bottom_ri {
  217. width: 20%;
  218. text-align: center;
  219. /* line-height: 2; */
  220. background: rgba(255, 19, 10, 0.2);
  221. font-size: 24rpx;
  222. border: 2rpx solid #FF130A;
  223. color: #FF130A;
  224. opacity: 0.6;
  225. border-radius: 50rpx;
  226. }
  227. /* 到店取餐 */
  228. /* .cont_two {
  229. display: none;width: 94%;margin: 0 auto;
  230. }
  231. .cont_two_ce{
  232. width: 94%;padding: 3% 3% 2%; margin: 3% 0 0 ;background-color: #FFFFFF;
  233. border-radius: 18rpx;
  234. } */
  235. .cont_one_img {}
  236. .cont_one_img {
  237. width: 120upx;
  238. height: 117upx;
  239. position: absolute;
  240. top: 0;
  241. left: 83%;
  242. }
  243. .cont_one_img image {
  244. width: 120upx;
  245. height: 117upx;
  246. }
  247. .cont {
  248. display: none;
  249. }
  250. .cont_dis {
  251. display: block;
  252. }
  253. </style>