商品编辑

main
fengxinyhyl 11 months ago
parent 8ba4cd88c3
commit 484f0a38b0
  1. 65
      app/common/repositories/store/product/ProductRepository.php
  2. 2
      app/common/repositories/user/UserAssetsLogRepository.php
  3. 42
      app/controller/admin/store/StoreProduct.php
  4. 10
      route/admin/product.php
  5. 5
      view/admin/src/api/product.js
  6. 22
      view/admin/src/views/product/productExamine/index.vue

@ -37,7 +37,12 @@ use crmeb\jobs\SendSmsJob;
use crmeb\services\QrcodeService;
use crmeb\services\RedisCacheService;
use crmeb\services\SwooleTaskService;
use FormBuilder\Exception\FormBuilderException;
use FormBuilder\Factory\Elm;
use FormBuilder\Form;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\exception\ValidateException;
use think\facade\Cache;
use think\facade\Db;
@ -128,6 +133,66 @@ class ProductRepository extends BaseRepository
return (app()->make(StoreCategoryRepository::class))->merExists(0, $id);
}
/**
* @param null $id
* @param array $formData
* @return Form
* @throws FormBuilderException
* @author xaboy
* @day 2020-05-07
*/
public function form($id = null, array $formData = [])
{
$action = Route::buildUrl('systemStoreProductUpdateSpread', compact('id'))->build();
return Elm::createForm($action, [
Elm::number('normal_integral_one', '普通区直推积分比例:')->placeholder('请输入普通区直推积分比例')
->max(100)->min(0)->required(),
Elm::number('normal_integral_two', '普通区间推积分比例:')->placeholder('请输入普通区间推积分比例')
->max(100)->min(0)->required(),
Elm::number('normal_diamond_one', '普通区直推钻石返佣:')->placeholder('请输入普通区直推钻石返佣')
->min(0)->required(),
Elm::number('normal_diamond_two', '普通区间推钻石返佣::')->placeholder('请输入普通区钻石返佣:')
->min(0)->required(),
Elm::switches('is_hot', '设为爆单商品:', 1)->activeValue(1)->inactiveValue(0)->inactiveText('否')->activeText('是'),
Elm::number('hot_integral_one', '爆单区直推积分比例:')->placeholder('请输入爆单区直推积分比例')
->max(100)->min(0)->required(),
Elm::number('hot_integral_two', '爆单区间推积分比例:')->placeholder('请输入爆单区间推积分比例')
->max(100)->min(0)->required(),
Elm::number('hot_diamond_one', '爆单区直推钻石返佣:')->placeholder('请输入爆单区直推钻石返佣')
->min(0)->required(),
Elm::number('hot_diamond_two', '爆单区间推钻石返佣::')->placeholder('请输入爆单区钻石返佣:')
->min(0)->required(),
Elm::number('hot_integral_rate', '爆单区返佣比例:')->placeholder('请输入爆单区返佣比例')
->max(100)->min(0)->required(),
Elm::number('hot_integral_total', '爆单区返佣积分:')->placeholder('请输入爆单区返佣积分')
->max(100)->min(0)->required(),
// Elm::number('order_sum', '营业额:')->placeholder('请输入营业额')->min(0)->required(),
// Elm::number('diamond', '赠送钻石数/天:')->placeholder('请输入赠送钻石数')->min(0)->required(),
// Elm::number('diamond_max', '赠送最大钻石数:')->placeholder('请输入赠送最大钻石数')->min(0)->required(),
// Elm::number('rate', '业绩分红比例:')->placeholder('请输入业绩分红比例')->max(100)->min(0)->required(),
])->setTitle('设置返佣比例')->formData($formData);
}
/**
* @param $id
* @return Form
* @throws FormBuilderException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-05-07
*/
public function updateForm($id)
{
return $this->form($id, $this->dao->get($id)->toArray());
}
/**
* @Author:Qinii
* @Date: 2020/5/20

@ -32,7 +32,7 @@ use think\facade\Log;
*/
class UserAssetsLogRepository extends BaseRepository
{
const ASSET_INTEGRAL = 1; // 消费积分积分
const ASSET_INTEGRAL = 1; // 积分
const ASSET_DIAMOND = 2; // 钻石
const ASSET_STOCK = 3; // 本票

@ -15,10 +15,14 @@ namespace app\controller\admin\store;
use app\common\repositories\store\product\SpuRepository;
use app\common\repositories\system\merchant\MerchantRepository;
use app\common\repositories\system\operate\OperateLogRepository;
use FormBuilder\Exception\FormBuilderException;
use think\App;
use crmeb\basic\BaseController;
use app\validate\merchant\StoreProductAdminValidate as validate;
use app\common\repositories\store\product\ProductRepository as repository;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Queue;
class StoreProduct extends BaseController
@ -61,6 +65,42 @@ class StoreProduct extends BaseController
return app('json')->success($this->repository->getAdminList($merId, $where, $page, $limit));
}
/**
* @param $id
* @return mixed
* @throws DbException
* @throws FormBuilderException
* @throws DataNotFoundException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-05-07
*/
public function updateForm($id)
{
if (!$this->repository->exists($id))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->updateForm($id)));
}
/**
* @param $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-05-07
*/
public function updateSpread($id)
{
$data = $this->request->params(['is_hot', 'normal_integral_one', 'normal_integral_two', 'normal_diamond_one', 'normal_diamond_two',
'hot_integral_one', 'hot_integral_two', 'hot_diamond_one', 'hot_diamond_two', 'hot_integral_rate', 'hot_integral_total']);
if (!$this->repository->exists($id))
return app('json')->fail('数据不存在');
$this->repository->update($id, $data);
return app('json')->success('编辑成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/18
@ -159,7 +199,7 @@ class StoreProduct extends BaseController
*/
public function checkParams(validate $validate)
{
$data = $this->request->params(['is_hot', 'is_best', 'is_benefit', 'is_new', 'store_name', 'content', 'rank', 'star']);
$data = $this->request->params(['is_hot','is_good', 'is_best', 'is_benefit', 'is_new', 'store_name', 'content', 'rank', 'star']);
$validate->check($data);
return $data;
}

@ -173,6 +173,16 @@ Route::group(function () {
'_alias' => '列表',
'_auth' => false,
]);
Route::post('update/spread/:id', '/updateSpread')->name('systemStoreProductUpdateSpread')->option([
'_alias' => '商品返佣编辑',
]);
Route::get('form/:id', '/updateForm')->name('systemStoreProductUpdateSpreadForm')->option([
'_alias' => '商品返佣编辑表单',
'_auth' => false,
'_form' => 'systemStoreProductUpdateSpread',
]);
Route::get('lst_filter', '/getStatusFilter')->name('systemStoreProductLstFilter')->option([
'_alias' => '统计',
]);

@ -171,6 +171,9 @@ export function merCategoryListApi() {
export function productDetailApi(id) {
return request.get(`store/product/detail/${id}`)
}
export function productEditSpreadApi(id) {
return request.get('store/product/form/' + id)
}
/**
* @description 秒杀商品审核 -- 详情
*/
@ -527,4 +530,4 @@ export function merProductLstApi(data) {
/** 商品列表 -- 商品操作记录 */
export function operateRecordList(id,data) {
return request.get(`store/product/get_operate_list/${id}`,data)
}
}

@ -159,7 +159,7 @@
查看评价
</router-link>
</el-dropdown-item>
<el-dropdown-item v-if="tableFrom.type !== '5'" @click.native="onEditLabel(scope.row)">编辑标签</el-dropdown-item>
<el-dropdown-item @click.native="onEditSpread(scope.row.product_id)">设置返佣</el-dropdown-item>
<el-dropdown-item v-if="tableFrom.type === '6' || tableFrom.type === '1'" @click.native="toVirtualSales(scope.row.product_id)">已售数量</el-dropdown-item>
<el-dropdown-item v-if="Number(tableFrom.type) < 3" @click.native="toOff(scope.row.product_id)">强制下架</el-dropdown-item>
</el-dropdown-menu>
@ -181,11 +181,14 @@
<el-rate class="rate_star" v-model="formValidate.star" :colors="colors" style="margin-top: 4px;"></el-rate>
<span style="margin-top: 4px; font-size: 12px;">备注5星为最高推荐级别1星为最低推荐级别设置后会在商城商品列表搜索商品列表中体现</span>
</el-form-item>
<el-form-item label="商品推荐:">
<el-checkbox-group v-model="checkboxGroup" size="small" @change="onChangeGroup">
<el-checkbox v-for="(item, index) in recommend" :key="index" :label="item.value">{{ item.name }}</el-checkbox>
</el-checkbox-group>
<el-form-item label="首页推荐:">
<el-switch v-model="formValidate.is_good" active-text="" inactive-text="" :active-value="1" :inactive-value="0" style="width: 100px" />
</el-form-item>
<!-- <el-form-item label="商品推荐:">-->
<!-- <el-checkbox-group v-model="checkboxGroup" size="small" @change="onChangeGroup">-->
<!-- <el-checkbox v-for="(item, index) in recommend" :key="index" :label="item.value">{{ item.name }}</el-checkbox>-->
<!-- </el-checkbox-group>-->
<!-- </el-form-item>-->
<el-form-item label="排序:">
<el-input-number v-model="formValidate.rank" size="small" placeholder="请输入排序序号" style="width: 200px;" />
</el-form-item>
@ -283,7 +286,8 @@ import {
updatetProductLabel,
batchesLabelsApi,
batchesRecommendApi,
batchesOnOffApi
batchesOnOffApi,
productEditSpreadApi
} from '@/api/product'
import { roterPre } from '@/settings'
import infoFrom from './info'
@ -356,6 +360,7 @@ export default {
is_best: 0,
is_new: 0,
is_benefit: 0,
is_good: 0,
ficti: 0,
is_ficti: "",
content: '',
@ -472,6 +477,10 @@ export default {
sys_labels: row.sys_labels
}
},
//
onEditSpread(id) {
this.$modalForm(productEditSpreadApi(id)).then(() => this.getList());
},
//
onDetails(id) {
this.product_id = id;
@ -531,6 +540,7 @@ export default {
is_best: info.is_best,
is_new: info.is_new,
is_benefit: info.is_benefit,
is_good: info.is_good,
ficti: info.ficti,
content: info.content,
store_name: info.store_name,

Loading…
Cancel
Save