Authored by lea guo

yohood原购价

... ... @@ -93,7 +93,7 @@ Component({
startTime: this.properties.startTime,
});
this.setData({
remainingTime: fomartTimes.join(':'),
remainingTime: fomartTimes.join(':') || '00:00:00',
isStart: fomartTimes.length === 0,
});
}, 1000);
... ...
// page/subPackage/pages/zeroSell/components/product-detail-header.js
import { fomartCountdownTime } from '../../../../utils/util';
import { fomartCountdownTime,formatTimeByDefined } from '../../../../utils/util';
Component({
properties: {
product: {
type: Object,
observer() {
observer(product) {
const {end_time: endTime, start_time: startTime, status} = product
let nextActivityTime = ''
if(status === 1 && endTime) {
nextActivityTime = `${formatTimeByDefined(startTime, 'Y-M-D h:m')}-${formatTimeByDefined(endTime, 'h:m')}`
}
this.setData({
formatTimeList: this.formatCountDown(),
nextActivityTime
});
},
},
... ... @@ -26,6 +32,7 @@ Component({
show: false,
isEnd: false,
formatTimeList: [],
nextActivityTime: ''
},
ready: function() {
const timeId = setInterval(() => {
... ...
... ... @@ -16,7 +16,7 @@
</view>
<view class="next-preview" wx:if="{{product.status === 1}}" hidden="{{ show }}">
<text class="next-tip">下一场活动时间</text>
<text class="next-time">2019.08.29 10:00-10:30</text>
<text class="next-time">{{nextActivityTime}}</text>
</view>
<view class="avatarcontainer">
<view class="avatars" wx:if="{{product.status === 2 && avatars.length > 0 && !show}}">
... ...
... ... @@ -175,9 +175,8 @@ Page(
isLogin: app.isLogin(),
uid,
});
this._getMineCode();
this._getUser();
this._getGroupList();
// this._getGroupList();
if (this.data.shareUid && this.data.scene) {
this._init();
... ... @@ -213,7 +212,6 @@ Page(
this._init().then(() => {
wx.stopPullDownRefresh();
});
this._getMineCode();
},
/**
... ... @@ -227,15 +225,15 @@ Page(
page,
loading: true,
});
this._loadGroupList(page);
// this._loadGroupList(page);
},
_getMineCode() {
if (this.data.uid && this.data.actPrizeId) {
_getMineCode(actPrizeId) {
if (this.data.uid) {
this.service
.fetchMyPrizeList({
uid: this.data.uid,
actPrizeId: this.data.actPrizeId,
actPrizeId,
})
.then(res => {
let len = res.data.length;
... ... @@ -324,23 +322,21 @@ Page(
let params = {
actPrizeId: this.data.actPrizeId,
};
const promises = [this.service.getYohoodDetail(params)];
if(this.data.actPrizeId) {
promises.push(this.service.getRecentAvatars(params))
}else {
promises.push(Promise.resolve({}))
}
return Promise.all(promises)
.then(([r1, r2]) => {
return this.service.getYohoodDetail(params)
.then((r1) => {
wx.hideLoading();
if (r1.code === 200 && r1.data) {
let product = r1.data;
let qrcode = this.service.getQrCode({
shareUid: app.getUid(),
actPrizeId: this.data.actPrizeId || product.id || '',
});
this._getMineCode(product.id);
let snapData = {
product_name: product.name,
default_image: product.cover_img,
... ... @@ -351,11 +347,6 @@ Page(
this.setData({
product: product,
actPrizeId: this.data.actPrizeId || product.id || '',
avatars: (r2.code === 200 ? r2.data : []).map(i => {
i.user_name = wrapperName(i.user_name);
i.user_thumb = formatImageUrl(i.user_thumb, 200, 200);
return i;
}),
myPrizeCount: r1.code === 200 ? r1.data.myCodeNum : 0,
snapData,
... ... @@ -363,6 +354,14 @@ Page(
lottery: JSON.parse(product.lottery_info || '{}'),
});
this.service.getRecentAvatars({actPrizeId: product.id}).then( r2 => {
this.setData({avatars: (r2.code === 200 ? r2.data : []).map(i => {
i.user_name = wrapperName(i.user_name);
i.user_thumb = formatImageUrl(i.user_thumb, 200, 200);
return i;
}),});
})
this._setActionStatus();
} else {
return Promise.reject();
... ... @@ -434,7 +433,6 @@ Page(
mask: true,
});
this._init();
this._getMineCode();
},
share(event) {
... ...
<view class="header {{shareFlag || notice.content && product.status >= 3 ? 'mt-header': ''}}">
<view class="header {{shareFlag || (notice.content || product.status >= 3 ? 'mt-header': '') }}">
<product-header product="{{product}}" shareFlag="{{shareFlag}}" bindchangeStatus="changeActionStatus" avatars="{{avatars}}"></product-header>
</view>
<view class="lottery-info">
... ... @@ -40,7 +40,7 @@
</block>
</view>
<view class="action-bar">
<action-bar activity-status="{{product.status}}" start-time="{{product.end_time}}" is-login="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}" act-id="{{actPrizeId}}" bindchangeStatus="changeActionStatus" bindshare="share" copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}" bindgaincodesuccess="reportSuccess" type="{{lottery.miniappType}}"></action-bar>
<action-bar activity-status="{{product.status}}" start-time="{{product.start_time}}" is-login="{{isLogin}}" status="{{actionStatus}}" num="{{myPrizeCount}}" share-uid="{{shareUid}}" act-id="{{actPrizeId}}" bindchangeStatus="changeActionStatus" bindshare="share" copyText="{{lottery.miniappCopy}}" text="{{lottery.miniappTip}}" bindgaincodesuccess="reportSuccess" type="{{lottery.miniappType}}"></action-bar>
</view>
<view class="foot"></view>
<import src="../../vendors/zanui/actionsheet/index.wxml" />
... ...
... ... @@ -17,7 +17,7 @@
overflow: hidden;
}
.mt-header {
margin-top: 56rpx;
margin-top: 80rpx;
}
.fellow-bar {
... ...
... ... @@ -57,8 +57,6 @@ class ZeroSellService extends Service {
result.data['myCodeNum'] = result.data[item];
}
})
productTime(result.data)
return result;
}
... ...