作者 王晓刚
1 个管道 的构建 通过 耗费 0 秒

商品搜索

... ... @@ -246,8 +246,12 @@ class Goods extends Frontend
->join('sto_goodstype t','t.id = g.goodstype_id')
->join('sto_store s','s.id = g.store_id')
->where($where)
->order($order)
->select();
->order($order);
if(!empty($param['paginate'])){
$data = $data->paginate($param['pageNum'],'',['page'=>$param['page']]);
}else{
$data = $data->select();
}
foreach($data as $key => $vo){
//计算距离
$distance = distance($param,$vo);
... ...
... ... @@ -761,7 +761,8 @@
success:function(res){
console.log(res);
var goods_html = "";
$(res.data).each(function (key1, vo) {
$(res.data.data).each(function (key1, vo) {
console.log(vo);
var property = "";
$(vo.property).each(function (key2, p) {
property += "<span class=\"myLable\">"+p+"</span>";
... ... @@ -782,6 +783,7 @@
" </tr>";
goods_html += str.replace("GOODS_ID",vo.id).replace("STORE_ID",vo.store_id).replace("PROVINCE_ID",province_id);
});
console.log(goods_html);
$('.goods_dom').html(goods_html);
$('#resultsNum').html(res.data.total+"件");
//初始化分页
... ...