作者 何书鹏

会员价

... ... @@ -417,8 +417,20 @@ class Goods extends Model
public static function operActivitySkuPrice($detail, $sku_price) {
$activity = (new self)->getActivity($detail['id']);
// 划线价格
$detail['original_price'] = $detail['price'];
// 原价
$prices = array_column($sku_price, 'price');
$detail['original_price'] = $prices ? min($prices) : 0;
// 会员价
$basicConfig = json_decode(\addons\shopro\model\Config::get(['name' => 'user'])->value, true);
$new_sku_price = [];
foreach ($sku_price as $s => $k) {
$new_sku_price[$s] = $k;
$new_sku_price[$s]['member_price'] = round($k['price'] * $basicConfig['discount'] / 10,2);
}
$sku_price = $new_sku_price;
$member_price = array_column($sku_price, 'member_price');
$detail['member_price'] = $member_price ? min($member_price) : 0;
if (!empty($activity)) {
switch ($activity['type']) {
... ...