Authored by 陈轩

商品领券: 修改 显示条件,并改为amd

... ... @@ -1470,7 +1470,15 @@ const _detailDataPkg = (origin, ua) => {
dest.introUrl = '/product/detail/intro/' + origin.product_skn;
dest.id = origin.product_id;
dest.goodsId = origin.goods_id;
dest.isDepositAdvance = origin.is_deposit_advance === 'Y'; // 是否定金预售
dest.isSeckill = origin.is_secKill === 'Y'; // 是否秒杀
dest.isLimitBuy = origin.isLimitBuy; // 是否 限购
dest.isPresale = Boolean(origin.expect_arrival_time); // 是否普通预售
// 自定义 属性
dest.showCoupon = !(
dest.isDepositAdvance || dest.isSeckill || dest.isLimitBuy || dest.isPresale
); // 商品有限购、秒杀、定金预售、普通预售 不显示领券
return dest;
... ... @@ -1584,7 +1592,8 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => {
}
if (origin.is_secKill) {
dest.isDepositAdvance = origin.is_deposit_advance;// 判断定金预售字段
dest.isDepositAdvance = origin.isDeposit_advance;// A定金预售字段 = origin.is_deposit_advance === 'Y'; // 是否定金预售
dest.isPresale = Boolean(origin.expect_arrival_time)
}
// 商品返回 YOHO 币
... ...
... ... @@ -161,6 +161,7 @@
<input id="productSkn" type="hidden" value="{{productSkn}}">
<input id="brand-id" type="hidden" value="{{brandId}}">
<input id="product-limit" type="hidden" value="{{isLimitBuy}}">
<input id="product-coupon-switch" type="hidden" value="{{showCoupon}}">
<input type="hidden" class="data-bind" name="loginUrl" id="loginUrl" value="">
... ...
... ... @@ -151,7 +151,9 @@ require('./detail/page-render')(function() {
$('#yoho-footer').css('border-top', '1px solid #e0e0e0');
}
});
require('./detail/brand-coupon');
$(function() {
if ($('#product-coupon-switch').val() === 'true') {
require(['./detail/brand-coupon']); // amd
}
});
... ...
'use strict';
/* global define */
// amd
define(function(require) {
'use strict';
/**
/**
* 商品详情: 品牌券
*/
var tip = require('plugin/tip');
var $ = require('yoho-jquery');
var $body = $(document.body);
var tip = require('plugin/tip');
var $ = require('yoho-jquery');
var $body = $(document.body);
var brandCoupon = {
var brandCoupon = {
skn: null,
brandId: null,
$entry: null,
... ... @@ -113,13 +116,7 @@ var brandCoupon = {
this.$couponDrawer.toggleClass('open', bool);
$body.toggleClass('coupon-drawer-open', bool);
}
};
$(function() {
if ($('#product-limit').val() !== '0') { // 限购商品 不展示优惠券
return;
}
};
brandCoupon.init(
$('#productSkn').val(),
... ...