
<view class="taskCenterPage">
<pages-load :isload="isload"></pages-load>
<view class="bottom" v-if="isload">
<view class="mosan" v-if="list2.length > 0">
<view class="list" v-for="(item, index) in list2">
<view class="left">
<view class="url">
<image
class="image"
:src="
item.url
? item.url
: 'https://hiin-file.cztv.com/d87900a7a7fa491ab0deaead666c9f71.png'
"
lazy-load
mode=""
>
</image>
</view>
<view class="text">
{{ item.goodName }}
</view>
</view>
<view class="right" @click.stop="openPopUp(item)">
<view class="quwancheng">
<view
class="text"
:style="{
color: item.writeOffOrNot ? '#fcf4f7' : '##fff',
background: item.writeOffOrNot ? '#efa3bd' : '#e66490',
}"
>
{{
item.isTheRewardClaimed
? item.writeOffOrNot
? "已核销"
: "核销"
: "点我领取"
}}</view
>
</view>
</view>
</view>
</view>
<view v-else class="empty-page">
<image
class="empty-icon"
src="/static/img/bigPlayer/empty-jar.png"
mode="widthFix"
></image>
<!-- 空状态文字 -->
<text class="empty-text">暂无未领取商品~</text>
</view>
</view>
<!-- 出示二维码 -->
<!-- <view class="chushierweima" @click.stop="openPopUp">
<image
class="image"
src="https://hiin-file.cztv.com/40f1cc8f53ce4aae9fb5652af1c7d8ec.png"
mode="heightFix"
>
</image>
</view> -->
<view
class="PopUp"
@click.stop="closePopUp"
v-if="PopUpShow"
:style="{
'--theme-color': ThemeColor,
'--secondary-color': SecondaryColor,
}"
>
<view class="info" @click.stop>
<view class="title">
<view class="left"> </view>
<view class="title-text">
<view class="square"> </view>
<view class="text"> 核销码 </view>
<view class="square"> </view>
</view>
<view class="rigth" @click.stop="closePopUp">
<image src="/static/img/bigPlayer/delete.png" mode=""> </image>
</view>
</view>
<view class="content">
<view class="biankuang">
<image class="erweima" :src="QRCode" mode=""></image>
</view>
<view class="text"> 任务完成后可向工作人员出示该二维码 </view>
</view>
<view class="btn-1">
<view class="btn-bottom left" @click.stop="closePopUp">
<view class="text"> 关 闭 弹 窗 </view>
</view>
</view>
<image
class="icon"
src="https://hiin-file.cztv.com/0ed138336df64124969653f04d9af7d2.png"
mode=""
>
</image>
</view>
</view>
<view
class="PopUp"
@click.stop="closePopUp"
v-if="PopUpShow"
:style="{
'--theme-color': ThemeColor,
'--secondary-color': SecondaryColor,
}"
>
<view class="info" @click.stop>
<view class="title">
<view class="left"> </view>
<view class="title-text">
<view class="square"> </view>
<view class="text"> 个人二维码 </view>
<view class="square"> </view>
</view>
<view class="rigth" @click.stop="closePopUp">
<image src="/static/img/bigPlayer/delete.png" mode=""> </image>
</view>
</view>
<view class="content">
<view class="biankuang">
<image class="erweima" :src="QRCode" mode=""></image>
</view>
<view class="text"> 任务完成后可向工作人员出示该二维码 </view>
</view>
<view class="btn-1">
<view class="btn-bottom left" @click.stop="closePopUp">
<view class="text"> 关 闭 弹 窗 </view>
</view>
</view>
<image
class="icon"
src="https://hiin-file.cztv.com/0ed138336df64124969653f04d9af7d2.png"
mode=""
>
</image>
</view>
</view>
</view>
</template>
<script>
import {
getUserClaimPageSelect,
getClaimTaskReward,
getWriteOff,
postWriteOffTaskPlayerApi,
getGenQrCode,
goodsWriteOff,
getGoodsWriteOff,
} from "@/utils/BigPlayer.js";
export default {
data() {
return {
list2: [],
PopUpShow: false,
ThemeColor: "#ee9fba",
SecondaryColor: "#ee9fba",
QRCode: "",
mainTaskId: "",
id: "",
isload: false,
scrollTop: 0,
old: {
scrollTop: 0,
},
isload: true,
};
},
onShow() {
this.scrollTop = this.old.scrollTop;
this.$nextTick(() => {
this.scrollTop = 0;
});
},
onLoad() {
this.init();
},
methods: {
init() {
getUserClaimPageSelect({
userId: 1,
// userId: uni.getStorageSync("memberid"),
// isTheRewardClaimed: false,
}).then((res) => {
console.log("用户领取信息", res);
if (res.code == 200) {
this.list2 = res.data;
this.isload = true;
}
});
},
handleTabChange(index) {
console.log("当前激活标签索引:", index);
// 可在此处添加切换标签后的业务逻辑(如更新内容区域)
},
// 出示二维码
openPopUp(item) {
console.log("点击二维码", item);
if (item.writeOffOrNot) return;
if (!item.isTheRewardClaimed) {
// 领取接口
this.givGift(item);
} else {
let _this = this;
uni.showModal({
title: "",
content: "是否确认核销",
cancelText: "取消",
confirmText: "确认",
success: (res) => {
if (res.confirm) {
_this.getQrcodeTaskPlayer(item);
}
},
});
}
},
// 领取商品
givGift(sceneValue) {
uni.showModal({
title: "",
content: "是否确认领取",
cancelText: "取消",
confirmText: "确认",
success: (res) => {
if (res.confirm) {
getClaimTaskReward({
id: sceneValue.id,
userId: sceneValue.userId,
// userId: uni.getStorageSync("memberid"),
})
.then((res) => {
if (res.code == 200) {
uni.showToast({
title: "领取成功",
icon: "success",
duration: 2000,
});
// 获取任务列表
this.init();
} else {
uni.showToast({
title: res.message,
icon: "none",
duration: 2000,
});
}
})
.catch((err) => {
uni.showToast({
title: err.msg,
icon: "none",
});
});
}
},
});
},
// 关闭二维码弹窗
closePopUp() {
this.PopUpShow = false;
this.getDetailTaskPlayer();
},
// 二维码请求
getQrcodeTaskPlayer(item) {
this.PopUpShow = true;
let _this = this;
let params = {
id: item.id,
userId: item.userId,
};
getGenQrCode(params).then((res) => {
_this.QRCode = res.data;
setTimeout(() => {
getGoodsWriteOff({
id: "28",
userId: 1,
}).then((res) => {
console.log("核销结果", res);
uni.showToast({
title: "核销成功",
icon: "success",
});
this.init();
});
}, 200);
});
},
// 操作/页面跳转 去完成
gotoPage(item) {
// const guideCoordinateInfo = JSON.stringify(item.guideCoordinateInfo);
// uni.setStorageSync("guideCoordinateInfo", guideCoordinateInfo);
// uni.navigateTo({
// url: "/BigPlayer/guideMap/index",
// });
},
// 扫码核销
handleScan() {
uni.scanCode({
success: (res) => {
console.log("扫码结果:", res.result, res);
if (!res.path) {
uni.showToast({
title: "无效码",
icon: "error",
});
return;
} else {
// uni.showToast({
// title: '核销成功',
// icon: 'success'
// })
// 使用字符串方法
let path = res.path;
const sceneIndex = path.indexOf("scene=");
if (sceneIndex !== -1) {
const sceneValue = path.substring(sceneIndex + 6);
console.log("扫码获取", sceneValue);
this.id = sceneValue;
// this.postWriteOffTaskPlayer(sceneValue);
} else {
uni.showToast({
title: "无效码",
icon: "error",
});
return;
}
}
},
});
},
postWriteOffTaskPlayer(sceneValue) {
getGoodsWriteOff({
id: sceneValue,
userId: uni.getStorageSync("memberid"),
})
.then((res) => {
if (res.code == 200) {
uni.showToast({
title: "核销成功",
icon: "success",
duration: 2000,
});
// 获取任务列表
this.init();
} else {
uni.showToast({
title: res.message,
icon: "none",
duration: 2000,
});
}
})
.catch((err) => {
uni.showToast({
title: err.msg,
icon: "none",
});
});
},
},
};
</script>
<style lang="scss" scoped>
.taskCenterPage {
position: fixed;
top: 34rpx;
left: 0;
width: 100vw;
min-height: 100vh;
background-color: #f5e1ea;
// background-repeat: no-repeat;
// background-position: center;
// background-attachment: fixed;
.bottom {
width: 100vw;
display: flex;
justify-content: center;
.mosan {
// background-color: #f5e1ea;
background-color: #f5e1ea;
width: 95%;
flex-direction: column;
.list {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx;
border-radius: 48rpx;
background: #fff;
border: 4rpx solid #e46590;
box-sizing: border-box;
font-family: "FZSEJW", "楷体";
font-weight: 500;
margin-top: 60rpx;
.left {
display: flex;
justify-content: flex-start;
align-items: center;
.url {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
overflow: hidden;
margin-right: 16rpx;
.image {
width: 100%;
height: 100%;
}
}
.text {
color: #e46490;
font-family: "FZSEJW", "楷体";
font-weight: 900;
font-size: 40rpx;
}
.name {
color: #1d2129;
font-size: 32rpx;
font-style: normal;
font-weight: 500;
line-height: 48rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: flex-start;
.top {
color: var(--gray-gray-1090084, #1d2129);
font-size: 32rpx;
font-style: normal;
font-weight: 600;
line-height: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.bottom {
color: var(--warning-warning-6, #ff7d00);
font-size: 24rpx;
font-style: normal;
font-weight: 400;
line-height: 20px;
.cc1 {
color: #4e5969;
}
.cc3 {
color: #00b42a;
}
}
}
}
.right {
display: flex;
justify-content: flex-end;
align-items: center;
position: absolute;
right: 30rpx;
.quwancheng {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
.text {
color: #ffffff;
display: flex;
align-items: center;
gap: 8rpx;
color: #ffffff;
background: #e56590;
font-family: "FZSEJW", "楷体";
font-weight: 900;
transform: scale(0.8);
text-align: center;
//
font-weight: 900;
font-family: "FZSEJW", "楷体";
display: inline-block;
padding: 28rpx 32rpx;
margin: 0 10rpx;
border: 10rpx solid #fff;
border-radius: 60rpx;
cursor: pointer;
box-shadow: 0 10rpx 0 0 rgba(218, 218, 218, 1);
align-self: stretch;
font-feature-settings: "liga" off, "clig" off;
font-size: 48rpx;
}
.text1 {
display: flex;
justify-content: center;
align-items: center;
.text12 {
color: #f38828;
font-size: 24rpx;
font-style: normal;
font-weight: 500;
line-height: 40rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.triangle-right {
width: 0;
height: 0;
border-top: 10rpx solid transparent;
border-bottom: 10rpx solid transparent;
border-left: 10rpx solid #f38828;
margin: 0 0 0 10rpx;
}
}
}
.image {
width: 100rpx;
height: 100rpx;
}
}
}
}
}
.chushierweima {
position: fixed;
right: 60rpx;
bottom: 0rpx;
width: 180rpx;
height: 180rpx;
z-index: 110;
.image {
width: 100%;
height: 100%;
}
}
.PopUp {
font-family: "FZSEJW", "楷体";
position: fixed;
top: 0;
left: 0;
width: 100vw;
min-height: 100vh;
background: rgba(0, 0, 0, 0.4);
z-index: 99999;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48rpx;
.info {
border-radius: 16px;
border: 2.5px solid var(--theme-color);
background: #fff;
display: flex;
padding: 24px;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 12px;
align-self: stretch;
width: 100%;
position: relative;
.title {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.title-text {
display: flex;
justify-content: center;
align-items: center;
}
.square {
position: relative;
width: 28rpx;
height: 28rpx;
background-color: var(--theme-color);
transform: rotate(-8deg);
margin: 0 20rpx;
}
.square::before {
content: "";
position: absolute;
top: 6rpx;
/* 阴影的偏移量 */
left: 6rpx;
/* 阴影的偏移量 */
width: 100%;
height: 100%;
background-color: var(--secondary-color);
/* 阴影颜色和透明度 */
}
.text {
color: var(--theme-color);
font-feature-settings: "liga" off, "clig" off;
font-size: 36rpx;
font-style: normal;
font-weight: 400;
line-height: normal;
}
.left,
.rigth {
width: 48rpx;
height: 48rpx;
image {
width: 100%;
height: 100%;
}
}
}
.content {
color: var(--theme-color);
align-self: stretch;
font-size: 24rpx;
font-weight: 500;
line-height: 20px;
white-space: pre-wrap;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
.biankuang {
border: 2rpx solid var(--theme-color);
width: 360rpx;
height: 360rpx;
border-radius: 32rpx;
box-sizing: border-box;
.erweima {
border-radius: 32rpx;
}
}
.text {
color: var(--theme-color);
text-align: center;
font-feature-settings: "liga" off, "clig" off;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: normal;
padding-top: 24rpx;
}
}
.btn-1 {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
.btn-bottom {
border-radius: 16px;
border: 2px solid var(--secondary-color);
display: flex;
justify-content: center;
align-items: center;
}
.left {
background: #fff;
.text {
display: flex;
padding: 8px 16px;
justify-content: center;
align-items: center;
gap: 8px;
border-radius: 26rpx;
border: 2px solid var(--theme-color);
background: #fff;
color: var(--theme-color);
text-align: center;
font-feature-settings: "liga" off, "clig" off;
font-size: 48rpx;
font-style: normal;
font-weight: 400;
line-height: 120%;
/* 28.8px */
}
}
.right {
background: var(--secondary-color);
.text {
display: flex;
padding: 8px 16px;
justify-content: center;
align-items: center;
gap: 8px;
border-radius: 26rpx;
border: 1px solid var(--theme-color);
background: var(--secondary-color);
color: var(--theme-color);
text-align: center;
font-feature-settings: "liga" off, "clig" off;
font-size: 48rpx;
font-style: normal;
font-weight: 400;
line-height: 120%;
}
}
}
.icon {
width: 250rpx;
height: 225rpx;
position: absolute;
top: -80rpx;
left: -65rpx;
}
}
}
.empty-page {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100vw;
height: 400rpx;
background-color: #f5e1ea;
overflow: hidden;
}
.empty-icon {
width: 200rpx;
margin-bottom: 30rpx;
}
.empty-text {
font-size: 32rpx;
color: #e56590;
font-weight: 900;
font-family: "FZSEJW", "楷体";
}
}
</style>