|
@@ -1398,7 +1398,6 @@ class Sell
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if ($info['invoice_id'] > 0) {
|
|
|
$invoice = Dever::load('passport/invoice')->getOne($info['uid'], $info['invoice_id']);
|
|
|
|
|
@@ -1426,83 +1425,36 @@ class Sell
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $info['ps_info'] = Dever::db('shop/sell_order_ps')->find(array('order_id' => $info['id']));
|
|
|
- if ($info['ps_info']) {
|
|
|
- $info['ps_info']['service'] = Dever::array_decode($info['ps_info']['service']);
|
|
|
- $info['ps_info']['cdate'] = date('Y-m-d H:i', $info['ps_info']['cdate']);
|
|
|
- if ($info['ps_info']['qs_date']) {
|
|
|
- $info['ps_info']['qs_date'] = date('Y-m-d H:i', $info['ps_info']['qs_date']);
|
|
|
- } else {
|
|
|
- $info['ps_info']['qs_date'] = '无';
|
|
|
- }
|
|
|
-
|
|
|
- $status = Dever::db('shop/sell_order_ps')->config['status'];
|
|
|
- $info['ps_info']['status_name'] = $status[$info['ps_info']['status']];
|
|
|
-
|
|
|
- $service = array();
|
|
|
- if ($info['ps_info']['service']) {
|
|
|
- foreach ($info['ps_info']['service'] as $k => $v) {
|
|
|
- if (isset($v['order_num']) && $v['order_num']) {
|
|
|
- $info['ps_info']['service'][$k]['service_name'] = '商家自送';
|
|
|
- if ($v['service_id'] > 0) {
|
|
|
- $service_info = Dever::db('shop/service')->find($v['service_id']);
|
|
|
- $info['ps_info']['service'][$k]['service_name'] = $service_info['name'];
|
|
|
- }
|
|
|
-
|
|
|
- $service[] = array
|
|
|
- (
|
|
|
- array('名称', $info['ps_info']['service'][$k]['service_name']),
|
|
|
- array('单号', isset($v['order_num']) ? $v['order_num'] : ''),
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ $audit = Dever::input('audit');
|
|
|
+ if ($audit == 1) {
|
|
|
+
|
|
|
+ $this->show_audit($info, $result);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ $this->show_ps($info, $result);
|
|
|
|
|
|
- $result['物流信息'] = array
|
|
|
- (
|
|
|
- 'type' => 'info',
|
|
|
- 'content' => array
|
|
|
- (
|
|
|
- array
|
|
|
- (
|
|
|
- array('发货时间', $info['ps_info']['cdate']),
|
|
|
- array('收货时间', $info['ps_info']['qs_date']),
|
|
|
- array('查单', '<a href="https://www.kuaidi100.com/?from=openv" target="_blank">点此手动查单</a>'),
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- $result['物流信息']['content'] = array_merge($result['物流信息']['content'], $service);
|
|
|
- }
|
|
|
+
|
|
|
+ $this->show_refund($info, $result, $tk, $tk_process);
|
|
|
|
|
|
+
|
|
|
+ $this->show_goods($info, $result, $tk_status);
|
|
|
|
|
|
- if (!$info['refund_cash']) {
|
|
|
- $info['refund_cash'] = 0;
|
|
|
+
|
|
|
+ $this->show_dz($info, $result);
|
|
|
}
|
|
|
|
|
|
- if ($info['refund_cash'] > 0 && $tk) {
|
|
|
- $process = $tk_process[$tk['process']];
|
|
|
- $tk['cdate'] = date('Y-m-d H:i', $tk['cdate']);
|
|
|
- $result['退款信息'] = array
|
|
|
- (
|
|
|
- 'type' => 'info',
|
|
|
- 'content' => array
|
|
|
- (
|
|
|
- array
|
|
|
- (
|
|
|
- array('退款金额', $info['refund_cash']),
|
|
|
- array('数量', $info['num']),
|
|
|
- array('退款进度', $process),
|
|
|
- ),
|
|
|
+ $head = array
|
|
|
+ (
|
|
|
+ 'name' => '基本信息',
|
|
|
+ 'btn' => array(),
|
|
|
+ );
|
|
|
+ $html = Dever::show($head, $result);
|
|
|
|
|
|
- array
|
|
|
- (
|
|
|
- array('申请时间', $tk['cdate']),
|
|
|
- array('退款原因', $tk['desc']),
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
|
|
|
+ private function show_goods($info, &$result, $tk_status)
|
|
|
+ {
|
|
|
$body = $refund_body = array();
|
|
|
$body_total = array();
|
|
|
$body_total['price'] = 0;
|
|
@@ -1587,7 +1539,10 @@ class Sell
|
|
|
'total' => $refund_body_total,
|
|
|
);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ private function show_dz($info, &$result)
|
|
|
+ {
|
|
|
$search_option_shop_type = Dever::input('search_option_shop_type');
|
|
|
if ($search_option_shop_type == 2) {
|
|
|
|
|
@@ -1653,16 +1608,181 @@ class Sell
|
|
|
);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
|
|
|
- $head = array
|
|
|
- (
|
|
|
- 'name' => '基本信息',
|
|
|
- 'btn' => array(),
|
|
|
- );
|
|
|
- $html = Dever::show($head, $result);
|
|
|
+ private function show_refund($info, &$result, $tk, $tk_process)
|
|
|
+ {
|
|
|
+ if (!$info['refund_cash']) {
|
|
|
+ $info['refund_cash'] = 0;
|
|
|
+ }
|
|
|
|
|
|
- return $html;
|
|
|
+ if ($info['refund_cash'] > 0 && $tk) {
|
|
|
+ $process = $tk_process[$tk['process']];
|
|
|
+ $tk['cdate'] = date('Y-m-d H:i', $tk['cdate']);
|
|
|
+ $result['退款信息'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'info',
|
|
|
+ 'content' => array
|
|
|
+ (
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('退款金额', $info['refund_cash']),
|
|
|
+ array('数量', $info['num']),
|
|
|
+ array('退款进度', $process),
|
|
|
+ ),
|
|
|
+
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('申请时间', $tk['cdate']),
|
|
|
+ array('退款原因', $tk['desc']),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private function show_ps($info, &$result)
|
|
|
+ {
|
|
|
+ $info['ps_info'] = Dever::db('shop/sell_order_ps')->find(array('order_id' => $info['id']));
|
|
|
+ if ($info['ps_info']) {
|
|
|
+ $info['ps_info']['service'] = Dever::array_decode($info['ps_info']['service']);
|
|
|
+ $info['ps_info']['cdate'] = date('Y-m-d H:i', $info['ps_info']['cdate']);
|
|
|
+ if ($info['ps_info']['qs_date']) {
|
|
|
+ $info['ps_info']['qs_date'] = date('Y-m-d H:i', $info['ps_info']['qs_date']);
|
|
|
+ } else {
|
|
|
+ $info['ps_info']['qs_date'] = '无';
|
|
|
+ }
|
|
|
+
|
|
|
+ $status = Dever::db('shop/sell_order_ps')->config['status'];
|
|
|
+ $info['ps_info']['status_name'] = $status[$info['ps_info']['status']];
|
|
|
+
|
|
|
+ $service = array();
|
|
|
+ if ($info['ps_info']['service']) {
|
|
|
+ foreach ($info['ps_info']['service'] as $k => $v) {
|
|
|
+ if (isset($v['order_num']) && $v['order_num']) {
|
|
|
+ $info['ps_info']['service'][$k]['service_name'] = '商家自送';
|
|
|
+ if ($v['service_id'] > 0) {
|
|
|
+ $service_info = Dever::db('shop/service')->find($v['service_id']);
|
|
|
+ $info['ps_info']['service'][$k]['service_name'] = $service_info['name'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $service[] = array
|
|
|
+ (
|
|
|
+ array('名称', $info['ps_info']['service'][$k]['service_name']),
|
|
|
+ array('单号', isset($v['order_num']) ? $v['order_num'] : ''),
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $result['物流信息'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'info',
|
|
|
+ 'content' => array
|
|
|
+ (
|
|
|
+ array
|
|
|
+ (
|
|
|
+ array('发货时间', $info['ps_info']['cdate']),
|
|
|
+ array('收货时间', $info['ps_info']['qs_date']),
|
|
|
+ array('查单', '<a href="https://www.kuaidi100.com/?from=openv" target="_blank">点此手动查单</a>'),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ $result['物流信息']['content'] = array_merge($result['物流信息']['content'], $service);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private function show_audit($info, &$result)
|
|
|
+ {
|
|
|
+ $info['type'] = 1;
|
|
|
+
|
|
|
+ $goods = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
|
|
|
+
|
|
|
+ $shop = Dever::db('shop/info')->find($info['shop_id']);
|
|
|
+
|
|
|
+ list($data, $source) = Dever::load('mshop/lib/buy')->assign($goods, $info, $shop, true);
|
|
|
+
|
|
|
+ if ($info) {
|
|
|
+
|
|
|
+ $head = array('序号', '商品编号', '商品名称', '供货商', '订货总数量', '商品计量单位', '订货单总金额');
|
|
|
+ $body = array();
|
|
|
+ $i = 0;
|
|
|
+ if ($data) {
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ foreach ($v as $v1) {
|
|
|
+ $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v1['goods_id'], $v1['sku_id']);
|
|
|
+ if (isset($goods_info['sku'])) {
|
|
|
+ $sku = '[' . $goods_info['sku']['string'] . ']';
|
|
|
+ } else {
|
|
|
+ $sku = '';
|
|
|
+ }
|
|
|
+ $d = array
|
|
|
+ (
|
|
|
+ $i+1,
|
|
|
+ $goods_info['code'],
|
|
|
+ $goods_info['name'] . $sku,
|
|
|
+ Dever::load('mshop/lib/buy')->getSelect($source, $v1['source_id'], $v1['order_goods_id']),
|
|
|
+ $v1['num'],
|
|
|
+ $goods_info['unit'],
|
|
|
+ $v1['p_price'] * $v1['num'],
|
|
|
+ );
|
|
|
+
|
|
|
+ $body[] = $d;
|
|
|
+
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($goods) {
|
|
|
+ foreach ($goods as $k => $v) {
|
|
|
+ $goods_info = Dever::load('goods/lib/info')->getInfoBySku($v['goods_id'], $v['sku_id']);
|
|
|
+ if (isset($goods_info['sku'])) {
|
|
|
+ $sku = '[' . $goods_info['sku']['string'] . ']';
|
|
|
+ } else {
|
|
|
+ $sku = '';
|
|
|
+ }
|
|
|
+ $d = array
|
|
|
+ (
|
|
|
+ $i+1,
|
|
|
+ $goods_info['code'],
|
|
|
+ $goods_info['name'] . $sku,
|
|
|
+ Dever::load('mshop/lib/buy')->getSelect($source, false, $v['id']),
|
|
|
+ $v['num'],
|
|
|
+ $goods_info['unit'],
|
|
|
+ $v['p_price'] * $v['num'],
|
|
|
+ );
|
|
|
+
|
|
|
+ $body[] = $d;
|
|
|
+
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $btn = array();
|
|
|
+ $btn[] = array(
|
|
|
+ 'type' => 'click',
|
|
|
+ 'content' => 'setAudit()',
|
|
|
+ 'name' => '全部调整<script>function setAudit(){layer.confirm(\'确定进行此项操作吗?\', function(){var audit = $(\'.audit_set\').val();$(\'.audit\').each(function(){$(this).val(audit);layui.form.render();layer.closeAll()})})}</script>'
|
|
|
+ );
|
|
|
+ $result['商品拆单'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'table',
|
|
|
+ 'head' => array('name' => '供货商:' . Dever::load('mshop/lib/buy')->getSelect($source, false, false), 'btn' => $btn),
|
|
|
+ 'content' => array
|
|
|
+ (
|
|
|
+ 'head' => $head,
|
|
|
+ 'body' => $body,
|
|
|
+ )
|
|
|
+ );
|
|
|
+
|
|
|
+ $url = Dever::url('lib/sell.audit_set_commit?json=1&order_id=' . $info['id'], 'shop');
|
|
|
+ $result['审核结果'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'html',
|
|
|
+ 'content' => '<script>function saveAudit(){var goods = [];var audit = 1; var audit_text = $(".update_audit_text").val();$(".update_audit").each(function(){if ($(this).get(0).checked){audit = $(this).val()}});$(\'.audit\').each(function(){var v = $(this).val();var id = $(this).attr("id");goods.push(v + "_" + id);});layer.confirm(\'确定进行此项操作吗?\', function(){layui.form.render();var send = {};send.goods = goods.join(",");send.audit = audit;send.audit_text = audit_text;console.info(send);$.post("'.$url.'", send, function(t){t = JSON.parse(t);showYes(t)})})}</script><style>.layui-form-radio{padding-right: 0px;margin: 0px 0px 0 0;margin-left:40px}</style><div class="layui-form-item show_input"><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">审核状态</label><div style="display:inline" class="am-btn-group"><input update_type="checked" class="checkbox-checkall-0_update_audit update_audit update_value validate[required]" type="radio" name="update_audit[]" value="2" checked="" show_id="audit" autocomplete="off" id="form-validation-field-1"> 审核通过 <input update_type="checked" class="autoload checkbox-checkall-0_update_audit update_audit update_value validate[required]" type="radio" name="update_audit[]" value="3" autocomplete="off" id="form-validation-field-0"> 审核未通过 </div></div></div></div><div class="layui-form-item" style="display: block;"><div classs="layui-col-lg6"><div><label style="font-size:14px;font-weight:bold;" class="">审核备注</label></div><div><textarea style="height:100px;" update_type="value" class="update_value update_audit_text form-control layui-input validate[required]" name="update_desc"></textarea></div></div></div> <div style="text-align:left" class="layui-layer-btn layui-layer-btn-"><a class="layui-layer-btn0" onclick="saveAudit()">保存</a><a class="layui-layer-btn1" style="display:none">取消</a></div>',
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1741,6 +1861,74 @@ class Sell
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function audit_set_commit_api()
|
|
|
+ {
|
|
|
+ Dever::config('base')->hook = true;
|
|
|
+
|
|
|
+
|
|
|
+ $id = Dever::input('order_id');
|
|
|
+ $goods = Dever::input('goods');
|
|
|
+ $audit = Dever::input('audit');
|
|
|
+ $audit_text = Dever::input('audit_text');
|
|
|
+
|
|
|
+ $info = Dever::db('shop/sell_order')->one($id);
|
|
|
+ if ($audit > 1 && $info && $info['status'] == 2) {
|
|
|
+
|
|
|
+ $shop = Dever::db('shop/info')->find($info['shop_id']);
|
|
|
+
|
|
|
+ if ($audit == 2) {
|
|
|
+ Dever::db('shop/sell_order')->update(array('where_id' => $info['id'], 'audit' => $audit, 'audit_desc' => $audit_text));
|
|
|
+
|
|
|
+ if (strstr($info['order_num'], '_')) {
|
|
|
+ $temp = explode('_', $info['order_num']);
|
|
|
+ $info['order_num'] = $temp[0];
|
|
|
+ $info['order_index'] = $temp[1];
|
|
|
+ } else {
|
|
|
+ $info['order_index'] = 0;
|
|
|
+ }
|
|
|
+ $goods = explode(',', $goods);
|
|
|
+ $data = $other = array();
|
|
|
+ foreach ($goods as $k => $v) {
|
|
|
+ list($source_type, $source_id, $name, $goods_id) = explode('_', $v);
|
|
|
+ $gv = Dever::db('shop/sell_order_goods')->find($goods_id);
|
|
|
+ if ($source_id > 0) {
|
|
|
+ $key = $source_type . '_' . $source_id;
|
|
|
+ $data[$key][] = array
|
|
|
+ (
|
|
|
+ 'area' => $shop['area'],
|
|
|
+ 'order_id' => $info['id'],
|
|
|
+ 'order_type' => 1,
|
|
|
+ 'order_num' => $info['order_num'],
|
|
|
+ 'order_index' => $info['order_index'],
|
|
|
+ 'type' => 1,
|
|
|
+ 'type_id' => $shop['id'],
|
|
|
+ 'source_type' => $source_type,
|
|
|
+ 'source_id' => $source_id,
|
|
|
+ 'order_goods_id' => $gv['id'],
|
|
|
+ 'goods_id' => $gv['goods_id'],
|
|
|
+ 'sku_id' => $gv['sku_id'],
|
|
|
+ 'price' => $gv['price'],
|
|
|
+ 'p_price' => $gv['price'],
|
|
|
+ 'num' => $gv['num'],
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ $other[] = $gv;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->audit_action($data, $other, $info, $shop, 1);
|
|
|
+ } else {
|
|
|
+ Dever::db('shop/sell_order')->update(array('where_id' => $info['id'], 'audit' => $audit, 'audit_desc' => $audit_text));
|
|
|
+
|
|
|
+ $shop = Dever::db('shop/info')->find($info['shop_id']);
|
|
|
+ Dever::load('shop/lib/refund')->set('sell')->apply(1, $shop['id'], $id, false, 3, 0, '未通过审核');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Dever::url('project/database/list&project=shop&table=sell_order&menu=shop&search_option_state=1&search_option_shop_type=2&menu_id=218', 'manage');
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public function audit_commit()
|
|
|
{
|
|
@@ -1763,6 +1951,13 @@ class Sell
|
|
|
|
|
|
$data = Dever::load('mshop/lib/buy')->assign($goods, $order, $shop);
|
|
|
|
|
|
+ $this->audit_action($data, $goods, $order, $shop);
|
|
|
+
|
|
|
+ return 'ok';
|
|
|
+ }
|
|
|
+
|
|
|
+ private function audit_action($data, $goods, $order, $shop, $state = 2)
|
|
|
+ {
|
|
|
$send = array();
|
|
|
|
|
|
if (!$goods && $data) {
|
|
@@ -1792,9 +1987,19 @@ class Sell
|
|
|
$string[] = $info['name'];
|
|
|
}
|
|
|
$string = implode('、', $string);
|
|
|
+ if ($state == 1) {
|
|
|
+ Dever::alert('商品:'.$string.'未选择供货商');
|
|
|
+ } else {
|
|
|
+ Dever::alert('商品:'.$string.'库存不足或厂家未生产,请联系供货商备货,该订单进入重新审核状态');
|
|
|
+ }
|
|
|
Dever::alert('商品:'.$string.'库存不足或厂家未生产,请联系供货商备货,该订单进入重新审核状态');
|
|
|
} else {
|
|
|
- Dever::alert('供货商库存不足,请联系供货商备货,该订单进入重新审核状态');
|
|
|
+ if ($state == 1) {
|
|
|
+ Dever::alert('未选择供货商,该订单进入重新审核状态');
|
|
|
+ } else {
|
|
|
+ Dever::alert('供货商库存不足,请联系供货商备货,该订单进入重新审核状态');
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1806,7 +2011,5 @@ class Sell
|
|
|
Dever::load('cash/lib/order')->up($order_info, 1, 1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return 'ok';
|
|
|
}
|
|
|
}
|