rabin 2 years ago
parent
commit
c81e065666
100 changed files with 10815 additions and 0 deletions
  1. 9 0
      boot.php
  2. 5 0
      common.php
  3. 198 0
      config/base.php
  4. 175 0
      config/env/localhost/default.php
  5. 6 0
      config/route.php
  6. 321 0
      data/compile/yuandaibao/manage/layadmin/console.cmp.php
  7. 66 0
      data/compile/yuandaibao/manage/layadmin/home.cmp.php
  8. 33 0
      data/compile/yuandaibao/manage/layadmin/inc/head.cmp.php
  9. 13 0
      data/compile/yuandaibao/manage/layadmin/inc/menu.cmp.php
  10. 73 0
      data/compile/yuandaibao/manage/layadmin/inc/nav.cmp.php
  11. 44 0
      data/compile/yuandaibao/manage/layadmin/inc/script.cmp.php
  12. 79 0
      data/compile/yuandaibao/manage/layadmin/login.cmp.php
  13. 262 0
      data/compile/yuandaibao/manage/layadmin/project/database/list.cmp.php
  14. 237 0
      data/compile/yuandaibao/manage/layadmin/project/database/update.cmp.php
  15. 1 0
      data/readme
  16. 2 0
      index.php
  17. 3 0
      package.json
  18. 4 0
      package/account/index.php
  19. 7 0
      package/area/daemon/import.php
  20. 4 0
      package/area/index.php
  21. 2 0
      package/boot.php
  22. 4 0
      package/email/index.php
  23. 4 0
      package/excel/index.php
  24. 4 0
      package/invite/index.php
  25. 88 0
      package/manage/config/base.php
  26. 11 0
      package/manage/config/plugin.php
  27. 7 0
      package/manage/daemon/loop.php
  28. 7 0
      package/manage/daemon/main.php
  29. 4 0
      package/manage/index.php
  30. 88 0
      package/manage/plugin/Console.php
  31. 4 0
      package/message/index.php
  32. 4 0
      package/middleware/index.php
  33. 4 0
      package/oauth/index.php
  34. 4 0
      package/passport/index.php
  35. 4 0
      package/pay/index.php
  36. 4 0
      package/pdf/index.php
  37. 4 0
      package/pinyin/index.php
  38. 4 0
      package/poster/index.php
  39. 4 0
      package/push/index.php
  40. 4 0
      package/qrcode/index.php
  41. 4 0
      package/queue/index.php
  42. 4 0
      package/score/index.php
  43. 4 0
      package/share/index.php
  44. 4 0
      package/short/index.php
  45. 4 0
      package/sms/index.php
  46. 4 0
      package/token/index.php
  47. 4 0
      package/upload/index.php
  48. 4 0
      package/wechat_applet/index.php
  49. 4 0
      src/bao/boot.php
  50. 2 0
      src/boot.php
  51. 4 0
      src/dai/boot.php
  52. 6 0
      src/dai/seller/assets/manage/html/order_goods.html
  53. 251 0
      src/dai/seller/database/buy_order.php
  54. 159 0
      src/dai/seller/database/buy_order_goods.php
  55. 220 0
      src/dai/seller/database/goods.php
  56. 295 0
      src/dai/seller/database/in_order.php
  57. 226 0
      src/dai/seller/database/in_order_goods.php
  58. 106 0
      src/dai/seller/database/in_order_type.php
  59. 478 0
      src/dai/seller/database/info.php
  60. 130 0
      src/dai/seller/database/servicer.php
  61. 282 0
      src/dai/seller/database/shop.php
  62. 286 0
      src/dai/seller/database/shop_goods.php
  63. 245 0
      src/dai/seller/database/shop_goods_list.php
  64. 115 0
      src/dai/seller/database/shop_store.php
  65. 130 0
      src/dai/seller/database/supplier.php
  66. 105 0
      src/dai/seller/database/type.php
  67. 8 0
      src/dai/seller/index.php
  68. 108 0
      src/dai/seller/lib/Manage.php
  69. 5 0
      src/dai/seller/template/manage/order_goods.php
  70. 6 0
      src/dai/servicer/assets/manage/html/order_goods.html
  71. 341 0
      src/dai/servicer/assets/pc/html/set_servicer.html
  72. 342 0
      src/dai/servicer/assets/pc/html/set_store.html
  73. 285 0
      src/dai/servicer/database/in_order.php
  74. 226 0
      src/dai/servicer/database/in_order_goods.php
  75. 106 0
      src/dai/servicer/database/in_order_type.php
  76. 360 0
      src/dai/servicer/database/info.php
  77. 301 0
      src/dai/servicer/database/out_order.php
  78. 215 0
      src/dai/servicer/database/out_order_goods.php
  79. 106 0
      src/dai/servicer/database/out_order_type.php
  80. 201 0
      src/dai/servicer/database/store.php
  81. 286 0
      src/dai/servicer/database/store_goods.php
  82. 245 0
      src/dai/servicer/database/store_goods_list.php
  83. 115 0
      src/dai/servicer/database/supplier.php
  84. 105 0
      src/dai/servicer/database/type.php
  85. 8 0
      src/dai/servicer/index.php
  86. 93 0
      src/dai/servicer/lib/Manage.php
  87. 112 0
      src/dai/servicer/lib/Set.php
  88. 117 0
      src/dai/servicer/lib/Set_store.php
  89. 5 0
      src/dai/servicer/template/manage/order_goods.php
  90. 354 0
      src/dai/supplier/assets/pc/html/set_supplier.html
  91. 208 0
      src/dai/supplier/database/goods.php
  92. 359 0
      src/dai/supplier/database/info.php
  93. 105 0
      src/dai/supplier/database/type.php
  94. 8 0
      src/dai/supplier/index.php
  95. 28 0
      src/dai/supplier/lib/Manage.php
  96. 115 0
      src/dai/supplier/lib/Set.php
  97. 327 0
      src/set/database/category.php
  98. 441 0
      src/set/database/category_attr.php
  99. 144 0
      src/set/database/category_attr_search.php
  100. 153 0
      src/set/database/category_attr_value.php

+ 9 - 0
boot.php

@@ -0,0 +1,9 @@
+<?php
+$_SERVER['DEVER_SERVER'] = 'localhost';
+define('DEVER_PROJECT', 'yuandaibao');
+define('DEVER_PROJECT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+if (defined('DEVER_PACKAGE')) {
+	include('dever_package/'.DEVER_PACKAGE.'/index.php');
+} else {
+	include('dever/boot.php');
+}

+ 5 - 0
common.php

@@ -0,0 +1,5 @@
+<?php
+$page = Dever::input('page');
+if ($page) {
+    Dever::setInput('pg', $page);
+}

+ 198 - 0
config/base.php

@@ -0,0 +1,198 @@
+<?php
+$config['base'] = array
+(
+	'name' => 'yuandaibao',
+	'version' => '1.0.0 Beta',
+
+    # 语言包
+    //'lang_set' => array('zh-cn' => '简体中文', 'en' => '英文'),
+
+    # 设置分类组件中的栏目下的分类为系统使用的主分类
+    'category' => 1,
+
+    # 后台头部菜单
+    'top' => 'passport/system_id',
+
+    # 小程序用的是啥 developer开发版 trial体验版 formal正式版
+    'wechat_applet' => 'trial',
+
+    'audit' => array
+    (
+        1 => '已审核',
+        2 => '未审核',
+        3 => '审核未通过',
+    ),
+
+    # 上线状态
+    'status' => array
+    (
+        1 => '上线发布',
+        2 => '下架',
+    ),
+
+    # 几个角色定义
+    'source' => array
+    (
+        1 => '门店',
+        2 => '仓库',
+        3 => '工厂',
+    ),
+
+    # 小程序配置
+    'applet' => array
+    (
+        'project' => 'passport/system',
+        'url' => 'https://api.weixin.qq.com/sns/jscode2session',
+        # 首页
+        'index' => 'pages/index/index',
+    ),
+
+    # 加密key
+    'encode_key' => 'dreamland1985',
+
+    # 站点使用邮箱还是手机作为主账号
+    'account' => 'mobile',//SMS_228142347
+
+    # 发送邮件的配置
+    'email' => array
+    (
+        'pop' => 'pop.qq.com',
+        'smtp' => 'smtp.qiye.aliyun.com',
+        'imap' => 'imap.qq.com',
+        'username' => 'zsmazq@zsma.com.cn',
+        'password' => 'Zsma123886',
+        'from' => array('zsmazq@zsma.com.cn', '厨人易料'),
+        'agent' => array
+        (
+            'title' => '厨人易料代理商邮箱认证',
+            'link' => 'agent/lib/email.act',
+            'content' => '尊敬的厨人易料用户:
+<br /><br />
+您好!
+<br /><br />
+请点击下方链接进行邮箱认证
+<br /><br />
+【{link}】
+<br /><br />
+如果上面的链接无法点击,您也可以复制链接到您的浏览器内打开,完成邮箱认证(链接有效期一天)。',
+        ),
+
+        'option' => array
+        (
+            'title' => '期权交付通知',
+            'link' => 'option/lib/email.act',
+            'content' => '
+尊敬的{username},您好:
+<br /><br />
+欢迎您使用期权管理系统,请点击以下链接,完成邮箱验证。
+<br /><br />
+验证链接:
+【<a href="{link}" target="_blank">{link}</a>】
+<br /><br />
+验证通过后,请重新登录期权管理系统,完成期权确认。
+<br /><br />
+请于7日内点击确认按钮,超过时限未确认,将失去期权获取资格。
+<br /><br />
+本邮件为系统自动发放,请勿回复。如有疑问联系客服咨询。
+<br /><br /><br /><br />
+
+<img src="https://7n.churenyiliao.com/base/qiquan.png" width="150"/>
+<br /><br />
+手机扫码此二维码,打开期权管理系统。
+<br /><br />
+本系统由ESOP服务商提供技术支持,如有疑问,请及时联系客服。
+<br /><br />
+
+',
+        ),
+    ),
+
+    # 直接使用sms组件,这部分配置废弃
+    
+    'mobileCode' => array
+    (
+        # debug模式
+        'debug' => true,
+    ),
+    
+    # 注册成功后,调取的接口
+    'regAction' => '',
+
+    # 注册成功后,是否发送短信,直接使用skin的key即可
+    //'regSendSms' => 'reg',
+
+    # 用户中心的列表中显示的项目
+    'passport_list_button' => array
+    (
+        /*
+        'list1' => array('订单', '"order&project=act&search_option_uid={id}&oper_parent=user&oper_project=passport"'),
+        'list2' => array('兑换码', '"info&project=code&search_option_create_uid={id}&oper_parent=user&oper_project=passport"'),
+        'list3' => array('积分', '"user&project=score&search_option_uid={id}&oper_parent=user&oper_project=passport"'),
+        */
+    ),
+
+    # 用户中心的用户下单量统计接口
+    'passport_stat_order' => 'shop/lib/cron.order_user',
+
+    # 日志系统
+    'log' => array
+    (
+        'cron' => array
+        (
+            'ad/lib/cron.run'
+        ),
+    ),
+
+    # 积分配置
+    'score' => array
+    (
+        # 实时增加积分开启,关闭则需要把lib/core.cron放到计划任务中
+        'sync' => true,
+    ),
+
+    # 启用全站图片压缩
+    //'pic' => 'yun_t1',
+
+    # 队列
+    'queue' => array
+    (
+        'method' => 'redis',
+        'host' => 'server-redis',
+        'port' => '6379',
+        'password' => 'dm_redis_123',
+    ),
+);
+
+
+# 前台通用配置
+$config['template'] = array
+(
+    # 静态页面目录
+    //'assets' => array('pc', 'mobile'),
+    'assets' => 'pc',
+
+    # 模板编译器目录
+    'template' => 'pc',
+
+    # 模板html文件的所在目录,默认为html
+    'path' => 'html',
+
+    'replace' => array
+    (
+        'css' => '../css/',
+        'js' => '../js/',
+        'images' => '../images/',
+        'img' => '../img/',
+        'script' => '../script/',
+        'static' => '../static/',
+    ),
+
+    # 编译器与模板对应关系目录,定义之后,代表可以完全不改动前端的代码,可以为空,为空则一一对应,参考manage
+    'relation' => array
+    (
+        # 首页启动屏幕
+        'home' => 'home',
+    ),
+    
+);
+return $config;

+ 175 - 0
config/env/localhost/default.php

@@ -0,0 +1,175 @@
+<?php
+
+# 验证dc是否存在,一般在share目录下
+$dc = array();
+$dc_file = '/data/dm/container/share/dc/config.php';
+if (is_file($dc_file)) {
+    $dc = include($dc_file);
+}
+# 基本配置
+$config['base'] = array
+(
+    # api文档生成是否开启,开启后,将会根据访问来生成文档。生产环境建议禁止
+    'apiDoc' => true,
+    # api日志是否开启,开启后,将会记录所有带有_api后缀方法的请求参数和响应参数
+    'apiLog' => true,
+
+    # 定义自动转为api的目录,可以将该目录下的所有类的公共方法,都转为可以访问的api,开启该功能可能有安全性问题。
+    'apiOpenPath' => 'src',
+
+    # 启用后,将会根据api目录下的配置文件自动定位api
+    'apiConfig' => false,
+);
+
+if (isset($dc['data'])) {
+    $config['base']['data'] = $dc['data'];
+}
+
+$create = false;
+if (isset($dc['mysql']['create'])) {
+    $create = false;
+}
+$create = -1;
+$ip = isset($dc['host']) ? $dc['host'] : '192.168.33.10';
+
+$local = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $ip;
+
+
+# 数据库配置
+$config['database'] = array
+(
+    # 是否开启mysql自助优化功能,开启后,会记录所有where条件和order的字段,可以方便的在后台进行分析、增加索引,必须安装manage组件
+    'opt' => true,
+
+    # 是否开启sql自动优化,将sql中的select * 转换为 select a,b形式,将sql中的where条件按照索引从左到右自动排序,必须打开上述的opt选项,数据量大时建议打开。
+    //'sqlOp' => true,
+    'create' => $create,
+    # 默认数据库配置
+    'default' => array
+    (
+        'type' => 'pdo',
+        'host' => array
+        (
+            'read' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
+            'update' => isset($dc['mysql']) ? $dc['mysql']['host'] : 'web-mysql:3306',
+            'create' => isset($dc['mysql']) ? $dc['mysql']['host_create'] : 'web-mysql:3306',
+        ),
+        'database' => 'sellsellking',
+        'username' => isset($dc['mysql']) ? $dc['mysql']['username'] : 'root',
+        'password' => isset($dc['mysql']) ? $dc['mysql']['password'] : '123456',
+        'charset' => 'utf8mb4',
+    ),
+
+    # 定义历史数据库
+    'old' => array
+    (
+        'type' => 'pdo',
+        'host' => array
+        (
+            'read' => isset($dc['mysqlold']) ? $dc['mysqlold']['host'] : 'web-mysql:3306',
+            'update' => isset($dc['mysqlold']) ? $dc['mysqlold']['host'] : 'web-mysql:3306',
+        ),
+        'database' => 'chuzren1yi9liao',
+        'username' => isset($dc['mysqlold']) ? $dc['mysqlold']['username'] : 'root',
+        'password' => isset($dc['mysqlold']) ? $dc['mysqlold']['password'] : '123456',
+        'charset' => 'utf8mb4',
+    ),
+);
+
+# 缓存配置
+$config['cache'] = array
+(
+    # 启用mysql数据库缓存,这个缓存是根据表名自动生成,dever::load形式和service的all、one形式均自动支持,无需手动添加
+    'mysql' => 0,
+    # 启用页面缓存 会根据当前的url来生成缓存,相当于页面静态化。
+    'html' => 0,
+    # 启用数据级别缓存 这个缓存是程序员自定义的:Dever::cache('name', 'value', 3600);
+    'data' => 0,
+    # 启用load加载器缓存,一般不加载
+    'load' => 0,
+    # 启用load加载器的远程加载缓存
+    'curl' => 0,
+    # 启用路由缓存
+    'route' => 0,
+
+    # 缓存精细控制,根据uri来控制,0则无需缓存
+    'routeKey' => array
+    (
+        
+    ),
+
+    # 哪些路由中的参数不参与生成缓存的key
+    'routeNoParam' => array
+    (
+        'uid' => array
+        (
+            
+        ),
+    ),
+    
+    # 缓存清理的参数名,请通过shell=clearcache执行
+    'shell' => 'clearcache',
+
+    # 是否启用key失效时间记录,启用之后,将会记录每个key的失效时间
+    'expire' => true,
+
+    # 缓存类型
+    'type' => 'redis',//memcache、redis
+
+    # 缓存保存方式,支持多个数据源、多台缓存服务器
+    'store' => array
+    (
+        array
+        (
+            'host' => 'server-redis',
+            'port' => '6379',
+            'weight' => 100,
+            'password' => 'dm_redis_123',
+        ),
+    ),
+);
+
+$config['debug'] = array
+(
+    'log' => false
+);
+
+/*
+if (DEVER_APP_NAME == 'source') {
+    $config['debug']['log'] = array('type' => 'file'); 
+}
+*/
+
+
+$host = 'http://'.$local . '/yuandaibao/';
+
+$name = '';
+
+if (isset($dc['mysql'])) {
+    $name = '';
+}
+$upload = $host . $name . 'package/';
+$uploadcdn = $host . $name . 'data/';
+
+$config['host'] = array
+(
+    'upload'=> $upload . 'upload/?save',
+    'uploadRes'     => isset($dc['res']) && $dc['res'] ? $dc['res'] : $uploadcdn . 'upload/',
+
+    # 定义接口
+    'project' => array
+    (
+        'uploads' => array
+        (
+            'path' => $host. 'churen/package/upload/?',
+        ),
+    ),
+);
+
+/*
+if (!strstr($_SERVER['DOCUMENT_URI'], 'goods')) {
+    //$config['host']['project']['goods'] = $config['host']['project']['goodss'];
+}
+*/
+
+return $config;

+ 6 - 0
config/route.php

@@ -0,0 +1,6 @@
+<?php
+return array
+(
+	'home' => 'home',
+	'c=v(.*?)_(.*?)' => 'view.get?type=$1&id=$2',
+);

+ 321 - 0
data/compile/yuandaibao/manage/layadmin/console.cmp.php

@@ -0,0 +1,321 @@
+<?php $data['manage/auth.notice']=Dever::load('manage/auth.notice') ?>
+<?php $data['manage/console.data']=Dever::load('manage/console.data') ?>
+<?php $data['manage/console.system']=Dever::load('manage/console.system') ?>
+<?php $data['manage/auth.config']=Dever::load('manage/auth.config') ?>
+<!DOCTYPE html>
+<!--power by dever--><html>
+<head>
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/head.cmp.php';} ?>
+</head>
+<body>
+  
+  <div class="layui-fluid">
+    <div class="layui-row layui-col-space15">
+    
+    </div>
+    <div class="layui-row layui-col-space15">
+      <div class="layui-col-md8">
+        <div class="layui-row layui-col-space15">
+          <div class="layui-col-md6" style="display: none;">
+            <div class="layui-card">
+              <div class="layui-card-header">快捷方式</div>
+              <div class="layui-card-body">
+                
+                <div class="layui-carousel layadmin-carousel layadmin-shortcut">
+                  <div carousel-item>
+                    <ul class="layui-row layui-col-space10">
+                      <li class="layui-col-xs3">
+                        <a lay-href="home/homepage1.html">
+                          <i class="layui-icon layui-icon-console"></i>
+                          <cite>主页一</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="home/homepage2.html">
+                          <i class="layui-icon layui-icon-chart"></i>
+                          <cite>主页二</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="component/layer/list.html">
+                          <i class="layui-icon layui-icon-template-1"></i>
+                          <cite>弹层</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a layadmin-event="im">
+                          <i class="layui-icon layui-icon-chat"></i>
+                          <cite>聊天</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="component/progress/index.html">
+                          <i class="layui-icon layui-icon-find-fill"></i>
+                          <cite>进度条</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="app/workorder/list.html">
+                          <i class="layui-icon layui-icon-survey"></i>
+                          <cite>工单</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="user/user/list.html">
+                          <i class="layui-icon layui-icon-user"></i>
+                          <cite>用户</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/system/website.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>设置</cite>
+                        </a>
+                      </li>
+                    </ul>
+                    <ul class="layui-row layui-col-space10">
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                      <li class="layui-col-xs3">
+                        <a lay-href="set/user/info.html">
+                          <i class="layui-icon layui-icon-set"></i>
+                          <cite>我的资料</cite>
+                        </a>
+                      </li>
+                    </ul>
+                    
+                  </div>
+                </div>
+                
+              </div>
+            </div>
+          </div>
+          <div class="layui-col-md12" id="console_data" style="<?php if(!(Dever::load('manage/console.data'))): ?>display:none;<?php endif; ?>">
+            <div class="layui-card">
+              <div class="layui-card-header">数据概览</div>
+              <div class="layui-card-body">
+
+                <div class="layui-carousel layadmin-carousel layadmin-backlog">
+                  <div carousel-item>
+                    <ul class="layui-row layui-col-space10">
+                      <?php if(isset($data['manage/console.data']) && is_array($data['manage/console.data'])): ?><?php $t=count($data['manage/console.data'])-1 ?><?php $i=0 ?><?php foreach($data['manage/console.data'] as $k => $v): ?><li class="layui-col-xs3">
+                        <a class="layadmin-backlog-body">
+                          <h3><?php echo isset($v['name']) ? $v['name'] : "" ?></h3>
+                          <p><cite><?php echo isset($v['num']) ? $v['num'] : "" ?></cite></p>
+                        </a>
+                      </li><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/console.data'] ?><?php endif; ?>
+                      
+                      
+                      
+                      
+                      
+                    </ul>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+
+          <div class="layui-col-md12" id="console_system_data">
+            <div class="layui-card">
+              <div class="layui-card-header">系统概览</div>
+              <div class="layui-card-body">
+
+                <div class="layui-carousel layadmin-carousel layadmin-backlog">
+                  <div carousel-item>
+                    <ul class="layui-row layui-col-space10">
+                      <?php if(isset($data['manage/console.system']) && is_array($data['manage/console.system'])): ?><?php $t=count($data['manage/console.system'])-1 ?><?php $i=0 ?><?php foreach($data['manage/console.system'] as $k => $v): ?><li class="layui-col-xs3">
+                        <a class="layadmin-backlog-body">
+                          <h3><?php echo isset($v['name']) ? $v['name'] : "" ?></h3>
+                          <p><cite><?php echo isset($v['num']) ? $v['num'] : "" ?></cite></p>
+                        </a>
+                      </li><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/console.system'] ?><?php endif; ?>
+                      
+                      
+                      
+                      
+                      
+                    </ul>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+
+          <div class="layui-col-md12" style="display: none;">
+            <div class="layui-card">
+              <div class="layui-card-header">图表走势</div>
+              <div class="layui-card-body">
+                
+                <div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-dataview">
+                  <div carousel-item id="LAY-index-dataview">
+                    <div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
+                    <div></div>
+                    <div></div>
+                  </div>
+                </div>
+                
+              </div>
+            </div>
+            <div class="layui-card" style="display: none;">
+              <div class="layui-tab layui-tab-brief layadmin-latestData">
+                <ul class="layui-tab-title">
+                  <li class="layui-this">今日热搜</li>
+                  <li>今日热帖</li>
+                </ul>
+                <div class="layui-tab-content">
+                  <div class="layui-tab-item layui-show">
+                    <table id="LAY-index-topSearch"></table>
+                  </div>
+                  <div class="layui-tab-item">
+                    <table id="LAY-index-topCard"></table>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      
+      <div class="layui-col-md4">
+
+        <div class="layui-card dever-notice" style="<?php if(!(Dever::load('manage/auth.notice'))): ?>display:none;<?php endif; ?>">
+          <div class="layui-card-header">系统公告</div>
+          <div class="layui-card-body">
+            <div class="layui-carousel layadmin-carousel layadmin-news" data-autoplay="true" data-anim="fade" lay-filter="news">
+              <div carousel-item id="dever-notice">
+                <?php if(isset($data['manage/auth.notice']) && is_array($data['manage/auth.notice'])): ?><?php $t=count($data['manage/auth.notice'])-1 ?><?php $i=0 ?><?php foreach($data['manage/auth.notice'] as $k => $v): ?><div><a href="#" target="_self" class="layui-bg-red" hrefs="<?php  echo Dever::url("notice?where_id=".$v['id']."&where_config=".$v['config']) ?>" title="<?php echo isset($v['name']) ? $v['name'] : "" ?>" style="background-color: #FF5722!important;"><?php echo isset($v['name']) ? $v['name'] : "" ?></a></div><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/auth.notice'] ?><?php endif; ?>
+                 
+                
+              </div>
+            </div>
+          </div>
+        </div>
+
+        <div class="layui-card">
+          <div class="layui-card-header">
+            系统说明
+            <i class="layui-icon layui-icon-tips" id="system_title" lay-tips="<?php echo $data['manage/auth.config']['title'] ?>" lay-offset="5"></i>
+          </div>
+          <div class="layui-card-body layui-text layadmin-text" id="system_info"><?php echo $data['manage/auth.config']['content'] ?></div>
+        </div>
+
+        <div class="layui-card">
+          <div class="layui-card-header">系统信息</div>
+          <div class="layui-card-body layui-text">
+            <table class="layui-table">
+              <colgroup>
+                <col width="100">
+                <col>
+              </colgroup>
+              <tbody>
+                <tr>
+                  <td>系统名称</td>
+                  <td id="system_name"><?php  echo Dever::config("base")->name ?>V<?php  echo Dever::config("base")->version ?></td>
+                </tr>
+                <tr>
+                  <td>内核驱动</td>
+                  <td id="framework_name"><?php  echo Dever::config("base")->framework_name ?></td>
+                </tr>
+                <tr>
+                  <td>主要特色</td>
+                  <td id="desc"><?php  echo Dever::config("base")->desc ?></td>
+                </tr>
+                <tr>
+                  <td>联系我们</td>
+                  <td style="padding-bottom: 0;" id="contact">
+                    <div class="layui-btn-container">
+                      <a href="<?php  echo Dever::config("base")->web ?>" target="_blank" class="layui-btn layui-btn-danger">官方社区</a>
+                      <a href="<?php  echo Dever::config("base")->github ?>" target="_blank" class="layui-btn">下载框架</a>
+                    </div>
+                  </td>
+                </tr>
+              </tbody>
+            </table>
+          </div>
+        </div>
+
+        
+        <div class="layui-card" style="display: none">
+          <div class="layui-card-header">效果报告</div>
+          <div class="layui-card-body layadmin-takerates">
+            <div class="layui-progress" lay-showpercent="yes">
+              <h3>转化率(日同比 28% <span class="layui-edge layui-edge-top" lay-tips="增长" lay-offset="-15"></span>)</h3>
+              <div class="layui-progress-bar" lay-percent="65%"></div>
+            </div>
+            <div class="layui-progress" lay-showpercent="yes">
+              <h3>签到率(日同比 11% <span class="layui-edge layui-edge-bottom" lay-tips="下降" lay-offset="-15"></span>)</h3>
+              <div class="layui-progress-bar" lay-percent="32%"></div>
+            </div>
+          </div>
+        </div>
+        
+        <div class="layui-card" style="display: none;">
+          <div class="layui-card-header">实时监控</div>
+          <div class="layui-card-body layadmin-takerates">
+            <div class="layui-progress" lay-showpercent="yes">
+              <h3>CPU使用率</h3>
+              <div class="layui-progress-bar" lay-percent="58%"></div>
+            </div>
+            <div class="layui-progress" lay-showpercent="yes">
+              <h3>内存占用率</h3>
+              <div class="layui-progress-bar layui-bg-red" lay-percent="90%"></div>
+            </div>
+          </div>
+        </div>
+        
+      </div>
+      
+    </div>
+  </div>
+
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/script.cmp.php';} ?>
+  <script>
+    layui.config({
+        base: '<?php echo Dever::config("host")->script ?>lib/layui/admin/' //静态资源所在路径
+    }).extend({
+        index: 'lib/index' //主入口模块
+    }).use(['index', 'console']);
+</script>
+</body>
+</html>

+ 66 - 0
data/compile/yuandaibao/manage/layadmin/home.cmp.php

@@ -0,0 +1,66 @@
+<?php $data['manage/database.cookie']=Dever::load('manage/database.cookie') ?>
+<?php $data['manage/menu.link']=Dever::load('manage/menu.link') ?>
+<!DOCTYPE html>
+<!--power by dever--><html>
+<head>
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/head.cmp.php';} ?>
+  <style>
+    .layui-layout-admin .layui-body{top: 50px}
+  </style>
+</head>
+<body class="theme-<?php  echo Dever::load("manage/auth.config#template") ?>" test="公告">
+
+  <div id="LAY_app" class="<?php echo $data['manage/database.cookie']['wrapper'] ?>">
+    <div class="layui-layout layui-layout-admin">
+
+      <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/nav.cmp.php';} ?>
+
+      <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/menu.cmp.php';} ?>
+
+      
+      <div class="layadmin-pagetabs" id="LAY_app_tabs" style="display:none;">
+        <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
+        <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
+        <div class="layui-icon layadmin-tabs-control layui-icon-down">
+          <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
+            <li class="layui-nav-item" lay-unselect>
+              <a href="javascript:;"></a>
+              <dl class="layui-nav-child layui-anim-fadein">
+                <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
+                <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
+                <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
+              </dl>
+            </li>
+          </ul>
+        </div>
+        <div class="layui-tab" lay-unauto lay-allowclose="true" lay-filter="layadmin-layout-tabs">
+          <ul class="layui-tab-title" id="LAY_app_tabsheader">
+            <li lay-id="<?php echo $data['manage/menu.link']['console'] ?>" lay-attr="<?php echo $data['manage/menu.link']['console'] ?>" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
+          </ul>
+        </div>
+      </div>
+      
+      
+      
+      <div class="layui-body" id="LAY_app_body">
+        <div class="layadmin-tabsbody-item layui-show">
+          <iframe src="<?php echo $data['manage/menu.link']['console'] ?>" frameborder="0" class="layadmin-iframe"></iframe>
+        </div>
+      </div>
+      
+      
+      <div class="layadmin-body-shade" layadmin-event="shade"></div>
+    </div>
+  </div>
+
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/script.cmp.php';} ?>
+  <script>
+    layui.config({
+        base: '<?php echo Dever::config("host")->script ?>lib/layui/admin/' //静态资源所在路径
+        ,version:false
+    }).extend({
+        index: 'lib/index' //主入口模块
+    }).use('index');
+</script>
+</body>
+</html>

+ 33 - 0
data/compile/yuandaibao/manage/layadmin/inc/head.cmp.php

@@ -0,0 +1,33 @@
+<?php $data['manage/auth.config']=Dever::load('manage/auth.config') ?>
+<meta charset="utf-8">
+<title><?php echo $data['manage/auth.config']['title'] ?></title>
+<meta name="keywords" content="<?php echo $data['manage/auth.config']['title'] ?>">
+<meta name="description" content="<?php echo $data['manage/auth.config']['title'] ?>">
+<meta name="apple-mobile-web-app-title" content="<?php echo $data['manage/auth.config']['title'] ?>" />
+<meta name="author" content="rabin">
+<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/layui/css/layui.css" />
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/layui/admin/style/admin.css?v9" media="all">
+
+
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/color/colpick.css">
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/kindeditor/themes/default/default.css?v1" />
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/valid/validationEngine.jquery.css">
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/fancybox/jquery.fancybox.css">
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/highlight/highlight.min.css">
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/datetime/jquery.datetimepicker.css">
+<link rel="stylesheet" type="text/css" href="<?php echo Dever::config("host")->script ?>lib/ui/ui.min.css">
+
+<script>
+window.paceOptions = {
+  ajax: true,
+  document: true,
+  eventLag: true,
+};
+</script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/jquery/pace.min.js"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/jquery/jquery.min.js"></script>
+<script id="script"><?php  echo Dever::script() ?>config.template="<?php  echo $data["manage/auth.config"]["template"] ?>";config.lib="<?php  echo Dever::config("host")->public ?>";config.debug=false</script>
+<style type="text/css" id="style"><?php  echo Dever::load("manage/auth.loading") ? ".content,.content-page{margin-left: 0px;min-height:auto}" : "" ?></style>

+ 13 - 0
data/compile/yuandaibao/manage/layadmin/inc/menu.cmp.php

@@ -0,0 +1,13 @@
+<?php $data['manage/auth.config']=Dever::load('manage/auth.config') ?>
+<?php $data['manage/menu.link']=Dever::load('manage/menu.link') ?>
+<?php $data['manage/menu.getHtml']=Dever::load('manage/menu.getHtml') ?>
+
+      <div class="layui-side layui-side-menu">
+        <div class="layui-side-scroll">
+          <div class="layui-logo" id="console-url" lay-href="<?php echo $data['manage/menu.link']['console'] ?>">
+            <span id="dever-name"><?php echo $data['manage/auth.config']['title'] ?></span>
+          </div>
+          
+          <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu"><?php echo $data['manage/menu.getHtml'] ?></ul>
+        </div>
+      </div>

+ 73 - 0
data/compile/yuandaibao/manage/layadmin/inc/nav.cmp.php

@@ -0,0 +1,73 @@
+<?php $data['manage/menu.getTop']=Dever::load('manage/menu.getTop') ?>
+<?php $data['manage/database.res']=Dever::load('manage/database.res') ?>
+<?php $data['manage/auth.config']=Dever::load('manage/auth.config') ?>
+<?php $data['manage/auth.info']=Dever::load('manage/auth.info') ?>
+<?php $data['manage/menu.link']=Dever::load('manage/menu.link') ?>
+<?php $data['manage/company.getList']=Dever::load('manage/company.getList') ?>
+<?php $data['manage/company.getCur']=Dever::load('manage/company.getCur') ?>
+<div id="load_style" style="display:none;"><?php echo $data['manage/database.res']['css'] ?></div>
+<style>
+@media screen and (max-width: 1024px) {
+    .nav{
+        display: none;
+    }
+}
+</style>
+<div id="dever-name" style="display:none;"><?php echo $data['manage/auth.config']['title'] ?></div>
+<div class="layui-header" id="nav" style="<?php  echo Dever::load("manage/auth.loading") ? "display:none;" : "" ?>">
+
+<ul class="layui-nav layui-layout-left" id="top"><?php echo $data['manage/menu.getTop'] ?></ul>
+
+<ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
+
+  <li class="layui-nav-item auth-top" lay-unselect style="<?php  echo Dever::load("manage/company.getCur") ? "" : "display:none;" ?>">
+    <a href="javascript:;">
+      <cite><span style="<?php if(!(Dever::load('manage/company.getCur'))): ?>display:none;<?php endif; ?>"><?php echo $data['manage/company.getCur'] ?></span></cite>
+    </a>
+    <ul class="layui-nav-child">
+      <?php if(isset($data['manage/company.getList']) && is_array($data['manage/company.getList'])): ?><?php $t=count($data['manage/company.getList'])-1 ?><?php $i=0 ?><?php foreach($data['manage/company.getList'] as $k => $v): ?><li><a href="javascript:;" data-id="<?php echo isset($v['id']) ? $v['id'] : "" ?>" onclick="topCMenu($(this))"><?php echo isset($v['name']) ? $v['name'] : "" ?></a></li><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/company.getList'] ?><?php endif; ?>
+    </ul>
+  </li>
+
+  <li class="layui-nav-item" lay-unselect style="display:none;">
+    <a lay-href="app/message/index.html" layadmin-event="message" lay-text="消息中心">
+      <i class="layui-icon layui-icon-notice"></i>  
+      
+      
+      <span class="layui-badge-dot"></span>
+    </a>
+  </li>
+  <li class="layui-nav-item layui-hide-xs" lay-unselect>
+    <a href="javascript:;" layadmin-event="theme">
+      <i class="layui-icon layui-icon-theme"></i>
+    </a>
+  </li>
+  <li class="layui-nav-item layui-hide-xs" lay-unselect style="display:none;">
+    <a href="javascript:;" layadmin-event="note">
+      <i class="layui-icon layui-icon-note"></i>
+    </a>
+  </li>
+  <li class="layui-nav-item layui-hide-xs" lay-unselect style="display:none;">
+    <a href="javascript:;" layadmin-event="fullscreen">
+      <i class="layui-icon layui-icon-screen-full"></i>
+    </a>
+  </li>
+  <li class="layui-nav-item" lay-unselect>
+    <a href="javascript:;">
+      <cite id="manage-name"><?php echo $data['manage/auth.info']['username'] ?></cite>
+    </a>
+    <dl class="layui-nav-child">
+      <dd><a id="edit_password" onclick="pass($(this));" style="cursor: pointer;">修改密码</a></dd>
+      <hr>
+      <dd style="text-align: center;"><a id="logout-url" href="<?php echo $data['manage/menu.link']['logout'] ?>">退出</a></dd>
+    </dl>
+  </li>
+  
+  <li class="layui-nav-item layui-hide-xs" lay-unselect style="display:none;">
+    <a href="javascript:;" layadmin-event="about"><i class="layui-icon layui-icon-more-vertical"></i></a>
+  </li>
+  <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
+    <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
+  </li>
+</ul>
+</div>

+ 44 - 0
data/compile/yuandaibao/manage/layadmin/inc/script.cmp.php

@@ -0,0 +1,44 @@
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/pic/webp.js"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/color/colpick.js"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/datetime/jquery.datetimepicker.min.js?v2"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/fancybox/jquery.fancybox.js"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/highlight/highlight.min.js"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/valid/jquery.validationEngine.min.js?v3"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/kindeditor/kindeditor-all-min.js?v9"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/kindeditor/lang/zh-CN.js?v7"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/ui/ui.min.js"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/qiniu/upload/plupload.full.min.js"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/qiniu/qiniu.upload.js"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/oss/aliyun-oss-sdk-6.11.2.min.js"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/tool/md5.js"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/layui/upload.js?v226"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/layui/layui.js?v12"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/clipboard/clipboard.js"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/pic/holder.js"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/excel/xlsx.min.js"></script>
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/excel/excel.js?v16"></script>
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/layui/xm-select/xm-select.js"></script>
+
+
+<script type="text/javascript" src="<?php echo Dever::config("host")->script ?>lib/manage/main.js?713"></script>

+ 79 - 0
data/compile/yuandaibao/manage/layadmin/login.cmp.php

@@ -0,0 +1,79 @@
+<?php $data['manage/auth.config']=Dever::load('manage/auth.config') ?>
+<!DOCTYPE html>
+<!--power by dever--><html>
+<head>
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/head.cmp.php';} ?>
+  <link rel="stylesheet" href="<?php echo Dever::config("host")->script ?>lib/layui/admin/style/login.css" media="all">
+</head>
+<body>
+
+  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
+    <form action="<?php echo $data['manage/auth.config']['login_url'] ?>" method="post" target="f1" class="form-horizontal m-t-20" id="login">
+    <input type="hidden" name="function" id="function" value="msg">
+    <input type="hidden" name="refer" id="refer" value="<?php echo $data['manage/auth.config']['refer'] ?>">
+    <iframe id="f1" name="f1" style="display:none;"></iframe>
+    <div class="layadmin-user-login-main">
+      <div class="layadmin-user-login-box layadmin-user-login-header">
+        <h2 id="name"><?php echo $data['manage/auth.config']['title'] ?></h2>
+      </div>
+      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
+        <div class="layui-form-item">
+          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
+          <input type="text" name="username" id="username" lay-verify="required" placeholder="账号" class="layui-input">
+        </div>
+        <div class="layui-form-item">
+          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
+          <input name="password" id="password" type="password" lay-verify="required" placeholder="密码" class="layui-input">
+        </div>
+        <div class="layui-form-item">
+          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
+        </div>
+      </div>
+    </div>
+    
+    <div class="layui-trans layadmin-user-login-footer">
+      <p id="footer" style="<?php if(!(Dever::load('manage/auth.config#copyright'))): ?>display:none;<?php endif; ?>"><?php echo $data['manage/auth.config']['copyright'] ?></p>
+    </div>
+    
+    <div class="ladmin-user-login-theme" style="display:none;">
+      <script type="text/html" template>
+        <ul>
+          <li data-theme=""><img src="{{ layui.setter.base }}style/res/bg-none.jpg"></li>
+          <li data-theme="#03152A" style="background-color: #03152A;"></li>
+          <li data-theme="#2E241B" style="background-color: #2E241B;"></li>
+          <li data-theme="#50314F" style="background-color: #50314F;"></li>
+          <li data-theme="#344058" style="background-color: #344058;"></li>
+          <li data-theme="#20222A" style="background-color: #20222A;"></li>
+        </ul>
+      </script>
+    </div>
+    </form> 
+  </div>
+
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/script.cmp.php';} ?>
+  <script>
+  $(function()
+  {
+    $("#login").bind("keydown",function(e){
+      var theEvent = e || window.event;    
+      var code = theEvent.keyCode || theEvent.which || theEvent.charCode;    
+      if (code == 13) {    
+              $("#login").submit();
+          }
+     });
+  });
+
+  </script>
+  <script>
+  layui.config({
+    base: '<?php echo Dever::config("host")->script ?>lib/layui/admin/' //静态资源所在路径
+  }).extend({
+    index: 'lib/index' //主入口模块
+  }).use(['index', 'user'], function(){
+    var $ = layui.$
+    ,setter = layui.setter
+    ,admin = layui.admin
+  });
+  </script>
+</body>
+</html>

+ 262 - 0
data/compile/yuandaibao/manage/layadmin/project/database/list.cmp.php

@@ -0,0 +1,262 @@
+<?php $fast=Dever::input("fast") ?>
+<?php $data['manage/database.page_list']=Dever::load('manage/database.page_list') ?>
+<?php $data['manage/database.info']=Dever::load('manage/database.info') ?>
+<?php $data['manage/database.res']=Dever::load('manage/database.res') ?>
+<?php $data['manage/database.listStyle']=Dever::load('manage/database.listStyle') ?>
+<?php $data['manage/database.page_list_table']=Dever::load('manage/database.page_list_table') ?>
+<?php $data['manage/database.list_search']=Dever::load('manage/database.list_search') ?>
+<?php $data['manage/database.list_tbody']=Dever::load('manage/database.list_tbody') ?>
+<?php $data['manage/database.list_thead']=Dever::load('manage/database.list_thead') ?>
+<?php $data['manage/database.getConfig']=Dever::load('manage/database.getConfig') ?>
+<?php $data['manage/database.list_data']=Dever::load('manage/database.list_data') ?>
+<?php $data['manage/database.list_data_show']=Dever::load('manage/database.list_data_show') ?>
+<?php $data['manage/database.list_chart']=Dever::load('manage/database.list_chart') ?>
+<?php $data['manage/database.list_chart_show']=Dever::load('manage/database.list_chart_show') ?>
+<?php $data['manage/database.list_button']=Dever::load('manage/database.list_button') ?>
+<?php $data['manage/database.list_mul']=Dever::load('manage/database.list_mul') ?>
+<?php $data['manage/auth.config']=Dever::load('manage/auth.config') ?>
+<!DOCTYPE html>
+<!--power by dever--><html>
+<head>
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/head.cmp.php';} ?>
+  
+</head>
+<body class="theme-<?php  echo Dever::load("/auth.config#template") ?>"> 
+<style id="addstyle"><?php echo $data['manage/database.listStyle'] ?></style>
+<style>
+.table {
+  /*box-shadow: 10px 11px 33px -14px;*/
+}
+.layui-table-cell .layui-select,.layui-table-cell .layui-input
+{
+    height: 25px;
+}
+.layui-table-cell {
+    height: auto;
+}
+.layui-card-header {
+    padding: 0px 5px;
+}
+
+.table th,.table td {
+  min-width: 60px;
+}
+#table_2,#table_1 {
+  /*overflow: auto;*/
+}
+.layui-btn-xs
+{
+  margin-top:1px;
+}
+.dever-emoji img {
+  width:16px;
+}
+.layui-tab-title {
+  height: 100%;
+  white-space: inherit;
+}
+.layui-form-item .layui-input-inline {
+    display: block;
+    float: none;
+    left: -3px;
+    margin: 0px 0px 0px 0px;
+}
+.chart {
+  width: 100%;
+  height:300px;
+}
+.table-header-fixed {
+    top: -1px;
+    position: sticky;
+    z-index: 999;
+}
+.goods_table {
+  width: 100%;
+}
+.goods_table th
+{
+  text-align: center;
+}
+.goods_table td
+{
+  text-align: center;
+}
+.layui-table-tool-temp{
+  display: none;
+}
+.layadmin-carousel {
+  height: 90px!important;
+}
+</style>
+<div id="load_style" style="display:none;"><?php echo $data['manage/database.res']['css'] ?></div>
+<span id="dever-name" style="display:none;"><?php echo $data['manage/auth.config']['title'] ?></span>
+<div class="topbar">
+    <div class="banner dever-layout" style="display:none;">
+        <a target="_blank"></a>
+        <span>项目名称</span>
+    </div>
+</div>
+
+<div id="content_1" style="<?php echo $data['manage/database.page_list']['s1'] ?>"><?php echo $data['manage/database.page_list']['content'] ?></div>
+<div id="content_2" style="<?php echo $data['manage/database.page_list']['s2'] ?>">
+  <div class="layui-fluid">
+
+    <div class="layui-card" id="stat_data_card" style="<?php if(isset($data['manage/database.list_data_show']) && is_array($data['manage/database.list_data_show'])): ?><?php $t=count($data['manage/database.list_data_show'])-1 ?><?php $i=0 ?><?php foreach($data['manage/database.list_data_show'] as $k => $v): ?><?php echo $data['manage/database.list_data_show'] ?><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/database.list_data_show'] ?><?php endif; ?>">
+      <div class="layui-card-header">数据概览</div>
+      <div class="layui-card-body">
+
+        <div class="layui-carousel layadmin-carousel layadmin-backlog">
+          <div carousel-item>
+            <ul class="layui-row layui-col-space10" id="stat_data"><?php if(isset($data['manage/database.list_data']) && is_array($data['manage/database.list_data'])): ?><?php $t=count($data['manage/database.list_data'])-1 ?><?php $i=0 ?><?php foreach($data['manage/database.list_data'] as $k => $v): ?><?php echo $v ?><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/database.list_data'] ?><?php endif; ?></ul>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="layui-card">
+      <input type="hidden" name="url1" id="url" value="<?php echo $data['manage/database.info']['mul'] ?>"/>
+
+      <form id="form1" name="form1" method="get" target="f1" action="<?php echo $data['manage/database.info']['list'] ?>">
+      <input type="hidden" name="l" id="l" value="<?php echo $data['manage/database.info']['l'] ?>"/>
+      <input type="hidden" name="project" id="project" value="<?php echo $data['manage/database.info']['project'] ?>"/>
+      <input type="hidden" name="table" id="tables" value="<?php echo $data['manage/database.info']['table'] ?>"/>
+      <input type="hidden" name="menu" id="menu" value="<?php echo $data['manage/database.info']['menu'] ?>"/>
+      <input type="hidden" name="menu_id" id="menu_id" value="<?php echo $data['manage/database.info']['menu_id'] ?>"/>
+      <input type="hidden" name="fast" id="fast" value="<?php echo $fast ?>" />
+      <input type="hidden" name="dever_submit" id="dever_submit" value="<?php echo $data['manage/database.info']['dever_submit'] ?>" />
+      <input type="hidden" name="search_option_state" id="search_option_state" value="<?php echo $data['manage/database.info']['state'] ?>"/>
+
+      <input type="hidden" name="function" id="function" value="msg"/>
+      <input type="hidden" name="method" id="method" value="search"/>
+      <div id="search_param"><?php echo $data['manage/database.info']['search_param'] ?></div> 
+      <iframe id="f1" name="f1" style="display:none;"></iframe>
+      <div class="layui-card-header" style="display: none;"><span id="list-project"><?php echo $data['manage/database.info']['project_name'] ?></span> > <span id="list-name"><?php echo $data['manage/database.info']['list_header'] ?></span></div>
+      <div class="layui-card-body" id="search_content" style="<?php if(!(Dever::load('manage/database.list_search'))): ?>display:none;<?php endif; ?>">
+
+        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
+          <div class="layui-form-item">
+            <div id="search"><?php echo $data['manage/database.list_search'] ?></div>
+          </div>
+        </div>
+      </div>
+      <div class="layui-card-body">
+
+        <div id="list-button" style="padding-bottom: 10px;"><?php echo $data['manage/database.list_button'] ?></div>
+        
+        <div class="dever_desc" id="info" style="<?php if(!(Dever::load('manage/database.getConfig#info'))): ?>display:none;<?php endif; ?>"><?php echo $data['manage/database.getConfig']['info'] ?></div>
+        
+        <div id="table_1" style="<?php echo $data['manage/database.page_list_table']['s1'] ?>"><?php echo $data['manage/database.page_list_table']['content'] ?></div>
+        <div id="table_2" style="<?php echo $data['manage/database.page_list_table']['s2'] ?>"> 
+          <div id="chart" class="chart" style="<?php if(isset($data['manage/database.list_chart_show']) && is_array($data['manage/database.list_chart_show'])): ?><?php $t=count($data['manage/database.list_chart_show'])-1 ?><?php $i=0 ?><?php foreach($data['manage/database.list_chart_show'] as $k => $v): ?><?php echo $data['manage/database.list_chart_show'] ?><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/database.list_chart_show'] ?><?php endif; ?>"><?php if(isset($data['manage/database.list_chart']) && is_array($data['manage/database.list_chart'])): ?><?php $t=count($data['manage/database.list_chart'])-1 ?><?php $i=0 ?><?php foreach($data['manage/database.list_chart'] as $k => $v): ?><?php echo $data['manage/database.list_chart'] ?><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/database.list_chart'] ?><?php endif; ?></div>
+          <table class="table layui-table layui-table-body" id="table">
+          <thead id="list-thead">
+              <tr><?php if(isset($data['manage/database.list_thead']) && is_array($data['manage/database.list_thead'])): ?><?php $t=count($data['manage/database.list_thead'])-1 ?><?php $i=0 ?><?php foreach($data['manage/database.list_thead'] as $k => $v): ?><?php echo $v ?><?php $i=$i+1 ?><?php endforeach; ?><?php else: ?><?php echo $data['manage/database.list_thead'] ?><?php endif; ?></tr>
+          </thead>
+          <tbody id="list-tbody"><?php echo $data['manage/database.list_tbody'] ?></tbody>
+      </table>
+
+      <div id="mul"><?php echo $data['manage/database.list_mul'] ?></div>
+      <div id="page" style="display:none"><?php  echo Dever::page("current") ?></div>
+      <div class="dever_desc" id="desc" style="<?php if(!(Dever::load('manage/database.getConfig#desc'))): ?>display:none;<?php endif; ?>"><?php echo $data['manage/database.getConfig']['desc'] ?></div>
+        </div>
+      </div>
+       </div>
+        </div>
+      </form>
+      <form id="form2" name="form2" method="get" style="display: none;"></form>
+      <div id="struct" style="display:none;"><?php echo $data['manage/database.info']['struct'] ?></div>
+    </div>
+  </div>
+</div>
+
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/script.cmp.php';} ?>
+  <script id="list-thead-data">
+    config.table = {};
+    config.table.limit = 20;
+    config.table.cols = [];
+  </script>
+  <script id="list-tbody-data">
+    config.table.data = [];
+  </script>
+  <script>
+    var form; 
+  layui.config({
+    base: '<?php echo Dever::config("host")->script ?>lib/layui/admin/' //静态资源所在路径
+    ,version:false
+  }).extend({
+    //formSelects: 'plugin/formselects/formselects',
+    index: 'lib/index' //主入口模块
+  }).use(['index', 'contlist', 'table', 'form', 'console'], function(){
+    var table = layui.table;
+    form = layui.form; 
+    //var formSelects = layui.formSelects;
+
+    if ($('#content_2').css('display') != 'none') {
+      var bw = document.body.scrollWidth;
+      var sw = $('#content_2').width();
+      if (sw > 0 && bw > sw) {
+          $('body').css({'width' : 'fit-content'});
+      }
+    } else {
+      //$('#table_1').css({'overflow' : 'auto'});
+      //$('#table_2').css({'overflow' : 'auto'});
+    }
+
+    if (config.table.cols.length > 0) {
+      table.render({
+        elem: '#table'
+        ,page: false
+        ,limit:config.table.limit
+        //,toolbar:'default'
+        //,defaultToolbar:["filter","exports","print"]
+        ,cols: config.table.cols
+        ,data: config.table.data
+        ,done:function(res, curr, count) {
+            $('#page').show();
+            let headerTop = $('.layui-table-header').offset().top; //获取表格头到文档顶部的距离
+            $(window).scroll(function () {
+               if (count > 3 && (headerTop - $(window).scrollTop()) < 0) { //超过了
+                   $('.layui-table-header').addClass('table-header-fixed'); //添加样式,固定住表头
+               } else { //没超过
+                   $('.layui-table-header').removeClass('table-header-fixed'); //移除样式
+               }
+            });
+        }
+      });
+    } else {
+      $('#page').show();
+      var count = $('#list-tbody tr').length;
+      let headerTop = $('#list-thead').offset().top; //获取表格头到文档顶部的距离
+      $(window).scroll(function () {
+         if (count > 3 && (headerTop - $(window).scrollTop()) < 100) { //超过了
+             $('#list-thead').addClass('table-header-fixed'); //添加样式,固定住表头
+
+             /*
+             $('#list-thead th').each(function (k, v) {
+                  var width = $('#list-tbody td').eq(k).width() + 0.9;
+                  //$(v).width(width + 1);
+                  $(v).css({'min-width': width});
+              });*/
+         } else { //没超过
+             $('#list-thead').removeClass('table-header-fixed'); //移除样式
+         }
+      });
+    }
+    init();
+
+    if ($('.dever-manage').length) {
+      $('.dever-manage').dblclick(function()
+      {
+        showMsg('数据结构', $(this), '#struct');
+      })
+    }
+
+    //滚动body,header跟随滚动
+    $('.layui-table-body').on('scroll', function(e) {
+        var leftPx = $(e.target).scrollLeft(); //获取表格body,滚动条距离左边的长度
+        var left = 'translateX(-' + leftPx + 'px)';
+        $('.layui-table-header .layui-table').css('transform', left); //设置表格header的内容反向(-)移动
+    });
+  });
+  </script>
+</body>
+</html>

+ 237 - 0
data/compile/yuandaibao/manage/layadmin/project/database/update.cmp.php

