|
|
@ -18,7 +18,7 @@ |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">条码:</span> |
|
|
|
<el-input v-model="locationForm.barCode" placeholder="" class="item_input" clearable /> |
|
|
|
<!-- <el-button type="primary" size="small" @click="createBarCode" :disabled="disabledCode">随机</el-button>--> |
|
|
|
<!-- <el-button type="primary" size="small" @click="createBarCode" :disabled="disabledCode">随机</el-button>--> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">商品名:</span> |
|
|
@ -28,21 +28,56 @@ |
|
|
|
<span class="item_text">别名:</span> |
|
|
|
<el-input v-model="locationForm.anotherName" class="item_input" clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">编码:</span> |
|
|
|
<el-input v-model="locationForm.code" :disabled="true" class="item_input" clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">品牌:</span> |
|
|
|
<el-select v-model="locationForm.brand" @change="selectBrand" class="item_input" placeholder="请选择"> |
|
|
|
<el-option v-for="(item,i) in brandList" :key="i" :label="item.dictValue" :value="item.sid"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">一级类别:</span> |
|
|
|
<el-select v-model="locationForm.categoryY" @change="selectCategoryA" class="item_input" placeholder="请选择"> |
|
|
|
<el-option v-for="(item,i) in categoryAList" :key="i" :label="item.categorys" :value="item.sid"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">二级类别:</span> |
|
|
|
<el-select v-model="locationForm.categoryR" @change="selectCategoryB" class="item_input" placeholder="请选择"> |
|
|
|
<el-option v-for="(item,i) in categoryBList" :key="i" :label="item.categorys" :value="item.sid"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">三级类别:</span> |
|
|
|
<el-select v-model="locationForm.category" @change="selectCategoryC" class="item_input" placeholder="请选择"> |
|
|
|
<el-option v-for="(item,i) in categoryCList" :key="i" :label="item.categorys" :value="item.sid"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">价值:</span> |
|
|
|
<el-input v-model="locationForm.value" class="item_input" @input="limitInput1($event)" clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">净重:</span> |
|
|
|
<el-input v-model="locationForm.netWeight" class="item_input" @input="limitInput2($event)" clearable></el-input> |
|
|
|
<el-input v-model="locationForm.netWeight" class="item_input" @input="limitInput2($event)" |
|
|
|
clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">毛重:</span> |
|
|
|
<el-input v-model="locationForm.roughWeight" class="item_input" @input="limitInput3($event)" clearable></el-input> |
|
|
|
<el-input v-model="locationForm.roughWeight" class="item_input" @input="limitInput3($event)" |
|
|
|
clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">有效天数:</span> |
|
|
|
<el-input v-model="locationForm.effectiveDays" class="item_input" @input="limitInput4($event)" clearable></el-input> |
|
|
|
<el-input v-model="locationForm.effectiveDays" class="item_input" @input="limitInput4($event)" |
|
|
|
clearable></el-input> |
|
|
|
</div> |
|
|
|
<div class="item"> |
|
|
|
<span class="item_text">备注:</span> |
|
|
@ -52,9 +87,9 @@ |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -64,19 +99,113 @@ |
|
|
|
barCode: "", |
|
|
|
name: "", |
|
|
|
anotherName: "", |
|
|
|
code: "系统自动排序生成", |
|
|
|
value: "", |
|
|
|
netWeight: "", |
|
|
|
roughWeight: "", |
|
|
|
effectiveDays: "", |
|
|
|
remarks: "", |
|
|
|
brand:"", |
|
|
|
brandSid: "", |
|
|
|
categoryY: "", |
|
|
|
categorySidY: "", |
|
|
|
categoryR: "", |
|
|
|
categorySidR: "", |
|
|
|
category: "", |
|
|
|
categorySid: "", |
|
|
|
}, |
|
|
|
viewTitle: "【新增】产品信息", |
|
|
|
brandList: [], |
|
|
|
categoryAList: [], |
|
|
|
categoryBList: [], |
|
|
|
categoryCList: [], |
|
|
|
categoryPSid: "1" // 默认类别 父级sid |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
|
|
|
|
this.getBrandList() |
|
|
|
this.getCategoryList("1") |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async getBrandList() { |
|
|
|
const { |
|
|
|
data: result |
|
|
|
} = await this.$http.post('/v1/restrictedbrand/brandList', '') |
|
|
|
if (result.code == 200) { |
|
|
|
console.log("getBrandList", result.data) |
|
|
|
|
|
|
|
this.brandList = result.data |
|
|
|
} |
|
|
|
}, |
|
|
|
async getCategoryList(type) { |
|
|
|
const { |
|
|
|
data: result |
|
|
|
} = await this.$http.get('/v1/restrictedcategory/categoryListByPsid/' + this.categoryPSid, this.categoryPSid) |
|
|
|
if (result.code == 200) { |
|
|
|
console.log("getCategoryList", result.data) |
|
|
|
|
|
|
|
if ('1' == type) { |
|
|
|
this.categoryAList = result.data |
|
|
|
} |
|
|
|
if ('2' == type) { |
|
|
|
this.categoryBList = result.data |
|
|
|
} |
|
|
|
if ('3' == type) { |
|
|
|
this.categoryCList = result.data |
|
|
|
} |
|
|
|
|
|
|
|
// this.brandList = result.data |
|
|
|
} |
|
|
|
}, |
|
|
|
selectBrand(value) { |
|
|
|
console.log("selectBrand", value) |
|
|
|
|
|
|
|
this.locationForm.brandSid = value |
|
|
|
|
|
|
|
console.log("selectBrand", this.locationForm.brandSid) |
|
|
|
}, |
|
|
|
selectCategoryA(value) { |
|
|
|
|
|
|
|
this.categoryBList = [] |
|
|
|
this.categoryCList = [] |
|
|
|
|
|
|
|
|
|
|
|
this.locationForm.categoryR = '' |
|
|
|
this.locationForm.categorySidR = '' |
|
|
|
|
|
|
|
this.locationForm.category = '' |
|
|
|
this.locationForm.categorySid = '' |
|
|
|
|
|
|
|
|
|
|
|
this.categoryPSid = value |
|
|
|
|
|
|
|
this.locationForm.categoryAsid = value |
|
|
|
|
|
|
|
this.getCategoryList("2") |
|
|
|
|
|
|
|
console.log("categoryPSid", this.categoryPSid) |
|
|
|
console.log("selectCategoryA", value) |
|
|
|
}, |
|
|
|
selectCategoryB(value) { |
|
|
|
this.categoryCList = [] |
|
|
|
|
|
|
|
this.locationForm.category = '' |
|
|
|
this.locationForm.categorySid = '' |
|
|
|
|
|
|
|
this.categoryPSid = value |
|
|
|
this.locationForm.categoryBsid = value |
|
|
|
|
|
|
|
this.getCategoryList("3") |
|
|
|
|
|
|
|
console.log("categoryPSid", this.categoryPSid) |
|
|
|
|
|
|
|
console.log("selectCategoryB", value) |
|
|
|
}, |
|
|
|
selectCategoryC(value) { |
|
|
|
console.log("selectCategoryC", value) |
|
|
|
this.locationForm.categorySid = value |
|
|
|
}, |
|
|
|
|
|
|
|
saveOrUpdate() { |
|
|
|
if (this.viewTitle === "【新增】产品信息") return this.addProduct() |
|
|
|
if (this.viewTitle === "【修改】产品信息") { |
|
|
@ -92,44 +221,56 @@ |
|
|
|
|
|
|
|
showAdd() { |
|
|
|
this.viewTitle = "【新增】产品信息"; |
|
|
|
this.disabledCode=false |
|
|
|
this.disabledCode = false |
|
|
|
this.clearList() |
|
|
|
}, |
|
|
|
clearList(){ |
|
|
|
clearList() { |
|
|
|
this.locationForm = { |
|
|
|
barCode: "", |
|
|
|
name: "", |
|
|
|
anotherName: "", |
|
|
|
value: "", |
|
|
|
code:"系统自动排序生成", |
|
|
|
netWeight: "", |
|
|
|
roughWeight: "", |
|
|
|
effectiveDays: "", |
|
|
|
remarks: "", |
|
|
|
brandSid: "", |
|
|
|
categoryA: "", |
|
|
|
categoryAsid: "", |
|
|
|
categoryB: "", |
|
|
|
categoryBsid: "", |
|
|
|
categoryC: "", |
|
|
|
categorySid: "", |
|
|
|
} |
|
|
|
}, |
|
|
|
showEdit(row) { |
|
|
|
console.log(row); |
|
|
|
this.viewTitle = "【修改】产品信息"; |
|
|
|
this.disabledCode=true |
|
|
|
this.locationForm=row |
|
|
|
}, |
|
|
|
async updataProduct () { |
|
|
|
// this.locationForm = { |
|
|
|
// name: "", |
|
|
|
// anotherName: "", |
|
|
|
// } |
|
|
|
const { data: result } = await this.$http.put('/product/updataProduct', this.locationForm) |
|
|
|
this.disabledCode = true |
|
|
|
this.locationForm = row |
|
|
|
}, |
|
|
|
async updataProduct() { |
|
|
|
|
|
|
|
console.log("updataProduct", this.locationForm) |
|
|
|
|
|
|
|
const { |
|
|
|
data: result |
|
|
|
} = await this.$http.put('/product/updataProduct', this.locationForm) |
|
|
|
if (result.status !== 200) return this.$message.error('更新数据失败') |
|
|
|
this.$message.success('更新成功') |
|
|
|
this.handleReturn('true') |
|
|
|
}, |
|
|
|
async addProduct () { |
|
|
|
const { data: result } = await this.$http.post('/product/addProduct', this.locationForm) |
|
|
|
async addProduct() { |
|
|
|
console.log("addProduct", this.locationForm) |
|
|
|
const { |
|
|
|
data: result |
|
|
|
} = await this.$http.post('/product/addProduct', this.locationForm) |
|
|
|
if (result.status !== 200) return this.$message.error('添加产品失败') |
|
|
|
this.$message.success('添加产品成功') |
|
|
|
this.handleReturn('true') |
|
|
|
}, |
|
|
|
createBarCode () { |
|
|
|
createBarCode() { |
|
|
|
var now = new Date() |
|
|
|
var nowstr = now.getTime() |
|
|
|
this.locationForm.barCode = 'P' + now.getTime() |
|
|
@ -168,8 +309,8 @@ |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style lang="scss"> |
|
|
|
</script> |
|
|
|
<style lang="scss"> |
|
|
|
.box-card { |
|
|
|
margin-left: 60px; |
|
|
|
margin-right: 60px; |
|
|
@ -196,6 +337,7 @@ |
|
|
|
margin-left: 10px; |
|
|
|
margin-right: 80px; |
|
|
|
} |
|
|
|
|
|
|
|
.item_inputs { |
|
|
|
flex: 4; |
|
|
|
font-size: 16px; |
|
|
@ -237,4 +379,4 @@ |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|