修改后端的物流显示模块
This commit is contained in:
parent
94dcf11fe2
commit
c1b88ef73e
@ -103,7 +103,7 @@ class Order extends AdminBase
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$detail = OrderLogic::getDetail($id);
|
||||
$detail['shipping'] = OrderLogic::shippingInfo($detail['id']);
|
||||
// $detail['shipping'] = OrderLogic::shippingInfo($detail['id']);
|
||||
return view('', [
|
||||
'detail' => $detail
|
||||
]);
|
||||
@ -128,4 +128,14 @@ class Order extends AdminBase
|
||||
}
|
||||
return JsonServer::success('', $result);
|
||||
}
|
||||
|
||||
// 查看对应商品的物流
|
||||
public function seeExpress()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$express = OrderLogic::seeExpress($id);
|
||||
return view('', [
|
||||
'express' => $express
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -24,6 +24,7 @@ namespace app\admin\logic\order;
|
||||
use app\common\basics\Logic;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\enum\ShopEnum;
|
||||
use app\common\model\Delivery;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\enum\OrderLogEnum;
|
||||
use app\common\enum\PayEnum;
|
||||
@ -235,6 +236,8 @@ class OrderLogic extends Logic
|
||||
$result['confirm_take_time'] = '';
|
||||
}
|
||||
|
||||
// 获取商品物流简略信息
|
||||
$result['express_info'] = Delivery::where(['order_id' => $id])->field('id, order_goods_id, shipping_name, invoice_no, create_time')->select()->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -505,4 +508,88 @@ class OrderLogic extends Logic
|
||||
}
|
||||
}
|
||||
|
||||
// 查看对应单号的物流
|
||||
public static function seeExpress($id)
|
||||
{
|
||||
$express_data = array();
|
||||
|
||||
$delivery = Delivery::find($id);
|
||||
if (!$delivery['invoice_no']) {
|
||||
$traces['list'] = ['物流单号为空'];
|
||||
return $traces;
|
||||
}
|
||||
|
||||
$express = ConfigServer::get('express', 'way');
|
||||
$key = ConfigServer::get($express, 'appkey');
|
||||
$app = ConfigServer::get($express, 'appsecret');
|
||||
if (empty($express) || empty($app) || empty($key)) {
|
||||
$traces['list'] = ['暂无物流信息'];
|
||||
return $traces;
|
||||
}
|
||||
|
||||
$result = Kd100Logic::expressDetail($id);
|
||||
|
||||
// 如果当前时间大于了api接口限制的时间,则调用api接口
|
||||
if (!isset($result) || (time() > $result['sel_time'])) {
|
||||
//快递配置设置为快递鸟时
|
||||
if ($express === 'kdniao') {
|
||||
$expressage = (new Kdniao($app, $key, true));
|
||||
$shipping_field = 'codebird';
|
||||
} else {
|
||||
$expressage = (new Kd100($app, $key, true));
|
||||
$shipping_field = 'code100';
|
||||
}
|
||||
|
||||
//快递编码
|
||||
$shipping_code = Db::name('express')
|
||||
->where(['id' => $delivery['shipping_id']])
|
||||
->value($shipping_field);
|
||||
|
||||
//获取物流轨迹
|
||||
if ($shipping_code === 'SF' && $express === 'kdniao') {
|
||||
$expressage->logistics($shipping_code, $delivery['invoice_no'], substr($delivery['mobile'],-4));
|
||||
}else {
|
||||
$phone = '';
|
||||
if ($shipping_code === 'shunfeng') {
|
||||
$phone = $delivery['mobile'];
|
||||
}
|
||||
$expressage->logistics($shipping_code, $delivery['invoice_no'], $phone);
|
||||
}
|
||||
|
||||
$traces = $expressage->logisticsFormat();
|
||||
$state = 0;
|
||||
if (!$traces) {
|
||||
$traces[] = [$expressage->getError()];
|
||||
} else {
|
||||
$data = $expressage->logisticsFullInfo();
|
||||
$data['delivery_id'] = $id;
|
||||
$data['order_id'] = $delivery['order_id'];
|
||||
Kd100Logic::saveExpress($data);
|
||||
$state = $data['state'];
|
||||
|
||||
foreach ($traces as &$item) {
|
||||
$item = array_values(array_unique($item));
|
||||
}
|
||||
}
|
||||
|
||||
$express_data['create_time'] = $delivery['create_time'];
|
||||
$express_data['invoice_no'] = $delivery['invoice_no'];
|
||||
$express_data['shipping_name'] = $delivery['shipping_name'];
|
||||
$express_data['state'] = $state;
|
||||
$express_data['state_text'] = Kd100Logic::$EXPRESS_STATE[$state];
|
||||
$express_data['list'] = $traces;
|
||||
} else {
|
||||
$express_data['create_time'] = $delivery['create_time'];
|
||||
$express_data['invoice_no'] = $delivery['invoice_no'];
|
||||
$express_data['shipping_name'] = $delivery['shipping_name'];
|
||||
$express_data['state'] = $result['state'];
|
||||
$express_data['state_text'] = Kd100Logic::$EXPRESS_STATE[$result['state']];
|
||||
$express_data['list'] = json_decode($result['data'], true);
|
||||
foreach ($express_data['list'] as &$item) {
|
||||
$item = array_values(array_unique($item));
|
||||
}
|
||||
}
|
||||
|
||||
return $express_data;
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,12 @@
|
||||
justify-content: left;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.width-160 {
|
||||
width: 200px;
|
||||
}
|
||||
@ -35,43 +41,12 @@
|
||||
<div class="layui-form" lay-filter="layuiadmin-form-express" id="layuiadmin-form-express" >
|
||||
<input type="hidden" name="order_id" value="{$detail.id}">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>快递信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
{empty name="$detail.shipping"}
|
||||
<div class="layui-form-item div-flex">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="width-160">暂无物流信息</div>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="layui-form-item div-flex">
|
||||
<label class="layui-form-label ">发货时间:</label>
|
||||
<div class="width-160">{$detail.shipping.create_time_text | default= "未知"}</div>
|
||||
{if condition = "$detail.shipping.send_type eq 1"}
|
||||
<label class="layui-form-label ">快递方式:</label>
|
||||
<div class="width-160">{$detail.shipping.shipping_name | default="未知"}</div>
|
||||
<label class="layui-form-label ">快递单号:</label>
|
||||
<div class="width-160">{$detail.shipping.invoice_no | default= "未知"}</div>
|
||||
<label class="layui-form-label ">物流状态:</label>
|
||||
<div class="width-160">{$detail.shipping.traces.state_text | default= "未知"}</div>
|
||||
{else/}
|
||||
<label class="layui-form-label ">配送方式:</label>
|
||||
<div class="width-160">无需快递</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/empty}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>商品信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item table-margin">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
@ -79,6 +54,7 @@
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -86,6 +62,7 @@
|
||||
<th>价格(元)</th>
|
||||
<th>数量</th>
|
||||
<th>小计(元)</th>
|
||||
<th>物流</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -106,51 +83,25 @@
|
||||
<td>¥{$goods.goods_price}</td>
|
||||
<td>{$goods.goods_num}</td>
|
||||
<td>{$goods.total_pay_price}</td>
|
||||
<td>
|
||||
{if condition="isset($detail.express_info[$k])"}
|
||||
<div class="flex">
|
||||
<div style="text-align: left;">
|
||||
<div>发货时间:{$detail.express_info[$k]['create_time']}</div>
|
||||
<div>快递方式:{$detail.express_info[$k]['shipping_name']}</div>
|
||||
<div>快递单号:{$detail.express_info[$k]['invoice_no']}</div>
|
||||
</div>
|
||||
<div>
|
||||
<input type="button" class="layui-btn layui-btn-sm layui-btn-normal width_160 see-express" data-id="{$detail.express_info[$k]['id']}" value="查看物流">
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>物流轨迹</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item table-margin">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr >
|
||||
<th colspan="3">轨迹</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $detail.shipping.traces.list as $k => $item}
|
||||
<tr>
|
||||
{if is_array($item)}
|
||||
{foreach $item as $k1 => $value}
|
||||
<td>{$value}</td>
|
||||
{/foreach}
|
||||
{else /}
|
||||
<td>{$item}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item div-flex ">
|
||||
<div class="layui-input-block ">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary width_160 " id="back">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -180,5 +131,15 @@
|
||||
parent.layui.table.reload('order-lists');
|
||||
return true;
|
||||
});
|
||||
|
||||
$(document).on('click', '.see-express', function () {
|
||||
var id = $(this).data('id');
|
||||
layer.open({
|
||||
type: 2
|
||||
,title: '选择商品'
|
||||
,content: '{:url("order.Order/seeExpress")}?id=' + id
|
||||
,area: ['90%', '90%']
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
132
app/admin/view/order/order/see_express.html
Executable file
132
app/admin/view/order/order/see_express.html
Executable file
@ -0,0 +1,132 @@
|
||||
{layout name="layout2" /}
|
||||
<style>
|
||||
.div-flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: left;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.width-160 {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.layui-table th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.table-margin {
|
||||
margin-left: 50px;
|
||||
margin-right: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.image {
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.mt50 {
|
||||
margin-left: 50px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="layui-card-body" >
|
||||
<!--基本信息-->
|
||||
<div class="layui-form" lay-filter="layuiadmin-form-express" id="layuiadmin-form-express" >
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>物流轨迹</legend>
|
||||
</fieldset>
|
||||
<div class="layui-form-item div-flex">
|
||||
<label class="layui-form-label ">发货时间:</label>
|
||||
<div class="width-160">{$express.create_time | default= "未知"}</div>
|
||||
<label class="layui-form-label ">快递方式:</label>
|
||||
<div class="width-160">{$express.shipping_name | default= "未知"}</div>
|
||||
<label class="layui-form-label ">快递单号:</label>
|
||||
<div class="width-160">{$express.invoice_no | default= "未知"}</div>
|
||||
<label class="layui-form-label ">物流状态:</label>
|
||||
<div class="width-160">{$express.state_text | default= "未知"}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item table-margin">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr >
|
||||
<th colspan="3">轨迹</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $express.list as $k => $item}
|
||||
<tr>
|
||||
{if is_array($item)}
|
||||
{foreach $item as $k1 => $value}
|
||||
<td>{$value}</td>
|
||||
{/foreach}
|
||||
{else /}
|
||||
<td>{$item}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
//注意:选项卡 依赖 element 模块,否则无法进行功能性操作
|
||||
|
||||
layui.config({
|
||||
version:"{$front_version}",
|
||||
base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'element', 'jquery', 'like', 'form'], function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form;
|
||||
var like = layui.like;
|
||||
|
||||
//主图放大
|
||||
$(document).on('click', '.image-show', function () {
|
||||
var src = $(this).attr('src');
|
||||
like.showImg(src,600);
|
||||
});
|
||||
|
||||
$('#back').click(function () {
|
||||
var index=parent.layer.getFrameIndex(window.name); //获取当前窗口的name
|
||||
parent.layer.close(index);
|
||||
parent.layui.table.reload('order-lists');
|
||||
return true;
|
||||
});
|
||||
|
||||
$(document).on('click', '.see-express', function () {
|
||||
var id = $(this).data('id');
|
||||
layer.open({
|
||||
type: 2
|
||||
,title: '选择商品'
|
||||
,content: '{:url("order.Order/seeExpress")}?id=' + id
|
||||
,area: ['90%', '90%']
|
||||
,btn: ['确认', '取消']
|
||||
,yes: function(index, layero){
|
||||
// var data = window["layui-layer-iframe" + index].callbackdata();
|
||||
// $('#shop_name').html(data[0].name)
|
||||
// $('#shop_id').val(data[0].id)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@ -21,28 +21,57 @@ class Kd100Logic extends Logic
|
||||
/*
|
||||
* 添加或更新快递信息
|
||||
* */
|
||||
public static function save($order_id, $data)
|
||||
// public static function save($order_id, $data)
|
||||
// {
|
||||
// $express['order_id'] = $order_id;
|
||||
// $express['delivery_id'] = $data['delivery_id'];
|
||||
// $express['state'] = $data['state'];
|
||||
// $express['com'] = $data['com'];
|
||||
// $express['nu'] = $data['nu'];
|
||||
// $express['data'] = json_encode($data['data'], JSON_UNESCAPED_UNICODE);
|
||||
// $express['sel_time'] = time() + self::$SEL_TIME;
|
||||
//
|
||||
// $kd100 = self::detail($order_id);
|
||||
// if ($kd100) {
|
||||
// Kd100Expressage::where(['order_id' => $order_id])->update($express);
|
||||
// } else {
|
||||
// Kd100Expressage::create($express);
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
* 获取物流详情
|
||||
* */
|
||||
// public static function detail($order_id)
|
||||
// {
|
||||
// return Kd100Expressage::where(['order_id' => $order_id])->find();
|
||||
// }
|
||||
|
||||
/*
|
||||
* 获取物流详情 物流模块改版后新的获取物流方式
|
||||
* */
|
||||
public static function expressDetail($delivery_id)
|
||||
{
|
||||
$express['order_id'] = $order_id;
|
||||
return Kd100Expressage::where(['delivery_id' => $delivery_id])->find();
|
||||
}
|
||||
|
||||
/*
|
||||
* 添加或更新快递信息 物流模块改版后新的添加或更新快递信息
|
||||
* */
|
||||
public static function saveExpress($data)
|
||||
{
|
||||
$express['order_id'] = $data['order_id'];
|
||||
$express['delivery_id'] = $data['delivery_id'];
|
||||
$express['state'] = $data['state'];
|
||||
$express['com'] = $data['com'];
|
||||
$express['nu'] = $data['nu'];
|
||||
$express['data'] = json_encode($data['data'], JSON_UNESCAPED_UNICODE);
|
||||
$express['sel_time'] = time() + self::$SEL_TIME;
|
||||
|
||||
$kd100 = self::detail($order_id);
|
||||
$kd100 = self::expressDetail($data['delivery_id']);
|
||||
if ($kd100) {
|
||||
Kd100Expressage::where(['order_id' => $order_id])->update($express);
|
||||
Kd100Expressage::where(['delivery_id' => $data['delivery_id']])->update($express);
|
||||
} else {
|
||||
Kd100Expressage::create($express);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取物流详情
|
||||
* */
|
||||
public static function detail($order_id)
|
||||
{
|
||||
return Kd100Expressage::where(['order_id' => $order_id])->find();
|
||||
}
|
||||
}
|
||||
@ -114,7 +114,7 @@ class Order extends ShopBase
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$detail = OrderLogic::getDetail($id);
|
||||
$detail['shipping'] = OrderLogic::shippingInfo($detail['id']);
|
||||
// $detail['shipping'] = OrderLogic::shippingInfo($detail['id']);
|
||||
return view('', [
|
||||
'detail' => $detail
|
||||
]);
|
||||
@ -361,4 +361,14 @@ class Order extends ShopBase
|
||||
return JsonServer::error('操作失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 查看对应商品的物流
|
||||
public function seeExpress()
|
||||
{
|
||||
$id = $this->request->get('id');
|
||||
$express = OrderLogic::seeExpress($id);
|
||||
return view('', [
|
||||
'express' => $express
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -31,9 +31,11 @@ use app\common\enum\VerificationEnum;
|
||||
use app\common\logic\GoodsVirtualLogic;
|
||||
use app\common\logic\OrderLogLogic;
|
||||
use app\common\logic\OrderRefundLogic;
|
||||
use app\common\model\Delivery;
|
||||
use app\common\model\Express;
|
||||
use app\common\model\order\Order;
|
||||
use app\common\model\DevRegion;
|
||||
use app\common\model\order\OrderGoods;
|
||||
use app\common\model\printer\Printer;
|
||||
use app\common\model\printer\PrinterConfig;
|
||||
use app\common\model\team\Team;
|
||||
@ -259,7 +261,6 @@ class OrderLogic extends Logic
|
||||
*/
|
||||
public static function getDetail($id)
|
||||
{
|
||||
|
||||
$order = new Order();
|
||||
$result = $order
|
||||
->with(['user', 'order_goods', 'invoice'])
|
||||
@ -293,6 +294,8 @@ class OrderLogic extends Logic
|
||||
$result['confirm_take_time'] = '';
|
||||
}
|
||||
|
||||
// 获取商品物流简略信息
|
||||
$result['express_info'] = Delivery::where(['order_id' => $id])->field('id, order_goods_id, shipping_name, invoice_no, create_time')->select()->toArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -308,13 +311,11 @@ class OrderLogic extends Logic
|
||||
*/
|
||||
public static function shippingInfo($order_id)
|
||||
{
|
||||
|
||||
$shipping = Db::name('delivery')->where('order_id', $order_id)->find();
|
||||
if ($shipping) {
|
||||
$shipping['create_time_text'] = date('Y-m-d H:i:s', $shipping['create_time']);
|
||||
}
|
||||
$shipping['traces'] = self::getShipping($order_id);
|
||||
|
||||
// $shipping['traces'] = self::getShipping($order_id);
|
||||
return $shipping;
|
||||
}
|
||||
|
||||
@ -327,10 +328,10 @@ class OrderLogic extends Logic
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author suny
|
||||
* @date 2021/7/14 10:24 上午
|
||||
* note 2024-08-17 11:24 物流模块被修改该功能暂时不用 搁置
|
||||
*/
|
||||
public static function getShipping($order_id)
|
||||
{
|
||||
|
||||
$express_data = array();
|
||||
|
||||
$orderModel = new Order();
|
||||
@ -436,73 +437,156 @@ class OrderLogic extends Logic
|
||||
*/
|
||||
public static function deliveryHandle($data, $admin_id)
|
||||
{
|
||||
|
||||
$order_id = $data['order_id'];
|
||||
$order = Order::where(['del' => 0, 'id' => $order_id])->find();
|
||||
|
||||
$order_goods = OrderGoods::where(['order_id' => $order_id])->field('id')->select()->toArray();
|
||||
if ($order['shipping_status'] == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$shipping = Db::name('express')->where('id', $data['shipping_id'])->find();
|
||||
$count = count($data['send_type']);
|
||||
|
||||
//添加发货单
|
||||
$delivery_data = [
|
||||
'order_id' => $order_id,
|
||||
'order_sn' => $order['order_sn'],
|
||||
'user_id' => $order['user_id'],
|
||||
'admin_id' => $admin_id,
|
||||
'consignee' => $order['consignee'],
|
||||
'mobile' => $order['mobile'],
|
||||
'province' => $order['province'],
|
||||
'city' => $order['city'],
|
||||
'district' => $order['district'],
|
||||
'address' => $order['address'],
|
||||
'invoice_no' => $data['invoice_no'],
|
||||
'send_type' => $data['send_type'],
|
||||
'create_time' => time(),
|
||||
];
|
||||
//配送方式->快递配送
|
||||
if ($data['send_type'] == 1) {
|
||||
$delivery_data['shipping_id'] = $data['shipping_id'];
|
||||
$delivery_data['shipping_name'] = $shipping['name'];
|
||||
$delivery_data['shipping_status'] = 1;
|
||||
}
|
||||
$delivery_id = Db::name('delivery')->insertGetId($delivery_data);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$shipping = Db::name('express')->where('id', $data['shipping_id'][$i])->find();
|
||||
|
||||
|
||||
//更新订单下商品的发货状态
|
||||
$order->update_time = time();
|
||||
$order->shipping_time = time();
|
||||
$order->shipping_status = 1;
|
||||
$order->order_status = Order::STATUS_WAIT_RECEIVE;
|
||||
$order->delivery_id = $delivery_id;
|
||||
$order->save();
|
||||
|
||||
//订单日志
|
||||
OrderLogLogic::record(
|
||||
OrderLogEnum::TYPE_SHOP,
|
||||
OrderLogEnum::SHOP_DELIVERY_ORDER,
|
||||
$order_id,
|
||||
$admin_id,
|
||||
OrderLogEnum::SHOP_DELIVERY_ORDER
|
||||
);
|
||||
|
||||
//通知用户发货
|
||||
if (!empty($order['mobile'])) {
|
||||
event('Notice', [
|
||||
'scene' => NoticeEnum::ORDER_DELIVERY_NOTICE,
|
||||
$delivery_data = [
|
||||
'order_id' => $order_id,
|
||||
'order_sn' => $order['order_sn'],
|
||||
'order_goods_id' => $order_goods[$i]['id'],
|
||||
'user_id' => $order['user_id'],
|
||||
'admin_id' => $admin_id,
|
||||
'consignee' => $order['consignee'],
|
||||
'mobile' => $order['mobile'],
|
||||
'params' => [
|
||||
'order_id' => $order['id'],
|
||||
'user_id' => $order['user_id'],
|
||||
'shipping_name' => $delivery_data['shipping_name'] ?? '无需快递',
|
||||
'invoice_no' => $data['invoice_no'] ?? '',
|
||||
]
|
||||
]);
|
||||
'province' => $order['province'],
|
||||
'city' => $order['city'],
|
||||
'district' => $order['district'],
|
||||
'address' => $order['address'],
|
||||
'invoice_no' => $data['invoice_no'][$i],
|
||||
'send_type' => $data['send_type'][$i],
|
||||
'create_time' => time(),
|
||||
];
|
||||
|
||||
//配送方式->快递配送
|
||||
if ($data['send_type'][$i] == 1) {
|
||||
$delivery_data['shipping_id'] = $data['shipping_id'][$i];
|
||||
$delivery_data['shipping_name'] = $shipping['name'];
|
||||
$delivery_data['shipping_status'] = 1;
|
||||
}
|
||||
|
||||
$delivery_id = Db::name('delivery')->insertGetId($delivery_data);
|
||||
|
||||
$order->update_time = time();
|
||||
$order->shipping_time = time();
|
||||
$order->shipping_status = 1;
|
||||
$order->order_status = Order::STATUS_WAIT_RECEIVE;
|
||||
$order->delivery_id = $delivery_id;
|
||||
$order->save();
|
||||
|
||||
//订单日志
|
||||
OrderLogLogic::record(
|
||||
OrderLogEnum::TYPE_SHOP,
|
||||
OrderLogEnum::SHOP_DELIVERY_ORDER,
|
||||
$order_id,
|
||||
$admin_id,
|
||||
OrderLogEnum::SHOP_DELIVERY_ORDER
|
||||
);
|
||||
|
||||
//通知用户发货
|
||||
if ($data['invoice_no'][$i] && !empty($order['mobile'])) {
|
||||
event('Notice', [
|
||||
'scene' => NoticeEnum::ORDER_DELIVERY_NOTICE,
|
||||
'mobile' => $order['mobile'],
|
||||
'params' => [
|
||||
'user_id' => $order['user_id'],
|
||||
'nickname' => $order['consignee'],
|
||||
'order_sn' => $data['invoice_no'] ?? '',
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 发货操作
|
||||
* @param $data
|
||||
* @param $admin_id
|
||||
* @return bool
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
* @author suny
|
||||
* @date 2021/7/14 10:24 上午
|
||||
*/
|
||||
// 原本的快递发货
|
||||
// public static function deliveryHandle($data, $admin_id)
|
||||
// {
|
||||
// $order_id = $data['order_id'];
|
||||
// $order = Order::where(['del' => 0, 'id' => $order_id])->find();
|
||||
//
|
||||
// if ($order['shipping_status'] == 1) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// $shipping = Db::name('express')->where('id', $data['shipping_id'])->find();
|
||||
//
|
||||
// //添加发货单
|
||||
// $delivery_data = [
|
||||
// 'order_id' => $order_id,
|
||||
// 'order_sn' => $order['order_sn'],
|
||||
// 'user_id' => $order['user_id'],
|
||||
// 'admin_id' => $admin_id,
|
||||
// 'consignee' => $order['consignee'],
|
||||
// 'mobile' => $order['mobile'],
|
||||
// 'province' => $order['province'],
|
||||
// 'city' => $order['city'],
|
||||
// 'district' => $order['district'],
|
||||
// 'address' => $order['address'],
|
||||
// 'invoice_no' => $data['invoice_no'],
|
||||
// 'send_type' => $data['send_type'],
|
||||
// 'create_time' => time(),
|
||||
// ];
|
||||
// //配送方式->快递配送
|
||||
// if ($data['send_type'] == 1) {
|
||||
// $delivery_data['shipping_id'] = $data['shipping_id'];
|
||||
// $delivery_data['shipping_name'] = $shipping['name'];
|
||||
// $delivery_data['shipping_status'] = 1;
|
||||
// }
|
||||
// $delivery_id = Db::name('delivery')->insertGetId($delivery_data);
|
||||
//
|
||||
//
|
||||
// //更新订单下商品的发货状态
|
||||
// $order->update_time = time();
|
||||
// $order->shipping_time = time();
|
||||
// $order->shipping_status = 1;
|
||||
// $order->order_status = Order::STATUS_WAIT_RECEIVE;
|
||||
// $order->delivery_id = $delivery_id;
|
||||
// $order->save();
|
||||
//
|
||||
// //订单日志
|
||||
// OrderLogLogic::record(
|
||||
// OrderLogEnum::TYPE_SHOP,
|
||||
// OrderLogEnum::SHOP_DELIVERY_ORDER,
|
||||
// $order_id,
|
||||
// $admin_id,
|
||||
// OrderLogEnum::SHOP_DELIVERY_ORDER
|
||||
// );
|
||||
//
|
||||
// //通知用户发货
|
||||
// if (!empty($order['mobile'])) {
|
||||
// event('Notice', [
|
||||
// 'scene' => NoticeEnum::ORDER_DELIVERY_NOTICE,
|
||||
// 'mobile' => $order['mobile'],
|
||||
// 'params' => [
|
||||
// 'order_id' => $order['id'],
|
||||
// 'user_id' => $order['user_id'],
|
||||
// 'shipping_name' => $delivery_data['shipping_name'] ?? '无需快递',
|
||||
// 'invoice_no' => $data['invoice_no'] ?? '',
|
||||
// ]
|
||||
// ]);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @notes 判断是否可以发货
|
||||
* @param $post
|
||||
@ -1100,4 +1184,89 @@ class OrderLogic extends Logic
|
||||
|
||||
return Order::where('id', $params['id'])->update(['allow_after_sale' => $type, 'update_time' => time()]);
|
||||
}
|
||||
|
||||
// 查看对应单号的物流
|
||||
public static function seeExpress($id)
|
||||
{
|
||||
$express_data = array();
|
||||
|
||||
$delivery = Delivery::find($id);
|
||||
if (!$delivery['invoice_no']) {
|
||||
$traces['list'] = ['物流单号为空'];
|
||||
return $traces;
|
||||
}
|
||||
|
||||
$express = ConfigServer::get('express', 'way');
|
||||
$key = ConfigServer::get($express, 'appkey');
|
||||
$app = ConfigServer::get($express, 'appsecret');
|
||||
if (empty($express) || empty($app) || empty($key)) {
|
||||
$traces['list'] = ['暂无物流信息'];
|
||||
return $traces;
|
||||
}
|
||||
|
||||
$result = Kd100Logic::expressDetail($id);
|
||||
|
||||
// 如果当前时间大于了api接口限制的时间,则调用api接口
|
||||
if (!isset($result) || (time() > $result['sel_time'])) {
|
||||
//快递配置设置为快递鸟时
|
||||
if ($express === 'kdniao') {
|
||||
$expressage = (new Kdniao($app, $key, true));
|
||||
$shipping_field = 'codebird';
|
||||
} else {
|
||||
$expressage = (new Kd100($app, $key, true));
|
||||
$shipping_field = 'code100';
|
||||
}
|
||||
|
||||
//快递编码
|
||||
$shipping_code = Db::name('express')
|
||||
->where(['id' => $delivery['shipping_id']])
|
||||
->value($shipping_field);
|
||||
|
||||
//获取物流轨迹
|
||||
if ($shipping_code === 'SF' && $express === 'kdniao') {
|
||||
$expressage->logistics($shipping_code, $delivery['invoice_no'], substr($delivery['mobile'],-4));
|
||||
}else {
|
||||
$phone = '';
|
||||
if ($shipping_code === 'shunfeng') {
|
||||
$phone = $delivery['mobile'];
|
||||
}
|
||||
$expressage->logistics($shipping_code, $delivery['invoice_no'], $phone);
|
||||
}
|
||||
|
||||
$traces = $expressage->logisticsFormat();
|
||||
$state = 0;
|
||||
if (!$traces) {
|
||||
$traces[] = [$expressage->getError()];
|
||||
} else {
|
||||
$data = $expressage->logisticsFullInfo();
|
||||
$data['delivery_id'] = $id;
|
||||
$data['order_id'] = $delivery['order_id'];
|
||||
Kd100Logic::saveExpress($data);
|
||||
$state = $data['state'];
|
||||
|
||||
foreach ($traces as &$item) {
|
||||
$item = array_values(array_unique($item));
|
||||
}
|
||||
}
|
||||
|
||||
$express_data['create_time'] = $delivery['create_time'];
|
||||
$express_data['invoice_no'] = $delivery['invoice_no'];
|
||||
$express_data['shipping_name'] = $delivery['shipping_name'];
|
||||
$express_data['state'] = $state;
|
||||
$express_data['state_text'] = Kd100Logic::$EXPRESS_STATE[$state];
|
||||
$express_data['list'] = $traces;
|
||||
} else {
|
||||
$express_data['create_time'] = $delivery['create_time'];
|
||||
$express_data['invoice_no'] = $delivery['invoice_no'];
|
||||
$express_data['shipping_name'] = $delivery['shipping_name'];
|
||||
$express_data['state'] = $result['state'];
|
||||
$express_data['state_text'] = Kd100Logic::$EXPRESS_STATE[$result['state']];
|
||||
$express_data['list'] = json_decode($result['data'], true);
|
||||
foreach ($express_data['list'] as &$item) {
|
||||
$item = array_values(array_unique($item));
|
||||
}
|
||||
}
|
||||
|
||||
return $express_data;
|
||||
}
|
||||
}
|
||||
@ -31,9 +31,9 @@
|
||||
|
||||
</style>
|
||||
|
||||
<div class="layui-card-body" >
|
||||
<div class="layui-card-body">
|
||||
<!--基本信息-->
|
||||
<div lay-filter="layuiadmin-form-express" id="layuiadmin-form-express" >
|
||||
<div lay-filter="layuiadmin-form-express" id="layuiadmin-form-express">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>收货信息</legend>
|
||||
@ -57,116 +57,164 @@
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item table-margin">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="250">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商品信息</th>
|
||||
<th>价格(元)</th>
|
||||
<th>数量</th>
|
||||
<th>小计(元)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $detail.order_goods as $k => $goods}
|
||||
<tr>
|
||||
<td>
|
||||
<div style="text-align: left">
|
||||
<div class="layui-col-md3">
|
||||
<img src="{$goods.goods_image}" class="image-show image">
|
||||
<div class="layui-form">
|
||||
<input type="hidden" name="order_id" value="{$detail.id}">
|
||||
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col width="250">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
{neq name="$detail.delivery_type" value="1"}
|
||||
<col width="100">
|
||||
{/neq}
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>商品信息</th>
|
||||
<th>价格(元)</th>
|
||||
<th>数量</th>
|
||||
<th>小计(元)</th>
|
||||
{neq name="$detail.delivery_type" value="1"}
|
||||
<th>物流</th>
|
||||
{/neq}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $detail.order_goods as $k => $goods}
|
||||
<tr>
|
||||
<td>
|
||||
<div style="text-align: left">
|
||||
<div class="layui-col-md3">
|
||||
<img src="{$goods.goods_image}" class="image-show image">
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<p style="margin-top: 10px">{$goods.goods_name}</p>
|
||||
<br>
|
||||
<p>{$goods.spec_value}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<p style="margin-top: 10px">{$goods.goods_name}</p>
|
||||
<br>
|
||||
<p>{$goods.spec_value}</p>
|
||||
</td>
|
||||
<td>¥{$goods.goods_price}</td>
|
||||
<td>{$goods.goods_num}</td>
|
||||
<td>¥{$goods.total_pay_price}</td>
|
||||
{neq name="$detail.delivery_type" value="1"}
|
||||
<td>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">配送方式:</label>
|
||||
<div class="layui-input-inline" style="text-align: left">
|
||||
<select name="send_type[]" lay-filter="need_express[]">
|
||||
<option value="1">快递配送</option>
|
||||
<option value="2">无需快递</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>¥{$goods.goods_price}</td>
|
||||
<td>{$goods.goods_num}</td>
|
||||
<td>¥{$goods.total_pay_price}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="layui-form-item div-flex select-express">
|
||||
<label class="layui-form-label ">选择快递:</label>
|
||||
<div class="layui-input-inline" style="text-align: left">
|
||||
<select name="shipping_id[]" lay-verify="required">
|
||||
{foreach $express as $k => $v}
|
||||
<option value="{$v.id}">{$v.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item div-flex select-express">
|
||||
<label class="layui-form-label ">快递单号:</label>
|
||||
<div>
|
||||
<input type="text" name="invoice_no[]" placeholder="请输入快递单号"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{/neq}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="layui-form-item" style="text-align: right">
|
||||
<div class="layui-input-block ">
|
||||
<input type="button" class="layui-btn layui-btn-sm layui-btn-normal width_160" lay-submit
|
||||
lay-filter="send" id="send" value="发货">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary width_160 back">返回
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{eq name="$detail.delivery_type" value="1"}
|
||||
<!--虚拟发货-->
|
||||
<div class="layui-form">
|
||||
<input type="hidden" name="order_id" value="{$detail.id}">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>商品发货</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<!--虚拟发货-->
|
||||
<div class="layui-form">
|
||||
<input type="hidden" name="order_id" value="{$detail.id}">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>商品发货</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">发货内容:</label>
|
||||
<div class="layui-input-inline" style="width: 50%">
|
||||
<textarea class="layui-textarea" name="delivery_content" rows="10">{$detail.delivery_content | default = ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item div-flex ">
|
||||
<div class="layui-input-block ">
|
||||
<input type="button" class="layui-btn layui-btn-sm layui-btn-normal width_160" lay-submit lay-filter="virtual" id="virtual" value="发货">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary width_160 back">返回</button>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">发货内容:</label>
|
||||
<div class="layui-input-inline" style="width: 50%">
|
||||
<textarea class="layui-textarea" name="delivery_content" rows="10">{$detail.delivery_content | default = ''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item div-flex ">
|
||||
<div class="layui-input-block ">
|
||||
<input type="button" class="layui-btn layui-btn-sm layui-btn-normal width_160" lay-submit
|
||||
lay-filter="virtual" id="virtual" value="发货">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary width_160 back">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else/}
|
||||
<!--实物发货-->
|
||||
<div class="layui-form">
|
||||
<input type="hidden" name="order_id" value="{$detail.id}">
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>快递配送</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
<!--实物发货-->
|
||||
<!-- <div class="layui-form">-->
|
||||
<!-- <input type="hidden" name="order_id" value="{$detail.id}">-->
|
||||
<!-- <div class="layui-form-item">-->
|
||||
<!-- <fieldset class="layui-elem-field layui-field-title">-->
|
||||
<!-- <legend>快递配送</legend>-->
|
||||
<!-- </fieldset>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item div-flex">
|
||||
<label class="layui-form-label ">配送方式:</label>
|
||||
<div>
|
||||
<input type="radio" name="send_type" lay-filter="express" value="1" title="快递配送" checked>
|
||||
<input type="radio" name="send_type" lay-filter="express" value="2" title="无需快递">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item div-flex">-->
|
||||
<!-- <label class="layui-form-label ">配送方式:</label>-->
|
||||
<!-- <div>-->
|
||||
<!-- <input type="radio" name="send_type" lay-filter="express" value="1" title="快递配送" checked>-->
|
||||
<!-- <input type="radio" name="send_type" lay-filter="express" value="2" title="无需快递">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item div-flex select-express">
|
||||
<label class="layui-form-label ">选择快递:</label>
|
||||
<div>
|
||||
<select name="shipping_id" lay-verify="required">
|
||||
{foreach $express as $k => $v}
|
||||
<option value="{$v.id}">{$v.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item div-flex select-express">-->
|
||||
<!-- <label class="layui-form-label ">选择快递:</label>-->
|
||||
<!-- <div>-->
|
||||
<!-- <select name="shipping_id" lay-verify="required">-->
|
||||
<!-- {foreach $express as $k => $v}-->
|
||||
<!-- <option value="{$v.id}">{$v.name}</option>-->
|
||||
<!-- {/foreach}-->
|
||||
<!-- </select>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item div-flex select-express" >
|
||||
<label class="layui-form-label ">快递单号:</label>
|
||||
<div>
|
||||
<input type="text" name="invoice_no" placeholder="请输入快递单号" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item div-flex select-express" >-->
|
||||
<!-- <label class="layui-form-label ">快递单号:</label>-->
|
||||
<!-- <div>-->
|
||||
<!-- <input type="text" name="invoice_no" placeholder="请输入快递单号" autocomplete="off" class="layui-input">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="layui-form-item div-flex ">
|
||||
<div class="layui-input-block ">
|
||||
<input type="button" class="layui-btn layui-btn-sm layui-btn-normal width_160" lay-submit lay-filter="send" id="send" value="发货">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary width_160 back" >返回</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="layui-form-item div-flex ">-->
|
||||
<!-- <div class="layui-input-block ">-->
|
||||
<!-- <input type="button" class="layui-btn layui-btn-sm layui-btn-normal width_160" lay-submit lay-filter="send" id="send" value="发货">-->
|
||||
<!-- <button type="button" class="layui-btn layui-btn-sm layui-btn-primary width_160 back" >返回</button>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
{/eq}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -175,7 +223,7 @@
|
||||
//注意:选项卡 依赖 element 模块,否则无法进行功能性操作
|
||||
|
||||
layui.config({
|
||||
version:"{$front_version}",
|
||||
version: "{$front_version}",
|
||||
base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
@ -187,9 +235,18 @@
|
||||
//主图放大
|
||||
$(document).on('click', '.image-show', function () {
|
||||
var src = $(this).attr('src');
|
||||
like.showImg(src,600);
|
||||
like.showImg(src, 600);
|
||||
});
|
||||
|
||||
form.on('select(send_type[])', function (data) {
|
||||
if (data.value == 2) {
|
||||
data.othis.parent().parent().next()[0].style.display = 'none'
|
||||
data.othis.parent().parent().next().next()[0].style.display = 'none'
|
||||
} else {
|
||||
data.othis.parent().parent().next()[0].style.display = 'block'
|
||||
data.othis.parent().parent().next().next()[0].style.display = 'flex'
|
||||
}
|
||||
})
|
||||
|
||||
form.on('radio(express)', function (data) {
|
||||
var checked = data.value;
|
||||
@ -201,7 +258,7 @@
|
||||
});
|
||||
|
||||
$('.back').click(function () {
|
||||
var index=parent.layer.getFrameIndex(window.name); //获取当前窗口的name
|
||||
var index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
|
||||
parent.layer.close(index);
|
||||
parent.layui.table.reload('order-lists');
|
||||
return true;
|
||||
@ -247,7 +304,7 @@
|
||||
offset: '15px'
|
||||
, icon: 1
|
||||
, time: 1000
|
||||
},function () {
|
||||
}, function () {
|
||||
var index = parent.layer.getFrameIndex(window.name);
|
||||
parent.location.reload();
|
||||
parent.updateTabNumber();
|
||||
|
||||
@ -6,6 +6,12 @@
|
||||
justify-content: left;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.width-160 {
|
||||
width: 200px;
|
||||
}
|
||||
@ -35,43 +41,12 @@
|
||||
<div class="layui-form" lay-filter="layuiadmin-form-express" id="layuiadmin-form-express" >
|
||||
<input type="hidden" name="order_id" value="{$detail.id}">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>快递信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
{empty name="$detail.shipping"}
|
||||
<div class="layui-form-item div-flex">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="width-160">暂无物流信息</div>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="layui-form-item div-flex">
|
||||
<label class="layui-form-label ">发货时间:</label>
|
||||
<div class="width-160">{$detail.shipping.create_time_text | default= "未知"}</div>
|
||||
{if condition = "$detail.shipping.send_type eq 1"}
|
||||
<label class="layui-form-label ">快递方式:</label>
|
||||
<div class="width-160">{$detail.shipping.shipping_name | default="未知"}</div>
|
||||
<label class="layui-form-label ">快递单号:</label>
|
||||
<div class="width-160">{$detail.shipping.invoice_no | default= "未知"}</div>
|
||||
<label class="layui-form-label ">物流状态:</label>
|
||||
<div class="width-160">{$detail.shipping.traces.state_text | default= "未知"}</div>
|
||||
{else/}
|
||||
<label class="layui-form-label ">配送方式:</label>
|
||||
<div class="width-160">无需快递</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/empty}
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>商品信息</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item table-margin">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
@ -79,6 +54,7 @@
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
<col width="200">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -86,6 +62,7 @@
|
||||
<th>价格(元)</th>
|
||||
<th>数量</th>
|
||||
<th>小计(元)</th>
|
||||
<th>物流</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -106,46 +83,26 @@
|
||||
<td>¥{$goods.goods_price}</td>
|
||||
<td>{$goods.goods_num}</td>
|
||||
<td>{$goods.total_pay_price}</td>
|
||||
<td>
|
||||
{if condition="isset($detail.express_info[$k])"}
|
||||
<div class="flex">
|
||||
<div style="text-align: left;">
|
||||
<div>发货时间:{$detail.express_info[$k]['create_time']}</div>
|
||||
<div>快递方式:{$detail.express_info[$k]['shipping_name']}</div>
|
||||
<div>快递单号:{$detail.express_info[$k]['invoice_no']}</div>
|
||||
</div>
|
||||
<div>
|
||||
<input type="button" class="layui-btn layui-btn-sm layui-btn-normal width_160 see-express" data-id="{$detail.express_info[$k]['id']}" value="查看物流">
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>物流轨迹</legend>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item table-margin">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr >
|
||||
<th colspan="3">轨迹</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $detail.shipping.traces.list as $k => $item}
|
||||
<tr>
|
||||
{if is_array($item)}
|
||||
{foreach $item as $k1 => $value}
|
||||
<td>{$value}</td>
|
||||
{/foreach}
|
||||
{else /}
|
||||
<td>{$item}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item div-flex ">
|
||||
<div class="layui-input-block ">
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-primary width_160 " id="back">返回</button>
|
||||
@ -180,5 +137,15 @@
|
||||
parent.layui.table.reload('order-lists');
|
||||
return true;
|
||||
});
|
||||
|
||||
$(document).on('click', '.see-express', function () {
|
||||
var id = $(this).data('id');
|
||||
layer.open({
|
||||
type: 2
|
||||
,title: '选择商品'
|
||||
,content: '{:url("order.Order/seeExpress")}?id=' + id
|
||||
,area: ['90%', '90%']
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
132
app/shop/view/order/order/see_express.html
Executable file
132
app/shop/view/order/order/see_express.html
Executable file
@ -0,0 +1,132 @@
|
||||
{layout name="layout2" /}
|
||||
<style>
|
||||
.div-flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: left;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.width-160 {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.layui-table th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.table-margin {
|
||||
margin-left: 50px;
|
||||
margin-right: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.image {
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.mt50 {
|
||||
margin-left: 50px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="layui-card-body" >
|
||||
<!--基本信息-->
|
||||
<div class="layui-form" lay-filter="layuiadmin-form-express" id="layuiadmin-form-express" >
|
||||
|
||||
<div class="layui-form-item">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>物流轨迹</legend>
|
||||
</fieldset>
|
||||
<div class="layui-form-item div-flex">
|
||||
<label class="layui-form-label ">发货时间:</label>
|
||||
<div class="width-160">{$express.create_time | default= "未知"}</div>
|
||||
<label class="layui-form-label ">快递方式:</label>
|
||||
<div class="width-160">{$express.shipping_name | default= "未知"}</div>
|
||||
<label class="layui-form-label ">快递单号:</label>
|
||||
<div class="width-160">{$express.invoice_no | default= "未知"}</div>
|
||||
<label class="layui-form-label ">物流状态:</label>
|
||||
<div class="width-160">{$express.state_text | default= "未知"}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item table-margin">
|
||||
<table class="layui-table">
|
||||
<colgroup>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr >
|
||||
<th colspan="3">轨迹</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $express.list as $k => $item}
|
||||
<tr>
|
||||
{if is_array($item)}
|
||||
{foreach $item as $k1 => $value}
|
||||
<td>{$value}</td>
|
||||
{/foreach}
|
||||
{else /}
|
||||
<td>{$item}</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
//注意:选项卡 依赖 element 模块,否则无法进行功能性操作
|
||||
|
||||
layui.config({
|
||||
version:"{$front_version}",
|
||||
base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'element', 'jquery', 'like', 'form'], function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form;
|
||||
var like = layui.like;
|
||||
|
||||
//主图放大
|
||||
$(document).on('click', '.image-show', function () {
|
||||
var src = $(this).attr('src');
|
||||
like.showImg(src,600);
|
||||
});
|
||||
|
||||
$('#back').click(function () {
|
||||
var index=parent.layer.getFrameIndex(window.name); //获取当前窗口的name
|
||||
parent.layer.close(index);
|
||||
parent.layui.table.reload('order-lists');
|
||||
return true;
|
||||
});
|
||||
|
||||
$(document).on('click', '.see-express', function () {
|
||||
var id = $(this).data('id');
|
||||
layer.open({
|
||||
type: 2
|
||||
,title: '选择商品'
|
||||
,content: '{:url("order.Order/seeExpress")}?id=' + id
|
||||
,area: ['90%', '90%']
|
||||
,btn: ['确认', '取消']
|
||||
,yes: function(index, layero){
|
||||
// var data = window["layui-layer-iframe" + index].callbackdata();
|
||||
// $('#shop_name').html(data[0].name)
|
||||
// $('#shop_id').val(data[0].id)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user