问题说明:后台分类搜索查询有误
修改文件:app\services\product\category\StoreProductCategoryServices
修改方法:getTierList()
public function getTierList($show = '', $type = 0, $relation_id = 0, $pid = 0)
{
$where = ['type' => $type, 'relation_id' => $relation_id];
if ($show !== '') $where['is_show'] = $show;
if (!$pid) $where['pid'] = 0;
return sort_list_tier($this->dao->getTierList($where));
}
修改文件:app\controller\store\product\StoreProductCategory
修改方法:tree_list()
public function tree_list($type)
{
$relation_id = $type ? $this->storeId : 0;
$list = $this->service->getTierList(1, $type, $relation_id);
return $this->success($list);
}
修改文件:app\controller\supplier\product\StoreProductCategory
修改方法:tree_list()
public function tree_list($type)
{
$relation_id = $this->supplierId;
$list = $this->service->getTierList(1, $type, $relation_id);
return $this->success($list);
}
修改文件:app\services\activity\coupon\StoreCouponService
修改方法:createForm()
public function createForm(int $type)
{
$f[] = Form::input('title', '优惠券名称');
switch ($type) {
case 1://品类券
$options = function () {
/** @var StoreProductCategoryServices $storeCategoryService */
$storeCategoryService = app()->make(StoreProductCategoryServices::class);
$list = $storeCategoryService->getTierList(1);
$menus = [];
foreach (sort_list_tier($list) as $menu) {
$menus[] = ['value' => $menu['id'], 'label' => $menu['html'] . $menu['cate_name'], 'disabled' => false];
}
return $menus;
};
$f[] = Form::select('category_id', '选择品类')->setOptions(Form::setOptions($options))->filterable(1)->col(12);
break;
case 2://商品券
$f[] = Form::frameImages('image', '商品', Url::buildUrl(config('admin.admin_prefix') . '/store.StoreProduct/index', array('fodder' => 'image', 'type' => 'many')))->icon('ios-add')->width('960px')->height('430px')->modal(['footer-hide' => true])->props(['srcKey' => 'image']);
$f[] = Form::hidden('product_id', '');
break;
}
$f[] = Form::number('coupon_price', '优惠券面值', 0)->min(0);
$f[] = Form::number('use_min_price', '优惠券最低消费', 0)->min(0);
$f[] = Form::number('coupon_time', '优惠券有效期限', 0)->min(0);
$f[] = Form::number('sort', '排序', 1)->min(0);
$f[] = Form::radio('status', '状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
$f[] = Form::hidden('type', $type);
return create_form('添加优惠券', $f, Url::buildUrl('/marketing/coupon/save'), 'POST');
}