@@ -0,0 +1,237 @@
+<?php $fast=Dever::input("fast") ?>
+<?php $data['manage/database.page_update']=Dever::load('manage/database.page_update') ?>
+<?php $data['manage/database.info']=Dever::load('manage/database.info') ?>
+<?php $data['manage/database.css']=Dever::load('manage/database.css') ?>
+<?php $data['manage/database.res']=Dever::load('manage/database.res') ?>
+<?php $data['manage/database.update_content']=Dever::load('manage/database.update_content') ?>
+<?php $data['/database.info']=Dever::load('/database.info') ?>
+<?php $data['manage/database.valid']=Dever::load('manage/database.valid') ?>
+<?php $data['manage/database.save']=Dever::load('manage/database.save') ?>
+<!DOCTYPE html>
+<!--power by dever--><html>
+<head>
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/head.cmp.php';} ?>
+
+  <style>
+    textarea{
+      padding-top: 5px;
+    }
+
+    .dever-color {
+      /*width: 100%;*/
+    }
+
+    .dever_form_add_child {
+      padding:15px;
+    }
+    .dever_form_delete {
+      float: right;
+      margin-right: 10px;
+      color: red;
+    }
+    .dever_score_child {
+      margin: 15px;
+    }
+    .layui-tab-title {
+      height: 100%;
+      white-space: inherit;
+    }
+
+    </style>
+</head>
+<body class="theme-<?php  echo Dever::load("/auth.config#template") ?>">
+  <div id="load_style" style="display:none;"><?php echo $data['manage/database.res']['css'] ?></div>
+<div class="topbar">
+    <div class="banner dever-layout" style="display:none;">
+        <a target="_blank"></a>
+        <span>项目名称</span>
+    </div>
+</div> 
+<div id="content_1" style="<?php echo $data['manage/database.page_update']['s1'] ?>"><?php echo $data['manage/database.page_update']['content'] ?></div>
+<div id="content_2" style="<?php echo $data['manage/database.page_update']['s2'] ?>">
+  <div class="layui-fluid">
+    <div style="display:none;"><span id="list-name"><?php echo $data['manage/database.info']['update_header'] ?></span> > <span id="list-project"><?php echo $data['manage/database.info']['project_name'] ?></span></div>
+    <form method="post" class="layui-form form1" target="f1" role="form" autocomplete="off" lay-filter="form-filter" action="<?php echo $data['manage/database.info']['action'] ?>">
+        <style id="load_css"><?php echo $data['manage/database.css'] ?></style>
+    <input type="hidden" name="function" id="function" value="msg"/>
+    <input type="hidden" name="url" id="url" value="<?php echo $data['manage/database.info']['list'] ?>" />
+    <input type="hidden" name="project" id="project" value="<?php echo $data['manage/database.info']['project'] ?>" />
+    <input type="hidden" name="table" id="table" value="<?php echo $data['manage/database.info']['table'] ?>" />
+    <input type="hidden" name="fast" id="fast" value="<?php echo $fast ?>" />
+    <input type="hidden" name="dever_submit" id="dever_submit" value="<?php echo $data['manage/database.info']['dever_submit'] ?>" />
+    <input type="hidden" name="menu_id" id="menu_id" value="<?php echo $data['manage/database.info']['menu_id'] ?>" />
+    <input type="hidden" name="update_where_id" id="update_where_id" value="<?php echo $data['manage/database.info']['id'] ?>"/>
+    <input type="hidden" name="copy_num" id="copy_num" value="0"/>
+    <iframe id="f1" name="f1" style="display:none;"></iframe>
+
+    <div class="layui-row layui-col-space15" id="data_content"><?php echo $data['manage/database.update_content'] ?></div>
+    <div id="valid"><?php echo $data['manage/database.valid'] ?></div>
+    <div id="struct" style="display:none;" save="<?php echo $data['manage/database.save'] ?>"><?php echo $data['/database.info']['struct'] ?></div>
+    </form>
+  </div>
+</div>
+
+  
+  <?php if(!isset($fast) || (isset($fast) && $fast != 1)){require Dever::config("base")->data . 'compile/yuandaibao/manage/layadmin/inc/script.cmp.php';} ?>
+  <script id="update_script">
+  var form;
+  var skuTable;
+  layui.config({
+    base: '<?php echo Dever::config("host")->script ?>lib/layui/admin/' //静态资源所在路径
+    ,version:true
+  }).extend({
+    index: 'lib/index', //主入口模块
+    //formSelects: 'plugin/formselects/formselects',
+    skuTable: 'plugin/skuTable',
+    sortable: 'plugin/sortable'
+  }).use(['index', 'contlist', 'table', 'form', 'skuTable'], function(){
+    var table = layui.table;
+    form = layui.form; 
+    //var formSelects = layui.formSelects;
+    skuTable = layui.skuTable;
+
+    if ($('#sku_spec_type').length) {
+        sku($('#sku_spec_type'));
+    }
+
+    /*
+    $('select').each(function() {
+        if ($(this).attr('xm-value')) {
+          formSelects.value($(this).attr('xm-select'), $(this).attr('xm-value'));
+        }
+    });
+    */
+
+    /*
+    var obj = layui.skuTable.render({
+            //规格类型 0统一规格 1多规格
+            isAttributeValue: 0,
+            //规格类型容器id
+            isAttributeElemId: 'sku_spec_type',
+            //规格表容器id
+            specTableElemId: 'sku_spec_table',
+            //sku表容器id
+            skuTableElemId: 'sku_table',
+            //规格拖拽排序
+            sortable: false,
+            //sku表相同属性值是否合并行
+            rowspan: true,
+            //请求成功返回状态码值
+            requestSuccessCode: 200,
+            //上传接口地址
+            //接口要求返回格式参考 upload.json
+            uploadUrl: './json/upload.json',
+            //统一规格配置项
+            singleSkuTableConfig: {
+                thead: [
+                    {title: '商品编码', icon: 'layui-icon-cols'},
+                    {title: '销售价(元)', icon: 'layui-icon-cols'},
+                    {title: '采购价(元)', icon: 'layui-icon-cols'},
+                    {title: '成本价(元)', icon: 'layui-icon-cols'},
+                ],
+                tbody: [
+                    {type: 'input', field: 'code', value: '', verify: 'required', reqtext: '商品编码不能为空'},
+                    {type: 'input', field: 'price', value: '0', verify: 'required|number', reqtext: '销售价不能为空'},
+                    {type: 'input', field: 'buy_price', value: '0', verify: 'required|number', reqtext: '采购价不能为空'},
+                    {type: 'input', field: 'cost_price', value: '0', verify: 'required|number', reqtext: '成本价不能为空'},
+                ]
+            },
+            //多规格配置项
+            multipleSkuTableConfig: {
+                thead: [
+                    {title: '图片', icon: ''},
+                    {title: '商品编码', icon: 'layui-icon-cols'},
+                    {title: '销售价(元)', icon: 'layui-icon-cols'},
+                    {title: '采购价(元)', icon: 'layui-icon-cols'},
+                    {title: '成本价(元)', icon: 'layui-icon-cols'},
+                ],
+                tbody: [
+                    {type: 'image', field: 'pic', value: '', verify: '', reqtext: ''},
+                    {type: 'input', field: 'code', value: '', verify: 'required', reqtext: '商品编码不能为空'},
+                    {type: 'input', field: 'price', value: '0', verify: 'required|number', reqtext: '销售价不能为空'},
+                    {type: 'input', field: 'buy_price', value: '0', verify: 'required|number', reqtext: '采购价不能为空'},
+                    {type: 'input', field: 'cost_price', value: '0', verify: 'required|number', reqtext: '成本价不能为空'},
+                ]
+            },
+            //商品id 配合specDataUrl和skuDataUrl使用
+            productId: '11',
+            //规格数据, 一般从后台获取
+            specData: [
+                {
+                    id: "1",
+                    title: "颜色",
+                    child: [
+                        {id: "1", title: "红", checked: true},
+                        {id: "2", title: "黄", checked: false},
+                        {id: "3", title: "蓝", checked: false}
+                    ]
+                }, {
+                    id: "2",
+                    title: "尺码",
+                    child: [
+                        {id: "4", title: "S", checked: true},
+                        {id: "5", title: "M", checked: true},
+                        {id: "6", title: "L", checked: false},
+                        {id: "7", title: "XL", checked: false}
+                    ]
+                }, {
+                    id: "3",
+                    title: "款式",
+                    child: [
+                        {id: "8", title: "男款", checked: true},
+                        {id: "9", title: "女款", checked: true}
+                    ]
+                }
+            ],
+            specData: [],
+            //获取规格数据接口地址,如果为空或者不配置则使用 specData 参数配置
+            //接口要求返回格式参考 specData.json
+            // specDataUrl: './json/specData.json',
+            //sku数据
+            //新增的时候为空对象
+            //编辑的时候可以从后台接收,会自动填充sku表,可以去掉注释看效果
+            //多规格格式
+            // skuData: {
+            //     "skus[1-4-8][picture]": "https://www.baidu.com/img/flexible/logo/pc/result.png",
+            //     "skus[1-4-8][price]": "100",
+            //     "skus[1-4-8][market_price]": "200",
+            //     "skus[1-4-8][cost_price]": "50",
+            //     "skus[1-4-8][stock]": "18",
+            //     "skus[1-4-8][status]": "0",
+            //     "skus[1-4-9][picture]": "",
+            //     "skus[1-4-9][price]": "0",
+            //     "skus[1-4-9][market_price]": "0",
+            //     "skus[1-4-9][cost_price]": "0",
+            //     "skus[1-4-9][stock]": "0",
+            //     "skus[1-4-9][status]": "1",
+            //     "skus[1-5-8][picture]": "",
+            //     "skus[1-5-8][price]": "0",
+            //     "skus[1-5-8][market_price]": "0",
+            //     "skus[1-5-8][cost_price]": "0",
+            //     "skus[1-5-8][stock]": "0",
+            //     "skus[1-5-8][status]": "1",
+            //     "skus[1-5-9][picture]": "",
+            //     "skus[1-5-9][price]": "0",
+            //     "skus[1-5-9][market_price]": "0",
+            //     "skus[1-5-9][cost_price]": "0",
+            //     "skus[1-5-9][stock]": "0",
+            //     "skus[1-5-9][status]": "1"
+            // },
+            //统一规格格式
+            // skuData: {
+            //     'price': '80',
+            //     'market_price': '100',
+            //     'cost_price': '60',
+            //     'stock': '999',
+            //     'status': '0',
+            // }
+            //获取SKU数据接口地址,如果为空或者不配置则使用skuData配置
+            //接口要求返回格式参考 skuData.json
+            // skuDataUrl: './json/skuData.json',
+        });*/
+
+    init();
+  });
+  </script>
+</body>
+</html>

+ 1 - 0
data/readme

@@ -0,0 +1 @@
+dever create

+ 2 - 0
index.php

@@ -0,0 +1,2 @@
+<?php
+include('main/index.php');

+ 3 - 0
package.json

@@ -0,0 +1,3 @@
+{
+	"rely": "manage,passport,email"
+}

+ 4 - 0
package/account/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'account');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 7 - 0
package/area/daemon/import.php

@@ -0,0 +1,7 @@
+<?php
+
+define('DEVER_DAEMON', true);
+
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../index.php');
+
+Dever::load('area/import.load');

+ 4 - 0
package/area/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'area');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 2 - 0
package/boot.php

@@ -0,0 +1,2 @@
+<?php
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/email/index.php

@@ -0,0 +1,4 @@
+<?php 
+define('DEVER_PACKAGE', 'email');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/excel/index.php

@@ -0,0 +1,4 @@
+<?php 
+define('DEVER_PACKAGE', 'excel');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/invite/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'invite');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 88 - 0
package/manage/config/base.php

@@ -0,0 +1,88 @@
+<?php
+
+$url = function()
+{
+	$url = Dever::input('loading') ? 'loading=1' : '';
+	$url .= Dever::input('ms') ? '&ms=' . Dever::input('ms') : '';
+
+	return $url;
+};
+
+# 一些基本配置
+$config['base'] = array
+(
+	'url' => $url(),
+
+	# 针对管理系统的配置,开启这个则每次刷新都读取admin的最新数据,测试功能
+	'getAdmin' => true,
+
+	# 开启批量更新
+	'mul_type' => 1,
+
+	# 地图配置
+	'map' => array
+	(
+		'url' => 'https://webapi.amap.com/maps?v=1.4.8&key=b51a0d5f8f977726eeaa070a30bcf3cd',
+	),
+
+	# 后台管理的数据执行权限的设置
+	//'manageAuthData' => 'journal/lib/manage.getManageData',
+
+	# 后台左侧主菜单,定义了这个之后,所有deverapp中的project建立主菜单功能将失效
+	/*
+	'menu' => array
+	(
+		'demand' => array
+		(
+			# 菜单名称
+			'name' => '需求管理',
+			# 哪些项目包含进来,多个用逗号隔开,直接把该项目中的database放到该菜单下
+			'project' => 'demand,service',
+			# 菜单图标 直接使用哪个project的图标
+			'icon' => 'demand',
+			# 排序
+			'order' => 100,
+		),
+
+		'main' => array
+		(
+			# 菜单名称
+			'name' => '系统设置',
+			# 哪些项目包含进来,多个用逗号隔开,直接把该项目中的database放到该菜单下
+			'project' => 'main,score,attr,category',
+			# 菜单图标 直接使用哪个project的图标
+			'icon' => 'main',
+			# 排序
+			'order' => 99,
+		),
+	)
+	*/
+);
+
+# 模板配置
+$config['template'] = array
+(
+	# 使用的模板 注意:定义这个之后,将会强制将本项目模板变成这个
+	'assets' => 'layadmin',
+	'template' => 'layadmin',
+
+	'replace' => array
+	(
+		'css' => '../css/',
+		'lib' => '../lib/',
+		'img' => '../img/',
+		'images' => '../images/',
+		'js' => '../js/',
+		'script' => '../script/',
+
+		# 以下的替换主要用于合并操作(host里的merge项)
+		'font' => '../fonts/',
+	),
+
+	'path' => 'html',
+	'layout' => '',
+
+	'relation' => array(),
+);
+
+return $config;

+ 11 - 0
package/manage/config/plugin.php

@@ -0,0 +1,11 @@
+<?php
+# 注册插件
+
+$config['manage/console.data'] = array
+(
+	# 直接覆盖旧的接口数据
+	//'cover' => 'console.data',
+);
+
+
+return $config;

+ 7 - 0
package/manage/daemon/loop.php

@@ -0,0 +1,7 @@
+<?php
+
+define('DEVER_DAEMON', true);
+
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../index.php');
+
+Dever::load('manage/project.loop');

+ 7 - 0
package/manage/daemon/main.php

@@ -0,0 +1,7 @@
+<?php
+
+define('DEVER_DAEMON', true);
+
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../index.php');
+
+Dever::load('manage/project.cron');

+ 4 - 0
package/manage/index.php

@@ -0,0 +1,4 @@
+<?php 
+define('DEVER_PACKAGE', 'manage');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 88 - 0
package/manage/plugin/Console.php

@@ -0,0 +1,88 @@
+<?php
+
+namespace Manage\Plugin;
+
+use Dever;
+
+class Console
+{
+    public function data()
+    {
+        $where['start'] = Dever::maketime(date('Y-m-d 00:00:00'));
+        $where['end'] = Dever::maketime(date('Y-m-d 23:59:59'));
+
+        $where['status'] = '1,2,3,4,5,6';
+        $today_sell_cash = Dever::db('shop/sell_order')->getCashNum($where);
+        $today_sell_order = Dever::db('shop/sell_order')->getOrderNum($where);
+
+        $where['status'] = '1,2,3,4,5,6';
+        $today_buy_cash = Dever::db('shop/buy_order')->getCashNum($where);
+        $today_buy_order = Dever::db('shop/buy_order')->getOrderNum($where);
+
+        $today_user = Dever::db('passport/user')->total($where);
+        $user = Dever::db('passport/user')->total();
+        $shop = Dever::db('shop/info')->total();
+        $factory = Dever::db('factory/info')->total();
+        $store = Dever::db('store/info')->total();
+
+        $total = 0;
+        $data[] = array
+        (
+            'name' => '当日销售额',
+            'num' => $today_sell_cash['total'] ? round($today_sell_cash['total'], 2) : 0,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '销售订单量',
+            'num' => $today_sell_order,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '采购额',
+            'num' => $today_buy_cash['total'] ? round($today_buy_cash['total'], 2) : 0,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '采购订单量',
+            'num' => $today_buy_order,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '当日用户新增',
+            'num' => $today_user,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '用户总量',
+            'num' => $user,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '门店数',
+            'num' => $shop,
+            'href' => '#',
+        );
+
+        $data[] = array
+        (
+            'name' => '仓库数/工厂数',
+            'num' => $store . ' / ' . $factory,
+            'href' => '#',
+        );
+
+
+        return $data;
+    }
+}

+ 4 - 0
package/message/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'message');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/middleware/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'middleware');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/oauth/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'oauth');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/passport/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'passport');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/pay/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'pay');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/pdf/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'pdf');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/pinyin/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'pinyin');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/poster/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'poster');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/push/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'push');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/qrcode/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'qrcode');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/queue/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'queue');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/score/index.php

@@ -0,0 +1,4 @@
+<?php 
+define('DEVER_PACKAGE', 'score');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/share/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'share');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/short/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'short');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/sms/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'sms');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/token/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'token');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/upload/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'upload');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
package/wechat_applet/index.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_PACKAGE',  'wechat_applet');
+define('DEVER_APP_SETUP', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
src/bao/boot.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_GROUP_ORDER', -2);
+define('DEVER_GROUP_NAME', '宝库管理');
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 2 - 0
src/boot.php

@@ -0,0 +1,2 @@
+<?php
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 4 - 0
src/dai/boot.php

@@ -0,0 +1,4 @@
+<?php
+define('DEVER_GROUP_ORDER', -2);
+define('DEVER_GROUP_NAME', '代理管理');
+include(dirname(__FILE__) . DIRECTORY_SEPARATOR . '../boot.php');

+ 6 - 0
src/dai/seller/assets/manage/html/order_goods.html

@@ -0,0 +1,6 @@
+
+<form class="layui-form form10" action="" target="f10" method="post">
+<iframe id="f10" name="f10" style="display:none;"></iframe>
+<div class="layui-form-item" id="show">
+</div>
+</form>

+ 251 - 0
src/dai/seller/database/buy_order.php

@@ -0,0 +1,251 @@
+<?php
+
+$status = array
+(
+	1 => array('name' => '待支付', 'style' => 'font-weight:bold;color:#F8046E'),
+    2 => array('name' => '待审核', 'style' => 'font-weight:bold;color:#436EEE'),
+    3 => array('name' => '待处理', 'style' => 'font-weight:bold;color:#003366'),
+    4 => array('name' => '待确认', 'style' => 'font-weight:bold;color:#003366'),
+    5 => array('name' => '已完成', 'style' => 'font-weight:bold;color:#0978F8'),
+    6 => array('name' => '已完成(有退款)', 'style' => 'font-weight:bold;color:#0978F8'),
+    7 => array('name' => '已取消', 'style' => 'font-weight:bold;color:#993333'),
+    8 => array('name' => '已退款', 'style' => 'font-weight:bold;color:#993333'),
+    11 => array('name' => '已过期', 'style' => 'font-weight:bold;color:#993333'),
+);
+
+$audit = array
+(
+    1 => '待审核',
+    2 => '审核通过',
+    3 => '审核未通过',
+);
+
+$shop = array();
+$seller_id = Dever::input('search_option_seller_id');
+if ($seller_id) {
+	$shop = function() use($seller_id) {
+		return Dever::db('seller/shop')->state(array('seller_id' => $seller_id, 'status' => 1));
+	};
+}
+
+$seller = function() {
+    return Dever::db('seller/info')->state();
+};
+
+$col = Dever::input('col');
+
+return array
+(
+    # 表名
+    'name' => 'buy_order',
+    # 显示给用户看的名称
+    'lang' => '采购单查询',
+    'order' => 20,
+    'set' => array
+    (
+    	'status' => $status,
+        'audit' => $audit,
+    ),
+    'end' => array
+    (
+        'insert' => 'set/lib/order.updateOrderNum?table=seller/buy_order&prefix=BU',
+    ),
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单号',
+            'default'   => '',
+            'desc'      => '订单号',
+            'match'     => 'is_string',
+            'search'    => 'fulltext',
+            'list_name'	=> '订单信息',
+            'list'      => 'Dever::load("seller/lib/manage.info", "buy", {id})',
+        ),
+
+        'seller_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '经销商',
+            'default'   => '',
+            'desc'      => '经销商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'searchs'    => array
+            (
+                'api' => 'role/seller-like',
+                'col' => 'name',
+                'result' => 'id',
+            ),
+            'search'    => 'select',
+            'option'    => $seller,
+            'value'     => $seller_id,
+            //'list'      => 'Dever::load("seller/info-one#name", {seller_id})',
+        ),
+
+        'seller_shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '门店',
+            'default'   => '',
+            'desc'      => '门店',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $shop,
+            //'list'      => 'Dever::load("seller/shop-one#name", {servicer_shop_id})',
+        ),
+
+        'relate_order_num'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '关联单据号',
+            'default'   => '',
+            'desc'      => '关联单据号',
+            'match'     => 'option',
+            //'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'address'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '收货信息',
+            'default'   => '',
+            'desc'      => '收货信息',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'      => true,
+        ),
+
+        'seller-buy_order_goods'=> array
+		(
+			'name' 		=> '商品设置',
+			'default' 	=> '',
+			'desc' 		=> '商品设置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'order_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+            'list_name' => '商品信息',
+			'list'		=> 'Dever::load("product/lib/manage.getGoods", {id}, "seller/buy_order_goods")',
+		),
+
+        'audit'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '审核状态',
+            'default'   => '2',
+            'desc'      => '审核状态',
+            'match'     => 'is_numeric',
+            'option'    => $audit,
+            'update'    => $col ? 'radio' : false,
+        ),
+
+        'audit_desc'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '审核备注',
+            'default'   => '',
+            'desc'      => '审核备注',
+            'match'     => 'option',
+            'update'    => $col ? 'textarea' : false,
+        ),
+
+        'audit_admin'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核人',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '审核人',
+            //'list'      => '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '2',
+            'desc'      => '订单状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            //'search_after' => '<br />',
+            //'mul'   => true,
+            //'mul_option' => array(2 => '批量审核', 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'    => 'sdate',
+            'list'        => 'date("Y-m-d H:i", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台提交时,检测该值是否为空,多个用逗号隔开
+        'update_check' => 'seller-buy_order_goods',
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+        //'excel' => $excel,
+        //'mul' => $mul,
+
+        'list_button' => array
+        (
+            'list' => array('查看详情', '"buy_order_goods&type=buy&page_type=1&order_id={id}"'),
+
+            'list1' => array('审核', '"buy_order_goods&type=buy&page_type=1&order_id={id}&audit=1"', '{status} == 2'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 159 - 0
src/dai/seller/database/buy_order_goods.php

@@ -0,0 +1,159 @@
+<?php
+
+$status = array
+(
+    1 => '待审',
+    2 => '已审核',
+    3 => '未通过',
+);
+
+return array
+(
+    # 表名
+    'name' => 'buy_order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    'status' => $status,
+    'end' => array
+    (
+        'insert' => 'set/lib/order.updateGoods?table=seller/buy_order_goods',
+        'update' => 'set/lib/order.updateGoods?table=seller/buy_order_goods',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '商品',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'option',
+            'update'    => 'select',
+            'update_search' => 'product/lib/manage.searchProduct?{seller_id}',
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showInfo?cash_col=buy_price', 'product'), 'col' => 'seller_id,seller_shop_id')),
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '库存',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'is_numeric',
+            'update'    => 'show',
+            'value'     => '暂无',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '-1',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
+        'unit_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '单位',
+            'default'   => '',
+            'desc'      => '单位',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => array(0 => '请先选择商品'),
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showPriceByUnit?cash_col=buy_price', 'product'), 'col' => 'seller_id,seller_shop_id,goods')),
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '单价',
+            'default'   => '',
+            'desc'      => '单价',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '数量',
+            'default'   => '1',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'	=> 'text',
+        ),
+
+        '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
+    (
+        'insert' => false,
+        'delete' => false,
+        'page_list' => 'order_goods',
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 220 - 0
src/dai/seller/database/goods.php

@@ -0,0 +1,220 @@
+<?php
+$status = Dever::config('base')->status;
+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,
+        ),
+
+        'seller_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属经销商',
+            'default'   => '',
+            'desc'      => '所属经销商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_seller_id'),
+            'list'      => 'Dever::load("seller/info-one#name", {seller_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-one#name", {goods_id})',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '规格型号',
+            'default'   => '-1',
+            'desc'      => '规格型号',
+            'match'     => 'is_numeric',
+        ),
+
+        'sell_min'       => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '销售起订数',
+            'default'   => '1',
+            'desc'      => '销售起订数',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'buy_min'       => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '采购起订数',
+            'default'   => '1',
+            'desc'      => '采购起订数',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'list'      => 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,
+    ),
+
+    'request' => array
+    (
+        # 后台搜索用到,也可以不加,自动生成
+        'search' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_id' => array('yes-t_1.seller_id'),
+                'status' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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_2.id as value, "" as selected, "" as disabled',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_id' => array('yes-t_1.seller_id'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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.*',
+        ),
+
+        'getDataPage' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_id' => array('yes-t_1.seller_id'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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'),
+            'page' => array(10, 'list'),
+            'col' => '*,t_2.*',
+        ),
+
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => '*',
+        ),
+    ),
+);

+ 295 - 0
src/dai/seller/database/in_order.php

