Authored by htoooth

add detial

... ... @@ -41,10 +41,6 @@ export default {
});
},
getQueueInfo(uid) {
},
/**
* 增加助力
*
... ... @@ -63,5 +59,37 @@ export default {
limitProductCode
}
});
},
addQueue({userId, helpUserId, helpUserName, helpUserImgUrl, limitProductCode, activityId}) {
return api.post({
url: '',
data: {
method: 'app.drawline.addQueue',
userId,
helpUserId,
helpUserName,
helpUserImgUrl,
limitProductCode,
activityId
}
});
},
/**
* 分享过该商品,记录一下
* @param {} uid
* @param {*} limitProductCode
*/
addShareAction(uid, limitProductCode) {
return api.post({
url: '',
data: {
method: 'app.limitProduct.addShareInfo',
uid,
limitProductCode,
isShare: 'Y'
}
});
}
};
\ No newline at end of file
... ...
... ... @@ -54,7 +54,6 @@ Page({
refreshText: '加载中...'
});
this.getList(this.data.tabSelected, 1, 20, false).then(() => {
wx.stopPullDownRefresh();
this.setData({
... ...
... ... @@ -5,6 +5,8 @@ import {
Actionsheet
} from '../../../vendors/zanui/index';
import {stringify} from '../../../vendors/query-stringify';
let app = getApp();
let router = global.router;
... ... @@ -25,6 +27,13 @@ const SHOW_STATUS = {
USED: 7
};
const QUEUE_TYPE = {
READY: 0,
START: 1,
ACTIVATE: 2,
END: 3,
};
const PRODUCT_SOURCE_TYPE = {
UNKONWN: 0,
ORIGIN: 1,
... ... @@ -41,10 +50,9 @@ const ASSIS_STATUS = {
const QUEUE_STATUS = {
UNKONWN: 0,
UN_QUEUE: 1,
QUEUE_PROCESSING: 2,
QUEUE_END: 3,
QUEUE_ACTION: 4,
WAIT_FOR_BUY: 5
QUEUE_START: 2,
QUEUE_PROCESSING: 3,
QUEUE_END: 4
};
const ASSIS_SUCCESS = {
... ... @@ -57,7 +65,7 @@ const QUEUE_SUCCESS = {
unknown: 0,
ok: 1,
repeat: 2
}
};
let {
windowHeight
... ... @@ -74,12 +82,13 @@ Page(Object.assign({
defaultImage: '',
productDesc: [],
snapData: {},
originUid: '',
avatarList: [],
uid: '',
originUid: '',
limitProductType: LIMIT_TYPE.ASSIS,
showStatus: SHOW_STATUS.SHARE,
queueType: QUEUE_TYPE.READY,
productSourceType: PRODUCT_SOURCE_TYPE.SHARE,
assisStatus: ASSIS_STATUS.UN_ASSIS,
queueStatus: QUEUE_STATUS.UN_QUEUE,
... ... @@ -87,6 +96,8 @@ Page(Object.assign({
assisLimit: 0,
assisSuccess: ASSIS_SUCCESS.unknown,
queueSuccess: QUEUE_SUCCESS.unknown,
error: false,
activityId: '',
actionSheet: {
componentId: 'shareActionSheet',
... ... @@ -219,8 +230,10 @@ Page(Object.assign({
saleTime: res.data.saleTime,
reminderNum: res.data.reminderNum,
limitProductTyp: res.data.limitProductType,
showStatus: res.data.showStatus,
assisLimit: res.data.helpLimit,
showStatus: res.data.showStatus ? res.data.showStatus : 0,
assisLimit: res.data.helpLimit ? res.data.helpLimit : 0,
queueType: res.data.queueType ? res.data.queueType : '',
activityId: res.data.activityId ? res.data.activityId : '',
defaultImage,
productDesc,
snapData,
... ... @@ -251,55 +264,153 @@ Page(Object.assign({
}
this.setData({
avatarList: result.data,
avatarList: result.list || [],
assisStatus
});
});
} else {
return detailModel.getQueueInfo(uid).then(result => {
} else if (this.data.limitProductType === LIMIT_TYPE.QUEUE) {
let queueType = this.data.queueType;
let queueStatus = QUEUE_STATUS.QUEUE_END;
switch (queueType) {
case QUEUE_TYPE.READY: {
queueStatus = QUEUE_STATUS.UN_QUEUE;
break;
}
case QUEUE_TYPE.START: {
queueStatus = QUEUE_STATUS.START;
break;
}
case QUEUE_TYPE.ACTIVATE: {
queueStatus = QUEUE_STATUS.QUEUE_PROCESSING;
break;
}
case QUEUE_TYPE.END: {
queueStatus = QUEUE_STATUS.QUEUE_END;
break;
}
default: {
queueStatus = QUEUE_STATUS.QUEUE_END;
break;
}
}
this.setData({
queueStatus
});
}
},
assisShare() {
if (!app.getUnionID()) {
this.goLogin();
return;
}
this.share();
},
assisAction() {
let userInfo = app.getUserInfo();
detailModel.addAssist({
userId: this.data.originUid,
helpUserId: app.getUnionID(),
helpUserName: userInfo.nickName,
helpUserImgUrl: userInfo.avatarUrl,
limitProductCode: this.data.limitProductCode
}).then(result => {
if (result.code !== 200 || result.code !== 401) {
this.showError();
return;
}
this.setData({
assisSuccess: ASSIS_SUCCESS.ok
});
if (result.code === 401) {
this.setData({
assisSuccess: ASSIS_SUCCESS.ok
});
return;
}
this.setData({
setData: ASSIS_SUCCESS.ok
});
}).catch(this.showError.bind(this));
// this.setData({
// assisSuccess: ASSIS_SUCCESS.repeat
// });
},
queueAction() {
this.setData({
queueSuccess: QUEUE_SUCCESS.ok
});
let userInfo = app.getUserInfo();
detailModel.addQueue({
userId: this.data.originUid,
helpUserId: app.getUnionID(),
helpUserName: userInfo.nickName,
helpUserImgUrl: userInfo.avatarUrl,
limitProductCode: this.data.limitProductCode,
activityId: this.data.activityId
}).then(result => {
if (result.code !== 200 || result.code !== 401) {
this.showError();
return;
}
// this.setData({
// queueSuccess: QUEUE_SUCCESS.repeat
// });
if (result.code === 401) {
this.setData({
queueSuccess: QUEUE_SUCCESS.repeat
});
return;
}
this.setData({
queueSuccess: QUEUE_SUCCESS.ok
});
}).catch(this.showError.bind(this));
},
queueCancel() {
this.onLoad();
},
assisCancel() {
this.onLoad();
},
buyNow() {
router.goUrl(`/pages/goodsDetail/goodsDetail?app=yohobuy&productSkn=${this.data.productSkn}`);
},
goList() {
router.go('home');
},
restartSelfShare() {
this.onLoad();
},
goQueueList() {
router.go('queueList', {
uid: this.data.originUid || this.data.uid,
limitProductCode: this.data.limitProductCode,
activityId: this.data.activityId
});
},
showError() {
this.setData({
error: true
});
},
cancelError() {
this.setData({
error: false
});
},
goLogin() {
let data = {};
if (this.data.originUid) {
data.originUid = this.data.originUid;
}
if (this.data.limitProductCode) {
data.limitProductCode = this.data.limitProductCode;
}
let refer = encodeURIComponent(`/pages/product/detail/detail?${stringify(data)}`);
router.go('userCenter', {refer});
}
}, Actionsheet));
}, Actionsheet));
\ No newline at end of file
... ...
... ... @@ -130,13 +130,20 @@
<block wx:if="{{productSourceType === 1}}">
<action-bar wx:if="{{queueStatus === 1}}">
<view class="bottom1-action">
<view class="action-btn" bindtap="assisShare">参加排队</view>
<view class="action-btn3">即将开售</view>
<view class="help">?</view>
</view>
</action-bar>
<action-bar wx:if="{{queueStatus === 2}}">
<view class="bottom1-action">
<view class="action-btn" bindtap="goQueueList">参加排队</view>
<view class="help">?</view>
</view>
</action-bar>
<action-bar wx:if="{{queueStatus === 3}}">
<view class="bottom1-action">
<view class="action-list">
<view class="action-btn3" bindtap="goQueueList">排队中,查看详情</view>
<view class="action-btn" bindtap="assisShare">邀请好友助力排队</view>
... ... @@ -144,7 +151,7 @@
</view>
</action-bar>
<action-bar wx:if="{{queueStatus === 3}}">
<action-bar wx:if="{{queueStatus === 4}}">
<view class="bottom1-action">
<view class="action-list">
<view class="action-btn3" bindtap="goQueueList">活动结束,点击查看排队详情</view>
... ... @@ -155,21 +162,35 @@
</block>
<block wx:if="{{productSourceType === 2}}">
<action-bar>
<action-bar wx:if="{{queueStatus === 1}}">
<view class="bottom1-action">
<view class="action-btn3">即将开售</view>
<view class="help">?</view>
</view>
</action-bar>
<action-bar wx:if="{{assisStatus === 3}}">
<view class="top-assis-action">
<view class="top-title" >你的好友邀请你为ta助力参加排队</view>
<view class="top-action">
<view class="top-ok" bindtap="queueAction">帮ta助力</view>
<view class="top-cancel" bindtap="queueCancel"><text decode="{{true}}">&ensp;取消&ensp;</text></view>
<view class="top-ok" bindtap="aqueueAction">帮ta助力</view>
<view class="top-cancel" bindtap="queueCancel">取消</view>
</view>
</view>
</action-bar>
<action-bar>
<view class="top-assis-action">
<view class="top-title" >你的好友已助力成功</view>
<view class="top-action1">
<view class="top-ok" bindtap="restartSelfShare" >我也要参加</view>
<action-bar wx:if="{{queueStatus === 4}}">
<view class="bottom1-action">
<view class="action-list">
<view class="action-btn3" bindtap="goQueueList">活动结束,点击查看排队详情</view>
</view>
</view>
</action-bar>
<action-bar wx:else>
<view class="bottom1-action">
<view class="action-list">
<view class="action-btn3" bindtap="goQueueList">活动结束,点击查看排队详情</view>
</view>
</view>
</action-bar>
... ... @@ -247,4 +268,21 @@
</view>
</yoho-alert>
<yoho-alert wx:if="{{error}}">
<view class="modal-content">
<view class="modal-title">
<view class="sub-title">助力失败</view>
<view class="sub-title2">
<view>请重新助力</view>
</view>
</view>
<view class="modal-ok" bindtap="cancelError">
确定
</view>
</view>
</view>
</yoho-alert>
<template is="zan-actionsheet" data="{{...actionSheet}}" />
\ No newline at end of file
... ...