From 33135acbcab2a4b6e334ae24657e6cd76733f21c Mon Sep 17 00:00:00 2001
From: Rock Zhang <iamgtskk@gmail.com>
Date: Wed, 16 Dec 2015 12:07:34 +0800
Subject: [PATCH] 添加当购物车商品为空时不能进入购物车结算页的逻辑

---
 template/m.yohobuy.com/actions/cart/index/gift-advance.phtml           |  20 ++++++++++++++++++++
 template/m.yohobuy.com/actions/cart/index/index.phtml                  |  72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 template/m.yohobuy.com/actions/cart/index/order-ensure.phtml           | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 template/m.yohobuy.com/actions/cart/index/select-address.phtml         |  37 +++++++++++++++++++++++++++++++++++++
 template/m.yohobuy.com/actions/cart/index/select-coupon.phtml          |  39 +++++++++++++++++++++++++++++++++++++++
 template/m.yohobuy.com/actions/index/shoppingcart/gift-advance.phtml   |  20 --------------------
 template/m.yohobuy.com/actions/index/shoppingcart/index.phtml          |  72 ------------------------------------------------------------------------
 template/m.yohobuy.com/actions/index/shoppingcart/order-ensure.phtml   | 177 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 template/m.yohobuy.com/actions/index/shoppingcart/select-address.phtml |  37 -------------------------------------
 template/m.yohobuy.com/actions/index/shoppingcart/select-coupon.phtml  |  39 ---------------------------------------
 yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php         |  37 ++++++++++++++++++++++++++++++++++---
 11 files changed, 379 insertions(+), 348 deletions(-)
 create mode 100644 template/m.yohobuy.com/actions/cart/index/gift-advance.phtml
 create mode 100644 template/m.yohobuy.com/actions/cart/index/index.phtml
 create mode 100644 template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
 create mode 100644 template/m.yohobuy.com/actions/cart/index/select-address.phtml
 create mode 100644 template/m.yohobuy.com/actions/cart/index/select-coupon.phtml
 delete mode 100644 template/m.yohobuy.com/actions/index/shoppingcart/gift-advance.phtml
 delete mode 100644 template/m.yohobuy.com/actions/index/shoppingcart/index.phtml
 delete mode 100644 template/m.yohobuy.com/actions/index/shoppingcart/order-ensure.phtml
 delete mode 100644 template/m.yohobuy.com/actions/index/shoppingcart/select-address.phtml
 delete mode 100644 template/m.yohobuy.com/actions/index/shoppingcart/select-coupon.phtml

