Merge pull request 'dev' (#255) from dev into main

Reviewed-on: #255
This commit is contained in:
mkm 2024-10-12 20:57:44 +08:00
commit d5062c8be2
4 changed files with 20 additions and 9 deletions

View File

@ -43,7 +43,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
public function lists(): array public function lists(): array
{ {
return BeforehandOrder::where($this->searchWhere) return BeforehandOrder::where($this->searchWhere)
->field(['id','order_id', 'uid','order_type','total_num','total_price','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark']) ->field(['id','order_id', 'uid','order_type','total_num','total_price','outbound_id','admin_id', 'pay_price', 'deduction_price','create_time', 'status', 'mark'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($item){ ->select()->each(function ($item){

View File

@ -92,9 +92,12 @@ class BeforehandOrderLogic extends BaseLogic
*/ */
public static function generateOrder(array $params): bool public static function generateOrder(array $params): bool
{ {
$order = BeforehandOrder::where('id', $params['id'])->find();
if ($order['order_type']==4) {
throw new BusinessException('该订单类型不能生成支付订单');
}
Db::startTrans(); Db::startTrans();
try { try {
$order = BeforehandOrder::where('id', $params['id'])->find();
$cart_info = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->toArray(); $cart_info = BeforehandOrderCartInfo::where('bhoid', $params['id'])->select()->toArray();
$cart_select = []; $cart_select = [];
@ -225,7 +228,6 @@ class BeforehandOrderLogic extends BaseLogic
return true; return true;
} catch (\Throwable $e) { } catch (\Throwable $e) {
Db::rollback(); Db::rollback();
d($e);
throw new BusinessException($e->getMessage()); throw new BusinessException($e->getMessage());
} }
} }
@ -345,6 +347,10 @@ class BeforehandOrderLogic extends BaseLogic
$datas = []; $datas = [];
$order = StoreOrder::where('id', $params['id'])->find(); $order = StoreOrder::where('id', $params['id'])->find();
$find=BeforehandOrder::where('order_sn',$order['order_id'])->find();
if($find){
throw new BusinessException('该订单已转成预定单,请勿重新转');
}
$info = StoreOrderCartInfo::where('oid', $params['id'])->select(); $info = StoreOrderCartInfo::where('oid', $params['id'])->select();
$total_num = $order['total_num']; $total_num = $order['total_num'];
$total_price = $order['total_price']; $total_price = $order['total_price'];
@ -369,6 +375,7 @@ class BeforehandOrderLogic extends BaseLogic
'total_price' => $total_price, 'total_price' => $total_price,
'pay_price' => 0, 'pay_price' => 0,
'pay_type' => 0, 'pay_type' => 0,
'order_type' => 4,
'deduction_price' => 0, 'deduction_price' => 0,
'paid' => 0, 'paid' => 0,
'mark' => $params['mark'] ?? '' 'mark' => $params['mark'] ?? ''

View File

@ -5,6 +5,7 @@ namespace app\api\controller\purchase_product_offer;
use app\api\lists\purchase_product_offer\PurchaseProductOfferLists; use app\api\lists\purchase_product_offer\PurchaseProductOfferLists;
use app\api\controller\BaseApiController; use app\api\controller\BaseApiController;
use app\common\model\dict\DictData;
use app\common\model\purchase_product_offer\PurchaseProductOffer; use app\common\model\purchase_product_offer\PurchaseProductOffer;
@ -53,11 +54,12 @@ class PurchaseProductOfferController extends BaseApiController
* 出库上浮比例列表 * 出库上浮比例列表
*/ */
public function outbound_floating_lv(){ public function outbound_floating_lv(){
$data[]=[ $list=DictData::where('type_value','outbound_floating')->field('name,value')->select()->each(function($item){
['name'=>'干货/5','value'=>0.05], $item->name_b=$item->name;
['name'=>'鲜货/15','value'=>0.15], $item->name=$item->name.'/'.$item->value;
['name'=>'粮油/5','value'=>0.05], $item->value=convertStringToNumber($item->value);
]; });
$data[]=$list;
return $this->success('ok',$data); return $this->success('ok',$data);
} }

View File

@ -9,6 +9,7 @@ use app\common\model\delivery_service\DeliveryService;
use app\common\model\store_product\StoreProduct; use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_unit\StoreProductUnit; use app\common\model\store_product_unit\StoreProductUnit;
use app\api\lists\BaseApiDataLists; use app\api\lists\BaseApiDataLists;
use app\common\model\store_category\StoreCategory;
/** /**
* 采购供应链商品列表 * 采购供应链商品列表
@ -49,7 +50,7 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI
return []; return [];
} }
return PurchaseProductOffer::where($this->searchWhere) return PurchaseProductOffer::where($this->searchWhere)
->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', 'mark']) ->field(['id', 'order_id', 'product_id', 'price', 'buyer_nums', 'unit', 'is_buyer', 'buyer_confirm','need_num', 'buyer_id', 'status', 'mark','update_time'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['product_id'=>'desc','id' => 'desc']) ->order(['product_id'=>'desc','id' => 'desc'])
->select()->each(function($item){ ->select()->each(function($item){
@ -58,6 +59,7 @@ class PurchaseProductOfferLists extends BaseApiDataLists implements ListsSearchI
$item->image=$find->image; $item->image=$find->image;
$item->store_info=$find->store_info; $item->store_info=$find->store_info;
$item->unit_name=StoreProductUnit::where('id',$item->unit)->value('name'); $item->unit_name=StoreProductUnit::where('id',$item->unit)->value('name');
$item->category_name=StoreCategory::where('id',$find->top_cate_id)->value('name');
if($item->is_buyer==1){ if($item->is_buyer==1){
$item->is_buyer_name='需要采购'; $item->is_buyer_name='需要采购';
}elseif($item->is_buyer==-1){ }elseif($item->is_buyer==-1){