receiveCoupon.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <view id="nononoElderModeClass">
  3. <ujp-navbar title="优惠券" :is-back="false" title-size='44' ></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.toFixed(2)}}
  19. </view>
  20. <view class="unit">元</view>
  21. <view class="ticket-info">
  22. <view class="ticket-name">
  23. {{item.threshold == 0 ? '无门槛充电抵扣券' : '满'+selectObj.threshold.toFixed(2)+'元可用'}}
  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. // var list_u_title = document.getElementsByClassName("u-title")
  66. // list_u_title.style="line-height: 20px;color: rgb(96, 98, 102); font-size: 20px; overflow: unset;"
  67. // console.log(this.userMessage)
  68. }).catch(error => {
  69. uni.showToast({
  70. title: error
  71. })
  72. })
  73. },
  74. btnCk(){
  75. if(this.status==3){
  76. this.submit()
  77. }else{
  78. uni.navigateTo({
  79. url:'/pages/user/coupon/myCoupon'
  80. })
  81. }
  82. },
  83. submit(){
  84. uni.showLoading({
  85. title: "加载中",
  86. mask: true,
  87. })
  88. userApi.receiveGiveCoupon({
  89. messageId:this.id
  90. }).then(response => {
  91. uni.hideLoading()
  92. uni.showModal({
  93. title:"提示",
  94. content:"领取成功",
  95. confirmText:"前往查看",
  96. showCancel:true,
  97. success(res) {
  98. if (res.confirm) {
  99. uni.navigateTo({
  100. url:'/pages/user/coupon/myCoupon'
  101. })
  102. } else if (res.cancel) {
  103. console.log('用户点击取消');
  104. }
  105. }
  106. })
  107. console.log(this.userMessage)
  108. this.getInfo()
  109. }).catch(error => {
  110. uni.showToast({
  111. title: error
  112. })
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. page{
  120. background-color: #FF4A2D;
  121. padding-bottom: 90px;
  122. }
  123. .main{
  124. width: 87.2%;
  125. margin: 100px auto 0;
  126. position: relative;
  127. .content{
  128. padding: 24px;
  129. padding-top: 50px;
  130. background-color: #fff;
  131. box-shadow: 0px 0px 0px 1px rgba(254, 229, 147, 100);
  132. border: 2px solid rgba(253, 217, 141, 100);
  133. border-radius: 8px;
  134. .img{
  135. width: 44vw;
  136. height: 134px;
  137. position: absolute;
  138. top: -88px;
  139. right: 0px;
  140. img{
  141. width: 100%;
  142. height: 100%;
  143. }
  144. }
  145. .title{
  146. font-size: 16px;
  147. color: rgba(84, 45, 45, 100);
  148. margin-bottom: 13px;
  149. }
  150. .text{
  151. line-height: 24px;
  152. color: rgba(84, 45, 45, 100);
  153. font-size: 16px;
  154. text-align: justify;
  155. text-decoration:underline;
  156. text-decoration-color:#ECE3BA;
  157. text-indent: 32px;
  158. }
  159. .sign{
  160. text-align: right;
  161. margin-top: 8px;
  162. font-size: 16px;
  163. }
  164. }
  165. // 专享优惠券
  166. .exclusive{
  167. background-color: #fff;
  168. margin-top: 20px;
  169. padding: 16px 24px 24px 24px ;
  170. box-shadow: 0px 0px 0px 1px rgba(254, 229, 147, 100);
  171. border: 2px solid rgba(253, 217, 141, 100);
  172. border-radius: 8px;
  173. p{
  174. width: 100%;
  175. text-align: center;
  176. color: rgba(255, 73, 75, 100);
  177. font-size: 20px;
  178. }
  179. .img{
  180. width: 74.4vw;
  181. height: 84px;
  182. margin-top: 16px;
  183. position: relative;
  184. img{
  185. width: 100%;
  186. height: 100%;
  187. }
  188. }
  189. .num{
  190. font-size:40px;
  191. color: rgba(252, 237, 179, 100);
  192. position: absolute;
  193. top:12px;
  194. left: 2vw;
  195. font-weight: 600;
  196. }
  197. .unit{
  198. font-size: 20px;
  199. color: rgba(252, 237, 179, 100);
  200. position: absolute;
  201. top: 29px;
  202. left: 18vw;
  203. }
  204. .ticket-info{
  205. width: 40vw;
  206. text-align: center;
  207. position: absolute;
  208. top: 18px;
  209. right: 18px;
  210. .ticket-name{
  211. line-height: 25px;
  212. color: rgba(16, 16, 16, 100);
  213. font-size: 14px;
  214. }
  215. .condition{
  216. line-height: 22px;
  217. color: #8a6f6f;
  218. font-size: 12px;
  219. }
  220. }
  221. }
  222. }
  223. .btn{
  224. width: 87.4%;
  225. margin-top: 20px;
  226. background-image: linear-gradient(#ffff00,#ff9600);
  227. color: rgba(82, 30, 0, 100);
  228. font-size: 20px;
  229. border-radius: 50px;
  230. }
  231. </style>