58 lines
1.7 KiB
PHP
58 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\operation;
|
|
|
|
use app\api\controller\BaseApiController;
|
|
use app\api\lists\operation\OpurchaseGoodsOfferList;
|
|
use app\api\logic\operation\OpurchaseGoodsOfferLogic;
|
|
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
|
|
|
class OpurchaseclassController extends BaseApiController
|
|
{
|
|
|
|
/**
|
|
* 报价列表
|
|
*/
|
|
public function goods_offer_list()
|
|
{
|
|
|
|
return $this->dataLists(new OpurchaseGoodsOfferList());
|
|
}
|
|
|
|
/**
|
|
* 创建报价
|
|
*/
|
|
public function create_price()
|
|
{
|
|
$id = $this->request->post('id');
|
|
$price = $this->request->post('price');
|
|
$nums = $this->request->post('nums');
|
|
$supplier_id = $this->request->userInfo['supplier']['id'];
|
|
if (!$supplier_id) return $this->fail('请先绑定供应商');
|
|
$res = OpurchaseGoodsOffer::where('supplier_id', $supplier_id)->where('id', $id)->update(['price' => $price, 'nums' => $nums]);
|
|
if ($res) return $this->success('报价成功');
|
|
return $this->fail('报价失败');
|
|
}
|
|
|
|
/**
|
|
* 提交物流
|
|
*/
|
|
public function express()
|
|
{
|
|
$delivery_name = $this->request->post('delivery_name');
|
|
$delivery_id = $this->request->post('delivery_id');
|
|
$supplier_id = $this->request->userInfo['supplier']['id'];
|
|
if (!$supplier_id) return $this->fail('请先绑定供应商');
|
|
$data = [
|
|
'delivery_name' => $delivery_name,
|
|
'delivery_id' => $delivery_id,
|
|
'supplier_id'=>$supplier_id,
|
|
];
|
|
$res = OpurchaseGoodsOfferLogic::express($data);
|
|
if (true === $res) {
|
|
return $this->success('提交成功', [], 1, 1);
|
|
}
|
|
return $this->fail(OpurchaseGoodsOfferLogic::getError());
|
|
}
|
|
}
|