便利店

This commit is contained in:
cun-nan 2023-10-28 15:03:28 +08:00
parent 217a549247
commit 92eafa75ec
10 changed files with 129 additions and 12 deletions

View File

@ -18,6 +18,14 @@ export function selectTree(data) {
})
}
// 联级选择器 树形数据结构
export function cvsGoodsTree() {
return request({
url: '/business/cvsGoods/tree',
method: 'get',
})
}
// 查询一级分类
export function list(data) {
return request({

View File

@ -7,6 +7,7 @@
<el-tab-pane label="商品回收站" name="recovery"></el-tab-pane>
</el-tabs>
<el-form-item label="商品分类" prop="cvsGoodId">
<!-- <el-cascader :options="cvsGoodOptions" clearable></el-cascader>-->
<el-select
v-model="queryParams.cvsGoodId"
placeholder="全部"
@ -259,7 +260,7 @@
</el-col>
<el-col :span="16">
<el-form-item label="初始库存" prop="stock">
<el-input v-model="form.stock" placeholder="0"/>
<el-input v-model="form.stock" :disabled="isAdd" placeholder="0"/>
</el-form-item>
</el-col>
</el-row>
@ -311,7 +312,7 @@
<script>
import {selectTree} from "@/api/convenienceStore/goods";
import {cvsGoodsTree, selectTree} from "@/api/convenienceStore/goods";
import {listSupplier} from "@/api/convenienceStore/supplier";
import {
addLJGoods,
@ -328,6 +329,8 @@ export default {
dicts: ['zhzt','yes_or_no'],
data(){
return {
cvsGoodOptions:[],
isAdd:false,
activeName: 'goods',
//
stockType:'',
@ -411,10 +414,16 @@ export default {
this.getList();
this.getQueryList();
this.getType();
// this.getTree();
},
computed:{
},
methods:{
getTree(){
cvsGoodsTree().then(response => {
console.log(response)
})
},
//
getPrice(){
this.form.memberPrice = this.form.retailPrice
@ -553,6 +562,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.isAdd = false;
this.title = "新增商品";
},
//
@ -562,6 +572,7 @@ export default {
getLJGoods(id).then(response => {
this.form = response.data;
this.open = true;
this.isAdd = true;
this.title = "编辑商品";
});
},

View File

@ -1279,6 +1279,7 @@ export default {
}).then(() => {
this.queryParams.page = 1
this.getList();
this.getListMember();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.CvsGoods;
import com.fuint.business.convenienceSore.service.CvsGoodsService;
import com.fuint.business.convenienceSore.vo.CvsGoodsTree;
import com.fuint.business.convenienceSore.vo.CvsGoodsVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
@ -33,9 +34,19 @@ public class CvsGoodsController extends BaseController {
}
}
/**
* 联级选择器树形数据结构
* @return
*/
@GetMapping("/tree")
public ResponseObject tree(){
List<CvsGoodsTree> list = cvsGoodsService.selectCvsGoodsTree();
return getSuccessResult(list);
}
/**分页查询*/
@GetMapping("/selectTree")
private ResponseObject selectTree(CvsGoods goods,
public ResponseObject selectTree(CvsGoods goods,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.convenienceSore.entity.CvsGoods;
import com.fuint.business.convenienceSore.vo.CvsGoodsTree;
import com.fuint.business.convenienceSore.vo.CvsGoodsVo;
import io.swagger.models.auth.In;
@ -29,12 +30,18 @@ public interface CvsGoodsService extends IService<CvsGoods> {
IPage<CvsGoodsVo> selectTree(Page page, CvsGoods goods);
/**
*
* 查询一级节点
* @param goods
* @return
*/
List<CvsGoods> selectCvsGoodsList(CvsGoods goods);
/**
* 联级选择器 树形数据结构
* @return
*/
List<CvsGoodsTree> selectCvsGoodsTree();
/**
* 根据id查询商品分类信息
* @param id

View File

@ -2,12 +2,14 @@ package com.fuint.business.convenienceSore.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.convenienceSore.entity.CvsGoods;
import com.fuint.business.convenienceSore.mapper.CvsGoodsMapper;
import com.fuint.business.convenienceSore.service.CvsGoodsService;
import com.fuint.business.convenienceSore.vo.CvsGoodsTree;
import com.fuint.business.convenienceSore.vo.CvsGoodsVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
@ -118,6 +120,44 @@ public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> im
return baseMapper.selectList(queryWrapper);
}
/**
* 联级选择器 树形数据结构
* @return
*/
@Override
public List<CvsGoodsTree> selectCvsGoodsTree() {
AccountInfo nowAccountInfo1 = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo1.getStoreId();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_id",storeId);
List<CvsGoods> cvsGoods = baseMapper.selectList(queryWrapper);
List<CvsGoodsTree> list = new ArrayList<>();
for (CvsGoods cvsGood : cvsGoods) {
if (cvsGood.getPid()==0){
CvsGoodsTree cvsGoodsTree = new CvsGoodsTree();
cvsGoodsTree.setPid(cvsGood.getPid());
cvsGoodsTree.setValue(cvsGood.getId());
cvsGoodsTree.setLabel(cvsGood.getName());
cvsGoodsTree.setChildren(new ArrayList<>());
list.add(cvsGoodsTree);
}
}
for (int i = 0; i < cvsGoods.size(); i++){
List<CvsGoodsTree> children = new ArrayList<>();
for (CvsGoods cvsGood : cvsGoods) {
if (list.get(i).getPid()==cvsGood.getPid()){
CvsGoodsTree cvsGoodsTree = new CvsGoodsTree();
cvsGoodsTree.setPid(cvsGood.getPid());
cvsGoodsTree.setValue(cvsGood.getId());
cvsGoodsTree.setLabel(cvsGood.getName());
children.add(cvsGoodsTree);
}
}
list.get(i).setChildren(children);
}
return list;
}
//根据id查找父级
public CvsGoods selectParentById(Integer id){
return baseMapper.selectById(id);

View File

@ -0,0 +1,13 @@
package com.fuint.business.convenienceSore.vo;
import lombok.Data;
import java.util.List;
@Data
public class CvsGoodsTree {
private Integer value;
private Integer pid;
private String label;
private List<CvsGoodsTree> children;
}

View File

@ -63,4 +63,11 @@ public interface CertifiedMemberService extends IService<CertifiedMember> {
* @return
*/
public int updateCertifiedMember(CertifiedMember certifiedMember);
/**
* 修改认证会员手机号
* @param certifiedMember
* @return
*/
public int updateCertifiedMemberByUserId(CertifiedMember certifiedMember);
}

View File

@ -1,18 +1,14 @@
package com.fuint.business.userManager.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.userManager.entity.CertifiedMember;
import com.fuint.business.userManager.entity.FixingLevel;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.mapper.CertifiedMemberMapper;
import com.fuint.business.userManager.mapper.FixingLevelMapper;
import com.fuint.business.userManager.service.CertifiedMemberService;
import com.fuint.business.userManager.service.FixingLevelService;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
@ -149,4 +145,17 @@ public class CertifiedMemberServiceImpl extends ServiceImpl<CertifiedMemberMappe
int row = baseMapper.updateById(certifiedMember);
return row;
}
/**
* 修改认证会员手机号
* @param certifiedMember
* @return
*/
@Override
public int updateCertifiedMemberByUserId(CertifiedMember certifiedMember) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id",certifiedMember.getUserId());
int row = baseMapper.update(certifiedMember, queryWrapper);
return row;
}
}

View File

@ -1,20 +1,20 @@
package com.fuint.business.userManager.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.userManager.entity.CertifiedMember;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.mapper.CertifiedMemberMapper;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.CertifiedMemberService;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.xml.crypto.Data;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
/**
@ -22,6 +22,9 @@ import java.util.*;
*/
@Service
public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> implements LJUserService {
@Autowired
private CertifiedMemberMapper certifiedMemberMapper;
/**
* 根据条件分页查询会员信息
* @param page
@ -131,6 +134,13 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
@Override
public int updateUser(LJUser user) {
int row = baseMapper.updateById(user);
// 修改认证会员手机号
CertifiedMember certifiedMember = new CertifiedMember();
certifiedMember.setUserId(user.getId());
certifiedMember.setMobile(user.getMobile());
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id",certifiedMember.getUserId());
certifiedMemberMapper.update(certifiedMember,queryWrapper);
return row;
}
}