Authored by wenjiekong

添加优惠券状态判断

@@ -94,7 +94,7 @@ exports.userAcquireStatus = (req, res, next) => { @@ -94,7 +94,7 @@ exports.userAcquireStatus = (req, res, next) => {
94 94
95 if (!req.user.uid) { 95 if (!req.user.uid) {
96 uid = ''; 96 uid = '';
97 - }else { 97 + } else {
98 uid = req.user.uid; 98 uid = req.user.uid;
99 } 99 }
100 100
@@ -564,10 +564,10 @@ $('.ident-select-wrap').one('click', function() { @@ -564,10 +564,10 @@ $('.ident-select-wrap').one('click', function() {
564 *埋点 564 *埋点
565 */ 565 */
566 $(function() { 566 $(function() {
567 - //加载优惠券状态 567 + // 加载优惠券状态
568 var couponIds = ''; 568 var couponIds = '';
569 569
570 - $('.coupon > a').each(function(){ 570 + $('.coupon > a').each(function() {
571 couponIds += $(this).attr('data-id') + ','; 571 couponIds += $(this).attr('data-id') + ',';
572 }); 572 });
573 573
@@ -575,15 +575,17 @@ $(function() { @@ -575,15 +575,17 @@ $(function() {
575 type: 'GET', 575 type: 'GET',
576 url: '/product/students/userAcquireStatus', 576 url: '/product/students/userAcquireStatus',
577 data: { 577 data: {
578 - couponIds: couponIds.substring(0,couponIds.length-1) 578 + couponIds: couponIds.substring(0, couponIds.length - 1)
579 }, 579 },
580 success: function(res) { 580 success: function(res) {
581 - var code = res.code; 581 + var code = res.code,
  582 + i,
  583 + text;
582 584
583 console.info(res); 585 console.info(res);
584 - if (code == 200) {  
585 - for (var i = 0; i < res.data.length; i++) {  
586 - var text = ''; 586 + if (code === 200) {
  587 + for (i = 0; i < res.data.length; i++) {
  588 + text = '';
587 589
588 if (res.data[i].status === 1) { 590 if (res.data[i].status === 1) {
589 text = '<div class="normal">' + 591 text = '<div class="normal">' +
@@ -609,7 +611,7 @@ $(function() { @@ -609,7 +611,7 @@ $(function() {
609 '<p class="guang">去逛逛</p>' + 611 '<p class="guang">去逛逛</p>' +
610 '</div>'; 612 '</div>';
611 } 613 }
612 - $("[data-id='" + res.data[i].couponId + "']").find('.info').html(text); 614 + $('[data-id=\'' + res.data[i].couponId + '\']').find('.info').html(text);
613 } 615 }
614 616
615 } 617 }