<?php


class TuLanDuo_addOrUpdateRouteOrderContentBuilder extends CI_Model
{

    private $userId;
    private $Key;

    private $bizContentarr = array();
    private $bizContent = NULL;

    private $orderData=array(
        'travelFees'         => array()   //团款明细
        ,'replaceCollections' => array()  //代收明细
        ,'replacePays'        => array()  //代付明细
        ,'scheduleDetails'    => array()  //行程详细，数组类型，按照第一天往后有序排列
        ,'customers'          => array()  //游客信息
    );

    function __construct() {
        parent::__construct();
    }

    public function getBizContent()
    {
        if(!empty($this->orderData)){
            $this->bizContentarr['orderData'] = $this->orderData;
            $this->bizContent = json_encode($this->bizContentarr);
        }
        return $this->bizContent;
    }

    public function resetBizContent()
    {
        $this->bizContentarr['orderData'] = $this->orderData = array();
        $this->bizContent = NULL;
        return $this->getBizContent();
    }

    public function setUserId($userId)
    {
        $this->userId = $userId;
        $this->bizContentarr['userId'] = $userId;
        return $this;
    }
    public function setKey($Key)
    {
        $this->key = $Key;
        $this->bizContentarr['key'] = $Key;
        return $this;
    }
    /** 订单基本信息 */
    public function setOrderId($orderId)
    {
        $this->orderData['orderId'] = $orderId;
        return $this;
    }
    public function setModifyLogInfo($modifyLogInfo)
    {
        $this->orderData['modifyLogInfo'] = $modifyLogInfo;
        return $this;
    }
    public function clearModifyLogInfo()
    {
        $this->orderData['modifyLogInfo'] = '';
        return $this;
    }
    public function setOrderType($orderType)
    {
        $this->orderData['orderType'] = $orderType;
        return $this;
    }
    public function setRouteName($routeName)
    {
        $this->orderData['routeName'] = $routeName;
        return $this;
    }
    public function setRouteType($routeType)
    {
        $this->orderData['routeType'] = $routeType;
        return $this;
    }
    public function setAgcOrderNo($agcOrderNo)
    {
        $this->orderData['agcOrderNo'] = $agcOrderNo;
        return $this;
    }
    public function setAdultNum($adultNum)
    {
        $this->orderData['adultNum'] = $adultNum;
        return $this;
    }
    public function setChildNum($childNum)
    {
        $this->orderData['childNum'] = $childNum;
        return $this;
    }
    public function setGuiderNum($guiderNum)
    {
        $this->orderData['guiderNum'] = $guiderNum;
        return $this;
    }
    public function setGuiderInfo($guiderInfo)
    {
        $this->orderData['guiderInfo'] = $guiderInfo;
        return $this;
    }
    public function setToTraffic($toTraffic)
    {
        $this->orderData['toTraffic'] = $toTraffic;
        return $this;
    }
    public function setBackTraffic($backTraffic)
    {
        $this->orderData['backTraffic'] = $backTraffic;
        return $this;
    }
    public function setRoomStandard($roomStandard)
    {
        $this->orderData['roomStandard'] = isset($this->orderData['roomStandard']) ? ($this->orderData['roomStandard'] . "\r\n" . $roomStandard) : $roomStandard;
        return $this;
    }
    public function setOrderRemark($orderRemark)
    {
        $this->orderData['orderRemark'] = isset($this->orderData['orderRemark']) ?  ($this->orderData['orderRemark'] . "\r\n" . $orderRemark) : $orderRemark;
        return $this;
    }
    public function setRouteStandard($routeStandard)
    {
        $this->orderData['routeStandard'] = "该团按非购物团标准结算 要求/接团小技巧:\r\n" . $routeStandard;
        return $this;
    }
    public function setDestination($destination)
    {
        // $this->orderData['destination'] = $destination . "分公司";
        $this->orderData['destination'] = $destination;
        return $this;
    }
    public function setTravelDate($travelDate)
    {
        $this->orderData['travelDate'] = $travelDate;
        return $this;
    }
    public function setLeavedDate($leavedDate)
    {
        $this->orderData['leavedDate'] = $leavedDate;
        return $this;
    }
    public function setOperationUserName($operationUserName)
    {
        $this->orderData['operationUserName'] = $operationUserName;
        return $this;
    }
    public function setCustomerFromCity($customerFromCity)
    {
        $this->orderData['customerFromCity'] = $customerFromCity;
        return $this;
    }

