diff --git a/backend/modules/shop/controllers/OrderController.php b/backend/modules/shop/controllers/OrderController.php
index 21dbe80..69d1b45 100755
--- a/backend/modules/shop/controllers/OrderController.php
+++ b/backend/modules/shop/controllers/OrderController.php
@@ -172,7 +172,6 @@ class OrderController extends Controller
/*获取发货商品信息(包括已发货和未发货)*/
$deliveryGoods = DeliveryManager::deliveryGoodsInfo($id);
-
return $this->render('delivery', [
'order' => $order,
'delivery' => $delivery,
diff --git a/backend/modules/shop/logic/delivery/DeliveryManager.php b/backend/modules/shop/logic/delivery/DeliveryManager.php
index f8ab2f4..61cd417 100644
--- a/backend/modules/shop/logic/delivery/DeliveryManager.php
+++ b/backend/modules/shop/logic/delivery/DeliveryManager.php
@@ -107,12 +107,11 @@ class DeliveryManager
return ['unShipped' => $unShippedGoods];
}
+ $filter = [];
$deliveryIds = [];
foreach ($delivery as $value) {
$deliveryIds[] = $value->id;
}
-
- $filter = [];
$deliveryGoods = DeliveryGoods::find()->where(['delivery_id' => $deliveryIds])->all();
for ($i = 0; $i < count($deliveryGoods); $i++) {
$orderGoodsId = $deliveryGoods[$i]['order_goods_id'];
@@ -120,7 +119,7 @@ class DeliveryManager
$filter[$orderGoodsId] = $deliveryGoods[$i]['goods_count'];
for ($j = 0; $j < count($deliveryGoods); $j++) {
//如果发货商品中有其他相同orderGoods的商品
- if ($orderGoodsId == $deliveryGoods[$j]['order_goods_id'] && $i !== $j) {
+ if ($orderGoodsId == $deliveryGoods[$j]['order_goods_id'] && $i != $j) {
//商品数量叠加起来并保存
$filter[$orderGoodsId] += $deliveryGoods[$j]['goods_count'];
}
@@ -154,14 +153,12 @@ class DeliveryManager
$shipped = [];
$delivery = Delivery::findAll(['order_id' => $order_id]);
foreach ($delivery as $k => $value) {
-// $expressTemplate = ExpressTemplate::find()
-// ->select('name')
-// ->where(['id' => $value->shipping_id])
-// ->one();
-// $deliveryInfo[$k]['logisticInfo'] = [
-// 'exp_name'=> $expressTemplate ? $expressTemplate->name : '',
-// 'invoice_no'=> $value->invoice_no
-// ]; //物流公司和运单号
+
+ $shipped[$k]['logisticInfo'] = [
+ 'exp_name' => '',
+ 'invoice_no' => '',
+ 'created_at' => '',
+ ]; //物流公司和运单号
$shipped[$k]['goodsInfo'] = self::getDeliverGoodsInfo($value->id); //获取商品信息
}
diff --git a/backend/modules/shop/views/order/delivery_goods.php b/backend/modules/shop/views/order/delivery_goods.php
index 72bb924..366a86b 100644
--- a/backend/modules/shop/views/order/delivery_goods.php
+++ b/backend/modules/shop/views/order/delivery_goods.php
@@ -11,13 +11,16 @@
.box {
margin-top: 20px;
}
- .unShipped-table,.shipped-table {
+ .unShipped-table, .shipped-table {
margin:15px;
width:90%;
padding:5px;
border-radius: 10px;
box-shadow:0 4px 30px 2px rgba(223, 225, 230, 0.5) !important;
}
+ .logistic {
+ text-align: center;
+ }
input {
width: 50%;
}
@@ -50,110 +53,45 @@
-
已发货商品
+ 已发货商品';
+ foreach ($deliveryGoods['shipped'] as $shipped) {
+ echo '
快递公司:';
+ echo "【{$shipped['logisticInfo']['exp_name']}】";
+ echo '    运单号:';
+ echo "【{$shipped['logisticInfo']['invoice_no']}】";
+ echo '    创建时间:';
+ echo "【{$shipped['logisticInfo']['created_at']}】";
+ echo '
';
+
+ echo
+ '
' .
+ '' .
+ '商品ID | ' .
+ '商品名称 | ' .
+ '商品sku | ' .
+ '发货数量 | ' .
+ '
';
+
+ foreach ($shipped['goodsInfo'] as $goodsInfo) {
+ echo '' .
+ " {$goodsInfo['goods_id']} | " .
+ " {$goodsInfo['goods_name']} | " .
+ " {$goodsInfo['sku_value']} | " .
+ " {$goodsInfo['delivery_number']} | " .
+ '
';
+ }
+ echo '
';
+ }
+ }
+ ?>
-";*/
-// console.log(data);
-// var unShipped = {};
-// function init() {
-//
-//
-//
-//
-//
-//
-// unShipped = JSON.stringify(unShipped);
-// $('#deliveryGoods').val(unShipped)
-// }
-// init();
-//
-// //编辑发货数量
-// function updateGoods(ref){
-// ref = $(ref)[0].target;
-// $(ref).hide();
-// $(ref).next().show();
-// $(ref).parent().parent().find('.goods_count').removeAttr('disabled')
-// }
-//
-// //保存编辑
-// function saveGoods(ref) {
-// if(typeof unShipped =='string'){
-// unShipped = JSON.parse(unShipped)
-// }
-// ref = $(ref)[0].target;
-// var tr = $(ref).parent().parent();
-// tr.find('.goods_count').attr('disabled', 'disabled');
-// var index = tr.attr('data-index');
-// var number = tr.find('.goods_count').val();
-// if (number < 0) {
-// alert('发货数量不能低于0');
-// tr.find('.goods_count').val(0);
-// return false;
-// }
-// unShipped[index].goods_count = number;
-// unShipped = JSON.stringify(unShipped);
-// $('#deliveryGoods').val(unShipped);
-// $(ref).hide();
-// $(ref).prev().show();
-// }
-//
-// //显示未发货商品
-// function showUnShipped(unShipped) {
-// unShipped.forEach(function (item,index) {
-// var tr = "" +
-// "" + item.goods_id + " | " +
-// "" + item.goods_name + " | " +
-// "" + item.sku_value + " | " +
-// "" + item.lack_number + " | " +
-// " | " +
-// "" +
-// "" +
-// "" +
-// " | " +
-// "
";
-// $('.unShipped-table').append(tr)
-// });
-// }
-//
-// //显示已发货商品
-// function showShipped(shipped) {
-// shipped.forEach(function(item,index) {
-// var table = ' ' +
-// '' +
-// '商品名称 | ' +
-// '商品sku | ' +
-// '发货数量 | ' +
-// '
' +
-// '
';
-// // var div = document.createElement('div');
-// // div.innerText = '运单号:' + item.logisticInfo.invoice_no + '快递公司:'+ item.logisticInfo.exp_name;
-// // $('.shipped-box').append(div);
-// $('.shipped-box').append(table);
-// table = $('.shipped-table').eq(index);
-// item.goodsInfo.forEach(function (item,index) {
-// var tr = "" +
-// "" + item.goods_name + " | " +
-// "" + item.sku_value + " | " +
-// "" + item.delivery_number + " | " +
-// "
";
-// $(table).append(tr);
-// });
-// })
-// }
-//
-// var btnUpdate = $('.btn-update');
-// var btnSave = $('.btn-save');
-// for (i = 0; i < btnUpdate.length; i++) {
-// btnUpdate[i].addEventListener("click", updateGoods);
-// btnSave[i].addEventListener("click", saveGoods);
-// }
-//SCRIPT;
-//$this->registerJs($js);
-//?>
+
+
+
+
diff --git a/console/controllers/TestController.php b/console/controllers/TestController.php
index a55bf9c..1f3f1fd 100644
--- a/console/controllers/TestController.php
+++ b/console/controllers/TestController.php
@@ -42,6 +42,7 @@ class TestController extends Controller {
try {
$order = new Order();
$order->user_id = 1;
+ $order->status = Order::STATUS_TO_BE_SHIPPING;
$order->type = Order::TYPE_SHOPPING;
$order->order_sn = date('Ymd', time()) . rand(0, 100);
$order->invoice_id = date('Ymd', time()) . rand(0, 100);