@@ -0,0 +1,295 @@
+<?php
+
+$status = array
+(
+    1 => array('name' => '待审核', 'style' => 'font-weight:bold;color:#436EEE'),
+    2 => array('name' => '已审核', 'style' => 'font-weight:bold;color:#003366'),
+    3 => array('name' => '已驳回', 'style' => 'font-weight:bold;color:#993333'),
+);
+
+$audit = array
+(
+    //1 => '待审核',
+    2 => '审核通过',
+    3 => '审核未通过',
+);
+
+$type = function() {
+    return Dever::db('seller/in_order_type')->state();
+};
+
+$shop = array();
+$seller_id = Dever::input('search_option_seller_id');
+if ($seller_id) {
+	$shop = function() use($seller_id) {
+		return Dever::db('seller/shop')->state(array('seller_id' => $seller_id, 'status' => 1));
+	};
+}
+
+$source_type = array
+(
+    1 => '供应商',
+    2 => '配送商仓库',
+    3 => '经销商门店',
+    10 => '其他',
+);
+
+$seller = function() {
+    return Dever::db('seller/info')->state();
+};
+
+$col = Dever::input('col');
+
+return array
+(
+    # 表名
+    'name' => 'in_order',
+    # 显示给用户看的名称
+    'lang' => '入库单查询',
+    'order' => 10,
+    'set' => array
+    (
+    	'status' => $status,
+        'audit' => $audit,
+    ),
+    'end' => array
+    (
+        'insert' => 'set/lib/order.updateOrderNum?table=seller/in_order&prefix=CI',
+        'update' => 'set/lib/stock.update_commit?table=seller/in_order&stock=seller/shop_goods&type=in&col=seller_shop_id',
+    ),
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单号',
+            'default'   => '',
+            'desc'      => '订单号',
+            'match'     => 'is_string',
+            'search'    => 'fulltext',
+            'list_name'	=> '订单信息',
+            'list'      => 'Dever::load("seller/lib/manage.info", "in", {id})',
+        ),
+
+        'seller_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '经销商',
+            'default'   => '',
+            'desc'      => '经销商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'searchs'    => array
+            (
+                'api' => 'seller/info-like',
+                'col' => 'name',
+                'result' => 'id',
+            ),
+            'search'    => 'select',
+            'option'    => $seller,
+            'value'     => $seller_id,
+            //'list'      => 'Dever::load("seller/info-one#name", {seller_id})',
+        ),
+
+        'seller_shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '仓库',
+            'default'   => '',
+            'desc'      => '仓库',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $shop,
+            //'list'      => 'Dever::load("seller/shop-one#name", {seller_shop_id})',
+        ),
+
+        'source_type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '来源类型',
+            'default'   => '1',
+            'desc'      => '来源类型',
+            'match'     => 'is_numeric',
+        ),
+
+        'source_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '来源',
+            'default'   => '',
+            'desc'      => '来源',
+            'match'     => 'is_numeric',
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '入库类型',
+            'default'   => '1',
+            'desc'      => '入库类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'search'    => 'select',
+            'option'    => $type,
+            //'list'      => true,
+        ),
+
+        'relate_order_num'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '关联单据号',
+            'default'   => '',
+            'desc'      => '关联单据号',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'address'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '收货信息',
+            'default'   => '',
+            'desc'      => '收货信息',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'      => true,
+        ),
+
+        'seller-in_order_goods'=> array
+		(
+			'name' 		=> '商品设置',
+			'default' 	=> '',
+			'desc' 		=> '商品设置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'order_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+            'list_name' => '商品信息',
+			'list'		=> 'Dever::load("goods/lib/manage.getGoods", {id}, "seller/in_order_goods")',
+		),
+
+        'audit'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '审核状态',
+            'default'   => '2',
+            'desc'      => '审核状态',
+            'match'     => 'is_numeric',
+            'option'    => $audit,
+            'update'    => $col ? 'radio' : false,
+        ),
+
+        'audit_desc'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '审核备注',
+            'default'   => '',
+            'desc'      => '审核备注',
+            'match'     => 'option',
+            'update'    => $col ? 'textarea' : false,
+        ),
+
+        'audit_admin'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核人',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '审核人',
+            //'list'      => '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '订单状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            //'search_after' => '<br />',
+            //'mul'   => true,
+            //'mul_option' => array(2 => '批量审核', 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'    => 'sdate',
+            'list'        => 'date("Y-m-d H:i", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台提交时,检测该值是否为空,多个用逗号隔开
+        'update_check' => 'seller-in_order_goods',
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+        //'excel' => $excel,
+        //'mul' => $mul,
+
+        'button' => array
+        (
+            //'导出订单明细' => array('excel', 'shop/excel.sell_order'),
+            '类型配置' => array('list', 'in_order_type&oper_parent=in_order'),
+        ),
+
+        'list_button' => array
+        (
+            'list' => array('查看详情', '"in_order_goods&type=in&page_type=1&order_id={id}"'),
+
+            'fast' => array('审核', '"in_order&where_id={id}&col=audit,audit_desc"', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 226 - 0
src/dai/seller/database/in_order_goods.php

@@ -0,0 +1,226 @@
+<?php
+
+$status = array
+(
+    1 => '待审',
+    2 => '已审核',
+    3 => '未通过',
+);
+
+return array
+(
+    # 表名
+    'name' => 'in_order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    'status' => $status,
+    # 验证供应商商品是否存在
+    'start' => array
+    (
+        'insert' => 'seller/lib/manage.check',
+    ),
+    'end' => array
+    (
+        'insert' => 'set/lib/order.updateGoods?table=seller/in_order_goods',
+        'update' => 'set/lib/order.updateGoods?table=seller/in_order_goods',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '商品',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'option',
+            'update'    => 'select',
+            'update_search' => 'product/lib/manage.searchProduct?{supplier_id}',
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showInfo?cash_col=buy_price', 'product'), 'col' => 'seller_shop_id,source_type,source_id')),
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '库存',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'is_numeric',
+            'update'    => 'show',
+            'value'     => '暂无',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '-1',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
+        'shop_goods_list_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联仓库商品id',
+            'default'   => '',
+            'desc'      => '关联仓库商品id',
+            'match'     => 'is_numeric',
+            'value'     => '暂无',
+        ),
+
+        'unit_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '单位',
+            'default'   => '',
+            'desc'      => '单位',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => array(0 => '请先选择商品'),
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showPriceByUnit?cash_col=buy_price', 'product'), 'col' => 'source_type,source_id,seller_shop_id,goods')),
+        ),
+
+        'batch'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '入库批次号',
+            'default'   => '',
+            'desc'      => '批次号',
+            'match'     => 'option',
+            'update'    => 'text',
+            'value'     => date('Ymd'),
+        ),
+
+        'sdate'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '生产日期',
+            'default'   => '',
+            'desc'      => '生产日期',
+            'match'     => 'option',
+            'update'    => 'day',
+            'callback'  => 'maketime',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '单价',
+            'default'   => '',
+            'desc'      => '单价',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '数量',
+            'default'   => '1',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'	=> 'text',
+        ),
+
+        '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
+    (
+        'insert' => false,
+        'delete' => false,
+        'page_list' => 'order_goods',
+    ),
+
+    'request' => array
+    (
+        'getNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-t_2.cdate', '>='),
+                'end' => array('yes-t_2.cdate', '<='),
+                'start_o' => array('yes-t_2.operdate', '>='),
+                'end_o' => array('yes-t_2.operdate', '<='),
+                'seller_id' => array('yes-t_2.seller_id'),
+                'seller_shop_id' => array('yes-t_2.seller_shop_id'),
+                'goods_id' => array('yes-t_1.goods_id'),
+                'status' => array('yes-t_2.status', 'in'),
+                'state_2' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+                'status_1' => 'yes-t_1.status-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'seller/in_order',
+                    'type' => 'left join',
+                    'on' => array('order_id','id'),
+                ),
+            ),
+            'type' => 'all',
+            'group' => 't_2.seller_id, t_2.seller_shop_id, t_1.goods_id',
+            'col' => 'id,t_2.seller_id, t_2.seller_shop_id, t_1.goods_id,sum(t_1.num) as num',
+        ),
+    ),
+);

+ 106 - 0
src/dai/seller/database/in_order_type.php

@@ -0,0 +1,106 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'in_order_type',
+	# 显示给用户看的名称
+	'lang' => '入库单类型',
+	# 是否显示在后台菜单
+	'order' => 1,
+	'menu'	=> false,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '类型名称',
+			'default' 	=> '',
+			'desc' 		=> '类型名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'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,
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+		'list_button' => array
+        (
+        	'edit' => array('编辑'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认类型", 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 478 - 0
src/dai/seller/database/info.php

@@ -0,0 +1,478 @@
+<?php
+
+$type = function()
+{
+	$array = array();
+	$data = Dever::load('seller/type-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+$category = function()
+{
+	$array = array();
+	$data = Dever::load('set/category-getTop');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+$price = function()
+{
+    $array = array
+    (
+        -1 => '默认模板',
+    );
+    $data = Dever::load('goods/price-state');
+    if($data)
+    {
+        $array += $data;
+    }
+    return $array;
+};
+
+$func = array
+(
+    'base' => '基础运营',
+    'news' => '文章资讯',
+    'agent' => '分销代理',
+	'product' => '平台商品',
+    'resource' => '平台资源',
+    'self_product' => '自营商品',
+    'self_resource' => '自营资源',
+    'yuding' => '场地预定',
+);
+
+$identity = array
+(
+	1 => '个人',
+	2 => '个体户',
+	3 => '企业',
+);
+
+$status = array
+(
+    1 => '启用',
+    2 => '禁用',
+);
+
+$account = function() {
+    return Dever::load('account/api')->getConfig('seller/info');
+};
+
+return array
+(
+	# 表名
+	'name' => 'info',
+	# 显示给用户看的名称
+	'lang' => '经销商列表',
+	# 是否显示在后台菜单
+	'order' => 100,
+    'check' => 'code',
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '经销商ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			//'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '经销商名称',
+			'default' 	=> '',
+			'desc' 		=> '经销商名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+        'code'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '经销商编码',
+            'default'   => '',
+            'desc'      => '经销商编码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+		'info'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '经销商介绍',
+            'default'   => '',
+            'desc'      => '经销商介绍',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+		'type_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '经销商类型',
+            'default'   => '1',
+            'desc'      => '经销商类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            //'list'		=> true,
+        ),
+
+        'seller-shop'=> array
+        (
+            'name'      => '门店设置',
+            'default'   => '',
+            'desc'      => '门店设置',
+            'match'     => 'option',
+            # 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+            'sync'      => array('id', 'seller_id'),
+            'update'    => array(1),
+            # 1纵向展示 2横向展示
+            'update_type' => 2,
+            'list_name' => '门店列表',
+            'list'      => 'Dever::load("seller/lib/manage.getShop", {id})',
+        ),
+
+        'account'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '资金账户-可以选择多个资金账户,账户余额可用于提现和分销',
+            'default'   => '',
+            'desc'      => '资金账户',
+            'match'     => 'is_string',
+            'update'    => 'checkbox',
+            'option'    => $account,
+            'tab'       => 1,
+            //'list_name' => '账户信息',
+            //'list'      => 'Dever::load("account/api.getInfo", {id}, "{account}")',
+        ),
+
+        'func'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '基础功能',
+            'default'   => 'base',
+            'desc'      => '基础功能',
+            'match'     => 'is_string',
+            'update'    => 'checkbox',
+            'option'    => $func,
+            'tab'       => 1,
+            'control'   => 'func',
+        ),
+
+        'category'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '平台商品属性分类-如不选择就是可以销售所有商品属性分类下的商品',
+            'default'   => '',
+            'desc'      => '商品属性分类',
+            'match'     => 'is_string',
+            'update'    => 'checkbox',
+            'option'    => $category,
+            'tab'       => 1,
+            'show'      => 'func=product',
+        ),
+
+        'price_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '平台商品价格模板',
+            'default'   => '-1',
+            'desc'      => '平台商品价格模板',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $price,
+            'tab'       => 1,
+            'show'      => 'func=product',
+        ),
+
+        'commission'        => array
+        (
+            'type'      => 'varchar-20',
+            'name'      => '销售佣金调整-针对每个商品的销售佣金做统一调整,如填写5%,就是在原有销售佣金的基础上增加5%佣金,设置为0则不做任何调整,设置为no,则佣金为0',
+            'default'   => '0',
+            'desc'      => '销售佣金调整',
+            'match'     => 'option',
+            'update'    => 'text',
+            'tab'       => 1,
+            'show'      => 'func=agent',
+        ),
+
+		'truename'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '联系人姓名',
+            'default'   => '',
+            'desc'      => '请输入联系人姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'		=> 2,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '联系人电话',
+            'default'   => '',
+            'desc'      => '请输入联系人电话',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'		=> 2,
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '联系人所在区县',
+            'default'   => '',
+            'desc'      => '联系人所在区县',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=3', 'area'),
+            //'list'      => 'Dever::load("area/api.string", "{area}")',
+            'tab'		=> 2,
+        ),
+
+        'province'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '省份',
+            'default'   => '',
+            'desc'      => '省份',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'       => 2,
+        ),
+
+        'city'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '城市',
+            'default'   => '',
+            'desc'      => '城市',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'       => 2,
+        ),
+
+        'county'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '县区',
+            'default'   => '',
+            'desc'      => '县区',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'       => 2,
+        ),
+
+        'address'       => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '联系人详细地址',
+            'default'   => '',
+            'desc'      => '联系人详细地址',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+            'tab'		=> 2,
+        ),
+
+        'identity'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '经销商身份',
+            'default'   => '1',
+            'desc'      => '经销商身份',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $identity,
+            'control'	=> 'identity',
+            'tab'		=> 3,
+        ),
+
+        'idcard_front'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证正面-如果是个人,这里上传联系人身份证,如果是个体户或者企业,这里上传法人身份证',
+            'default'   => '',
+            'desc'      => '身份证正面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'tab'		=> 3,
+        ),
+
+        'idcard_back'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证背面-如果是个人,这里上传联系人身份证,如果是个体户或者企业,这里上传法人身份证',
+            'default'   => '',
+            'desc'      => '身份证背面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'tab'		=> 3,
+        ),
+
+        'company_license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '营业执照',
+            'default'   => '',
+            'desc'      => '企业营业执照',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'show'		=> 'identity=2,3',
+            'tab'		=> 3,
+        ),
+
+        'company_name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '企业全称',
+            'default'   => '',
+            'desc'      => '企业全称',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'show'      => 'identity=2,3',
+            'tab'       => 3,
+        ),
+
+        'company_number'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '社会信用代码',
+            'default'   => '',
+            'desc'      => '社会信用代码',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'show'      => 'identity=2,3',
+            'tab'       => 3,
+        ),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> 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
+	(
+        'delete' => false,
+		'tab' => array('基本设置', '功能设置', '联系人信息', '认证信息'),
+		'button' => array
+        (
+            //'类型配置' => array('list', 'type&oper_parent=seller'),
+        ),
+        'list_button' => array
+        (
+            'br1' => array('<br />'),
+            'location' => array('分配供应商', Dever::url('lib/set.home?role=seller', 'supplier')),
+            'location1' => array('分配配送商', Dever::url('lib/set.home?role=seller', 'servicer')),
+            'location2' => array('商品设置', Dever::url('lib/set.home?project=seller&table=goods&info=info', 'goods')),
+            'add' => array('采购下单', 'buy_order&oper_table=info&search_option_seller_id={id}&oper_save_jump=buy_order'),
+            'add1' => array('代客下单', 'buy_order&oper_table=info&search_option_seller_id={id}&oper_save_jump=buy_order'),
+            'br4' => array('<br />'),
+            'fast_add' => array('账户操作', 'push&project=account&oper_table=info&oper_project=seller&uid={id}'),
+            'list' => array('账户列表', 'info&project=account&oper_table=info&oper_project=seller&search_option_uid={id}', '"{account}"'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,code,type_id,state,cdate',
+		'value' => array
+		(
+			'"平台经销商", "platform", 1, 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		'like' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'name' => array('yes', 'like'),
+                'id' => 'yes',
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => '*|id',
+        ),
+	)
+);

+ 130 - 0
src/dai/seller/database/servicer.php

@@ -0,0 +1,130 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'servicer',
+    # 显示给用户看的名称
+    'lang' => '经销商配送商关系表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'seller_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '经销商ID',
+			'default' 	=> '-1',
+			'desc' 		=> '经销商ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_seller_id'),
+		),
+
+        'servicer_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '配送商ID',
+            'default'   => '',
+            'desc'      => '配送商ID',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_servicer_id'),
+            'list'      => 'Dever::load("supplier/info-one#name", {servicer_id})',
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-优先级,数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'search'    => 'order',
+            'list_name' => '排序',
+            '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
+    (
+        
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            'option' => array
+            (
+                'seller_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => '*|servicer_id',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_id' => array('yes-t_1.seller_id'),
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'servicer/info',
+                    'type' => 'left join',
+                    'on' => array('servicer_id','id'),
+                    'col' => 'servicer_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*,t_2.name,t_2.id as id|id',
+        ),
+    ),
+);

+ 282 - 0
src/dai/seller/database/shop.php

@@ -0,0 +1,282 @@
+<?php
+
+
+$stock = array
+(
+    1 => '独立库存',
+    2 => '共享库存',
+);
+$shop = function()
+{
+	$array = array();
+	$data = Dever::load('seller/shop-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+$type = array
+(
+	1 => '实体店',
+	2 => '网店',
+	3 => '虚拟店',
+);
+
+$status = array
+(
+	1 => '启用',
+	2 => '禁用',
+);
+
+$set = Dever::input('set', 2);
+
+return array
+(
+	# 表名
+	'name' => 'shop',
+	# 显示给用户看的名称
+	'lang' => '经销商门店',
+	# 是否显示在后台菜单
+	'order' => 10,
+	'menu' => false,
+	'check' => 'seller_id,code',
+
+	'status' => $status,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'seller_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '经销商ID',
+			'default' 	=> '-1',
+			'desc' 		=> '经销商ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_seller_id'),
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '门店名称',
+			'default' 	=> '',
+			'desc' 		=> '门店名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'code'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '门店编码',
+            'default'   => '',
+            'desc'      => '门店编码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '门店类型-实体店需要设置门店地址',
+            'default'   => '2',
+            'desc'      => '门店类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'list'		=> true,
+            'control'	=> 'type',
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '所在区县',
+            'default'   => '',
+            'desc'      => '所在区县',
+            'match'     => 'is_string',
+            'search'    => 'linkage',
+            'update'    => $set == 1 ? 'linkage' : false,
+            'option'    => Dever::url('api.get?level_total=3', 'area'),
+            //'list'      => 'Dever::load("area/api.string", "{area}")',
+            'show'		=> 'type=1',
+        ),
+
+        'address'       => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '详细地址',
+            'default'   => '',
+            'desc'      => '详细地址',
+            'match'     => 'is_string',
+            'update'    => $set == 1 ? 'text' : false,
+            'show'		=> 'type=1',
+        ),
+
+        'truename'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '联系人姓名',
+            'default'   => '',
+            'desc'      => '请输入联系人姓名',
+            'match'     => 'is_string',
+            'update'    => $set == 1 ? 'text' : false,
+            'search'    => 'fulltext',
+            'show'		=> 'type=1',
+        ),
+
+        'tel'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '联系人电话',
+            'default'   => '',
+            'desc'      => '请输入联系人电话',
+            'match'     => 'is_numeric',
+            'update'    => $set == 1 ? 'text' : false,
+            'search'    => 'fulltext',
+            'show'		=> 'type=1',
+        ),
+
+        'stock'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '库存设置-如果商品有库存,这里设置库存是否独立或共享,独立库存就是该门店自己使用一套库存,共享库存就是和其他门店共享一套库存,共享库存将无法设置商品',
+            'default'   => '1',
+            'desc'      => '库存设置',
+            'match'     => 'is_numeric',
+            'update'    => $set == 1 ? 'radio' : false,
+            'option'    => $stock,
+            'control'	=> 'stock',
+            'tab'		=> 1,
+        ),
+
+        'stock_shop'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '共享门店-选择和哪个门店共享一套库存',
+            'default'   => '-1',
+            'desc'      => '共享经销商',
+            'match'     => 'is_numeric',
+            'update'    => $set == 1 ? 'select' : false,
+            'option'    => $shop,
+            'show'		=> 'stock=2',
+            'tab'		=> 1,
+        ),
+
+        'company_license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '营业执照',
+            'default'   => '',
+            'desc'      => '企业营业执照',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'tab'		=> 2,
+        ),
+
+        'company_name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '企业全称',
+            'default'   => '',
+            'desc'      => '企业全称',
+            'match'     => 'option',
+            'update'    => 'text',
+            'tab'       => 2,
+        ),
+
+        'company_number'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '社会信用代码',
+            'default'   => '',
+            'desc'      => '社会信用代码',
+            'match'     => 'option',
+            'update'    => 'text',
+            'tab'       => 2,
+        ),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> true,
+		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '是否启用',
+			'default' 	=> '1',
+			'desc' 		=> '是否启用',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $status,
+			'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
+	(
+		'tab' => array('基本信息', '商品设置', '门店认证'),
+		'delete' => false,
+        
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 286 - 0
src/dai/seller/database/shop_goods.php

@@ -0,0 +1,286 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'shop_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,
+        ),
+
+        'seller_shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '经销商门店',
+            'default'   => '',
+            'desc'      => '经销商门店',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_seller_shop_id'),
+            'list'      => 'Dever::load("seller/shop-one#name", {seller_shop_id})',
+        ),
+
+        'goods-info_sku-code'=> array
+        (
+            'name'      => '商品编码',
+            'default'   => '',
+            'desc'      => '商品编码',
+            'match'     => 'option',
+            # 读取另外表的关联方式
+            'sync'      => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
+            'search'    => array
+            (
+                'api' => 'goods/info_sku-all',
+                'col' => 'code',
+                'result' => 'id',
+                'search' => 'sku_id',
+            ),
+            'list'      => true,
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'search'    => array
+            (
+                'api' => 'goods/info-all',
+                'col' => 'name',
+                'result' => 'id',
+                'search' => 'goods_id',
+            ),
+            'update'    => 'select',
+            'update_search' => 'goods/lib/manage.search',
+            'list'      => 'Dever::load("goods/lib/info.getBaseInfo#aname", "{goods_id}", "{sku_id}")',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '规格型号',
+            'default'   => '-1',
+            'desc'      => '规格型号',
+            'match'     => 'is_numeric',
+        ),
+
+        'unit_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '基本单位',
+            'default'   => '',
+            'desc'      => '基本单位',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("set/unit-one#name", {unit_id})',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库均价',
+            'default'   => '',
+            'desc'      => '入库均价',
+            'match'     => 'option',
+            'list'      => true,
+        ),
+
+        'in_num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库总库存',
+            'default'   => '0',
+            'desc'      => '入库总库存',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+
+        'out_num'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '出库总库存',
+            'default'   => '0',
+            'desc'      => '出库总库存',
+            'match'     => 'option',
+            'list'      => 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,
+        'list_button' => array
+        (
+            'list' => array('查看详情', '"shop_goods_list&oper_table=shop_goods&top_table=info&search_option_shop_goods_id={id}"'),
+        ),
+    ),
+
+    'request' => array
+    (
+        # 后台搜索用到,也可以不加,自动生成
+        'search' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'name' => array('yes-t_2.name', 'like'),
+                'seller_shop_id' => array('yes-t_1.seller_shop_id'),
+                'status' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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'),
+            'page' => array(10, 'list'),
+            'col' => '*, t_2.*,t_2.id as value, "" as selected, "" as disabled',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_shop_id' => array('yes-t_1.seller_shop_id'),
+                'sell_type' => array('yes-t_2.sell_type'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,cdate',
+        ),
+
+        'getDataPage' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_shop_id' => array('yes-t_1.seller_shop_id'),
+                'sell_type' => array('yes-t_2.sell_type'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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'),
+            'page' => array(10, 'list'),
+            'col' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,t_1.cdate,t_1.id as id',
+        ),
+
+        # 获取某个sku的单条数据
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_shop_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => '*,(sum(in_num)-sum(out_num)) as total,AVG(cash) as cash',
+        ),
+
+        # 获取单位下的数据
+        'getUnit' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_shop_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => '*,(in_num-out_num) as total|unit_id',
+        ),
+    ),
+);

+ 245 - 0
src/dai/seller/database/shop_goods_list.php

@@ -0,0 +1,245 @@
+<?php
+
+$info = '';
+$shop_goods_id = Dever::input('search_option_shop_goods_id');
+if ($shop_goods_id) {
+    $shop_goods = Dever::db('seller/shop_goods')->find($shop_goods_id);
+    if ($shop_goods) {
+        $shop = Dever::db('seller/shop')->find($shop_goods['seller_shop_id']);
+        $seller = Dever::db('seller/info')->find($shop['seller_id']);
+        $goods_info = Dever::load('goods/lib/info')->getBaseInfo($shop_goods['goods_id'], $shop_goods['sku_id']);
+        $info = '<blockquote class="layui-elem-quote">';
+        $info .= $seller['name'] . '.' . $shop['name'];
+        $info .= ' -> ';
+        $info .= '<b>' . $goods_info['aname'] . '('.$goods_info['code'].')</b>';
+        $info .= '<br />';
+        $info .= '入库均价:' . '<b>' . $shop_goods['cash'] . '</b>';
+        $info .= ' 入库总库存:' . '<b>' . $shop_goods['in_num'] . '</b>';
+        $info .= ' 出库总库存:' . '<b>' . $shop_goods['out_num'] . '</b>';
+        $info .= '</blockquote>';
+    }
+}
+$config = array
+(
+    # 表名
+    'name' => 'shop_goods_list',
+    # 显示给用户看的名称
+    'lang' => '商品价格设置',
+    'order' => 200,
+    'menu' => false,
+    'info' => $info,
+
+
+    # 数据结构 不同的字段放这里
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'list'        => true,
+        ),
+
+        'seller_shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属配送商',
+            'default'   => '',
+            'desc'      => '所属配送商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_seller_shop_id'),
+            //'list'      => 'Dever::load("seller/shop-one#name", {seller_shop_id})',
+        ),
+
+        'shop_goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品id',
+            'default'   => '',
+            'desc'      => '商品id',
+            'match'     => 'is_numeric',
+        ),
+
+        'batch'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '入库批次号',
+            'default'   => '',
+            'desc'      => '入库批次号',
+            'match'     => 'option',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'sdate'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '生产日期',
+            'default'   => '',
+            'desc'      => '生产日期',
+            'match'     => 'option',
+            'update'    => 'day',
+            'callback'  => 'maketime',
+            'search'    => 'day',
+            'list'      => '{sdate} ? date("Y-m-d H:i:s", {sdate}) : "-"',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库单价',
+            'default'   => '',
+            'desc'      => '入库单价',
+            'match'     => 'option',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'in_num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库库存',
+            'default'   => '0',
+            'desc'      => '入库库存',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+
+        'out_num'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '出库库存',
+            'default'   => '0',
+            'desc'      => '出库库存',
+            'match'     => 'option',
+            'list'      => 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,
+        //'excel' => array(array('导出门店库存', '门店库存', '')),
+        'page_list_table' => 'sku',
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+       	# 列表 先入先出
+        'getList' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_shop_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('sdate' => 'asc', 'batch' => 'asc', 'id' => 'asc'),
+            'col' => '*,in_num-out_num as total',
+        ),
+
+        # 获取某个仓库商品下的数据
+        'getOneByshop' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'shop_goods_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'group' => 'shop_goods_id',
+            'col' => 'id,sum(in_num) as in_num, sum(out_num) as out_num,AVG(cash) as cash',
+        ),
+
+        # 更新入库库存
+        'inUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'in_num' => array('yes', '+='),
+            ),
+        ),
+
+        # 更新出库库存
+        'outUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'out_num' => array('yes', '+='),
+            ),
+        ),
+
+        # 更新入库在途库存
+        'onInUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'on_in_num' => array('yes', '+='),
+            ),
+        ),
+
+        # 更新出库在途库存
+        'onOutUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'on_out_num' => array('yes', '+='),
+            ),
+        ),
+    ),
+);
+
+return $config;

+ 115 - 0
src/dai/seller/database/shop_store.php

@@ -0,0 +1,115 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'shop_store',
+    # 显示给用户看的名称
+    'lang' => '门店仓库配送关系表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'shop_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '门店ID',
+			'default' 	=> '-1',
+			'desc' 		=> '门店ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_shop_id'),
+		),
+
+        'servicer_store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '仓库ID',
+            'default'   => '',
+            'desc'      => '仓库ID',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_servicer_store_id'),
+            'list'      => 'Dever::load("servicer/store-one#name", {servicer_store_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
+    (
+        'getAll' => array
+        (
+            'option' => array
+            (
+                'seller_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => '*|servicer_store_id',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_id' => array('yes-t_1.seller_id'),
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'servicer/info',
+                    'type' => 'left join',
+                    'on' => array('servicer_store_id','id'),
+                    'col' => 'servicer_store_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*,t_2.name,t_2.id as id|id',
+        ),
+    ),
+);

+ 130 - 0
src/dai/seller/database/supplier.php

@@ -0,0 +1,130 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'supplier',
+    # 显示给用户看的名称
+    'lang' => '经销商供应商关系表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'seller_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '经销商ID',
+			'default' 	=> '-1',
+			'desc' 		=> '经销商ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_seller_id'),
+		),
+
+        'supplier_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '供应商ID',
+            'default'   => '',
+            'desc'      => '供应商ID',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_supplier_id'),
+            'list'      => 'Dever::load("supplier/info-one#name", {supplier_id})',
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-优先级,数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'search'    => 'order',
+            'list_name' => '排序',
+            '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
+    (
+        
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            'option' => array
+            (
+                'seller_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => '*|supplier_id',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'seller_id' => array('yes-t_1.seller_id'),
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'supplier/info',
+                    'type' => 'left join',
+                    'on' => array('supplier_id','id'),
+                    'col' => 'supplier_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*,t_2.name,t_2.id as id|id',
+        ),
+    ),
+);

+ 105 - 0
src/dai/seller/database/type.php

