调整商品列表
This commit is contained in:
parent
2950b863a9
commit
56e0af48df
@ -2,14 +2,24 @@
|
|||||||
|
|
||||||
namespace app\common;
|
namespace app\common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枚举类
|
||||||
|
*/
|
||||||
class Enum
|
class Enum
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** 购物车、订单相关 */
|
||||||
const SALE_TYPE_RETAIL = 1; //零售类型
|
const SALE_TYPE_RETAIL = 1; //零售类型
|
||||||
const SALE_TYPE_WHOLESALE = 2; //批发类型
|
const SALE_TYPE_WHOLESALE = 2; //批发类型
|
||||||
|
/** 通用状态 */
|
||||||
const STATUS_ENABLE = 1; //允许状态
|
const STATUS_ENABLE = 1; //允许状态
|
||||||
const STATUS_DISABLE = 0; //禁用状态
|
const STATUS_DISABLE = 0; //禁用状态
|
||||||
|
/** 店铺相关 */
|
||||||
|
const RETAIL_ONLY = 0; //仅零售
|
||||||
|
const WHOLESALE_ONLY = 1; //仅批发
|
||||||
|
const RETAIL_WHOLESALE = 2; //零售和批发
|
||||||
|
|
||||||
|
/** @const MAP */
|
||||||
const MAP = [
|
const MAP = [
|
||||||
self::SALE_TYPE_RETAIL => '零售',
|
self::SALE_TYPE_RETAIL => '零售',
|
||||||
self::SALE_TYPE_WHOLESALE => '批发',
|
self::SALE_TYPE_WHOLESALE => '批发',
|
||||||
|
@ -11,9 +11,11 @@
|
|||||||
namespace app\common\dao\store\product;
|
namespace app\common\dao\store\product;
|
||||||
|
|
||||||
use app\common\dao\BaseDao;
|
use app\common\dao\BaseDao;
|
||||||
|
use app\common\Enum;
|
||||||
use app\common\model\store\product\ProductCate;
|
use app\common\model\store\product\ProductCate;
|
||||||
use app\common\model\store\product\Spu;
|
use app\common\model\store\product\Spu;
|
||||||
use app\common\model\store\StoreCategory;
|
use app\common\model\store\StoreCategory;
|
||||||
|
use app\common\model\system\merchant\Merchant;
|
||||||
use app\common\repositories\store\StoreCategoryRepository;
|
use app\common\repositories\store\StoreCategoryRepository;
|
||||||
use app\common\repositories\system\merchant\MerchantRepository;
|
use app\common\repositories\system\merchant\MerchantRepository;
|
||||||
use crmeb\services\VicWordService;
|
use crmeb\services\VicWordService;
|
||||||
@ -68,6 +70,11 @@ class SpuDao extends BaseDao
|
|||||||
->when(isset($where['mer_ids']) && $where['mer_ids'] !== '',function($query)use($where){
|
->when(isset($where['mer_ids']) && $where['mer_ids'] !== '',function($query)use($where){
|
||||||
$query->whereIn('P.mer_id',$where['mer_ids']);
|
$query->whereIn('P.mer_id',$where['mer_ids']);
|
||||||
})
|
})
|
||||||
|
->when(isset($where['sale_type']) && $where['sale_type'] !== '',function($query)use($where){
|
||||||
|
$saleType = $where['sale_type'] == Enum::SALE_TYPE_RETAIL ? [Enum::RETAIL_ONLY, Enum::RETAIL_WHOLESALE] : [Enum::WHOLESALE_ONLY];
|
||||||
|
$merIds = Merchant::whereIn('wholesale', $saleType)->column('mer_id');
|
||||||
|
$query->whereIn('P.mer_id', $merIds);
|
||||||
|
})
|
||||||
->when(isset($where['product_ids']) && $where['product_ids'] !== '',function($query)use($where){
|
->when(isset($where['product_ids']) && $where['product_ids'] !== '',function($query)use($where){
|
||||||
$query->whereIn('P.product_id',$where['product_ids']);
|
$query->whereIn('P.product_id',$where['product_ids']);
|
||||||
})
|
})
|
||||||
|
@ -133,6 +133,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($merchantCart['list'] as $k => $cart) {
|
foreach ($merchantCart['list'] as $k => $cart) {
|
||||||
|
if ($isWholeSale) {
|
||||||
|
$merchantCart['list'][$k]['productAttr']['price'] = $cart['productAttr']['wholesale_price'];
|
||||||
|
$merchantCart['list'][$k]['product']['price'] = $cart['productAttr']['wholesale_price'];
|
||||||
|
}
|
||||||
//获取订单商品支持的配送类型
|
//获取订单商品支持的配送类型
|
||||||
if ($cart['product']['delivery_way']) {
|
if ($cart['product']['delivery_way']) {
|
||||||
$delivery_way = explode(',', $cart['product']['delivery_way']);
|
$delivery_way = explode(',', $cart['product']['delivery_way']);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
namespace app\common\repositories\store\product;
|
namespace app\common\repositories\store\product;
|
||||||
|
|
||||||
|
use app\common\model\store\order\StoreOrder;
|
||||||
use app\common\model\store\product\ProductLabel;
|
use app\common\model\store\product\ProductLabel;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\repositories\community\CommunityRepository;
|
use app\common\repositories\community\CommunityRepository;
|
||||||
@ -61,6 +62,8 @@ class ProductRepository extends BaseRepository
|
|||||||
|
|
||||||
/** @var $isWholesale bool 是否批发 */
|
/** @var $isWholesale bool 是否批发 */
|
||||||
public $isWholesale = false;
|
public $isWholesale = false;
|
||||||
|
/** @var $saleType int 售卖类型 */
|
||||||
|
public $saleType;
|
||||||
protected $dao;
|
protected $dao;
|
||||||
const CREATE_PARAMS = [
|
const CREATE_PARAMS = [
|
||||||
"is_copy", "image", "slider_image", "store_name", "store_info", "keyword", "bar_code", "guarantee_template_id", "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', 'mer_form_id',
|
"is_copy", "image", "slider_image", "store_name", "store_info", "keyword", "bar_code", "guarantee_template_id", "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', 'mer_form_id',
|
||||||
@ -1379,7 +1382,7 @@ class ProductRepository extends BaseRepository
|
|||||||
],
|
],
|
||||||
$userInfo['uid']
|
$userInfo['uid']
|
||||||
);
|
);
|
||||||
$this->isWholesale = $product->merchant->isWholesale() && $userInfo->getMerId() > 0;
|
$this->isWholesale = StoreOrder::isWholesale($product->merchant['wholesale'], $userInfo->getMerId(), $this->saleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systemConfig('sys_reply_status')) {
|
if (systemConfig('sys_reply_status')) {
|
||||||
|
@ -114,7 +114,7 @@ class MerchantCategoryRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function getSelect()
|
public function getSelect()
|
||||||
{
|
{
|
||||||
$query = $this->search([])->field('merchant_category_id,category_name');
|
$query = $this->search([])->field('merchant_category_id,category_name,background');
|
||||||
$list = $query->select()->toArray();
|
$list = $query->select()->toArray();
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ class StoreProduct extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function detail($id)
|
public function detail($id)
|
||||||
{
|
{
|
||||||
|
$this->repository->saleType = $this->request->get('sale_type', 1);
|
||||||
$data = $this->repository->detail((int)$id, $this->userInfo);
|
$data = $this->repository->detail((int)$id, $this->userInfo);
|
||||||
if (!$data) {
|
if (!$data) {
|
||||||
app()->make(SpuRepository::class)->changeStatus($id, 0);
|
app()->make(SpuRepository::class)->changeStatus($id, 0);
|
||||||
|
@ -61,7 +61,8 @@ class StoreSpu extends BaseController
|
|||||||
'filter_params',
|
'filter_params',
|
||||||
'mer_type_id',
|
'mer_type_id',
|
||||||
'sys_labels',
|
'sys_labels',
|
||||||
'deduction_rate'
|
'deduction_rate',
|
||||||
|
'sale_type',
|
||||||
]);
|
]);
|
||||||
$where['is_gift_bag'] = 0;
|
$where['is_gift_bag'] = 0;
|
||||||
$where['product_type'] = 0;
|
$where['product_type'] = 0;
|
||||||
@ -101,7 +102,7 @@ class StoreSpu extends BaseController
|
|||||||
public function recommend()
|
public function recommend()
|
||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$where = $this->request->params(['common','mer_id']);
|
$where = $this->request->params(['common', 'mer_id', 'sale_type']);
|
||||||
$where['is_gift_bag'] = 0;
|
$where['is_gift_bag'] = 0;
|
||||||
//1:星级
|
//1:星级
|
||||||
//2:用户收藏
|
//2:用户收藏
|
||||||
|
Loading…
x
Reference in New Issue
Block a user