dever 3 年之前
父節點
當前提交
8ad28cb3f2

+ 10 - 9
app/goods/database/coupon.php

@@ -4,7 +4,7 @@ $status = Dever::config('base')->status;
 $type = array
 (
     1 => '满减券',
-    2 => '通用券',
+    //2 => '通用券',
 );
 
 $method = array
@@ -16,13 +16,13 @@ $method = array
 
 $time = array
 (
-    1 => '3天',
-    2 => '7天',
-    3 => '15天',
-    4 => '30天',
-    5 => '90天',
-    6 => '182天',
-    7 => '365天',
+    3 => '3天',
+    7 => '7天',
+    15 => '15天',
+    30 => '30天',
+    90 => '90天',
+    182 => '182天',
+    365 => '365天',
 );
 
 return array
@@ -33,6 +33,7 @@ return array
     'lang' => '优惠券配置',
     # 后台菜单排序
     'order' => 100,
+    'time' => $time,
     # 数据结构
     'struct' => array
     (
@@ -81,7 +82,7 @@ return array
             'default'   => '3',
             'desc'      => '优惠券范围',
             'match'     => 'is_numeric',
-            'update'    => 'radio',
+            //'update'    => 'radio',
             'option'    => $method,
         ),
 

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

@@ -572,7 +572,7 @@ $config = array
                 'top_category_id' => 'yes',
                 'second_category_id' => 'yes',
                 'category_id' => 'yes',
-                //'status' => 1,
+                'status' => 1,
                 'state' => 1,
             ),
             'type' => 'all',

+ 258 - 14
app/mshop/lib/Buy.php

@@ -8,6 +8,140 @@ use Dever;
 
 class Buy
 {
+    # 获取配置
+    public $config = array();
+    # table
+    public $table = 'shop/buy_order';
+
+    public function __construct()
+    {
+        $this->config = Dever::db($this->table)->config;
+    }
+
+    # 获取公共的where
+    public function where($id)
+    {
+        $where = array();
+        $where['shop_id'] = $id;
+        if (!$where) {
+            Dever::alert('参数错误');
+        }
+
+        return $where;
+    }
+
+    # 获取订单列表
+    public function getList($id)
+    {
+        $result = array();
+        $where = $this->where($id);
+        $mobile = Dever::input('mobile');
+        if ($mobile) {
+            $where['mobile'] = $mobile;
+        }
+        $status = Dever::input('status');
+        if ($status) {
+            $where['status'] = $status;
+        }
+
+        $result['search_value'] = $where;
+        $result['search_value']['day'] = $day = Dever::input('day');
+        if ($day) {
+            $where['start'] = Dever::maketime($day . ' 00:00:00');
+            $where['end'] = Dever::maketime($day . ' 23:59:59');
+        }
+
+        $result['order'] = Dever::db($this->table)->getAll($where);
+
+        if ($result['order']) {
+            foreach ($result['order'] as $k => $v) {
+                $result['order'][$k] = $this->getInfo($v);
+            }
+        }
+
+        $result['search'] = array();
+        $result['search']['status'] = array
+        (
+            array('value' => 1, 'name' => '待支付'),
+            array('value' => 2, 'name' => '待审核'),
+            array('value' => 3, 'name' => '待发货'),
+            array('value' => 4, 'name' => '待收货确认'),
+            array('value' => 5, 'name' => '已完成'),
+            array('value' => 6, 'name' => '已完成(有退款)'),
+            array('value' => 7, 'name' => '已取消'),
+        );
+
+        return $result;
+    }
+
+    # 查看详情
+    public function getView($id, $order_id, $show = true)
+    {
+        $where = $this->where($id);
+        $where['id'] = $order_id;
+
+        $result = Dever::db($this->table)->find($where);
+
+        if (!$result) {
+            Dever::alert('订单不存在');
+        }
+
+        if ($show) {
+            $result = $this->getInfo($result, true);
+        }
+
+        return $result;
+    }
+
+    # 获取订单详细信息
+    public function getInfo($info, $view = false)
+    {
+        if ($info['status'] == 1) {
+            # 15分钟内支付,900秒
+            $m = 9000;
+            # 支付倒计时
+            $info['time'] = time() - $info['cdate'];
+            if ($info['time'] >= $m) {
+                # 已过期,自动取消
+                $info['time'] = -1;
+                Dever::db($this->table)->update(array('where_id' => $info['id'], 'status' => 11));
+                $info['status'] = 11;
+            } else {
+                $info['time'] = $m - $info['time'];
+            }
+        }
+
+        $info['status_name'] = $this->config['status'][$info['status']];
+
+        $info['goods'] = Dever::db('shop/buy_order_goods')->select(array('order_id' => $info['id']));
+        $info['shop'] = Dever::db('shop/info')->getOne($info['shop_id']);
+        $info['cdate'] = date('Y-m-d H:i', $info['cdate']);
+
+        if ($view) {
+            foreach ($info['goods'] as $k => $v) {
+                $info['goods'][$k]['info'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
+            }
+        } else {
+            foreach ($info['goods'] as $k => $v) {
+                $goods = Dever::db('goods/info')->one($v['goods_id']);
+                $info['goods'][$k]['name'] = $goods['name'];
+                $info['goods'][$k]['cover'] = $goods['cover'];
+            }
+        }
+
+        if ($info['fdate']) {
+            $info['fdate'] = date('Y-m-d H:i', $info['fdate']);
+        }
+        if ($info['qfdate']) {
+            $info['qfdate'] = date('Y-m-d H:i', $info['qfdate']);
+        }
+        if ($info['operdate']) {
+            $info['operdate'] = date('Y-m-d H:i', $info['operdate']);
+        }
+
+        return $info;
+    }
+
     # 发起支付
     public function action($shop, $name, $num, $goods, $price, $info, $refer = '')
     {
@@ -30,9 +164,6 @@ class Buy
         $order_data['town'] = $shop['town'];
 
         $order_data['order_num'] = $this->getOrderId();
-        $order_data['pay_id'] = $order_data['order_num'];
-        $order_data['pay_status'] = 1;
-        $order_data['pay_price'] = 0;
         $id = Dever::db('shop/buy_order')->insert($order_data);
 
         if (!$id) {
@@ -50,15 +181,21 @@ class Buy
             Dever::db('shop/buy_order_goods')->insert($data);
         }
 
-        if ($card || $price <= 0) {
+        if ($price <= 0) {
 
             $param['pay_product_id'] = $id;
-            $param['pay_order_id'] = $order_data['pay_id'];
+            $param['pay_order_id'] = $order_data['order_num'];
             $param['pay_status'] = 2;
             $param['pay_cash'] = $price;
             $param['pay_msg'] = '';
             $this->success($param);
-            return 'ok';
+            return array
+            (
+                'order' => '',
+                'order_num' => $order_data['order_num'],
+                'order_id' => $id,
+                'type' => 'pay',
+            );
         }
 
         $param = array
@@ -70,7 +207,7 @@ class Buy
             'name' => $order_data['name'],
             'cash' => $price,
             'product_id' => $id,
-            'order_id' => $order_data['pay_id'],
+            'order_id' => $order_data['order_num'],
             'refer' => $refer,
         );
 
@@ -80,13 +217,15 @@ class Buy
         }
 
         $result = Dever::load('pay/api.pay', $param);
+        $result['order_num'] = $order_data['order_num'];
+        $result['order_id'] = $id;
         return $result;
     }
 
     # 再次发起支付
     public function raction($id, $refer = '')
     {
-        $order = Dever::db('goods/order')->find($id);
+        $order = Dever::db('goods/buy_order')->find($id);
 
         if (!$order) {
             Dever::alert('订单信息错误');
@@ -99,12 +238,13 @@ class Buy
         $param = array
         (
             'project_id' => 1,
-            'account_id' => 5,
-            'uid' => -1;
+            'channel_id' => 1,
+            'system_source' => 5,
+            'uid' => -1,
             'name' => $order['name'],
             'cash' => $order['price'],
             'product_id' => $id,
-            'order_id' => $order['pay_id'],
+            'order_id' => $order['order_num'],
             'refer' => $refer,
         );
 
@@ -114,6 +254,8 @@ class Buy
         }
 
         $result = Dever::load('pay/api.pay', $param);
+        $result['order_num'] = $order['order_num'];
+        $result['order_id'] = $id;
 
         return $result;
     }
@@ -152,11 +294,8 @@ class Buy
                 
             }
 
