admin端显示商品返比设置

This commit is contained in:
wangxiaowei 2024-11-16 15:30:50 +08:00
parent 41363bacd0
commit d945db7bef
5 changed files with 56 additions and 3 deletions

@ -30,6 +30,7 @@ use app\common\model\Freight;
use app\common\model\goods\Goods as GoodsModel; use app\common\model\goods\Goods as GoodsModel;
use app\common\model\goods\GoodsBrand; use app\common\model\goods\GoodsBrand;
use app\common\model\goods\GoodsItem; use app\common\model\goods\GoodsItem;
use app\common\model\goods\GoodsSubsidy;
use app\common\model\goods\GoodsUnit; use app\common\model\goods\GoodsUnit;
use app\common\model\goods\Supplier; use app\common\model\goods\Supplier;
use app\common\server\JsonServer; use app\common\server\JsonServer;
@ -70,6 +71,14 @@ class Goods extends AdminBase
{ {
$goods_id = $this->request->get('goods_id'); $goods_id = $this->request->get('goods_id');
$shop_id = GoodsModel::where('id', $goods_id)->value('shop_id'); $shop_id = GoodsModel::where('id', $goods_id)->value('shop_id');
$info = GoodsLogic::info($goods_id);
$subsidy = [];
if ($info['base']['subsidy_id']) {
$subsidy = (new GoodsSubsidy())->getSubsidyById($info['base']['subsidy_id']);
}
return view('goods/goods/add', [ return view('goods/goods/add', [
'category_lists' => json_encode(MallCategoryLogic::getAllTree(), JSON_UNESCAPED_UNICODE), 'category_lists' => json_encode(MallCategoryLogic::getAllTree(), JSON_UNESCAPED_UNICODE),
'shop_category_lists' => json_encode(ShopCategoryLogic::listAll($shop_id), JSON_UNESCAPED_UNICODE), 'shop_category_lists' => json_encode(ShopCategoryLogic::listAll($shop_id), JSON_UNESCAPED_UNICODE),
@ -77,7 +86,8 @@ class Goods extends AdminBase
'supplier_lists' => json_encode(Supplier::getNameColumn(), JSON_UNESCAPED_UNICODE), 'supplier_lists' => json_encode(Supplier::getNameColumn(), JSON_UNESCAPED_UNICODE),
'unit_lists' => json_encode(GoodsUnit::getNameColumn(), JSON_UNESCAPED_UNICODE), 'unit_lists' => json_encode(GoodsUnit::getNameColumn(), JSON_UNESCAPED_UNICODE),
'freight_lists' => json_encode(Freight::getNameColumn($shop_id), JSON_UNESCAPED_UNICODE), 'freight_lists' => json_encode(Freight::getNameColumn($shop_id), JSON_UNESCAPED_UNICODE),
'info' => json_encode(GoodsLogic::info($goods_id), JSON_UNESCAPED_UNICODE) 'info' => json_encode($info, JSON_UNESCAPED_UNICODE),
'subsidy' => json_encode($subsidy, JSON_UNESCAPED_UNICODE),
]); ]);
} }

@ -205,6 +205,31 @@
area: ['60%', '60%'] area: ['60%', '60%']
}); });
}); });
var subsidy = {$subsidy | raw};
if (subsidy.profit) {
const h = `
<table class="layui-table">
<thead>
<tr>
<th>商家利润比例</th>
<th>商品让利比例</th>
<th>商品全返比例</th>
</tr>
</thead>
<tbody>
<tr>
<td>${subsidy.profit}</td>
<td>${subsidy.discount}</td>
<td>${subsidy.subsidy}</td>
</tr>
</tbody>
</table>
`
$("#goods_subsidy_table").html(h);
$("#subsidy_id").val(subsidy.id)
}
// ----------------------------------------图片/视频上传 end ----------------------------- // ----------------------------------------图片/视频上传 end -----------------------------
//------------------------------------------数据验证 begin ------------------------------- //------------------------------------------数据验证 begin -------------------------------

@ -1,4 +1,19 @@
<div class="layui-tab-item"> <div class="layui-tab-item">
<!--商品返补比例-->
<div class="layui-form-item">
<div style="height: 40px">
<label class="layui-form-label"><span class="form-label-asterisk">*</span>商品返补比例:</label>
<div class="layui-input-inline">
<div class="layui-input-inline" style="display: flex">
<input type="hidden" id="subsidy_id" name="subsidy_id">
<a id="select-goods-subsidy" class="layui-btn layui-btn-normal ">选择</a>
</div>
</div>
</div>
<div id="goods_subsidy_table" style="padding: 0 46px;"></div>
</div>
<!--库存预警--> <!--库存预警-->
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">库存预警:</label> <label class="layui-form-label">库存预警:</label>

@ -280,7 +280,10 @@ class Goods extends ShopBase
$b['base']['second_cate_id'] = explode(",", $b['base']['second_cate_id']); $b['base']['second_cate_id'] = explode(",", $b['base']['second_cate_id']);
$b['base']['third_cate_id'] = explode(",", $b['base']['third_cate_id']); $b['base']['third_cate_id'] = explode(",", $b['base']['third_cate_id']);
$subsidy = (new GoodsSubsidy())->getSubsidyById($b['base']['subsidy_id']); $subsidy = [];
if ($b['base']['subsidy_id']) {
$subsidy = (new GoodsSubsidy())->getSubsidyById($b['base']['subsidy_id']);
}
return view('goods/goods/add', [ return view('goods/goods/add', [
'category_lists_new' => $a, 'category_lists_new' => $a,

@ -1,5 +1,5 @@
<div class="layui-tab-item"> <div class="layui-tab-item">
<!--商品让利--> <!--商品返补比例-->
<div class="layui-form-item"> <div class="layui-form-item">
<div style="height: 40px"> <div style="height: 40px">
<label class="layui-form-label"><span class="form-label-asterisk">*</span>商品返补比例:</label> <label class="layui-form-label"><span class="form-label-asterisk">*</span>商品返补比例:</label>