Authored by htoooth

fix

@@ -131,5 +131,5 @@ export default { @@ -131,5 +131,5 @@ export default {
131 method: 'app.drawline.getMyQueueList' 131 method: 'app.drawline.getMyQueueList'
132 } 132 }
133 }); 133 });
134 - } 134 + },
135 }; 135 };
@@ -61,17 +61,14 @@ export default { @@ -61,17 +61,14 @@ export default {
61 }); 61 });
62 }, 62 },
63 63
64 - addQueue({userId, helpUserId, helpUserName, helpUserImgUrl, limitProductCode, activityId}) { 64 + addQueue({uid, activityId, unionId}) {
65 return api.post({ 65 return api.post({
66 url: '', 66 url: '',
67 data: { 67 data: {
68 method: 'app.drawline.addQueue', 68 method: 'app.drawline.addQueue',
69 - userId,  
70 - helpUserId,  
71 - helpUserName,  
72 - helpUserImgUrl,  
73 - limitProductCode,  
74 - activityId 69 + uid,
  70 + activityId,
  71 + openId: unionId
75 } 72 }
76 }); 73 });
77 }, 74 },
@@ -83,6 +83,7 @@ Page(Object.assign({ @@ -83,6 +83,7 @@ Page(Object.assign({
83 avatarList: [], 83 avatarList: [],
84 uid: '', 84 uid: '',
85 originUid: '', 85 originUid: '',
  86 + originUnionID: '',
86 87
87 limitProductType: LIMIT_TYPE.ASSIS, 88 limitProductType: LIMIT_TYPE.ASSIS,
88 showStatus: SHOW_STATUS.SHARE, 89 showStatus: SHOW_STATUS.SHARE,
@@ -117,6 +118,7 @@ Page(Object.assign({ @@ -117,6 +118,7 @@ Page(Object.assign({
117 onLoad: function(options) { 118 onLoad: function(options) {
118 let limitProductCode = options.limitProductCode ? options.limitProductCode : ''; 119 let limitProductCode = options.limitProductCode ? options.limitProductCode : '';
119 let originUid = options.originUid ? options.originUid : ''; 120 let originUid = options.originUid ? options.originUid : '';
  121 + let originUnionID = options.originUnionID ? options.originUnionID : '';
120 122
121 let uid = app.getUid(); 123 let uid = app.getUid();
122 124
@@ -127,6 +129,7 @@ Page(Object.assign({ @@ -127,6 +129,7 @@ Page(Object.assign({
127 limitProductCode, 129 limitProductCode,
128 originUid, 130 originUid,
129 uid, 131 uid,
  132 + originUnionID
130 }); 133 });
131 134
132 this.productInfo().then(() => { 135 this.productInfo().then(() => {
@@ -160,7 +163,7 @@ Page(Object.assign({ @@ -160,7 +163,7 @@ Page(Object.assign({
160 return { 163 return {
161 title: params.TITLE, // 分享标题 164 title: params.TITLE, // 分享标题
162 desc: params.DESC, // 分享描述 165 desc: params.DESC, // 分享描述
163 - path: `/pages/product/detail/detail?limitProductCode=${this.data.limitProductCode}&originUid=${app.getUid()}`, 166 + path: `/pages/product/detail/detail?limitProductCode=${this.data.limitProductCode}&originUid=${app.getUid()}&originUnionID=${app.getUnionID()}`,
164 imageUrl: this.data.snapData.default_image, 167 imageUrl: this.data.snapData.default_image,
165 success: function() { 168 success: function() {
166 params.SHARE_RESUIL = 1; 169 params.SHARE_RESUIL = 1;
@@ -237,7 +240,8 @@ Page(Object.assign({ @@ -237,7 +240,8 @@ Page(Object.assign({
237 240
238 let params = { 241 let params = {
239 originUid: app.getUid(), 242 originUid: app.getUid(),
240 - llimitProductCode: this.data.limitProductCode 243 + llimitProductCode: this.data.limitProductCode,
  244 + originUnionID: app.getUnionID(),
241 }; 245 };
242 246
243 let product_qrCode = config.domains.api + `/wechat/miniapp/img-check.jpg?param=${JSON.stringify(params)}&miniapp_type=4&miniQrType=11`; // eslint-disable-line 247 let product_qrCode = config.domains.api + `/wechat/miniapp/img-check.jpg?param=${JSON.stringify(params)}&miniapp_type=4&miniQrType=11`; // eslint-disable-line
@@ -252,7 +256,11 @@ Page(Object.assign({ @@ -252,7 +256,11 @@ Page(Object.assign({
252 256
253 let productSourceType = PRODUCT_SOURCE_TYPE.ORIGIN; 257 let productSourceType = PRODUCT_SOURCE_TYPE.ORIGIN;
254 258
255 - if (this.data.originUid) { 259 + if (this.data.originUnionID && this.data.originUnionID === app.getUnionID()) {
  260 + productSourceType = PRODUCT_SOURCE_TYPE.ORIGIN;
  261 + } else if (!this.data.originUnionID && !this.data.originUid) {
  262 + productSourceType = PRODUCT_SOURCE_TYPE.ORIGIN;
  263 + } else if (this.data.originUnionID && this.data.originUnionID !== app.getUnionID()) {
256 productSourceType = PRODUCT_SOURCE_TYPE.SHARE; 264 productSourceType = PRODUCT_SOURCE_TYPE.SHARE;
257 } 265 }
258 266
@@ -289,13 +297,15 @@ Page(Object.assign({ @@ -289,13 +297,15 @@ Page(Object.assign({
289 if (this.data.assisLimit === result.data.list.length) { 297 if (this.data.assisLimit === result.data.list.length) {
290 assisStatus = ASSIS_STATUS.ASSIS_FULL; 298 assisStatus = ASSIS_STATUS.ASSIS_FULL;
291 } else { 299 } else {
292 - if (this.data.originUid && this.data.uid !== this.data.originUid) { 300 + // 不是发起者
  301 + if (this.data.originUid && this.data.originUnionID && this.data.originUnionID !== app.getUnionID()) {
293 assisStatus = ASSIS_STATUS.ASSIS_ACTION; 302 assisStatus = ASSIS_STATUS.ASSIS_ACTION;
294 } else { 303 } else {
295 assisStatus = ASSIS_STATUS.UN_ASSIS; 304 assisStatus = ASSIS_STATUS.UN_ASSIS;
296 } 305 }
297 } 306 }
298 307
  308 + // 判断当前用户是否已经助力
299 let index = (result.data.list || []).findIndex((i) => i.helpUserId === app.getUnionID()); 309 let index = (result.data.list || []).findIndex((i) => i.helpUserId === app.getUnionID());
300 310
301 if (index !== -1) { 311 if (index !== -1) {
@@ -316,29 +326,42 @@ Page(Object.assign({ @@ -316,29 +326,42 @@ Page(Object.assign({
316 326
317 }); 327 });
318 } else if (this.data.limitProductType === LIMIT_TYPE.QUEUE) { 328 } else if (this.data.limitProductType === LIMIT_TYPE.QUEUE) {
319 - let queueType = this.data.queueType;  
320 - let queueStatus = QUEUE_STATUS.QUEUE_END;  
321 -  
322 - switch (queueType) {  
323 - case QUEUE_TYPE.READY:  
324 - queueStatus = QUEUE_STATUS.UN_QUEUE;  
325 - break;  
326 - case QUEUE_TYPE.START:  
327 - queueStatus = QUEUE_STATUS.QUEUE_START;  
328 - break;  
329 - case QUEUE_TYPE.ACTIVATE:  
330 - queueStatus = QUEUE_STATUS.QUEUE_PROCESSING;  
331 - break;  
332 - case QUEUE_TYPE.END:  
333 - queueStatus = QUEUE_STATUS.QUEUE_END;  
334 - break;  
335 - default:  
336 - queueStatus = QUEUE_STATUS.QUEUE_END;  
337 - break;  
338 - } 329 + return detailModel.getAssistInfo(uid, this.data.limitProductCode).then(result => {
  330 + if (result.code !== 200) {
  331 + return;
  332 + }
339 333
340 - this.setData({  
341 - queueStatus, 334 + let queueType = this.data.queueType;
  335 + let queueStatus = QUEUE_STATUS.QUEUE_END;
  336 +
  337 + switch (queueType) {
  338 + case QUEUE_TYPE.READY:
  339 + queueStatus = QUEUE_STATUS.UN_QUEUE;
  340 + break;
  341 + case QUEUE_TYPE.START:
  342 + queueStatus = QUEUE_STATUS.QUEUE_START;
  343 + break;
  344 + case QUEUE_TYPE.ACTIVATE:
  345 + queueStatus = QUEUE_STATUS.QUEUE_PROCESSING;
  346 + break;
  347 + case QUEUE_TYPE.END:
  348 + queueStatus = QUEUE_STATUS.QUEUE_END;
  349 + break;
  350 + default:
  351 + queueStatus = QUEUE_STATUS.QUEUE_END;
  352 + break;
  353 + }
  354 +
  355 + // 判断当前用户是否已经助力
  356 + let index = (result.data.list || []).findIndex((i) => i.helpUserId === app.getUnionID());
  357 +
  358 + if (index !== -1) {
  359 + queueStatus = QUEUE_STATUS.QUEUE_HELP;
  360 + }
  361 +
  362 + this.setData({
  363 + queueStatus,
  364 + });
342 }); 365 });
343 } 366 }
344 }, 367 },
@@ -389,13 +412,15 @@ Page(Object.assign({ @@ -389,13 +412,15 @@ Page(Object.assign({
389 return; 412 return;
390 } 413 }
391 414
392 - detailModel.addQueue({ 415 + detailModel.addAssist({
393 userId: this.data.originUid, 416 userId: this.data.originUid,
394 helpUserId: app.getUnionID(), 417 helpUserId: app.getUnionID(),
395 helpUserName: userInfo.nickName, 418 helpUserName: userInfo.nickName,
396 helpUserImgUrl: userInfo.avatarUrl, 419 helpUserImgUrl: userInfo.avatarUrl,
397 limitProductCode: this.data.limitProductCode, 420 limitProductCode: this.data.limitProductCode,
398 activityId: this.data.activityId 421 activityId: this.data.activityId
  422 + }).then(() => {
  423 + return detailModel.addQueue(this.data.originUid, this.data.activityId, app.getUnionID());
399 }).then(result => { 424 }).then(result => {
400 if (result.code === 200) { 425 if (result.code === 200) {
401 this.setData({ 426 this.setData({
@@ -462,6 +487,10 @@ Page(Object.assign({ @@ -462,6 +487,10 @@ Page(Object.assign({
462 data.limitProductCode = this.data.limitProductCode; 487 data.limitProductCode = this.data.limitProductCode;
463 } 488 }
464 489
  490 + if (this.data.originUnionID) {
  491 + data.originUnionID = this.data.originUnionID;
  492 + }
  493 +
465 let referer = `/pages/product/detail/detail?${stringify(data)}`; 494 let referer = `/pages/product/detail/detail?${stringify(data)}`;
466 495
467 router.go('userCenter', { 496 router.go('userCenter', {
@@ -481,7 +510,5 @@ Page(Object.assign({ @@ -481,7 +510,5 @@ Page(Object.assign({
481 refreshText: '下拉刷新' 510 refreshText: '下拉刷新'
482 }); 511 });
483 }); 512 });
484 -  
485 - },  
486 - 513 + }
487 }, Actionsheet)); 514 }, Actionsheet));
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 } 11 }
12 12
13 .snapshoot-container .snapshoot-content { 13 .snapshoot-container .snapshoot-content {
14 - margin-top: 100rpx; 14 + margin-top: 20rpx;
15 margin-left: 105rpx; 15 margin-left: 105rpx;
16 width: 540rpx; 16 width: 540rpx;
17 height: 1000rpx; 17 height: 1000rpx;
@@ -234,7 +234,7 @@ @@ -234,7 +234,7 @@
234 234
235 .snapshoot-bottom { 235 .snapshoot-bottom {
236 margin-left: 105rpx; 236 margin-left: 105rpx;
237 - margin-top: 20%; 237 + margin-top: 20rpx;
238 width: 540rpx; 238 width: 540rpx;
239 height: 88rpx; 239 height: 88rpx;
240 display: flex; 240 display: flex;