| | |
| | | |
| | | # VUE_APP_API = 'https://dmtest.ahapp.net/preselect_interface/' |
| | | |
| | | VUE_APP_API = 'http://192.168.0.35:10012/' |
| | | VUE_APP_API = 'http://192.168.0.15:10022/' |
| | | |
| | | # VUE_APP_API = 'https://dmtest.ahapp.net/preselect_web_interface/' |
| | | |
| | | # VUE_APP_API = 'https://dmtest.ahapp.net/preselect_interface/' |
| | |
| | | <h3 style="margin: 20px 0 10px 0;">基本信息</h3> |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="类别来源" prop="type"> |
| | | <el-radio-group v-model="form.type" @change="changeRadio"> |
| | | <el-radio-group v-model="form.type" :disabled="form.id ? true : false" @change="changeRadio"> |
| | | <el-radio :label="1">从平台库选择</el-radio> |
| | | <el-radio :label="0">企业自建</el-radio> |
| | | </el-radio-group> |
| | |
| | | v-model="scope.row.isselect" |
| | | active-color="#13ce66" |
| | | inactive-color="#ff4949" |
| | | @change="changeIsselect($event, scope.row)" |
| | | :active-value="1" |
| | | :inactive-value="0"> |
| | | </el-switch> |
| | |
| | | }) |
| | | }, |
| | | methods: { |
| | | changeIsselect(e, item) { |
| | | let num = 0 |
| | | this.form.tableData.forEach(row => { |
| | | if (row.isselect === 1) { |
| | | num += 1 |
| | | } |
| | | }) |
| | | if (num > 2) { |
| | | item.isselect = 0 |
| | | this.$message.warning({ message: '只能设置两个选项' }) |
| | | } |
| | | }, |
| | | addItem() { |
| | | this.form.tableData.push({ name: '', isselect: 0, isshow: 1 }) |
| | | }, |
| | |
| | | <el-form-item label="品牌名称" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请输入品牌名称" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="类型" prop="type"> |
| | | <el-select v-model="searchForm.type" clearable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in typeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">搜索</el-button> |
| | | <!-- <el-button type="primary" :loading="isWorking.export" v-permissions="['business:brand:exportExcel']" @click="exportExcel">导出</el-button> --> |
| | |
| | | fit="cover"></el-image> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="categoryName" label="类型" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.type == 0">自建</span> |
| | | <span v-else>拉取</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="sortnum" label="排序码(升序)" min-width="100px"></el-table-column> |
| | | <el-table-column prop="createDate" label="创建时间" min-width="100px"></el-table-column> |
| | | <el-table-column |
| | |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="edit(row)" icon="el-icon-edit" v-permissions="['business:brand:update']">编辑</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:brand:delete']">删除</el-button> |
| | | <template v-if="row.type == 0"> |
| | | <el-button type="text" @click="edit(row)" icon="el-icon-edit" v-permissions="['business:brand:update']">编辑</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:brand:delete']">删除</el-button> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | return { |
| | | // 搜索 |
| | | searchForm: { |
| | | name: '' |
| | | } |
| | | name: '', |
| | | type: '' |
| | | }, |
| | | typeList: [ |
| | | { name: '自建', id: 0 }, |
| | | { name: '拉取', id: 1 } |
| | | ] |
| | | } |
| | | }, |
| | | created () { |
| | |
| | | <el-form-item label="类别名称" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请输入类别名称" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="类型" prop="type"> |
| | | <el-select v-model="searchForm.type" clearable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in typeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">搜索</el-button> |
| | | <!-- <el-button type="primary" :loading="isWorking.export" v-permissions="['business:category:exportExcel']" @click="exportExcel">导出</el-button> --> |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="类别名称" min-width="100px"></el-table-column> |
| | | <el-table-column prop="categoryName" label="类型" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.type == 0">自建</span> |
| | | <span v-else>拉取</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="sortnum" label="排序码(升序)" min-width="100px"></el-table-column> |
| | | <el-table-column prop="createDate" label="创建时间" min-width="100px"></el-table-column> |
| | | <el-table-column prop="status" label="状态" min-width="100px"> |
| | |
| | | return { |
| | | // 搜索 |
| | | searchForm: { |
| | | name: '' |
| | | } |
| | | name: '', |
| | | type: '' |
| | | }, |
| | | typeList: [ |
| | | { name: '自建', id: 0 }, |
| | | { name: '拉取', id: 1 } |
| | | ] |
| | | } |
| | | }, |
| | | created () { |
| | |
| | | </el-select> |
| | | <!-- <el-input v-model="searchForm.status" placeholder="请输入状态 0启用 1禁用" @keypress.enter.native="search"></el-input> --> |
| | | </el-form-item> |
| | | <el-form-item label="类型" prop="type"> |
| | | <el-select v-model="searchForm.type" clearable placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in typeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | <!-- <el-input v-model="searchForm.status" placeholder="请输入状态 0启用 1禁用" @keypress.enter.native="search"></el-input> --> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">搜索</el-button> |
| | | <el-button @click="reset">重置</el-button> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="brandName" label="品牌" min-width="100px"></el-table-column> |
| | | <el-table-column prop="categoryName" label="类别" min-width="100px"></el-table-column> |
| | | <el-table-column prop="categoryName" label="类型" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.type == 0">自建</span> |
| | | <span v-else>拉取</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="指导价(元)" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.type == 0">{{ row.zdPrice }}</span> |
| | |
| | | name: '', |
| | | status: '', |
| | | categoryId: '', |
| | | brandId: '' |
| | | brandId: '', |
| | | type: '' |
| | | }, |
| | | ids: '', |
| | | categoryList: [], |
| | |
| | | statusList: [ |
| | | { name: '启用', id: 0 }, |
| | | { name: '禁用', id: 1 } |
| | | ], |
| | | typeList: [ |
| | | { name: '自建', id: 0 }, |
| | | { name: '拉取', id: 1 } |
| | | ] |
| | | } |
| | | }, |
| | |
| | | @PostMapping("/page") |
| | | // @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse<PageData<BaseGoods>> findPage (@RequestBody PageWrap<BaseGoods> pageWrap) { |
| | | return ApiResponse.success(baseGoodsService.findPage(pageWrap)); |
| | | return ApiResponse.success(baseGoodsService.findCompanyPage(pageWrap)); |
| | | } |
| | | |
| | | } |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("企业新建商品") |
| | | @PostMapping("/companyCreate") |
| | | // @RequiresPermissions("business:goods:create") |
| | | @RequiresPermissions("business:goods:create") |
| | | public ApiResponse companyCreate(@RequestBody Goods goods) { |
| | | goodsService.companyCreate(goods); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), |
| | | }) |
| | | // @RequiresPermissions("business:goods:create") |
| | | @RequiresPermissions("business:goods:create") |
| | | public ApiResponse<Integer> importExcel (@ApiParam(value = "file") MultipartFile file) { |
| | | Integer val = goodsService.importBatch(file); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | |
| | | * @param pageWrap 分页对象 |
| | | * @return PageData<BaseGoods> |
| | | */ |
| | | PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap,Integer companyId); |
| | | PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap); |
| | | |
| | | /** |
| | | * 条件统计 |
| | |
| | | |
| | | |
| | | @Override |
| | | public PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap ,Integer companyId) { |
| | | |
| | | //查询企业已经存在的商品 |
| | | List<Integer> collect = new ArrayList<>(); |
| | | if(Objects.nonNull(companyId)){ |
| | | QueryWrapper<Goods> goodsQuery = new QueryWrapper<>(); |
| | | goodsQuery.lambda().eq(Goods::getIsdeleted,Constants.ZERO) |
| | | .eq(Goods::getCompanyId,companyId) |
| | | .isNotNull(Goods::getGoodsId); |
| | | List<Goods> goods = goodsMapper.selectList(goodsQuery); |
| | | if (CollectionUtils.isEmpty(goods)){ |
| | | collect = goods.stream().map(s -> s.getGoodsId()).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | public PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | IPage<BaseGoods> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<BaseGoods> queryWrapper = new MPJLambdaWrapper<>(); |
| | |
| | | .eq(pageWrap.getModel().getCategoryId()!=null,BaseGoods::getCategoryId, pageWrap.getModel().getCategoryId()) |
| | | .eq(pageWrap.getModel().getBrandId()!=null,BaseGoods::getBrandId, pageWrap.getModel().getBrandId()) |
| | | .eq(pageWrap.getModel().getStatus()!=null,BaseGoods::getStatus, pageWrap.getModel().getStatus()) |
| | | .notIn(!CollectionUtils.isEmpty(collect),BaseGoods::getId, collect); |
| | | |
| | | .notExists(user.getType().equals(Constants.UserType.COMPANY.getKey())," select 1 from goods g where g.GOODS_ID = t.id and g.TYPE = 1 and g.company_id = "+user.getCompanyId()+" "); |
| | | queryWrapper.orderByDesc(Goods::getId); |
| | | PageData<BaseGoods> pageData =PageData.from(baseGoodsJoinMapper.selectJoinPage(page,BaseGoods.class,queryWrapper)); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | |
| | | |
| | | QueryWrapper<Brand> brandQuery = new QueryWrapper<>(); |
| | | brandQuery.lambda() |
| | | .eq(Brand::getType,Constants.ONE) |
| | | .eq(Brand::getName,s.getBrandName()); |
| | | brandQuery.lambda() |
| | | .eq(Brand::getIsdeleted,Constants.ZERO); |
| | |
| | | .or().eq(Brand::getType,Constants.ONE) |
| | | ); |
| | | } |
| | | queryWrapper.lambda().orderByAsc(Brand::getType); |
| | | queryWrapper.lambda().orderByAsc(Brand::getSortnum); |
| | | IPage<Brand> brandIPage = brandMapper.selectPage(page, queryWrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .eq("STATUS",Constants.ZERO) |
| | | .last(" limit 1 ")); |
| | | if(Objects.isNull(cateParam)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"企业分类数据同步异常请联系管理员"); |
| | | } |
| | | // if(Objects.isNull(cateParam)){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"企业分类数据同步异常请联系管理员"); |
| | | // } |
| | | GoodsParam goodsParam = new GoodsParam(); |
| | | goodsParam.setCreator(user.getId()); |
| | | goodsParam.setCreateDate(new Date()); |
| | |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParam.setVal(bgParam.getVal()); |
| | | goodsParam.setName(bgParam.getName()); |
| | | goodsParam.setPramaId(cateParam.getId()); |
| | | goodsParam.setPramaId(Objects.isNull(cateParam)?null:cateParam.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | |
| | | //存储 cate_param_select 查询是否已存在 |
| | | // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | // CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | // cateParamSelect.setCreator(user.getId()); |
| | | // cateParamSelect.setCreateDate(new Date()); |
| | | // cateParamSelect.setName(goodsParam.getVal()); |
| | | // cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | // cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelectMapper.insert(cateParamSelect); |
| | | // }; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | INSERT INTO `cate_param_select` |
| | | (`CREATOR`, `CREATE_DATE`, `EDITOR`, `EDIT_DATE`, `ISDELETED`, `REMARK`, `NAME`, `PARAM_ID`, `CATEGORY_ID`, |
| | | `STATUS`, `SORTNUM`) |
| | | select #{userId} , now(),null , null , 0 , null , a.VAL , a.PRAMA_ID , b.CATEGORY_ID , 0 , null from goods_param a inner join goods b on a.GOODS_ID = b.ID |
| | | select DISTINCT #{userId} , now(),null , null , 0 , null , a.VAL , a.PRAMA_ID , b.CATEGORY_ID , 0 , null from goods_param a inner join goods b on a.GOODS_ID = b.ID |
| | | and a.PRAMA_ID is not null AND a.VAL is not null |
| | | and a.ISDELETED = 0 |
| | | and a.`STATUS` = 0 |