123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- namespace App\Models\Traits\Orders;
- /**
- * 订单状态
- *
- */
- trait Status
- {
- // 交易类型 与 支付方式
- private $statusList = ['0'=>[
- 'id' =>0,
- 'name' =>'创建订单',// 未付款
- 'state' =>'待付款',
- ],'1'=>[
- 'id' =>1,
- 'name' =>'创建订单',// 未付款,系统报单不走支付流程的状态
- 'state' =>'进行中',
- ],'2'=>[
- 'id' =>2,
- 'name' =>'已付款未发货',// 已付款未发货
- 'state' =>'待发货',
- ],'3'=>[
- 'id' =>3,
- 'name' =>'已发货未收货',// 已发货未收货
- 'state' =>'待收货',
- ],'4'=>[
- 'id' =>4,
- 'name' =>'已取消',// 已取消
- 'state' =>'已取消',
- ],'5'=>[
- 'id' =>5,
- 'name' =>'退款中',// 退款中
- 'state' =>'退款中',
- ],'6'=>[
- 'id' =>6,
- 'name' =>'已退款',// 已退款
- 'state' =>'已退款',
- ],'7'=>[
- 'id' =>7,
- 'name' =>'已关闭',// 已关闭
- 'state' =>'已关闭',
- ],'8'=>[
- 'id' =>8,
- 'name' =>'已完成',// 已收货
- 'state' =>'已完成',
- ],'9'=>[
- 'id' =>9,
- 'name' =>'回执审核',// 回执审核
- 'state' =>'回执审核',
- ],'10'=>[
- 'id' =>10,
- 'name' =>'拼团中',// 回执审核
- 'state' =>'拼团中',
- ],'11'=>[
- 'id' =>11,
- 'name' =>'拼团失败',// 回执审核
- 'state' =>'拼团失败',
- ]];
- /**
- * 交易类型列表
- *
- */
- public function getStatusList(){
- // 返回数据
- return $this->statusList;
- }
- /**
- * 获取交易类型
- *
- * @param int $status 交易状态
- * @param string $field 字段
- *
- */
- public function getState($status,$field=''){
- // 获取交易类型
- $status = isset($this->statusList[$status]) ? $this->statusList[$status] : [];
- // 如果存在需要的字段
- if( $field ) return isset($status[$field]) ? $status[$field] : null;
- // 返回结果
- return $status;
- }
- /**
- * 获取交易类型
- *
- * @param string getWeibanStatus 交易状态
- *
- */
- public function getWeibanStatus($weibanStatus){
- // 状态列表
- $list = ['待付款'=>0,'待发货'=>2,'待收货'=>3,'已完成'=>8,'已退款'=>6,'取消交易'=>4];
- // 返回结果
- return isset($list[$weibanStatus]) ? $list[$weibanStatus] : 0;
- }
- }
|