修复编辑商品详情的bug
This commit is contained in:
parent
48f7c566b7
commit
f1139b29b5
@ -127,7 +127,7 @@
|
||||
@click="modalPicTap('1')"
|
||||
>
|
||||
<div v-if="formValidate.image" class="pictrue">
|
||||
<img :src="formValidate.image">
|
||||
<img :src="formValidate.image" />
|
||||
</div>
|
||||
<div v-else class="upLoad">
|
||||
<i class="el-icon-camera cameraIconfont" />
|
||||
@ -148,7 +148,7 @@
|
||||
@dragenter="handleDragEnter($event, item)"
|
||||
@dragend="handleDragEnd($event, item)"
|
||||
>
|
||||
<img :src="item">
|
||||
<img :src="item" />
|
||||
<i
|
||||
class="el-icon-error btndel"
|
||||
@click="handleRemove(index)"
|
||||
@ -178,9 +178,9 @@
|
||||
<input
|
||||
ref="refid"
|
||||
type="file"
|
||||
style="display:none"
|
||||
style="display: none"
|
||||
@change="zh_uploadFile_change"
|
||||
>
|
||||
/>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="ios-cloud-upload-outline"
|
||||
@ -195,13 +195,17 @@
|
||||
:percentage="progress"
|
||||
:text-inside="true"
|
||||
:stroke-width="20"
|
||||
style="margin-top: 10px;"
|
||||
style="margin-top: 10px"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<div v-if="formValidate.video_link" class="iview-video-style">
|
||||
<video
|
||||
style="width:100%;height: 100%!important;border-radius: 10px;"
|
||||
style="
|
||||
width: 100%;
|
||||
height: 100% !important;
|
||||
border-radius: 10px;
|
||||
"
|
||||
:src="formValidate.video_link"
|
||||
controls="controls"
|
||||
>
|
||||
@ -255,11 +259,9 @@
|
||||
@close="handleCloseCoupon(tag)"
|
||||
>{{ tag.title }}
|
||||
</el-tag>
|
||||
<el-button
|
||||
class="mr15"
|
||||
size="mini"
|
||||
@click="addCoupon"
|
||||
>选择优惠券</el-button>
|
||||
<el-button class="mr15" size="mini" @click="addCoupon"
|
||||
>选择优惠券</el-button
|
||||
>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -325,12 +327,11 @@
|
||||
class="ml15"
|
||||
size="small"
|
||||
@click="confirm"
|
||||
>确认</el-button>
|
||||
<el-button
|
||||
class="ml15"
|
||||
size="small"
|
||||
@click="addRule"
|
||||
>添加规格模板</el-button>
|
||||
>确认</el-button
|
||||
>
|
||||
<el-button class="ml15" size="small" @click="addRule"
|
||||
>添加规格模板</el-button
|
||||
>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="formValidate.attr.length > 0">
|
||||
@ -369,7 +370,8 @@
|
||||
class="button-new-tag"
|
||||
size="small"
|
||||
@click="showInput(item)"
|
||||
>+ 添加</el-button>
|
||||
>+ 添加</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@ -392,11 +394,9 @@
|
||||
</el-col>
|
||||
<el-col :xl="12" :lg="6" :md="6" :sm="24" :xs="24">
|
||||
<el-form-item class="noLeft">
|
||||
<el-button
|
||||
type="primary"
|
||||
class="mr15"
|
||||
@click="createAttrName"
|
||||
>确定</el-button>
|
||||
<el-button type="primary" class="mr15" @click="createAttrName"
|
||||
>确定</el-button
|
||||
>
|
||||
<el-button @click="offAttrName">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -407,7 +407,8 @@
|
||||
icon="md-add"
|
||||
class="mr15"
|
||||
@click="addBtn"
|
||||
>添加新规格</el-button>
|
||||
>添加新规格</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 批量设置-->
|
||||
@ -431,7 +432,7 @@
|
||||
@click="modalPicTap('1', 'pi')"
|
||||
>
|
||||
<div v-if="scope.row.image" class="pictrue tabPic">
|
||||
<img :src="scope.row.image">
|
||||
<img :src="scope.row.image" />
|
||||
</div>
|
||||
<div v-else class="upLoad tabPic">
|
||||
<i class="el-icon-camera cameraIconfont" />
|
||||
@ -451,7 +452,6 @@
|
||||
<el-input
|
||||
v-if="formThead[iii].title === '付费会员价'"
|
||||
v-model="scope.row[iii]"
|
||||
|
||||
:disabled="formValidate.svip_price_type == 1"
|
||||
class="priceBox"
|
||||
controls-position="right"
|
||||
@ -525,11 +525,9 @@
|
||||
</template>
|
||||
<el-table-column align="center" label="操作" min-width="80">
|
||||
<template>
|
||||
<el-button
|
||||
type="text"
|
||||
class="submission"
|
||||
@click="batchAdd"
|
||||
>批量添加</el-button>
|
||||
<el-button type="text" class="submission" @click="batchAdd"
|
||||
>批量添加</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -551,7 +549,7 @@
|
||||
@click="modalPicTap('1', 'dan', 'pi')"
|
||||
>
|
||||
<div v-if="formValidate.image" class="pictrue tabPic">
|
||||
<img :src="scope.row.image">
|
||||
<img :src="scope.row.image" />
|
||||
</div>
|
||||
<div v-else class="upLoad tabPic">
|
||||
<i class="el-icon-camera cameraIconfont" />
|
||||
@ -677,7 +675,7 @@
|
||||
@click="modalPicTap('1', 'duo', scope.$index)"
|
||||
>
|
||||
<div v-if="scope.row.image" class="pictrue tabPic">
|
||||
<img :src="scope.row.image">
|
||||
<img :src="scope.row.image" />
|
||||
</div>
|
||||
<div v-else class="upLoad tabPic">
|
||||
<i class="el-icon-camera cameraIconfont" />
|
||||
@ -779,7 +777,8 @@
|
||||
type="text"
|
||||
class="submission"
|
||||
@click="delAttrTable(scope.$index)"
|
||||
>删除</el-button>
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -808,8 +807,13 @@
|
||||
title="750*750px"
|
||||
@click="modalPicTap('3')"
|
||||
>
|
||||
<div v-for="(item, index) in formValidate.content.image" class="pictrue details_pictrue">
|
||||
<img :src="item" :key="index">
|
||||
<div
|
||||
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 class="upLoad details_pictrue">
|
||||
<i class="el-icon-camera cameraIconfont" />
|
||||
@ -939,11 +943,9 @@
|
||||
:value="item.shipping_template_id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
class="ml15"
|
||||
size="small"
|
||||
@click="addTem"
|
||||
>添加运费模板</el-button>
|
||||
<el-button class="ml15" size="small" @click="addTem"
|
||||
>添加运费模板</el-button
|
||||
>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -1009,11 +1011,9 @@
|
||||
:value="item.guarantee_template_id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button
|
||||
class="ml15"
|
||||
size="small"
|
||||
@click="addServiceTem"
|
||||
>添加服务说明模板</el-button>
|
||||
<el-button class="ml15" size="small" @click="addServiceTem"
|
||||
>添加服务说明模板</el-button
|
||||
>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -1080,7 +1080,8 @@
|
||||
type="text"
|
||||
class="submission"
|
||||
@click.native.prevent="delSpecs(scope.$index)"
|
||||
>删除</el-button>
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -1090,7 +1091,8 @@
|
||||
size="small"
|
||||
class="mt20"
|
||||
@click="addSpecs"
|
||||
>添加参数</el-button>
|
||||
>添加参数</el-button
|
||||
>
|
||||
<el-select
|
||||
v-model="customSpecs"
|
||||
multiple
|
||||
@ -1103,7 +1105,6 @@
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -1166,7 +1167,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item style="margin-top:30px;">
|
||||
<el-form-item style="margin-top: 30px">
|
||||
<el-button
|
||||
v-show="currentTab > 1"
|
||||
type="primary"
|
||||
@ -1345,7 +1346,7 @@ export default {
|
||||
taoBao,
|
||||
copyRecord
|
||||
},
|
||||
data() {
|
||||
data () {
|
||||
const url =
|
||||
SettingMer.https + '/upload/image/0/file?ueditor=1&token=' + getToken()
|
||||
return {
|
||||
@ -1553,11 +1554,11 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
attrValue() {
|
||||
attrValue () {
|
||||
const obj = Object.assign({}, this.attrVal)
|
||||
return obj
|
||||
},
|
||||
oneFormBatch() {
|
||||
oneFormBatch () {
|
||||
const obj = [Object.assign({}, defaultObj.attrValue[0])]
|
||||
if (this.OneattrValue[0] && this.OneattrValue[0]['image']) { obj[0]['image'] = this.OneattrValue[0]['image'] }
|
||||
delete obj[0].bar_code
|
||||
@ -1566,28 +1567,28 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'formValidate.attr': {
|
||||
handler: function(val) {
|
||||
handler: function (val) {
|
||||
if (this.formValidate.spec_type === 1) this.watCh(val)
|
||||
},
|
||||
immediate: false,
|
||||
deep: true
|
||||
},
|
||||
currentTab(newVal) {
|
||||
currentTab (newVal) {
|
||||
if (newVal == 5) {
|
||||
this.$nextTick(e=>{
|
||||
this.$nextTick(e => {
|
||||
this.setSort()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
created () {
|
||||
this.tempRoute = Object.assign({}, this.$route)
|
||||
if (this.$route.params.id && this.formValidate.spec_type === 1) {
|
||||
this.$watch('formValidate.attr', this.watCh)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
mounted () {
|
||||
this.formValidate.slider_image = []
|
||||
if (this.$route.params.id) {
|
||||
this.setTagsViewTitle()
|
||||
@ -1615,18 +1616,18 @@ export default {
|
||||
this.getLabelLst()
|
||||
this.$store.dispatch('settings/setEdit', true)
|
||||
},
|
||||
destroyed() {
|
||||
destroyed () {
|
||||
window.removeEventListener('popstate', this.goBack, false)
|
||||
},
|
||||
methods: {
|
||||
setSort() {
|
||||
setSort () {
|
||||
// ref一定跟table上面的ref一致
|
||||
const el = this.$refs.tableParameter.$el.querySelectorAll(
|
||||
'.el-table__body-wrapper > table > tbody'
|
||||
)[0]
|
||||
this.sortable = Sortable.create(el, {
|
||||
ghostClass: 'sortable-ghost',
|
||||
setData: function(dataTransfer) {
|
||||
setData: function (dataTransfer) {
|
||||
dataTransfer.setData('Text', '')
|
||||
},
|
||||
// 监听拖拽事件结束时触发
|
||||
@ -1635,17 +1636,17 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
elChangeExForArray(index1, index2, array) {
|
||||
elChangeExForArray (index1, index2, array) {
|
||||
const temp = array[index1]
|
||||
array[index1] = array[index2]
|
||||
array[index2] = temp
|
||||
return array
|
||||
},
|
||||
goBack() {
|
||||
goBack () {
|
||||
sessionStorage.clear()
|
||||
window.history.back()
|
||||
},
|
||||
handleCloseCoupon(tag) {
|
||||
handleCloseCoupon (tag) {
|
||||
this.formValidate.couponData.splice(
|
||||
this.formValidate.couponData.indexOf(tag),
|
||||
1
|
||||
@ -1656,7 +1657,7 @@ export default {
|
||||
})
|
||||
},
|
||||
// 参数模板
|
||||
getSpecsLst(id) {
|
||||
getSpecsLst (id) {
|
||||
let cate_id = id ? id : this.formValidate.cate_id
|
||||
specsSelectedApi({ cate_id: cate_id })
|
||||
.then(res => {
|
||||
@ -1667,7 +1668,7 @@ export default {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
productCon() {
|
||||
productCon () {
|
||||
productConfigApi()
|
||||
.then(res => {
|
||||
this.extensionStatus = res.data.extension_status
|
||||
@ -1696,7 +1697,7 @@ export default {
|
||||
})
|
||||
},
|
||||
// 获取标签项
|
||||
getLabelLst() {
|
||||
getLabelLst () {
|
||||
getProductLabelApi()
|
||||
.then(res => {
|
||||
this.labelList = res.data
|
||||
@ -1705,14 +1706,14 @@ export default {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
addCoupon() {
|
||||
addCoupon () {
|
||||
const _this = this
|
||||
this.$modalCoupon(
|
||||
this.formValidate.couponData,
|
||||
'wu',
|
||||
_this.formValidate.give_coupon_ids,
|
||||
(this.keyNum += 1),
|
||||
function(row) {
|
||||
function (row) {
|
||||
_this.formValidate.give_coupon_ids = []
|
||||
_this.formValidate.couponData = row
|
||||
row.map(item => {
|
||||
@ -1721,16 +1722,16 @@ export default {
|
||||
}
|
||||
)
|
||||
},
|
||||
delSpecs(index) {
|
||||
delSpecs (index) {
|
||||
this.formValidate.params.splice(index, 1)
|
||||
},
|
||||
addSpecs() {
|
||||
addSpecs () {
|
||||
this.formValidate.params.push({ name: '', value: '', sort: 0 })
|
||||
},
|
||||
// 参数模板详情
|
||||
getSpecsList() {
|
||||
let merParams = [...this.customSpecs],sysParams = [...[this.formValidate.param_temp_id]]
|
||||
let params = [...merParams,...sysParams]
|
||||
getSpecsList () {
|
||||
let merParams = [...this.customSpecs], sysParams = [...[this.formValidate.param_temp_id]]
|
||||
let params = [...merParams, ...sysParams]
|
||||
console.log(params)
|
||||
console.log(this.customSpecs)
|
||||
if (params.length <= 0) {
|
||||
@ -1748,19 +1749,19 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
setTagsViewTitle() {
|
||||
setTagsViewTitle () {
|
||||
const title = '编辑商品'
|
||||
const route = Object.assign({}, this.tempRoute, {
|
||||
title: `${title}-${this.$route.params.id}`
|
||||
})
|
||||
this.$store.dispatch('tagsView/updateVisitedView', route)
|
||||
},
|
||||
onChangeGroup() {
|
||||
onChangeGroup () {
|
||||
this.checkboxGroup.includes('is_good')
|
||||
? (this.formValidate.is_good = 1)
|
||||
: (this.formValidate.is_good = 0)
|
||||
},
|
||||
watCh(val) {
|
||||
watCh (val) {
|
||||
const tmp = {}
|
||||
const tmpTab = {}
|
||||
this.formValidate.attr.forEach((o, i) => {
|
||||
@ -1789,17 +1790,17 @@ export default {
|
||||
this.manyTabDate = tmpTab
|
||||
this.formThead = Object.assign({}, this.formThead, tmp)
|
||||
},
|
||||
attrFormat(arr) {
|
||||
attrFormat (arr) {
|
||||
let data = []
|
||||
const res = []
|
||||
return format(arr)
|
||||
|
||||
function format(arr) {
|
||||
function format (arr) {
|
||||
if (arr.length > 1) {
|
||||
arr.forEach((v, i) => {
|
||||
if (i === 0) data = arr[i]['detail']
|
||||
const tmp = []
|
||||
data.forEach(function(vv) {
|
||||
data.forEach(function (vv) {
|
||||
arr[i + 1] &&
|
||||
arr[i + 1]['detail'] &&
|
||||
arr[i + 1]['detail'].forEach(g => {
|
||||
@ -1872,29 +1873,29 @@ export default {
|
||||
}
|
||||
},
|
||||
// 运费模板
|
||||
addTem() {
|
||||
addTem () {
|
||||
const _this = this
|
||||
this.$modalTemplates(0, function() {
|
||||
this.$modalTemplates(0, function () {
|
||||
_this.getShippingList()
|
||||
})
|
||||
},
|
||||
// 添加服务保障模板
|
||||
addServiceTem() {
|
||||
addServiceTem () {
|
||||
this.$refs.serviceGuarantee.add()
|
||||
},
|
||||
// 删除视频;
|
||||
delVideo() {
|
||||
delVideo () {
|
||||
const that = this
|
||||
that.$set(that.formValidate, 'video_link', '')
|
||||
},
|
||||
zh_uploadFile() {
|
||||
zh_uploadFile () {
|
||||
if (this.videoLink) {
|
||||
this.formValidate.video_link = this.videoLink
|
||||
} else {
|
||||
this.$refs.refid.click()
|
||||
}
|
||||
},
|
||||
zh_uploadFile_change(evfile) {
|
||||
zh_uploadFile_change (evfile) {
|
||||
const that = this
|
||||
that.progress = 10
|
||||
const suffix = evfile.target.files[0].name.substr(
|
||||
@ -1909,7 +1910,7 @@ export default {
|
||||
type: res.data.type,
|
||||
evfile: evfile,
|
||||
res: res,
|
||||
uploading(status, progress) {
|
||||
uploading (status, progress) {
|
||||
that.upload.videoIng = status
|
||||
}
|
||||
})
|
||||
@ -1925,18 +1926,18 @@ export default {
|
||||
})
|
||||
},
|
||||
// 添加规则;
|
||||
addRule() {
|
||||
addRule () {
|
||||
const _this = this
|
||||
this.$modalAttr(this.formDynamics, function() {
|
||||
this.$modalAttr(this.formDynamics, function () {
|
||||
_this.productGetRule()
|
||||
})
|
||||
},
|
||||
// 选择规格
|
||||
onChangeSpec(num) {
|
||||
onChangeSpec (num) {
|
||||
if (num === 1) this.productGetRule()
|
||||
},
|
||||
// 切换积分抵扣
|
||||
changeIntergral(e) {
|
||||
changeIntergral (e) {
|
||||
if (e == -1) {
|
||||
this.formValidate.integral_rate = -1
|
||||
} else {
|
||||
@ -1944,7 +1945,7 @@ export default {
|
||||
}
|
||||
},
|
||||
// 选择属性确认
|
||||
confirm() {
|
||||
confirm () {
|
||||
if (!this.selectRule) {
|
||||
return this.$message.warning('请选择属性')
|
||||
}
|
||||
@ -1955,7 +1956,7 @@ export default {
|
||||
})
|
||||
},
|
||||
// 商户分类;
|
||||
getCategorySelect() {
|
||||
getCategorySelect () {
|
||||
categorySelectApi()
|
||||
.then(res => {
|
||||
this.merCateList = res.data
|
||||
@ -1965,7 +1966,7 @@ export default {
|
||||
})
|
||||
},
|
||||
// 平台分类;
|
||||
getCategoryList() {
|
||||
getCategoryList () {
|
||||
categoryListApi()
|
||||
.then(res => {
|
||||
this.categoryList = res.data
|
||||
@ -1975,7 +1976,7 @@ export default {
|
||||
})
|
||||
},
|
||||
// 品牌筛选;
|
||||
getBrandListApi() {
|
||||
getBrandListApi () {
|
||||
categoryBrandListApi()
|
||||
.then(res => {
|
||||
this.BrandList = res.data
|
||||
@ -1985,39 +1986,39 @@ export default {
|
||||
})
|
||||
},
|
||||
// 获取商品属性模板;
|
||||
productGetRule() {
|
||||
productGetRule () {
|
||||
templateLsitApi().then(res => {
|
||||
this.ruleList = res.data
|
||||
})
|
||||
},
|
||||
// 运费模板;
|
||||
getShippingList() {
|
||||
getShippingList () {
|
||||
shippingListApi().then(res => {
|
||||
this.shippingList = res.data
|
||||
})
|
||||
},
|
||||
// 获取服务保障模板
|
||||
getGuaranteeList() {
|
||||
getGuaranteeList () {
|
||||
guaranteeListApi().then(res => {
|
||||
this.guaranteeList = res.data
|
||||
})
|
||||
},
|
||||
showInput(item) {
|
||||
showInput (item) {
|
||||
this.$set(item, 'inputVisible', true)
|
||||
},
|
||||
virtualbtn(id, type) {
|
||||
virtualbtn (id, type) {
|
||||
if (this.$route.params.id) {
|
||||
return this.$message.warning('商品类型不能切换!')
|
||||
}
|
||||
this.formValidate.type = id
|
||||
this.productCon()
|
||||
},
|
||||
customMessBtn(e) {
|
||||
customMessBtn (e) {
|
||||
if (!e) {
|
||||
this.formValidate.extend = []
|
||||
}
|
||||
},
|
||||
addcustom() {
|
||||
addcustom () {
|
||||
if (this.formValidate.extend.length > 9) {
|
||||
this.$message.warning('最多添加10条')
|
||||
} else {
|
||||
@ -2029,10 +2030,10 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
delcustom(index) {
|
||||
delcustom (index) {
|
||||
this.formValidate.extend.splice(index, 1)
|
||||
},
|
||||
onChangetype(item) {
|
||||
onChangetype (item) {
|
||||
if (item === 1) {
|
||||
this.OneattrValue.map(item => {
|
||||
this.$set(item, 'extension_one', null)
|
||||
@ -2055,7 +2056,7 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
onChangeSpecs(item) {
|
||||
onChangeSpecs (item) {
|
||||
if (item == 1 || item == 2) {
|
||||
this.attrVal = {
|
||||
price: null,
|
||||
@ -2087,72 +2088,72 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
memberPrice(formHead, row) {
|
||||
memberPrice (formHead, row) {
|
||||
if (formHead.title == '售价') {
|
||||
row.svip_price = this.accMul(row.price, this.svip_rate)
|
||||
}
|
||||
},
|
||||
// 乘法
|
||||
accMul(arg1, arg2) {
|
||||
accMul (arg1, arg2) {
|
||||
var max = 0
|
||||
var s1 = arg1.toString()
|
||||
var s2 = arg2.toString()
|
||||
try {
|
||||
max += s1.split('.')[1].length
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
try {
|
||||
max += s2.split('.')[1].length
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
return (
|
||||
(Number(s1.replace('.', '')) * Number(s2.replace('.', ''))) /
|
||||
Math.pow(10, max)
|
||||
)
|
||||
},
|
||||
// 删除表格中的属性
|
||||
delAttrTable(index) {
|
||||
delAttrTable (index) {
|
||||
this.ManyAttrValue.splice(index, 1)
|
||||
},
|
||||
// 批量添加
|
||||
batchAdd() {
|
||||
batchAdd () {
|
||||
for (const val of this.ManyAttrValue) {
|
||||
console.log(this.oneFormBatch[0])
|
||||
if(this.oneFormBatch[0].image!= '')this.$set(val, 'image', this.oneFormBatch[0].image)
|
||||
if(this.oneFormBatch[0].price!= null)this.$set(val, 'price', this.oneFormBatch[0].price)
|
||||
if(this.oneFormBatch[0].cost!= null)this.$set(val, 'cost', this.oneFormBatch[0].cost)
|
||||
if(this.oneFormBatch[0].ot_price!= null)this.$set(val, 'ot_price', this.oneFormBatch[0].ot_price)
|
||||
if(this.oneFormBatch[0].svip_price!= null)this.$set(val, 'svip_price', this.oneFormBatch[0].svip_price)
|
||||
if(this.oneFormBatch[0].stock!= null)this.$set(val, 'stock', this.oneFormBatch[0].stock)
|
||||
if(this.oneFormBatch[0].bar_code!= null)this.$set(val, 'bar_code', this.oneFormBatch[0].bar_code)
|
||||
if(this.oneFormBatch[0].weight!= null)this.$set(val, 'weight', this.oneFormBatch[0].weight)
|
||||
if(this.oneFormBatch[0].volume!= null)this.$set(val, 'volume', this.oneFormBatch[0].volume)
|
||||
if(this.oneFormBatch[0].extension_one!= null)this.$set(val, 'extension_one', this.oneFormBatch[0].extension_one)
|
||||
if(this.oneFormBatch[0].extension_two!= null)this.$set(val, 'extension_two', this.oneFormBatch[0].extension_two)
|
||||
if (this.oneFormBatch[0].image != '') this.$set(val, 'image', this.oneFormBatch[0].image)
|
||||
if (this.oneFormBatch[0].price != null) this.$set(val, 'price', this.oneFormBatch[0].price)
|
||||
if (this.oneFormBatch[0].cost != null) this.$set(val, 'cost', this.oneFormBatch[0].cost)
|
||||
if (this.oneFormBatch[0].ot_price != null) this.$set(val, 'ot_price', this.oneFormBatch[0].ot_price)
|
||||
if (this.oneFormBatch[0].svip_price != null) this.$set(val, 'svip_price', this.oneFormBatch[0].svip_price)
|
||||
if (this.oneFormBatch[0].stock != null) this.$set(val, 'stock', this.oneFormBatch[0].stock)
|
||||
if (this.oneFormBatch[0].bar_code != null) this.$set(val, 'bar_code', this.oneFormBatch[0].bar_code)
|
||||
if (this.oneFormBatch[0].weight != null) this.$set(val, 'weight', this.oneFormBatch[0].weight)
|
||||
if (this.oneFormBatch[0].volume != null) this.$set(val, 'volume', this.oneFormBatch[0].volume)
|
||||
if (this.oneFormBatch[0].extension_one != null) this.$set(val, 'extension_one', this.oneFormBatch[0].extension_one)
|
||||
if (this.oneFormBatch[0].extension_two != null) this.$set(val, 'extension_two', this.oneFormBatch[0].extension_two)
|
||||
}
|
||||
},
|
||||
// 添加按钮
|
||||
addBtn() {
|
||||
addBtn () {
|
||||
this.clearAttr()
|
||||
this.isBtn = true
|
||||
},
|
||||
// 取消
|
||||
offAttrName() {
|
||||
offAttrName () {
|
||||
this.isBtn = false
|
||||
},
|
||||
clearAttr() {
|
||||
clearAttr () {
|
||||
this.formDynamic.attrsName = ''
|
||||
this.formDynamic.attrsVal = ''
|
||||
},
|
||||
// 删除规格
|
||||
handleRemoveAttr(index) {
|
||||
handleRemoveAttr (index) {
|
||||
this.formValidate.attr.splice(index, 1)
|
||||
this.manyFormValidate.splice(index, 1)
|
||||
},
|
||||
// 删除属性
|
||||
handleClose(item, index) {
|
||||
handleClose (item, index) {
|
||||
item.splice(index, 1)
|
||||
},
|
||||
// 添加规则名称
|
||||
createAttrName() {
|
||||
createAttrName () {
|
||||
if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
|
||||
const data = {
|
||||
value: this.formDynamic.attrsName,
|
||||
@ -2160,7 +2161,7 @@ export default {
|
||||
}
|
||||
this.formValidate.attr.push(data)
|
||||
var hash = {}
|
||||
this.formValidate.attr = this.formValidate.attr.reduce(function(
|
||||
this.formValidate.attr = this.formValidate.attr.reduce(function (
|
||||
item,
|
||||
next
|
||||
) {
|
||||
@ -2176,13 +2177,13 @@ export default {
|
||||
}
|
||||
},
|
||||
// 添加属性
|
||||
createAttr(num, idx) {
|
||||
createAttr (num, idx) {
|
||||
if (num) {
|
||||
this.formValidate.attr[idx].detail.push(num);
|
||||
var hash = {};
|
||||
this.formValidate.attr[idx].detail = this.formValidate.attr[
|
||||
idx
|
||||
].detail.reduce(function(item, next) {
|
||||
].detail.reduce(function (item, next) {
|
||||
/* eslint-disable */
|
||||
hash[next] ? "" : (hash[next] = true && item.push(next));
|
||||
return item;
|
||||
@ -2193,11 +2194,11 @@ export default {
|
||||
}
|
||||
},
|
||||
// 详情
|
||||
getInfo() {
|
||||
getInfo () {
|
||||
this.fullscreenLoading = true;
|
||||
productDetailApi(this.$route.params.id)
|
||||
.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;
|
||||
this.infoData(info);
|
||||
this.getSpecsLst(info.cate_id);
|
||||
@ -2207,7 +2208,7 @@ export default {
|
||||
this.$message.error(res.message);
|
||||
});
|
||||
},
|
||||
infoData(info) {
|
||||
infoData (info) {
|
||||
this.deduction_set = info.integral_rate == -1 ? -1 : 1;
|
||||
this.formValidate = {
|
||||
image: info.image,
|
||||
@ -2287,18 +2288,18 @@ export default {
|
||||
this.fullscreenLoading = false;
|
||||
},
|
||||
//关闭淘宝弹窗并生成数据;
|
||||
onClose(data) {
|
||||
onClose (data) {
|
||||
this.modals = false;
|
||||
this.infoData(data);
|
||||
},
|
||||
handleRemove(i) {
|
||||
handleRemove (i) {
|
||||
this.formValidate.slider_image.splice(i, 1);
|
||||
},
|
||||
// 点击商品图
|
||||
modalPicTap(tit, num, i) {
|
||||
modalPicTap (tit, num, i) {
|
||||
const _this = this;
|
||||
const attr = [];
|
||||
this.$modalUpload(function(img) {
|
||||
this.$modalUpload(function (img) {
|
||||
if (tit === "1" && !num) {
|
||||
_this.formValidate.image = img[0];
|
||||
_this.OneattrValue[0].image = img[0];
|
||||
@ -2321,15 +2322,25 @@ export default {
|
||||
if (tit === "1" && num === "pi") {
|
||||
_this.oneFormBatch[0].image = img[0];
|
||||
}
|
||||
if (tit === "3"){
|
||||
_this.formValidate.content.image = img;
|
||||
if (tit === "3") {
|
||||
// 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);
|
||||
},
|
||||
handleSubmitUp() {
|
||||
// 删除详情图片
|
||||
deleteContentImg (index) {
|
||||
this.formValidate.content.image.splice(index, 1)
|
||||
},
|
||||
handleSubmitUp () {
|
||||
this.currentTab = (Number(this.currentTab) - 1).toString();
|
||||
},
|
||||
handleSubmitNest(name) {
|
||||
handleSubmitNest (name) {
|
||||
this.$refs[name].validate(valid => {
|
||||
if (valid) {
|
||||
this.currentTab = (Number(this.currentTab) + 1).toString();
|
||||
@ -2337,7 +2348,7 @@ export default {
|
||||
});
|
||||
},
|
||||
// 提交
|
||||
handleSubmit(name) {
|
||||
handleSubmit (name) {
|
||||
this.$store.dispatch("settings/setEdit", false);
|
||||
this.onChangeGroup();
|
||||
if (this.formValidate.spec_type === 1) {
|
||||
@ -2401,7 +2412,7 @@ export default {
|
||||
});
|
||||
},
|
||||
//预览
|
||||
handlePreview(name) {
|
||||
handlePreview (name) {
|
||||
this.onChangeGroup();
|
||||
if (this.formValidate.spec_type === 1) {
|
||||
this.formValidate.attrValue = this.ManyAttrValue;
|
||||
@ -2419,13 +2430,13 @@ export default {
|
||||
});
|
||||
},
|
||||
// 表单验证
|
||||
validate(prop, status, error) {
|
||||
validate (prop, status, error) {
|
||||
if (status === false) {
|
||||
this.$message.warning(error);
|
||||
}
|
||||
},
|
||||
// 规格图片验证
|
||||
specPicValidate(ManyAttrValue) {
|
||||
specPicValidate (ManyAttrValue) {
|
||||
for (let i = 0; i < ManyAttrValue.length; i++) {
|
||||
if (ManyAttrValue[i].image === "" || !ManyAttrValue[i].image) {
|
||||
this.$message.warning("请上传商品规格图!");
|
||||
@ -2435,16 +2446,16 @@ export default {
|
||||
}
|
||||
},
|
||||
// 移动
|
||||
handleDragStart(e, item) {
|
||||
handleDragStart (e, item) {
|
||||
this.dragging = item;
|
||||
},
|
||||
handleDragEnd(e, item) {
|
||||
handleDragEnd (e, item) {
|
||||
this.dragging = null;
|
||||
},
|
||||
handleDragOver(e) {
|
||||
handleDragOver (e) {
|
||||
e.dataTransfer.dropEffect = "move";
|
||||
},
|
||||
handleDragEnter(e, item) {
|
||||
handleDragEnter (e, item) {
|
||||
e.dataTransfer.effectAllowed = "move";
|
||||
if (item === this.dragging) {
|
||||
return;
|
||||
@ -2456,10 +2467,10 @@ export default {
|
||||
this.formValidate.slider_image = newItems;
|
||||
},
|
||||
// 添加自定义弹窗
|
||||
addCustomDialog(editorId) {
|
||||
addCustomDialog (editorId) {
|
||||
window.UE.registerUI(
|
||||
"test-dialog",
|
||||
function(editor, uiName) {
|
||||
function (editor, uiName) {
|
||||
// 创建 dialog
|
||||
let dialog = new window.UE.ui.Dialog({
|
||||
iframeUrl: roterPre + "/admin/widget/image?field=dialog",
|
||||
@ -2473,7 +2484,7 @@ export default {
|
||||
name: "dialog-button",
|
||||
title: "上传图片",
|
||||
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
|
||||
onclick: function() {
|
||||
onclick: function () {
|
||||
// 渲染dialog
|
||||
dialog.render();
|
||||
dialog.open();
|
||||
@ -2485,7 +2496,7 @@ export default {
|
||||
);
|
||||
window.UE.registerUI(
|
||||
"video-dialog",
|
||||
function(editor, uiName) {
|
||||
function (editor, uiName) {
|
||||
let dialog = new window.UE.ui.Dialog({
|
||||
iframeUrl: roterPre + "/admin/widget/video?fodder=video",
|
||||
editor: editor,
|
||||
@ -2498,7 +2509,7 @@ export default {
|
||||
name: "video-button",
|
||||
title: "上传视频",
|
||||
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -320px -20px;`,
|
||||
onclick: function() {
|
||||
onclick: function () {
|
||||
// 渲染dialog
|
||||
dialog.render();
|
||||
dialog.open();
|
||||
@ -2698,7 +2709,7 @@ export default {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.details_pictrue{
|
||||
.details_pictrue {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user