Compare commits

..

2 Commits

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

@ -192,6 +192,22 @@
<el-form-item label="排序:">
<el-input-number v-model="formValidate.rank" size="small" placeholder="请输入排序序号" style="width: 200px;" />
</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-form-item label="商品详情:">
<ueditor-from v-model="formValidate.content" :content="formValidate.content" />
@ -317,6 +333,7 @@ export default {
},
data() {
return {
attrValue:[],
props: {
emitPath: false
},
@ -367,7 +384,8 @@ export default {
store_name: '',
rank: '',
us_status: '',
star: ''
star: '',
attrValue:[]
},
productStatusList: [
{ label: "上架显示", value: 1 },
@ -535,6 +553,23 @@ export default {
this.checkboxGroup = [];
productDetailApi(id).then(res => {
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 = {
is_hot: info.is_hot,
is_best: info.is_best,
@ -545,7 +580,8 @@ export default {
content: info.content,
store_name: info.store_name,
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_hot === 1) this.checkboxGroup.push('is_hot')
@ -568,10 +604,15 @@ export default {
},
//
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) => {
if(valid) {
productUpdateApi(this.productId, this.formValidate).then(async res => {
productUpdateApi(this.productId, formParams).then(async res => {
this.fullscreenLoading = false
this.$message.success(res.message)
this.dialogVisible = false
@ -794,5 +835,12 @@ table .el-image {
.el-icon-arrow-down {
font-size: 12px;
}
.attrItem{
display: flex;
align-items: center;
margin:5px 0;
.priceContainer{
margin:0 20px;
}
}
</style>

Loading…
Cancel
Save