更新委托商品处理
This commit is contained in:
parent
79fdbef9d3
commit
0d1e33f245
@ -101,6 +101,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
throw new ValidateException('采购商品不支持跨店购买');
|
||||
}
|
||||
$community = [];
|
||||
// 99 委托商品是否设置收货方式
|
||||
if ($order_type == 98) {
|
||||
$sourceIdArray = [];
|
||||
foreach($merchantCart['list'] as $prod){
|
||||
@ -138,7 +139,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
}
|
||||
$orderDeliveryStatus = true;
|
||||
$order_svip_discount = 0;
|
||||
// 循环计算每个店铺的订单数据
|
||||
// 循环计算每个店铺的订单数据 99 委托商品是否设置收货方式
|
||||
foreach ($merchantCartList as &$merchantCart) {
|
||||
if ($order_type == 98 && !empty($deliverMethodArray)) {
|
||||
$merchantCart['delivery_way'] = $deliverMethodArray;
|
||||
@ -172,7 +173,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$product_cart = [];
|
||||
|
||||
foreach ($merchantCart['list'] as $k => $cart) {
|
||||
//处理转售送货方式
|
||||
//处理转售送货方式 99 委托商品是否设置收货方式
|
||||
if ($order_type == 98) {
|
||||
$merchantCart['list'][$k]['product']['delivery_way'] = $cart['product']['delivery_way'] = $deliverMethod ?? '';
|
||||
}
|
||||
|
@ -574,6 +574,14 @@ class StoreOrderRepository extends BaseRepository
|
||||
} else {
|
||||
return $cart['productAttr']['price'];
|
||||
}
|
||||
// 更新委托价格
|
||||
} else if ($cart['product_type'] == '99') {
|
||||
$price = Db::name('entrust')->where('product_attr_unique', $cart['product_attr_unique'])->where('status', 0)->value('price');
|
||||
if ($price) {
|
||||
return $price;
|
||||
} else {
|
||||
return $cart['productAttr']['price'];
|
||||
}
|
||||
} else {
|
||||
return $cart['productAttr']['price'];
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ class ProductRepository extends BaseRepository
|
||||
break;
|
||||
}
|
||||
if ($productType == 0) {
|
||||
$where[] = empty($merId) ? ['product_type', 'in', [0, 98]] : ['product_type', 'in', [0]];
|
||||
$where[] = empty($merId) ? ['product_type', 'in', [0, 98, 99]] : ['product_type', 'in', [0]];
|
||||
if (!$merId) $where['is_gift_bag'] = 0;
|
||||
}
|
||||
if ($productType == 1) {
|
||||
@ -1170,6 +1170,7 @@ class ProductRepository extends BaseRepository
|
||||
switch ($res['product_type']) {
|
||||
case 0:
|
||||
case 98:
|
||||
case 99:
|
||||
$append[] = 'max_integral';
|
||||
$append[] = 'show_svip_info';
|
||||
break;
|
||||
@ -2171,6 +2172,7 @@ class ProductRepository extends BaseRepository
|
||||
{
|
||||
case 0:
|
||||
case 98:
|
||||
case 99:
|
||||
return $this->apiProductDetail(['product_id' => $data['id']], $data['product_type'], 0);
|
||||
break;
|
||||
case 1:
|
||||
@ -2374,7 +2376,7 @@ class ProductRepository extends BaseRepository
|
||||
}
|
||||
$find = Db::name('store_product')->where('product_id', $product_id)->find();
|
||||
if ($find) {
|
||||
if (!in_array($find['product_type'], [0, 98])) {
|
||||
if (!in_array($find['product_type'], [0, 98, 99])) {
|
||||
throw new ValidateException('该商品不是普通商品');
|
||||
}
|
||||
$exist = Db::name('store_product')->where('source_product_id', $product_id)->where('mer_id', $mer_id)->find();
|
||||
|
@ -281,6 +281,7 @@ class SpuRepository extends BaseRepository
|
||||
switch ($productType) {
|
||||
case 0:
|
||||
case 98:
|
||||
case 99:
|
||||
$where = [
|
||||
'activity_id' => 0,
|
||||
'product_id' => $id,
|
||||
@ -379,14 +380,14 @@ class SpuRepository extends BaseRepository
|
||||
}
|
||||
$ret = $make->getWhere(['product_id' => $where['product_id']]);
|
||||
if (!$ret || $ret['status'] !== 1 || $ret['mer_status'] !== 1 || $ret['is_del']) $status = 0;
|
||||
if (in_array($productType, [0, 1,98]) && ($ret['is_show'] !== 1 || $ret['is_used'] !== 1)) $status = 0;
|
||||
if (in_array($productType, [0, 1,98, 99]) && ($ret['is_show'] !== 1 || $ret['is_used'] !== 1)) $status = 0;
|
||||
$result = $this->dao->getSearch($where)->find();
|
||||
if (!$result && $ret) $result = $this->create($ret->toArray(), $where['product_id'], $where['activity_id'], $productType);
|
||||
if ($result) $this->dao->update($result['spu_id'], ['status' => $status]);
|
||||
if ($status == 1 && in_array($productType, [0, 98])) {
|
||||
if ($status == 1 && in_array($productType, [0, 98, 99])) {
|
||||
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
||||
}
|
||||
if (in_array($productType, [0, 98])) Queue::push(SyncProductTopJob::class,[]);
|
||||
if (in_array($productType, [0, 98, 99])) Queue::push(SyncProductTopJob::class,[]);
|
||||
return true;
|
||||
} catch (\Exception $exception) {
|
||||
Log::info($exception->getMessage());
|
||||
|
@ -64,6 +64,7 @@ class JgPush
|
||||
}
|
||||
break;
|
||||
case 'MERCHANT_CREDIT_BUY_NOTICE':
|
||||
// 委托商品是否需要提醒信息
|
||||
$route = "/pages/order_details/stay?order_id={$data['orderId']}&product_type=98";
|
||||
$merUserId = Merchant::where('mer_id', $data['id'])->value('uid');
|
||||
$jgRegisterId = User::where('uid', $merUserId)->value('jg_register_id');
|
||||
|
@ -82,7 +82,7 @@ class StoreCart extends BaseController
|
||||
}
|
||||
}
|
||||
$entryMerId = $decryptArray[0] ?? '';
|
||||
if(!in_array($data['product_type'],[0,1,2,3,4,98])) return app('json')->fail('商品类型错误');
|
||||
if(!in_array($data['product_type'],[0,1,2,3,4,98,99])) return app('json')->fail('商品类型错误');
|
||||
if ($data['cart_num'] <= 0) return app('json')->fail('购买数量有误');
|
||||
$user = $this->request->userInfo();
|
||||
event('user.cart.before',compact('user','data'));
|
||||
@ -90,6 +90,7 @@ class StoreCart extends BaseController
|
||||
{
|
||||
case 0: //普通商品
|
||||
case 98: //供应链商品
|
||||
case 99: //委托商品
|
||||
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
||||
[$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', ''];
|
||||
$data['source'] = (in_array($source, [0, 1]) && $pid == $data['product_id']) ? $source : 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user