<?php
/**
 * 订单Dao
 * Created by PhpStorm.
 * User: XiaoMing
 * Date: 2019/10/31
 * Time: 15:49
 */

namespace JinDouYun\Dao\Order;

use JinDouYun\Dao\BaseDao;

class DOrder extends BaseDao
{
    public function __construct($serviceDB = 'default')
    {
        $this->_table = 'order';
        $this->_primary = 'id';
        $this->_fields = [
            "id", //int(10) NOT NULL AUTO_INCREMENT,
            "no", //char(20) NOT NULL COMMENT '订单编号',
            "shopId", //int(10) NOT NULL DEFAULT '0' COMMENT '店铺id',
            "shopName",//varchar(50) NOT NULL COMMENT '店铺名称',
            "merchantId", // int(10) DEFAULT NULL COMMENT '商户id',
            "outerTradeNo", //varchar(255) NOT NULL DEFAULT '' COMMENT '外部流水号(支付宝/微信返回的流水号)',
            "totalMoney", //decimal(12,2) DEFAULT '0.00' COMMENT '总金额',
            "payAmount", //decimal(12,2) DEFAULT '0.00' COMMENT '实付金额',
            'notPayMoney',
            "retMoney",//退款金额
            "retTime",//退款时间
            "isRet",//订单是否退款
            "buyTotal", //int(10) NOT NULL DEFAULT '0' COMMENT '购买总数',
            "customerName", //varchar(50) NOT NULL COMMENT '客户姓名',
            "customerId", //int(10) NOT NULL COMMENT '客户id',
            "payStatus", //tinyint(3) NOT NULL DEFAULT '1' COMMENT '支付状态  默认1 未支付 2已支付',
            "orderStatus", //tinyint(3) NOT NULL DEFAULT '2' COMMENT '订单状态 默认 2待支付 3代发货 4待收货 5已完成 6已关闭',
            "payType", //tinyint(3) DEFAULT NULL COMMENT '支付方式 1微信 2支付宝 3货到付款 4上门自提',
            "deliveryType", //tinyint(3) DEFAULT NULL COMMENT '配送方式 1商品配送 2上门自提',
            "source", //tinyint(3) DEFAULT NULL COMMENT '订单来源 默认1 ios 2android 3小程序 4后台创建',
            "remark", //varchar(255) NOT NULL DEFAULT '' COMMENT '订单备注',
            "extends", //json DEFAULT NULL COMMENT '拓展字段',
            "deleteStatus", //tinyint(3) NOT NULL DEFAULT '5' COMMENT '是否删除  默认5 正常 4删除',
            "auditStatus", //tinyint(3) NOT NULL DEFAULT '1' COMMENT '审核状态 默认1 待审 2审核通过 3 审核未通过 4 审核中',
            'returnStatus',//tinyint(3) DEFAULT '0' COMMENT '退货状态 0:未退货 1:部分退货 2:全部退货',
            'outStatus',//tinyint(3) DEFAULT NULL COMMENT '出库状态 4:未出库 5:已出库 6部分出库',
            "payTime", //int(10) NOT NULL DEFAULT '0' COMMENT '付款时间',
            "createTime", //int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
            "updateTime", //int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            "preferentialActivityId", //int(10) DEFAULT '0' COMMENT '店铺优惠活动id',
            "salesManId", //int(10) DEFAULT '0' COMMENT '业务员id',
            "salesManName", //varchar(255) DEFAULT NULL COMMENT '业务员名称',
            "customerType", //tinyint(3) DEFAULT NULL COMMENT '客户类型',
            "userCenterId", //int(10) DEFAULT NULL COMMENT 'userCenterId',
            "customerOwe",//decimal(12,2) DEFAULT '0.00' COMMENT '客户当前欠款',
            "successFullyTime",//int(10) DEFAULT '0' COMMENT '订单完成时间',
            "preferential",//decimal(12,2) DEFAULT '0.00' COMMENT '优惠券优惠金额',
            "vipDiscount",//decimal(12,2) DEFAULT '0.00' COMMENT '会员卡优惠金额',
            "vipDoubleDiscount",//decimal(12,2) DEFAULT '0.00' COMMENT '会员卡折上折优惠金额',
            "vipCardId",//int(10) DEFAULT '0' COMMENT '使用会员卡id',
            "verifyCode",//varchar(50) NOT NULL DEFAULT '' COMMENT '核销码',
            "originPayAmount",//decimal(12,2) DEFAULT '0.00' COMMENT '原付款金额',
            "orderType",//tinyint(3) DEFAULT 1 COMMENT '单据类型 1:销售订单(购物车正常购买的) 23:销售单(后台快速创建的)',
            "outTime",//varchar(50) NOT NULL DEFAULT '' COMMENT '出库时间',
            "isCommission",
            "commissionData",
            "expressMoney",
            "deliveryNo",
            "expressName",
            "expressId",
            "selfRuleId",
            "selfRuleData",
            "cashierUid",
            "guideUids",
            "cashierName",
            "guideName",
            "remMoney",
            "changeSubMoney",
            "isNoneUser",
            "customerMobile",
            "currentAccountName",
            "accountList",
            "receivedMoney",
            "totalReduceMoney",
            "serialNum",
            "operatorName",
            "operatorId",
            "isSettel",
            "reservoir",//库位信息
            "comBinId",
            "revokeTime",//审核驳回时间
            "logisticsData",//物流信息
            "driverId",// int(10) DEFAULT NULL COMMENT '物流表司机id',
        ];
        $this->_readonly = ['id'];
        $this->_create_autofill = [
            'createTime' => time()
        ];
        $this->_update_autofill = [
            'updateTime' => time()
        ];

        parent::__construct($serviceDB);
    }
}
