edit-admin-clues-nearby-biz
This commit is contained in:
@@ -184,6 +184,12 @@ class Clues extends HD_Controller
|
||||
}
|
||||
}
|
||||
$info_show['cus_bizs'] = implode($biz_arr,',');
|
||||
//附近门店
|
||||
if($re['lat']&&$re['lng']){
|
||||
$info_show['near_bizs'] = $this->biz_model->nearby($re['lat'],$re['lng'],1,3,'id,biz_name');
|
||||
}else{
|
||||
$info_show['near_bizs'] = $this->biz_model->select(['city_id'=>$re['city_id'],'county_id'=>$re['county_id'],'status'=>1],'id desc',1,3,'id,biz_name');
|
||||
}
|
||||
$this->data['info'] = $dataInfo;
|
||||
$this->data['info_show'] = $info_show;
|
||||
$this->data['_title'] = '线索详情';
|
||||
|
||||
@@ -34,6 +34,9 @@ class Customer extends HD_Controller
|
||||
$status_arr = $this->customers_model->get_status();
|
||||
unset($status_arr['-1']);
|
||||
$params = $this->input->get();
|
||||
!$params['city_id'] && $params['city_id'] = '';
|
||||
!$params['county_id'] && $params['county_id'] = '';
|
||||
!$params['biz_id'] && $params['biz_id'] = '';
|
||||
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
@@ -55,6 +58,7 @@ class Customer extends HD_Controller
|
||||
}
|
||||
}
|
||||
strlen($params['status']) && $where["status"] = $params['status'];
|
||||
$params['biz_id'] && $where['biz_id'] = $params['biz_id'];
|
||||
|
||||
$count = $this->customers_model->count($where);
|
||||
$lists = [];
|
||||
|
||||
@@ -100,12 +100,6 @@
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -215,6 +209,14 @@
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td" colspan="3">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">推荐门店:</div>
|
||||
<span v-for="(val,key) in infoShow['near_bizs']" :class="'label ml5 '+randClass()">
|
||||
{{val.biz_name}}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="info.editType==3">
|
||||
<td colspan="4">
|
||||
@@ -503,6 +505,11 @@
|
||||
},
|
||||
});
|
||||
},
|
||||
randClass:function(){
|
||||
var classArr = ['label-default','label-primary','label-success','label-info','label-warning','label-danger'];
|
||||
var rand = Math.floor( Math.random() * classArr.length );
|
||||
return classArr[rand]
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'info.city_id':function(nv, ov){
|
||||
|
||||
@@ -34,6 +34,34 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">门店:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="city_id" v-model="params.city_id">
|
||||
<option value="">城市</option>
|
||||
<template v-for="(v,i) in cityAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="county_id" v-model="params.county_id">
|
||||
<option value="">行政区</option>
|
||||
<template v-for="(v,i) in countyAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="biz_id" v-model="params.biz_id">
|
||||
<option value="">门店</option>
|
||||
<template v-for="(v,i) in bizList">
|
||||
<option :value="v.id">{{v.biz_name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<label class="am-para-label w100">创建时间:</label>
|
||||
@@ -150,20 +178,66 @@
|
||||
data: {
|
||||
params: [],
|
||||
searchTpAry: [],
|
||||
lists: []
|
||||
lists: [],
|
||||
cityAry:[],
|
||||
countyAry:[],
|
||||
bizList:[],
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
vm.params = <?=json_encode($params)?>;
|
||||
vm.searchTpAry = <?=json_encode($searchTpAry)?>;
|
||||
vm.lists = <?=json_encode($lists)?>;
|
||||
this.init_citys();
|
||||
},
|
||||
methods: {
|
||||
saveEdit: function () {
|
||||
$("form").submit();
|
||||
}
|
||||
},
|
||||
init_citys:function(){
|
||||
var vm = this;
|
||||
$.get('common/area',{id:'350',key:'city',type:1},function(response){
|
||||
if (response.code == 1) {
|
||||
vm.cityAry = response.data;
|
||||
}
|
||||
});
|
||||
if(vm.params.city_id>0){
|
||||
$.get('common/area',{id:vm.params.city_id,key:'county',type:1},function(response){
|
||||
if (response.code == 1) {
|
||||
vm.countyAry = response.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {}
|
||||
watch: {
|
||||
'params.city_id':function(nv, ov){
|
||||
var that = this;
|
||||
that.county_id = '';
|
||||
if(nv == ''){
|
||||
that.countyAry = [];
|
||||
} else {
|
||||
$.get('common/area',{id:nv,key:'county',type:1},function(response){
|
||||
if (response.code == 1) {
|
||||
that.countyAry = response.data;
|
||||
}
|
||||
});
|
||||
$.post('receiver/clues/get_adviser',{city_id:that.params.city_id,county_id:that.params.county_id},function(response){
|
||||
if (response.code == 1) {
|
||||
that.bizList = response.data.bizList;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.county_id':function(nv, ov){
|
||||
var that = this;
|
||||
$.post('receiver/clues/get_adviser',{city_id:that.params.city_id,county_id:that.params.county_id},function(response){
|
||||
if (response.code == 1) {
|
||||
that.bizList = response.data.bizList;
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
<?php page_script($pager) ?>
|
||||
|
||||
@@ -49,4 +49,25 @@ class Biz_model extends HD_Model
|
||||
return $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度获取附近门店
|
||||
* @param $lat float 纬度
|
||||
* @param $lng float 经度
|
||||
* @param $page int 页码
|
||||
* @param $size int 分页大小
|
||||
*/
|
||||
public function nearby($lat,$lng,$page=1,$size=20,$filed='*' ){
|
||||
$lat = (float)$lat;
|
||||
$lng = (float)$lng;
|
||||
$where = "status=1 and lat>0 and lng>0";
|
||||
|
||||
if($page){
|
||||
$offset = ($page - 1) * $size;
|
||||
$limit = $size;
|
||||
}
|
||||
|
||||
$sql = "select {$filed},round(sqrt(pow(lat-{$lat},2)+pow(lng-{$lng},2)),5)*80000 as dis from lc_biz where {$where} order by dis asc limit {$offset},{$limit}";
|
||||
$rows = $this->db->query($sql)->result_array();
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user