-            $update['pay_status'] = $status;
             $update['status'] = 2;
             $update['where_id'] = $order['id'];
-            $update['pay_time'] = time();
-            $update['pay_price'] = $cash;
             Dever::db('shop/buy_order')->update($update);
         }
 
@@ -175,6 +314,111 @@ class Buy
         }
     }
 
+    # 取消订单
+    public function cancel($id, $order_id)
+    {
+        $data = $this->getView($id, $order_id, false);
+        if ($data['status'] == 1) {
+            $state = Dever::db('shop/buy_order')->update(array('where_id' => $data['id'], 'status' => 7, 'operdate' => time()));
+            if ($state) {
+                
+            }
+
+            return 'ok';
+        } else {
+            Dever::alert('当前订单状态不允许取消');
+        }
+    }
+
+    # 全部退款
+    public function tui($id, $order_id, $status = 6, $desc = '')
+    {
+        if ($status != 8 && $status != 9) {
+            Dever::alert('当前订单状态不允许退货退款');
+        }
+
+        $data = $this->getView($id, $order_id, false);
+        if ($data['status'] == 2) {
+            $state = Dever::db('shop/buy_order')->update(array('where_id' => $data['id'], 'status' => $status, 'tk_desc' => $desc, 'tk_cash' => $data['price']));
+
+            $this->pay_tui($state, $data, $data['price']);
+
+            return 'ok';
+        } else {
+            Dever::alert('当前订单状态不允许退货退款');
+        }
+    }
+
+    # 获取部分退款的详情
+    public function tui_one_info($id, $order_id, $order_goods_id)
+    {
+        $data = $this->getView($id, $order_id, false);
+        if ($data['status'] == 2 || $data['status'] == 3 || $data['status'] == 4) {
+            $info = Dever::db('shop/buy_order_goods')->find(array('id' => $order_goods_id, 'order_id' => $data['id'], 'shop_id' => $id));
+            if ($info && $info['status'] <= 4) {
+                $info['tui_price'] = $info['price'];
+                $info['tui_one_price'] = round($info['tui_price'] / $info['num'], 2);
+                $info['goods'] = Dever::db('goods/info')->find($info['goods_id']);
+            }
+            return $info;
+        } else {
+            Dever::alert('当前订单状态不允许退货退款');
+        }
+    }
+
+    # 部分退款
+    public function tui_one($id, $order_id, $order_goods_id, $num = false, $status = 6, $desc = '')
+    {
+        if ($status != 5 && $status != 6) {
+            Dever::alert('当前订单状态不允许退货退款');
+        }
+
+        $data = $this->getView($id, $order_id, false);
+        if ($data['status'] == 2 || $data['status'] == 3 || $data['status'] == 4 || $data['status'] == 5) {
+            $info = Dever::db('shop/buy_order_goods')->find(array('id' => $order_goods_id, 'order_id' => $data['id'], 'shop_id' => $id));
+            if ($info && $info['status'] <= 4) {
+                $info['price'] = $info['price'];
+                if ($num > 0 && $info['num'] >= $num) {
+                    $price = round($info['price'] / $info['num'], 2);
+                    $info['price'] = round($price * $num, 2);
+                }
+                $state = Dever::db('shop/buy_order_goods')->update(array('where_id' => $info['id'], 'status' => $status, 'tk_desc' => $desc, 'tk_cash' => $info['price']));
+
+                if ($state) {
+                    $this->pay_tui($state, $data, $info['price']);
+
+                    # 检查这个订单下的商品是不是都退了
+                    $total = Dever::db('shop/buy_order_goods')->total(array('order_id' => $data['id'], 'shop_id' => $id, 'status' => 1));
+                    if ($total <= 0) {
+                        $state = Dever::db('shop/buy_order')->update(array('where_id' => $data['id'], 'status' => 8, 'tk_desc' => $desc, 'tk_cash' => $info['price']));
+                    } elseif ($data['status'] == 5) {
+                        $state = Dever::db('shop/buy_order')->update(array('where_id' => $data['id'], 'status' => 6));
+                    }
+                }
+            }
+            return 'ok';
+        } else {
+            Dever::alert('当前订单状态不允许退货退款');
+        }
+    }
+
+    # 退款通知
+    public function pay_tui($state, $data, $price)
+    {
+        return;
+        if ($state) {
+            $shop = Dever::db('shop/info')->one($data['shop_id']);
+            $msg_param['type'] = 1;//消息类型1是订单消息
+            $msg_param['id'] = $data['id'];
+            $msg_param['name'] = $shop['name'];
+            $msg_param = Dever::json_encode($msg_param);
+            $msg = '您有一笔订单已退款,退款将在3个工作日内返回原支付账户';
+            Dever::load('message/lib/data')->push(-1, $data['uid'], '退款成功通知', $msg, 1, 1, false, $msg_param);
+
+            # 退款到原支付账户 待处理
+        }
+    }
+
     # 展示订单详情
     public function show()
     {

+ 1 - 1
app/mshop/src/Core.php → app/mshop/lib/Core.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Mshop\Src;
+namespace Mshop\Lib;
 
 use Dever;
 

+ 57 - 13
app/mshop/src/Act.php → app/mshop/src/Buy.php

@@ -3,17 +3,43 @@
 namespace Mshop\Src;
 
 use Dever;
+use Mshop\Lib\Core;
 
-class Act extends Core
+class Buy extends Core
 {
-    # 获取商品列表
+    # 获取所有商品列表
     public function getGoods()
     {
-        $this->data['data'] = Dever::load('shop/lib/info')->getGoods($this->shop_id);
+        $where = array();
+
+        $name = Dever::input('name');
+        if ($name) {
+            $where['name'] = $name;
+        }
+        $this->data['data'] = Dever::db('goods/info')->getPageAll($where);
+        if ($this->data['data']) {
+            foreach ($this->data['data'] as $k => $v) {
+                $this->data['data'][$k] = Dever::load('shop/lib/info')->getGoodsInfo($this->shop_id, $v);
+            }
+        }
 
         return $this->data;
     }
 
+    # 采购订单列表
+    public function getList()
+    {
+        return Dever::load('mshop/lib/buy')->getList($this->shop_id);
+    }
+
+    # 查看订单详情
+    public function view()
+    {
+        $order_id = Dever::input('order_id');
+
+        return Dever::load('shop/lib/sell')->getView($this->shop_id, $order_id);
+    }
+
     # 确认订单页面
     public function confirm()
     {
@@ -45,32 +71,27 @@ class Act extends Core
 
         $this->data['price'] = 0;
         $this->data['num'] = 0;
-        $this->data['name'] = '';
+        $this->data['name'] = array();
         $count = count($goods_id);
         # 计算总价格
         foreach ($goods_id as $k => $v) {
-            $s = isset($sku_id[$k]) ? $sku_id[$k] : 0;
+            $s = isset($sku_id[$k]) ? $sku_id[$k] : -1;
             $n = isset($num[$k]) ? $num[$k] : 1;
             $this->data['list'][$k] = Dever::load('goods/lib/info')->getPayInfo($v, $s, $n);
 
             $this->data['list'][$k]['buy_num'] = $n;
             $this->data['num'] += $n;
             $this->data['price'] += $this->data['list'][$k]['price'] * $n;
-            if (!$this->data['name']) {
-                if ($count > 1) {
-                    $this->data['name'] = $this->data['list'][$k]['name'] . '等' . $count . '种商品';
-                } else {
-                    $this->data['name'] = $this->data['list'][$k]['name'];
-                }
-            }
+            $this->data['name'][] = $this->data['list'][$k]['name'];
         }
+
+        $this->data['name'] = implode(',', $this->data['name']);
     }
 
     # 开始下单
     public function pay()
     {
         $refer = Dever::input('refer');
-        $cart = Dever::input('cart', 1);
         
         $info = Dever::input('info');
 
@@ -90,4 +111,27 @@ class Act extends Core
 
         return $pay;
     }
+
+    # 取消订单
+    public function order_cancel()
+    {
+        $order_id = Dever::input('order_id');
+
+        return Dever::load('mshop/lib/buy')->cancel($this->shop_id, $order_id);
+    }
+
+    # 用户退款
+    public function order_tui()
+    {
+        $order_id = Dever::input('order_id');
+        $status = Dever::input('status');
+
+        return Dever::load('mshop/lib/buy')->tui($this->shop_id, $order_id, $status);
+    }
+
+    # 测试审核拆单
+    public function audit()
+    {
+        Dever::load('mshop/lib/buy')->audit();
+    }
 }

+ 8 - 1
app/mshop/src/Data.php

@@ -3,6 +3,7 @@
 namespace Mshop\Src;
 
 use Dever;
+use Mshop\Lib\Core;
 
 class Data extends Core
 {
@@ -41,7 +42,7 @@ class Data extends Core
 		return $this->data;
 	}
 
-	# 销售订单管理
+	# 销售订单列表
 	public function sell_order()
 	{
 		return Dever::load('shop/lib/sell')->set(2, 1)->getList($this->shop_id);
@@ -55,6 +56,12 @@ class Data extends Core
         return Dever::load('shop/lib/sell')->set(2, 2)->getView($this->shop_id, $order_id);
     }
 
+    # 核销取件码
+    public function code()
+    {
+        
+    }
+
     # 门店全部退款
     public function order_tui()
     {

+ 3 - 2
app/mshop/src/Goods.php

@@ -3,13 +3,14 @@
 namespace Mshop\Src;
 
 use Dever;
+use Mshop\Lib\Core;
 
 # 库存清单
 class Goods extends Core
 {
-    public function getSellData()
+    public function getList()
     {
-        # 订单管理
+        $this->data['data'] = Dever::load('shop/lib/info')->getGoods($this->shop_id);
 
         return $this->data;
     }

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

@@ -21,7 +21,7 @@ class Main
             foreach ($user as $k => $v) {
                 $shop = Dever::db('shop/info')->getOne($v['shop_id']);
                 if ($shop) {
-                    $this->data['shop'][] = Dever::db('shop/info')->getOne($v['shop_id']);
+                    $this->data['shop'][] = $shop;
                     $this->data['shop_id'] = $v['shop_id'];
                 }
             }

+ 283 - 6
app/mshop/src/My.php

@@ -3,21 +3,298 @@
 namespace Mshop\Src;
 
 use Dever;
+use Mshop\Lib\Core;
 
 class My extends Core
 {
-    public function getInfo()
+    public function home()
     {
+        $config = Dever::db('main/manage_config')->find();
+        $this->data['phone'] = $config['phone'];
         $this->data['user'] = $this->user;
+        $this->data['shop'] = $this->shop;
+        $this->data['date'] = date('Y-m-d');
 
-        # 获取拥有的优惠券数量
-        $this->data['coupon_num'] = Dever::db('shop/user_coupon')->total(array('uid' => $this->uid));
+        $where['mobile'] = $this->user['mobile'];
+        $user = Dever::db('shop/member')->select($where);
 
-        $this->data['card_num'] = Dever::db('goods/card_code')->total(array('uid' => $this->uid));
+        if ($user) {
+            $this->data['other_shop'] = array();
+            foreach ($user as $k => $v) {
+                if ($v['shop_id'] != $this->shop_id) {
+                    $shop = Dever::db('shop/info')->getOne($v['shop_id']);
+                    if ($shop) {
+                        $this->data['other_shop'][] = $shop;
+                    }
+                }
+            }
+        }
 
-        $this->data['score'] = Dever::load('score/lib/core')->getUserScore($this->uid);
+        return $this->data;
+    }
+
+    public function getEdit()
+    {
+        $this->data['user'] = $this->user;
+        $this->data['shop'] = $this->shop;
+
+        return $this->data;
+    }
+
+    # 修改门店资料
+    public function edit()
+    {
+        $data = array();
+        $name = Dever::input('name');
+        if ($name) {
+            $data['name'] = $name;
+        }
+        $lng = Dever::input('lng');
+        if ($lng) {
+            $data['lng'] = $lng;
+        }
+        $lat = Dever::input('lat');
+        if ($lat) {
+            $data['lat'] = $lat;
+        }
+        $address = Dever::input('address');
+        if ($address) {
+            $data['address'] = $address;
+        }
+        $truename = Dever::input('truename');
+        if ($truename) {
+            $data['truename'] = $name;
+        }
+        $mobile = Dever::input('mobile');
+        if ($mobile) {
+            $data['mobile'] = $mobile;
+        }
+        $open = Dever::input('open');
+        if ($open) {
+            $data['open'] = $open;
+        }
+        $method = Dever::input('method');
+        if ($method) {
+            $data['method'] = $method;
+        }
+        $worktime = Dever::input('worktime');
+        if ($worktime) {
+            $data['worktime'] = $worktime;
+        }
+
+        if ($data) {
+            $data['where_id'] = $this->shop_id;
+            Dever::db('shop/info')->update($data);
+        }
+        
+
+        return 'ok';
+    }
+
+    # 员工列表
+    public function getUser()
+    {
+        $where['shop_id'] = $this->shop_id;
+        $this->data['user'] = Dever::db('shop/member')->select_page($where);
+        $role = Dever::db('shop/member')->config['role'];
+        foreach ($this->data['user'] as $k => $v) {
+            $v['role_name'] = array();
+            $v['role'] = explode(',', $v['role_id']);
+            foreach ($role as $k1 => $v1) {
+                if (in_array($k1, $v['role'])) {
+                    $v['role_name'][] = $v1;
+                }
+            }
+            $this->data['user'][$k]['role_name'] = implode(',', $v['role_name']);
+        }
+
+        return $this->data;
+    }
+
+    # 添加员工
+    public function getEditUser()
+    {
+        $this->data['role'] = Dever::db('shop/member')->config['role'];
+
+        $id = Dever::input('id');
+
+        if ($id) {
+            $this->data['user'] = Dever::db('shop/member')->find($id);
+        }
+
+        return $this->data;
+    }
+
+    # 编辑员工
+    public function upUser()
+    {
+        $id = Dever::input('id');
+        $role = Dever::input('role');
+        $avatar = Dever::input('avatar');
+        $name = Dever::input('name');
+        $mobile = Dever::input('mobile');
+        if ($role) {
+            $update['role_id'] = $role;
+        }
+        
+        if ($avatar) {
+            $update['avatar'] = $avatar;
+        }
+
+        if ($name) {
+            $update['name'] = $name;
+        } else {
+            Dever::alert('姓名不能为空');
+        }
+
+        if ($mobile) {
+            $update['mobile'] = $mobile;
+            $check = Dever::db('shop/member')->find(array('mobile' => $mobile, 'shop_id' => $this->shop_id));
+            if ($check && $id && $id != $check['id']) {
+                Dever::alert('电话已存在');
+            } elseif ($check && !$id) {
+                Dever::alert('电话已存在');
+            }
+        } else {
+            Dever::alert('电话不能为空');
+        }
+
+        $update['shop_id'] = $this->shop_id;
+
+        if ($id) {
+            $update['where_id'] = $id;
+            Dever::db('shop/member')->update($update);
+        } else {
+            $id = Dever::db('shop/member')->insert($update);
+        }
+
+        return 'ok';
+    }
+
+    # 打印机列表
+    public function getPrint()
+    {
+        $where['shop_id'] = $this->shop_id;
+        $this->data['print'] = Dever::db('shop/print')->select_page($where);
+
+        return $this->data;
+    }
+
+    # 添加打印机
+    public function getEditPrint()
+    {
+        $id = Dever::input('id');
+
+        if ($id) {
+            $this->data['print'] = Dever::db('shop/print')->find($id);
+        }
+
+        return $this->data;
+    }
+
+    # 编辑打印机
+    public function upPrint()
+    {
+        $id = Dever::input('id');
+        $name = Dever::input('name');
+        $number = Dever::input('number');
+        if ($name) {
+            $update['name'] = $name;
+        } else {
+            Dever::alert('名称不能为空');
+        }
+
+        if ($number) {
+            $update['number'] = $number;
+        } else {
+            Dever::alert('编号不能为空');
+        }
+
+        $update['shop_id'] = $this->shop_id;
+
+        if ($id) {
+            $update['where_id'] = $id;
+            Dever::db('shop/print')->update($update);
+        } else {
+            $id = Dever::db('shop/print')->insert($update);
+        }
+
+        return 'ok';
+    }
+
+    # 营销活动 优惠券列表
+    public function getCoupon()
+    {
+        $this->data['coupon'] = Dever::db('goods/coupon')->select();
+
+        if ($this->data['coupon']) {
+            $this->data['day'] = Dever::db('goods/coupon')->config['time'];
+            foreach ($this->data['coupon'] as $k => $v) {
+                $this->data['coupon'][$k]['check'] = 1;
+                $check = Dever::db('shop/coupon')->find(array('shop_id' => $this->shop_id, 'coupon_id' => $v['id']));
+                if ($check) {
+                    $this->data['coupon'][$k]['check'] = 2;
+                    $this->data['coupon'][$k]['shop'] = $check;
+                }
+            }
+        }
+        return $this->data;
+    }
+
+    # 营销活动 配置
+    public function setCoupon()
+    {
+        $coupon_city = Dever::input('coupon_city');
+
+        if ($coupon_city) {
+            $update['where_id'] = $this->shop_id;
+            $update['coupon_city'] = $coupon_city;
+            Dever::db('shop/info')->update($update);
+        }
+
+        $coupon = Dever::input('coupon');
+
+        //$coupon[] = array('id' => 1, 'day' => 7, 'num' => 10);
+
+        //print_r(Dever::json_encode($coupon));die;
+
+        if ($coupon) {
+            $coupon = Dever::json_decode($coupon);
+            foreach ($coupon as $k => $v) {
+                $info = Dever::db('shop/coupon')->find(array('shop_id' => $this->shop_id, 'coupon_id' => $v['id']));
+                $data = array();
+                if (!$info) {
+                    $data['shop_id'] = $this->shop_id;
+                    $data['coupon_id'] = $v['id'];
+                    $data['day'] = $v['day'];
+                    $data['num'] = $v['num'];
+                    Dever::db('shop/coupon')->insert($data);
+                } else {
+                    $data['where_id'] = $info['id'];
+                    $data['day'] = $v['day'];
+                    $data['num'] = $v['num'];
+                    Dever::db('shop/coupon')->update($data);
+                }
+            }
+        }
+
+        return $this->coupon();
+    }
+
+    # 获取参与活动领取的优惠券
+    public function getActCoupon()
+    {
+        $this->data['shop_coupon'] = Dever::load('shop/lib/coupon')->getData($this->shop_id);
 
-        $this->data['msg'] = Dever::load('message/lib/data')->num($this->uid);
+        foreach ($this->data['shop_coupon'] as $k => $v) {
+            $this->data['shop_coupon'][$k]['info'] = Dever::db('goods/coupon')->find($v['coupon_id']);
+            $check = Dever::db('shop/coupon_act_1')->find(array('shop_id' => $this->shop_id, 'shop_coupon_id' => $v['id']));
+            $this->data['shop_coupon'][$k]['check'] = 1;
+            if ($check) {
+                $this->data['shop_coupon'][$k]['act_coupon'] = $check;
+                $this->data['shop_coupon'][$k]['check'] = 2;
+            }
+        }
 
         return $this->data;
     }

+ 1 - 0
app/mshop/src/Order.php

@@ -3,6 +3,7 @@
 namespace Mshop\Src;
 
 use Dever;
+use Mshop\Lib\Core;
 
 class Order extends Core
 {

+ 63 - 90
app/shop/database/buy_order.php

@@ -9,9 +9,11 @@ $status = array
     3 => '待发货',
     4 => '待收货确认',
     5 => '已完成',
-    6 => '退款退货',
-    7 => '无货退款',
-    8 => '已取消',
+    6 => '已完成(有退款)',
+    7 => '已取消',
+    8 => '退款退货',
+    9 => '无货退款',
+    11 => '已过期',
 );
 
 return array
@@ -21,6 +23,7 @@ return array
     # 显示给用户看的名称
     'lang' => '采购订单',
     'order' => 99,
+    'status' => $status,
     # 数据结构
     'struct' => array
     (
@@ -66,7 +69,7 @@ return array
 
         'name'      => array
         (
-            'type'      => 'varchar-80',
+            'type'      => 'varchar-800',
             'name'      => '订单名称',
             'default'   => '',
             'desc'      => '订单名称',
@@ -108,110 +111,34 @@ return array
             'list'        => true,
         ),
 
-        'pay_id'      => array
+        'tk_cash'      => array
         (
-            'type'      => 'varchar-100',
-            'name'      => '支付订单ID',
-            'default'   => '',
-            'desc'      => '付款订单id',
-            'match'     => 'is_string',
-            //'update'    => 'text',
-            //'search'    => 'fulltext',
-            //'list'        => true,
-        ),
-
-        'pay_status'        => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '支付状态',
-            'default'   => '1',
-            'desc'      => '请选择支付状态',
-            'match'     => 'is_numeric',
-            'option'    => $pay_status,
-        ),
-
-        'pay_price'      => array
-        (
-            'type'      => 'varchar-50',
-            'name'      => '付款金额',
+            'type'      => 'varchar-300',
+            'name'      => '退款金额',
             'default'   => '',
-            'desc'      => '款金额',
+            'desc'      => '退款金额',
             'match'     => 'option',
             'update'    => 'text',
         ),
 
-        'info'      => array
+        'tk_desc'      => array
         (
             'type'      => 'varchar-300',
-            'name'      => '订单备注',
+            'name'      => '退款描述',
             'default'   => '',
-            'desc'      => '订单备注',
+            'desc'      => '退款描述',
             'match'     => 'option',
             'update'    => 'textarea',
         ),
 
-        'note'     => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '是否发送状态提醒-1未发送,2已发送',
-            'default'   => '1',
-            'desc'      => '请选择状态',
-            'match'     => 'is_numeric',
-        ),
-
-        'notice'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => '模板消息提醒次数',
-            'default'   => '0',
-            'desc'      => '模板消息提醒次数',
-            'match'     => 'is_numeric',
-        ),
-
-        'tk_pic'     => array
-        (
-            'type'      => 'varchar-150',
-            'name'      => '退款截图',
-            'default'   => '',
-            'desc'      => '退款截图',
-            'match'     => 'is_string',
-            'update'    => 'image',
-            'key'       => 1
-        ),
-
-        'tk_time'       => array
-        (
-            'type'      => 'int-11',
-            'name'      => '退款时间',
-            'default'   => '',
-            'desc'      => '退款时间',
-            'match'     => 'option',
-            //'list'        => true,
-            //'update'    => 'date',
-            'callback'  => 'maketime',
-            'show'      => 'status=5',
-        ),
-
-        'tk_admin'      => array
-        (
-            'type'      => 'int-11',
-            'name'      => '退款审核人',
-            'default'   => '1',
-            'desc'      => '退款审核人',
-            'match'     => 'option',
-            //'list'        => true,
-            'show'      => 'status=5',
-        ),
-
-        'tk_desc'       => array
+        'info'      => array
         (
             'type'      => 'varchar-300',
-            'name'      => '退款备注',
+            'name'      => '订单备注',
             'default'   => '',
-            'desc'      => '退款备注',
+            'desc'      => '订单备注',
             'match'     => 'option',
             'update'    => 'textarea',
-            //'show'        => 'status=5',
         ),
 
         'area'       => array
@@ -285,6 +212,33 @@ return array
             'desc'      => '请选择状态',
             'match'     => 'is_numeric',
         ),
+
+        'operdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+        ),
+
+        'fdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '发货时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+        ),
+
+        'qfdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '确认发货时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+        ),
         
         'cdate'     => array
         (
@@ -319,6 +273,25 @@ return array
 
     'request' => array
     (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'name' => array('yes', 'like'),
+                'shop_id' => 'yes',
+                'mobile' => 'yes',
+                'start' => array('yes-cdate', '>='),
+                'end' => array('yes-cdate', '<='),
+                'status' => array('yes', 'in'),
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('cdate' => 'desc'),
+            'page' => array(10, 'list'),
+            'col' => '*',
+        ),
+
         # 获取订单数量
         'getOrderNum' => array
         (

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

@@ -130,6 +130,26 @@ return array
             'list'        => true,
         ),
 
+        'tk_cash'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款金额',
+            'default'   => '',
+            'desc'      => '退款金额',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'tk_desc'      => array
+        (
+            'type'      => 'varchar-300',
+            'name'      => '退款描述',
+            'default'   => '',
+            'desc'      => '退款描述',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
         'status'        => array
         (
             'type'      => 'int-11',

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

@@ -13,6 +13,7 @@ $coupon = function()
     }
     return $array;
 };
+$time = Dever::db('goods/coupon')->config['time'];
 
 return array
 (
@@ -80,7 +81,8 @@ return array
             'default'   => '1',
             'desc'      => '有效期',
             'match'     => 'is_numeric',
-            'update'    => 'text',
+            'update'    => 'select',
+            'option'    => $time,
         ),
 
         'num'      => array

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

@@ -5,7 +5,7 @@ $shop_id = Dever::input('search_option_shop_id');
 $coupon = function() use($shop_id)
 {
     $array = array();
-    $info = Dever::load('shop/lib/coupon')->getAll($shop_id);
+    $info = Dever::load('shop/lib/coupon')->getData($shop_id);
     
     if($info)
     {

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

@@ -557,7 +557,7 @@ return array
                 'state' => 1,
             ),
             'type' => 'one',
-            'col' => 'id,name,`desc`,truename,mobile,lng,lat,address,open,worktime,method,gotime,city,area,province,county,town,coupon_city,pdesc',
+            'col' => 'id,name,`desc`,truename,mobile,lng,lat,address,open,worktime,method,gotime,city,area,province,county,town,coupon_city,pdesc,license,food_license,jy_license',
         ),
     ),
 );

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

