index.vue 5.7 KB

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