|
@@ -3,8 +3,8 @@
|
|
<image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/red_packet_background.jpg" class="read_packet_background" />
|
|
<image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/red_packet_background.jpg" class="read_packet_background" />
|
|
<view class="rule" @click="showRule">活动规则</view>
|
|
<view class="rule" @click="showRule">活动规则</view>
|
|
<view class="get_content" v-if="!showReward">
|
|
<view class="get_content" v-if="!showReward">
|
|
- <view class="custom_button" @click="showRectangle"> 立即领取 </view>
|
|
|
|
- <text>点击领取后,红包将自动到账余额</text>
|
|
|
|
|
|
+ <view class="custom_button" :class="{ disabled: packetItem.status !== 0 }" @click="showRectangle"> 立即领取 </view>
|
|
|
|
+ <text>{{ packetItem.status !== 0 ? "红包已领取或已失效" : "点击领取后,红包将自动到账余额" }}</text>
|
|
</view>
|
|
</view>
|
|
<uni-popup ref="lotteryRule" type="center">
|
|
<uni-popup ref="lotteryRule" type="center">
|
|
<view class="lottery_rule_box">
|
|
<view class="lottery_rule_box">
|
|
@@ -13,14 +13,16 @@
|
|
<view class="close_btn" @click="closeRule"> X </view>
|
|
<view class="close_btn" @click="closeRule"> X </view>
|
|
</view>
|
|
</view>
|
|
<scroll-view class="lottery_rule_info" scroll-y="true">
|
|
<scroll-view class="lottery_rule_info" scroll-y="true">
|
|
- <rich-text nodes="lotteryInfo.rule" class="rich_text"></rich-text>
|
|
|
|
|
|
+ <rich-text :nodes="packetItem.active_rule" class="rich_text"></rich-text>
|
|
</scroll-view>
|
|
</scroll-view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</uni-popup>
|
|
<div :class="['rectangle', { show: showReward }]">
|
|
<div :class="['rectangle', { show: showReward }]">
|
|
<image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/red_packet_bottom.png" class="read_packet_background" />
|
|
<image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/red_packet_bottom.png" class="read_packet_background" />
|
|
<view class="text_content">
|
|
<view class="text_content">
|
|
- <view> <text style="font-size: 50rpx; font-weight: bold">8.88 </text>元 </view>
|
|
|
|
|
|
+ <view>
|
|
|
|
+ <text style="font-size: 50rpx; font-weight: bold">{{ packetItem.money }} </text>元
|
|
|
|
+ </view>
|
|
<view style="margin-top: 20rpx; color: #02a7f0" @click="_goWithdraw">已存入余额,去提现</view>
|
|
<view style="margin-top: 20rpx; color: #02a7f0" @click="_goWithdraw">已存入余额,去提现</view>
|
|
</view>
|
|
</view>
|
|
</div>
|
|
</div>
|
|
@@ -29,9 +31,19 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { ref } from "vue";
|
|
import { ref } from "vue";
|
|
|
|
+import { onLoad } from "@dcloudio/uni-app";
|
|
|
|
+import common from "@/utils/common";
|
|
|
|
+
|
|
|
|
+import http from "@/utils/request";
|
|
|
|
|
|
const lotteryRule = ref();
|
|
const lotteryRule = ref();
|
|
const showReward = ref(false);
|
|
const showReward = ref(false);
|
|
|
|
+const packetItem = ref({});
|
|
|
|
+
|
|
|
|
+onLoad((options) => {
|
|
|
|
+ // 获取传递的参数
|
|
|
|
+ _getPacketlist(options.packet_id);
|
|
|
|
+});
|
|
|
|
|
|
const closeRule = () => {
|
|
const closeRule = () => {
|
|
lotteryRule.value.close();
|
|
lotteryRule.value.close();
|
|
@@ -41,15 +53,28 @@ const showRule = () => {
|
|
lotteryRule.value.open("center");
|
|
lotteryRule.value.open("center");
|
|
};
|
|
};
|
|
|
|
|
|
-const showRectangle = () => {
|
|
|
|
- showReward.value = true;
|
|
|
|
-};
|
|
|
|
|
|
+const showRectangle = common.debounce(() => {
|
|
|
|
+ if (!packetItem.value.custom_redpacket_id) return;
|
|
|
|
+ http.request("/api/redpacket/get_redpacket", { custom_redpacket_id: packetItem.value.custom_redpacket_id }).then((callback) => {
|
|
|
|
+ if (callback.code == "success") {
|
|
|
|
+ showReward.value = true;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+}, 1000);
|
|
|
|
|
|
const _goWithdraw = () => {
|
|
const _goWithdraw = () => {
|
|
uni.redirectTo({
|
|
uni.redirectTo({
|
|
url: "/pages/user/withdraw",
|
|
url: "/pages/user/withdraw",
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+const _getPacketlist = (packet_id) => {
|
|
|
|
+ http.request("api/redpacket/get_info", { custom_redpacket_id: packet_id }, "POST").then((callback) => {
|
|
|
|
+ if (callback.code == "success") {
|
|
|
|
+ packetItem.value = callback.data;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
@@ -99,6 +124,15 @@ const _goWithdraw = () => {
|
|
border: 2px solid transparent;
|
|
border: 2px solid transparent;
|
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
|
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
|
position: relative;
|
|
position: relative;
|
|
|
|
+ &.disabled {
|
|
|
|
+ background-color: #ccc;
|
|
|
|
+ color: #666;
|
|
|
|
+ &:before,
|
|
|
|
+ &:after {
|
|
|
|
+ background-color: #ccc;
|
|
|
|
+ border-color: #ccc;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
&:before,
|
|
&:before,
|
|
&:after {
|
|
&:after {
|
|
content: "";
|
|
content: "";
|