Commit 29ee853c authored by wangnf's avatar wangnf

wnf

parent 0c78f968
......@@ -9,6 +9,7 @@
"pages/endPage/endPage"
],
"window": {
"allowsBounceVertical": "NO",
"defaultTitle": "C端模板",
"enableSkia":"true"
}
......
......@@ -69,9 +69,7 @@
line-height:30rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
white-space: nowrap;
}
.goods-modal-container__content-item__price {
padding: 0 31rpx 0 24rpx;
......@@ -112,7 +110,4 @@
top: 502rpx;
right: 19rpx;
background: #eee;
}
.goods-modal-timer__clock {
}
\ No newline at end of file
.my-prize-page {
width: 100vw;
height: 100vh;
opacity: 1;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
/* background: url('') no-repeat center top/cover; */
}
.my-prize-page .my-prize-wrap {
width: 100%;
height: 100%;
overflow: auto;
}
.my-prize-page .my-prize-label {
width: 208rpx;
height: 36rpx;
margin: 140rpx auto 40rpx;
background: url('//yun.dui88.com/duiba-components-c-myprizeprize_title.png') no-repeat;
background-size: 100% 100%;
}
.my-prize-page .my-prize-list {
width: 100%;
height: auto;
}
.my-prize-page .my-prize-empty {
text-align: center;
color: #fff;
margin-top: 30rpx;
}
.my-prize-page .my-prize-item {
display: flex;
justify-content: center;
align-items: center;
padding: 0 28rpx 0 26rpx;
margin: 0 auto 24rpx;
position: relative;
box-sizing: border-box;
width: 700rpx;
height: 161rpx;
background-color: #ffffff;
box-shadow: 2rpx 3rpx 18rpx 0 rgba(230, 146, 255, 0.6);
border-radius: 10rpx;
box-sizing: border-box;
}
.my-prize-page .my-prize-item .my-prize-avatar {
width: 120rpx;
height: 120rpx;
}
.my-prize-page .my-prize-item .my-prize-content {
flex: 1;
min-width: 0;
padding: 0 20rpx;
display: flex;
flex-direction: column;
height: 130rpx;
}
.my-prize-page .my-prize-item .my-prize-subtitle {
display: flex;
justify-content: center;
align-items: center;
}
.my-prize-page .my-prize-item .my-prize-copy {
width: 20rpx;
height: 20rpx;
margin-left: 18rpx;
}
.my-prize-page .my-prize-item .prize-status {
width: 150rpx;
height: 41rpx;
}
.prize-status>image {
width: 100%;
height: 100%;
}
.my-prize-page .my-prize-item .my-prize-name {
width: 100%;
font-size: 28rpx;
color: #2d2d2d;
letter-spacing: -1rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.my-prize-page .my-prize-item .my-prize-tip {
margin-top: 8rpx;
font-size: 20rpx;
line-height: 20rpx;
letter-spacing: 0;
color: #8a8a8a;
}
.my-prize-page .my-prize-item .my-prize-code {
width: 290rpx;
font-family: PingFangSC-Regular;
font-size: 20rpx;
color: #8a8a8a;
letter-spacing: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
\ No newline at end of file
<view class="my-prize-page" style="{{{'background':`url(${task.image.bg}) no-repeat center top/cover`}}}">
<view class="my-prize-wrap">
<view class="my-prize-label" style="{{{'background':`url(${task.image.title}) no-repeat`,'backgroundSize':'100% 100%'}}}"></view>
<view class="my-prize-list" a:if="{{myPrizeList && myPrizeList.length > 0}}">
<view class="my-prize-item" a:for="{{myPrizeList}}">
<image class="my-prize-avatar" src="{{item.image}}"/>
<view class="my-prize-content">
<label class="my-prize-name">{{item.name}}</label>
<view class="my-prize-subtitle">
<label class="my-prize-code">奖品编码:{{item._id}}</label>
<!-- 复制按钮 -->
<image class="my-prize-copy" data-text="{{item._id}}" onTap="handleCopyId" src="{{task.image.copyIcon}}" />
</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === DRAW_STATUS.FAIL}}">{{item.remark}}</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === DRAW_STATUS.RETRY || (item.drawStatus === DRAW_STATUS.WAITAWARD)}}">请于{{endTime}}前领取</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === DRAW_STATUS.EXPIRED }}">奖品已过期失效</view>
</view>
<view class="prize-status" style="{{task.btnStyle}}">
<!-- 未领取 -->
<block a:if="{{item.drawStatus===DRAW_STATUS.WAITAWARD}}">
<!-- 实物填写地址 -->
<image a:if="{{item.type === PRIZE_TYPE.OBJECT}}" onTap="handleClick" data-item="{{item}}" src="{{task.image.addressBth}}" />
<!-- 优惠券立即领取 -->
<image a:else onTap="handleClick" data-item="{{item}}" src="{{task.image.getBth}}" />
</block>
<!-- 已领取 -->
<block a:if="{{item.drawStatus===DRAW_STATUS.SUCCESS}}">
<!-- 实物查看物流 -->
<image a:if="{{item.type === PRIZE_TYPE.OBJECT}}" onTap="handleView" data-item="{{item}}" src="{{task.image.logisticsBth}}" />
<!-- 优惠券去使用 -->
<image a:else onTap="handleTouse" data-item="{{item}}" src="{{task.image.useBtn}}" />
</block>
<!-- 重新领取 -->
<image a:if="{{item.drawStatus===DRAW_STATUS.RETRY}}" onTap="handleClick" data-item="{{item}}" src="{{task.image.getAgainBtn}}" />
<!-- 已失效 -->
<image a:if="{{item.drawStatus===DRAW_STATUS.EXPIRED}}" src="{{task.image.invalidBtn}}" />
<!-- 领取失败 -->
<image a:if="{{item.drawStatus===DRAW_STATUS.FAIL}}" src="{{task.image.failBth}}" />
</view>
</view>
</view>
<view a:if="{{myPrizeList && myPrizeList.length === 0}}" class="my-prize-empty">{{task.blankTxt}}</view>
</view>
<logistics-modal a:if="{{isLogistic}}" prizeItem="{{currentPrize}}" onCloseModal="closeLogisticModal" task="{{task.logisticsImage}}"/>
</view>
\ No newline at end of file
const app = getApp();
const { tbcc } = app;
const { commonToast, navigateToOutside, getUserAddress, setClipboard } = tbcc.tb;
const { PRIZE_TYPE, DRAW_STATUS } = tbcc.constants;
Component({
mixins: [],
data: {
PRIZE_TYPE,
DRAW_STATUS,
currentPrize: {},
isLogistic: false,
},
props: {
myPrizeList: null, //我的奖品
endTime: null,//到期时间
task: {
image: {},
logisticsImage: {},
btnStyle: {}
}
},
didMount() { },
didUpdate() { },
didUnmount() { },
methods: {
//领取奖品
handleClick(e) {
this.props.onHandleClick(e)
},
// 复制编码
async handleCopyId(e) {
const { text } = e.target.dataset || {}
await setClipboard({ text })
console.log(text)
commonToast('复制成功')
},
// 去使用
handleTouse(e) {
const { item } = e.target.dataset;
navigateToOutside(item.useUrl)
},
//查看物流
handleView(e) {
let { item } = e.target.dataset
this.setData({ currentPrize: item, isLogistic: true })
},
/**
* 关闭物流弹窗
*/
closeLogisticModal() {
this.setData({ isLogistic: false })
},
},
});
{
"component": true,
"usingComponents": {
"logistics-modal": "/components/logisticsModal/logisticsModal"
}
}
\ No newline at end of file
......@@ -19,28 +19,40 @@ const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
const completeType = 1 // 1 浏览完成 2 点击任意商品完成
const completeTime = 10 // 浏览时间(s)
const taskConfig = {
taskType: 'browseGoods',
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
},
color: '#181818'
}
Page({
timer: null,
data: {
completeType: completeType,
usePercent: 0, // 已进行的进度条
percent: 0,// 进度条
isShowCountdown: true, // 是否显示倒计时
isShowCountdown: false, // 是否显示倒计时
query: {},
task: {},
task: taskConfig,
goodsList: []
},
onLoad(query) {
this.query = query || {}
this.init()
this.initPage()
},
onShow() {
//重新回到页面开启倒计时
if(!this.timer && completeType == 1) {
this.setData({ usePercent: this.data.percent })
this.browseGoodsTimes()
console.log(10 - this.usePercent)
}
},
onHide() {
......@@ -55,24 +67,6 @@ Page({
clearInterval(this.timer)
}
},
init() {
this.setData({
task: {
taskType: 'browseGoods',
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
},
color: '#181818'
}
})
this.initPage()
},
async initPage() {
const { activityId } = app
const { itemIds } = this.query
......@@ -91,7 +85,7 @@ Page({
res && commonToast(res)
}) || {}
if(browsResult.success) {
commonToast('任务完成,请到任务中心查看奖励')
commonToast('浏览成功')
}
},
/**
......@@ -117,7 +111,7 @@ Page({
this.setData({
usePercent: this.data.usePercent + 1
}, () => {
if (this.data.usePercent >= 10) {
if (this.data.usePercent >= completeTime) {
this.onCompleteTask()
clearInterval(this.timer)
}
......
......@@ -14,41 +14,36 @@
* color: //商品名称:文字颜色
* }
*/
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
import API from '../../api';
const taskConfig = {
taskType: 'collectGoods',
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
},
color: '#181818'
}
Page({
data: {
query: {},
task: {},
task: taskConfig,
goodsList: []
},
onLoad(query) {
this.query = query || {}
this.init()
this.initPage()
},
onShow() {
},
init() {
this.setData({
task: {
taskType: 'collectGoods',
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
},
color: '#181818'
}
})
this.initPage()
},
async initPage() {
const { activityId } = app
const { itemIds } = this.query
......@@ -69,6 +64,7 @@ Page({
res && commonToast(res)
}) || {}
if(success) {
commonToast('收藏成功')
this.initPage()
}
}
......
......@@ -151,7 +151,8 @@ Page({
ruleModalVisible: false
});
},
onShareAppMessage() {
onShareAppMessage(res) {
console.log(res)
// 返回自定义分享信息
return SHARE_CONFIG;
},
......
.my-prize-container {
width: 100vw;
height: 100vh;
opacity: 1;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
/* background: url('') no-repeat center top/cover; */
}
.my-prize-container .my-prize-label {
width: 208rpx;
height: 36rpx;
margin: 140rpx auto 40rpx;
background: url('//yun.dui88.com/duiba-components-c-myprizeprize_title.png') no-repeat;
background-size: 100% 100%;
}
.my-prize-content {
position: absolute;
left: 0;
top: 363rpx;
bottom: 0;
width: 100%;
}
.my-prize-content__scroll {
width: 100%;
height: 100%;
padding-top: 30rpx;
}
.my-prize-container .my-prize-list {
width: 100%;
height: auto;
}
.my-prize-container .my-prize-item__empty {
text-align: center;
color: #fff;
margin-top: 30rpx;
}
.my-prize-list .my-prize-item {
display: flex;
justify-content: center;
align-items: center;
padding: 0 28rpx 0 26rpx;
margin: 0 auto 24rpx;
position: relative;
box-sizing: border-box;
width: 700rpx;
height: 161rpx;
background-color: #ffffff;
box-shadow: 2rpx 3rpx 18rpx 0 rgba(230, 146, 255, 0.6);
border-radius: 10rpx;
box-sizing: border-box;
}
.my-prize-list .my-prize-item .my-prize-item__avatar {
width: 120rpx;
height: 120rpx;
}
.my-prize-list .my-prize-item .my-prize-item__content {
flex: 1;
min-width: 0;
padding: 0 20rpx;
display: flex;
flex-direction: column;
height: 130rpx;
align-items: flex-start;
justify-content: center
}
.my-prize-list .my-prize-item .my-prize-item__subtitle {
display: flex;
justify-content: center;
align-items: center;
}
.my-prize-list .my-prize-item .my-prize-item__copy {
width: 20rpx;
height: 20rpx;
margin-left: 18rpx;
}
.my-prize-list .my-prize-item .prize-item__status {
width: 150rpx;
}
.prize-item__status>image {
width: 100%;
}
.my-prize-list .my-prize-item .my-prize-item__name {
width: 100%;
font-size: 28rpx;
color: #2d2d2d;
letter-spacing: -1rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.my-prize-list .my-prize-item .my-prize-item__tip {
margin-top: 8rpx;
font-size: 20rpx;
line-height: 20rpx;
letter-spacing: 0;
color: #8a8a8a;
}
.my-prize-list .my-prize-item .my-prize-item__code {
width: 290rpx;
font-family: PingFangSC-Regular;
font-size: 20rpx;
color: #8a8a8a;
letter-spacing: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
\ No newline at end of file
<view class="my-prize">
<prize-modal
myPrizeList="{{myPrizeList}}"
task="{{task}}"
endTime="{{endTime}}"
onHandleClick="handleClick"/>
</view>
\ No newline at end of file
<view class="my-prize-container" style="{{{'background':`url(${prizeConfig.bg}) no-repeat center top/cover`}}}">
<view class="my-prize-label" style="{{{'background':`url(${prizeConfig.title}) no-repeat`,'backgroundSize':'100% 100%'}}}"></view>
<view class="my-prize-content" style="{{ {'top': prizeConfig.contentTop }}}">
<scroll-view scroll-y="{{true}}" class="my-prize-content__scroll">
<view class="my-prize-list" a:if="{{myPrizeList && myPrizeList.length > 0}}">
<view class="my-prize-item" a:for="{{myPrizeList}}">
<image class="my-prize-item__avatar" src="{{item.image}}"/>
<view class="my-prize-item__content">
<label class="my-prize-item__name">{{item.name}}</label>
<view class="my-prize-item__subtitle" a:if="{{isShowPirzeId}}">
<label class="my-prize-item__code">奖品编码:{{item.id || item._id}}</label>
<!-- 复制按钮 -->
<image class="my-prize-item__copy" data-text="{{item.id || item._id}}" onTap="handleCopyId" src="{{prizeConfig.copyIcon}}" />
</view>
<view class="my-prize-item__tip" a:if="{{item.drawStatus === DRAW_STATUS.FAIL}}">{{item.remark}}</view>
<view class="my-prize-item__tip" a:if="{{item.drawStatus === DRAW_STATUS.RETRY || (item.drawStatus === DRAW_STATUS.WAITAWARD)}}">请于{{endTime}}前领取</view>
<view class="my-prize-item__tip" a:if="{{item.drawStatus === DRAW_STATUS.EXPIRED }}">奖品已过期失效</view>
</view>
<view class="prize-item__status" style="{{prizeConfig.btnStyle}}">
<!-- 实物奖品状态 -->
<block a:if="{{item.type === PRIZE_TYPE.OBJECT}}">
<image onTap="handleClick" data-item="{{item}}" src="{{objectStatus[item.drawStatus]}}" mode="widthFix" />
</block>
<!-- 非实物奖品状态 -->
<block a:else>
<image onTap="handleClick" data-item="{{item}}" src="{{(item.drawStatus === 3 && !item.useUrl) ? prizeConfig['receiveBtn'] : enameStatus[item.drawStatus]}}" mode="widthFix" />
</block>
</view>
</view>
</view>
<view a:if="{{myPrizeList && myPrizeList.length === 0}}" class="my-prize-item__empty">{{prizeConfig.blankTxt}}</view>
</scroll-view>
</view>
</view>
<logistics-modal
a:if="{{isLogisticModal}}"
prizeItem="{{currentPrize}}"
onCloseModal="closeLogisticModal"
task="{{logisticsImage}}" />
\ No newline at end of file
......@@ -6,47 +6,69 @@ const { tbcc } = app;
const { commonToast, navigateToOutside, getUserAddress, setClipboard } = tbcc.tb;
const { dateFormatter, throttleHandle } = tbcc.utils;
const { PRIZE_TYPE, DRAW_STATUS } = tbcc.constants;
// 我的奖品配置项
const prizeConfig = {
bg: '//yun.duiba.com.cn/aurora/assets/e13fab3165d3a6bb4cbe8827e8f0fd41084b0091.png', //背景图
title: '//yun.dui88.com/duiba-components-c-myprizeprize_title.png',//标题
copyIcon: '//yun.dui88.com/duiba-components-c-myprizemyprize_copy_code.png', //复制
receiveBtn: '//yun.duiba.com.cn/bestoreBox/prize_received.png', //已领取 权益类奖品未配置 uesUrl使用
commonStatus: {
6: '//yun.dui88.com/duiba-components-c-myprizeget_again.png', //重新领取
5: '//yun.duiba.com.cn/spark/assets/914ba8643c8abb8d710a3126ec312aecf6c4daf0.png', //已失效
4: '//yun.duiba.com.cn/spark/assets/8267375232058a6d0140270b1594427fb08d6ae3.png', //领取失败
},
objectStatus: {
1: '//yun.dui88.com/duiba-components-c-myprizeto_address.png', //填写地址(实物奖品)
3: '//yun.dui88.com/duiba-components-c-myprizelogistics.png', //查看物流
},
enameStatus: {
1: '//yun.dui88.com/duiba-components-c-myprizeget_now.png', //立即领取(除实物奖品外)
3: '//yun.duiba.com.cn/bestoreBox/prize_received.png', //去使用(除实物奖品外)
},
logisticsImage: {
shipped: '//yun.dui88.com/duiba-components-c-myprizeprize_shipped.png', // 已发货物理弹窗
notShipped: '//yun.dui88.com/duiba-components-c-myprizenotshipped.png', // 待发货物流弹窗
},
btnStyle: {
width: '150rpx'
},
contentTop: '210rpx',
blankTxt: '暂无奖品',
hasLogistic: true, // 是否展示物流信息
isShowPirzeId: true // 是否显示奖品编号
}
Page({
data: {
PRIZE_TYPE,
DRAW_STATUS,
myPrizeList: null, //我的奖品
myPrizeList: [], //我的奖品
endTime: null,//到期时间
task: {
image: {
bg: '//yun.duiba.com.cn/aurora/assets/e13fab3165d3a6bb4cbe8827e8f0fd41084b0091.png', //背景图
title: '//yun.dui88.com/duiba-components-c-myprizeprize_title.png',//标题
copyIcon: '//yun.dui88.com/duiba-components-c-myprizemyprize_copy_code.png', //复制
addressBth: '//yun.dui88.com/duiba-components-c-myprizeto_address.png', //填写地址(实物奖品)
getBth: '//yun.dui88.com/duiba-components-c-myprizeget_now.png', //立即领取(除实物奖品外)
logisticsBth: '//yun.dui88.com/duiba-components-c-myprizelogistics.png', //查看物流
useBtn: '//yun.dui88.com/duiba-components-c-myprizeto_use.png', //去使用(除实物奖品外)
getAgainBtn: '//yun.dui88.com/duiba-components-c-myprizeget_again.png', //重新领取
invalidBtn: '//yun.duiba.com.cn/spark/assets/914ba8643c8abb8d710a3126ec312aecf6c4daf0.png', //已失效
failBth: '//yun.duiba.com.cn/spark/assets/8267375232058a6d0140270b1594427fb08d6ae3.png', //领取失败
},
logisticsImage: {
shipped: '//yun.dui88.com/duiba-components-c-myprizeprize_shipped.png', // 已发货物理弹窗
notShipped: '//yun.dui88.com/duiba-components-c-myprizenotshipped.png', // 待发货物流弹窗
copyIcon: '//yun.dui88.com/duiba-components-c-myprizemyprize_copy_code.png', //复制
},
blankTxt: '暂无奖品',
btnStyle: { // 按钮自定义样式
width: '150rpx',
height: '41rpx',
}
}
prizeConfig: prizeConfig,
objectStatus: {
...prizeConfig.commonStatus,
...prizeConfig.objectStatus
},
enameStatus: {
...prizeConfig.commonStatus,
...prizeConfig.enameStatus
},
logisticsImage: {
...prizeConfig.logisticsImage,
copyIcon: prizeConfig.copyIcon
},
hasLogistic: prizeConfig.hasLogistic,
isShowPirzeId: prizeConfig.isShowPirzeId,
isLogisticModal: false,
currentPrize: {}
},
onShow() {
onLoad() {
this.getMyPrize();
},
onShow() {
},
// 到期时间
getEndTime(prizeList = []) {
if (!prizeList || !prizeList.length) return null
let endTime = prizeList[0].expiredTime
getEndTime(endTime) {
if (!endTime) return null
this.setData({
endTime: dateFormatter(endTime, 'yyyy/MM/dd hh:mm:ss')
})
......@@ -55,49 +77,55 @@ Page({
/**
* 获取奖品列表
* @param {string} type 是否展示loading
* @param {string}
*/
async getMyPrize(type) {
async getMyPrize() {
const { activityId } = app;
if (type != 'noLoading') {
my.showLoading();
}
const { success, data } = await API.getMyPrizeList({ activityId }).catch(res => {
commonToast(res && res.message);
this.setData({
myPrizeList: []
})
}) || {};
if (success && data) {
const { list } = data
this.setData({
myPrizeList: data.list
myPrizeList: list
})
console.log(data.list)
this.getEndTime(data.list)
}
if (type != 'noLoading') {
my.hideLoading();
const endTime = list && list[0] && list[0].expiredTime
this.getEndTime(endTime)
}
},
//领取奖品
handleClick: throttleHandle(async function(e) {
const { item } = e.target.dataset;
const { type, drawStatus, useUrl = '', id, _id } = e.target.dataset.item
const { hasLogistic } = this.data
if(drawStatus == 3) {
if(type == PRIZE_TYPE.OBJECT && hasLogistic) {
this.setData({ currentPrize: e.target.dataset.item, isLogisticModal: true })
return;
}
if(type != PRIZE_TYPE.OBJECT && useUrl) {
navigateToOutside(useUrl)
return;
}
}
if(!(drawStatus == 6 || drawStatus == 1)) {
return;
}
// 领取权益
if (item.type === PRIZE_TYPE.ENAME) return this.handleGetEquity(e)
const prizeId = id || _id
if (type === PRIZE_TYPE.ENAME) return this.handleGetEquity(prizeId)
// 领取实物
if (item.type === PRIZE_TYPE.OBJECT) return this.handleGetEntity(e)
if (type === PRIZE_TYPE.OBJECT) return this.handleGetEntity(prizeId)
// 领取积分
if (item.type === PRIZE_TYPE.CREDITS) return this.handleGetIntergation(e)
},1000),
if (type === PRIZE_TYPE.CREDITS) return this.handleGetIntergation(prizeId)
},2000),
// 优惠券
async handleGetEquity(e) {
async handleGetEquity(id) {
const { activityId } = app;
const { item } = e.target.dataset;
console.log(item, '领取权益')
const { success, data, message } = await API.receiveEnamePrize({ activityId, id: item._id || item.id }).catch(res => {
this.getMyPrize('noLoading')
const { success, data, message } = await API.receiveEnamePrize({ activityId, id }).catch(res => {
this.getMyPrize()
commonToast(res && res.message)
}) || {};
if (success && data) {
......@@ -106,14 +134,11 @@ Page({
}
},
// 领取实物前询问
async handleGetEntity(e) {
my.showLoading();
async handleGetEntity(id) {
const { activityId } = app;
const { item } = e.target.dataset;
const userAddress = await getUserAddress().catch(err => {
commonToast(err && err.errorMessage);
});
my.hideLoading();
if (!userAddress) return
const { name, telNumber, provinceName, cityName, cityCode, countyName, detailInfo, streetName } = userAddress || {};
const params = {
......@@ -126,7 +151,7 @@ Page({
province: provinceName,
area: countyName,
streetName,
id: item._id || item.id
id
}
my.confirm({
......@@ -155,21 +180,15 @@ Page({
this.getMyPrize()
},
// 积分
async handleGetIntergation(e) {
async handleGetIntergation(id) {
// 判断是否为会员
await this.getUserInfo()
const { isVip, vipLink } = app;
const { isVip, url } = await this.getUserInfo() || {}
if (!isVip) {
commonToast('立即加入会员,即可领取奖品', 2000);
setTimeout(() => {
navigateToOutside(vipLink)
}, 1000)
return
commonToast('需加入会员才能领取成功哦', 2000,() => { navigateToOutside(url) });
return;
}
const { activityId } = app;
const { item } = e.target.dataset;
console.log(item, '领取积分')
const { success, data } = await API.receiveEnamePrize({ activityId, id: item._id }).catch(res => {
const { success, data } = await API.receiveEnamePrize({ activityId, id }).catch(res => {
commonToast(res && res.message)
}) || {};
if (success && data) {
......@@ -184,10 +203,21 @@ Page({
const { success, data } = await API.getVipInfo({ activityId }).catch(res => {
commonToast(res && res.message)
}) || {};
console.log(data, '用户vip信息');
if (success && data) {
app.isVip = (data && data.isVip) || false;
app.vipLink = (data && data.url) || '';
return data
}
},
// 复制编码
async handleCopyId(e) {
const { text } = e.target.dataset || {}
await setClipboard({ text })
commonToast('复制成功')
},
/**
* 关闭物流弹窗
*/
closeLogisticModal() {
this.setData({ isLogisticModal: false })
},
});
\ No newline at end of file
{
"usingComponents": {
"prize-modal": "/components/prizeModal/prizeModal"
"logistics-modal": "/components/logisticsModal/logisticsModal"
}
}
\ No newline at end of file
......@@ -14,41 +14,35 @@
* color: //商品名称:文字颜色
* }
*/
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
import API from '../../api';
const taskConfig = {
taskType: 'orderGoods',
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
},
color: '#181818'
}
Page({
data: {
query: {},
task: {},
task: taskConfig,
goodsList: []
},
onLoad(query) {
this.query = query || {}
this.init()
this.initPage()
},
onShow() {
},
init() {
this.setData({
task: {
taskType: 'orderGoods',
type: '01',
image: {
bg: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_bg@2x.png',
banner: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_banner@2x.png',
title: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_title@2x.png',
collect: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_collection@2x.png',
no_collect: '//yun.duiba.com.cn/taobaomini/clientCTest/collection_no_collect@2x.png',
img: '//yun.duiba.com.cn/taobaomini/clientCTest/goods_img@2x.png',
},
color: '#181818'
}
})
this.initPage()
},
async initPage() {
const { activityId } = app
......
// 分享配置
export const SHARE_CONFIG = {
title: '分享测试标题',
desc: '分享测试描述',
imageUrl: '', // 分享图片URL
path: 'pages/index/index'
};
// 链接配置
export const REDIRECT_URL = {
'testpage': '/pages/testPage/testPage',
'tmall': 'https://www.tmall.com'
};
// 领取奖品状态
export const DRAW_STATUS = {
// 待领取
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment