dever 3 年之前
父节点
当前提交
c2b658d8fe

+ 81 - 0
app/factory/database/goods.php

@@ -0,0 +1,81 @@
+<?php
+return array
+(
+    # 表名
+    'name' => 'goods',
+    # 显示给用户看的名称
+    'lang' => '商品列表',
+    'order' => 10,
+    'menu'  => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'factory_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属工厂',
+            'default'   => '',
+            'desc'      => '所属工厂',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_factory_id'),
+            'list'      => 'Dever::load("factory/info-find#name", {factory_id})',
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'update_search' => 'goods/lib/manage.search',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 8 - 2
app/factory/database/info.php

@@ -15,6 +15,11 @@ return array
     'lang' => '工厂列表',
     # 后台菜单排序
     'order' => 99,
+    'end' => array
+    (
+        'insert' => 'factory/lib/manage.infoUpdate',
+        'update' => 'factory/lib/manage.infoUpdate',
+    ),
     # 数据结构
     'struct' => array
     (
@@ -296,8 +301,9 @@ return array
     (
         'list_button' => array
         (
-            'list1' => array('账号管理', '"member&search_option_shop_id={id}&oper_table=info"'),
-            'list4' => array('订货单', '"order&search_option_shop_id={id}&oper_table=info"'),
+            'list1' => array('账号管理', '"member&search_option_factory_id={id}&oper_table=info"'),
+            'list3' => array('生产能力', '"goods&search_option_factory_id={id}&oper_table=info"'),
+            'list2' => array('订货单', '"order&search_option_factory_id={id}&oper_table=info"'),
         ),
     ),
 

+ 40 - 2
app/factory/database/member.php

@@ -38,7 +38,7 @@ return array
             'default'   => '0',
             'desc'      => '请选择用户',
             'match'     => 'is_numeric',
-            'update'    => 'text',
+            //'update'    => 'text',
             //'search'  => 'select',
             'search'    => array
             (
@@ -56,7 +56,9 @@ return array
             'default'   => '',
             'desc'      => '所属工厂',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("factory/info-find#name", {factory_id})';
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_factory_id'),
+            'list'      => 'Dever::load("factory/info-find#name", {factory_id})',
         ),
 
         'role_id'      => array
@@ -71,6 +73,42 @@ return array
             'list'      => true,
         ),
 
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '员工姓名',
+            'default'   => '',
+            'desc'      => '请输入仓库名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '员工手机号',
+            'default'   => '',
+            'desc'      => '请输入员工手机号',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'avatar'        => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '头像',
+            'default'   => '',
+            'desc'      => '请选择头像',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',

+ 126 - 230
app/factory/database/order.php

@@ -1,13 +1,16 @@
 <?php
-# 系统
-$system_source = Dever::config('base')->system_source;
 
-$status = Dever::config('base', 'pay')->pay['status'];
+$pay_status = Dever::config('base', 'pay')->pay['status'];
 
-$source = array
+$status = array
 (
-    1 => '仓库',
-    2 => '门店',
+    1 => '待支付',
+    2 => '待审核',
+    3 => '待发货',
+    4 => '待收货确认',
+    5 => '已完成',
+    6 => '已完成(有退款)',
+    7 => '已取消',
 );
 
 return array
@@ -16,7 +19,7 @@ return array
     'name' => 'order',
     # 显示给用户看的名称
     'lang' => '订货单',
-    'order' => 1,
+    'order' => 99,
     'menu' => false,
     # 数据结构
     'struct' => array
@@ -31,18 +34,6 @@ return array
             'match'     => 'is_numeric',
             'search'    => 'order',
             //'list'      => true,
-        ),
-
-        'order_id'      => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => '支付订单ID',
-            'default'   => '',
-            'desc'      => '付款订单id',
-            'match'     => 'is_string',
-            //'update'    => 'text',
-            //'search'    => 'fulltext',
-            //'list'        => true,
         ), 
 
         'factory_id'      => array
@@ -52,20 +43,47 @@ return array
             'default'   => '',
             'desc'      => '所属工厂',
             'match'     => 'is_numeric',
-            'update'    => 'select',
-            'option'    => $factory,
-            'list'      => 'Dever::load("factory/info-find#name", {factory_id})';
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_factory_id'),
+            'list'      => 'Dever::load("factory/info-find#name", {factory_id})',
         ),
 
-        'buy_num'        => array
+        'store_id'      => array
         (
             'type'      => 'int-11',
-            'name'      => '购买数量',
+            'name'      => '所属仓库',
+            'default'   => '-1',
+            'desc'      => '所属仓库',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("store/info-find#name", {store_id})',
+        ),
+
+        'store_order_id' => array
+        (
+            'type'      => 'int-11',
+            'name'      => '仓库订单id',
             'default'   => '',
-            'desc'      => '购买数量',
+            'desc'      => '仓库订单id',
+            'match'     => 'is_numeric',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
+        ),
+
+        'shop_order_id' => array
+        (
+            'type'      => 'int-11',
+            'name'      => '门店订单id',
+            'default'   => '',
+            'desc'      => '门店订单id',
             'match'     => 'is_numeric',
-            //'search'    => 'select',
-            //'list'        => true,
         ),
 
         'name'      => array
@@ -76,35 +94,100 @@ return array
             'desc'      => '订单名称',
             'match'     => 'is_string',
             'update'    => 'text',
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单编号',
+            'default'   => '',
+            'desc'      => '订单编号',
+            'match'     => 'is_string',
+            'update'    => 'text',
             'search'    => 'fulltext',
-            'list_name' => '订单信息',
-            'list'      => 'Dever::load("user/lib/manage.showOrderUser", "{id}")',
+            'list'      => true,
         ),
 
-        'cash'      => array
+        'price'      => array
         (
             'type'      => 'varchar-50',
-            'name'      => '支付金额',
+            'name'      => '购买价格',
             'default'   => '',
-            'desc'      => '支付金额',
+            'desc'      => '购买价格',
             'match'     => 'option',
             'update'    => 'text',
             'list'        => true,
         ),
 
-        'status'        => array
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'pay_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '支付订单ID',
+            'default'   => '',
+            'desc'      => '付款订单id',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'        => true,
+        ),
+
+        'pay_status'        => array
         (
             'type'      => 'tinyint-1',
-            'name'      => '订单状态',
+            'name'      => '支付状态',
             'default'   => '1',
-            'desc'      => '请选择订单状态',
+            'desc'      => '请选择支付状态',
+            'match'     => 'is_numeric',
+            'option'    => $pay_status,
+        ),
+
+        'pay_price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '付款金额',
+            'default'   => '',
+            'desc'      => '付款金额',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'notice'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '模板消息提醒次数',
+            'default'   => '0',
+            'desc'      => '模板消息提醒次数',
             'match'     => 'is_numeric',
-            'option'    => $status,
-            'search'    => 'select',
-            'update'    => 'radio',
-            'list'      => true,
-            'list'      => 'Dever::load("user/lib/manage.showOrderStatus", "{id}", "ticket")',
-            'control'   => 'status',
         ),
 
         'tk_pic'     => array
@@ -153,54 +236,6 @@ return array
             //'show'        => 'status=5',
         ),
 
-        'info'      => array
-        (
-            'type'      => 'varchar-300',
-            'name'      => '订单备注',
-            'default'   => '',
-            'desc'      => '订单备注',
-            'match'     => 'option',
-            'update'    => 'textarea',
-            //'show'        => 'status=5'
-            //'list'      => '"{info}" ? "{info}" : "双击添加备注"',
-            //'edit'      => true,
-        ),
-
-        'mobile'        => array
-        (
-            'type'      => 'varchar-300',
-            'name'      => '下单手机号',
-            'default'   => '',
-            'desc'      => '手机号',
-            'match'     => 'option',
-            //'show'        => 'status=5'
-            'search'    => array
-            (
-                'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
-                'col' => 'mobile',//要查询的字段
-                'result' => 'id',//返回的字段
-                'search' => 'uid',//本表的字段,默认为当前的字段
-            ),
-        ),
-
-        'note'     => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '是否发送状态提醒-1未发送,2已发送',
-            'default'   => '1',
-            'desc'      => '请选择状态',
-            'match'     => 'is_numeric',
-        ),
-
-        'notice'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => '模板消息提醒次数',
-            'default'   => '0',
-            'desc'      => '模板消息提醒次数',
-            'match'     => 'is_numeric',
-        ),
-
         'state'     => array
         (
             'type'      => 'tinyint-1',
@@ -224,15 +259,6 @@ return array
         ),
     ),
 
-    'top' => Dever::config('base')->top,
-
-    # 增加这个,为了给当前的list增加一个option
-    'top_option' => array
-    (
-        'value' => $auth,
-        'col' => 'cate_id',
-    ),
-
     'manage' => array
     (
         'delete' => false,
@@ -245,143 +271,13 @@ return array
         ),
 
         'list_button' => array(
-            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
+            //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
             //'delete' => array('删除', '', '{status} == 1'),
         ),
     ),
 
     'request' => array
     (
-        'getList' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'info_id' => 'yes',
-                'uid' => 'yes',
-                'status' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'page' => array(5, 'list'),
-            'col' => '*',
-        ),
-
-        'getAll' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'uid' => 'yes',
-                'status' => array('1', '!='),
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'page' => array(10, 'list'),
-            'col' => '*',
-        ),
-
-        'getYes' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'info_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'col' => '*',
-        ),
-
-        # 获取提交订单超过12个小时
-        'getDataByTime' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'cdate' => array('yes', '>='),
-                'notice' => 'yes',
-                'note' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'col' => '*',
-        ),
-
-        # 获取1,2
-        'getBuy' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'status' => 'yes',
-                'info_id' => 'yes',
-                'order_id' => 'yes',
-                'uid' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('id' => 'desc'),
-            'col' => '*',
-        ),
-
-        'getMyAll' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'uid' => 'yes',
-                'status' => 'yes',
-                'cate_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('id' => 'desc'),
-            'page' => array(10, 'list'),
-            'col' => 'id,order_id,name,buy_num,cdate,cash,info_id,buy_id',
-        ),
-
-        # 删除未支付订单
-        'drop' => array
-        (
-            # 匹配的正则或函数 选填项
-            'where' => array
-            (
-                'time' => array('yes-cdate', '<='),
-                'status' => 1,
-                'state' => 1,
-            ),
-            'type' => 'delete',
-            'col' => 'id,order_id',
-        ),
-
-        # 获取数据
-        'getAllByDate' => array
-        (
-            # 匹配的正则或函数 选填项
-            'where' => array
-            (
-                'time' => array('yes-cdate', '<='),
-            ),
-            'type' => 'all',
-            'col' => 'id,order_id',
-        ),
-
-        'getNum' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'object_id' => 'yes',
-                'info_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'one',
-            'col' => 'sum(buy_num) as buy_num',
-        ),
+        
     ),
 );

+ 138 - 0
app/factory/database/order_goods.php

@@ -0,0 +1,138 @@
+<?php
+
+$status = array
+(
+    1 => '正常',
+    2 => '缺货',
+    3 => '退款',
+);
+
+return array
+(
+    # 表名
+    'name' => 'order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'factory_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属工厂',
+            'default'   => '',
+            'desc'      => '所属工厂',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("factory/info-find#name", {factory_id})',
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '价格',
+            'default'   => '',
+            'desc'      => '价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '状态',
+            'match'     => 'is_numeric',
+            //'update'  => 'select',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 36 - 0
app/factory/lib/Manage.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace factory\Lib;
+
+use Dever;
+
+class Manage
+{
+    /**
+     * 更新信息
+     *
+     * @return mixed
+     */
+    public function infoUpdate($id, $name, $data)
+    {
+        $update = array();
+        $area = Dever::param('area', $data);
+        if ($area) {
+            $temp = is_string($area) ? explode(',', $area) : $area;
+            $update['province'] = $temp[0];
+            $update['city'] = $temp[1];
+        }
+
+        $map = Dever::param('map', $data);
+        if ($map) {
+            $temp = is_string($map) ? explode(',', $map) : $map;
+            $update['lng'] = $temp[1];
+            $update['lat'] = $temp[2];
+        }
+
+        if (isset($update) && $update) {
+            $update['where_id'] = $id;
+            Dever::db('factory/info')->update($update);
+        }
+    }
+}

+ 4 - 148
app/shop/database/buy_order.php

@@ -43,25 +43,11 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
             'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
-        'mobile'        => array
-        (
-            'type'      => 'varchar-300',
-            'name'      => '下单手机号',
-            'default'   => '',
-            'desc'      => '手机号',
-            'match'     => 'option',
-            'search'    => array
-            (
-                'api' => 'passport/user-select',//接口地址,最好是获取多条数据的地址
-                'col' => 'mobile',//要查询的字段
-                'result' => 'id',//返回的字段
-                'search' => 'uid',//本表的字段,默认为当前的字段
-            ),
-        ),
-
         'name'      => array
         (
             'type'      => 'varchar-80',
@@ -247,143 +233,13 @@ return array
         ),
 
         'list_button' => array(
-            'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
+            //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
             //'delete' => array('删除', '', '{status} == 1'),
         ),
     ),
 
     'request' => array
     (
-        'getList' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'info_id' => 'yes',
-                'uid' => 'yes',
-                'status' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'page' => array(5, 'list'),
-            'col' => '*',
-        ),
-
-        'getAll' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'uid' => 'yes',
-                'status' => array('1', '!='),
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'page' => array(10, 'list'),
-            'col' => '*',
-        ),
-
-        'getYes' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'info_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'col' => '*',
-        ),
-
-        # 获取提交订单超过12个小时
-        'getDataByTime' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'cdate' => array('yes', '>='),
-                'notice' => 'yes',
-                'note' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('cdate' => 'desc'),
-            'col' => '*',
-        ),
-
-        # 获取1,2
-        'getBuy' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'status' => 'yes',
-                'info_id' => 'yes',
-                'order_id' => 'yes',
-                'uid' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('id' => 'desc'),
-            'col' => '*',
-        ),
-
-        'getMyAll' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'uid' => 'yes',
-                'status' => 'yes',
-                'cate_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'all',
-            'order' => array('id' => 'desc'),
-            'page' => array(10, 'list'),
-            'col' => 'id,order_id,name,buy_num,cdate,cash,info_id,buy_id',
-        ),
-
-        # 删除未支付订单
-        'drop' => array
-        (
-            # 匹配的正则或函数 选填项
-            'where' => array
-            (
-                'time' => array('yes-cdate', '<='),
-                'status' => 1,
-                'state' => 1,
-            ),
-            'type' => 'delete',
-            'col' => 'id,order_id',
-        ),
-
-        # 获取数据
-        'getAllByDate' => array
-        (
-            # 匹配的正则或函数 选填项
-            'where' => array
-            (
-                'time' => array('yes-cdate', '<='),
-            ),
-            'type' => 'all',
-            'col' => 'id,order_id',
-        ),
-
-        'getNum' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'object_id' => 'yes',
-                'info_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'one',
-            'col' => 'sum(buy_num) as buy_num',
-        ),
+        
     ),
 );

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

@@ -77,6 +77,15 @@ return array
             'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
         'price'      => array
         (
             'type'      => 'varchar-50',

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

@@ -96,7 +96,7 @@ return array
             'default'   => '0',
             'desc'      => '已用数量',
             'match'     => 'is_string',
-            'update'    => 'text',
+            //'update'    => 'text',
         ),
 
         'state'     => array

+ 6 - 1
app/shop/database/goods.php

@@ -8,6 +8,11 @@ return array
     'lang' => '商品列表',
     'order' => 10,
     'menu'  => false,
+    'end' => array
+    (
+        'insert' => 'shop/lib/manage.goodsUpdate',
+        'update' => 'shop/lib/manage.goodsUpdate',
+    ),
     # 数据结构
     'struct' => array
     (
@@ -108,7 +113,7 @@ return array
         # 列表里的按钮
         'list_button' => array
         (
-            'list' => array('多价库存设置', '"goods_sku&project=shop&search_option_shop_goods_id={id}&oper_parent=goods&oper_project=shop&oper_save_jump=goods&page_type=1"', '{price_type} == 2'),
+            'list' => array('多价库存设置', '"goods_sku&project=shop&search_option_shop_goods_id={id}&oper_parent=goods&oper_project=shop&top_table=info&oper_save_jump=goods&page_type=1"', '{price_type} == 2'),
         ),
     ),
 

+ 8 - 30
app/shop/database/goods_sku.php

@@ -29,7 +29,7 @@ $config = array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
+            //'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'goods_id'      => array
@@ -39,7 +39,7 @@ $config = array
             'default'   => '',
             'desc'      => '商品名称',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
+            //'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
         'shop_goods_id'      => array
@@ -142,12 +142,15 @@ $config = array
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'info_id' => 'yes',
+                'shop_id' => 'yes',
+                'sku_id' => 'yes',
+                'goods_id' => 'yes',
+                'shop_goods_id' => 'yes',
                 'state' => 1,
             ),
             'type' => 'all',
             'order' => array('id' => 'desc'),
