commit
7ae9abfc1b
@ -9,8 +9,10 @@ use app\common\model\store_product\StoreProduct;
|
|||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
use app\common\model\store_category\StoreCategory;
|
use app\common\model\store_category\StoreCategory;
|
||||||
|
use app\common\model\store_product_group_price\StoreProductGroupPrice;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
|
use app\common\model\user\User;
|
||||||
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
||||||
use app\common\lists\ListsExcelInterface;
|
use app\common\lists\ListsExcelInterface;
|
||||||
|
|
||||||
@ -62,10 +64,11 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$is_warehouse=$this->request->get('is_warehouse',0);
|
$is_warehouse=$this->request->get('is_warehouse',0);
|
||||||
return StoreProduct::where($this->searchWhere)
|
$list = StoreProduct::where($this->searchWhere)
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item) use($is_warehouse) {
|
->select()->each(function ($item) use($is_warehouse) {
|
||||||
|
$item['product_id'] = $item['id'];
|
||||||
$item['bar_code_two'] = '';
|
$item['bar_code_two'] = '';
|
||||||
if (in_array($item['unit'], [2, 21])) {
|
if (in_array($item['unit'], [2, 21])) {
|
||||||
$item['bar_code_two'] = $item['bar_code'];
|
$item['bar_code_two'] = $item['bar_code'];
|
||||||
@ -110,6 +113,11 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|||||||
}
|
}
|
||||||
return $item;
|
return $item;
|
||||||
})?->toArray();
|
})?->toArray();
|
||||||
|
if (!empty($this->params['user_id'])) {
|
||||||
|
$userShip = User::where('id', $this->params['user_id'])->value('user_ship');
|
||||||
|
$list = StoreProductGroupPrice::resetProductsPrice($list, $userShip);
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,11 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return StoreProduct::where($this->searchWhere)->limit($this->limitOffset, $this->limitLength)
|
$query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit');
|
||||||
|
if ($this->params['product_id']) {
|
||||||
|
$query->where('id|store_name', $this->params['product_id']);
|
||||||
|
}
|
||||||
|
return $query->limit($this->limitOffset, $this->limitLength)
|
||||||
->field('id,store_name,purchase,cost,vip_price,price,unit')
|
->field('id,store_name,purchase,cost,vip_price,price,unit')
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item) {
|
->select()->each(function ($item) {
|
||||||
@ -64,7 +68,11 @@ class StoreProductGroupPriceLists extends BaseAdminDataLists implements ListsSea
|
|||||||
*/
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
return StoreProduct::where($this->searchWhere)->count();
|
$query = StoreProduct::field('id,store_name,purchase,cost,vip_price,price,unit');
|
||||||
|
if ($this->params['product_id']) {
|
||||||
|
$query->where('id|store_name', $this->params['product_id']);
|
||||||
|
}
|
||||||
|
return $query->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -52,8 +52,10 @@ class StoreProductPriceLists extends BaseAdminDataLists implements ListsSearchIn
|
|||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function($item){
|
||||||
$find = StoreProduct::where('id', $item['product_id'])->field('image,store_name')->find();
|
$find = StoreProduct::with('unitName')->where('id', $item['product_id'])->field('image,store_name,store_info,unit')->find();
|
||||||
|
$item['unit_name']=$find['unitName']['name'];
|
||||||
$item['store_name']=$find['store_name'];
|
$item['store_name']=$find['store_name'];
|
||||||
|
$item['store_info']=$find['store_info'];
|
||||||
$item['image']=$find['image'];
|
$item['image']=$find['image'];
|
||||||
$item['status_name']=$item['status']==0?"未设置":"已设置";
|
$item['status_name']=$item['status']==0?"未设置":"已设置";
|
||||||
})
|
})
|
||||||
|
@ -70,6 +70,13 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
$total_num = 0;
|
$total_num = 0;
|
||||||
$total_price = 0;
|
$total_price = 0;
|
||||||
$uid = $params['uid'] ?? 0;
|
$uid = $params['uid'] ?? 0;
|
||||||
|
if (!empty($uid) && empty($params['other_data']['nickname'])) {
|
||||||
|
$user = User::where('id', $uid)->field('nickname,mobile')->find();
|
||||||
|
$userAddress = UserAddress::getDefaultAddress($uid);
|
||||||
|
$params['other_data']['nickname'] = $user['nickname'];
|
||||||
|
$params['other_data']['phone'] = $user['mobile'];
|
||||||
|
$params['other_data']['address'] = !empty($userAddress) ? $userAddress['area']['area_name'] . $userAddress['street']['street_name'] . $userAddress['village']['village_name'] . $userAddress['brigade']['brigade_name'] . $userAddress['detail'] : '';
|
||||||
|
}
|
||||||
foreach ($params['product_arr'] as $k => $v) {
|
foreach ($params['product_arr'] as $k => $v) {
|
||||||
if ($v['product_id'] <= 0) {
|
if ($v['product_id'] <= 0) {
|
||||||
unset($params['product_arr'][$k]);
|
unset($params['product_arr'][$k]);
|
||||||
|
@ -159,6 +159,11 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
|||||||
throw new BusinessException('请勿重复入库');
|
throw new BusinessException('请勿重复入库');
|
||||||
}
|
}
|
||||||
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();
|
$offer_list = PurchaseProductOffer::where(['order_id' => $params['bhoid'], 'is_storage' => 0])->select();
|
||||||
|
foreach ($offer_list as $k => $v) {
|
||||||
|
if($v['buyer_nums']<=0){
|
||||||
|
throw new BusinessException('采购数量不能为0');
|
||||||
|
}
|
||||||
|
}
|
||||||
$total_price= PurchaseProductOffer::where(['order_id' => $params['bhoid']])->sum('total_price');
|
$total_price= PurchaseProductOffer::where(['order_id' => $params['bhoid']])->sum('total_price');
|
||||||
$completed_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>1])->sum('total_price');
|
$completed_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>1])->sum('total_price');
|
||||||
$outstanding_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>2])->sum('total_price');
|
$outstanding_amount= PurchaseProductOffer::where(['order_id' => $params['bhoid'],'pay_type'=>2])->sum('total_price');
|
||||||
|
@ -11,6 +11,7 @@ use app\common\model\Config;
|
|||||||
use app\common\model\dict\DictType;
|
use app\common\model\dict\DictType;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||||
|
use app\common\model\store_product_group_price\StoreProductGroupPrice;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
|
|
||||||
@ -92,6 +93,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name');
|
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$list = StoreProductGroupPrice::resetProductsPrice($list, $user_ship);
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ use app\common\lists\ListsSortInterface;
|
|||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
use app\common\model\Config;
|
use app\common\model\Config;
|
||||||
|
use app\common\model\store_product_group_price\StoreProductGroupPrice;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
//use app\common\model\goods\GoodsLabel;
|
//use app\common\model\goods\GoodsLabel;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -111,7 +112,7 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
|
|||||||
$this->searchWhere[] = ['is_show', '=', 1];
|
$this->searchWhere[] = ['is_show', '=', 1];
|
||||||
$this->searchWhere[] = ['product_type', 'in', [0,4]];
|
$this->searchWhere[] = ['product_type', 'in', [0,4]];
|
||||||
// $this->searchWhere[] = ['stock', '>', 0];
|
// $this->searchWhere[] = ['stock', '>', 0];
|
||||||
return StoreProduct::where($this->searchWhere)
|
$list = StoreProduct::where($this->searchWhere)
|
||||||
->field($fields)
|
->field($fields)
|
||||||
->with(['className', 'unitName'])
|
->with(['className', 'unitName'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
@ -127,6 +128,8 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
|
|||||||
return $item;
|
return $item;
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
$list = StoreProductGroupPrice::resetProductsPrice($list, $user_ship);
|
||||||
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ use app\common\model\store_order\StoreOrder;
|
|||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||||
|
use app\common\model\store_product_group_price\StoreProductGroupPrice;
|
||||||
use app\common\model\store_product_log\StoreProductLog;
|
use app\common\model\store_product_log\StoreProductLog;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
use app\common\model\system_store\SystemStore;
|
use app\common\model\system_store\SystemStore;
|
||||||
@ -101,6 +102,9 @@ class OrderLogic extends BaseLogic
|
|||||||
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
|
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
|
||||||
} else {
|
} else {
|
||||||
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
|
$find = StoreProduct::where(['id' => $v['product_id']])->field($field)->find();
|
||||||
|
if (!empty($user['user_ship'])) {
|
||||||
|
$find = StoreProductGroupPrice::resetProductPrice($find, $user['user_ship']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!$find) {
|
if (!$find) {
|
||||||
throw new BusinessException('商品不存在');
|
throw new BusinessException('商品不存在');
|
||||||
@ -123,25 +127,8 @@ class OrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
unset($cart_select[$k]['id']);
|
unset($cart_select[$k]['id']);
|
||||||
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
$cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价
|
||||||
if ($v['source'] != 4) {
|
|
||||||
if ($off_activity == 1 || ($user != null && in_array($user['user_ship'], [4, 6, 7]))) {
|
$price = self::getProductPrice($v['source'], $off_activity, $params['store_id'], $find, $user);
|
||||||
$price = $find['cost'];
|
|
||||||
} else {
|
|
||||||
$price = $find['price'];
|
|
||||||
//单门店活动判断
|
|
||||||
if ($params['store_id'] == getenv('ACTIVITY_STORE_ID')) {
|
|
||||||
$storeBranchPrice = StoreBranchProduct::where('store_id', getenv('ACTIVITY_STORE_ID'))->where('product_id', $v['product_id'])->value('price');
|
|
||||||
if ($storeBranchPrice) {
|
|
||||||
$price = $storeBranchPrice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($off_activity == 0 && $find['top_cate_id'] == 15189 && $user && $user['user_ship'] == 5) {
|
|
||||||
$price = $find['cost'];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$price = $find['price'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$cart_select[$k]['price'] = $price;
|
$cart_select[$k]['price'] = $price;
|
||||||
$cart_select[$k]['cost'] = $find['cost'];
|
$cart_select[$k]['cost'] = $find['cost'];
|
||||||
@ -887,4 +874,30 @@ class OrderLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
return $pay_price;
|
return $pay_price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getProductPrice($source, $offActivity, $storeId, $product, $user)
|
||||||
|
{
|
||||||
|
if ($source == 4) {
|
||||||
|
return $product['price'];
|
||||||
|
}
|
||||||
|
//开启活动或用户身份为 商户、酒店、食堂 展示成本价(即商户价)
|
||||||
|
//目前已修改为 商品分组报价,根据用户组展示对应的价格
|
||||||
|
if ($offActivity == 1) {
|
||||||
|
$price = $product['cost'];
|
||||||
|
} else {
|
||||||
|
$price = $product['price'];
|
||||||
|
//单门店活动判断
|
||||||
|
if ($storeId == getenv('ACTIVITY_STORE_ID')) {
|
||||||
|
$storeBranchPrice = StoreBranchProduct::where('store_id', getenv('ACTIVITY_STORE_ID'))->where('product_id', $product['id'])->value('price');
|
||||||
|
if ($storeBranchPrice) {
|
||||||
|
$price = $storeBranchPrice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($offActivity == 0 && $product['top_cate_id'] == 15189 && $user && $user['user_ship'] == 5) {
|
||||||
|
$price = $product['cost'];
|
||||||
|
}
|
||||||
|
return $price;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
16
app/common/model/geo/GeoArea.php
Normal file
16
app/common/model/geo/GeoArea.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\geo;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GeoArea
|
||||||
|
* @package app\common\model\geo\GeoArea
|
||||||
|
*/
|
||||||
|
class GeoArea extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $name = 'geo_area';
|
||||||
|
|
||||||
|
}
|
16
app/common/model/geo/GeoBrigade.php
Normal file
16
app/common/model/geo/GeoBrigade.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\geo;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GeoBrigade
|
||||||
|
* @package app\common\model\geo\GeoBrigade
|
||||||
|
*/
|
||||||
|
class GeoBrigade extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $name = 'geo_brigade';
|
||||||
|
|
||||||
|
}
|
16
app/common/model/geo/GeoCity.php
Normal file
16
app/common/model/geo/GeoCity.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\geo;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GeoCity
|
||||||
|
* @package app\common\model\geo\GeoCity
|
||||||
|
*/
|
||||||
|
class GeoCity extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $name = 'geo_city';
|
||||||
|
|
||||||
|
}
|
16
app/common/model/geo/GeoProvince.php
Normal file
16
app/common/model/geo/GeoProvince.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\geo;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GeoProvince
|
||||||
|
* @package app\common\model\geo\GeoProvince
|
||||||
|
*/
|
||||||
|
class GeoProvince extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $name = 'geo_province';
|
||||||
|
|
||||||
|
}
|
16
app/common/model/geo/GeoStreet.php
Normal file
16
app/common/model/geo/GeoStreet.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\geo;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GeoStreet
|
||||||
|
* @package app\common\model\geo\GeoStreet
|
||||||
|
*/
|
||||||
|
class GeoStreet extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $name = 'geo_street';
|
||||||
|
|
||||||
|
}
|
16
app/common/model/geo/GeoVillage.php
Normal file
16
app/common/model/geo/GeoVillage.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\geo;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class GeoVillage
|
||||||
|
* @package app\common\model\geo\GeoVillage
|
||||||
|
*/
|
||||||
|
class GeoVillage extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $name = 'geo_village';
|
||||||
|
|
||||||
|
}
|
@ -18,5 +18,26 @@ class StoreProductGroupPrice extends BaseModel
|
|||||||
protected $name = 'store_product_group_price';
|
protected $name = 'store_product_group_price';
|
||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
public static function resetProductsPrice($productList, $userShip)
|
||||||
|
{
|
||||||
|
$productIds = array_column($productList, 'product_id');
|
||||||
|
$groupPrices = StoreProductGroupPrice::where('group_id', $userShip)->whereIn('product_id', $productIds)->column('product_id,price_type,base_rate,price');
|
||||||
|
$groupPrices = reset_index($groupPrices, 'product_id');
|
||||||
|
foreach ($productList as &$item) {
|
||||||
|
if (isset($groupPrices[$item['product_id']])) {
|
||||||
|
$item['price'] = $groupPrices[$item['product_id']]['price'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $productList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function resetProductPrice($product, $userShip)
|
||||||
|
{
|
||||||
|
$groupPrice = StoreProductGroupPrice::where('group_id', $userShip)->whereIn('product_id', $product['id'])->field('product_id,price_type,base_rate,price')->find();
|
||||||
|
if (!empty($groupPrice) && $groupPrice['product_id'] == $product['id']) {
|
||||||
|
$product['price'] = $groupPrice['price'];
|
||||||
|
}
|
||||||
|
return $product;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -5,6 +5,10 @@ namespace app\common\model\user;
|
|||||||
|
|
||||||
|
|
||||||
use app\common\model\BaseModel;
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\geo\GeoArea;
|
||||||
|
use app\common\model\geo\GeoBrigade;
|
||||||
|
use app\common\model\geo\GeoStreet;
|
||||||
|
use app\common\model\geo\GeoVillage;
|
||||||
use think\model\concern\SoftDelete;
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,4 +23,33 @@ class UserAddress extends BaseModel
|
|||||||
|
|
||||||
protected $deleteTime = 'delete_time';
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
public static function getDefaultAddress($uid)
|
||||||
|
{
|
||||||
|
$address = self::with(['area', 'street', 'village', 'brigade'])->where(['uid' => $uid, 'is_default' => 1])->find();
|
||||||
|
if (empty($address)) {
|
||||||
|
$address = self::with(['area', 'street', 'village', 'brigade'])->where(['uid' => $uid])->find();
|
||||||
|
}
|
||||||
|
return empty($address) ? [] : $address->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function area()
|
||||||
|
{
|
||||||
|
return $this->hasOne(GeoArea::class, 'area_code', 'area')->field('area_code,area_name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function street()
|
||||||
|
{
|
||||||
|
return $this->hasOne(GeoStreet::class, 'street_code', 'street')->field('street_code,street_name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function village()
|
||||||
|
{
|
||||||
|
return $this->hasOne(GeoVillage::class, 'village_code', 'village')->field('village_code,village_name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function brigade()
|
||||||
|
{
|
||||||
|
return $this->hasOne(GeoBrigade::class, 'id', 'brigade')->field('id,brigade_name');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -9,6 +9,7 @@ use app\common\model\order\Cart;
|
|||||||
use app\common\model\Config;
|
use app\common\model\Config;
|
||||||
use app\common\model\store_branch_product\StoreBranchProduct;
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
use app\common\model\store_product_attr_value\StoreProductAttrValue;
|
||||||
|
use app\common\model\store_product_group_price\StoreProductGroupPrice;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
use app\common\lists\ListsExtendInterface;
|
use app\common\lists\ListsExtendInterface;
|
||||||
@ -66,15 +67,16 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
|
|||||||
$user_ship=0;
|
$user_ship=0;
|
||||||
if ($uid > 0) {
|
if ($uid > 0) {
|
||||||
$user_ship = User::where('id', $uid)->value('user_ship');
|
$user_ship = User::where('id', $uid)->value('user_ship');
|
||||||
if (in_array($user_ship, [4, 6, 7])) {
|
// if (in_array($user_ship, [4, 6, 7])) {
|
||||||
$off_activity = 1;
|
// $off_activity = 1;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
foreach ($list as $key => &$item) {
|
foreach ($list as $key => &$item) {
|
||||||
$find = StoreProduct::where(['id' => $item['product_id']])
|
$find = StoreProduct::where(['id' => $item['product_id']])
|
||||||
->field('id,id product_id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id')
|
->field('id,id product_id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id')
|
||||||
->find();
|
->find();
|
||||||
if ($find) {
|
if ($find) {
|
||||||
|
$find = StoreProductGroupPrice::resetProductPrice($find, $user_ship);
|
||||||
if ($off_activity == 1) {
|
if ($off_activity == 1) {
|
||||||
$this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
|
$this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2);
|
||||||
$item['price'] = $find['cost'];
|
$item['price'] = $find['cost'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user