Compare commits

...

2 Commits

  1. 58
      view/admin/src/views/product/productExamine/index.vue

@ -192,6 +192,22 @@
<el-form-item label="排序:"> <el-form-item label="排序:">
<el-input-number v-model="formValidate.rank" size="small" placeholder="请输入排序序号" style="width: 200px;" /> <el-input-number v-model="formValidate.rank" size="small" placeholder="请输入排序序号" style="width: 200px;" />
</el-form-item> </el-form-item>
<el-form-item label="价格:">
<div>
<div class="attrItem" v-for="(item,index) in attrValue" :key="index">
<div>{{item.desc}}</div>
<div class="priceContainer">
<span>成本价</span>
<el-input-number v-model="item.cost" size="small" placeholder="请输入成本价" style="width: 150px;" />
</div>
<div>
<span>价格</span>
<el-input-number v-model="item.price" size="small" placeholder="请输入价格" style="width: 150px;" />
</div>
</div>
</div>
<!-- <el-input-number v-model="formValidate.rank" size="small" placeholder="请输入排序序号" style="width: 200px;" /> -->
</el-form-item>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="商品详情:"> <el-form-item label="商品详情:">
<ueditor-from v-model="formValidate.content" :content="formValidate.content" /> <ueditor-from v-model="formValidate.content" :content="formValidate.content" />
@ -317,6 +333,7 @@ export default {
}, },
data() { data() {
return { return {
attrValue:[],
props: { props: {
emitPath: false emitPath: false
}, },
@ -367,7 +384,8 @@ export default {
store_name: '', store_name: '',
rank: '', rank: '',
us_status: '', us_status: '',
star: '' star: '',
attrValue:[]
}, },
productStatusList: [ productStatusList: [
{ label: "上架显示", value: 1 }, { label: "上架显示", value: 1 },
@ -535,6 +553,23 @@ export default {
this.checkboxGroup = []; this.checkboxGroup = [];
productDetailApi(id).then(res => { productDetailApi(id).then(res => {
const info = res.data const info = res.data
this.attrValue = []
info.attrValue.forEach(item=>{
let obj = {
desc:'',
value_id:item.value_id,
cost:item.cost,
price:item.price
}
if(item.detail instanceof Object){
Object.keys(item.detail).forEach(i=>{
obj.desc += i+item.detail[i]+";"
})
}
this.attrValue.push(obj)
})
this.formValidate = { this.formValidate = {
is_hot: info.is_hot, is_hot: info.is_hot,
is_best: info.is_best, is_best: info.is_best,
@ -545,7 +580,8 @@ export default {
content: info.content, content: info.content,
store_name: info.store_name, store_name: info.store_name,
rank: info.rank, rank: info.rank,
star: info.star star: info.star,
attrValue:this.attrValue
} }
if(info.is_benefit === 1) this.checkboxGroup.push('is_benefit') if(info.is_benefit === 1) this.checkboxGroup.push('is_benefit')
if(info.is_hot === 1) this.checkboxGroup.push('is_hot') if(info.is_hot === 1) this.checkboxGroup.push('is_hot')
@ -568,10 +604,15 @@ export default {
}, },
// //
handleSubmit(name) { handleSubmit(name) {
console.log(this.formValidate)
let formParams=JSON.parse(JSON.stringify(this.formValidate))
formParams.attrValue.forEach(item=>{
this.$delete(item,'desc')
})
console.log(formParams)
this.$refs[name].validate((valid) => { this.$refs[name].validate((valid) => {
if(valid) { if(valid) {
productUpdateApi(this.productId, this.formValidate).then(async res => { productUpdateApi(this.productId, formParams).then(async res => {
this.fullscreenLoading = false this.fullscreenLoading = false
this.$message.success(res.message) this.$message.success(res.message)
this.dialogVisible = false this.dialogVisible = false
@ -794,5 +835,12 @@ table .el-image {
.el-icon-arrow-down { .el-icon-arrow-down {
font-size: 12px; font-size: 12px;
} }
.attrItem{
display: flex;
align-items: center;
margin:5px 0;
.priceContainer{
margin:0 20px;
}
}
</style> </style>

Loading…
Cancel
Save