|
@@ -379,11 +379,11 @@ class SalesroomModel{
|
|
|
$order_goods_saleshexiao_list[$k]['effect_begin_time'] = date('Y-m-d',$v['effect_begin_time']);
|
|
|
$order_goods_saleshexiao_list[$k]['effect_end_time'] = date('Y-m-d',$v['effect_end_time']);
|
|
|
//已核销次数
|
|
|
- $order_goods_saleshexiao_list[$k]['has_hexiao_count'] = $v['hexiao_count']-$v['remain_hexiao_count'];
|
|
|
+ $order_goods_saleshexiao_list[$k]['has_hexiao_count'] = $v['hexiao_count']-$v['hexiao_count'];
|
|
|
if($v['hexiao_type'] == 1){
|
|
|
if($v['hexiao_count'] == 0){
|
|
|
$order_goods_saleshexiao_list[$k]['hexiao_count'] = '无限';
|
|
|
- $order_goods_saleshexiao_list[$k]['remain_hexiao_count'] = '无限';
|
|
|
+ $order_goods_saleshexiao_list[$k]['hexiao_count'] = '无限';
|
|
|
$has_hexiao_count = M('lionfish_comshop_order_goods_saleshexiao_record')->where(array('order_id'=>$v['order_id'],'order_goods_id'=>$v['order_goods_id']))->sum('hexiao_count');
|
|
|
if(empty($has_hexiao_count)){
|
|
|
$has_hexiao_count = 0;
|
|
@@ -532,7 +532,7 @@ class SalesroomModel{
|
|
|
//订单核销信息表id
|
|
|
$hx_id = $order_goods_saleshexiao['id'];
|
|
|
//剩余核销数量
|
|
|
- $remain_hexiao_count = $order_goods_saleshexiao['remain_hexiao_count'];
|
|
|
+ $remain_hexiao_count = $order_goods_saleshexiao['hexiao_count'];
|
|
|
if($order_goods_saleshexiao['hexiao_count'] > 0) {
|
|
|
$hexiao_count = 0;
|
|
|
if ($hx_time > 0) {
|
|
@@ -547,10 +547,10 @@ class SalesroomModel{
|
|
|
|
|
|
$hexiao_data = array();
|
|
|
if ($hexiao_count == $remain_hexiao_count) {
|
|
|
- $hexiao_data['remain_hexiao_count'] = 0;
|
|
|
+ $hexiao_data['hexiao_count'] = 0;
|
|
|
$hexiao_data['is_hexiao_over'] = 1;
|
|
|
} else {
|
|
|
- $hexiao_data['remain_hexiao_count'] = $remain_hexiao_count - $hexiao_count;
|
|
|
+ $hexiao_data['hexiao_count'] = $remain_hexiao_count - $hexiao_count;
|
|
|
}
|
|
|
$hx_result = M('lionfish_comshop_order_goods_saleshexiao')->where(array('id' => $hx_id))->save($hexiao_data);
|
|
|
}else{
|
|
@@ -640,12 +640,12 @@ class SalesroomModel{
|
|
|
$saleshexiao_info['effect_begin_time'] = date('Y-m-d H:i',$saleshexiao_info['effect_begin_time']);
|
|
|
$saleshexiao_info['effect_end_time'] = date('Y-m-d H:i',$saleshexiao_info['effect_end_time']);
|
|
|
//已核销次数
|
|
|
- $saleshexiao_info['has_hexiao_count'] = $saleshexiao_info['hexiao_count']-$saleshexiao_info['remain_hexiao_count'];
|
|
|
+ $saleshexiao_info['has_hexiao_count'] = $saleshexiao_info['hexiao_count']-$saleshexiao_info['hexiao_count'];
|
|
|
|
|
|
if($saleshexiao_info['hexiao_type'] == 1){
|
|
|
if($saleshexiao_info['hexiao_count'] == 0){
|
|
|
$saleshexiao_info['hexiao_count'] = '无限';
|
|
|
- $saleshexiao_info['remain_hexiao_count'] = '无限';
|
|
|
+ $saleshexiao_info['hexiao_count'] = '无限';
|
|
|
}
|
|
|
}
|
|
|
$result['saleshexiao_info'] = $saleshexiao_info;
|
|
@@ -669,7 +669,7 @@ class SalesroomModel{
|
|
|
$is_finished = false;
|
|
|
}
|
|
|
if($v['hexiao_type'] == 1 && $v['is_hexiao_over'] == 0){//按次核销
|
|
|
- if($v['hexiao_count'] > 0 && $v['remain_hexiao_count'] > 0){
|
|
|
+ if($v['hexiao_count'] > 0 && $v['hexiao_count'] > 0){
|
|
|
$is_finished = false;
|
|
|
}
|
|
|
if($v['hexiao_count'] == 0){
|
|
@@ -714,7 +714,7 @@ class SalesroomModel{
|
|
|
public function get_hexiao_order_goods_can_refund_quantity($order_id,$order_goods_id){
|
|
|
$sales_hexiao_info = M('lionfish_comshop_order_goods_saleshexiao')->where(array('order_id'=>$order_id,'order_goods_id'=>$order_goods_id))->find();
|
|
|
if($sales_hexiao_info['hexiao_type'] == 1){
|
|
|
- $can_refund_quantity = floor($sales_hexiao_info['remain_hexiao_count']/$sales_hexiao_info['one_hexiao_count']);
|
|
|
+ $can_refund_quantity = floor($sales_hexiao_info['hexiao_count']/$sales_hexiao_info['one_hexiao_count']);
|
|
|
}else{
|
|
|
$can_refund_quantity = $sales_hexiao_info['goods_quantity']-$sales_hexiao_info['refund_quantity'];
|
|
|
}
|
|
@@ -797,12 +797,12 @@ class SalesroomModel{
|
|
|
$data['refund_quantity'] = $sales_hexiao_info['refund_quantity']+$refund_quantity;
|
|
|
if($sales_hexiao_info['hexiao_type'] == 0){
|
|
|
if($sales_hexiao_info['goods_quantity'] == $data['refund_quantity']){
|
|
|
- $data['remain_hexiao_count'] = 0;
|
|
|
+ $data['hexiao_count'] = 0;
|
|
|
$data['is_hexiao_over'] = 1;
|
|
|
}
|
|
|
}else{
|
|
|
//剩余核销数量
|
|
|
- $data['remain_hexiao_count'] = $sales_hexiao_info['remain_hexiao_count']-$refund_quantity*$sales_hexiao_info['one_hexiao_count'];
|
|
|
+ $data['hexiao_count'] = $sales_hexiao_info['hexiao_count']-$refund_quantity*$sales_hexiao_info['one_hexiao_count'];
|
|
|
if($sales_hexiao_info['goods_quantity'] == $data['refund_quantity']){
|
|
|
$data['is_hexiao_over'] = 1;
|
|
|
}
|
|
@@ -853,7 +853,7 @@ class SalesroomModel{
|
|
|
$hexiao_record['order_id'] = $v['order_id'];
|
|
|
$hexiao_record['order_goods_id'] = $v['order_goods_id'];
|
|
|
$hexiao_record['goods_id'] = $v['goods_id'];
|
|
|
- $hexiao_record['hexiao_count'] = $v['remain_hexiao_count'];
|
|
|
+ $hexiao_record['hexiao_count'] = $v['hexiao_count'];
|
|
|
$hexiao_record['smember_name'] = "商品过期自动使用";
|
|
|
$hexiao_record['is_admin'] = 1;
|
|
|
$hexiao_record['addtime'] = time();
|