-            'col' => '*,num-sell_num as num',
+            'col' => '*,num-sell_num as num|sku_id',
         ),
 
         # 获取单条数据
@@ -159,38 +162,13 @@ $config = array
                 'shop_id' => 'yes',
                 'sku_id' => 'yes',
                 'goods_id' => 'yes',
+                'shop_goods_id' => 'yes',
                 'state' => 1,
             ),
             'type' => 'one',
             'col' => '*,num-sell_num as num',
         ),
 
-        'getMinOne' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'info_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'one',
-            'order' => array('price' => 'asc', 'id' => 'desc'),
-            'col' => '*',
-        ),
-
-        'getMaxOne' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'info_id' => 'yes',
-                'state' => 1,
-            ),
-            'type' => 'one',
-            'order' => array('price' => 'desc', 'id' => 'desc'),
-            'col' => '*',
-        ),
-
         # 更新售出量
         'updateSell' => array
         (

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

@@ -414,6 +414,7 @@ return array
 
     'manage' => array
     (
+        'insert' => false,
         'list_button' => array
         (
             'list22' => array('商品管理', '"goods&search_option_shop_id={id}&oper_table=info"'),
@@ -421,7 +422,7 @@ return array
             'list1' => array('账号管理', '"member&search_option_shop_id={id}&oper_table=info"'),
             'list2' => array('打印机管理', '"print&search_option_shop_id={id}&oper_table=info"'),
             'list3' => array('销售订单', '"sell_order&search_option_shop_id={id}&oper_table=info"'),
-            //'list4' => array('采购订单', '"buy_order&search_option_shop_id={id}&oper_table=info"'),
+            'list4' => array('采购订单', '"buy_order&search_option_shop_id={id}&oper_table=info"'),
         ),
     ),
 

+ 39 - 1
app/shop/database/member.php

@@ -39,7 +39,7 @@ return array
             'default'   => '0',
             'desc'      => '请选择用户',
             'match'     => 'is_numeric',
-            'update'    => 'text',
+            //'update'    => 'text',
             //'search'  => 'select',
             'search'    => array
             (
@@ -57,6 +57,8 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
             'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
@@ -72,6 +74,42 @@ return array
             'list'      => true,
         ),
 
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '员工姓名',
+            'default'   => '',
+            'desc'      => '请输入仓库名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '员工手机号',
+            'default'   => '',
+            'desc'      => '请输入员工手机号',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'avatar'        => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '头像',
+            'default'   => '',
+            'desc'      => '请选择头像',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',

+ 2 - 0
app/shop/database/print.php

@@ -38,6 +38,8 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
             'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
         

+ 9 - 7
app/shop/database/sell_order.php

@@ -75,6 +75,8 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
             'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
@@ -429,7 +431,7 @@ return array
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'info_id' => 'yes',
+                'shop_id' => 'yes',
                 'uid' => 'yes',
                 'status' => 'yes',
                 'state' => 1,
@@ -460,7 +462,7 @@ return array
             # 匹配的正则或函数 选填项
             'option' => array
             (
-                'info_id' => 'yes',
+                'shop_id' => 'yes',
                 'state' => 1,
             ),
             'type' => 'all',
@@ -491,8 +493,8 @@ return array
             'option' => array
             (
                 'status' => 'yes',
-                'info_id' => 'yes',
-                'order_id' => 'yes',
+                'shop_id' => 'yes',
+                'order_num' => 'yes',
                 'uid' => 'yes',
                 'state' => 1,
             ),
@@ -514,7 +516,7 @@ return array
             'type' => 'all',
             'order' => array('id' => 'desc'),
             'page' => array(10, 'list'),
-            'col' => 'id,order_id,name,buy_num,cdate,cash,info_id,buy_id',
+            'col' => 'id,order_num,name,buy_num,cdate,cash,shop_id,buy_id',
         ),
 
         # 删除未支付订单
@@ -528,7 +530,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'delete',
-            'col' => 'id,order_id',
+            'col' => 'id,order_num',
         ),
 
         # 获取数据
@@ -541,7 +543,7 @@ return array
                 'end' => array('yes-cdate', '<='),
             ),
             'type' => 'all',
-            'col' => 'id,order_id',
+            'col' => 'id,order_num',
         ),
 
         # 获取订单数量

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

@@ -55,6 +55,8 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
             'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 

+ 25 - 3
app/shop/lib/Manage.php

@@ -34,6 +34,26 @@ class Manage
         }
     }
 
