Merge remote-tracking branch 'origin/master'
# Conflicts: # app/admin/logic/operation/OpurchaseclassLogic.php
This commit is contained in:
commit
773b07537f
@ -5,6 +5,7 @@ namespace app\admin\controller\operation;
|
|||||||
|
|
||||||
use app\admin\controller\BaseAdminController;
|
use app\admin\controller\BaseAdminController;
|
||||||
use app\admin\lists\operation\OpurchaseclassLists;
|
use app\admin\lists\operation\OpurchaseclassLists;
|
||||||
|
use app\admin\lists\operation\OpurchaseclassofferLists;
|
||||||
use app\admin\logic\operation\OpurchaseclassLogic;
|
use app\admin\logic\operation\OpurchaseclassLogic;
|
||||||
use app\admin\validate\operation\OpurchaseclassValidate;
|
use app\admin\validate\operation\OpurchaseclassValidate;
|
||||||
use app\common\model\goods\Goods;
|
use app\common\model\goods\Goods;
|
||||||
@ -133,24 +134,8 @@ class OpurchaseclassController extends BaseAdminController
|
|||||||
*/
|
*/
|
||||||
public function goods_offer_list()
|
public function goods_offer_list()
|
||||||
{
|
{
|
||||||
$id = $this->request->get('id');
|
|
||||||
$page_no = $this->request->get('page_no', 1);
|
return $this->dataLists(new OpurchaseclassofferLists());
|
||||||
$params=$this->request->get();
|
|
||||||
$where['order_id']=$id;
|
|
||||||
if(isset($params['is_adopt']) && $params['is_adopt']!==''){
|
|
||||||
$where['is_adopt']=$params['is_adopt'];
|
|
||||||
}
|
|
||||||
$res = OpurchaseGoodsOffer::where($where)->page($page_no, 25)->select()->each(function ($item) {
|
|
||||||
$find = Goods::where('id', $item['goods_id'])->with('unitName')->find();
|
|
||||||
$item['goods_name'] = $find['name'];
|
|
||||||
$item['unit_name'] = $find['unit_name'];
|
|
||||||
$item['supplier_name'] = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
|
||||||
});
|
|
||||||
$data['count'] = Opurchaseinfo::where('pid', $id)->count();
|
|
||||||
$data['lists'] = $res?->toArray();
|
|
||||||
$data['page_no'] = $page_no;
|
|
||||||
$data['page_siz'] = 15;
|
|
||||||
return $this->success('ok', $data);
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @notes 推送给供应商报价
|
* @notes 推送给供应商报价
|
||||||
@ -178,9 +163,12 @@ class OpurchaseclassController extends BaseAdminController
|
|||||||
public function goods_offer_update()
|
public function goods_offer_update()
|
||||||
{
|
{
|
||||||
$id = $this->request->post('id');
|
$id = $this->request->post('id');
|
||||||
$result = OpurchaseclassLogic::goodsOfferUpdate($id);
|
$type = $this->request->post('type');
|
||||||
if ($result) {
|
$notes = $this->request->post('notes');
|
||||||
return $this->success('已采纳', [], 1, 1);
|
$nums = $this->request->post('nums');
|
||||||
|
$result = OpurchaseclassLogic::goodsOfferUpdate($id,$type,$notes,$nums);
|
||||||
|
if ($result==true) {
|
||||||
|
return $this->success('已设置', [], 1, 1);
|
||||||
}
|
}
|
||||||
return $this->fail(OpurchaseclassLogic::getError());
|
return $this->fail(OpurchaseclassLogic::getError());
|
||||||
}
|
}
|
||||||
|
72
app/admin/lists/operation/OpurchaseclassofferLists.php
Normal file
72
app/admin/lists/operation/OpurchaseclassofferLists.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\lists\operation;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
|
use app\common\model\operation\Opurchaseclass;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\goods\Goods;
|
||||||
|
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||||
|
use app\common\model\supplier\Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购供应链商户报价
|
||||||
|
* Class OpurchaseclassofferLists
|
||||||
|
* @package app\admin\listsoperation
|
||||||
|
*/
|
||||||
|
class OpurchaseclassofferLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 设置搜索条件
|
||||||
|
* @return \string[][]
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/04/27 11:26
|
||||||
|
*/
|
||||||
|
public function setSearch(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'=' => ['is_adopt'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取采购供应链商户报价列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/04/27 11:26
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
$where=[];
|
||||||
|
return OpurchaseGoodsOffer::where($this->searchWhere)
|
||||||
|
->where($where)
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()->each(function ($item) {
|
||||||
|
$find = Goods::where('id', $item['goods_id'])->with('unitName')->find();
|
||||||
|
$item['goods_name'] = $find['name'];
|
||||||
|
$item['unit_name'] = $find['unit_name'];
|
||||||
|
$item['supplier_name'] = Supplier::where('id',$item['supplier_id'])->value('mer_name');
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取采购供应链商户报价数量
|
||||||
|
* @return int
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2024/04/27 11:26
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return OpurchaseGoodsOffer::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -92,28 +92,21 @@ class OpurchaseclassLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function detail($params): array
|
public static function detail($params): array
|
||||||
{
|
{
|
||||||
|
$id=$params['id'];
|
||||||
$data = Opurchaseclass::findOrEmpty($params['id'])->toArray();
|
$data = Opurchaseclass::findOrEmpty($params['id'])->toArray();
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$data['goods_info'] = Opurchaseinfo::where('pid', $params['id'])->limit(25)->select()->each(function ($item) {
|
$data['goods_info'] = Opurchaseinfo::where('pid', $params['id'])->limit(25)->select()->each(function ($item)use($id) {
|
||||||
$find = Goods::where('id', $item['goods'])->with('unitName')->find();
|
$find = Goods::where('id', $item['goods'])->with('unitName')->find();
|
||||||
if ($find) {
|
if ($find) {
|
||||||
$item['goods_name'] = $find['name'];
|
$item['goods_name'] = $find['name'];
|
||||||
$item['unit_name'] = $find['unit_name'];
|
$item['unit_name'] = $find['unit_name'];
|
||||||
}
|
}
|
||||||
// $sys_labels = Goods::where('id', $item['goods'])->value('sys_labels');
|
$where=[
|
||||||
// $supplier_arr=[];
|
'goods_id'=>$item['goods'],
|
||||||
// if($sys_labels){
|
'order_id'=>$id,
|
||||||
// $arr = explode(',', $sys_labels);
|
'is_adopt'=>1
|
||||||
// foreach ($arr as $k => $v) {
|
];
|
||||||
// if($v>0){
|
$item['nums_count']=OpurchaseGoodsOffer::where($where)->sum('nums');
|
||||||
// $supplier=Supplier::whereLike('sys_labels', "%," . $v . ",%")->field('id,mer_name')->find();
|
|
||||||
// if($supplier){
|
|
||||||
// $supplier_arr[]=$supplier;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// $item['supplier'] = array_unique($supplier_arr);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
$data['merchant_name'] = Merchant::where('mer_id', $data['merchant'])->value('mer_name');
|
$data['merchant_name'] = Merchant::where('mer_id', $data['merchant'])->value('mer_name');
|
||||||
@ -198,11 +191,27 @@ class OpurchaseclassLogic extends BaseLogic
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @date 2024/04/27 11:26
|
* @date 2024/04/27 11:26
|
||||||
*/
|
*/
|
||||||
public static function goodsOfferUpdate($params)
|
public static function goodsOfferUpdate($id,$type=0,$notes='',$nums=0)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
OpurchaseGoodsOffer::where('id', $params)->update(['is_adopt' => 2]);
|
$find=OpurchaseGoodsOffer::where('id', $id)->find();
|
||||||
return true;
|
if($type==0){
|
||||||
|
if($find &&$find['price']==0){
|
||||||
|
self::setError('报价未设置');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$find->is_adopt=1;
|
||||||
|
}else{
|
||||||
|
$find->is_storage=1;
|
||||||
|
$find->notes=$notes;
|
||||||
|
$find->before_nums=$find->nums;
|
||||||
|
$find->nums=$nums;
|
||||||
|
}
|
||||||
|
$res= $find->save();
|
||||||
|
if($res){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
self::setError($e->getMessage());
|
self::setError($e->getMessage());
|
||||||
return false;
|
return false;
|
||||||
|
@ -95,18 +95,18 @@ class RetailOrderController extends BaseApiController
|
|||||||
$order = OrderLogic::createOrder($cartId, $addressId, null, $params);
|
$order = OrderLogic::createOrder($cartId, $addressId, null, $params);
|
||||||
if ($order != false) {
|
if ($order != false) {
|
||||||
switch ($pay_type) {
|
switch ($pay_type) {
|
||||||
case PayEnum::WECHAT_PAY:
|
case PayEnum::BALANCE_PAY:
|
||||||
//余额支付
|
//余额支付
|
||||||
$user = User::where('id', $this->request->userId)->find();
|
$user = User::where('id', $this->request->userId)->find();
|
||||||
$res = RetailOrderLogic::payBalance($user, $order);
|
$res = RetailOrderLogic::payBalance($user, $order);
|
||||||
if (RetailOrderLogic::hasError()) {
|
if (RetailOrderLogic::hasError()) {
|
||||||
|
return $this->fail(RetailOrderLogic::getError());
|
||||||
|
} else {
|
||||||
$res = RetailOrderLogic::paySuccess($order, ['money' => $order['actual']]);
|
$res = RetailOrderLogic::paySuccess($order, ['money' => $order['actual']]);
|
||||||
if (RetailOrderLogic::hasError()) {
|
if (RetailOrderLogic::hasError()) {
|
||||||
} else {
|
|
||||||
return $this->fail(RetailOrderLogic::getError());
|
return $this->fail(RetailOrderLogic::getError());
|
||||||
}
|
}
|
||||||
} else {
|
return $this->success('余额支付成功');
|
||||||
return $this->fail(RetailOrderLogic::getError());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PayEnum::WECHAT_PAY:
|
case PayEnum::WECHAT_PAY:
|
||||||
|
@ -74,7 +74,9 @@ class OrderLogic extends BaseLogic
|
|||||||
static public function createOrder($cartId, $addressId, $user = null, $params = [])
|
static public function createOrder($cartId, $addressId, $user = null, $params = [])
|
||||||
{
|
{
|
||||||
$orderInfo = self::cartIdByOrderInfo($cartId, $addressId, $user, $params);
|
$orderInfo = self::cartIdByOrderInfo($cartId, $addressId, $user, $params);
|
||||||
|
if(!$orderInfo){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$_order = $orderInfo['order'];
|
$_order = $orderInfo['order'];
|
||||||
$_order['deduction_price'] = 0;
|
$_order['deduction_price'] = 0;
|
||||||
$_order['merchant'] = $params['mer_id'];
|
$_order['merchant'] = $params['mer_id'];
|
||||||
|
@ -23,7 +23,7 @@ return [
|
|||||||
// 断线重连
|
// 断线重连
|
||||||
'break_reconnect' => true,
|
'break_reconnect' => true,
|
||||||
// 关闭SQL监听日志
|
// 关闭SQL监听日志
|
||||||
'trigger_sql' => true,
|
'trigger_sql' => false,
|
||||||
// 自定义分页类
|
// 自定义分页类
|
||||||
'bootstrap' => ''
|
'bootstrap' => ''
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user