172 行
5.3 KiB
PHP
可执行文件
172 行
5.3 KiB
PHP
可执行文件
<?php
|
||
|
||
namespace Retail\Controller;
|
||
|
||
use Common\Business\GoodsClassify;
|
||
use Common\Business\ModifyPriceSingle;
|
||
use Think\Controller;
|
||
|
||
//[1.5.46]
|
||
class ModifyPriceOrderController extends BaseController
|
||
{
|
||
|
||
public function index()
|
||
{
|
||
$arr = array(
|
||
'addPurchaseOrder' => '/index.php/Retail/ModifyPriceOrder/addModifyPrice',
|
||
'exportOperation' => '/index.php/Retail/ModifyPriceOrder/export',
|
||
'OrderInfo' => '/index.php/Retail/ModifyPriceOrder/details'
|
||
);
|
||
$authArr = checkFunction($arr);
|
||
$this->assign('authArr', $authArr);
|
||
$this->display();
|
||
}
|
||
|
||
|
||
/**
|
||
* 调价单列表
|
||
*/
|
||
public function modifyOrderList()
|
||
{
|
||
$data = I("post.");
|
||
$data['merchant_id'] = session('merchant_userinfo')['id'];
|
||
$data['user_type'] = 1; //商户
|
||
$ModifyPriceOrderClass = new ModifyPriceSingle();
|
||
$result = $ModifyPriceOrderClass->getModifyPriceSingleList($data); //调价单列表
|
||
$res['status'] = 1;
|
||
$res['count'] = $result['data']['count'];
|
||
$res['data'] = $result['data']['list'];
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
|
||
public function addModifyPrice()
|
||
{
|
||
$arr = array(
|
||
'goodsChoice' => '/index.php/Retail/ModifyPriceOrder/goodsList',
|
||
'onSubmit' => '/index.php/Retail/ModifyPriceOrder/ModifyOperation',
|
||
);
|
||
$authArr = checkFunction($arr);
|
||
$this->assign('authArr', $authArr);
|
||
$goodsClass = new GoodsClassify();
|
||
$result = $goodsClass->getGoodsClassTopLevel(session('merchant_userinfo')['id']);
|
||
$this->assign('goodsClass1', json_encode($result['data']['list']));
|
||
$this->display();
|
||
}
|
||
|
||
|
||
/**
|
||
* 选择的调价商品列表
|
||
*/
|
||
public function goodsList()
|
||
{
|
||
$data = I('post.');
|
||
$data['user_type'] = 1;
|
||
$data['merchant_id'] = session('merchant_userinfo')['id'];
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$result = $ModifyPriceSingleClass->getGoodsList($data);
|
||
$res['status'] = 1;
|
||
$res['msg'] = '查询成功';
|
||
$res['count'] = $result['data']['count'];
|
||
$res['data'] = $result['data']['list'];
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
|
||
/**
|
||
* 调价提交
|
||
*/
|
||
public function ModifyOperation()
|
||
{
|
||
$data = I("post.");
|
||
$parameter = [
|
||
'user_type'=>1,
|
||
'merchant_id'=>session('merchant_userinfo')['id'],
|
||
'supplier_type'=>1,
|
||
'type'=>$data['type'],
|
||
'modify_order_number'=>$data['modify_order_number'],
|
||
'operator_id'=>session("jurisdiction_user")['id'],
|
||
'remarks'=>$data['remarks'],
|
||
'goodsList'=>json_decode(htmlspecialchars_decode($data['goodsList']), true),
|
||
];
|
||
$ModifyPriceSingle = new ModifyPriceSingle();
|
||
$result = $ModifyPriceSingle->modifyPriceOperation($parameter);
|
||
if($result['status'] == 1){
|
||
//操作日志记录
|
||
$source = 0;//请求来源: 0pc系统 1小助手
|
||
$type = 3;//平台:1合伙人端 2代理商端 3商户端 4门店端
|
||
$request_data = json_encode($_POST);//请求参数 json数据
|
||
$desc = '调价单-添加';//操作行为描述
|
||
action_log($source, $type, $request_data, $desc);
|
||
}
|
||
$this->ajaxReturn($result);
|
||
}
|
||
|
||
|
||
/*
|
||
* 详情
|
||
*/
|
||
public function details()
|
||
{
|
||
$arr = array(
|
||
'exportOperation' => '/index.php/Retail/ModifyPriceOrder/detailsExport',
|
||
);
|
||
$authArr = checkFunction($arr);
|
||
$this->assign('authArr', $authArr);
|
||
$id = I("get.id");
|
||
$info = D('ModifyPriceOrder')->getFind(array('id' => $id));
|
||
$info['add_time'] = date('Y-m-d H:i:s', $info['add_time']);
|
||
$info['remarks'] = str_replace("\n", "", $info['remarks']);
|
||
$warehouse = D('SaleWarehouse')->getFindField(array('id' => $info['warehouse_id']), "name");
|
||
$this->assign('id', $id);
|
||
$this->assign('warehouse', $warehouse);
|
||
$this->assign('info', $info);
|
||
$this->display();
|
||
}
|
||
|
||
|
||
/**
|
||
*调价单详情的商品列表
|
||
*/
|
||
public function detailsList()
|
||
{
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$result = $ModifyPriceSingleClass->ModifyPriceGoodsList([
|
||
'user_type' => 1,
|
||
'id' => I('post.id') //调价单id
|
||
]);
|
||
$res['status'] = 1;
|
||
$res['msg'] = '';
|
||
$res['data'] = $result['data']['list'];
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
|
||
/**
|
||
* 调价单列表导出
|
||
* @throws \PHPExcel_Exception
|
||
* @throws \PHPExcel_Reader_Exception
|
||
* @throws \PHPExcel_Writer_Exception
|
||
*/
|
||
public function export()
|
||
{
|
||
$data = I('get.');
|
||
$data['merchant_id'] = session('merchant_userinfo')['id'];
|
||
$data['user_type'] = 1; //商户
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$ModifyPriceSingleClass->ModifyPriceSingleListExport($data);
|
||
}
|
||
|
||
|
||
/**
|
||
*调价单详情导出
|
||
*/
|
||
public function detailsExport()
|
||
{
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$ModifyPriceSingleClass->ModifyPriceGoodsListExport([
|
||
'user_type' => 1,
|
||
'id' => I('get.id')
|
||
]);
|
||
}
|
||
} |