|
@@ -28,99 +28,47 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
{
|
|
|
$mod = Model('fetch_order');
|
|
|
|
|
|
+ $member_id = $_SESSION['member_id'];
|
|
|
$condition['store_id'] = $_SESSION['store_id'];
|
|
|
$condition['status'] = 1;
|
|
|
- $order_list = $mod->getFetchOrderList($condition,50);
|
|
|
+ $total_fetch_order = $mod->where($condition)->count();
|
|
|
+
|
|
|
+ $condition['member_id'] = $member_id;
|
|
|
+ $order_list = $mod->getFetchOrderList($condition,20);
|
|
|
+
|
|
|
Tpl::output('order_list', $order_list);
|
|
|
- Tpl::output('order_num', count($order_list));
|
|
|
+ Tpl::output('total_fetch_order', $total_fetch_order);
|
|
|
Tpl::output('show_page',$mod->showpage());
|
|
|
|
|
|
Tpl::showpage('store_refill_order.index');
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导出已支付订单
|
|
|
- *
|
|
|
- */
|
|
|
- public function export_pay_orderOp()
|
|
|
+ public function fetch_orderOp()
|
|
|
{
|
|
|
- $orders = [];
|
|
|
-
|
|
|
- $model_refill_order = Model('refill_order');
|
|
|
-
|
|
|
- $condition['vr_order.store_id'] = $_SESSION['store_id'];
|
|
|
- $condition['vr_order.order_state'] = ORDER_STATE_PAY;
|
|
|
- $condition['refill_order.inner_status'] = 0;
|
|
|
-
|
|
|
- $order_list = $model_refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.order_id asc');
|
|
|
- foreach ($order_list as $order) {
|
|
|
- $resp = $this->_order_send($order);
|
|
|
- if ($resp['state'] === true) {
|
|
|
- $tmp = [];
|
|
|
- $tmp[] = ['data' => $order['order_id']];
|
|
|
- $tmp[] = ['data' => $order['order_sn']];
|
|
|
- $tmp[] = ['data' => $order['card_no']];
|
|
|
- $tmp[] = ['data' => $order['refill_amount']];
|
|
|
-
|
|
|
- $orders[] = $tmp;
|
|
|
+ if (chksubmit()) {
|
|
|
+ $num = intval($_GET['num']);
|
|
|
+ $mod = Model('fetch_order');
|
|
|
+ $condition['status'] = 1;
|
|
|
+ $fetch_order = $mod->where($condition)->order('add_time desc')->limit($num)->select();
|
|
|
+ if(empty($fetch_order)) {
|
|
|
+ showDialog('暂无可抢订单','index.php?act=store_refill_order&op=index','error');
|
|
|
+ echo json_encode(['status' => false, 'msg' => "暂无可抢订单"]);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (empty($orders)) {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- Language::read('export');
|
|
|
- import('libraries.excel');
|
|
|
- $excel = new Excel();
|
|
|
- $excel->setStyle(['id' => 's_title', 'Font' => ['FontName' => '宋体', 'Size' => '12', 'Bold' => '1']]);
|
|
|
-
|
|
|
- $headers = [['styleid' => 's_title', 'data' => '编号'],
|
|
|
- ['styleid' => 's_title', 'data' => '订单号'],
|
|
|
- ['styleid' => 's_title', 'data' => '卡号'],
|
|
|
- ['styleid' => 's_title', 'data' => '充值金额']];
|
|
|
-
|
|
|
- $table[] = $headers;
|
|
|
- foreach ($orders as $order) {
|
|
|
- $table[] = $order;
|
|
|
+ $order_ids = '';
|
|
|
+ foreach ($fetch_order as $order)
|
|
|
+ {
|
|
|
+ $order_ids .= "{$order['order_id']},";
|
|
|
}
|
|
|
-
|
|
|
- $table = $excel->charset($table, CHARSET);
|
|
|
- $excel->addArray($table);
|
|
|
- $excel->addWorksheet($excel->charset("充值——已支付未处理订单", CHARSET));
|
|
|
-
|
|
|
- $len = count($orders);
|
|
|
- $time = date('Y-m-d', time());
|
|
|
- $start = $orders[0][0]['data'];
|
|
|
- $table_name = "{$time} {$start}-{$len}";
|
|
|
-
|
|
|
- $excel->generateXML($excel->charset($table_name, CHARSET));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function batch_sendOp()
|
|
|
- {
|
|
|
- if (chksubmit()) {
|
|
|
- $order_ids = trim($_GET['order_ids']);
|
|
|
- $model_refill_order = Model('refill_order');
|
|
|
-
|
|
|
- $condition['vr_order.order_id'] = ['in' , $order_ids];
|
|
|
-
|
|
|
- $order_list = $model_refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.order_id asc');
|
|
|
-
|
|
|
- foreach ($order_list as $key => $order_info){
|
|
|
- $resp = $this->_order_send($order_info);
|
|
|
- if($resp['state'] != true){
|
|
|
- if($key == 0){
|
|
|
- showDialog('处理失败','index.php?act=store_refill_order&op=index','error');
|
|
|
- echo json_encode(['status' => false, 'msg' => "处理失败"]);
|
|
|
- }else{
|
|
|
- showDialog("部分处理成功,成功数量:{$key}",'index.php?act=store_refill_order&op=index','error');
|
|
|
- echo json_encode(['status' => false, 'msg' => "部分处理成功,成功数量:{$key}"]);
|
|
|
- }
|
|
|
- exit;
|
|
|
- }
|
|
|
+ $order_ids = rtrim($order_ids,',');
|
|
|
+ $member_id = $_SESSION['member_id'];
|
|
|
+ $update_cond['order_id'] = ['in' , $order_ids];
|
|
|
+ $update_cond['memeber_id'] = $member_id;
|
|
|
+ $res = $mod->editFetchOrder(['status' => 2, 'member_id' => $member_id], $update_cond);
|
|
|
+ if($res) {
|
|
|
+ showDialog('抢单成功','index.php?act=store_refill_order&op=index','succ');
|
|
|
+ } else {
|
|
|
+ showDialog('抢单失败','index.php?act=store_refill_order&op=index','error');
|
|
|
}
|
|
|
- showDialog('处理成功','index.php?act=store_refill_order&op=index','succ');
|
|
|
} else {
|
|
|
$this->indexOp();
|
|
|
}
|