|
@@ -2,14 +2,14 @@
|
|
|
<view class="container">
|
|
<view class="container">
|
|
|
<!-- 优惠券信息 -->
|
|
<!-- 优惠券信息 -->
|
|
|
<view class="info">
|
|
<view class="info">
|
|
|
- <view class="info_name">外卖满减券</view>
|
|
|
|
|
- <view class="info_term">满25可用</view>
|
|
|
|
|
|
|
+ <view class="info_name">{{ info.couponName }}</view>
|
|
|
|
|
+ <view class="info_term" v-if="info.minMoney">满{{ info.minMoney || 0 }}可用</view>
|
|
|
<view class="info_box">
|
|
<view class="info_box">
|
|
|
<text class="text">¥</text>
|
|
<text class="text">¥</text>
|
|
|
- 5
|
|
|
|
|
|
|
+ {{ info.money || 0 }}
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="info_btn">立即领取</view>
|
|
|
|
|
- <view class="info_time">2025.09.22 23:59 到期</view>
|
|
|
|
|
|
|
+ <view class="info_btn" @click="handleFetch">立即领取</view>
|
|
|
|
|
+ <view class="info_time" v-if="info.expirationTime">{{ info.expirationTime }}到期</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
@@ -18,7 +18,9 @@
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- imgtype1: ''
|
|
|
|
|
|
|
+ shopId: '',
|
|
|
|
|
+ couponId: '',
|
|
|
|
|
+ info: {}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
@@ -34,14 +36,65 @@ export default {
|
|
|
params[key] = value
|
|
params[key] = value
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- let shopId = params.shopId
|
|
|
|
|
- let couponId = params.couponId
|
|
|
|
|
|
|
+ this.shopId = params.shopId
|
|
|
|
|
+ this.couponId = params.couponId
|
|
|
|
|
|
|
|
- console.log(shopId)
|
|
|
|
|
- console.log(couponId)
|
|
|
|
|
|
|
+ this.getInfo()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- methods: {}
|
|
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ getInfo() {
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ couponId: this.couponId
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$Request.get('/app/coupon/selectCoupon', data).then((res) => {
|
|
|
|
|
+ // console.log(res, 963)
|
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
|
+ this.info = res.data
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ handleFetch() {
|
|
|
|
|
+ let userId = uni.getStorageSync('userId')
|
|
|
|
|
+
|
|
|
|
|
+ if (userId) {
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ couponId: this.couponId,
|
|
|
|
|
+ shopId: this.shopId,
|
|
|
|
|
+ userId
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$Request.get('/app/coupon/receiveCoupon', data).then((res) => {
|
|
|
|
|
+ // console.log(res, 888)
|
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '领取成功',
|
|
|
|
|
+ icon: 'success'
|
|
|
|
|
+ })
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ uni.reLaunch({
|
|
|
|
|
+ url: '/my/coupon/index'
|
|
|
|
|
+ })
|
|
|
|
|
+ }, 1500)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请先登录',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ uni.navigateTo({
|
|
|
|
|
+ url: '/pages/public/login'
|
|
|
|
|
+ })
|
|
|
|
|
+ }, 1500)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|