@@ -0,0 +1,105 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'type',
+	# 显示给用户看的名称
+	'lang' => '经销商类型',
+	# 是否显示在后台菜单
+	'order' => 1,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '类型名称',
+			'default' 	=> '',
+			'desc' 		=> '类型名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'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,
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+		'list_button' => array
+        (
+        	'edit' => array('编辑'),
+        ),
+	),
+
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"平台自营", 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 8 - 0
src/dai/seller/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'seller');
+define('DEVER_APP_LANG', '经销商');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 92);
+define('DEVER_MANAGE_ICON', 'layui-icon-username');
+include(DEVER_APP_PATH . '../boot.php');

+ 108 - 0
src/dai/seller/lib/Manage.php

@@ -0,0 +1,108 @@
+<?php
+
+namespace Seller\Lib;
+
+use Dever;
+
+class Manage
+{
+    public function __construct()
+    {
+        Dever::load('manage/auth.init');
+    }
+
+    # 获取订单信息
+    public function info($type = 'in', $id)
+    {
+        $info = Dever::db('seller/'.$type.'_order')->find($id);
+
+        $string = '';
+
+        $string = $info['order_num'];
+
+        $seller = Dever::db('seller/info')->one($info['seller_id']);
+
+        $string .= '<br />' . $seller['name'];
+
+        $shop = Dever::db('seller/shop')->one($info['seller_shop_id']);
+
+        $string .= '.' . $shop['name'];
+
+        if (isset($info['supplier_id'])) {
+            $supplier = Dever::db('supplier/info')->one($info['supplier_id']);
+
+            $string .= '<br />' . $supplier['name'];
+        }
+
+        if (isset($info['servicer_id'])) {
+            $servicer = Dever::db('servicer/info')->one($info['servicer_id']);
+
+            $string .= '<br />' . $servicer['name'];
+
+            if (isset($info['servicer_store_id'])) {
+	            $store = Dever::db('servicer/store')->one($info['servicer_store_id']);
+
+	            $string .= '.' . $store['name'];
+	        }
+        }
+
+        if ($type == 'in' || $type == 'out') {
+        	$type = Dever::db('seller/'.$type.'_order_type')->one($info['type']);
+        	$string .= '<br />' . $type['name'];
+        }
+
+        $string .= '<br />' . $info['info'];
+
+        return $string;
+    }
+
+    # 查看详情
+    public function show()
+    {
+        $type = Dever::input('type');
+        return Dever::load('set/lib/order')->show('seller/'.$type.'_order', 'seller/info', 'seller_id', '经销商');
+    }
+
+
+    public function getShop($id)
+    {
+        $table = array();
+        $table['head'] = array('门店名称', '门店编码', '操作');
+        $table['body'] = array();
+
+        $data = Dever::db('seller/shop')->select(array('seller_id' => $id));
+
+        if ($data) {
+        	$status = Dever::db('seller/shop')->config['status'];
+            foreach ($data as $k => $v) {
+            	$status_name = '';
+            	if ($v['status'] == 2) {
+            		$status_name = '(已禁用)';
+            	}
+            	$url = Dever::url('project/database/update?project=seller&table=shop&oper_save_table=info&set=1&where_id='.$v['id'], 'manage');
+            	$oper = '<a class="layui-btn" onclick="fastEdit($(this),\''.$url.'\',\'编辑门店信息\', \'\')">编辑</a>';
+
+                $url = Dever::url('project/database/list?project=seller&table=shop_goods&oper_table=info&search_option_seller_shop_id='.$v['id'], 'manage');
+            	$oper .= '<a class="layui-btn" href="'.$url.'">商品清单</a>';
+
+                $url = Dever::url('lib/set_store.home?role=seller&table=shop', 'servicer');
+                $oper .= '<a class="layui-btn" href="'.$url.'">分配仓库</a>';
+
+                $table['body'][$k][] = $v['name'] . $status_name;
+                $table['body'][$k][] = $v['code'];
+                $table['body'][$k][] = $oper;
+            }
+        }
+        $body[''] = array
+        (
+            'type' => 'table',
+            'content' => $table,
+        );
+
+        if ($table['body']) {
+            return Dever::show('', $body);
+        } else {
+            return '暂无';
+        }
+    }
+}

+ 5 - 0
src/dai/seller/template/manage/order_goods.php

@@ -0,0 +1,5 @@
+<?php
+
+$view
+->fetch('#show', 'seller/lib/manage.show')
+->display();

+ 6 - 0
src/dai/servicer/assets/manage/html/order_goods.html

@@ -0,0 +1,6 @@
+
+<form class="layui-form form10" action="" target="f10" method="post">
+<iframe id="f10" name="f10" style="display:none;"></iframe>
+<div class="layui-form-item" id="show">
+</div>
+</form>

+ 341 - 0
src/dai/servicer/assets/pc/html/set_servicer.html

@@ -0,0 +1,341 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
+<meta name="author" content="siweiyong 2602812659@qq.com"/>
+<title>设置配送商</title>
+<link rel="stylesheet" href="../script/lib/miniui/themes/default/miniui.css">
+<link rel="stylesheet" href="../script/lib/layui/css/layui.css" />
+<link rel="stylesheet" href="../script/lib/cashier/common.css">
+<link rel="stylesheet" href="../script/lib/layui/admin/modules/plugin/formselects/formselects.css" media="all" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/miniui/miniui.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+</head>
+<body style="background: #F6F7F9;">
+<div class="main">
+<form class="layui-form" lay-filter="form">
+    <div class="layui-row">
+        <div class="main_left layui-col-xs12 layui-col-md3">
+            <div class="layui-row">
+                <div class="top">
+                    <i class="layui-icon layui-icon-app"></i>配送商列表
+                </div>
+                <div class="left_main">
+                    <input id="key" class="mini-textbox" onenter="onKeyEnter" value="请输入配送商名称" onclick="setVal('key')"/>
+                    <a class="mini-button" onclick="search()">查询</a> 
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="addGoods()">一键添加</button>
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="delGoods()">一键删除</button>
+                    <ul id="tree1" class="mini-tree" url="<{$url}>" showTreeIcon="true" textField="name" idField="id" expandOnLoad="true" onNodeClick="onNodeClick">
+                    </ul>
+
+                </div>
+            </div>
+        </div>
+        <div class="main_right layui-col-xs12 layui-col-md9">
+            <div class="layui-row">
+                <div class="top">
+                    <label>切换<{$name}>:</label>
+                    <div class="layui-input-inline">
+
+                        <div><select xm-select="sid" xm-select-skin="normal" xm-select-search="<{$search}>" xm-select-search-type="dl" xm-select-radio="" class="update_value form-control layui-input layui-select" name="sid" id="sid"  ></select></div>
+
+                    </div>
+                    <div class="layui-input-inline">
+                        <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="setShop()">确认切换</button>
+                    </div>
+                </div>
+                <div class="goods_list" style="height:645px;">
+                    <table class="layui-table">
+                        <thead>
+                            <tr>
+                                <th lay-data="{field:'id'}">配送商ID</th>
+                                <th lay-data="{field:'id'}">配送商编码</th>
+                                <th lay-data="{field:'name'}">配送商名称</th>
+                                <th lay-data="{field:'name'}">配送商类型</th>
+                                <th lay-data="{field:'operation'}">操作</th>
+                            </tr>
+                        </thead>
+                        <tbody id="goods">
+                            
+                        </tbody>
+                    </table>
+                </div>
+                <div class="total ft16">
+                    合计:【<span> 分配配送商总数:<i class="totalNum">0</i> </span>】
+                </div>
+                <div class="towbtn">
+                    <input type="button" id="settlement" value="确认分配">
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+</form>
+</div>
+<script>
+    var form;
+    layui.config(
+    {
+        base: '../script/lib/layui/admin/' //静态资源所在路径
+        ,version: true
+    }).extend(
+    {
+        index: 'lib/index', //主入口模块
+        formSelects: 'plugin/formselects/formselects'
+    }).use(['index', 'contlist', 'table', 'form', 'formSelects','layer'], function()
+    {
+        var table = layui.table;
+        form = layui.form; 
+        var formSelects = layui.formSelects;
+    });
+
+    $(function()
+    {
+        $("#settlement").click(function(){
+            var url = '<{$submit}>';
+            var id = '<{$id}>';
+            var role = '<{$role}>';
+
+            layui.layer.confirm('确定进行此项设置吗?', function() {
+                var goods_string = JSON.stringify(goods);
+
+                var data = {};
+                data = {id:id, role:role, value:goods_string};
+                $.post(url, data, function(t) {
+                    t = JSON.parse(t);
+                    if (t.status == 1) {
+                        layui.layer.alert('设置成功', function(index){
+                          if (t.data == 'refer') {
+                                history.back();
+                            } else {
+                                location.href = t.data;
+                            }
+                          layer.close(index);
+                        });
+                    } else {
+                        layui.layer.alert(t.msg);
+                    }
+                });
+            });
+        })
+    })
+    var goods = {};
+    var del_goods = {};
+    mini.parse();
+    var tree = mini.get("tree1");
+    for (var i in tree.data) {
+        if (typeof(tree.data[i].children) == 'object') {
+            if (tree.data[i].children.length > 0) {
+                for (var j in tree.data[i].children) {
+                    if(tree.data[i].children[j].select == 1) {
+                        setGoods(tree.data[i].children[j]);
+                    }
+                }
+            } else if(tree.data[i].select == 1) {
+                setGoods(tree.data[i]);
+            }
+        }
+    }
+    function search() 
+    {
+        var key = mini.get("key").getValue();
+        if (key == "") {
+            tree.clearFilter();
+        } else {
+            key = key.toLowerCase();                
+            tree.filter(function (node) {
+                var name = node.name ? node.name.toLowerCase() : "";
+                if (name.indexOf(key) != -1) {
+                    return true;
+                }
+            });
+        }
+    }
+    function onKeyEnter(e)
+    {
+        search();
+    }
+
+    function onNodeClick()
+    {
+        var tree=mini.get("tree1");
+        node=tree.getSelectedNode();
+        if(node.end) {
+            setGoods(node);
+        }
+    }
+
+    function setGoods(node)
+    {
+        if (node.id) {
+            var key = node.id;
+            if (!goods[key]) {
+                goods[key] = node;
+                create(node);
+                setTotal();
+            } else {
+                add(key);
+            }
+        }
+    }
+
+    function unsetGoods(node)
+    {
+        if (node.id) {
+            if (goods[node.id]) {
+                delete goods[node.id];
+                get(node.id).remove();
+            }
+        }
+    }
+
+    function get(key)
+    {
+        return $('#goods_' + key);
+    }
+
+    function create(node)
+    {
+        if (!get(node.id).length) {
+            var addtr = '<tr class="mytr" id="goods_'+node.id+'">';
+            addtr += '<td class="goods_id">'+node.id+'</td>';
+            addtr += '<td class="goods_id">'+node.code+'</td>';
+            addtr += '<td class="goods_name">'+node.name+'</td>';     
+            addtr += '<td class="goods_name">'+node.type_name+'</td>';     
+            addtr += '<td><a class="delete_btn" onclick="del(\''+node.id+'\')">删除</a></td>';        
+            addtr += '</tr>';
+            $("#goods").append(addtr);
+        }
+    }
+
+    function add(id)
+    {
+        goods[id].num += 1;
+        get(id).find('.goods_num').val(goods[id].num);
+        setTotal();
+    }
+    
+    function dec(id)
+    {
+        goods[id].num -= 1;
+        if (goods[id].num < 1) {
+            goods[id].num = 0;
+        }
+
+        get(id).find('.goods_num').val(goods[id].num);
+        setTotal();
+    }
+
+    function del(id)
+    {
+        if (confirm('确定删除吗?')) {
+            delete goods[id];
+			get(id).remove();
+			setTotal();
+        }
+    }
+
+    // 一键添加
+    function addGoods()
+    {
+        var key = mini.get("key").getValue();
+        if (key == '请输入配送商名称') {
+            key = '';
+        }
+        if (key) {
+            key = key.toLowerCase();
+        }
+        for (var i in tree.data) {
+            if (typeof(tree.data[i].children) == 'object') {
+                if (tree.data[i].children.length > 0) {
+                    for (var j in tree.data[i].children) {
+                        if (key) {
+                            var name = tree.data[i].children[j].name;
+                            if (name.indexOf(key) != -1) {
+                                setGoods(tree.data[i].children[j]);
+                            }
+                        } else {
+                            setGoods(tree.data[i].children[j]);
+                        }
+                    }
+                } else {
+                    if (key) {
+                        var name = tree.data[i].name;
+                        if (name.indexOf(key) != -1) {
+                            setGoods(tree.data[i]);
+                        }
+                    } else {
+                        setGoods(tree.data[i]);
+                    }
+                }
+            }
+        }
+    }
+
+    // 一键删除
+    function delGoods()
+    {
+        if (confirm('确定删除吗?')) {
+            var key = mini.get("key").getValue();
+            if (key == '请输入配送商名称') {
+                key = '';
+            }
+            if (key) {
+                key = key.toLowerCase();
+            }
+            for (var i in tree.data) {
+                if (typeof(tree.data[i].children) == 'object') {
+                    if (tree.data[i].children.length > 0) {
+                        for (var j in tree.data[i].children) {
+                            if (key) {
+                                var name = tree.data[i].children[j].name;
+                                if (name.indexOf(key) != -1) {
+                                    unsetGoods(tree.data[i].children[j]);
+                                }
+                            } else {
+                                unsetGoods(tree.data[i].children[j]);
+                            }
+                        }
+                    } else {
+                        if (key) {
+                            var name = tree.data[i].name;
+                            if (name.indexOf(key) != -1) {
+                                unsetGoods(tree.data[i]);
+                            }
+                        } else {
+                            unsetGoods(tree.data[i]);
+                        }
+                    }
+                }
+            }
+            setTotal();
+        }
+    }
+
+    function setTotal()
+    {
+        var num = 0;
+        for (var i in goods) {
+            num += 1;
+        }
+        $(".totalNum").html(num);
+    }
+
+    function setShop()
+    {
+        var sid = $('.xm-select-parent[fs_id="sid"] span[fsw="xm-select"]').attr('value');
+        if (!sid) {
+            layui.layer.alert('请选择<{$name}>');
+            return;
+        }
+        layui.layer.confirm('确定切换<{$name}>吗?', function() {
+            location.href = '<{$host}>&id=' + sid;
+        });
+    }
+</script>
+</body>
+</html>

+ 342 - 0
src/dai/servicer/assets/pc/html/set_store.html

@@ -0,0 +1,342 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
+<meta name="author" content="siweiyong 2602812659@qq.com"/>
+<title>设置配送商</title>
+<link rel="stylesheet" href="../script/lib/miniui/themes/default/miniui.css">
+<link rel="stylesheet" href="../script/lib/layui/css/layui.css" />
+<link rel="stylesheet" href="../script/lib/cashier/common.css">
+<link rel="stylesheet" href="../script/lib/layui/admin/modules/plugin/formselects/formselects.css" media="all" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/miniui/miniui.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+</head>
+<body style="background: #F6F7F9;">
+<div class="main">
+<form class="layui-form" lay-filter="form">
+    <div class="layui-row">
+        <div class="main_left layui-col-xs12 layui-col-md3">
+            <div class="layui-row">
+                <div class="top">
+                    <i class="layui-icon layui-icon-app"></i>仓库列表
+                </div>
+                <div class="left_main">
+                    <input id="key" class="mini-textbox" onenter="onKeyEnter" value="请输入配送商名称" onclick="setVal('key')"/>
+                    <a class="mini-button" onclick="search()">查询</a> 
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="addGoods()">一键添加</button>
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="delGoods()">一键删除</button>
+                    <ul id="tree1" class="mini-tree" url="<{$url}>" showTreeIcon="true" textField="name" idField="id" expandOnLoad="true" onNodeClick="onNodeClick">
+                    </ul>
+
+                </div>
+            </div>
+        </div>
+        <div class="main_right layui-col-xs12 layui-col-md9">
+            <div class="layui-row">
+                <div class="top">
+                    <label>切换<{$name}>:</label>
+                    <div class="layui-input-inline">
+
+                        <div><select xm-select="sid" xm-select-skin="normal" xm-select-search="<{$search}>" xm-select-search-type="dl" xm-select-radio="" class="update_value form-control layui-input layui-select" name="sid" id="sid"  ></select></div>
+
+                    </div>
+                    <div class="layui-input-inline">
+                        <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="setShop()">确认切换</button>
+                    </div>
+                </div>
+                <div class="goods_list" style="height:645px;">
+                    <table class="layui-table">
+                        <thead>
+                            <tr>
+                                <th lay-data="{field:'id'}">配送商ID</th>
+                                <th lay-data="{field:'id'}">配送商编码</th>
+                                <th lay-data="{field:'name'}">配送商名称</th>
+                                <th lay-data="{field:'name'}">配送商类型</th>
+                                <th lay-data="{field:'operation'}">操作</th>
+                            </tr>
+                        </thead>
+                        <tbody id="goods">
+                            
+                        </tbody>
+                    </table>
+                </div>
+                <div class="total ft16">
+                    合计:【<span> 分配仓库总数:<i class="totalNum">0</i> </span>】 注意:不分配仓库,则门店可以使用所有与经销商绑定的配送商下的仓库
+                </div>
+                <div class="towbtn">
+                    <input type="button" id="settlement" value="确认分配">
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+</form>
+</div>
+<script>
+    var form;
+    layui.config(
+    {
+        base: '../script/lib/layui/admin/' //静态资源所在路径
+        ,version: true
+    }).extend(
+    {
+        index: 'lib/index', //主入口模块
+        formSelects: 'plugin/formselects/formselects'
+    }).use(['index', 'contlist', 'table', 'form', 'formSelects','layer'], function()
+    {
+        var table = layui.table;
+        form = layui.form; 
+        var formSelects = layui.formSelects;
+    });
+
+    $(function()
+    {
+        $("#settlement").click(function(){
+            var url = '<{$submit}>';
+            var id = '<{$id}>';
+            var role = '<{$role}>';
+            var table = '<{$table}>';
+
+            layui.layer.confirm('确定进行此项设置吗?', function() {
+                var goods_string = JSON.stringify(goods);
+
+                var data = {};
+                data = {id:id, role:role,table:table, value:goods_string};
+                $.post(url, data, function(t) {
+                    t = JSON.parse(t);
+                    if (t.status == 1) {
+                        layui.layer.alert('设置成功', function(index){
+                          if (t.data == 'refer') {
+                                history.back();
+                            } else {
+                                location.href = t.data;
+                            }
+                          layer.close(index);
+                        });
+                    } else {
+                        layui.layer.alert(t.msg);
+                    }
+                });
+            });
+        })
+    })
+    var goods = {};
+    var del_goods = {};
+    mini.parse();
+    var tree = mini.get("tree1");
+    for (var i in tree.data) {
+        if (typeof(tree.data[i].children) == 'object') {
+            if (tree.data[i].children.length > 0) {
+                for (var j in tree.data[i].children) {
+                    if(tree.data[i].children[j].select == 1) {
+                        setGoods(tree.data[i].children[j]);
+                    }
+                }
+            } else if(tree.data[i].select == 1) {
+                setGoods(tree.data[i]);
+            }
+        }
+    }
+    function search() 
+    {
+        var key = mini.get("key").getValue();
+        if (key == "") {
+            tree.clearFilter();
+        } else {
+            key = key.toLowerCase();                
+            tree.filter(function (node) {
+                var name = node.name ? node.name.toLowerCase() : "";
+                if (name.indexOf(key) != -1) {
+                    return true;
+                }
+            });
+        }
+    }
+    function onKeyEnter(e)
+    {
+        search();
+    }
+
+    function onNodeClick()
+    {
+        var tree=mini.get("tree1");
+        node=tree.getSelectedNode();
+        if(node.end) {
+            setGoods(node);
+        }
+    }
+
+    function setGoods(node)
+    {
+        if (node.id) {
+            var key = node.id;
+            if (!goods[key]) {
+                goods[key] = node;
+                create(node);
+                setTotal();
+            } else {
+                add(key);
+            }
+        }
+    }
+
+    function unsetGoods(node)
+    {
+        if (node.id) {
+            if (goods[node.id]) {
+                delete goods[node.id];
+                get(node.id).remove();
+            }
+        }
+    }
+
+    function get(key)
+    {
+        return $('#goods_' + key);
+    }
+
+    function create(node)
+    {
+        if (!get(node.id).length) {
+            var addtr = '<tr class="mytr" id="goods_'+node.id+'">';
+            addtr += '<td class="goods_id">'+node.id+'</td>';
+            addtr += '<td class="goods_id">'+node.code+'</td>';
+            addtr += '<td class="goods_name">'+node.name+'</td>';     
+            addtr += '<td class="goods_name">'+node.type_name+'</td>';     
+            addtr += '<td><a class="delete_btn" onclick="del(\''+node.id+'\')">删除</a></td>';        
+            addtr += '</tr>';
+            $("#goods").append(addtr);
+        }
+    }
+
+    function add(id)
+    {
+        goods[id].num += 1;
+        get(id).find('.goods_num').val(goods[id].num);
+        setTotal();
+    }
+    
+    function dec(id)
+    {
+        goods[id].num -= 1;
+        if (goods[id].num < 1) {
+            goods[id].num = 0;
+        }
+
+        get(id).find('.goods_num').val(goods[id].num);
+        setTotal();
+    }
+
+    function del(id)
+    {
+        if (confirm('确定删除吗?')) {
+            delete goods[id];
+			get(id).remove();
+			setTotal();
+        }
+    }
+
+    // 一键添加
+    function addGoods()
+    {
+        var key = mini.get("key").getValue();
+        if (key == '请输入配送商名称') {
+            key = '';
+        }
+        if (key) {
+            key = key.toLowerCase();
+        }
+        for (var i in tree.data) {
+            if (typeof(tree.data[i].children) == 'object') {
+                if (tree.data[i].children.length > 0) {
+                    for (var j in tree.data[i].children) {
+                        if (key) {
+                            var name = tree.data[i].children[j].name;
+                            if (name.indexOf(key) != -1) {
+                                setGoods(tree.data[i].children[j]);
+                            }
+                        } else {
+                            setGoods(tree.data[i].children[j]);
+                        }
+                    }
+                } else {
+                    if (key) {
+                        var name = tree.data[i].name;
+                        if (name.indexOf(key) != -1) {
+                            setGoods(tree.data[i]);
+                        }
+                    } else {
+                        setGoods(tree.data[i]);
+                    }
+                }
+            }
+        }
+    }
+
+    // 一键删除
+    function delGoods()
+    {
+        if (confirm('确定删除吗?')) {
+            var key = mini.get("key").getValue();
+            if (key == '请输入配送商名称') {
+                key = '';
+            }
+            if (key) {
+                key = key.toLowerCase();
+            }
+            for (var i in tree.data) {
+                if (typeof(tree.data[i].children) == 'object') {
+                    if (tree.data[i].children.length > 0) {
+                        for (var j in tree.data[i].children) {
+                            if (key) {
+                                var name = tree.data[i].children[j].name;
+                                if (name.indexOf(key) != -1) {
+                                    unsetGoods(tree.data[i].children[j]);
+                                }
+                            } else {
+                                unsetGoods(tree.data[i].children[j]);
+                            }
+                        }
+                    } else {
+                        if (key) {
+                            var name = tree.data[i].name;
+                            if (name.indexOf(key) != -1) {
+                                unsetGoods(tree.data[i]);
+                            }
+                        } else {
+                            unsetGoods(tree.data[i]);
+                        }
+                    }
+                }
+            }
+            setTotal();
+        }
+    }
+
+    function setTotal()
+    {
+        var num = 0;
+        for (var i in goods) {
+            num += 1;
+        }
+        $(".totalNum").html(num);
+    }
+
+    function setShop()
+    {
+        var sid = $('.xm-select-parent[fs_id="sid"] span[fsw="xm-select"]').attr('value');
+        if (!sid) {
+            layui.layer.alert('请选择<{$name}>');
+            return;
+        }
+        layui.layer.confirm('确定切换<{$name}>吗?', function() {
+            location.href = '<{$host}>&id=' + sid;
+        });
+    }
+</script>
+</body>
+</html>

+ 285 - 0
src/dai/servicer/database/in_order.php

