174 lines
4.2 KiB
PHP
174 lines
4.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* ThinkShop商城系统 - 团队十年电商经验汇集巨献!
|
|
* =========================================================
|
|
* Copy right 2019-2029 成都云之牛科技有限公司, 保留所有权利。
|
|
* ----------------------------------------------
|
|
* 官方网址: https://www.cdcloudshop.com
|
|
* =========================================================
|
|
*/
|
|
|
|
namespace addon\cashier\model\order;
|
|
|
|
|
|
use app\model\order\OrderCommon;
|
|
use app\model\order\OrderLog;
|
|
|
|
/**
|
|
* 订单创建(收银订单)
|
|
*
|
|
* @author Administrator
|
|
*
|
|
*/
|
|
class CashierOrder extends OrderCommon
|
|
{
|
|
//待付款
|
|
const ORDER_CREATE = 0;
|
|
// 订单已支付
|
|
const ORDER_PAY = 1;
|
|
// 订单已完成
|
|
const ORDER_COMPLETE = 10;
|
|
// 订单已关闭
|
|
const ORDER_CLOSE = -1;
|
|
|
|
/**
|
|
* 订单类型
|
|
*
|
|
* @var int
|
|
*/
|
|
public $order_type = 5;
|
|
|
|
//订单来源
|
|
public $order_from_list = [ 'cashier' => [ 'name' => '收银台' ] ];
|
|
public $order_status = [
|
|
self::ORDER_CREATE => [
|
|
'status' => self::ORDER_CREATE,
|
|
'name' => '待支付',
|
|
'is_allow_refund' => 0,
|
|
'icon' => 'public/uniapp/order/order-icon.png',
|
|
'action' => [
|
|
[
|
|
'action' => 'orderClose',
|
|
'title' => '关闭订单',
|
|
'color' => ''
|
|
]
|
|
],
|
|
'member_action' => [
|
|
[
|
|
'action' => 'orderClose',
|
|
'title' => '关闭订单',
|
|
'color' => ''
|
|
],
|
|
|
|
],
|
|
'color' => ''
|
|
],
|
|
self::ORDER_COMPLETE => [
|
|
'status' => self::ORDER_COMPLETE,
|
|
'name' => '已完成',
|
|
'is_allow_refund' => 1,
|
|
'icon' => 'public/uniapp/order/order-icon-received.png',
|
|
'action' => [
|
|
],
|
|
'member_action' => [
|
|
|
|
],
|
|
'color' => ''
|
|
],
|
|
self::ORDER_CLOSE => [
|
|
'status' => self::ORDER_CLOSE,
|
|
'name' => '已关闭',
|
|
'is_allow_refund' => 0,
|
|
'icon' => 'public/uniapp/order/order-icon-close.png',
|
|
'action' => [
|
|
|
|
],
|
|
'member_action' => [
|
|
|
|
],
|
|
'color' => ''
|
|
],
|
|
];
|
|
|
|
public $pay_type = array (
|
|
'cash' => '现金支付',
|
|
'own_wechatpay' => '个人微信',
|
|
'own_alipay' => '个人支付宝',
|
|
'own_pos' => '个人pos刷卡',
|
|
'ONLINE_PAY' => '在线支付',
|
|
);
|
|
|
|
protected $cashier_order_type = [
|
|
'goods' => '消费',
|
|
'card' => '售卡',
|
|
'recharge' => '充值',
|
|
];
|
|
//todo 切勿调用,占位
|
|
public $delivery_status_list = array (
|
|
0 => '待发货',
|
|
1 => '已发货',
|
|
2 => '已收货'
|
|
);
|
|
|
|
public function getPayType($params = [])
|
|
{
|
|
return $this->pay_type;
|
|
}
|
|
|
|
public function getCashierOrderType()
|
|
{
|
|
return $this->cashier_order_type;
|
|
}
|
|
|
|
public function orderPay()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public function refund($params)
|
|
{
|
|
return $this->success();
|
|
}
|
|
|
|
|
|
public function orderDetail($order_info)
|
|
{
|
|
return [];
|
|
}
|
|
|
|
|
|
/**
|
|
* 订单完成
|
|
* @param $params
|
|
*/
|
|
public function complete($params)
|
|
{
|
|
$site_id = $params[ 'site_id' ];
|
|
$order_id = $params[ 'order_id' ];
|
|
$cashier_order_model = new CashierOrder();
|
|
$cashier_data = array (
|
|
'order_status' => 10,
|
|
'finish_time' => time(),
|
|
'order_status_name' => $cashier_order_model->order_status[ 10 ][ 'name' ],
|
|
'order_status_action' => json_encode($cashier_order_model->order_status[ 10 ], JSON_UNESCAPED_UNICODE)
|
|
);
|
|
$cashier_condition = array (
|
|
[ 'order_id', '=', $order_id ],
|
|
);
|
|
model('order')->update($cashier_data, $cashier_condition);
|
|
|
|
$log_data = array (
|
|
'order_id' => $order_id,
|
|
'action' => 'complete',
|
|
'site_id' => $site_id,
|
|
'is_auto' => 1
|
|
);
|
|
( new OrderLog() )->addLog($log_data);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
}
|