+    /**
+     * 更新商品信息
+     *
+     * @return mixed
+     */
+    public function goodsUpdate($id, $name, $data)
+    {
+        $update = array();
+        $goods_id = Dever::param('goods_id', $data);
+        if ($goods_id) {
+            $info = Dever::db('goods/info')->find($goods_id);
+            $update['price_type'] = $info['price_type'];
+        }
+
+        if (isset($update) && $update) {
+            $update['where_id'] = $id;
+            Dever::db('shop/goods')->update($update);
+        }
+    }
+
     public function skuConfig()
     {
         $data['action'] = Dever::url('shop/lib/manage.skuUp');
@@ -81,9 +101,11 @@ class Manage
 
         $sku = Dever::db('goods/info_sku')->getData(array('info_id' => $shop_goods['goods_id']));
 
+        $sku_num = Dever::db('shop/goods_sku')->getData(array('shop_goods_id' => $id));
+
         $info = Dever::db('goods/info')->one($shop_goods['goods_id']);
 
-        $info = Info::init(-1)->info($info, 'list_reorder');
+        $info = \Goods\Lib\Info::init(-1)->info($info, 'list_reorder');
 
         $html = '请先选择属性';
         if ($info['sell_attr']) {
@@ -118,8 +140,8 @@ class Manage
                     }
                     $key = implode('_', $key);
                     $f_price = $s_price = $price = $num = '';
-                    if (isset($sku[$key])) {
-                        $num = $sku[$key]['num'];
+                    if (isset($sku[$key]) && isset($sku_num[$sku[$key]['id']])) {
+                        $num = $sku_num[$sku[$key]['id']]['num'];
                     }
                     $body .= '<td width="30"><input type="text" class="layui-input" name="num['.$k.']"  value="'.$num.'"/></td>';
 

+ 44 - 0
app/store/assets/manage/html/sku.html

@@ -0,0 +1,44 @@
+</form>
+<form class="layui-form form10" action="" target="f10" method="post">
+<input type="hidden" name="info_id" id="info_id" value="">
+<input type="hidden" name="function" id="function" value="skuMsg">
+<iframe id="f10" name="f10" style="display:none;"></iframe>
+    <div class="layui-form-item">
+        <table class="layui-table" id="sku">
+          <thead>
+            <tr>
+              <th>昵称</th>
+              <th>加入时间</th>
+              <th>签名</th>
+            </tr> 
+          </thead>
+          <tbody>
+            <tr>
+              <td>贤心</td>
+              <td>2016-11-29</td>
+              <td>人生就像是一场修行</td>
+            </tr>
+            <tr>
+              <td>许闲心</td>
+              <td>2016-11-28</td>
+              <td>于千万人之中遇见你所遇见的人,于千万年之中,时间的无涯的荒野里…</td>
+            </tr>
+          </tbody>
+        </table>
+    </div>
+
+    <div class="layui-form-item">
+        <div class="">
+          <button type="button" class="layui-btn" onclick="saveSku()">保存</button>
+        </div>
+    </div>
+<script>
+function saveSku()
+{
+    $('.form10').submit();
+}
+function skuMsg()
+{
+    showAlert('保存成功');
+}
+</script>

+ 99 - 35
app/store/database/goods.php

@@ -1,35 +1,17 @@
 <?php
-
-$store = function()
-{
-    $array = array();
-    $info = Dever::db('store/info')->select();
-    
-    if($info)
-    {
-        $array += $info;
-    }
-    return $array;
-};
-
-$goods = function()
-{
-    $array = array();
-    $info = Dever::db('goods/info')->select();
-    
-    if($info)
-    {
-        $array += $info;
-    }
-    return $array;
-};
-
 return array
 (
     # 表名
     'name' => 'goods',
     # 显示给用户看的名称
     'lang' => '商品列表',
+    'order' => 10,
+    'menu'  => false,
+    'end' => array
+    (
+        'insert' => 'store/lib/manage.goodsUpdate',
+        'update' => 'store/lib/manage.goodsUpdate',
+    ),
     # 数据结构
     'struct' => array
     (
@@ -53,9 +35,9 @@ return array
             'default'   => '',
             'desc'      => '所属仓库',
             'match'     => 'is_numeric',
-            'update'    => 'select',
-            'option'    => $store,
-            'list'      => 'Dever::load("store/info-find#name", {store_id})';
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_store_id'),
+            'list'      => 'Dever::load("store/info-find#name", {store_id})',
         ),
 
         'goods_id'      => array
@@ -66,16 +48,38 @@ return array
             'desc'      => '商品名称',
             'match'     => 'is_numeric',
             'update'    => 'select',
-            'option'    => $goods,
-            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+            'update_search' => 'goods/lib/manage.search',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
-        'num'      => array
+        'price_type'        => array
         (
             'type'      => 'int-11',
-            'name'      => '库存数量',
+            'name'      => '价格类型',
+            'default'   => '1',
+            'desc'      => '价格类型',
+            'match'     => 'is_numeric',
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '库存',
             'default'   => '0',
-            'desc'      => '请填写库存数量',
+            'desc'      => '库存',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'select',
+            'list_name' => '当前库存',
+            'list'        => '{num}-{sell_num}',
+        ),
+
+        'sell_num'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '销量',
+            'default'   => '0',
+            'desc'      => '请填写销量',
             'match'     => 'option',
             'search'    => 'order',
             'list'      => true,
@@ -105,11 +109,71 @@ return array
 
     'manage' => array
     (
-        
+        # 列表里的按钮
+        'list_button' => array
+        (
+            'list' => array('多价库存设置', '"goods_sku&project=store&search_option_store_goods_id={id}&oper_parent=goods&oper_project=store&top_table=info&oper_save_jump=goods&page_type=1"', '{price_type} == 2'),
+        ),
     ),
 
     'request' => array
     (
-        
+        # 更新售出量
+        'updateSell' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'sell_num' => array('yes', '+='),
+            ),
+        ),
+
+        # 获取单条数据
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'shop_id' => 'yes',
+                'goods_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => '*,num-sell_num as num',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'top' => array('yes-t_2.top'),
+                'youhui' => array('yes-t_2.youhui'),
+                'category' => array('yes-t_2.category', 'like'),
+                'top_category_id' => array('yes-t_2.top_category_id'),
+                'second_category_id' => array('yes-t_2.second_category_id'),
+                'category_id' => array('yes-t_2.category_id'),
+                'status' => array('yes-t_2.status', 1),
+                'state' => array('yes-t_2.state', 1),
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'goods/info',
+                    'type' => 'left join',
+                    'on' => array('goods_id','id'),
+                    'col' => 'goods_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*,t_2.*,t_1.num-t_1.sell_num as num,t_1.sell_num',
+        ),
     ),
 );

+ 210 - 0
app/store/database/goods_sku.php

