receiveCoupon.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view>
  3. <ujp-navbar title="优惠券" :is-back="false" ></ujp-navbar>
  4. <view class="main">
  5. <view class="content">
  6. <view class="img">
  7. <img src="../../assets/img/coupons.png" alt="">
  8. </view>
  9. <view v-html="userMessage.content">
  10. </view>
  11. </view>
  12. <!-- 专享优惠券 -->
  13. <view class="exclusive">
  14. <p>专享优惠券</p>
  15. <view class="img" v-for="(item,i) in userCouponList" :key="i" >
  16. <img src="../../assets/img/Frame915.png" alt="">
  17. <view class="num">
  18. {{item.value}}
  19. </view>
  20. <view class="unit">元</view>
  21. <view class="ticket-info">
  22. <view class="ticket-name">
  23. {{item.threshold == 0 ? '无门槛充电抵扣券' : '满'+selectObj.threshold+'元可用'}}
  24. </view>
  25. <view class="condition">
  26. 限{{item.useScopeText}}使用
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <button class="btn" @click="btnCk()" >{{status=='3'?'领取优惠券':'查看'}}</button>
  33. </view>
  34. </template>
  35. <script>
  36. import * as userApi from '@/apis/user.js'
  37. export default {
  38. data() {
  39. return {
  40. id:"",
  41. userMessage:{},
  42. userCouponList:[],
  43. status:-1,
  44. }
  45. },onLoad(op) {
  46. this.id=op.id
  47. this.getInfo()
  48. },
  49. methods: {
  50. getInfo(){
  51. uni.showLoading({
  52. title: "加载中",
  53. mask: true,
  54. })
  55. userApi.giveCouponDetail({
  56. messageId:this.id
  57. }).then(response => {
  58. uni.hideLoading()
  59. this.userMessage=response.data.userMessage
  60. this.userCouponList=response.data.userCouponList
  61. for(var i in this.userCouponList){
  62. var obj=this.userCouponList[i]
  63. this.status=obj.status;
  64. }
  65. console.log(this.userMessage)
  66. }).catch(error => {
  67. uni.showToast({
  68. title: error
  69. })
  70. })
  71. },
  72. btnCk(){
  73. if(this.status==3){
  74. this.submit()
  75. }else{
  76. uni.navigateTo({
  77. url:'/pages/user/coupon/myCoupon'
  78. })
  79. }
  80. },
  81. submit(){
  82. uni.showLoading({
  83. title: "加载中",
  84. mask: true,
  85. })
  86. userApi.receiveGiveCoupon({
  87. messageId:this.id
  88. }).then(response => {
  89. uni.hideLoading()
  90. uni.showModal({
  91. title:"提示",
  92. content:"领取成功",
  93. confirmText:"前往查看",
  94. showCancel:true,
  95. success(res) {
  96. if (res.confirm) {
  97. uni.navigateTo({
  98. url:'/pages/user/coupon/myCoupon'
  99. })
  100. } else if (res.cancel) {
  101. console.log('用户点击取消');
  102. }
  103. }
  104. })
  105. console.log(this.userMessage)
  106. this.getInfo()
  107. }).catch(error => {
  108. uni.showToast({
  109. title: error
  110. })
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. page{
  118. background-color: #FF4A2D;
  119. padding-bottom: 90px;
  120. }
  121. .main{
  122. width: 87.2%;
  123. margin: 100px auto 0;
  124. position: relative;
  125. .content{
  126. padding: 24px;
  127. padding-top: 50px;
  128. background-color: #fff;
  129. box-shadow: 0px 0px 0px 1px rgba(254, 229, 147, 100);
  130. border: 2px solid rgba(253, 217, 141, 100);
  131. border-radius: 8px;
  132. .img{
  133. width: 44vw;
  134. height: 134px;
  135. position: absolute;
  136. top: -88px;
  137. right: 0px;
  138. img{
  139. width: 100%;
  140. height: 100%;
  141. }
  142. }
  143. .title{
  144. font-size: 16px;
  145. color: rgba(84, 45, 45, 100);
  146. margin-bottom: 13px;
  147. }
  148. .text{
  149. line-height: 24px;
  150. color: rgba(84, 45, 45, 100);
  151. font-size: 16px;
  152. text-align: justify;
  153. text-decoration:underline;
  154. text-decoration-color:#ECE3BA;
  155. text-indent: 32px;
  156. }
  157. .sign{
  158. text-align: right;
  159. margin-top: 8px;
  160. font-size: 16px;
  161. }
  162. }
  163. // 专享优惠券
  164. .exclusive{
  165. background-color: #fff;
  166. margin-top: 20px;
  167. padding: 16px 24px 24px 24px ;
  168. box-shadow: 0px 0px 0px 1px rgba(254, 229, 147, 100);
  169. border: 2px solid rgba(253, 217, 141, 100);
  170. border-radius: 8px;
  171. p{
  172. width: 100%;
  173. text-align: center;
  174. color: rgba(255, 73, 75, 100);
  175. font-size: 20px;
  176. }
  177. .img{
  178. width: 74.4vw;
  179. height: 84px;
  180. margin-top: 16px;
  181. position: relative;
  182. img{
  183. width: 100%;
  184. height: 100%;
  185. }
  186. }
  187. .num{
  188. font-size:40px;
  189. color: rgba(252, 237, 179, 100);
  190. position: absolute;
  191. top:12px;
  192. left: 2vw;
  193. font-weight: 600;
  194. }
  195. .unit{
  196. font-size: 20px;
  197. color: rgba(252, 237, 179, 100);
  198. position: absolute;
  199. top: 29px;
  200. left: 18vw;
  201. }
  202. .ticket-info{
  203. width: 40vw;
  204. text-align: center;
  205. position: absolute;
  206. top: 18px;
  207. right: 18px;
  208. .ticket-name{
  209. line-height: 25px;
  210. color: rgba(16, 16, 16, 100);
  211. font-size: 14px;
  212. }
  213. .condition{
  214. line-height: 22px;
  215. color: #8a6f6f;
  216. font-size: 12px;
  217. }
  218. }
  219. }
  220. }
  221. .btn{
  222. width: 87.4%;
  223. margin-top: 20px;
  224. background-image: linear-gradient(#ffff00,#ff9600);
  225. color: rgba(82, 30, 0, 100);
  226. font-size: 20px;
  227. border-radius: 50px;
  228. }
  229. </style>