Compare commits
28 Commits
mkm-patch-
...
main
Author | SHA1 | Date | |
---|---|---|---|
bb93f8f238 | |||
f3b547b835 | |||
bcbcd626c3 | |||
7e11bf3bb2 | |||
03af4a589a | |||
13a575ca0c | |||
fb3b626970 | |||
959978f746 | |||
fbba725ce7 | |||
11687aa3d4 | |||
a08d11f69c | |||
49d534a48d | |||
0a046509dd | |||
970a7f07c5 | |||
848dbf2c80 | |||
463da3cef1 | |||
5e35acdc39 | |||
58b70c53f8 | |||
b9e34a94d9 | |||
6d67d00c63 | |||
3976af97f1 | |||
a89f7fbe28 | |||
bb039fcf5e | |||
b461c79b53 | |||
197a31668e | |||
b3dee9c166 | |||
6dcd228e3c | |||
fb4d528070 |
@ -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');
|
||||
|
@ -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' => '分类',
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
]);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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),'预收金额:');
|
||||
|
@ -55,7 +55,7 @@ return [
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8mb4',
|
||||
// 数据库表前缀
|
||||
'prefix' => 'la_',
|
||||
'prefix' => 'eb_',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user