Compare commits

...

9 Commits

17 changed files with 513 additions and 117 deletions

View File

@ -0,0 +1,94 @@
<?php
namespace app\admin\controller\store_branch_product_attr_value;
use app\admin\controller\BaseAdminController;
use app\admin\lists\store_branch_product_attr_value\StoreBranchProductAttrValueLists;
use app\admin\logic\store_branch_product_attr_value\StoreBranchProductAttrValueLogic;
use app\admin\validate\store_branch_product_attr_value\StoreBranchProductAttrValueValidate;
/**
* 门店商品属性值辅助表控制器
* Class StoreBranchProductAttrValueController
* @package app\admin\controller\store_branch_product_attr_value
*/
class StoreBranchProductAttrValueController extends BaseAdminController
{
/**
* @notes 获取门店商品属性值辅助表列表
* @return \think\response\Json
* @author admin
* @date 2024/08/26 16:17
*/
public function lists()
{
return $this->dataLists(new StoreBranchProductAttrValueLists());
}
/**
* @notes 添加门店商品属性值辅助表
* @return \think\response\Json
* @author admin
* @date 2024/08/26 16:17
*/
public function add()
{
$params = (new StoreBranchProductAttrValueValidate())->post()->goCheck('add');
$result = StoreBranchProductAttrValueLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(StoreBranchProductAttrValueLogic::getError());
}
/**
* @notes 编辑门店商品属性值辅助表
* @return \think\response\Json
* @author admin
* @date 2024/08/26 16:17
*/
public function status()
{
$params =$this->request->post();
$result = StoreBranchProductAttrValueLogic::status($params);
if (true === $result) {
return $this->success('变更成功', [], 1, 1);
}
}
/**
* @notes 删除门店商品属性值辅助表
* @return \think\response\Json
* @author admin
* @date 2024/08/26 16:17
*/
public function delete()
{
$params = (new StoreBranchProductAttrValueValidate())->post()->goCheck('delete');
StoreBranchProductAttrValueLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取门店商品属性值辅助表详情
* @return \think\response\Json
* @author admin
* @date 2024/08/26 16:17
*/
public function detail()
{
$params = (new StoreBranchProductAttrValueValidate())->goCheck('detail');
$result = StoreBranchProductAttrValueLogic::detail($params);
return $this->data($result);
}
}

View File

@ -57,6 +57,8 @@ class StoreProductController extends BaseAdminController
public function edit() public function edit()
{ {
$params = (new StoreProductValidate())->post()->goCheck('edit'); $params = (new StoreProductValidate())->post()->goCheck('edit');
d($params);
$result = StoreProductLogic::edit($params); $result = StoreProductLogic::edit($params);
return $this->success('编辑成功', [], 1, 1); return $this->success('编辑成功', [], 1, 1);

View File

@ -0,0 +1,65 @@
<?php
namespace app\admin\lists\store_branch_product_attr_value;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\store_branch_product_attr_value\StoreBranchProductAttrValue;
use app\common\lists\ListsSearchInterface;
use app\common\model\store_product_unit\StoreProductUnit;
/**
* 门店商品属性值辅助表列表
* Class StoreBranchProductAttrValueLists
* @package app\admin\listsstore_branch_product_attr_value
*/
class StoreBranchProductAttrValueLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author admin
* @date 2024/08/26 16:17
*/
public function setSearch(): array
{
return [
'=' => ['product_id', 'store_id'],
];
}
/**
* @notes 获取门店商品属性值辅助表列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author admin
* @date 2024/08/26 16:17
*/
public function lists(): array
{
return StoreBranchProductAttrValue::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) {
$item->unit_name = StoreProductUnit::where('id', $item->unit)->value('name');
})
->toArray();
}
/**
* @notes 获取门店商品属性值辅助表数量
* @return int
* @author admin
* @date 2024/08/26 16:17
*/
public function count(): int
{
return StoreBranchProductAttrValue::where($this->searchWhere)->count();
}
}

View File

