|
@@ -47,9 +47,6 @@ Class Manage
|
|
}
|
|
}
|
|
public function list_api()
|
|
public function list_api()
|
|
{
|
|
{
|
|
- $header = array('门店类型', '门店编号', '门店名称', '订单号', '商品编码', '存货编码', '商品名称', '规格型号', '税率', '商品单价', '购买数量', '商品合计金额', '代理优惠金额', '商品实付金额', '礼品卡金额', '钱包金额','商品支付金额', '礼品卡名称', '礼品卡卡号', '代理商注册时间', '下单时间', '付款时间', '发货时间', '完成时间', '订单总数量', '订单总金额', '订单实付金额', '礼品卡金额', '钱包金额', '优惠券金额', '代理优惠金额', '订单状态', '退款状态', '退款时间', '退款金额','退卡金额','退现金金额', '收件人', '收件人手机', '收件人地址');
|
|
|
|
-
|
|
|
|
- $body = array();
|
|
|
|
$status = Dever::db('shop/sell_order')->config['status_manage'];
|
|
$status = Dever::db('shop/sell_order')->config['status_manage'];
|
|
$start = Dever::input('start');
|
|
$start = Dever::input('start');
|
|
$end = Dever::input('end');
|
|
$end = Dever::input('end');
|
|
@@ -96,116 +93,122 @@ Class Manage
|
|
}
|
|
}
|
|
$where['state'] = 1;
|
|
$where['state'] = 1;
|
|
$data = Dever::db('shop/sell_order')->getExcel($where);
|
|
$data = Dever::db('shop/sell_order')->getExcel($where);
|
|
- // print_R($data);die;
|
|
|
|
|
|
+ $header = array('门店类型', '门店编号', '门店名称', '订单号', '商品编码', '存货编码', '商品名称', '规格型号', '税率', '商品单价', '购买数量', '商品合计金额', '代理优惠金额', '商品实付金额', '礼品卡金额', '钱包金额','商品支付金额', '礼品卡名称', '礼品卡卡号', '代理商注册时间', '下单时间', '付款时间', '发货时间', '完成时间', '订单总数量', '订单总金额', '订单实付金额', '礼品卡金额', '钱包金额', '优惠券金额', '代理优惠金额', '订单状态', '退款状态', '退款时间', '退款金额','退卡金额','退现金金额', '收件人', '收件人手机', '收件人地址');
|
|
|
|
+
|
|
|
|
+ $body = array();
|
|
if ($data) {
|
|
if ($data) {
|
|
foreach ($data as $k => $v) {
|
|
foreach ($data as $k => $v) {
|
|
- $v['card'] = '';
|
|
|
|
- $v['card_code'] = '';
|
|
|
|
- if ($v['card_code_id']) {
|
|
|
|
- $code = Dever::db('card/code')->find($v['card_code_id']);
|
|
|
|
- if ($code) {
|
|
|
|
- $card_info = Dever::db('card/info')->find($code['card_id']);
|
|
|
|
- if ($card_info) {
|
|
|
|
- if (!$code['total_cash']) {
|
|
|
|
- $code['total_cash'] = $card_info['value'];
|
|
|
|
- }
|
|
|
|
- $v['card'] = $card_info['name'];
|
|
|
|
- $v['card_code'] = $code['card'];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ $shop_type = '';
|
|
if ($v['shop_type'] == 1) {
|
|
if ($v['shop_type'] == 1) {
|
|
- $v['shop_type_name'] = '体验店';
|
|
|
|
|
|
+ $shop_type = '体验店';
|
|
} elseif ($v['shop_type'] == 2) {
|
|
} elseif ($v['shop_type'] == 2) {
|
|
- $v['shop_type_name'] = '平台商城';
|
|
|
|
|
|
+ $shop_type = '平台商城';
|
|
}
|
|
}
|
|
- $shop = Dever::db('shop/info')->find(Array('id'=>$v['shop_id']));
|
|
|
|
- if (isset($shop) && $shop) {
|
|
|
|
- $data[$k]['shop_sid'] = $shop['sid'];
|
|
|
|
- $data[$k]['shop_name'] = $shop['name'];
|
|
|
|
|
|
+ $shop = Dever::db('shop/info')->find($v['shop_id']);
|
|
|
|
+ $sid = '';
|
|
|
|
+ $shop_name = '';
|
|
|
|
+ if ($shop) {
|
|
|
|
+ if (isset($shop['sid']) && $shop['sid'] ) {
|
|
|
|
+ $sid = $shop['sid'];
|
|
|
|
+ }
|
|
|
|
+ if (isset($shop['name']) && $shop['name']) {
|
|
|
|
+ $shop_name = $shop['name'];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- $zhuce = '';
|
|
|
|
- $address_contact = '';
|
|
|
|
- $address_mobile = '';
|
|
|
|
- $address_info = '';
|
|
|
|
- if ($v['address_id'] > 0) {
|
|
|
|
- $address = Dever::load('passport/address')->getOne($v['uid'], $v['address_id']);
|
|
|
|
- if($address) {
|
|
|
|
- $address_contact = $address['contact'];
|
|
|
|
- $address_mobile = $address['mobile'];
|
|
|
|
- $address_info = $address['address_info'];
|
|
|
|
- $member = Dever::db('agent/member')->find(array('mobile'=>$address['mobile']));
|
|
|
|
- if ($member) {
|
|
|
|
- $zhuce = date('Y-m-d H:i',$member['cdate']);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- $ps = Dever::db('shop/sell_order_ps')->find(array('order_id' => $v['id']));
|
|
|
|
- $cdate = strstr($v['cdate'], '-') ? $v['cdate'] : date('Y-m-d H:i', $v['cdate']);
|
|
|
|
|
|
+ $v['card'] = '';
|
|
|
|
+ if ($v['card_code_id']) {
|
|
|
|
+ $code = Dever::db('card/code')->find($v['card_code_id']);
|
|
|
|
+ if ($code) {
|
|
|
|
+ $card_info = Dever::db('card/info')->find($code['card_id']);
|
|
|
|
+ if ($card_info) {
|
|
|
|
+ if (!$code['total_cash']) {
|
|
|
|
+ $code['total_cash'] = $card_info['value'];
|
|
|
|
+ }
|
|
|
|
+ $v['card'] = $card_info['name'];
|
|
|
|
+ $v['card_code'] = $code['card'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $zhuce = '';
|
|
|
|
+ $address_contact = '';
|
|
|
|
+ $address_mobile = '';
|
|
|
|
+ $address_info = '';
|
|
|
|
+ if ($v['address_id'] > 0) {
|
|
|
|
+ $address = Dever::load('passport/address')->getOne($v['uid'], $v['address_id']);
|
|
|
|
+ if($address) {
|
|
|
|
+ $address_contact = $address['contact'];
|
|
|
|
+ $address_mobile = $address['mobile'];
|
|
|
|
+ $address_info = $address['address_info'];
|
|
|
|
+ $member = Dever::db('agent/member')->find(array('mobile'=>$address['mobile']));
|
|
|
|
+ if ($member) {
|
|
|
|
+ $zhuce = date('Y-m-d H:i',$member['cdate']);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $ps = Dever::db('shop/sell_order_ps')->find(array('order_id' => $v['id']));
|
|
|
|
+ $cdate = strstr($v['cdate'], '-') ? $v['cdate'] : date('Y-m-d H:i', $v['cdate']);
|
|
$paydate = isset($v['paydate']) && $v['paydate'] ? date('Y-m-d H:i', $v['paydate']) : '-';
|
|
$paydate = isset($v['paydate']) && $v['paydate'] ? date('Y-m-d H:i', $v['paydate']) : '-';
|
|
$operdate = ($ps && $ps['cdate']) ? date('Y-m-d H:i', $ps['cdate']) : '-';
|
|
$operdate = ($ps && $ps['cdate']) ? date('Y-m-d H:i', $ps['cdate']) : '-';
|
|
- $goods = Dever::db('shop/sell_order_goods')->select(Array('order_id'=>$v['id']));
|
|
|
|
- $fdate = '';
|
|
|
|
|
|
+ $fdate = '-';
|
|
if ($v['fdate']) {
|
|
if ($v['fdate']) {
|
|
$fdate = date('Y-m-d H:i',$v['fdate']);
|
|
$fdate = date('Y-m-d H:i',$v['fdate']);
|
|
}
|
|
}
|
|
- // print_R($v);die;
|
|
|
|
- foreach ($goods as $k1 => $v1) {
|
|
|
|
|
|
+ $refund_status = '';
|
|
|
|
+ $refund_cdate = '';
|
|
|
|
+ $refund_cash = '';
|
|
|
|
+ $ka = 0;
|
|
|
|
+ $money = 0;
|
|
|
|
+
|
|
|
|
+ $goods = Dever::db('shop/sell_order_goods')->select(Array('order_id'=>$v['id']));
|
|
|
|
+ foreach($goods as $k1 => $v1) {
|
|
$goods_info = Dever::load('goods/lib/info')->getInfoBySku($v1['goods_id'], $v1['sku_id']);
|
|
$goods_info = Dever::load('goods/lib/info')->getInfoBySku($v1['goods_id'], $v1['sku_id']);
|
|
- // print_R($goods_info);die;
|
|
|
|
if (isset($goods_info['sku'])) {
|
|
if (isset($goods_info['sku'])) {
|
|
$sku = $goods_info['sku']['string'];
|
|
$sku = $goods_info['sku']['string'];
|
|
} else {
|
|
} else {
|
|
$sku = '';
|
|
$sku = '';
|
|
}
|
|
}
|
|
- $goods_price = $v1['price']*$v1['num'];
|
|
|
|
- #代理优惠金额
|
|
|
|
- $dl_discount_cash = round($v1['discount_cash'],2);
|
|
|
|
- // $discount_cash = round($v['discount_cash'],2);
|
|
|
|
- #商品实付金额
|
|
|
|
- $price = round(($goods_price-$dl_discount_cash),2);
|
|
|
|
- // round(($goods_price/$v['oprice']*$v['price']),2);
|
|
|
|
- //round(($v['price']/$goods_price),2);
|
|
|
|
- #礼品卡金额
|
|
|
|
- $card_code_cash = round($v['card_code_cash'],2);
|
|
|
|
- #钱包金额
|
|
|
|
- $wallet_cash = round($v['wallet_cash'],2);
|
|
|
|
- #商品支付金额
|
|
|
|
- #
|
|
|
|
-
|
|
|
|
if ($k1 == 0) {
|
|
if ($k1 == 0) {
|
|
$total_cash = Dever::load("shop/lib/manage.getTotalCash", $v['id']);
|
|
$total_cash = Dever::load("shop/lib/manage.getTotalCash", $v['id']);
|
|
} else {
|
|
} else {
|
|
$total_cash = 0;
|
|
$total_cash = 0;
|
|
}
|
|
}
|
|
- $ka = 0;
|
|
|
|
- $money = 0;
|
|
|
|
- if ($v['status'] == 8 || $v['status'] == 6) {
|
|
|
|
- $num = $v1['num'];
|
|
|
|
- $refund_cash = $v1['price']*$v1['num'];
|
|
|
|
|
|
+ if ($v['status'] == 8 || $v['status'] == 6) {
|
|
|
|
+ $refund_status = '已退款';
|
|
|
|
+ $refund_cash = $v1['price']*$v1['num'];
|
|
if ($v['status'] == 8) {
|
|
if ($v['status'] == 8) {
|
|
if ($v['refund_cash'] && $v['refund_cash']>0) {
|
|
if ($v['refund_cash'] && $v['refund_cash']>0) {
|
|
- $money = $v['refund_cash'];
|
|
|
|
|
|
+ $money = $v['refund_cash']+$v['wallet_cash'];
|
|
}
|
|
}
|
|
if ($v['card_code_cash'] && $v['card_code_cash'] >0) {
|
|
if ($v['card_code_cash'] && $v['card_code_cash'] >0) {
|
|
$ka = $v['card_code_cash'];
|
|
$ka = $v['card_code_cash'];
|
|
}
|
|
}
|
|
|
|
+ if ($k1 == 0) {
|
|
|
|
+ $ka = $ka;
|
|
|
|
+ $money = $money;
|
|
|
|
+ } else {
|
|
|
|
+ $ka = 0;
|
|
|
|
+ $money = 0;
|
|
|
|
+ }
|
|
} elseif ($v['status'] == 6) {
|
|
} elseif ($v['status'] == 6) {
|
|
- if ($v['card_code_id'] && $v['card_code_id'] >0) {
|
|
|
|
- $ka = $v['refund_cash'];
|
|
|
|
|
|
+ if ($v1['status'] == 3) {
|
|
|
|
+ if ($v['card_code_id'] && $v['card_code_id'] >0) {
|
|
|
|
+
|
|
|
|
+ $ka = $v['refund_cash'];
|
|
|
|
+ } else {
|
|
|
|
+ $money = $v['refund_cash'];
|
|
|
|
+ }
|
|
|
|
+ $refund_status = '已退款';
|
|
} else {
|
|
} else {
|
|
- $money = $v['refund_cash'];
|
|
|
|
|
|
+ $refund_status = '正常';
|
|
|
|
+ $refund_cash = 0;
|
|
|
|
+ $ka = 0;
|
|
|
|
+ $money = 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- if ($k1 == 0) {
|
|
|
|
- $ka = $ka;
|
|
|
|
- $money = $money;
|
|
|
|
- } else {
|
|
|
|
- $ka = 0;
|
|
|
|
- $money = 0;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- $refund_status = '已退款';
|
|
|
|
|
|
+ // print_R($ka);die;
|
|
|
|
+
|
|
$refund_cdate = '';
|
|
$refund_cdate = '';
|
|
if ($v['shop_type'] == 1) {
|
|
if ($v['shop_type'] == 1) {
|
|
$refund = Dever::db('shop/sell_order_refund')->find(array('order_id'=>$v['id']));
|
|
$refund = Dever::db('shop/sell_order_refund')->find(array('order_id'=>$v['id']));
|
|
@@ -213,32 +216,16 @@ Class Manage
|
|
$refund_cdate = date('Y-m-d H:i',$refund['cdate']);
|
|
$refund_cdate = date('Y-m-d H:i',$refund['cdate']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- } else {
|
|
|
|
- #有退款的情况
|
|
|
|
- if ($v['refund_status'] == 3 && $v1['status'] == 3) {
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if ($v['refund_status'] == 3 && $v1['status'] == 3) {
|
|
|
|
+ $refund_cash = $v1['num']*$v1['price'];
|
|
|
|
+ if ($v['card_code_id'] && $v['card_code_id'] >0) {
|
|
|
|
+ $ka = $v['refund_cash'];
|
|
|
|
+ } else {
|
|
|
|
+ $money = $v['refund_cash'];
|
|
|
|
+ }
|
|
|
|
+ // $refund_status = '已退款';
|
|
$refund_status = '有退款';
|
|
$refund_status = '有退款';
|
|
- $refund_cash = $v1['num']*$v1['price'];
|
|
|
|
- if ($refund_cash)
|
|
|
|
- if ($v['refund_cash']>$refund_cash) {
|
|
|
|
- if ($k1 == 0) {
|
|
|
|
- if ($v['card_code_cash'] && $v['card_code_cash'] >0) {
|
|
|
|
- $ka = $v['refund_cash'];
|
|
|
|
- } else {
|
|
|
|
- $money = $v['refund_cash'];
|
|
|
|
- }
|
|
|
|
- }else {
|
|
|
|
- $ka = 0;
|
|
|
|
- $money = 0;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if ($v['card_code_id'] && $v['card_code_id'] >0) {
|
|
|
|
- $ka = $v['refund_cash'];
|
|
|
|
- } else {
|
|
|
|
- $money = $v['refund_cash'];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
$refund_cdate = '';
|
|
$refund_cdate = '';
|
|
if ($v['shop_type'] == 1) {
|
|
if ($v['shop_type'] == 1) {
|
|
$refund = Dever::db('shop/sell_order_refund')->find(array('order_id'=>$v['id']));
|
|
$refund = Dever::db('shop/sell_order_refund')->find(array('order_id'=>$v['id']));
|
|
@@ -246,156 +233,203 @@ Class Manage
|
|
$refund_cdate = date('Y-m-d H:i',$refund['cdate']);
|
|
$refund_cdate = date('Y-m-d H:i',$refund['cdate']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- $refund_cdate = '';
|
|
|
|
- $num = '0';
|
|
|
|
|
|
+ } else {
|
|
|
|
+ $refund_cdate = '';
|
|
$refund_cash = '0';
|
|
$refund_cash = '0';
|
|
$refund_status = '未退款';
|
|
$refund_status = '未退款';
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // if ($v['status'] >=7) {
|
|
|
|
- // $v['price'] = 0;
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- if ($k1 == 0) {
|
|
|
|
- $v['num'] = $v['num'];
|
|
|
|
- $zhifu = round($v['price'],2);
|
|
|
|
- $coupon_cash = round($v['coupon_cash'],2);#优惠券金额
|
|
|
|
- $card_code_cash = round($v['card_code_cash'],2);#礼品卡金额
|
|
|
|
- $wallet_cash = round($v['wallet_cash'],2);#钱包金额
|
|
|
|
- $discount_cash = round($v['discount_cash'],2);
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- $v['num'] = 0;
|
|
|
|
-
|
|
|
|
- $zhifu = 0;
|
|
|
|
- $v['wallet_cash'] = 0;
|
|
|
|
- $coupon_cash = 0;
|
|
|
|
- $card_code_cash = 0;
|
|
|
|
- $wallet_cash = 0;
|
|
|
|
- $discount_cash = 0;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- // print_R($v['price']);die;
|
|
|
|
- $d = array
|
|
|
|
- (
|
|
|
|
- $v['shop_type_name'],
|
|
|
|
- $data[$k]['shop_sid'],
|
|
|
|
- $data[$k]['shop_name'],
|
|
|
|
- $v['order_num'],
|
|
|
|
- $goods_info['code'] . "\t",
|
|
|
|
- $goods_info['cunhuo_code'] . "\t",
|
|
|
|
- $goods_info['name'],
|
|
|
|
- $sku,
|
|
|
|
- $goods_info['tax'],
|
|
|
|
-
|
|
|
|
- round($v1['price'], 2),//商品单价
|
|
|
|
- round($v1['num'],2),//商品数量
|
|
|
|
- round($v1['price']*$v1['num'], 2),//商品合计金额
|
|
|
|
- $dl_discount_cash,//代理商优惠金额
|
|
|
|
- $price,//商品实付金额
|
|
|
|
- $card_code_cash,//礼品卡
|
|
|
|
- $wallet_cash, //钱包
|
|
|
|
- $zhifu,//商品支付
|
|
|
|
- $v['card'],
|
|
|
|
- $v['card_code']."\t",
|
|
|
|
- $zhuce,
|
|
|
|
- $cdate,
|
|
|
|
- $paydate,
|
|
|
|
- $operdate,
|
|
|
|
- $fdate,
|
|
|
|
- $v['num'],//订单总量
|
|
|
|
- sprintf('%01.2f',$total_cash),//订单总金额
|
|
|
|
- $zhifu,//订单实付
|
|
|
|
- $card_code_cash,//礼品卡
|
|
|
|
- $wallet_cash,//钱包
|
|
|
|
- $coupon_cash,//优惠券
|
|
|
|
- $discount_cash,//代理优惠
|
|
|
|
- $status[$v['status']],
|
|
|
|
- $refund_status,
|
|
|
|
- $refund_cdate,
|
|
|
|
- round($refund_cash, 2),
|
|
|
|
- round($ka,2),
|
|
|
|
- round($money,2),
|
|
|
|
- $address_contact,
|
|
|
|
- $address_mobile,
|
|
|
|
- $address_info,
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- // $body[] = $d;
|
|
|
|
- if ($goods_info['price_type'] > 2 && isset($goods_info['goods']) && is_array($goods_info['goods'])) {
|
|
|
|
-
|
|
|
|
- foreach ($goods_info['goods'] as $k2 => $v2) {
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // print_R($goods);die;
|
|
|
|
+ // print_R($goods_info);
|
|
|
|
+ if ($goods_info['price_type'] > 2 && isset($goods_info['goods']) && is_array($goods_info['goods'])) {
|
|
|
|
+ $heji = 0;
|
|
|
|
+ $heji = $this->total($goods);
|
|
|
|
+ // print_R($heji);die;
|
|
|
|
+ foreach ($goods_info['goods'] as $key => $val) {
|
|
|
|
+ // $val['price']-($val['price']*)
|
|
|
|
+ $youhui = ($val['price']*($val['num']+$v1['num'])-($val['price']*($val['num']+$v1['num'])/$heji)*$v['price'])*$v1['num'];
|
|
|
|
+ $card_price = ($v['card_code_cash']/$heji*($val['price']*($val['num']+$v1['num'])))*$v1['num'];
|
|
|
|
+ $wallet_price = ($v['wallet_cash']/$heji*($val['price']*($val['num']+$v1['num'])))*$v1['num'];
|
|
|
|
+ $goodsfu = $val['price']*($val['num']+$v1['num'])-$youhui-$card_price-$wallet_price;
|
|
|
|
+ if ($key == 0) {
|
|
|
|
+ $price = round($v1['price']*$v1['num']-$v1['discount_cash'],2);
|
|
|
|
+ $shifu = round($v['price'],2);//实付金额
|
|
|
|
+ $order_num = $v1['num'];#订单总数量
|
|
|
|
+ $oprice = round($v1['price']*$v1['num'],2);#订单总金额
|
|
|
|
+ $coupon_cash = round($v1['coupon_cash'],2);
|
|
|
|
+ $discount_cash = round($v1['discount_cash'],2);
|
|
|
|
+ $card_code_cash = round($v['card_code_cash'],2);
|
|
|
|
+ $wallet_cash = round($v['wallet_cash'],2);
|
|
|
|
+ } else {
|
|
|
|
+ $price = 0;
|
|
|
|
+ $shifu = 0;
|
|
|
|
+ $order_num = 0;
|
|
|
|
+ $oprice = 0;#订单总金额
|
|
|
|
+ $coupon_cash = 0;
|
|
|
|
+ $discount_cash = 0;
|
|
|
|
+ $card_code_cash = 0;
|
|
|
|
+ $wallet_cash = 0;
|
|
|
|
+ }
|
|
|
|
+ if($v1['num']>1) {
|
|
|
|
+ $dnum = round($val['num']+$v1['num'],2);
|
|
|
|
+ } else {
|
|
|
|
+ $dnum = round($val['num'],2);
|
|
|
|
+ }
|
|
|
|
|
|
- if ($v2['code']) {
|
|
|
|
- //$v2['code'] = '-' . $v2['code'];
|
|
|
|
- }
|
|
|
|
- $p = $v2['price'];
|
|
|
|
- if (is_numeric($v2['num']) && is_numeric($v2['price'])) {
|
|
|
|
- $p = $v2['price']*$v2['num'];
|
|
|
|
- }
|
|
|
|
- $goods_price1 = 0;
|
|
|
|
-
|
|
|
|
- $d = array
|
|
|
|
|
|
+ $d = array
|
|
(
|
|
(
|
|
- $v['shop_type_name'],
|
|
|
|
- $data[$k]['shop_sid'],
|
|
|
|
- $data[$k]['shop_name'],
|
|
|
|
|
|
+ $shop_type,
|
|
|
|
+ $sid,
|
|
|
|
+ $shop_name,
|
|
$v['order_num'],
|
|
$v['order_num'],
|
|
- $v2['code'] . "\t",
|
|
|
|
- $goods_info['cunhuo_code'] . "\t",
|
|
|
|
- $goods_info['name'],
|
|
|
|
|
|
+ $val['code']."\t",
|
|
|
|
+ $goods_info['cunhuo_code']."\t",
|
|
|
|
+ $val['name'].'('.$goods_info['name'].')',
|
|
$sku,
|
|
$sku,
|
|
$goods_info['tax'],
|
|
$goods_info['tax'],
|
|
|
|
|
|
- round($goods_info['price'], 2),#单价
|
|
|
|
- round($v1['num'],2),#数量
|
|
|
|
- round(($goods_info['price']*$v1['num']),2),#商品合计金额
|
|
|
|
- $dl_discount_cash,//代理商优惠金额
|
|
|
|
- $price,#实付金额
|
|
|
|
- $card_code_cash,#礼品卡金额
|
|
|
|
- $wallet_cash,#钱包金额
|
|
|
|
- $zhifu,#商品支付金额
|
|
|
|
|
|
+ round($val['price'],2),
|
|
|
|
+ $dnum,
|
|
|
|
+ round(($val['price']*($val['num']+$v1['num'])),2),
|
|
|
|
+ round($youhui,2),
|
|
|
|
+ $goodsfu,
|
|
|
|
+ $card_price,
|
|
|
|
+ $wallet_price,
|
|
|
|
+ $price,
|
|
|
|
+
|
|
$v['card'],
|
|
$v['card'],
|
|
- $v['card_code']."\t",
|
|
|
|
|
|
+ $v['card_code_card']."\t",
|
|
$zhuce,
|
|
$zhuce,
|
|
$cdate,
|
|
$cdate,
|
|
$paydate,
|
|
$paydate,
|
|
$operdate,
|
|
$operdate,
|
|
$fdate,
|
|
$fdate,
|
|
- $v['num'],
|
|
|
|
- sprintf('%01.2f',$total_cash),
|
|
|
|
- $zhifu,//订单实付
|
|
|
|
- $card_code_cash,//礼品卡
|
|
|
|
- $wallet_cash,//钱包
|
|
|
|
- $coupon_cash,//优惠券
|
|
|
|
- $discount_cash,//代理优惠
|
|
|
|
- $status[$v['status']],
|
|
|
|
|
|
+
|
|
|
|
+ $order_num,
|
|
|
|
+ $oprice,
|
|
|
|
+ $price,
|
|
|
|
+ $card_code_cash,
|
|
|
|
+ $wallet_cash,
|
|
|
|
+ $coupon_cash,
|
|
|
|
+ $discount_cash,
|
|
|
|
+
|
|
|
|
+ $status[$v['status']],
|
|
$refund_status,
|
|
$refund_status,
|
|
$refund_cdate,
|
|
$refund_cdate,
|
|
|
|
+
|
|
round($refund_cash, 2),
|
|
round($refund_cash, 2),
|
|
round($ka,2),
|
|
round($ka,2),
|
|
round($money,2),
|
|
round($money,2),
|
|
|
|
+
|
|
$address_contact,
|
|
$address_contact,
|
|
$address_mobile,
|
|
$address_mobile,
|
|
$address_info,
|
|
$address_info,
|
|
);
|
|
);
|
|
|
|
+ $body[] = $d;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if ($k1 == 0) {
|
|
|
|
+ $discount_cash = round($v['discount_cash'],2);
|
|
|
|
+ $card_code_cash = round($v['card_code_cash'],2);
|
|
|
|
+ $wallet_cash = round($v['wallet_cash'],2);
|
|
|
|
+ $zhifu = $v['price'];
|
|
|
|
+ $total = $v['oprice']-($card_code_cash + $wallet_cash + $discount_cash+$zhifu);
|
|
|
|
+ $order_num = $v['num'];//订单总数量
|
|
|
|
+ $oprice = round($v['oprice'],2);#订单总金额
|
|
|
|
+ $coupon_cash = round($v['coupon_cash'],2);
|
|
|
|
+ } else {
|
|
|
|
+ $discount_cash = 0;
|
|
|
|
+ $card_code_cash = 0;
|
|
|
|
+ $wallet_cash = 0;
|
|
|
|
+ $total = 0;
|
|
|
|
+ $zhifu = 0;
|
|
|
|
+ $order_num = 0;
|
|
|
|
+ $oprice = 0;
|
|
|
|
+ $coupon_cash = 0;
|
|
|
|
+ }
|
|
|
|
+ // print_R($v1['price']*$v1['num']/$v['oprice']*$v['price']);die;
|
|
|
|
+ $dyouhui = round($v1['discount_cash'],2);
|
|
|
|
+ // ($v1['price']*$v1['num']/$v['oprice']*$v['price']);
|
|
|
|
+ // print_R($dyouhui);die;
|
|
|
|
+ $dcard_price = $v['card_code_cash']/$v['oprice']*($v1['price']*$v1['num']);
|
|
|
|
+ $dwallet_price = $v['wallet_cash']/$v['oprice']*($v1['price']*$v1['num']);
|
|
|
|
+ $dgoodsfu = $v1['price']*$v1['num']-$dyouhui-$dcard_price-$dwallet_price;
|
|
|
|
+ if ($dgoodsfu<0){
|
|
|
|
+ $dgoodsfu = 0;
|
|
|
|
+ }
|
|
|
|
+ $d = array
|
|
|
|
+ (
|
|
|
|
+ $shop_type,
|
|
|
|
+ $sid,
|
|
|
|
+ $shop_name,
|
|
|
|
+ $v['order_num'],
|
|
|
|
+ $goods_info['code']."\t",
|
|
|
|
+ $goods_info['cunhuo_code']."\t",
|
|
|
|
+ $goods_info['name'],
|
|
|
|
+ $sku,
|
|
|
|
+ $goods_info['tax'],
|
|
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- $body[] = $d;
|
|
|
|
|
|
+ round($v1['price'],2),
|
|
|
|
+ round($v1['num'],2),
|
|
|
|
+ round(($v1['price']*$v1['num']),2),
|
|
|
|
+ round($dyouhui,2),
|
|
|
|
+ $dgoodsfu,
|
|
|
|
+ $dcard_price,
|
|
|
|
+ $dwallet_price,
|
|
|
|
+ $zhifu,
|
|
|
|
+
|
|
|
|
+ $v['card'],
|
|
|
|
+ $v['card_code_card']."\t",
|
|
|
|
+ $zhuce,
|
|
|
|
+ $cdate,
|
|
|
|
+ $paydate,
|
|
|
|
+ $operdate,
|
|
|
|
+ $fdate,
|
|
|
|
+
|
|
|
|
+ $order_num,
|
|
|
|
+ sprintf('%01.2f',$total_cash),
|
|
|
|
+ $zhifu,
|
|
|
|
+ $card_code_cash,
|
|
|
|
+ $wallet_cash,
|
|
|
|
+ $coupon_cash,//优惠券
|
|
|
|
+ $discount_cash,//代理优惠
|
|
|
|
+
|
|
|
|
+ $status[$v['status']],
|
|
|
|
+ $refund_status,
|
|
|
|
+ $refund_cdate,
|
|
|
|
+
|
|
|
|
+ round($refund_cash, 2),
|
|
|
|
+ round($ka,2),
|
|
|
|
+ round($money,2),
|
|
|
|
+
|
|
|
|
+ $address_contact,
|
|
|
|
+ $address_mobile,
|
|
|
|
+ $address_info,
|
|
|
|
+
|
|
|
|
+ );
|
|
|
|
+ $body[] = $d;
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
if (!$body) {
|
|
if (!$body) {
|
|
Dever::alert('此时段没有数据,请重新选择条件');
|
|
Dever::alert('此时段没有数据,请重新选择条件');
|
|
}
|
|
}
|
|
$file = '商品销售相关数据';
|
|
$file = '商品销售相关数据';
|
|
- return Dever::excelExport($body, $header, $file);
|
|
|
|
|
|
+ return Dever::excelExport($body, $header, $file);
|
|
|
|
+ }
|
|
|
|
+ public function total($goods){
|
|
|
|
+ // print_R($goods);die;
|
|
|
|
+ if ($goods) {
|
|
|
|
+ $price = 0;
|
|
|
|
+ foreach ($goods as $k => $v) {
|
|
|
|
+ $price += $v['price'] * $v['num'];
|
|
|
|
+ }
|
|
|
|
+ return $price;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
public function memberGoods_api()
|
|
public function memberGoods_api()
|
|
{
|
|
{
|