1 changed files with 222 additions and 214 deletions
@ -1,220 +1,228 @@ |
|||||
<template> |
<template> |
||||
<div> |
<div> |
||||
|
|
||||
<div class="tab-header webtop"> |
<div class="tab-header webtop"> |
||||
<!-- 标题 --> |
<!-- 标题 --> |
||||
<div>商品信息</div> |
<div>商品信息</div> |
||||
<!-- start 添加修改按钮 --> |
<!-- start 添加修改按钮 --> |
||||
<div> |
<div> |
||||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button> |
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button> |
||||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
||||
</div> |
</div> |
||||
<!-- end 添加修改按钮 --> |
<!-- end 添加修改按钮 --> |
||||
<!-- end 详情按钮 --> |
<!-- end 详情按钮 --> |
||||
</div> |
</div> |
||||
|
|
||||
<div class="listconadd"> |
<div class="listconadd"> |
||||
|
|
||||
<el-card class="box-card"> |
<el-card class="box-card"> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">名称:</span> |
<span class="item_text">名称:</span> |
||||
<el-input v-model="formobj.name" placeholder="" class="item_input" clearable /> |
<el-input v-model="formobj.name" placeholder="" class="item_input" clearable /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">编码:</span> |
<span class="item_text">编码:</span> |
||||
<el-input v-model="formobj.code" placeholder="" class="item_input" clearable oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" /> |
<el-input v-model="formobj.code" placeholder="" class="item_input" clearable |
||||
</div> |
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" /> |
||||
<div class="item"> |
</div> |
||||
<span class="item_text">条码:</span> |
<div class="item"> |
||||
<el-input v-model="formobj.barcode" placeholder="" class="item_input" clearable oninput="value=value.replace(/[^0-9]/g,'')" /> |
<span class="item_text">条码:</span> |
||||
</div> |
<el-input v-model="formobj.barcode" placeholder="" class="item_input" clearable |
||||
<div class="item"> |
oninput="value=value.replace(/[^0-9]/g,'')" /> |
||||
<span class="item_text">价格:</span> |
</div> |
||||
<el-input v-model="formobj.price" placeholder="" class="item_input" clearable |
<div class="item"> |
||||
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
<span class="item_text">价格:</span> |
||||
</div> |
<el-input v-model="formobj.price" placeholder="" class="item_input" clearable |
||||
<div class="item"> |
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
||||
<span class="item_text">单位:</span> |
</div> |
||||
<el-input v-model="formobj.unitName" placeholder="" class="item_input" clearable /> |
<div class="item"> |
||||
</div> |
<span class="item_text">单位:</span> |
||||
<div class="item"> |
<el-input v-model="formobj.unitName" placeholder="" class="item_input" clearable /> |
||||
<span class="item_text">备注:</span> |
</div> |
||||
<el-input v-model="formobj.remarks" placeholder="例如:一份30斤" class="item_input" clearable /> |
<div class="item"> |
||||
</div> |
<span class="item_text">备注:</span> |
||||
|
<el-input v-model="formobj.remarks" placeholder="例如:一份30斤" class="item_input" clearable /> |
||||
<div> |
</div> |
||||
<span class="item_text">商品详情:</span> |
|
||||
<editor :height="300" :minHeight="100" :value="formobj.appContent" @input="editinput"></editor> |
<div class="item" style="margin-bottom: 100px;margin-top: 100px;"> |
||||
</div> |
<span class="item_text">图片:</span> |
||||
|
<upload style="margin-top: 20px;" class="item_input" ref="uploadImg2" v-model="imgList" :limit="1" |
||||
</el-card> |
@change="backData" bucket="map" :upload-data="{ type: '0001' }"></upload> |
||||
|
</div> |
||||
</div> |
|
||||
|
<div> |
||||
</div> |
<span class="item_text">商品详情:</span> |
||||
|
<editor :height="300" :minHeight="100" :value="formobj.appContent" @input="editinput"></editor> |
||||
|
</div> |
||||
|
|
||||
|
</el-card> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import req from '@/api/commodity/commodity.js' |
import req from '@/api/commodity/commodity.js' |
||||
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue' |
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue' |
||||
import Editor from '@/components/Editor' |
import Editor from '@/components/Editor' |
||||
|
|
||||
export default { |
export default { |
||||
components: { |
components: { |
||||
upload, |
upload, |
||||
Editor |
Editor |
||||
}, |
}, |
||||
data() { |
data() { |
||||
return { |
return { |
||||
imgList: [ |
imgList: [ |
||||
|
|
||||
|
|
||||
], |
], |
||||
submitdisabled: false, |
submitdisabled: false, |
||||
formobj: { |
formobj: { |
||||
sid: "", |
sid: "", |
||||
name: '', |
name: '', |
||||
code: '', |
code: '', |
||||
barcode: '', |
barcode: '', |
||||
price: "", |
price: "", |
||||
unitName: "", |
unitName: "", |
||||
remarks: "", |
remarks: "", |
||||
picUrl: "", |
picUrl: "", |
||||
appContent:'' |
appContent: '' |
||||
} |
} |
||||
} |
} |
||||
}, |
}, |
||||
methods: { |
methods: { |
||||
backData(value) { |
backData(value) { |
||||
console.log("backData》》》》", value) |
console.log("backData》》》》", value) |
||||
console.log("imgList", this.imgList) |
console.log("imgList", this.imgList) |
||||
|
|
||||
|
|
||||
this.formobj.picUrl = this.imgList[0].url |
this.formobj.picUrl = this.imgList[0].url |
||||
}, |
}, |
||||
|
|
||||
saveOrUpdate() { |
saveOrUpdate() { |
||||
console.log('>>>>>>>>>saveOrUpdate', this.formobj) |
console.log('>>>>>>>>>saveOrUpdate', this.formobj) |
||||
req.saveGoods(this.formobj) |
req.saveGoods(this.formobj) |
||||
.then(resp => { |
.then(resp => { |
||||
if (resp.success) { |
if (resp.success) { |
||||
this.$message({ |
this.$message({ |
||||
showClose: true, |
showClose: true, |
||||
type: 'success', |
type: 'success', |
||||
message: resp.msg |
message: resp.msg |
||||
}) |
}) |
||||
this.handleReturn('true') |
this.handleReturn('true') |
||||
} else { |
} else { |
||||
// 根据resp.code进行异常情况处理 |
// 根据resp.code进行异常情况处理 |
||||
} |
} |
||||
}) |
}) |
||||
.catch(() => {}) |
.catch(() => {}) |
||||
}, |
}, |
||||
handleReturn(isreload) { |
handleReturn(isreload) { |
||||
if (isreload === 'true') this.$emit('reloadlist') |
if (isreload === 'true') this.$emit('reloadlist') |
||||
this.imgList = [] |
this.imgList = [] |
||||
this.formobj = { |
this.formobj = { |
||||
sid: "", |
sid: "", |
||||
name: '', |
name: '', |
||||
code: '', |
code: '', |
||||
barcode: '', |
barcode: '', |
||||
price: "", |
price: "", |
||||
unitName: "", |
unitName: "", |
||||
remarks: "", |
remarks: "", |
||||
picUrl: "" |
picUrl: "" |
||||
} |
} |
||||
this.$emit('doback') |
this.$emit('doback') |
||||
}, |
}, |
||||
|
|
||||
showAdd() { |
showAdd() { |
||||
console.log(this.imgList, 88888888) |
console.log(this.imgList, 88888888) |
||||
}, |
}, |
||||
showEdit(row) { |
showEdit(row) { |
||||
req.goodsInit(row.sid) |
req.goodsInit(row.sid) |
||||
.then(resp => { |
.then(resp => { |
||||
if (resp.success) { |
if (resp.success) { |
||||
this.formobj = resp.data |
this.formobj = resp.data |
||||
this.imgList = [] |
this.imgList = [] |
||||
this.imgList.push({ |
this.imgList.push({ |
||||
url: resp.data.picUrl |
url: resp.data.picUrl |
||||
}) |
}) |
||||
|
|
||||
} |
} |
||||
}) |
}) |
||||
.catch(e => { |
.catch(e => { |
||||
this.formobj = row |
this.formobj = row |
||||
this.imgList = [] |
this.imgList = [] |
||||
this.imgList.push({ |
this.imgList.push({ |
||||
url: formobj.picUrl |
url: formobj.picUrl |
||||
}) |
}) |
||||
}) |
}) |
||||
}, |
}, |
||||
editinput(text) { |
editinput(text) { |
||||
this.formobj.appContent = text |
this.formobj.appContent = text |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
</script> |
</script> |
||||
<style lang="scss"> |
<style lang="scss"> |
||||
.box-card { |
.box-card { |
||||
margin-left: 60px; |
margin-left: 60px; |
||||
margin-right: 60px; |
margin-right: 60px; |
||||
min-width: 70%; |
min-width: 70%; |
||||
margin-top: 20px; |
margin-top: 20px; |
||||
|
|
||||
.item { |
.item { |
||||
display: flex; |
display: flex; |
||||
flex-direction: row; |
flex-direction: row; |
||||
align-items: center; |
align-items: center; |
||||
margin-top: 15px; |
margin-top: 15px; |
||||
height: 40px; |
height: 40px; |
||||
line-height: 40px; |
line-height: 40px; |
||||
|
|
||||
.item_text { |
.item_text { |
||||
flex: 0.8; |
flex: 0.8; |
||||
font-size: 18px; |
font-size: 18px; |
||||
text-align: right; |
text-align: right; |
||||
} |
} |
||||
|
|
||||
.item_input { |
.item_input { |
||||
flex: 4; |
flex: 4; |
||||
font-size: 16px; |
font-size: 16px; |
||||
margin-left: 10px; |
margin-left: 10px; |
||||
margin-right: 80px; |
margin-right: 80px; |
||||
} |
} |
||||
|
|
||||
.item_left_input { |
.item_left_input { |
||||
width: 20%; |
width: 20%; |
||||
} |
} |
||||
|
|
||||
.item_left_text { |
.item_left_text { |
||||
height: 30px; |
height: 30px; |
||||
margin-left: 20px; |
margin-left: 20px; |
||||
line-height: 30px; |
line-height: 30px; |
||||
color: #018AD2; |
color: #018AD2; |
||||
padding: 0px 15px; |
padding: 0px 15px; |
||||
border: 1.5px solid #018AD2; |
border: 1.5px solid #018AD2; |
||||
border-radius: 5px; |
border-radius: 5px; |
||||
|
|
||||
} |
} |
||||
|
|
||||
.item_right { |
.item_right { |
||||
flex: 1; |
flex: 1; |
||||
justify-items: center; |
justify-items: center; |
||||
|
|
||||
.item_right_list_text { |
.item_right_list_text { |
||||
font-size: 16px; |
font-size: 16px; |
||||
} |
} |
||||
|
|
||||
.item_right_list_delect { |
.item_right_list_delect { |
||||
color: #5E94FF; |
color: #5E94FF; |
||||
margin-left: 20px; |
margin-left: 20px; |
||||
font-size: 16px; |
font-size: 16px; |
||||
text-decoration: underline; |
text-decoration: underline; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
} |
} |
||||
|
|
||||
} |
} |
||||
</style> |
</style> |
Loading…
Reference in new issue