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

<script>
xd's avatar
xd committed
28
import { getCouponList } from "@/api/sidebar/voucher"
xd's avatar
xd committed
29 30 31 32 33 34 35
export default {
  data() {
    return {
      form: {
        unit: '100',
        type: '老用户回馈券',
        usageAmount: '500',
xd's avatar
xd committed
36 37 38 39 40 41
        begin_date: '2020/2/3',
        end_date: '2020/4/5'
      },
      store: '',
      id: '',
      deptId: ''
xd's avatar
xd committed
42
    }
xd's avatar
xd committed
43 44 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
  },
  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
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 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 137 138 139 140
  }
}
</script>

<style  scoped>
.contain {
  background-color: rgb(237, 239, 243);
  height: 100%;
  justify-content: center;
}
.box {
  margin-top: 18px;
  height: 50%;
  background-color: #fff;
  width: 90%;
  padding: 50px 20px;
}
.yhq {
  background-color: #F39B00;
  height: 60%;
  display: flex;
  padding: 20px;
  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;
  width: 35%;
  height: 100%;
  border-right: 1px dashed #f0f0f0;
}
.price {
  font-size: 32px;
  font-weight: 800;
}
.right {
  width: 65%;  
  height: 100%;
  padding: 10px 0 10px 10px;
}

</style>