
7 changed files with 1215 additions and 1222 deletions
@ -1,344 +1,350 @@ |
|||||
<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-select v-model="formobj.brandId" placeholder="请选择菜窖分类" class="item_input" |
<el-select v-model="formobj.brandId" placeholder="请选择菜窖分类" class="item_input" |
||||
@change="selectBrandChange"> |
@change="selectBrandChange"> |
||||
<el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" /> |
<el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" /> |
||||
</el-select> |
</el-select> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">选择商品分类:</span> |
<span class="item_text">选择商品分类:</span> |
||||
<el-select v-model="formobj.categoryId" placeholder="请选择商品分类" class="item_input" |
<el-select v-model="formobj.categoryId" placeholder="请选择商品分类" class="item_input" |
||||
@change="selectCateChange"> |
@change="selectCateChange"> |
||||
<el-option v-for="item in cateList" :key="item.id" :label="item.name" :value="item.id" /> |
<el-option v-for="item in cateList" :key="item.id" :label="item.name" :value="item.id" /> |
||||
</el-select> |
</el-select> |
||||
</div> |
</div> |
||||
<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 |
<el-input v-model="formobj.code" placeholder="" class="item_input" clearable |
||||
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" /> |
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">条码:</span> |
<span class="item_text">条码:</span> |
||||
<el-input v-model="formobj.barcode" placeholder="" class="item_input" clearable |
<el-input v-model="formobj.barcode" placeholder="" class="item_input" clearable |
||||
oninput="value=value.replace(/[^0-9]/g,'')" /> |
oninput="value=value.replace(/[^0-9]/g,'')" /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">价格 (元/斤):</span> |
<span class="item_text">价格 (元/斤):</span> |
||||
<el-input v-model="formobj.price" placeholder="" class="item_input" clearable |
<el-input v-model="formobj.price" placeholder="" class="item_input" clearable |
||||
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">阶梯重量(斤):</span> |
<span class="item_text">阶梯重量(斤):</span> |
||||
<el-input v-model="formobj.stepWeight" placeholder="" class="item_input" clearable |
<el-input v-model="formobj.stepWeight" placeholder="" class="item_input" clearable |
||||
oninput="value=value.replace(/[^0-9]/g,'')" /> |
oninput="value=value.replace(/[^0-9]/g,'')" /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">阶梯价格 (元/斤):</span> |
<span class="item_text">阶梯价格 (元/斤):</span> |
||||
<el-input v-model="formobj.stepPrice" placeholder="" class="item_input" clearable |
<el-input v-model="formobj.stepPrice" placeholder="" class="item_input" clearable |
||||
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">商品单位:</span> |
<span class="item_text">商品单位:</span> |
||||
<el-input v-model="formobj.specificationUnit" placeholder="例如:斤/瓶/袋/箱/盒" class="item_input" |
<el-input v-model="formobj.specificationUnit" placeholder="例如:斤/瓶/袋/箱/盒" class="item_input" |
||||
clearable /> |
clearable /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">规格 (斤/份):</span> |
<span class="item_text">规格 (斤/份):</span> |
||||
<el-input v-model="formobj.weight" placeholder="例如:30" class="item_input" clearable |
<el-input v-model="formobj.weight" placeholder="例如:30" class="item_input" clearable |
||||
oninput="value=value.replace(/[^0-9]/g,'')" /> |
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
||||
</div> |
</div> |
||||
<div class="item"> |
<div class="item"> |
||||
<span class="item_text">规格单位:</span> |
<span class="item_text">规格单位:</span> |
||||
<el-input v-model="formobj.unitName" placeholder="例如:份" :readonly="true" class="item_input" |
<el-input v-model="formobj.unitName" placeholder="例如:份" class="item_input" clearable /> |
||||
clearable /> |
</div> |
||||
</div> |
<div class="item"> |
||||
<div class="item"> |
<span class="item_text">规格描述:</span> |
||||
<span class="item_text">规格描述:</span> |
<el-input v-model="formobj.remarks" placeholder="例如:一份30斤" class="item_input" clearable /> |
||||
<el-input v-model="formobj.remarks" placeholder="例如:一份30斤" class="item_input" clearable /> |
</div> |
||||
</div> |
<div class="item"> |
||||
<div class="item"> |
<span class="item_text">提货截止日:</span> |
||||
<span class="item_text">提货截止日:</span> |
<el-date-picker v-model="formobj.periodValidity" type="date" class="item_input" |
||||
<el-date-picker v-model="formobj.periodValidity" type="date" class="item_input" |
value-format="yyyy-MM-dd" placeholder="选择日期"> |
||||
value-format="yyyy-MM-dd" placeholder="选择日期"> |
</el-date-picker> |
||||
</el-date-picker> |
</div> |
||||
</div> |
<div class="item"> |
||||
<div class="item"> |
<span class="item_text">商品简介:</span> |
||||
<span class="item_text">商品简介:</span> |
<el-input v-model="formobj.content" placeholder="商品简介" class="item_input" clearable /> |
||||
<el-input v-model="formobj.content" placeholder="商品简介" class="item_input" clearable /> |
</div> |
||||
</div> |
<div class="item"> |
||||
|
<span class="item_text">商品排序:</span> |
||||
|
<el-input v-model="formobj.sort" placeholder="商品排序" class="item_input" clearable |
||||
|
oninput="value=value.replace(/[^0-9]/g,'')" /> |
||||
|
</div> |
||||
|
|
||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;"> |
<div class="item" style="margin-bottom: 100px;margin-top: 100px;"> |
||||
<span class="item_text">图片:</span> |
<span class="item_text">图片:</span> |
||||
<upload ref="uploadImg2" v-model="imgList" style="margin-top: 20px;" class="item_input" :limit="1" |
<upload ref="uploadImg2" v-model="imgList" style="margin-top: 20px;" class="item_input" :limit="1" |
||||
bucket="map" :class="{ hide: hideUploadBtn }" :upload-data="{ type: '0001' }" |
bucket="map" :class="{ hide: hideUploadBtn }" :upload-data="{ type: '0001' }" |
||||
@change="backData" /> |
@change="backData" /> |
||||
</div> |
</div> |
||||
|
|
||||
<div> |
<div> |
||||
<span class="item_text">商品详情:</span> |
<span class="item_text">商品详情:</span> |
||||
<editor :height="300" :min-height="100" :value="formobj.appContent" @input="editinput" /> |
<editor :height="300" :min-height="100" :value="formobj.appContent" @input="editinput" /> |
||||
</div> |
</div> |
||||
|
|
||||
</el-card> |
</el-card> |
||||
|
|
||||
</div> |
</div> |
||||
|
|
||||
</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' |
||||
import reqMall from '@/api/adminmallapi.js' |
import reqMall from '@/api/adminmallapi.js' |
||||
|
|
||||
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: '', |
||||
stepWeight: '', |
stepWeight: '', |
||||
stepPrice: '', |
stepPrice: '', |
||||
unitName: '份', |
unitName: '份', |
||||
specificationUnit: '', |
specificationUnit: '', |
||||
weight: '', |
weight: '', |
||||
remarks: '', |
remarks: '', |
||||
content: '', |
content: '', |
||||
picUrl: '', |
sort: '', |
||||
brandId: null, |
picUrl: '', |
||||
brandName: '', |
brandId: '', |
||||
categoryId: null, |
brandName: '', |
||||
categoryName: '', |
categoryId: '', |
||||
periodValidity: "" |
categoryName: '', |
||||
}, |
periodValidity: "" |
||||
brandList: [], |
}, |
||||
cateList: [], |
brandList: [], |
||||
hideUploadBtn: false |
cateList: [], |
||||
} |
hideUploadBtn: false |
||||
}, |
} |
||||
created() { |
}, |
||||
this.initData() |
created() { |
||||
}, |
this.initData() |
||||
methods: { |
}, |
||||
initData() { |
methods: { |
||||
reqMall.listAllBrand().then(resp => { |
initData() { |
||||
this.brandList = resp.data |
reqMall.listAllBrand().then(resp => { |
||||
}) |
this.brandList = resp.data |
||||
reqMall.listAllCategory().then(resp => { |
}) |
||||
this.cateList = resp.data |
reqMall.listAllCategory().then(resp => { |
||||
}) |
this.cateList = resp.data |
||||
}, |
}) |
||||
backData(value) { |
}, |
||||
console.log('backData》》》》', value) |
backData(value) { |
||||
console.log('imgList', this.imgList) |
console.log('backData》》》》', value) |
||||
|
console.log('imgList', this.imgList) |
||||
|
|
||||
if (this.imgList.length > 0) { |
if (this.imgList.length > 0) { |
||||
this.formobj.picUrl = this.imgList[0].url |
this.formobj.picUrl = this.imgList[0].url |
||||
} else { |
} else { |
||||
this.formobj.picUrl = '' |
this.formobj.picUrl = '' |
||||
} |
} |
||||
|
|
||||
this.hideUploadBtn = this.imgList.length != 0 |
this.hideUploadBtn = this.imgList.length != 0 |
||||
console.log('this.hideUploadBtn', this.hideUploadBtn) |
console.log('this.hideUploadBtn', this.hideUploadBtn) |
||||
}, |
}, |
||||
|
|
||||
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.hideUploadBtn = true |
this.hideUploadBtn = true |
||||
this.formobj = { |
this.formobj = { |
||||
sid: '', |
sid: '', |
||||
name: '', |
name: '', |
||||
code: '', |
code: '', |
||||
barcode: '', |
barcode: '', |
||||
price: '', |
price: '', |
||||
stepWeight: '', |
stepWeight: '', |
||||
stepPrice: '', |
stepPrice: '', |
||||
unitName: '份', |
unitName: '份', |
||||
specificationUnit: '', |
specificationUnit: '', |
||||
weight: '', |
weight: '', |
||||
remarks: '', |
remarks: '', |
||||
content: '', |
content: '', |
||||
picUrl: '', |
sort: '', |
||||
appContent: '', |
picUrl: '', |
||||
periodValidity: "" |
appContent: '', |
||||
} |
periodValidity: "" |
||||
this.$emit('doback') |
} |
||||
}, |
this.$emit('doback') |
||||
showAdd() { |
}, |
||||
console.log(this.imgList, 88888888) |
showAdd() { |
||||
this.hideUploadBtn = this.imgList.length != 0 |
console.log(this.imgList, 88888888) |
||||
}, |
this.hideUploadBtn = this.imgList.length != 0 |
||||
showEdit(row) { |
}, |
||||
req.goodsInit(row.sid) |
showEdit(row) { |
||||
.then(resp => { |
req.goodsInit(row.sid) |
||||
if (resp.success) { |
.then(resp => { |
||||
this.formobj = resp.data |
if (resp.success) { |
||||
this.imgList = [] |
this.formobj = resp.data |
||||
if (resp.data.picUrl != '') { |
this.imgList = [] |
||||
this.imgList.push({ |
if (resp.data.picUrl != '') { |
||||
url: resp.data.picUrl |
this.imgList.push({ |
||||
}) |
url: resp.data.picUrl |
||||
} |
}) |
||||
|
} |
||||
|
|
||||
this.hideUploadBtn = this.imgList.length != 0 |
this.hideUploadBtn = this.imgList.length != 0 |
||||
console.log('this.hideUploadBtn', this.hideUploadBtn) |
console.log('this.hideUploadBtn', this.hideUploadBtn) |
||||
} |
} |
||||
}) |
}) |
||||
.catch(e => { |
.catch(e => { |
||||
this.formobj = row |
this.formobj = row |
||||
this.imgList = [] |
this.imgList = [] |
||||
// if (resp.data.picUrl != '') { |
// if (resp.data.picUrl != '') { |
||||
// this.imgList.push({ |
// this.imgList.push({ |
||||
// url: formobj.picUrl |
// url: formobj.picUrl |
||||
// }) |
// }) |
||||
// } |
// } |
||||
|
|
||||
// this.hideUploadBtn = this.imgList.length != 0 |
// this.hideUploadBtn = this.imgList.length != 0 |
||||
console.log('this.hideUploadBtn', this.hideUploadBtn) |
console.log('this.hideUploadBtn', this.hideUploadBtn) |
||||
}) |
}) |
||||
}, |
}, |
||||
editinput(text) { |
editinput(text) { |
||||
this.formobj.appContent = text |
this.formobj.appContent = text |
||||
}, |
}, |
||||
selectBrandChange(val) { |
selectBrandChange(val) { |
||||
for (var i = 0; i < this.brandList.length; i++) { |
for (var i = 0; i < this.brandList.length; i++) { |
||||
if (val === this.brandList[i].id) { |
if (val === this.brandList[i].id) { |
||||
this.formobj.brandName = this.brandList[i].name |
this.formobj.brandName = this.brandList[i].name |
||||
break |
break |
||||
} |
} |
||||
} |
} |
||||
}, |
}, |
||||
selectCateChange(val) { |
selectCateChange(val) { |
||||
for (var i = 0; i < this.cateList.length; i++) { |
for (var i = 0; i < this.cateList.length; i++) { |
||||
if (val === this.cateList[i].id) { |
if (val === this.cateList[i].id) { |
||||
this.formobj.categoryName = this.cateList[i].name |
this.formobj.categoryName = this.cateList[i].name |
||||
break |
break |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
</script> |
</script> |
||||
<style lang="scss" scoped> |
<style lang="scss" scoped> |
||||
// 隐藏上传组件 |
// 隐藏上传组件 |
||||
|
|
||||
::v-deep .hide { |
::v-deep .hide { |
||||
.el-upload--picture-card { |
.el-upload--picture-card { |
||||
display: none !important; |
display: none !important; |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
.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> |
@ -1,318 +1,293 @@ |
|||||
<template> |
<template> |
||||
<div class="app-container"> |
<div class="app-container"> |
||||
<div v-show="viewState == 1"> |
<div v-show="viewState == 1"> |
||||
<button-bar ref="btnbar" view-title="商品列表" :btndisabled="btndisabled" @btnhandle="btnHandle" /> |
<button-bar ref="btnbar" view-title="商品列表" :btndisabled="btndisabled" @btnhandle="btnHandle" /> |
||||
<div class="main-content"> |
<div class="main-content"> |
||||
<div class="searchcon"> |
<div class="searchcon"> |
||||
<el-button size="small" class="searchbtn" @click="clicksearchShow"> |
<el-button size="small" class="searchbtn" @click="clicksearchShow"> |
||||
{{ searchxianshitit }} |
{{ searchxianshitit }} |
||||
</el-button> |
</el-button> |
||||
<div v-show="isSearchShow" class="search"> |
<div v-show="isSearchShow" class="search"> |
||||
<el-form :inline="true" class="tab-header"> |
<el-form :inline="true" class="tab-header"> |
||||
<el-form-item label="商品名称"> |
<el-form-item label="商品名称"> |
||||
<el-input v-model="queryParams.params.name" placeholder="" clearable /> |
<el-input v-model="queryParams.params.name" placeholder="" clearable /> |
||||
</el-form-item> |
</el-form-item> |
||||
|
|
||||
</el-form> |
</el-form> |
||||
<div class="btn" style="text-align: center;"> |
<div class="btn" style="text-align: center;"> |
||||
<el-button |
<el-button type="primary" size="small" icon="el-icon-search" |
||||
type="primary" |
@click="dosearch">查询</el-button> |
||||
size="small" |
<el-button type="primary" size="small" icon="el-icon-refresh" |
||||
icon="el-icon-search" |
@click="resetQuery">重置</el-button> |
||||
@click="dosearch" |
</div> |
||||
>查询</el-button> |
</div> |
||||
<el-button |
</div> |
||||
type="primary" |
<!-- Start 项目列表头部 --> |
||||
size="small" |
<div class="listtop"> |
||||
icon="el-icon-refresh" |
<div class="tit">商品列表</div> |
||||
@click="resetQuery" |
</div> |
||||
>重置</el-button> |
<!-- End 项目列表头部 --> |
||||
</div> |
<!-- Start 项目列表 --> |
||||
</div> |
<div class=""> |
||||
</div> |
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%"> |
||||
<!-- Start 项目列表头部 --> |
<!-- <el-table-column fixed width="50" type="selection" align="center" /> --> |
||||
<div class="listtop"> |
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center" /> |
||||
<div class="tit">商品列表</div> |
<el-table-column label="操作" align="center" width="180"> |
||||
</div> |
<template slot-scope="scope"> |
||||
<!-- End 项目列表头部 --> |
<el-button type="primary" size="mini" @click="toRelevancy(scope.row)">编辑</el-button> |
||||
<!-- Start 项目列表 --> |
<!-- <el-button type="primary" size="mini" @click="toRelevancyInfo(scope.row)">删除</el-button> --> |
||||
<div class=""> |
</template> |
||||
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%"> |
</el-table-column> |
||||
<!-- <el-table-column fixed width="50" type="selection" align="center" /> --> |
<el-table-column label="小程序自选商品" align="center" width="140"> |
||||
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center" /> |
<template slot-scope="scope"> |
||||
<el-table-column label="操作" align="center" width="180"> |
<el-switch v-model="scope.row.useTo" active-text="是" inactive-text="否" active-value="1" |
||||
<template slot-scope="scope"> |
inactive-value="2" @change="enableChange1(scope.row.sid,scope.row.useTo)" /> |
||||
<el-button type="primary" size="mini" @click="toRelevancy(scope.row)">编辑</el-button> |
</template> |
||||
<!-- <el-button type="primary" size="mini" @click="toRelevancyInfo(scope.row)">删除</el-button> --> |
</el-table-column> |
||||
</template> |
<el-table-column label="商品上架" align="center" width="140"> |
||||
</el-table-column> |
<template slot-scope="scope"> |
||||
<el-table-column label="小程序自选商品" align="center" width="140"> |
<el-switch v-model="scope.row.isAppletGrounding" active-text="上架" inactive-text="下架" |
||||
<template slot-scope="scope"> |
active-value="1" inactive-value="2" |
||||
<el-switch |
@change="enableChange2(scope.row.sid,scope.row.isAppletGrounding)" /> |
||||
v-model="scope.row.useTo" |
</template> |
||||
active-text="是" |
</el-table-column> |
||||
inactive-text="否" |
<el-table-column prop="name" label="商品名称" align="center" /> |
||||
active-value="1" |
<el-table-column label="商品图片" align="center"> |
||||
inactive-value="2" |
<template slot-scope="scope"> |
||||
@change="enableChange1(scope.row.sid,scope.row.useTo)" |
<el-popover placement="left" trigger="click" width="300"> |
||||
/> |
<img :src="scope.row.picUrl" width="100%"> |
||||
</template> |
<img slot="reference" :src="scope.row.picUrl" :alt="scope.row.picUrl" |
||||
</el-table-column> |
style="max-height: 70px;max-width: 70px; padding: 5px"> |
||||
<el-table-column label="商品上架" align="center" width="140"> |
</el-popover> |
||||
<template slot-scope="scope"> |
<!-- <span v-for="(item,index) in scope.row.picUrl" :key="index"> |
||||
<el-switch |
|
||||
v-model="scope.row.isAppletGrounding" |
|
||||
active-text="上架" |
|
||||
inactive-text="下架" |
|
||||
active-value="1" |
|
||||
inactive-value="2" |
|
||||
@change="enableChange2(scope.row.sid,scope.row.isAppletGrounding)" |
|
||||
/> |
|
||||
</template> |
|
||||
</el-table-column> |
|
||||
<el-table-column prop="name" label="商品名称" align="center" /> |
|
||||
<el-table-column label="商品图片" align="center"> |
|
||||
<template slot-scope="scope"> |
|
||||
<el-popover placement="left" trigger="click" width="300"> |
|
||||
<img :src="scope.row.picUrl" width="100%"> |
|
||||
<img |
|
||||
slot="reference" |
|
||||
:src="scope.row.picUrl" |
|
||||
:alt="scope.row.picUrl" |
|
||||
style="max-height: 70px;max-width: 70px; padding: 5px" |
|
||||
> |
|
||||
</el-popover> |
|
||||
<!-- <span v-for="(item,index) in scope.row.picUrl" :key="index"> |
|
||||
<el-popover placement="left" trigger="click" width="300"> |
<el-popover placement="left" trigger="click" width="300"> |
||||
<img :src="item.url" width="100%" /> |
<img :src="item.url" width="100%" /> |
||||
<img slot="reference" :src="item.url" :alt="item.url" |
<img slot="reference" :src="item.url" :alt="item.url" |
||||
style="max-height: 70px;max-width: 70px; padding: 5px" /> |
style="max-height: 70px;max-width: 70px; padding: 5px" /> |
||||
</el-popover> |
</el-popover> |
||||
</span> --> |
</span> --> |
||||
</template> |
</template> |
||||
</el-table-column> |
</el-table-column> |
||||
<el-table-column prop="code" label="商品编码" align="center" /> |
<el-table-column prop="code" label="商品编码" align="center" /> |
||||
<el-table-column prop="barcode" label="商品条码" align="center" /> |
<el-table-column prop="barcode" label="商品条码" align="center" /> |
||||
<el-table-column prop="price" label="单价" align="center" /> |
<el-table-column prop="price" label="单价" align="center" /> |
||||
<el-table-column prop="unitName" label="标准单位" align="center" /> |
<el-table-column prop="unitName" label="标准单位" align="center" /> |
||||
</el-table> |
<el-table-column prop="brandName" label="所属菜窖" align="center" /> |
||||
</div> |
<el-table-column prop="categoryName" label="所属分类" align="center" /> |
||||
<!-- End 项目列表 --> |
<el-table-column prop="sort" label="排序" align="center" /> |
||||
<div class="pages"> |
<el-table-column prop="createTime" label="创建日期" align="center" /> |
||||
<div class="tit" /> |
</el-table> |
||||
<!-- 翻页 --> |
</div> |
||||
<pagination |
<!-- End 项目列表 --> |
||||
v-show="dataList.length > 0" |
<div class="pages"> |
||||
:total="queryParams.total" |
<div class="tit" /> |
||||
:page.sync="queryParams.current" |
<!-- 翻页 --> |
||||
:limit.sync="queryParams.size" |
<pagination v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" |
||||
class="pagination" |
:limit.sync="queryParams.size" class="pagination" @pagination="loadList" /> |
||||
@pagination="loadList" |
</div> |
||||
/> |
</div> |
||||
</div> |
</div> |
||||
</div> |
<!-- End 查询和其列表部分 --> |
||||
|
<!-- 新增修改部分组件 --> |
||||
|
<divAdd v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState" @reloadlist="loadList" /> |
||||
</div> |
</div> |
||||
<!-- End 查询和其列表部分 --> |
|
||||
<!-- 新增修改部分组件 --> |
|
||||
<divAdd v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState" @reloadlist="loadList" /> |
|
||||
</div> |
|
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import req from '@/api/commodity/commodity.js' |
import req from '@/api/commodity/commodity.js' |
||||
import ButtonBar from '@/components/ButtonBar' |
import ButtonBar from '@/components/ButtonBar' |
||||
import Pagination from '@/components/pagination' |
import Pagination from '@/components/pagination' |
||||
import pageye from '@/components/pagination/pageye' |
import pageye from '@/components/pagination/pageye' |
||||
import divAdd from './commodityAdd.vue' |
import divAdd from './commodityAdd.vue' |
||||
export default { |
export default { |
||||
name: 'SupplierBankInfoIndex', |
name: 'SupplierBankInfoIndex', |
||||
components: { |
components: { |
||||
ButtonBar, |
ButtonBar, |
||||
Pagination, |
Pagination, |
||||
pageye, |
pageye, |
||||
divAdd |
divAdd |
||||
}, |
}, |
||||
data() { |
data() { |
||||
return { |
return { |
||||
btndisabled: false, |
btndisabled: false, |
||||
viewState: 1, // 1、列表 2、添加 3、修改 4、查看 |
viewState: 1, // 1、列表 2、添加 3、修改 4、查看 |
||||
isSearchShow: false, |
isSearchShow: false, |
||||
searchxianshitit: '显示查询条件', |
searchxianshitit: '显示查询条件', |
||||
tableLoading: false, |
tableLoading: false, |
||||
dataList: [], |
dataList: [], |
||||
btnList: [{ |
btnList: [{ |
||||
type: 'primary', |
type: 'primary', |
||||
size: 'small', |
size: 'small', |
||||
icon: 'plus', |
icon: 'plus', |
||||
btnKey: 'toAdd', |
btnKey: 'toAdd', |
||||
btnLabel: '新增' |
btnLabel: '新增' |
||||
}, |
}, |
||||
{ |
{ |
||||
type: 'info', |
type: 'info', |
||||
size: 'small', |
size: 'small', |
||||
icon: 'cross', |
icon: 'cross', |
||||
btnKey: 'doClose', |
btnKey: 'doClose', |
||||
btnLabel: '关闭' |
btnLabel: '关闭' |
||||
} |
} |
||||
], |
], |
||||
queryParams: { |
queryParams: { |
||||
current: 1, |
current: 1, |
||||
size: 10, |
size: 10, |
||||
total: 0, |
total: 0, |
||||
params: { |
params: { |
||||
name: '' |
name: '' |
||||
} |
} |
||||
}, |
}, |
||||
sids: [] |
sids: [] |
||||
} |
} |
||||
}, |
}, |
||||
mounted() { |
mounted() { |
||||
this.$refs['btnbar'].setButtonList(this.btnList) |
this.$refs['btnbar'].setButtonList(this.btnList) |
||||
}, |
}, |
||||
created() { |
created() { |
||||
this.loadList() |
this.loadList() |
||||
}, |
}, |
||||
methods: { |
methods: { |
||||
// 搜索条件效果 |
// 搜索条件效果 |
||||
clicksearchShow() { |
clicksearchShow() { |
||||
this.isSearchShow = !this.isSearchShow |
this.isSearchShow = !this.isSearchShow |
||||
if (this.isSearchShow) { |
if (this.isSearchShow) { |
||||
this.searchxianshitit = '隐藏查询条件' |
this.searchxianshitit = '隐藏查询条件' |
||||
} else { |
} else { |
||||
this.searchxianshitit = '显示查询条件' |
this.searchxianshitit = '显示查询条件' |
||||
} |
} |
||||
}, |
}, |
||||
btnHandle(btnKey) { |
btnHandle(btnKey) { |
||||
switch (btnKey) { |
switch (btnKey) { |
||||
case 'toAdd': |
case 'toAdd': |
||||
this.toAdd() |
this.toAdd() |
||||
break |
break |
||||
case 'doClose': |
case 'doClose': |
||||
this.doClose() |
this.doClose() |
||||
break |
break |
||||
default: |
default: |
||||
break |
break |
||||
} |
} |
||||
}, |
}, |
||||
loadList() { |
loadList() { |
||||
this.tableLoading = true |
this.tableLoading = true |
||||
req.goodsListPage(this.queryParams).then((resp) => { |
req.goodsListPage(this.queryParams).then((resp) => { |
||||
this.tableLoading = false |
this.tableLoading = false |
||||
if (resp.success) { |
if (resp.success) { |
||||
const data = resp.data |
const data = resp.data |
||||
this.queryParams.total = data.total |
this.queryParams.total = data.total |
||||
this.dataList = data.records |
this.dataList = data.records |
||||
} else { |
} else { |
||||
// 根据resp.code进行异常情况处理 |
// 根据resp.code进行异常情况处理 |
||||
this.dataList = [] |
this.dataList = [] |
||||
this.queryParams.total = 0 |
this.queryParams.total = 0 |
||||
} |
} |
||||
}).catch(() => { |
}).catch(() => { |
||||
this.tableLoading = false |
this.tableLoading = false |
||||
}) |
}) |
||||
}, |
}, |
||||
|
|
||||
// 序号 |
// 序号 |
||||
indexMethod(index) { |
indexMethod(index) { |
||||
var pagestart = (this.queryParams.current - 1) * this.queryParams.size |
var pagestart = (this.queryParams.current - 1) * this.queryParams.size |
||||
var pageindex = index + 1 + pagestart |
var pageindex = index + 1 + pagestart |
||||
return pageindex |
return pageindex |
||||
}, |
}, |
||||
dosearch() { |
dosearch() { |
||||
this.queryParams.current = 1 |
this.queryParams.current = 1 |
||||
this.loadList() |
this.loadList() |
||||
}, |
}, |
||||
resetQuery() { |
resetQuery() { |
||||
this.queryParams = { |
this.queryParams = { |
||||
current: 1, |
current: 1, |
||||
size: 10, |
size: 10, |
||||
total: 0, |
total: 0, |
||||
params: { |
params: { |
||||
name: '' |
name: '' |
||||
} |
} |
||||
} |
} |
||||
this.loadList() |
this.loadList() |
||||
}, |
}, |
||||
toAdd() { |
toAdd() { |
||||
this.viewState = 2 |
this.viewState = 2 |
||||
this.$refs['divadd'].showAdd() |
this.$refs['divadd'].showAdd() |
||||
}, |
}, |
||||
|
|
||||
doClose() { |
doClose() { |
||||
this.$store.dispatch('tagsView/delView', this.$route) |
this.$store.dispatch('tagsView/delView', this.$route) |
||||
this.$router.go(-1) |
this.$router.go(-1) |
||||
}, |
}, |
||||
toRelevancy(row) { |
toRelevancy(row) { |
||||
this.viewState = 3 |
this.viewState = 3 |
||||
this.$refs['divadd'].showEdit(row) |
this.$refs['divadd'].showEdit(row) |
||||
}, |
}, |
||||
toRelevancyInfo(row) { |
toRelevancyInfo(row) { |
||||
const tip = '请确认是否删除所选商品?' |
const tip = '请确认是否删除所选商品?' |
||||
this.$confirm(tip, '提示', { |
this.$confirm(tip, '提示', { |
||||
confirmButtonText: '确定', |
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
cancelButtonText: '取消', |
||||
type: 'warning' |
type: 'warning' |
||||
}).then(() => { |
}).then(() => { |
||||
const loading = this.$loading({ |
const loading = this.$loading({ |
||||
lock: true, |
lock: true, |
||||
text: 'Loading', |
text: 'Loading', |
||||
spinner: 'el-icon-loading', |
spinner: 'el-icon-loading', |
||||
background: 'rgba(0, 0, 0, 0.7)' |
background: 'rgba(0, 0, 0, 0.7)' |
||||
}) |
}) |
||||
req.deleteGoods(row.sid).then((resp) => { |
req.deleteGoods(row.sid).then((resp) => { |
||||
loading.close() |
loading.close() |
||||
if (resp.success) { |
if (resp.success) { |
||||
this.$message({ |
this.$message({ |
||||
type: 'success', |
type: 'success', |
||||
message: resp.msg, |
message: resp.msg, |
||||
showClose: true |
showClose: true |
||||
}) |
}) |
||||
this.loadList() |
this.loadList() |
||||
} else { |
} else { |
||||
// 根据resp.code进行异常情况处理 |
// 根据resp.code进行异常情况处理 |
||||
} |
} |
||||
}).catch(e => { |
}).catch(e => { |
||||
loading.close() |
loading.close() |
||||
}) |
}) |
||||
}).catch(() => {}) |
}).catch(() => {}) |
||||
}, |
}, |
||||
resetState() { |
resetState() { |
||||
this.viewState = 1 |
this.viewState = 1 |
||||
}, |
}, |
||||
enableChange1(sid, state) { |
enableChange1(sid, state) { |
||||
console.log('sid', sid) |
console.log('sid', sid) |
||||
console.log('state', state) |
console.log('state', state) |
||||
req.updateAppletUseTo(sid, state).then((resp) => { |
req.updateAppletUseTo(sid, state).then((resp) => { |
||||
if (resp.success) { |
if (resp.success) { |
||||
this.$message({ |
this.$message({ |
||||
type: 'success', |
type: 'success', |
||||
message: '状态已更新', |
message: '状态已更新', |
||||
showClose: true |
showClose: true |
||||
}) |
}) |
||||
} else { // 根据resp.code进行异常情况处理 |
} else { // 根据resp.code进行异常情况处理 |
||||
} |
} |
||||
}).catch(e => { |
}).catch(e => { |
||||
console.log(e) |
console.log(e) |
||||
}) |
}) |
||||
}, |
}, |
||||
enableChange2(sid, state) { |
enableChange2(sid, state) { |
||||
console.log('sid', sid) |
console.log('sid', sid) |
||||
console.log('state', state) |
console.log('state', state) |
||||
req.updateIsEnable(sid, state).then((resp) => { |
req.updateIsEnable(sid, state).then((resp) => { |
||||
if (resp.success) { |
if (resp.success) { |
||||
this.$message({ |
this.$message({ |
||||
type: 'success', |
type: 'success', |
||||
message: '状态已更新', |
message: '状态已更新', |
||||
showClose: true |
showClose: true |
||||
}) |
}) |
||||
} else { // 根据resp.code进行异常情况处理 |
} else { // 根据resp.code进行异常情况处理 |
||||
} |
} |
||||
}).catch(e => { |
}).catch(e => { |
||||
console.log(e) |
console.log(e) |
||||
}) |
}) |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
</script> |
</script> |
||||
<style scoped> |
<style scoped> |
||||
</style> |
</style> |
File diff suppressed because it is too large
Loading…
Reference in new issue