@@ -16,6 +16,7 @@ return array
     # 显示给用户看的名称
     'lang' => '账号管理',
     'menu' => false,
+    'role' => $role,
     # 数据结构
     'struct' => array
     (

+ 10 - 1
app/shop/database/sell_order.php

@@ -131,7 +131,7 @@ return array
 
         'name'      => array
         (
-            'type'      => 'varchar-80',
+            'type'      => 'varchar-800',
             'name'      => '订单名称',
             'default'   => '',
             'desc'      => '订单名称',
@@ -356,6 +356,15 @@ return array
             'list'      => true,
         ),
 
+        'operdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '操作时间',
+            'default'   => '',
+            'match'     => 'is_numeric',
+            'desc'      => '',
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',

+ 15 - 0
app/shop/lib/Coupon.php

@@ -6,6 +6,21 @@ use Dever;
 
 class Coupon
 {
+    # 获取分享活动的优惠券列表
+    public function getData($shop_id)
+    {
+        $data = Dever::db('shop/coupon')->getData(array('shop_id' => $shop_id));
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $coupon = Dever::db('goods/coupon')->find($v['coupon_id']);
+                $data[$k]['name'] = $coupon['name'];
+            }
+        }
+
+        return $data;
+    }
+
     # 获取分享活动的优惠券列表
     public function getAll($shop_id)
     {

+ 10 - 8
app/shop/lib/Sell.php

@@ -192,6 +192,10 @@ class Sell
         $info['shop'] = Dever::db('shop/info')->getOne($info['shop_id']);
         $info['cdate'] = date('Y-m-d H:i', $info['cdate']);
 
+        if ($info['operdate']) {
+            $info['operdate'] = date('Y-m-d H:i', $info['operdate']);
+        }
+
         if ($this->view == 2) {
             foreach ($info['goods'] as $k => $v) {
                 $info['goods'][$k]['info'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
@@ -226,7 +230,7 @@ class Sell
     {
         $data = $this->getView($id, $order_id, false);
         if ($data['status'] == 1) {
-            $state = Dever::db('shop/sell_order')->update(array('where_id' => $data['id'], 'status' => 5));
+            $state = Dever::db('shop/sell_order')->update(array('where_id' => $data['id'], 'status' => 5, 'qxdate' => time()));
             if ($state) {
                 if ($data['user_coupon_id']) {
                     $this->noCoupon($data['user_coupon_id']);
@@ -536,14 +540,12 @@ class Sell
                 $data['list'][$k]['buy_num'] = $n;
                 $data['num'] += $n;
                 $data['price'] += $data['list'][$k]['price'] * $n;
-                if ($count > 1) {
-                    $data['name'][] = $data['list'][$k]['name'];
-                } else {
-                    $data['name'][] = $data['list'][$k]['name'];
-                }
+                $data['name'][] = $data['list'][$k]['name'];
             }
         }
 
+        $data['name'] = implode(',', $data['name']);
+
         return $data;
     }
 
@@ -561,7 +563,7 @@ class Sell
         $order_data['mobile'] = $user['mobile'];
         $order_data['address_id'] = $address_id;
         $order_data['invoice_id'] = $invoice_id;
-        $order_data['name'] = is_array($name) ? implode(',', $name) : $name;
+        $order_data['name'] = $name;
         $order_data['num'] = $num;
         $order_data['info'] = $info;
         $order_data['price'] = $price;
@@ -751,7 +753,7 @@ class Sell
         }
 
         $result = Dever::load('pay/api.pay', $param);
-        $result['order_num'] = $order_data['order_num'];
+        $result['order_num'] = $order['order_num'];
         $result['order_id'] = $id;
         return $result;
     }

+ 1 - 1
app/shop/src/My.php

@@ -147,7 +147,7 @@ class My extends Core
 	public function order_tui()
 	{
 		$order_id = Dever::input('order_id');
-        $status = Dever::input('status');
+        $status = 6;
 
         return Dever::load('shop/lib/sell')->set(1, 2)->tui($this->uid, $order_id, $status);
 	}

+ 10 - 84
main/database/config.php

@@ -11,7 +11,7 @@ return array
 	# 表名
 	'name' => 'config',
 	# 显示给用户看的名称
-	'lang' => '基本配置',
+	'lang' => '网站基础信息',
 	'order' => 1,
 	# 数据结构
 	'struct' => array
@@ -27,7 +27,7 @@ return array
 		
 		'hr1'		=> array
 		(
-			'name' 		=> '平台基本信息',
+			'name' 		=> '网站基本信息',
 			'class'		=> '',//本项必须填写
 			'attr'		=> '',
 		),
@@ -35,27 +35,17 @@ return array
 		'name'		=> array
 		(
 			'type' 		=> 'varchar-32',
-			'name' 		=> '平台名称',
+			'name' 		=> '网站名称',
 			'default' 	=> '',
-			'desc' 		=> '请输入平台名称',
+			'desc' 		=> '请输入网站名称',
 			'match' 	=> 'is_string',
 			'update'	=> 'text',
 		),
-		
-		'info'		=> array
-		(
-			'type' 		=> 'varchar-1000',
-			'name' 		=> '平台业务描述',
-			'default' 	=> '',
-			'desc' 		=> '请输入平台描述',
-			'match' 	=> 'option',
-			'update'	=> 'textarea',
-		),
 
 		'logo'		=> array
 		(
 			'type' 		=> 'varchar-150',
-			'name' 		=> '平台LOGO',
+			'name' 		=> '网站LOGO',
 			'default' 	=> '',
 			'desc' 		=> '平台LOGO',
 			'match' 	=> 'option',
@@ -66,74 +56,10 @@ return array
 
         'hr2'       => array
         (
-            'name'      => '门店相关',
+            'name'      => '网站SEO信息',
             'class'     => '',//本项必须填写
             'attr'      => '',
         ),
-
-        'km'      => array
-        (
-            'type'      => 'varchar-32',
-            'name'      => '推荐门店公里数-单位是公里,如5公里,填写5即可',
-            'default'   => '5',
-            'desc'      => '推荐门店公里数',
-            'match'     => 'option',
-            'update'    => 'text',
-        ),
-
-        'video'     => array
-        (
-            'type'      => 'varchar-800',
-            'name'      => '视频宣传片-视频格式mp4,上传大小不能超过4G',
-            'default'   => '',
-            'desc'      => '视频宣传片',
-            'match'     => 'option',
-            'update'    => 'video',
-            'key'       => '3',
-            'place'     => '150',
-            'upload'    => 'yun',
-            'large'     => true,
-            //'cover'     => 'pic',//封面图字段名
-        ),
-
-        'file'        => array
-        (
-            'type'      => 'varchar-150',
-            'name'      => '宣传文件',
-            'default'   => '',
-            'desc'      => '宣传文件',
-            'match'     => 'option',
-            'update'    => 'upload',
-            'key'       => '3',
-        ),
-
-        'rule'      => array
-        (
-            'type'      => 'text-1000',
-            'name'      => '门店合作规则',
-            'default'   => '',
-            'desc'      => '门店合作规则',
-            'match'     => 'option',
-            'update'    => 'editor',
-            'key'       => 1,
-        ),
-
-        'hr3'       => array
-        (
-            'name'      => '官网SEO信息',
-            'class'     => '',//本项必须填写
-            'attr'      => '',
-        ),
-
-        'seo_title'      => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => 'SEO标题',
-            'default'   => '',
-            'desc'      => '请输入SEO标题',
-            'match'     => 'option',
-            'update'    => 'text',
-        ),
         
         'seo_keyword'      => array
         (
@@ -155,9 +81,9 @@ return array
             'update'    => 'textarea',
         ),
 
-        'hr4'       => array
+        'hr3'       => array
         (
-            'name'      => '官网信息',
+            'name'      => '联系信息',
             'class'     => '',//本项必须填写
             'attr'      => '',
         ),
@@ -239,10 +165,10 @@ return array
 
 	'default' => array
 	(
-		'col' => 'name,info,cdate',
+		'col' => 'name,cdate',
 		'value' => array
 		(
-			'"厨人易料","厨人易料",' . time(),
+			'"厨人易料",' . time(),
 		),
 	),
 

+ 92 - 0
main/database/factory_config.php

@@ -0,0 +1,92 @@
+<?php
+
+$home_top_type = array
+(
+    1 => '显示',
+    2 => '不显示',
+);
+
+return array
+(
+    # 表名
+    'name' => 'factory_config',
+    # 显示给用户看的名称
+    'lang' => '供应链基础信息',
+    'order' => 1,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '平台ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '供应链名称',
+            'default'   => '',
+            'desc'      => '供应链名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+        
+        'info'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '供应链业务描述',
+            'default'   => '',
+            'desc'      => '供应链业务描述',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'phone'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '客服电话',
+            'default'   => '',
+            'desc'      => '请输入客服电话',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        '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,
+        ),
+    ),
+
+    'default' => array
+    (
+        'col' => 'name,info,cdate',
+        'value' => array
+        (
+            '"供应链管理","供应链管理",' . time(),
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台管理不要列表页
+        'list' => 'update',
+    ),
+);

+ 163 - 0
main/database/manage_config.php

@@ -0,0 +1,163 @@
+<?php
+
+$home_top_type = array
+(
+    1 => '显示',
+    2 => '不显示',
+);
+
+return array
+(
+    # 表名
+    'name' => 'manage_config',
+    # 显示给用户看的名称
+    'lang' => '门店小程序信息',
+    'order' => 1,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '平台ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '小程序名称',
+            'default'   => '',
+            'desc'      => '小程序名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+        
+        'info'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '小程序业务描述',
+            'default'   => '',
+            'desc'      => '小程序业务描述',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'logo'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '小程序LOGO',
+            'default'   => '',
+            'desc'      => '小程序LOGO',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+
+        'applet'       => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '小程序二维码',
+            'default'   => '',
+            'desc'      => '小程序二维码',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150*150',
+        ),
+
+        'phone'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '客服电话',
+            'default'   => '',
+            'desc'      => '请输入客服电话',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'km'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '推荐门店公里数-单位是公里,如5公里,填写5即可',
+            'default'   => '5',
+            'desc'      => '推荐门店公里数',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'video'     => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => '视频宣传片-视频格式mp4,上传大小不能超过4G',
+            'default'   => '',
+            'desc'      => '视频宣传片',
+            'match'     => 'option',
+            'update'    => 'video',
+            'key'       => '3',
+            'place'     => '150',
+            'upload'    => 'yun',
+            'large'     => true,
+            //'cover'     => 'pic',//封面图字段名
+        ),
+
+        'file'        => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '宣传文件',
+            'default'   => '',
+            'desc'      => '宣传文件',
+            'match'     => 'option',
+            'update'    => 'upload',
+            'key'       => '3',
+        ),
+
+        'rule'      => array
+        (
+            'type'      => 'text-1000',
+            'name'      => '门店合作规则',
+            'default'   => '',
+            'desc'      => '门店合作规则',
+            'match'     => 'option',
+            'update'    => 'editor',
+            'key'       => 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,
+        ),
+    ),
+
+    'default' => array
+    (
+        'col' => 'name,info,cdate',
+        'value' => array
+        (
+            '"门店管理","门店管理",' . time(),
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台管理不要列表页
+        'list' => 'update',
+    ),
+);