@@ -0,0 +1,210 @@
+<?php
+
+$config = array
+(
+    # 表名
+    'name' => 'goods_sku',
+    # 显示给用户看的名称
+    'lang' => '商品价格设置',
+    'order' => 200,
+    'menu' => false,
+
+    # 数据结构 不同的字段放这里
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'list'        => true,
+        ),
+
+        'store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属仓库',
+            'default'   => '',
+            'desc'      => '所属仓库',
+            'value'     => Dever::input('search_option_store_id'),
+            'list'      => 'Dever::load("store/info-find#name", {store_id})',
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
+        ),
+
+        'store_goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品sku',
+            'default'   => '',
+            'desc'      => '商品sku',
+            'match'     => 'is_numeric',
+        ),
+
+        'num'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '库存',
+            'default'   => '',
+            'desc'      => '库存',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'sell_num'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '销量',
+            'default'   => '0',
+            'desc'      => '请填写销量',
+            'match'     => 'option',
+            'search'    => 'order',
+            'list'      => true,
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-数值越大越靠前,相当于置顶',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '数据状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '发布时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            //'search'  => 'date',
+            //'list'        => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        'insert' => false,
+        'edit' => false,
+        'delete' => false,
+        'num' => false,
+        'page_list_table' => 'sku',
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            //'自定义属性' => array('fast', 1, 'config&where_id=1'),
+        ),
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+        # 列表
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('id' => 'desc'),
+            'col' => '*,num-sell_num as num',
+        ),
+
+        # 获取单条数据
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'shop_id' => 'yes',
+                'sku_id' => 'yes',
+                'goods_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => '*,num-sell_num as num',
+        ),
+
+        'getMinOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'order' => array('price' => 'asc', 'id' => 'desc'),
+            'col' => '*',
+        ),
+
+        'getMaxOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'order' => array('price' => 'desc', 'id' => 'desc'),
+            'col' => '*',
+        ),
+
+        # 更新售出量
+        'updateSell' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'sell_num' => array('yes', '+='),
+            ),
+        ),
+    ),
+);
+
+return $config;

+ 217 - 15
app/store/database/info.php

@@ -2,8 +2,9 @@
 # 获取分类权限
 $status = array
 (
-    1 => '合作中',
-    2 => '已终止合作',
+    1 => '已认证',
+    2 => '认证中',
+    3 => '认证失败',
 );
 
 return array
@@ -14,6 +15,11 @@ return array
     'lang' => '仓库列表',
     # 后台菜单排序
     'order' => 99,
+    'end' => array
+    (
+        'insert' => 'store/lib/manage.infoUpdate',
+        'update' => 'store/lib/manage.infoUpdate',
+    ),
     # 数据结构
     'struct' => array
     (
@@ -28,6 +34,31 @@ return array
             'list'      => true,
             'order'     => 'desc',
         ),
+
+        'hr1'       => array
+        (
+            'name'      => '仓库基本信息',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'uid'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '用户名',
+            'default'   => '0',
+            'desc'      => '请选择用户',
+            'match'     => 'is_numeric',
+            //'update'    => 'text',
+            //'search'  => 'select',
+            'searchs'    => array
+            (
+                'api' => 'passport/user-select',
+                'col' => 'username',
+                'result' => 'id',
+            ),
+            //'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
+        ),
         
         'name'      => array
         (
@@ -41,14 +72,190 @@ return array
             'list'      => true,
         ),
 
+        'truename'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '联系人姓名',
+            'default'   => '',
+            'desc'      => '请输入联系人姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '联系人电话',
+            'default'   => '',
+            'desc'      => '请输入联系人电话',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '所在城市',
+            'default'   => '',
+            'desc'      => '所在城市',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=2', 'area'),
+            'list'      => 'Dever::load("area/api.string", "{area}")',
+        ),
+
+        'province'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '省份',
+            'default'   => '',
+            'desc'      => '省份',
+            'match'     => 'option',
+            //'update'  => 'text',
+        ),
+
+        'city'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '城市',
+            'default'   => '',
+            'desc'      => '城市',
+            'match'     => 'option',
+            //'update'  => 'text',
+        ),
+
+        'map'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '地理位置',
+            'default'   => '',
+            'desc'      => '地理位置',
+            'match'     => 'is_string',
+            # 如果是map,必须在config的base.php中设置map信息
+            'update'  => 'map',
+        ),
+
+        'lng'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '经度',
+            'default'   => '',
+            'desc'      => '经度',
+            'match'     => 'option',
+            //'update'    => 'text',
+            //'list'        => true,
+        ),
+
+        'lat'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '纬度',
+            'default'   => '',
+            'desc'      => '纬度',
+            'match'     => 'option',
+            //'update'    => 'text',
+            //'list'        => true,
+        ),
+
+        'address'       => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '仓库地址',
+            'default'   => '',
+            'desc'      => '仓库地址',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+        ),
+
+        'hr2'       => array
+        (
+            'name'      => '仓库认证信息',
+            'class'     => '',//本项必须填写
+            'attr'      => '',
+        ),
+
+        'license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '营业执照',
+            'default'   => '',
+            'desc'      => '营业执照',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
+        'license_number'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '营业执照号码',
+            'default'   => '',
+            'desc'      => '营业执照号码',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'company_name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '公司名称',
+            'default'   => '',
+            'desc'      => '公司名称',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'idcard_front'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证正面',
+            'default'   => '',
+            'desc'      => '身份证正面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
+        'idcard_back'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证背面',
+            'default'   => '',
+            'desc'      => '身份证背面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
+        'kh_license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '开户许可证',
+            'default'   => '',
+            'desc'      => '开户许可证',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '660*660',
+        ),
+
         'status'        => array
         (
             'type'      => 'int-11',
-            'name'      => '合作状态',
+            'name'      => '认证状态',
             'default'   => '1',
-            'desc'      => '上线状态',
+            'desc'      => '认证状态',
             'match'     => 'is_numeric',
-            //'update'  => 'select',
+            'update'  => 'select',
             'option'    => $status,
             'search'    => 'select',
             'list'      => true,
@@ -90,21 +297,16 @@ return array
         ),
     ),
 
