This commit is contained in:
lewis 2025-01-09 14:56:52 +08:00
commit 8595617908
5 changed files with 41 additions and 7 deletions

View File

@ -51,7 +51,7 @@ 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,refund_num,refund_amount')->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')->withTrashed()->find(); $find=StoreProduct::where('id',$item['product_id'])->field('image,unit,store_name,store_info')->withTrashed()->find();
$item['nickname']='无'; $item['nickname']='无';
@ -136,6 +136,8 @@ class StoreOrderCartInfoLists extends BaseAdminDataLists implements ListsSearchI
'cart_num' => '数量', 'cart_num' => '数量',
'price' => '单价', 'price' => '单价',
'total_price' => '总价', 'total_price' => '总价',
'refund_num' => '退款数量',
'refund_amount' => '退款金额',
'nickname' => '用户', 'nickname' => '用户',
'mobile' => '手机', 'mobile' => '手机',
'create_time' => '时间', 'create_time' => '时间',

View File

@ -70,9 +70,9 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
$this->searchWhere[] = ['status', '>=', 0]; $this->searchWhere[] = ['status', '>=', 0];
$query = StoreOrderCartInfo::where($this->searchWhere); $query = StoreOrderCartInfo::where($this->searchWhere);
if ($is_group == 1) { if ($is_group == 1) {
$query->field('store_id,product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num')->group(['store_id', 'product_id']); $query->field('store_id,product_id,price,SUM(total_price) as total_price,SUM(cart_num) as cart_num,SUM(refund_num) as refund_num,SUM(refund_amount) as refund_amount')->group(['store_id', 'product_id']);
} else { } else {
$query->field('store_id,product_id,price,total_price,cart_num,create_time,uid,oid'); $query->field('store_id,product_id,price,total_price,cart_num,create_time,uid,oid,refund_num,refund_amount');
} }
return $query->limit($this->limitOffset, $this->limitLength) return $query->limit($this->limitOffset, $this->limitLength)
->select()->each(function ($item) use($is_group,$export){ ->select()->each(function ($item) use($is_group,$export){
@ -167,6 +167,8 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
'cart_num' => '数量', 'cart_num' => '数量',
'price' => '单价', 'price' => '单价',
'total_price' => '总价', 'total_price' => '总价',
'refund_num' => '退款数量',
'refund_amount' => '退款金额',
]; ];
} else { } else {
$data = [ $data = [
@ -180,6 +182,8 @@ class StoreOrderCartInfoTwoLists extends BaseAdminDataLists implements ListsSear
'cart_num' => '数量', 'cart_num' => '数量',
'price' => '单价', 'price' => '单价',
'total_price' => '总价', 'total_price' => '总价',
'refund_num' => '退款数量',
'refund_amount' => '退款金额',
'nickname' => '用户', 'nickname' => '用户',
'mobile' => '手机', 'mobile' => '手机',
'create_time' => '时间', 'create_time' => '时间',

View File

@ -66,6 +66,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
} }
} }
$is_warehouse=$this->request->get('is_warehouse',0); $is_warehouse=$this->request->get('is_warehouse',0);
$order_type=$this->request->get('order_type',0);
$userShip = 0; $userShip = 0;
if (!empty($this->params['user_id'])) { if (!empty($this->params['user_id'])) {
$userShip = User::where('id', $this->params['user_id'])->value('user_ship'); $userShip = User::where('id', $this->params['user_id'])->value('user_ship');
@ -87,7 +88,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
} }
$list = $query->limit($this->limitOffset, $this->limitLength) $list = $query->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($item) use($is_warehouse, $userShip) { ->select()->each(function ($item) use($is_warehouse, $userShip,$order_type) {
$item['product_id'] = $item['id']; $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])) {
@ -142,6 +143,15 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
}else{ }else{
$item['status_msg']='下架|不常用|是否有替换'; $item['status_msg']='下架|不常用|是否有替换';
} }
if ($order_type == 2) {
$price=StoreProductGroupPrice::where('group_id', 42)->where('product_id', $item['product_id'])->value('price');
if($price>0){
$item['price'] = $price;
$item['store_name'] = $item['store_name'].'|活动价';
}
}
return $item; return $item;
})?->toArray(); })?->toArray();
// if ($userShip > 0 && $userShip != 4) { // if ($userShip > 0 && $userShip != 4) {

View File

@ -3,6 +3,7 @@
namespace app\api\logic; namespace app\api\logic;
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_product\StoreProduct; use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_group_price\StoreProductGroupPrice; use app\common\model\store_product_group_price\StoreProductGroupPrice;
use think\facade\Db; use think\facade\Db;
@ -67,6 +68,23 @@ class DemoLogic extends BaseLogic
} else { } else {
StoreProductGroupPrice::insert(['product_id' => $v['product_id'], 'group_id' => 20, 'price' => bcadd($v['price4'], 0, 2), 'price_type' => 3, 'base_rate' => bcadd(bcmul($v['lv4'], 100), 100, 2)]); StoreProductGroupPrice::insert(['product_id' => $v['product_id'], 'group_id' => 20, 'price' => bcadd($v['price4'], 0, 2), 'price_type' => 3, 'base_rate' => bcadd(bcmul($v['lv4'], 100), 100, 2)]);
} }
//活动价
$find42 = StoreProductGroupPrice::where('product_id', $v['product_id'])->where('group_id', 42)->find();
if ($find42) {
$find42->save(['price' => bcadd($v['price4'], 0, 2)]);
} else {
StoreProductGroupPrice::insert(['product_id' => $v['product_id'], 'group_id' => 42, 'price' => bcadd($v['price9'], 0, 2), 'price_type' => 3, 'base_rate' =>0]);
}
}
}
public static function test2($store_id, $srr)
{
foreach ($srr as $k => $v) {
$find = StoreBranchProduct::where('store_id', $store_id)->where('product_id', $v['product_id'])->find();
$find->stock = bcsub($find->stock, $v['cart_num'], 2);
$find->save();
SqlChannelLog('StoreBranchProduct', $find['id'], $v['cart_num'], -1, Request()->url(), 1);
} }
} }
} }

View File

@ -139,7 +139,7 @@ class StoreFinanceFlowLogic extends BaseLogic
$find = User::where('id', $uid)->find(); $find = User::where('id', $uid)->find();
$capitalFlowDao = new CapitalFlowLogic($find); $capitalFlowDao = new CapitalFlowLogic($find);
$capitalFlowDao->userIncome('system_balance_add', 'order', $order_id, $money); $capitalFlowDao->userIncome('system_balance_add', 'order', $order_id, $money);
$find->inc('now_money', $money)->update(); User::where('id', $uid)->inc('now_money', $money)->update();
} }
/** /**
* 核销后更新门店余额 * 核销后更新门店余额