| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?php
- // +----------------------------------------------------------------------
- // | likeshop100%开源免费商用商城系统
- // +----------------------------------------------------------------------
- // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
- // | 开源版本可自由商用,可去除界面版权logo
- // | 商业版本务必购买商业授权,以免引起法律纠纷
- // | 禁止对系统程序代码以任何目的,任何形式的再发布
- // | gitee下载:https://gitee.com/likeshop_gitee
- // | github下载:https://github.com/likeshop-github
- // | 访问官网:https://www.likeshop.cn
- // | 访问社区:https://home.likeshop.cn
- // | 访问手册:http://doc.likeshop.cn
- // | 微信公众号:likeshop技术社区
- // | likeshop团队 版权所有 拥有最终解释权
- // +----------------------------------------------------------------------
- // | author: likeshopTeam
- // +----------------------------------------------------------------------
- namespace app\adminapi\lists\goods;
- use app\adminapi\lists\BaseAdminDataLists;
- use app\common\lists\ListsExcelInterface;
- use app\common\lists\ListsSearchInterface;
- use app\common\model\Goods;
- use app\common\model\GoodsItem;
- /**
- * 商品规格价格列表
- * Class GoodsSpecPriceLists
- * @package app\adminapi\lists\goods
- */
- class GoodsSpecPriceLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
- {
- /**
- * @notes 搜索条件
- * @return array
- * @author
- * @date 2024/01/01 00:00
- */
- public function setSearch(): array
- {
- return [
- '=' => ['g.id', 'g.category_id', 'g.status'],
- 'like' => ['g.name', 'g.code'],
- ];
- }
- /**
- * @notes 获取商品规格价格列表
- * @return array
- * @author
- * @date 2024/01/01 00:00
- */
- public function lists(): array
- {
- $lists = GoodsItem::alias('gi')
- ->leftJoin('goods g', 'g.id = gi.goods_id')
- ->where($this->searchWhere)
- ->where('g.delete_time', null)
- ->field([
- 'g.id as goods_id',
- 'g.code as goods_code',
- 'g.name as goods_name',
- 'gi.id as item_id',
- 'gi.spec_value_str',
- 'gi.sell_price',
- 'gi.lineation_price',
- 'gi.cost_price',
- 'gi.stock',
- 'gi.weight',
- 'gi.volume'
- ])
- ->limit($this->limitOffset, $this->limitLength)
- ->order('g.id desc, gi.id asc')
- ->select()
- ->toArray();
- return $lists;
- }
- /**
- * @notes 获取数量
- * @return int
- * @author
- * @date 2024/01/01 00:00
- */
- public function count(): int
- {
- return GoodsItem::alias('gi')
- ->leftJoin('goods g', 'g.id = gi.goods_id')
- ->where($this->searchWhere)
- ->where('g.delete_time', null)
- ->count();
- }
- /**
- * @notes 设置导出字段
- * @return array
- * @author
- * @date 2024/01/01 00:00
- */
- public function setExcelFields(): array
- {
- return [
- 'goods_id' => '商品ID',
- 'goods_code' => '商品编码',
- 'goods_name' => '商品名称',
- 'item_id' => '规格ID',
- 'spec_value_str' => '规格名称',
- 'sell_price' => '销售价格',
- 'lineation_price' => '划线价格',
- 'cost_price' => '成本价格',
- 'stock' => '库存数量',
- 'weight' => '重量(kg)',
- 'volume' => '体积(m³)'
- ];
- }
- /**
- * @notes 设置文件名
- * @return string
- * @author
- * @date 2024/01/01 00:00
- */
- public function setFileName(): string
- {
- return '商品规格价格';
- }
- }
|