    /** 团款数组 */
    public function setTravelFeesType($index, $type)
    {
        $this->orderData['travelFees'][$index]['type'] = $type;
        return $this;
    }
    public function setTravelFeesMoney($index, $money)
    {
        $this->orderData['travelFees'][$index]['money'] = $money;
        return $this;
    }
    public function setTravelFeesNum($index, $num)
    {
        $this->orderData['travelFees'][$index]['num'] = $num;
        return $this;
    }
    public function setTravelFeesUnit($index, $unit)
    {
        $this->orderData['travelFees'][$index]['unit'] = $unit;
        return $this;
    }
    public function setTravelFeesSumMoney($index, $sumMoney)
    {
        $this->orderData['travelFees'][$index]['sumMoney'] = $sumMoney;
        return $this;
    }
    public function setTravelFeesRemark($index, $remark)
    {
        $this->orderData['travelFees'][$index]['remark'] = $remark;
        return $this;
    }

    /** 代付数组 */
    public function setReplacePaysType($index, $type)
    {
        $this->orderData['replacePays'][$index]['type'] = $type;
        return $this;
    }
    public function setReplacePaysMoney($index, $money)
    {
        $this->orderData['replacePays'][$index]['money'] = $money;
        return $this;
    }
    public function setReplacePaysRemark($index, $remark)
    {
        $this->orderData['replacePays'][$index]['remark'] = $remark;
        return $this;
    }

    /** 代收数组 */
    public function setReplaceCollectionsType($index, $type)
    {
        $this->orderData['replaceCollections'][$index]['type'] = $type;
        return $this;
    }
    public function setReplaceCollectionsMoney($index, $money)
    {
        $this->orderData['replaceCollections'][$index]['money'] = $money;
        return $this;
    }
    public function setReplaceCollectionsRemark($index, $remark)
    {
        $this->orderData['replaceCollections'][$index]['remark'] = $remark;
        return $this;
    }

    /**
     * 行程详细数组
     * 已存在的日期则拼接内容
     */
    public function setScheduleDetailsTitle($index, $title)
    {
        $this->orderData['scheduleDetails'][$index]['title'] = $title;
        return $this;
    }
    public function setScheduleDetailsContent($index, $content)
    {
        $this->orderData['scheduleDetails'][$index]['content'] = isset($this->orderData['scheduleDetails'][$index]['content']) ?
            ($this->orderData['scheduleDetails'][$index]['content'] . "\r\n" . $content) : $content;
        return $this;
    }
    public function setScheduleDetailsTraffic($index, $traffic)
    {
        $this->orderData['scheduleDetails'][$index]['traffic'] = isset($this->orderData['scheduleDetails'][$index]['traffic']) ?
            ($this->orderData['scheduleDetails'][$index]['traffic'] . "\r\n" . $traffic) : $traffic;
        return $this;
    }
    public function setScheduleDetailsAccommodation($index, $accommodation)
    {
        $this->orderData['scheduleDetails'][$index]['accommodation'] = isset($this->orderData['scheduleDetails'][$index]['accommodation']) ?
            ($this->orderData['scheduleDetails'][$index]['accommodation'] . "\r\n" . $accommodation) : $accommodation;
        return $this;
    }
    public function setScheduleDetailsBreakFirst($index, $breakFirst)
    {
        $this->orderData['scheduleDetails'][$index]['breakFirst'] = isset($this->orderData['scheduleDetails'][$index]['breakFirst']) ?
            $breakFirst+$this->orderData['scheduleDetails'][$index]['breakFirst'] : $breakFirst;
        return $this;
    }
    public function setScheduleDetailsDinner($index, $dinner)
    {
        $this->orderData['scheduleDetails'][$index]['dinner'] = isset($this->orderData['scheduleDetails'][$index]['dinner']) ?
            $dinner+$this->orderData['scheduleDetails'][$index]['dinner'] : $dinner;
        return $this;
    }
    public function setScheduleDetailsLunch($index, $lunch)
    {
        $this->orderData['scheduleDetails'][$index]['lunch'] = isset($this->orderData['scheduleDetails'][$index]['lunch']) ?
            $lunch+$this->orderData['scheduleDetails'][$index]['lunch'] : $lunch;
        return $this;
    }

    /** 游客信息数组 */
    public function setCustomersName($index, $name)
    {
        $this->orderData['customers'][$index]['name'] = $name;
        return $this;
    }
    public function setCustomersPeopleType($index, $peopleType)
    {
        $this->orderData['customers'][$index]['peopleType'] = $peopleType;
        return $this;
    }
    public function setCustomersDocumentType($index, $documentType)
    {
        $this->orderData['customers'][$index]['documentType'] = $documentType;
        return $this;
    }
    public function setCustomersDocumentNo($index, $documentNo)
    {
        $this->orderData['customers'][$index]['documentNo'] = $documentNo;
        return $this;
    }
    public function setCustomersPhoneNo($index, $phoneNo)
    {
        $this->orderData['customers'][$index]['phoneNo'] = $phoneNo;
        return $this;
    }
    public function setCustomersOtherInfo($index, $otherInfo)
    {
        $this->orderData['customers'][$index]['otherInfo'] = $otherInfo;
        return $this;
    }


}

?>
