coupon.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="container home clearfix" v-if="hasLogin">
  3. <view class="coupon-title" v-if="userIdentity == 4">优惠券仅限{{userName}}(机构)使用 </view>
  4. <view class="coupon-title" v-if="userIdentity == 2">优惠券仅限{{userName}}使用 </view>
  5. <image class="coupon-image" src="http://static.caimei365.com/app/meibohui/app/activity-detail.jpg" mode=""></image>
  6. </view>
  7. </template>
  8. <script>
  9. import { mapState,mapMutations} from 'vuex';
  10. export default {
  11. components:{
  12. },
  13. data() {
  14. return {
  15. userName:'',
  16. userIdentity:0
  17. }
  18. },
  19. onLoad() {
  20. if(!this.hasLogin){
  21. uni.redirectTo({
  22. url:'../../login/login'
  23. })
  24. }
  25. },
  26. computed: {
  27. ...mapState(['hasLogin','userInfo','identity','isActivity'])
  28. },
  29. methods: {
  30. },
  31. onShow(){
  32. this.$api.getComStorage('userInfo').then((resolve) =>{
  33. this.userName = resolve.name;
  34. this.userIdentity = resolve.userIdentity
  35. }).catch(error =>{
  36. })
  37. }
  38. }
  39. </script>
  40. <style lang="scss">
  41. page{
  42. }
  43. .container{
  44. width: 100%;
  45. height: auto;
  46. background-color: #ff2e4c;
  47. .coupon-title{
  48. width: 100%;
  49. height: 110rpx;
  50. line-height: 110rpx;
  51. font-size: $font-size-28;
  52. font-weight: bold;
  53. background-image: linear-gradient(0deg, #fffaec 0%, #fff7d6 50%, #fff4b9 100%), linear-gradient(#fffaef, #fffaef);
  54. box-sizing: border-box;
  55. padding: 0 24rpx;
  56. white-space: nowrap;
  57. text-overflow: ellipsis;
  58. overflow: hidden;
  59. color: #fd3c5b;
  60. text-align: center;
  61. }
  62. .coupon-image{
  63. width: 100%;
  64. height: 1860rpx;
  65. display: block;
  66. }
  67. }
  68. </style>