lqmac 10 months ago
parent 5279926b18
commit bfe5684c4d
  1. 33
      app/admin/controller/Goods.php
  2. 13
      app/common/model/Goods.php
  3. 23
      app/store/model/Goods.php
  4. 1
      public/admin/css/goods.9804b499.css
  5. 2
      public/admin/index.html
  6. 1
      public/admin/js/app.578b849c.js
  7. 3
      public/admin/js/goods.bf456f65.js

@ -129,15 +129,44 @@ class Goods extends Controller
* @param bool $state 为true表示上架 * @param bool $state 为true表示上架
* @return Json * @return Json
*/ */
public function state(array $goodsIds, bool $state): Json public function state(array $goodsIds, bool $is_pool): Json
{ {
$model = new GoodsModel; $model = new GoodsModel;
if (!$model->setStatus($goodsIds, $state)) { if (!$model->setIsPool($goodsIds, $is_pool)) {
return $this->renderError($model->getError() ?: '操作失败'); return $this->renderError($model->getError() ?: '操作失败');
} }
return $this->renderSuccess('操作成功'); return $this->renderSuccess('操作成功');
} }
/**
* 修改商品状态(上下架)
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return Json
*/
public function sale(array $goodsIds, bool $is_sale): Json
{
$model = new GoodsModel;
if (!$model->setIsPool($goodsIds, $is_sale)) {
return $this->renderError($model->getError() ?: '操作失败');
}
return $this->renderSuccess('操作成功');
}
/**
* 修改商品状态(上下架)
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return Json
*/
public function category(array $goodsIds, array $categoryIds): Json
{
$model = new GoodsModel;
foreach ($goodsIds as $key => $goodsId) {
\app\store\model\GoodsCategoryRel::updates($goodsId, $categoryIds);
}
return $this->renderSuccess('操作成功');
}
/** /**
* 删除商品 * 删除商品
* @param array $goodsIds * @param array $goodsIds

@ -310,6 +310,7 @@ class Goods extends BaseModel
*/ */
private function getQueryFilter(array $param): BaseQuery private function getQueryFilter(array $param): BaseQuery
{ {
// 商品列表获取条件 // 商品列表获取条件
$params = $this->setQueryDefaultValue($param, [ $params = $this->setQueryDefaultValue($param, [
'listType' => 'all', // 列表模式 (全部:all 出售中:on_sale 已下架:off_sale 已售罄:sold_out) 'listType' => 'all', // 列表模式 (全部:all 出售中:on_sale 已下架:off_sale 已售罄:sold_out)
@ -317,9 +318,14 @@ class Goods extends BaseModel
'goodsName' => null, // 商品名称 'goodsName' => null, // 商品名称
'goodsNo' => null, // 商品编码 'goodsNo' => null, // 商品编码
'status' => 0, // 商品状态(0全部 10上架 20下架) 'status' => 0, // 商品状态(0全部 10上架 20下架)
'keywords' => '' 'goods_price_min' => '',
'goods_price_max' => '',
'date_type' => '',
'is_pool' => '',
'is_self' => '',
'keywords' => '',
]); ]);
// 实例化新查询对象 // 实例化新查询对象
$query = $this->getNewQuery(); $query = $this->getNewQuery();
// 筛选条件 // 筛选条件
@ -374,6 +380,7 @@ class Goods extends BaseModel
$filter[] = ['paihang', '>', 0]; $filter[] = ['paihang', '>', 0];
$query->order('paihang asc'); $query->order('paihang asc');
} }
//是否店内 //是否店内
if (isset($param['is_in_store']) && $param['is_in_store'] !== '') { if (isset($param['is_in_store']) && $param['is_in_store'] !== '') {
$filter[] = ['is_in_store', '=', $params['is_in_store']]; $filter[] = ['is_in_store', '=', $params['is_in_store']];
@ -388,7 +395,7 @@ class Goods extends BaseModel
if (isset($param['is_self']) && $param['is_self'] !== '') { if (isset($param['is_self']) && $param['is_self'] !== '') {
$filter[] = ['goods.is_self', '=', $params['is_self']]; $filter[] = ['goods.is_self', '=', $params['is_self']];
} }
if (isset($param['data_type']) && $param['data_type'] !== '') { if (isset($params['data_type']) && $params['data_type'] != '') {
$filter[] = ['goods.data_type', '=', $params['data_type']]; $filter[] = ['goods.data_type', '=', $params['data_type']];
} }
if (isset($param['is_pool']) && $param['is_pool'] !== '') { if (isset($param['is_pool']) && $param['is_pool'] !== '') {

@ -165,7 +165,28 @@ class Goods extends GoodsModel
// exit(); // exit();
return $ret; return $ret;
} }
/**
* 修改商品状态
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return bool|false
*/
public function setIsPool(array $goodsIds, bool $is_pool): bool
{
// 批量更新记录
return static::updateBase(['is_pool' => $is_pool], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态
* @param array $goodsIds 商品id集
* @param bool $state 为true表示上架
* @return bool|false
*/
public function setIsSale(array $goodsIds, bool $is_sale): bool
{
// 批量更新记录
return static::updateBase(['is_sale' => $is_sale], [['goods_id', 'in', $goodsIds]]);
}
/** /**
* 修改商品状态 * 修改商品状态
* @param array $goodsIds 商品id集 * @param array $goodsIds 商品id集

File diff suppressed because one or more lines are too long

@ -1 +1 @@
<!DOCTYPE html><html lang="zh-cmn-Hans"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>超级管理后台</title><style>#loading-mask{position:fixed;left:0;top:0;height:100%;width:100%;background:#fff;user-select:none;z-index:9999;overflow:hidden}.loading-wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-100%)}.loading-dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:64px;width:64px;height:64px;box-sizing:border-box}.loading-dot i{width:22px;height:22px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.loading-dot i:nth-child(1){top:0;left:0}.loading-dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.loading-dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.loading-dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style><link href="css/cloud.a47f0029.css" rel="prefetch"><link href="css/goods.bfc31ddd.css" rel="prefetch"><link href="css/menu.ea2422ad.css" rel="prefetch"><link href="css/setting.acf5c21b.css" rel="prefetch"><link href="css/store.14ef162f.css" rel="prefetch"><link href="css/user.6c29834d.css" rel="prefetch"><link href="js/cloud.5250d74c.js" rel="prefetch"><link href="js/fail.9f520b72.js" rel="prefetch"><link href="js/goods.71c06100.js" rel="prefetch"><link href="js/menu.532798eb.js" rel="prefetch"><link href="js/setting.9458c846.js" rel="prefetch"><link href="js/store.e9aaa387.js" rel="prefetch"><link href="js/user.8c820957.js" rel="prefetch"><link href="css/app.586c5556.css" rel="preload" as="style"><link href="css/chunk-vendors.f1c5ffe0.css" rel="preload" as="style"><link href="js/app.ef43f453.js" rel="preload" as="script"><link href="js/chunk-vendors.deec1c57.js" rel="preload" as="script"><link href="css/chunk-vendors.f1c5ffe0.css" rel="stylesheet"><link href="css/app.586c5556.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><div id="loading-mask"><div class="loading-wrapper"><span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span></div></div></div><script src="config.js"></script><script src="js/chunk-vendors.deec1c57.js"></script><script src="js/app.ef43f453.js"></script></body></html> <!DOCTYPE html><html lang="zh-cmn-Hans"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>超级管理后台</title><style>#loading-mask{position:fixed;left:0;top:0;height:100%;width:100%;background:#fff;user-select:none;z-index:9999;overflow:hidden}.loading-wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-100%)}.loading-dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:64px;width:64px;height:64px;box-sizing:border-box}.loading-dot i{width:22px;height:22px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.loading-dot i:nth-child(1){top:0;left:0}.loading-dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.loading-dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.loading-dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style><link href="css/cloud.a47f0029.css" rel="prefetch"><link href="css/goods.9804b499.css" rel="prefetch"><link href="css/menu.ea2422ad.css" rel="prefetch"><link href="css/setting.acf5c21b.css" rel="prefetch"><link href="css/store.14ef162f.css" rel="prefetch"><link href="css/user.6c29834d.css" rel="prefetch"><link href="js/cloud.5250d74c.js" rel="prefetch"><link href="js/fail.9f520b72.js" rel="prefetch"><link href="js/goods.bf456f65.js" rel="prefetch"><link href="js/menu.532798eb.js" rel="prefetch"><link href="js/setting.9458c846.js" rel="prefetch"><link href="js/store.e9aaa387.js" rel="prefetch"><link href="js/user.8c820957.js" rel="prefetch"><link href="css/app.586c5556.css" rel="preload" as="style"><link href="css/chunk-vendors.f1c5ffe0.css" rel="preload" as="style"><link href="js/app.578b849c.js" rel="preload" as="script"><link href="js/chunk-vendors.deec1c57.js" rel="preload" as="script"><link href="css/chunk-vendors.f1c5ffe0.css" rel="stylesheet"><link href="css/app.586c5556.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"><div id="loading-mask"><div class="loading-wrapper"><span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span></div></div></div><script src="config.js"></script><script src="js/chunk-vendors.deec1c57.js"></script><script src="js/app.578b849c.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save