diff --git a/template/m.yohobuy.com/actions/cart/index/gift-advance.phtml b/template/m.yohobuy.com/actions/cart/index/gift-advance.phtml
new file mode 100644
index 0000000..91077dd
--- /dev/null
+++ b/template/m.yohobuy.com/actions/cart/index/gift-advance.phtml
@@ -0,0 +1,20 @@
+{{> layout/header}}
+<div class="gift-advance-page yoho-page">
+    {{# shoppingCart}}
+        {{#if gift}}
+            {{# gift}}
+                {{> shopping-cart/gift-advance-good}}
+            {{/ gift}}
+        {{^}}
+            {{# advance}}
+                <div class="advance-block">
+                    <p class="title">{{title}}</p>
+                    {{# goods}}
+                        {{> shopping-cart/gift-advance-good}}
+                    {{/ goods}}
+                </div>
+            {{/ advance}}
+        {{/if}}
+    {{/ shoppingCart}}
+</div>
+{{> layout/footer}}
\ No newline at end of file
diff --git a/template/m.yohobuy.com/actions/cart/index/index.phtml b/template/m.yohobuy.com/actions/cart/index/index.phtml
new file mode 100644
index 0000000..6898091
--- /dev/null
+++ b/template/m.yohobuy.com/actions/cart/index/index.phtml
@@ -0,0 +1,72 @@
+{{> layout/header}}
+<div id="mainCart" class="shopping-cart-page yoho-page">
+    {{# shoppingCart}}
+        {{#if cartNav}}
+            <ul class="cart-nav clearfix">
+                <li class="active">
+                    <span>
+                        普通商品({{commonGoodsCount}})
+                    </span>
+                </li>
+                <li>
+                    <span>
+                        预售商品({{presellGoodsCount}})
+                    </span>
+                </li>
+            </ul>
+        {{/if}}
+
+        {{#if showLoginInfo}}
+            <p class="login-info">
+                <span class="iconfont">&#xe628;</span>
+                请您先
+                <a class="btn btn-login">登录</a>
+                可以同步电脑和手机中的商品
+            </p>
+        {{/if}}
+
+        {{# commonCart}}
+            <div class="cart-content common">
+                {{> shopping-cart/cart-content}}
+            </div>
+        {{/ commonCart}}
+
+        {{# preSellCart}}
+            <div class="cart-content presell hide">
+                <p class="presell-info">
+                    <span class="iconfont">&#xe61a;</span>
+                    <span class="txt">预售商品全场包邮,到货后立即发货</span>
+                    <span class="txt">预售商品不参加活动,不可使用优惠券</span>
+                </p>
+                {{> shopping-cart/cart-content}}
+            </div>
+        {{/ preSellCart}}
+
+    {{/ shoppingCart}}
+</div>
+<div id="advanceBuy" class="shopping-cart-page yoho-page hide">
+{{# shoppingCart}}
+    {{# commonCart}}
+        {{# advanceBuy}}
+        <span>
+            {{promotionTitle}}
+        </span>
+        {{# goods}}
+            {{> shopping-cart/gift-advance-good}}
+        {{/ goods}}
+        {{/ advanceBuy}}
+    {{/ commonCart}}
+{{/ shoppingCart}}
+</div>
+
+<div class="shopping-cart-zero yoho-page hide">
+    <div class="cart-zero">
+        <i class="iconfont">&#xe62c</i>
+        <p>您的购物车暂无商品</p>
+        <a href="">随便逛逛</a>
+    </div>
+    {{> product/recommend-for-you}}
+</div>
+
+        {{> shopping-cart/chose-panel}}
+{{> layout/footer}}
\ No newline at end of file
diff --git a/template/m.yohobuy.com/actions/cart/index/order-ensure.phtml b/template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
new file mode 100644
index 0000000..b9ddae1
--- /dev/null
+++ b/template/m.yohobuy.com/actions/cart/index/order-ensure.phtml
@@ -0,0 +1,177 @@
+{{> layout/header}}
+<div class="order-ensure-page yoho-page">
+    {{# orderEnsure}}
+        <a class="address-wrap block" data-id="{{addressId}}" href="/shoppingCart/selectAddress">
+            <p class="infos">
+                收货地址
+                <span class="per-info">{{name}} {{phoneNum}}</span>
+                <span class="address">{{area}} {{address}}</span>
+            </p>
+            <span class="iconfont">&#xe614;</span>
+        </a>
+
+        <section class="dispatch block">
+            <div class="sub-block">
+                <h3 class="title">配送方式</h3>
+                <ul class="dispatch-mode clearfix">
+                    {{#each dispatchMode}}
+                        <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li>
+                    {{/each}}
+                </ul>
+            </div>
+
+            <div class="sub-block">
+                <h3 class="title">送货时间</h3>
+                <ul class="dispatch-time clearfix">
+                    {{#each dispatchTime}}
+                        <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li>
+                    {{/each}}
+                </ul>
+            </div>
+        </section>
+
+        <section class="block">
+            <h3 class="title">商品</h3>
+            <div class="goods">
+                {{#each goods}}
+                    {{> me/order/good}}
+                {{/each}}
+            </div>
+        </section>
+
+        <section class="block">
+            <ul class="sale-invoice">
+                {{# coupon}}
+                    <li class="coupon">
+                        <a href="/shoppingCart/selectCoupon">
+                            <span class="title">优惠券</span>
+                            {{#if count}}
+                                <span class="coupon-count">
+                                    {{count}}张可用
+                                </span>
+                            {{/if}}
+
+                            {{#if value}}
+                                <span class="used coupon-use">
+                                    -¥{{value}}
+                                    <i class="iconfont">&#xe614;</i>
+                                </span>
+                            {{^}}
+                                <span class="not-used coupon-use">
+                                    未使用
+                                    <i class="iconfont">&#xe614;</i>
+                                </span>
+                            {{/if}}
+                        </a>
+                    </li>
+                {{/coupon}}
+
+                <li class="coin" data-yoho-coin="{{yohoCoin}}">
+                    <span class="title">YOHO币</span>
+                    <span class="desc">可抵用¥{{yohoCoin}}</span>
+                    <span class="coin-check">
+                        <em>- ¥ {{yohoCoin}}</em>
+                        <i class="iconfont checkbox icon-cb-checked"></i>
+                    </span>
+                </li>
+
+                {{#if invoice}}
+                    <li class="invoice {{#if needInvoice}}focus{{/if}}">
+                        <span class="title">发票</span>
+                        <span class="iconfont checkbox {{#if needInvoice}}icon-cb-checked{{else}}icon-checkbox{{/if}}"></span>
+                        <form id="invoice">
+                            <input type="text" name="invoice-title" value="{{invoiceText}}" placeholder="发票抬头">
+                            <label>
+                                发票类型
+                                <select class="invoice-type" name="invoice-type">
+                                    {{# invoice}}
+                                    <option value="{{id}}" {{#if isSelected}}selected{{/if}}>{{name}}</option>
+                                    {{/ invoice}}
+                                </select>
+                            </label>
+                        </form>
+                    </li>
+                {{/if}}
+            </ul>
+
+            <form id="msg" action="" method="post">
+                <input type="text" name="msg" value="{{msg}}" placeholder="留言">
+            </form>
+        </section>
+
+        <section class="price-cal block">
+            <ul class="total">
+                <li>
+                    <span>总价</span>
+                    &nbsp;&nbsp;¥{{sumPrice}}
+                </li>
+                <li>
+                    <span>活动价</span>
+                    - ¥{{salePrice}}
+                </li>
+                <li>
+                    <span>运费</span>
+                    + {{freight}}
+                </li>
+	            {{#couponPrice}}
+                <li>
+                    <span>优惠券</span>
+                    - ¥{{.}}
+                </li>
+	            {{/couponPrice}}
+                <li>
+                    <span>YOHO币</span>
+                    - ¥{{yohoCoin}}
+                </li>
+                <li class="cost">
+                    应付金额: <em>¥{{price}}</em>
+                </li>
+            </ul>
+        </section>
+
+        <ul class="pay-mode">
+            {{# paymentWay}}
+            <li class="{{#if default}}default{{/if}}" data-pay-type="{{paymentType}}" data-pay-id="{{id}}">
+                <span class="iconfont">
+                    {{#if default}}
+                        &#xe62f;
+                    {{else}}
+                        &#xe62e;
+                    {{/if}}
+                </span>
+                {{name}}
+            </li>
+            {{/ paymentWay}}
+        </ul>
+    {{/ orderEnsure}}
+</div>
+<script id="tmpl-price" type="text/tmpl">
+    <ul class="total">
+        <li>
+            <span>总价</span>
+            &nbsp;&nbsp;¥\{{sumPrice}}
+        </li>
+        <li>
+            <span>活动价</span>
+            - ¥\{{salePrice}}
+        </li>
+        <li>
+            <span>运费</span>
+            + \{{freight}}
+        </li>
+        \{{#couponPrice}}
+        <li>
+            <span>优惠券</span>
+            - ¥\{{.}}
+        </li>
+        \{{/couponPrice}}
+        <li>
+            <span>YOHO币</span>
+            - ¥\{{yohoCoin}}
+        </li>
+        <li class="cost">
+            应付金额: <em>¥\{{price}}</em>
+        </li>
+    </ul>
+</script>
+{{> layout/footer}}
diff --git a/template/m.yohobuy.com/actions/cart/index/select-address.phtml b/template/m.yohobuy.com/actions/cart/index/select-address.phtml
new file mode 100644
index 0000000..fc51ca6
--- /dev/null
+++ b/template/m.yohobuy.com/actions/cart/index/select-address.phtml
@@ -0,0 +1,37 @@
+{{> layout/header}}
+<div class="my-address-page select-address-page yoho-page">
+    <div class="page-wrap">
+        {{# address}}
+        <a class="address-item" data-address-id="{{address_id}}" href="/shoppingCart/orderEnsure">
+            <span class="name">{{consignee}}</span>
+            <span class="tel">{{mobile}}</span>
+            <p class="address-info">{{area}} {{address}}</p>
+            <div class="action iconfont">
+                <span class="edit" data-href="/home/addressAct?id={{address_id}}&refer=shopping">&#xe61e;</span>
+                <span class="del" data-id="{{address_id}}">&#xe621;</span>
+            </div>
+        </a>
+        {{/ address}}
+
+        <a class="add-address" data-href="/home/addressAct?refer=shopping">
+           添加新地址
+        </a>
+
+        <div class="confim-mask hide">
+            <div class="confim-box">
+                <div class="content">
+                    您确定要删除地址?
+                </div>
+                <div class="action">
+                    <span class="cancel">
+                        取消
+                    </span>
+                    <span class="confim">
+                        确认
+                    </span>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+{{> layout/footer}}
diff --git a/template/m.yohobuy.com/actions/cart/index/select-coupon.phtml b/template/m.yohobuy.com/actions/cart/index/select-coupon.phtml
new file mode 100644
index 0000000..1a3377e
--- /dev/null
+++ b/template/m.yohobuy.com/actions/cart/index/select-coupon.phtml
@@ -0,0 +1,39 @@
+{{> layout/header}}
+<div class="yoho-page select-coupon-page my-coupon-page">
+    <form id="new-coupon" method="POST" action="">
+        <input type="text" name="couponCode" value="" placeholder="输入优惠券码">
+        <button type="submit" class="submit">确定</button>
+    </form>
+    <div id="coupon-list" class="coupon-list"></div>
+    <div class="not-avaliable-coupon-line hide">不可使用的优惠券</div>
+    <div id="coupon-list-not" class="coupon-list"></div>
+</div>
+<script id="tmpl-coupon" type="text/tmpl">
+\{{#coupons}}
+    \{{^ notAvailable}}
+    <a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-value="\{{ couponValue}}" href="/shoppingCart/orderEnsure">
+        <span>\{{ couponValue}}</span>
+        <p class="coupon-name">\{{ couponDetailInfomation}}</p>
+        <p>有效期:\{{ couponValidity}}</p>
+    </a>
+    \{{/ notAvailable}}
+\{{/coupons}}
+</script>
+<script id="tmpl-coupon-not-avaliable" type="text/tmpl">
+\{{# notAvailableCoupons}}
+    <div class="employ-main not-avaliable">
+        <span>\{{ couponValue}}</span>
+        <p class="coupon-name">\{{ couponDetailInfomation}}</p>
+        <p>有效期:\{{ couponValidity}}</p>
+    </div>
+\{{/ notAvailableCoupons}}
+</script>
+<script id="tmpl-no-coupon" type="text/tmpl">
+<div class="coupon-list">
+    <div class="null">
+        <i></i>
+        <p>您还没有优惠券!</p>
+    </div>
+</div>
+</script>
+{{> layout/footer}}
diff --git a/template/m.yohobuy.com/actions/index/shoppingcart/gift-advance.phtml b/template/m.yohobuy.com/actions/index/shoppingcart/gift-advance.phtml
deleted file mode 100644
index 91077dd..0000000
--- a/template/m.yohobuy.com/actions/index/shoppingcart/gift-advance.phtml
+++ /dev/null
@@ -1,20 +0,0 @@
-{{> layout/header}}
-<div class="gift-advance-page yoho-page">
-    {{# shoppingCart}}
-        {{#if gift}}
-            {{# gift}}
-                {{> shopping-cart/gift-advance-good}}
-            {{/ gift}}
-        {{^}}
-            {{# advance}}
-                <div class="advance-block">
-                    <p class="title">{{title}}</p>
-                    {{# goods}}
-                        {{> shopping-cart/gift-advance-good}}
-                    {{/ goods}}
-                </div>
-            {{/ advance}}
-        {{/if}}
-    {{/ shoppingCart}}
-</div>
-{{> layout/footer}}
\ No newline at end of file
diff --git a/template/m.yohobuy.com/actions/index/shoppingcart/index.phtml b/template/m.yohobuy.com/actions/index/shoppingcart/index.phtml
deleted file mode 100644
index 6898091..0000000
--- a/template/m.yohobuy.com/actions/index/shoppingcart/index.phtml
+++ /dev/null
@@ -1,72 +0,0 @@
-{{> layout/header}}
-<div id="mainCart" class="shopping-cart-page yoho-page">
-    {{# shoppingCart}}
-        {{#if cartNav}}
-            <ul class="cart-nav clearfix">
-                <li class="active">
-                    <span>
-                        普通商品({{commonGoodsCount}})
-                    </span>
-                </li>
-                <li>
-                    <span>
-                        预售商品({{presellGoodsCount}})
-                    </span>
-                </li>
-            </ul>
-        {{/if}}
-
-        {{#if showLoginInfo}}
-            <p class="login-info">
-                <span class="iconfont">&#xe628;</span>
-                请您先
-                <a class="btn btn-login">登录</a>
-                可以同步电脑和手机中的商品
-            </p>
-        {{/if}}
-
-        {{# commonCart}}
-            <div class="cart-content common">
-                {{> shopping-cart/cart-content}}
-            </div>
-        {{/ commonCart}}
-
-        {{# preSellCart}}
-            <div class="cart-content presell hide">
-                <p class="presell-info">
-                    <span class="iconfont">&#xe61a;</span>
-                    <span class="txt">预售商品全场包邮,到货后立即发货</span>
-                    <span class="txt">预售商品不参加活动,不可使用优惠券</span>
-                </p>
-                {{> shopping-cart/cart-content}}
-            </div>
-        {{/ preSellCart}}
-
-    {{/ shoppingCart}}
-</div>
-<div id="advanceBuy" class="shopping-cart-page yoho-page hide">
-{{# shoppingCart}}
-    {{# commonCart}}
-        {{# advanceBuy}}
-        <span>
-            {{promotionTitle}}
-        </span>
-        {{# goods}}
-            {{> shopping-cart/gift-advance-good}}
-        {{/ goods}}
-        {{/ advanceBuy}}
-    {{/ commonCart}}
-{{/ shoppingCart}}
-</div>
-
-<div class="shopping-cart-zero yoho-page hide">
-    <div class="cart-zero">
-        <i class="iconfont">&#xe62c</i>
-        <p>您的购物车暂无商品</p>
-        <a href="">随便逛逛</a>
-    </div>
-    {{> product/recommend-for-you}}
-</div>
-
-        {{> shopping-cart/chose-panel}}
-{{> layout/footer}}
\ No newline at end of file
diff --git a/template/m.yohobuy.com/actions/index/shoppingcart/order-ensure.phtml b/template/m.yohobuy.com/actions/index/shoppingcart/order-ensure.phtml
deleted file mode 100644
index b9ddae1..0000000
--- a/template/m.yohobuy.com/actions/index/shoppingcart/order-ensure.phtml
+++ /dev/null
@@ -1,177 +0,0 @@
-{{> layout/header}}
-<div class="order-ensure-page yoho-page">
-    {{# orderEnsure}}
-        <a class="address-wrap block" data-id="{{addressId}}" href="/shoppingCart/selectAddress">
-            <p class="infos">
-                收货地址
-                <span class="per-info">{{name}} {{phoneNum}}</span>
-                <span class="address">{{area}} {{address}}</span>
-            </p>
-            <span class="iconfont">&#xe614;</span>
-        </a>
-
-        <section class="dispatch block">
-            <div class="sub-block">
-                <h3 class="title">配送方式</h3>
-                <ul class="dispatch-mode clearfix">
-                    {{#each dispatchMode}}
-                        <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li>
-                    {{/each}}
-                </ul>
-            </div>
-
-            <div class="sub-block">
-                <h3 class="title">送货时间</h3>
-                <ul class="dispatch-time clearfix">
-                    {{#each dispatchTime}}
-                        <li {{#if isSelected}}class="chosed"{{/if}} data-id="{{id}}">{{name}}</li>
-                    {{/each}}
-                </ul>
-            </div>
-        </section>
-
-        <section class="block">
-            <h3 class="title">商品</h3>
-            <div class="goods">
-                {{#each goods}}
-                    {{> me/order/good}}
-                {{/each}}
-            </div>
-        </section>
-
-        <section class="block">
-            <ul class="sale-invoice">
-                {{# coupon}}
-                    <li class="coupon">
-                        <a href="/shoppingCart/selectCoupon">
-                            <span class="title">优惠券</span>
-                            {{#if count}}
-                                <span class="coupon-count">
-                                    {{count}}张可用
-                                </span>
-                            {{/if}}
-
-                            {{#if value}}
-                                <span class="used coupon-use">
-                                    -¥{{value}}
-                                    <i class="iconfont">&#xe614;</i>
-                                </span>
-                            {{^}}
-                                <span class="not-used coupon-use">
-                                    未使用
-                                    <i class="iconfont">&#xe614;</i>
-                                </span>
-                            {{/if}}
-                        </a>
-                    </li>
-                {{/coupon}}
-
-                <li class="coin" data-yoho-coin="{{yohoCoin}}">
-                    <span class="title">YOHO币</span>
-                    <span class="desc">可抵用¥{{yohoCoin}}</span>
-                    <span class="coin-check">
-                        <em>- ¥ {{yohoCoin}}</em>
-                        <i class="iconfont checkbox icon-cb-checked"></i>
-                    </span>
-                </li>
-
-                {{#if invoice}}
-                    <li class="invoice {{#if needInvoice}}focus{{/if}}">
-                        <span class="title">发票</span>
-                        <span class="iconfont checkbox {{#if needInvoice}}icon-cb-checked{{else}}icon-checkbox{{/if}}"></span>
-                        <form id="invoice">
-                            <input type="text" name="invoice-title" value="{{invoiceText}}" placeholder="发票抬头">
-                            <label>
-                                发票类型
-                                <select class="invoice-type" name="invoice-type">
-                                    {{# invoice}}
-                                    <option value="{{id}}" {{#if isSelected}}selected{{/if}}>{{name}}</option>
-                                    {{/ invoice}}
-                                </select>
-                            </label>
-                        </form>
-                    </li>
-                {{/if}}
-            </ul>
-
-            <form id="msg" action="" method="post">
-                <input type="text" name="msg" value="{{msg}}" placeholder="留言">
-            </form>
-        </section>
-
-        <section class="price-cal block">
-            <ul class="total">
-                <li>
-                    <span>总价</span>
-                    &nbsp;&nbsp;¥{{sumPrice}}
-                </li>
-                <li>
-                    <span>活动价</span>
-                    - ¥{{salePrice}}
-                </li>
-                <li>
-                    <span>运费</span>
-                    + {{freight}}
-                </li>
-	            {{#couponPrice}}
-                <li>
-                    <span>优惠券</span>
-                    - ¥{{.}}
-                </li>
-	            {{/couponPrice}}
-                <li>
-                    <span>YOHO币</span>
-                    - ¥{{yohoCoin}}
-                </li>
-                <li class="cost">
-                    应付金额: <em>¥{{price}}</em>
-                </li>
-            </ul>
-        </section>
-
-        <ul class="pay-mode">
-            {{# paymentWay}}
-            <li class="{{#if default}}default{{/if}}" data-pay-type="{{paymentType}}" data-pay-id="{{id}}">
-                <span class="iconfont">
-                    {{#if default}}
-                        &#xe62f;
-                    {{else}}
-                        &#xe62e;
-                    {{/if}}
-                </span>
-                {{name}}
-            </li>
-            {{/ paymentWay}}
-        </ul>
-    {{/ orderEnsure}}
-</div>
-<script id="tmpl-price" type="text/tmpl">
-    <ul class="total">
-        <li>
-            <span>总价</span>
-            &nbsp;&nbsp;¥\{{sumPrice}}
-        </li>
-        <li>
-            <span>活动价</span>
-            - ¥\{{salePrice}}
-        </li>
-        <li>
-            <span>运费</span>
-            + \{{freight}}
-        </li>
-        \{{#couponPrice}}
-        <li>
-            <span>优惠券</span>
-            - ¥\{{.}}
-        </li>
-        \{{/couponPrice}}
-        <li>
-            <span>YOHO币</span>
-            - ¥\{{yohoCoin}}
-        </li>
-        <li class="cost">
-            应付金额: <em>¥\{{price}}</em>
-        </li>
-    </ul>
-</script>
-{{> layout/footer}}
diff --git a/template/m.yohobuy.com/actions/index/shoppingcart/select-address.phtml b/template/m.yohobuy.com/actions/index/shoppingcart/select-address.phtml
deleted file mode 100644
index fc51ca6..0000000
--- a/template/m.yohobuy.com/actions/index/shoppingcart/select-address.phtml
+++ /dev/null
@@ -1,37 +0,0 @@
-{{> layout/header}}
-<div class="my-address-page select-address-page yoho-page">
-    <div class="page-wrap">
-        {{# address}}
-        <a class="address-item" data-address-id="{{address_id}}" href="/shoppingCart/orderEnsure">
-            <span class="name">{{consignee}}</span>
-            <span class="tel">{{mobile}}</span>
-            <p class="address-info">{{area}} {{address}}</p>
-            <div class="action iconfont">
-                <span class="edit" data-href="/home/addressAct?id={{address_id}}&refer=shopping">&#xe61e;</span>
-                <span class="del" data-id="{{address_id}}">&#xe621;</span>
-            </div>
-        </a>
-        {{/ address}}
-
-        <a class="add-address" data-href="/home/addressAct?refer=shopping">
-           添加新地址
-        </a>
-
-        <div class="confim-mask hide">
-            <div class="confim-box">
-                <div class="content">
-                    您确定要删除地址?
-                </div>
-                <div class="action">
-                    <span class="cancel">
-                        取消
-                    </span>
-                    <span class="confim">
-                        确认
-                    </span>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
-{{> layout/footer}}
diff --git a/template/m.yohobuy.com/actions/index/shoppingcart/select-coupon.phtml b/template/m.yohobuy.com/actions/index/shoppingcart/select-coupon.phtml
deleted file mode 100644
index 1a3377e..0000000
--- a/template/m.yohobuy.com/actions/index/shoppingcart/select-coupon.phtml
+++ /dev/null
@@ -1,39 +0,0 @@
-{{> layout/header}}
-<div class="yoho-page select-coupon-page my-coupon-page">
-    <form id="new-coupon" method="POST" action="">
-        <input type="text" name="couponCode" value="" placeholder="输入优惠券码">
-        <button type="submit" class="submit">确定</button>
-    </form>
-    <div id="coupon-list" class="coupon-list"></div>
-    <div class="not-avaliable-coupon-line hide">不可使用的优惠券</div>
-    <div id="coupon-list-not" class="coupon-list"></div>
-</div>
-<script id="tmpl-coupon" type="text/tmpl">
-\{{#coupons}}
-    \{{^ notAvailable}}
-    <a class="employ-main" data-coupon-code="\{{ couponCode}}" data-coupon-value="\{{ couponValue}}" href="/shoppingCart/orderEnsure">
-        <span>\{{ couponValue}}</span>
-        <p class="coupon-name">\{{ couponDetailInfomation}}</p>
-        <p>有效期:\{{ couponValidity}}</p>
-    </a>
-    \{{/ notAvailable}}
-\{{/coupons}}
-</script>
-<script id="tmpl-coupon-not-avaliable" type="text/tmpl">
-\{{# notAvailableCoupons}}
-    <div class="employ-main not-avaliable">
-        <span>\{{ couponValue}}</span>
-        <p class="coupon-name">\{{ couponDetailInfomation}}</p>
-        <p>有效期:\{{ couponValidity}}</p>
-    </div>
-\{{/ notAvailableCoupons}}
-</script>
-<script id="tmpl-no-coupon" type="text/tmpl">
-<div class="coupon-list">
-    <div class="null">
-        <i></i>
-        <p>您还没有优惠券!</p>
-    </div>
-</div>
-</script>
-{{> layout/footer}}
diff --git a/yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php b/yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
index 3d340bf..653de50 100644
--- a/yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
+++ b/yohobuy/m.yohobuy.com/application/controllers/ShoppingCart.php
@@ -10,6 +10,20 @@ use Plugin\Helpers;
  */
 class ShoppingcartController extends AbstractAction
 {
+    /**
+     * 通过当前用户审判是否跳到登录
+     *
+     * @param boolean $useSession (true:从服务端session中检查, false:从客户端cookie中检查)
+     * @return void
+     */
+    protected function auditJumpLogin($useSession = true)
+    {
+        $uid = $this->getUid($useSession);
+        if (!$uid) {
+            $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
+        }
+    }
+
     /*
      * 购物车首页
      */
@@ -221,17 +235,28 @@ class ShoppingcartController extends AbstractAction
 	 */
 	public function orderEnsureAction()
 	{
+        // 审判跳转登录页
+        $this->auditJumpLogin();
+
 		$this->setTitle('购物车');
 		$this->setNavHeader('购物车');
 
-		$cartType = $this->post('cartType', 'ordinary');
+        // 购物车商品为空跳转到购物车页面
+        $shoppingKey = Helpers::getShoppingKeyByCookie();
+        $uid = $this->getUid(true);
+        $cartGoods = CartModel::getCartData($uid, $shoppingKey);
+        if (empty($cartGoods) || isset($cartGoods['isEmptyCart'])) {
+            $this->go(Helpers::url('/shoppingcart'));
+        }
+
+		$cartType = $this->get('cartType', 'ordinary');
 		$cookieData = $this->getCookie('order-info', null);
 		$uid = $this->getUid(true);
 		$data = array(
 			'orderEnsurePage' => true,
 			'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
 		);
-        // var_dump($data);
+
 		$this->_view->display('order-ensure', $data);
 	}
 
@@ -288,7 +313,6 @@ class ShoppingcartController extends AbstractAction
 
 		if ($this->isAjax()) {
 			$uid = $this->getUid(true);
-			$page = $this->get('page', 1);
 			$result = CartModel::getCouponList($uid);
 		}
 
@@ -304,6 +328,9 @@ class ShoppingcartController extends AbstractAction
      */
     public function selectAddressAction()
     {
+        // 审判跳转登录页
+        $this->auditJumpLogin();
+
         // 设置网站标题
         $this->setTitle('选择地址');
         $this->setNavHeader('选择地址', Helpers::url('/shoppingCart/orderEnsure'));
@@ -323,9 +350,13 @@ class ShoppingcartController extends AbstractAction
      */
     public function selectCouponAction()
     {
+        // 审判跳转登录页
+        $this->auditJumpLogin();
+
         // 设置网站标题
         $this->setTitle('选择优惠券');
         $this->setNavHeader('选择优惠券', Helpers::url('/shoppingCart/orderEnsure'));
+
         $this->_view->display('select-coupon', array(
             'selectCouponPage' => true,
             'pageFooter' => true
--
libgit2 0.24.0