-    # 默认值
-    'default' => array
+    'manage' => array
     (
-        'col' => 'name,reorder,state,cdate',
-        'value' => array
+        'list_button' => array
         (
-            '"默认工厂",1,1,' . time(),
+            'list1' => array('账号管理', '"member&search_option_store_id={id}&oper_table=info"'),
+            'list3' => array('库存清单', '"goods&search_option_store_id={id}&oper_table=info"'),
+            'list2' => array('订货单', '"order&search_option_store_id={id}&oper_table=info"'),
         ),
     ),
 
-    'manage' => array
-    (
-        
-    ),
-
     'request' => array
     (
         

+ 40 - 2
app/store/database/member.php

@@ -38,7 +38,7 @@ return array
             'default'   => '0',
             'desc'      => '请选择用户',
             'match'     => 'is_numeric',
-            'update'    => 'text',
+            //'update'    => 'text',
             //'search'  => 'select',
             'search'    => array
             (
@@ -56,7 +56,9 @@ return array
             'default'   => '',
             'desc'      => '所属仓库',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("store/info-find#name", {store_id})';
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_store_id'),
+            'list'      => 'Dever::load("store/info-find#name", {store_id})',
         ),
 
         'role_id'      => array
@@ -71,6 +73,42 @@ return array
             'list'      => true,
         ),
 
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '员工姓名',
+            'default'   => '',
+            'desc'      => '请输入仓库名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '员工手机号',
+            'default'   => '',
+            'desc'      => '请输入员工手机号',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'avatar'        => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '头像',
+            'default'   => '',
+            'desc'      => '请选择头像',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',

+ 264 - 0
app/store/database/order.php

