dever 3 年之前
父节点
当前提交
67a647e722

+ 75 - 4
app/goods/database/card.php

@@ -14,6 +14,15 @@ $type = array
     2 => '固定天数',
 );
 
+$card_type = array
+(
+    1 => '全数字',
+    2 => '全小写',
+    3 => '全大写',
+    4 => '大小写组合',
+    5 => '数字+大小写组合',
+);
+
 return array
 (
     # 表名
@@ -72,6 +81,68 @@ return array
             'show'      => 'type=2',
         ),
 
+        'card_type'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '卡号生成规则',
+            'default'   => '3',
+            'desc'      => '卡号生成规则',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $card_type,
+        ),
+
+        'card_prefix'        => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '卡号前缀-前缀不占用卡号长度的位数,如卡号长度填写14,卡号前缀为Q,则生成卡号前缀+14位随机数',
+            'default'   => '',
+            'desc'      => '卡号前缀',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'card_len'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '卡号长度',
+            'default'   => '14',
+            'desc'      => '卡号长度',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
+        'pwd_type'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '密码生成规则',
+            'default'   => '3',
+            'desc'      => '密码生成规则',
+            'match'     => 'is_numeric',
+            'update'    => 'select',
+            'option'    => $card_type,
+        ),
+
+        'pwd_prefix'        => array
+        (
+            'type'      => 'varchar-80',
+            'name'      => '密码前缀',
+            'default'   => '',
+            'desc'      => '密码前缀',
+            'match'     => 'option',
+            'update'    => 'text',
+        ),
+
+        'pwd_len'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '密码长度',
+            'default'   => '8',
+            'desc'      => '密码长度',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+        ),
+
         'method'        => array
         (
             'type'      => 'int-11',
@@ -79,9 +150,9 @@ return array
             'default'   => '3',
             'desc'      => '领取方式',
             'match'     => 'is_numeric',
-            'update'    => 'radio',
+            //'update'    => 'radio',
             'option'    => $method,
-            'control'   => 'method',
+            //'control'   => 'method',
         ),
 
         'goods'       => array
@@ -156,9 +227,9 @@ return array
 
         'list_button' => array
         (
-            'fast' => array('生成卡密', 'add_card&where_id=1&search_option_card_id={$id}'),
+            'fast' => array('生成卡密', '"add_card&where_id=1&search_option_card_id={id}"', '{status} == 1'),
 
-            'list1' => array('卡密列表', '"card_code&search_option_card_id={id}&oper_table=card"' , '{status} == 1'),
+            'list1' => array('卡密列表', '"card_code&search_option_card_id={id}&oper_table=card"'),
         ),
     ),
 

+ 7 - 6
app/goods/database/card_code.php

@@ -90,7 +90,7 @@ return array
             'desc'      => '用户信息',
             'match'     => 'is_numeric',
             'list_name' => '兑换信息',
-            'list'      => 'Dever::load("goods/lib/manage.showUserInfo", "{id}")',
+            //'list'      => 'Dever::load("goods/lib/manage.showUserInfo", "{id}")',
         ),
 
         'shop_id'      => array
@@ -126,8 +126,9 @@ return array
             'type'      => 'int-11',
             'name'      => '失效时间',
             'match'     => 'is_numeric',
+            'default'   => '',
             'desc'      => '',
-            'list'      => 'date("Y-m-d H:i:s", {edate})',
+            //'list'      => 'date("Y-m-d H:i:s", {edate})',
         ),
 
         'state'     => array
@@ -142,7 +143,7 @@ return array
         'cdate'     => array
         (
             'type'      => 'int-11',
-            'name'      => '录入时间',
+            'name'      => '生成时间',
             'match'     => array('is_numeric', time()),
             'desc'      => '',
             # 只有insert时才生效
@@ -157,13 +158,13 @@ return array
         'delete' => false,
         'edit' => false,
         'insert' => false,
-        'mul' => '{type} == 1 || {type} == 4',
+       // 'mul' => '{type} == 1 || {type} == 4',
 
         'list_button' => array
         (
-            'oper' => array('作废', 'goods/lib/manage.drop?id={id}', '{type} == 1'),
+            //'oper' => array('作废', 'goods/lib/manage.drop?id={id}', '{type} == 1'),
 
-            'oper2' => array('恢复使用', 'goods/lib/manage.recovery?id={id}', '{type} == 4'),
+            //'oper2' => array('恢复使用', 'goods/lib/manage.recovery?id={id}', '{type} == 4'),
         ),
     ),
 

