Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev
This commit is contained in:
commit
7f99a6b34e
@ -109,12 +109,12 @@ class PurchaseProductOfferController extends BaseAdminController
|
||||
PurchaseProductOfferLogic::setStoreroomInfo($params);
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
public function setStoreroomInfoTwo()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
PurchaseProductOfferLogic::setStoreroomInfoTwo($params);
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
// public function setStoreroomInfoTwo()
|
||||
// {
|
||||
// $params = $this->request->post();
|
||||
// PurchaseProductOfferLogic::setStoreroomInfoTwo($params);
|
||||
// return $this->success('设置成功', [], 1, 1);
|
||||
// }
|
||||
/**
|
||||
* @notes 删除采购商品
|
||||
* @return \think\response\Json
|
||||
|
@ -77,9 +77,10 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
||||
}
|
||||
if (!empty($this->params['store_staff_id']) || !empty($this->params['is_store'])) {
|
||||
$this->searchWhere[] = ['store_staff_id', '>', 0];
|
||||
} else {
|
||||
$this->searchWhere[] = ['store_staff_id', '=', 0];
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// $this->searchWhere[] = ['store_staff_id', '=', 0];
|
||||
// }
|
||||
if ($order_rk!='') {
|
||||
$oid=WarehouseOrder::where('financial_pm',1)->where('code','like','%'.$order_rk)->column('id');
|
||||
$this->searchWhere[] = ['warehousing_id','in',$oid];
|
||||
|
@ -222,19 +222,19 @@ class PurchaseProductOfferLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
$offer->save([
|
||||
'buyer_nums' => $params['buyer_nums'],
|
||||
// 'buyer_nums' => $params['buyer_nums'],
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'price' => $params['purchase'],
|
||||
'purchase_price' => $params['purchase_price'] ?? 0,
|
||||
// 'price' => $params['purchase'],
|
||||
// 'purchase_price' => $params['purchase_price'] ?? 0,
|
||||
'total_price' => $params['total_price'],
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'buyer_confirm' => 1,
|
||||
'package' => $params['package'],
|
||||
'store_info' => $params['store_info'],
|
||||
'marques' => $params['marques'],
|
||||
'after_sales' => $params['after_sales'],
|
||||
'manufacture' => $params['manufacture'],
|
||||
'expiration_date' => $params['expiration_date'],
|
||||
// 'package' => $params['package'],
|
||||
// 'store_info' => $params['store_info'],
|
||||
// 'marques' => $params['marques'],
|
||||
// 'after_sales' => $params['after_sales'],
|
||||
// 'manufacture' => $params['manufacture'],
|
||||
// 'expiration_date' => $params['expiration_date'],
|
||||
]);
|
||||
// $find = StoreProductPrice::where(['offer_id' => $params['id']])->find();
|
||||
$product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('id,store_name,top_cate_id,two_cate_id,cate_id')->find();
|
||||
@ -243,36 +243,6 @@ class PurchaseProductOfferLogic extends BaseLogic
|
||||
$order->pay_price = PurchaseProductOffer::where('order_id', $order['id'])->sum('total_price');
|
||||
$order->total_price = $order->pay_price;
|
||||
$order->save();
|
||||
self::setProductGroupPrice($params, $product);
|
||||
// $data = [];
|
||||
// $dict_data = DictData::where('type_value', 'price_lv_' . $product['top_cate_id'])->field('name,value')->select();
|
||||
// $data['bhoid'] = $offer['order_id'];
|
||||
// $data['offer_id'] = $params['id'];
|
||||
// $data['product_id'] = $offer['product_id'];
|
||||
// $data['purchase_price'] = $params['purchase'];
|
||||
// $data['status'] = 0;
|
||||
// if ($dict_data) {
|
||||
// foreach ($dict_data as $k => $v) {
|
||||
// if ($v['name'] == 'purchase') {
|
||||
// $data['purchase_lv'] = $v['value'];
|
||||
// $lv = bcmul($v['value'], $params['purchase'], 2);
|
||||
// $data['purchase'] = bcadd($lv, $params['purchase'], 2);
|
||||
// } elseif ($v['name'] == 'cost') {
|
||||
// $data['cost_lv'] = $v['value'];
|
||||
// $lv = bcmul($v['value'], $params['purchase'], 2);
|
||||
// $data['cost'] = bcadd($lv, $params['purchase'], 2);
|
||||
// } elseif ($v['name'] == 'price') {
|
||||
// $data['price_lv'] = $v['value'];
|
||||
// $lv = bcmul($v['value'], $params['purchase'], 2);
|
||||
// $data['price'] = bcadd($lv, $params['purchase'], 2);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if ($find) {
|
||||
// $find->save($data);
|
||||
// } else {
|
||||
// StoreProductPrice::create($data);
|
||||
// }
|
||||
Db::commit();
|
||||
$offer['store_name'] = $product['store_name'];
|
||||
$offer['unit_name'] = $unit_name;
|
||||
@ -288,7 +258,6 @@ class PurchaseProductOfferLogic extends BaseLogic
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
Db::rollback();
|
||||
d($e);
|
||||
throw new BusinessException($e->getMessage());
|
||||
}
|
||||
}
|
||||
@ -336,22 +305,25 @@ class PurchaseProductOfferLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
PurchaseProductOffer::where('id', $params['id'])->update(['is_accept' => 1]);
|
||||
$find = BeforehandOrderCartInfo::where(['bhoid' => $params['bhoid'], 'product_id' => $params['product_id']])->find();
|
||||
$data = [
|
||||
'gross_weight' => $params['gross_weight'] ?? 0,
|
||||
'net_weight' => $params['net_weight'] ?? 0,
|
||||
'accept_num' => $params['accept_num'] ?? 0,
|
||||
];
|
||||
if ($params['accept_num'] != $find['cart_num']) {
|
||||
$pay_price = bcmul($params['accept_num'], $find['price'], 2);
|
||||
$data['pay_price'] = $pay_price;
|
||||
if($params['accept_num']<=0){
|
||||
throw new BusinessException('分拣数量不能小于0');
|
||||
}
|
||||
$find->save($data);
|
||||
if ($params['accept_num'] != $find['cart_num']) {
|
||||
$pay_price = BeforehandOrderCartInfo::where(['bhoid' => $params['bhoid']])->sum('pay_price');
|
||||
BeforehandOrder::where('id', $params['bhoid'])->update(['pay_price' => $pay_price]);
|
||||
$offer=PurchaseProductOffer::where('id', $params['id'])->find();
|
||||
$offer_data = ['buyer_nums' => $params['accept_num'],];
|
||||
$offer_data['is_storage'] = 1;
|
||||
if($offer['total_price']>0){
|
||||
$price= bcdiv($offer['total_price'],$params['accept_num'], 2);
|
||||
$offer_data['price'] = $price;
|
||||
}else{
|
||||
throw new BusinessException('采购总价不能为0');
|
||||
}
|
||||
$offer->save($offer_data);
|
||||
|
||||
$pay_price = PurchaseProductOffer::where(['order_id' => $offer['order_id']])->sum('total_price');
|
||||
BeforehandOrder::where('id', $offer['bhoid'])->update(['pay_price' => $pay_price]);
|
||||
$product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('id,store_name,top_cate_id,two_cate_id,cate_id')->find();
|
||||
$offer['purchase']=$price;
|
||||
self::setProductGroupPrice($offer, $product);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user