便利店

This commit is contained in:
cun-nan 2023-10-26 16:02:04 +08:00
parent 2af2037ed1
commit 2b6850b251
6 changed files with 97 additions and 8 deletions

View File

@ -50,6 +50,7 @@
"html2canvas": "^1.4.1",
"js-beautify": "1.13.0",
"js-cookie": "3.0.1",
"js-pinyin": "^0.2.5",
"jsencrypt": "3.0.0-rc.1",
"nprogress": "0.2.0",
"qrcode": "^1.5.3",

View File

@ -167,7 +167,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入商品名称"/>
<el-input v-model="form.name" @input="pinyin" placeholder="请输入商品名称"/>
</el-form-item>
</el-col>
<el-col :span="12">
@ -258,7 +258,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="mobile">
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
@ -285,10 +285,11 @@
<script>
import {selectParentById, selectTree} from "@/api/convenienceStore/goods";
import {selectTree} from "@/api/convenienceStore/goods";
import {listSupplier} from "@/api/convenienceStore/supplier";
import {addLJGoods, delLJGoods, getLJGoods, listLJGoods, updateLJGoods} from "@/api/convenienceStore/ljgoods";
import {getSysConfig} from "@/api/staff/user/sysconfig";
import pinyin from "js-pinyin";
export default {
dicts: ['zhzt','yes_or_no'],
@ -328,13 +329,46 @@ export default {
isRecovery:0,
},
//
form: {},
form: {
id:'',goodsNo:'',name:'',cvsGoodId:"",buyingPrice:'',retailPrice:"",memberPrice:'',pinyinCode:"",
unit:'',shelfNumber:'',canUsePoint:'no',stock:0,supplierId:'',sort:0,status:'qy'
},
//
showSearch: true,
//
rules: {
goodsNo: [
{ required: true, message: "商品条码不能为空", trigger: "blur" },
],
name: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
{ required: true, message: "商品名称不能为空", trigger: "blur" },
],
cvsGoodId: [
{ required: true, message: "请选择商品分类", trigger: "blur" },
],
buyingPrice: [
{ required: true, message: "请输入商品进货单价", trigger: "blur" },
],
retailPrice: [
{ required: true, message: "请输入商品零售价", trigger: "blur" },
],
memberPrice: [
{ required: true, message: "请输入商品会员价", trigger: "blur" },
],
pinyinCode: [
{ required: true, message: "商品拼音码不能为空", trigger: "blur" },
],
unit: [
{ required: true, message: "请输入商品单位", trigger: "blur" },
],
canUsePoint: [
{ required: true, message: "请选择是否能使用积分抵扣", trigger: "blur" },
],
supplierId: [
{ required: true, message: "请选择供应商", trigger: "blur" },
],
status: [
{ required: true, message: "请选择商品状态", trigger: "blur" },
],
}
}
@ -347,6 +381,11 @@ export default {
computed:{
},
methods:{
pinyin(){
let pinyin = require("js-pinyin");
pinyin.setOptions({ checkPolyphone: false, charCase: 1 });
this.form.pinyinCode = pinyin.getCamelChars(this.form.name)
},
//
handleChange(value) {
console.log(value);
@ -389,7 +428,10 @@ export default {
//
reset() {
this.resetForm("form");
this.form= {}
this.form= {
id:'',goodsNo:'',name:'',cvsGoodId:"",buyingPrice:'',retailPrice:"",memberPrice:'',pinyinCode:"",
unit:'',shelfNumber:'',canUsePoint:'no',stock:0,supplierId:'',sort:0,status:'qy'
}
},
//
handleAdd() {

View File

@ -46,6 +46,16 @@ public class LJGoodsController extends BaseController {
return getSuccessResult(goods);
}
/**
* 生成13位数字条码信息
* @return
*/
@GetMapping("/createGoodsNo")
public ResponseObject createGoodsNo(){
String goodNo = goodsService.createGoodNo();
return getSuccessResult(goodNo);
}
/**
* 删除商品信息
* @return

View File

@ -10,10 +10,10 @@
<where>
store_id = #{goods.storeId} and is_recovery = #{goods.isRecovery}
<if test="goods.cvsGoodId != null and goods.cvsGoodId != ''">
and cvs_good_id like concat('%', #{goods.cvsGoodId}, '%')
and cvs_good_id = #{goods.cvsGoodId}
</if>
<if test="goods.supplierId != null and goods.supplierId != ''">
and supplier_id like concat('%', #{goods.supplierId}, '%')
and supplier_id = #{goods.supplierId}
</if>
<if test="goods.name != null and goods.name != ''">
and name like concat('%', #{goods.name}, '%')

View File

@ -22,6 +22,12 @@ public interface LJGoodsService {
*/
public LJGoods selectLJGoodsById(int id);
/**
* 生成13位条码数字信息
* @return
*/
public String createGoodNo();
/**
* 根据id删除商品信息
* @param id

View File

@ -10,6 +10,8 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import java.util.Random;
/**
* 商品信息 业务层
*/
@ -39,6 +41,34 @@ public class LJGoodsServiceImpl extends ServiceImpl<LJGoodsMapper, LJGoods> impl
return baseMapper.selectById(id);
}
/**
* 生成13位条码数字信息
* @return
*/
@Override
public String createGoodNo() {
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 12; i++) {
sb.append(random.nextInt(10));
}
String digits = sb.toString();
int sum = 0;
for (int i = 0; i < digits.length(); i++) {
int digit = Integer.parseInt(String.valueOf(digits.charAt(i)));
if (i % 2 == 0) {
sum += digit;
} else {
sum += digit * 3;
}
}
int checksum = (10 - (sum % 10)) % 10;
String number = digits + checksum;
return number;
}
/**
* 根据id删除商品信息
* @param id