...
|
...
|
@@ -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 |
...
|
...
|
|