1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace app\api\controller;
- class Sellerbill extends MobileSeller
- {
- public function initialize()
- {
- parent::initialize();
- }
-
- public function bill_list()
- {
- $bill_model = model('bill');
- $condition = array();
- $condition[] = array('ob_store_id', '=', $this->store_info['store_id']);
- if (preg_match('/^\d+$/', input('post.ob_no'))) {
- $condition[] = array('ob_no', '=', intval(input('post.ob_no')));
- }
- if (is_numeric(input('post.bill_state'))) {
- $condition[] = array('ob_state', '=', intval(input('post.bill_state')));
- }
- $bill_list = $bill_model->getOrderbillList($condition, '*', $this->pagesize, 'ob_state asc,ob_no asc');
- foreach ($bill_list as $k => $v) {
- $bill_list[$k]['ob_time'] = date('Y-m-d', $v['ob_startdate']) . ' ~ ' . date('Y-m-d', $v['ob_enddate']);
- $bill_list[$k]['ob_states'] = get_bill_state($v['ob_state']);
- }
- $result = array_merge(array('bill_list' => $bill_list), mobile_page($bill_model->page_info));
- ds_json_encode(10000, lang('ds_common_op_succ'), $result);
- }
-
- public function confirm_bill()
- {
- $ob_no = input('param.ob_no');
- if (!$ob_no) {
- ds_json_encode(10001, lang('param_error'));
- }
- $bill_model = model('bill');
- $condition = array();
- $condition[] = array('ob_no', '=', $ob_no);
- $condition[] = array('ob_store_id', '=', session('store_id'));
- $condition[] = array('ob_state', '=', BILL_STATE_CREATE);
- $bill_info = $bill_model->getOrderbillInfo($condition);
- if (!$bill_info) {
- ds_json_encode(10001, lang('bill_is_not_exist'));
- }
- $update = $bill_model->editOrderbill(array('ob_state' => BILL_STATE_STORE_COFIRM), $condition);
- if ($update) {
- ds_json_encode(10000, lang('ds_common_op_succ'));
- } else {
- ds_json_encode(10001, lang('ds_common_op_fail'));
- }
- }
- }
|