@@ -0,0 +1,285 @@
+<?php
+
+$status = array
+(
+    1 => array('name' => '待审核', 'style' => 'font-weight:bold;color:#436EEE'),
+    2 => array('name' => '已审核', 'style' => 'font-weight:bold;color:#003366'),
+    3 => array('name' => '已驳回', 'style' => 'font-weight:bold;color:#993333'),
+);
+
+$audit = array
+(
+    //1 => '待审核',
+    2 => '审核通过',
+    3 => '审核未通过',
+);
+
+$type = function() {
+    return Dever::db('servicer/in_order_type')->state();
+};
+
+$store = array();
+$servicer_id = Dever::input('search_option_servicer_id');
+if ($servicer_id) {
+	$store = function() use($servicer_id) {
+		return Dever::db('servicer/store')->state(array('servicer_id' => $servicer_id, 'status' => 1));
+	};
+}
+
+$supplier = function() use($servicer_id) {
+	return Dever::db('servicer/supplier')->getData(array('servicer_id' => $servicer_id));
+};
+
+$servicer = function() {
+    return Dever::db('servicer/info')->state();
+};
+
+$col = Dever::input('col');
+
+return array
+(
+    # 表名
+    'name' => 'in_order',
+    # 显示给用户看的名称
+    'lang' => '入库单查询',
+    'order' => 9,
+    'set' => array
+    (
+    	'status' => $status,
+        'audit' => $audit,
+    ),
+    'end' => array
+    (
+        'insert' => 'scm/lib/order.updateOrderNum?table=servicer/in_order&prefix=CI',
+        'update' => 'scm/lib/stock.update_commit?table=servicer/in_order&stock=servicer/store_goods&type=in&col=servicer_store_id',
+    ),
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单号',
+            'default'   => '',
+            'desc'      => '订单号',
+            'match'     => 'is_string',
+            'search'    => 'fulltext',
+            'list_name'	=> '订单信息',
+            'list'      => 'Dever::load("servicer/lib/manage.info", "in", {id})',
+        ),
+
+        'servicer_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '配送商',
+            'default'   => '',
+            'desc'      => '配送商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'searchs'    => array
+            (
+                'api' => 'role/seller-like',
+                'col' => 'name',
+                'result' => 'id',
+            ),
+            'search'    => 'select',
+            'option'    => $servicer,
+            'value'     => $servicer_id,
+            //'list'      => 'Dever::load("servicer/info-one#name", {servicer_id})',
+        ),
+
+        'servicer_store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '仓库',
+            'default'   => '',
+            'desc'      => '仓库',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $store,
+            //'list'      => 'Dever::load("servicer/store-one#name", {servicer_store_id})',
+        ),
+
+        'supplier_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '供应商',
+            'default'   => '',
+            'desc'      => '供应商',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $supplier,
+            //'list'      => 'Dever::load("supplier/info-one#name", {supplier_id})',
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '入库类型',
+            'default'   => '1',
+            'desc'      => '入库类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'search'    => 'select',
+            'option'    => $type,
+            //'list'      => true,
+        ),
+
+        'relate_order_num'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '关联单据号',
+            'default'   => '',
+            'desc'      => '关联单据号',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'address'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '收货信息',
+            'default'   => '',
+            'desc'      => '收货信息',
+            'match'     => 'is_string',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'      => true,
+        ),
+
+        'servicer-in_order_goods'=> array
+		(
+			'name' 		=> '商品设置',
+			'default' 	=> '',
+			'desc' 		=> '商品设置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'order_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+            'list_name' => '商品信息',
+			'list'		=> 'Dever::load("product/lib/manage.getGoods", {id}, "servicer/in_order_goods")',
+		),
+
+        'audit'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '审核状态',
+            'default'   => '2',
+            'desc'      => '审核状态',
+            'match'     => 'is_numeric',
+            'option'    => $audit,
+            'update'    => $col ? 'radio' : false,
+        ),
+
+        'audit_desc'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '审核备注',
+            'default'   => '',
+            'desc'      => '审核备注',
+            'match'     => 'option',
+            'update'    => $col ? 'textarea' : false,
+        ),
+
+        'audit_admin'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核人',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '审核人',
+            //'list'      => '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '订单状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            //'search_after' => '<br />',
+            //'mul'   => true,
+            //'mul_option' => array(2 => '批量审核', 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'    => 'sdate',
+            'list'        => 'date("Y-m-d H:i", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台提交时,检测该值是否为空,多个用逗号隔开
+        'update_check' => 'servicer-in_order_goods',
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+        //'excel' => $excel,
+        //'mul' => $mul,
+
+        'button' => array
+        (
+            //'导出订单明细' => array('excel', 'shop/excel.sell_order'),
+            '类型配置' => array('list', 'in_order_type&oper_parent=in_order'),
+        ),
+
+        'list_button' => array
+        (
+            'list' => array('查看详情', '"in_order_goods&type=in&page_type=1&order_id={id}"'),
+
+            'fast' => array('审核', '"in_order&where_id={id}&col=audit,audit_desc"', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 226 - 0
src/dai/servicer/database/in_order_goods.php

@@ -0,0 +1,226 @@
+<?php
+
+$status = array
+(
+    1 => '待审',
+    2 => '已审核',
+    3 => '未通过',
+);
+
+return array
+(
+    # 表名
+    'name' => 'in_order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    'status' => $status,
+    # 验证供应商商品是否存在
+    'start' => array
+    (
+        'insert' => 'supplier/lib/manage.check',
+    ),
+    'end' => array
+    (
+        'insert' => 'scm/lib/order.updateGoods?table=servicer/in_order_goods',
+        'update' => 'scm/lib/order.updateGoods?table=servicer/in_order_goods',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '商品',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'option',
+            'update'    => 'select',
+            'update_search' => 'goods/lib/manage.searchProduct?{supplier_id}',
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showInfo?cash_col=cost_price', 'goods'), 'col' => 'servicer_store_id,supplier_id')),
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '库存',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'is_numeric',
+            'update'    => 'show',
+            'value'     => '暂无',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '-1',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
+        'store_goods_list_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联仓库商品id',
+            'default'   => '',
+            'desc'      => '关联仓库商品id',
+            'match'     => 'is_numeric',
+            'value'     => '暂无',
+        ),
+
+        'unit_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '单位',
+            'default'   => '',
+            'desc'      => '单位',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => array(0 => '请先选择商品'),
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showPriceByUnit?cash_col=cost_price', 'goods'), 'col' => 'supplier_id,servicer_store_id,goods')),
+        ),
+
+        'batch'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '入库批次号',
+            'default'   => '',
+            'desc'      => '批次号',
+            'match'     => 'option',
+            'update'    => 'text',
+            'value'     => date('Ymd'),
+        ),
+
+        'sdate'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '生产日期',
+            'default'   => '',
+            'desc'      => '生产日期',
+            'match'     => 'option',
+            'update'    => 'day',
+            'callback'  => 'maketime',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '单价',
+            'default'   => '',
+            'desc'      => '单价',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '数量',
+            'default'   => '1',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'	=> 'text',
+        ),
+
+        '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
+    (
+        'insert' => false,
+        'delete' => false,
+        'page_list' => 'order_goods',
+    ),
+
+    'request' => array
+    (
+        'getNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-t_2.cdate', '>='),
+                'end' => array('yes-t_2.cdate', '<='),
+                'start_o' => array('yes-t_2.operdate', '>='),
+                'end_o' => array('yes-t_2.operdate', '<='),
+                'servicer_id' => array('yes-t_2.servicer_id'),
+                'servicer_store_id' => array('yes-t_2.servicer_store_id'),
+                'goods_id' => array('yes-t_1.goods_id'),
+                'status' => array('yes-t_2.status', 'in'),
+                'state_2' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+                'status_1' => 'yes-t_1.status-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'servicer/in_order',
+                    'type' => 'left join',
+                    'on' => array('order_id','id'),
+                ),
+            ),
+            'type' => 'all',
+            'group' => 't_2.servicer_id, t_2.servicer_store_id, t_1.goods_id',
+            'col' => 'id,t_2.servicer_id, t_2.servicer_store_id, t_1.goods_id,sum(t_1.num) as num',
+        ),
+    ),
+);

+ 106 - 0
src/dai/servicer/database/in_order_type.php

@@ -0,0 +1,106 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'in_order_type',
+	# 显示给用户看的名称
+	'lang' => '入库单类型',
+	# 是否显示在后台菜单
+	'order' => 1,
+	'menu'	=> false,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '类型名称',
+			'default' 	=> '',
+			'desc' 		=> '类型名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'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,
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+		'list_button' => array
+        (
+        	'edit' => array('编辑'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认类型", 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 360 - 0
src/dai/servicer/database/info.php

@@ -0,0 +1,360 @@
+<?php
+$category = function()
+{
+    return Dever::load('goods/category-getTop');
+};
+
+$type = function()
+{
+    return Dever::load('servicer/type-state');
+};
+
+$identity = array
+(
+	1 => '个人',
+	2 => '个体户',
+	3 => '企业',
+);
+
+$status = array
+(
+    1 => '启用',
+    2 => '禁用',
+);
+
+return array
+(
+	# 表名
+	'name' => 'info',
+	# 显示给用户看的名称
+	'lang' => '配送商列表',
+	# 是否显示在后台菜单
+	'order' => 10,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '配送商ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			//'order'		=> 'desc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '配送商名称',
+			'default' 	=> '',
+			'desc' 		=> '配送商名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'code'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '配送商编码',
+            'default'   => '',
+            'desc'      => '配送商编码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'type_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '配送商类型',
+            'default'   => '1',
+            'desc'      => '配送商类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'list'      => true,
+        ),
+
+        'category'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '商品属性分类-如不选择就是可以选择所有商品属性分类下的商品',
+            'default'   => '',
+            'desc'      => '商品属性分类',
+            'match'     => 'is_string',
+            'update'    => 'checkbox',
+            'option'    => $category,
+        ),
+
+		'servicer-store'=> array
+		(
+			'name' 		=> '仓库设置',
+			'default' 	=> '',
+			'desc' 		=> '仓库设置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'servicer_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+            'list_name' => '仓库列表',
+			'list'		=> 'Dever::load("servicer/lib/manage.getStore", {id})',
+		),
+
+		'truename'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '联系人姓名',
+            'default'   => '',
+            'desc'      => '请输入联系人姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'		=> 1,
+        ),
+
+        'tel'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '联系人电话',
+            'default'   => '',
+            'desc'      => '请输入联系人电话',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'		=> 1,
+        ),
+
+        'email'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '联系人邮箱',
+            'default'   => '',
+            'desc'      => '联系人邮箱',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'       => 1,
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '联系人城市',
+            'default'   => '',
+            'desc'      => '联系人城市',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=3', 'area'),
+            //'list'      => 'Dever::load("area/api.string", "{area}")',
+            'tab'		=> 1,
+        ),
+
+        'province'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '省份',
+            'default'   => '',
+            'desc'      => '省份',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'		=> 1,
+        ),
+
+        'city'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '城市',
+            'default'   => '',
+            'desc'      => '城市',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'		=> 1,
+        ),
+
+        'county'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '县区',
+            'default'   => '',
+            'desc'      => '县区',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'		=> 1,
+        ),
+
+        'address'       => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '联系人地址',
+            'default'   => '',
+            'desc'      => '联系人地址',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+            'tab'		=> 1,
+        ),
+
+        'identity'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '供应商身份',
+            'default'   => '1',
+            'desc'      => '供应商身份',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $identity,
+            'control'	=> 'identity',
+            'tab'		=> 2,
+        ),
+
+        'idcard_front'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证正面-如果是个人,这里上传联系人身份证,如果是个体户或者企业,这里上传法人身份证',
+            'default'   => '',
+            'desc'      => '身份证正面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'tab'		=> 2,
+        ),
+
+        'idcard_back'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证背面-如果是个人,这里上传联系人身份证,如果是个体户或者企业,这里上传法人身份证',
+            'default'   => '',
+            'desc'      => '身份证背面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'tab'		=> 2,
+        ),
+
+        'company_license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '营业执照',
+            'default'   => '',
+            'desc'      => '营业执照',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'show'		=> 'identity=2,3',
+            'tab'		=> 2,
+        ),
+
+        'company_name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '企业全称',
+            'default'   => '',
+            'desc'      => '企业全称',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'show'      => 'identity=2,3',
+            'tab'       => 2,
+        ),
+
+        'company_number'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '社会信用代码',
+            'default'   => '',
+            'desc'      => '社会信用代码',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'show'      => 'identity=2,3',
+            'tab'       => 2,
+        ),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> 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
+	(
+		'tab' => array('基本设置', '联系人信息', '认证信息'),
+		'delete' => false,
+		'list_button' => array
+        (
+        	'location' => array('分配供应商', Dever::url('lib/set.home?role=servicer', 'supplier')),
+            'br3' => array('<br />'),
+            'add' => array('入库下单', 'in_order&oper_table=info&search_option_servicer_id={id}&oper_save_jump=in_order'),
+            'add2' => array('出库下单', 'out_order&oper_table=info&search_option_servicer_id={id}&oper_save_jump=out_order'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,code,state,cdate',
+		'value' => array
+		(
+			'"默认配送商", "default", 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 301 - 0
src/dai/servicer/database/out_order.php

@@ -0,0 +1,301 @@
+<?php
+
+$status = array
+(
+    1 => array('name' => '待审核', 'style' => 'font-weight:bold;color:#436EEE'),
+    2 => array('name' => '已审核', 'style' => 'font-weight:bold;color:#003366'),
+    3 => array('name' => '已驳回', 'style' => 'font-weight:bold;color:#993333'),
+);
+
+$audit = array
+(
+    //1 => '待审核',
+    2 => '审核通过',
+    3 => '审核未通过',
+);
+
+$type = function() {
+	return Dever::db('servicer/out_order_type')->state();
+};
+
+$store = array();
+$servicer_id = Dever::input('search_option_servicer_id');
+if ($servicer_id) {
+	$store = function() use($servicer_id) {
+		return Dever::db('servicer/store')->state(array('servicer_id' => $servicer_id));
+	};
+}
+
+$servicer = function() {
+    return Dever::db('servicer/info')->state();
+};
+
+
+$in_type = array
+(
+    1 => '不生成',
+    2 => '生成仓库入库单',
+    //3 => '生成经销商入库单',
+);
+
+$col = Dever::input('col');
+
+return array
+(
+    # 表名
+    'name' => 'out_order',
+    # 显示给用户看的名称
+    'lang' => '出库单查询',
+    'order' => 8,
+    'set' => array
+    (
+    	'status' => $status,
+        'audit' => $audit,
+    ),
+    'end' => array
+    (
+        'insert' => 'scm/lib/order.updateOrderNum?table=servicer/out_order&prefix=CO',
+        'update' => 'scm/lib/stock.update_commit?table=servicer/out_order&stock=servicer/store_goods&type=out&col=servicer_store_id',
+    ),
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单号',
+            'default'   => '',
+            'desc'      => '订单号',
+            'match'     => 'is_string',
+            'search'    => 'fulltext',
+            'list_name'	=> '订单信息',
+            'list'      => 'Dever::load("servicer/lib/manage.info", "out", {id})',
+        ),
+
+        'servicer_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '配送商',
+            'default'   => '',
+            'desc'      => '配送商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'searchs'    => array
+            (
+                'api' => 'role/seller-like',
+                'col' => 'name',
+                'result' => 'id',
+            ),
+            'search'    => 'select',
+            'option'    => $servicer,
+            'value'     => $servicer_id,
+            //'list'      => 'Dever::load("servicer/info-one#name", {servicer_id})',
+        ),
+
+        'servicer_store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '出库仓库',
+            'default'   => '',
+            'desc'      => '出库仓库',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $store,
+            //'list'      => 'Dever::load("servicer/store-one#name", {servicer_store_id})',
+        ),
+
+        'type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '出库类型',
+            'default'   => '1',
+            'desc'      => '出库类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'list'      => true,
+            'control'	=> 'type',
+        ),
+
+        'relate_order_num'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '关联单据号',
+            'default'   => '',
+            'desc'      => '关联单据号',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'in_type'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '同时生成入库单',
+            'default'   => '1',
+            'desc'      => '同时生成入库单',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $in_type,
+            //'list'      => true,
+            'control'   => 'in_type',
+        ),
+
+        'in_type_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '入库组织',
+            'default'   => '',
+            'desc'      => '入库组织',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'update_search' => 'goods/lib/manage.searchRole?servicer_id='.$servicer_id.'&{in_type,servicer_store_id}',
+            'show'		=> 'type=1',
+            'show'   => 'in_type=2,3',
+            //'list'      => 'Dever::load("servicer/store-one#name", {servicer_store_id})',
+        ),
+
+        'info'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '订单备注',
+            'default'   => '',
+            'desc'      => '订单备注',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+        ),
+
+        'address'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '收货信息',
+            'default'   => '',
+            'desc'      => '收货信息',
+            'match'     => 'is_string',
+        ),
+
+        'servicer-out_order_goods'=> array
+		(
+			'name' 		=> '商品设置',
+			'default' 	=> '',
+			'desc' 		=> '商品设置',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'order_id'),
+			'update'	=> array(1),
+			# 1纵向展示 2横向展示
+			'update_type' => 2,
+            'list_name' => '商品信息',
+			'list'		=> 'Dever::load("goods/lib/manage.getGoods", {id}, "servicer/out_order_goods")',
+		),
+
+        'audit'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '审核状态',
+            'default'   => '2',
+            'desc'      => '审核状态',
+            'match'     => 'is_numeric',
+            'option'    => $audit,
+            'update'    => $col ? 'radio' : false,
+        ),
+
+        'audit_desc'        => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '审核备注',
+            'default'   => '',
+            'desc'      => '审核备注',
+            'match'     => 'option',
+            'update'    => $col ? 'textarea' : false,
+        ),
+
+        'audit_admin'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核人',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '审核人',
+            //'list'      => '"{audit_admin}" > 0 ? Dever::load("manage/admin-find#username", {audit_admin}) : "-"',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '订单状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+            //'search_after' => '<br />',
+            //'mul'   => true,
+            //'mul_option' => array(2 => '批量审核', 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'    => 'sdate',
+            'list'        => 'date("Y-m-d H:i", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台提交时,检测该值是否为空,多个用逗号隔开
+        'update_check' => 'servicer-out_order_goods',
+        'delete' => false,
+        'edit' => false,
+        'insert' => false,
+        //'excel' => $excel,
+        //'mul' => $mul,
+
+        'button' => array
+        (
+            //'导出订单明细' => array('excel', 'shop/excel.sell_order'),
+            '类型配置' => array('list', 'out_order_type&oper_parent=out_order'),
+        ),
+
+        'list_button' => array
+        (
+            'list' => array('查看详情', '"out_order_goods&type=out&page_type=1&order_id={id}"'),
+
+            'fast' => array('审核', '"out_order&where_id={id}&col=audit,audit_desc"', '{status} == 1'),
+        ),
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 215 - 0
src/dai/servicer/database/out_order_goods.php

@@ -0,0 +1,215 @@
+<?php
+
+$status = array
+(
+    1 => '待审',
+    2 => '已审核',
+    3 => '未通过',
+);
+
+return array
+(
+    # 表名
+    'name' => 'out_order_goods',
+    # 显示给用户看的名称
+    'lang' => '订单商品表',
+    'menu' => false,
+    'status' => $status,
+    # 验证库存
+    'start' => array
+    (
+    	'insert' => 'scm/lib/stock.out_check?table=servicer/store_goods&order_table=servicer/out_order&col=servicer_store_id',
+    ),
+    'end' => array
+    (
+        'insert' => 'scm/lib/order.updateGoods?table=servicer/out_order_goods',
+        'update' => 'scm/lib/order.updateGoods?table=servicer/out_order_goods',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'order_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '订单表id',
+            'default'   => '',
+            'desc'      => '订单表id',
+            'match'     => 'is_numeric',
+        ),
+
+        'goods'      => array
+        (
+            'type'      => 'varchar-2000',
+            'name'      => '商品',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'option',
+            'update'    => 'select',
+            'update_search' => 'goods/lib/manage.searchProduct?{servicer_id,servicer_store_id}',
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showInfo', 'goods'), 'col' => 'servicer_store_id')),
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '库存',
+            'default'   => '',
+            'desc'      => '商品',
+            'match'     => 'is_numeric',
+            'update'	=> 'show',
+            'value'		=> '暂无',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'sku_id',
+            'default'   => '-1',
+            'desc'      => 'sku_id',
+            'match'     => 'is_numeric',
+        ),
+
+        'store_goods_list_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '关联仓库商品id',
+            'default'   => '',
+            'desc'      => '关联仓库商品id',
+            'match'     => 'is_numeric',
+            'value'     => '暂无',
+        ),
+
+        'unit_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '单位',
+            'default'   => '',
+            'desc'      => '单位',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => array(0 => '请先选择商品'),
+            'bind'        => array('onchange', 'loading', array('url' => Dever::url('lib/manage.showPriceByUnit', 'goods'), 'col' => 'servicer_store_id,goods')),
+        ),
+
+        'batch'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '出库批次号',
+            'default'   => '',
+            'desc'      => '批次号',
+            'match'     => 'option',
+            'update'    => 'text',
+            'value'     => date('Ymd'),
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '单价(入库价平均价)',
+            'default'   => '',
+            'desc'      => '单价',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '数量',
+            'default'   => '1',
+            'desc'      => '数量',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        '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
+    (
+        'insert' => false,
+        'delete' => false,
+        'page_list' => 'order_goods',
+    ),
+
+    'request' => array
+    (
+        'getNum' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'start' => array('yes-t_2.cdate', '>='),
+                'end' => array('yes-t_2.cdate', '<='),
+                'start_o' => array('yes-t_2.operdate', '>='),
+                'end_o' => array('yes-t_2.operdate', '<='),
+                'servicer_id' => array('yes-t_2.servicer_id'),
+                'servicer_store_id' => array('yes-t_2.servicer_store_id'),
+                'goods_id' => array('yes-t_1.goods_id'),
+                'status' => array('yes-t_2.status', 'in'),
+                'state_2' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+                'status_1' => 'yes-t_1.status-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'servicer/out_order',
+                    'type' => 'left join',
+                    'on' => array('order_id','id'),
+                ),
+            ),
+            'type' => 'all',
+            'group' => 't_2.servicer_id, t_2.servicer_store_id, t_1.goods_id',
+            'col' => 'id,t_2.servicer_id, t_2.servicer_store_id, t_1.goods_id,sum(t_1.num) as num',
+        ),
+    ),
+);

+ 106 - 0
src/dai/servicer/database/out_order_type.php

@@ -0,0 +1,106 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'out_order_type',
+	# 显示给用户看的名称
+	'lang' => '出库单类型',
+	# 是否显示在后台菜单
+	'order' => 1,
+	'menu'	=> false,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '类型名称',
+			'default' 	=> '',
+			'desc' 		=> '类型名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'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,
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+		'list_button' => array
+        (
+        	'edit' => array('编辑'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认类型", 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 201 - 0
src/dai/servicer/database/store.php

@@ -0,0 +1,201 @@
+<?php
+
+$status = array
+(
+	1 => '启用',
+	2 => '禁用',
+);
+
+$type = array
+(
+	1 => '实体仓',
+	2 => '虚拟仓',
+);
+
+$set = Dever::input('set', 2);
+
+return array
+(
+	# 表名
+	'name' => 'store',
+	# 显示给用户看的名称
+	'lang' => '配送商仓库',
+	# 是否显示在后台菜单
+	'order' => 10,
+	'menu' => false,
+
+	'status' => $status,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'servicer_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '配送商ID',
+			'default' 	=> '-1',
+			'desc' 		=> '配送商ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_servicer_id'),
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '仓库名称',
+			'default' 	=> '',
+			'desc' 		=> '仓库名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'code'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '仓库编码',
+            'default'   => '',
+            'desc'      => '仓库编码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '门店类型-实体仓需要设置地址',
+            'default'   => '2',
+            'desc'      => '门店类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'list'		=> true,
+            'control'	=> 'type',
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '所在区县',
+            'default'   => '',
+            'desc'      => '所在区县',
+            'match'     => 'is_string',
+            'search'    => 'linkage',
+            'update'    => $set == 1 ? 'linkage' : false,
+            'option'    => Dever::url('api.get?level_total=3', 'area'),
+            //'list'      => 'Dever::load("area/api.string", "{area}")',
+            'show'		=> 'type=1',
+        ),
+
+        'address'       => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '详细地址',
+            'default'   => '',
+            'desc'      => '详细地址',
+            'match'     => 'is_string',
+            'update'    => $set == 1 ? 'text' : false,
+            'show'		=> 'type=1',
+        ),
+
+        'truename'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '联系人姓名',
+            'default'   => '',
+            'desc'      => '请输入联系人姓名',
+            'match'     => 'is_string',
+            'update'    => $set == 1 ? 'text' : false,
+            'search'    => 'fulltext',
+            'show'		=> 'type=1',
+        ),
+
+        'tel'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '联系人电话',
+            'default'   => '',
+            'desc'      => '请输入联系人电话',
+            'match'     => 'is_numeric',
+            'update'    => $set == 1 ? 'text' : false,
+            'search'    => 'fulltext',
+            'show'		=> 'type=1',
+        ),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> true,
+		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '是否启用',
+			'default' 	=> '1',
+			'desc' 		=> '是否启用',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $status,
+			'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
+	(
+		'delete' => false,
+        
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 286 - 0
src/dai/servicer/database/store_goods.php

@@ -0,0 +1,286 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'store_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,
+        ),
+
+        'servicer_store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '配送商仓库',
+            'default'   => '',
+            'desc'      => '配送商仓库',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_servicer_store_id'),
+            'list'      => 'Dever::load("servicer/store-one#name", {servicer_store_id})',
+        ),
+
+        'goods-info_sku-code'=> array
+        (
+            'name'      => '商品编码',
+            'default'   => '',
+            'desc'      => '商品编码',
+            'match'     => 'option',
+            # 读取另外表的关联方式
+            'sync'      => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
+            'search'    => array
+            (
+                'api' => 'goods/info_sku-all',
+                'col' => 'code',
+                'result' => 'id',
+                'search' => 'sku_id',
+            ),
+            'list'      => true,
+        ),
+
+        'goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品名称',
+            'default'   => '',
+            'desc'      => '商品名称',
+            'match'     => 'is_numeric',
+            'search'    => array
+            (
+                'api' => 'goods/info-all',
+                'col' => 'name',
+                'result' => 'id',
+                'search' => 'goods_id',
+            ),
+            'update'    => 'select',
+            'update_search' => 'goods/lib/manage.search',
+            'list'      => 'Dever::load("goods/lib/info.getBaseInfo#aname", "{goods_id}", "{sku_id}")',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '规格型号',
+            'default'   => '-1',
+            'desc'      => '规格型号',
+            'match'     => 'is_numeric',
+        ),
+
+        'unit_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '基本单位',
+            'default'   => '',
+            'desc'      => '基本单位',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("scm/unit-one#name", {unit_id})',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库均价',
+            'default'   => '',
+            'desc'      => '入库均价',
+            'match'     => 'option',
+            'list'      => true,
+        ),
+
+        'in_num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库总库存',
+            'default'   => '0',
+            'desc'      => '入库总库存',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+
+        'out_num'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '出库总库存',
+            'default'   => '0',
+            'desc'      => '出库总库存',
+            'match'     => 'option',
+            'list'      => 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,
+        'list_button' => array
+        (
+            'list' => array('查看详情', '"store_goods_list&oper_table=store_goods&top_table=info&search_option_store_goods_id={id}"'),
+        ),
+    ),
+
+    'request' => array
+    (
+        # 后台搜索用到,也可以不加,自动生成
+        'search' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'name' => array('yes-t_2.name', 'like'),
+                'servicer_store_id' => array('yes-t_1.servicer_store_id'),
+                'status' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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'),
+            'page' => array(10, 'list'),
+            'col' => '*, t_2.*,t_2.id as value, "" as selected, "" as disabled',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'servicer_store_id' => array('yes-t_1.servicer_store_id'),
+                'sell_type' => array('yes-t_2.sell_type'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,cdate',
+        ),
+
+        'getDataPage' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'servicer_store_id' => array('yes-t_1.servicer_store_id'),
+                'sell_type' => array('yes-t_2.sell_type'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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'),
+            'page' => array(10, 'list'),
+            'col' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,t_1.cdate,t_1.id as id',
+        ),
+
+        # 获取某个sku的单条数据
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'servicer_store_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => '*,(sum(in_num)-sum(out_num)) as total,AVG(cash) as cash',
+        ),
+
+        # 获取单位下的数据
+        'getUnit' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'servicer_store_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => '*,(in_num-out_num) as total|unit_id',
+        ),
+    ),
+);

+ 245 - 0
src/dai/servicer/database/store_goods_list.php

@@ -0,0 +1,245 @@
+<?php
+
+$info = '';
+$store_goods_id = Dever::input('search_option_store_goods_id');
+if ($store_goods_id) {
+    $store_goods = Dever::db('servicer/store_goods')->find($store_goods_id);
+    if ($store_goods) {
+        $store = Dever::db('servicer/store')->find($store_goods['servicer_store_id']);
+        $servicer = Dever::db('servicer/info')->find($store['servicer_id']);
+        $goods_info = Dever::load('goods/lib/info')->getBaseInfo($store_goods['goods_id'], $store_goods['sku_id']);
+        $info = '<blockquote class="layui-elem-quote">';
+        $info .= $servicer['name'] . '.' . $store['name'];
+        $info .= ' -> ';
+        $info .= '<b>' . $goods_info['aname'] . '('.$goods_info['code'].')</b>';
+        $info .= '<br />';
+        $info .= '入库均价:' . '<b>' . $store_goods['cash'] . '</b>';
+        $info .= ' 入库总库存:' . '<b>' . $store_goods['in_num'] . '</b>';
+        $info .= ' 出库总库存:' . '<b>' . $store_goods['out_num'] . '</b>';
+        $info .= '</blockquote>';
+    }
+}
+$config = array
+(
+    # 表名
+    'name' => 'store_goods_list',
+    # 显示给用户看的名称
+    'lang' => '商品价格设置',
+    'order' => 200,
+    'menu' => false,
+    'info' => $info,
+
+
+    # 数据结构 不同的字段放这里
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            //'list'        => true,
+        ),
+
+        'servicer_store_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属配送商',
+            'default'   => '',
+            'desc'      => '所属配送商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_servicer_store_id'),
+            //'list'      => 'Dever::load("servicer/store-one#name", {servicer_store_id})',
+        ),
+
+        'store_goods_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '商品id',
+            'default'   => '',
+            'desc'      => '商品id',
+            'match'     => 'is_numeric',
+        ),
+
+        'batch'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '入库批次号',
+            'default'   => '',
+            'desc'      => '入库批次号',
+            'match'     => 'option',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'sdate'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '生产日期',
+            'default'   => '',
+            'desc'      => '生产日期',
+            'match'     => 'option',
+            'update'    => 'day',
+            'callback'  => 'maketime',
+            'search'    => 'day',
+            'list'      => '{sdate} ? date("Y-m-d H:i:s", {sdate}) : "-"',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库单价',
+            'default'   => '',
+            'desc'      => '入库单价',
+            'match'     => 'option',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'in_num'        => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '入库库存',
+            'default'   => '0',
+            'desc'      => '入库库存',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+
+        'out_num'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '出库库存',
+            'default'   => '0',
+            'desc'      => '出库库存',
+            'match'     => 'option',
+            'list'      => 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,
+        //'excel' => array(array('导出门店库存', '门店库存', '')),
+        'page_list_table' => 'sku',
+    ),
+
+    # request 请求接口定义
+    'request' => array
+    (
+       	# 列表 先入先出
+        'getList' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'servicer_store_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('sdate' => 'asc', 'batch' => 'asc', 'id' => 'asc'),
+            'col' => '*,in_num-out_num as total',
+        ),
+
+        # 获取某个仓库商品下的数据
+        'getOneByStore' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'store_goods_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'group' => 'store_goods_id',
+            'col' => 'id,sum(in_num) as in_num, sum(out_num) as out_num,AVG(cash) as cash',
+        ),
+
+        # 更新入库库存
+        'inUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'in_num' => array('yes', '+='),
+            ),
+        ),
+
+        # 更新出库库存
+        'outUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'out_num' => array('yes', '+='),
+            ),
+        ),
+
+        # 更新入库在途库存
+        'onInUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'on_in_num' => array('yes', '+='),
+            ),
+        ),
+
+        # 更新出库在途库存
+        'onOutUpdate' => array
+        (
+            'type' => 'update',
+            'where' => array
+            (
+                'id' => 'yes',
+            ),
+            'set' => array
+            (
+                'on_out_num' => array('yes', '+='),
+            ),
+        ),
+    ),
+);
+
+return $config;

