221 行
7.4 KiB
PHP
可执行文件
221 行
7.4 KiB
PHP
可执行文件
<?php
|
||
|
||
namespace Retail\Controller;
|
||
|
||
use Common\Business\ModifyPriceSingle;
|
||
use Think\Controller;
|
||
|
||
//[1.5.59]
|
||
class SModifyPriceOrderController extends BaseController
|
||
{
|
||
static $showPrice;
|
||
static $identity;
|
||
static $global_store_jurisdiction;
|
||
|
||
public function _initialize()
|
||
{
|
||
self::$showPrice = session('global_store_jurisdiction')['showpurch_price'];
|
||
self::$identity = session("identity");
|
||
self::$global_store_jurisdiction = session('global_store_jurisdiction');
|
||
}
|
||
|
||
/*
|
||
* 查询仓库
|
||
*/
|
||
private function Info($merchant_id, $store_id)
|
||
{
|
||
$map['merchant_id'] = $merchant_id;
|
||
$map['store_id'] = $store_id;
|
||
$map['status'] = 1;
|
||
$fields = "id,name";
|
||
$warehouse = D('SSaleWarehouse')->getSelect($map, $page = '', $limit = '', $fields);
|
||
$this->assign('warehouse', json_encode($warehouse)); //销售仓库
|
||
}
|
||
|
||
/*
|
||
* 商品分类
|
||
*/
|
||
private function goodsClass($merchant_id)
|
||
{
|
||
$class_name = M('retail_goods_class')->where(array('merchantid' => $merchant_id, 'status' => 0, 'type' => 1))->order('code asc')->select();
|
||
$this->assign('goodsClass1', json_encode($class_name));
|
||
}
|
||
|
||
public function index()
|
||
{
|
||
$arr = array(
|
||
'addPurchaseOrder' => '/index.php/Retail/SModifyPriceOrder/addModifyPrice',
|
||
'OrderInfo' => '/index.php/Retail/SModifyPriceOrder/details',
|
||
'exportOperation' => '/index.php/Retail/SModifyPriceOrder/export'
|
||
);
|
||
$authArr = checkFunction($arr);
|
||
$this->assign('authArr', $authArr);
|
||
$this->assign("identity", self::$identity);
|
||
$this->assign("global_store_jurisdiction", self::$global_store_jurisdiction);
|
||
$this->display();
|
||
}
|
||
|
||
public function modifyOrderList()
|
||
{
|
||
$data = I("post.");
|
||
$data['user_type'] = 2; //门店
|
||
$data['merchant_id'] = session('ls_userinfo')['merchantid'];
|
||
$data['store_id'] = session("storeid");
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$result = $ModifyPriceSingleClass->getModifyPriceSingleList($data);
|
||
$res['status'] = 1;
|
||
$res['data'] = $result['data']['list'];
|
||
$res['count'] = $result['data']['count'];
|
||
$this->ajaxReturn($res);
|
||
}
|
||
|
||
public function addModifyPrice()
|
||
{
|
||
$arr = array(
|
||
'goodsChoice' => '/index.php/Retail/SModifyPriceOrder/goodsList',
|
||
'onSubmit' => '/index.php/Retail/SModifyPriceOrder/ModifyOperation',
|
||
);
|
||
$authArr = checkFunction($arr);
|
||
$this->assign('authArr', $authArr);
|
||
$merchant_id = session("ls_userinfo")['merchantid'];
|
||
$store_id = session("storeid");
|
||
$this->Info($merchant_id, $store_id);
|
||
$this->goodsClass($merchant_id);
|
||
$this->assign('showPrice', self::$showPrice);
|
||
$this->assign('identity', self::$identity);
|
||
$this->display();
|
||
}
|
||
|
||
/*
|
||
* 调价的商品
|
||
*/
|
||
public function goodsList()
|
||
{
|
||
$data = I("post.");
|
||
$parameter = [
|
||
'user_type'=>2,
|
||
'merchant_id'=>session('ls_userinfo')['merchantid'],
|
||
'store_id'=>session('storeid'),
|
||
'type'=>$data['type'],
|
||
'modify_order_number'=>$data['modify_order_number'],
|
||
'page'=>$data['page'],
|
||
'limit'=>$data['limit'],
|
||
'searchText'=>$data['searchText'],
|
||
];
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$result = $ModifyPriceSingleClass->getGoodsList($parameter);
|
||
$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' => 2,
|
||
'supplier_type'=>session('ls_userinfo')['supplier_type'],
|
||
'merchant_id' => session("ls_userinfo")['merchantid'],
|
||
'store_id' => session("storeid"),
|
||
'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)
|
||
];
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$result = $ModifyPriceSingleClass->modifyPriceOperation($parameter);
|
||
if ($result['status'] == 1) {
|
||
//操作日志记录
|
||
$source = 0;//请求来源: 0pc系统 1小助手
|
||
$type = 4;//平台: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/SModifyPriceOrder/detailsExport',
|
||
);
|
||
$authArr = checkFunction($arr);
|
||
$this->assign('authArr', $authArr);
|
||
$id = I("get.id");
|
||
$info = D('SModifyPriceOrder')->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('SSaleWarehouse')->getFindField(array('id' => $info['warehouse_id']), "name");
|
||
$this->assign('id', $id);
|
||
$this->assign('warehouse', $warehouse);
|
||
$this->assign('info', $info);
|
||
$this->assign('showPrice', self::$showPrice);
|
||
$this->assign('identity', self::$identity);
|
||
$this->assign('global_store_jurisdiction', self::$global_store_jurisdiction);
|
||
$this->display();
|
||
}
|
||
|
||
|
||
/**
|
||
* 调价单详情的商品列表
|
||
*/
|
||
public function detailsList()
|
||
{
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$result = $ModifyPriceSingleClass->ModifyPriceGoodsList([
|
||
'user_type' => 2,
|
||
'showPrice' => self::$showPrice,
|
||
'identity' => self::$identity,
|
||
'id' => I('post.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('ls_userinfo')['merchantid'];
|
||
$data['store_id'] = session("storeid");
|
||
$data['user_type'] = 2; //门店
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$ModifyPriceSingleClass->ModifyPriceSingleListExport($data);
|
||
}
|
||
|
||
/**
|
||
* 调价单详情导出
|
||
* @throws \PHPExcel_Exception
|
||
* @throws \PHPExcel_Reader_Exception
|
||
* @throws \PHPExcel_Writer_Exception
|
||
*/
|
||
public function detailsExport()
|
||
{
|
||
$ModifyPriceSingleClass = new ModifyPriceSingle();
|
||
$ModifyPriceSingleClass->ModifyPriceGoodsListExport([
|
||
'user_type' => 2,
|
||
'showPrice' => self::$showPrice,
|
||
'identity' => self::$identity,
|
||
'id' => I('get.id')
|
||
]);
|
||
}
|
||
|
||
} |