+ 11 - 9
app/goods/lib/Manage.php

@@ -284,28 +284,30 @@ class Manage
         $num = Dever::param('num', $param);
         $card_id = Dever::param('card_id', $param);
 
-        if ($num > 0) {
+        $info = Dever::db('goods/card')->find($card_id);
+
+        if ($info && $num > 0) {
             for ($i = 0; $i< $num;$i++) {
-                $this->createCode($card_id);
+                $this->createCode($info);
             }
         }
     }
 
-    private function createCode($card_id)
+    private function createCode($info)
     {
         # 生成卡号和密码
-        $card = 'CR' . Dever::rand(14);
-        $pwd = Dever::rand(8);
+        $card = $info['card_prefix'] . Dever::rand($info['card_len'], $info['card_type'] - 1);
+        $pwd = $info['pwd_prefix'] . Dever::rand($info['pwd_len'], $info['pwd_type'] - 1);
 
         $where['card'] = $card;
         $where['pwd'] = $pwd;
-        $info = Dever::db('goods/card_code')->find($where);
+        $state = Dever::db('goods/card_code')->find($where);
 
-        if (!$info) {
-            $where['card_id'] = $card_id;
+        if (!$state) {
+            $where['card_id'] = $info['id'];
             Dever::db('goods/card_code')->insert($where);
         } else {
-            $this->createCode($card_id);
+            $this->createCode($info);
         }
     }
 

+ 23 - 3
app/shop/database/info.php

@@ -135,13 +135,13 @@ return array
         'area'       => array
         (
             'type'      => 'varchar-500',
-            'name'      => '所在城市',
+            'name'      => '所在街道',
             'default'   => '',
-            'desc'      => '所在城市',
+            'desc'      => '所在街道',
             'match'     => 'option',
             'search'    => 'linkage',
             'update'    => 'linkage',
-            'option'    => Dever::url('api.get?level_total=2', 'area'),
+            'option'    => Dever::url('api.get?level_total=4', 'area'),
             'list'      => 'Dever::load("area/api.string", "{area}")',
         ),
 
@@ -165,6 +165,26 @@ return array
             //'update'  => 'text',
         ),
 
