Authored by 梁志锋

4.7.3

@@ -118,6 +118,9 @@ @@ -118,6 +118,9 @@
118 {{#if cancelOrder}} 118 {{#if cancelOrder}}
119 <span class="op-item cancel-order">取消订单</span> 119 <span class="op-item cancel-order">取消订单</span>
120 {{^}} 120 {{^}}
  121 + {{#if reBuy}}
  122 + <span class="rebuy">再次购买</span>
  123 + {{^}}
121 {{#if confirmReceived}} 124 {{#if confirmReceived}}
122 <span class="op-item confirm-received">确认收货</span> 125 <span class="op-item confirm-received">确认收货</span>
123 {{^}} 126 {{^}}
@@ -131,6 +134,7 @@ @@ -131,6 +134,7 @@
131 {{/if}} 134 {{/if}}
132 {{/if}} 135 {{/if}}
133 {{/if}} 136 {{/if}}
  137 + {{/if}}
134 {{#if hasDelete}} 138 {{#if hasDelete}}
135 <span class="op-item restore-order">还原订单</span> 139 <span class="op-item restore-order">还原订单</span>
136 {{/if}} 140 {{/if}}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.

48.3 KB | W: | H:

48.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

8.64 KB | W: | H:

8.64 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -130,7 +130,17 @@ $cartnewSum.one('click', 'input[type="checkbox"]', function() { @@ -130,7 +130,17 @@ $cartnewSum.one('click', 'input[type="checkbox"]', function() {
130 }; 130 };
131 choiceOut(dataJSON); 131 choiceOut(dataJSON);
132 }); 132 });
133 - 133 +// 滚动到第一个选中的商品
  134 +function scrollToFirst(){
  135 + var $selected = $('.pay-wapper tbody tr').find('.cart-item-check:checked');
  136 + var top = 0;
  137 + if($selected.length > 0){
  138 + $selected = $selected.eq(0);
  139 + }
  140 + top = $selected.offset().top - 36;
  141 + $('html,body').scrollTop(top);
  142 + return false;
  143 +}
134 function isCheck(obj, className) { 144 function isCheck(obj, className) {
135 selectArray = []; 145 selectArray = [];
136 dataJSON = {}; 146 dataJSON = {};
@@ -881,3 +891,4 @@ $payWapper.on('selectstart', function() { @@ -881,3 +891,4 @@ $payWapper.on('selectstart', function() {
881 $goodsDetail.on('selectstart', function() { 891 $goodsDetail.on('selectstart', function() {
882 return false; 892 return false;
883 }); 893 });
  894 +scrollToFirst();
@@ -181,7 +181,24 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function (e) { @@ -181,7 +181,24 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function (e) {
181 active = editOrder($(this).closest('.order, .order-detail').data('id')) 181 active = editOrder($(this).closest('.order, .order-detail').data('id'))
182 active.show(); 182 active.show();
183 newAddress(0); 183 newAddress(0);
  184 +}).on('click', '.rebuy', function() {
  185 + var id = $(this).closest('.order, .order-detail').data('id');
  186 + buyAgain(id);
184 }); 187 });
  188 +//再次购买
  189 +function buyAgain(id){
  190 + $.ajax({
  191 + type: 'post',
  192 + url: '/home/orders/reAdd',
  193 + data: {orderCode: id}
  194 + }).then(function(d) {
  195 + if (d.code === 200) {
  196 + location.href = '/shopping/cart';
  197 + } else {
  198 + new dialog.Alert(d.message).show();
  199 + }
  200 + })
  201 +}
185 function deleteOrder(id, obj) { 202 function deleteOrder(id, obj) {
186 // 是否为彻底删除 203 // 是否为彻底删除
187 var isFullyDelete = true; 204 var isFullyDelete = true;
@@ -275,6 +275,16 @@ @@ -275,6 +275,16 @@
275 border-radius: 4px; 275 border-radius: 4px;
276 width: 68px; 276 width: 68px;
277 } 277 }
  278 + .operation .rebuy{
  279 + display: inline-block;
  280 + box-sizing: border-box;
  281 + width: 68px;
  282 + height: 18px;
  283 + line-height: 18px;
  284 + border-radius: 5px;
  285 + text-align: center;
  286 + border: 1px solid #000;
  287 + }
278 } 288 }
279 } 289 }
280 290
1 -<?php  
2 -  
3 -use Action\AbstractAction;  
4 -use LibModels\Wap\Category\FocusData;  
5 -  
6 -/**  
7 - * 品牌  
8 - */  
9 -class FocusController extends AbstractAction  
10 -{  
11 -  
12 - public function indexAction()  
13 - {  
14 - // 获取关注数据  
15 - $gender = $this->get('gender', '1,3');  
16 - $focusData = FocusData::getFocusData(0, $gender);  
17 -  
18 - $focus = array();  
19 - if ($focusData['code'] == 200) {  
20 - $focus = $focusData['data'];  
21 - }  
22 -  
23 - echo '<pre>';  
24 - var_dump($focus);  
25 - exit;  
26 -  
27 - $this->_view->assign('title', 'YOHO!BUY 有货');  
28 - $this->_view->display('class', compact('focus'));  
29 - }  
30 -  
31 -}  
@@ -579,6 +579,10 @@ class OrderModel @@ -579,6 +579,10 @@ class OrderModel
579 $exchangeUrl = Helpers::url('/home/returns/exchangeRequest', array('orderCode' => $orderCode)); 579 $exchangeUrl = Helpers::url('/home/returns/exchangeRequest', array('orderCode' => $orderCode));
580 //申请退货 580 //申请退货
581 $refundUrl = Helpers::url('/home/returns/refundrequest', array('orderCode' => $orderCode)); 581 $refundUrl = Helpers::url('/home/returns/refundrequest', array('orderCode' => $orderCode));
  582 + //再次购买
  583 + if ( $isCancel == 'Y') {
  584 + $operation[] = array( 'name' => '再次购买', 'reBuy' => true);
  585 + }
582 //立即付款 586 //立即付款
583 if ($payStatus == 'N' && $paymentType != 2 && $isCancel == 'N') { 587 if ($payStatus == 'N' && $paymentType != 2 && $isCancel == 'N') {
584 $operation[] = array('payNow' => true, 'href' => $payUrl); 588 $operation[] = array('payNow' => true, 'href' => $payUrl);
@@ -611,6 +615,8 @@ class OrderModel @@ -611,6 +615,8 @@ class OrderModel
611 if ($status >= 6 && $time < 86400 * $orderRefundLimitTime && $attribute != 3 && $isCancel == 'N') { 615 if ($status >= 6 && $time < 86400 * $orderRefundLimitTime && $attribute != 3 && $isCancel == 'N') {
612 $operation[] = array('href' => $refundUrl, 'name' => '申请退货', 'optDis' => $opRefundStatus); 616 $operation[] = array('href' => $refundUrl, 'name' => '申请退货', 'optDis' => $opRefundStatus);
613 } 617 }
  618 +
  619 +
614 return $operation; 620 return $operation;
615 } 621 }
616 622
@@ -269,6 +269,40 @@ class OrdersController extends WebAction @@ -269,6 +269,40 @@ class OrdersController extends WebAction
269 } 269 }
270 270
271 /** 271 /**
  272 + * 我的订单——再次购买
  273 + */
  274 + public function reAddAction()
  275 + {
  276 + $result = array('code' => 401, 'message' => '商品加入购物车失败', 'data' => '');
  277 +
  278 + do {
  279 + /* 判断是不是AJAX请求 */
  280 + if (!$this->isAjax()) {
  281 + break;
  282 + }
  283 + //获取相关参数
  284 + $uid = $this->getUid(true);
  285 + $orderCode = $this->post('orderCode', '');
  286 + if (!$uid || !$orderCode) {
  287 + $result = array('code' => 400, 'message' => '缺失参数', 'data' => '');
  288 + break;
  289 + }
  290 + $reAddData = OrderData::reAddData($uid, $orderCode);
  291 + if(!isset($reAddData['code']) || $reAddData['code'] != 200){
  292 + break;
  293 + }
  294 + $result = array('code' => 200, 'message' => '商品已重新加入购物车', 'data' => $reAddData['data']);
  295 +
  296 + if (!isset($result['code'])) {
  297 + break;
  298 + }
  299 + }
  300 + while (false);
  301 +
  302 + $this->echoJson($result);
  303 + }
  304 +
  305 + /**
272 * 还原订单 306 * 还原订单
273 */ 307 */
274 public function restoreOrderAction() 308 public function restoreOrderAction()