|
@@ -370,7 +370,8 @@ Class Manage
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
- if ($info['status'] > 1 && $no_code > 0 && $info['status'] != 3 && time()<$active['act_start'] && $active['refund_type'] == 2) {
|
|
|
+ if ($info['status'] > 1 && $no_code > 0 && $info['status'] != 3 && $active['refund_type'] == 2) {
|
|
|
+ // && time()<$active['act_start']
|
|
|
if (Dever::load('manage/auth')->checkFunc('active.order', 'editrefund1', '未使用退款')) {
|
|
|
$purl = Dever::url('project/database/update?project=active&table=info_refund&search_option_order_id='.$info['id'].'&col=num,order_id', 'manage');
|
|
|
$button[] = array
|
|
@@ -438,10 +439,21 @@ Class Manage
|
|
|
}
|
|
|
$active = Dever::db('active/info')->find($v['active_id']);
|
|
|
$m = '';
|
|
|
- if ($v['status'] == 1 && time()<$active['act_start'] && $active['refund_type'] == 2) {
|
|
|
- $url = Dever::url('lib/manage.setOrder&order_id=' . $v['order_id'].'&code_id='.$v['id'], 'active');
|
|
|
- $m = '<a href="javascript:;" onclick="load( \''.$url.'\')" class="layui-btn">退款</a>';
|
|
|
+ if ($v['status'] == 1 && $active['refund_type'] == 2 ) {
|
|
|
+ // && time()<$active['act_start']
|
|
|
+ if ($active['refund_type'] == 2) {
|
|
|
+ if ($v['status']!=3) {
|
|
|
+ $url = Dever::url('project/database/update?project=active&table=info_refund_log&search_option_price='.$active['price'].'&search_option_code_id='.$v['id'].'&search_option_order_id='.$v['id'].'&col=price,order_id,code_id', 'manage');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ($v['status']==1) {
|
|
|
+ $url = Dever::url('project/database/update?project=active&table=info_refund_log&search_option_price='.$active['price'].'&search_option_code_id='.$v['id'].'&search_option_order_id='.$v['id'].'&col=price,order_id,code_id', 'manage');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // $url = Dever::url('lib/manage.setOrder&order_id=' . $v['order_id'].'&code_id='.$v['id'].'&col=price', 'active');
|
|
|
+ $m = '<a href="javascript:;" onclick="fastEdit($(this), \''.$url.'\')" class="layui-btn">退款</a>';
|
|
|
}
|
|
|
+
|
|
|
$d = array
|
|
|
(
|
|
|
$join_name,
|
|
@@ -468,6 +480,46 @@ Class Manage
|
|
|
return array();
|
|
|
}
|
|
|
}
|
|
|
+ public function insertInfoRefundLog($id,$name,$data)
|
|
|
+ {
|
|
|
+ $price = Dever::param('price',$data);
|
|
|
+ $order_id = Dever::param('order_id',$data);
|
|
|
+ $code_id = Dever::param('code_id',$data);
|
|
|
+ $order = Dever::db('active/order')->find($order_id);
|
|
|
+ $active = Dever::db('active/info')->find($order['info_id']);
|
|
|
+ if (!$price) {
|
|
|
+ Dever::alert('退款金额不能为空');
|
|
|
+ }
|
|
|
+ if ($price > $active['price']) {
|
|
|
+ Dever::alert('退款金额大于购买金额');
|
|
|
+ }
|
|
|
+ $data = Dever::db('active/info_refund_log')->find(Array('order_id'=>$order_id,'code_id'=>$code_id));
|
|
|
+ if($data) {
|
|
|
+ Dever::alert('不可重复退款');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function updateInfoRefundLog($id,$name,$data)
|
|
|
+ {
|
|
|
+ $price = Dever::param('price',$data);
|
|
|
+ $order_id = Dever::param('order_id',$data);
|
|
|
+ $code_id = Dever::param('code_id',$data);
|
|
|
+ $order = Dever::db('active/order')->find($order_id);
|
|
|
+ $where['order_id'] = $order_id;
|
|
|
+ $where['code_id'] = $code_id;
|
|
|
+ $where['price'] = $price;
|
|
|
+ $data = Dever::db('active/order')->find($order_id);
|
|
|
+ $ids = $this->common($data,3,false,false,$price);
|
|
|
+ if ($ids) {
|
|
|
+ Dever::db('active/info_refund_log')->insert($where);
|
|
|
+ $admin = Dever::load('manage/auth.info');
|
|
|
+ $w['where_id'] = $code_id;
|
|
|
+ $w['status'] = 3;
|
|
|
+ $w['offdate'] = time();
|
|
|
+ $w['audit_admin'] = $admin['id'];
|
|
|
+ Dever::db('active/code')->update($w);
|
|
|
+ }
|
|
|
+ return 'reload';
|
|
|
+ }
|
|
|
public function setOrder_api($order_id,$code_id){
|
|
|
$data = Dever::db('active/order')->find($order_id);
|
|
|
$ids = $this->common($data,3);
|
|
@@ -482,13 +534,14 @@ Class Manage
|
|
|
return 'reload';
|
|
|
}
|
|
|
|
|
|
- public function common($data,$type,$num=false,$refund_id=false){
|
|
|
+ public function common($data,$type,$num=false,$refund_id=false,$refund_price=false){
|
|
|
Dever::config('base')->hook = true;
|
|
|
$active = Dever::db('active/info')->find($data['active_id']);
|
|
|
$info = Dever::db('active/info_refund')->state(array('order_id'=>$data['id']));
|
|
|
if (time() > $active['act_start']) {
|
|
|
- Dever::alert('活动已开始,不能退款');
|
|
|
+ // Dever::alert('活动已开始,不能退款');
|
|
|
}
|
|
|
+
|
|
|
if ($type == 1) {
|
|
|
$code = Dever::db('active/code')->find(array('order_id'=>$data['id']));
|
|
|
if ($data['code_num'] > 0 || (isset($code) && $code)) {
|
|
@@ -506,9 +559,15 @@ Class Manage
|
|
|
}
|
|
|
if ($type == 3) {
|
|
|
$refund_num = 1;
|
|
|
- $price = $active['price'];
|
|
|
+ if ($refund_price) {
|
|
|
+ $price = $refund_price;
|
|
|
+ } else {
|
|
|
+ $price = $active['price'];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
$param = array
|
|
|
(
|
|
|
'project_id' => 6,
|