@ -12,6 +12,7 @@ use app\common\model\store_product\StoreProduct;
use app\common\lists\ListsExcelInterface; use app\common\lists\ListsExcelInterface;
use app\common\model\store_category\StoreCategory; use app\common\model\store_category\StoreCategory;
use app\common\model\store_order\StoreOrder; use app\common\model\store_order\StoreOrder;
use app\common\model\store_product_attr_value\StoreProductAttrValue;
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\user\User;
@ -51,9 +52,10 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
public function lists(): array public function lists(): array
{ {
return StoreOrderCartInfo::where($this->searchWhere) return StoreOrderCartInfo::where($this->searchWhere)
->field('id,oid,uid,product_id,store_id,cart_num,price,total_price,create_time')->limit($this->limitOffset, $this->limitLength) ->field('id,oid,uid,product_id,store_id,cart_num,price,total_price,create_time,attr_value_id')->limit($this->limitOffset, $this->limitLength)
->select()->each(function ($item) { ->select()->each(function ($item) {
$find=StoreProduct::where('id',$item['product_id'])->field('image,unit,store_name,store_info')->find(); $find=StoreProduct::where('id',$item['product_id'])->field('image,unit,store_name,store_info')->find();
$attr_value=StoreProductAttrValue::where('id',$item['attr_value_id'])->find();
$item['nickname']='无'; $item['nickname']='无';
$item['mobile']=''; $item['mobile']='';
if($find){ if($find){
@ -71,20 +73,18 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
$item['image']=$find['image'];//商品图片 $item['image']=$find['image'];//商品图片
$item['system_store']=SystemStore::where('id',$item['store_id'])->value('name')??""; $item['system_store']=SystemStore::where('id',$item['store_id'])->value('name')??"";
$item['store_name']=$find['store_name'];//商品名称 $item['store_name']=$find['store_name'];//商品名称
$item['store_info']=$find['store_info'];//商品规格 $item['sku_name']=$attr_value['sku_name']??'';//商品规格
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name')??""; $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name')??"";
$item['cate_name'] = StoreCategory::where('id', $find['cate_id'])->value('name')??""; $item['cate_name'] = StoreCategory::where('id', $find['cate_id'])->value('name')??"";
$item['pay_price'] =$item['total_price']; $item['pay_price'] =$item['total_price'];
$item['cart_info'] = $item->toArray()??[];
}else{ }else{
$item['image']='';//商品图片 $item['image']='';//商品图片
$item['unit_name']='';//商品图片 $item['unit_name']='';//商品图片
$item['cate_name']='';//商品图片 $item['cate_name']='';//商品图片
$item['store_name']='';//商品名称 $item['store_name']='';//商品名称
$item['store_info']='';//商品规格-(数据库叫商品简介) $item['sku_name']='';//商品规格-(数据库叫商品简介)
$item['nickname']=''; $item['nickname']='';
$item['system_store']=''; $item['system_store']='';
$item['cart_info']=[];
} }
return $item; //返回处理后的数据。 return $item; //返回处理后的数据。
}) })
@ -130,7 +130,7 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
$data=[ $data=[
'store_name' => '商品名称', 'store_name' => '商品名称',
'system_store' => '门店', 'system_store' => '门店',
'store_info' => '规格', 'sku_name' => '规格',
'unit_name' => '单位', 'unit_name' => '单位',
'cate_name' => '分类', 'cate_name' => '分类',
'cart_num' => '数量', 'cart_num' => '数量',

View File

@ -6,7 +6,7 @@ namespace app\admin\lists\store_product_attr_value;
use app\admin\lists\BaseAdminDataLists; use app\admin\lists\BaseAdminDataLists;
use app\common\model\store_product_attr_value\StoreProductAttrValue; use app\common\model\store_product_attr_value\StoreProductAttrValue;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
use app\common\model\store_product_unit\StoreProductUnit;
/** /**
* 商品属性值列表 * 商品属性值列表
@ -43,11 +43,11 @@ class StoreProductAttrValueLists extends BaseAdminDataLists implements ListsSear
public function lists(): array public function lists(): array
{ {
return StoreProductAttrValue::where($this->searchWhere) return StoreProductAttrValue::where($this->searchWhere)
->field(['id', 'product_id'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select() ->select()->each(function ($item) {
->toArray(); $item->unit_name = StoreProductUnit::where('id', $item->unit)->value('name');
})->toArray();
} }
@ -61,5 +61,4 @@ class StoreProductAttrValueLists extends BaseAdminDataLists implements ListsSear
{ {
return StoreProductAttrValue::where($this->searchWhere)->count(); return StoreProductAttrValue::where($this->searchWhere)->count();
} }
} }

View File

@ -0,0 +1,115 @@
<?php
namespace app\admin\logic\store_branch_product_attr_value;
use app\common\model\store_branch_product_attr_value\StoreBranchProductAttrValue;
use app\common\logic\BaseLogic;
use support\exception\BusinessException;
use think\facade\Db;
/**
* 门店商品属性值辅助表逻辑
* Class StoreBranchProductAttrValueLogic
* @package app\admin\logic\store_branch_product_attr_value
*/
class StoreBranchProductAttrValueLogic extends BaseLogic
{
/**
* @notes 添加门店商品属性值辅助表
* @param array $params
* @return bool
* @author admin
* @date 2024/08/26 16:17
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
StoreBranchProductAttrValue::create([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑门店商品属性值辅助表
* @param array $params
* @return bool
* @author admin
* @date 2024/08/26 16:17
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
StoreBranchProductAttrValue::where('id', $params['id'])->update([
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 更新状态
* @param array $params
* @return bool
* @author admin
* @date 2024/08/26 16:17
*/
public static function status(array $params): bool
{
Db::startTrans();
try {
StoreBranchProductAttrValue::where('id', $params['id'])->update(['status' => $params['status']]);
Db::commit();
return true;
} catch (\Throwable $e) {
Db::rollback();
throw new BusinessException($e->getMessage());
}
}
/**
* @notes 删除门店商品属性值辅助表
* @param array $params
* @return bool
* @author admin
* @date 2024/08/26 16:17
*/
public static function delete(array $params): bool
{
return StoreBranchProductAttrValue::destroy($params['id']);
}
/**
* @notes 获取门店商品属性值辅助表详情
* @param $params
* @return array
* @author admin
* @date 2024/08/26 16:17
*/
public static function detail($params): array
{
return StoreBranchProductAttrValue::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -56,12 +56,13 @@ class StoreProductLogic extends BaseLogic
'top_cate_id' => $top_cate_id, 'top_cate_id' => $top_cate_id,
'two_cate_id' => $two_cate_id, 'two_cate_id' => $two_cate_id,
'cate_id' => $params['cate_id'], 'cate_id' => $params['cate_id'],
'unit' => $params['unit'], 'unit' => $params['product_arr'][0]['unit'],
'stock' => 0, 'stock' => 0,
'price' => $params['price'], 'price' => $params['product_arr'][0]['price'],
'vip_price' => $params['vip_price'], 'vip_price' => $params['product_arr'][0]['cost'],
'cost' => $params['cost'], 'cost' => $params['product_arr'][0]['cost'],
'purchase' => $params['purchase'], 'purchase' => $params['product_arr'][0]['purchase'],
'rose' => $params['rose'],
'is_return' => $params['is_return'], 'is_return' => $params['is_return'],
'manufacturer_information' => $params['manufacturer_information'] ?? '', 'manufacturer_information' => $params['manufacturer_information'] ?? '',
'swap' => $params['swap'] ?? 0, 'swap' => $params['swap'] ?? 0,
@ -80,18 +81,17 @@ class StoreProductLogic extends BaseLogic
} }
$data['rose']=$rose; $data['rose']=$rose;
$res = StoreProduct::create($data); $res = StoreProduct::create($data);
StoreProductAttrValue::create([ $arr=[];
"bar_code" => $params["bar_code"] ?? '', foreach($params['product_arr'] as $k=>$v){
"image" => $params["image"] ?? '', $arr[$k]['sku_name']=$v['sku_name'];
"price" => $params['price'], $arr[$k]['bar_code']=$v['bar_code'];
'vip_price' => $params['vip_price'], $arr[$k]['price']=$v['price'];
"cost" => $params['cost'], $arr[$k]['cost']=$v['cost'];
"purchase" => $params['purchase'], $arr[$k]['purchase']=$v['purchase'];
"unit" => $params["unit"], $arr[$k]['unit']=$v['unit'];
"stock" => 0, $arr[$k]['product_id']=$res['id'];
"product_id" => $res['id'], }
'sales' => 0, (new StoreProductAttrValue())->saveAll($arr);
]);
Db::commit(); Db::commit();
if ($data['product_type'] == 5) { if ($data['product_type'] == 5) {
return true; return true;
@ -117,7 +117,7 @@ class StoreProductLogic extends BaseLogic
} }
return true; return true;
} catch (\Exception $e) { } catch (\Throwable $e) {
Db::rollback(); Db::rollback();
throw new BusinessException('添加商品失败' . $e->getMessage()); throw new BusinessException('添加商品失败' . $e->getMessage());
} }
@ -341,7 +341,6 @@ class StoreProductLogic extends BaseLogic
'top_cate_id' => $dealCate['top_cate_id'], 'top_cate_id' => $dealCate['top_cate_id'],
'two_cate_id' => $dealCate['two_cate_id'], 'two_cate_id' => $dealCate['two_cate_id'],
'price' => $find['price'], 'price' => $find['price'],
// 'cost' => $find['cost'], //v1.0
'cost' => $find['cost'], 'cost' => $find['cost'],
'purchase' => $find['purchase'], 'purchase' => $find['purchase'],
'vip_price' => $find['vip_price'], 'vip_price' => $find['vip_price'],
@ -356,14 +355,14 @@ class StoreProductLogic extends BaseLogic
'rose' => $find['rose'], 'rose' => $find['rose'],
]; ];
$branch = StoreBranchProduct::create($product); $branch = StoreBranchProduct::create($product);
$arr = [ $select=StoreProductAttrValue::where('product_id', $find['id'])->select()->toArray();
'product_id' => $product_arr['id'],
'store_id' => $store_id,
'sales' => 0, foreach($select as $k=>&$v){
'type' => 0, $v['store_id']=$store_id;
'bar_code' => $find['bar_code'] unset($v['id']);
]; }
StoreBranchProductAttrValue::create($arr); (new StoreBranchProductAttrValue())->saveAll($select);
return $branch; return $branch;
} }

