12
This commit is contained in:
@@ -1,10 +1,39 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
var service_name = 'oil-mall'
|
var service_name = 'oil-mall'
|
||||||
export default {
|
export default {
|
||||||
brandGetByPage() {
|
brandGetAll(data) {
|
||||||
|
return request({
|
||||||
|
url: `/${service_name}/mallProductBrands/getAll`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
brandUpdate(data) {
|
||||||
|
return request({
|
||||||
|
url: `/${service_name}/mallProductBrands/update`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
brandDelete(data) {
|
||||||
|
return request({
|
||||||
|
url: `/${service_name}/mallProductBrands/delete`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
brandSave(data) {
|
||||||
|
return request({
|
||||||
|
url: `/${service_name}/mallProductBrands/save`,
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
brandGetByPage(data) {
|
||||||
return request({
|
return request({
|
||||||
url: `/${service_name}/mallProductBrands/getByPage`,
|
url: `/${service_name}/mallProductBrands/getByPage`,
|
||||||
method: 'get',
|
method: 'post',
|
||||||
|
data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getAllAttributesType() {
|
getAllAttributesType() {
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ export default {
|
|||||||
addTreeListLabelForCasCard(arr, child) {
|
addTreeListLabelForCasCard(arr, child) {
|
||||||
},
|
},
|
||||||
handlerSubmit() {
|
handlerSubmit() {
|
||||||
console.log(this.model,'454545')
|
|
||||||
productApi[this.model](this.editPram).then((result) => {
|
productApi[this.model](this.editPram).then((result) => {
|
||||||
if(result.code==20000){
|
if(result.code==20000){
|
||||||
this.$parent.$parent.editDialogConfig.visible=false;
|
this.$parent.$parent.editDialogConfig.visible=false;
|
||||||
|
|||||||
@@ -156,12 +156,14 @@ export function isStrictPromise(value) {
|
|||||||
&& typeof value.then === 'function'
|
&& typeof value.then === 'function'
|
||||||
&& typeof value.finally === 'function';
|
&& typeof value.finally === 'function';
|
||||||
}
|
}
|
||||||
export function loadingFn(loading, callback) {
|
export function loadingFn(loading, callback,minTimes=0) {
|
||||||
this[loading] = true
|
this[loading] = true
|
||||||
if (isStrictPromise(callback)) {
|
if (isStrictPromise(callback)) {
|
||||||
callback.finally(() => {
|
callback.finally(() => {
|
||||||
console.log("运行")
|
console.log("运行");
|
||||||
|
setTimeout(() => {
|
||||||
this[loading] = false
|
this[loading] = false
|
||||||
|
}, minTimes);
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
71
src/views/product/brand/components/AddOrEdit.vue
Normal file
71
src/views/product/brand/components/AddOrEdit.vue
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form ref="form" :model="form">
|
||||||
|
<el-form-item prop="brandName" label="品牌名称" label-width="100px"
|
||||||
|
:rules="[{ required: true, message: '请输入品牌名称', trigger: ['blur', 'change'] }]">
|
||||||
|
<el-input v-model="form.brandName"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品牌首字母" prop="firstLetter" label-width="100px"
|
||||||
|
:rules="[{ required: true, message: '请输入品牌首字母', trigger: ['blur', 'change'] }]">
|
||||||
|
<el-input v-model="form.firstLetter"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label=" 品牌LOGO" label-width="100px">
|
||||||
|
<upload :photo="form.logoUrl" @success="uploadSuccess" tip="只能上传jpg/png格式文件,文件不能超过50kb">
|
||||||
|
</upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" label-width="100px">
|
||||||
|
<el-input-number v-model="form.sort" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否显示" label-width="100px">
|
||||||
|
<el-switch v-model="form.showFlag" active-text="显示" inactive-text="隐藏" active-value="1"
|
||||||
|
inactive-value="2" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="footer">
|
||||||
|
<el-button @click="$emit('close')" >取 消</el-button>
|
||||||
|
<el-button @click="save" type="primary">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import upload from '@/components/Upload/index'
|
||||||
|
export default {
|
||||||
|
components: { upload },
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
apiMode:"brandSave",
|
||||||
|
form: {
|
||||||
|
"brandName": "",
|
||||||
|
"firstLetter": "",
|
||||||
|
"logoUrl": "",
|
||||||
|
"showFlag": "1",
|
||||||
|
"sort": "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
save() {
|
||||||
|
this.$refs.form.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.$emit("brandSave",this.form,this.apiMode)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
uploadSuccess(e, res) {
|
||||||
|
if (res.code == 20000) {
|
||||||
|
({ publicUrl: this.form.logoUrl } = res.data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.footer {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<el-form ref="artFrom" :model="page" label-width="80px" label-position="right" class="tabform"
|
<el-form ref="artFrom" :model="page" label-width="80px" label-position="right" class="tabform"
|
||||||
@submit.native.prevent inline>
|
@submit.native.prevent inline>
|
||||||
<el-form-item label="输入搜索">
|
<el-form-item label="输入搜索">
|
||||||
<el-input clearable v-model="page.rule_name" placeholder="品牌名称/关键词"
|
<el-input clearable v-model="page.brandName" placeholder="品牌名称/关键词"
|
||||||
class="form_content_width"></el-input>
|
class="form_content_width"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||||
<el-button type="primary" @click="addType">添加品牌</el-button>
|
<el-button type="primary" @click="addBrand">添加品牌</el-button>
|
||||||
<el-table @current-change="tableCurrentChange" ref="table" :data="tableData" v-loading="loading"
|
<el-table @current-change="tableCurrentChange" ref="table" :data="tableData" v-loading="loading"
|
||||||
highlight-current-row :row-key="getRowKey" @selection-change="handleSelectRow" empty-text="暂无数据"
|
highlight-current-row :row-key="getRowKey" @selection-change="handleSelectRow" empty-text="暂无数据"
|
||||||
class="mt14">
|
class="mt14">
|
||||||
@@ -27,57 +27,47 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="品牌名称">
|
<el-table-column label="品牌名称">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ scope.row.name }}</span>
|
<span>{{ scope.row.brandName }}</span>
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="品牌首字母">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button @click="showAttrList(scope.row)" type="text">
|
|
||||||
{{ scope.row.attrCount }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="排序">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button @click="showAttrList(scope.row)" type="text">
|
|
||||||
{{ scope.row.attrCount }}
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="品牌首字母" prop="firstLetter"> </el-table-column>
|
||||||
|
<el-table-column label="排序" prop="sort"> </el-table-column>
|
||||||
<el-table-column label="是否显示">
|
<el-table-column label="是否显示">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button @click="showAttrList(scope.row)" type="text">
|
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag"
|
||||||
{{ scope.row.attrCount }}
|
active-color="#13ce66" inactive-color="#ff4949">
|
||||||
</el-button>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right">
|
<el-table-column label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<a @click="edit(scope.row)">编辑</a>
|
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
|
||||||
<el-divider direction="vertical"></el-divider>
|
<el-divider direction="vertical"></el-divider>
|
||||||
<a @click="del(scope.row)">删除</a>
|
<el-button type="text" @click="del(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div class="acea-row row-right page">
|
<div class="acea-row row-right page">
|
||||||
<el-pagination
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||||
@size-change="handleSizeChange"
|
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize"
|
||||||
@current-change="handleCurrentChange"
|
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" />
|
||||||
:current-page="page.currentPage"
|
|
||||||
:page-sizes="[10, 15, 20, 30]"
|
|
||||||
:page-size="page.pageSize"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
|
||||||
:total="page.totalCount" />
|
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<el-dialog title="品牌设置" :visible.sync="isAddOrEdit" v-loading="addLoading">
|
||||||
|
<addOrEdit v-if="isAddOrEdit" @close="isAddOrEdit = false" @brandSave="brandSave" ref="addOrEdit"></addOrEdit>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import productApi from '@/api/product/productAttr.js';
|
import productApi from '@/api/product/productAttr.js';
|
||||||
import { loadingFn } from "@/utils/validate"
|
import { loadingFn } from "@/utils/validate"
|
||||||
|
import addOrEdit from "./components/AddOrEdit.vue"
|
||||||
export default {
|
export default {
|
||||||
|
components: { addOrEdit },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
addLoading: false,
|
||||||
|
isAddOrEdit: false,
|
||||||
selection: [],
|
selection: [],
|
||||||
selectAttrList: null,
|
selectAttrList: null,
|
||||||
isShowAttrList: false,
|
isShowAttrList: false,
|
||||||
@@ -85,7 +75,9 @@ export default {
|
|||||||
page: {
|
page: {
|
||||||
"currentPage": 1,
|
"currentPage": 1,
|
||||||
"pageSize": 10,
|
"pageSize": 10,
|
||||||
"params": {},
|
"params": {
|
||||||
|
brandName:""
|
||||||
|
},
|
||||||
totalCount: 0
|
totalCount: 0
|
||||||
},
|
},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
@@ -96,14 +88,38 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
created() { },
|
created() {
|
||||||
|
this.init()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
addBrand() {
|
||||||
|
this.isAddOrEdit = true;
|
||||||
|
},
|
||||||
|
brandSave(e,model="brandSave") {
|
||||||
|
loadingFn.call(this, "addLoading", productApi[model](e).then(res => {
|
||||||
|
if (res.code == 20000) {
|
||||||
|
this.$message.success("操作成功")
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isAddOrEdit = false;
|
||||||
|
this.getList();
|
||||||
|
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
}), 1000);
|
||||||
|
|
||||||
|
},
|
||||||
tableCurrentChange(e) { },
|
tableCurrentChange(e) { },
|
||||||
handleCurrentChange(val) { },
|
handleCurrentChange(val) {
|
||||||
handleSizeChange(val) { },
|
this.page.currentPage = val;
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.page.pageSize = val
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
clearSelection() { },
|
clearSelection() { },
|
||||||
onCancel() { },
|
onCancel() { },
|
||||||
addType() { },
|
|
||||||
showAttrList(e) { },
|
showAttrList(e) { },
|
||||||
getRowKey(row) { },
|
getRowKey(row) { },
|
||||||
//全选和取消全选时触发
|
//全选和取消全选时触发
|
||||||
@@ -112,11 +128,30 @@ export default {
|
|||||||
handleSelectRow(selection) { },
|
handleSelectRow(selection) { },
|
||||||
setChecked() { },
|
setChecked() { },
|
||||||
// 删除
|
// 删除
|
||||||
del(row) { },
|
del(row) {
|
||||||
|
this.$alert('请确定删除该数据!', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
callback: action => {
|
||||||
|
if (action == "confirm") {
|
||||||
|
loadingFn.call(this, "loading", productApi.brandDelete(row).then(res => {
|
||||||
|
if (res.code = 20000) {
|
||||||
|
this.$message.success("操作成功!")
|
||||||
|
this.handleCurrentChange()
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
addAttr(model) {
|
addAttr(model) {
|
||||||
},
|
},
|
||||||
// 编辑
|
// 编辑
|
||||||
edit(row) {
|
edit(row) {
|
||||||
|
this.isAddOrEdit = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addOrEdit.apiMode = "brandUpdate"
|
||||||
|
this.$refs.addOrEdit.form = Object.assign(this.$refs.addOrEdit.form, row);
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 列表
|
// 列表
|
||||||
getList() {
|
getList() {
|
||||||
@@ -125,7 +160,13 @@ export default {
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
// 表格搜索
|
// 表格搜索
|
||||||
userSearchs() { },
|
userSearchs() {
|
||||||
|
this.handleCurrentChange()
|
||||||
|
},
|
||||||
|
// 初始化
|
||||||
|
init() {
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<el-steps :active="currentTab" align-center finish-status="success">
|
<el-steps :active="currentTab" align-center finish-status="success">
|
||||||
<el-step title="商品信息" />
|
<el-step title="商品信息" />
|
||||||
<el-step title="商品详情" />
|
<el-step title="商品详情" />
|
||||||
<el-step title="其他设置" />
|
<!-- <el-step title="其他设置" /> -->
|
||||||
<!--<el-step title="规格设置" />-->
|
<!--<el-step title="规格设置" />-->
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
@@ -14,14 +14,14 @@
|
|||||||
<el-row v-show="currentTab === 0" :gutter="24">
|
<el-row v-show="currentTab === 0" :gutter="24">
|
||||||
<!-- 商品信息-->
|
<!-- 商品信息-->
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品名称:" prop="storeName">
|
<el-form-item label="商品分类:" prop="categorys">
|
||||||
<el-input v-model="formValidate.storeName" maxlength="249" placeholder="请输入商品名称" :disabled="isDisabled" />
|
<el-cascader @change="cascaderChange" v-model="formValidate.categorys" :options="merCateList"
|
||||||
|
:props="props2" clearable class="selWidth" :show-all-levels="false" :disabled="isDisabled" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品分类:" prop="cateIds">
|
<el-form-item label="商品名称:" prop="productName">
|
||||||
<el-cascader v-model="formValidate.cateIds" :options="merCateList" :props="props2" clearable
|
<el-input v-model="formValidate.productName" maxlength="249" placeholder="请输入商品名称" :disabled="isDisabled" />
|
||||||
class="selWidth" :show-all-levels="false" :disabled="isDisabled" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
@@ -29,18 +29,35 @@
|
|||||||
<el-input v-model="formValidate.keyword" placeholder="请输入商品关键字" :disabled="isDisabled" />
|
<el-input v-model="formValidate.keyword" placeholder="请输入商品关键字" :disabled="isDisabled" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="单位:" prop="unitName">
|
<el-form-item label="商品品牌:" prop="brandId">
|
||||||
<el-input v-model="formValidate.unitName" placeholder="请输入单位" :disabled="isDisabled" />
|
<el-select style="width: 100%;" v-model="formValidate.brandId" placeholder="请选择">
|
||||||
|
<el-option v-for="item in brandOptions" :key="item.id" :label="item.brandName" :value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col> -->
|
</el-col>
|
||||||
|
<el-col v-bind="grid2">
|
||||||
|
<el-form-item label="商品货号" prop="productNum">
|
||||||
|
<el-input v-model="formValidate.productNum" maxlength="249" placeholder="请输入商品货号" :disabled="isDisabled" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col v-bind="grid2">
|
||||||
|
<el-form-item label="商品类型:" prop="productType">
|
||||||
|
<el-select style="width: 100%;" v-model="formValidate.productType" placeholder="请选择商品类型">
|
||||||
|
<el-option label="店铺商品" value="2"> </el-option>
|
||||||
|
<el-option label="平台商品" value="1"> </el-option>
|
||||||
|
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col v-bind="grid2">
|
||||||
<el-form-item label="商品简介:" prop="storeInfo">
|
<el-form-item label="商品简介:" prop="storeInfo">
|
||||||
<el-input v-model="formValidate.storeInfo" type="textarea" maxlength="250" :rows="3" placeholder="请输入商品简介"
|
<el-input v-model="formValidate.storeInfo" type="textarea" maxlength="250" :rows="3" placeholder="请输入商品简介"
|
||||||
:disabled="isDisabled" />
|
:disabled="isDisabled" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-bind="grid2">
|
<el-col :span="24">
|
||||||
<el-form-item label="商品封面图:" prop="image">
|
<el-form-item label="商品封面图:" prop="image">
|
||||||
<div class="upLoadPicBox" @click="modalPicTap('1')" :disabled="isDisabled">
|
<div class="upLoadPicBox" @click="modalPicTap('1')" :disabled="isDisabled">
|
||||||
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
|
<div v-if="formValidate.image" class="pictrue"><img :src="formValidate.image"></div>
|
||||||
@@ -68,17 +85,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :xs="18" :sm="18" :md="18" :lg="12" :xl="12">
|
|
||||||
<el-form-item label="运费模板:" prop="tempId">
|
|
||||||
<el-select v-model="formValidate.tempId" placeholder="请选择" class="mr20" :disabled="isDisabled"
|
|
||||||
style="width:100%;">
|
|
||||||
<el-option v-for="item in shippingList" :key="item.id" :label="item.name" :value="item.id" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col> -->
|
|
||||||
<!-- <el-col :xs="6" :sm="6" :md="6" :lg="12" :xl="12">
|
|
||||||
<el-button v-show="!isDisabled" class="mr15" @click="addTem">运费模板</el-button>
|
|
||||||
</el-col> -->
|
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="商品规格:" props="specType">
|
<el-form-item label="商品规格:" props="specType">
|
||||||
<el-radio-group v-model="formValidate.specType" @change="onChangeSpec(formValidate.specType)"
|
<el-radio-group v-model="formValidate.specType" @change="onChangeSpec(formValidate.specType)"
|
||||||
@@ -87,13 +93,6 @@
|
|||||||
<el-radio :label="true">多规格</el-radio>
|
<el-radio :label="true">多规格</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="佣金设置:" props="isSub">
|
|
||||||
<el-radio-group v-model="formValidate.isSub" @change="onChangetype(formValidate.isSub)"
|
|
||||||
:disabled="isDisabled">
|
|
||||||
<el-radio :label="true" class="radio">单独设置</el-radio>
|
|
||||||
<el-radio :label="false">默认设置</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- 多规格添加-->
|
<!-- 多规格添加-->
|
||||||
<el-col v-if="formValidate.specType && !isDisabled" :span="24" class="noForm">
|
<el-col v-if="formValidate.specType && !isDisabled" :span="24" class="noForm">
|
||||||
@@ -103,7 +102,7 @@
|
|||||||
<el-option v-for="item in ruleList" :key="item.id" :label="item.name" :value="item.id" />
|
<el-option v-for="item in ruleList" :key="item.id" :label="item.name" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button type="primary" class="mr20" @click="confirm">确认</el-button>
|
<el-button type="primary" class="mr20" @click="confirm">确认</el-button>
|
||||||
<el-button class="mr15" @click="addRule">添加规格</el-button>
|
<!-- <el-button class="mr15" @click="addRule">添加规格</el-button> -->
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
@@ -111,44 +110,19 @@
|
|||||||
<div class="acea-row row-middle"><span class="mr5">{{ item.attributeName }}</span><i
|
<div class="acea-row row-middle"><span class="mr5">{{ item.attributeName }}</span><i
|
||||||
class="el-icon-circle-close" @click="handleRemoveAttr(index)" /></div>
|
class="el-icon-circle-close" @click="handleRemoveAttr(index)" /></div>
|
||||||
<div class="rulesBox">
|
<div class="rulesBox">
|
||||||
<el-tag v-for="(j, indexn) in item.attributeContentList" :key="indexn" closable size="medium"
|
<el-tag v-for="(j, indexn) in item.sku.value" :key="indexn" closable size="medium"
|
||||||
:disable-transitions="false" class="mb5 mr10" @close="handleClose(item.attrValue, indexn)">
|
:disable-transitions="false" class="mb5 mr10" @close="handleClose(item.sku.value, indexn,index)">
|
||||||
{{ j }}
|
{{ j }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-input v-if="item.inputVisible" ref="saveTagInput" v-model="item.attrValue.attrsVal"
|
|
||||||
class="input-new-tag" size="small" @keyup.enter.native="createAttr(item.attrValue.attrsVal, index)"
|
|
||||||
@blur="createAttr(item.attrValue.attrsVal, index)" />
|
|
||||||
<el-button v-else class="button-new-tag" size="small" @click="showInput(item)">+ 添加</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-col v-if="isBtn">
|
|
||||||
<el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">
|
|
||||||
<el-form-item label="规格:">
|
|
||||||
<el-input v-model="formDynamic.attrsName" placeholder="请输入规格" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xl="6" :lg="9" :md="9" :sm="24" :xs="24">
|
|
||||||
<el-form-item label="规格值:">
|
|
||||||
<el-input v-model="formDynamic.attrsVal" placeholder="请输入规格值" />
|
|
||||||
</el-form-item>
|
|
||||||
</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 @click="offAttrName">取消</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-col>
|
|
||||||
<el-form-item v-if="!isBtn">
|
|
||||||
<el-button type="primary" icon="md-add" class="mr15" @click="addBtn">添加新规格</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- 批量设置-->
|
<!-- 批量设置-->
|
||||||
<el-col v-if="formValidate.attr.length > 0 && formValidate.specType && !isDisabled" :span="24" class="noForm">
|
<el-col v-if="formValidate.attr.length > 0 && formValidate.specType && !isDisabled" :span="24" class="noForm">
|
||||||
<el-form-item label="批量设置:">
|
<el-form-item label="批量设置:">
|
||||||
<el-table :data="oneFormBatch" border class="tabNumWidth" size="mini">
|
<el-table :data="oneFormBatch" border class="tabNumWidth" size="mini">
|
||||||
<el-table-column align="center" label="图片" min-width="80">
|
<!-- <el-table-column align="center" label="图片" min-width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div class="upLoadPicBox" @click="modalPicTap('1', 'pi')">
|
<div class="upLoadPicBox" @click="modalPicTap('1', 'pi')">
|
||||||
<div v-if="scope.row.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
|
<div v-if="scope.row.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
|
||||||
@@ -157,28 +131,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center"
|
<el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="item.label" align="center"
|
||||||
min-width="120">
|
min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row[iii]" maxlength="9" min="0.01" class="priceBox"
|
<el-input :disabled="isDisabled" maxlength="9" min="0.01" v-model="scope.row[item.value]"
|
||||||
@blur="keyupEvent(iii, scope.row[iii], scope.$index, 1)" />
|
class="priceBox" @blur="keyupEvent(iii, scope.row[item.value], scope.$index, 3)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<template v-if="formValidate.isSub">
|
|
||||||
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input v-model="scope.row.brokerage" type="number" :min="0" :max="scope.row.price"
|
|
||||||
class="priceBox" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" :max="scope.row.price"
|
|
||||||
class="priceBox" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</template>
|
|
||||||
<el-table-column align="center" label="操作" min-width="80">
|
<el-table-column align="center" label="操作" min-width="80">
|
||||||
<template>
|
<template>
|
||||||
<el-button type="text" class="submission" @click="batchAdd">批量添加</el-button>
|
<el-button type="text" class="submission" @click="batchAdd">批量添加</el-button>
|
||||||
@@ -191,40 +151,15 @@
|
|||||||
<!-- 单规格表格-->
|
<!-- 单规格表格-->
|
||||||
<el-form-item v-if="formValidate.specType === false">
|
<el-form-item v-if="formValidate.specType === false">
|
||||||
<el-table :data="OneattrValue" border class="tabNumWidth" size="mini">
|
<el-table :data="OneattrValue" border class="tabNumWidth" size="mini">
|
||||||
<el-table-column align="center" label="图片" min-width="80">
|
<el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="item.label" align="center"
|
||||||
<template slot-scope="scope">
|
|
||||||
<div class="upLoadPicBox" @click="modalPicTap('1', 'dan', 'pi')">
|
|
||||||
<div v-if="formValidate.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
|
|
||||||
<div v-else class="upLoad tabPic">
|
|
||||||
<i class="el-icon-camera cameraIconfont" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center"
|
|
||||||
min-width="120">
|
min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input :disabled="isDisabled" v-model="scope.row[iii]" maxlength="9" min="0.01" class="priceBox"
|
<el-input :disabled="isDisabled" maxlength="9" min="0.01" v-model="scope.row[item.value]"
|
||||||
@blur="keyupEvent(iii, scope.row[iii], scope.$index, 2)" />
|
class="priceBox" @blur="keyupEvent(iii, scope.row[item.value], scope.$index, 3)" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<template v-if="formValidate.isSub">
|
|
||||||
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input :disabled="isDisabled" v-model="scope.row.brokerage" type="number" :min="0"
|
|
||||||
class="priceBox" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input :disabled="isDisabled" v-model="scope.row.brokerageTwo" type="number" :min="0"
|
|
||||||
class="priceBox" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</template>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <div>manyTabDate:{{manyTabDate}}</div> -->
|
|
||||||
<el-form-item label="全部sku:" v-if="$route.params.id && showAll">
|
<el-form-item label="全部sku:" v-if="$route.params.id && showAll">
|
||||||
<el-button type="default" @click="showAllSku()" :disabled="isDisabled">展示</el-button>
|
<el-button type="default" @click="showAllSku()" :disabled="isDisabled">展示</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -233,46 +168,22 @@
|
|||||||
:class="isDisabled ? 'disLabel' : 'disLabelmoren'">
|
:class="isDisabled ? 'disLabel' : 'disLabelmoren'">
|
||||||
<el-table :data="ManyAttrValue" border class="tabNumWidth" size="mini">
|
<el-table :data="ManyAttrValue" border class="tabNumWidth" size="mini">
|
||||||
<template v-if="manyTabDate">
|
<template v-if="manyTabDate">
|
||||||
<el-table-column v-for="(item, iii) in manyTabDate" :key="iii" align="center"
|
<el-table-column v-for="(item) in manyTabDate" :key="item" align="center" :label="item" min-width="80">
|
||||||
:label="manyTabTit[iii].title" min-width="80">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span class="priceBox" v-text="scope.row[iii]" />
|
<span class="priceBox" v-text="scope.row[item]" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
<el-table-column align="center" label="图片" min-width="80">
|
<el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="item.label" align="center"
|
||||||
<template slot-scope="scope">
|
|
||||||
<div class="upLoadPicBox" @click="modalPicTap('1', 'duo', scope.$index)">
|
|
||||||
<div v-if="scope.row.image" class="pictrue tabPic"><img :src="scope.row.image"></div>
|
|
||||||
<div v-else class="upLoad tabPic">
|
|
||||||
<i class="el-icon-camera cameraIconfont" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column v-for="(item, iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center"
|
|
||||||
min-width="120">
|
min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<!-- <span>scope.row:{{scope.row}}</span>-->
|
<el-input :disabled="isDisabled" maxlength="9" min="0.01" v-model="scope.row[item.value]"
|
||||||
<el-input :disabled="isDisabled" maxlength="9" min="0.01" v-model="scope.row[iii]" class="priceBox"
|
class="priceBox" @blur="keyupEvent(iii, scope.row[item.value], scope.$index, 3)" />
|
||||||
@blur="keyupEvent(iii, scope.row[iii], scope.$index, 3)" />
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="一级返佣(元)" min-width="120" v-if="formValidate.isSub">
|
<el-table-column label="操作" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input :disabled="isDisabled" v-model="scope.row.brokerage" type="number" :min="0"
|
<el-button type="text" @click="delAttrTable(scope.$index)">删除</el-button>
|
||||||
:max="scope.row.price" class="priceBox" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" label="二级返佣(元)" min-width="120" v-if="formValidate.isSub">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-input :disabled="isDisabled" v-model="scope.row.brokerageTwo" type="number" :min="0"
|
|
||||||
:max="scope.row.price" class="priceBox" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column v-if="!isDisabled" key="3" align="center" label="操作" min-width="80">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button type="text" class="submission" @click="delAttrTable(scope.$index)">删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -348,9 +259,9 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button v-show="currentTab > 0" class="submission priamry_border" @click="handleSubmitUp">上一步</el-button>
|
<el-button v-show="currentTab > 0" class="submission priamry_border" @click="handleSubmitUp">上一步</el-button>
|
||||||
<el-button v-show="currentTab < 2" type="primary" class="submission"
|
<el-button v-show="currentTab < 1" type="primary" class="submission"
|
||||||
@click="handleSubmitNest('formValidate')">下一步</el-button>
|
@click="handleSubmitNest('formValidate')">下一步</el-button>
|
||||||
<el-button v-show="(currentTab === 2 || $route.params.id) && !isDisabled" type="primary" class="submission"
|
<el-button v-show="(currentTab === 1 || $route.params.id) && !isDisabled" type="primary" class="submission"
|
||||||
@click="handleSubmit('formValidate')">提交</el-button>
|
@click="handleSubmit('formValidate')">提交</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -408,25 +319,19 @@ const defaultObj = {
|
|||||||
}
|
}
|
||||||
const objTitle = {
|
const objTitle = {
|
||||||
price: {
|
price: {
|
||||||
title: '售价'
|
title: '市场价格'
|
||||||
},
|
},
|
||||||
cost: {
|
cost: {
|
||||||
title: '成本价'
|
title: '销售价格'
|
||||||
},
|
},
|
||||||
otPrice: {
|
otPrice: {
|
||||||
title: '原价'
|
title: '商品库存'
|
||||||
},
|
},
|
||||||
stock: {
|
stock: {
|
||||||
title: '库存'
|
title: 'SKU编号'
|
||||||
},
|
},
|
||||||
barCode: {
|
barCode: {
|
||||||
title: '商品编号'
|
title: '兑换积分'
|
||||||
},
|
|
||||||
weight: {
|
|
||||||
title: '重量(KG)'
|
|
||||||
},
|
|
||||||
volume: {
|
|
||||||
title: '体积(m³)'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
@@ -434,6 +339,7 @@ export default {
|
|||||||
components: { Templates, CreatTemplates, Tinymce },
|
components: { Templates, CreatTemplates, Tinymce },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
brandOptions: [],
|
||||||
isDisabled: this.$route.params.isDisabled === '1' ? true : false,
|
isDisabled: this.$route.params.isDisabled === '1' ? true : false,
|
||||||
activity: { '默认': 'red', '秒杀': 'blue', '砍价': 'green', '拼团': 'yellow' },
|
activity: { '默认': 'red', '秒杀': 'blue', '砍价': 'green', '拼团': 'yellow' },
|
||||||
props2: {
|
props2: {
|
||||||
@@ -488,33 +394,33 @@ export default {
|
|||||||
xs: 24
|
xs: 24
|
||||||
},
|
},
|
||||||
ruleValidate: {
|
ruleValidate: {
|
||||||
storeName: [
|
// storeName: [
|
||||||
{ required: true, message: '请输入商品名称', trigger: 'blur' }
|
// { required: true, message: '请输入商品名称', trigger: 'blur' }
|
||||||
],
|
// ],
|
||||||
cateIds: [
|
// cateIds: [
|
||||||
{ required: true, message: '请选择商品分类', trigger: 'change', type: 'array', min: '1' }
|
// { required: true, message: '请选择商品分类', trigger: 'change', type: 'array', min: '1' }
|
||||||
],
|
// ],
|
||||||
keyword: [
|
// keyword: [
|
||||||
{ required: true, message: '请输入商品关键字', trigger: 'blur' }
|
// { required: true, message: '请输入商品关键字', trigger: 'blur' }
|
||||||
],
|
// ],
|
||||||
unitName: [
|
// unitName: [
|
||||||
{ required: true, message: '请输入单位', trigger: 'blur' }
|
// { required: true, message: '请输入单位', trigger: 'blur' }
|
||||||
],
|
// ],
|
||||||
storeInfo: [
|
// storeInfo: [
|
||||||
{ required: true, message: '请输入商品简介', trigger: 'blur' }
|
// { required: true, message: '请输入商品简介', trigger: 'blur' }
|
||||||
],
|
// ],
|
||||||
tempId: [
|
// tempId: [
|
||||||
{ required: true, message: '请选择运费模板', trigger: 'change' }
|
// { required: true, message: '请选择运费模板', trigger: 'change' }
|
||||||
],
|
// ],
|
||||||
image: [
|
// image: [
|
||||||
{ required: true, message: '请上传商品图', trigger: 'change' }
|
// { required: true, message: '请上传商品图', trigger: 'change' }
|
||||||
],
|
// ],
|
||||||
sliderImages: [
|
// sliderImages: [
|
||||||
{ required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }
|
// { required: true, message: '请上传商品轮播图', type: 'array', trigger: 'change' }
|
||||||
],
|
// ],
|
||||||
specType: [
|
// specType: [
|
||||||
{ required: true, message: '请选择商品规格', trigger: 'change' }
|
// { required: true, message: '请选择商品规格', trigger: 'change' }
|
||||||
]
|
// ]
|
||||||
},
|
},
|
||||||
attrInfo: {},
|
attrInfo: {},
|
||||||
tableFrom: {
|
tableFrom: {
|
||||||
@@ -527,14 +433,37 @@ export default {
|
|||||||
isAttr: false,
|
isAttr: false,
|
||||||
showAll: false,
|
showAll: false,
|
||||||
videoLink: "",
|
videoLink: "",
|
||||||
|
attrValue: [
|
||||||
|
{
|
||||||
|
label: "市场价格",
|
||||||
|
name: "市场价格",
|
||||||
|
value: "marketPrice"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "销售价格",
|
||||||
|
name: "销售价格",
|
||||||
|
value: "sellPrice"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "商品库存",
|
||||||
|
name: "商品库存",
|
||||||
|
value: "stock"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "SKU编号",
|
||||||
|
name: "SKU编号",
|
||||||
|
|
||||||
|
value: "skuNum"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "兑换积分",
|
||||||
|
name: "兑换积分",
|
||||||
|
value: "integral"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
attrValue() {
|
|
||||||
const obj = Object.assign({}, defaultObj.attrValue[0])
|
|
||||||
delete obj.image
|
|
||||||
return obj
|
|
||||||
},
|
|
||||||
oneFormBatch() {
|
oneFormBatch() {
|
||||||
const obj = [Object.assign({}, defaultObj.attrValue[0])]
|
const obj = [Object.assign({}, defaultObj.attrValue[0])]
|
||||||
delete obj[0].barCode
|
delete obj[0].barCode
|
||||||
@@ -542,6 +471,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
ManyAttrValue(n) { },
|
||||||
'formValidate.attr': {
|
'formValidate.attr': {
|
||||||
handler: function (val) {
|
handler: function (val) {
|
||||||
if (this.formValidate.specType && this.isAttr) this.watCh(val) //重要!!!
|
if (this.formValidate.specType && this.isAttr) this.watCh(val) //重要!!!
|
||||||
@@ -552,11 +482,22 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getCategorySelect();
|
this.getCategorySelect();
|
||||||
this.productGetRule()
|
this.productGetRule();
|
||||||
|
this.brandGetAll()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
brandGetAll(){
|
||||||
|
productApi.brandGetAll().then(res=>{
|
||||||
|
if(res.code==20000){
|
||||||
|
this.brandOptions =res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
cascaderChange(e) {
|
||||||
|
console.log(e, "cascaderChange")
|
||||||
|
},
|
||||||
// 校验输入框不能输入0,保留2位小数,库存为正整数
|
// 校验输入框不能输入0,保留2位小数,库存为正整数
|
||||||
keyupEvent(key, val, index, num) {
|
keyupEvent(key, val, index, num) {
|
||||||
if (key === 'barCode') return;
|
if (key === 'barCode') return;
|
||||||
@@ -621,27 +562,30 @@ export default {
|
|||||||
this.checkboxGroup.includes('isNew') ? this.formValidate.isNew = true : this.formValidate.isNew = false
|
this.checkboxGroup.includes('isNew') ? this.formValidate.isNew = true : this.formValidate.isNew = false
|
||||||
this.checkboxGroup.includes('isHot') ? this.formValidate.isHot = true : this.formValidate.isHot = false
|
this.checkboxGroup.includes('isHot') ? this.formValidate.isHot = true : this.formValidate.isHot = false
|
||||||
},
|
},
|
||||||
|
// sku算法
|
||||||
watCh(val) {
|
watCh(val) {
|
||||||
const tmp = {}
|
let arr = [];
|
||||||
const tmpTab = {}
|
this.manyTabDate = [];
|
||||||
this.formValidate.attr.forEach((o, i) => {
|
for (let i = 0; i < val.length; i++) {
|
||||||
// tmp['value' + i] = { title: o.attrName }
|
arr.push(val[i].sku);
|
||||||
// tmpTab['value' + i] = ''
|
this.manyTabDate.push(val[i].sku.name)
|
||||||
tmp[o.attrName] = { title: o.attrName };
|
};
|
||||||
tmpTab[o.attrName] = '';
|
this.ManyAttrValue = arr.reduce((a, b, c) => {
|
||||||
});
|
let res = [];
|
||||||
this.ManyAttrValue = this.attrFormat(val);
|
a.map(x => {
|
||||||
this.ManyAttrValue.forEach((val, index) => {
|
b.value.map(y => {
|
||||||
const key = Object.values(val.attrValue).sort().join('/')
|
res.push({
|
||||||
if (this.attrInfo[key]) this.ManyAttrValue[index] = this.attrInfo[key]
|
...x,
|
||||||
|
[b.name]: y,
|
||||||
|
data: Object.assign({},x.data||{},{ [b.name]: y}),
|
||||||
|
...Object.fromEntries(this.attrValue.map(item=>{
|
||||||
|
return [item.value,""]
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
this.attrInfo = [];
|
|
||||||
this.ManyAttrValue.forEach((val) => {
|
|
||||||
this.attrInfo[Object.values(val.attrValue).sort().join('/')] = val
|
|
||||||
})
|
})
|
||||||
this.manyTabTit = tmp
|
})
|
||||||
this.manyTabDate = tmpTab
|
return res
|
||||||
this.formThead = Object.assign({}, this.formThead, tmp)
|
}, [{}]);
|
||||||
},
|
},
|
||||||
attrFormat(arr) {
|
attrFormat(arr) {
|
||||||
let data = []
|
let data = []
|
||||||
@@ -738,21 +682,7 @@ export default {
|
|||||||
if (!this.formValidate.selectRule) {
|
if (!this.formValidate.selectRule) {
|
||||||
return this.$message.warning('请选择属性')
|
return this.$message.warning('请选择属性')
|
||||||
}
|
}
|
||||||
const data = [];
|
this.formValidate.attr = JSON.parse(JSON.stringify(this.ruleList.find(item => item.id == this.formValidate.selectRule).attributesList));
|
||||||
this.formValidate.attr = this.ruleList.find(item=>item.id==this.formValidate.selectRule).attributesList;
|
|
||||||
|
|
||||||
console.log(this.formValidate.attr,'attributeContentList')
|
|
||||||
// this.ruleList.forEach(item => { attributesList
|
|
||||||
// if (item.id === this.formValidate.selectRule) {
|
|
||||||
// item.ruleValue.forEach(i => {
|
|
||||||
// data.push({
|
|
||||||
// attrName: i.value,
|
|
||||||
// attrValue: i.detail
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// this.formValidate.attr = data;
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
// 商品分类;
|
// 商品分类;
|
||||||
getCategorySelect() {
|
getCategorySelect() {
|
||||||
@@ -761,15 +691,6 @@ export default {
|
|||||||
this.merCateList = res.data;
|
this.merCateList = res.data;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// categoryApi({ status: -1, type: 1 }).then(res => {
|
|
||||||
// this.merCateList = this.filerMerCateList(res)
|
|
||||||
// let newArr = [];
|
|
||||||
// res.forEach((value,index) => {
|
|
||||||
// newArr[index] = value;
|
|
||||||
// if(value.child) newArr[index].child = value.child.filter(item => item.status === true)
|
|
||||||
// }) //过滤商品分类设置为隐藏的子分类不出现在树形列表里
|
|
||||||
// this.merCateList = this.filerMerCateList(newArr)
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
filerMerCateList(treeData) {
|
filerMerCateList(treeData) {
|
||||||
return treeData.map((item) => {
|
return treeData.map((item) => {
|
||||||
@@ -790,21 +711,13 @@ export default {
|
|||||||
attributesList: item.attributesList.map(citem => {
|
attributesList: item.attributesList.map(citem => {
|
||||||
return {
|
return {
|
||||||
...citem,
|
...citem,
|
||||||
attributeContentList:citem.attributeContent.split(",")
|
sku: { name: citem.attributeName, value: citem.attributeContent.split(",") }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
console.log( this.ruleList,' this.ruleList')
|
|
||||||
})
|
})
|
||||||
// templateListApi(this.tableFrom).then(res => {
|
|
||||||
// const list = res.list
|
|
||||||
// for (var i = 0; i < list.length; i++) {
|
|
||||||
// list[i].ruleValue = JSON.parse(list[i].ruleValue)
|
|
||||||
// }
|
|
||||||
// this.ruleList = list
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
// 运费模板;
|
// 运费模板;
|
||||||
getShippingList() {
|
getShippingList() {
|
||||||
@@ -846,18 +759,10 @@ export default {
|
|||||||
batchAdd() {
|
batchAdd() {
|
||||||
// if (!this.oneFormBatch[0].pic || !this.oneFormBatch[0].price || !this.oneFormBatch[0].cost || !this.oneFormBatch[0].ot_price ||
|
// if (!this.oneFormBatch[0].pic || !this.oneFormBatch[0].price || !this.oneFormBatch[0].cost || !this.oneFormBatch[0].ot_price ||
|
||||||
// !this.oneFormBatch[0].stock || !this.oneFormBatch[0].bar_code) return this.$Message.warning('请填写完整的批量设置内容!');
|
// !this.oneFormBatch[0].stock || !this.oneFormBatch[0].bar_code) return this.$Message.warning('请填写完整的批量设置内容!');
|
||||||
for (const val of this.ManyAttrValue) {
|
console.log( this.ManyAttrValue,this.oneFormBatch," this.ManyAttrValue");
|
||||||
this.$set(val, 'image', this.oneFormBatch[0].image)
|
this.ManyAttrValue.forEach(item=>{
|
||||||
this.$set(val, 'price', this.oneFormBatch[0].price)
|
Object.assign(item,this.oneFormBatch[0])
|
||||||
this.$set(val, 'cost', this.oneFormBatch[0].cost)
|
})
|
||||||
this.$set(val, 'otPrice', this.oneFormBatch[0].otPrice)
|
|
||||||
this.$set(val, 'stock', this.oneFormBatch[0].stock)
|
|
||||||
this.$set(val, 'barCode', this.oneFormBatch[0].barCode)
|
|
||||||
this.$set(val, 'weight', this.oneFormBatch[0].weight)
|
|
||||||
this.$set(val, 'volume', this.oneFormBatch[0].volume)
|
|
||||||
this.$set(val, 'brokerage', this.oneFormBatch[0].brokerage)
|
|
||||||
this.$set(val, 'brokerageTwo', this.oneFormBatch[0].brokerageTwo)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// 添加按钮
|
// 添加按钮
|
||||||
addBtn() {
|
addBtn() {
|
||||||
@@ -876,12 +781,17 @@ export default {
|
|||||||
// 删除规格
|
// 删除规格
|
||||||
handleRemoveAttr(index) {
|
handleRemoveAttr(index) {
|
||||||
this.isAttr = true
|
this.isAttr = true
|
||||||
this.formValidate.attr.splice(index, 1)
|
this.formValidate.attr.splice(index, 1);
|
||||||
this.manyFormValidate.splice(index, 1)
|
this.manyFormValidate.splice(index, 1);
|
||||||
|
|
||||||
},
|
},
|
||||||
// 删除属性
|
// 删除属性
|
||||||
handleClose(item, index) {
|
handleClose(item, index,parentIndex) {
|
||||||
item.splice(index, 1)
|
if (item.length == 1) {
|
||||||
|
this.handleRemoveAttr(parentIndex)
|
||||||
|
} else {
|
||||||
|
item.splice(index, 1);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 添加规则名称
|
// 添加规则名称
|
||||||
createAttrName() {
|
createAttrName() {
|
||||||
@@ -1099,59 +1009,59 @@ export default {
|
|||||||
},
|
},
|
||||||
// 提交
|
// 提交
|
||||||
handleSubmit: Debounce(function (name) {
|
handleSubmit: Debounce(function (name) {
|
||||||
this.onChangeGroup()
|
// this.onChangeGroup()
|
||||||
if (this.formValidate.specType && this.formValidate.attr.length < 1) return this.$message.warning("请填写多规格属性!");
|
// if (this.formValidate.specType && this.formValidate.attr.length < 1) return this.$message.warning("请填写多规格属性!");
|
||||||
this.formValidate.cateId = this.formValidate.cateIds.join(',')
|
// this.formValidate.cateId = this.formValidate.cateIds.join(',')
|
||||||
this.formValidate.sliderImage = JSON.stringify(this.formValidate.sliderImages)
|
// this.formValidate.sliderImage = JSON.stringify(this.formValidate.sliderImages)
|
||||||
if (this.formValidate.specType) {
|
// if (this.formValidate.specType) {
|
||||||
this.formValidate.attrValue = this.ManyAttrValue;
|
// this.formValidate.attrValue = this.ManyAttrValue;
|
||||||
this.formValidate.attr = this.formValidate.attr.map((item) => {
|
// this.formValidate.attr = this.formValidate.attr.map((item) => {
|
||||||
return {
|
// return {
|
||||||
attrName: item.attrName,
|
// attrName: item.attrName,
|
||||||
id: item.id,
|
// id: item.id,
|
||||||
attrValues: item.attrValue.join(','),
|
// attrValues: item.attrValue.join(','),
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
for (var i = 0; i < this.formValidate.attrValue.length; i++) {
|
// for (var i = 0; i < this.formValidate.attrValue.length; i++) {
|
||||||
this.$set(this.formValidate.attrValue[i], 'id', 0);
|
// this.$set(this.formValidate.attrValue[i], 'id', 0);
|
||||||
this.$set(this.formValidate.attrValue[i], 'productId', 0);
|
// this.$set(this.formValidate.attrValue[i], 'productId', 0);
|
||||||
this.$set(this.formValidate.attrValue[i], 'attrValue', JSON.stringify(this.formValidate.attrValue[i].attrValue)); //
|
// this.$set(this.formValidate.attrValue[i], 'attrValue', JSON.stringify(this.formValidate.attrValue[i].attrValue)); //
|
||||||
delete this.formValidate.attrValue[i].value0
|
// delete this.formValidate.attrValue[i].value0
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
this.formValidate.attr = [{ attrName: '规格', attrValues: '默认', id: this.$route.params.id ? this.formValidate.attr[0].id : 0 }]
|
// this.formValidate.attr = [{ attrName: '规格', attrValues: '默认', id: this.$route.params.id ? this.formValidate.attr[0].id : 0 }]
|
||||||
this.OneattrValue.map(item => {
|
// this.OneattrValue.map(item => {
|
||||||
this.$set(item, 'attrValue', JSON.stringify({ '规格': '默认' }))
|
// this.$set(item, 'attrValue', JSON.stringify({ '规格': '默认' }))
|
||||||
})
|
// })
|
||||||
this.formValidate.attrValue = this.OneattrValue
|
// this.formValidate.attrValue = this.OneattrValue
|
||||||
}
|
// }
|
||||||
this.$refs[name].validate((valid) => {
|
// this.$refs[name].validate((valid) => {
|
||||||
if (valid) {
|
// if (valid) {
|
||||||
this.fullscreenLoading = true
|
// this.fullscreenLoading = true
|
||||||
this.$route.params.id ? productUpdateApi(this.formValidate).then(async res => {
|
// this.$route.params.id ? productUpdateApi(this.formValidate).then(async res => {
|
||||||
this.$message.success('编辑成功');
|
// this.$message.success('编辑成功');
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
this.$router.push({ path: '/store/index' });
|
// this.$router.push({ path: '/store/index' });
|
||||||
}, 500);
|
// }, 500);
|
||||||
this.fullscreenLoading = false
|
// this.fullscreenLoading = false
|
||||||
}).catch(res => {
|
// }).catch(res => {
|
||||||
this.fullscreenLoading = false
|
// this.fullscreenLoading = false
|
||||||
}) : productCreateApi(this.formValidate).then(async res => {
|
// }) : productCreateApi(this.formValidate).then(async res => {
|
||||||
this.$message.success('新增成功');
|
// this.$message.success('新增成功');
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
this.$router.push({ path: '/store/index' });
|
// this.$router.push({ path: '/store/index' });
|
||||||
}, 500);
|
// }, 500);
|
||||||
this.fullscreenLoading = false
|
// this.fullscreenLoading = false
|
||||||
}).catch(res => {
|
// }).catch(res => {
|
||||||
this.fullscreenLoading = false
|
// this.fullscreenLoading = false
|
||||||
})
|
// })
|
||||||
} else {
|
// } else {
|
||||||
if (!this.formValidate.storeName || !this.formValidate.cateId || !this.formValidate.keyword
|
// if (!this.formValidate.storeName || !this.formValidate.cateId || !this.formValidate.keyword
|
||||||
|| !this.formValidate.unitName || !this.formValidate.storeInfo || !this.formValidate.image || !this.formValidate.sliderImages) {
|
// || !this.formValidate.unitName || !this.formValidate.storeInfo || !this.formValidate.image || !this.formValidate.sliderImages) {
|
||||||
this.$message.warning("请填写完整商品信息!");
|
// this.$message.warning("请填写完整商品信息!");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}),
|
}),
|
||||||
// 表单验证
|
// 表单验证
|
||||||
validate(prop, status, error) {
|
validate(prop, status, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user