| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\plugins\adopt\models;
- use Yii;
- use Codeception\PHPUnit\ResultPrinter\HTML;
- /**
- * This is the model class for table "{{%adopt_cost_order}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property integer $order_id
- * @property integer $user_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 $address
- * @property string $remark
- * @property integer $is_pay
- * @property integer $pay_type
- * @property integer $pay_time
- * @property integer $send_time
- * @property string $express
- * @property string $express_no
- * @property integer $confirm_time
- * @property integer $apply_delete
- * @property integer $created_at
- * @property integer $is_delete
- * @property string $coupon_sub_price
- * @property string $content
- * @property integer $is_offline
- * @property integer $clerk_id
- * @property string $address_data
- * @property string $offline_qrcode
- * @property string $before_update_price
- * @property integer $shop_id
- * @property string $discount
- * @property integer $user_coupon_id
- * @property string $integral
- * @property integer $give_integral
- * @property integer $is_sale
- * @property string $words
- * @property string $version
- * @property string $express_price_1
- * @property integer $mch_id
- * @property integer $is_recycle
- * @property string $seller_comments
- * @property string $before_update_express
- * @property integer $is_transfer
- * @property integer $is_show
- * @property integer $order_origin
- * @property integer $is_open_offline
- * @property integer $trade_status
- * @property string $transaction_id
- * @property string $alipay_trade_no
- * @property string $is_platform
- * @property integer $combine_money
- * @property integer $is_combine_pay
- * @property integer $order_type
- * @property string $updated_at
- * @property string $is_delivery
- * @property integer $md_id
- * @property integer $is_trans
- * @property integer $profit
- * @property integer $province_id
- * @property integer $city_id
- * @property integer $district_id
- * @property integer $pay_user_id
- * @property integer $weight
- * @property string $cost_detail
- * @property string $order_union_id
- */
- class AdoptCostOrder 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_COD = 2;
- /**
- * 支付方式:余额支付
- */
- const PAY_TYPE_BALANCE_PAID = 3;
- /**
- * 订单类型:商城订单
- */
- const ORDER_TYPE_STORE = 0;
- /**
- * 订单类型:当面付订单
- */
- const ORDER_TYPE_POND = 1;
- /**
- * 订单是否显示:显示
- */
- const IS_SHOW_TRUE = 1;
- /**
- * 订单是否显示:不显示
- */
- const IS_SHOW_FALSE = 0;
- /**
- * 是否过售后时间:是
- */
- const IS_SALE_TRUE = 1;
- /**
- * 是否过售后时间:否
- */
- const IS_SALE_FALSE = 0;
- /**
- * 自提订单
- */
- const IS_OFFLINE_TRUE = 1;
- const IS_OFFLINE_FALSE = 0;
- /**
- * 类型
- */
- // const SEND_TYPE_DADA = 1;
- // const SEND_TYPE_UU = 2;
- // const SEND_TYPE_PEISONG = 3;
- /**
- * 同城配送
- */
- const IS_SAME_CITY_NO = 0; //否
- const IS_SAME_CITY_YES = 1; //是
- /**
- * 是否是组合支付:是
- */
- const IS_COMBINE_PAY = 1;
- /**
- * 是否是组合支付:否
- */
- const NOT_COMBINE_PAY = 0;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%adopt_cost_order}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'user_id', 'order_id', 'order_no', ], 'required'],
- [['store_id', 'user_id', 'is_pay', 'pay_type', 'pay_time', 'send_time',
- 'confirm_time', 'apply_delete', 'created_at', 'updated_at', 'is_delete',
- 'is_offline', 'clerk_id', 'shop_id', 'user_coupon_id', 'give_integral',
- 'is_sale', 'mch_id', 'is_transfer', 'is_show',
- 'order_origin', 'trade_status', 'is_platform', 'is_combine_pay', 'order_type',
- 'is_delivery', 'md_id', 'is_trans', 'province_id', 'city_id', 'district_id', 'pay_user_id', ], 'integer'],
- [['total_price', 'pay_price', 'express_price',
- 'coupon_sub_price', 'before_update_price', 'discount', 'express_price_1',
- 'before_update_express', 'combine_money', 'weight'], 'number'],
- [['address_data', 'content', 'offline_qrcode', 'integral', 'words', 'seller_comments', 'cost_detail'], 'string'],
- [['order_no', 'name', 'mobile', 'express', 'express_no', 'version', 'alipay_trade_no'], 'string', 'max' => 255],
- [['address', 'remark'], 'string', 'max' => 1000],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'user_id' => '用户id',
- 'order_id' => '关联认养订单id',
- 'order_no' => '订单号',
- 'total_price' => '订单总费用(包含运费)',
- 'pay_price' => '实际支付总费用(含运费)',
- 'express_price' => '运费',
- 'name' => '收货人姓名',
- 'mobile' => '收货人手机',
- 'address' => '收货地址',
- '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',
- 'coupon_sub_price' => '优惠券抵消金额',
- 'content' => 'Content',
- 'is_offline' => '是否到店自提 0--否 1--是',
- 'clerk_id' => '核销员user_id',
- 'address_data' => '收货地址信息,json格式',
- 'offline_qrcode' => '核销码',
- 'before_update_price' => '修改前的价格',
- 'shop_id' => '自提自提点ID',
- 'discount' => '会员折扣',
- 'user_coupon_id' => '使用的优惠券ID',
- 'integral' => '积分使用',
- 'give_integral' => '是否发放积分【1=> 已发放 , 0=> 未发放】',
- 'is_sale' => '是否超过售后时间',
- 'words' => '商家留言',
- 'version' => '版本',
- 'express_price_1' => '减免的运费',
- 'mch_id' => '入驻商户id',
- 'seller_comments' => '商家备注',
- 'before_update_express' => '价格修改前的运费',
- 'is_transfer' => '是否已转入商户账户:0=否,1=是',
- 'order_type' => '0:采摘订单,1:保管订单',
- 'is_show' => '是否显示 0--不显示 1--显示(软删除用)',
- 'order_origin' => '订单来源 1:公众号或者网站 2:app 3:小程序',
- 'trade_status' => '订单状态,-1:默认,0:待发货,1:已取消,2:已发货,3:已确认',
- 'weight' => '提货重量',
- 'cost_detail' => '费用明细',
- ];
- }
- public function afterSave($insert, $changedAttributes)
- {
- parent::afterSave($insert, $changedAttributes);
- if($insert){
- (new \app\utils\OrderUtil())->adoptCostOrderCancel($this);
- }
- if(isset($changedAttributes['trade_status']) && $this->trade_status == AdoptCostOrder::ORDER_FLOW_SEND){
- (new \app\utils\OrderUtil())->adoptCostOrderConfirm($this);
- }
- }
- }
|