Your Name 3 年之前
父节点
当前提交
cba6ce9eea

+ 27 - 0
service/agent/assets/manage/html/member_prize.html

@@ -0,0 +1,27 @@
+
+<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">
+    <table class="layui-table">
+      <thead>
+        <tr>
+          <th>昵称</th>
+          <th>加入时间</th>
+          <th>签名</th>
+        </tr> 
+      </thead>
+      <tbody>
+        <tr>
+          <td>贤心</td>
+          <td>2016-11-29</td>
+          <td>人生就像是一场修行</td>
+        </tr>
+        <tr>
+          <td>许闲心</td>
+          <td>2016-11-28</td>
+          <td>于千万人之中遇见你所遇见的人,于千万年之中,时间的无涯的荒野里…</td>
+        </tr>
+      </tbody>
+    </table>
+</div>
+</form>

+ 1 - 1
service/agent/database/member.php

@@ -123,7 +123,7 @@ return array
             'match'     => 'is_string',
             'update'    => 'text',
 
-            'search'    => ($parent_mid) ? 'hidden' : 'fulltext',
+            // 'search'    => ($parent_mid) ? 'hidden' : 'fulltext',
 
             //'search'    => 'fulltext',
             'search'    => array

+ 1 - 1
service/agent/database/member_prize.php

@@ -101,7 +101,7 @@ return array
 
     'manage' => array
     (
-        
+        'page_list' => 'member_prize',
     ),
 
     'request' => array

+ 253 - 0
service/agent/database/soft_cash.php

