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

跳了好多东西

... ... @@ -87,4 +87,29 @@ class OrderController extends WeChatBaseController
}
$this->success('SUCCESS');
}
public function delivery(){
$id = $this->request->param('indent_id',0,'intval');
if(empty($id)){
$this->error('缺少必要参数');
}
$where1['id'] = ['eq',$id];
$indentModel = new IndentModel();
$data = $indentModel->findData($where1);
if(empty($data)){
$this->error('缺少必要参数','','','');
}
$where2['indent_id'] = ['eq',$data['id']];
$indentGoodsModel = new IndentGoodsModel();
$indentGoods = $indentGoodsModel->selectData($where2);
$data['indent_goods'] = $indentGoods;
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
if($data['state'] != 5){
$this->error('订单不是待收货状态','','','');
}
$result = $indentModel->updateData($where1,['state'=>3]);
if(empty($result)){
$this->error('sql执行失败','','','');
}
$this->success('SUCCESS','',$data);
}
}
\ No newline at end of file
... ...
... ... @@ -168,7 +168,7 @@ class OrderSalesmanController extends WeChatBaseController
$this->error('缺少必参数','','','');
}
$indentModel = new IndentModel();
$indent = $indentModel->findData(['id'=>$id]);
$indent = $indentModel->findData(['id'=>$id])->toArray();
if(empty($indent)){
$this->error('查询为空');
}
... ... @@ -176,7 +176,7 @@ class OrderSalesmanController extends WeChatBaseController
$indent_goods = $indentGoodsModel->selectData(['indent_id'=>$indent['id']]);
if(!empty($indent['indent_address'])){
$addressModel = new AddressModel();
$indent_address = $addressModel->findData(['id'=>$indent['indent_address']]);
$indent_address = $addressModel->findData(['id'=>$indent['indent_address']])->toArray();
$indent['indent_address'] = $indent_address;
}
$indent['indent_goods'] = $indent_goods;
... ...
... ... @@ -97,6 +97,7 @@
<a href="{:url('logistics/index',array('indent_id'=>$vo['id']))}">
<div class="myorder_bottom2_2">查看物流</div>
</a>
<div class="myorder_bottom2_2 delivery" data-id="{$vo.id}">确认收货</div>
<elseif condition="$vo.state eq 3"/>
<div class="myorder_bottom2_2">去评价</div>
</if>
... ... @@ -172,6 +173,7 @@
<a href="{:url('logistics/index',array('indent_id'=>$vo['id']))}">
<div class="myorder_bottom2_2">查看物流</div>
</a>
<div class="myorder_bottom2_2 delivery" data-id="{$vo.id}">确认收货</div>
<elseif condition="$vo.state eq 3"/>
<div class="myorder_bottom2_2">去评价</div>
</if>
... ... @@ -248,8 +250,10 @@
<a href="{:url('logistics/index',array('indent_id'=>$vo['id']))}">
<div class="myorder_bottom2_2">查看物流</div>
</a>
<div class="myorder_bottom2_2 delivery" data-id="{$vo.id}">确认收货</div>
<div class="myorder_bottom2_2 delivery">确认收货</div>
<elseif condition="$vo.state eq 3"/>
<div class="myorder_bottom2_2">去评价</div>
<!--<div class="myorder_bottom2_2">去评价</div>-->
</if>
</div>
</div>
... ... @@ -324,8 +328,9 @@
<a href="{:url('logistics/index',array('indent_id'=>$vo['id']))}">
<div class="myorder_bottom2_2">查看物流</div>
</a>
<div class="myorder_bottom2_2 delivery" data-id="{$vo.id}">确认收货</div>
<elseif condition="$vo.state eq 3"/>
<div class="myorder_bottom2_2">去评价</div>
<!--<div class="myorder_bottom2_2">去评价</div>-->
</if>
</div>
</div>
... ... @@ -400,8 +405,10 @@
<a href="{:url('logistics/index',array('indent_id'=>$vo['id']))}">
<div class="myorder_bottom2_2">查看物流</div>
</a>
<div class="myorder_bottom2_2 delivery" data-id="{$vo.id}">确认收货</div>
<div class="myorder_bottom2_2 delivery">确认收货</div>
<elseif condition="$vo.state eq 3"/>
<div class="myorder_bottom2_2">去评价</div>
<!--<div class="myorder_bottom2_2">去评价</div>-->
</if>
</div>
</div>
... ... @@ -454,6 +461,76 @@
}
})
})
$("body").on('click','.delivery',function(){
var index = $(".myor_title ul li").index($('.myor_title_active'));
var indent_id = $(this).attr('data-id');
console.log(indent_id);
$.ajax({
url:"{:url('portal/order/delivery')}",
type:"GET",
data:{"indent_id":indent_id},
success:function(res){
if(res.code == 1){
var data = res.data;
var indent_goods = "";
$(data.indent_goods).each(function(key,vo){
indent_goods += "<li>\n" +
" <div class=\"order_newsImg\">\n" +
" <img src=\""+vo.thumbnail+"\" alt=\"\"/>\n" +
" </div>\n" +
" <div class=\"order_newsCon\">\n" +
" <div class=\"order_newsTxt1 txt-cut\">\n" +
" "+vo.book_name+"\n" +
" </div>\n" +
" <div class=\"order_newsTxt2\">×<span>"+vo.number+"</span></div>\n" +
" <div class=\"order_newsTxt3\">\n" +
" <p class=\"de_topTxt1_1\">¥<span>"+vo.price+"</span></p>\n" +
" <p class=\"de_topTxt1_2\">¥<span>"+vo.pricing+"</span></p>\n" +
" </div>\n" +
" </div>\n" +
" </li>";
});
var length = data.indent_goods.length;
var html = "<div class=\"myorder_information dom_cancel_order_"+data.id+"\" >\n" +
" <!-- 订单 -->\n" +
" <a href=\"{:url('order/get_one','',false,true)}/id/"+data.id+"\">\n" +
" <div class=\"myorder_the\">\n" +
" <p class=\"order_dan\">订单号:"+data.order_number+"</p>\n" +
" <div class=\"myorder_state1\">\n" +
" 已完成\n" +
" </div>\n" +
" </div>\n" +
" <ul class=\"order_newsUl myorder_border\">"+indent_goods+"\n" +
" <div class=\"my_ordera\">\n" +
" <span>共"+length+"件商品 合计:</span>\n" +
" <p>¥"+data.money+"</p>\n" +
" </div>\n" +
" </ul>\n" +
" </a>\n" +
" <!-- 时间/底部 -->\n" +
" <div class=\"myorder_bottom\">\n" +
" <div class=\"myorder_bottom1\">\n" +
" <div class=\"myorder_bottom1Img\">\n" +
" <img src=\"__TMPL__/public/assets/images/52.png\" alt=\"\"/>\n" +
" </div>\n" +
" <p class=\"myorder_bottom1Txt\">"+data.create_time+"</p>\n" +
" </div>\n" +
" <div class=\"myorder_bottom2\">\n" +
" </div>\n" +
" </div>\n" +
" </div>";
$('.myorder_con1').eq(4).prepend(html);
$('.myorder_con1').eq(index).find('.dom_cancel_order_' + indent_id).remove();
alert('收货成功')
}else{
alert('出错啦,请稍后再试!')
}
},
error:function(){
alert('与服务器断开连接')
}
})
})
})
</script>
</body>
... ...