Authored by 郭成尧

ensure_from

@@ -11,6 +11,11 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model @@ -11,6 +11,11 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model
11 11
12 const cartModel = require('../models/index'); 12 const cartModel = require('../models/index');
13 13
  14 +// cookie 参数
  15 +const actCkOpthn = {
  16 + path: '/cart/index'
  17 +};
  18 +
14 /** 19 /**
15 * [购物车首页] 20 * [购物车首页]
16 */ 21 */
@@ -23,6 +28,9 @@ const index = (req, res) => { @@ -23,6 +28,9 @@ const index = (req, res) => {
23 }) 28 })
24 }; 29 };
25 30
  31 + // 标识是从普通购物车进的提交订单页面,普通购物车进入提交订单页面默认不使用优惠券
  32 + res.cookie('ensure_from', 'cart', actCkOpthn);
  33 +
26 // 唤起 APP 的路径 34 // 唤起 APP 的路径
27 res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shopcart","params":{}}'; 35 res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shopcart","params":{}}';
28 36
@@ -40,6 +40,11 @@ let $invoice = $('.invoice'), @@ -40,6 +40,11 @@ let $invoice = $('.invoice'),
40 40
41 const orderEnsure = new OrderEnsure(order); 41 const orderEnsure = new OrderEnsure(order);
42 42
  43 +// cookie 参数
  44 +const actCkOpthn = {
  45 + path: '/cart/index'
  46 +};
  47 +
43 require('common'); 48 require('common');
44 49
45 lazyLoad(); 50 lazyLoad();
@@ -49,10 +54,11 @@ function isLimitGood() { @@ -49,10 +54,11 @@ function isLimitGood() {
49 } 54 }
50 55
51 // 来自购物车的链接默认不使用优惠券 56 // 来自购物车的链接默认不使用优惠券
52 -if (document.referrer && document.referrer.indexOf('/cart/index/index') !== -1) { 57 +if (cookie.get('ensure_from') === 'cart') {
53 orderInfo('couponCode', null); 58 orderInfo('couponCode', null);
54 orderInfo('usable_usual_code', null); 59 orderInfo('usable_usual_code', null);
55 orderInfo('usable_free_code', null); 60 orderInfo('usable_free_code', null);
  61 + cookie.removeSpecific('ensure_from', actCkOpthn);
56 } 62 }
57 63
58 isLimitGood() && (function() { 64 isLimitGood() && (function() {