|
|
@@ -217,7 +217,7 @@ class ProductController extends BaseController
|
|
|
$itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
} elseif ($requestType == 'changePrice') {
|
|
|
//修改价格列表
|
|
|
- $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,discountPrice,skMore,variety,price,stock,presell,frontHide';
|
|
|
+ $field = 'id,py,cover,name,cost,itemId,classId,addPrice,hjAddPrice,skPrice,discountPrice,skMore,variety,price,hjPrice,stock,presell,frontHide';
|
|
|
$itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
$itemInfoData = ProductClass::changePriceGroup($itemInfoData, $level);
|
|
|
} elseif ($requestType == 'changeStock') {
|
|
|
@@ -227,14 +227,14 @@ class ProductController extends BaseController
|
|
|
$itemInfoData = ProductClass::changeStockGroup($itemInfoData, $level);
|
|
|
} elseif ($requestType == 'kd') {
|
|
|
//开单的花材列表
|
|
|
- $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,smallRatio,bigUnit,ratio';
|
|
|
+ $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,hjPrice,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,smallRatio,bigUnit,ratio';
|
|
|
$itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
|
|
|
$itemInfoData = ProductClass::kdItemGroup($itemInfoData, $level);
|
|
|
} elseif ($requestType == 'itemList') {
|
|
|
//花材列表
|
|
|
if (getenv('YII_ENV', 'local') == 'production') {
|
|
|
$showFrontHide = [7615, 7756];
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$showFrontHide = [644];
|
|
|
}
|
|
|
if (in_array($this->mainId, $showFrontHide)) {
|
|
|
@@ -556,7 +556,8 @@ class ProductController extends BaseController
|
|
|
$targetId = Yii::$app->request->post('targetId', 0);
|
|
|
$changeParams = ['staffId' => $shopAdmin->id, 'staffName' => $shopAdmin->name, 'changeType' => $changeType, 'targetId' => $targetId];
|
|
|
|
|
|
- $data = Yii::$app->request->post('data', '');
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+ $data = $post['data'] ?? '';
|
|
|
if (empty($data)) {
|
|
|
util::fail('没有修改');
|
|
|
}
|
|
|
@@ -565,6 +566,11 @@ class ProductController extends BaseController
|
|
|
util::fail('没有修改哦');
|
|
|
}
|
|
|
|
|
|
+ $appVersion = $post['appVersion'] ?? 0;
|
|
|
+ if ($appVersion != 1) {
|
|
|
+ util::fail('请先升级应用');
|
|
|
+ }
|
|
|
+
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
@@ -617,7 +623,7 @@ class ProductController extends BaseController
|
|
|
util::fail('请填写' . $productName . '的零售价');
|
|
|
}
|
|
|
$skPrice = $product['skPrice'];
|
|
|
-
|
|
|
+ $hjPrice = $product['hjPrice'] ?? 0;
|
|
|
if (isset($productInfo->mainId) == false || $productInfo->mainId != $this->mainId) {
|
|
|
util::fail('没有权限访问');
|
|
|
}
|
|
|
@@ -625,7 +631,7 @@ class ProductController extends BaseController
|
|
|
continue;
|
|
|
}
|
|
|
$ptItemId = $productInfo->itemId;
|
|
|
- ProductClass::changeSinglePrice($shop, $ptItemId, $price, $skPrice, $changeParams);
|
|
|
+ ProductClass::changeSinglePrice($shop, $ptItemId, $price, $skPrice, $hjPrice, $changeParams);
|
|
|
//在首店修改需要同步到所有直营店
|
|
|
if ($default == 1 && isset($shop->dataSync) && $shop->dataSync == 1) {
|
|
|
foreach ($chainShopList as $chain) {
|
|
|
@@ -635,7 +641,7 @@ class ProductController extends BaseController
|
|
|
$chainMainId = $chain->mainId ?? 0;
|
|
|
$staff = ShopAdminClass::getByCondition(['mainId' => $chainMainId, 'adminId' => $adminId], true);
|
|
|
$changeParams2 = ['staffId' => $staff->id, 'staffName' => $staff->name, 'changeType' => $changeType, 'targetId' => $targetId];
|
|
|
- ProductClass::changeSinglePrice($chain, $ptItemId, $price, $skPrice, $changeParams2);
|
|
|
+ ProductClass::changeSinglePrice($chain, $ptItemId, $price, $skPrice, $hjPrice, $changeParams2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -865,6 +871,12 @@ class ProductController extends BaseController
|
|
|
}
|
|
|
|
|
|
$post = Yii::$app->request->post();
|
|
|
+
|
|
|
+ $appVersion = $post['appVersion'] ?? 0;
|
|
|
+ if ($appVersion != 1) {
|
|
|
+ util::fail('请先升级应用');
|
|
|
+ }
|
|
|
+
|
|
|
$post['adminId'] = $this->adminId;
|
|
|
$post['staffId'] = $this->shopAdmin->id;
|
|
|
$post['staffName'] = $this->shopAdmin->name;
|
|
|
@@ -968,6 +980,12 @@ class ProductController extends BaseController
|
|
|
public function actionAdd()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
+
|
|
|
+ $appVersion = $post['appVersion'] ?? 0;
|
|
|
+ if ($appVersion != 1) {
|
|
|
+ util::fail('请先升级应用');
|
|
|
+ }
|
|
|
+
|
|
|
$shop = $this->shop;
|
|
|
$join = $shop->join ?? 0;
|
|
|
$default = $shop->default ?? 0;
|
|
|
@@ -1009,6 +1027,11 @@ class ProductController extends BaseController
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
|
|
|
+ $appVersion = $post['appVersion'] ?? 0;
|
|
|
+ if ($appVersion != 1) {
|
|
|
+ util::fail('请先升级应用');
|
|
|
+ }
|
|
|
+
|
|
|
$shop = $this->shop;
|
|
|
$join = $shop->join ?? 0;
|
|
|
$default = $shop->default ?? 0;
|
|
|
@@ -1027,9 +1050,20 @@ class ProductController extends BaseController
|
|
|
$post['staffName'] = $shopAdmin->name ?? '';
|
|
|
|
|
|
$price = $post['price'] ?? 0;
|
|
|
+ if (empty($price) || $price <= 0) {
|
|
|
+ util::fail('请填写批发价');
|
|
|
+ }
|
|
|
+ $skPrice = $post['skPrice'] ?? 0;
|
|
|
+ if (empty($skPrice) || $skPrice <= 0) {
|
|
|
+ util::fail('请填写零售价');
|
|
|
+ }
|
|
|
+ $hjPrice = $post['hjPrice'] ?? 0;
|
|
|
+ if (empty($hjPrice) || $hjPrice <= 0) {
|
|
|
+ util::fail('请填写会员价');
|
|
|
+ }
|
|
|
$addPrice = $post['addPrice'] ?? 0;
|
|
|
if ($addPrice > $price) {
|
|
|
- util::fail('加价不能大于售价');
|
|
|
+ util::fail('批发价的加价不能大于售价');
|
|
|
}
|
|
|
//复制标识
|
|
|
$post['copy'] = 1;
|