rabin %!s(int64=3) %!d(string=hai) anos
pai
achega
110fe79035
Modificáronse 2 ficheiros con 63 adicións e 5 borrados
  1. 32 4
      app/mshop/lib/Buy.php
  2. 31 1
      app/shop/lib/Sell.php

+ 32 - 4
app/mshop/lib/Buy.php

@@ -310,6 +310,30 @@ class Buy
             }
         }
 
+        $info = $this->refund_button($info);
+
+        return $info;
+    }
+
+    # 是否可以退款
+    public function refund_button($info)
+    {
+        $info['refund_button'] = -1;
+        # 是否显示退款按钮
+        $manage_config = Dever::db('main/manage_config')->find();
+
+        $refund_time = $manage_config['buy_refund_day']*86400;
+
+        if ($refund_time > 0 && ($info['status'] == 8 || $info['status'] == 6)) {
+            $cur = time();
+            if ($cur - $info['fdate'] < $refund_time) {
+                # 可以退款
+                $info['refund_button'] = 1;
+            } else {
+                # 不可以退款
+                $info['refund_button'] = 2;
+            }
+        }
         return $info;
     }
 
@@ -1291,10 +1315,14 @@ class Buy
                     }
                     
                 }
-                if ($info['status'] == 3) {
-                    $status = '<a href="javascript:;" onclick="fastEdit($(this), \''.$tui.'\', \'缺货退款\', \'\', 1)" class="layui-btn">缺货退款</a>';
-                } elseif ($info['status'] == 4) {
-                    $status = '<a href="javascript:;" onclick="fastEdit($(this), \''.$tui.'\', \'报损退款\', \'\', 1)" class="layui-btn">报损退款</a>';
+
+                $info = $this->refund_button($info);
+                if ($info['refund_button'] == 1) {
+                    if ($info['status'] == 3) {
+                        $status = '<a href="javascript:;" onclick="fastEdit($(this), \''.$tui.'\', \'缺货退款\', \'\', 1)" class="layui-btn">缺货退款</a>';
+                    } elseif ($info['status'] == 4) {
+                        $status = '<a href="javascript:;" onclick="fastEdit($(this), \''.$tui.'\', \'报损退款\', \'\', 1)" class="layui-btn">报损退款</a>';
+                    }
                 }
             }
 

+ 31 - 1
app/shop/lib/Sell.php

@@ -369,10 +369,37 @@ class Sell
             }
         }
 
+        $info = $this->refund_button($info);
+
+        return $info;
+    }
+
+    # 是否可以退款
+    public function refund_button($info)
+    {
+        $info['refund_button'] = -1;
+        # 是否显示退款按钮
+        $manage_config = Dever::db('main/manage_config')->find();
+
         if (isset($info['shop_id']) && $info['shop_id'] == 3) {
+            # 平台商城
             $info['code'] = '';
+            $refund_time = $manage_config['shop_refund_day']*86400;
+        } else {
+            # 体验店
+            $refund_time = $manage_config['sell_refund_day']*86400;
         }
 
+        if ($refund_time > 0 && ($info['status'] == 8 || $info['status'] == 6)) {
+            $cur = time();
+            if ($cur - $info['fdate'] < $refund_time) {
+                # 可以退款
+                $info['refund_button'] = 1;
+            } else {
+                # 不可以退款
+                $info['refund_button'] = 2;
+            }
+        }
         return $info;
     }
 
@@ -1800,7 +1827,10 @@ class Sell
             if ($info['shop_type'] == 2 && $info['status'] > 1 && $info['status'] < 7) {
                 $tui = Dever::url('buy_order_tui?shop_id='.$v['shop_id'].'&order_goods_id=' . $v['id'] . '&order_id=' . $info['id'] . '&cash=' . $v['price'], 'shop');
 
-                $status = '<a href="javascript:;" onclick="fastEdit($(this), \''.$tui.'\', \'退款\', \'\', 1)" class="layui-btn">退款</a>';
+                $info = $this->refund_button($info);
+                if ($info['refund_button'] == 1) {
+                    $status = '<a href="javascript:;" onclick="fastEdit($(this), \''.$tui.'\', \'退款\', \'\', 1)" class="layui-btn">退款</a>';
+                }
             }
 
             $d = array