7 changed files with 278 additions and 45 deletions
@ -0,0 +1,123 @@ |
|||||
|
<template> |
||||
|
<view class="bg"> |
||||
|
<view class="popupBox"> |
||||
|
<view class="name"> |
||||
|
兑换优惠券 |
||||
|
</view> |
||||
|
<input type="text" v-model="password" placeholder="请输入兑换码"> |
||||
|
<view class="btns"> |
||||
|
<view class="cancel" @click="cancel"> |
||||
|
取消 |
||||
|
</view> |
||||
|
<span></span> |
||||
|
<view class="sub" @click="submitPassword"> |
||||
|
兑换 |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
password:'' |
||||
|
} |
||||
|
}, |
||||
|
onShow() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
submitPassword() { |
||||
|
console.log('提交的兑换码',this.password); |
||||
|
let that = this |
||||
|
that.password = that.password.trim() |
||||
|
that.$refs.popup.close() |
||||
|
if (that.password== '') { |
||||
|
uni.showToast({ |
||||
|
title: '请输入优惠券领取卡号', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
that.Post({ |
||||
|
card_key: that.password |
||||
|
}, "/api/coupon/getCoupon").then((res) => { |
||||
|
console.log(res.code); |
||||
|
if (res.code == 200) { |
||||
|
that.coupon = [] |
||||
|
this.getList(this.navList[0]) |
||||
|
uni.showToast({ |
||||
|
title: '兑换成功', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
} else{ |
||||
|
uni.showToast({ |
||||
|
title: res.msg, |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
that.password = '' |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.bg { |
||||
|
background: #F7F7F7; |
||||
|
min-height: 100vh; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
.popupBox { |
||||
|
background: #fff; |
||||
|
border-radius: 20rpx; |
||||
|
padding: 40.67rpx 39.33rpx 35.33rpx 40rpx; |
||||
|
} |
||||
|
|
||||
|
.popupBox .name { |
||||
|
font-size: 35rpx; |
||||
|
color: #111; |
||||
|
font-weight: bold; |
||||
|
margin-bottom: 57.33rpx; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.popupBox input { |
||||
|
width: 454rpx; |
||||
|
height: 81rpx; |
||||
|
border: 1px solid #D8D8D8; |
||||
|
border-radius: 7rpx; |
||||
|
font-size: 31rpx;font-weight: 500; |
||||
|
color: #999999; |
||||
|
line-height: 81rpx; |
||||
|
margin: 0 39.33rpx 72.67rpx 40rpx; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
.popupBox .btns { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
font-size: 35rpx; |
||||
|
justify-content: space-around; |
||||
|
} |
||||
|
|
||||
|
.popupBox .btns .cancel { |
||||
|
color: #111; |
||||
|
} |
||||
|
|
||||
|
.popupBox .btns span { |
||||
|
width: 1rpx; |
||||
|
height: 53rpx; |
||||
|
background: #D8D8D8; |
||||
|
} |
||||
|
|
||||
|
.popupBox .btns .sub { |
||||
|
color: #07C49B; |
||||
|
} |
||||
|
|
||||
|
</style> |
Loading…
Reference in new issue