This commit is contained in:
zpc 2025-04-01 23:35:44 +08:00
parent 658c587398
commit 50e28de1fb
3 changed files with 268 additions and 214 deletions

View File

@ -125,7 +125,7 @@ export default {
return new Promise((resolve, reject) => {
WeixinJSBridge.invoke(
'getBrandWCPayRequest', data,
function(res) {
function (res) {
console.log('支付回调', res);
if (res.errMsg == 'requestPayment:fail cancel') {
uni.showToast({
@ -265,7 +265,7 @@ export default {
* loading 接口加载中状态
* 传入方法不要写括号
*/
/* 如果接口加载中,终止任何操作 */
if (this.data.loading) {
uni.showToast({
@ -282,8 +282,8 @@ export default {
} catch (e) {
//TODO handle the exception
}
var that=this;
setTimeout(()=>{that.data.loading = false; console.log("方法执行结束", this.data.loading, this.data.loading);},1000)
var that = this;
setTimeout(() => { that.data.loading = false; console.log("方法执行结束", this.data.loading, this.data.loading); }, 1000)
},
@ -315,7 +315,20 @@ export default {
})
}, 100)
},
msg(msg) {
let title = msg || ''
let icon = 'none'
let mask = false
let duration = 1500
let position = 'center'
uni.showToast({
title,
icon,
mask,
duration,
position,
});
},
/**
* @description: 获取规则
* @param {*} type
@ -508,13 +521,13 @@ export default {
'onMenuShareTimeline',
]
});
wx.ready(function() {
wx.ready(function () {
wx.checkJsApi({
jsApiList: [
'openAddress',
'onMenuShareTimeline',
],
success: function(res) {
success: function (res) {
if (link.indexOf('http:') < 0 &&
link.indexOf('https:') < 0) {
link = location.href.split('#')[0] + "#" + link;
@ -525,7 +538,7 @@ export default {
desc: desc, // 分享描述
link: link, // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: image, // 分享图标
success: function() {
success: function () {
// 设置成功
}
})
@ -555,7 +568,7 @@ export default {
});
wx.error(function(res) {
wx.error(function (res) {
// config信息验证失败会执行error函数如签名过期导致验证失败具体错误信息可以打开config的debug模式查看也可以在返回的res参数中查看对于SPA可以在这里更新签名。
console.log("出现错误", res);
});

View File

@ -75,18 +75,6 @@
</template>
<view v-if="pageData.goods.type == 6 && !getBtnXianShi()"> </view>
<template v-else>
<view class="pay-type" v-if="pay_currency" @click="changePayMethod('useIntegral')">
<view class="title flex align-center">
使用{{ currencyName }}{{deduction_name}}¥{{ orderData.use_integral_money }}
<text
style="color: #676767; font-size: 16rpx; margin-left: 10rpx;">(剩余:{{ orderData.integral }})</text>
</view>
<view class="icon">
<image v-if="useIntegral" :src="$img1('common/check_act.png')" lazy-load></image>
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
</view>
<view class="pay-type" v-if="pay_balance" @click="changePayMethod('useMoney')">
<view class="title flex align-center">
@ -101,6 +89,21 @@
</view>
</view>
<view class="pay-type" v-if="pay_currency" @click="changePayMethod('useIntegral')">
<view class="title flex align-center">
使用{{ currencyName }}{{deduction_name}}¥{{ orderData.use_integral_money }}
<text
style="color: #676767; font-size: 16rpx; margin-left: 10rpx;">(剩余:{{ orderData.integral }})</text>
</view>
<view class="icon">
<image v-if="useIntegral" :src="$img1('common/check_act.png')" lazy-load></image>
<image v-else :src="$img1('common/check.png')" lazy-load></image>
</view>
</view>
<view class="pay-type" v-if="pay_currency2" @click="changePayMethod('useMoney2')">
<view class="title flex align-center">
使用{{ currencyName2 }}{{deduction_name}}¥{{ (orderData.use_score/100).toFixed(2) }} <text style="color: #676767; font-size: 16rpx; margin-left: 10rpx;">

View File

@ -1,7 +1,7 @@
<!-- 每日签到 -->
<template>
<view class="content">
<view class="navLeft align-center" :style="{top:$sys().statusBarHeight+'px'}" @tap="$c.back(1)">
<view class="navLeft align-center" :style="{ top: $sys().statusBarHeight + 'px' }" @tap="$c.back(1)">
<uni-icons type="left" color="#000000"></uni-icons>
<!-- <view class="">{{$c.detailPageTitle((pageData && pageData.goods) || '')}}</view> -->
</view>
@ -10,17 +10,16 @@
<view class="" style="height: 232rpx;"></view>
<view class=""
style="width: 686rpx; height: 328rpx; background-color: #D8D8D8; border-radius: 16rpx; margin: 0 auto 0;">
<view class="" style="height: 328rpx; border-radius: 16rpx; margin: 0 auto 0;">
<banner :type-id="6" :height="150"></banner>
</view>
<view class=""
style="width: 686rpx; height: 838rpx; background-color: #fff; margin: 40rpx auto 0; border-radius: 16rpx;">
<view class="center" style="padding-top: 24rpx;">
<text style="color: #8A8A8A; font-size: 28rpx;">累计签到<text
style="color: #96B050;">{{checkinData.TotalCheckins}}</text></text>
<text style="color: #8A8A8A; font-size: 28rpx;">累计签到<text style="color: #96B050;">{{
checkinData.TotalCheckins }}</text></text>
</view>
<!-- 累计签到 -->
@ -30,9 +29,10 @@
<view class=""
style="width: 100%; height: 4rpx; background-color: #F3F3F3;position: absolute; top: 42rpx; left: 10rpx;">
</view>
<view class="relative"
<view class="relative total-checkin-item"
style="width: 71.7rpx; height: 102rpx;display: inline-block; margin-right: 94rpx;"
v-for="(item,index) in checkinData.TotalCheckinList" :key="index">
v-for="(item, index) in checkinData.TotalCheckinList" :key="index"
@tap="showTips(item, $event, index)">
<image :src="$img('/static/checkin/Claim.png')"
style="width: 71.7rpx; height: 72rpx; position: absolute;" mode=""></image>
@ -43,7 +43,7 @@
<text
style="width: 100%; text-align: center; position: absolute; bottom: 0rpx; color: #8A8A8A; font-size: 18rpx;">
累计
<text style="color: #96B050;">{{item.Days}}</text>
<text style="color: #96B050;">{{ item.Days }}</text>
</text>
</view>
@ -56,22 +56,20 @@
<scroll-view scroll-y="true" style="width: 632rpx; height: 600rpx;">
<view class="grid-container">
<view class="grid-item" v-for="(item,index) in checkinData.CheckinList" style="">
<view class="grid-item" v-for="(item, index) in checkinData.CheckinList" :key="index" style="">
<image :src="$img('/static/checkin/Claim2.png')">
</image>
<!-- <image v-if="!item.isClaim" style="z-index: 10;"
:src="$img('/static/checkin/Expired.png')" mode=""></image> -->
<image v-if="item.isExpired && !item.isClaim" style="z-index: 10;"
:src="$img('/static/checkin/Expired.png')" mode=""></image>
<image v-if="item.isExpired && item.isClaim" style="z-index: 10;"
:src="$img('/static/checkin/Claimed2.png')" mode=""></image>
<image v-if="item.isClaim" style="z-index: 10;" :src="$img('/static/checkin/Claimed2.png')"
mode=""></image>
<image v-if="item.isToday" :src="$img('/static/checkin/ClaimBorder.png')" mode="">
</image>
<text class="day">{{item.Day}}</text>
<text class="reward">{{item.Reward}}</text>
<text class="day">{{ item.Day }}</text>
<text class="reward">{{ item.Reward }}</text>
</view>
</view>
@ -86,215 +84,255 @@
<!-- 签到按钮 -->
<view class="justify-center" style="width: 100%; height: 198rpx; background-color: #fff; margin-top: -10rpx;">
<view class="align-center column">
<view class="center"
<view class="center" @click="sign"
style="width: 340rpx; height: 84rpx; background-color: #D8FD24; margin-top: 32rpx;">
<text style="color: #333333; font-size: 32rpx; font-weight: 600;">每日签到</text>
<text style="color: #333333; font-size: 32rpx; font-weight: 600;">{{ !is_sign ? "今日已签到" : "每日签到"
}}</text>
</view>
<text
style="color: #8A8A8A; font-size: 20rpx; margin-top: 12rpx;">签到条件{{checkinData.Requirement}}</text>
<text style="color: #8A8A8A; font-size: 20rpx; margin-top: 12rpx;">{{ checkinData.Requirement
}}</text>
</view>
</view>
<!-- 气泡提示 -->
<view class="tooltip" v-if="tipVisible" :style="{ left: tipPosition.x + 'px', top: tipPosition.y + 'px' }">
<view class="tooltip-content">
<text>{{ currentTip }}</text>
</view>
<view class="tooltip-arrow"></view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
checkinData: {
TotalCheckins: 10, //
Requirement: "任意消费100钻石",
TotalCheckinList: [{ //
isClaim: true, //
Days: 3, //
}, {
isClaim: false,
Days: 7,
}, {
isClaim: false,
Days: 10,
}, {
isClaim: false,
Days: 15,
}, {
isClaim: false,
Days: 31,
}],
CheckinList: [ //
{
isExpired: true, //
isClaim: false, //
isToday: false, //
Day: 1, //
Reward: "100钻石", //
},
{
isExpired: true,
isClaim: true,
isToday: false,
Day: 2,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: true,
Day: 3,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 4,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 5,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
}, {
isExpired: false,
isClaim: false,
isToday: false,
Day: 6,
Reward: "100钻石",
},
],
}
export default {
data() {
return {
tipVisible: false,
currentTip: '',
tipPosition: {
x: 0,
y: 0
},
checkinData: {
TotalCheckins: 10, //
Requirement: "任意消费100钻石",
TotalCheckinList: [{ //
isClaim: true, //
Days: 3, //
tips: "获得钻石*100"
}],
CheckinList: [
],
},
is_sign: false,
isSignCooldown: false, //
}
},
onLoad() {
this.load();
},
methods: {
showTips(item, event, index) {
if (item.tips) {
//
const query = uni.createSelectorQuery();
query.selectAll('.total-checkin-item').boundingClientRect(data => {
if (data && data[index]) {
const itemRect = data[index];
this.tipPosition.x = itemRect.left + itemRect.width / 2;
this.tipPosition.y = itemRect.top - 20;
this.currentTip = item.tips;
this.tipVisible = true;
//
setTimeout(() => {
this.tipVisible = false;
}, 2000);
}
}).exec();
}
},
methods: {
async load() {
let sign_in_spend_limit = this.$config.getAppSetting("sign_in_spend_limit");
if (sign_in_spend_limit && sign_in_spend_limit > 0) {
this.checkinData.Requirement = "签到条件:任意消费" + sign_in_spend_limit + "钻石"
} else {
this.checkinData.Requirement = ""
}
let res = await this.req({
url: 'sign_info',
Loading: true
// method: "GET",
})
console.log(res);
if (res.status === 0) {
return;
}
let data = res.data;
console.log(this.checkinData.CheckinList);
this.is_sign = data.is_sign == 0 ? true : false;
this.checkinData.CheckinList.splice(0, this.checkinData.CheckinList.length);
let that = this;
data.daily_configs.forEach(item => {
let t = {
isExpired: false,
isClaim: item.is_sign === 2 ? true : false,
isToday: item.is_sign === 1 ? true : false,
Day: item.day,
Reward: item.description,
};
// isExpired: true, //
// isClaim: false, //
// isToday: false, //
that.checkinData.CheckinList.push(t);
});
//TotalCheckinList
this.checkinData.TotalCheckinList.splice(0, this.checkinData.TotalCheckinList.length);
data.continuous_configs.forEach(item => {
let t = {
Days: item.day,
isClaim: item.is_sign === 2 ? true : false,
tips: item.description || ''
};
that.checkinData.TotalCheckinList.push(t);
});
this.checkinData.TotalCheckins = data.sign_days;
},
async sign() {
if (!this.is_sign) {
this.$c.msg("已签到")
return false;
}
//
if (this.isSignCooldown) {
this.$c.msg("点击太频繁,请稍后再试")
return false;
}
//
this.isSignCooldown = true;
//
setTimeout(() => {
this.isSignCooldown = false;
}, 500);
let res = await this.req({
url: 'sign',
Loading: true
})
console.log(res);
if (res.status === 1) {
this.$c.msg(res.msg)
}
await this.load();
}
}
}
</script>
<style lang="scss">
.content {
width: 100vw;
box-sizing: border-box;
background: #F7F7F7;
.content {
width: 100vw;
box-sizing: border-box;
background: #F7F7F7;
}
.navLeft {
position: fixed;
left: 30rpx;
height: 44px;
z-index: 100;
>view {
font-weight: 400;
font-size: 50rpx;
color: #FFFFFF;
}
}
.navLeft {
position: fixed;
left: 30rpx;
height: 44px;
z-index: 100;
.title1 {
width: 100%;
top: 108rpx;
position: absolute;
display: flex;
align-items: center;
font-size: 34rpx;
justify-content: center;
color: black;
z-index: 50;
}
>view {
font-weight: 400;
font-size: 50rpx;
color: #FFFFFF;
}
}
.grid-container {
display: grid;
grid-template-columns: repeat(4, 140rpx);
gap: 26rpx;
}
.title1 {
.grid-item {
width: 140rpx;
height: 172rpx;
position: relative;
>image {
width: 100%;
top: 108rpx;
height: 100%;
position: absolute;
display: flex;
align-items: center;
font-size: 34rpx;
justify-content: center;
color: black;
z-index: 50;
}
.grid-container {
display: grid;
grid-template-columns: repeat(4, 140rpx);
gap: 26rpx;
.day {
position: absolute;
font-size: 18rpx;
color: #96B152;
top: 12rpx;
left: 50%;
transform: translateX(-50%);
}
.grid-item {
width: 140rpx;
height: 172rpx;
position: relative;
>image {
width: 100%;
height: 100%;
position: absolute;
}
.day {
position: absolute;
font-size: 18rpx;
color: #96B152;
top: 12rpx;
left: 50%;
transform: translateX(-50%);
}
.reward {
position: absolute;
font-size: 20rpx;
color: #96B050;
white-space: nowrap;
bottom: 10rpx;
left: 50%;
transform: translateX(-50%);
}
.reward {
position: absolute;
font-size: 20rpx;
color: #96B050;
white-space: nowrap;
bottom: 10rpx;
left: 50%;
transform: translateX(-50%);
}
}
.tooltip {
position: fixed;
z-index: 999;
transform: translateX(-50%);
.tooltip-content {
min-width: 80rpx;
max-width: 300rpx;
padding: 10rpx 16rpx;
background-color: rgba(0, 0, 0, 0.7);
color: #fff;
border-radius: 8rpx;
font-size: 24rpx;
text-align: center;
}
.tooltip-arrow {
width: 0;
height: 0;
border-left: 10rpx solid transparent;
border-right: 10rpx solid transparent;
border-top: 10rpx solid rgba(0, 0, 0, 0.7);
margin: 0 auto;
}
}
</style>