Option_account.php 8.6 KB

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