修复编辑商品详情的bug

This commit is contained in:
weipengfei 2023-10-14 10:51:13 +08:00
parent 48f7c566b7
commit f1139b29b5

View File

@ -127,7 +127,7 @@
@click="modalPicTap('1')" @click="modalPicTap('1')"
> >
<div v-if="formValidate.image" class="pictrue"> <div v-if="formValidate.image" class="pictrue">
<img :src="formValidate.image"> <img :src="formValidate.image" />
</div> </div>
<div v-else class="upLoad"> <div v-else class="upLoad">
<i class="el-icon-camera cameraIconfont" /> <i class="el-icon-camera cameraIconfont" />
@ -148,7 +148,7 @@
@dragenter="handleDragEnter($event, item)" @dragenter="handleDragEnter($event, item)"
@dragend="handleDragEnd($event, item)" @dragend="handleDragEnd($event, item)"
> >
<img :src="item"> <img :src="item" />
<i <i
class="el-icon-error btndel" class="el-icon-error btndel"
@click="handleRemove(index)" @click="handleRemove(index)"
@ -180,7 +180,7 @@
type="file" type="file"
style="display: none" style="display: none"
@change="zh_uploadFile_change" @change="zh_uploadFile_change"
> />
<el-button <el-button
type="primary" type="primary"
icon="ios-cloud-upload-outline" icon="ios-cloud-upload-outline"
@ -195,13 +195,17 @@
:percentage="progress" :percentage="progress"
:text-inside="true" :text-inside="true"
:stroke-width="20" :stroke-width="20"
style="margin-top: 10px;" style="margin-top: 10px"
/> />
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<div v-if="formValidate.video_link" class="iview-video-style"> <div v-if="formValidate.video_link" class="iview-video-style">
<video <video
style="width:100%;height: 100%!important;border-radius: 10px;" style="
width: 100%;
height: 100% !important;
border-radius: 10px;
"
:src="formValidate.video_link" :src="formValidate.video_link"
controls="controls" controls="controls"
> >
@ -255,11 +259,9 @@
@close="handleCloseCoupon(tag)" @close="handleCloseCoupon(tag)"
>{{ tag.title }} >{{ tag.title }}
</el-tag> </el-tag>
<el-button <el-button class="mr15" size="mini" @click="addCoupon"
class="mr15" >选择优惠券</el-button
size="mini" >
@click="addCoupon"
>选择优惠券</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -325,12 +327,11 @@
class="ml15" class="ml15"
size="small" size="small"
@click="confirm" @click="confirm"
>确认</el-button> >确认</el-button
<el-button >
class="ml15" <el-button class="ml15" size="small" @click="addRule"
size="small" >添加规格模板</el-button
@click="addRule" >
>添加规格模板</el-button>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item v-if="formValidate.attr.length > 0"> <el-form-item v-if="formValidate.attr.length > 0">
@ -369,7 +370,8 @@
class="button-new-tag" class="button-new-tag"
size="small" size="small"
@click="showInput(item)" @click="showInput(item)"
>+ 添加</el-button> >+ 添加</el-button
>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
@ -392,11 +394,9 @@
</el-col> </el-col>
<el-col :xl="12" :lg="6" :md="6" :sm="24" :xs="24"> <el-col :xl="12" :lg="6" :md="6" :sm="24" :xs="24">
<el-form-item class="noLeft"> <el-form-item class="noLeft">
<el-button <el-button type="primary" class="mr15" @click="createAttrName"
type="primary" >确定</el-button
class="mr15" >
@click="createAttrName"
>确定</el-button>
<el-button @click="offAttrName">取消</el-button> <el-button @click="offAttrName">取消</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -407,7 +407,8 @@
icon="md-add" icon="md-add"
class="mr15" class="mr15"
@click="addBtn" @click="addBtn"
>添加新规格</el-button> >添加新规格</el-button
>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- 批量设置--> <!-- 批量设置-->
@ -431,7 +432,7 @@
@click="modalPicTap('1', 'pi')" @click="modalPicTap('1', 'pi')"
> >
<div v-if="scope.row.image" class="pictrue tabPic"> <div v-if="scope.row.image" class="pictrue tabPic">
<img :src="scope.row.image"> <img :src="scope.row.image" />
</div> </div>
<div v-else class="upLoad tabPic"> <div v-else class="upLoad tabPic">
<i class="el-icon-camera cameraIconfont" /> <i class="el-icon-camera cameraIconfont" />
@ -451,7 +452,6 @@
<el-input <el-input
v-if="formThead[iii].title === '付费会员价'" v-if="formThead[iii].title === '付费会员价'"
v-model="scope.row[iii]" v-model="scope.row[iii]"
:disabled="formValidate.svip_price_type == 1" :disabled="formValidate.svip_price_type == 1"
class="priceBox" class="priceBox"
controls-position="right" controls-position="right"
@ -525,11 +525,9 @@
</template> </template>
<el-table-column align="center" label="操作" min-width="80"> <el-table-column align="center" label="操作" min-width="80">
<template> <template>
<el-button <el-button type="text" class="submission" @click="batchAdd"
type="text" >批量添加</el-button
class="submission" >
@click="batchAdd"
>批量添加</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -551,7 +549,7 @@
@click="modalPicTap('1', 'dan', 'pi')" @click="modalPicTap('1', 'dan', 'pi')"
> >
<div v-if="formValidate.image" class="pictrue tabPic"> <div v-if="formValidate.image" class="pictrue tabPic">
<img :src="scope.row.image"> <img :src="scope.row.image" />
</div> </div>
<div v-else class="upLoad tabPic"> <div v-else class="upLoad tabPic">
<i class="el-icon-camera cameraIconfont" /> <i class="el-icon-camera cameraIconfont" />
@ -677,7 +675,7 @@
@click="modalPicTap('1', 'duo', scope.$index)" @click="modalPicTap('1', 'duo', scope.$index)"
> >
<div v-if="scope.row.image" class="pictrue tabPic"> <div v-if="scope.row.image" class="pictrue tabPic">
<img :src="scope.row.image"> <img :src="scope.row.image" />
</div> </div>
<div v-else class="upLoad tabPic"> <div v-else class="upLoad tabPic">
<i class="el-icon-camera cameraIconfont" /> <i class="el-icon-camera cameraIconfont" />
@ -779,7 +777,8 @@
type="text" type="text"
class="submission" class="submission"
@click="delAttrTable(scope.$index)" @click="delAttrTable(scope.$index)"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -808,8 +807,13 @@
title="750*750px" title="750*750px"
@click="modalPicTap('3')" @click="modalPicTap('3')"
> >
<div v-for="(item, index) in formValidate.content.image" class="pictrue details_pictrue"> <div
<img :src="item" :key="index"> v-for="(item, index) in formValidate.content.image"
class="pictrue details_pictrue"
@click.stop="deleteContentImg(index)"
:key="index + item"
>
<img :src="item" :key="index" />
</div> </div>
<div class="upLoad details_pictrue"> <div class="upLoad details_pictrue">
<i class="el-icon-camera cameraIconfont" /> <i class="el-icon-camera cameraIconfont" />
@ -939,11 +943,9 @@
:value="item.shipping_template_id" :value="item.shipping_template_id"
/> />
</el-select> </el-select>
<el-button <el-button class="ml15" size="small" @click="addTem"
class="ml15" >添加运费模板</el-button
size="small" >
@click="addTem"
>添加运费模板</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -1009,11 +1011,9 @@
:value="item.guarantee_template_id" :value="item.guarantee_template_id"
/> />
</el-select> </el-select>
<el-button <el-button class="ml15" size="small" @click="addServiceTem"
class="ml15" >添加服务说明模板</el-button
size="small" >
@click="addServiceTem"
>添加服务说明模板</el-button>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -1080,7 +1080,8 @@
type="text" type="text"
class="submission" class="submission"
@click.native.prevent="delSpecs(scope.$index)" @click.native.prevent="delSpecs(scope.$index)"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -1090,7 +1091,8 @@
size="small" size="small"
class="mt20" class="mt20"
@click="addSpecs" @click="addSpecs"
>添加参数</el-button> >添加参数</el-button
>
<el-select <el-select
v-model="customSpecs" v-model="customSpecs"
multiple multiple
@ -1103,7 +1105,6 @@
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -1166,7 +1167,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item style="margin-top:30px;"> <el-form-item style="margin-top: 30px">
<el-button <el-button
v-show="currentTab > 1" v-show="currentTab > 1"
type="primary" type="primary"
@ -2197,7 +2198,7 @@ export default {
this.fullscreenLoading = true; this.fullscreenLoading = true;
productDetailApi(this.$route.params.id) productDetailApi(this.$route.params.id)
.then(async res => { .then(async res => {
if(res.data.content_arr)res.data.content = res.data.content_arr; if (res.data.content_arr && res.data.content_arr.length > 0) res.data.content = res.data.content_arr;
let info = res.data; let info = res.data;
this.infoData(info); this.infoData(info);
this.getSpecsLst(info.cate_id); this.getSpecsLst(info.cate_id);
@ -2322,10 +2323,20 @@ export default {
_this.oneFormBatch[0].image = img[0]; _this.oneFormBatch[0].image = img[0];
} }
if (tit === "3") { if (tit === "3") {
_this.formValidate.content.image = img; // console.log('', _this.formValidate?.content, img)
let image = _this.formValidate.content.image ? _this.formValidate.content.image : [];
_this.formValidate.content = {
image: [...image, ...img],
title: _this.formValidate.content.title
}
console.log('选择好的', _this.formValidate.content)
} }
}, tit); }, tit);
}, },
//
deleteContentImg (index) {
this.formValidate.content.image.splice(index, 1)
},
handleSubmitUp () { handleSubmitUp () {
this.currentTab = (Number(this.currentTab) - 1).toString(); this.currentTab = (Number(this.currentTab) - 1).toString();
}, },