liche update for admin clues edit city_code

This commit is contained in:
xxb
2021-08-19 16:53:21 +08:00
parent eabec524c9
commit f498cefade
4 changed files with 96 additions and 4 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class Common extends CI_Controller
$this->data = $city;
break;
case 'county':
$this->data = $this->area_model->county($id);
$this->data = $this->area_model->county($id, $type);
break;
default:
$this->data = $this->area_model->province();
+23
View File
@@ -136,6 +136,21 @@ class Clues extends HD_Controller
$intention['cor_name'] = '车身颜色:' . ($jsondata['car']['color']['title'] ? $jsondata['car']['color']['title'] : '');
$info_show['intention'] = $intention;
//获取城市区域
$city_id = '';
$county_id = '';
if($jsondata['info'] && $jsondata['info']['city_code']){
$city_code = $jsondata['info']['city_code'];
if('0' === $city_code[5]){
$city_id = $city_code;
} else {
$county_id = $city_code;
$city_id = substr_replace($county_id, '00', 4, 2);
}
}
$dataInfo['city_id'] = $city_id;
$dataInfo['county_id'] = $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');
@@ -331,6 +346,14 @@ class Clues extends HD_Controller
$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']);
if($info['city_id'] || $info['county_id']){
$jsondata['info']['city_code'] = $info['county_id'] ? $info['county_id'] : $info['city_id'];
} else {
if($jsondata['info'] && $jsondata['info']['city_code']){
unset($jsondata['info']['city_code']);
}
}
$ret = $this->clues_model->update(array('brand_id' => $info['brand_id'],
's_id' => $info['s_id'], 'jsondata' => json_encode($jsondata, JSON_UNESCAPED_UNICODE)), array('id' => $info['id']));
if (!$ret) {
+70 -1
View File
@@ -68,7 +68,7 @@
</td>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">业主电话:</div>
<div class="input-group-addon">客户电话:</div>
{{infoShow.mobile_sub}}
</div>
</td>
@@ -175,6 +175,25 @@
</select></div>
</td>
</tr>
<tr>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">城市:</div>
<select style="width: 120px; display: inline" v-model="info.city_id">
<option value="">选择城市</option>
<template v-for="(v,i) in cityAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
<select style="width: 120px; display: inline" v-model="info.county_id">
<option value="">选择行政区</option>
<template v-for="(v,i) in countyAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
</td>
</tr>
<tr v-if="info.editType==3">
<td colspan="4">
<div class="am-form-inline" style="padding-right: 30px;padding-top: 10px;">
@@ -262,11 +281,14 @@
info: {},
infoShow: {"intention": {}, 'autoList': []},
goods: {"imgs_url": [], "imgs": [], "log": ''},
cityAry:[],
countyAry:[]
},
mounted: function () {
var that = this;
that.info = <?=json_encode($info)?>;
that.infoShow = <?=json_encode($info_show)?>;
that.init_citys();
},
computed: {},
created: function () {
@@ -274,6 +296,24 @@
updated: function () {
},
methods: {
init_citys:function(){
var vm = this;
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: '350',
key:'city',
type:1
},
success:function(response){
if (response.code == 1) {
vm.cityAry = response.data;
}
}
});
},
editType: function (index) {
var vm = this;
if (index == 1) {
@@ -441,6 +481,35 @@
},
});
},
},
watch:{
'info.city_id':function(nv, ov){
var that = this;
console.log(that.info);
if(nv == ''){
that.countyAry = [];
that.info.county_id = '';
} else {
if(nv.substring(0,4) != that.info.county_id.substring(0, 4)){
that.info.county_id = '';
}
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: nv,
key:'county',
type:1
},
success:function(response){
if (response.code == 1) {
that.countyAry = response.data;
}
}
});
}
}
}
});
});
+2 -2
View File
@@ -57,11 +57,11 @@ class Area_model extends HD_Model
return $result;
}
public function county($city_id = '')
public function county($city_id = '', $type = 0)
{
$result = array();
$list = $this->select(array('city_id' => $city_id), null, null, null, 'distinct(county_id), county_name');
$result[] = array('name'=>'行政区','id'=>'');
$type == 0 && $result[] = array('name'=>'行政区','id'=>'');
if($list)
{
foreach ($list as $v)