Compare commits

...

28 Commits

Author SHA1 Message Date
mkm
bb93f8f238 Merge pull request 'dev' (#31) from dev into main
Reviewed-on: #31
2025-04-28 11:56:35 +08:00
f3b547b835 修改仓库商品查询的错误 2025-04-28 11:55:17 +08:00
mkm
bcbcd626c3 1 2025-04-24 18:36:25 +08:00
mkm
7e11bf3bb2 1 2025-04-24 18:36:14 +08:00
mkm
03af4a589a Merge pull request 'feat(admin): 为商品列表添加图片字段' (#30) from dev into main
Reviewed-on: #30
2025-04-24 15:58:33 +08:00
mkm
13a575ca0c feat(admin): 为商品列表添加图片字段
- 在 StoreProductLists 类中添加了 'image' => '图片' 字段
- 此修改使得商品列表能够显示商品图片,提高列表的可读性和直观性
2025-04-24 15:57:54 +08:00
mkm
fb3b626970 Merge pull request '添加导入商品采购价' (#29) from dev into main
Reviewed-on: #29
2025-04-23 15:22:57 +08:00
959978f746 添加导入商品采购价 2025-04-23 15:22:27 +08:00
mkm
fbba725ce7 Merge pull request '同步商品价格比例' (#28) from dev into main
Reviewed-on: #28
2025-04-18 18:00:39 +08:00
11687aa3d4 同步商品价格比例 2025-04-18 18:00:11 +08:00
mkm
a08d11f69c Merge pull request '同步商品价格比例' (#27) from dev into main
Reviewed-on: #27
2025-04-18 17:50:28 +08:00
49d534a48d 同步商品价格比例 2025-04-18 17:49:43 +08:00
mkm
0a046509dd Merge pull request '添加商品价格更新时间' (#26) from dev into main
Reviewed-on: #26
2025-04-18 17:30:15 +08:00
970a7f07c5 添加商品价格更新时间 2025-04-18 17:22:06 +08:00
mkm
848dbf2c80 Merge pull request 'dev' (#25) from dev into main
Reviewed-on: #25
2025-04-18 16:33:03 +08:00
463da3cef1 Merge branch 'dev' of https://gitea.lihaink.cn/mkm/multi-store into dev 2025-04-18 16:32:27 +08:00
5e35acdc39 修改商品零售价格的错误 2025-04-18 16:31:14 +08:00
mkm
58b70c53f8 Merge pull request 'refactor(xlsx): 调整订单供货出库表格的列标题和数据填充逻辑' (#24) from dev into main
Reviewed-on: #24
2025-04-18 15:20:36 +08:00
mkm
b9e34a94d9 refactor(xlsx): 调整订单供货出库表格的列标题和数据填充逻辑
- 将"出库单价"、"出库总价"、"供货价"、"供货总价"等列
2025-04-18 15:19:00 +08:00
mkm
6d67d00c63 Merge pull request 'feat(admin): 仓库产品列表增加分类搜索功能' (#23) from dev into main
Reviewed-on: #23
2025-04-18 13:48:42 +08:00
mkm
3976af97f1 feat(admin): 仓库产品列表增加分类搜索功能
- 添加了根据分类 ID 进行搜索的功能
- 如果请求中包含 'class_all' 参数,则在查询中加入相应的条件
- 通过 StoreProduct 模型获取符合条件的产品 ID 列表
- 如果没有符合条件的产品,则返回空数组
2025-04-18 13:47:42 +08:00
mkm
a89f7fbe28 Merge pull request '调整了查询条件,增加了对class_all参数的处理。' (#22) from dev into main
Reviewed-on: #22
2025-04-18 12:07:45 +08:00
bb039fcf5e 调整了查询条件,增加了对class_all参数的处理。 2025-04-18 12:06:16 +08:00
mkm
b461c79b53 Merge pull request '修改商品列表搜索' (#21) from dev into main
Reviewed-on: #21
2025-04-17 09:57:21 +08:00
197a31668e 修改商品列表搜索 2025-04-17 09:57:07 +08:00
mkm
b3dee9c166 Merge pull request '修改商品列表搜索' (#20) from dev into main
Reviewed-on: #20
2025-04-17 09:44:42 +08:00
6dcd228e3c 修改商品列表搜索 2025-04-17 09:44:17 +08:00
mkm
fb4d528070 Merge pull request '更新 app/admin/logic/store_product/StoreProductLogic.php' (#19) from mkm-patch-2 into main
Reviewed-on: #19
2025-04-16 18:20:31 +08:00
8 changed files with 184 additions and 33 deletions

View File

@ -6,6 +6,7 @@ use app\admin\logic\beforehand_order_cart_info\BeforehandOrderCartInfoLogic;
use app\admin\logic\product_source_link_info\ProductSourceLinkInfoLogic;
use app\admin\logic\inventory_transfer_order\InventoryTransferOrderLogic;
use app\admin\logic\store_product\StoreProductLogic;
use app\admin\logic\store_product_price\StoreProductPriceLogic;
use app\admin\service\ProductPriceService;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo;
@ -31,10 +32,41 @@ use think\facade\Db;
class LocalController extends BaseAdminController
{
public $notNeedLogin = ['activityPrice', 'searchProduct', 'setPrice', 'index', 'updateProductPriceList', 'importOrder', 'warehousing', 'outbound', 'syncPrice', 'importProduct'];
public $notNeedLogin = ['importPrice', 'searchProduct', 'setPrice', 'index', 'updateProductPriceList', 'importOrder', 'warehousing', 'outbound', 'syncPrice', 'importProduct'];
public $ids = [1829, 1828, 1827, 1826, 1825, 1824, 1823, 1821, 1820, 1814, 1813, 1811, 1810, 1809, 1808, 1807, 1806, 1800, 1799, 1798, 1796, 1795, 1794, 1793, 1792, 1791, 1790, 1789, 1788, 1787, 1786, 1785, 1784, 1783, 1782, 1781, 1780, 1779, 1778, 1777, 1776, 1775, 1774, 1773, 1772, 1771, 1770, 1768, 1765, 1764, 1763, 1762, 1761, 1760, 1759, 1758, 1757, 1756, 1755, 1754, 1753, 1752, 1751, 1750, 1749, 1748, 1747, 1746, 1745, 1744, 1743, 1742, 1741, 1740, 1739, 1738, 1737, 1736, 1735, 1733, 1732, 1731, 1730, 1729, 1728, 1727, 1726, 1725, 1724, 1723, 1722, 1720, 1719, 1718, 1717, 1716, 1715, 1714, 1713, 1712, 1711, 1710, 1709, 1708, 1707, 1706, 1705, 1704, 1703, 1701, 1700, 1699, 1698, 1697, 1696, 1695, 1694, 1693, 1692, 1691, 1690, 1689, 1688, 1687, 1686, 1685, 1684, 1683, 1682, 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, 1668, 1667, 1666, 1665, 1664, 1663, 1660, 1659, 1658, 1657, 1656, 1655, 1654, 1652, 1651, 1650, 1649, 1648, 1647, 1646, 1645, 1644, 1643, 1642, 1641, 1640, 1639, 1638, 1637, 1636, 1635, 1634, 1633, 1632, 1631, 1630, 1629, 1628, 1627, 1626, 1623, 1622];
public function importPrice()
{
$file = $this->request->file('file');
$reader = IOFactory::createReader('Xlsx');
$spreadsheet = $reader->load($file->getRealPath());
$data = $spreadsheet->getActiveSheet()->toArray();
foreach ($data as $k => $v) {
if ($k < 1) {
continue;
}
$productId = $v[0];
$purchasePrice = $v[12];
$product = StoreProduct::where('id', $productId)->find();
if (empty($product)) {
continue;
}
$params = [
'product_id' => $productId,
'purchase_price' => $purchasePrice,
'status' => 1,
];
$productService = new ProductPriceService();
$productPriceRate = $productService->getProductPriceRate($productId);
if (!empty($productPriceRate)) {
$priceArray = $productService->setProductPrice($params['purchase_price'], $productPriceRate);
$params = array_merge($params, $priceArray);
}
StoreProductPriceLogic::add($params);
}
}
public function importProduct()
{
$file = $this->request->file('file');

View File

@ -74,7 +74,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
$class_all = $this->request->get('class_all');
if ($class_all) {
if (count($class_all) == 1) {
$query->where('top_category_id', $class_all[0]);
$query->where('top_cate_id', $class_all[0]);
} elseif (count($class_all) == 2) {
$query->where(function ($query) use ($class_all) {
$query->where('two_cate_id', $class_all[1])->whereOr('cate_id', $class_all[1]);
@ -98,6 +98,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
$list = $query->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) use ($is_warehouse, $userShip, $order_type, $is_true) {
$item['price_update_time'] = !empty($item['price_update_time']) ? date('Y-m-d H:i:s', $item['price_update_time']) : '';
$item['product_id'] = $item['id'];
$item['bar_code_two'] = '';
if (in_array($item['unit'], [2, 21])) {
@ -185,7 +186,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
$class_all = $this->request->get('class_all');
if ($class_all) {
if (count($class_all) == 1) {
$query->where('top_category_id', $class_all[0]);
$query->where('top_cate_id', $class_all[0]);
} elseif (count($class_all) == 2) {
$query->where(function ($query) use ($class_all) {
$query->where('two_cate_id', $class_all[1])->whereOr('cate_id', $class_all[1]);
@ -231,6 +232,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
{
$data = [
'id' => '商品id',
'image' => '图片',
'store_name' => '商品名称',
'product_type_name' => '商品类型',
'cate_name' => '分类',

View File

@ -64,9 +64,14 @@ class WarehouseProductStoregeLists extends BaseAdminDataLists implements ListsSe
*/
public function lists(): array
{
$where = [];
if ($this->request->get('store_name')) {
$this->store_name = $this->request->get('store_name');
$ids = StoreProduct::where('store_name', 'like', '%' . $this->request->get('store_name') . '%')->column('id');
$where[] = ['store_name', 'like', '%' . $this->request->get('store_name') . '%'];
if($this->request->get('class_all')){
$where[] = ['top_cate_id', 'in', $this->request->get('class_all')];
}
$ids = StoreProduct::where($where)->column('id');
if ($ids) {
$this->searchWhere[] = ['product_id', 'in', $ids];
$this->ids = $ids;
@ -84,6 +89,16 @@ class WarehouseProductStoregeLists extends BaseAdminDataLists implements ListsSe
return [];
}
}
if($this->request->get('class_all')){
$where[] = ['top_cate_id', 'in', $this->request->get('class_all')];
}
$ids = StoreProduct::where($where)->column('id');
if ($ids) {
$this->searchWhere[] = ['product_id', 'in', $ids];
$this->ids = $ids;
} else {
return [];
}
return WarehouseProductStorege::where($this->searchWhere)
->field(['id','is_verify','warehouse_id', 'product_id', 'nums', 'price', 'total_price', 'status'])
->limit($this->limitOffset, $this->limitLength)

View File

@ -39,6 +39,20 @@ class StoreProductPriceLogic extends BaseLogic
try {
$model = StoreProductPrice::create($params);
$storeProductPriceList = StoreProductPriceList::where('product_id', $model['product_id'])->find();
$attrs = [
'supply_rate' => $params['purchase_lv'] * 100,
'merchant_rate' => $params['cost_lv'] * 100,
'vip_rate' => $params['vip_lv'] * 100,
'price_rate' => $params['price_lv'] * 100,
];
if (empty($storeProductPriceList)) {
$attrs['product_id'] = $model['product_id'];
StoreProductPriceList::create($attrs);
} else {
StoreProductPriceList::where('product_id', $model['product_id'])->update($attrs);
}
$productPrice = StoreProduct::where('id', $model['product_id'])->value('vip_price');
if ($productPrice != $model['vip_price']) {
SqlChannelPriceLog($model['product_id'], 43, $productPrice, $model['vip_price']);
@ -49,7 +63,8 @@ class StoreProductPriceLogic extends BaseLogic
'cost' => $model['cost'],
'vip_price' => $model['vip_price'],
'price' => $model['price'],
'ot_price' => $model['price']
'ot_price' => $model['price'],
'price_update_time' => time(),
]);
StoreBranchProduct::where('product_id', $model['product_id'])->update([
'purchase' => $model['purchase'],
@ -128,14 +143,15 @@ class StoreProductPriceLogic extends BaseLogic
'purchase' => $find['purchase'],
'cost' => $find['cost'],
'vip_price' => $find['vip_price'],
'price' => $find['vip_price'],
'ot_price' => $find['price']
'price' => $find['price'],
'ot_price' => $find['price'],
'price_update_time' => time(),
]);
StoreBranchProduct::where('product_id', $find['product_id'])->update([
'purchase' => $find['purchase'],
'cost' => $find['cost'],
'vip_price' => $find['vip_price'],
'price' => $find['vip_price'],
'price' => $find['price'],
'ot_price' => $find['price']
]);
@ -209,14 +225,15 @@ class StoreProductPriceLogic extends BaseLogic
'purchase' => $find['purchase'] ?? 0,
'cost' => $find['cost'] ?? 0,
'vip_price' => $find['vip_price'] ?? 0,
'price' => $find['vip_price'] ?? 0,
'price' => $find['price'] ?? 0,
'ot_price' => $find['price'] ?? 0,
'price_update_time' => time(),
]);
StoreBranchProduct::where('product_id', $find['product_id'])->update([
'purchase' => $find['purchase'] ?? 0,
'cost' => $find['cost'] ?? 0,
'vip_price' => $find['vip_price'] ?? 0,
'price' => $find['vip_price'] ?? 0,
'price' => $find['price'] ?? 0,
'ot_price' => $find['price'] ?? 0,
]);
}

View File

@ -25,12 +25,11 @@ class ProductPriceService
$result['vip_price'] = bcmul($result['purchase'], $result['vip_lv'], 2);
$result['price_lv'] = bcdiv($productPriceRate['price_rate'], 100, 2);
$result['price'] = bcmul($result['purchase'], $result['price_lv'], 2);
// 暂时不处理零售价,零售价使用会员价
// $lastNum = substr($result['price'], -1);
// if ($lastNum > 0) {
// $result['price'] = ceil($result['price'] * 10);
// $result['price'] = bcdiv($result['price'], 10, 2);
// }
$lastNum = substr($result['price'], -1);
if ($lastNum > 0) {
$result['price'] = ceil($result['price'] * 10);
$result['price'] = bcdiv($result['price'], 10, 2);
}
$lastNum = substr($result['vip_price'], -1);
if ($lastNum > 0) {
$result['vip_price'] = ceil($result['vip_price'] * 10);

View File

@ -61,14 +61,100 @@ class IndexController extends BaseApiController
public function index()
{
$arr= Db::name('ceshi_copy_copy')->select();
foreach ($arr as $k => $v) {
$find=Db::name('ceshi_copy')->where('product_id',$v['product_id'])->find();
if($find){
Db::name('ceshi_copy_copy')->where('id',$v['id'])->update(['price_two'=>bcadd($v['price'],bcmul($v['price'], $find['purchase'], 2),2),'purchase'=>bcadd($v['price'],bcmul($v['price'], $find['price'], 2),2)]);
}
$arr=Db::connect('demo')->name('sheet1')->where('name','<>','')->limit(2)->select();
foreach ($arr as $k => $v) {
$find= Db::connect('demo')->name('store_product_unit')->where('value',$v['unit_name'])->find();
if(!$find){
$aa=['mer_id'=>7,'type'=>1,'value'=>$v['unit_name'],'status'=>1];
$id=Db::connect('demo')->name('store_product_unit')->insertGetId($aa);
}
$data=[
'mer_id'=>7,
'store_name'=>$v['name'],
'store_info'=>$v['name_tow'],
'cate_id'=>0,
'unit_name'=>$v['unit_name'],
'price'=>$v['price'],
'cost'=>$v['cost'],
'ot_price'=>0,
'image'=>$v['image'],
'slider_image'=>$v['image'],
'mer_svip_status'=>1,
'svip_price_type'=>2,
'svip_price'=>$v['cost'],
];
$product_id=Db::connect('demo')->name('store_product')->insertGetId($data);
$data2=[
'mer_id'=>7,
'product_id'=>$product_id,
'store_name'=>$v['name'],
'ot_price'=>0,
'image'=>$v['image'],
];
Db::connect('demo')->name('store_spu')->insert($data2);
$sku='';
$unique=substr(md5($sku . $product_id), 12, 10) . 0;
$data4=[
'product_id'=>$product_id,
'detail'=>'""',
'image'=>$v['image'],
'price'=>$v['price'],
'unique'=>$unique,
'svip_price'=>$v['cost'],
];
$vid=Db::connect('demo')->name('store_product_attr_value')->insertGetId($data4);
$json=[
'attr'=>[],
'attrValue'=>[
'value_id'=>$vid,
'product_id'=>$product_id,
'detail'=>'',
'sku'=>'',
'stock'=>0,
'brand_id'=>0,
'sales'>0,
'image'=>$v['image'],
'bar_code'=>'',
'cost'=>0,
'ot_price'=>0,
'price'=>$v['price'],
'svip_price'=>$v['cost'],
'weight'=>0,
'volume'=>0,
'type'=>0,
'extension_one'=>0,
'extension_two'=>0,
'unique'=>$unique,
'library_id'=>0,
'bar_code_number'=>'',
'is_default_select'=>0,
'is_show'=>1,
'productCdkey'=>[],
'select'=>1,
'list'=>[]
],
'params'=>[]
];
$data3=[
'product_id'=>$product_id,
'change_time'=>time(),
'result'=>json_encode($json),
];
Db::connect('demo')->name('store_product_attr_result')->insert($data3);
$data5=[
'product_id'=>$product_id,
'content'=>'',
'type'=>0,
];
Db::connect('demo')->name('store_product_content')->insert($data5);
}
d($arr);
d(1);
$arr = Db::name('ceshi_copy')->select();
foreach ($arr as $k => $v) {

View File

@ -48,10 +48,10 @@ class OrderSupplyOutbound
$sheet->setCellValue('B3', '品名');
$sheet->setCellValue('C3', '单位');
$sheet->setCellValue('D3', '数量');
$sheet->setCellValue('E3', '出库单价');
$sheet->setCellValue('F3', '出库总价');
$sheet->setCellValue('G3', '供货价');
$sheet->setCellValue('H3', '供货总价');
$sheet->setCellValue('E3', '进货单价');
$sheet->setCellValue('F3', '进货总价');
$sheet->setCellValue('G3', '零售单价');
$sheet->setCellValue('H3', '零售总价');
$sheet->setCellValue('I3', '利润');
$sheet->setCellValue('J3', '备注');
@ -71,10 +71,10 @@ class OrderSupplyOutbound
$sheet->setCellValue('B' . ($k + 4), $v['store_name']);
$sheet->setCellValue('C' . ($k + 4), $v['unit_name']);
$sheet->setCellValue('D' . ($k + 4), $v['nums']);
$sheet->setCellValue('E' . ($k + 4), $v['price']);
$sheet->setCellValue('F' . ($k + 4), $v['total_price']);
$sheet->setCellValue('G' . ($k + 4), $v['purchase']);
$sheet->setCellValue('H' . ($k + 4), $v['pay_price']);
$sheet->setCellValue('E' . ($k + 4), $v['purchase']);
$sheet->setCellValue('F' . ($k + 4), $v['pay_price']);
$sheet->setCellValue('G' . ($k + 4), $v['price']);
$sheet->setCellValue('H' . ($k + 4), $v['total_price']);
$sheet->setCellValue('I' . ($k + 4), $v['profit']);
$sheet->mergeCells('J' . ($k + 4) . ':K' . $k + 4);
$sheet->setCellValue('J' . ($k + 4), $v['mark']);
@ -84,7 +84,7 @@ class OrderSupplyOutbound
$sheet->setCellValue('A' . ($count + 4),'合计');
$sheet->setCellValue('B' . ($count + 4),$count);
$sheet->setCellValue('J' . ($count + 4),$order['group_title']??'');
// $sheet->setCellValue('J' . ($count + 4),$order['group_title']??'');
$sheet->setCellValue('A' . ($count + 5),'累计接单:');
$sheet->setCellValue('C' . ($count + 5),'预收金额:');

View File

@ -55,7 +55,7 @@ return [
// 数据库编码默认采用utf8
'charset' => 'utf8mb4',
// 数据库表前缀
'prefix' => 'la_',
'prefix' => 'eb_',
],
],
];