...
|
...
|
@@ -83,6 +83,9 @@ |
|
|
border-radius: 0 8px 8px 0;
|
|
|
}
|
|
|
.content .contentMain #tableBox .tableButtons{
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
margin-bottom: 16px;
|
|
|
}
|
|
|
.content .contentMain #tableBox .tableButtons button{
|
...
|
...
|
@@ -96,6 +99,9 @@ |
|
|
font-family: PingFang SC;
|
|
|
font-weight: 400;
|
|
|
color: rgba(4, 17, 33, 1);
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
}
|
|
|
.content .contentMain #tableBox .tableButtons .dropdown{
|
|
|
display: inline-block;
|
...
|
...
|
@@ -506,11 +512,11 @@ |
|
|
<div class="locationBox">
|
|
|
<img src="__CDN__/assets/store/images/location_fill.png" alt="">
|
|
|
<p class="title">当前区域</p>
|
|
|
<p id="locationText">天津市河东区大直沽西路</p>
|
|
|
<p id="locationText"></p>
|
|
|
</div>
|
|
|
<!--搜索框-->
|
|
|
<div class="searchBox">
|
|
|
<input id="searchVal" type="text" class="search form-control" placeholder="请输入型号、参数查找元器件" />
|
|
|
<input id="searchVal" type="text" class="search form-control" placeholder="请输入型号、参数查找元器件" value="{$keyword}"/>
|
|
|
<span class="input-group-btn">
|
|
|
<button class="btn" onclick="searchData()">
|
|
|
<img src="__CDN__/assets/store/images/search.png" alt="user">
|
...
|
...
|
@@ -523,44 +529,48 @@ |
|
|
<!--搜索结果表格-->
|
|
|
<div id="tableBox">
|
|
|
<div class="tableButtons">
|
|
|
<button class="btn activeBtn" onclick="sortSearch(this, 'salesVolume')">
|
|
|
销量
|
|
|
<img src="__CDN__/assets/store/images/dropDwon_select.png" alt="">
|
|
|
<button class="btn" data-sort="1" onclick="sortSearch(this, 'salesVolume')">
|
|
|
<div>销量</div>
|
|
|
<div style="width: 18px;">
|
|
|
<img src="__CDN__/assets/store/images/dropDwon.png" alt="">
|
|
|
</div>
|
|
|
</button>
|
|
|
<button class="btn" onclick="sortSearch(this, 'score')">
|
|
|
评分
|
|
|
<img src="__CDN__/assets/store/images/dropDwon.png" alt="">
|
|
|
<button class="btn" data-sort="2" onclick="sortSearch(this, 'score')">
|
|
|
<div>评分</div>
|
|
|
<div style="width: 18px;"><img src="__CDN__/assets/store/images/dropDwon.png" alt=""></div>
|
|
|
</button>
|
|
|
<button class="btn" onclick="sortSearch(this, 'releaseTime')">
|
|
|
发布时间
|
|
|
<img src="__CDN__/assets/store/images/dropDwon.png" alt="">
|
|
|
<button class="btn" data-sort="3" onclick="sortSearch(this, 'releaseTime')">
|
|
|
<div>发布时间</div>
|
|
|
<div style="width: 18px;"><img src="__CDN__/assets/store/images/dropDwon.png" alt=""></div>
|
|
|
</button>
|
|
|
<button class="btn" onclick="sortSearch(this, 'stock')">
|
|
|
库存
|
|
|
<img src="__CDN__/assets/store/images/dropDwon.png" alt="">
|
|
|
<button class="btn" data-sort="4" onclick="sortSearch(this, 'stock')">
|
|
|
<div>库存</div>
|
|
|
<div style="width: 18px;"><img src="__CDN__/assets/store/images/dropDwon.png" alt=""></div>
|
|
|
</button>
|
|
|
<button class="btn priceBtn" onclick="sortSearch(this, 'price')">
|
|
|
价格
|
|
|
<img src="__CDN__/assets/store/images/dropDwon_up.png" alt="">
|
|
|
<img src="__CDN__/assets/store/images/dropDwon.png" alt="">
|
|
|
<button class="btn priceBtn" data-sort="0" onclick="sortSearch(this, 'price')">
|
|
|
<div>价格</div>
|
|
|
<div style="display: flex;flex-direction: column;align-items: center;height: 18px;width: 30px">
|
|
|
<img src="__CDN__/assets/store/images/dropDwon_up.png" alt="">
|
|
|
<img src="__CDN__/assets/store/images/dropDwon.png" alt="">
|
|
|
</div>
|
|
|
</button>
|
|
|
<div class="dropdown dropdownBtn">
|
|
|
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
|
<span class="distributorName">全部商家</span>
|
|
|
<span class="caret"></span>
|
|
|
<button class="btn btn-default dropdown-toggle activeBtn" data-sort="0" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
|
|
<div><span class="distributorName">全部商家</span></div>
|
|
|
<div style="width: 18px;"><span class="caret"></span></div>
|
|
|
</button>
|
|
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
|
|
<li><a href="#" onclick="selectDistributor(this)">全部商家</a></li>
|
|
|
<li><a href="#" data-sort="0" onclick="selectDistributor(this)">全部商家</a></li>
|
|
|
<li role="separator" class="divider"></li>
|
|
|
<li><a href="#" onclick="selectDistributor(this)">供应商</a></li>
|
|
|
<li><a href="#" data-sort="7" onclick="selectDistributor(this)">供应商</a></li>
|
|
|
<li role="separator" class="divider"></li>
|
|
|
<li><a href="#" onclick="selectDistributor(this)">一级代理</a></li>
|
|
|
<li><a href="#" data-sort="8" onclick="selectDistributor(this)">一级代理</a></li>
|
|
|
<li role="separator" class="divider"></li>
|
|
|
<li><a href="#" onclick="selectDistributor(this)">厂家直销</a></li>
|
|
|
<li><a href="#" data-sort="9" onclick="selectDistributor(this)">厂家直销</a></li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<p>
|
|
|
为你找到<span id="resultsNum">5999件</span>相关商品
|
|
|
为你找到<span id="resultsNum">0件</span>相关商品
|
|
|
</p>
|
|
|
</div>
|
|
|
|
...
|
...
|
@@ -587,137 +597,17 @@ |
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<td width="54px">1</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">2</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">3</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">4</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">5</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">6</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">7</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">8</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">9</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td width="54px">10</td>
|
|
|
<td width="100px"><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td width="180px">TOGIALED(统佳)
|
|
|
TJ-L3FYTSARMFCSFLX2R-A5
|
|
|
发光二极管 DIP 红发红</td>
|
|
|
<td width="102px">80000</td>
|
|
|
<td width="102px">buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td width="140px">TOGIALED(统佳)</td>
|
|
|
<td width="128px">单价:¥0.0675</td>
|
|
|
<td width="131px">天津市河东区
|
|
|
大直沽西路(10km)</td>
|
|
|
</tr>
|
|
|
<tbody class="goods_dom">
|
|
|
<!--<tr>
|
|
|
<td>1</td>
|
|
|
<td><img src="__CDN__/assets/store/images/tableImg.png" alt=""></td>
|
|
|
<td>TOGIALED(统佳) TJ-L3FYTSARMFCSFLX2R-A5 发光二极管 DIP 红发红</td>
|
|
|
<td>80000</td>
|
|
|
<td>buerklin<span class="myLable">厂家直销</span></td>
|
|
|
<td>TOGIALED(统佳)</td>
|
|
|
<td>单价:¥0.0675</td>
|
|
|
<td>天津市河东区大直沽西路(10km)</td>
|
|
|
</tr>-->
|
|
|
</tbody>
|
|
|
</table>
|
|
|
|
...
|
...
|
@@ -734,8 +624,8 @@ |
|
|
<div id="mapShowNoResultsBox">
|
|
|
<img src="__CDN__/assets/store/images/noResults.png" alt="img">
|
|
|
<p id="mapShowTipsTitle">温馨提示</p>
|
|
|
<p id="mapShowTipsText">抱歉,未找到与‘XXXXXXXXXX’相关的商品</p>
|
|
|
<a href="helpBuy.html">帮买服务</a>
|
|
|
<p id="mapShowTipsText">抱歉,未找到与‘{$keyword}’相关的商品</p>
|
|
|
<a href="">帮买服务</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
...
|
...
|
@@ -768,13 +658,8 @@ |
|
|
<p id="tipsText">未搜索到,换个试试</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div id="allmap"></div>
|
|
|
{include file="public/footer"/}
|
|
|
{include file="public/js"/}
|
|
|
<!--百度地图引入-->
|
|
|
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=lu7CH9ucr6STjUk1GQgkfzjhpHbb7hPd"></script>
|
|
|
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=lu7CH9ucr6STjUk1GQgkfzjhpHbb7hPd"></script>
|
|
|
<script type="text/javascript" src="http://api.map.baidu.com/library/CityList/1.2/src/CityList_min.js"></script>
|
|
|
<script>
|
|
|
var noResults = false;
|
|
|
var mapShow = false;
|
...
|
...
|
@@ -783,35 +668,119 @@ |
|
|
var locationLng = 117.233;
|
|
|
var locationLat = 39.11365;
|
|
|
$(function () {
|
|
|
var val = decodeURI(window.location.href.split('searchKey=')[1]);
|
|
|
$('#searchVal').val(val);
|
|
|
searchData();
|
|
|
showTableData();
|
|
|
// showTableData();
|
|
|
initMap();
|
|
|
tableClick();
|
|
|
initPaging();
|
|
|
initLocation();
|
|
|
initLocation();//获取定位信息
|
|
|
});
|
|
|
|
|
|
//表格点击事件
|
|
|
function tableClick() {
|
|
|
$('#searchTable tbody tr').click(function (e) {
|
|
|
console.log(e)
|
|
|
console.log(this)
|
|
|
$("#searchTable").on("click","tbody tr",function (e){
|
|
|
// $('#searchTable tbody tr').click(function (e) {
|
|
|
// console.log(e);
|
|
|
// console.log(this);
|
|
|
$('.activeTr').removeClass('activeTr');
|
|
|
$(this).addClass('activeTr');
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//定位当前位置
|
|
|
function initLocation(){
|
|
|
// 百度地图API功能
|
|
|
var map = new BMap.Map("allmap");
|
|
|
var point = new BMap.Point(116.331398,39.897445);
|
|
|
map.centerAndZoom(point,12);
|
|
|
var geolocation = new BMap.Geolocation();
|
|
|
geolocation.getCurrentPosition(function(r){
|
|
|
$('#locationText').html(r.address.province + "" + r.address.city);
|
|
|
if(this.getStatus() == BMAP_STATUS_SUCCESS){
|
|
|
var mk = new BMap.Marker(r.point);
|
|
|
map.addOverlay(mk);
|
|
|
map.panTo(r.point);
|
|
|
//省份名称转换为id
|
|
|
$.ajax({
|
|
|
url:"{:url('index/sundry/get_province_id')}",
|
|
|
type:"POST",
|
|
|
data:{"province_name":r.address.province},
|
|
|
async:false,
|
|
|
success:function(res){
|
|
|
if(res.code == 1){
|
|
|
province_id = res.data.province_id;
|
|
|
lng = r.point.lng;
|
|
|
lat = r.point.lat;
|
|
|
//初始化产品热卖
|
|
|
initGoodsList();
|
|
|
}else{
|
|
|
toast(res.msg);
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
toast('failed'+this.getStatus());
|
|
|
}
|
|
|
},{enableHighAccuracy: true})
|
|
|
}
|
|
|
|
|
|
//初始化商品列表
|
|
|
function initGoodsList(page = 1, pageNum = 10){
|
|
|
//排序规则
|
|
|
var sort = $('.activeBtn').attr('data-sort');
|
|
|
//关键字
|
|
|
var keyword = $('#searchVal').val();
|
|
|
$.ajax({
|
|
|
url:"{:url('index/goods/get_all')}",
|
|
|
type:"POST",
|
|
|
data:{"province_id":province_id,"page":page,"pageNum":pageNum,'paginate':1,'sort':sort,'keyword':keyword,'lng':lng,'lat':lat},
|
|
|
success:function(res){
|
|
|
console.log(res);
|
|
|
var goods_html = "";
|
|
|
$(res.data.data).each(function (key1, vo) {
|
|
|
var property = "";
|
|
|
$(vo.property).each(function (key2, p) {
|
|
|
property += "<span class=\"myLable\">"+p+"</span>";
|
|
|
});
|
|
|
var str = "<tr>\n" +
|
|
|
" <td>"+vo.id+"</td>\n" +
|
|
|
" <td><img src=\""+vo.thumbnail+"\" alt=\"\" style='width: 100px;height:50px'></td>\n" +
|
|
|
" <td>"+vo.goodsname+"</td>\n" +
|
|
|
" <td>"+vo.inventory+"</td>\n" +
|
|
|
" <td>"+vo.store_name+property+"\n" +
|
|
|
" <td>"+vo.brand+"</td>\n" +
|
|
|
" <td>单价:¥"+vo.price+"</td>\n" +
|
|
|
" <td>"+vo.store_address+"(10km)</td>\n" +
|
|
|
" </tr>";
|
|
|
goods_html += str.replace("GOODS_ID",vo.id);
|
|
|
});
|
|
|
$('.goods_dom').html(goods_html);
|
|
|
$('#resultsNum').html(res.data.total+"件");
|
|
|
//初始化分页
|
|
|
var totalPage = Math.ceil(res.data.total/pageNum);
|
|
|
initPaging(res.data.total,res.data.current_page,totalPage,pageNum);
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//初始化分页
|
|
|
function initPaging() {
|
|
|
function initPaging(totalSize = 0, current_page = 1, totalPage = 0, pageNum, showPageNum = 5) {
|
|
|
$("#paginationAllOrder").whjPaging({
|
|
|
//每页显示数据条数
|
|
|
pageNum: pageNum,
|
|
|
//当前页
|
|
|
current_page: current_page,
|
|
|
//可选,总条数
|
|
|
totalSize: 90,
|
|
|
totalSize: totalSize,
|
|
|
//可选,总页数
|
|
|
totalPage: 18,
|
|
|
totalPage: totalPage,
|
|
|
//可选,展示页码数量,默认5个页码数量
|
|
|
showPageNum: 5,
|
|
|
showPageNum: showPageNum,
|
|
|
//可选,css设置,可设置值:css-1,css-2,css-3,css-4,css-5,默认css-1,可自定义样式
|
|
|
css: 'css-1',
|
|
|
//可选,上一页按钮展示文本,默认显示文本为上一页
|
...
|
...
|
@@ -835,6 +804,7 @@ |
|
|
//必选,回掉函数,返回参数:第一个参数为页码,第二个参数为每页显示N条
|
|
|
callBack: function (currPage, pageSize) {
|
|
|
console.log('currPage:' + currPage + ' pageSize:' + pageSize);
|
|
|
initGoodsList(currPage, pageSize)
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -842,6 +812,7 @@ |
|
|
//切换经销商
|
|
|
function selectDistributor(obj) {
|
|
|
$(obj).closest('.dropdown').find('.distributorName').html($(obj).html());
|
|
|
$('#dropdownMenu1').attr('data-sort',$(obj).attr('data-sort'));
|
|
|
sortSearch($('#dropdownMenu1')[0], $(obj).html());
|
|
|
}
|
|
|
|
...
|
...
|
@@ -849,31 +820,37 @@ |
|
|
function searchData(val) {
|
|
|
var searchKey = $('#searchVal').val();
|
|
|
if(searchKey == ''){
|
|
|
$.message({
|
|
|
message:'请输入要搜索的内容',
|
|
|
type:'warning'
|
|
|
});
|
|
|
toast('请输入要搜索的内容');
|
|
|
return;
|
|
|
}
|
|
|
initGoodsList();
|
|
|
//noResultsTips();
|
|
|
}
|
|
|
|
|
|
//排序查询
|
|
|
function sortSearch(obj, type) {
|
|
|
if(!$('.activeBtn').hasClass('priceBtn')){
|
|
|
$('.activeBtn img').attr('src', '__CDN__/assets/store/images/dropDwon.png')
|
|
|
$('.activeBtn img').attr('src', '__CDN__/assets/store/images/dropDwon.png');
|
|
|
}
|
|
|
$('.activeBtn').removeClass('activeBtn');
|
|
|
$(obj).addClass('activeBtn');
|
|
|
if(type != 'price'){
|
|
|
$(obj).find('img').attr('src', '__CDN__/assets/store/images/dropDwon_select.png')
|
|
|
$(obj).find('img').attr('src', '__CDN__/assets/store/images/dropDwon_select.png');
|
|
|
$('.priceBtn').attr('data-sort',0);
|
|
|
$('.priceBtn').find('img').eq(0).attr('src', '__CDN__/assets/store/images/dropDwon_up.png');
|
|
|
$('.priceBtn').find('img').eq(0).attr('src', '__CDN__/assets/store/images/dropDwon.png');
|
|
|
}else{
|
|
|
if($.inArray($(obj).attr('data-sort'),['0','5']) != -1){
|
|
|
$(obj).find('img').eq(1).attr('src', '__CDN__/assets/store/images/dropDwon_select.png');
|
|
|
$(obj).find('img').eq(0).attr('src', '__CDN__/assets/store/images/dropDwon_up.png');
|
|
|
$(obj).attr('data-sort',6);
|
|
|
}else{
|
|
|
$(obj).find('img').eq(0).attr('src', '__CDN__/assets/store/images/dropDwon_up_select.png');
|
|
|
$(obj).find('img').eq(1).attr('src', '__CDN__/assets/store/images/dropDwon.png');
|
|
|
$(obj).attr('data-sort',5);
|
|
|
}
|
|
|
}
|
|
|
console.log(type);
|
|
|
}
|
|
|
|
|
|
//显示表格数据
|
|
|
function showTableData() {
|
|
|
return
|
|
|
initGoodsList();
|
|
|
}
|
|
|
|
|
|
//无搜索结果提示
|
...
|
...
|
@@ -912,6 +889,7 @@ |
|
|
})
|
|
|
mapShow = true;
|
|
|
noResultsTips();
|
|
|
initMap();
|
|
|
}
|
|
|
|
|
|
//收回地图
|
...
|
...
|
@@ -935,6 +913,8 @@ |
|
|
mapObj.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
|
|
|
mapObj.setDefaultCursor('pointer');
|
|
|
addMarker(point, 999);
|
|
|
rangeSearch50();
|
|
|
|
|
|
|
|
|
var size = new BMap.Size(405, 43);
|
|
|
mapObj.addControl(new BMap.CityListControl({
|
...
|
...
|
@@ -945,20 +925,37 @@ |
|
|
geoc = new BMap.Geocoder();
|
|
|
|
|
|
mapObj.addEventListener("click", function(e){
|
|
|
console.log(e);
|
|
|
var allOverlay = this.getOverlays();
|
|
|
for (var i=0; i<allOverlay.length; i++){
|
|
|
this.removeOverlay(allOverlay[i]);
|
|
|
}
|
|
|
|
|
|
locationLng = e.point.lng;
|
|
|
locationLat = e.point.lat;
|
|
|
|
|
|
geoc.getLocation(e.point, function(rs){
|
|
|
var addComp = rs.addressComponents;
|
|
|
$('#locationText').html(addComp.province + "" + addComp.city + "" + addComp.district + "" + addComp.street + "" + addComp.streetNumber);
|
|
|
//省份名称转换为id
|
|
|
$.ajax({
|
|
|
url:"{:url('index/sundry/get_province_id')}",
|
|
|
type:"POST",
|
|
|
data:{"province_name":addComp.province},
|
|
|
async:false,
|
|
|
success:function(res){
|
|
|
console.log(res);
|
|
|
if(res.code == 1){
|
|
|
province_id = res.data.province_id;
|
|
|
lng = locationLng;
|
|
|
lat = locationLat;
|
|
|
rangeSearch50();
|
|
|
}else{
|
|
|
toast(res.msg);
|
|
|
}
|
|
|
},
|
|
|
error:function(res){
|
|
|
toast('与服务器断开连接');
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
var point = new BMap.Point(locationLng, locationLat);
|
|
|
addMarker(point, 999);
|
|
|
})
|
...
|
...
|
@@ -970,6 +967,7 @@ |
|
|
// 创建标注对象并添加到地图
|
|
|
var marker = new BMap.Marker(point, {icon: myIcon});
|
|
|
mapObj.addOverlay(marker);
|
|
|
console.log(marker);
|
|
|
}
|
|
|
|
|
|
//查询50KM范围内在售商品
|
...
|
...
|
@@ -990,10 +988,7 @@ |
|
|
console.log(circle.getRadius()); //返回圆形覆盖物的半径
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//测试搜索,正式使用时应创建point坐标传入addMarker
|
|
|
var local = new BMap.LocalSearch(mapObj, {renderOptions: {map: mapObj, autoViewport: false}});
|
|
|
local.searchNearby('地铁站',mPoint,5000);
|
|
|
initGoodsList();
|
|
|
}
|
|
|
</script>
|
|
|
</body>
|
...
|
...
|
|