Option_account.php 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <?php
  2. namespace Agent\Lib;
  3. use Dever;
  4. Class Option_account{
  5. #列表展示
  6. public function show($id){
  7. $info = Dever::db('agent/option_account')->find($id);
  8. $data =array();
  9. $data['list'] = $info['name'].'<br/>'.$info['mobile'].'<br/>'.$info['idcard'];
  10. $count = $info['price']+$info['zh_price']+$info['zj_price']+$info['other_price'];
  11. $data['price'] = '设备费:'.$info['price'].'<br/>装修费:'.$info['zh_price'].'<br/>租金费:'.$info['zj_price'].'<br/>其他:'.$info['other_price'].'<br/>总计:'.$count;
  12. $config = Dever::db('agent/option_account')->config['config_status'];
  13. $status = Dever::status($config,$info['status']);
  14. if($info['jf_date']){
  15. $jf_date = date('Y-m-d H:i',$info['jf_date']);
  16. }else{
  17. $jf_date = '-';
  18. }
  19. $data['date'] = $status.'<br/>'.$jf_date;
  20. // $audit = Dever::db('agent/option_account')->config['config_audit_type'];
  21. // $type = Dever::status($audit,$info['audit_type']);
  22. if($info['audit_type'] == 1){
  23. $type = '待审核';
  24. }elseif($info['audit_type'] == 2 || $info['audit_type'] == 3){
  25. $type = '审核通过';
  26. }else{
  27. $type = '审核不通过';
  28. }
  29. if($info['audit_date']){
  30. $audit_date = date('Y-m-d H:i',$info['audit_date']);
  31. }else{
  32. $audit_date = '-';
  33. }
  34. $data['audit'] = $type.'<br/>'.$audit_date;
  35. return $data;
  36. }
  37. #详情页
  38. public function list(){
  39. $id = Dever::input('id');
  40. $info = Dever::db('agent/option_account')->find($id);
  41. $type_name = '';
  42. if($info['type'] == 1){
  43. $type_name = '零售店';
  44. }
  45. $count = $info['price']+$info['zh_price']+$info['zj_price']+$info['other_price'];
  46. $info_price = '设备费:'.$info['price'].'万元;装修费:'.$info['zh_price'].'万元;租金费:'.$info['zj_price'].'万元;其他:'.$info['other_price'].'万元;总计:'.$count.'万元';
  47. $area = Dever::load("area/api.string", $info['area']);
  48. $area = str_replace(',','',$area);
  49. $image = explode(',',$info['pic']);
  50. $pic = '';
  51. foreach($image as $k => $v){
  52. $pic .= '<a href="'.$v.'" target="_blank"><img src="'.$v.'" width="100" /></a>';
  53. }
  54. if($info['annex']){
  55. $pic .= '<a href="'.$info['annex'].'" target="_blank">点此查看</a>';
  56. }
  57. // $audit = Dever::db('agent/option_account')->config['config_audit_type'];
  58. // $audit_type = Dever::status($audit,$info['audit_type']);
  59. if($info['audit_type'] == 1){
  60. $audit_type = '待审核';
  61. }elseif($info['audit_type'] == 2 || $info['audit_type'] == 3){
  62. $audit_type = '审核通过';
  63. }else{
  64. $audit_type = '审核不通过';
  65. }
  66. $config = Dever::db('agent/option_account')->config['config_status'];
  67. $status = Dever::status($config,$info['status']);
  68. $result = array();
  69. $result['期权记录详情'] = array
  70. (
  71. 'type' => 'info',
  72. 'content' => array
  73. (
  74. array
  75. (
  76. array('期权记录标题', $info['title']),
  77. array('记录说明', $info['desc']),
  78. array('备注', $info['remark']),
  79. ),
  80. array
  81. (
  82. array('记录类型', $type_name),
  83. array('资金记录明细', $info_price),
  84. array('行权说明', '行权3年期。自门店注册日期开始计算。满一年30%,满两年35%,满三年35%'),
  85. ),
  86. ),
  87. );
  88. $result['受益人资料'] = array
  89. (
  90. 'type' => 'info',
  91. 'content' => array
  92. (
  93. array
  94. (
  95. array('受益人姓名', $info['name']),
  96. array('受益人电话', $info['mobile']),
  97. array('受益人身份证号', $info['idcard']),
  98. ),
  99. array
  100. (
  101. array('门店地址', $area.$info['address']),
  102. ),
  103. ),
  104. );
  105. $result['凭证照片/附件'] = array
  106. (
  107. 'type' => 'info',
  108. 'content' => array
  109. (
  110. array
  111. (
  112. array('', $pic),
  113. ),
  114. ),
  115. );
  116. if($info['audit_type'] == 1){
  117. $result['审核结果'] = array
  118. (
  119. 'type' => 'info',
  120. 'content' => array
  121. (
  122. array
  123. (
  124. array('审核状态', $audit_type),
  125. array('交付状态', $status),
  126. ),
  127. ),
  128. );
  129. }else{
  130. $result['审核结果'] = array
  131. (
  132. 'type' => 'info',
  133. 'content' => array
  134. (
  135. array
  136. (
  137. array('审核状态', $audit_type),
  138. array('确认期权数', $info['num']),
  139. array('审核备注', $info['audit_desc']),
  140. ),
  141. array
  142. (
  143. array('交付状态', $status),
  144. ),
  145. ),
  146. );
  147. }
  148. $button = array();
  149. if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit', '备注')) {
  150. $purl = Dever::url('project/database/update?project=agent&table=option_account&where_id='.$info['id'].'&col=remark', 'manage');
  151. $button[] = array
  152. (
  153. 'type' => 'edit',
  154. 'link' => $purl,
  155. 'name' => '备注',
  156. );
  157. }
  158. if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit1', '修改资料')) {
  159. $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,other_price','manage');
  160. $button[] = array
  161. (
  162. 'type' => 'edit',
  163. 'link' => $purl,
  164. 'name' => '修改资料',
  165. );
  166. }
  167. if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit2', '财务终审')) {
  168. if($info['audit_type'] == 1 && $info['audit'] == 1){
  169. $purl = Dever::url('project/database/update?project=agent&table=option_account&where_id='.$info['id'].'&col=id,audit_type,audit,audit_desc,num', 'manage');
  170. $button[] = array
  171. (
  172. 'type' => 'edit',
  173. 'link' => $purl,
  174. 'name' => '财务终审',
  175. );
  176. }
  177. }
  178. if (Dever::load('manage/auth')->checkFunc('agent.option_account', 'edit3', '交付确认')) {
  179. if($info['audit_type'] == 2){
  180. $purl = Dever::url('project/database/update?project=agent&table=option_account&where_id='.$info['id'].'&audit_type=2&col=id', 'manage');
  181. $button[] = array
  182. (
  183. 'type' => 'action',
  184. 'link' => Dever::url('lib/option_account.setStatus?id=' . $info['id'] . '&value=2', 'agent'),
  185. 'name' => '交付确认',
  186. );
  187. }
  188. }
  189. $head = array
  190. (
  191. 'name' => '基本资料',
  192. 'btn' => $button,
  193. );
  194. $foot = $button;
  195. $html = Dever::show($head, $result, $foot);
  196. return $html;
  197. }
  198. public function setStatus_api()
  199. {
  200. $where['where_id'] = Dever::input('id');
  201. $where['set_audit_type'] = 3;
  202. $where['set_status'] = 2;
  203. $where['set_jf_date'] = time();
  204. Dever::db('agent/option_account')->update($where);
  205. return 'reload';
  206. }
  207. public function updateAccount($id,$name,$data){
  208. $audit = Dever::param('audit',$data);
  209. $num = Dever::param('num',$data);
  210. $info = Dever::db('agent/option_account')->find($id);
  211. if($audit){
  212. if ($audit == 1) {
  213. $where['where_id'] = $id;
  214. $where['set_audit_date'] = time();
  215. $where['set_audit_type'] = 2;
  216. if($num){
  217. $where['set_num'] = $num;
  218. }
  219. Dever::db('agent/option_account')->update($where);
  220. }
  221. }
  222. if(!$audit){
  223. if($info['audit'] ==2){
  224. $update['where_id'] = $id;
  225. $update['audit'] = 1;
  226. Dever::db('agent/option_account')->update($update);
  227. }
  228. }
  229. if($id){
  230. $admin = Dever::load('manage/auth.data');
  231. $where['where_id'] = $id;
  232. $where['audit_admin'] = $admin['id'];
  233. Dever::db('agent/option_account')->update($where);
  234. }
  235. }
  236. }