dever 4 anni fa
parent
commit
8125dbce89

+ 2 - 2
app/goods/database/info.php

@@ -12,8 +12,8 @@ $price_type = array
 $mode = array
 (
     1 => '自提',
-    2 => '外',
-    3 => '外卖+自提',
+    2 => '外',
+    3 => '以上全支持',
 );
 
 $yes = array

+ 0 - 1
app/shop/database/buy_order.php

@@ -20,7 +20,6 @@ return array
     # 显示给用户看的名称
     'lang' => '采购订单',
     'order' => 99,
-    'menu' => false,
     # 数据结构
     'struct' => array
     (

+ 11 - 0
app/shop/database/buy_order_goods.php

@@ -86,6 +86,17 @@ return array
             'match'     => 'is_numeric',
         ),
 
+        'attr'      => array
+        (
+            'type'      => 'text-255',
+            'name'      => '属性组合规则',
+            'default'   => '',
+            'desc'      => '属性组合规则',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            //'list'      => true,
+        ),
+
         'price'      => array
         (
             'type'      => 'varchar-50',

+ 2 - 2
app/shop/database/info.php

@@ -28,8 +28,8 @@ $open = array
 $method = array
 (
     1 => '自提',
-    2 => '送',
-    3 => '自提+配送',
+    2 => '送',
+    3 => '以上全支持',
 );
 
 return array

+ 4 - 2
app/shop/database/sell_order.php

@@ -37,7 +37,10 @@ $status = array
     3 => '配送中',
     4 => '已完成',
     5 => '已取消',
-    6 => '退款',
+    6 => '退货退款',
+    7 => '部分退款',
+    8 => '仅退款',
+    11 => '已过期',
 );
 
 return array
@@ -52,7 +55,6 @@ return array
     'code_status' => $code_status,
     'pay_method' => $pay_method,
     'method' => $method,
-    'menu' => false,
     # 数据结构
     'struct' => array
     (

+ 2 - 2
app/shop/lib/Sell.php

@@ -211,7 +211,7 @@ class Sell
                 }
 
                 # 如果是自提订单,生成自提码
-                if ($order['method'] == 2) {
+                if ($order['method'] == 1) {
                 	$update['code_status'] = 2;
                 	$update['code'] = $this->getCode();
                 } else {
@@ -259,7 +259,7 @@ class Sell
     # 生成自提码
     public function getCode()
     {
-        $where['code'] = Dever::rand(6);
+        $where['code'] = Dever::rand(6, 0);
         $state = Dever::db('shop/sell_order')->one($where);
         if (!$state) {
             return $where['code'];

+ 69 - 5
app/shop/src/My.php

@@ -137,19 +137,35 @@ class My extends Core
     # 获取订单详细信息
     public function order_info($info, $type = 1)
     {
+        if ($info['status'] == 1) {
+            # 15分钟内支付,900秒
+            $m = 9000;
+            # 支付倒计时
+            $info['time'] = time() - $info['cdate'];
+            if ($info['time'] >= $m) {
+                # 已过期,自动取消
+                $info['time'] = -1;
+                Dever::db('shop/sell_order')->update(array('where_id' => $info['id'], 'status' => 11));
+                $info['status'] = 11;
+            } else {
+                $info['time'] = $m - $info['time'];
+            }
+        }
+
         $info['status_name'] = $this->config['status'][$info['status']];
         $info['method_name'] = $this->config['method'][$info['method']];
 
-        if ($info['method'] == 1 && $info['status'] > 1) {
-
+        if ($info['method'] == 2 && $info['status'] > 1) {
+            # 如果是外送,需要读取外送单号
         }
+
         $info['goods'] = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
         $info['shop'] = Dever::db('shop/info')->getOne($info['shop_id']);
         $info['cdate'] = date('Y-m-d H:i', $info['cdate']);
 
         if ($type == 2) {
             foreach ($info['goods'] as $k => $v) {
-                $info['goods']['info'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
+                $info['goods'][$k]['info'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
             }
             if ($info['address_id']) {
                 $info['address'] = Dever::db('passport/address')->find($info['address_id']);
@@ -179,10 +195,58 @@ class My extends Core
         if (!$this->data) {
             Dever::alert('订单不存在');
         }
+        if ($this->data['status'] == 1) {
+            Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 5));
+
+            return 'ok';
+        } else {
+            Dever::alert('当前订单状态不允许取消');
+        }
+    }
+
+    # 退款退货
+    public function order_tui()
+    {
+        $id = Dever::input('order_id');
+
+        $this->data = Dever::db('shop/sell_order')->find(array('uid' => $this->uid, 'id' => $id));
+        if (!$this->data) {
+            Dever::alert('订单不存在');
+        }
+        if ($this->data['status'] == 2 || $this->data['status'] == 3) {
+            Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 6));
+
+            # 退款到原支付账户
+            return 'ok';
+        } else {
+            Dever::alert('当前订单状态不允许退货退款');
+        }
+    }
 
-        Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 5));
+    # 部分退款退货
+    public function order_tui_goods()
+    {
+        $id = Dever::input('order_id');
+        $user_goods_id = Dever::input('user_goods_id');
 
-        return 'ok';
+        $this->data = Dever::db('shop/sell_order')->find(array('uid' => $this->uid, 'id' => $id));
+        if (!$this->data) {
+            Dever::alert('订单不存在');
+        }
+        if ($this->data['status'] == 2 || $this->data['status'] == 3) {
+            Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 7));
+
+            $goods_id = explode(',', $user_goods_id);
+
+            foreach ($goods_id as $k => $v) {
+                Dever::db('shop/sell_order_goods')->update(array('where_id' => $v, 'status' => 3));
+            }
+
+            # 退款到原支付账户
+            return 'ok';
+        } else {
+            Dever::alert('当前订单状态不允许退货退款');
+        }
     }
 
     # 我的消息列表