|
@@ -268,6 +268,7 @@ class Buy
|
|
|
$data['goods_id'] = $v['id'];
|
|
|
$data['sku_id'] = $v['sku_id'];
|
|
|
$data['price'] = $v['price'] * $v['buy_num'];
|
|
|
+ $data['d_price'] = $v['price'];
|
|
|
$data['num'] = $v['buy_num'];
|
|
|
|
|
|
Dever::db('shop/buy_order_goods')->insert($data);
|
|
@@ -566,14 +567,24 @@ class Buy
|
|
|
$html = '<div class="layui-col-md12"><div class="layui-card"><div class="layui-card-header">基本信息</div><div class="layui-card-body">';
|
|
|
$html .= '<table class="layui-table"><thead><tr><th style="width:20%">项目</th><th style="width:80%">详情</th></tr> </thead><tbody>';
|
|
|
|
|
|
- if ($type == 2) {
|
|
|
+ if ($type == 2 || $info['type'] == 2) {
|
|
|
$info['price'] = $info['p_price'];
|
|
|
}
|
|
|
- $html .= '<tr>
|
|
|
- <td>订单信息</td>
|
|
|
- <td>'.$this->table(false, array(array('订单号:' . $info['order_num'], '金额:' . $info['price'], '数量:' . $info['num'], '状态:' . $status))).'</td>
|
|
|
|
|
|
- </tr>';
|
|
|
+ if ($type == 3) {
|
|
|
+ $html .= '<tr>
|
|
|
+ <td>订单信息</td>
|
|
|
+ <td>'.$this->table(false, array(array('订单号:' . $info['order_num'], '数量:' . $info['num'], '状态:' . $status))).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+ } else {
|
|
|
+ $html .= '<tr>
|
|
|
+ <td>订单信息</td>
|
|
|
+ <td>'.$this->table(false, array(array('订单号:' . $info['order_num'], '金额:' . $info['price'], '数量:' . $info['num'], '状态:' . $status))).'</td>
|
|
|
+
|
|
|
+ </tr>';
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if ($type == 1 && $tk && $tk['process'] == 1) {
|
|
|
$status = '申请' . $tk_status[$tk['status']];
|
|
@@ -652,7 +663,7 @@ class Buy
|
|
|
<td>'.$this->table(false, array($button)).'</td>
|
|
|
|
|
|
</tr>';
|
|
|
- } elseif ($info['type'] == 2) {
|
|
|
+ } elseif ($type == 3) {
|
|
|
$config = Dever::load('factory/admin/auth.config');
|
|
|
$button = array();
|
|
|
$button[] = '<button class="layui-btn layui-btn-primary" onclick="print(\''.$info['id'].'\')">打印订单</button>';
|
|
@@ -722,11 +733,16 @@ class Buy
|
|
|
$info['ps_info']['service_name'] = $service['name'];
|
|
|
}
|
|
|
|
|
|
- $head = array('名称', '单号', '费用', '数量', '重量', '体积', '配货员', '打包员', '发货时间', '收货时间');
|
|
|
+ if ($type == 3) {
|
|
|
+ $head = array('名称', '单号', '数量', '重量', '体积', '发货时间', '收货时间');
|
|
|
|
|
|
-
|
|
|
+ $body = array(array($info['ps_info']['service_name'], $info['ps_info']['order_num'], $info['ps_info']['num'], $info['ps_info']['zl'], $info['ps_info']['tj'], $info['ps_info']['cdate'], $info['ps_info']['ydate']));
|
|
|
+ } else {
|
|
|
+ $head = array('名称', '单号', '费用', '数量', '重量', '体积', '配货员', '打包员', '发货时间', '收货时间');
|
|
|
|
|
|
- $body = array(array($info['ps_info']['service_name'], $info['ps_info']['order_num'], $info['ps_info']['price'], $info['ps_info']['num'], $info['ps_info']['zl'], $info['ps_info']['tj'], $info['ps_info']['phy'], $info['ps_info']['dby'], $info['ps_info']['cdate'], $info['ps_info']['ydate']));
|
|
|
+ $body = array(array($info['ps_info']['service_name'], $info['ps_info']['order_num'], $info['ps_info']['price'], $info['ps_info']['num'], $info['ps_info']['zl'], $info['ps_info']['tj'], $info['ps_info']['phy'], $info['ps_info']['dby'], $info['ps_info']['cdate'], $info['ps_info']['ydate']));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
$html .= '<div class="layui-card"><div class="layui-card-header">物流信息</div><div class="layui-card-body">' . $this->table($head, $body) . '</div></div>';
|
|
|
}
|
|
@@ -745,7 +761,7 @@ class Buy
|
|
|
$refund_body_total['price'] = 0;
|
|
|
$refund_body_total['num'] = 0;
|
|
|
foreach ($goods as $k => $v) {
|
|
|
- if ($type == 2) {
|
|
|
+ if ($type == 2 || $info['type'] == 2) {
|
|
|
$v['price'] = $v['p_price'];
|
|
|
}
|
|
|
$goods_info = Dever::load('goods/lib/info')->getInfoBySku($v['goods_id'], $v['sku_id']);
|
|
@@ -791,23 +807,31 @@ class Buy
|
|
|
}
|
|
|
|
|
|
if ($tk && $v['status'] == 3) {
|
|
|
- $refund_body[] = array
|
|
|
+ $d = array
|
|
|
(
|
|
|
$goods_info['name'] . ' ' . $sku,
|
|
|
$v['price'],
|
|
|
$v['num'],
|
|
|
$tk_status[$tk['status']],
|
|
|
);
|
|
|
+ if ($type == 3) {
|
|
|
+ unset($d[1]);
|
|
|
+ }
|
|
|
+ $refund_body[] = $d;
|
|
|
$refund_body_total['price'] += $v['price'];
|
|
|
$refund_body_total['num'] += $v['num'];
|
|
|
} else {
|
|
|
- $body[] = array
|
|
|
+ $d = array
|
|
|
(
|
|
|
$goods_info['name'] . ' ' . $sku,
|
|
|
$v['price'],
|
|
|
$v['num'],
|
|
|
$status,
|
|
|
);
|
|
|
+ if ($type == 3) {
|
|
|
+ unset($d[1]);
|
|
|
+ }
|
|
|
+ $body[] = $d;
|
|
|
$body_total['price'] += $v['price'];
|
|
|
$body_total['num'] += $v['num'];
|
|
|
}
|
|
@@ -817,7 +841,7 @@ class Buy
|
|
|
|
|
|
$head = array('名称', '金额', '数量', '状态');
|
|
|
|
|
|
- $body[] = array
|
|
|
+ $d = array
|
|
|
(
|
|
|
'合计',
|
|
|
$body_total['price'],
|
|
@@ -825,6 +849,12 @@ class Buy
|
|
|
'-'
|
|
|
);
|
|
|
|
|
|
+ if ($type == 3) {
|
|
|
+ unset($head[1]);
|
|
|
+ unset($d[1]);
|
|
|
+ }
|
|
|
+ $body[] = $d;
|
|
|
+
|
|
|
|
|
|
$html .= '<div class="layui-card"><div class="layui-card-header">商品清单</div><div class="layui-card-body" style="max-heights: 500px;overflow: auto;">' . $this->table($head, $body) . '</div></div>';
|
|
|
}
|
|
@@ -833,13 +863,18 @@ class Buy
|
|
|
|
|
|
$head = array('名称', '金额', '数量', '状态');
|
|
|
|
|
|
- $refund_body[] = array
|
|
|
+ $d = array
|
|
|
(
|
|
|
'合计',
|
|
|
$refund_body_total['price'],
|
|
|
$refund_body_total['num'],
|
|
|
'-'
|
|
|
);
|
|
|
+ if ($type == 3) {
|
|
|
+ unset($head[1]);
|
|
|
+ unset($d[1]);
|
|
|
+ }
|
|
|
+ $refund_body[] = $d;
|
|
|
|
|
|
$html .= '<div class="layui-card"><div class="layui-card-header">缺货与报损商品</div><div class="layui-card-body" style="max-heights: 300px;overflow: auto;">' . $this->table($head, $refund_body) . '</div></div>';
|
|
|
}
|
|
@@ -856,7 +891,7 @@ class Buy
|
|
|
if (isset($cash_order) && $cash_order) {
|
|
|
$head = array('序号', '结算单号', '数量', '金额', '结算类型', '入账状态', '审核状态', '结算时间', '审核未通过原因', '管理');
|
|
|
|
|
|
- if ($type == 1 && $info['type'] == 2) {
|
|
|
+ if ($type == 3) {
|
|
|
unset($head[3]);
|
|
|
}
|
|
|
|
|
@@ -891,7 +926,7 @@ class Buy
|
|
|
$m,
|
|
|
);
|
|
|
|
|
|
- if ($type == 1 && $info['type'] == 2) {
|
|
|
+ if ($type == 3) {
|
|
|
unset($d[3]);
|
|
|
}
|
|
|
$body[] = $d;
|
|
@@ -1120,7 +1155,7 @@ class Buy
|
|
|
if ($sku) {
|
|
|
if ($goods['num'] <= $sku['total']) {
|
|
|
|
|
|
- $state = $this->createOrder($order_id, $order_num, 1, $shop['id'], 2, $where['store_id'], $goods['price'], $goods['price'], $goods['num'], $where['goods_id'], $where['sku_id']);
|
|
|
+ $state = $this->createOrder($order_id, $order_num, 1, $shop['id'], 2, $where['store_id'], $goods['price'], $goods['price'], $goods['d_price'], $goods['num'], $where['goods_id'], $where['sku_id']);
|
|
|
if ($state) {
|
|
|
$type_id[] = $where['store_id'];
|
|
|
$id[] = $state;
|
|
@@ -1131,7 +1166,7 @@ class Buy
|
|
|
|
|
|
$goods['num'] = $goods['num'] - $sku['total'];
|
|
|
|
|
|
- $state = $this->createOrder($order_id, $order_num, 1, $shop['id'], 2, $where['store_id'], $goods['price'], $goods['price'], $sku['total'], $where['goods_id'], $where['sku_id']);
|
|
|
+ $state = $this->createOrder($order_id, $order_num, 1, $shop['id'], 2, $where['store_id'], $goods['price'], $goods['price'], $goods['d_price'], $sku['total'], $where['goods_id'], $where['sku_id']);
|
|
|
if (!$state) {
|
|
|
$goods['num'] = $goods['num'] + $sku['total'];
|
|
|
} else {
|
|
@@ -1167,7 +1202,7 @@ class Buy
|
|
|
$sku = Dever::db('factory/goods_sku')->getOne($where);
|
|
|
|
|
|
if ($sku && $sku['p_price'] > 0) {
|
|
|
- $state = $this->createOrder($order_id, $order_num, 1, $shop['id'], 3, $where['factory_id'], $goods['price'], $sku['p_price'], $goods['num'], $where['goods_id'], $where['sku_id']);
|
|
|
+ $state = $this->createOrder($order_id, $order_num, 1, $shop['id'], 3, $where['factory_id'], $goods['price'], $sku['p_price'], $goods['d_price'], $goods['num'], $where['goods_id'], $where['sku_id']);
|
|
|
if ($state) {
|
|
|
$type_id[] = $where['factory_id'];
|
|
|
$id[] = $state;
|
|
@@ -1198,7 +1233,7 @@ class Buy
|
|
|
}
|
|
|
|
|
|
|
|
|
- private function createOrder($order_id, $order_num, $type, $type_id, $source_type, $source_id, $price, $p_price, $num, $goods_id, $sku_id)
|
|
|
+ private function createOrder($order_id, $order_num, $type, $type_id, $source_type, $source_id, $price, $p_price, $d_price, $num, $goods_id, $sku_id)
|
|
|
{
|
|
|
$where['parent_order_id'] = $order_id;
|
|
|
$where['type'] = $type;
|
|
@@ -1236,6 +1271,7 @@ class Buy
|
|
|
$goods['goods_id'] = $goods_id;
|
|
|
$goods['sku_id'] = $sku_id;
|
|
|
$goods['price'] = $price;
|
|
|
+ $goods['d_price'] = $d_price;
|
|
|
$goods['p_price'] = $p_price;
|
|
|
$goods['num'] = $num;
|
|
|
Dever::db('shop/buy_order_goods')->insert($goods);
|