|
|
@@ -23,8 +23,7 @@ class ProductController extends BaseController
|
|
|
|
|
|
public $guestAccess = ['index'];
|
|
|
|
|
|
- //开单时获取所有的分类花材信息
|
|
|
- //库存预警
|
|
|
+ //按分类列出所有花材
|
|
|
public function actionIndex()
|
|
|
{
|
|
|
$py = Yii::$app->request->get('py', '');
|
|
|
@@ -76,7 +75,7 @@ class ProductController extends BaseController
|
|
|
util::success($data);
|
|
|
}
|
|
|
|
|
|
- //当前门店所有花材
|
|
|
+ //所有花材分页和不分页
|
|
|
public function actionList()
|
|
|
{
|
|
|
$where = [];
|
|
|
@@ -143,33 +142,55 @@ class ProductController extends BaseController
|
|
|
$respond['list'] = ProductClass::groupProductInfo($respond['list'], $level);
|
|
|
$respond['list'] = ProductClass::groupClassName($this->sjId, $respond['list']);
|
|
|
util::success($respond);
|
|
|
- }
|
|
|
- if ($type == 'waring') {
|
|
|
- //库存预警 按库存从小到大排序
|
|
|
- $data = ProductClass::getAllByCondition($where, ['stock' => SORT_ASC, 'inTurn' => SORT_DESC], "*");
|
|
|
} else {
|
|
|
- if (!empty($productIds)) {
|
|
|
- //优先按 $productIds 排序 "FIELD(`id`,4,5,6)"=>true
|
|
|
- $data = ProductClass::getAllByCondition($where, ["FIELD(`id`,$productIds)" => true, 'inTurn' => SORT_DESC], "*");
|
|
|
+ if ($type == 'waring') {
|
|
|
+ //库存预警 按库存从小到大排序
|
|
|
+ $data = ProductClass::getAllByCondition($where, ['stock' => SORT_ASC, 'inTurn' => SORT_DESC], "*");
|
|
|
} else {
|
|
|
- $data = ProductClass::getAllByCondition($where, ['actualSold' => SORT_DESC, 'inTurn' => SORT_DESC], "*");
|
|
|
- }
|
|
|
+ if (!empty($productIds)) {
|
|
|
+ //优先按 $productIds 排序 "FIELD(`id`,4,5,6)"=>true
|
|
|
+ $data = ProductClass::getAllByCondition($where, ["FIELD(`id`,$productIds)" => true, 'inTurn' => SORT_DESC], "*");
|
|
|
+ } else {
|
|
|
+ $data = ProductClass::getAllByCondition($where, ['actualSold' => SORT_DESC, 'inTurn' => SORT_DESC], "*");
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- $data = ProductClass::groupProductInfo($data, $level);
|
|
|
- $data = ProductClass::groupClassName($this->sjId, $data);
|
|
|
+ $data = ProductClass::groupProductInfo($data, $level);
|
|
|
+ $data = ProductClass::groupClassName($this->sjId, $data);
|
|
|
|
|
|
- if ($type == 'waring') {
|
|
|
- //库存预警
|
|
|
- $newData = [];
|
|
|
- foreach ($data as $v) {
|
|
|
- if ($v['stock'] <= $v['stockWarning']) {
|
|
|
- $newData[] = $v;
|
|
|
+ if ($type == 'waring') {
|
|
|
+ //库存预警
|
|
|
+ $newData = [];
|
|
|
+ foreach ($data as $v) {
|
|
|
+ if ($v['stock'] <= $v['stockWarning']) {
|
|
|
+ $newData[] = $v;
|
|
|
+ }
|
|
|
}
|
|
|
+ util::success(['list' => $newData]);
|
|
|
}
|
|
|
- util::success(['list' => $newData]);
|
|
|
+ util::success(['list' => $data]);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ //所有花材
|
|
|
+ public function actionAll()
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ $where['sjId'] = $this->sjId;
|
|
|
+ $where['shopId'] = $this->shopId;
|
|
|
+ $status = Yii::$app->request->get('status', 0);
|
|
|
+ if (!empty($status)) {
|
|
|
+ $where['status'] = $status;
|
|
|
+ }
|
|
|
+ $delStatus = Yii::$app->request->get('delStatus', 0);
|
|
|
+ if ($delStatus != 2) {
|
|
|
+ $where['delStatus'] = $delStatus;
|
|
|
+ }
|
|
|
+ //输出标准会员价,即花店价,默认显示的是花店价
|
|
|
+ $level = 1;
|
|
|
+ $data = ProductClass::getAllByCondition($where, ['actualSold' => SORT_DESC, 'inTurn' => SORT_DESC], "*");
|
|
|
+ $data = ProductClass::groupProductInfo($data, $level);
|
|
|
util::success(['list' => $data]);
|
|
|
}
|
|
|
|