commit
ea6a3638e6
@ -30,6 +30,7 @@ class StoreCartDao extends BaseDao
|
|||||||
const SOURCE_STORE_CLOUD = 101; //店铺内云商品
|
const SOURCE_STORE_CLOUD = 101; //店铺内云商品
|
||||||
const SOURCE_CLOUD = 102; //云仓内店铺商品
|
const SOURCE_CLOUD = 102; //云仓内店铺商品
|
||||||
const CITY_CLOUD = 103; //市级云仓商品
|
const CITY_CLOUD = 103; //市级云仓商品
|
||||||
|
const SOURCE_PROCURE = 200; //供应链采购商品B2B
|
||||||
const SOURCE_COMMUNITY_RESALE = 201; //转售商品
|
const SOURCE_COMMUNITY_RESALE = 201; //转售商品
|
||||||
const SOURCE_COMMUNITY_ENTRUST = 202; //委托商品
|
const SOURCE_COMMUNITY_ENTRUST = 202; //委托商品
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ class StoreCartDao extends BaseDao
|
|||||||
$query->field('product_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,is_used,product_type,once_max_count,once_min_count,pay_limit,mer_svip_status,svip_price_type');
|
$query->field('product_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,is_used,product_type,once_max_count,once_min_count,pay_limit,mer_svip_status,svip_price_type');
|
||||||
},
|
},
|
||||||
'productAttr' => function ($query) {
|
'productAttr' => function ($query) {
|
||||||
$query->field('product_id,stock,price,unique,sku,image,svip_price');
|
$query->field('product_id,stock,price,unique,sku,image,svip_price,procure_price');
|
||||||
},
|
},
|
||||||
'merchant' => function ($query) {
|
'merchant' => function ($query) {
|
||||||
$query->field('mer_id,mer_name,mer_state,mer_avatar,is_trader,type_id,credit_buy,street_id')->with(['type_names']);
|
$query->field('mer_id,mer_name,mer_state,mer_avatar,is_trader,type_id,credit_buy,street_id')->with(['type_names']);
|
||||||
@ -113,7 +114,7 @@ class StoreCartDao extends BaseDao
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'productAttr' => function (Relation $query) {
|
'productAttr' => function (Relation $query) {
|
||||||
$query->field('image,extension_one,extension_two,product_id,stock,price,unique,sku,volume,weight,ot_price,cost,svip_price')
|
$query->field('image,extension_one,extension_two,product_id,stock,price,unique,sku,volume,weight,ot_price,cost,svip_price,procure_price')
|
||||||
->append(['bc_extension_one', 'bc_extension_two']);
|
->append(['bc_extension_one', 'bc_extension_two']);
|
||||||
},
|
},
|
||||||
'merchant' => function (Relation $query) use ($uid) {
|
'merchant' => function (Relation $query) use ($uid) {
|
||||||
@ -148,7 +149,7 @@ class StoreCartDao extends BaseDao
|
|||||||
*/
|
*/
|
||||||
public function getCartCount(int $uid,$product_type)
|
public function getCartCount(int $uid,$product_type)
|
||||||
{
|
{
|
||||||
$data = ($this->getModel()::getDB())->where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type])->field('count(*) as count')->select();
|
$data = ($this->getModel()::getDB())->where(['uid' => $uid, 'is_del' => 0, 'is_new' => 0, 'is_pay' => 0,'product_type' => $product_type,'is_fail'=>0])->field('count(*) as count')->select();
|
||||||
$data[0]['count'] = $data[0]['count'] ? $data[0]['count'] : 0;
|
$data[0]['count'] = $data[0]['count'] ? $data[0]['count'] : 0;
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,9 @@ class MerchantAdminDao extends BaseDao
|
|||||||
* @author xaboy
|
* @author xaboy
|
||||||
* @day 2020/7/7
|
* @day 2020/7/7
|
||||||
*/
|
*/
|
||||||
public function merIdByAdmin(int $merId)
|
public function merIdByAdmin(int $merId,$where=[],$level=0)
|
||||||
{
|
{
|
||||||
return MerchantAdmin::getDB()->where('mer_id', $merId)->where('level', 0)->find();
|
return MerchantAdmin::getDB()->where('mer_id', $merId)->where('level',$level)->where($where)->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,9 +34,12 @@ class MerchantAuthMiddleware extends BaseMiddleware
|
|||||||
|
|
||||||
/** @var MenuRepository $menu */
|
/** @var MenuRepository $menu */
|
||||||
$menu = app()->make(MenuRepository::class);
|
$menu = app()->make(MenuRepository::class);
|
||||||
|
|
||||||
if ($admin->level) {
|
if ($admin->level) {
|
||||||
|
if($admin->level==2){
|
||||||
|
$rules = $role->idsByRules(0, $admin->roles);
|
||||||
|
}else{
|
||||||
$rules = $role->idsByRules($request->merId(), $admin->roles);
|
$rules = $role->idsByRules($request->merId(), $admin->roles);
|
||||||
|
}
|
||||||
$menus = count($rules) ? ($merchant->type_id ? $menu->typesByRoutes($merchant->type_id, $rules) : $menu->idsByRoutes($rules)) : [];
|
$menus = count($rules) ? ($merchant->type_id ? $menu->typesByRoutes($merchant->type_id, $rules) : $menu->idsByRoutes($rules)) : [];
|
||||||
$msg = '没有权限访问';
|
$msg = '没有权限访问';
|
||||||
} else {
|
} else {
|
||||||
|
@ -238,6 +238,11 @@ class StoreCart extends BaseModel
|
|||||||
//库存不足
|
//库存不足
|
||||||
if($sku->stock < $this->cart_num || $sku->sku->stock < $this->cart_num) return false;
|
if($sku->stock < $this->cart_num || $sku->sku->stock < $this->cart_num) return false;
|
||||||
break;
|
break;
|
||||||
|
case 98: //供应链商品
|
||||||
|
if ($this->product->product_type !== 98 || $this->product->is_show !== 1 || $this->productAttr->stock < $this->cart_num || $this->product->is_used !== 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 100: //扫码枪商品
|
case 100: //扫码枪商品
|
||||||
if ($this->product->product_type !== 0 || $this->product->is_show !== 1 || $this->productAttr->stock < $this->cart_num || $this->product->is_used !== 1) {
|
if ($this->product->product_type !== 0 || $this->product->is_show !== 1 || $this->productAttr->stock < $this->cart_num || $this->product->is_used !== 1) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,130 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
namespace app\common\repositories\store\order;
|
|
||||||
|
|
||||||
|
|
||||||
use app\common\dao\store\order\StoreCartDao;
|
|
||||||
use app\common\model\store\product\Product;
|
|
||||||
use app\common\repositories\BaseRepository;
|
|
||||||
use app\common\repositories\store\coupon\StoreCouponProductRepository;
|
|
||||||
use app\common\repositories\store\coupon\StoreCouponRepository;
|
|
||||||
use app\common\repositories\store\product\ProductRepository;
|
|
||||||
use think\exception\ValidateException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class StoreCartRepository
|
|
||||||
* @package app\common\repositories\store\order
|
|
||||||
* @author xaboy
|
|
||||||
* @day 2020/5/30
|
|
||||||
* @mixin StoreCartDao
|
|
||||||
*/
|
|
||||||
class StoreCartRepository extends BaseRepository
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* StoreCartRepository constructor.
|
|
||||||
* @param StoreCartDao $dao
|
|
||||||
*/
|
|
||||||
public function __construct(StoreCartDao $dao)
|
|
||||||
{
|
|
||||||
$this->dao = $dao;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $uid
|
|
||||||
* @return array
|
|
||||||
* @author Qinii
|
|
||||||
*/
|
|
||||||
public function getList($user)
|
|
||||||
{
|
|
||||||
$res = $this->dao->getAll($user->uid)->append(['checkCartProduct', 'UserPayCount', 'ActiveSku', 'attrValue', 'attr','spu']);
|
|
||||||
$make = app()->make(ProductRepository::class);
|
|
||||||
$res->map(function ($item) use ($make) {
|
|
||||||
$item['attr'] = $make->detailAttr($item['attr']);
|
|
||||||
});
|
|
||||||
return $this->checkCartList($res, $user->uid, $user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkCartList($res, $hasCoupon = 0, $user = null)
|
|
||||||
{
|
|
||||||
$arr = $fail = [];
|
|
||||||
$product_make = app()->make(ProductRepository::class);
|
|
||||||
$svip_status = ($user && $user->is_svip > 0 && systemConfig('svip_switch_status')) ? true : false;
|
|
||||||
foreach ($res as $item) {
|
|
||||||
if (!$item['checkCartProduct']) {
|
|
||||||
$item['product'] = $product_make->getFailProduct($item['product_id']);
|
|
||||||
$fail[] = $item;
|
|
||||||
} else {
|
|
||||||
$merchantData = $item['merchant']->append(['openReceipt'])->toArray();
|
|
||||||
unset($item['merchant']);
|
|
||||||
$coupon_make = app()->make(StoreCouponRepository::class);
|
|
||||||
if (!isset($arr[$item['mer_id']])) {
|
|
||||||
if ($hasCoupon)
|
|
||||||
$merchantData['hasCoupon'] = $coupon_make->validMerCouponExists($item['mer_id'], $hasCoupon);
|
|
||||||
$arr[$item['mer_id']] = $merchantData;
|
|
||||||
}
|
|
||||||
if ($hasCoupon && !$arr[$item['mer_id']]['hasCoupon']) {
|
|
||||||
$couponIds = app()->make(StoreCouponProductRepository::class)->productByCouponId([$item['product']['product_id']]);
|
|
||||||
$arr[$item['mer_id']]['hasCoupon'] = count($couponIds) ? $coupon_make->validProductCouponExists([$item['product']['product_id']], $hasCoupon) : 0;
|
|
||||||
}
|
|
||||||
if ($svip_status && $item['product']['show_svip_price']) {
|
|
||||||
$item['productAttr']['show_svip_price'] = true;
|
|
||||||
$item['productAttr']['org_price'] = $item['productAttr']['price'];
|
|
||||||
$item['productAttr']['price'] = $item['productAttr']['svip_price'];
|
|
||||||
} else {
|
|
||||||
$item['productAttr']['show_svip_price'] = false;
|
|
||||||
}
|
|
||||||
$arr[$item['mer_id']]['list'][] = $item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$list = array_values($arr);
|
|
||||||
return compact('list', 'fail');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取单条购物车信息
|
|
||||||
* @Author:Qinii
|
|
||||||
* @Date: 2020/5/30
|
|
||||||
* @param int $id
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getOne(int $id,int $uid)
|
|
||||||
{
|
|
||||||
$where = [$this->dao->getPk() => $id,'is_del'=>0,'is_fail'=>0,'is_new'=>0,'is_pay'=>0,'uid' => $uid];
|
|
||||||
return ($this->dao->getWhere($where));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看相同商品的sku是存在
|
|
||||||
* @param $sku
|
|
||||||
* @param $uid
|
|
||||||
* @author Qinii
|
|
||||||
*/
|
|
||||||
public function getCartByProductSku($sku,$uid)
|
|
||||||
{
|
|
||||||
$where = ['is_del'=>0,'is_fail'=>0,'is_new'=>0,'is_pay'=>0,'uid' => $uid,'product_type' => 0,'product_attr_unique' => $sku];
|
|
||||||
return ($this->dao->getWhere($where));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getProductById($productId)
|
|
||||||
{
|
|
||||||
$where = [
|
|
||||||
'is_del' =>0,
|
|
||||||
'is_new'=>0,
|
|
||||||
'is_pay'=>0,
|
|
||||||
'product_id'=>$productId
|
|
||||||
];
|
|
||||||
return $this->dao->getWhereCount($where);
|
|
||||||
}
|
|
||||||
}
|
|
@ -107,28 +107,28 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($order_type == 98 || $order_type == 99) && count($merchantCartList) > 1) {
|
// if (($order_type == 98 || $order_type == 99) && count($merchantCartList) > 1) {
|
||||||
throw new ValidateException('采购、委托商品不支持跨店购买');
|
// throw new ValidateException('采购、委托商品不支持跨店购买');
|
||||||
}
|
// }
|
||||||
$community = [];
|
$community = [];
|
||||||
if ($order_type == 98) {
|
// if ($order_type == 98) {
|
||||||
$sourceIdArray = [];
|
// $sourceIdArray = [];
|
||||||
foreach($merchantCart['list'] as $prod){
|
// foreach($merchantCart['list'] as $prod){
|
||||||
if ($prod['source_id'] > 0) {
|
// if ($prod['source_id'] > 0) {
|
||||||
$sourceIdArray[] = $prod['source_id'];
|
// $sourceIdArray[] = $prod['source_id'];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (count($sourceIdArray)) {
|
// if (count($sourceIdArray)) {
|
||||||
if (count(array_unique($sourceIdArray)) > 1) {
|
// if (count(array_unique($sourceIdArray)) > 1) {
|
||||||
throw new ValidateException('转售商品数据异常');
|
// throw new ValidateException('转售商品数据异常');
|
||||||
}
|
// }
|
||||||
$community = Db::name('Community')->where('community_id', $sourceIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find();
|
// $community = Db::name('Community')->where('community_id', $sourceIdArray[0] ?? 0)->field('community_id, title, image')->fetchSql(false)->find();
|
||||||
if ($community) {
|
// if ($community) {
|
||||||
$deliverMethod = Db::name('resale')->where('community_id', $sourceIdArray[0] ?? 0)->value('deliver_method');
|
// $deliverMethod = Db::name('resale')->where('community_id', $sourceIdArray[0] ?? 0)->value('deliver_method');
|
||||||
$deliverMethodArray = explode(',', $deliverMethod);
|
// $deliverMethodArray = explode(',', $deliverMethod);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
unset($merchantCart, $cart);
|
unset($merchantCart, $cart);
|
||||||
$order_price = 0;
|
$order_price = 0;
|
||||||
$total_true_price = 0;
|
$total_true_price = 0;
|
||||||
@ -139,6 +139,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$fn = [];
|
$fn = [];
|
||||||
$enabledPlatformCoupon = !$order_type;
|
$enabledPlatformCoupon = !$order_type;
|
||||||
$order_total_postage = 0;
|
$order_total_postage = 0;
|
||||||
|
$platformCoupon = [];
|
||||||
|
|
||||||
|
|
||||||
//套餐订单
|
//套餐订单
|
||||||
@ -182,9 +183,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$product_cart = [];
|
$product_cart = [];
|
||||||
|
|
||||||
foreach ($merchantCart['list'] as $k => $cart) {
|
foreach ($merchantCart['list'] as $k => $cart) {
|
||||||
if ($order_type == 98) {
|
|
||||||
$merchantCart['list'][$k]['product']['delivery_way'] = $cart['product']['delivery_way'] = $deliverMethod ?? '';
|
|
||||||
}
|
|
||||||
//获取订单类型, 活动商品单次只能购买一个
|
//获取订单类型, 活动商品单次只能购买一个
|
||||||
if ($cart['product']['delivery_way']) {
|
if ($cart['product']['delivery_way']) {
|
||||||
$delivery_way = explode(',', $cart['product']['delivery_way']);
|
$delivery_way = explode(',', $cart['product']['delivery_way']);
|
||||||
@ -233,7 +231,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
$svip_discount = 0;
|
$svip_discount = 0;
|
||||||
$realPrice = $this->cartByPrice($cart);
|
$realPrice = $this->cartByPrice($cart);
|
||||||
if ($cart['product_type'] == 98 || $cart['product_type'] == 99) {
|
if ($source == StoreCartDao::SOURCE_PROCURE) {
|
||||||
|
if($realPrice==0){
|
||||||
|
throw new ValidateException('价格必须大于0');
|
||||||
|
}
|
||||||
$cart['product']['price'] = $realPrice;
|
$cart['product']['price'] = $realPrice;
|
||||||
$cart['productAttr']['price'] = $realPrice;
|
$cart['productAttr']['price'] = $realPrice;
|
||||||
$cart['productAttr']['stock'] = $cart['cart_num'];
|
$cart['productAttr']['stock'] = $cart['cart_num'];
|
||||||
@ -394,105 +395,14 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//过滤不可用店铺优惠券
|
|
||||||
foreach ($merchantCart['coupon'] as &$coupon) {
|
|
||||||
if (!$coupon['coupon']['type']) continue;
|
|
||||||
|
|
||||||
$coupon['disabled'] = false;
|
|
||||||
$coupon['checked'] = false;
|
|
||||||
|
|
||||||
if (count(array_intersect(array_column($coupon['product'], 'product_id'), array_keys($product_price))) == 0) {
|
|
||||||
$coupon['disabled'] = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if($svip_coupon_merge != '1' && $use_svip){
|
|
||||||
$coupon['disabled'] = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$flag = false;
|
|
||||||
foreach ($coupon['product'] as $_product) {
|
|
||||||
if (isset($product_price[$_product['product_id']]) && $product_price[$_product['product_id']] >= $coupon['use_min_price']) {
|
|
||||||
$flag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$flag) {
|
|
||||||
$coupon['disabled'] = true;
|
|
||||||
}
|
|
||||||
// if (!$coupon['disabled']) {
|
|
||||||
// $all_coupon_product[] = $coupon['coupon_user_id'];
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($coupon);
|
|
||||||
|
|
||||||
//if ($useCouponFlag && count(array_diff($all_coupon_product, $use_coupon_product))) {
|
|
||||||
// throw new ValidateException('请选择有效的商品券');
|
|
||||||
//}
|
|
||||||
//计算商品券金额
|
|
||||||
foreach ($merchantCart['coupon'] as &$coupon) {
|
|
||||||
if (!$coupon['coupon']['type']) continue;
|
|
||||||
if ($coupon['disabled']) continue;
|
|
||||||
|
|
||||||
foreach ($coupon['product'] as $_product) {
|
|
||||||
if (isset($product_price[$_product['product_id']]) && $product_price[$_product['product_id']] >= $coupon['use_min_price']) {
|
|
||||||
if ($useCouponFlag) {
|
|
||||||
if (!in_array($coupon['coupon_user_id'], $merCouponIds) || isset($use_coupon_product[$_product['product_id']])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else if (isset($use_coupon_product[$_product['product_id']])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$coupon_price = bcadd($coupon_price, $coupon['coupon_price'], 2);
|
|
||||||
$use_coupon_product[$_product['product_id']] = $coupon;
|
|
||||||
$coupon['checked'] = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($_product);
|
|
||||||
}
|
|
||||||
unset($coupon);
|
|
||||||
$pay_price = max(bcsub($valid_total_price, $coupon_price, 2), 0);
|
$pay_price = max(bcsub($valid_total_price, $coupon_price, 2), 0);
|
||||||
$_pay_price = $pay_price;
|
$_pay_price = $pay_price;
|
||||||
//计算店铺券
|
|
||||||
foreach ($merchantCart['coupon'] as &$coupon) {
|
|
||||||
if ($coupon['coupon']['type']) continue;
|
|
||||||
$coupon['checked'] = false;
|
|
||||||
$coupon['disabled'] = $pay_price <= 0;
|
|
||||||
if ($use_store_coupon || $pay_price <= 0) continue;
|
|
||||||
if($svip_coupon_merge != '1' && $use_svip){
|
|
||||||
$coupon['disabled'] = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//店铺券
|
|
||||||
if ($valid_total_price >= $coupon['use_min_price']) {
|
|
||||||
if ($useCouponFlag) {
|
|
||||||
if (!in_array($coupon['coupon_user_id'], $merCouponIds)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$use_store_coupon = $coupon;
|
|
||||||
$coupon_price = bcadd($coupon_price, $coupon['coupon_price'], 2);
|
|
||||||
$_pay_price = bcsub($_pay_price, $coupon['coupon_price'], 2);
|
|
||||||
$coupon['checked'] = true;
|
|
||||||
} else {
|
|
||||||
$coupon['disabled'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($coupon);
|
|
||||||
|
|
||||||
$productCouponRate = [];
|
$productCouponRate = [];
|
||||||
$storeCouponRate = null;
|
$storeCouponRate = null;
|
||||||
$useCouponIds = [];
|
$useCouponIds = [];
|
||||||
//计算优惠占比
|
|
||||||
foreach ($use_coupon_product as $productId => $coupon) {
|
|
||||||
$productCouponRate[$productId] = [
|
|
||||||
'rate' => $product_price[$productId] > 0 ? bcdiv($coupon['coupon_price'], $product_price[$productId], 4) : 1,
|
|
||||||
'coupon_price' => $coupon['coupon_price'],
|
|
||||||
'price' => $product_price[$productId]
|
|
||||||
];
|
|
||||||
$useCouponIds[] = $coupon['coupon_user_id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($use_store_coupon) {
|
if ($use_store_coupon) {
|
||||||
$storeCouponRate = [
|
$storeCouponRate = [
|
||||||
@ -507,39 +417,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
foreach ($merchantCart['list'] as $_k => &$cart) {
|
foreach ($merchantCart['list'] as $_k => &$cart) {
|
||||||
$cartTotalPrice = bcmul($this->cartByPrice($cart), $cart['cart_num'], 2);
|
$cartTotalPrice = bcmul($this->cartByPrice($cart), $cart['cart_num'], 2);
|
||||||
$_cartTotalPrice = $cartTotalPrice;
|
$_cartTotalPrice = $cartTotalPrice;
|
||||||
if (!$cart['product_type'] && $cartTotalPrice > 0) {
|
|
||||||
if (isset($productCouponRate[$cart['product_id']])) {
|
|
||||||
//计算每个商品优惠金额(商品券)
|
|
||||||
if ($productCouponRate[$cart['product_id']]['rate'] >= 1) {
|
|
||||||
$cartTotalPrice = 0;
|
|
||||||
} else {
|
|
||||||
array_pop($product_cart);
|
|
||||||
if (!count($product_cart)) {
|
|
||||||
$cartTotalPrice = bcsub($cartTotalPrice, $productCouponRate[$cart['product_id']]['coupon_price'], 2);
|
|
||||||
$productCouponRate[$cart['product_id']]['coupon_price'] = 0;
|
|
||||||
} else {
|
|
||||||
$couponPrice = bcmul($cartTotalPrice, $productCouponRate[$cart['product_id']]['rate'], 2);
|
|
||||||
$cartTotalPrice = bcsub($cartTotalPrice, $couponPrice, 2);
|
|
||||||
$productCouponRate[$cart['product_id']]['coupon_price'] = bcsub($productCouponRate[$cart['product_id']]['coupon_price'], $couponPrice, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//(店铺券)
|
|
||||||
if ($storeCouponRate && $cartTotalPrice > 0) {
|
|
||||||
if ($storeCouponRate['rate'] >= 1) {
|
|
||||||
$cartTotalPrice = 0;
|
|
||||||
} else {
|
|
||||||
if (count($merchantCart['list']) == $_k + 1) {
|
|
||||||
$cartTotalPrice = bcsub($cartTotalPrice, $storeCouponRate['coupon_price'], 2);
|
|
||||||
} else {
|
|
||||||
$couponPrice = bcmul($cartTotalPrice, $storeCouponRate['rate'], 2);
|
|
||||||
$cartTotalPrice = bcsub($cartTotalPrice, $couponPrice, 2);
|
|
||||||
$storeCouponRate['coupon_price'] = bcsub($storeCouponRate['coupon_price'], $couponPrice, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//单个商品实际支付金额
|
//单个商品实际支付金额
|
||||||
$cart['coupon_price'] = bcsub($_cartTotalPrice, $cartTotalPrice, 2);
|
$cart['coupon_price'] = bcsub($_cartTotalPrice, $cartTotalPrice, 2);
|
||||||
@ -558,6 +435,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
'final_price' => $final_price,
|
'final_price' => $final_price,
|
||||||
'down_price' => $down_price,
|
'down_price' => $down_price,
|
||||||
'coupon_price' => $coupon_price,
|
'coupon_price' => $coupon_price,
|
||||||
|
'platformCoupon' => $platformCoupon,
|
||||||
'svip_coupon_merge' => $svip_coupon_merge,
|
'svip_coupon_merge' => $svip_coupon_merge,
|
||||||
'postage_price' => $postage_price,
|
'postage_price' => $postage_price,
|
||||||
'isTake' => $isTake,
|
'isTake' => $isTake,
|
||||||
@ -578,8 +456,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
unset($merchantCart);
|
unset($merchantCart);
|
||||||
|
|
||||||
$usePlatformCouponId = $useCoupon[0] ?? 0;
|
$usePlatformCouponId = 0;
|
||||||
$usePlatformCouponId = is_array($usePlatformCouponId) ? array_pop($usePlatformCouponId) : $usePlatformCouponId;
|
$total_platform_coupon_price = 0;
|
||||||
$usePlatformCouponFlag = isset($useCoupon[0]);
|
$usePlatformCouponFlag = isset($useCoupon[0]);
|
||||||
|
|
||||||
foreach ($merchantCartList as &$merchantCart) {
|
foreach ($merchantCartList as &$merchantCart) {
|
||||||
@ -601,154 +479,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
unset($merchantCart);
|
unset($merchantCart);
|
||||||
|
|
||||||
//计算平台券优惠金额
|
|
||||||
// if ($total_true_price > 0) {
|
|
||||||
$StoreCouponUser = app()->make(StoreCouponUserRepository::class);
|
|
||||||
$platformCoupon = $StoreCouponUser->validUserPlatformCoupon($uid);
|
|
||||||
if ($enabledPlatformCoupon && count($platformCoupon)) {
|
|
||||||
|
|
||||||
$catePriceLst = [];
|
|
||||||
$storePriceLst = [];
|
|
||||||
$_cartNum = 0;
|
|
||||||
|
|
||||||
foreach ($merchantCartList as &$merchantCart) {
|
|
||||||
if ($merchantCart['order']['true_price'] <= 0) continue;
|
|
||||||
foreach ($merchantCart['list'] as &$cart) {
|
|
||||||
$_cartNum++;
|
|
||||||
if ($cart['product']['cate_id']) {
|
|
||||||
if (!isset($catePriceLst[$cart['product']['cate_id']])) {
|
|
||||||
$catePriceLst[$cart['product']['cate_id']] = ['price' => 0, 'cart' => []];
|
|
||||||
}
|
|
||||||
$catePriceLst[$cart['product']['cate_id']]['price'] = bcadd($catePriceLst[$cart['product']['cate_id']]['price'], $cart['true_price']);
|
|
||||||
$catePriceLst[$cart['product']['cate_id']]['cart'][] = &$cart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($cart);
|
|
||||||
$storePriceLst[$merchantCart['mer_id']] = [
|
|
||||||
'price' => $merchantCart['order']['true_price'],
|
|
||||||
'num' => count($merchantCart['list'])
|
|
||||||
];
|
|
||||||
}
|
|
||||||
unset($merchantCart);
|
|
||||||
$flag = false;
|
|
||||||
$platformCouponRate = null;
|
|
||||||
|
|
||||||
foreach ($platformCoupon as &$coupon) {
|
|
||||||
$coupon['checked'] = false;
|
|
||||||
//通用券
|
|
||||||
if ($coupon['coupon']['type'] === StoreCouponRepository::TYPE_PLATFORM_ALL) {
|
|
||||||
$coupon['disabled'] = $total_true_price <= 0 || $coupon['use_min_price'] > $total_true_price;
|
|
||||||
if (!$platformCouponRate && !$coupon['disabled'] && !$flag && ((!$usePlatformCouponId && !$usePlatformCouponFlag) || $usePlatformCouponId == $coupon['coupon_user_id'])) {
|
|
||||||
$platformCouponRate = [
|
|
||||||
'id' => $coupon['coupon_user_id'],
|
|
||||||
'type' => $coupon['coupon']['type'],
|
|
||||||
'price' => $total_true_price,
|
|
||||||
'coupon_price' => $coupon['coupon_price'],
|
|
||||||
'use_count' => $_cartNum,
|
|
||||||
'check' => function ($cart) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
$coupon['checked'] = true;
|
|
||||||
$flag = true;
|
|
||||||
}
|
|
||||||
//品类券
|
|
||||||
} else if ($coupon['coupon']['type'] === StoreCouponRepository::TYPE_PLATFORM_CATE) {
|
|
||||||
$_price = 0;
|
|
||||||
$_use_count = 0;
|
|
||||||
$cateIds = $coupon['product']->column('product_id');
|
|
||||||
$allCateIds = array_unique(array_merge(app()->make(StoreCategoryRepository::class)->allChildren($cateIds), $cateIds));
|
|
||||||
$flag2 = true;
|
|
||||||
foreach ($allCateIds as $cateId) {
|
|
||||||
if (isset($catePriceLst[$cateId])) {
|
|
||||||
$_price = bcadd($catePriceLst[$cateId]['price'], $_price, 2);
|
|
||||||
$_use_count += count($catePriceLst[$cateId]['cart']);
|
|
||||||
$flag2 = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$coupon['disabled'] = $flag2 || $coupon['use_min_price'] > $_price;
|
|
||||||
//品类券可用
|
|
||||||
if (!$platformCouponRate && !$coupon['disabled'] && !$flag && !$flag2 && ((!$usePlatformCouponId && !$usePlatformCouponFlag) || $usePlatformCouponId == $coupon['coupon_user_id'])) {
|
|
||||||
$platformCouponRate = [
|
|
||||||
'id' => $coupon['coupon_user_id'],
|
|
||||||
'type' => $coupon['coupon']['type'],
|
|
||||||
'price' => $_price,
|
|
||||||
'use_cate' => $allCateIds,
|
|
||||||
'coupon_price' => $coupon['coupon_price'],
|
|
||||||
'use_count' => $_use_count,
|
|
||||||
'check' => function ($cart) use ($allCateIds) {
|
|
||||||
return in_array($cart['product']['cate_id'], $allCateIds);
|
|
||||||
}
|
|
||||||
];
|
|
||||||
$coupon['checked'] = true;
|
|
||||||
$flag = true;
|
|
||||||
}
|
|
||||||
//跨店券
|
|
||||||
} else if ($coupon['coupon']['type'] === StoreCouponRepository::TYPE_PLATFORM_STORE) {
|
|
||||||
$_price = 0;
|
|
||||||
$_use_count = 0;
|
|
||||||
$flag2 = true;
|
|
||||||
foreach ($coupon['product'] as $item) {
|
|
||||||
$merId = $item['product_id'];
|
|
||||||
if (isset($storePriceLst[$merId])) {
|
|
||||||
$_price = bcadd($storePriceLst[$merId]['price'], $_price, 2);
|
|
||||||
$_use_count += $storePriceLst[$merId]['num'];
|
|
||||||
$flag2 = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$coupon['disabled'] = $flag2 || $coupon['use_min_price'] > $_price;
|
|
||||||
//店铺券可用
|
|
||||||
if (!$platformCouponRate && !$coupon['disabled'] && !$flag && !$flag2 && ((!$usePlatformCouponId && !$usePlatformCouponFlag) || $usePlatformCouponId == $coupon['coupon_user_id'])) {
|
|
||||||
$_merIds = $coupon['product']->column('product_id');
|
|
||||||
$platformCouponRate = [
|
|
||||||
'id' => $coupon['coupon_user_id'],
|
|
||||||
'type' => $coupon['coupon']['type'],
|
|
||||||
'price' => $_price,
|
|
||||||
'use_store' => $_merIds,
|
|
||||||
'coupon_price' => $coupon['coupon_price'],
|
|
||||||
'use_count' => $_use_count,
|
|
||||||
'check' => function ($cart) use ($_merIds) {
|
|
||||||
return in_array($cart['mer_id'], $_merIds);
|
|
||||||
}
|
|
||||||
];
|
|
||||||
$coupon['checked'] = true;
|
|
||||||
$flag = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unset($coupon);
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
|
|
||||||
$usePlatformCouponId = 0;
|
$usePlatformCouponId = 0;
|
||||||
$total_platform_coupon_price = 0;
|
$total_platform_coupon_price = 0;
|
||||||
//计算平台优惠券
|
|
||||||
if (isset($platformCouponRate)) {
|
|
||||||
$_coupon_price = $platformCouponRate['coupon_price'];
|
|
||||||
foreach ($merchantCartList as &$merchantCart) {
|
|
||||||
$_price = 0;
|
|
||||||
foreach ($merchantCart['list'] as &$cart) {
|
|
||||||
if ($cart['true_price'] <= 0 || !$platformCouponRate['check']($cart)) continue;
|
|
||||||
|
|
||||||
if ($platformCouponRate['use_count'] === 1) {
|
|
||||||
$couponPrice = min($platformCouponRate['coupon_price'], $cart['true_price']);
|
|
||||||
} else {
|
|
||||||
$couponPrice = min(bcmul($_coupon_price, bcdiv($cart['true_price'], $platformCouponRate['price'], 3), 2), $cart['true_price']);
|
|
||||||
}
|
|
||||||
$platformCouponRate['coupon_price'] = bcsub($platformCouponRate['coupon_price'], $couponPrice, 2);
|
|
||||||
$cart['true_price'] = bcsub($cart['true_price'], $couponPrice, 2);
|
|
||||||
$cart['platform_coupon_price'] = $couponPrice;
|
|
||||||
$platformCouponRate['use_count']--;
|
|
||||||
$_price = bcadd($couponPrice, $_price, 2);
|
|
||||||
}
|
|
||||||
unset($cart);
|
|
||||||
$merchantCart['order']['platform_coupon_price'] = $_price;
|
|
||||||
$merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'], $_price, 2);
|
|
||||||
$total_platform_coupon_price = bcadd($total_platform_coupon_price, $_price, 2);
|
|
||||||
}
|
|
||||||
$usePlatformCouponId = $platformCouponRate['id'];
|
|
||||||
unset($merchantCart);
|
|
||||||
}
|
|
||||||
|
|
||||||
//积分配置
|
//积分配置
|
||||||
$sysIntegralConfig = systemConfig(['integral_money', 'integral_status', 'integral_order_rate']);
|
$sysIntegralConfig = systemConfig(['integral_money', 'integral_status', 'integral_order_rate']);
|
||||||
@ -775,49 +507,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$merIntegralFlag = $merIntegralFlag || ((bool)$merIntegralConfig['mer_integral_status']);
|
$merIntegralFlag = $merIntegralFlag || ((bool)$merIntegralConfig['mer_integral_status']);
|
||||||
$integralFlag = $useIntegral && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0 && $merIntegralConfig['mer_integral_status'];
|
$integralFlag = $useIntegral && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0 && $merIntegralConfig['mer_integral_status'];
|
||||||
|
|
||||||
//计算积分抵扣
|
|
||||||
foreach ($merchantCart['list'] as &$cart) {
|
|
||||||
//只有普通商品可以抵扣
|
|
||||||
if ($cart['product_type'] == 0 && $integralFlag && $userIntegral > 0 && $merchantCart['order']['true_price'] > 0) {
|
|
||||||
$integralRate = $cart['product']['integral_rate'];
|
|
||||||
if ($integralRate < 0) {
|
|
||||||
$integralRate = $merIntegralConfig['mer_integral_rate'];
|
|
||||||
} else if($integralRate > 0){
|
|
||||||
$integralRate = min(bcdiv($integralRate, 100, 4), 1);
|
|
||||||
}
|
|
||||||
if ($integralRate > 0) {
|
|
||||||
$productIntegralPrice = min(bcmul(bcmul($this->cartByPrice($cart), $cart['cart_num'], 2), $integralRate, 2), $cart['true_price']);
|
|
||||||
if ($productIntegralPrice > 0) {
|
|
||||||
$productIntegral = ceil(bcdiv($productIntegralPrice, $sysIntegralConfig['integral_money'], 3));
|
|
||||||
if ($productIntegral <= $userIntegral) {
|
|
||||||
$userIntegral = bcsub($userIntegral, $productIntegral, 0);
|
|
||||||
//使用多少积分抵扣了多少金额
|
|
||||||
$cart['integral'] = [
|
|
||||||
'use' => $productIntegral,
|
|
||||||
'price' => $productIntegralPrice
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
$productIntegralPrice = bcmul($userIntegral, $sysIntegralConfig['integral_money'], 2);
|
|
||||||
//使用多少积分抵扣了多少金额
|
|
||||||
$cart['integral'] = [
|
|
||||||
'use' => $userIntegral,
|
|
||||||
'price' => $productIntegralPrice
|
|
||||||
];
|
|
||||||
$userIntegral = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cart['true_price'] = bcsub($cart['true_price'], $cart['integral']['price'], 2);
|
|
||||||
$merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'], $cart['integral']['price'], 2);
|
|
||||||
|
|
||||||
$total_integral_price = bcadd($total_integral_price, $cart['integral']['price'], 2);
|
|
||||||
$total_integral = bcadd($total_integral, $cart['integral']['use'], 0);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$cart['integral'] = null;
|
|
||||||
}
|
|
||||||
unset($cart);
|
|
||||||
$order_total_integral = bcadd($order_total_integral, $total_integral, 0);
|
$order_total_integral = bcadd($order_total_integral, $total_integral, 0);
|
||||||
$order_total_integral_price = bcadd($order_total_integral_price, $total_integral_price, 2);
|
$order_total_integral_price = bcadd($order_total_integral_price, $total_integral_price, 2);
|
||||||
|
|
||||||
@ -848,14 +537,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
|
|
||||||
$giveIntegralFlag = $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_order_rate'] > 0;
|
$giveIntegralFlag = $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_order_rate'] > 0;
|
||||||
$total_give_integral = 0;
|
$total_give_integral = 0;
|
||||||
//计算赠送积分, 只有普通商品赠送积分
|
|
||||||
if ($giveIntegralFlag && !$order_type && $pay_price > 0) {
|
|
||||||
$total_give_integral = floor(bcmul($pay_price, $sysIntegralConfig['integral_order_rate'], 0));
|
|
||||||
if ($total_give_integral > 0 && $svip_status && $svip_integral_rate > 0) {
|
|
||||||
$total_give_integral = bcmul($svip_integral_rate, $total_give_integral, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$order_total_give_integral = bcadd($total_give_integral, $order_total_give_integral, 0);
|
|
||||||
|
|
||||||
foreach ($fn as $callback) {
|
foreach ($fn as $callback) {
|
||||||
$callback();
|
$callback();
|
||||||
@ -901,8 +582,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
'order_price',
|
'order_price',
|
||||||
'total_price',
|
'total_price',
|
||||||
'community',
|
'community',
|
||||||
'platformCoupon',
|
|
||||||
'enabledPlatformCoupon',
|
'enabledPlatformCoupon',
|
||||||
|
'platformCoupon',
|
||||||
'usePlatformCouponId',
|
'usePlatformCouponId',
|
||||||
'order_total_integral',
|
'order_total_integral',
|
||||||
'order_total_integral_price',
|
'order_total_integral_price',
|
||||||
|
@ -557,17 +557,22 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
return $cart['activeSku']['active_price'];
|
return $cart['activeSku']['active_price'];
|
||||||
// 更新调货价格
|
// 更新调货价格
|
||||||
} else if ($cart['product_type'] == '98') {
|
} else if ($cart['product_type'] == '98') {
|
||||||
if ($cart['source_id'] > 0) {
|
// if ($cart['source_id'] > 0) {
|
||||||
$resale_find = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->find();
|
// $resale_find = Db::name('resale')->where('community_id', $cart['source_id'])->where('product_attr_unique', $cart['product_attr_unique'])->find();
|
||||||
if ($resale_find &&$resale_find['status']==0) {
|
// if ($resale_find &&$resale_find['status']==0) {
|
||||||
return $resale_find['price'];
|
// return $resale_find['price'];
|
||||||
}else if($resale_find['status']==1){
|
// }else if($resale_find['status']==1){
|
||||||
throw new ValidateException('商品已转售');
|
// throw new ValidateException('商品已转售');
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
throw new ValidateException('转售商品数据异常');
|
// throw new ValidateException('转售商品数据异常');
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
|
// return $cart['productAttr']['price'];
|
||||||
|
// }
|
||||||
|
if($cart['source']== StoreCartDao::SOURCE_PROCURE){
|
||||||
|
return $cart['productAttr']['procure_price'];
|
||||||
|
}else{
|
||||||
return $cart['productAttr']['price'];
|
return $cart['productAttr']['price'];
|
||||||
}
|
}
|
||||||
// 更新委托价格
|
// 更新委托价格
|
||||||
|
@ -69,17 +69,17 @@ class ProductRepository extends BaseRepository
|
|||||||
|
|
||||||
protected $dao;
|
protected $dao;
|
||||||
const CREATE_PARAMS = [
|
const CREATE_PARAMS = [
|
||||||
"image", "slider_image", "store_name", "store_info", "keyword", "bar_code", "guarantee_template_id", "cate_id", "mer_cate_id", "unit_name", "sort" , "is_show", "is_good", 'is_gift_bag', 'integral_rate', "video_link", "temp_id", "content", "spec_type", "extension_type", "attr", 'mer_labels', 'delivery_way', 'delivery_free','param_temp_id','extend', 'source_product_id', 'stock',
|
"image", "slider_image", "store_name", "store_info", "keyword", "bar_code", "guarantee_template_id", "cate_id", "mer_cate_id", "unit_name", "sort", "is_show", "is_good", 'is_gift_bag', 'integral_rate', "video_link", "temp_id", "content", "spec_type", "extension_type", "attr", 'mer_labels', 'delivery_way', 'delivery_free', 'param_temp_id', 'extend', 'source_product_id', 'stock',
|
||||||
["brand_id",0],
|
["brand_id", 0],
|
||||||
['once_max_count',0],
|
['once_max_count', 0],
|
||||||
['once_min_count',0],
|
['once_min_count', 0],
|
||||||
['pay_limit', 0],
|
['pay_limit', 0],
|
||||||
["attrValue",[]],
|
["attrValue", []],
|
||||||
['give_coupon_ids',[]],
|
['give_coupon_ids', []],
|
||||||
['type',0],
|
['type', 0],
|
||||||
['svip_price',0],
|
['svip_price', 0],
|
||||||
['svip_price_type',0],
|
['svip_price_type', 0],
|
||||||
['params',[]],
|
['params', []],
|
||||||
];
|
];
|
||||||
protected $admin_filed = 'Product.product_id,Product.mer_id,brand_id,spec_type,unit_name,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,U.rank,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,star,ficti,integral_total,integral_price_total,sys_labels,param_temp_id,mer_svip_status,svip_price,svip_price_type,update_time,source_product_id';
|
protected $admin_filed = 'Product.product_id,Product.mer_id,brand_id,spec_type,unit_name,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,U.rank,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,star,ficti,integral_total,integral_price_total,sys_labels,param_temp_id,mer_svip_status,svip_price,svip_price_type,update_time,source_product_id';
|
||||||
protected $filed = 'Product.bar_code,Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id,mer_svip_status,svip_price,svip_price_type,update_time,source_product_id';
|
protected $filed = 'Product.bar_code,Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id,mer_svip_status,svip_price,svip_price_type,update_time,source_product_id';
|
||||||
@ -228,21 +228,21 @@ class ProductRepository extends BaseRepository
|
|||||||
if (count($data['attrValue']) > 1) throw new ValidateException('单规格商品属性错误');
|
if (count($data['attrValue']) > 1) throw new ValidateException('单规格商品属性错误');
|
||||||
}
|
}
|
||||||
$content = [
|
$content = [
|
||||||
'content' => $conType ? json_encode($data['content']) : $data['content'] ,
|
'content' => $conType ? json_encode($data['content']) : $data['content'],
|
||||||
'type' => $conType
|
'type' => $conType
|
||||||
];
|
];
|
||||||
$product = $this->setProduct($data);
|
$product = $this->setProduct($data);
|
||||||
event('product.create.before', compact('data','productType','conType'));
|
event('product.create.before', compact('data', 'productType', 'conType'));
|
||||||
return Db::transaction(function () use ($data, $productType,$conType,$content,$product) {
|
return Db::transaction(function () use ($data, $productType, $conType, $content, $product) {
|
||||||
$activity_id = 0;
|
$activity_id = 0;
|
||||||
$product['product_type'] = $productType;
|
$product['product_type'] = $productType;
|
||||||
$result = $this->dao->create($product);
|
$result = $this->dao->create($product);
|
||||||
|
|
||||||
$settleParams = $this->setAttrValue($data, $result->product_id, $productType, 0,$data['mer_id']);
|
$settleParams = $this->setAttrValue($data, $result->product_id, $productType, 0, $data['mer_id']);
|
||||||
// $settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $result->product_id, $data['mer_id']);
|
// $settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $result->product_id, $data['mer_id']);
|
||||||
$settleParams['attr'] = $this->setAttr($data['attr'], $result->product_id);
|
$settleParams['attr'] = $this->setAttr($data['attr'], $result->product_id);
|
||||||
if (in_array($productType, [0, 98, 99])) app()->make(ParameterValueRepository::class)->create($result->product_id, $data['params'] ?? [],$data['mer_id']);
|
if (in_array($productType, [0, 98, 99])) app()->make(ParameterValueRepository::class)->create($result->product_id, $data['params'] ?? [], $data['mer_id']);
|
||||||
$this->save($result->product_id, $settleParams, $content,$product,$productType);
|
$this->save($result->product_id, $settleParams, $content, $product, $productType);
|
||||||
if (in_array($productType, [0, 1, 98, 99])) {
|
if (in_array($productType, [0, 1, 98, 99])) {
|
||||||
if ($productType == 1) { //秒杀商品
|
if ($productType == 1) { //秒杀商品
|
||||||
$dat = $this->setSeckillProduct($data);
|
$dat = $this->setSeckillProduct($data);
|
||||||
@ -255,7 +255,7 @@ class ProductRepository extends BaseRepository
|
|||||||
app()->make(SpuRepository::class)->create($product, $result->product_id, $activity_id, $productType);
|
app()->make(SpuRepository::class)->create($product, $result->product_id, $activity_id, $productType);
|
||||||
}
|
}
|
||||||
$product = $result;
|
$product = $result;
|
||||||
event('product.create',compact('product', 'data', 'conType'));
|
event('product.create', compact('product', 'data', 'conType'));
|
||||||
return $result->product_id;
|
return $result->product_id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -272,31 +272,31 @@ class ProductRepository extends BaseRepository
|
|||||||
$data['attr'] = [];
|
$data['attr'] = [];
|
||||||
if (count($data['attrValue']) > 1) throw new ValidateException('单规格商品属性错误');
|
if (count($data['attrValue']) > 1) throw new ValidateException('单规格商品属性错误');
|
||||||
}
|
}
|
||||||
event('product.update.before', compact('id','data','merId','productType','conType'));
|
event('product.update.before', compact('id', 'data', 'merId', 'productType', 'conType'));
|
||||||
$spuData = $product = $this->setProduct($data);
|
$spuData = $product = $this->setProduct($data);
|
||||||
$settleParams = $this->setAttrValue($data, $id, $productType, 1,$merId);
|
$settleParams = $this->setAttrValue($data, $id, $productType, 1, $merId);
|
||||||
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
||||||
$settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
$settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
||||||
$content = [
|
$content = [
|
||||||
'content' => $conType ? json_encode($data['content']) : $data['content'] ,
|
'content' => $conType ? json_encode($data['content']) : $data['content'],
|
||||||
'type' => $conType
|
'type' => $conType
|
||||||
];
|
];
|
||||||
$spuData['price'] = $settleParams['data']['price'];
|
$spuData['price'] = $settleParams['data']['price'];
|
||||||
$spuData['mer_id'] = $merId;
|
$spuData['mer_id'] = $merId;
|
||||||
$spuData['mer_labels'] = $data['mer_labels'];
|
$spuData['mer_labels'] = $data['mer_labels'];
|
||||||
Db::transaction(function () use ($id, $data, $productType, $settleParams,$content,$product,$spuData,$merId) {
|
Db::transaction(function () use ($id, $data, $productType, $settleParams, $content, $product, $spuData, $merId) {
|
||||||
$this->save($id, $settleParams, $content, $product, $productType);
|
$this->save($id, $settleParams, $content, $product, $productType);
|
||||||
if ($productType == 1) { //秒杀商品
|
// if ($productType == 1) { //秒杀商品
|
||||||
$dat = $this->setSeckillProduct($data);
|
// $dat = $this->setSeckillProduct($data);
|
||||||
app()->make(StoreSeckillActiveRepository::class)->updateByProduct($id, $dat);
|
// app()->make(StoreSeckillActiveRepository::class)->updateByProduct($id, $dat);
|
||||||
}
|
// }
|
||||||
if ($productType == 0) {
|
if ($productType == 0) {
|
||||||
$make = app()->make(ParameterValueRepository::class);
|
$make = app()->make(ParameterValueRepository::class);
|
||||||
$make->clear($id, 'product_id');
|
$make->clear($id, 'product_id');
|
||||||
$make->create($id, $data['params'] ?? [], $merId);
|
$make->create($id, $data['params'] ?? [], $merId);
|
||||||
}
|
}
|
||||||
app()->make(SpuRepository::class)->baseUpdate($spuData, $id, 0, $productType);
|
app()->make(SpuRepository::class)->baseUpdate($spuData, $id, 0, $productType);
|
||||||
event('product.update',compact('id'));
|
event('product.update', compact('id'));
|
||||||
if ($data['status'] == 0) {
|
if ($data['status'] == 0) {
|
||||||
event('product.sell', ['product_id' => [$id]]);
|
event('product.sell', ['product_id' => [$id]]);
|
||||||
}
|
}
|
||||||
@ -312,15 +312,15 @@ class ProductRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
$res = $this->dao->get($id);
|
$res = $this->dao->get($id);
|
||||||
$data['svip_price_type'] = $res['svip_price_type'];
|
$data['svip_price_type'] = $res['svip_price_type'];
|
||||||
$settleParams = $this->setAttrValue($data, $id, 0, 1,$merId);
|
$settleParams = $this->setAttrValue($data, $id, 0, 1, $merId);
|
||||||
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
||||||
$settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
$settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
||||||
$data['price'] = $settleParams['data']['price'];
|
$data['price'] = $settleParams['data']['price'];
|
||||||
unset($data['attrValue'],$data['attr'],$data['mer_cate_id']);
|
unset($data['attrValue'], $data['attr'], $data['mer_cate_id']);
|
||||||
$ret = Spu::getInstance()->where('product_id', $id)->whereIn('product_type',[0, 98, 99])->find();
|
$ret = Spu::getInstance()->where('product_id', $id)->whereIn('product_type', [0, 98, 99])->find();
|
||||||
Db::transaction(function () use ($id, $data, $settleParams,$ret) {
|
Db::transaction(function () use ($id, $data, $settleParams, $ret) {
|
||||||
$this->save($id, $settleParams, null, [], 0);
|
$this->save($id, $settleParams, null, [], 0);
|
||||||
app()->make(SpuRepository::class)->update($ret->spu_id,['price' => $data['price']]);
|
app()->make(SpuRepository::class)->update($ret->spu_id, ['price' => $data['price']]);
|
||||||
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -359,12 +359,12 @@ class ProductRepository extends BaseRepository
|
|||||||
|
|
||||||
if (isset($settleParams['attrValue'])) {
|
if (isset($settleParams['attrValue'])) {
|
||||||
$arr = array_chunk($settleParams['attrValue'], 30);
|
$arr = array_chunk($settleParams['attrValue'], 30);
|
||||||
foreach ($arr as $item){
|
foreach ($arr as $item) {
|
||||||
app()->make(ProductAttrValueRepository::class)->insertAll($item);
|
app()->make(ProductAttrValueRepository::class)->insertAll($item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($content){
|
if ($content) {
|
||||||
app()->make(ProductContentRepository::class)->clearAttr($id,$content['type']);
|
app()->make(ProductContentRepository::class)->clearAttr($id, $content['type']);
|
||||||
$this->dao->createContent($id, $content);
|
$this->dao->createContent($id, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,9 +377,9 @@ class ProductRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
$res = $this->dao->update($id, $data);
|
$res = $this->dao->update($id, $data);
|
||||||
|
|
||||||
if(isset($data['status']) && $data['status'] !== 1 ){
|
if (isset($data['status']) && $data['status'] !== 1) {
|
||||||
$message = '您有1个新的'. ($productType ? '秒杀商品' : ($data['is_gift_bag'] ? '礼包商品' :'商品')) . '待审核';
|
$message = '您有1个新的' . $productType . '商品待审核'; //? '秒杀商品' : ($data['is_gift_bag'] ? '礼包商品' :'商品')) .
|
||||||
$type = $productType ? 'new_seckill' : ($data['is_gift_bag'] ? 'new_bag' :'new_product');
|
$type = $productType ? 'new_seckill' : ($data['is_gift_bag'] ? 'new_bag' : 'new_product');
|
||||||
SwooleTaskService::admin('notice', [
|
SwooleTaskService::admin('notice', [
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'data' => [
|
'data' => [
|
||||||
@ -450,11 +450,10 @@ class ProductRepository extends BaseRepository
|
|||||||
$give_coupon_ids = implode(',', $gcoupon_ids);
|
$give_coupon_ids = implode(',', $gcoupon_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($data['integral_rate'])){
|
if (isset($data['integral_rate'])) {
|
||||||
$integral_rate = $data['integral_rate'];
|
$integral_rate = $data['integral_rate'];
|
||||||
if($data['integral_rate'] < 0) $integral_rate = -1;
|
if ($data['integral_rate'] < 0) $integral_rate = -1;
|
||||||
if($data['integral_rate'] > 100) $integral_rate = 100;
|
if ($data['integral_rate'] > 100) $integral_rate = 100;
|
||||||
|
|
||||||
}
|
}
|
||||||
$result = [
|
$result = [
|
||||||
'store_name' => $data['store_name'],
|
'store_name' => $data['store_name'],
|
||||||
@ -462,25 +461,25 @@ class ProductRepository extends BaseRepository
|
|||||||
'image' => $data['image'],
|
'image' => $data['image'],
|
||||||
'slider_image' => is_array($data['slider_image']) ? implode(',', $data['slider_image']) : '',
|
'slider_image' => is_array($data['slider_image']) ? implode(',', $data['slider_image']) : '',
|
||||||
'store_info' => $data['store_info'] ?? '',
|
'store_info' => $data['store_info'] ?? '',
|
||||||
'keyword' => $data['keyword']??'',
|
'keyword' => $data['keyword'] ?? '',
|
||||||
'brand_id' => $data['brand_id'] ?? 0,
|
'brand_id' => $data['brand_id'] ?? 0,
|
||||||
'cate_id' => $data['cate_id'] ?? 0,
|
'cate_id' => $data['cate_id'] ?? 0,
|
||||||
'unit_name' => $data['unit_name']??'件',
|
'unit_name' => $data['unit_name'] ?? '件',
|
||||||
'sort' => $data['sort'] ?? 0,
|
'sort' => $data['sort'] ?? 0,
|
||||||
'is_show' => $data['is_show'] ?? 0,
|
'is_show' => $data['is_show'] ?? 0,
|
||||||
'is_used' => (isset($data['status']) && $data['status'] == 1) ? 1 : 0,
|
'is_used' => (isset($data['status']) && $data['status'] == 1) ? 1 : 0,
|
||||||
'is_good' => $data['is_good'] ?? 0,
|
'is_good' => $data['is_good'] ?? 0,
|
||||||
'video_link' => $data['video_link']??'',
|
'video_link' => $data['video_link'] ?? '',
|
||||||
'temp_id' => $data['delivery_free'] ? 0 : ($data['temp_id'] ?? 0),
|
'temp_id' => $data['delivery_free'] ? 0 : ($data['temp_id'] ?? 0),
|
||||||
'extension_type' => $data['extension_type']??0,
|
'extension_type' => $data['extension_type'] ?? 0,
|
||||||
'spec_type' => $data['spec_type'] ?? 0,
|
'spec_type' => $data['spec_type'] ?? 0,
|
||||||
'status' => $data['status']??0,
|
'status' => $data['status'] ?? 0,
|
||||||
'give_coupon_ids' => $give_coupon_ids,
|
'give_coupon_ids' => $give_coupon_ids,
|
||||||
'mer_status' => $data['mer_status'],
|
'mer_status' => $data['mer_status'],
|
||||||
'guarantee_template_id' => $data['guarantee_template_id']??0,
|
'guarantee_template_id' => $data['guarantee_template_id'] ?? 0,
|
||||||
'is_gift_bag' => $data['is_gift_bag'] ?? 0,
|
'is_gift_bag' => $data['is_gift_bag'] ?? 0,
|
||||||
'integral_rate' => $integral_rate ?? 0,
|
'integral_rate' => $integral_rate ?? 0,
|
||||||
'delivery_way' => implode(',',$data['delivery_way']),
|
'delivery_way' => implode(',', $data['delivery_way']),
|
||||||
'delivery_free' => $data['delivery_free'] ?? 0,
|
'delivery_free' => $data['delivery_free'] ?? 0,
|
||||||
'once_min_count' => $data['once_min_count'] ?? 0,
|
'once_min_count' => $data['once_min_count'] ?? 0,
|
||||||
'once_max_count' => $data['once_max_count'] ?? 0,
|
'once_max_count' => $data['once_max_count'] ?? 0,
|
||||||
@ -501,7 +500,7 @@ class ProductRepository extends BaseRepository
|
|||||||
if (isset($data['param_temp_id']))
|
if (isset($data['param_temp_id']))
|
||||||
$result['param_temp_id'] = $data['param_temp_id'];
|
$result['param_temp_id'] = $data['param_temp_id'];
|
||||||
if (isset($data['extend']))
|
if (isset($data['extend']))
|
||||||
$result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) :[];
|
$result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) : [];
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +537,7 @@ class ProductRepository extends BaseRepository
|
|||||||
public function setAttr(array $data, int $productId)
|
public function setAttr(array $data, int $productId)
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
try{
|
try {
|
||||||
foreach ($data as $value) {
|
foreach ($data as $value) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'type' => 0,
|
'type' => 0,
|
||||||
@ -562,9 +561,9 @@ class ProductRepository extends BaseRepository
|
|||||||
* @param int $productId
|
* @param int $productId
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function setAttrValue(array $data, int $productId, int $productType, int $isUpdate = 0,int $merId = 0)
|
public function setAttrValue(array $data, int $productId, int $productType, int $isUpdate = 0, int $merId = 0)
|
||||||
{
|
{
|
||||||
if($merId<=0){
|
if ($merId <= 0) {
|
||||||
throw new ValidateException('添加商品商户id不能为0');
|
throw new ValidateException('添加商品商户id不能为0');
|
||||||
}
|
}
|
||||||
$extension_status = systemConfig('extension_status');
|
$extension_status = systemConfig('extension_status');
|
||||||
@ -595,8 +594,8 @@ class ProductRepository extends BaseRepository
|
|||||||
$_svip_price = $value['svip_price'];
|
$_svip_price = $value['svip_price'];
|
||||||
$svip_price = !$svip_price ? $value['svip_price'] : (($svip_price > $value['svip_price']) ? $value['svip_price'] : $svip_price);
|
$svip_price = !$svip_price ? $value['svip_price'] : (($svip_price > $value['svip_price']) ? $value['svip_price'] : $svip_price);
|
||||||
}
|
}
|
||||||
|
$procure_price = $value['procure_price'] ?? 0.00;
|
||||||
$cost = !$cost ? $value['cost'] : (($cost > $value['cost']) ?$cost: $value['cost']);
|
$cost = !$cost ? $value['cost'] : (($cost > $value['cost']) ? $cost : $value['cost']);
|
||||||
$price = !$price ? $sprice : (($price > $sprice) ? $sprice : $price);
|
$price = !$price ? $sprice : (($price > $sprice) ? $sprice : $price);
|
||||||
$ot_price = !$ot_price ? $ot_price_ : (($ot_price > $ot_price_) ? $ot_price : $ot_price_);
|
$ot_price = !$ot_price ? $ot_price_ : (($ot_price > $ot_price_) ? $ot_price : $ot_price_);
|
||||||
|
|
||||||
@ -607,8 +606,8 @@ class ProductRepository extends BaseRepository
|
|||||||
"image" => $value["image"] ?? '',
|
"image" => $value["image"] ?? '',
|
||||||
"cost" => $value['cost'] ? (($value['cost'] < 0) ? 0 : $value['cost']) : 0,
|
"cost" => $value['cost'] ? (($value['cost'] < 0) ? 0 : $value['cost']) : 0,
|
||||||
"price" => $value['price'] ? (($value['price'] < 0) ? 0 : $value['price']) : 0,
|
"price" => $value['price'] ? (($value['price'] < 0) ? 0 : $value['price']) : 0,
|
||||||
"volume" => isset($value['volume']) ? ($value['volume'] ? (($value['volume'] < 0) ? 0 : $value['volume']) : 0) :0,
|
"volume" => isset($value['volume']) ? ($value['volume'] ? (($value['volume'] < 0) ? 0 : $value['volume']) : 0) : 0,
|
||||||
"weight" => isset($value['weight']) ? ($value['weight'] ? (($value['weight'] < 0) ? 0 : $value['weight']) : 0) :0,
|
"weight" => isset($value['weight']) ? ($value['weight'] ? (($value['weight'] < 0) ? 0 : $value['weight']) : 0) : 0,
|
||||||
"stock" => $value['stock'] ? (($value['stock'] < 0) ? 0 : $value['stock']) : 0,
|
"stock" => $value['stock'] ? (($value['stock'] < 0) ? 0 : $value['stock']) : 0,
|
||||||
"ot_price" => $value['ot_price'] ? (($value['ot_price'] < 0) ? 0 : $value['ot_price']) : 0,
|
"ot_price" => $value['ot_price'] ? (($value['ot_price'] < 0) ? 0 : $value['ot_price']) : 0,
|
||||||
"extension_one" => $extension_status ? ($value['extension_one'] ?? 0) : 0,
|
"extension_one" => $extension_status ? ($value['extension_one'] ?? 0) : 0,
|
||||||
@ -620,18 +619,20 @@ class ProductRepository extends BaseRepository
|
|||||||
'sales' => $isUpdate ? ($oldSku[$sku]['sales'] ?? 0) : 0,
|
'sales' => $isUpdate ? ($oldSku[$sku]['sales'] ?? 0) : 0,
|
||||||
'svip_price' => $_svip_price,
|
'svip_price' => $_svip_price,
|
||||||
'mer_id' => $merId,
|
'mer_id' => $merId,
|
||||||
|
'procure_price' => $procure_price
|
||||||
];
|
];
|
||||||
$stock = $stock + intval($value['stock']);
|
$stock = $stock + intval($value['stock']);
|
||||||
}
|
}
|
||||||
$result['data'] = [
|
$result['data'] = [
|
||||||
'price' => $price ,
|
'price' => $price,
|
||||||
'stock' => $stock,
|
'stock' => $stock,
|
||||||
'ot_price' => $ot_price,
|
'ot_price' => $ot_price,
|
||||||
'cost' => $cost,
|
'cost' => $cost,
|
||||||
'svip_price' => $svip_price,
|
'svip_price' => $svip_price,
|
||||||
|
'procure_price' => $procure_price,
|
||||||
];
|
];
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
throw new ValidateException('规格错误 :'.$exception->getMessage());
|
throw new ValidateException('规格错误 :' . $exception->getMessage());
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -648,8 +649,8 @@ class ProductRepository extends BaseRepository
|
|||||||
public function setUnique(int $id, $sku, int $type)
|
public function setUnique(int $id, $sku, int $type)
|
||||||
{
|
{
|
||||||
$str = strval($type);
|
$str = strval($type);
|
||||||
$result=strlen($str);
|
$result = strlen($str);
|
||||||
$length=12-$result;
|
$length = 12 - $result;
|
||||||
return $unique = substr(md5($sku . $id), 12, $length) . $type;
|
return $unique = substr(md5($sku . $id), 12, $length) . $type;
|
||||||
// $has = (app()->make(ProductAttrValueRepository::class))->merUniqueExists(null, $unique);
|
// $has = (app()->make(ProductAttrValueRepository::class))->merUniqueExists(null, $unique);
|
||||||
// return $has ? false : $unique;
|
// return $has ? false : $unique;
|
||||||
@ -666,9 +667,10 @@ class ProductRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function getAdminOneProduct(int $id, ?int $activeId, $conType = 0)
|
public function getAdminOneProduct(int $id, ?int $activeId, $conType = 0)
|
||||||
{
|
{
|
||||||
$with = ['attr', 'attrValue', 'oldAttrValue', 'merCateId.category', 'storeCategory', 'brand', 'temp', 'seckillActive',
|
$with = [
|
||||||
|
'attr', 'attrValue', 'oldAttrValue', 'merCateId.category', 'storeCategory', 'brand', 'temp', 'seckillActive',
|
||||||
'content',
|
'content',
|
||||||
'merchant'=> function($query){
|
'merchant' => function ($query) {
|
||||||
$query->field('mer_id,mer_avatar,mer_name,is_trader');
|
$query->field('mer_id,mer_avatar,mer_name,is_trader');
|
||||||
},
|
},
|
||||||
'guarantee.templateValue.value',
|
'guarantee.templateValue.value',
|
||||||
@ -677,7 +679,7 @@ class ProductRepository extends BaseRepository
|
|||||||
|
|
||||||
$data = $this->dao->geTrashedtProduct($id)->with($with)->find();
|
$data = $this->dao->geTrashedtProduct($id)->with($with)->find();
|
||||||
|
|
||||||
$data['delivery_way'] = empty($data['delivery_way']) ? [2] : explode(',',$data['delivery_way']);
|
$data['delivery_way'] = empty($data['delivery_way']) ? [2] : explode(',', $data['delivery_way']);
|
||||||
$data['extend'] = empty($data['extend']) ? [] : json_decode($data['extend']);
|
$data['extend'] = empty($data['extend']) ? [] : json_decode($data['extend']);
|
||||||
$make_order = app()->make(StoreCouponRepository::class);
|
$make_order = app()->make(StoreCouponRepository::class);
|
||||||
$where = [['coupon_id', 'in', $data['give_coupon_ids']]];
|
$where = [['coupon_id', 'in', $data['give_coupon_ids']]];
|
||||||
@ -689,10 +691,10 @@ class ProductRepository extends BaseRepository
|
|||||||
$append = ['us_status', 'params'];
|
$append = ['us_status', 'params'];
|
||||||
$activeId = 0;
|
$activeId = 0;
|
||||||
}
|
}
|
||||||
if ($data['product_type'] == 1){
|
if ($data['product_type'] == 1) {
|
||||||
$activeId = $data->seckillActive->seckill_active_id;
|
$activeId = $data->seckillActive->seckill_active_id;
|
||||||
$make = app()->make(StoreOrderRepository::class);
|
$make = app()->make(StoreOrderRepository::class);
|
||||||
$append = ['us_status','seckill_status'];
|
$append = ['us_status', 'seckill_status'];
|
||||||
}
|
}
|
||||||
if ($data['product_type'] == 2) $make = app()->make(ProductPresellSkuRepository::class);
|
if ($data['product_type'] == 2) $make = app()->make(ProductPresellSkuRepository::class);
|
||||||
if ($data['product_type'] == 3) $make = app()->make(ProductAssistSkuRepository::class);
|
if ($data['product_type'] == 3) $make = app()->make(ProductAssistSkuRepository::class);
|
||||||
@ -755,30 +757,34 @@ class ProductRepository extends BaseRepository
|
|||||||
$data['attrValue'] = $arr;
|
$data['attrValue'] = $arr;
|
||||||
$content = $data['content']['content'] ?? '';
|
$content = $data['content']['content'] ?? '';
|
||||||
$data['content_arr'] = [];
|
$data['content_arr'] = [];
|
||||||
if (isset($data['content']) &&$data['content']['type']==1){
|
if (isset($data['content']) && $data['content']['type'] == 1) {
|
||||||
$arr = json_decode($content);
|
$arr = json_decode($content);
|
||||||
if(is_array($arr)){
|
if (is_array($arr)) {
|
||||||
$data['content_arr'] = $arr;
|
$data['content_arr'] = $arr;
|
||||||
if($arr){
|
if ($arr) {
|
||||||
$content='';
|
$content = '';
|
||||||
if(isset($arr['image'])){
|
if (isset($arr['image'])) {
|
||||||
foreach($arr['image'] as $k=>$v){
|
foreach ($arr['image'] as $k => $v) {
|
||||||
$content.='<img src='.$v.'></br>';
|
$content .= '<img src=' . $v . '></br>';
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
foreach($arr as $k=>$v){
|
foreach ($arr as $k => $v) {
|
||||||
$content.='<img src='.$v.'></br>';
|
$content .= '<img src=' . $v . '></br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$content = $arr;
|
$content = $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
unset($data['content']);
|
unset($data['content']);
|
||||||
$data['content'] = $content;
|
$data['content'] = $content;
|
||||||
|
// $attr = $this->detailAttr($data['attr']);
|
||||||
|
$attrValue =$data['attrValue'];
|
||||||
|
|
||||||
|
$sku = $this->detailAttrValue($attrValue, null, $data['product_type'], null);
|
||||||
|
$data['sku'] = $sku;
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,7 +912,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$data->append(['us_status']);
|
$data->append(['us_status']);
|
||||||
|
|
||||||
$list = hasMany(
|
$list = hasMany(
|
||||||
$data ,
|
$data,
|
||||||
'mer_labels',
|
'mer_labels',
|
||||||
ProductLabel::class,
|
ProductLabel::class,
|
||||||
'product_label_id',
|
'product_label_id',
|
||||||
@ -942,7 +948,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$data->append(['seckill_status', 'us_status']);
|
$data->append(['seckill_status', 'us_status']);
|
||||||
|
|
||||||
$list = hasMany(
|
$list = hasMany(
|
||||||
$data ,
|
$data,
|
||||||
'mer_labels',
|
'mer_labels',
|
||||||
ProductLabel::class,
|
ProductLabel::class,
|
||||||
'product_label_id',
|
'product_label_id',
|
||||||
@ -975,9 +981,9 @@ class ProductRepository extends BaseRepository
|
|||||||
]);
|
]);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$data = $query->page($page, $limit)->setOption('field', [])->field($this->admin_filed)->select();
|
$data = $query->page($page, $limit)->setOption('field', [])->field($this->admin_filed)->select();
|
||||||
$data->append([ 'us_status']);
|
$data->append(['us_status']);
|
||||||
$list = hasMany(
|
$list = hasMany(
|
||||||
$data ,
|
$data,
|
||||||
'sys_labels',
|
'sys_labels',
|
||||||
ProductLabel::class,
|
ProductLabel::class,
|
||||||
'product_label_id',
|
'product_label_id',
|
||||||
@ -1022,7 +1028,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$data->append(['seckill_status', 'us_status']);
|
$data->append(['seckill_status', 'us_status']);
|
||||||
|
|
||||||
$list = hasMany(
|
$list = hasMany(
|
||||||
$data ,
|
$data,
|
||||||
'sys_labels',
|
'sys_labels',
|
||||||
ProductLabel::class,
|
ProductLabel::class,
|
||||||
'product_label_id',
|
'product_label_id',
|
||||||
@ -1139,7 +1145,7 @@ class ProductRepository extends BaseRepository
|
|||||||
* @param $id
|
* @param $id
|
||||||
* @param $userInfo
|
* @param $userInfo
|
||||||
*/
|
*/
|
||||||
public function detail(int $id, $userInfo,$product_type)
|
public function detail(int $id, $userInfo, $product_type)
|
||||||
{
|
{
|
||||||
$where = [
|
$where = [
|
||||||
'is_show' => 1,
|
'is_show' => 1,
|
||||||
@ -1158,11 +1164,11 @@ class ProductRepository extends BaseRepository
|
|||||||
* @author Qinii
|
* @author Qinii
|
||||||
* @day 2020-08-05
|
* @day 2020-08-05
|
||||||
*/
|
*/
|
||||||
public function seckillDetail(int $id,$userInfo)
|
public function seckillDetail(int $id, $userInfo)
|
||||||
{
|
{
|
||||||
$where = $this->seckillShow();
|
$where = $this->seckillShow();
|
||||||
$where['product_id'] = $id;
|
$where['product_id'] = $id;
|
||||||
return $this->apiProductDetail($where, 1, null,$userInfo);
|
return $this->apiProductDetail($where, 1, null, $userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function apiProductDetail(array $where, int $productType, ?int $activityId, $userInfo = null)
|
public function apiProductDetail(array $where, int $productType, ?int $activityId, $userInfo = null)
|
||||||
@ -1174,7 +1180,7 @@ class ProductRepository extends BaseRepository
|
|||||||
'attrValue',
|
'attrValue',
|
||||||
'oldAttrValue',
|
'oldAttrValue',
|
||||||
'merchant' => function ($query) {
|
'merchant' => function ($query) {
|
||||||
$query->with(['type_names'])->append(['isset_certificate','services_type']);
|
$query->with(['type_names'])->append(['isset_certificate', 'services_type']);
|
||||||
},
|
},
|
||||||
'seckillActive' => function ($query) {
|
'seckillActive' => function ($query) {
|
||||||
$query->field('start_day,end_day,start_time,end_time,product_id');
|
$query->field('start_day,end_day,start_time,end_time,product_id');
|
||||||
@ -1182,7 +1188,7 @@ class ProductRepository extends BaseRepository
|
|||||||
'temp'
|
'temp'
|
||||||
];
|
];
|
||||||
|
|
||||||
$append = ['guaranteeTemplate','params'];
|
$append = ['guaranteeTemplate', 'params'];
|
||||||
if (empty($where['product_id']) || $productType != 0) {
|
if (empty($where['product_id']) || $productType != 0) {
|
||||||
$where['product_type'] = $productType;
|
$where['product_type'] = $productType;
|
||||||
}
|
}
|
||||||
@ -1237,7 +1243,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$res['merchant']['top_banner'] = merchantConfig($res['mer_id'], 'mer_pc_top');
|
$res['merchant']['top_banner'] = merchantConfig($res['mer_id'], 'mer_pc_top');
|
||||||
$res['merchant']['care'] = $care;
|
$res['merchant']['care'] = $care;
|
||||||
$res['replayData'] = null;
|
$res['replayData'] = null;
|
||||||
if (systemConfig('sys_reply_status')){
|
if (systemConfig('sys_reply_status')) {
|
||||||
$res['replayData'] = app()->make(ProductReplyRepository::class)->getReplyRate($res['product_id']);
|
$res['replayData'] = app()->make(ProductReplyRepository::class)->getReplyRate($res['product_id']);
|
||||||
$append[] = 'topReply';
|
$append[] = 'topReply';
|
||||||
}
|
}
|
||||||
@ -1256,28 +1262,26 @@ class ProductRepository extends BaseRepository
|
|||||||
$res['sku'] = $sku;
|
$res['sku'] = $sku;
|
||||||
$res->append($append);
|
$res->append($append);
|
||||||
if ($res['content'] && $res['content']['type'] == 1) {
|
if ($res['content'] && $res['content']['type'] == 1) {
|
||||||
$content= json_decode($res['content']['content']);
|
$content = json_decode($res['content']['content']);
|
||||||
if(is_Array($content) && isset($content['image'])){
|
if (is_Array($content) && isset($content['image'])) {
|
||||||
// $img='<p>';
|
// $img='<p>';
|
||||||
$image= $content['image']??[];
|
$image = $content['image'] ?? [];
|
||||||
// foreach($content['image'] as $k=>$v){
|
// foreach($content['image'] as $k=>$v){
|
||||||
// $img =$img. '<img src="'.$v.'"/>';
|
// $img =$img. '<img src="'.$v.'"/>';
|
||||||
// }
|
// }
|
||||||
$res['content']['content']=['image'=>$image];
|
$res['content']['content'] = ['image' => $image];
|
||||||
|
} elseif (is_object($content)) {
|
||||||
}elseif(is_object($content)){
|
$image = $content->image ?? [];
|
||||||
$image= $content->image??[];
|
|
||||||
// $img='<p>';
|
// $img='<p>';
|
||||||
// foreach($image as $k=>$v){
|
// foreach($image as $k=>$v){
|
||||||
// $img =$img. '<img src="'.$v.'"/>';
|
// $img =$img. '<img src="'.$v.'"/>';
|
||||||
// }
|
// }
|
||||||
$res['content']['content']=['image'=>$image];
|
$res['content']['content'] = ['image' => $image];
|
||||||
}
|
} else {
|
||||||
else{
|
if (is_Array($content)) {
|
||||||
if(is_Array($content)){
|
$res['content']['content'] = ['image' => $content];
|
||||||
$res['content']['content']=['image'=>$content];
|
} else {
|
||||||
}else{
|
$res['content']['content'] = $content;
|
||||||
$res['content']['content']=$content;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1300,8 +1304,8 @@ class ProductRepository extends BaseRepository
|
|||||||
$res['top_pid'] = $hot['top_pid'] ?? 0;
|
$res['top_pid'] = $hot['top_pid'] ?? 0;
|
||||||
}
|
}
|
||||||
//活动氛围图
|
//活动氛围图
|
||||||
if (in_array($res['product_type'],[0,2,4])){
|
if (in_array($res['product_type'], [0, 2, 4])) {
|
||||||
$active = app()->make(StoreActivityRepository::class)->getActivityBySpu(StoreActivityRepository::ACTIVITY_TYPE_ATMOSPHERE,$res['spu_id'],$res['cate_id'],$res['mer_id']);
|
$active = app()->make(StoreActivityRepository::class)->getActivityBySpu(StoreActivityRepository::ACTIVITY_TYPE_ATMOSPHERE, $res['spu_id'], $res['cate_id'], $res['mer_id']);
|
||||||
if ($active) $res['atmosphere_pic'] = $active['pic'];
|
if ($active) $res['atmosphere_pic'] = $active['pic'];
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
@ -1319,13 +1323,13 @@ class ProductRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
//热卖排行
|
//热卖排行
|
||||||
$lv = systemConfig('hot_ranking_lv') ?:0;
|
$lv = systemConfig('hot_ranking_lv') ?: 0;
|
||||||
$categoryMake = app()->make(StoreCategoryRepository::class);
|
$categoryMake = app()->make(StoreCategoryRepository::class);
|
||||||
$cate = $categoryMake->getWhere(['store_category_id' => $cateId]);
|
$cate = $categoryMake->getWhere(['store_category_id' => $cateId]);
|
||||||
if ($lv != 2 && $cate) $cateId = $lv == 1 ? $cate->pathIds[2] : $cate->pathIds[1];
|
if ($lv != 2 && $cate) $cateId = $lv == 1 ? $cate->pathIds[2] : $cate->pathIds[1];
|
||||||
$RedisCacheService = app()->make(RedisCacheService::class);
|
$RedisCacheService = app()->make(RedisCacheService::class);
|
||||||
$prefix = env('QUEUE_NAME','merchant').'_hot_ranking_';
|
$prefix = env('QUEUE_NAME', 'merchant') . '_hot_ranking_';
|
||||||
$key = ( $prefix.'top_item_'.$cateId.'_'.$spuId);
|
$key = ($prefix . 'top_item_' . $cateId . '_' . $spuId);
|
||||||
$k1 = $RedisCacheService->keys($key);
|
$k1 = $RedisCacheService->keys($key);
|
||||||
if ($k1) {
|
if ($k1) {
|
||||||
$top = $RedisCacheService->handler()->get($key);
|
$top = $RedisCacheService->handler()->get($key);
|
||||||
@ -1345,24 +1349,24 @@ class ProductRepository extends BaseRepository
|
|||||||
* @author Qinii
|
* @author Qinii
|
||||||
* @day 12/7/21
|
* @day 12/7/21
|
||||||
*/
|
*/
|
||||||
public function getRecommend($productId,$merId)
|
public function getRecommend($productId, $merId)
|
||||||
{
|
{
|
||||||
$make = app()->make(ProductCateRepository::class);
|
$make = app()->make(ProductCateRepository::class);
|
||||||
$product_id = [];
|
$product_id = [];
|
||||||
if ($productId) {
|
if ($productId) {
|
||||||
$catId = $make->getSearch(['product_id' => $productId])->column('mer_cate_id');
|
$catId = $make->getSearch(['product_id' => $productId])->column('mer_cate_id');
|
||||||
$product_id = $make->getSearch([])->whereIn('mer_cate_id',$catId)->column('product_id');
|
$product_id = $make->getSearch([])->whereIn('mer_cate_id', $catId)->column('product_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $this->dao->getSearch([])
|
$query = $this->dao->getSearch([])
|
||||||
->where($this->dao->productShow())
|
->where($this->dao->productShow())
|
||||||
->when($productId,function($query) use ($productId) {
|
->when($productId, function ($query) use ($productId) {
|
||||||
$query->where('product_id','<>',$productId);
|
$query->where('product_id', '<>', $productId);
|
||||||
})
|
})
|
||||||
->when($product_id,function($query) use ($product_id) {
|
->when($product_id, function ($query) use ($product_id) {
|
||||||
$query->whereIn('product_id',$product_id);
|
$query->whereIn('product_id', $product_id);
|
||||||
})
|
})
|
||||||
->where('mer_id',$merId);
|
->where('mer_id', $merId);
|
||||||
$data = [];
|
$data = [];
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
// if ($count < 3) {
|
// if ($count < 3) {
|
||||||
@ -1376,9 +1380,9 @@ class ProductRepository extends BaseRepository
|
|||||||
// ->limit((3 - $count))
|
// ->limit((3 - $count))
|
||||||
// ->select()->toArray();
|
// ->select()->toArray();
|
||||||
// }
|
// }
|
||||||
if ($count > 0 ){
|
if ($count > 0) {
|
||||||
$count = $count > 3 ? 3 : $count;
|
$count = $count > 3 ? 3 : $count;
|
||||||
$res = $query->setOption('field',[])->field('mer_id,product_id,store_name,image,price,is_show,status,is_gift_bag,is_good,sales,create_time')
|
$res = $query->setOption('field', [])->field('mer_id,product_id,store_name,image,price,is_show,status,is_gift_bag,is_good,sales,create_time')
|
||||||
->order('sort DESC,create_time DESC')
|
->order('sort DESC,create_time DESC')
|
||||||
->limit($count)
|
->limit($count)
|
||||||
->select()->toArray();
|
->select()->toArray();
|
||||||
@ -1487,8 +1491,9 @@ class ProductRepository extends BaseRepository
|
|||||||
'sales' => $value['sales'],
|
'sales' => $value['sales'],
|
||||||
'unique' => $value['unique'],
|
'unique' => $value['unique'],
|
||||||
'bar_code' => $value['bar_code'],
|
'bar_code' => $value['bar_code'],
|
||||||
|
'procure_price' => $value['procure_price'],
|
||||||
];
|
];
|
||||||
if($productType == 0 ){
|
if ($productType == 0) {
|
||||||
$_value['ot_price'] = $value['ot_price'];
|
$_value['ot_price'] = $value['ot_price'];
|
||||||
$_value['svip_price'] = $value['svip_price'];
|
$_value['svip_price'] = $value['svip_price'];
|
||||||
}
|
}
|
||||||
@ -1621,12 +1626,12 @@ class ProductRepository extends BaseRepository
|
|||||||
Db::rollback();
|
Db::rollback();
|
||||||
throw new ValidateException('商品更新出错');
|
throw new ValidateException('商品更新出错');
|
||||||
}
|
}
|
||||||
$changeStatus= app()->make(SpuRepository::class)->changeStatus($id, $product->product_type);
|
$changeStatus = app()->make(SpuRepository::class)->changeStatus($id, $product->product_type);
|
||||||
if ($changeStatus=== false) {
|
if ($changeStatus === false) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
throw new ValidateException('商品spu更新出错');
|
throw new ValidateException('商品spu更新出错');
|
||||||
}else{
|
} else {
|
||||||
if ($product->product_type==0){
|
if ($product->product_type == 0) {
|
||||||
event('product.sell', ['product_id' => [$id]]);
|
event('product.sell', ['product_id' => [$id]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1637,7 +1642,7 @@ class ProductRepository extends BaseRepository
|
|||||||
{
|
{
|
||||||
$where['product_id'] = $id;
|
$where['product_id'] = $id;
|
||||||
if ($merId) $where['mer_id'] = $merId;
|
if ($merId) $where['mer_id'] = $merId;
|
||||||
$products = $this->dao->getSearch([])->where('product_id','in', $id)->select();
|
$products = $this->dao->getSearch([])->where('product_id', 'in', $id)->select();
|
||||||
if (!$products)
|
if (!$products)
|
||||||
throw new ValidateException('数据不存在');
|
throw new ValidateException('数据不存在');
|
||||||
$productIds = [];
|
$productIds = [];
|
||||||
@ -1649,18 +1654,18 @@ class ProductRepository extends BaseRepository
|
|||||||
if ($merId && $product['mer_id'] !== $merId)
|
if ($merId && $product['mer_id'] !== $merId)
|
||||||
throw new ValidateException('商品不属于您');
|
throw new ValidateException('商品不属于您');
|
||||||
if ($status == 1 && $product['product_type'] == 2)
|
if ($status == 1 && $product['product_type'] == 2)
|
||||||
throw new ValidateException('ID:'.$product->product_id . ' 商品正在参与预售活动');
|
throw new ValidateException('ID:' . $product->product_id . ' 商品正在参与预售活动');
|
||||||
if ($status == 1 && $product['product_type'] == 3)
|
if ($status == 1 && $product['product_type'] == 3)
|
||||||
throw new ValidateException('ID:'.$product->product_id . ' 商品正在参与助力活动');
|
throw new ValidateException('ID:' . $product->product_id . ' 商品正在参与助力活动');
|
||||||
}
|
}
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
if ($this->dao->updates($id,[$field => $status]) === false) {
|
if ($this->dao->updates($id, [$field => $status]) === false) {
|
||||||
throw new \Exception('商品操作出错', 500);
|
throw new \Exception('商品操作出错', 500);
|
||||||
}
|
}
|
||||||
event('product.sell', ['product_id' => $productIds]);
|
event('product.sell', ['product_id' => $productIds]);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
Queue::push(ChangeSpuStatusJob::class,['id' => $id,'product_type'=> $product_type]);
|
Queue::push(ChangeSpuStatusJob::class, ['id' => $id, 'product_type' => $product_type]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
throw new \Exception('商品操作出错', $e->getCode());
|
throw new \Exception('商品操作出错', $e->getCode());
|
||||||
@ -1674,7 +1679,7 @@ class ProductRepository extends BaseRepository
|
|||||||
* @author Qinii
|
* @author Qinii
|
||||||
* @day 2022/11/14
|
* @day 2022/11/14
|
||||||
*/
|
*/
|
||||||
public function switchStatus($id,$data)
|
public function switchStatus($id, $data)
|
||||||
{
|
{
|
||||||
$product = $this->getSearch([])->find($id);
|
$product = $this->getSearch([])->find($id);
|
||||||
$this->dao->update($id, $data);
|
$this->dao->update($id, $data);
|
||||||
@ -1689,10 +1694,9 @@ class ProductRepository extends BaseRepository
|
|||||||
'id' => $product['product_id']
|
'id' => $product['product_id']
|
||||||
]
|
]
|
||||||
], $product['mer_id']);
|
], $product['mer_id']);
|
||||||
app()->make(SpuRepository::class)->changeStatus($id,$product->product_type);
|
app()->make(SpuRepository::class)->changeStatus($id, $product->product_type);
|
||||||
event('product.sell', ['product_id' => [$id]]);
|
event('product.sell', ['product_id' => [$id]]);
|
||||||
$this->switchShow($id,$status,'is_used',0);
|
$this->switchShow($id, $status, 'is_used', 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1703,9 +1707,9 @@ class ProductRepository extends BaseRepository
|
|||||||
* @author Qinii
|
* @author Qinii
|
||||||
* @day 2022/9/6
|
* @day 2022/9/6
|
||||||
*/
|
*/
|
||||||
public function batchSwitchStatus(array $id,array $data)
|
public function batchSwitchStatus(array $id, array $data)
|
||||||
{
|
{
|
||||||
$productData = $this->getSearch([])->where('product_id','in', $id)->select();
|
$productData = $this->getSearch([])->where('product_id', 'in', $id)->select();
|
||||||
foreach ($productData as $product) {
|
foreach ($productData as $product) {
|
||||||
$product_type = $product['product_type'];
|
$product_type = $product['product_type'];
|
||||||
$type = self::NOTIC_MSG[$data['status']][$product['product_type']];
|
$type = self::NOTIC_MSG[$data['status']][$product['product_type']];
|
||||||
@ -1718,14 +1722,13 @@ class ProductRepository extends BaseRepository
|
|||||||
'id' => $product['product_id']
|
'id' => $product['product_id']
|
||||||
]
|
]
|
||||||
], $product['mer_id']);
|
], $product['mer_id']);
|
||||||
if($data['status']==1){
|
if ($data['status'] == 1) {
|
||||||
$this->switchShow($product['product_id'],1,'is_used',0);
|
$this->switchShow($product['product_id'], 1, 'is_used', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->dao->updates($id, $data);
|
$this->dao->updates($id, $data);
|
||||||
Queue(ChangeSpuStatusJob::class, ['id' => $id, 'product_type' => $product_type]);
|
Queue(ChangeSpuStatusJob::class, ['id' => $id, 'product_type' => $product_type]);
|
||||||
event('product.status',compact('id','data'));
|
event('product.status', compact('id', 'data'));
|
||||||
event('product.sell', ['product_id' => $id]);
|
event('product.sell', ['product_id' => $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1910,13 +1913,13 @@ class ProductRepository extends BaseRepository
|
|||||||
} else {
|
} else {
|
||||||
//加入购物车
|
//加入购物车
|
||||||
//购物车现有
|
//购物车现有
|
||||||
$_num = $this->productOnceCountCart($where['product_id'],$data['product_attr_unique'], $userInfo->uid,$data['product_type']);
|
$_num = $this->productOnceCountCart($where['product_id'], $data['product_attr_unique'], $userInfo->uid, $data['product_type']);
|
||||||
$cart_num = $_num + $data['cart_num'];
|
$cart_num = $_num + $data['cart_num'];
|
||||||
}
|
}
|
||||||
if ($sku['stock'] < $cart_num ) throw new ValidateException('库存不足');
|
if ($sku['stock'] < $cart_num) throw new ValidateException('库存不足');
|
||||||
//添加购物车
|
//添加购物车
|
||||||
if (!$data['is_new']) {
|
if (!$data['is_new']) {
|
||||||
$cart = app()->make(StoreCartRepository::class)->getCartByProductSku($data['product_attr_unique'], $userInfo->uid,$data['product_type']);
|
$cart = app()->make(StoreCartRepository::class)->getCartByProductSku($data['product_attr_unique'], $userInfo->uid, $data['product_type']);
|
||||||
}
|
}
|
||||||
return compact('product', 'sku', 'cart');
|
return compact('product', 'sku', 'cart');
|
||||||
}
|
}
|
||||||
@ -1929,7 +1932,7 @@ class ProductRepository extends BaseRepository
|
|||||||
* @author Qinii
|
* @author Qinii
|
||||||
* @day 5/26/21
|
* @day 5/26/21
|
||||||
*/
|
*/
|
||||||
public function productOnceCountCart($productId,$product_attr_unique,$uid,$product_type=0)
|
public function productOnceCountCart($productId, $product_attr_unique, $uid, $product_type = 0)
|
||||||
{
|
{
|
||||||
$make = app()->make(StoreCartRepository::class);
|
$make = app()->make(StoreCartRepository::class);
|
||||||
$where = [
|
$where = [
|
||||||
@ -2079,11 +2082,12 @@ class ProductRepository extends BaseRepository
|
|||||||
$data = app()->make(GuaranteeTemplateRepository::class)->getSearch($where)->with(
|
$data = app()->make(GuaranteeTemplateRepository::class)->getSearch($where)->with(
|
||||||
[
|
[
|
||||||
'templateValue' => [
|
'templateValue' => [
|
||||||
'value' => function($query){
|
'value' => function ($query) {
|
||||||
$query->field('guarantee_id,guarantee_name,guarantee_info');
|
$query->field('guarantee_id,guarantee_name,guarantee_info');
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
])->find();
|
]
|
||||||
|
)->find();
|
||||||
return $data ?? [];
|
return $data ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2095,15 +2099,15 @@ class ProductRepository extends BaseRepository
|
|||||||
* @author Qinii
|
* @author Qinii
|
||||||
* @day 5/24/21
|
* @day 5/24/21
|
||||||
*/
|
*/
|
||||||
public function increaseTake(int $uid, string $unique,int $type,int $product_id)
|
public function increaseTake(int $uid, string $unique, int $type, int $product_id)
|
||||||
{
|
{
|
||||||
$status = systemConfig('procudt_increase_status');
|
$status = systemConfig('procudt_increase_status');
|
||||||
if(!$status) throw new ValidateException('未开启到货通知');
|
if (!$status) throw new ValidateException('未开启到货通知');
|
||||||
$make = app()->make(ProductTakeRepository::class);
|
$make = app()->make(ProductTakeRepository::class);
|
||||||
$where['product_id'] = $product_id;
|
$where['product_id'] = $product_id;
|
||||||
if($unique) $where['unique'] = $unique;
|
if ($unique) $where['unique'] = $unique;
|
||||||
$sku = app()->make(ProductAttrValueRepository::class)->getWhere($where);
|
$sku = app()->make(ProductAttrValueRepository::class)->getWhere($where);
|
||||||
if(!$sku) throw new ValidateException('商品不存在');
|
if (!$sku) throw new ValidateException('商品不存在');
|
||||||
$data = [
|
$data = [
|
||||||
'product_id' => $sku['product_id'],
|
'product_id' => $sku['product_id'],
|
||||||
'unique' => $unique ?: 1,
|
'unique' => $unique ?: 1,
|
||||||
@ -2129,11 +2133,11 @@ class ProductRepository extends BaseRepository
|
|||||||
}
|
}
|
||||||
$productType = 0;
|
$productType = 0;
|
||||||
$product = $this->setProduct($data);
|
$product = $this->setProduct($data);
|
||||||
if(isset($data['start_day'])){ //秒杀
|
if (isset($data['start_day'])) { //秒杀
|
||||||
$product['stop'] = time() + 3600;
|
$product['stop'] = time() + 3600;
|
||||||
$productType = 1;
|
$productType = 1;
|
||||||
}
|
}
|
||||||
if(isset($data['presell_type'])){ //预售
|
if (isset($data['presell_type'])) { //预售
|
||||||
$product['start_time'] = $data['start_time'];
|
$product['start_time'] = $data['start_time'];
|
||||||
$product['end_time'] = $data['end_time'];
|
$product['end_time'] = $data['end_time'];
|
||||||
$product['presell_type'] = $data['presell_type'];
|
$product['presell_type'] = $data['presell_type'];
|
||||||
@ -2145,7 +2149,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$productType = 2;
|
$productType = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($data['assist_count'])){
|
if (isset($data['assist_count'])) {
|
||||||
//助力
|
//助力
|
||||||
$product['assist_count'] = $data['assist_count'];
|
$product['assist_count'] = $data['assist_count'];
|
||||||
$product['assist_user_count'] = $data['assist_user_count'];
|
$product['assist_user_count'] = $data['assist_user_count'];
|
||||||
@ -2153,14 +2157,14 @@ class ProductRepository extends BaseRepository
|
|||||||
$productType = 3;
|
$productType = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($data['buying_count_num'])) {
|
if (isset($data['buying_count_num'])) {
|
||||||
//
|
//
|
||||||
$product['buying_count_num'] = $data['buying_count_num'];
|
$product['buying_count_num'] = $data['buying_count_num'];
|
||||||
$product['pay_count'] = $data['pay_count'];
|
$product['pay_count'] = $data['pay_count'];
|
||||||
$productType = 4;
|
$productType = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
$product['slider_image'] = explode(',',$product['slider_image']);
|
$product['slider_image'] = explode(',', $product['slider_image']);
|
||||||
$product['merchant'] = $data['merchant'];
|
$product['merchant'] = $data['merchant'];
|
||||||
$product['content'] = ['content' => $data['content']];
|
$product['content'] = ['content' => $data['content']];
|
||||||
$settleParams = $this->setAttrValue($data, 0, $productType, 0);
|
$settleParams = $this->setAttrValue($data, 0, $productType, 0);
|
||||||
@ -2185,24 +2189,24 @@ class ProductRepository extends BaseRepository
|
|||||||
];
|
];
|
||||||
$sku[$value['sku']] = $_value;
|
$sku[$value['sku']] = $_value;
|
||||||
}
|
}
|
||||||
$preview_key = 'preview'.$data['mer_id'].$productType.'_'.time();
|
$preview_key = 'preview' . $data['mer_id'] . $productType . '_' . time();
|
||||||
unset($settleParams['data'],$settleParams['attrValue']);
|
unset($settleParams['data'], $settleParams['attrValue']);
|
||||||
$settleParams['sku'] = $sku;
|
$settleParams['sku'] = $sku;
|
||||||
$settleParams['attr'] = $this->detailAttr($settleParams['attr'],1);
|
$settleParams['attr'] = $this->detailAttr($settleParams['attr'], 1);
|
||||||
|
|
||||||
if(isset($data['guarantee_template_id'])) {
|
if (isset($data['guarantee_template_id'])) {
|
||||||
$guarantee_id = app()->make(GuaranteeValueRepository::class)->getSearch(['guarantee_template_id' => $data['guarantee_template_id']])->column('guarantee_id');
|
$guarantee_id = app()->make(GuaranteeValueRepository::class)->getSearch(['guarantee_template_id' => $data['guarantee_template_id']])->column('guarantee_id');
|
||||||
$product['guaranteeTemplate'] = app()->make(GuaranteeRepository::class)->getSearch(['status' => 1, 'is_del' => 0])->where('guarantee_id', 'in', $guarantee_id)->select();
|
$product['guaranteeTemplate'] = app()->make(GuaranteeRepository::class)->getSearch(['status' => 1, 'is_del' => 0])->where('guarantee_id', 'in', $guarantee_id)->select();
|
||||||
}
|
}
|
||||||
if(isset($data['temp_id'])) {
|
if (isset($data['temp_id'])) {
|
||||||
$product['temp'] = app()->make(ShippingTemplateRepository::class)->getSearch(['shipping_template_id' => $data['temp_id']])->find();
|
$product['temp'] = app()->make(ShippingTemplateRepository::class)->getSearch(['shipping_template_id' => $data['temp_id']])->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = array_merge($product,$settleParams);
|
$ret = array_merge($product, $settleParams);
|
||||||
|
|
||||||
Cache::set($preview_key,$ret);
|
Cache::set($preview_key, $ret);
|
||||||
|
|
||||||
return compact('preview_key','ret');
|
return compact('preview_key', 'ret');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2215,8 +2219,7 @@ class ProductRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function getPreview(array $data)
|
public function getPreview(array $data)
|
||||||
{
|
{
|
||||||
switch($data['product_type'])
|
switch ($data['product_type']) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
case 98:
|
case 98:
|
||||||
case 99:
|
case 99:
|
||||||
@ -2228,20 +2231,20 @@ class ProductRepository extends BaseRepository
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$make = app()->make(ProductPresellRepository::class);
|
$make = app()->make(ProductPresellRepository::class);
|
||||||
$res = $make->getWhere([$make->getPk()=> $data['id']])->toArray();
|
$res = $make->getWhere([$make->getPk() => $data['id']])->toArray();
|
||||||
$ret = $this->apiProductDetail(['product_id' => $res['product_id']], 2, $data['id'])->toArray();
|
$ret = $this->apiProductDetail(['product_id' => $res['product_id']], 2, $data['id'])->toArray();
|
||||||
$ret['ot_price'] = $ret['price'];
|
$ret['ot_price'] = $ret['price'];
|
||||||
$ret['start_time'] = $res['start_time'];
|
$ret['start_time'] = $res['start_time'];
|
||||||
$ret['p_end_time'] = $res['end_time'];
|
$ret['p_end_time'] = $res['end_time'];
|
||||||
$ret = array_merge($ret,$res);
|
$ret = array_merge($ret, $res);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$make = app()->make(ProductAssistRepository::class);
|
$make = app()->make(ProductAssistRepository::class);
|
||||||
$res = $make->getWhere([$make->getPk()=> $data['id']])->toArray();
|
$res = $make->getWhere([$make->getPk() => $data['id']])->toArray();
|
||||||
$ret = $this->apiProductDetail(['product_id' => $res['product_id']], 3, $data['id'])->toArray();
|
$ret = $this->apiProductDetail(['product_id' => $res['product_id']], 3, $data['id'])->toArray();
|
||||||
|
|
||||||
$ret = array_merge($ret,$res);
|
$ret = array_merge($ret, $res);
|
||||||
foreach ($ret['sku'] as $value){
|
foreach ($ret['sku'] as $value) {
|
||||||
$ret['price'] = $value['price'];
|
$ret['price'] = $value['price'];
|
||||||
$ret['stock'] = $value['stock'];
|
$ret['stock'] = $value['stock'];
|
||||||
}
|
}
|
||||||
@ -2251,7 +2254,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$res = $make->get($data['id'])->toArray();
|
$res = $make->get($data['id'])->toArray();
|
||||||
$ret = $this->apiProductDetail(['product_id' => $res['product_id']], 4, $data['id'])->toArray();
|
$ret = $this->apiProductDetail(['product_id' => $res['product_id']], 4, $data['id'])->toArray();
|
||||||
$ret['ot_price'] = $ret['price'];
|
$ret['ot_price'] = $ret['price'];
|
||||||
$ret = array_merge($ret,$res);
|
$ret = array_merge($ret, $res);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -2264,7 +2267,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$where['product_id'] = $id;
|
$where['product_id'] = $id;
|
||||||
$field = isset($data['sys_labels']) ? 'sys_labels' : 'mer_labels';
|
$field = isset($data['sys_labels']) ? 'sys_labels' : 'mer_labels';
|
||||||
if ($merId) $where['mer_id'] = $merId;
|
if ($merId) $where['mer_id'] = $merId;
|
||||||
app()->make(ProductLabelRepository::class)->checkHas($merId,$data[$field]);
|
app()->make(ProductLabelRepository::class)->checkHas($merId, $data[$field]);
|
||||||
$ret = $this->dao->getWhere($where);
|
$ret = $this->dao->getWhere($where);
|
||||||
|
|
||||||
$activeId = $ret->seckillActive->seckill_active_id ?? 0;
|
$activeId = $ret->seckillActive->seckill_active_id ?? 0;
|
||||||
@ -2283,7 +2286,7 @@ class ProductRepository extends BaseRepository
|
|||||||
return app()->make(ProductAttrValueRepository::class)->getSearch(['product_id' => $id])->select()->append(['is_svip_price']);
|
return app()->make(ProductAttrValueRepository::class)->getSearch(['product_id' => $id])->select()->append(['is_svip_price']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkParams($data,$merId,$id = null)
|
public function checkParams($data, $merId, $id = null)
|
||||||
{
|
{
|
||||||
if (!$data['pay_limit']) $data['once_max_count'] = 0;
|
if (!$data['pay_limit']) $data['once_max_count'] = 0;
|
||||||
if ($data['brand_id'] > 0 && !$this->merBrandExists($data['brand_id']))
|
if ($data['brand_id'] > 0 && !$this->merBrandExists($data['brand_id']))
|
||||||
@ -2295,20 +2298,20 @@ class ProductRepository extends BaseRepository
|
|||||||
if ($data['delivery_way'] == 2 && !$this->merShippingExists($merId, $data['temp_id']))
|
if ($data['delivery_way'] == 2 && !$this->merShippingExists($merId, $data['temp_id']))
|
||||||
throw new ValidateException('运费模板不存在');
|
throw new ValidateException('运费模板不存在');
|
||||||
if (isset($data['type']) && $data['type'] && $data['extend']) {
|
if (isset($data['type']) && $data['type'] && $data['extend']) {
|
||||||
$key = ['email','text','number','date','time','idCard','mobile','image'];
|
$key = ['email', 'text', 'number', 'date', 'time', 'idCard', 'mobile', 'image'];
|
||||||
if (count($data['extend']) > 10) throw new ValidateException('附加表单不能超过10条');
|
if (count($data['extend']) > 10) throw new ValidateException('附加表单不能超过10条');
|
||||||
$title = [];
|
$title = [];
|
||||||
foreach ($data['extend'] as $item) {
|
foreach ($data['extend'] as $item) {
|
||||||
if (empty($item['title']) )
|
if (empty($item['title']))
|
||||||
throw new ValidateException('表单名称不能为空:'.$item['key']);
|
throw new ValidateException('表单名称不能为空:' . $item['key']);
|
||||||
if (in_array($item['title'],$title))
|
if (in_array($item['title'], $title))
|
||||||
throw new ValidateException('表单名称不能重复:'.$item['title']);
|
throw new ValidateException('表单名称不能重复:' . $item['title']);
|
||||||
$title[] = $item['title'];
|
$title[] = $item['title'];
|
||||||
if (!in_array($item['key'], $key))
|
if (!in_array($item['key'], $key))
|
||||||
throw new ValidateException('表单类型错误:'.$item['key']);
|
throw new ValidateException('表单类型错误:' . $item['key']);
|
||||||
$extend[] = [
|
$extend[] = [
|
||||||
'title' => $item['title'],
|
'title' => $item['title'],
|
||||||
'key' => $item['key'] ,
|
'key' => $item['key'],
|
||||||
'require' => $item['require'],
|
'require' => $item['require'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -2316,8 +2319,8 @@ class ProductRepository extends BaseRepository
|
|||||||
foreach ($data['attrValue'] as $k => $item) {
|
foreach ($data['attrValue'] as $k => $item) {
|
||||||
//$data['attrValue'][$k]['stock'] = 0;
|
//$data['attrValue'][$k]['stock'] = 0;
|
||||||
}
|
}
|
||||||
app()->make(ProductLabelRepository::class)->checkHas($merId,$data['mer_labels']);
|
app()->make(ProductLabelRepository::class)->checkHas($merId, $data['mer_labels']);
|
||||||
$count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['cate_id'],'is_show' => 1]);
|
$count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['cate_id'], 'is_show' => 1]);
|
||||||
if (!$count) throw new ValidateException('平台分类不存在或不可用');
|
if (!$count) throw new ValidateException('平台分类不存在或不可用');
|
||||||
app()->make(StoreProductValidate::class)->check($data);
|
app()->make(StoreProductValidate::class)->check($data);
|
||||||
if ($id) unset($data['type']);
|
if ($id) unset($data['type']);
|
||||||
@ -2341,29 +2344,30 @@ class ProductRepository extends BaseRepository
|
|||||||
$model = new PurchaseRecord();
|
$model = new PurchaseRecord();
|
||||||
$stockIn = $params['number'] ?? 0;
|
$stockIn = $params['number'] ?? 0;
|
||||||
$price = $params['price'] ?? 0;
|
$price = $params['price'] ?? 0;
|
||||||
if($stockIn==0){
|
$orderProduct = StoreOrderProduct::where('order_id', $params['order_id'])->where('product_id', $params['order_product_id'])
|
||||||
$stockIn=1;
|
->where('product_sku', $params['order_unique'])->find();
|
||||||
|
$stockIn=$orderProduct['product_num'];
|
||||||
|
if ($stockIn <= 0) {
|
||||||
|
throw new ValidateException('入库数量不能小于等于0');
|
||||||
}
|
}
|
||||||
if (empty($params['product_id']) && !empty($params['order_product_id'])) {
|
if (empty($params['product_id']) && !empty($params['order_product_id'])) {
|
||||||
//有商品无规格或者无商品无规格,导入商品和规格
|
//有商品无规格或者无商品无规格,导入商品和规格
|
||||||
$product = $this->getWhere(['source_product_id' => $params['order_product_id'], 'mer_id' => $merId]);
|
$product = $this->getWhere(['source_product_id' => $params['order_product_id'], 'mer_id' => $merId]);
|
||||||
if (!empty($product)) {
|
if (!empty($product)) {
|
||||||
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $product['product_id'])->find();
|
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $product['product_id'])->where('unique', $params['unique'])->find();
|
||||||
if (!empty($params['order_id'])) {
|
if (!empty($params['order_id'])) {
|
||||||
//采购、委托订单导入
|
//采购、委托订单导入
|
||||||
$orderMerId = StoreOrder::where('order_id', $params['order_id'])->value('mer_id');
|
$orderMerId = StoreOrder::where('order_id', $params['order_id'])->value('mer_id');
|
||||||
$orderProduct = StoreOrderProduct::where('order_id', $params['order_id'])->where('product_id', $params['order_product_id'])->where('product_sku', $params['order_unique'])->find();
|
|
||||||
if (empty($orderProduct)) {
|
if (empty($orderProduct)) {
|
||||||
$unique = $this->importAttrValue($params['order_product_id'], $product->toArray(), $params['order_unique']);
|
$unique = $this->importAttrValue($params['order_product_id'], $product->toArray(), $params['order_unique']);
|
||||||
if (!$unique) {
|
if (!$unique) {
|
||||||
throw new \Exception('商品规格导入出错', 500);
|
throw new ValidateException('商品规格导入出错');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( $orderProduct->is_imported == 1){
|
if ($orderProduct->is_imported == 0) {
|
||||||
|
|
||||||
ProductAttrValue::where('mer_id', $merId)
|
$attrValue->stock=$attrValue->stock + $stockIn;
|
||||||
->where('product_id', $product['product_id'])
|
$product->stock = $stockIn + $product->stock;
|
||||||
->update(['stock'=>$attrValue->stock + $stockIn]);
|
|
||||||
$data = [
|
$data = [
|
||||||
'order_id' => $params['order_id'] ?? 0,
|
'order_id' => $params['order_id'] ?? 0,
|
||||||
'order_product_id' => $params['order_product_id'] ?? 0,
|
'order_product_id' => $params['order_product_id'] ?? 0,
|
||||||
@ -2373,13 +2377,18 @@ class ProductRepository extends BaseRepository
|
|||||||
'unique' => $attrValue['unique'],
|
'unique' => $attrValue['unique'],
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
'mer_id' => $product->mer_id,
|
'mer_id' => $product->mer_id,
|
||||||
'supplier_mer_id' => $orderMerId??0,
|
'supplier_mer_id' => $orderMerId ?? 0,
|
||||||
];
|
];
|
||||||
if (!$model->save($data)) {
|
if (!$model->save($data)) {
|
||||||
throw new \Exception('入库失败', 500);
|
throw new ValidateException('入库失败');
|
||||||
}
|
}
|
||||||
|
$orderProduct->save(['is_imported' => 1]);
|
||||||
|
$attrValue->save();
|
||||||
|
$product->save();
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return true;
|
return true;
|
||||||
|
}else{
|
||||||
|
throw new ValidateException('该商品已导入过');
|
||||||
}
|
}
|
||||||
$stockIn = $orderProduct['product_num'] ?? 0;
|
$stockIn = $orderProduct['product_num'] ?? 0;
|
||||||
$price = $orderProduct['product_price'] ?? 0;
|
$price = $orderProduct['product_price'] ?? 0;
|
||||||
@ -2393,7 +2402,6 @@ class ProductRepository extends BaseRepository
|
|||||||
$productId = $this->import($params['order_product_id'], request()->userInfo());
|
$productId = $this->import($params['order_product_id'], request()->userInfo());
|
||||||
$product = $this->get($productId);
|
$product = $this->get($productId);
|
||||||
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $productId)->find();
|
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $productId)->find();
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//有商品有规格
|
//有商品有规格
|
||||||
@ -2401,16 +2409,13 @@ class ProductRepository extends BaseRepository
|
|||||||
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $params['product_id'])->where('unique', $params['unique'])->find();
|
$attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $params['product_id'])->where('unique', $params['unique'])->find();
|
||||||
}
|
}
|
||||||
if (!$product || !$attrValue) {
|
if (!$product || !$attrValue) {
|
||||||
throw new DataNotFoundException('商品或规格不存在');
|
throw new ValidateException('商品或规格不存在');
|
||||||
}
|
|
||||||
if ($stockIn <= 0) {
|
|
||||||
throw new ValidateException('入库数量不能小于等于0');
|
|
||||||
}
|
}
|
||||||
$attrValue->stock = $attrValue->stock + $stockIn;
|
$attrValue->stock = $attrValue->stock + $stockIn;
|
||||||
$attrValue->save();
|
$attrValue->save();
|
||||||
$product->stock = $stockIn + $product->stock;
|
$product->stock = $stockIn + $product->stock;
|
||||||
if (!$product->save()) {
|
if (!$product->save()) {
|
||||||
throw new \Exception('商品库存保存失败', 500);
|
throw new ValidateException('商品库存保存失败');
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
'order_id' => $params['order_id'] ?? 0,
|
'order_id' => $params['order_id'] ?? 0,
|
||||||
@ -2424,15 +2429,15 @@ class ProductRepository extends BaseRepository
|
|||||||
'supplier_mer_id' => $supplierMerId,
|
'supplier_mer_id' => $supplierMerId,
|
||||||
];
|
];
|
||||||
if (!$model->save($data)) {
|
if (!$model->save($data)) {
|
||||||
throw new \Exception('入库失败', 500);
|
throw new ValidateException('入库失败');
|
||||||
}
|
}
|
||||||
if (isset($orderProduct) && !$orderProduct->save(['is_imported' => 1])) {
|
if (isset($orderProduct) && !$orderProduct->save(['is_imported' => 1])) {
|
||||||
throw new \Exception('订单商品更新出错', 500);
|
throw new ValidateException('订单商品更新出错');
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
throw new \Exception($e->getMessage(), $e->getCode());
|
throw new ValidateException($e->getMessage(), $e->getCode());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2533,7 +2538,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$data = $query->page($page, $limit)->setOption('field', [])->field($this->filed)->select();
|
$data = $query->page($page, $limit)->setOption('field', [])->field($this->filed)->select();
|
||||||
$data->append(['us_status']);
|
$data->append(['us_status']);
|
||||||
$list = hasMany(
|
$list = hasMany(
|
||||||
$data ,
|
$data,
|
||||||
'mer_labels',
|
'mer_labels',
|
||||||
ProductLabel::class,
|
ProductLabel::class,
|
||||||
'product_label_id',
|
'product_label_id',
|
||||||
@ -2543,5 +2548,4 @@ class ProductRepository extends BaseRepository
|
|||||||
);
|
);
|
||||||
return compact('count', 'list');
|
return compact('count', 'list');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
namespace app\controller\admin\system\auth;
|
namespace app\controller\admin\system\auth;
|
||||||
|
|
||||||
|
use app\common\model\system\Relevance;
|
||||||
use crmeb\basic\BaseController;
|
use crmeb\basic\BaseController;
|
||||||
use app\common\repositories\system\auth\MenuRepository;
|
use app\common\repositories\system\auth\MenuRepository;
|
||||||
use app\validate\admin\MenuValidate;
|
use app\validate\admin\MenuValidate;
|
||||||
@ -21,6 +22,7 @@ use think\App;
|
|||||||
use think\db\exception\DataNotFoundException;
|
use think\db\exception\DataNotFoundException;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\db\exception\ModelNotFoundException;
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Menu
|
* Class Menu
|
||||||
@ -193,9 +195,12 @@ class Menu extends BaseController
|
|||||||
{
|
{
|
||||||
$pre = '/' . config('admin.merchant_prefix');
|
$pre = '/' . config('admin.merchant_prefix');
|
||||||
$merchant = $this->request->merchant();
|
$merchant = $this->request->merchant();
|
||||||
$menus = $this->request->adminInfo()->level
|
$level = $this->request->adminInfo()->level;
|
||||||
? $this->repository->ruleByMenuList($this->request->adminRule(), $this->merchant)
|
if($level){
|
||||||
: ($merchant->type_id ? $this->repository->typesByValidMenuList($merchant->type_id) : $this->repository->getValidMenuList($this->merchant));
|
$menus= $this->repository->ruleByMenuList($this->request->adminRule(), $this->merchant);
|
||||||
|
}else{
|
||||||
|
$menus=($merchant->type_id ? $this->repository->typesByValidMenuList($merchant->type_id) : $this->repository->getValidMenuList($this->merchant));
|
||||||
|
}
|
||||||
foreach ($menus as $k => $menu) {
|
foreach ($menus as $k => $menu) {
|
||||||
$menu['route'] = $pre . $menu['route'];
|
$menu['route'] = $pre . $menu['route'];
|
||||||
$menus[$k] = $menu;
|
$menus[$k] = $menu;
|
||||||
|
@ -243,7 +243,26 @@ class Merchant extends BaseController
|
|||||||
{
|
{
|
||||||
if (!$this->repository->exists($id))
|
if (!$this->repository->exists($id))
|
||||||
return app('json')->fail('数据不存在');
|
return app('json')->fail('数据不存在');
|
||||||
|
$admins=$this->request->adminInfo();
|
||||||
|
if($admins['admin_id']!=1){
|
||||||
|
$adminInfo = $adminRepository->merIdByAdmin($id,['account'=>'yy'.$admins['account']],2);
|
||||||
|
if(!$adminInfo){
|
||||||
|
$pwd =password_hash(rand(100000,999999), PASSWORD_BCRYPT);
|
||||||
|
$data =[
|
||||||
|
'mer_id' => $id,
|
||||||
|
'pwd'=>$pwd,
|
||||||
|
'account'=>'yy'.$admins['account'],
|
||||||
|
'real_name' => $admins['real_name'],
|
||||||
|
'phone' => $admins['phone'],
|
||||||
|
'roles' => env('MERCHANT_ROLES'),
|
||||||
|
'level' => 2
|
||||||
|
];
|
||||||
|
Db::name('merchant_admin')->insert($data);
|
||||||
|
$adminInfo = $adminRepository->merIdByAdmin($id,['account'=>'yy'.$admins['account']],2);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
$adminInfo = $adminRepository->merIdByAdmin($id);
|
$adminInfo = $adminRepository->merIdByAdmin($id);
|
||||||
|
}
|
||||||
$tokenInfo = $adminRepository->createToken($adminInfo);
|
$tokenInfo = $adminRepository->createToken($adminInfo);
|
||||||
$admin = $adminInfo->toArray();
|
$admin = $adminInfo->toArray();
|
||||||
unset($admin['pwd']);
|
unset($admin['pwd']);
|
||||||
|
@ -1,336 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
namespace app\controller\api\server;
|
|
||||||
|
|
||||||
|
|
||||||
use app\common\repositories\delivery\DeliveryStationRepository;
|
|
||||||
use app\common\repositories\store\order\StoreOrderRepository;
|
|
||||||
use app\common\repositories\store\order\StoreRefundOrderRepository;
|
|
||||||
use app\common\repositories\store\service\StoreServiceRepository;
|
|
||||||
use app\controller\merchant\Common;
|
|
||||||
use crmeb\basic\BaseController;
|
|
||||||
use think\App;
|
|
||||||
use think\exception\HttpResponseException;
|
|
||||||
use think\exception\ValidateException;
|
|
||||||
use think\facade\Db;
|
|
||||||
use think\response\Json;
|
|
||||||
|
|
||||||
class StoreOrder extends BaseController
|
|
||||||
{
|
|
||||||
public function __construct(App $app)
|
|
||||||
{
|
|
||||||
parent::__construct($app);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function orderStatistics($merId, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
$order = $repository->OrderTitleNumber($merId, null);
|
|
||||||
$order['refund'] = app()->make(StoreRefundOrderRepository::class)->getWhereCount(['is_system_del' => 0, 'mer_id' => $merId]);
|
|
||||||
$common = app()->make(Common::class);
|
|
||||||
$data = [];
|
|
||||||
$data['today'] = $common->mainGroup('today', $merId);
|
|
||||||
$data['yesterday'] = $common->mainGroup('yesterday', $merId);
|
|
||||||
$data['month'] = $common->mainGroup('month', $merId);
|
|
||||||
return app('json')->success(compact('order', 'data'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function orderDetail($merId, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
[$page, $limit] = $this->getPage();
|
|
||||||
list($start, $stop) = $this->request->params([
|
|
||||||
['start', strtotime(date('Y-m'))],
|
|
||||||
['stop', time()],
|
|
||||||
], true);
|
|
||||||
if ($start == $stop) return app('json')->fail('参数有误');
|
|
||||||
if ($start > $stop) {
|
|
||||||
$middle = $stop;
|
|
||||||
$stop = $start;
|
|
||||||
$start = $middle;
|
|
||||||
}
|
|
||||||
$where = $this->request->has('start') ? ['dateRange' => compact('start', 'stop')] : [];
|
|
||||||
$list = $repository->orderGroupNumPage($where, $page, $limit, $merId);
|
|
||||||
return app('json')->success($list);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function orderList($merId, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
[$page, $limit] = $this->getPage();
|
|
||||||
$where['status'] = $this->request->param('status');
|
|
||||||
$where['is_verify'] = $this->request->param('is_verify');
|
|
||||||
$where['search'] = $this->request->param('store_name');
|
|
||||||
$where['mer_id'] = $merId;
|
|
||||||
$where['is_del'] = 0;
|
|
||||||
if($where['status'] == 2) $where['order_type'] = 0;
|
|
||||||
return app('json')->success($repository->merchantGetList($where, $page, $limit));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function order($merId, $id, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
$detail = $repository->getDetail($id);
|
|
||||||
if (!$detail)
|
|
||||||
return app('json')->fail('订单不存在');
|
|
||||||
if ($detail['mer_id'] != $merId)
|
|
||||||
return app('json')->fail('没有权限');
|
|
||||||
return app('json')->success($detail->toArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected function checkOrderAuth($merId, $id)
|
|
||||||
{
|
|
||||||
if (!app()->make(StoreOrderRepository::class)->existsWhere(['mer_id' => $merId, 'order_id' => $id]))
|
|
||||||
throw new ValidateException('没有权限');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mark($merId, $id, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
$this->checkOrderAuth($merId, $id);
|
|
||||||
$data = $this->request->params(['remark']);
|
|
||||||
$repository->update($id, $data);
|
|
||||||
return app('json')->success('备注成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function price($merId, $id, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
$this->checkOrderAuth($merId, $id);
|
|
||||||
|
|
||||||
$data = $this->request->params(['total_price', 'pay_postage']);
|
|
||||||
|
|
||||||
if ($data['total_price'] < 0 || $data['pay_postage'] < 0)
|
|
||||||
return app('json')->fail('金额不可未负数');
|
|
||||||
if (!$repository->merStatusExists((int)$id, $merId))
|
|
||||||
return app('json')->fail('订单信息或状态错误');
|
|
||||||
$repository->eidt($id, $data);
|
|
||||||
return app('json')->success('修改成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 发货操作
|
|
||||||
* @param $merId
|
|
||||||
* @param $id
|
|
||||||
* @param StoreOrderRepository $repository
|
|
||||||
* @return Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 6/1/22
|
|
||||||
*/
|
|
||||||
public function delivery($merId, $id, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
$this->checkOrderAuth($merId, $id);
|
|
||||||
$type = $this->request->param('delivery_type');
|
|
||||||
$split = $this->request->params(['is_split',['split',[]]]);
|
|
||||||
if (!$repository->merDeliveryExists($id, $merId))
|
|
||||||
return app('json')->fail('订单信息或状态错误');
|
|
||||||
switch ($type)
|
|
||||||
{
|
|
||||||
case 3: //虚拟发货
|
|
||||||
$data = $this->request->params([
|
|
||||||
'delivery_type',
|
|
||||||
'remark',
|
|
||||||
]);
|
|
||||||
$data['delivery_name'] = '';
|
|
||||||
$data['delivery_id'] = '';
|
|
||||||
$method = 'delivery';
|
|
||||||
break;
|
|
||||||
case 4: //电子面单
|
|
||||||
if (!systemConfig('crmeb_serve_dump'))
|
|
||||||
return app('json')->fail('电子面单功能未开启');
|
|
||||||
$data = $this->request->params([
|
|
||||||
'delivery_type',
|
|
||||||
'delivery_name',
|
|
||||||
'from_name',
|
|
||||||
'from_tel',
|
|
||||||
'from_addr',
|
|
||||||
'temp_id',
|
|
||||||
'remark',
|
|
||||||
]);
|
|
||||||
if (!$data['from_name'] ||
|
|
||||||
!$data['delivery_name'] ||
|
|
||||||
!$data['from_tel'] ||
|
|
||||||
!$data['from_addr'] ||
|
|
||||||
!$data['temp_id']
|
|
||||||
)
|
|
||||||
return app('json')->fail('填写配送信息');
|
|
||||||
$method = 'dump';
|
|
||||||
break;
|
|
||||||
case 5: //同城配送
|
|
||||||
if (systemConfig('delivery_status') != 1)
|
|
||||||
return app('json')->fail('未开启同城配送');
|
|
||||||
$data = $this->request->params([
|
|
||||||
'delivery_type',
|
|
||||||
'station_id',
|
|
||||||
'mark',
|
|
||||||
['cargo_weight',0],
|
|
||||||
'remark',
|
|
||||||
]);
|
|
||||||
if ($data['cargo_weight'] < 0) return app('json')->fail('包裹重量能为负数');
|
|
||||||
if (!$data['station_id']) return app('json')->fail('请选择门店');
|
|
||||||
$method = 'cityDelivery';
|
|
||||||
break;
|
|
||||||
default: //快递
|
|
||||||
$data = $this->request->params([
|
|
||||||
'delivery_type',
|
|
||||||
'delivery_type',
|
|
||||||
'delivery_name',
|
|
||||||
'delivery_id',
|
|
||||||
'remark',
|
|
||||||
]);
|
|
||||||
if (!$data['delivery_type'] || !$data['delivery_name'] || !$data['delivery_id'])
|
|
||||||
return app('json')->fail('填写配送信息');
|
|
||||||
|
|
||||||
$method = 'delivery';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$repository->runDelivery($id,$merId, $data, $split, $method, $this->request->serviceInfo()->service_id);
|
|
||||||
return app('json')->success('发货成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function payPrice($merId, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
list($start, $stop, $month) = $this->request->params([
|
|
||||||
['start', strtotime(date('Y-m'))],
|
|
||||||
['stop', time()],
|
|
||||||
'month'
|
|
||||||
], true);
|
|
||||||
|
|
||||||
if ($month) {
|
|
||||||
$start = date('Y/m/d', strtotime(getStartModelTime('month')));
|
|
||||||
$stop = date('Y/m/d H:i:s', strtotime('+ 1day'));
|
|
||||||
$front = date('Y/m/d', strtotime('first Day of this month', strtotime('-1 day', strtotime('first Day of this month'))));
|
|
||||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
|
||||||
} else {
|
|
||||||
if ($start == $stop) return app('json')->fail('参数有误');
|
|
||||||
if ($start > $stop) {
|
|
||||||
$middle = $stop;
|
|
||||||
$stop = $start;
|
|
||||||
$start = $middle;
|
|
||||||
}
|
|
||||||
$space = bcsub($stop, $start, 0);//间隔时间段
|
|
||||||
$front = bcsub($start, $space, 0);//第一个时间段
|
|
||||||
|
|
||||||
$front = date('Y/m/d H:i:s', $front);
|
|
||||||
$start = date('Y/m/d H:i:s', $start);
|
|
||||||
$stop = date('Y/m/d H:i:s', $stop);
|
|
||||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
|
||||||
}
|
|
||||||
$frontPrice = $repository->dateOrderPrice($front . '-' . $end, $merId);
|
|
||||||
$afterPrice = $repository->dateOrderPrice($start . '-' . date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
|
||||||
$chartInfo = $repository->chartTimePrice($start, date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
|
||||||
$data['chart'] = $chartInfo;//营业额图表数据
|
|
||||||
$data['time'] = $afterPrice;//时间区间营业额
|
|
||||||
$increase = (float)bcsub((string)$afterPrice, (string)$frontPrice, 2); //同比上个时间区间增长营业额
|
|
||||||
$growthRate = abs($increase);
|
|
||||||
if ($growthRate == 0) $data['growth_rate'] = 0;
|
|
||||||
else if ($frontPrice == 0) $data['growth_rate'] = bcmul($growthRate, 100, 0);
|
|
||||||
else $data['growth_rate'] = (int)bcmul((string)bcdiv((string)$growthRate, (string)$frontPrice, 2), '100', 0);//时间区间增长率
|
|
||||||
$data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
|
|
||||||
$data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
|
|
||||||
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param StoreOrderRepository $repository
|
|
||||||
* @return Json
|
|
||||||
* @author xaboy
|
|
||||||
* @day 2020/8/27
|
|
||||||
*/
|
|
||||||
public function payNumber($merId, StoreOrderRepository $repository)
|
|
||||||
{
|
|
||||||
list($start, $stop, $month) = $this->request->params([
|
|
||||||
['start', strtotime(date('Y-m'))],
|
|
||||||
['stop', time()],
|
|
||||||
'month'
|
|
||||||
], true);
|
|
||||||
|
|
||||||
if ($month) {
|
|
||||||
$start = date('Y/m/d', strtotime(getStartModelTime('month')));
|
|
||||||
$stop = date('Y/m/d H:i:s', strtotime('+ 1day'));
|
|
||||||
$front = date('Y/m/d', strtotime('first Day of this month', strtotime('-1 day', strtotime('first Day of this month'))));
|
|
||||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
|
||||||
} else {
|
|
||||||
if ($start == $stop) return app('json')->fail('参数有误');
|
|
||||||
if ($start > $stop) {
|
|
||||||
$middle = $stop;
|
|
||||||
$stop = $start;
|
|
||||||
$start = $middle;
|
|
||||||
}
|
|
||||||
$space = bcsub($stop, $start, 0);//间隔时间段
|
|
||||||
$front = bcsub($start, $space, 0);//第一个时间段
|
|
||||||
|
|
||||||
$front = date('Y/m/d H:i:s', $front);
|
|
||||||
$start = date('Y/m/d H:i:s', $start);
|
|
||||||
$stop = date('Y/m/d H:i:s', $stop);
|
|
||||||
$end = date('Y/m/d H:i:s', strtotime($start . ' -1 second'));
|
|
||||||
}
|
|
||||||
$frontNumber = $repository->dateOrderNum($front . '-' . $end, $merId);
|
|
||||||
$afterNumber = $repository->dateOrderNum($start . '-' . date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
|
||||||
$chartInfo = $repository->chartTimeNum($start . '-' . date('Y/m/d H:i:s', strtotime($stop . '-1 second')), $merId);
|
|
||||||
$data['chart'] = $chartInfo;//订单数图表数据
|
|
||||||
$data['time'] = $afterNumber;//时间区间订单数
|
|
||||||
$increase = $afterNumber - $frontNumber; //同比上个时间区间增长订单数
|
|
||||||
$growthRate = abs($increase);
|
|
||||||
if ($growthRate == 0) $data['growth_rate'] = 0;
|
|
||||||
else if ($frontNumber == 0) $data['growth_rate'] = bcmul($growthRate, 100, 0);
|
|
||||||
else $data['growth_rate'] = (int)bcmul((string)bcdiv((string)$growthRate, (string)$frontNumber, 2), '100', 0);//时间区间增长率
|
|
||||||
$data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
|
|
||||||
$data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
|
|
||||||
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFormData($merId)
|
|
||||||
{
|
|
||||||
$config = [
|
|
||||||
'mer_from_com',
|
|
||||||
'mer_from_name',
|
|
||||||
'mer_from_tel',
|
|
||||||
'mer_from_addr',
|
|
||||||
'mer_config_siid',
|
|
||||||
'mer_config_temp_id'
|
|
||||||
];
|
|
||||||
$data = merchantConfig($merId,$config);
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDeliveryConfig()
|
|
||||||
{
|
|
||||||
$data = systemConfig(['crmeb_serve_dump','delivery_status']);
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDeliveryOptions($merId, DeliveryStationRepository $repository)
|
|
||||||
{
|
|
||||||
if (!systemConfig('delivery_status')) {
|
|
||||||
return app('json')->success([]);
|
|
||||||
}
|
|
||||||
$where = [
|
|
||||||
'status' => 1,
|
|
||||||
'mer_id' => $merId,
|
|
||||||
'type' => systemConfig('delivery_type'),
|
|
||||||
];
|
|
||||||
$data = $repository->getOptions($where)->toArray();
|
|
||||||
$type = systemConfig('delivery_type') == 1 ? 'UU' : '达达';
|
|
||||||
if (empty($data)) return app('json')->fail('请前往商户后台添加'.$type.'发货点');
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function verify($merId,$id,StoreOrderRepository $orderRepository)
|
|
||||||
{
|
|
||||||
$order = $orderRepository->getWhere(['order_id' => $id,'mer_id' => $merId]);
|
|
||||||
if (!$order) return app('json')->fail('数据不存在');
|
|
||||||
$data = $this->request->params(['verify_code','data']);
|
|
||||||
$orderRepository->verifyOrder($order->verify_code, $merId, $data, $this->request->serviceInfo()->service_id);
|
|
||||||
return app('json')->success('订单核销成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -90,7 +90,7 @@ class StoreProduct extends BaseController
|
|||||||
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
|
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
|
||||||
$data['rate'] = 3;
|
$data['rate'] = 3;
|
||||||
$typeCode=Db::name('merchant_type')->where('mer_type_id',$merchant['type_id'])->value('type_code');
|
$typeCode=Db::name('merchant_type')->where('mer_type_id',$merchant['type_id'])->value('type_code');
|
||||||
// if ($merchant['type_id']==12){
|
if ($merchant['type_id']==12){
|
||||||
if ($typeCode==Merchant::TypeCode['TypeSupplyChain']){
|
if ($typeCode==Merchant::TypeCode['TypeSupplyChain']){
|
||||||
$product_type=98;//供应链
|
$product_type=98;//供应链
|
||||||
}else{
|
}else{
|
||||||
@ -104,7 +104,7 @@ class StoreProduct extends BaseController
|
|||||||
// 'unique' => $unique,
|
// 'unique' => $unique,
|
||||||
// 'number' => $stockNum,
|
// 'number' => $stockNum,
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
}
|
||||||
return app('json')->success('添加成功');
|
return app('json')->success('添加成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,8 +239,15 @@ class StoreProduct extends BaseController
|
|||||||
public function stockIn()
|
public function stockIn()
|
||||||
{
|
{
|
||||||
$params = $this->request->param();
|
$params = $this->request->param();
|
||||||
$this->repository->stockIn($this->merId, $params);
|
if($params['unique']==''){
|
||||||
|
return app('json')->fail('多规格编号不能为空');
|
||||||
|
}
|
||||||
|
$res=$this->repository->stockIn($this->merId, $params);
|
||||||
|
if($res){
|
||||||
return app('json')->success('入库成功');
|
return app('json')->success('入库成功');
|
||||||
|
}else{
|
||||||
|
return app('json')->fail('入库失败');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,206 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: CRMEB Team <admin@crmeb.com>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
namespace app\controller\api\server;
|
|
||||||
|
|
||||||
use app\common\repositories\store\order\StoreCartRepository;
|
|
||||||
use app\common\repositories\store\product\ProductLabelRepository;
|
|
||||||
use app\common\repositories\store\product\ProductRepository;
|
|
||||||
use app\common\repositories\store\service\StoreServiceRepository;
|
|
||||||
use app\common\repositories\system\merchant\MerchantRepository;
|
|
||||||
use app\validate\merchant\StoreProductValidate;
|
|
||||||
use crmeb\basic\BaseController;
|
|
||||||
use crmeb\services\UploadService;
|
|
||||||
use think\App;
|
|
||||||
use think\exception\HttpResponseException;
|
|
||||||
use think\exception\ValidateException;
|
|
||||||
|
|
||||||
class StoreProduct extends BaseController
|
|
||||||
{
|
|
||||||
protected $merId;
|
|
||||||
protected $repository;
|
|
||||||
|
|
||||||
public function __construct(App $app, ProductRepository $repository)
|
|
||||||
{
|
|
||||||
parent::__construct($app);
|
|
||||||
$this->repository = $repository;
|
|
||||||
$this->merId = $this->request->route('merId');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 头部统计
|
|
||||||
* @param $merId
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 8/24/21
|
|
||||||
*/
|
|
||||||
public function title($merId)
|
|
||||||
{
|
|
||||||
return app('json')->success($this->repository->getFilter($merId, '', 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 列表
|
|
||||||
* @param $merId
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 8/24/21
|
|
||||||
*/
|
|
||||||
public function lst($merId)
|
|
||||||
{
|
|
||||||
[$page, $limit] = $this->getPage();
|
|
||||||
$where = $this->request->params(['cate_id', 'keyword', ['type',20], 'mer_cate_id', 'is_gift_bag', 'status', 'us_status', 'product_id', 'mer_labels',['order','sort']]);
|
|
||||||
$where = array_merge($where, $this->repository->switchType($where['type'], $merId, 0));
|
|
||||||
return app('json')->success($this->repository->getList($merId, $where, $page, $limit));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 添加
|
|
||||||
* @param $merId
|
|
||||||
* @param StoreProductValidate $validate
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 8/24/21
|
|
||||||
*/
|
|
||||||
public function create($merId, StoreProductValidate $validate)
|
|
||||||
{
|
|
||||||
$res = $this->request->params($this->repository::CREATE_PARAMS);
|
|
||||||
$data = $this->repository->checkParams($res,$merId);
|
|
||||||
$data['mer_id'] = $merId;
|
|
||||||
$data['is_gift_bag'] = 0;
|
|
||||||
$merchant = app()->make(MerchantRepository::class)->get($merId);
|
|
||||||
$data['status'] = $merchant->is_audit ? 0 : 1;
|
|
||||||
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
|
|
||||||
$data['rate'] = 3;
|
|
||||||
$this->repository->create($data, 0, 1);
|
|
||||||
return app('json')->success('添加成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 编辑
|
|
||||||
* @param $merId
|
|
||||||
* @param $id
|
|
||||||
* @param StoreProductValidate $validate
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 8/24/21
|
|
||||||
*/
|
|
||||||
public function update($merId, $id, StoreProductValidate $validate)
|
|
||||||
{
|
|
||||||
$res = $this->request->params($this->repository::CREATE_PARAMS);
|
|
||||||
$data = $this->repository->checkParams($res,$merId,$id);
|
|
||||||
|
|
||||||
$merchant = app()->make(MerchantRepository::class)->get($merId);
|
|
||||||
if (!$this->repository->merExists($merId, $id))
|
|
||||||
return app('json')->fail('数据不存在');
|
|
||||||
$pro = $this->repository->getWhere(['product_id' => $id]);
|
|
||||||
if ($pro->status == -2) {
|
|
||||||
$data['status'] = 0;
|
|
||||||
} else {
|
|
||||||
$data['status'] = $merchant->is_audit ? 0 : 1;
|
|
||||||
}
|
|
||||||
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
|
|
||||||
$data['mer_id'] = $merId;
|
|
||||||
$this->repository->edit($id, $data, $merId, 0, 1);
|
|
||||||
return app('json')->success('编辑成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 详情
|
|
||||||
* @param $merId
|
|
||||||
* @param $id
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 8/24/21
|
|
||||||
*/
|
|
||||||
public function detail($merId, $id)
|
|
||||||
{
|
|
||||||
if (!$this->repository->merExists($merId, $id))
|
|
||||||
return app('json')->fail('数据不存在');
|
|
||||||
return app('json')->success($this->repository->getAdminOneProduct($id, 0, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 修改状态
|
|
||||||
* @param $merId
|
|
||||||
* @param $id
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 8/24/21
|
|
||||||
*/
|
|
||||||
public function switchStatus($merId, $id)
|
|
||||||
{
|
|
||||||
$status = $this->request->param('status', 0) == 1 ? 1 : 0;
|
|
||||||
if (!$this->repository->merExists($merId, $id))
|
|
||||||
return app('json')->fail('数据不存在');
|
|
||||||
$this->repository->switchShow($id,$status, 'is_show',$merId);
|
|
||||||
return app('json')->success('修改成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 加入回收站
|
|
||||||
* @param $merId
|
|
||||||
* @param $id
|
|
||||||
* @return \think\response\Json
|
|
||||||
* @author Qinii
|
|
||||||
* @day 8/24/21
|
|
||||||
*/
|
|
||||||
public function delete($merId, $id)
|
|
||||||
{
|
|
||||||
if (!$this->repository->merExists($merId, $id))
|
|
||||||
return app('json')->fail('数据不存在');
|
|
||||||
if ($this->repository->getWhereCount(['product_id' => $id, 'is_show' => 1, 'status' => 1]))
|
|
||||||
return app('json')->fail('商品上架中');
|
|
||||||
$this->repository->delete($id);
|
|
||||||
return app('json')->success('转入回收站');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function config($merId)
|
|
||||||
{
|
|
||||||
$data['extension_status'] = systemConfig('extension_status');
|
|
||||||
$data['integral_status'] = 0;
|
|
||||||
$data['integral_rate'] = 0;
|
|
||||||
if(systemConfig('integral_status') && merchantConfig($merId,'mer_integral_status')) {
|
|
||||||
$data['integral_status'] = 1;
|
|
||||||
$data['integral_rate'] = merchantConfig($merId,'mer_integral_rate');
|
|
||||||
}
|
|
||||||
$merchant = app()->make(MerchantRepository::class)->get($merId);
|
|
||||||
$data['delivery_way'] = $merchant->delivery_way;
|
|
||||||
return app('json')->success($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function restore($id)
|
|
||||||
{
|
|
||||||
if (!$this->repository->merDeleteExists($this->merId, $id))
|
|
||||||
return app('json')->fail('只能删除回收站的商品');
|
|
||||||
$this->repository->restore($id);
|
|
||||||
return app('json')->success('商品已恢复');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function destory($id)
|
|
||||||
{
|
|
||||||
if (!$this->repository->merDeleteExists($this->merId, $id))
|
|
||||||
return app('json')->fail('只能删除回收站的商品');
|
|
||||||
if (app()->make(StoreCartRepository::class)->getProductById($id))
|
|
||||||
return app('json')->fail('商品有被加入购物车不可删除');
|
|
||||||
$this->repository->destory($id);
|
|
||||||
return app('json')->success('删除成功');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updateGood($id)
|
|
||||||
{
|
|
||||||
$is_good = $this->request->param('is_good', 0) == 1 ? 1 : 0;
|
|
||||||
if (!$this->repository->merExists($this->merId, $id))
|
|
||||||
return app('json')->fail('数据不存在');
|
|
||||||
|
|
||||||
$this->repository->update($id, ['is_good' => $is_good]);
|
|
||||||
return app('json')->success('修改成功');
|
|
||||||
}
|
|
||||||
}
|
|
@ -58,10 +58,20 @@ class Merchant extends BaseController
|
|||||||
public function lst()
|
public function lst()
|
||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$where = $this->request->params(['keyword', 'order', 'is_best', 'location', 'category_id', 'type_id', 'type_code', 'is_trader', 'street_id', 'credit_buy']);
|
$where = $this->request->params(['store_category_id','keyword', 'order', 'is_best', 'location', 'category_id', 'type_id', 'type_code', 'is_trader', 'street_id', 'credit_buy']);
|
||||||
if (empty($where['type_id'])) {
|
if (empty($where['type_id'])) {
|
||||||
$where['type_id'] =[10,17];
|
$where['type_id'] =[10,17];
|
||||||
}
|
}
|
||||||
|
if($where['store_category_id']>0){
|
||||||
|
$arr= Db::name('store_category')->where(['pid'=>$where['store_category_id'],'mer_id'=>0,'level'=>1,'is_show'=>1])->column('cate_name');
|
||||||
|
if($arr){
|
||||||
|
$category_id=Db::name('merchant_category')->whereIn('category_name',$arr)->column('merchant_category_id');
|
||||||
|
if($category_id){
|
||||||
|
$where['category_id']=implode(',',$category_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($where['store_category_id']);
|
||||||
|
}
|
||||||
return app('json')->success($this->repository->getList($where, $page, $limit, $this->userInfo));
|
return app('json')->success($this->repository->getList($where, $page, $limit, $this->userInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,8 @@ class MerchantIntention extends BaseController
|
|||||||
'area' => $data['area_id'] ?? '',
|
'area' => $data['area_id'] ?? '',
|
||||||
'street' => $data['street_id'] ?? '',
|
'street' => $data['street_id'] ?? '',
|
||||||
'address' => $data['address'] ?? '',
|
'address' => $data['address'] ?? '',
|
||||||
'mer_intention_id' => $intention->mer_intention_id
|
'mer_intention_id' => $intention->mer_intention_id,
|
||||||
|
'type_id'=>$data['mer_type_id']??''
|
||||||
];
|
];
|
||||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||||
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
||||||
@ -202,7 +203,9 @@ class MerchantIntention extends BaseController
|
|||||||
'bank_back' => $data['bank_back'] ?? '',
|
'bank_back' => $data['bank_back'] ?? '',
|
||||||
'cardno_front' => $data['cardno_front'] ?? '',
|
'cardno_front' => $data['cardno_front'] ?? '',
|
||||||
'cardno_back' => $data['cardno_back'] ?? '',
|
'cardno_back' => $data['cardno_back'] ?? '',
|
||||||
'mer_intention_id' => $intentionId
|
'mer_intention_id' => $intentionId,
|
||||||
|
'type_id'=>$merInfo['type_id']??''
|
||||||
|
|
||||||
];
|
];
|
||||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||||
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
||||||
@ -296,7 +299,9 @@ class MerchantIntention extends BaseController
|
|||||||
'area' => $data['area_id'] ?? '',
|
'area' => $data['area_id'] ?? '',
|
||||||
'street' => $data['street_id'] ?? '',
|
'street' => $data['street_id'] ?? '',
|
||||||
'address' => $data['address'] ?? '',
|
'address' => $data['address'] ?? '',
|
||||||
'mer_intention_id' => $id
|
'mer_intention_id' => $id,
|
||||||
|
'type_id'=>$data['mer_type_id']??''
|
||||||
|
|
||||||
];
|
];
|
||||||
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
$postUrl = env('TASK_WORKER_HOST_URL') . '/adminapi/company/createShopMerchant';
|
||||||
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
$res = $this->sendMerIntentionApply($sendData, $postUrl);
|
||||||
|
@ -93,7 +93,7 @@ class StoreCart extends BaseController
|
|||||||
case 99: //委托商品
|
case 99: //委托商品
|
||||||
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
||||||
[$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', ''];
|
[$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', ''];
|
||||||
if($source==StoreCartDao::CITY_CLOUD){
|
if($source==StoreCartDao::CITY_CLOUD||$source==StoreCartDao::SOURCE_PROCURE){
|
||||||
$data['source'] = $source;
|
$data['source'] = $source;
|
||||||
}else{
|
}else{
|
||||||
$data['source'] = (in_array($source, [0, 1]) && $pid == $data['product_id']) ? $source : 0;
|
$data['source'] = (in_array($source, [0, 1]) && $pid == $data['product_id']) ? $source : 0;
|
||||||
|
@ -8,14 +8,11 @@ use app\common\repositories\store\product\SpuRepository;
|
|||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\App;
|
use think\App;
|
||||||
use crmeb\basic\BaseController;
|
use crmeb\basic\BaseController;
|
||||||
|
use app\common\dao\store\product\SpuDao;
|
||||||
|
|
||||||
class CloudWarehouse extends BaseController
|
class CloudWarehouse extends BaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* @var SpuRepository
|
|
||||||
*/
|
|
||||||
protected $repository;
|
|
||||||
/**
|
/**
|
||||||
* @var MerchantDao
|
* @var MerchantDao
|
||||||
*/
|
*/
|
||||||
@ -25,18 +22,20 @@ class CloudWarehouse extends BaseController
|
|||||||
*/
|
*/
|
||||||
protected $spuRepository;
|
protected $spuRepository;
|
||||||
|
|
||||||
|
protected $SpuDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StoreProduct constructor.
|
* StoreProduct constructor.
|
||||||
* @param App $app
|
* @param App $app
|
||||||
* @param SpuRepository $repository
|
* @param SpuRepository $repository
|
||||||
* @param MerchantDao $merchantDao
|
* @param MerchantDao $merchantDao
|
||||||
*/
|
*/
|
||||||
public function __construct(App $app, SpuRepository $repository, MerchantDao $merchantDao, SpuRepository $spuRepository)
|
public function __construct(App $app, MerchantDao $merchantDao, SpuRepository $spuRepository,SpuDao $SpuDao)
|
||||||
{
|
{
|
||||||
parent::__construct($app);
|
parent::__construct($app);
|
||||||
$this->repository = $repository;
|
|
||||||
$this->merchantDao = $merchantDao;
|
$this->merchantDao = $merchantDao;
|
||||||
$this->spuRepository = $spuRepository;
|
$this->spuRepository = $spuRepository;
|
||||||
|
$this->SpuDao = $SpuDao;
|
||||||
$this->spuRepository->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
|
$this->spuRepository->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,24 +103,20 @@ class CloudWarehouse extends BaseController
|
|||||||
'status' => 1,
|
'status' => 1,
|
||||||
'is_del' => 0,
|
'is_del' => 0,
|
||||||
'mer_status' => 1,
|
'mer_status' => 1,
|
||||||
|
'product_type'=>98,
|
||||||
|
'product_id'=>$cloud_product
|
||||||
];
|
];
|
||||||
if (!$cloud_product && $category_id==0) {
|
if (!$cloud_product && $category_id==0) {
|
||||||
|
|
||||||
return app('json')->success(['count' => 0, 'list' => []]);
|
return app('json')->success(['count' => 0, 'list' => []]);
|
||||||
}
|
}
|
||||||
$count = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->count();
|
$count = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->count();
|
||||||
$select = Db::name('store_product')->whereIn('product_id', $cloud_product)->where($where)
|
|
||||||
->withAttr('merchant', function ($value, $data) {
|
$products = $this->spuRepository->getApiSearch($where,$page,10, false,true);
|
||||||
$find= Db::name('merchant')->where('mer_id', $data['mer_id'])->field('mer_id,mer_name')->find();
|
if($products['list']){
|
||||||
return $find;
|
$list=$products['list'];
|
||||||
})
|
}
|
||||||
->withAttr('sku', function ($value, $data) {
|
return app('json')->success(['count' => $count, 'list' => $list]);
|
||||||
$find = Db::name('store_product_attr_value')->where('mer_id', $data['mer_id'])->where('product_id', $data['product_id'])->find();
|
|
||||||
return ['' => $find];
|
|
||||||
})
|
|
||||||
// ->field('product_id,mer_id,store_name,bar_code,price,stock,product_type,image')
|
|
||||||
->select();
|
|
||||||
return app('json')->success(['count' => $count, 'list' => $select]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,7 +132,7 @@ class StoreSpu extends BaseController
|
|||||||
$where['mer_id'] = $id;
|
$where['mer_id'] = $id;
|
||||||
$where['is_gift_bag'] = 0;
|
$where['is_gift_bag'] = 0;
|
||||||
$where['order'] = $where['order'] ? $where['order'] : 'sort';
|
$where['order'] = $where['order'] ? $where['order'] : 'sort';
|
||||||
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo);
|
$data = $this->repository->getApiSearch($where, $page, $limit, $this->userInfo,true);
|
||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ return [
|
|||||||
'refund.after'=>[\app\listener\AfterRefund::class],
|
'refund.after'=>[\app\listener\AfterRefund::class],
|
||||||
'refund.deliver'=>[\app\listener\DeliverRefund::class],
|
'refund.deliver'=>[\app\listener\DeliverRefund::class],
|
||||||
'order.create'=>[\app\listener\OrderCreate::class],
|
'order.create'=>[\app\listener\OrderCreate::class],
|
||||||
|
'order.take'=>[\app\listener\OrderTake::class],
|
||||||
],
|
],
|
||||||
|
|
||||||
'subscribe' => [],
|
'subscribe' => [],
|
||||||
|
188
app/listener/OrderTake.php
Normal file
188
app/listener/OrderTake.php
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace app\listener;
|
||||||
|
|
||||||
|
use app\common\dao\store\order\StoreCartDao;
|
||||||
|
use app\common\dao\system\merchant\MerchantDao;
|
||||||
|
use app\common\model\system\merchant\Merchant;
|
||||||
|
use app\common\repositories\store\order\StoreOrderRepository;
|
||||||
|
use app\common\repositories\store\product\ProductRepository;
|
||||||
|
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||||
|
use app\common\repositories\system\merchant\MerchantRepository;
|
||||||
|
use crmeb\utils\DingTalk;
|
||||||
|
use think\facade\Db;
|
||||||
|
use think\facade\Log;
|
||||||
|
use app\common\model\store\product\PurchaseRecord;
|
||||||
|
use app\common\model\system\Extend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货后的逻辑
|
||||||
|
*/
|
||||||
|
class OrderTake
|
||||||
|
{
|
||||||
|
|
||||||
|
public $totalAmount;
|
||||||
|
public $event;
|
||||||
|
public $finance = [];
|
||||||
|
public $streetId;
|
||||||
|
public $financeSn;
|
||||||
|
public $index = 1;
|
||||||
|
public $remain;
|
||||||
|
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$order = $event['order'];
|
||||||
|
if ($order['source'] == 200 && $order['activity_type'] == 98) {
|
||||||
|
$product_arr = Db::name('store_order_product')->where('order_id', $order['order_id'])->where('is_refund', 'in', [0, 2])->field('product_id,product_sku,refund_num')->select();
|
||||||
|
foreach ($product_arr as $k => $v) {
|
||||||
|
$this->import($v, $order);
|
||||||
|
|
||||||
|
// app(ProductRepository::class)->create($find, 0);
|
||||||
|
}
|
||||||
|
// $productId = $this->import($params['order_product_id'], request()->userInfo());
|
||||||
|
// $product = $this->get($productId);
|
||||||
|
// $attrValue = ProductAttrValue::where('mer_id', $merId)->where('product_id', $productId)->find();
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Log::error($e->getMessage() . 'lien:' . $e->getLine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function import($product, $order)
|
||||||
|
{
|
||||||
|
$mer_id = Db::name('store_service')->where('uid', $order['uid'])->where('status', 1)->value('mer_id');
|
||||||
|
if ($mer_id == 0) {
|
||||||
|
Log::error('采购导入商品:商户不存在');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/**原始商品数据 */
|
||||||
|
$find = Db::name('store_product')->where('product_id', $product['product_id'])->find();
|
||||||
|
if ($find) {
|
||||||
|
if (!in_array($find['product_type'], [0, 98])) {
|
||||||
|
Log::error('采购导入商品:不是普通商品');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/**查询是否导入过该商品 */
|
||||||
|
$exist = Db::name('store_product')->where('source_product_id', $product['product_id'])->where('mer_id', $mer_id)->find();
|
||||||
|
if ($exist) {
|
||||||
|
$store_product_attr_value = Db::name('store_product_attr_value')->where('product_id', $exist['product_id'])->where('unique', $product['product_sku'])->find();
|
||||||
|
if ($store_product_attr_value) {
|
||||||
|
Log::error('采购导入商品:已经导入过该规格了');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$attrValue = Db::name('store_product_attr_value')->where(['product_id' => $find['product_id']])
|
||||||
|
->where('unique', $product['product_sku'])
|
||||||
|
->field('image,price,cost,ot_price,svip_price,stock,bar_code,weight,volume,detail,sku')
|
||||||
|
->withAttr('detail', function ($value) {
|
||||||
|
return empty($value) ? [] : json_decode($value, true);
|
||||||
|
})
|
||||||
|
->find();
|
||||||
|
$find['attr'] = [];
|
||||||
|
if ($attrValue['detail']) {
|
||||||
|
foreach ($attrValue['detail'] as $kk => $vv) {
|
||||||
|
|
||||||
|
$attr_values = Db::name('store_product_attr')->where('product_id', $exist['product_id'])->where('attr_name', $kk)
|
||||||
|
->value('attr_values');
|
||||||
|
if ($attr_values) {
|
||||||
|
$attr_values = explode('-!-', $attr_values);
|
||||||
|
if (!in_array($vv, $attr_values)) {
|
||||||
|
$attr_values[] = $vv;
|
||||||
|
$attr_values = implode('-!-', $attr_values);
|
||||||
|
Db::name('store_product_attr')->where('product_id', $exist['product_id'])->where('attr_name', $kk)->update(['attr_values' => $attr_values]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$attr_values = $vv;
|
||||||
|
|
||||||
|
Db::name('store_product_attr')->insert(
|
||||||
|
[
|
||||||
|
'product_id' => $exist['product_id'],
|
||||||
|
'attr_name' => $kk, 'attr_values' => $attr_values
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$attrValue['stock'] = $product['refund_num'];
|
||||||
|
$unique = app(ProductRepository::class)->setUnique($exist['product_id'], $attrValue['sku'], 0);
|
||||||
|
$attrValue['unique'] = $unique;
|
||||||
|
$attrValue['detail'] = json_encode($attrValue['detail']);
|
||||||
|
$attrValue['product_id'] = $exist['product_id'];
|
||||||
|
$attrValue['mer_id'] = $mer_id;
|
||||||
|
Db::name('store_product_attr_value')->insert($attrValue);
|
||||||
|
Db::name('store_product')->where('product_id',$exist['product_id'])->update(['stock'=>$product['refund_num']+$exist['stock']]);
|
||||||
|
$data = [
|
||||||
|
'order_id' => $order['order_id'], 'order_product_id' => $order['product_id'],
|
||||||
|
'product_id' => $exist['product_id'], 'number' => $product['refund_num'], 'order_unique' => $product['product_sku'],
|
||||||
|
'price' => $attrValue['price'], 'supplierMerId' => $order['mer_id'], 'mer_id' => $mer_id, 'unique' => $unique
|
||||||
|
];
|
||||||
|
$this->purchase_record($data);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$find['attrValue'] = Db::name('store_product_attr_value')->where(['product_id' => $find['product_id']])
|
||||||
|
->where('unique', $product['product_sku'])
|
||||||
|
->field('image,price,cost,ot_price,svip_price,stock,bar_code,weight,volume,detail,sku')
|
||||||
|
->withAttr('detail', function ($value) {
|
||||||
|
return empty($value) ? [] : json_decode($value, true);
|
||||||
|
})
|
||||||
|
->find();
|
||||||
|
|
||||||
|
$find['attr'] = [];
|
||||||
|
if ($find['attrValue']['detail']) {
|
||||||
|
foreach ($find['attrValue']['detail'] as $kk => $vv) {
|
||||||
|
$find['attr'][] = ['attr_name' => $kk, 'detail' => $vv];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$find['attrValue']['stock'] = $product['refund_num'];
|
||||||
|
|
||||||
|
$find['content'] = Db::name('store_product_content')->where('product_id', $find['product_id'])->value('content');
|
||||||
|
$find['is_show'] = 0;
|
||||||
|
$find['mer_id'] = $mer_id;
|
||||||
|
$find['temp_id'] = "";
|
||||||
|
$find['give_coupon_ids'] = [];
|
||||||
|
$find['params'] = [];
|
||||||
|
$find['extend'] = [];
|
||||||
|
$find['param_temp_id'] = [];
|
||||||
|
$find['mer_labels'] = [];
|
||||||
|
$find['delivery_way'] = [0 => "2"];
|
||||||
|
$find["guarantee_template_id"] = "";
|
||||||
|
$find['product_type'] = 0;
|
||||||
|
$find['mer_cate_id'] = [0 => 0];
|
||||||
|
$find['is_used'] = 1;
|
||||||
|
$find['status'] = 1;
|
||||||
|
$find['mer_status'] = 1;
|
||||||
|
$find['source_product_id'] = $product['product_id'];
|
||||||
|
$find['slider_image'] = explode(',', $find['slider_image']);
|
||||||
|
unset($find['product_id'], $find['create_time']);
|
||||||
|
$productId = app(ProductRepository::class)->create($find, 0);
|
||||||
|
$data = [
|
||||||
|
'order_id' => $order['order_id'], 'order_product_id' => $order['product_id'],
|
||||||
|
'product_id' => $productId, 'number' => $product['refund_num'], 'order_unique' => $product['product_sku'],
|
||||||
|
'price' => $find['attrValue']['price'], 'supplierMerId' => $order['mer_id'], 'mer_id' => $mer_id
|
||||||
|
];
|
||||||
|
$this->purchase_record($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function purchase_record($data)
|
||||||
|
{
|
||||||
|
$model = new PurchaseRecord();
|
||||||
|
$data = [
|
||||||
|
'order_id' => $data['order_id'] ?? 0,
|
||||||
|
'order_product_id' => $data['order_product_id'] ?? 0,
|
||||||
|
'product_id' => $data['product_id'],
|
||||||
|
'number' => $data['number'],
|
||||||
|
'order_unique' => $data['order_unique'] ?? '',
|
||||||
|
'unique' => $data['unique'] ?? '',
|
||||||
|
'price' => $data['price'],
|
||||||
|
'mer_id' => $data['mer_id'],
|
||||||
|
'supplier_mer_id' => $data['supplierMerId'],
|
||||||
|
];
|
||||||
|
$model->save($data);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
.selWidth[data-v-5efee90a]{width:330px}.title[data-v-5efee90a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.head[data-v-2f11caa9]{padding:30px 35px 25px}.head .full[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-2f11caa9]{width:60px;height:60px}.head .full .iconfont[data-v-2f11caa9]{color:#1890ff}.head .full .iconfont.sale-after[data-v-2f11caa9]{color:#90add5}.head .full .text[data-v-2f11caa9]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-2f11caa9]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-2f11caa9]{padding-top:10px;white-space:nowrap}.head .list[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-2f11caa9]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-2f11caa9]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-2f11caa9]{color:#f56022}.head .list .item .value2[data-v-2f11caa9]{color:#1bbe6b}.head .list .item .value3[data-v-2f11caa9]{color:#1890ff}.head .list .item .value4[data-v-2f11caa9]{color:#6a7b9d}.head .list .item .value5[data-v-2f11caa9]{color:#f5222d}.el-tabs--border-card[data-v-2f11caa9]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-2f11caa9]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-2f11caa9]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-2f11caa9]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-2f11caa9]:nth-child(3n+1){padding-right:20px}.section .item[data-v-2f11caa9]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-2f11caa9]:nth-child(3n+3){padding-left:20px}.section .value[data-v-2f11caa9]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-2f11caa9]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-2f11caa9]{width:36px;height:36px;margin-right:10px}[data-v-2f11caa9] .el-drawer__body{overflow:auto}.gary[data-v-2f11caa9]{color:#aaa}.logistics[data-v-2f11caa9]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-2f11caa9]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-2f11caa9]{width:100%;height:100%}.logistics .logistics_cent span[data-v-2f11caa9]{display:block;font-size:12px}.tabBox_tit[data-v-2f11caa9]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.title[data-v-96d4296a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-96d4296a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}.pictures[data-v-23a14075]{max-width:100%}.area-desc[data-v-23a14075]{margin:0;color:#999;font-size:12px}.selWidth[data-v-23a14075]{width:300px}.spBlock[data-v-23a14075]{cursor:pointer;display:block;padding:5px 0}.check[data-v-23a14075]{color:#00a2d4}.el-dropdown-link[data-v-23a14075]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-23a14075]{font-size:12px}.tabBox_tit[data-v-23a14075]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-23a14075] .row-bg .cell{color:red!important}.headTab[data-v-23a14075]{position:relative}.headTab .headBtn[data-v-23a14075]{position:absolute;right:0;top:-6px}.dropdown[data-v-23a14075]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
.selWidth[data-v-5efee90a]{width:330px}.title[data-v-5efee90a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.head[data-v-2f11caa9]{padding:30px 35px 25px}.head .full[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.head .full .order_icon[data-v-2f11caa9]{width:60px;height:60px}.head .full .iconfont[data-v-2f11caa9]{color:#1890ff}.head .full .iconfont.sale-after[data-v-2f11caa9]{color:#90add5}.head .full .text[data-v-2f11caa9]{-ms-flex-item-align:center;align-self:center;-webkit-box-flex:1;-ms-flex:1;flex:1;min-width:0;padding-left:12px;font-size:13px;color:#606266}.head .full .text .title[data-v-2f11caa9]{margin-bottom:10px;font-weight:500;font-size:16px;line-height:16px;color:rgba(0,0,0,.85)}.head .full .text .order-num[data-v-2f11caa9]{padding-top:10px;white-space:nowrap}.head .list[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:20px;overflow:hidden;list-style:none;padding:0}.head .list .item[data-v-2f11caa9]{-webkit-box-flex:0;-ms-flex:none;flex:none;width:200px;font-size:14px;line-height:14px;color:rgba(0,0,0,.85)}.head .list .item .title[data-v-2f11caa9]{margin-bottom:12px;font-size:13px;line-height:13px;color:#666}.head .list .item .value1[data-v-2f11caa9]{color:#f56022}.head .list .item .value2[data-v-2f11caa9]{color:#1bbe6b}.head .list .item .value3[data-v-2f11caa9]{color:#1890ff}.head .list .item .value4[data-v-2f11caa9]{color:#6a7b9d}.head .list .item .value5[data-v-2f11caa9]{color:#f5222d}.el-tabs--border-card[data-v-2f11caa9]{-webkit-box-shadow:none;box-shadow:none;border-bottom:none}.section[data-v-2f11caa9]{padding:20px 0 5px;border-bottom:1px dashed #eee}.section .title[data-v-2f11caa9]{padding-left:10px;border-left:3px solid #1890ff;font-size:15px;line-height:15px;color:#303133}.section .list[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.section .item[data-v-2f11caa9]{-webkit-box-flex:0;-ms-flex:0 0 33.33333%;flex:0 0 33.33333%;display:-webkit-box;display:-ms-flexbox;display:flex;margin-top:16px;font-size:13px;color:#606266}.section .item[data-v-2f11caa9]:nth-child(3n+1){padding-right:20px}.section .item[data-v-2f11caa9]:nth-child(3n+2){padding-right:10px;padding-left:10px}.section .item[data-v-2f11caa9]:nth-child(3n+3){padding-left:20px}.section .value[data-v-2f11caa9]{-webkit-box-flex:1;-ms-flex:1;flex:1}.section .value image[data-v-2f11caa9]{display:inline-block;width:40px;height:40px;margin:0 12px 12px 0;vertical-align:middle}.tab[data-v-2f11caa9]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.tab .el-image[data-v-2f11caa9]{width:36px;height:36px;margin-right:10px}[data-v-2f11caa9] .el-drawer__body{overflow:auto}.gary[data-v-2f11caa9]{color:#aaa}.logistics[data-v-2f11caa9]{-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:10px 0}.logistics .logistics_img[data-v-2f11caa9]{width:45px;height:45px;margin-right:12px}.logistics .logistics_img img[data-v-2f11caa9]{width:100%;height:100%}.logistics .logistics_cent span[data-v-2f11caa9]{display:block;font-size:12px}.tabBox_tit[data-v-2f11caa9]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}.title[data-v-96d4296a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-96d4296a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}.pictures[data-v-6419e29e]{max-width:100%}.area-desc[data-v-6419e29e]{margin:0;color:#999;font-size:12px}.selWidth[data-v-6419e29e]{width:300px}.spBlock[data-v-6419e29e]{cursor:pointer;display:block;padding:5px 0}.check[data-v-6419e29e]{color:#00a2d4}.el-dropdown-link[data-v-6419e29e]{cursor:pointer;color:#409eff;font-size:12px}.el-icon-arrow-down[data-v-6419e29e]{font-size:12px}.tabBox_tit[data-v-6419e29e]{width:53%;font-size:12px!important;margin:0 2px 0 10px;letter-spacing:1px;padding:5px 0;-webkit-box-sizing:border-box;box-sizing:border-box}[data-v-6419e29e] .row-bg .cell{color:red!important}.headTab[data-v-6419e29e]{position:relative}.headTab .headBtn[data-v-6419e29e]{position:absolute;right:0;top:-6px}.dropdown[data-v-6419e29e]{padding:0 10px;border:1px solid #409eff;margin-right:10px;line-height:28px;border-radius:4px}
|
@ -1 +1 @@
|
|||||||
.title[data-v-3500ed7a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-3500ed7a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}[data-v-3cd1b9b0] .el-cascader{display:block}.dialog-scustom[data-v-3cd1b9b0]{width:1200px;height:600px}.ela-btn[data-v-3cd1b9b0]{color:#2d8cf0}.Box .ivu-radio-wrapper[data-v-3cd1b9b0]{margin-right:25px}.Box .numPut[data-v-3cd1b9b0]{width:80%!important}.lunBox[data-v-3cd1b9b0]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;border:1px solid #0bb20c}.pictrueBox[data-v-3cd1b9b0]{display:inline-block}.pictrue[data-v-3cd1b9b0]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-3cd1b9b0]{width:100%;height:100%}.pictrueTab[data-v-3cd1b9b0]{width:40px!important;height:40px!important}.upLoad[data-v-3cd1b9b0]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.ft[data-v-3cd1b9b0]{color:red}.buttonGroup[data-v-3cd1b9b0]{position:relative;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.buttonGroup .small-btn[data-v-3cd1b9b0]{position:relative;float:left;height:24px;padding:0 7px;font-size:14px;border-radius:3px}.buttonGroup .small-btn[data-v-3cd1b9b0]:first-child{margin-left:0;border-bottom-right-radius:0;border-top-right-radius:0}.virtual_boder[data-v-3cd1b9b0]{border:1px solid #1890ff}.virtual_boder2[data-v-3cd1b9b0]{border:1px solid #e7e7e7}.virtual_san[data-v-3cd1b9b0]{position:absolute;bottom:0;right:0;width:0;height:0;border-bottom:26px solid #1890ff;border-left:26px solid transparent}.virtual_dui[data-v-3cd1b9b0]{position:absolute;bottom:-2px;right:2px;color:#fff;font-family:system-ui}.virtual[data-v-3cd1b9b0]{width:120px;height:60px;background:#fff;border-radius:3px;float:left;text-align:center;padding-top:8px;position:relative;cursor:pointer;line-height:23px}.virtual .virtual_top[data-v-3cd1b9b0]{font-size:14px;font-weight:600;color:rgba(0,0,0,.85)}.virtual .virtual_bottom[data-v-3cd1b9b0]{font-size:12px;font-weight:400;color:#999}.virtual[data-v-3cd1b9b0]:nth-child(2n){margin:0 12px}[data-v-7d87bc0d] .el-cascader{display:block}.ela-btn[data-v-7d87bc0d]{color:#2d8cf0}.priceBox[data-v-7d87bc0d]{width:80px}.pictrue[data-v-7d87bc0d]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-7d87bc0d]{width:100%;height:100%}[data-v-7d87bc0d] .el-input-number__decrease,[data-v-7d87bc0d] .el-input-number__increase{display:none}[data-v-7d87bc0d] .el-input-number.is-controls-right .el-input__inner,[data-v-7d87bc0d] .el-input__inner{padding:0 5px}.pictrueTab[data-v-7d87bc0d]{width:40px!important;height:40px!important}.upLoad[data-v-7d87bc0d]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.bg[data-v-2060f2ce]{z-index:100;position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.5)}.goods_detail .goods_detail_wrapper[data-v-2060f2ce]{z-index:-10}[data-v-2060f2ce] table.el-input__inner{padding:0}.demo-table-expand[data-v-2060f2ce]{font-size:0}.demo-table-expand1[data-v-2060f2ce] label{width:77px!important;color:#99a9bf}.demo-table-expand .el-form-item[data-v-2060f2ce]{margin-right:0;margin-bottom:0;width:33.33%}.selWidth[data-v-2060f2ce]{width:350px!important}.seachTiele[data-v-2060f2ce]{line-height:35px}
|
.title[data-v-3500ed7a]{margin-bottom:16px;color:#17233d;font-weight:500;font-size:14px}.description-term[data-v-3500ed7a]{display:table-cell;padding-bottom:10px;line-height:20px;width:50%;font-size:12px}[data-v-3cd1b9b0] .el-cascader{display:block}.dialog-scustom[data-v-3cd1b9b0]{width:1200px;height:600px}.ela-btn[data-v-3cd1b9b0]{color:#2d8cf0}.Box .ivu-radio-wrapper[data-v-3cd1b9b0]{margin-right:25px}.Box .numPut[data-v-3cd1b9b0]{width:80%!important}.lunBox[data-v-3cd1b9b0]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;border:1px solid #0bb20c}.pictrueBox[data-v-3cd1b9b0]{display:inline-block}.pictrue[data-v-3cd1b9b0]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-3cd1b9b0]{width:100%;height:100%}.pictrueTab[data-v-3cd1b9b0]{width:40px!important;height:40px!important}.upLoad[data-v-3cd1b9b0]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.ft[data-v-3cd1b9b0]{color:red}.buttonGroup[data-v-3cd1b9b0]{position:relative;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0)}.buttonGroup .small-btn[data-v-3cd1b9b0]{position:relative;float:left;height:24px;padding:0 7px;font-size:14px;border-radius:3px}.buttonGroup .small-btn[data-v-3cd1b9b0]:first-child{margin-left:0;border-bottom-right-radius:0;border-top-right-radius:0}.virtual_boder[data-v-3cd1b9b0]{border:1px solid #1890ff}.virtual_boder2[data-v-3cd1b9b0]{border:1px solid #e7e7e7}.virtual_san[data-v-3cd1b9b0]{position:absolute;bottom:0;right:0;width:0;height:0;border-bottom:26px solid #1890ff;border-left:26px solid transparent}.virtual_dui[data-v-3cd1b9b0]{position:absolute;bottom:-2px;right:2px;color:#fff;font-family:system-ui}.virtual[data-v-3cd1b9b0]{width:120px;height:60px;background:#fff;border-radius:3px;float:left;text-align:center;padding-top:8px;position:relative;cursor:pointer;line-height:23px}.virtual .virtual_top[data-v-3cd1b9b0]{font-size:14px;font-weight:600;color:rgba(0,0,0,.85)}.virtual .virtual_bottom[data-v-3cd1b9b0]{font-size:12px;font-weight:400;color:#999}.virtual[data-v-3cd1b9b0]:nth-child(2n){margin:0 12px}[data-v-7d87bc0d] .el-cascader{display:block}.ela-btn[data-v-7d87bc0d]{color:#2d8cf0}.priceBox[data-v-7d87bc0d]{width:80px}.pictrue[data-v-7d87bc0d]{width:50px;height:50px;border:1px dotted rgba(0,0,0,.1);display:inline-block;position:relative;cursor:pointer}.pictrue img[data-v-7d87bc0d]{width:100%;height:100%}[data-v-7d87bc0d] .el-input-number__decrease,[data-v-7d87bc0d] .el-input-number__increase{display:none}[data-v-7d87bc0d] .el-input-number.is-controls-right .el-input__inner,[data-v-7d87bc0d] .el-input__inner{padding:0 5px}.pictrueTab[data-v-7d87bc0d]{width:40px!important;height:40px!important}.upLoad[data-v-7d87bc0d]{width:40px;height:40px;border:1px dotted rgba(0,0,0,.1);border-radius:4px;background:rgba(0,0,0,.02);cursor:pointer}.bg[data-v-08836151]{z-index:100;position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.5)}.goods_detail .goods_detail_wrapper[data-v-08836151]{z-index:-10}[data-v-08836151] table.el-input__inner{padding:0}.demo-table-expand[data-v-08836151]{font-size:0}.demo-table-expand1[data-v-08836151] label{width:77px!important;color:#99a9bf}.demo-table-expand .el-form-item[data-v-08836151]{margin-right:0;margin-bottom:0;width:33.33%}.selWidth[data-v-08836151]{width:350px!important}.seachTiele[data-v-08836151]{line-height:35px}
|
File diff suppressed because one or more lines are too long
1
public/mer/js/app.6f011970.js
Normal file
1
public/mer/js/app.6f011970.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/mer/js/chunk-4dbe6a20.0febd519.js
Normal file
1
public/mer/js/chunk-4dbe6a20.0febd519.js
Normal file
File diff suppressed because one or more lines are too long
1
public/mer/js/chunk-5726e47e.cee99973.js
Normal file
1
public/mer/js/chunk-5726e47e.cee99973.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/mer/js/chunk-bab0b9dc.8e77d0e4.js
Normal file
1
public/mer/js/chunk-bab0b9dc.8e77d0e4.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user