Browse Source

已支付,为发货的商城订单,也能取消订单

lizhen_gitee 9 months ago
parent
commit
0b3591e993

+ 0 - 1
addons/unishop/controller/Order.php

@@ -370,7 +370,6 @@ class Order extends Base
 //        if ($order['status'] == \addons\unishop\model\Order::STATUS_NORMAL && $order['have_paid'] == \addons\unishop\model\Order::PAID_NO) {
         if ($order['status'] == \addons\unishop\model\Order::STATUS_NORMAL && $order['have_delivered'] == \addons\unishop\model\Order::DELIVERED_NO) {
             $order->status = \addons\unishop\model\Order::STATUS_CANCEL;
-            $order->refund_status = \addons\unishop\model\Order::REFUND_STATUS_DELIVERY;
             $order->save();
             $this->success('取消成功', true);
         }

+ 1 - 2
application/admin/lang/zh-cn/unishop/order.php

@@ -48,8 +48,7 @@ return [
     'Refund status'           => '售后状态',
     'Apply'           => '申请中',
     'Pass'           => '同意',
-//    'Pass and left User delivery'           => '通过(让用户发货)',
-    'Pass and left User delivery'           => '通过(让用户发货)或无需退货',
+    'Pass and left User delivery'           => '通过(让用户发货)',
 //    'Waiting for shipment'           => '等待发货',
     'Waiting for shipment'           => '等待买家发货',
     'Refuse'           => '拒绝',

+ 79 - 0
application/admin/view/unishop/order/cancelrefund.html

@@ -0,0 +1,79 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <input type="hidden" name="updatetime" value="{$row.updatetime}" />
+
+    <ul class="list-group">
+        <li class="list-group-item">
+            订单金额:¥{$row.order_price}
+        </li>
+        <li class="list-group-item">
+            实付金额:¥{$row.total_price}元 (包含:<!--优惠¥{$row.discount_price},-->物流费用¥{$row.delivery_price})
+        </li>
+        {if $row.had_refund}
+        <li class="list-group-item">
+            退款时间:{:date('Y-m-d H:i:s', $row.had_refund)}
+        </li>
+        <li class="list-group-item">
+            已退款:{:__('Yes')}
+        </li>
+        {else/}
+        <li class="list-group-item">
+            已退款:{:__('No')}
+        </li>
+        {/if}
+
+    </ul>
+
+    <style>
+        .media {
+            border-bottom: 1px solid #f1f1f1;
+        }
+
+        .media-left img {
+            width: 100px;
+            height: 100px;
+        }
+
+        .total-price {
+            color: #ff5f17;
+        }
+    </style>
+
+
+
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">退款金额:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="refund_amount" type="text" value="{$row.total_price}">
+            <font color="red">选择【同意】后:如果是余额支付,将退款到余额;如果是在线支付的,将原路退回。选择【同意】或【拒绝】之后即退款结束,无法再次退款</font>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">退款状态:</label>
+        <div class="col-xs-12 col-sm-8">
+
+            <div class="radio">
+                {foreach name="refundStatusList" item="vo"}
+                {if $key > 2}
+                <label for="row[refund_status]-{$key}"><input id="row[refund_status]-{$key}" name="refund_status" type="radio" value="{$key}" {in name="key" value="$row.refund_status"}checked{/in} /> {$vo}</label>
+                {/if}
+                {/foreach}
+            </div>
+
+        </div>
+    </div>
+
+    <?php if($row['refund_status'] != 3 && $row['refund_status'] != 4){ ?>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+    <?php } ?>
+
+
+</form>
+

+ 16 - 0
public/assets/js/backend/unishop/order.js

@@ -31,6 +31,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     delivere_url: 'unishop/order/delivery',
                     product_url: 'unishop/order/product',
                     refund_url: 'unishop/order/refund',
+                    cancelrefund_url: 'unishop/order/cancelrefund',
                     table: 'unishop_order',
                 }
             });
@@ -72,6 +73,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         var url = options.extend.refund_url;
                         Fast.api.open(Table.api.replaceurl(url, row, table), __('Refund'), $(this).data() || {});
                     }
+                },
+                {
+                    'click .btn-cancelrefund': function (e, value, row, index) {
+                        e.stopPropagation();
+                        e.preventDefault();
+                        var table = $(this).closest('table');
+                        var options = table.bootstrapTable('getOptions');
+                        var ids = row[options.pk];
+                        row = $.extend({}, row ? row : {}, {ids: ids});
+                        var url = options.extend.cancelrefund_url;
+                        Fast.api.open(Table.api.replaceurl(url, row, table), __('Refund'), $(this).data() || {});
+                    }
                 }
             );
 
@@ -279,6 +292,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         product: function(){
             Controller.api.bindevent();
         },
+        cancelrefund: function(){
+            Controller.api.bindevent();
+        },
         refund: function(){
             Controller.api.bindevent();
         },