custsaleModel.php 1.4 KB

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