diff --git a/service/Application/Home/View/Default/Order/Comments.html b/service/Application/Home/View/Default/Order/Comments.html
index ad06e00bf..6d5c16628 100755
--- a/service/Application/Home/View/Default/Order/Comments.html
+++ b/service/Application/Home/View/Default/Order/Comments.html
@@ -69,16 +69,20 @@
¥{{$goods.price}} x {{$goods.buy_number}}
-
+
+
+
+
-
-
|
diff --git a/service/Application/Home/View/Default/User/Index.html b/service/Application/Home/View/Default/User/Index.html
index 129bb0cd3..ed59c8565 100755
--- a/service/Application/Home/View/Default/User/Index.html
+++ b/service/Application/Home/View/Default/User/Index.html
@@ -48,7 +48,8 @@
-
diff --git a/service/Application/Service/OrderService.class.php b/service/Application/Service/OrderService.class.php
index cd73a9a09..00eb9c1cd 100755
--- a/service/Application/Service/OrderService.class.php
+++ b/service/Application/Service/OrderService.class.php
@@ -671,7 +671,7 @@ class OrderService
if($m->where($where)->save($upd_data))
{
// 库存扣除
- $ret = BuyService::OrderInventoryRollback(['order_id'=>$params['id'], 'order_data'=>$upd_data]);
+ $ret = BuyService::OrderInventoryRollback(['order_id'=>$order['id'], 'order_data'=>$upd_data]);
if($ret['status'] != 0)
{
// 事务回滚
@@ -763,7 +763,7 @@ class OrderService
if($m->where($where)->save($upd_data))
{
// 库存扣除
- $ret = BuyService::OrderInventoryDeduct(['order_id'=>$params['id'], 'order_data'=>$upd_data]);
+ $ret = BuyService::OrderInventoryDeduct(['order_id'=>$order['id'], 'order_data'=>$upd_data]);
if($ret['status'] != 0)
{
// 事务回滚
@@ -833,6 +833,9 @@ class OrderService
return DataReturn('状态不可操作['.$status_text.']', -1);
}
+ // 开启事务
+ $m->startTrans();
+
// 更新订单状态
$upd_data = [
'status' => 4,
@@ -841,6 +844,15 @@ class OrderService
];
if($m->where($where)->save($upd_data))
{
+ // 订单商品积分赠送
+ $ret = self::OrderGoodsIntegralGiving(['order_id'=>$order['id']]);
+ if($ret['status'] != 0)
+ {
+ // 事务回滚
+ $m->rollback();
+ return DataReturn($ret['msg'], -10);
+ }
+
// 用户消息
MessageService::MessageAdd($order['user_id'], '订单收货', '订单收货成功', 1, $order['id']);
@@ -848,8 +860,14 @@ class OrderService
$creator = isset($params['creator']) ? intval($params['creator']) : 0;
$creator_name = isset($params['creator_name']) ? htmlentities($params['creator_name']) : '';
self::OrderHistoryAdd($order['id'], $upd_data['status'], $order['status'], '收货', $creator, $creator_name);
+
+ // 提交事务
+ $m->commit();
return DataReturn(L('common_operation_collect_success'), 0);
}
+
+ // 事务回滚
+ $m->rollback();
return DataReturn(L('common_operation_collect_error'), -1);
}
@@ -1212,5 +1230,76 @@ class OrderService
return DataReturn('处理成功', 0, $result);
}
+ /**
+ * 订单商品积分赠送
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-11-14
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public static function OrderGoodsIntegralGiving($params = [])
+ {
+ // 请求参数
+ $p = [
+ [
+ 'checked_type' => 'empty',
+ 'key_name' => 'order_id',
+ 'error_msg' => '订单id有误',
+ ]
+ ];
+ $ret = params_checked($params, $p);
+ if($ret !== true)
+ {
+ return DataReturn($ret, -1);
+ }
+
+ // 订单
+ $order = M('Order')->field('id,user_id,status')->find(intval($params['order_id']));
+ if(empty($order))
+ {
+ return DataReturn('订单不存在或已删除,中止操作', 0);
+ }
+ if(!in_array($order['status'], [4]))
+ {
+ return DataReturn('当前订单状态不允许操作['.$params['order_id'].'-'.$order['status'].']', 0);
+ }
+
+ // 获取用户信息
+ $user_m = M('User');
+ $user = $user_m->field('id')->find(intval($order['user_id']));
+ if(empty($user))
+ {
+ return DataReturn('用户不存在或已删除,中止操作', 0);
+ }
+
+ // 获取订单商品
+ $goods_all = M('OrderDetail')->where(['order_id'=>$params['order_id']])->getField('goods_id', true);
+ if(!empty($goods_all))
+ {
+ $goods_m = M('Goods');
+ $log_m = M('OrderGoodsInventoryLog');
+ foreach($goods_all as $goods_id)
+ {
+ $give_integral = $goods_m->where(['id'=>$goods_id])->getField('give_integral');
+ if(!empty($give_integral))
+ {
+ // 用户积分添加
+ $user_integral = $user_m->where(['id'=>$user['id']])->getField('integral');
+ if(!$user_m->where(['id'=>$user['id']])->setInc('integral', $give_integral))
+ {
+ return DataReturn('用户积分赠送失败['.$params['order_id'].'-'.$goods_id.']', -10);
+ }
+
+ // 积分日志
+ UserService::UserIntegralLogAdd($user['id'], $user_integral, $user_integral+$give_integral, '订单商品完成赠送', 1);
+ }
+ }
+ return DataReturn('操作成功', 0);
+ }
+ return DataReturn('没有需要操作的数据', 0);
+ }
+
}
?>
\ No newline at end of file
diff --git a/service/Public/Home/Default/Css/Buy.css b/service/Public/Home/Default/Css/Buy.css
index 8b224d636..641c38229 100755
--- a/service/Public/Home/Default/Css/Buy.css
+++ b/service/Public/Home/Default/Css/Buy.css
@@ -147,11 +147,11 @@ ul.address-list, .business-item ul { overflow: hidden; }
/**
* 商品列表
*/
-.goods-detail img { width: 80px; height: 80px; }
-.goods-detail { position: relative; }
+.goods-detail img { width: 80px; height: 80px; position: absolute; }
+.goods-detail { position: relative; min-height: 80px; }
.goods-title { display: block; max-height: 36px; overflow: hidden; text-overflow: ellipsis; }
.goods-title:hover { text-decoration: underline; }
-.goods-base { position: absolute; top: 0; left: 85px; }
+.goods-base { float: left; top: 0; margin-left: 85px; }
.goods-attr { margin-top: 5px; }
.goods-attr li { color: #888; line-height: 16px; }
.original-price, .line-price { font-family: Verdana,Tahoma,arial; }
diff --git a/service/Public/Home/Default/Css/Order.Comments.css b/service/Public/Home/Default/Css/Order.Comments.css
index 31c1baead..002c20c1e 100755
--- a/service/Public/Home/Default/Css/Order.Comments.css
+++ b/service/Public/Home/Default/Css/Order.Comments.css
@@ -1,6 +1,7 @@
ul.rating {
overflow: hidden;
margin-bottom: 2px;
+ padding: 3px 5px;
}
ul.rating li {
float: left;
@@ -12,17 +13,28 @@ ul.rating li i.am-icon-star-o {
ul.rating li i.am-icon-star {
color: #d13b49;
}
-
+.rating-items {
+ margin-bottom: 0;
+}
+.rating-items .input-rating {
+ position: fixed;
+ top: -10000px;
+ left: -10000px;
+}
+.rating-items.am-form-error ul.rating {
+ background-color: #ffe7e7;
+}
/**
* 商品列表
*/
+.order-goods .base { width: 50%; }
.order-goods { margin-top: 20px; }
-.goods-detail img { width: 80px; height: 80px; }
-.goods-detail { position: relative; }
+.goods-detail img { width: 80px; height: 80px; position: absolute; }
+.goods-detail { position: relative; min-height: 80px; }
.goods-title { display: block; max-height: 36px; overflow: hidden; text-overflow: ellipsis; }
.goods-title:hover { text-decoration: underline; }
-.goods-base { position: absolute; top: 0; left: 85px; }
+.goods-base {float: left; top: 0; margin-left: 85px; }
.goods-attr { margin-top: 5px; }
.goods-attr li { color: #888; line-height: 16px; }
.original-price, .line-price { font-family: Verdana,Tahoma,arial; }
@@ -40,4 +52,9 @@ strong.total-price-content { color: #d2364c; font-size: 16px; }
.cart-content table tr .number { width: 20%; }
.cart-content table tr .total-price { width: 20%; }
.cart-content { margin-top: 20px; }
-}
\ No newline at end of file
+}
+@media only screen and (max-width:640px) {
+ .goods-detail img { width: 60px; height: 60px; }
+ .goods-base { margin-left: 65px; }
+ .goods-detail { min-height: 60px; }
+}
\ No newline at end of file
diff --git a/service/Public/Home/Default/Css/Order.Detail.css b/service/Public/Home/Default/Css/Order.Detail.css
index 3c0d4f426..4ca58885a 100755
--- a/service/Public/Home/Default/Css/Order.Detail.css
+++ b/service/Public/Home/Default/Css/Order.Detail.css
@@ -189,11 +189,11 @@ ul.progress li.current .title {
* 商品列表
*/
.order-goods { margin-top: 20px; }
-.goods-detail img { width: 80px; height: 80px; }
-.goods-detail { position: relative; }
+.goods-detail img { width: 80px; height: 80px; position: absolute; }
+.goods-detail { position: relative; min-height: 80px; }
.goods-title { display: block; max-height: 36px; overflow: hidden; text-overflow: ellipsis; }
.goods-title:hover { text-decoration: underline; }
-.goods-base { position: absolute; top: 0; left: 85px; }
+.goods-base { float: left; top: 0; margin-left: 85px; }
.goods-attr { margin-top: 5px; }
.goods-attr li { color: #888; line-height: 16px; }
.original-price, .line-price { font-family: Verdana,Tahoma,arial; }
diff --git a/service/Public/Home/Default/Css/Order.css b/service/Public/Home/Default/Css/Order.css
index 575126bb7..0f5170331 100755
--- a/service/Public/Home/Default/Css/Order.css
+++ b/service/Public/Home/Default/Css/Order.css
@@ -91,7 +91,6 @@ table.data-ongoing .base-operate { border-top: 1px dashed #fff1f5; }
*/
.goods-detail { position: relative; min-height: 80px; }
.goods-detail img { width: 80px; height: 80px; position: absolute; }
-.goods-detail { position: relative; }
.goods-title { display: block; max-height: 36px; overflow: hidden; text-overflow: ellipsis; }
.goods-title:hover { text-decoration: underline; }
.goods-base { float: left; top: 0; margin-left: 85px; }
diff --git a/service/Public/Home/Default/Css/User.Index.css b/service/Public/Home/Default/Css/User.Index.css
index 1c98bebc7..95d65067f 100755
--- a/service/Public/Home/Default/Css/User.Index.css
+++ b/service/Public/Home/Default/Css/User.Index.css
@@ -47,7 +47,7 @@ ul.order-base li span.am-badge{position: absolute; top: -7px; left: 55%;}
.nav-search{display: none;} .user-main{padding-top: 0;}
.user-content-body{padding: 0;}
.user-base{text-align: center; height: 210px;}
- .user-avatar{margin-bottom: 10px;}
+ .user-avatar{margin-bottom: 10px; margin-top: 10px; }
.user-base-left .items a:not(:last-child){margin-right: 20px;}
.user-base-right{position: absolute; right: 10px; top: 10px;}
ul.user-base-icon{left: 0; bottom: 0; width: 100%; padding: 5px 0;}
diff --git a/service/Public/Home/Default/Js/Order.js b/service/Public/Home/Default/Js/Order.js
index 859439029..4c11340c3 100755
--- a/service/Public/Home/Default/Js/Order.js
+++ b/service/Public/Home/Default/Js/Order.js
@@ -56,7 +56,7 @@ $(function()
{
$(this).parent().find('li').eq(i).find('i').removeClass('am-icon-star-o').addClass('am-icon-star');
}
- $(this).parents('td').find('input.input-rating').val(index+1);
+ $(this).parents('td').find('input.input-rating').val(index+1).trigger('blur');
});
// 是否自动开启支付窗口