@@ -0,0 +1,253 @@
+<?php
+
+$status = array
+(
+    1 => array('name' => '待业务初审', 'style' => 'font-weight:bold;color:#436EEE'),
+    2 => array('name' => '待财务终审', 'style' => 'font-weight:bold;color:#436EEE'),
+    3 => array('name' => '已完成', 'style' => 'font-weight:bold;color:green'),
+    4 => array('name' => '驳回', 'style' => 'font-weight:bold;color:#CD3700'),
+);
+
+$manage_audit = array
+(
+    //1 => '待审核',
+    2 => '已审核',
+    3 => '已作废',
+);
+
+$button = array();
+$col = Dever::input('col');
+if (Dever::load('manage/auth')->checkFunc('agent.soft_cash', 'editnew', '新增')) {
+	$button['新增'] = array('新增', Dever::url('project/database/update&project=agent&&table=soft_cash&menu=agent&search_option_state=1'));
+}
+return array
+(
+    # 表名
+    'name' => 'soft_cash',
+    # 显示给用户看的名称
+    'lang' => '软件服务费',
+    'menu' => true,
+    'config_status' => $status,
+    'end' => array
+    (
+    	'insert' => 'agent/lib/soft_cash.updateSoft',
+        'update' => 'agent/lib/soft_cash.updateSoft',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'update'    => 'hidden',
+            //'list'        => true,
+        ),
+
+        'mid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '代理商姓名/手机号',
+            'default'   => '-1',
+            'desc'      => '代理商',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+             'search'    => array
+            (
+                'api' => 'agent/member-getSearch',
+                'col' => 'col',
+                'result' => 'id',
+                'search' => 'mid',
+            ),
+            'list'      => 'Dever::load("agent/lib/member.getOne", {mid}, "agent/member", true)',
+            'list_order' => 2,
+        ),
+         'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '代理商手机号',
+            'default'   => '',
+            'desc'      => '请输入手机号',
+            'match'     => Dever::rule('mobile'),
+            'update'    => 'text',
+            # 绑定js脚本,更新时使用,第一个参数是执行的方式,第二个参数执行的方法,第三个参数是传值。
+            'bind'        => array('onblur', 'loading', array('url' => Dever::url("lib/soft_cash.search", 'agent'))),
+            //'search'    => 'fulltext',
+            //'list'      => true,
+        ),
+     
+       'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单号',
+            'default'   => '',
+            'desc'      => '订单号',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+            //'search'    => 'fulltext',
+            'list_name' => '订单号<br />购买时间',
+            'list'      => 'Dever::load("agent/lib/soft_cash.soft_show#num",{id})',
+            'list_order' => 1,
+        ),
+
+        'agreement_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '合同',
+            'default'   => '-1',
+            'desc'      => '合同',
+            'match'     => 'is_string',
+            // 'update'    => 'text',
+        ),
+
+        'cash'      => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '软件服务费用',
+            'default'   => '0',
+            'desc'      => '费用',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'float-11,2',
+            'name'      => '期权价值',
+            'default'   => '0',
+            'desc'      => '期权价值',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'pic'       => array
+        (
+            'type'      => 'text-255',
+            'name'      => '支付凭证',
+            'default'   => '',
+            'desc'      => '多张图片',
+            'match'     => 'is_string',
+            'update'    => 'images',
+            'key'       => '1',
+            'place'     => '759*562',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '订单状态',
+            'match'     => 'is_numeric',
+            // 'update'    => 'radio',
+            'option'    => $status,
+            'list'      => true,
+        ),
+        'audit'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '审核状态',
+            'default'   => '2',
+            'desc'      => '审核状态',
+            'match'     => 'is_numeric',
+            'update'    => $col ? 'radio' : false,
+            'option'    => $manage_audit,
+            'mul'       => true,
+            'control'   => 'audit',
+        ),
+
+        'audit_desc'      => array
+        (
+            'type'      => 'varchar-600',
+            'name'      => '备注',
+            'default'   => '',
+            'desc'      => '审核说明',
+            'match'     => 'is_string',
+            'update'    => $col ? 'textarea' : false,
+            // 'list'      => '"{audit_desc}" ? "{audit_desc}" : "-"',
+            // 'list_order'  => 9,
+            'show'      => 'audit=3',
+        ),
+
+        'admin_desc'      => array
+        (
+            'type'      => 'varchar-600',
+            'name'      => '管理员备注',
+            'default'   => '',
+            'desc'      => '管理员备注',
+            'match'     => 'option',
+            'update'    => 'textarea',
+        ),
+
+        'buy_date'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '购买时间',
+            'match'     => 'option',
+            'default'   => '0',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'update'    => 'day',
+            'callback'  => 'maketime',
+            // 'list'        => '{buy_date} > 0 ? date("Y-m-d H:i", {buy_date}) : "无"',
+        ),
+
+        '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,
+    	'edit'   => false,
+    	'button' => $button,
+    	'list_button' => array
+        (
+        	 'list' => array('查看详情', '"member_prize&project=agent&id={id}&page_type=1&[refer]"'),
+        ),
+    ),
+
+    'request' => array
+    (
+        'getList' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'main' => 'yes',
+                'mobile' => 'yes',
+                'state' => 1,
+            ),
+            'order' => array('main' => 'asc','id' => 'desc'),
+            'type' => 'all',
+            'col' => '*',
+        ),
+
+    ),
+);

+ 12 - 3
service/agent/lib/Agreement.php

@@ -121,9 +121,14 @@ class Agreement
     }
 
 	# 新建合同
-	public function up($order)
+	public function up($order, $status = 2, $type = false)
 	{
-		$agreement = Dever::db('setting/agreement')->getData();
+        if ($type) {
+            $agreement = Dever::db('setting/agreement')->select(array('type' => $type));
+        } else {
+            $agreement = Dever::db('setting/agreement')->getData();
+        }
+		// print_r($agreement);die;
 		$role = Dever::db('setting/role')->find($order['role']);
         foreach ($agreement as $k => $v) {
             if ($k == 3) {
@@ -177,7 +182,7 @@ class Agreement
             $where['company_name'] = $order['company_name'];
             $where['company_pic'] = $order['company_pic'];
             $where['address'] = '';
-            $where['status'] = 2;
+            $where['status'] = $status;
             $where['udate'] = $where['cdate'] = time();
             $where['qdate'] = $qdate;
             $where['sdate'] = $sdate;
@@ -189,6 +194,7 @@ class Agreement
                 $up['content'] = Dever::array_encode($this->$method($v, $info));
                 $up['where_id'] = $info['id'];
                 $state = Dever::db('agent/member_agreement')->update($up);
+                // print_R($state);die;
             } else {
                 $up = $where;
 
@@ -196,6 +202,9 @@ class Agreement
                 $state = Dever::db('agent/member_agreement')->insert($up);
             }
         }
+        if($state){
+            return $state;
+        }
 	}
 
     # 更新合同内容

