mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-28 13:31:04 +00:00
feat(移动端): DIY 商品列表支持指定商品与商品标签筛选
This commit is contained in:
parent
61f7006a44
commit
fb1266d0a1
@ -36,11 +36,25 @@ class CenterProductController
|
||||
['salesOrder', ''],
|
||||
['cate_id', ''],
|
||||
['limit', 30],
|
||||
['ids', ''],
|
||||
['store_label_id', ''],
|
||||
]);
|
||||
[$page, $limit] = $services->getPageValue();
|
||||
if (!empty($where['limit'])) {
|
||||
$limit = (int)$where['limit'];
|
||||
}
|
||||
// DIY 商品列表/商品选项卡「指定商品」「商品标签」:ids/store_label_id 逗号串转数组(DAO 按数组 whereIn/FIND_IN_SET 处理,ids 需按顺序排序)
|
||||
foreach (['ids', 'store_label_id'] as $idKey) {
|
||||
$idValue = is_array($where[$idKey]) ? $where[$idKey] : explode(',', (string)$where[$idKey]);
|
||||
$where[$idKey] = array_values(array_filter(array_map('intval', $idValue)));
|
||||
if (empty($where[$idKey])) {
|
||||
unset($where[$idKey]);
|
||||
}
|
||||
}
|
||||
if (!empty($where['ids'])) {
|
||||
// 指定商品按已选数量返回,不受默认分页条数限制
|
||||
$limit = max($limit, count($where['ids']));
|
||||
}
|
||||
if ($where['cate_id'] !== '') {
|
||||
$where['cate_id'] = explode(',', $where['cate_id']);
|
||||
foreach ($where['cate_id'] as $keys => &$items) {
|
||||
|
||||
@ -1243,9 +1243,12 @@ function productslist() {
|
||||
let limit = LIMIT;
|
||||
let data = {};
|
||||
if (typeConfig.value == 1) {
|
||||
const goodsList = props.dataConfig.goodsList.list || [];
|
||||
const ids = goodsList
|
||||
.map((item) => item.id)
|
||||
// 指定商品:保存后的配置只保留 goodsList.ids(ID 数组),goodsList.list 仅预览/旧数据存在,两者兼容
|
||||
const selectGoods = props.dataConfig.goodsList || {};
|
||||
const ids = (selectGoods.ids && selectGoods.ids.length
|
||||
? selectGoods.ids
|
||||
: (selectGoods.list || []).map((item) => item.id)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.join(",");
|
||||
if (ids) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user