123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309 |
- <?php
- namespace Agent\Lib;
- use Dever;
- Class Option_account{
- #列表展示
- public function show($id){
- $info = Dever::db('agent/option_account')->find($id);
- $data =array();
- $data['list'] = $info['name'].'<br/>'.$info['mobile'].'<br/>'.$info['idcard'];
- // $count = $info['price']+$info['zh_price']+$info['zj_price'];
- $data['price'] = $info['price'].'<br/>'.$info['zh_price'].'<br/>'.$info['zj_price'];
- $config = Dever::db('agent/option_account')->config['config_status'];
- $status = Dever::status($config,$info['status']);
- if($info['jf_date']){
- $jf_date = date('Y-m-d H:i',$info['jf_date']);
- }else{
- $jf_date = '-';
- }
- $data['date'] = $status.'<br/>'.$jf_date;
- // $audit = Dever::db('agent/option_account')->config['config_audit_type'];
- // $type = Dever::status($audit,$info['audit_type']);
- if($info['audit_type'] == 1){
- $type = '待审核';
- }elseif($info['audit_type'] == 2 || $info['audit_type'] == 3){
- $type = '审核通过';
- }else{
- $type = '审核不通过';
- }
- if($info['audit_date']){
- $audit_date = date('Y-m-d H:i',$info['audit_date']);
- }else{
- $audit_date = '-';
- }
- $data['audit'] = $type.'<br/>'.$audit_date;
- return $data;
- }
- #详情页
- public function list(){
- $id = Dever::input('id');
- $info = Dever::db('agent/option_account')->find($id);
- $type_name = '';
- if($info['type'] == 1){
- $type_name = '零售店';
- }
- $count = $info['price']+$info['zh_price']+$info['zj_price'];
- $info_price = '设备费:'.$info['price'].'万元;装修费:'.$info['zh_price'].'万元;租金费:'.$info['zj_price'].'万元';
- $area = Dever::load("area/api.string", $info['area']);
- $area = str_replace(',','',$area);
- $image = explode(',',$info['pic']);
- $pic = '';
- foreach($image as $k => $v){
- $pic .= '<a href="'.$v.'" target="_blank"><img src="'.$v.'" width="100" /></a>';
- }
- if($info['annex']){
- $pic .= '<a href="'.$info['annex'].'" target="_blank">点此查看</a>';
- }
- // $audit = Dever::db('agent/option_account')->config['config_audit_type'];
- // $audit_type = Dever::status($audit,$info['audit_type']);
- if($info['audit_type'] == 1){
- $audit_type = '待审核';
- }elseif($info['audit_type'] == 2 || $info['audit_type'] == 3){
- $audit_type = '审核通过';
- }else{
- $audit_type = '审核不通过';
- }
- $config = Dever::db('agent/option_account')->config['config_status'];
- $status = Dever::status($config,$info['status']);
- $policy = Dever::db('agent/option_policy')->find($info['policy_id']);
- $policy_name = '';
- if ($policy && $policy['name']) {
- $policy_name = $policy['name'];
- }
- $exe = explode(',', $info['exercise_id']);
- foreach ($exe as $k => $v) {
- $exer[] = Dever::db('agent/option_exercise')->find($v);
- }
- // print_R($exercise);die;
- $exercise_name = '';
- if ($exer) {
- $ex = array_column($exer,'name');
- if ($ex) {
- $exercise_name = implode(';', $ex);
- }
- }
- $release = Dever::db('agent/option_release')->find($info['release_id']);
- $release_name = '';
- if ($release && $release['name']) {
- $release_name = $release['name'];
- }
- $result = array();
- $result['期权记录详情'] = array
- (
- 'type' => 'info',
- 'content' => array
- (
- array
- (
- array('期权记录标题', $info['title']),
- array('记录说明', $info['desc']),
- array('备注', $info['remark']),
- ),
- array
- (
- array('记录类型', $type_name),
- array('开店投入金额', $info['price'].'元'),
- array('零售店政策', $policy_name),
- ),
- array
- (
- array('政策对应期权价值', $info['zh_price']),
- array('实际补贴期权价值', $info['zj_price']),
- array('行权条件', $exercise_name),
- ),
- array
- (
- array('释放比例', $release_name),
- ),
- ),
- );
- $result['受益人资料'] = array
- (
- 'type' => 'info',
- 'content' => array
- (
- array
- (
- array('受益人姓名', $info['name']),
- array('受益人电话', $info['mobile']),
- array('受益人身份证号', $info['idcard']),
- ),
- array
- (
- array('受益人邮箱', $info['email']),
- array('门店地址', $area.$info['address']),
- array('门店编号', $info['number']),
- ),
- ),
- );
- $result['凭证照片/附件'] = array
- (
- 'type' => 'info',
- 'content' => array
- (
- array
- (
- array('', $pic),
- ),
- ),
- );
- if($info['audit_type'] == 1){
- $result['审核结果'] = array
- (
- 'type' => 'info',
- 'content' => array
- (
- array
- (
- array('审核状态', $audit_type),
- array('交付状态', $status),
- ),
- ),
- );
- }else{
- $result['审核结果'] = array
- (
- 'type' => 'info',
- 'content' => array
- (
- array
- (
- array('审核状态', $audit_type),
- // array('确认期权数', $info['num']),
- array('审核备注', $info['audit_desc']),
- ),
- array
- (
- array('交付状态', $status),
- ),
- ),
- );
- }
- $button = array();
-
- if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit', '备注')) {
- $purl = Dever::url('project/database/update?project=agent&table=option_account&where_id='.$info['id'].'&col=remark', 'manage');
- $button[] = array
- (
- 'type' => 'edit',
- 'link' => $purl,
- 'name' => '备注',
- );
- }
- if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit1', '修改资料')) {
- $purl = Dever::url('project/database/update?project=agent&table=option_account&where_id='.$info['id'].'&audit='.$info['audit'].'&col=name,mobile,idcard,area,address,title,remark,type,price,zh_price,zj_price,policy_id,exercise_id,release_id','manage');
- $button[] = array
- (
- 'type' => 'edit',
- 'link' => $purl,
- 'name' => '修改资料',
- );
- }
- if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit2', '财务终审')) {
- if($info['audit_type'] == 1 && $info['audit'] == 1){
- $purl = Dever::url('project/database/update?project=agent&table=option_account&where_id='.$info['id'].'&col=id,audit_type,audit,audit_desc,num', 'manage');
- $button[] = array
- (
- 'type' => 'edit',
- 'link' => $purl,
- 'name' => '财务终审',
- );
- }
-
- }
- if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit3', '交付确认')) {
- if($info['audit_type'] == 2){
- $purl = Dever::url('project/database/update?project=agent&table=option_account&where_id='.$info['id'].'&audit_type=2&col=id', 'manage');
- $button[] = array
- (
- 'type' => 'action',
- 'link' => Dever::url('lib/option_account.setStatus?id=' . $info['id'] . '&value=2', 'agent'),
- 'name' => '交付确认',
- );
- }
-
- }
- $head = array
- (
- 'name' => '基本资料',
- 'btn' => $button,
- );
- $foot = $button;
- $html = Dever::show($head, $result, $foot);
- return $html;
- }
- public function setStatus_api()
- {
- $where['where_id'] = Dever::input('id');
- $where['set_audit_type'] = 3;
- $where['set_status'] = 2;
- $where['set_jf_date'] = time();
- Dever::db('agent/option_account')->update($where);
- return 'reload';
- }
- public function updateAccount($id,$name,$data)
- {
- $price = Dever::param('price',$data);
- $zh_price = Dever::param('zh_price',$data);
- $zj_price = Dever::param('zj_price',$data);
- $audit = Dever::param('audit',$data);
- $num = Dever::param('num',$data);
- $info = Dever::db('agent/option_account')->find($id);
- // if (!$info) {
- // if ($price <= $zh_price){
- // $zj_price = $price;
- // } elseif ($price > $zh_price) {
- // $zj_price = $price - $zh_price;
- // }
- // $w['where_id'] = $id;
- // $w['zj_price'] = $zj_price;
- // // print_R($w);die;
- // Dever::db('agent/option_account')->update($w);
- // }
- // if (!$info['zj_price'] || $info['zj_price'] <=0) {
- // if ($info['price'] <= $info['zh_price']) {
- // $zj_price = $info['price'];
- // } elseif ($info['price'] > $info['zh_price']) {
- // $zj_price = $info['price'] - $info['zh_price'];
- // }
- // $w['where_id'] = $info['id'];
- // $w['zj_price'] = $zj_price;
- // // print_R($w);die;
- // Dever::db('agent/option_account')->update($w);
- // }
- if($audit){
- if ($audit == 1) {
- $where['where_id'] = $id;
- $where['set_audit_date'] = time();
- $where['set_audit_type'] = 2;
- if($num){
- $where['set_num'] = $num;
- }
- Dever::db('agent/option_account')->update($where);
- }
-
- }
- if(!$audit){
- if($info['audit'] ==2){
- $update['where_id'] = $id;
- $update['audit'] = 1;
- Dever::db('agent/option_account')->update($update);
- }
- }
- if($id){
- $admin = Dever::load('manage/auth.data');
- $where['where_id'] = $id;
- $where['audit_admin'] = $admin['id'];
- Dever::db('agent/option_account')->update($where);
- }
- }
- }
|