+ 115 - 0
src/dai/servicer/database/supplier.php

@@ -0,0 +1,115 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'supplier',
+    # 显示给用户看的名称
+    'lang' => '配送商供应商关系表',
+    'menu' => false,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'servicer_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '配送商ID',
+			'default' 	=> '-1',
+			'desc' 		=> '配送商ID',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_servicer_id'),
+		),
+
+        'supplier_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '供应商ID',
+            'default'   => '',
+            'desc'      => '供应商ID',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_supplier_id'),
+            'list'      => 'Dever::load("supplier/info-one#name", {supplier_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
+    (
+        'getAll' => array
+        (
+            'option' => array
+            (
+                'servicer_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => '*|supplier_id',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'servicer_id' => array('yes-t_1.servicer_id'),
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.state-1',
+            ),
+            # 联表
+            'join' => array
+            (
+                array
+                (
+                    'table' => 'supplier/info',
+                    'type' => 'left join',
+                    'on' => array('supplier_id','id'),
+                    'col' => 'supplier_id',
+                ),
+            ),
+            'type' => 'all',
+            'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
+            'col' => '*,t_2.name,t_2.id as id|id',
+        ),
+    ),
+);

+ 105 - 0
src/dai/servicer/database/type.php

@@ -0,0 +1,105 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'type',
+	# 显示给用户看的名称
+	'lang' => '配送商类型',
+	# 是否显示在后台菜单
+	'order' => 1,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '类型名称',
+			'default' 	=> '',
+			'desc' 		=> '类型名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'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,
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+		'list_button' => array
+        (
+        	'edit' => array('编辑'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认类型", 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 8 - 0
src/dai/servicer/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'servicer');
+define('DEVER_APP_LANG', '服务商');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 91);
+define('DEVER_MANAGE_ICON', 'layui-icon-template-1');
+include(DEVER_APP_PATH . '../boot.php');

+ 93 - 0
src/dai/servicer/lib/Manage.php

@@ -0,0 +1,93 @@
+<?php
+
+namespace Servicer\Lib;
+
+use Dever;
+
+class Manage
+{
+    public function __construct()
+    {
+        Dever::load('manage/auth.init');
+    }
+
+    # 获取订单信息
+    public function info($type = 'in', $id)
+    {
+        Dever::load('manage/auth.init');
+
+        $info = Dever::db('servicer/'.$type.'_order')->find($id);
+
+        $string = '';
+
+        $string = $info['order_num'];
+
+        $servicer = Dever::db('servicer/info')->one($info['servicer_id']);
+
+        $string .= '<br />' . $servicer['name'];
+
+        $store = Dever::db('servicer/store')->one($info['servicer_store_id']);
+
+        $string .= '.' . $store['name'];
+
+        if (isset($info['supplier_id'])) {
+            $supplier = Dever::db('supplier/info')->one($info['supplier_id']);
+
+            $string .= '<br />' . $supplier['name'];
+        }
+
+        $type = Dever::db('servicer/'.$type.'_order_type')->one($info['type']);
+
+        $string .= '<br />' . $type['name'];
+
+        $string .= '<br />' . $info['info'];
+
+        return $string;
+    }
+
+    # 查看详情
+    public function show()
+    {
+        $type = Dever::input('type');
+        return Dever::load('scm/lib/order')->show('servicer/'.$type.'_order', 'servicer/info', 'servicer_id', '配送商');
+    }
+
+
+    public function getStore($id)
+    {
+        $table = array();
+        $table['head'] = array('仓库名称', '仓库编码', '操作');
+        $table['body'] = array();
+
+        $data = Dever::db('servicer/store')->select(array('servicer_id' => $id));
+
+        if ($data) {
+        	$status = Dever::db('servicer/store')->config['status'];
+            foreach ($data as $k => $v) {
+            	$status_name = '';
+            	if ($v['status'] == 2) {
+            		$status_name = '(已禁用)';
+            	}
+                $url = Dever::url('project/database/update?project=servicer&table=store&oper_save_table=info&set=1&where_id='.$v['id'], 'manage');
+                $oper = '<a class="layui-btn" onclick="fastEdit($(this),\''.$url.'\',\'编辑仓库信息\', \'\')">编辑</a>';
+
+                $url = Dever::url('project/database/list?project=servicer&table=store_goods&oper_table=info&top_table1=info&search_option_servicer_store_id='.$v['id'], 'manage');
+            	$oper .= '<a class="layui-btn" href="'.$url.'">库存清单</a>';
+                $table['body'][$k][] = $v['name'] . $status_name;
+                $table['body'][$k][] = $v['code'];
+                $table['body'][$k][] = $oper;
+            }
+        }
+        $body[''] = array
+        (
+            'type' => 'table',
+            'content' => $table,
+        );
+
+        if ($table['body']) {
+            return Dever::show('', $body);
+        } else {
+            return '暂无';
+        }
+    }
+}

+ 112 - 0
src/dai/servicer/lib/Set.php

@@ -0,0 +1,112 @@
+<?php
+
+namespace Servicer\Lib;
+
+use Dever;
+
+class Set
+{
+    public function __construct()
+    {
+        Dever::load('manage/auth.init');
+    }
+
+    # 获取下游
+    public function search_api()
+    {
+        $role = Dever::input('role');
+        return Dever::search('' . $role . '/info');
+    }
+
+    # 分配配送商
+    public function getList_api()
+    {
+        $role = Dever::input('role');
+        $id = Dever::input('id', 1);
+        $data = Dever::db(''.$role.'/servicer')->getAll(array($role . '_id' => $id));
+        $type = Dever::db('servicer/type')->select();
+        
+        $result = array();
+        if ($type) {
+            $i = 0;
+            foreach ($type as $k => $v) {
+                $servicer = Dever::db('servicer/info')->select(array('status' => 1, 'type_id' => $v['id']));
+                if ($servicer) {
+                    $result[$i] = array();
+                    $result[$i]['id'] = $v['id'];
+                    $result[$i]['name'] = $v['name'];
+                    $result[$i]['select'] = 2;
+                    $result[$i]['end'] = false;
+                    $result[$i]['children'] = array();
+
+                    foreach ($servicer as $k1 => $v1) {
+                        $child = array();
+                        $child['id'] = $v1['id'];
+                        $child['name'] = $v1['name'];
+                        $child['code'] = $v1['code'];
+                        $child['type_name'] = $v['name'];
+                        $child['select'] = 2;
+                        $child['end'] = true;
+                        if (isset($data[$v1['id']]) && $data[$v1['id']]) {
+                            $child['select'] = 1;
+                        }
+                        $result[$i]['children'][] = $child;
+                    }
+                    $i++;
+                }
+            }
+        }
+        return Dever::outDiy($result);
+    }
+
+    public function home_api()
+    {
+        $data = array();
+        $data['id'] = Dever::input('id', 1);
+        $data['role'] = Dever::input('role');
+        $data['name'] = '经销商';
+        if ($data['role'] == 'servicer') {
+            $data['name'] = '配送商';
+        }
+        $data['host'] = Dever::url('lib/set.home?role=' . $data['role'], 'servicer');
+        $data['url'] = Dever::url('lib/set.getList?id=' . $data['id'] . '&role=' . $data['role'], 'servicer');
+        $data['search'] = Dever::url('lib/set.search?yes='.$data['id'].'&role=' . $data['role'] . '&json=1', 'servicer');
+        $data['submit'] = Dever::url('lib/set.set_commit?json=1', 'servicer');
+
+        return Dever::render('set_servicer', $data);
+    }
+
+    public function set_commit_api()
+    {
+        $value = Dever::input('value');
+        if (!$value) {
+            Dever::alert('未选择');
+        }
+        $value = Dever::json_decode($value);
+        $id = Dever::input('id');
+        $role = Dever::input('role');
+
+        $col = $role . '_id';
+        $table = '' . $role . '/servicer';
+        $where['option_' . $col] = $id;
+        $where['set_state'] = 2;
+        Dever::db($table)->updates($where);
+
+        foreach ($value as $k => $v) {
+            $w = array();
+            $w['servicer_id'] = $v['id'];
+            $w[$col] = $id;
+            $info = Dever::db($table)->one($w);
+
+            if (!$info) {
+                Dever::db($table)->insert($w);
+            } else {
+                $w['where_id'] = $info['id'];
+                $w['state'] = 1;
+                Dever::db($table)->update($w);
+            }
+        }
+
+        return 'refer';
+    }
+}

+ 117 - 0
src/dai/servicer/lib/Set_store.php

@@ -0,0 +1,117 @@
+<?php
+
+namespace Servicer\Lib;
+
+use Dever;
+
+class Set_store
+{
+    public function __construct()
+    {
+        Dever::load('manage/auth.init');
+    }
+
+    # 获取下游
+    public function search_api()
+    {
+        $role = Dever::input('role');
+        $table = Dever::input('table');
+        $yes = Dever::input('yes');
+        $where = array();
+        $info = Dever::db('' . $role . '/' . $table)->find($yes);
+        $where[$role . '_id'] = $info[$role . '_id'];
+        return Dever::search('' . $role . '/' . $table, $where);
+    }
+
+    # 分配配送商
+    public function getList_api()
+    {
+        $role = Dever::input('role');
+        $table = Dever::input('table');
+        $id = Dever::input('id', 1);
+        $data = Dever::db(''.$role.'/'.$table.'_store')->getAll(array($role . '_' . $table . '_id' => $id));
+        $type = Dever::db('servicer/info')->select();
+        
+        $result = array();
+        if ($type) {
+            $i = 0;
+            foreach ($type as $k => $v) {
+                $store = Dever::db('servicer/store')->select(array('status' => 1, 'servicer_id' => $v['id']));
+                if ($store) {
+                    $result[$i] = array();
+                    $result[$i]['id'] = $v['id'];
+                    $result[$i]['name'] = $v['name'];
+                    $result[$i]['select'] = 2;
+                    $result[$i]['end'] = false;
+                    $result[$i]['children'] = array();
+
+                    foreach ($store as $k1 => $v1) {
+                        $child = array();
+                        $child['id'] = $v1['id'];
+                        $child['name'] = $v1['name'];
+                        $child['code'] = $v1['code'];
+                        $child['type_name'] = $v['name'];
+                        $child['select'] = 2;
+                        $child['end'] = true;
+                        if (isset($data[$v1['id']]) && $data[$v1['id']]) {
+                            $child['select'] = 1;
+                        }
+                        $result[$i]['children'][] = $child;
+                    }
+                    $i++;
+                }
+            }
+        }
+        return Dever::outDiy($result);
+    }
+
+    public function home_api()
+    {
+        $data = array();
+        $data['id'] = Dever::input('id', 1);
+        $data['role'] = Dever::input('role');
+        $data['table'] = Dever::input('table');
+        $data['name'] = '门店';
+        $data['host'] = Dever::url('lib/set_store.home?role=' . $data['role'] . '&table=' . $data['table'], 'servicer');
+        $data['url'] = Dever::url('lib/set_store.getList?id=' . $data['id'] . '&role=' . $data['role'] . '&table=' . $data['table'], 'servicer');
+        $data['search'] = Dever::url('lib/set_store.search?yes='.$data['id'].'&role=' . $data['role'] . '&table=' . $data['table'] . '&json=1', 'servicer');
+        $data['submit'] = Dever::url('lib/set_store.set_commit?json=1', 'servicer');
+
+        return Dever::render('set_store', $data);
+    }
+
+    public function set_commit_api()
+    {
+        $value = Dever::input('value');
+        if (!$value) {
+            Dever::alert('未选择');
+        }
+        $value = Dever::json_decode($value);
+        $id = Dever::input('id');
+        $role = Dever::input('role');
+        $table = Dever::input('table');
+
+        $col = $role . '_' . $table . '_id';
+        $table = '' . $role . '/' . $table . '_store';
+        $where['option_' . $col] = $id;
+        $where['set_state'] = 2;
+        Dever::db($table)->updates($where);
+
+        foreach ($value as $k => $v) {
+            $w = array();
+            $w[$role . '_' . $table . '_id'] = $v['id'];
+            $w[$col] = $id;
+            $info = Dever::db($table)->one($w);
+
+            if (!$info) {
+                Dever::db($table)->insert($w);
+            } else {
+                $w['where_id'] = $info['id'];
+                $w['state'] = 1;
+                Dever::db($table)->update($w);
+            }
+        }
+
+        return 'refer';
+    }
+}

+ 5 - 0
src/dai/servicer/template/manage/order_goods.php

@@ -0,0 +1,5 @@
+<?php
+
+$view
+->fetch('#show', 'servicer/lib/manage.show')
+->display();

+ 354 - 0
src/dai/supplier/assets/pc/html/set_supplier.html

@@ -0,0 +1,354 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
+<meta name="author" content="siweiyong 2602812659@qq.com"/>
+<title>设置供应商</title>
+<link rel="stylesheet" href="../script/lib/miniui/themes/default/miniui.css">
+<link rel="stylesheet" href="../script/lib/layui/css/layui.css" />
+<link rel="stylesheet" href="../script/lib/cashier/common.css">
+<link rel="stylesheet" href="../script/lib/layui/admin/modules/plugin/formselects/formselects.css" media="all" />
+<script src="../script/lib/jquery/jquery.min.js"></script>
+<script src="../script/lib/miniui/miniui.js"></script>
+<script src="../script/lib/layui/layui.js"></script>
+<script><{Dever::script()}></script>
+<script src="../script/dever/core.js"></script>
+</head>
+<body style="background: #F6F7F9;">
+<div class="main">
+<form class="layui-form" lay-filter="form">
+    <div class="layui-row">
+        <div class="main_left layui-col-xs12 layui-col-md3">
+            <div class="layui-row">
+                <div class="top">
+                    <i class="layui-icon layui-icon-app"></i>供应商列表
+                </div>
+                <div class="left_main">
+                    <input id="key" class="mini-textbox" onenter="onKeyEnter" value="请输入供应商名称" onclick="setVal('key')"/>
+                    <a class="mini-button" onclick="search()">查询</a> 
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="addGoods()">一键添加</button>
+                    <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="delGoods()">一键删除</button>
+                    <ul id="tree1" class="mini-tree" url="<{$url}>" showTreeIcon="true" textField="name" idField="id" expandOnLoad="true" onNodeClick="onNodeClick">
+                    </ul>
+
+                </div>
+            </div>
+        </div>
+        <div class="main_right layui-col-xs12 layui-col-md9">
+            <div class="layui-row">
+                <div class="top">
+                    <label>切换<{$name}>:</label>
+                    <div class="layui-input-inline">
+
+                        <div><select xm-select="sid" xm-select-skin="normal" xm-select-search="<{$search}>" xm-select-search-type="dl" xm-select-radio="" class="update_value form-control layui-input layui-select" name="sid" id="sid"  ></select></div>
+
+                    </div>
+                    <div class="layui-input-inline">
+                        <button class="layui-btn layui-btn-button" type="button" style="vertical-align: middle;margin-bottom: 2px;" onclick="setShop()">确认切换</button>
+                    </div>
+                </div>
+                <div class="goods_list" style="height:645px;">
+                    <table class="layui-table">
+                        <thead>
+                            <tr>
+                                <th lay-data="{field:'id'}">供应商ID</th>
+                                <th lay-data="{field:'id'}">供应商编码</th>
+                                <th lay-data="{field:'name'}">供应商名称</th>
+                                <th lay-data="{field:'name'}">供应商类型</th>
+                                <th lay-data="{field:'name'}">优先级</th>
+                                <th lay-data="{field:'operation'}">操作</th>
+                            </tr>
+                        </thead>
+                        <tbody id="goods">
+                            
+                        </tbody>
+                    </table>
+                </div>
+                <div class="total ft16">
+                    合计:【<span> 分配供应商总数:<i class="totalNum">0</i> </span>】
+                </div>
+                <div class="towbtn">
+                    <input type="button" id="settlement" value="确认分配">
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+</form>
+</div>
+<script>
+    var form;
+    layui.config(
+    {
+        base: '../script/lib/layui/admin/' //静态资源所在路径
+        ,version: true
+    }).extend(
+    {
+        index: 'lib/index', //主入口模块
+        formSelects: 'plugin/formselects/formselects'
+    }).use(['index', 'contlist', 'table', 'form', 'formSelects','layer'], function()
+    {
+        var table = layui.table;
+        form = layui.form; 
+        var formSelects = layui.formSelects;
+    });
+
+    $(function()
+    {
+        $("#settlement").click(function(){
+            var url = '<{$submit}>';
+            var id = '<{$id}>';
+            var role = '<{$role}>';
+
+            layui.layer.confirm('确定进行此项设置吗?', function() {
+                var goods_string = JSON.stringify(goods);
+
+                var data = {};
+                data = {id:id, role:role, value:goods_string};
+                $.post(url, data, function(t) {
+                    t = JSON.parse(t);
+                    if (t.status == 1) {
+                        layui.layer.alert('设置成功', function(index){
+                          if (t.data == 'refer') {
+                                history.back();
+                            } else {
+                                location.href = t.data;
+                            }
+                          layer.close(index);
+                        });
+                    } else {
+                        layui.layer.alert(t.msg);
+                    }
+                });
+            });
+        });
+        $("#goods").on("keyup", ".goods_num", function() {
+            var num = parseFloat($(this).val());
+            if (num < 0) {
+                num = 1;
+                $(this).val(1);
+            }
+            var id = $(this).parent().attr('value');
+            goods[id].reorder = num;
+            setTotal();
+        });
+    })
+    var goods = {};
+    var del_goods = {};
+    mini.parse();
+    var tree = mini.get("tree1");
+    for (var i in tree.data) {
+        if (typeof(tree.data[i].children) == 'object') {
+            if (tree.data[i].children.length > 0) {
+                for (var j in tree.data[i].children) {
+                    if(tree.data[i].children[j].select == 1) {
+                        setGoods(tree.data[i].children[j]);
+                    }
+                }
+            } else if(tree.data[i].select == 1) {
+                setGoods(tree.data[i]);
+            }
+        }
+    }
+    function search() 
+    {
+        var key = mini.get("key").getValue();
+        if (key == "") {
+            tree.clearFilter();
+        } else {
+            key = key.toLowerCase();                
+            tree.filter(function (node) {
+                var name = node.name ? node.name.toLowerCase() : "";
+                if (name.indexOf(key) != -1) {
+                    return true;
+                }
+            });
+        }
+    }
+    function onKeyEnter(e)
+    {
+        search();
+    }
+
+    function onNodeClick()
+    {
+        var tree=mini.get("tree1");
+        node=tree.getSelectedNode();
+        if(node.end) {
+            setGoods(node);
+        }
+    }
+
+    function setGoods(node)
+    {
+        if (node.id) {
+            var key = node.id;
+            if (!goods[key]) {
+                goods[key] = node;
+                goods[key].reorder = goods[key].reorder ? parseFloat(goods[key].reorder) : 1;
+                create(node);
+                setTotal();
+            } else {
+                add(key);
+            }
+        }
+    }
+
+    function unsetGoods(node)
+    {
+        if (node.id) {
+            if (goods[node.id]) {
+                delete goods[node.id];
+                get(node.id).remove();
+            }
+        }
+    }
+
+    function get(key)
+    {
+        return $('#goods_' + key);
+    }
+
+    function create(node)
+    {
+        if (!get(node.id).length) {
+            var addtr = '<tr class="mytr" id="goods_'+node.id+'">';
+            addtr += '<td class="goods_id">'+node.id+'</td>';
+            addtr += '<td class="goods_id">'+node.code+'</td>';
+            addtr += '<td class="goods_name">'+node.name+'</td>';     
+            addtr += '<td class="goods_name">'+node.type_name+'</td>';        
+            addtr += '<td><div class="jiajian" value='+node.id+'><span class="jian" onclick="dec(\''+node.id+'\')">-</span><input type="text" value="'+node.reorder+'" class="goods_num"><span class="jia" onclick="add(\''+node.id+'\')">+</span></div></td>';
+            addtr += '<td><a class="delete_btn" onclick="del(\''+node.id+'\')">删除</a></td>';        
+            addtr += '</tr>';
+            $("#goods").append(addtr);
+        }
+    }
+
+    function add(id)
+    {
+        goods[id].reorder += 1;
+        get(id).find('.goods_num').val(goods[id].reorder);
+        setTotal();
+    }
+    
+    function dec(id)
+    {
+        goods[id].reorder -= 1;
+        if (goods[id].reorder < 1) {
+            goods[id].reorder = 0;
+        }
+
+        get(id).find('.goods_num').val(goods[id].reorder);
+        setTotal();
+    }
+
+    function del(id)
+    {
+        if (confirm('确定删除吗?')) {
+            delete goods[id];
+			get(id).remove();
+			setTotal();
+        }
+    }
+
+    // 一键添加
+    function addGoods()
+    {
+        var key = mini.get("key").getValue();
+        if (key == '请输入供应商名称') {
+            key = '';
+        }
+        if (key) {
+            key = key.toLowerCase();
+        }
+        for (var i in tree.data) {
+            if (typeof(tree.data[i].children) == 'object') {
+                if (tree.data[i].children.length > 0) {
+                    for (var j in tree.data[i].children) {
+                        if (key) {
+                            var name = tree.data[i].children[j].name;
+                            if (name.indexOf(key) != -1) {
+                                setGoods(tree.data[i].children[j]);
+                            }
+                        } else {
+                            setGoods(tree.data[i].children[j]);
+                        }
+                    }
+                } else {
+                    if (key) {
+                        var name = tree.data[i].name;
+                        if (name.indexOf(key) != -1) {
+                            setGoods(tree.data[i]);
+                        }
+                    } else {
+                        setGoods(tree.data[i]);
+                    }
+                }
+            }
+        }
+    }
+
+    // 一键删除
+    function delGoods()
+    {
+        if (confirm('确定删除吗?')) {
+            var key = mini.get("key").getValue();
+            if (key == '请输入供应商名称') {
+                key = '';
+            }
+            if (key) {
+                key = key.toLowerCase();
+            }
+            for (var i in tree.data) {
+                if (typeof(tree.data[i].children) == 'object') {
+                    if (tree.data[i].children.length > 0) {
+                        for (var j in tree.data[i].children) {
+                            if (key) {
+                                var name = tree.data[i].children[j].name;
+                                if (name.indexOf(key) != -1) {
+                                    unsetGoods(tree.data[i].children[j]);
+                                }
+                            } else {
+                                unsetGoods(tree.data[i].children[j]);
+                            }
+                        }
+                    } else {
+                        if (key) {
+                            var name = tree.data[i].name;
+                            if (name.indexOf(key) != -1) {
+                                unsetGoods(tree.data[i]);
+                            }
+                        } else {
+                            unsetGoods(tree.data[i]);
+                        }
+                    }
+                }
+            }
+            setTotal();
+        }
+    }
+
+    function setTotal()
+    {
+        var num = 0;
+        for (var i in goods) {
+            num += 1;
+        }
+        $(".totalNum").html(num);
+    }
+
+    function setShop()
+    {
+        var sid = $('.xm-select-parent[fs_id="sid"] span[fsw="xm-select"]').attr('value');
+        if (!sid) {
+            layui.layer.alert('请选择<{$name}>');
+            return;
+        }
+        layui.layer.confirm('确定切换<{$name}>吗?', function() {
+            location.href = '<{$host}>&id=' + sid;
+        });
+    }
+</script>
+</body>
+</html>

+ 208 - 0
src/dai/supplier/database/goods.php

@@ -0,0 +1,208 @@
+<?php
+$status = Dever::config('base')->status;
+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,
+        ),
+
+        'supplier_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属供应商',
+            'default'   => '',
+            'desc'      => '所属供应商',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'search'    => 'hidden',
+            'value'     => Dever::input('search_option_supplier_id'),
+            'list'      => 'Dever::load("supplier/info-one#name", {supplier_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-one#name", {goods_id})',
+        ),
+
+        'sku_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '规格型号',
+            'default'   => '-1',
+            'desc'      => '规格型号',
+            'match'     => 'is_numeric',
+        ),
+
+        'cost_price'       => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '成本价',
+            'default'   => '',
+            'desc'      => '成本价',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => 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,
+    ),
+
+    'request' => array
+    (
+        # 后台搜索用到,也可以不加,自动生成
+        'search' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'supplier_id' => array('yes-t_1.supplier_id'),
+                'status' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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_2.id as value, "" as selected, "" as disabled',
+        ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'supplier_id' => array('yes-t_1.supplier_id'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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.*',
+        ),
+
+        'getDataPage' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'supplier_id' => array('yes-t_1.supplier_id'),
+                'name' => array('yes-t_2.name', 'like'),
+                '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' => 'yes-t_2.status-1',
+                'state' => 'yes-t_2.state-1',
+                'state_1' => 'yes-t_1.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'),
+            'page' => array(10, 'list'),
+            'col' => '*,t_2.*',
+        ),
+
+        'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'supplier_id' => 'yes',
+                'goods_id' => 'yes',
+                'sku_id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => '*',
+        ),
+    ),
+);

+ 359 - 0
src/dai/supplier/database/info.php