+        'county'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '县区',
+            'default'   => '',
+            'desc'      => '县区',
+            'match'     => 'option',
+            //'update'  => 'text',
+        ),
+
+        'town'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '街道',
+            'default'   => '',
+            'desc'      => '街道',
+            'match'     => 'option',
+            //'update'  => 'text',
+        ),
+
         'map'       => array
         (
             'type'      => 'varchar-300',

+ 8 - 5
app/shop/database/sell_order.php

@@ -4,8 +4,8 @@ $pay_status = Dever::config('base', 'pay')->pay['status'];
 
 $method = array
 (
-    1 => '外送',
-    2 => '自提',
+    1 => '自提',
+    2 => '外送',
 );
 
 $pay_method = array
@@ -75,15 +75,16 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
+            //'search'    => '',
             'update'    => 'hidden',
             'value'     => Dever::input('search_option_shop_id'),
-            //'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'uid'       => array
         (
             'type'      => 'int-11',
-            'name'      => '购买人',
+            'name'      => '购买人名称',
             'default'   => '0',
             'desc'      => '请选择用户',
             'match'     => 'is_numeric',
@@ -107,12 +108,14 @@ return array
             'match'     => 'is_numeric',
             //'update'    => 'text',
             //'search'  => 'select',
+            /*
             'search'    => array
             (
                 'api' => 'passport/user-all',
                 'col' => 'username',
                 'result' => 'id',
             ),
+            */
             //'list_name' => '订单详情',
             //'list'      => 'Dever::load("goods/lib/manage.order", {id})',
             //'list'      => '{parent_uid} > 0 ? Dever::load("passport/user-one#username", {parent_uid}) : "无邀请人"',
@@ -464,7 +467,7 @@ return array
             'option' => array
             (
                 'uid' => 'yes',
-                'status' => array('1', '!='),
+                'status' => 'yes',
                 'state' => 1,
             ),
             'type' => 'all',

+ 2 - 0
app/shop/lib/Manage.php

@@ -50,6 +50,8 @@ class Manage
             $temp = is_string($area) ? explode(',', $area) : $area;
             $update['province'] = $temp[0];
             $update['city'] = $temp[1];
+            $update['county'] = $temp[2];
+            $update['town'] = $temp[3];
         }
 
         $map = Dever::param('map', $data);

+ 97 - 33
app/shop/lib/Sell.php

@@ -285,45 +285,109 @@ class Sell
     {
         $id = Dever::input('order_id');
 
+        $config = Dever::db('shop/sell_order')->config;
+
         $info = Dever::db('shop/sell_order')->one($id);
 
-        $goods = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
+        $shop = Dever::db('shop/info')->find($info['shop_id']);
+
+        $user = Dever::db('passport/user')->find($info['uid']);
+
+        if (!$user['truename']) {
+            $user['truename'] = $user['username'];
+        }
+
+        $html = '订单号:' . $info['order_num'] . '<br />';
+        $html .= '[基本信息]:<table class="layui-table"><thead><tr><th style="width:20%">项目</th><th style="width:80%">详情</th></tr> </thead><tbody>';
+
+        $html .= '<tr>
+          <td>订单信息</td>
+          <td>'.$this->table(array('订单状态', '金额', '数量','支付方式', '配送方式'), array(array($config['status'][$info['status']], $info['price'], $info['num'],$config['pay_method'][$info['pay_method']], $config['method'][$info['method']]))).'</td>
+        </tr>';
+
+        if ($info['address_id'] > 0) {
+            $address = Dever::load('passport/address')->getOne($info['uid'], $info['address_id']);
+            $html .= '<tr>
+              <td>收货地址</td>
+              <td>'.$this->table(array('省份', '城市', '地区','地址', '门牌号', '姓名', '手机号'), array(array($address['province_name'], $address['city_name'], $address['county_name'], $address['address'], $address['house_number'], $address['contact'], $address['mobile']))).'</td>
+        </tr>';
+        }
 
-        $goods_tbody = '';
+        if ($info['invoice_id'] > 0) {
+            $invoice = Dever::load('passport/invoice')->getOne($info['uid'], $info['invoice_id']);
+            $html .= '<tr>
+              <td>发票信息</td>
+              <td>'.$this->table(array('发票类型', '抬头', '税号','手机号', '邮箱'), array(array($invoice['title_type_name'], $invoice['title'], $invoice['number'], $invoice['mobile'], $invoice['email']))).'</td>
+        </tr>';
+        }
+
+        $html .= '<tr>
+          <td>门店信息</td>
+          <td>'.$this->table(false, array(array('门店名称:' . $shop['name'], '联系人:' . $shop['truename'], '联系电话:' . $shop['mobile']))).'</td>
+
+        </tr>';
+
+        $html .= '<tr>
+          <td>用户信息</td>
+          <td>'.$this->table(false, array(array('昵称:' . $user['username'], '联系电话:' . $user['mobile']))).'</td>
+        </tr>';
+
+        $html .= '</tbody></table>';
+
+        $html .= '[商品清单]:';
+
+        $head = array('商品名称', '商品属性', '商品价格', '商品数量');
+
+        $body = array();
+        $goods = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
         foreach ($goods as $k => $v) {
-            $goods_tbody .= '<tr>';
             $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v['goods_id'], $v['sku_id']);
-
-            $goods_tbody .= '<td>'.$goods_info['name'].'</td>';
-            $goods_tbody .= '<td>'.$v['price'].'</td>';
-            $goods_tbody .= '<td>'.$v['price'].'</td>';
-            $goods_tbody .= '<td>'.$v['num'].'</td>';
-            $goods_tbody .= '</tr>';
+            $body[$k] = array
+            (
+                $goods_info['name'],
+                $v['price'],
+                $v['price'],
+                $v['num'],
+            );
         }
+        $html .= $this->table($head, $body);
+
+        return $html;
+    }
+
+    private function table($head, $data)
+    {
+        $html = '';
+        if ($head) {
+            $html = '<table class="layui-table">';
 
-        return '
-<table class="layui-table">
-      
-      <tbody>
-        <tr>
-          <td>总金额:'.$info['price'].'</td>
-          <td>总数量:'.$info['num'].'</td>
-        </tr>
-      </tbody>
-    </table>
-
-        <table class="layui-table">
-      <thead>
-        <tr>
-          <th>商品名称</th>
-          <th>商品属性</th>
-          <th>商品价格</th>
-          <th>商品数量</th>
-        </tr> 
-      </thead>
-      <tbody>
-        '.$goods_tbody.'
-      </tbody>
-    </table>';
+            $html .= '<thead><tr>';
+            foreach ($head as $k => $v) {
+                $html .= '<th>'.$v.'</th>';
+            }
+            $html .= '</tr></thead>';
+
+            $html .= '<tbody>';
+            foreach ($data as $k => $v) {
+                $html .= '<tr>';
+                foreach ($v as $k1 => $v1) {
+                    $html .= '<td>'.$v1.'</td>';
+                }
+                $html .= '</tr>';
+            }
+
+            $html .= '</tbody>';
+
+            $html .= '</table>';
+        } else {
+            foreach ($data as $k => $v) {
+                $html .= '';
+                foreach ($v as $k1 => $v1) {
+                    $html .= $v1 . '&nbsp;&nbsp;&nbsp;&nbsp;';
+                }
+                $html .= '';
+            }
+        }
+        return $html;
     }
 }

