便利店
This commit is contained in:
parent
2af2037ed1
commit
2b6850b251
@ -50,6 +50,7 @@
|
|||||||
"html2canvas": "^1.4.1",
|
"html2canvas": "^1.4.1",
|
||||||
"js-beautify": "1.13.0",
|
"js-beautify": "1.13.0",
|
||||||
"js-cookie": "3.0.1",
|
"js-cookie": "3.0.1",
|
||||||
|
"js-pinyin": "^0.2.5",
|
||||||
"jsencrypt": "3.0.0-rc.1",
|
"jsencrypt": "3.0.0-rc.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
|
@ -167,7 +167,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="商品名称" prop="name">
|
<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-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@ -258,7 +258,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<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-group v-model="form.status">
|
||||||
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@ -285,10 +285,11 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
import {selectParentById, selectTree} from "@/api/convenienceStore/goods";
|
import {selectTree} from "@/api/convenienceStore/goods";
|
||||||
import {listSupplier} from "@/api/convenienceStore/supplier";
|
import {listSupplier} from "@/api/convenienceStore/supplier";
|
||||||
import {addLJGoods, delLJGoods, getLJGoods, listLJGoods, updateLJGoods} from "@/api/convenienceStore/ljgoods";
|
import {addLJGoods, delLJGoods, getLJGoods, listLJGoods, updateLJGoods} from "@/api/convenienceStore/ljgoods";
|
||||||
import {getSysConfig} from "@/api/staff/user/sysconfig";
|
import {getSysConfig} from "@/api/staff/user/sysconfig";
|
||||||
|
import pinyin from "js-pinyin";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
dicts: ['zhzt','yes_or_no'],
|
dicts: ['zhzt','yes_or_no'],
|
||||||
@ -328,13 +329,46 @@ export default {
|
|||||||
isRecovery:0,
|
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,
|
showSearch: true,
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
|
goodsNo: [
|
||||||
|
{ required: true, message: "商品条码不能为空", trigger: "blur" },
|
||||||
|
],
|
||||||
name: [
|
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:{
|
computed:{
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
pinyin(){
|
||||||
|
let pinyin = require("js-pinyin");
|
||||||
|
pinyin.setOptions({ checkPolyphone: false, charCase: 1 });
|
||||||
|
this.form.pinyinCode = pinyin.getCamelChars(this.form.name)
|
||||||
|
},
|
||||||
// 排序计步器
|
// 排序计步器
|
||||||
handleChange(value) {
|
handleChange(value) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
@ -389,7 +428,10 @@ export default {
|
|||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.resetForm("form");
|
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() {
|
handleAdd() {
|
||||||
|
@ -46,6 +46,16 @@ public class LJGoodsController extends BaseController {
|
|||||||
return getSuccessResult(goods);
|
return getSuccessResult(goods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成13位数字条码信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/createGoodsNo")
|
||||||
|
public ResponseObject createGoodsNo(){
|
||||||
|
String goodNo = goodsService.createGoodNo();
|
||||||
|
return getSuccessResult(goodNo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除商品信息
|
* 删除商品信息
|
||||||
* @return
|
* @return
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<where>
|
<where>
|
||||||
store_id = #{goods.storeId} and is_recovery = #{goods.isRecovery}
|
store_id = #{goods.storeId} and is_recovery = #{goods.isRecovery}
|
||||||
<if test="goods.cvsGoodId != null and goods.cvsGoodId != ''">
|
<if test="goods.cvsGoodId != null and goods.cvsGoodId != ''">
|
||||||
and cvs_good_id like concat('%', #{goods.cvsGoodId}, '%')
|
and cvs_good_id = #{goods.cvsGoodId}
|
||||||
</if>
|
</if>
|
||||||
<if test="goods.supplierId != null and goods.supplierId != ''">
|
<if test="goods.supplierId != null and goods.supplierId != ''">
|
||||||
and supplier_id like concat('%', #{goods.supplierId}, '%')
|
and supplier_id = #{goods.supplierId}
|
||||||
</if>
|
</if>
|
||||||
<if test="goods.name != null and goods.name != ''">
|
<if test="goods.name != null and goods.name != ''">
|
||||||
and name like concat('%', #{goods.name}, '%')
|
and name like concat('%', #{goods.name}, '%')
|
||||||
|
@ -22,6 +22,12 @@ public interface LJGoodsService {
|
|||||||
*/
|
*/
|
||||||
public LJGoods selectLJGoodsById(int id);
|
public LJGoods selectLJGoodsById(int id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成13位条码数字信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String createGoodNo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id删除商品信息
|
* 根据id删除商品信息
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -10,6 +10,8 @@ import com.fuint.common.dto.AccountInfo;
|
|||||||
import com.fuint.common.util.TokenUtil;
|
import com.fuint.common.util.TokenUtil;
|
||||||
import org.springframework.stereotype.Service;
|
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);
|
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删除商品信息
|
* 根据id删除商品信息
|
||||||
* @param id
|
* @param id
|
||||||
|
Loading…
Reference in New Issue
Block a user