@@ -0,0 +1,264 @@
+<?php
+
+$pay_status = Dever::config('base', 'pay')->pay['status'];
+
+$status = array
+(
+    1 => '待支付',
+    2 => '待审核',
+    3 => '待发货',
+    4 => '待收货确认',
+    5 => '已完成',
+    6 => '已完成(有退款)',
+    7 => '已取消',
+);
+
+return array
+(
+    # 表名
+    'name' => 'order',
+    # 显示给用户看的名称
+    'lang' => '订货单',
+    'order' => 99,
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ), 
+
+        'store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属仓库',
+            'default'   => '',
+            'desc'      => '所属仓库',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_store_id'),
+            'list'      => 'Dever::load("store/info-find#name", {store_id})',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
+        ),
+
+        'shop_order_id' => array
+        (
+            'type'      => 'int-11',
+            'name'      => '门店订单id',
+            'default'   => '',
+            'desc'      => '门店订单id',
+            'match'     => 'is_numeric',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '订单名称',
+            'default'   => '',
+            'desc'      => '订单名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单编号',
+            'default'   => '',
+            'desc'      => '订单编号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '购买价格',
+            'default'   => '',
+            'desc'      => '购买价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'pay_id'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '支付订单ID',
+            'default'   => '',
+            'desc'      => '付款订单id',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'        => true,
+        ),
+
+        'pay_status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '支付状态',
+            'default'   => '1',
+            'desc'      => '请选择支付状态',
+            'match'     => 'is_numeric',
+            'option'    => $pay_status,
+        ),
+
+        'pay_price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '付款金额',
+            'default'   => '',
+            'desc'      => '付款金额',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'note'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '是否发送状态提醒-1未发送,2已发送',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
+        'notice'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '模板消息提醒次数',
+            'default'   => '0',
+            'desc'      => '模板消息提醒次数',
+            'match'     => 'is_numeric',
+        ),
+
+        'tk_pic'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '退款截图',
+            'default'   => '',
+            'desc'      => '退款截图',
+            'match'     => 'is_string',
+            'update'    => 'image',
+            'key'       => 1
+        ),
+
+        'tk_time'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款时间',
+            'default'   => '',
+            'desc'      => '退款时间',
+            'match'     => 'option',
+            //'list'        => true,
+            //'update'    => 'date',
+            'callback'  => 'maketime',
+            'show'      => 'status=5',
+        ),
+
+        'tk_admin'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '退款审核人',
+            'default'   => '1',
+            'desc'      => '退款审核人',
+            'match'     => 'option',
+            //'list'        => true,
+            'show'      => 'status=5',
+        ),
+
+        'tk_desc'       => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款备注',
+            'default'   => '',
+            'desc'      => '退款备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+            //'show'        => 'status=5',
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '下单时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'search'    => 'date',
+            'list'        => 'date("Y-m-d H:i:s", {cdate})',
+            //'list'      => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
+        ),
+    ),
+
+    'manage' => array
+    (
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+
+        'button' => array
+        (
+            //'导出订单' => array('location', 'user/lib/manage.out'),
+        ),
+
+        'list_button' => array(
+            //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
+            //'delete' => array('删除', '', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 138 - 0
app/store/database/order_goods.php

@@ -0,0 +1,138 @@
+<?php
+
+$status = array
+(
+    1 => '正常',
+    2 => '缺货',
+    3 => '退款',
+);
+
+return array
+(
+    # 表名
+    'name' => 'order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属仓库',
+            'default'   => '',
+            'desc'      => '所属仓库',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("store/info-find#name", {store_id})',
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '价格',
+            'default'   => '',
+            'desc'      => '价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'        => true,
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买数量',
+            'default'   => '',
+            'desc'      => '购买数量',
+            'match'     => 'is_numeric',
+            'search'    => 'select',
+            'list'        => true,
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '状态',
+            'match'     => 'is_numeric',
+            //'update'  => 'select',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 160 - 0
app/store/lib/Manage.php

@@ -0,0 +1,160 @@
+<?php
+
+namespace Store\Lib;
+
+use Dever;
+
+class Manage
+{
+    /**
+     * 更新信息
+     *
+     * @return mixed
+     */
+    public function infoUpdate($id, $name, $data)
+    {
+        $update = array();
+        $area = Dever::param('area', $data);
+        if ($area) {
+            $temp = is_string($area) ? explode(',', $area) : $area;
+            $update['province'] = $temp[0];
+            $update['city'] = $temp[1];
+        }
+
+        $map = Dever::param('map', $data);
+        if ($map) {
+            $temp = is_string($map) ? explode(',', $map) : $map;
+            $update['lng'] = $temp[1];
+            $update['lat'] = $temp[2];
+        }
+
+        if (isset($update) && $update) {
+            $update['where_id'] = $id;
+            Dever::db('store/info')->update($update);
+        }
+    }
+
+    /**
+     * 更新商品信息
+     *
+     * @return mixed
+     */
+    public function goodsUpdate($id, $name, $data)
+    {
+        $update = array();
+        $goods_id = Dever::param('goods_id', $data);
+        if ($goods_id) {
+            $info = Dever::db('goods/info')->find($goods_id);
+            $update['price_type'] = $info['price_type'];
+        }
+
+        if (isset($update) && $update) {
+            $update['where_id'] = $id;
+            Dever::db('store/goods')->update($update);
+        }
+    }
+
+    public function skuConfig()
+    {
+        $data['action'] = Dever::url('store/lib/manage.skuUp');
+        $data['info_id'] = Dever::input('search_option_store_goods_id');
+        return $data;
+    }
+
+    public function skuUp_api()
+    {
+        $store_goods_id = Dever::input('info_id');
+        $key = Dever::input('key');
+        $num = Dever::input('num');
+
+        $store_goods = Dever::db('store/goods')->one($store_goods_id);
+        if ($key) {
+            foreach ($key as $k => $v) {
+                if (isset($num[$k]) && $num[$k]) {
+                    $info = Dever::db('goods/info_sku')->one(array('key' => $v));
+                    $data = array();
+                    $data['store_id'] = $store_goods['store_id'];
+                    $data['goods_id'] = $store_goods['goods_id'];
+                    $data['store_goods_id'] = $store_goods_id;
+                    $data['sku_id'] = $info['id'];
+                    $store_info = Dever::db('store/goods_sku')->one($data);
+
+                    $data['num'] = $num[$k];
+                    if (!$store_info) {
+                        Dever::db('store/goods_sku')->insert($data);
+                    } else {
+                        $data['where_id'] = $info['id'];
+                        Dever::db('store/goods_sku')->update($data);
+                    }
+                }
+            }
+        }
+
+        Dever::out('yes');
+    }
+
+    public function skuInput()
+    {
+        $id = Dever::input('search_option_store_goods_id');
+
+        $store_goods = Dever::db('store/goods')->one($id);
+
+        $sku = Dever::db('goods/info_sku')->getData(array('info_id' => $store_goods['goods_id']));
+
+        $sku_num = Dever::db('store/goods_sku')->getData(array('store_goods_id' => $id));
+
+        $info = Dever::db('goods/info')->one($store_goods['goods_id']);
+
+        $info = \Goods\Lib\Info::init(-1)->info($info, 'list_reorder');
+
+        $html = '请先选择属性';
+        if ($info['sell_attr']) {
+            $head = '<thead><tr>';
+            $body = '<tbody>';
+            $option = array();
+            foreach ($info['sell_attr'] as $k => $v) {
+                $head .= '<th>'.$v['name'].'</th>';
+                if (isset($v['option_sku'])) {
+                    $option[$k] = $v['option_sku'];
+                }
+            }
+            $head .= '<th>库存</th>';
+            $head .= '</tr></thead>';
+
+            if ($option) {
+                $option = Dever::cartesian($option);
+
+                foreach ($option as $k => $v) {
+                    $body .= '<tr data-row="' .($k+1). '">';
+
+                    $key = $id = array();
+                    foreach ($v['name'] as $k1 => $v1) {
+                        $rows = 1;
+                        $body .= '<td width="50" rowspan="'.$rows.'">'.$v1.'</td>';
+                        $id[] = array
+                        (
+                            'id' => $v['id'][$k1],
+                            'attr_id' => $v['info_id'][$k1],
+                        );
+                        $key[] = $v['info_id'][$k1] . '-' . $v['id'][$k1];
+                    }
+                    $key = implode('_', $key);
+                    $f_price = $s_price = $price = $num = '';
+                    if (isset($sku[$key]) && isset($sku_num[$sku[$key]['id']])) {
+                        $num = $sku_num[$sku[$key]['id']]['num'];
+                    }
+                    $body .= '<td width="30"><input type="text" class="layui-input" name="num['.$k.']"  value="'.$num.'"/></td>';
+
+                    $body .= '<input type="hidden" name="key['.$k.']" value="'.$key.'"/>';
+                    $body .= '</tr>';
+                }
+            }
+
+            $body .= '</tbody>';
+            
+            $html = $head . $body;
+        }
+
+        return $html;
+    }
+}

+ 7 - 0
app/store/template/manage/sku.php

@@ -0,0 +1,7 @@
+<?php
+
+$view
+->fetch('.form10@action', 'store/lib/manage.skuConfig#action')
+->fetch('#info_id@value', 'store/lib/manage.skuConfig#info_id')
+->fetch('#sku', 'store/lib/manage.skuInput')
+->display();