View File

@ -0,0 +1,82 @@
<?php
namespace app\admin\validate\store_branch_product_attr_value;
use app\common\validate\BaseValidate;
/**
* 门店商品属性值辅助表验证器
* Class StoreBranchProductAttrValueValidate
* @package app\admin\validate\store_branch_product_attr_value
*/
class StoreBranchProductAttrValueValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
];
/**
* @notes 添加场景
* @return StoreBranchProductAttrValueValidate
* @author admin
* @date 2024/08/26 16:17
*/
public function sceneAdd()
{
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return StoreBranchProductAttrValueValidate
* @author admin
* @date 2024/08/26 16:17
*/
public function sceneEdit()
{
return $this->only(['id']);
}
/**
* @notes 删除场景
* @return StoreBranchProductAttrValueValidate
* @author admin
* @date 2024/08/26 16:17
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return StoreBranchProductAttrValueValidate
* @author admin
* @date 2024/08/26 16:17
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -31,7 +31,7 @@ class CartController extends BaseApiController
{ {
$params = (new CartValidate())->post()->goCheck('add'); $params = (new CartValidate())->post()->goCheck('add');
$params['uid'] = $this->request->userId; $params['uid'] = $this->request->userId;
$result = Cart::where(['uid' => $params['uid'], 'store_id' => $params['store_id'], 'product_id' => $params['product_id'], 'is_fail' => 0, 'is_pay' => 0, 'delete_time' => null])->find(); $result = Cart::where(['uid' => $params['uid'], 'store_id' => $params['store_id'], 'product_id' => $params['product_id'], 'attr_value_id' => $params['attr_value_id'], 'is_fail' => 0, 'is_pay' => 0, 'delete_time' => null])->find();
$params['cart_num']=bcadd($params['cart_num'],0,2); $params['cart_num']=bcadd($params['cart_num'],0,2);
//判断起批发价 //判断起批发价
$branchProduct = StoreProduct::where( $branchProduct = StoreProduct::where(
@ -55,7 +55,7 @@ class CartController extends BaseApiController
} }
//数量下单判断 //数量下单判断
$count = Cart::where(['uid' => $params['uid'], 'delete_time' => null, 'is_pay' => 0])->count(); $count = Cart::where(['uid' => $params['uid'], 'is_pay' => 0])->count();
if ($count > 100) { if ($count > 100) {
return $this->fail('购物车商品不能大于100个请先结算'); return $this->fail('购物车商品不能大于100个请先结算');
} }

View File

@ -65,15 +65,17 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
->toArray(); ->toArray();
$off_activity = Config::where('name', 'off_activity')->value('value'); $off_activity = Config::where('name', 'off_activity')->value('value');
$user_ship = User::where('id', $userId)->value('user_ship'); $user_ship = User::where('id', $userId)->value('user_ship');
$field = 'id,id product_id,image,price,cost,store_name,unit,delete_time,vip_price,top_cate_id,batch'; $field = 'image,store_name';
if (in_array($user_ship, [4, 6, 7])) { // if (in_array($user_ship, [4, 6, 7])) {
$field = 'id,id product_id,image,cost price,cost,store_name,unit,delete_time,vip_price,top_cate_id,batch'; // $field = 'id,id product_id,image,store_name,unit,top_cate_id,batch';
} // }
$this->user_ship = $user_ship; $this->user_ship = $user_ship;
$this->off_activity = $off_activity; $this->off_activity = $off_activity;
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($field) // ->field($field)
// ->find();
$find = StoreProductAttrValue::where(['id'=>$item['attr_value_id']])
->find(); ->find();
if ($find) { if ($find) {
if ($off_activity == 1) { if ($off_activity == 1) {
@ -82,13 +84,15 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
if ($off_activity == 0 && $user_ship == 5 && $find['top_cate_id'] == 15189) { if ($off_activity == 0 && $user_ship == 5 && $find['top_cate_id'] == 15189) {
$find['price'] = $find['cost']; $find['price'] = $find['cost'];
} }
$product_info=StoreProduct::where(['id' => $item['product_id']])->field($field)->find();
$item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2);
$this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2);
$item['batch'] = $find['batch']; $item['batch'] = $find['batch'];
$item['imgs'] = $find['image']; $item['imgs'] = $product_info['image'];
$item['price'] = $find['price']; $item['price'] = $find['price'];
$item['cost'] = $find['cost']; $item['cost'] = $find['cost'];
$item['goods_name'] = $find['store_name']; $item['goods_name'] = $product_info['store_name'];
$item['sku_name'] = $find['sku_name'];
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name');
} }
} }

View File

@ -7,6 +7,9 @@ use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
use app\common\model\store_order\StoreOrder; 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_attr_value\StoreProductAttrValue;
use app\common\model\store_product_unit\StoreProductUnit;
use Picqer\Barcode\BarcodeGeneratorPNG; use Picqer\Barcode\BarcodeGeneratorPNG;
/** /**
@ -52,22 +55,19 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface
->select() ->select()
->each(function ($item) { ->each(function ($item) {
$item['goods_list'] = StoreOrderCartInfo::where('oid', $item['id']) $item['goods_list'] = StoreOrderCartInfo::where('oid', $item['id'])
->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,cart_info')->limit(3)->select() ->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,attr_value_id,price')->limit(3)->select()
->each(function ($v) use ($item) { ->each(function ($v){
$v['store_name'] = ''; $find=StoreProduct::where('id', $v['product_id'])->field('store_name,image')->find();
$v['image'] = ''; $attr_value=StoreProductAttrValue::where('id',$v['attr_value_id'])->find();
$v['price'] = ''; $name='';
$v['unit_name']=''; if($attr_value){
$v['cart_num']=floatval($v['cart_num']); $name=StoreProductUnit::where('id',$attr_value['unit'])->value('name');
if(isset($v['cart_info'])){
// foreach( $v['cart_info'] as $k=>$vv){
$v['store_name'] =$v['cart_info']['name'];
$v['image'] =$v['cart_info'] ['image'];
$v['price'] = $v['cart_info']['price'];
$v['unit_name']=$v['cart_info']['unit_name']??'';
// }
} }
$v['store_name'] = $find['store_name'] ?? '';
$v['sku_name'] = $attr_value['sku_name'] ?? '';
$v['image'] = $find['image'] ?? '';
$v['price'] = $v['price']??'';
$v['unit_name']=$name;
}); });
$item['goods_count'] = count(explode(',', $item['cart_id'])); $item['goods_count'] = count(explode(',', $item['cart_id']));
if ($item['refund_reason_time']) { if ($item['refund_reason_time']) {

View File

@ -7,6 +7,9 @@ use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface; use app\common\lists\ListsSearchInterface;
use app\common\model\store_order\StoreOrder; 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_attr_value\StoreProductAttrValue;
use app\common\model\store_product_unit\StoreProductUnit;
use Picqer\Barcode\BarcodeGeneratorPNG; use Picqer\Barcode\BarcodeGeneratorPNG;
/** /**
@ -54,21 +57,19 @@ class StoreOrderList extends BaseAdminDataLists implements ListsSearchInterface
->select() ->select()
->each(function ($item) { ->each(function ($item) {
$item['goods_list'] = StoreOrderCartInfo::where('oid', $item['id']) $item['goods_list'] = StoreOrderCartInfo::where('oid', $item['id'])
->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,cart_info')->limit(3)->select() ->field('product_id,price,cart_num,verify_code,is_writeoff,writeoff_time,attr_value_id')->limit(3)->select()
->each(function ($v) use ($item) { ->each(function ($v) use ($item) {
$v['store_name'] = ''; $find=StoreProduct::where('id', $v['product_id'])->field('store_name,image')->find();
$v['image'] = ''; $attr_value=StoreProductAttrValue::where('id',$v['attr_value_id'])->find();
$v['price'] = ''; $name='';
$v['unit_name']=''; if($attr_value){
if(isset($v['cart_info'])){ $name=StoreProductUnit::where('id',$attr_value['unit'])->value('name');
// foreach( $v['cart_info'] as $k=>$vv){
$v['store_name'] =$v['cart_info']['name'];
$v['image'] =$v['cart_info'] ['image'];
$v['price'] = $v['cart_info']['price'];
$v['unit_name']=$v['cart_info']['unit_name']??'';
// }
} }
$v['store_name'] = $find['store_name'] ?? '';
$v['sku_name'] = $attr_value['sku_name'] ?? '';
$v['image'] = $find['image'] ?? '';
$v['price'] = $v['price']??'';
$v['unit_name']=$name??'';
}); });
$item['goods_count'] = count(explode(',', $item['cart_id'])); $item['goods_count'] = count(explode(',', $item['cart_id']));
if ($item['refund_reason_time']) { if ($item['refund_reason_time']) {

View File

@ -9,6 +9,8 @@ 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_attr_value\StoreProductAttrValue;
use app\common\model\store_product_unit\StoreProductUnit;
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;
@ -117,6 +119,10 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order($order) ->order($order)
->select()->each(function ($item) use ($tag, $off_activity, $user_ship) { ->select()->each(function ($item) use ($tag, $off_activity, $user_ship) {
$item['attr_value']=StoreProductAttrValue::where('product_id', $item['product_id'])->limit(6)->select()->each(function($items){
$items['unit_name']=StoreProductUnit::where('id', $items['unit'])->value('name');
return $items;
});
if ($off_activity == 0 && $user_ship == 5 && $item['top_cate_id'] == 15189) { if ($off_activity == 0 && $user_ship == 5 && $item['top_cate_id'] == 15189) {
$item['price'] = $item['cost']; $item['price'] = $item['cost'];
} }

View File

@ -39,6 +39,7 @@ class CartLogic extends BaseLogic
'uid' => $params['uid'], 'uid' => $params['uid'],
'store_id' => $params['store_id'], 'store_id' => $params['store_id'],
'product_id' => $params['product_id'], 'product_id' => $params['product_id'],
'attr_value_id' => $params['attr_value_id'],
'is_pay' => 0, 'is_pay' => 0,
'source' => $source, 'source' => $source,
])->field('id')->find(); ])->field('id')->find();
@ -55,6 +56,7 @@ class CartLogic extends BaseLogic
'staff_id' => $params['staff_id'] ?? 0, 'staff_id' => $params['staff_id'] ?? 0,
'cart_num' => $params['cart_num'], 'cart_num' => $params['cart_num'],
'is_new' => $params['is_new'] ?? 0, 'is_new' => $params['is_new'] ?? 0,
'attr_value_id' => $params['attr_value_id'] ?? 0,
'source' =>$source, 'source' =>$source,
]); ]);
} }
@ -91,13 +93,15 @@ class CartLogic extends BaseLogic
Cart::where([ Cart::where([
'uid' => $params['uid'], 'uid' => $params['uid'],
'store_id' => $params['store_id'], 'store_id' => $params['store_id'],
'product_id' => $params['product_id'] 'product_id' => $params['product_id'],
'attr_value_id' => $params['attr_value_id']
])->inc('cart_num')->update(); ])->inc('cart_num')->update();
}else{ }else{
Cart::where([ Cart::where([
'uid' => $params['uid'], 'uid' => $params['uid'],
'store_id' => $params['store_id'], 'store_id' => $params['store_id'],
'product_id' => $params['product_id'] 'product_id' => $params['product_id'],
'attr_value_id' => $params['attr_value_id']
])->update(['cart_num' => $params['cart_num']]); ])->update(['cart_num' => $params['cart_num']]);
} }
Db::commit(); Db::commit();

View File

@ -69,12 +69,12 @@ class OrderLogic extends BaseLogic
if (empty($params['store_id']) || $params['store_id'] <= 0) { if (empty($params['store_id']) || $params['store_id'] <= 0) {
throw new BusinessException('请选择门店'); throw new BusinessException('请选择门店');
} }
$source=0; $source = 0;
if (isset($params['source']) && $params['source'] >0) { if (isset($params['source']) && $params['source'] > 0) {
$source=$params['source']; $source = $params['source'];
} }
$where = ['is_pay' => 0]; $where = ['is_pay' => 0];
$cart_select = Cart::whereIn('id', $cartId)->where($where)->field('id,product_id,cart_num,source')->select()->toArray(); $cart_select = Cart::whereIn('id', $cartId)->where($where)->field('id,product_id,attr_value_id,cart_num,source')->select()->toArray();
if (empty($cart_select)) { if (empty($cart_select)) {
throw new BusinessException('购物车为空'); throw new BusinessException('购物车为空');
} }
@ -90,7 +90,7 @@ class OrderLogic extends BaseLogic
self::$fresh_price = 0; //生鲜金额 self::$fresh_price = 0; //生鲜金额
/** 计算价格 */ /** 计算价格 */
$off_activity = Config::where('name', 'off_activity')->value('value'); $off_activity = Config::where('name', 'off_activity')->value('value');
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose'; // $field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
foreach ($cart_select as $k => $v) { foreach ($cart_select as $k => $v) {
if($source==0){ if($source==0){
$source=$v['source']; $source=$v['source'];
@ -100,6 +100,7 @@ class OrderLogic extends BaseLogic
if (!$find) { if (!$find) {
throw new BusinessException('商品不存在'); throw new BusinessException('商品不存在');
} }
$product = StoreProduct::where(['id' => $find['product_id'],])->find();
if (convertNumber($v['cart_num']) == false) { if (convertNumber($v['cart_num']) == false) {
$is_bulk = StoreProductUnit::where('id', $find['unit'])->value('is_bulk'); $is_bulk = StoreProductUnit::where('id', $find['unit'])->value('is_bulk');
if ($is_bulk == 0) { if ($is_bulk == 0) {
@ -148,12 +149,12 @@ class OrderLogic extends BaseLogic
$cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本
$cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $price, 2); //订单支付金额 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $price, 2); //订单支付金额
$cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //商户价 $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2) ?? 0; //商户价
$cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2) ?? 0; //vip售价 $cart_select[$k]['vip_price'] = 0; //vip售价
if ($cart_select[$k]['total_price'] > $cart_select[$k]['pay_price']) { if ($cart_select[$k]['total_price'] > $cart_select[$k]['pay_price']) {
$deduction_price = bcsub($cart_select[$k]['total_price'], $cart_select[$k]['pay_price'], 2); $deduction_price = bcsub($cart_select[$k]['total_price'], $cart_select[$k]['pay_price'], 2);
$cart_select[$k]['deduction_price'] = $deduction_price; //抵扣金额 $cart_select[$k]['deduction_price'] = $deduction_price; //抵扣金额
} }
$cart_select[$k]['product_id'] = $find['id']; $cart_select[$k]['product_id'] = $product['id'];
$cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['old_cart_id'] = $v['id'];
$cart_select[$k]['cart_num'] = floatval($v['cart_num']); $cart_select[$k]['cart_num'] = floatval($v['cart_num']);
$cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? '';
@ -172,12 +173,14 @@ class OrderLogic extends BaseLogic
// } // }
// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] ); // d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] );
$cartInfo = $cart_select[$k]; $cartInfo = $cart_select[$k];
$cartInfo['name'] = $find['store_name']; $cartInfo['name'] = $product['store_name'];
$cartInfo['image'] = $find['image']; $cartInfo['sku_name'] = $find['sku_name'];
$cartInfo['image'] = $product['image'];
$cart_select[$k]['cart_info'] = json_encode($cartInfo); $cart_select[$k]['cart_info'] = json_encode($cartInfo);
//理论上每笔都是拆分了 //理论上每笔都是拆分了
$cart_select[$k]['name'] = $find['store_name']; $cart_select[$k]['name'] = $product['store_name'];
$cart_select[$k]['imgs'] = $find['image']; $cart_select[$k]['sku_name'] = $find['sku_name'];
$cart_select[$k]['imgs'] = $product['image'];
$cart_select[$k]['store_id'] = $params['store_id'] ?? 0; $cart_select[$k]['store_id'] = $params['store_id'] ?? 0;
$cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name'); $cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name');
$cart_select[$k]['total_price'] = $cart_select[$k]['pay_price']; $cart_select[$k]['total_price'] = $cart_select[$k]['pay_price'];
@ -262,6 +265,7 @@ class OrderLogic extends BaseLogic
$alert = '当前时间超过配送截止时间16:00,若下单,物品送达时间为' . date('Y-m-d', strtotime($currentDate . '+2 days')); $alert = '当前时间超过配送截止时间16:00,若下单,物品送达时间为' . date('Y-m-d', strtotime($currentDate . '+2 days'));
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
d($e);
throw new BusinessException($e->getMessage()); throw new BusinessException($e->getMessage());
} }
return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store'], 'alert' => $alert]; return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store'], 'alert' => $alert];
@ -497,13 +501,15 @@ class OrderLogic extends BaseLogic
if ($find) { if ($find) {
$find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id']) $find['goods_list'] = StoreOrderCartInfo::where('oid', $find['id'])
->field('product_id,cart_num nums,store_id')->select()->each(function ($item) use ($find) { ->field('product_id,cart_num nums,store_id,attr_value_id,price')->select()->each(function ($item) {
$find = StoreProduct::where('id', $item['product_id'])->withTrashed()->find(); $find = StoreProductAttrValue::where('id', $item['attr_value_id'])->find();
$product = StoreProduct::where('id', $item['product_id'])->withTrashed()->find();
$item['store_name'] = $find['store_name']; $item['store_name'] = $product['store_name'];
$item['sku_name'] = $find['sku_name'];
$item['nums'] = floatval($item['nums']); $item['nums'] = floatval($item['nums']);
$item['image'] = $find['image']; $item['image'] = $product['image'];
$item['price'] = $find['price']; $item['price'] = $item['price'];
$item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? ''; $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? '';
$item['msg'] = '预计48小时发货'; $item['msg'] = '预计48小时发货';
return $item; return $item;
@ -521,21 +527,21 @@ class OrderLogic extends BaseLogic
$find['verify_base64'] = 'data:image/png;base64,' . base64_encode($tmpFilename); $find['verify_base64'] = 'data:image/png;base64,' . base64_encode($tmpFilename);
} }
//处理返回最近的店铺 //处理返回最近的店铺
if ($param['lat'] && $param['long']) { // if ($param['lat'] && $param['long']) {
$storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray(); // $storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray();
$nearestStore = null; // $nearestStore = null;
$minDistance = PHP_FLOAT_MAX; // $minDistance = PHP_FLOAT_MAX;
foreach ($storeAll as $value) { // foreach ($storeAll as $value) {
$value['distance'] = haversineDistance($value['latitude'], $value['longitude'], $param['lat'], $param['long']); // $value['distance'] = haversineDistance($value['latitude'], $value['longitude'], $param['lat'], $param['long']);
if ($value['distance'] < $minDistance) { // if ($value['distance'] < $minDistance) {
$minDistance = $value['distance']; // $minDistance = $value['distance'];
$nearestStore = $value; // $nearestStore = $value;
} // }
} // }
if ($nearestStore) { // if ($nearestStore) {
$find['near_store'] = $nearestStore; // $find['near_store'] = $nearestStore;
} // }
} // }
} }
return $find; return $find;
} }

View File

@ -7,6 +7,7 @@ use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct; use app\common\model\store_finance_flow_product\StoreFinanceFlowProduct;
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\user\User; use app\common\model\user\User;
use PDO; use PDO;
use support\Log; use support\Log;
@ -23,23 +24,25 @@ class CommissionProductLogic extends BaseLogic
*/ */
function calculate_product_flow($find, $order, $village_uid = 0, $brigade_uid = 0, $user_ship = 0, $spread_user_ship = 0) function calculate_product_flow($find, $order, $village_uid = 0, $brigade_uid = 0, $user_ship = 0, $spread_user_ship = 0)
{ {
$attrValue = StoreProductAttrValue::where('id', $find['attr_value_id'])->find();
$product = StoreProduct::where('id', $find['product_id'])->find(); $product = StoreProduct::where('id', $find['product_id'])->find();
if ($product) { if ($attrValue) {
if ($product['product_type'] == 4) { if ($product['product_type'] == 4) {
$this->c($find, $order, $village_uid, $brigade_uid, $user_ship, $product); $this->c($find, $order, $village_uid, $brigade_uid, $user_ship, $attrValue);
return true; return true;
} else { } else {
if ($user_ship == 5) { if ($user_ship == 5) {
$top_cate_id = $product['top_cate_id']; $top_cate_id = $product['top_cate_id'];
if ($top_cate_id == 15189) { if ($top_cate_id == 15189) {
$this->b($find, $order, $product, $user_ship); $this->b($find, $order, $attrValue, $user_ship);
return true; return true;
} }
} elseif ($user_ship == 0) { } elseif ($user_ship == 0) {
$this->b($find, $order, $product, $user_ship); $this->b($find, $order, $attrValue, $user_ship);
return true; return true;
} else { } else {
$this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $product); $this->a($find, $order, $village_uid, $brigade_uid, $user_ship, $attrValue);
} }
} }
@ -93,6 +96,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => $nickname, 'nickname' => $nickname,
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'price' => $price, 'price' => $price,
'other_uid' => $uid, 'other_uid' => $uid,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -111,6 +115,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => $nickname, 'nickname' => $nickname,
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => $uid, 'other_uid' => $uid,
'price' => $price, 'price' => $price,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -136,6 +141,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售队长', 'nickname' => '零售队长',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -152,6 +158,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售村长', 'nickname' => '零售村长',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $brigade_number, 'total_price' => $brigade_number,
@ -168,6 +175,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售门店', 'nickname' => '零售门店',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $total_price, 'total_price' => $total_price,
@ -184,6 +192,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售平台', 'nickname' => '零售平台',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -200,6 +209,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '零售消耗', 'nickname' => '零售消耗',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -249,6 +259,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价队长预留', 'nickname' => '商户价队长预留',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -265,6 +276,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价村长预留', 'nickname' => '商户价村长预留',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $brigade_number, 'total_price' => $brigade_number,
@ -281,6 +293,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价门店', 'nickname' => '商户价门店',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $total_price, 'total_price' => $total_price,
@ -297,6 +310,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价平台', 'nickname' => '商户价平台',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -313,6 +327,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '商户价消耗', 'nickname' => '商户价消耗',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $purchase_price, 'total_price' => $purchase_price,
@ -355,6 +370,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动队长', 'nickname' => '活动队长',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => $brigade_uid, 'other_uid' => $brigade_uid,
'price' => $price, 'price' => $price,
'total_price' => $total_price, 'total_price' => $total_price,
@ -371,6 +387,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动村长', 'nickname' => '活动村长',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => $village_uid, 'other_uid' => $village_uid,
'price' => $price, 'price' => $price,
'total_price' => $brigade_number, 'total_price' => $brigade_number,
@ -387,6 +404,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动门店', 'nickname' => '活动门店',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $store_number, 'total_price' => $store_number,
@ -403,6 +421,7 @@ class CommissionProductLogic extends BaseLogic
'nickname' => '活动平台', 'nickname' => '活动平台',
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'product_id' => $find['product_id'], 'product_id' => $find['product_id'],
'attr_value_id' => $find['attr_value_id'],
'other_uid' => 0, 'other_uid' => 0,
'price' => $price, 'price' => $price,
'total_price' => $platform_number, 'total_price' => $platform_number,

View File

@ -682,7 +682,7 @@ class PayNotifyLogic extends BaseLogic
} }
try { try {
$info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,product_id,cart_num')->select(); $info = StoreOrderCartInfo::where('oid', $order['id'])->field('store_id,attr_value_id,product_id,cart_num')->select();
$comm = new CommissionProductLogic(); $comm = new CommissionProductLogic();
foreach ($info as $k => $v) { foreach ($info as $k => $v) {
$comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship); $comm->calculate_product_flow($v, $order, $village_uid, $brigade_uid, $user_ship);