index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. // console.log(res)
  91. if (res.code == 0) {
  92. this.totalCount = res.data.totalCount
  93. if (this.page == 1) {
  94. this.dataList = res.data.list
  95. } else {
  96. this.dataList = [...this.dataList, ...res.data.list]
  97. }
  98. }
  99. })
  100. },
  101. //优惠卷兑换规则
  102. getGuize() {
  103. this.$Request.getT('/app/common/type/240').then((res) => {
  104. if (res.code == 0) {
  105. this.content = res.data.value
  106. }
  107. })
  108. },
  109. use(item) {
  110. if (!item.shopId) {
  111. uni.switchTab({
  112. url: '/pages/index/index'
  113. })
  114. } else {
  115. uni.navigateTo({
  116. url: '/pages/index/shop/index?shopId=' + item.shopId + '&shopTypeId=' + item.shopTypeId+'&lat='+uni.getStorageSync('lat')+'&lng='+uni.getStorageSync('lng')
  117. })
  118. }
  119. }
  120. },
  121. onReachBottom: function () {
  122. if (this.dataList.length < this.totalCount) {
  123. this.page = this.page + 1
  124. this.getData()
  125. } else {
  126. uni.showToast({
  127. title: '已经到底了',
  128. icon: 'none'
  129. })
  130. }
  131. }
  132. }
  133. </script>
  134. <style scoped>
  135. /* 切换选项 */
  136. .nav {
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. background-color: #ffffff;
  141. color: #999999;
  142. }
  143. .nav view {
  144. flex-grow: 1;
  145. margin: 3% 9% 2%;
  146. text-align: center;
  147. }
  148. .nav_btna {
  149. font-size: 38rpx;
  150. line-height: 34rpx;
  151. border-bottom: 14rpx solid #fcd202;
  152. color: #000000;
  153. font-weight: bold;
  154. }
  155. /* 内容 */
  156. /* 全部订单 */
  157. .cont_one {
  158. /* display: none; */
  159. width: 94%;
  160. margin: 0 auto;
  161. }
  162. .cont_one_ce {
  163. width: 100%;
  164. padding: 3% 3% 2%;
  165. margin: 3% 0 0;
  166. background-color: #ffffff;
  167. border-radius: 18rpx;
  168. position: relative;
  169. }
  170. .cont_one_top {
  171. display: flex;
  172. width: 100%;
  173. }
  174. .cont_one_top_le {
  175. flex: 2;
  176. font-size: 35rpx;
  177. font-weight: 800;
  178. color: #000000;
  179. line-height: 32rpx;
  180. }
  181. .cont_one_top_le2 {
  182. flex: 2;
  183. font-size: 35rpx;
  184. font-weight: 800;
  185. color: #999999;
  186. line-height: 32rpx;
  187. }
  188. .cont_one_top_ri {
  189. flex: 1;
  190. font-size: 40rpx;
  191. text-align: right;
  192. font-family: DINPro;
  193. font-weight: 500;
  194. color: #ff130a;
  195. line-height: 32rpx;
  196. }
  197. .cont_one_top_ri text {
  198. font-size: 30rpx;
  199. }
  200. .cont_one_text {
  201. font-size: 30rpx;
  202. margin: 2% 0 1%;
  203. font-weight: 400;
  204. color: #999999;
  205. display: flex;
  206. justify-content: space-between;
  207. }
  208. .cont_one_bottom {
  209. width: 100%;
  210. padding: 3% 0 0;
  211. margin-top: 3%;
  212. display: flex;
  213. border-top: 2rpx dotted #e6e6e6;
  214. }
  215. .cont_one_bottom_le {
  216. width: 80%;
  217. /* font-size: 30rpx; */
  218. font-weight: 500;
  219. color: #999999;
  220. line-height: 2;
  221. }
  222. .cont_one_bottom_ri {
  223. width: 20%;
  224. text-align: center;
  225. /* line-height: 2; */
  226. background: rgba(255, 19, 10, 0.2);
  227. font-size: 24rpx;
  228. border: 2rpx solid #ff130a;
  229. color: #ff130a;
  230. opacity: 0.6;
  231. border-radius: 50rpx;
  232. }
  233. /* 到店取餐 */
  234. /* .cont_two {
  235. display: none;width: 94%;margin: 0 auto;
  236. }
  237. .cont_two_ce{
  238. width: 94%;padding: 3% 3% 2%; margin: 3% 0 0 ;background-color: #FFFFFF;
  239. border-radius: 18rpx;
  240. } */
  241. .cont_one_img {
  242. }
  243. .cont_one_img {
  244. width: 120upx;
  245. height: 117upx;
  246. position: absolute;
  247. top: 0;
  248. left: 83%;
  249. }
  250. .cont_one_img image {
  251. width: 120upx;
  252. height: 117upx;
  253. }
  254. .cont {
  255. display: none;
  256. }
  257. .cont_dis {
  258. display: block;
  259. }
  260. </style>