Commit fdc05aec by hcy001

1

parent 83f3d94f
......@@ -164,6 +164,12 @@ class ApiController extends Controller
ExportLayui((new QuoteModel())->lists($input));
}
//历史报价
public function ApiQuoteHistoryList($input, $id)
{
ExportLayui((new QuoteModel())->historyList($input));
}
// 撤销报价
public function ApiCancelQuote($input, $id)
{
......
......@@ -2,6 +2,7 @@
namespace App\Model;
use App\map\InquiryMap;
use App\map\OperationLogMap;
use App\map\QuoteMap;
use Illuminate\Database\Eloquent\Model;
......@@ -181,6 +182,51 @@ class QuoteModel extends Model
}
}
// 获取历史报价
public function historyList($input)
{
$page = $input['page'];
$limit = $input['limit'];
$list = $this->from('quote as q')
->select("q.*")
->join('inquiry_items as it', 'q.inquiry_items_id', '=', 'it.id')
->where(function($query) use ($input) {
foreach ($input as $k=>$b){
switch ($k){
case "goods_name":
$query->where('it.goods_name', 'like', $b.'%');
break;
case "brand_name":
$query->where('it.brand_name', 'like',$b.'%');
break;
}
}
$query->whereIn('q.status', [1,2,3]);
});
$list = $list->orderBy('id', 'desc')->paginate($limit, ['*'], 'page', $page)->toArray();
foreach ( $list['data'] as $b=>&$v) {
if ($v['currency'] == 1){
$v["price_origin"] = "--";
}else{
$v["price_rmb"] = "--";
}
$v["currency"] = InquiryMap::$currency[$v["currency"]];
if ($v['delivery_time'] > 6) {
$v['delivery_time'] = intval($v['delivery_time'] / 7).'周';
} else {
$v['delivery_time'] = $v['delivery_time'].'天';
}
$v["effect_days"] = $v["effect_days"]."天";
$v['price_rmb'] = $v['currency'] == 1 ? $v['price_rmb'] : '';
$v["digikey"] = "包装:".$v["raw_goods_packing"];
}
return [0, '获取成功', $list['data'], $list['total']];
}
// 处理数据
public function handleData($data, $type)
{
......@@ -202,6 +248,8 @@ class QuoteModel extends Model
$v['price_rmb'] = $v['currency'] == 1 ? $v['price_rmb'] : '';
}
$v["digikey"] = "包装".$v["raw_goods_packing"];
}
return $data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment