|
|
|
@ -6,20 +6,28 @@ use AfterSalesConst;
|
|
|
|
|
use AppConst;
|
|
|
|
|
use CommonTool;
|
|
|
|
|
use Dao\AfterSale\AfterSalesDao;
|
|
|
|
|
use Dao\AfterSale\AfterSalesRsyncQueueDao;
|
|
|
|
|
use Dao\Common\LogisticsDao;
|
|
|
|
|
use Dao\Common\LogisticsPlatformDao;
|
|
|
|
|
use Dao\Mall\MallSDao;
|
|
|
|
|
use Dao\Order\OpOrderAllergyRefundDao;
|
|
|
|
|
use Dao\Order\OpOrderDao;
|
|
|
|
|
use Dao\Order\SearchConditionLogDao;
|
|
|
|
|
use Dao\OrderPrint\OpPageSettingDao;
|
|
|
|
|
use ExcelTool;
|
|
|
|
|
use Exception\BizException;
|
|
|
|
|
use Exception\CheckClientException;
|
|
|
|
|
use HtmlTool;
|
|
|
|
|
use OrderConst;
|
|
|
|
|
use OrderPrintConst;
|
|
|
|
|
use OrderPrintTool;
|
|
|
|
|
use PddApi;
|
|
|
|
|
use PermissionTool;
|
|
|
|
|
use PurchaseOrderConst;
|
|
|
|
|
use Repository\Mall\MallRepository;
|
|
|
|
|
use Repository\OrderPrint\OrderPrintRepository;
|
|
|
|
|
use Service\AbstractService;
|
|
|
|
|
use StatusConst;
|
|
|
|
|
use ZcArrayHelper;
|
|
|
|
|
use ZcDateHelper;
|
|
|
|
|
|
|
|
|
@ -31,7 +39,10 @@ class AfterSaleService extends AbstractService {
|
|
|
|
|
private $afterSalesDao;
|
|
|
|
|
private $searchConditionLogDao;
|
|
|
|
|
private $opOrderAllergyRefundDao;
|
|
|
|
|
private $opPageSettingDao;
|
|
|
|
|
private $afterSalesRsyncQueueDao;
|
|
|
|
|
|
|
|
|
|
private $mallRepository;
|
|
|
|
|
private $orderPrintRepository;
|
|
|
|
|
|
|
|
|
|
protected function __construct() {
|
|
|
|
@ -42,83 +53,86 @@ class AfterSaleService extends AbstractService {
|
|
|
|
|
$this->afterSalesDao = AfterSalesDao::instance();
|
|
|
|
|
$this->searchConditionLogDao = SearchConditionLogDao::instance();
|
|
|
|
|
$this->opOrderAllergyRefundDao = OpOrderAllergyRefundDao::instance();
|
|
|
|
|
$this->opPageSettingDao = OpPageSettingDao::instance();
|
|
|
|
|
$this->afterSalesRsyncQueueDao = AfterSalesRsyncQueueDao::instance();
|
|
|
|
|
|
|
|
|
|
$this->mallRepository = MallRepository::instance();
|
|
|
|
|
$this->orderPrintRepository = OrderPrintRepository::instance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getSearchAfterSalesListFilter($post, $operatorInfo) {
|
|
|
|
|
private function getSearchAfterSalesListFilter($params, $operatorInfo) {
|
|
|
|
|
$mallId = $operatorInfo['mallId'];
|
|
|
|
|
$filter = [];
|
|
|
|
|
$tabType = $post['tabType'];
|
|
|
|
|
if (!empty($post['authMallIds'])) {
|
|
|
|
|
PermissionTool::checkMultiShopValid($mallId, $post['authMallIds']);
|
|
|
|
|
$tabType = $params['tabType'];
|
|
|
|
|
if (!empty($params['authMallIds'])) {
|
|
|
|
|
PermissionTool::checkMultiShopValid($mallId, $params['authMallIds']);
|
|
|
|
|
}
|
|
|
|
|
if (isset($post['shippingStatus']) && is_numeric($post['shippingStatus'])) {
|
|
|
|
|
$filter['shippingStatus'] = $post['shippingStatus'];
|
|
|
|
|
if (isset($params['shippingStatus']) && is_numeric($params['shippingStatus'])) {
|
|
|
|
|
$filter['shippingStatus'] = $params['shippingStatus'];
|
|
|
|
|
}
|
|
|
|
|
if (isset($post['afterSalesType']) && is_numeric($post['afterSalesType'])) {
|
|
|
|
|
$filter['afterSalesType'] = $post['afterSalesType'];
|
|
|
|
|
if (isset($params['afterSalesType']) && is_numeric($params['afterSalesType'])) {
|
|
|
|
|
$filter['afterSalesType'] = $params['afterSalesType'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($post['afterSalesStatus'])) {
|
|
|
|
|
$filter['afterSalesStatus'] = is_array($post['afterSalesStatus']) ? $post['afterSalesStatus'] : [$post['afterSalesStatus']];
|
|
|
|
|
if (!empty($params['afterSalesStatus'])) {
|
|
|
|
|
$filter['afterSalesStatus'] = is_array($params['afterSalesStatus']) ? $params['afterSalesStatus'] : [$params['afterSalesStatus']];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($post['orderSn'])) {
|
|
|
|
|
$filter['orderSn'] = CommonTool::convertValToArray($post['orderSn']);
|
|
|
|
|
if (!empty($params['orderSn'])) {
|
|
|
|
|
$filter['orderSn'] = CommonTool::convertValToArray($params['orderSn']);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['afterSalesId'])) {
|
|
|
|
|
$filter['afterSalesId'] = CommonTool::convertValToArray($post['afterSalesId']);
|
|
|
|
|
if (!empty($params['afterSalesId'])) {
|
|
|
|
|
$filter['afterSalesId'] = CommonTool::convertValToArray($params['afterSalesId']);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['goodsId'])) {
|
|
|
|
|
$filter['goodsId'] = $post['goodsId'];
|
|
|
|
|
if (!empty($params['goodsId'])) {
|
|
|
|
|
$filter['goodsId'] = $params['goodsId'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['recreatedAtStart'])) {
|
|
|
|
|
$filter['recreatedAtStart'] = ZcDateHelper::formatDate($post['recreatedAtStart']);
|
|
|
|
|
if (!empty($params['recreatedAtStart'])) {
|
|
|
|
|
$filter['recreatedAtStart'] = ZcDateHelper::formatDate($params['recreatedAtStart']);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['recreatedAtEnd'])) {
|
|
|
|
|
$filter['recreatedAtEnd'] = date('Y-m-d 23:59:59', strtotime($post['recreatedAtEnd']));
|
|
|
|
|
if (!empty($params['recreatedAtEnd'])) {
|
|
|
|
|
$filter['recreatedAtEnd'] = date('Y-m-d 23:59:59', strtotime($params['recreatedAtEnd']));
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['purchaseStartTime'])) {
|
|
|
|
|
$filter['purchaseStartTime'] = ZcDateHelper::formatDate($post['purchaseStartTime']);
|
|
|
|
|
if (!empty($params['purchaseStartTime'])) {
|
|
|
|
|
$filter['purchaseStartTime'] = ZcDateHelper::formatDate($params['purchaseStartTime']);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['purchaseEndTime'])) {
|
|
|
|
|
$filter['purchaseEndTime'] = date('Y-m-d 23:59:59', strtotime($post['purchaseEndTime']));
|
|
|
|
|
if (!empty($params['purchaseEndTime'])) {
|
|
|
|
|
$filter['purchaseEndTime'] = date('Y-m-d 23:59:59', strtotime($params['purchaseEndTime']));
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['expireStartTime'])) {
|
|
|
|
|
$filter['expireStartTime'] = $post['expireStartTime'];
|
|
|
|
|
if (!empty($params['expireStartTime'])) {
|
|
|
|
|
$filter['expireStartTime'] = $params['expireStartTime'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['expireEndTime'])) {
|
|
|
|
|
$filter['expireEndTime'] = $post['expireEndTime'];
|
|
|
|
|
if (!empty($params['expireEndTime'])) {
|
|
|
|
|
$filter['expireEndTime'] = $params['expireEndTime'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['refundAmountStart'])) {
|
|
|
|
|
$filter['refundAmountStart'] = $post['refundAmountStart'];
|
|
|
|
|
if (!empty($params['refundAmountStart'])) {
|
|
|
|
|
$filter['refundAmountStart'] = $params['refundAmountStart'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['refundAmountEnd'])) {
|
|
|
|
|
$filter['refundAmountEnd'] = $post['refundAmountEnd'];
|
|
|
|
|
if (!empty($params['refundAmountEnd'])) {
|
|
|
|
|
$filter['refundAmountEnd'] = $params['refundAmountEnd'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['purchasePlatform'])) {
|
|
|
|
|
$filter['purchasePlatform'] = $post['purchasePlatform'];
|
|
|
|
|
if (!empty($params['purchasePlatform'])) {
|
|
|
|
|
$filter['purchasePlatform'] = $params['purchasePlatform'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['purchaseOrderSn'])) {
|
|
|
|
|
$filter['purchaseOrderSn'] = $post['purchaseOrderSn'];
|
|
|
|
|
if (!empty($params['purchaseOrderSn'])) {
|
|
|
|
|
$filter['purchaseOrderSn'] = $params['purchaseOrderSn'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['purchaseOrderStatus'])) {
|
|
|
|
|
$filter['purchaseOrderStatus'] = $post['purchaseOrderStatus'];
|
|
|
|
|
if (!empty($params['purchaseOrderStatus'])) {
|
|
|
|
|
$filter['purchaseOrderStatus'] = $params['purchaseOrderStatus'];
|
|
|
|
|
}
|
|
|
|
|
if (isset($post['isPurchase']) && is_numeric($post['isPurchase'])) {
|
|
|
|
|
if($post['isPurchase'] == 1){
|
|
|
|
|
if (isset($params['isPurchase']) && is_numeric($params['isPurchase'])) {
|
|
|
|
|
if($params['isPurchase'] == 1){
|
|
|
|
|
$filter['filterPurchaseStatus'] = array(PurchaseOrderConst::filterPurchaseStatusPartPurchase, PurchaseOrderConst::filterPurchaseStatusHasPurchase, PurchaseOrderConst::filterPurchaseStatusManualHasPurchase);
|
|
|
|
|
}else{
|
|
|
|
|
$filter['filterPurchaseStatus'] = array(PurchaseOrderConst::filterPurchaseStatusWaitPurchase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['receiverNameOrPhone'])) {
|
|
|
|
|
if (!empty($params['receiverNameOrPhone'])) {
|
|
|
|
|
$receiverInfoFilter = [];
|
|
|
|
|
if (preg_match('/^[1-9]{1}\d{10}$/', $post['receiverNameOrPhone'])) {
|
|
|
|
|
$receiverInfoFilter['receiverPhone'] = $post['receiverNameOrPhone'];
|
|
|
|
|
if (preg_match('/^[1-9]{1}\d{10}$/', $params['receiverNameOrPhone'])) {
|
|
|
|
|
$receiverInfoFilter['receiverPhone'] = $params['receiverNameOrPhone'];
|
|
|
|
|
} else {
|
|
|
|
|
$receiverInfoFilter['receiverName'] = $post['receiverNameOrPhone'];
|
|
|
|
|
$receiverInfoFilter['receiverName'] = $params['receiverNameOrPhone'];
|
|
|
|
|
}
|
|
|
|
|
$kmsSearchList = PddApi::getKmsSearchList($receiverInfoFilter, $operatorInfo['accessToken']);
|
|
|
|
|
if (!empty($kmsSearchList['receiverNameSearchText'])) {
|
|
|
|
@ -129,34 +143,34 @@ class AfterSaleService extends AbstractService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($post['speedRefundFlag']) && is_numeric($post['speedRefundFlag'])) {
|
|
|
|
|
$filter['speedRefundFlag'] = $post['speedRefundFlag'];
|
|
|
|
|
if (isset($params['speedRefundFlag']) && is_numeric($params['speedRefundFlag'])) {
|
|
|
|
|
$filter['speedRefundFlag'] = $params['speedRefundFlag'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($post['mallNote'])) {
|
|
|
|
|
$filter['mallNote'] = trim($post['mallNote']);
|
|
|
|
|
if (!empty($params['mallNote'])) {
|
|
|
|
|
$filter['mallNote'] = trim($params['mallNote']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($post['hasMallNote']) && is_numeric($post['hasMallNote'])) {
|
|
|
|
|
$filter['hasMallNote'] = $post['hasMallNote'];
|
|
|
|
|
if (isset($params['hasMallNote']) && is_numeric($params['hasMallNote'])) {
|
|
|
|
|
$filter['hasMallNote'] = $params['hasMallNote'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($post['mallNoteFlag'])) {
|
|
|
|
|
$mallNoteFlag = array_filter($post['mallNoteFlag'], 'is_numeric');
|
|
|
|
|
if (!empty($params['mallNoteFlag'])) {
|
|
|
|
|
$mallNoteFlag = array_filter($params['mallNoteFlag'], 'is_numeric');
|
|
|
|
|
if ($mallNoteFlag) {
|
|
|
|
|
$filter['mallNoteFlag'] = $mallNoteFlag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($post['sortType'])) {
|
|
|
|
|
$filter['sortType'] = $post['sortType'];
|
|
|
|
|
if (!empty($params['sortType'])) {
|
|
|
|
|
$filter['sortType'] = $params['sortType'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($post['purchaseOrderBuyer'])) {
|
|
|
|
|
$filter['purchaseOrderBuyer'] = $post['purchaseOrderBuyer'];
|
|
|
|
|
if (!empty($params['purchaseOrderBuyer'])) {
|
|
|
|
|
$filter['purchaseOrderBuyer'] = $params['purchaseOrderBuyer'];
|
|
|
|
|
}
|
|
|
|
|
if (!empty($post['trackingNumber'])) {
|
|
|
|
|
$filter['trackingNumbers'] = CommonTool::convertValToArray($post['trackingNumber']);
|
|
|
|
|
if (!empty($params['trackingNumber'])) {
|
|
|
|
|
$filter['trackingNumbers'] = CommonTool::convertValToArray($params['trackingNumber']);
|
|
|
|
|
}
|
|
|
|
|
return $filter;
|
|
|
|
|
}
|
|
|
|
@ -363,28 +377,24 @@ class AfterSaleService extends AbstractService {
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function exportAfterSales() {
|
|
|
|
|
public function exportAfterSales($params, $operatorInfo) {
|
|
|
|
|
$pageSize = 20;
|
|
|
|
|
$page = 1;
|
|
|
|
|
$isOpApp = in_array(Zc::C('appName'), [AppConst::appPddDz, AppConst::appPddDzOp, AppConst::appMsPddOp, AppConst::appMsPddOpEbill]);
|
|
|
|
|
$mallId = $operatorInfo['mallId'];
|
|
|
|
|
$isOpApp = in_array(\Zc::C('appName'), [AppConst::appPddDz, AppConst::appPddDzOp, AppConst::appMsPddOp, AppConst::appMsPddOpEbill]);
|
|
|
|
|
|
|
|
|
|
$cookieName = empty($_POST['cookieName']) ? 'exportAfterSales' : $_POST['cookieName'];
|
|
|
|
|
$objPHPExcel = new PHPExcel();
|
|
|
|
|
$objPHPExcel = new \PHPExcel();
|
|
|
|
|
$headers = $isOpApp ? $this->getOpExportAfterSalesHeaders() : $this->getOdExportAfterSalesHeaders();
|
|
|
|
|
|
|
|
|
|
$activeSheet = ExcelTool::createNewSheetAndSetTitle($objPHPExcel, 0, '退款申请单');
|
|
|
|
|
ExcelTool::setSheetRowValues($activeSheet, 1, $headers);
|
|
|
|
|
|
|
|
|
|
$mallIds = $_POST['authMallIds'] ? $_POST['authMallIds'] : array($this->mallId);
|
|
|
|
|
$filterRet = $this->getSearchAfterSalesListFilter($_POST);
|
|
|
|
|
if (CommonTool::isFailRet($filterRet)) {
|
|
|
|
|
return $this->renderJSON($filterRet);
|
|
|
|
|
}
|
|
|
|
|
$filter = $filterRet['filter'];
|
|
|
|
|
$mallIds = $_POST['authMallIds'] ? $_POST['authMallIds'] : array($mallId);
|
|
|
|
|
$filter = $this->getSearchAfterSalesListFilter($params, $operatorInfo);
|
|
|
|
|
|
|
|
|
|
$afterSalesList = [];
|
|
|
|
|
while (true) {
|
|
|
|
|
list($afterSalesChunk, $total) = $this->afterSalesService->searchAfterSalesList($this->mallId, $filter, $page, $pageSize);
|
|
|
|
|
list($afterSalesChunk, $total) = $this->afterSalesDao->searchPage($mallId, $filter, $page, $pageSize);
|
|
|
|
|
|
|
|
|
|
if (!$afterSalesChunk) {
|
|
|
|
|
break;
|
|
|
|
@ -403,11 +413,10 @@ class AfterSaleService extends AbstractService {
|
|
|
|
|
$afterSalesList = $this->getAfterSalesOpOrders($mallIds, $afterSalesList);
|
|
|
|
|
$this->packOpExportAfterSalesData($activeSheet, $afterSalesList);
|
|
|
|
|
} else {
|
|
|
|
|
$afterSalesList = $this->getAfterSalesPurchaseOrders($mallIds, $afterSalesList);
|
|
|
|
|
$this->packOdExportAfterSalesData($activeSheet, $afterSalesList);
|
|
|
|
|
throw new BizException('暂不支持采购售后相关功能');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExcelTool::outputExcel($objPHPExcel, '导出售后单', $cookieName);
|
|
|
|
|
ExcelTool::downloadExcel($objPHPExcel, '导出售后单');
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -460,110 +469,84 @@ class AfterSaleService extends AbstractService {
|
|
|
|
|
}
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $timeTip);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$row ++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function packOdExportAfterSalesData(&$activeSheet, $afterSalesList) {
|
|
|
|
|
$row = 2;
|
|
|
|
|
foreach ($afterSalesList as $afterSales) {
|
|
|
|
|
$column = 1;
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $afterSales['mallName']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $afterSales['orderSn']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $afterSales['recreatedAt']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, CommonTool::ensconceString($afterSales['receiverName'], 'name'));
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, CommonTool::ensconceString($afterSales['receiverPhone'], 'mobile'));
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, CommonTool::ensconceString($afterSales['fullAddress'], 'address'));
|
|
|
|
|
|
|
|
|
|
foreach ($afterSales['orderItems'] as $orderItem) {
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $orderItem['skuName']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $orderItem['goodsId']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $orderItem['skuId']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $orderItem['itemTotal']);
|
|
|
|
|
}
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $afterSales['orderPayment']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $afterSales['refundAmount']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $afterSales['afterSalesId']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, AfterSalesConst::getShippingStatusMap()[$afterSales['shippingStatus']]);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, AfterSalesConst::getAfterSalesTypeMap()[$afterSales['afterSalesType']]);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, AfterSalesConst::getAfterSalesStatusMap()[$afterSales['afterSalesStatus']]);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $afterSales['afterSaleReason']);
|
|
|
|
|
|
|
|
|
|
foreach ($afterSales['purchaseOrders'] as $purchaseOrder) {
|
|
|
|
|
$platformName = PurchaseOrderConst::getPurchasePlatformName($purchaseOrder['purchasePlatform']);
|
|
|
|
|
$purchaseOrderStatus = '';
|
|
|
|
|
|
|
|
|
|
if ($purchaseOrder['purchaseOrderStatus'] == PurchaseOrderConst::purchaseOrderStatusHasSend) {
|
|
|
|
|
$purchaseOrderStatus = $platformName . '已发货';
|
|
|
|
|
} elseif ($purchaseOrder['purchaseOrderStatus'] == PurchaseOrderConst::purchaseOrderStatusFinished) {
|
|
|
|
|
$purchaseOrderStatus = $platformName . '已完成';
|
|
|
|
|
} elseif ($purchaseOrder['purchaseOrderStatus'] == PurchaseOrderConst::purchaseOrderStatusCancel) {
|
|
|
|
|
$purchaseOrderStatus = $platformName . '已关闭';
|
|
|
|
|
} elseif ($purchaseOrder['purchaseOrderStatus'] == PurchaseOrderConst::purchaseOrderStatusRefund) {
|
|
|
|
|
$purchaseOrderStatus = $platformName . '退款中';
|
|
|
|
|
} else {
|
|
|
|
|
$purchaseOrderStatus = $platformName . '未发货';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrder['purchasePlatform']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrder['purchaseOrderStartTime']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrder['purchaseOrderBuyer']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrderStatus);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrder['purchaseOrderSn']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrder['purchaseOrderFullname']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrder['purchaseOrderMobile']);
|
|
|
|
|
ExcelTool::setCellValue($activeSheet, $column++, $row, $purchaseOrder['purchaseOrderFullAddress']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$row ++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function saveDefaultAdditionalAfterSalesColumns() {
|
|
|
|
|
$subAccountId = $_SESSION[SessionConst::mallSubAccountId];
|
|
|
|
|
$ret = $this->orderPrintService->saveUserDefaultAdditionalAfterSalesColumns($this->mallId, $subAccountId, $_POST['fields']);
|
|
|
|
|
public function saveDefaultAdditionalAfterSalesColumns($mallId, $subAccountId, $fields) {
|
|
|
|
|
$ret = $this->opPageSettingDao->saveDefaultAdditionalAfterSalesColumns($mallId, $subAccountId, $fields);
|
|
|
|
|
if (!$ret) {
|
|
|
|
|
return $this->renderJSON(CommonTool::failResult('保存默认展示字段失败'));
|
|
|
|
|
throw new BizException('保存默认展示字段失败');
|
|
|
|
|
}
|
|
|
|
|
return $this->renderJSON(CommonTool::successResult());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function triggerRsyncAfterSales() {
|
|
|
|
|
$multiShopOptions = $this->mallService->getMultiShopOptions($this->mallId, $_SESSION[SessionConst::mallName], $_SESSION[SessionConst::mallSubAccountId]);
|
|
|
|
|
public function triggerRsyncAfterSales($operatorInfo) {
|
|
|
|
|
$multiShopOptions = $this->mallRepository->getMultiShopOptions($operatorInfo['mallId'], $operatorInfo['mallName'], $operatorInfo['mallSubAccountId']);
|
|
|
|
|
foreach ($multiShopOptions as $authMallId => $shopName) {
|
|
|
|
|
$this->opOrderService->tryRsyncAfterSales($authMallId);
|
|
|
|
|
$this->tryRsyncAfterSales($authMallId);
|
|
|
|
|
}
|
|
|
|
|
return $this->renderJSON(CommonTool::successResult());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function checkRsyncAfterSalesFinish() {
|
|
|
|
|
$multiShopOptions = $this->mallService->getMultiShopOptions($this->mallId, $_SESSION[SessionConst::mallName], $_SESSION[SessionConst::mallSubAccountId]);
|
|
|
|
|
public function tryRsyncAfterSales($mallId, $priority = 100, $forceStart = null) {
|
|
|
|
|
$queueInfo = $this->afterSalesRsyncQueueDao->getByMallId($mallId);
|
|
|
|
|
if (empty($queueInfo)) {
|
|
|
|
|
return $this->afterSalesRsyncQueueDao->insert(array(
|
|
|
|
|
'mall_id' => $mallId,
|
|
|
|
|
'app' => \Zc::C('appName'),
|
|
|
|
|
'priority' => $priority,
|
|
|
|
|
'locked' => 0,
|
|
|
|
|
'gmt_force_start' => $forceStart,
|
|
|
|
|
'after_sales_total' => 0,
|
|
|
|
|
'completed' => 0,
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
$update = array(
|
|
|
|
|
'priority' => $priority < $queueInfo['priority'] ? $priority : $queueInfo['priority']
|
|
|
|
|
);
|
|
|
|
|
if ($forceStart) {
|
|
|
|
|
$update['gmt_force_start'] = $forceStart;
|
|
|
|
|
}
|
|
|
|
|
return $this->afterSalesRsyncQueueDao->update($update, 'mall_id = %i', $mallId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function checkRsyncAfterSalesFinish($operatorInfo) {
|
|
|
|
|
$multiShopOptions = $this->mallRepository->getMultiShopOptions($operatorInfo['mallId'], $operatorInfo['mallName'], $operatorInfo['mallSubAccountId']);
|
|
|
|
|
$authMallIds = array_keys($multiShopOptions);
|
|
|
|
|
$queueCount = $this->afterSalesService->getAfterSalesRsyncQueueCount($authMallIds);
|
|
|
|
|
$ret = CommonTool::successResult([
|
|
|
|
|
$queueCount = $this->afterSalesRsyncQueueDao->getQueueCount($authMallIds);
|
|
|
|
|
return [
|
|
|
|
|
'status' => $queueCount ? StatusConst::process : StatusConst::finish
|
|
|
|
|
]);
|
|
|
|
|
return $this->renderJSON($ret);
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateAfterSaleMallNote() {
|
|
|
|
|
$afterSalesId = $_POST['afterSalesId'] ?: null;
|
|
|
|
|
$flag = $_POST['flag'] ?: 0;
|
|
|
|
|
$mallNote = $_POST['mallNote'] ?: '';
|
|
|
|
|
$afterSalesInfo = $this->afterSalesService->getAfterSalesInfoByAfterSalesId($afterSalesId);
|
|
|
|
|
public function updateAfterSaleMallNote($mallId, $afterSalesId, $flag, $mallNote) {
|
|
|
|
|
$afterSalesInfo = $this->afterSalesDao->getById($afterSalesId);
|
|
|
|
|
if (strlen($mallNote) > 200) {
|
|
|
|
|
return $this->renderJSON(CommonTool::failResult('备注信息不能超过200个字符'));
|
|
|
|
|
throw new CheckClientException('备注信息不能超过200个字符');
|
|
|
|
|
}
|
|
|
|
|
if (empty($afterSalesInfo)) {
|
|
|
|
|
return $this->renderJSON(CommonTool::failResult('售后不存在'));
|
|
|
|
|
throw new CheckClientException('售后不存在');
|
|
|
|
|
}
|
|
|
|
|
PermissionTool::checkMultiShopValid($mallId, array($afterSalesInfo['mallId']));
|
|
|
|
|
|
|
|
|
|
return $this->doUpdateAfterSaleMallNote($afterSalesId, $flag, $mallNote);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function doUpdateAfterSaleMallNote($afterSalesId, $flag, $mallNote) {
|
|
|
|
|
if (empty($afterSalesId)) {
|
|
|
|
|
throw new CheckClientException('参数错误');
|
|
|
|
|
}
|
|
|
|
|
$checkRet = $this->mallUtil->checkMultiShopValid($this->mallId, array($afterSalesInfo['mall_id']));
|
|
|
|
|
if (CommonTool::isFailRet($checkRet)) {
|
|
|
|
|
return $this->renderJSON($checkRet);
|
|
|
|
|
$data = [
|
|
|
|
|
'mall_note_flag' => $flag,
|
|
|
|
|
'mall_note' => $mallNote,
|
|
|
|
|
];
|
|
|
|
|
$affRow = $this->afterSalesDao->update($data, 'after_sales_id = %i', $afterSalesId);
|
|
|
|
|
if ($affRow === false) {
|
|
|
|
|
throw new BizException('保存失败');
|
|
|
|
|
}
|
|
|
|
|
$ret = $this->afterSalesService->updateAfterSaleMallNote($afterSalesId, $flag, $mallNote);
|
|
|
|
|
return $this->renderJSON($ret);
|
|
|
|
|
return [
|
|
|
|
|
'flag' => $flag,
|
|
|
|
|
'flagImg' => $flag ? HtmlTool::getStaticFile('flags/' . OrderPrintTool::getOrderFlag()[$flag]) : '',
|
|
|
|
|
'mallNote' => $mallNote,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|