diff --git a/service/Application/Admin/Controller/OrderController.class.php b/service/Application/Admin/Controller/OrderController.class.php
index 481f05d4889635513fbc46d13be1ef20237dc51f..c36a70d7ae3ec3cdb3054627298339ebadf002e0 100755
--- a/service/Application/Admin/Controller/OrderController.class.php
+++ b/service/Application/Admin/Controller/OrderController.class.php
@@ -3,6 +3,7 @@
namespace Admin\Controller;
use Service\OrderService;
+use Service\ResourcesService;
/**
* 订单管理
@@ -70,7 +71,7 @@ class OrderController extends CommonController
$this->assign('common_order_pay_status', L('common_order_pay_status'));
// 快递公司
- $this->assign('express_list', M('Express')->field('id,name')->where(['is_enable'=>1])->select());
+ $this->assign('express_list', ResourcesService::ExpressList());
// 参数
$this->assign('param', $param);
@@ -131,7 +132,6 @@ class OrderController extends CommonController
// 快递公司
$v['express_name'] = GetExpressName($v['express_id']);
- unset($v['express_id']);
// 收件人地址
$v['receive_province_name'] = GetRegionName($v['receive_province']);
@@ -280,39 +280,12 @@ class OrderController extends CommonController
$this->error(L('common_unauthorized_access'));
}
- // 参数处理
- $id = I('id');
-
- // 取消数据
- if(!empty($id))
- {
- // 订单模型
- $m = M('Order');
-
- // 订单是否存在
- $data = $m->field('id,status')->find($id);
- if(empty($data))
- {
- $this->ajaxReturn(L('common_data_no_exist_error'), -2);
- }
-
- // 状态
- if(!in_array($data['status'], [2]))
- {
- $this->ajaxReturn('状态不可操作['.L('common_order_admin_status')[$data['status']]['name'].']', -3);
- }
-
- // 取消订单
- $status = $m->where(array('id'=>$id))->save(['status'=>3, 'upd_time'=>time(), 'delivery_time'=>time()]);
- if($status !== false)
- {
- $this->ajaxReturn(L('common_operation_delivery_success'));
- } else {
- $this->ajaxReturn(L('common_operation_delivery_error'), -100);
- }
- } else {
- $this->ajaxReturn(L('common_param_error'), -1);
- }
+ // 发货操作
+ $params = $_POST;
+ $params['creator'] = $this->admin['id'];
+ $params['creator_name'] = $this->admin['username'];
+ $ret = OrderService::OrderDelivery($params);
+ $this->ajaxReturn($ret['msg'], $ret['code'], $ret['data']);
}
/**
diff --git a/service/Application/Admin/Lang/zh-cn/order.php b/service/Application/Admin/Lang/zh-cn/order.php
index 82dedd9460144e5667d7a93b634fb429f00feba0..229b52c756a6cbe0340dc6b6f2e3cf152645cab8 100755
--- a/service/Application/Admin/Lang/zh-cn/order.php
+++ b/service/Application/Admin/Lang/zh-cn/order.php
@@ -23,5 +23,11 @@ return array(
'order_delivery_time_text' => '发货时间',
'order_cancel_time_text' => '取消时间',
'order_success_time_text' => '完成时间',
+
+ 'order_delivery_popup_title' => '发货操作',
+ 'order_express_not_data_tips' => '没有快递方式',
+ 'order_business_express_title' => '选择快递',
+ 'order_express_number_text' => '快递单号',
+ 'order_express_number_format' => '请填写快递单号',
);
?>
\ No newline at end of file
diff --git a/service/Application/Admin/View/Default/Order/Index.html b/service/Application/Admin/View/Default/Order/Index.html
index 260646ca495c76421bfb803ad1f3e7e979f8f18e..e93dd2e8ee24ac315ddb79b84c43b5de590e0f15 100755
--- a/service/Application/Admin/View/Default/Order/Index.html
+++ b/service/Application/Admin/View/Default/Order/Index.html
@@ -100,8 +100,15 @@
{{$v.express_name}}
{{$v.express_number}}
-
{{$v.status_text}} |
- {{$v.pay_status_text}} |
+
+ {{$v.status_text}}
+
+ 用户已删除
+
+ |
+
+ {{$v.pay_status_text}}
+ |
订单金额:{{$v.price}}
优惠金额:{{$v.preferential_price}}
@@ -205,12 +212,12 @@
-
+
-
+
|
@@ -223,6 +230,52 @@
+
+
diff --git a/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php b/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php
old mode 100755
new mode 100644
index 93680255ee7dd657db5d02e82ee0d1b59f4ad358..f743c10230098d2021d30045fe45551e80f66585
--- a/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php
+++ b/service/Application/Runtime/Temp/8cde93cbd070139d84f31d26f8ea8f4d.php
@@ -1,3 +1,3 @@
\ No newline at end of file
diff --git a/service/Application/Runtime/Temp/a58f8070835be94249ea77f3601c6647.php b/service/Application/Runtime/Temp/a58f8070835be94249ea77f3601c6647.php
old mode 100755
new mode 100644
diff --git a/service/Application/Service/OrderService.class.php b/service/Application/Service/OrderService.class.php
index 721af28bd4d17bf44f687b77280e5a557b64d95a..0b2915f76b38b9ffff460a8d9d19222a0bbe8ddc 100755
--- a/service/Application/Service/OrderService.class.php
+++ b/service/Application/Service/OrderService.class.php
@@ -486,6 +486,80 @@ class OrderService
return DataReturn(L('common_cancel_error'), -1);
}
+ /**
+ * 订单发货
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-30
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function OrderDelivery($params = [])
+ {
+ // 请求参数
+ $p = [
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'id',
+ 'error_msg' => '订单id有误',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'user_id',
+ 'error_msg' => '用户id有误',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'express_id',
+ 'error_msg' => '快递id有误',
+ ],
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'express_number',
+ 'error_msg' => '快递单号有误',
+ ],
+ ];
+ $ret = params_checked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ // 获取订单信息
+ $m = M('Order');
+ $where = ['id'=>intval($params['id']), 'user_id'=>$params['user_id'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
+ $order = $m->where($where)->field('id,status,user_id')->find();
+ if(empty($order))
+ {
+ return DataReturn(L('common_data_no_exist_error'), -1);
+ }
+ if(!in_array($order['status'], [2]))
+ {
+ $status_text = L('common_order_user_status')[$order['status']]['name'];
+ return DataReturn('状态不可操作['.$status_text.']', -1);
+ }
+
+ $data = [
+ 'status' => 3,
+ 'express_id' => intval($params['express_id']),
+ 'express_number' => I('express_number', '', '', $params),
+ 'upd_time' => time(),
+ ];
+ if($m->where($where)->save($data))
+ {
+ // 用户消息
+ ResourcesService::MessageAdd($order['user_id'], '订单发货', '订单已发货', 1, $order['id']);
+
+ // 订单状态日志
+ $creator = isset($params['creator']) ? intval($params['creator']) : 0;
+ $creator_name = isset($params['creator_name']) ? htmlentities($params['creator_name']) : '';
+ self::OrderHistoryAdd($order['id'], $data['status'], $order['status'], '收货', $creator, $creator_name);
+ return DataReturn(L('common_operation_delivery_success'), 0);
+ }
+ return DataReturn(L('common_operation_delivery_error'), -1);
+ }
+
/**
* 订单收货
* @author Devil
diff --git a/service/Application/Service/ResourcesService.class.php b/service/Application/Service/ResourcesService.class.php
index 59850161ccb966eda1d6f3cbbe22705f6e8264e7..ee92a7735da1504eaf713e14f8e65331a3bc690a 100755
--- a/service/Application/Service/ResourcesService.class.php
+++ b/service/Application/Service/ResourcesService.class.php
@@ -36,8 +36,12 @@ class ResourcesService
*/
public static function ExpressList($params = [])
{
- $where = ['is_enable'=>1];
- $data = M('Express')->where($where)->field('id,icon,name,sort')->order('sort asc')->select();
+ $where = [];
+ if(isset($params['is_enable']))
+ {
+ $where['is_enable'] = intval($params['is_enable']);
+ }
+ $data = M('Express')->where($where)->field('id,icon,name,sort,is_enable')->order('sort asc')->select();
if(!empty($data) && is_array($data))
{
$images_host = C('IMAGE_HOST');
@@ -61,7 +65,9 @@ class ResourcesService
*/
public static function PaymentList($params = [])
{
- $where = empty($params['where']) ? ['is_enable'=>1] : $params['where'];
+ $where = empty($params['where']) ? [] : $params['where'];
+ $where['is_enable'] = isset($params['is_enable']) ? intval($params['is_enable']) : 1;
+
$data = M('Payment')->where($where)->field('id,logo,name,sort,payment,config,apply_terminal,apply_terminal,element,is_enable')->order('sort asc')->select();
if(!empty($data) && is_array($data))
{
diff --git a/service/Public/Admin/Default/Css/Order.css b/service/Public/Admin/Default/Css/Order.css
index 9944a4ebdfb8c3bf659114861605c52ec06e139a..d6e274085c37df2dc6269e6220c387ba3b25048f 100755
--- a/service/Public/Admin/Default/Css/Order.css
+++ b/service/Public/Admin/Default/Css/Order.css
@@ -23,4 +23,23 @@
.am-table .goods-item { padding: 5px 0; }
.am-table .goods-item, .am-table .goods-item .base { overflow: hidden; }
.am-table .goods-item .other .fl { width: 60%; }
-.am-table .goods-item:not(:last-child) { border-bottom: 1px solid #eee; }
\ No newline at end of file
+.am-table .goods-item:not(:last-child) { border-bottom: 1px solid #eee; }
+
+
+/**
+ * 快递弹窗
+ */
+.business-item h3 { border-bottom: 3px solid #e3e3e3; margin:5px 0 0 0; font-size: 14px;font-weight: 700; }
+.business-item ul { padding: 10px 3px 5px 5px; overflow: hidden; }
+.business-item ul li { border:1px solid transparent ;overflow: hidden; float: left; cursor: pointer; padding: 5px; border: 1px solid #eee; margin: 0 10px 10px 0; }
+.business-item ul li img { width: 36px; height: 36px; }
+.business-item ul li.selected { border-color: #d2364c ; position: relative; }
+.business-item ul li.selected i.icon-active { position: absolute; width: 10px; height: 10px; font-size: 0; line-height: 0; right: 0px; bottom: 0px; background: url(../Images/sys_item_selected.gif) no-repeat right bottom; }
+@media only screen and (min-width:640px) {
+ .business-item ul li {width:calc(33% - 5px); }
+ .business-item ul li:nth-child(3n) { margin-right: 0; }
+}
+@media only screen and (max-width:640px) {
+ .business-item ul li { width: calc(50% - 5px); }
+ .business-item ul li:nth-child(2n) { margin-right: 0; }
+}
\ No newline at end of file
diff --git a/service/Public/Admin/Default/Images/sys_item_selected.gif b/service/Public/Admin/Default/Images/sys_item_selected.gif
new file mode 100755
index 0000000000000000000000000000000000000000..704bbf53595b63716bcb4aecfb57100455cbdddb
Binary files /dev/null and b/service/Public/Admin/Default/Images/sys_item_selected.gif differ
diff --git a/service/Public/Admin/Default/Js/Order.js b/service/Public/Admin/Default/Js/Order.js
index 88ad04cb5579c92f6aec04035b3298e8856c5162..9ae1fd3683e18ce38e8960b40fddda592b1d6848 100755
--- a/service/Public/Admin/Default/Js/Order.js
+++ b/service/Public/Admin/Default/Js/Order.js
@@ -1,4 +1,51 @@
$(function()
{
+ // 支付操作
+ $('.submit-delivery').on('click', function()
+ {
+ $('form.delivery-form input[name=id]').val($(this).data('id'));
+ $('form.delivery-form input[name=express_number]').val('');
+ var express_id = $(this).data('express-id') || 0;
+ var user_id = $(this).data('user-id') || 0;
+ if($('.express-items-'+express_id).length > 0)
+ {
+ $('form.delivery-form input[name=express_id]').val(express_id);
+ $('form.delivery-form input[name=user_id]').val(user_id);
+ $('.express-items-'+express_id).addClass('selected').siblings('li').removeClass('selected');
+ } else {
+ $('form.delivery-form input[name=express_id]').val(0);
+ $('form.delivery-form input[name=user_id]').val(0);
+ $('ul.express-list li.selected').removeClass('selected');
+ }
+ });
+ // 混合列表选择
+ $('.business-item ul li').on('click', function()
+ {
+ if($(this).hasClass('selected'))
+ {
+ $('form.delivery-form input[name='+$(this).parent().data('type')+'_id]').val(0);
+ $(this).removeClass('selected');
+ } else {
+ $('form.delivery-form input[name='+$(this).parent().data('type')+'_id]').val($(this).data('value'));
+ $(this).addClass('selected').siblings('li').removeClass('selected');
+ }
+ });
+
+ // 发货表单
+ $('form.delivery-form button[type=submit]').on('click', function()
+ {
+ var id = $('form.delivery-form input[name=id]').val() || 0;
+ if(id == 0)
+ {
+ Prompt('订单id有误');
+ return false;
+ }
+ var express_id = $('form.delivery-form input[name=express_id]').val() || 0;
+ if(express_id == 0)
+ {
+ Prompt('请选择快递方式');
+ return false;
+ }
+ });
});
\ No newline at end of file
diff --git a/service/Public/Home/Default/Js/Order.js b/service/Public/Home/Default/Js/Order.js
index 6c8093162daa7a4c5038e84bfd756e92fb3a5d36..7dad4f38d44e995b16eb0bd737cf8e0c61cf5162 100644
--- a/service/Public/Home/Default/Js/Order.js
+++ b/service/Public/Home/Default/Js/Order.js
@@ -42,8 +42,10 @@ $(function()
{
if($(this).hasClass('selected'))
{
+ $('form.pay-form input[name='+$(this).parent().data('type')+'_id]').val(0);
$(this).removeClass('selected');
} else {
+ $('form.pay-form input[name='+$(this).parent().data('type')+'_id]').val($(this).data('value'));
$(this).addClass('selected').siblings('li').removeClass('selected');
}
});