detail.vue 2.98 KB
Newer Older
xd's avatar
xd committed
1 2 3
<template>
  <div class="contain">
    <div class="box">
xd's avatar
xd committed
4
      <div class="name">{{ form.name }}</div>
xd's avatar
xd committed
5 6 7 8 9
      <div class="yhq"> 
        <div class="left">
          <div class="price">¥{{ form.unit }}</div>
        </div>
        <div class="right">
xd's avatar
xd committed
10
          <div>{{ form.salesUnit }}元可用</div>
xd's avatar
xd committed
11 12 13
          <div>
            <div>有效期:</div>
            <div>
xd's avatar
xd committed
14 15
              <span>{{ form.begin_date }}</span>~
              <span>{{ form.end_date }}</span>
xd's avatar
xd committed
16 17 18 19 20 21 22
            </div>            
          </div>
          <div>全店通用</div>
        </div>
        <i></i>
      </div>
      <div class="txt">{{ form.type }}</div>
xd's avatar
xd committed
23
      <div class="txt">此优惠券仅限于 <span>{{ store }}</span> 使用</div>
xd's avatar
xd committed
24 25 26 27 28
    </div>
  </div>
</template>

<script>
xd's avatar
xd committed
29
import { getCouponList } from "@/api/sidebar/voucher"
xd's avatar
xd committed
30 31 32 33
export default {
  data() {
    return {
      form: {
xd's avatar
xd committed
34
        name: '优惠券',
xd's avatar
xd committed
35 36 37
        unit: '100',
        type: '老用户回馈券',
        usageAmount: '500',
xd's avatar
xd committed
38 39 40 41 42 43
        begin_date: '2020/2/3',
        end_date: '2020/4/5'
      },
      store: '',
      id: '',
      deptId: ''
xd's avatar
xd committed
44
    }
xd's avatar
xd committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
  },
  mounted() {
    this.deptId = sessionStorage.getItem('oyStallCode')
    // this.deptId = 3
    this.id = this.$route.query.id
    console.log(this.id);
    
    this.getList()
  },
  methods: {
    getList() {
      let params = {
        deptId: this.deptId
      }
      getCouponList(params).then(res => {
        res.data.forEach(item => {
          item.begin_date = item.begin_date.substr(0,4)+'-'+item.begin_date.substr(4,2)+'-'+item.begin_date.substr(6,2)
          item.end_date = item.end_date.substr(0,4)+'-'+item.end_date.substr(4,2)+'-'+item.end_date.substr(6,2)
        })
        let obj = res.data.find(x => {
          console.log(x,'x')
          return x.id === this.id
        })
        console.log(obj,'obj')       
        this.form = obj
        this.store = sessionStorage.getItem("barName")
      })
    },
xd's avatar
xd committed
73 74 75 76 77
  }
}
</script>

<style  scoped>
xd's avatar
xd committed
78 79 80 81 82
.name {
  font-size: 22px;
  padding-bottom: 16px;
  text-align: center;
}
xd's avatar
xd committed
83 84 85 86 87 88 89 90 91 92
.contain {
  background-color: rgb(237, 239, 243);
  height: 100%;
  justify-content: center;
}
.box {
  margin-top: 18px;
  height: 50%;
  background-color: #fff;
  width: 90%;
xd's avatar
xd committed
93
  padding: 20px 20px 50px;
xd's avatar
xd committed
94 95 96 97 98
}
.yhq {
  background-color: #F39B00;
  height: 60%;
  display: flex;
xd's avatar
xd committed
99
  padding: 10px;
xd's avatar
xd committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
  align-items: center;
  margin-bottom: 38px;
}
.yhq:before {
	content: '';
	position: absolute;
	top:0;
	bottom:0;
	left:10px;
	right:10px;
	z-index: -1;
}
.yhq i {
	position: absolute;
	left: 20%;
	top: 45px;
	height: 190px;
	width: 390px;
	background-color: rgba(255, 255, 255, .15);
	transform: rotate(-30deg);
}
.left,.right {
  font-size: 16px;
  color:rgb(255,255,255);
}
.txt {
  font-size: 18px;
  text-align: center;
  margin-top: 14px;
}
.left {
  display: flex;
  align-items: center;
  height: 100%;
  border-right: 1px dashed #f0f0f0;
}
.price {
xd's avatar
xd committed
137
  font-size: 30px;
xd's avatar
xd committed
138
  font-weight: 800;
xd's avatar
xd committed
139
  margin-right: 8px;
xd's avatar
xd committed
140 141 142 143 144 145 146 147
}
.right {
  width: 65%;  
  height: 100%;
  padding: 10px 0 10px 10px;
}

</style>