+ 307 - 0
service/agent/lib/Soft_cash.php

@@ -0,0 +1,307 @@
+<?php
+
+namespace Agent\Lib;
+
+use Dever;
+
+Class Soft_cash
+{
+	 public function updateSoft($id, $name, $data){
+	 	// print_R($data);die;
+        $mobile = Dever::param('mobile', $data);
+        $cash = Dever::param('cash', $data);
+        $price = Dever::param('price', $data);
+        $pic = Dever::param('pic', $data);
+        $status = Dever::param('status', $data);
+        $audit = Dever::param('audit', $data);
+        $audit_desc = Dever::param('audit_desc', $data);
+        $cdate = Dever::param('cdate',$data);
+        $buy_cdate = Dever::param('buy_cdate',$data);
+
+        $soft = Dever::db('agent/soft_cash')->one($id);
+        if($soft['mid']<0){
+        	$info = Dever::db('agent/member')->find(array('mobile'=>$soft['mobile']));
+        }else{
+        	$info = Dever::db('agent/member')->find(array('id'=>$soft['mid']));
+        }
+        
+        if($info){
+            // print_R($info);die;
+            $update['where_id'] = $id;
+            $update['set_mid'] = $info['id'];
+            $update['set_order_num'] = $this->getOrderId($id);
+            if($cash){
+                $update['set_cash'] = $cash;
+            }
+            if($price){
+                $update['set_price'] = $price;
+            }
+            if($pic){
+                $update['set_pic'] = $pic;
+            }
+            if($status){
+                $update['set_status'] = $status;
+            }
+             if($audit){
+                $update['set_audit'] = $audit;
+            }
+            if($audit_desc){
+                $update['set_audit_desc'] = $audit_desc;
+            }
+           	if($soft){
+           		// if($soft['audit'] == 2 && $soft['status'] == -1)
+	        	if($soft['audit'] == 2 && $soft['status'] == 1){
+	            	$update['set_status'] = 2;
+	            }elseif($soft['audit'] == 2 && $soft['status'] == 2){
+	            	$update['set_status'] = 3;
+	            }elseif($soft['audit'] ==3 && $soft['status'] == 3){
+	            	$update['set_status'] = 4;
+	            }
+	            if($soft['audit']== 2 && $update['set_status'] == 3){
+	                $order['role'] = $info['role'];
+	                $order['soft_cash'] = $cash;
+	                $order['price'] = $cash;
+	                $order['cdate'] = $cdate;
+	                $order['type'] = 3;
+	                $order['sign'] = '';
+	                $order['name'] = $info['name'];
+	                $order['mobile'] = $info['mobile'];
+	                $order['mid'] = $info['id'];
+	                $order['id'] = $id;
+	                $order['area'] = $info['area'];
+	                $order['idcard'] = $info['idcard'];
+	                $order['idcard_front'] = $info['idcard_front'];
+	                $order['idcard_back'] = $info['idcard_back'];
+	                $order['company_name'] = $info['company_name'];
+	                $order['company_pic'] = $info['company_pic'];
+	                // print_R($order);die;
+	                $update['set_agreement_id'] = Dever::load('agent/lib/agreement')->up($order,1,3);
+	            }
+        	}
+            
+            $ids=Dever::db('agent/soft_cash')->update($update);
+        }
+    }
+
+    public function getOrderId($id)
+    {
+        $order = Dever::order();
+        $info = Dever::db('agent/soft_cash')->one(array('order_num'=>$order));
+        if ($info) {
+            return $this->createOrderId($id);
+        } else {
+            return $order;
+        }
+    }
+    public function soft_show($id){
+        $info = Dever::db('agent/soft_cash')->find($id);
+        $html['num'] = $info['order_num'].'</br>'.date('Y-m-d H:i',$info['buy_date']);
+        return $html;
+    }
+	public function show(){
+        $id = Dever::input('id');
+        $info = Dever::db('agent/soft_cash')->find($id);
+        $member = Dever::db('agent/member')->find($info['mid']);
+        $type = Dever::db('agent/member')->config['config_type'];
+        $config_status = Dever::db('agent/soft_cash')->config['config_status'];
+
+        $status = Dever::status($config_status,$info['status']);
+         // print_R($status);die;
+        $buy_date = date('Y-m-d H:i',$info['buy_date']);
+        $role = Dever::db('setting/role')->one($member['role']);
+        $area = Dever::load("area/api.string", $member['area']);
+        $idcard_pic = '<a href="'.$member['idcard_front'].'" target="_blank"><img src="'.$member['idcard_front'].'" width="100" /></a>';
+        if ($member['idcard_back']) {
+            $idcard_pic .= '<a href="'.$member['idcard_back'].'" target="_blank"><img src="'.$member['idcard_back'].'" width="100" /></a>';
+        }
+        $pic = '<a href="'.$info['pic'].'" target="_blank"><img src="'.$info['pic'].'" width="100" /></a>';
+        $result['订单信息'] = array
+        (
+            'type' => 'info',
+            'content' => array
+            (
+                array
+                (
+                    array('订单号', $info['order_num']),
+                    array('订单状态', $status),
+                    array('购买时间', $buy_date),
+                ),
+                array
+                (
+                    array('备注', $info['audit_desc']),
+                    array('管理员备注', $info['admin_desc']),
+                    // array('购买时间', $buy_date),
+                ),
+            ),
+        );
+        $result['代理商信息'] = array
+        (
+            'type' => 'info',
+            'content' => array
+            (
+                array
+                (
+                    array('手机号', $member['mobile']),
+                    array('名称', $member['name']),
+                    array('类型', $type[$member['type']]),
+                ),
+                array
+                (
+                    array('代理商角色', $role['name']),
+                    array('代理区域', $area),
+                    array('身份证号', $member['idcard']),
+                ),
+                array
+                (
+                	array('身份证照片', $idcard_pic),
+                ),
+            ),
+        );
+        $result['费用信息'] = array
+        (
+            'type' => 'info',
+            'content' => array
+            (
+                array
+                (
+                    array('软件服务费', $info['cash']),
+                    array('期权价值', $info['price']),
+                ),
+                 array
+                (
+                	array('支付凭证', $pic),
+                ),
+            ),
+        );
+        $button = $this->show_button($info);
+
+        if($info['status'] == 3 ){
+        	$member_goods = Dever::db('agent/member_goods')->find($info['agreement_id']);
+        	if ($member_goods['sign']) {
+            $sign_pic = '<a href="'.$member_goods['sign'].'" target="_blank"><img src="'.$member_goods['sign'].'" width="100" /></a>';
+        } else {
+            $sign_pic = '暂无';
+        }
+        
+        	$this->show_agreement($info, $role, $sign_pic, $result);
+        }
+        $head = array
+        (
+            'name' => '基本信息',
+            'btn' => $button,
+        );
+         
+        // $foot = $button;
+        $html = Dever::show($head, $result);
+        return $html;
+    }
+    public function show_button($info){
+    	$button = array();
+    	$purl = Dever::url('project/database/update?project=agent&table=soft_cash&where_id='.$info['id'].'&col=audit_desc', 'manage');
+        $button[] = array
+        (
+            'type' => 'edit',
+            'link' => $purl,
+            'name' => '备注',
+        );
+        $purl = Dever::url('project/database/update?project=agent&table=soft_cash&where_id='.$info['id'].'&audit=2&col=id,audit,audit_desc', 'manage');
+        // if($aduit)
+        if($info['status'] == 1){
+        	$button[] = array
+            (
+                'type' => 'edit',
+                'link' => $purl,
+                'name' => '待业务初审',
+            );
+        }
+        $purl = Dever::url('project/database/update?project=agent&table=soft_cash&where_id='.$info['id'].'&audit=2&col=id,audit,audit_desc', 'manage');
+        if (Dever::load('manage/auth')->checkFunc('agent.soft_cash', 'edit1', '待财务终审')) {
+	        if($info['status'] == 2){
+	        	$button[] = array
+	            (
+	                'type' => 'edit',
+	                'link' => $purl,
+	                'name' => '待财务终审',
+	            );
+	        }
+	    }
+        
+        $purl = Dever::url('project/database/update?project=agent&table=soft_cash&where_id='.$info['id'].'&audit=3&col=id,audit,audit_desc', 'manage');
+        if (Dever::load('manage/auth')->checkFunc('agent.soft_cash', 'edit2', '驳回')) {
+	        if($info['status'] == 4){
+	        	$button[] = array
+	            (
+	                'type' => 'edit',
+	                'link' => $purl,
+	                'name' => '驳回',
+	            );
+	        }
+	    }
+        $button[] = array
+        (
+            'type' => 'link',
+            'link' => 'refer',
+            'name' => '返回上一页',
+        );
+        return $button;
+    }
+    private function show_agreement($info, $role, $sign_pic, &$result)
+    {
+        $table = array();
+        $table['head'] = array('合同类型', '合同名称', '合同签名', '合同状态');
+        $table['body'] = array();
+        $agreement_type = Dever::db('setting/agreement')->config['config_type'];
+        $agreement_status = Dever::db('agent/member_agreement')->config['status'];
+        if($info['status'] == 3 && $info['agreement_id']){
+        	$agreement_title = '(已生成合同)';
+        	$agreement_button = array();
+        	$agreement = Dever::db('agent/member_agreement')->find(array('id' => $info['agreement_id']));
+        	if($agreement){
+        		$agreement_info = Dever::db('setting/agreement')->find($agreement['agreement_id']);
+        		// print_r($agreement_info);die;
+        		$agreement_status_name = Dever::status($agreement_status, $agreement['status']);
+        		// echo dever::sql();die;
+        		$table['body'] = array(Dever::status($agreement_type, $agreement_info['type']), Dever::load('agent/lib/agreement')->name($agreement_info, $agreement, $role, 2), $sign_pic, $agreement_status_name);
+        	}else{
+        		$agreement_title = '';
+        	}
+        }
+
+        $result['生成软件服务合同' . $agreement_title] = array
+        (
+            'type' => 'table',
+            'head' => array('name' => '&nbsp;', 'btn' => $agreement_button),
+            'content' => $table
+        );
+    }
+
+    public function search_api()
+    {
+        $value = Dever::input('value');
+        if ($value) {
+            $data = Dever::db('agent/soft_cash')->getList(array('mobile' => $value));
+            $table = array();
+            if ($data) {
+                $table = array();
+                $table['head'] = array('序列号', '姓名', '手机号');
+                $table['body'] = array();
+                foreach ($data as $k => $v) {
+                    $table['body'][] = array($v['mobile'], $v['name'], $v['mobile']);
+                }
+
+                $result[] = array
+                (
+                    'type' => 'table',
+                    'content' => $table,
+                );
+
+                $html = Dever::show('', $result, false, false);
+                return $html;
+            }
+
+            return '暂无账号';
+        } else {
+            return '';
+        }
+    }
+}

+ 5 - 0
service/agent/template/manage/member_prize.php

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