custsaleModel.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. class flow_custsaleClassModel extends flowModel
  3. {
  4. public $statearr;
  5. public function initModel(){
  6. $this->statearr = c('array')->strtoarray('跟进中|blue,已成交|green,已丢失|#888888,暂缓|#ff6600');
  7. }
  8. public function flowrsreplace($rs)
  9. {
  10. $zt = $this->statearr[$rs['state']];
  11. $rs['statess'] = $rs['state'];
  12. $rs['state'] = '<font color="'.$zt[1].'">'.$zt[0].'</font>';
  13. if($rs['htid']>0)$rs['state'].=',<font color=#888888>并建立合同</font>';
  14. return $rs;
  15. }
  16. protected function flowsubmit($na, $sm)
  17. {
  18. m('crm')->update('`lastdt`=now()', $this->rs['custid']);
  19. }
  20. protected function flowoptmenu($ors, $crs)
  21. {
  22. $zt = $ors['statusvalue'];
  23. $num = $ors['num'];
  24. if($num=='ztqh'){
  25. $sarr['state'] = $zt;
  26. if($zt==1)$sarr['dealdt'] = $this->rock->now;
  27. $this->update($sarr, $this->id);
  28. }
  29. if($num=='zhuan'){
  30. $cname = $crs['cname'];
  31. $cnameid = $crs['cnameid'];
  32. $this->update(array(
  33. 'uid' => $cnameid,
  34. 'optname' => $cname
  35. ), $this->id);
  36. $this->push($cnameid, '客户销售', ''.$this->adminname.'将一个客户【{custname}】的一个销售单转移给你');
  37. }
  38. if($num=='genjin' || $num=='ztqh'){
  39. m('crm')->update('`lastdt`=now()', $this->rs['custid']);
  40. }
  41. }
  42. protected function flowbillwhere($uid, $lx)
  43. {
  44. return array(
  45. 'order' => '`state`,`optdt` desc'
  46. );
  47. }
  48. }
粤ICP备19079148号