@@ -0,0 +1,359 @@
+<?php
+
+$type = function()
+{
+	$array = array();
+	$data = Dever::load('supplier/type-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+$category = function()
+{
+	$array = array();
+	$data = Dever::load('goods/category-getTop');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+$identity = array
+(
+	1 => '个人',
+	2 => '个体户',
+	3 => '企业',
+);
+
+$status = array
+(
+    1 => '启用',
+    2 => '禁用',
+);
+
+return array
+(
+	# 表名
+	'name' => 'info',
+	# 显示给用户看的名称
+	'lang' => '供应商列表',
+	# 是否显示在后台菜单
+	'order' => 11,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '供应商ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '供应商名称',
+			'default' 	=> '',
+			'desc' 		=> '供应商名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+        'code'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '供应商编码',
+            'default'   => '',
+            'desc'      => '供应商编码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+		'type_id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '供应商类型',
+            'default'   => '1',
+            'desc'      => '供应商类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'list'      => true,
+        ),
+
+        'category'		=> array
+		(
+			'type' 		=> 'varchar-2000',
+			'name' 		=> '商品属性分类-如不选择就是可以销售所有商品属性分类下的商品',
+			'default' 	=> '',
+			'desc' 		=> '商品属性分类',
+			'match' 	=> 'is_string',
+			'update'	=> 'checkbox',
+			'option'	=> $category,
+		),
+
+		'truename'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '联系人姓名',
+            'default'   => '',
+            'desc'      => '请输入联系人姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'		=> 1,
+        ),
+
+        'tel'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '联系人电话',
+            'default'   => '',
+            'desc'      => '请输入联系人电话',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'		=> 1,
+        ),
+
+        'email'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '联系人邮箱',
+            'default'   => '',
+            'desc'      => '联系人邮箱',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'tab'       => 1,
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '联系人所在区县',
+            'default'   => '',
+            'desc'      => '联系人所在区县',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=3', 'area'),
+            //'list'      => 'Dever::load("area/api.string", "{area}")',
+            'tab'		=> 1,
+        ),
+
+        'province'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '省份',
+            'default'   => '',
+            'desc'      => '省份',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'		=> 1,
+        ),
+
+        'city'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '城市',
+            'default'   => '',
+            'desc'      => '城市',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'		=> 1,
+        ),
+
+        'county'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '县区',
+            'default'   => '',
+            'desc'      => '县区',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'tab'		=> 1,
+        ),
+
+        'address'       => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '联系人详细地址',
+            'default'   => '',
+            'desc'      => '联系人详细地址',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'        => true,
+            'tab'		=> 1,
+        ),
+
+        'identity'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '供应商身份',
+            'default'   => '1',
+            'desc'      => '供应商身份',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $identity,
+            'control'	=> 'identity',
+            'tab'		=> 2,
+        ),
+
+        'idcard_front'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证正面-如果是个人,这里上传联系人身份证,如果是个体户或者企业,这里上传法人身份证',
+            'default'   => '',
+            'desc'      => '身份证正面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'tab'		=> 2,
+        ),
+
+        'idcard_back'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证背面-如果是个人,这里上传联系人身份证,如果是个体户或者企业,这里上传法人身份证',
+            'default'   => '',
+            'desc'      => '身份证背面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'tab'		=> 2,
+        ),
+
+        'company_license'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '营业执照',
+            'default'   => '',
+            'desc'      => '营业执照',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+            'show'		=> 'identity=2,3',
+            'tab'		=> 2,
+        ),
+
+        'company_name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '企业全称',
+            'default'   => '',
+            'desc'      => '企业全称',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'show'      => 'identity=2,3',
+            'tab'       => 2,
+        ),
+
+        'company_number'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '社会信用代码',
+            'default'   => '',
+            'desc'      => '社会信用代码',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'show'		=> 'identity=2,3',
+            'tab'		=> 2,
+        ),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'list'		=> true,
+			'order'		=> 'desc',
+			'edit'		=> 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
+	(
+        'delete' => false,
+		'tab' => array('基本设置', '联系人信息', '认证信息'),
+		'button' => array
+        (
+            //'类型配置' => array('list', 'type&oper_parent=info'),
+        ),
+        'list_button' => array
+        (
+        	'location' => array('商品设置', Dever::url('lib/set.home?project=supplier&table=goods&info=info', 'goods')),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,code,type_id,state,cdate',
+		'value' => array
+		(
+			'"默认供应商", "default", 1, 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 105 - 0
src/dai/supplier/database/type.php

@@ -0,0 +1,105 @@
+<?php
+
+return array
+(
+	# 表名
+	'name' => 'type',
+	# 显示给用户看的名称
+	'lang' => '供应商类型',
+	# 是否显示在后台菜单
+	'order' => 1,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+			'order'		=> 'asc',
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '类型名称',
+			'default' 	=> '',
+			'desc' 		=> '类型名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'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,
+
+        # 自定义快捷新增和编辑
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+		'list_button' => array
+        (
+        	'edit' => array('编辑'),
+        )
+	),
+
+	'default' => array
+	(
+		'col' => 'name,state,cdate',
+		'value' => array
+		(
+			'"默认类型", 1,' . DEVER_TIME,
+		),
+	),
+
+	'request' => array
+	(
+		
+	)
+);

+ 8 - 0
src/dai/supplier/index.php

@@ -0,0 +1,8 @@
+<?php
+
+define('DEVER_APP_NAME', 'supplier');
+define('DEVER_APP_LANG', '供应商');
+define('DEVER_APP_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
+define('DEVER_MANAGE_ORDER', 90);
+define('DEVER_MANAGE_ICON', 'layui-icon-flag');
+include(DEVER_APP_PATH . '../boot.php');

+ 28 - 0
src/dai/supplier/lib/Manage.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace Supplier\Lib;
+
+use Dever;
+
+class Manage
+{
+    public function __construct()
+    {
+        Dever::load('manage/auth.init');
+    }
+
+    public function check($id, $name, $data)
+	{
+		$goods = Dever::param('goods', $data);
+		list($goods_id, $sku_id) = explode('-', $goods);
+		$where['goods_id'] = $goods_id;
+		$where['sku_id'] = $sku_id;
+		$where['supplier_id'] = Dever::input('update_supplier_id');
+		$info = Dever::db('supplier/goods')->getOne($where);
+		if (!$info) {
+			$supplier = Dever::db('supplier/info')->one($where['supplier_id']);
+			$goods_info = Dever::load('product/lib/info')->getBaseInfo($goods_id, $sku_id);
+			return Dever::alert($supplier['name'] . '无此商品:【' . $goods_info['aname'] . '】');
+		}
+	}
+}

+ 115 - 0
src/dai/supplier/lib/Set.php

@@ -0,0 +1,115 @@
+<?php
+
+namespace Supplier\Lib;
+
+use Dever;
+
+class Set
+{
+    public function __construct()
+    {
+        Dever::load('manage/auth.init');
+    }
+
+    # 获取下游
+    public function search_api()
+    {
+        $role = Dever::input('role');
+        return Dever::search('' . $role . '/info');
+    }
+
+    # 分配供应商
+    public function getList_api()
+    {
+        $role = Dever::input('role');
+        $id = Dever::input('id', 1);
+        $data = Dever::db(''.$role.'/supplier')->getAll(array($role . '_id' => $id));
+        $type = Dever::db('supplier/type')->select();
+        
+        $result = array();
+        if ($type) {
+            $i = 0;
+            foreach ($type as $k => $v) {
+                $supplier = Dever::db('supplier/info')->select(array('status' => 1, 'type_id' => $v['id']));
+                if ($supplier) {
+                    $result[$i] = array();
+                    $result[$i]['id'] = $v['id'];
+                    $result[$i]['name'] = $v['name'];
+                    $result[$i]['select'] = 2;
+                    $result[$i]['end'] = false;
+                    $result[$i]['children'] = array();
+
+                    foreach ($supplier as $k1 => $v1) {
+                        $child = array();
+                        $child['id'] = $v1['id'];
+                        $child['name'] = $v1['name'];
+                        $child['code'] = $v1['code'];
+                        $child['type_name'] = $v['name'];
+                        $child['reorder'] = $v1['reorder'];
+                        $child['select'] = 2;
+                        $child['end'] = true;
+                        if (isset($data[$v1['id']]) && $data[$v1['id']]) {
+                            $child['select'] = 1;
+                            $child['reorder'] = $data[$v1['id']]['reorder'];
+                        }
+                        $result[$i]['children'][] = $child;
+                    }
+                    $i++;
+                }
+            }
+        }
+        return Dever::outDiy($result);
+    }
+
+    public function home_api()
+    {
+        $data = array();
+        $data['id'] = Dever::input('id', 1);
+        $data['role'] = Dever::input('role');
+        $data['name'] = '经销商';
+        if ($data['role'] == 'servicer') {
+            $data['name'] = '配送商';
+        }
+        $data['host'] = Dever::url('lib/set.home?role=' . $data['role'], 'supplier');
+        $data['url'] = Dever::url('lib/set.getList?id=' . $data['id'] . '&role=' . $data['role'], 'supplier');
+        $data['search'] = Dever::url('lib/set.search?yes='.$data['id'].'&role=' . $data['role'] . '&json=1', 'supplier');
+        $data['submit'] = Dever::url('lib/set.set_commit?json=1', 'supplier');
+
+        return Dever::render('set_supplier', $data);
+    }
+
+    public function set_commit_api()
+    {
+        $value = Dever::input('value');
+        if (!$value) {
+            Dever::alert('未选择');
+        }
+        $value = Dever::json_decode($value);
+        $id = Dever::input('id');
+        $role = Dever::input('role');
+
+        $col = $role . '_id';
+        $table = '' . $role . '/supplier';
+        $where['option_' . $col] = $id;
+        $where['set_state'] = 2;
+        Dever::db($table)->updates($where);
+
+        foreach ($value as $k => $v) {
+            $w = array();
+            $w['supplier_id'] = $v['id'];
+            $w[$col] = $id;
+            $info = Dever::db($table)->one($w);
+
+            $w['reorder'] = $v['reorder'];
+            if (!$info) {
+                Dever::db($table)->insert($w);
+            } else {
+                $w['where_id'] = $info['id'];
+                $w['state'] = 1;
+                Dever::db($table)->update($w);
+            }
+        }
+
+        return 'refer';
+    }
+}

+ 327 - 0
src/set/database/category.php

@@ -0,0 +1,327 @@
+<?php
+
+$status = array
+(
+	1 => '启用',
+	2 => '不启用',
+);
+
+$type = array
+(
+	1 => '商品',
+	2 => '资源',
+);
+
+return array
+(
+	# 表名
+	'name' => 'category',
+	# 显示给用户看的名称
+	'lang' => '属性分类',
+	# 是否显示在后台菜单
+	'order' => 300,
+
+	'end' => array
+	(
+		'insert' => 'set/lib/category.update',
+		'update' => 'set/lib/category.update',
+	),
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'list'		=> true,
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '分类名称',
+			'default' 	=> '',
+			'desc' 		=> '分类名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'type'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '所属类型',
+			'default' 	=> '1',
+			'desc' 		=> '所属类型',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $type,
+			'search'	=> 'select',
+			'list'		=> true,
+		),
+
+		'parent'		=> array
+		(
+			'type' 		=> 'varchar-800',
+			'name' 		=> '上级分类',
+			'default' 	=> Dever::input('option_parent', -1),
+			'desc' 		=> '请选择上级分类',
+			'match' 	=> 'option',
+			'update'	=> 'linkage',
+			'linkage' 	=> 'id=' . Dever::input('where_id'),
+			'option'	=> Dever::url('lib/category.get', 'set'),
+		),
+
+		'parent_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '上级分类',
+			'default' 	=> -1,
+			'desc' 		=> '请选择上级分类',
+			'match' 	=> 'option',
+			'value'		=> Dever::input('option_parent_id', -1),
+			'list_name'	=> '属性',
+			'list'		=> 'Dever::load("set/lib/attr.getInfoByCate", {id})',
+		),
+
+		'top_parent_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '顶级分类',
+			'default' 	=> -1,
+			'desc' 		=> '请选择顶级分类',
+			'match' 	=> 'is_numeric',
+		),
+
+		'set-category_attr'=> array
+		(
+			'name' 		=> '属性设置',
+			'default' 	=> '',
+			'desc' 		=> '请先选择属性分类',
+			'match' 	=> 'option',
+			# 同步更新另外一个表的内容,两个表相关联的id,更新另一个表的字段
+			'sync'		=> array('id', 'category_id'),
+			# 根据category字段的值,获取set/attr.search接口的内容
+			'update'	=> array(1),
+		),
+
+		'level'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '分类级别-1为顶级分类、2为2级分类,-1为最后一级分类',
+			'default' 	=> 1,
+			'desc' 		=> '分类级别',
+			'match' 	=> 'is_numeric',
+		),
+
+		'key'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '分类标识-该标识一般为前台样式名称,选填项',
+			'default' 	=> '',
+			'desc' 		=> '标识',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			//'search'	=> 'fulltext',
+			//'list'		=> true,
+			//'edit'		=> true,
+			'tab'		=> 1,
+		),
+
+		'icon'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '图标',
+			'default' 	=> '',
+			'desc' 		=> '图标',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key'		=> 1,
+			'tab'		=> 1,
+		),
+
+		'size'		=> array
+		(
+			'type' 		=> 'varchar-10',
+			'name' 		=> '字体大小-字体px值,为空则使用系统默认字体大小',
+			'default' 	=> '',
+			'desc' 		=> '字体大小',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'tab'		=> 1,
+		),
+
+		'color'		=> array
+		(
+			'type' 		=> 'varchar-10',
+			'name' 		=> '字体颜色-请填写颜色代码',
+			'default' 	=> '',
+			'desc' 		=> '字体颜色',
+			'match' 	=> 'option',
+			'update'	=> 'color',
+			'tab'		=> 1,
+		),
+
+		'bgcolor'		=> array
+		(
+			'type' 		=> 'varchar-10',
+			'name' 		=> '背景颜色-请填写颜色代码',
+			'default' 	=> '',
+			'desc' 		=> '背景颜色',
+			'match' 	=> 'option',
+			'update'	=> 'color',
+			'tab'		=> 1,
+		),
+
+		'status'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '是否启用',
+			'default' 	=> '1',
+			'desc' 		=> '是否启用',
+			'match' 	=> 'is_numeric',
+			//'update'	=> 'select',
+			'option'	=> $status,
+			'list'		=> true,
+			'edit'		=> true,
+		),
+
+		'reorder'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '排序(数值越大越靠前)',
+			'default' 	=> '1',
+			'desc' 		=> '请输入排序',
+			'match' 	=> 'option',
+			//'update'	=> 'text',
+			'search'	=> 'order',
+			'list_name' => '排序',
+			'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
+	(
+		'lang' => 'name',
+		'tab' => array('基础设置', '前端样式'),
+		# 列表页的类型
+		'list_type' => 'tree',
+		'list_button' => array
+		(
+			'add' => array('新增子分类', '"{parent}" == -1 ? "category&option_parent={id}" : "category&option_parent={parent},{id}"'),
+
+			'list' => array('属性设置', '"category_attr&search_option_category_id={id}&oper_table=category"'),
+		),
+	),
+
+	'request' => array
+	(
+		'getOne' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'id,name,parent_id',
+        ),
+
+		# 获取顶级分类
+		'getTop' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'name' => array('yes', 'like'),
+                'id' => 'yes',
+				'parent_id' => -1,
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'asc'),
+			'col' => '*,name as name, id, id as value, "" as selected, "" as disabled|id',
+		),
+
+		'getChild' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'parent_id' => 'yes',
+				'top_parent_id' => 'yes',
+				'level' => 'yes',
+				'parent_id_in' => array('yes-parent_id', 'in'),
+				'id' => array('yes', '!='),
+				'parent' => array('yes', 'like'),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'asc'),
+			'col' => '*|parent_id|',
+		),
+
+		'getList' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'parent_id' => 'yes',
+				'top_parent_id' => 'yes',
+				'level' => 'yes',
+				'parent_id_in' => array('yes-parent_id', 'in'),
+				'id' => array('yes', '!='),
+				'parent' => array('yes', 'like'),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'asc'),
+			'col' => '*',
+		),
+
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'parent_id' => 'yes',
+				'id' => array('yes', '!='),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('reorder' => 'desc', 'id' => 'asc'),
+			'col' => 'id as value, name',
+		),
+	)
+);

+ 441 - 0
src/set/database/category_attr.php

@@ -0,0 +1,441 @@
+<?php
+
+$col = 'id,name,is_must,`type`,data_type,`match`,`unit`,ename,icon,color,bgcolor,list_reorder,search_reorder,view_reorder,cate_id,state';
+$type = array
+(
+	1 => '数字输入框',
+	2 => '单行输入框',
+	3 => '多行输入框',
+	//4 => '图文编辑器',
+	5 => '单图片上传',
+	6 => '多图片上传',
+	7 => '地区选择器',
+	//8 => '多级分类',
+	9 => '区间输入框',
+
+	10 => '单选框',
+	11 => '多选框',
+	12 => '单项选择框',
+);
+
+$is_must = array
+(
+	1 => '必填项',
+	2 => '选填项',
+);
+
+$data_type = array
+(
+	1 => '数字',
+	2 => '字符',
+	3 => '正则匹配',
+);
+
+
+/*
+使用该组件,这么用
+$attr = function()
+{
+	$auth = Dever::load('attr/api.get', false);
+	return $auth;
+};
+
+'attr'		=> array
+(
+	'type' 		=> 'varchar-800',
+	'name' 		=> '属性设置',
+	'default' 	=> '',
+	'desc' 		=> '属性设置',
+	'match' 	=> 'option',
+	'update'	=> 'checkbox',
+	'option'	=> $attr,
+	'update_input' => '',
+	'update_input_default' => '',
+	'update_parent' => 'checkbox',
+),
+
+'attr_input'		=> array
+(
+	'type' 		=> 'text-255',
+	'name' 		=> '属性值设置',
+	'default' 	=> '',
+	'desc' 		=> '属性值设置',
+	'match' 	=> 'option',
+),
+*/
+
+return array
+(
+	# 表名
+	'name' => 'category_attr',
+	# 显示给用户看的名称
+	'lang' => '属性设置',
+	# 是否显示在后台菜单
+	'order' => 10,
+	'menu'	=> false,
+
+	# 数据结构
+	'struct' => array
+	(
+		'id' 		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> 'ID',
+			'default' 	=> '',
+			'desc' 		=> '',
+			'match' 	=> 'is_numeric',
+			'order'		=> 'desc',
+			'list'		=> true,
+		),
+
+		'name'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '名称',
+			'default' 	=> '',
+			'desc' 		=> '名称',
+			'match' 	=> 'is_string',
+			'update'	=> 'text',
+			'search'	=> 'fulltext',
+			'list'		=> true,
+			'edit'		=> true,
+			'tab'		=> 0,
+		),
+
+		'category_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '分类',
+			'default' 	=> '-1',
+			'desc' 		=> '分类',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_category_id'),
+			//'list'		=> '{category_id} > 0 ? Dever::load("goods/category-one#name", {category_id}) : "未选择"',
+			'tab'		=> 0,
+		),
+
+		'is_must'	  => array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '是否必填',
+			'default' 	=> '1',
+			'desc' 		=> '是否必填',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $is_must,
+			'search'	=> 'select',
+			'list'		=> true,
+			'edit'		=> true,
+			'tab'		=> 0,
+		),
+
+		'type'	  => array
+		(
+			'type' 		=> 'tinyint-11',
+			'name' 		=> '录入类型-配置录入类型后可以在商品录入时进行属性设置',
+			'default' 	=> '1',
+			'desc' 		=> '录入类型',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $type,
+			//'search'	=> 'select',
+			//'list'		=> true,
+			'control'	=> 'type',
+			'tab'		=> 0,
+		),
+
+        'data_type'	  => array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '数据验证类型-选择类型之后会自动验证数据有效性',
+			'default' 	=> '1',
+			'desc' 		=> '数据验证类型',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'radio',
+			'option'	=> $data_type,
+			'search'	=> 'select',
+			//'list'		=> true,
+			'control' 	=> 'data_type',
+			'show'      => 'type=2',
+			'tab'		=> 0,
+		),
+
+		'match'		=> array
+		(
+			'type' 		=> 'varchar-600',
+			'name' 		=> '正则匹配规则-直接输入正则表达式即可',
+			'default' 	=> '',
+			'desc' 		=> '正则匹配规则',
+			'match' 	=> 'option',
+			'update'	=> 'textarea',
+			//'search'	=> 'fulltext',
+			//'list'		=> true,
+			//'edit'		=> true,
+			'show'		=> array('data_type' => 3),
+			'tab'		=> 0,
+		),
+
+		'list_reorder'	  => array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '列表页排序-设置该属性在列表页中的排序,数字越大越靠前,如果为负数或者0,则不加入到列表页中。也同时影响后台显示排序。',
+			'default' 	=> '1',
+			'desc' 		=> '是否作为搜索条件',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			'show'      => 'type=1,2,7,9,10,11,12',
+			//'search'	=> 'order',
+			'order'		=> 'desc',
+			'edit'		=> true,
+			'list'		=> true,
+			'tab'		=> 2,
+		),
+
+		'search_reorder'	  => array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '搜索条件排序-设置搜索条件中的排序,数字越大越靠前,如果为负数或者0,则不加入到搜索条件中。',
+			'default' 	=> '1',
+			'desc' 		=> '是否作为搜索条件',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			'show'      => 'type=1,2,7,9,10,11,12',
+			//'search'	=> 'order',
+			//'order'		=> 'desc',
+			'edit'		=> true,
+			//'list'		=> true,
+			'tab'		=> 2,
+		),
+
+		'view_reorder'	  => array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '详情页排序-设置该属性在详情页中的排序,数字越大越靠前,如果为负数或者0,则不加入到详情页中。',
+			'default' 	=> '1',
+			'desc' 		=> '详情页排序',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'text',
+			//'show'      => 'type=1,2,7,9,10,11,12',
+			//'search'	=> 'order',
+			//'order'		=> 'desc',
+			'edit'		=> true,
+			//'list'		=> true,
+			'tab'		=> 2,
+		),
+
+		'key'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '标识-该标识一般为前台样式名称,选填项',
+			'default' 	=> '',
+			'desc' 		=> '标识',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			//'search'	=> 'fulltext',
+			//'list'		=> true,
+			//'edit'		=> true,
+			'tab'		=> 1,
+		),
+
+		'unit'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '单位-填写属性单位,选填项',
+			'default' 	=> '',
+			'desc' 		=> '单位',
+			'match' 	=> 'option',
+			'update'	=> 'text',
+			'tab'		=> 1,
+		),
+
+		'icon'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '图标-属性图标,选填项',
+			'default' 	=> '',
+			'desc' 		=> '图标',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key'		=> 1,
+			'tab'		=> 1,
+		),
+
+		'color'		=> array
+		(
+			'type' 		=> 'varchar-10',
+			'name' 		=> '字体颜色-请填写颜色代码,选填项',
+			'default' 	=> '',
+			'desc' 		=> '字体颜色',
+			'match' 	=> 'option',
+			'update'	=> 'color',
+			'tab'		=> 1,
+		),
+
+		'bgcolor'		=> array
+		(
+			'type' 		=> 'varchar-10',
+			'name' 		=> '背景颜色-请填写颜色代码,选填项',
+			'default' 	=> '',
+			'desc' 		=> '背景颜色',
+			'match' 	=> 'option',
+			'update'	=> 'color',
+			'tab'		=> 1,
+		),
+		
+		'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
+	(
+		'lang' => 'name,unit',
+		'tab' => array('基本配置', '扩展设置', '排序规则'),
+
+		'insert' => false,
+        'edit' => false,
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+
+		# 列表
+		'list_button' => array
+		(
+			'fast' => array('编辑'),
+
+			'list1' => array('属性值设置', '"category_attr_value&search_type=4&search_option_category_id={category_id}&search_option_attr_id={id}&oper_table=category_attr&top_table=category"' , '{type} > 9'),
+			'list2' => array('搜索值设置', '"category_attr_search&search_type=4&search_option_attr_id={id}&search_option_category_id={category_id}&oper_table=category_attr&top_table=category"' , '{type} == 1 || {type} == 9'),
+		),
+	),
+
+	'request' => array
+	(
+		'getOne' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'id' => 'yes',
+				'state' => 1,
+			),
+			'type' => 'one',
+			'col' => 'id,type,unit,name,icon as front_icon,color as front_color,bgcolor as front_bgcolor',
+		),
+
+		'getAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				//'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('list_reorder`+`search_reorder`+`view_reorder' => 'desc', 'id' => 'desc'),
+			'col' => $col. '|id',
+		),
+
+		'getAllByIds' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				//'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('list_reorder`+`search_reorder`+`view_reorder' => 'desc', 'id' => 'desc'),
+			'col' => $col. '|id',
+		),
+
+		'getListByIds' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'list_reorder' => array('yes', '>='),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('list_reorder' => 'desc', 'id' => 'desc'),
+			'col' => $col. '|id',
+		),
+
+		'getSearchByIds' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'search_reorder' => array('yes', '>='),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('search_reorder' => 'desc', 'id' => 'desc'),
+			'col' => $col. '|id',
+		),
+
+		'getViewByIds' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'view_reorder' => array('yes', '>='),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('view_reorder' => 'desc', 'id' => 'desc'),
+			'col' => $col. '|id',
+		),
+
+		'getCateAll' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'category_id' => array('yes', 'in'),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('list_reorder' => 'desc', 'id' => 'desc'),
+			'col' => '*',
+		),
+
+		/*
+		'getSearch' => array
+		(
+			# 匹配的正则或函数 选填项
+			'option' => array
+			(
+				'ids' => array('yes-id', 'in'),
+				'search_reorder' => array('yes', '>='),
+				'state' => 1,
+			),
+			'type' => 'all',
+			'order' => array('search_reorder' => 'desc', 'id' => 'desc'),
+			'col' => '*',
+		),
+		*/
+	)
+);

+ 144 - 0
src/set/database/category_attr_search.php

@@ -0,0 +1,144 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'category_attr_search',
+    # 显示给用户看的名称
+    'lang' => '搜索值设置',
+    # 是否显示在后台菜单
+    'order' => 9,
+    'menu'  => false,
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+
+        'category_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '分类',
+			'default' 	=> '-1',
+			'desc' 		=> '分类',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_category_id'),
+		),
+
+        'attr_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '属性id',
+            'default'   => '1',
+            'desc'      => '属性id',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_attr_id'),
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '搜索名称-如设置为100万以下',
+            'default'   => '',
+            'desc'      => '搜索名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'value'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '搜索值-直接输入要搜索的值即可,也可以设置为公式,如{v}<=100,{v}为当前值,如果是区间输入框,则{s}为区间最小值,{e}为区间最大值',
+            'default'   => '',
+            'desc'      => '搜索值',
+            'match'     => 'is_string',
+            'update'    => 'textarea',
+            'search'    => 'fulltext',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'search'    => 'order',
+            'list_name' => '排序',
+            '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
+    (
+    	'lang' => 'name,value',
+
+        'insert' => false,
+        'edit' => false,
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+        # 列表
+        'list_button' => array
+        (
+            'fast' => array('编辑'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'info_id' => 'yes',
+                'ids' => array('yes-id', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => '*',
+        ),
+    )
+);

+ 153 - 0
src/set/database/category_attr_value.php

@@ -0,0 +1,153 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'category_attr_value',
+    # 显示给用户看的名称
+    'lang' => '属性值设置',
+    # 是否显示在后台菜单
+    'order' => 9,
+    'menu'  => false,
+
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'list'      => true,
+        ),
+
+        'category_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '分类',
+			'default' 	=> '-1',
+			'desc' 		=> '分类',
+			'match' 	=> 'is_numeric',
+			'update'	=> 'hidden',
+			'value'		=> Dever::input('search_option_category_id'),
+		),
+
+        'attr_id'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '属性id',
+            'default'   => '1',
+            'desc'      => '属性id',
+            'match'     => 'is_numeric',
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_attr_id'),
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '属性值名称-如绿色',
+            'default'   => '',
+            'desc'      => '属性值名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+            'edit'      => true,
+        ),
+
+        'value'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '属性具体值-如上述名称为绿色,这里可以是绿色的色值,选填项,可以为空',
+            'default'   => '',
+            'desc'      => '属性具体值',
+            'match'     => 'option',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+        ),
+
+        'icon'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '图标-选填项',
+            'default'   => '',
+            'desc'      => '图标',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => 1,
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序(数值越大越靠前)',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'search'    => 'order',
+            'list_name' => '排序',
+            '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
+    (
+    	'lang' => 'name',
+
+        'insert' => false,
+        'edit' => false,
+        'button' => array
+        (
+            '新增' => array('fast'),
+        ),
+        # 列表
+        'list_button' => array
+        (
+            'fast' => array('编辑'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'attr_id' => 'yes',
+                'ids' => array('yes-id', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc', 'id' => 'desc'),
+            'col' => 'id,attr_id,name,value,icon,concat(attr_id, "-", id) as price_key|id',
+        ),
+    )
+);

Some files were not shown because too many files changed in this diff