diff --git a/admin/controllers/biz/Situation.php b/admin/controllers/biz/Situation.php index 6c6894fb..852e8c0d 100644 --- a/admin/controllers/biz/Situation.php +++ b/admin/controllers/biz/Situation.php @@ -13,6 +13,7 @@ class Situation extends HD_Controller { parent::__construct(); $this->load->model("biz/biz_model", 'mdBiz'); + $this->load->model("biz/biz_brand_model", 'mdBizBrand'); $this->load->model("biz/biz_base_model", 'mdBizBase'); $this->load->model("biz/biz_sell_model", 'mdBizSell'); $this->load->model('area_model', 'mdArea'); @@ -43,7 +44,7 @@ class Situation extends HD_Controller if (!$re_biz || empty($re_biz)) { return $this->show_json(SYS_CODE_FAIL, '店铺不存在!'); } - $base_info = $sell_info = []; + $base_info = []; //店铺概况 $re_base = $this->mdBizBase->get(['biz_id' => $biz_id]); $fields = $this->mdBizBase->get_fields(); @@ -55,8 +56,15 @@ class Situation extends HD_Controller } else if ($key == 'street_id' && $re_biz['street_id']) {//乡镇 $result = $this->mdStreet->get(['street_id' => $re_biz['street_id']]); $fields[$key]['value'] = $result['street_name']; + } else if ($key == 'company' && $re_biz['brand_id']) {//公司名称 + $result = $this->mdBizBrand->get(['id' => $re_biz['brand_id']]); + $result['brand_name'] && $fields[$key]['value'] = $result['brand_name']; + } else if ($key == 'level') {//级别 + $fields[$key]['value'] = $this->level($biz_id); } else if ($key == 'type' && $re_biz['type']) {//类型 $fields[$key]['value'] = $this->mdBiz->type_ary($re_biz['type']); + } else if ($key == 'address' && $re_biz['address']) {//位置 + $fields[$key]['value'] = $re_biz['address']; } else if ($key == 'lead' && $re_base[$key]) {//负责人 $result = $this->mdUsers->get(['id' => $re_base[$key]]); $fields[$key]['value'] = $result['uname']; @@ -80,43 +88,16 @@ class Situation extends HD_Controller $base_info[] = $setValue; } //售卖概况 - $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); - $jsondata = $re_biz['jsondata'] ? json_decode($re_biz['jsondata'], true) : []; - $y_month = date('Y-m', strtotime("-1 month"));//上个月 - $re_sell = $this->mdBizSell->get(['biz_id' => $biz_id, 'y_month' => $y_month]); - $fields = $this->mdBizSell->get_fields(); - foreach ($fields as $key => $value) { - if ($key == 'cooperation_car' && $jsondata['auto_brands']) { - $autoBrands = ''; - if ($re_sell[$key]) { - $autoBrands = $re_sell[$key]; - } else if ($jsondata['auto_brands']) { -// $auto_brands = implode(',', $jsondata['auto_brands']); -// $res_ab = $this->mdAutoBrand->select(["id in({$auto_brands})" => null], 'id desc', 0, 0, 'name'); -// $res_ab && $auto_brands = implode(',', array_column($res_ab, 'name')); - } - $fields[$key]['value'] = $autoBrands; - } else if ($key == 'sales') { - $orders = ''; - if ($re_sell[$key]) { - $orders = $re_sell[$key]; - } else { -// $last_month_s = date("Y-m-01", strtotime("-1 month"));//上1个月1日 -// $last_month_e = date("Y-m-d", strtotime("$last_month_s +1 month -1 day")); //上1个月最后一天 -// $where = ['biz_id' => $biz_id, 'status<>' => -1, 'brand_id<>' => 3, 'biz_id<>' => 1]; -// $orders = $this->mdOrders->count(array_merge($where, ['c_time >=' => strtotime($last_month_s . ' 00:00:00') -// , 'c_time <=' => strtotime($last_month_e . ' 23:59:59')])); - } - $fields[$key]['value'] = $orders; - } else { - $re_sell[$key] && $fields[$key]['value'] = $re_sell[$key]; - } - $setValue = $fields[$key]; - $setValue['field'] = $key; - $sell_info[] = $setValue; - } $this->data['base_info'] = $base_info; - $this->data['sell_info'] = $sell_info; + $showInfo['biz_id'] = $biz_id; + $showInfo['sell_info'] = ''; + $showInfo['y_month'] = date('Y-m', strtotime("-1 month"));//上个月 + $y_month_ary = []; + for ($i = 1; $i <= 12; $i++) { + $y_month_ary[] = date('Y-m', strtotime("-{$i} month")); + } + $showInfo['y_month_ary'] = $y_month_ary; + $this->data['showInfo'] = $showInfo; $this->data['_title'] = $re_biz['biz_name']; return $this->show_view('biz/situation/get', true); } @@ -142,4 +123,75 @@ class Situation extends HD_Controller { } + + public function get_sell_info() + { + $biz_id = intval($this->input->post('biz_id')); + $y_month = $this->input->post('y_month'); + $this->load->model('auto/auto_brand_model', 'mdAutoBrand'); + $sell_info = []; + if (!$y_month) { + $y_month = date('Y-m', strtotime("-1 month"));//上个月 + } + $re_sell = $this->mdBizSell->get(['biz_id' => $biz_id, 'y_month' => $y_month]); + $fields = $this->mdBizSell->get_fields(); + foreach ($fields as $key => $value) { + if ($key == 'boss_sell') { + $fields[$key]['value'] = $re_sell['boss_sell'] ? '是' : '否'; + } else { + $re_sell[$key] && $fields[$key]['value'] = $re_sell[$key]; + } + $setValue = $fields[$key]; + $setValue['field'] = $key; + $sell_info[] = $setValue; + } + $this->data = array('sell_info' => $sell_info); + return $this->show_json(SYS_CODE_SUCCESS); + } + + private function level($biz_id = 0) + { + $str = ''; + if ($biz_id) { + $where = ['biz_id' => $biz_id, 'status<>' => -1, 'brand_id<>' => 3, 'biz_id<>' => 1]; + $last_month_s = date("Y-m-01", strtotime("-1 month"));//上1个月1日 + $last_month_e = date("Y-m-d", strtotime("$last_month_s +1 month -1 day")); //上1个月最后一天 + $orders = $this->mdOrders->count(array_merge($where, ['c_time >=' => strtotime($last_month_s . ' 00:00:00') + , 'c_time <=' => strtotime($last_month_e . ' 23:59:59')])); + if ($orders >= 12) { + $str = 'A1'; + } else if ($orders >= 9) { + $str = 'A2'; + } else if ($orders >= 6) { + $str = 'A3'; + } else if ($orders >= 5) { + $str = 'B1'; + } else if ($orders >= 4) { + $str = 'B2'; + } else if ($orders >= 3) { + $str = 'B3'; + } else { + $month_s = date("Y-m-01", strtotime("-3 month")); //上3个月1日 + $month_e = date("Y-m-d", strtotime("$month_s +1 month -1 day")); //上3个月最后一天 + $orders = $this->mdOrders->count(array_merge($where, ['c_time >=' => strtotime($month_s . ' 00:00:00') + , 'c_time <=' => strtotime($month_e . ' 23:59:59')])); + if ($orders && $orders <= 8) { + $str = 'C1'; + } else { + $month_s = date("Y-m-d", strtotime("$last_month_s -15 day"));//45天前 + $month_e = $last_month_e; //上个月最后一天 + $orders = $this->mdOrders->count(array_merge($where, ['c_time >=' => strtotime($month_s . ' 00:00:00') + , 'c_time <=' => strtotime($month_e . ' 23:59:59')])); + if ($orders == 1) { + $str = 'C2'; + } else if ($orders == 0) { + $this->load->model('items/items_model', 'mdItems'); + $count_items = $this->mdItems->count(['status<>' => 0, 'biz_id' => $biz_id, 'brand_id<>' => 3, 'biz_id<>' => 1]); + !$count_items && $str = 'C3';//门店有样车未开单 + } + } + } + } + return $str; + } } \ No newline at end of file diff --git a/admin/controllers/items/Transfer.php b/admin/controllers/items/Transfer.php index a07e1e4b..741c1cc7 100644 --- a/admin/controllers/items/Transfer.php +++ b/admin/controllers/items/Transfer.php @@ -316,7 +316,6 @@ class Transfer extends HD_Controller } $transport['imgs'] = $imgs; } - $jsondata['reason'] && $fields[] = ['title' => '调拨理由', 'value' => $jsondata['reason']]; if ($re['arti_id']) { $res_a = $this->mdArticle->select(["id in ({$re['arti_id']})" => null], 'id desc', 0, 0, 'title'); $res_a && $arti_content = implode('   ', array_unique(array_column($res_a, 'title'))); @@ -333,6 +332,7 @@ class Transfer extends HD_Controller } $abnormal['imgs'] = $imgs; } + $jsondata['reason'] && $fields[] = ['title' => '调拨理由', 'value' => $jsondata['reason']]; if ($re['trailer_fees']) { $trailer_fees = $re['trailer_fees'] ? $re['trailer_fees'] . '元' : ''; $trailer_fees .= '  费用承担人:' . $this->mdTransfer->feesTypeAry($re['fees_type']); diff --git a/admin/views/biz/situation/get.php b/admin/views/biz/situation/get.php index f1e34725..1ef0ae85 100644 --- a/admin/views/biz/situation/get.php +++ b/admin/views/biz/situation/get.php @@ -40,14 +40,25 @@ -
- $value) { ?> -
- - : +
+
@@ -56,4 +67,66 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/admin/views/biz/store/lists.php b/admin/views/biz/store/lists.php index a1058a75..f070c5aa 100755 --- a/admin/views/biz/store/lists.php +++ b/admin/views/biz/store/lists.php @@ -142,7 +142,8 @@ - + 概况 渠道归属 4, 'cms_id' => 0, 'sort' => 0, - 'title' => '哪吒V', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '63900 ~ 72900'], + 'title' => '哪吒V', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '65900 ~ 74900'], 'img' => 'https://img.liche.cn/NZV.png' ], [ 'brand_id' => 5, 'cms_id' => 0, 'sort' => 0, - 'title' => '零跑T03', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '59800 ~ 76800'], + 'title' => '零跑T03', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '60800 ~ 84900'], 'img' => 'https://img.liche.cn/T03.png' ], [ 'brand_id' => 5, 'cms_id' => 0, 'sort' => 0, - 'title' => '零跑C11', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '159800 ~ 199800'], + 'title' => '零跑C11', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '159800 ~ 214800'], 'img' => 'https://img.liche.cn/C11.png' ], + [ + 'brand_id' => 7, 'cms_id' => 0, 'sort' => 0, + 'title' => '合创Z03', 'ori_price' => ['title' => '厂商指导价¥', 'value' => '132800 ~ 168800'], + 'img' => 'https://img.liche.cn/HCZ03.png' + ], ]; shuffle($lists); foreach ($lists as $key => $val) {