+ 116 - 0
main/database/sell_config.php

@@ -0,0 +1,116 @@
+<?php
+
+$home_top_type = array
+(
+    1 => '显示',
+    2 => '不显示',
+);
+
+return array
+(
+    # 表名
+    'name' => 'sell_config',
+    # 显示给用户看的名称
+    'lang' => '零售小程序信息',
+    'order' => 1,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '平台ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '小程序名称',
+            'default'   => '',
+            'desc'      => '小程序名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+        
+        'info'      => array
+        (
+            'type'      => 'varchar-1000',
+            'name'      => '小程序业务描述',
+            'default'   => '',
+            'desc'      => '小程序业务描述',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'logo'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '小程序LOGO',
+            'default'   => '',
+            'desc'      => '小程序LOGO',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150',
+        ),
+
+        'applet'       => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '小程序二维码',
+            'default'   => '',
+            'desc'      => '小程序二维码',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '150*150',
+        ),
+
+        'phone'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '客服电话',
+            'default'   => '',
+            'desc'      => '请输入客服电话',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        '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,
+        ),
+    ),
+
+    'default' => array
+    (
+        'col' => 'name,info,cdate',
+        'value' => array
+        (
+            '"零售小程序","零售小程序",' . time(),
+        ),
+    ),
+
+    'manage' => array
+    (
+        # 后台管理不要列表页
+        'list' => 'update',
+    ),
+);