dever 3 years ago
parent
commit
64ae51a5ba

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

@@ -138,7 +138,7 @@ $config = array
             'desc'      => '分类',
             'match'     => 'is_string',
             'search'    => 'linkage',
-            'update'    => 'linkage',
+            'update'    => Dever::input('where_id') ? false : 'linkage',
             'option'    => Dever::url('api.get', 'category'),
             //'list'        => 'Dever::load("category/api.string", "{category}")',
         ),
@@ -214,7 +214,7 @@ $config = array
             'default'   => '1',
             'desc'      => '价格类型',
             'match'     => 'is_numeric',
-            'update'    => 'radio',
+            'update'    => Dever::input('where_id') ? false : 'radio',
             'option'    => $price_type,
             'control'   => 'price_type',
         ),
@@ -269,7 +269,7 @@ $config = array
             'desc'      => '套餐商品配置',
             'match'     => 'is_string',
             'show'      => 'price_type=3,4',
-            'update'    => array
+            'update'    => Dever::input('where_id') ? false : array
             (
                 array
                 (

+ 18 - 1
app/goods/database/info_sku.php

@@ -1,5 +1,11 @@
 <?php
 
+$type = array
+(
+    1 => '普通属性',
+    2 => '组合属性',
+    3 => '单选属性',
+);
 $config = array
 (
     # 表名
@@ -54,6 +60,17 @@ $config = array
             'list'      => true,
         ),
 
+        'type'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '属性类型',
+            'default'   => '2',
+            'desc'      => '属性类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+        ),
+
         'price'     => array
         (
             'type'      => 'decimal-10,2',
@@ -174,7 +191,7 @@ $config = array
             ),
             'type' => 'all',
             'order' => array('id' => 'desc'),
-            'col' => 'id,info_id,`key`,price,s_price',
+            'col' => 'id,info_id,`key`,price,s_price,type',
         ),
 
         # 列表

+ 37 - 29
app/goods/lib/Info.php

@@ -257,6 +257,7 @@ class Info
                     $info['price'] = $sku['price'];
                     $info['s_price'] = $sku['s_price'];
                     //$info['num'] = $sku['num'];
+                    $info['attr_json'] = $sku['attr'];
                     $info['attr'] = Dever::json_decode($sku['attr']);
 
                     if ($info['attr']) {
@@ -584,46 +585,53 @@ class Info
         $info['price_array'] = array();
         $list = Dever::db('goods/info_sku')->getData($where);
 
-        $info['price_array']['list'] = array();
+        $info['price_array']['sku'] = $info['price_array']['option'] = $info['price_array']['main'] = array();
 
         $min = $max = array();
         if ($list) {
             foreach ($list as $k => $v) {
 
-                $v['name'] = array();
-                $temp = explode('_', $v['key']);
-                foreach ($temp as $k1 => $v1) {
-                    if (isset($info['option_sku'][$v1])) {
-                        $v['name'][] = $info['option_sku'][$v1]['name'];
-                    }
-                }
-                $v['name'] = implode(';', $v['name']);
-
-                if ($other) {
-                    foreach ($other[1] as $k1 => $v1) {
-                        $v[$v1] = isset($other[0][$v['id']][$v1]) ? $other[0][$v['id']][$v1] : 0;
-                    }
-                }
+                if ($v['key']) {
+                    if ($v['key'] == -1) {
+                        $info['price_array']['main'] = $v;
+                    } elseif ($v['type'] == 2) {
+                        $v['name'] = array();
+                        $temp = explode('_', $v['key']);
+                        foreach ($temp as $k1 => $v1) {
+                            if (isset($info['option_sku'][$v1])) {
+                                $v['name'][] = $info['option_sku'][$v1]['name'];
+                            }
+                        }
+                        $v['name'] = implode(';', $v['name']);
 
-                $info['price_array']['list'][$v['key']] = $v;
-                if (!$min) {
-                    $min = $v;
-                }
-                if (!$max) {
-                    $max = $v;
-                }
+                        if ($other) {
+                            foreach ($other[1] as $k1 => $v1) {
+                                $v[$v1] = isset($other[0][$v['id']][$v1]) ? $other[0][$v['id']][$v1] : 0;
+                            }
+                        }
+                        $info['price_array']['sku'][$v['key']] = $v;
+                        if (!$min) {
+                            $min = $v;
+                        }
+                        if (!$max) {
+                            $max = $v;
+                        }
 
-                if ($min['price'] > $v['price']) {
-                    $min = $v;
-                }
+                        if ($min['price'] > $v['price']) {
+                            $min = $v;
+                        }
 
-                if ($max['price'] < $v['price']) {
-                    $max = $v;
+                        if ($max['price'] < $v['price']) {
+                            $max = $v;
+                        }
+                    } elseif ($v['type'] == 3) {
+                        $info['price_array']['option'][$v['key']] = $v;
+                    }
                 }
             }
         }
-        $info['price_array']['min'] = $min;
-        $info['price_array']['max'] = $max;
+        $info['price_array']['sku_min'] = $min;
+        $info['price_array']['sku_max'] = $max;
 
         if ($min) {
             $info['price'] = $min['price'];

+ 10 - 0
app/goods/lib/Sku.php

@@ -127,6 +127,12 @@ class Sku
             $cur_sku = false;
             $sku_id = false;
             foreach ($config['key'] as $k => $v) {
+                $type = 1;
+                if (strstr($v, '||')) {
+                    $temp = explode('||', $v);
+                    $v = $temp[0];
+                    $type = $temp[1];
+                }
                 if (isset($config['attr'][$k])) {
                     
                     $data = $where;
@@ -143,6 +149,8 @@ class Sku
                         $data['attr'] = $config['attr'][$k];
                         $data[$key] = $v;
                     }
+
+                    $data['type'] = $type;
                     
                     foreach ($config['set']['col'] as $k1 => $v1) {
                         $value = Dever::input($k1);
@@ -387,6 +395,7 @@ class Sku
                 }
 
                 if ($update) {
+                    $key .= '||2';
                     $body .= '<input type="hidden" name="key['.$k.']" value="'.$key.'"/><textarea style="display:none;" name="attr['.$k.']">'.json_encode($id).'</textarea>';
                 }
                 
@@ -451,6 +460,7 @@ class Sku
                 }
 
                 if ($update) {
+                    $key .= '||3';
                     $option_body .= '<input type="hidden" name="key['.$k.']" value="'.$key.'"/><textarea style="display:none;" name="attr['.$k.']">'.json_encode($id).'</textarea>';
                 }
                 

+ 6 - 10
app/mshop/lib/Buy.php

@@ -68,7 +68,7 @@ class Buy
             array('value' => 4, 'name' => '待收货确认'),
             array('value' => 5, 'name' => '已完成'),
             array('value' => 6, 'name' => '已完成(有退款)'),
-            array('value' => 7, 'name' => '已取消'),
+            array('value' => '7,8,9', 'name' => '已取消'),
         );
 
         return $result;
@@ -150,7 +150,6 @@ class Buy
         }
         
         $order_data['shop_id'] = $shop['id'];
-        $order_data['uid'] = -1;
         $order_data['mobile'] = $shop['mobile'];
         $order_data['name'] = $name;
         $order_data['num'] = $num;
@@ -200,7 +199,7 @@ class Buy
 
         $param = array
         (
-            'project_id' => 1,
+            'project_id' => 2,
             'channel_id' => 1,
             'system_source' => 5,
             'uid' => -1,
@@ -237,7 +236,7 @@ class Buy
 
         $param = array
         (
-            'project_id' => 1,
+            'project_id' => 2,
             'channel_id' => 1,
             'system_source' => 5,
             'uid' => -1,
@@ -288,7 +287,7 @@ class Buy
         $msg = $send['pay_msg'];
 
         $order = Dever::db('shop/buy_order')->one(array('id' => $product_id, 'time' => time()));
-        if ($order && $order['pay_status'] == 1) {
+        if ($order && $order['status'] == 1) {
 
             if ($status == 2) {
                 
@@ -331,7 +330,7 @@ class Buy
     }
 
     # 全部退款
-    public function tui($id, $order_id, $status = 6, $desc = '')
+    public function tui($id, $order_id, $status = 8, $desc = '')
     {
         if ($status != 8 && $status != 9) {
             Dever::alert('当前订单状态不允许退货退款');
@@ -518,6 +517,7 @@ class Buy
         $info = Dever::db('shop/buy_order')->find($order_id);
 
         $goods = Dever::db('shop/buy_order_goods')->select(array('order_id' => $order_id));
+        print_r($goods);die;
 
         $shop = Dever::db('shop/info')->find($info['shop_id']);
 
@@ -537,7 +537,6 @@ class Buy
 
         array_multisort($distance, SORT_ASC, SORT_NUMERIC, $store);
 
-
         $shop_factory = Dever::db('shop/factory')->select(array('shop_id' => $shop['id']));
         $factory = array();
         $distance = array();
@@ -553,9 +552,6 @@ class Buy
 
         array_multisort($distance, SORT_ASC, SORT_NUMERIC, $factory);
 
-        print_r($store);
-        print_r($factory);die;
-
         if ($store) {
             $num = 0;
             foreach ($goods as $k => $v) {

+ 1 - 1
app/mshop/src/Buy.php

@@ -43,7 +43,7 @@ class Buy extends Core
     # 确认订单页面
     public function confirm()
     {
-        $this->data['user'] = $this->user;
+        //$this->data['user'] = $this->user;
         $this->goods();
 
         return $this->data;

+ 14 - 2
app/mshop/src/Data.php

@@ -57,9 +57,21 @@ class Data extends Core
     }
 
     # 核销取件码
-    public function code()
+    public function hx_code()
     {
-        
+        $code = Dever::input('code');
+
+        $info = Dever::db('shop/sell_order')->find(array('code' => $code));
+
+        if ($info && $info['shop_id'] == $this->shop_id) {
+
+            $state = Dever::db('shop/sell_order')->update(array('where_id' => $info['id'], 'status' => 4, 'operdate' => time()));
+
+            # 发消息?
+            return 'ok';
+        } else {
+            Dever::alert('您没有权限核销');
+        }
     }
 
     # 门店全部退款

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

@@ -16,6 +16,12 @@ $status = array
     11 => '已过期',
 );
 
+$source_type = array
+(
+    1 => '仓库',
+    2 => '工厂',
+);
+
 return array
 (
     # 表名
@@ -111,6 +117,24 @@ return array
             'list'        => true,
         ),
 
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '采购来源',
+            'default'   => '',
+            'desc'      => '采购来源',
+            'match'     => 'is_numeric',
+        ),
+
+        'type_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '来源id',
+            'default'   => '',
+            'desc'      => '来源id',
+            'match'     => 'is_numeric',
+        ),
+
         'tk_cash'      => array
         (
             'type'      => 'varchar-300',

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

@@ -10,12 +10,6 @@ $status = array
     6 => '上游退款',
 );
 
-$type = array
-(
-    1 => '仓库',
-    2 => '工厂',
-);
-
 return array
 (
     # 表名
@@ -79,35 +73,6 @@ return array
             'match'     => 'is_numeric',
         ),
 
-        'type'      => array
-        (
-            'type'      => 'int-11',
-            'name'      => '采购来源',
-            'default'   => '',
-            'desc'      => '采购来源',
-            'match'     => 'is_numeric',
-        ),
-
-        'type_id'      => array
-        (
-            'type'      => 'varchar-200',
-            'name'      => '来源id',
-            'default'   => '',
-            'desc'      => '来源id',
-            'match'     => 'is_string',
-        ),
-
-        'attr'      => array
-        (
-            'type'      => 'text-255',
-            'name'      => '属性组合规则',
-            'default'   => '',
-            'desc'      => '属性组合规则',
-            'match'     => 'is_string',
-            'update'    => 'textarea',
-            //'list'      => true,
-        ),
-
         'price'      => array
         (
             'type'      => 'varchar-50',

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

@@ -4,7 +4,7 @@ $status = array
 (
     1 => '合作中',
     2 => '已终止合作',
-    3 => '申请合作中',
+    //3 => '申请合作中',
 );
 
 $type = array

+ 3 - 4
app/shop/database/member.php

@@ -3,10 +3,9 @@
 $role = array
 (
     1 => '管理员',
-    2 => '销售收款',
-    3 => '库存盘点',
-    4 => '商品采购',
-    5 => '财务对账',
+    2 => '门店经理',
+    3 => '店员',
+    4 => '配送员',
 );
 
 return array

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

@@ -89,17 +89,6 @@ 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',