修改商品价格展示
This commit is contained in:
parent
c97602e318
commit
7ff348b3db
@ -412,7 +412,7 @@ class Product extends BaseModel
|
||||
|
||||
public function merchant()
|
||||
{
|
||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count,is_margin');
|
||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count,is_margin,wholesale');
|
||||
}
|
||||
|
||||
public function reply()
|
||||
|
@ -59,6 +59,8 @@ use think\contract\Arrayable;
|
||||
class ProductRepository extends BaseRepository
|
||||
{
|
||||
|
||||
/** @var $isWholesale bool 是否批发 */
|
||||
public $isWholesale = false;
|
||||
protected $dao;
|
||||
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',
|
||||
@ -1329,6 +1331,7 @@ class ProductRepository extends BaseRepository
|
||||
$with = [
|
||||
'attr',
|
||||
'attrValue',
|
||||
'merchant',
|
||||
];
|
||||
$append = ['topReply'];
|
||||
switch ($productType) {
|
||||
@ -1376,6 +1379,7 @@ class ProductRepository extends BaseRepository
|
||||
],
|
||||
$userInfo['uid']
|
||||
);
|
||||
$this->isWholesale = $product->merchant->isWholesale() && $userInfo->getMerId() > 0;
|
||||
}
|
||||
|
||||
if (systemConfig('sys_reply_status')) {
|
||||
@ -1399,6 +1403,9 @@ class ProductRepository extends BaseRepository
|
||||
$product['attr'] = $attr;
|
||||
$product['sku'] = $sku;
|
||||
$product['isRelation'] = $isRelation;
|
||||
if ($this->isWholesale) {
|
||||
$product['price'] = current($sku)['price'];
|
||||
}
|
||||
return $product;
|
||||
}
|
||||
|
||||
@ -1653,6 +1660,9 @@ class ProductRepository extends BaseRepository
|
||||
'unique' => $value['unique'],
|
||||
'bar_code' => $value['bar_code'],
|
||||
];
|
||||
if ($this->isWholesale) {
|
||||
$_value['price'] = $value['wholesale_price'];
|
||||
}
|
||||
if ($productType == 0) {
|
||||
$_value['ot_price'] = $value['ot_price'];
|
||||
$_value['svip_price'] = $value['svip_price'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user