receiveCoupon.vue 5.3 KB

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