+ 20 - 3
app/shop/src/My.php

@@ -106,7 +106,7 @@ class My extends Core
     # 我的订单列表
     public function order()
     {
-        $this->data = Dever::db('shop/sell_order')->page(array('uid' => $this->uid));
+        $this->data = Dever::db('shop/sell_order')->getAll(array('uid' => $this->uid));
 
         if ($this->data) {
             $this->config = Dever::db('shop/sell_order')->config;
@@ -188,14 +188,31 @@ class My extends Core
     # 我的消息列表
     public function msg()
     {
-        return Dever::load('msg/lib/data')->read($this->uid);
+        $data = Dever::load('message/lib/data')->read($this->uid);
+
+        if ($data) {
+            foreach ($data as $k => $v) {
+                $data[$k]['cdate_string'] = Dever::ddate($v['cdate']);
+                $type = Dever::db('message/type')->one($v['type']);
+                $data[$k]['type_name'] = $type['name'];
+            }
+        }
+        return $data;
     }
 
     # 查看我的消息
     public function view_msg()
     {
         $id = Dever::input('id');
-        return Dever::load('msg/lib/data')->view($this->uid, $id);
+        $data = Dever::load('message/lib/data')->view($this->uid, $id);
+
+        if ($data) {
+            $data['cdate_string'] = Dever::ddate($data['cdate']);
+            $type = Dever::db('message/type')->one($data['type']);
+            $data['type_name'] = $type['name'];
+        }
+
+        return $data;
     }
 
     # 我的地址列表

+ 2 - 2
main/database/page.php

@@ -4,8 +4,8 @@ $type = array
 (
     1 => '门店销售',
     2 => '门店管理',
-    3 => '工厂管理',
-    4 => '仓库管理',
+    3 => '仓库管理',
+    4 => '工厂管理',
 );
 
 $config = array

+ 16 - 2
main/src/View.php

@@ -18,14 +18,28 @@ class View extends Core
     # 获取单页详情
     public function page()
     {
+        $type = Dever::input('type', 1);
+        if (!$type) {
+            Dever::alert('您访问的页面有误');
+        }
+
         $key = Dever::input('key');
         if (!$key) {
             Dever::alert('您访问的页面有误');
         }
 
-        $info = Dever::db('main/page')->one(array('key' => $key . '_' . $this->data['system']));
+        $name = Dever::input('name');
+
+        $where['type'] = $type;
+        $where['key'] = $key;
+        $info = Dever::db('main/page')->find($where);
+
         if (!$info) {
-            $info = Dever::db('main/page')->one(array('key' => $key));
+            $insert = $where;
+            $insert['name'] = $name;
+            $insert['content'] = $name;
+            $id = Dever::db('main/page')->insert($insert);
+            $info = Dever::db('main/page')->find($id);
         }
 
         return $info;