clues_505

This commit is contained in:
dengbw
2022-05-05 14:09:20 +08:00
committed by lccsw
parent 287ff561b4
commit 35a903ec71
3 changed files with 21 additions and 156 deletions
+4 -47
View File
@@ -143,7 +143,7 @@ class Clues extends HD_Controller
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
$statusList = $status2List = $logsList = $intention = $autoList = array();
$statusList = $status2List = $logsList = [];
$re = $this->clues_model->get(array('id' => $id));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
@@ -191,30 +191,12 @@ class Clues extends HD_Controller
}
$info_show['logsList'] = $logsList;
//意向信息
$re_b = $this->mdAutoBrand->get(array('id' => $re['brand_id']), 'name');
$re_s = $this->mdAutoSeries->get(array('id' => $re['s_id']), 'name');
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : array();
$intention['brand_name'] = '品牌:' . ($re_b ? $re_b['name'] : '');
$intention['s_name'] = '车系:' . ($re_s ? $re_s['name'] : '');
$intention['v_name'] = '车型:' . ($jsondata['car']['version']['title'] ? $jsondata['car']['version']['title'] : '');
$intention['cor_name'] = '车身颜色:' . ($jsondata['car']['color']['title'] ? $jsondata['car']['color']['title'] : '');
$info_show['intention'] = $intention;
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : [];
//获取城市区域
$dataInfo['city_id'] = $re['city_id'];
$dataInfo['county_id'] = $re['county_id'];
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
if ($re['brand_id']) {
$autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $re['brand_id']), 'id desc', 0, 0, 'id,name');
}
$dataInfo['v_id'] = intval($jsondata['car']['version']['id']);
$dataInfo['cor_id'] = intval($jsondata['car']['color']['id']);
if ($re['s_id']) {
$autoList[3] = $this->mdAutoAttr->select(array('type' => 1, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
$autoList[4] = $this->mdAutoAttr->select(array('type' => 0, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
}
$info_show['autoList'] = $autoList;
//获取已分配店铺
$cus = $this->customers_model->select(['rid' => $re['id']], '', '', '', 'biz_id');
$biz_arr = [];
@@ -476,18 +458,9 @@ class Clues extends HD_Controller
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => $log));
}
} else if ($info['editType'] == 3) {
if (!$info['brand_id']) {
return $this->show_json(SYS_CODE_FAIL, '请选择品牌');
}
$jsondata = $re['jsondata'] ? json_decode($re['jsondata'], true) : array();
$jsondata['car']['version']['id'] = intval($info['v_id']);
$jsondata['car']['color']['id'] = intval($info['cor_id']);
$up_data = [
'brand_id' => $info['brand_id'],
's_id' => $info['s_id'],
'city_id' => $info['city_id'],
'county_id' => $info['county_id'],
'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)
'county_id' => $info['county_id']
];
$ret = $this->clues_model->update($up_data, array('id' => $info['id']));
if (!$ret) {
@@ -495,23 +468,7 @@ class Clues extends HD_Controller
$msg = '修改意向信息失败';
} else {
$msg = '修改意向信息成功';
if ($info['brand_id']) {
$re_b = $this->mdAutoBrand->get(array('id' => $info['brand_id']), 'name');
$log = $re_b['name'];
if ($info['s_id']) {
$re_s = $this->mdAutoSeries->get(array('id' => $info['s_id']), 'name');
$log .= '-' . $re_s['name'];
}
if ($info['v_id']) {
$re_v = $this->mdAutoAttr->get(array('id' => $info['v_id']), 'title');
$log .= '-' . $re_v['title'];
}
if ($info['cor_id']) {
$re_cor = $this->mdAutoAttr->get(array('id' => $info['cor_id']), 'title');
$log .= '-' . $re_cor['title'];
}
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => '更新意向信息为(' . $log . ')'));
}
$this->addLog(array('clue_id' => $info['id'], 'type' => 0, 'log' => '修改意向信息'));
}
}
return $this->show_json($code, $msg);
+16 -11
View File
@@ -108,8 +108,8 @@
<div class="am-para-inline" style="padding-top: 5px;">
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="weeks">本周</a>
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="month">本月</a>
</div>
</div>
</div>
@@ -394,23 +394,28 @@
elem: '#id-create-time', range: '~'
});
$('.id-day-btn').click(function () {
var type = $(this).data('date'), date = '', d_obj = new Date();
var type = $(this).data('date'), date = '', nowDate = new Date();
var beginDate = '', endDate = '';
switch (type) {
case 'today':
date = d_obj.Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
beginDate = endDate = nowDate.Format('yyyy-MM-dd');
break;
case 'yesterday':
date = (new Date(d_obj.getTime() - 86400000)).Format('yyyy-MM-dd');
date = date + ' ~ ' + date;
beginDate = endDate = (new Date(nowDate.getTime() - 86400000)).Format('yyyy-MM-dd');
break;
case '7day':
date = (new Date(d_obj.getTime() - 86400000 * 7)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
case 'weeks':
nowDate.setDate(nowDate.getDate() - nowDate.getDay() + 1);
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
nowDate.setDate(nowDate.getDate() + 6);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + nowDate.getDate();
break;
case '30day':
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
case 'month':
beginDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-01";
var day = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, 0);
endDate = nowDate.getFullYear() + "-" + (nowDate.getMonth() + 1) + "-" + day.getDate();
break;
}
date = beginDate + ' ~ ' + endDate;
$('#id-create-time').val(date);
});
});
+1 -98
View File
@@ -161,49 +161,6 @@
</div>
<div class="am-panel-bd am-g">
<table width="100%" style="margin:0px 0px 10px 0px;">
<tr>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">品牌:</div>
<select style="width: 120px;" v-model="info.brand_id" @change='autoList(2);'>
<option value="0">选择品牌</option>
<template v-for="(v,i) in infoShow['autoList'][1]">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
</td>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">车系:</div>
<select style="width: 120px;" v-model="info.s_id" @change='autoList(3);'>
<option value="0">选择车系</option>
<template v-for="(v,i) in infoShow['autoList'][2]">
<option :value="v.id">{{v.name}}</option>
</template>
</select></div>
</td>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">车型:</div>
<select style="width: 120px;" v-model="info.v_id">
<option value="0">选择车型</option>
<template v-for="(v,i) in infoShow['autoList'][3]">
<option :value="v.id">{{v.name}}</option>
</template>
</select></div>
</td>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">车身色:</div>
<select style="width: 120px;" v-model="info.cor_id">
<option value="0">选择车身色</option>
<template v-for="(v,i) in infoShow['autoList'][4]">
<option :value="v.id">{{v.name}}</option>
</template>
</select></div>
</td>
</tr>
<tr>
<td class="table-td" colspan="2">
<div class="input-group">
@@ -337,7 +294,7 @@
el: '#vue-edit',
data: {
info: {},
infoShow: {"intention": {}, 'autoList': []},
infoShow: {},
goods: {"imgs_url": [], "imgs": [], "log": ''},
cityAry: [],
countyAry: [],
@@ -393,60 +350,6 @@
}
}
},
autoList: function (type) {
var vm = this;
var pid = 0;
if (type == 2) {
if (vm.info.brand_id == 0) {
vm.info.brand_id = 0;
vm.info.s_id = 0;
vm.info.v_id = 0;
vm.info.cor_id = 0;
vm.infoShow['autoList'][2] = [];
vm.infoShow['autoList'][3] = [];
vm.infoShow['autoList'][4] = [];
return;
}
pid = vm.info.brand_id;
} else if (type == 3) {
if (vm.info.s_id == 0) {
vm.info.s_id = 0;
vm.info.v_id = 0;
vm.info.cor_id = 0;
vm.infoShow['autoList'][3] = [];
vm.infoShow['autoList'][4] = [];
return;
}
pid = vm.info.s_id;
}
$.ajax({
url: '/common/auto',
type: 'get',
dataType: 'json',
data: {
type: type,
pid: pid,
tp: 1,
},
success: function (data) {
if (data.data) {
if (type == 2) {
vm.info.s_id = 0;
vm.info.v_id = 0;
vm.info.cor_id = 0;
vm.infoShow['autoList'][2] = data.data;
vm.infoShow['autoList'][3] = [];
vm.infoShow['autoList'][4] = [];
} else if (type == 3) {
vm.info.v_id = 0;
vm.info.cor_id = 0;
vm.infoShow['autoList'][3] = data.data[3];
vm.infoShow['autoList'][4] = data.data[4];
}
}
},
});
},
getStatus2: function () {
//二级分类
var vm = this;