| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "{{%purchase_order}}".
- *
- * @property integer $id
- * @property integer $cloud_order_id
- * @property integer $store_id
- * @property integer $user_id
- * @property integer $saas_id
- * @property string $order_no
- * @property string $total_price
- * @property string $pay_price
- * @property string $express_price
- * @property string $name
- * @property string $mobile
- * @property string $remark
- * @property integer $is_pay
- * @property integer $pay_type
- * @property integer $pay_time
- * @property integer $is_comment
- * @property integer $created_at
- * @property integer $is_delete
- * @property integer $is_sale
- * @property integer $is_recycle
- * @property string $alipay_trade_no
- * @property integer $cancel_examine
- * @property integer $cancel_examine_time
- * @property integer $province_id
- * @property integer $city_id
- * @property integer $district_id
- * @property integer $centralized_status
- * @property integer $trade_status
- */
- class PurchaseOrder extends \yii\db\ActiveRecord
- {
- /**
- * 订单流转状态:默认
- */
- const ORDER_FLOW_DEFAULT = -1;
- /**
- * 订单流转状态:待发货
- */
- const ORDER_FLOW_NO_SEND = 0;
- /**
- * 订单流转状态:已取消
- */
- const ORDER_FLOW_CANCEL = 1;
- /**
- * 订单流转状态:已发货
- */
- const ORDER_FLOW_SEND = 2;
- /**
- * 订单流转状态:已完成
- */
- const ORDER_FLOW_CONFIRM = 3;
- public $valid_order_flow = [
- self::ORDER_FLOW_DEFAULT,
- self::ORDER_FLOW_NO_SEND,
- self::ORDER_FLOW_SEND,
- self::ORDER_FLOW_CANCEL,
- self::ORDER_FLOW_CONFIRM
- ];
- /**
- * 申请取消订单: 默认
- */
- const ORDER_APPLY_DELETE_DEFAULT = 0;
- /**
- * 申请取消订单: 申请中
- */
- const ORDER_APPLY_DELETE = 1;
- /**
- * 订单来源 公众号或网站
- */
- const ORDER_SOURCE_WEB = 1;
- /**
- * 订单来源 app
- */
- const ORDER_SOURCE_APP = 2;
- /**
- * 订单来源 小程序
- */
- const ORDER_SOURCE_MINI = 3;
- /**
- * 用户取消类型
- */
- const CANCEL_USER_TYPE = 0;
- /**
- * 后台取消类型
- */
- const CANCEL_BACK_TYPE = 1;
- /**
- * 是否取消(手动):已取消
- */
- const IS_DELETE_TRUE = 1;
- /**
- * 是否取消(手动):未取消
- */
- const IS_DELETE_FALSE = 0;
- /**
- * 是否支付:已支付
- */
- const IS_PAY_TRUE = 1;
- /**
- * 是否支付:未支付
- */
- const IS_PAY_FALSE = 0;
- /**
- * 支付方式:未支付
- */
- const PAY_TYPE_UNPAID = 0;
- /**
- * 支付方式:微信支付
- */
- const PAY_TYPE_WECHAT = 1;
- /**
- * 支付方式:支付宝支付
- */
- const PAY_TYPE_ALIPAY = 2;
- /**
- * 支付方式:余额支付
- */
- const PAY_TYPE_BALANCE_PAID = 3;
- /**
- * 订单是否显示:显示
- */
- const IS_SHOW_TRUE = 1;
- /**
- * 订单是否显示:不显示
- */
- const IS_SHOW_FALSE = 0;
- /**
- * 是否过售后时间:是
- */
- const IS_SALE_TRUE = 1;
- /**
- * 是否过售后时间:否
- */
- const IS_SALE_FALSE = 0;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%purchase_order}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'user_id', 'order_no'], 'required'],
- [['store_id', 'user_id', 'is_pay', 'pay_type', 'pay_time',
- 'is_comment', 'created_at', 'is_delete', 'province_id', 'city_id', 'district_id', 'centralized_status'], 'integer'],
- [['total_price', 'pay_price'], 'number'],
- [['order_no', 'name', 'mobile', 'alipay_trade_no'], 'string', 'max' => 255],
- [['remark'], 'string', 'max' => 1000],
- [['address', 'address_data', 'send_time', 'express', 'express_no', 'confirm_time', 'apply_delete', 'cloud_order_no',
- 'alipay_trade_no','is_sale','is_show','trade_status', 'province_id', 'city_id', 'district_id', 'supplier_id'], 'safe'],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'user_id' => '用户id',
- 'order_no' => '订单号',
- 'total_price' => '订单总费用(包含运费)',
- 'pay_price' => '实际支付总费用(含运费)',
- 'name' => '收货人姓名',
- 'mobile' => '收货人手机',
- 'address' => '收货地址',
- 'address_data' => '收货地址信息,json格式',
- 'remark' => '订单备注',
- 'is_pay' => '支付状态:0=未支付,1=已支付',
- 'pay_type' => '支付方式:1=微信支付',
- 'pay_time' => '支付时间',
- 'send_time' => '发货时间',
- 'express' => '物流公司',
- 'express_no' => 'Express No',
- 'confirm_time' => '确认收货时间',
- 'is_comment' => '是否已评价:0=未评价,1=已评价',
- 'apply_delete' => '是否申请取消订单:0=否,1=申请取消订单',
- 'created_at' => 'Addtime',
- 'is_delete' => 'Is Delete',
- 'alipay_trade_no' => '支付宝订单号',
- 'is_sale' => '是否超过售后时间',
- 'is_show' => '是否显示 0--不显示 1--显示(软删除用)',
- 'trade_status' => '订单状态,-1:默认,0:待发货,1:已取消,2:已发货,3:已确认',
- 'province_id' => '省id',
- 'city_id' => '市id',
- 'district_id' => '区id',
- 'centralized_status' => '集采订单状态'
- ];
- }
- public function getDetail()
- {
- return $this->hasMany(PurchaseOrderDetail::className(), ['order_id' => 'id']);
- }
- public function afterOtherDataSave()
- {
- \app\modules\admin\models\jushuitan\JuShuiTanForm::afterPurchaseOrderSave($this);
- }
- public function afterSave($insert, $changedAttributes)
- {
- \app\modules\admin\models\jushuitan\JuShuiTanForm::afterPurchaseOrderSave($this, $insert, $changedAttributes);
- }
- }
|