parent
a8e2b253c6
commit
3c362751b8
5 changed files with 6191 additions and 5152 deletions
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,356 +1,440 @@ |
||||
<template> |
||||
<!-- 产品管理 --> |
||||
<div style="padding-top: 24px"> |
||||
<div class="tool"> |
||||
<ul class="filter" style="align-items: flex-start"> |
||||
<li> |
||||
<label>学科类:</label> |
||||
<el-select v-model="form.categoryId" clearable |
||||
@change="getProfessionalClass()" @clear="clearClass()"> |
||||
<el-option v-for="(item,index) in subjectList" :key="index" |
||||
:label="item.disciplineName" |
||||
:value="item.disciplineId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>专业类:</label> |
||||
<el-select v-model="form.professionalCategoryId" clearable |
||||
:disabled="form.categoryId ? false : true" |
||||
@change="getProfessional" @clear="clearProfess()"> |
||||
<el-option v-for="(item,index) in professionalClassList" :key="index" |
||||
:label="item.professionalClassName" |
||||
:value="item.professionalClassId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>专业:</label> |
||||
<el-select v-model="form.professionalId" clearable |
||||
:disabled="form.professionalCategoryId ? false : true" |
||||
@change="initData"> |
||||
<el-option v-for="(item,index) in professionalList" :key="index" |
||||
:label="item.professionalName" |
||||
:value="item.professionalId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>产品分类:</label> |
||||
<el-select v-model="form.productClassification" clearable placeholder="请选择产品分类" @change="initData"> |
||||
<el-option v-for="(item, i) in productCategoryList" :key="i" :label="item.classificationName" :value="item.classificationId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>搜索:</label> |
||||
<el-input placeholder="请输入" suffix-icon="el-icon-search" v-model="form.productName" clearable size="small"></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button v-auth="'/shop:产品管理:新增'" type="primary" round @click="addCourse">新增</el-button> |
||||
</div> |
||||
</div> |
||||
<!-- 产品管理 --> |
||||
<div style="padding-top: 24px"> |
||||
<div class="tool"> |
||||
<ul class="filter" |
||||
style="align-items: flex-start"> |
||||
<li> |
||||
<label>学科类:</label> |
||||
<el-select v-model="form.categoryId" |
||||
clearable |
||||
@change="getProfessionalClass()" |
||||
@clear="clearClass()"> |
||||
<el-option v-for="(item,index) in subjectList" |
||||
:key="index" |
||||
:label="item.disciplineName" |
||||
:value="item.disciplineId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>专业类:</label> |
||||
<el-select v-model="form.professionalCategoryId" |
||||
clearable |
||||
:disabled="form.categoryId ? false : true" |
||||
@change="getProfessional" |
||||
@clear="clearProfess()"> |
||||
<el-option v-for="(item,index) in professionalClassList" |
||||
:key="index" |
||||
:label="item.professionalClassName" |
||||
:value="item.professionalClassId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>专业:</label> |
||||
<el-select v-model="form.professionalId" |
||||
clearable |
||||
:disabled="form.professionalCategoryId ? false : true" |
||||
@change="initData"> |
||||
<el-option v-for="(item,index) in professionalList" |
||||
:key="index" |
||||
:label="item.professionalName" |
||||
:value="item.professionalId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>产品分类:</label> |
||||
<el-select v-model="form.productClassification" |
||||
clearable |
||||
placeholder="请选择产品分类" |
||||
@change="initData"> |
||||
<el-option v-for="(item, i) in productCategoryList" |
||||
:key="i" |
||||
:label="item.classificationName" |
||||
:value="item.classificationId"></el-option> |
||||
</el-select> |
||||
</li> |
||||
<li> |
||||
<label>搜索:</label> |
||||
<el-input placeholder="请输入" |
||||
suffix-icon="el-icon-search" |
||||
v-model="form.productName" |
||||
clearable |
||||
size="small"></el-input> |
||||
</li> |
||||
</ul> |
||||
<div> |
||||
<el-button v-auth="'/shop:产品管理:新增'" |
||||
type="primary" |
||||
round |
||||
@click="addCourse">新增</el-button> |
||||
</div> |
||||
</div> |
||||
|
||||
<el-table :data="list" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="id" @sort-change="sortChange"> |
||||
<el-table-column type="selection" width="80" align="center" :reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" width="100" label="序号" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="productName" label="产品名称" min-width="150" align="center"></el-table-column> |
||||
<el-table-column prop="supplierName" label="厂商" min-width="150" align="center"></el-table-column> |
||||
<el-table-column prop="classificationName" label="产品分类" min-width="150" align="center"></el-table-column> |
||||
<el-table-column prop="typeName" label="产品类型" min-width="150" align="center"></el-table-column> |
||||
<el-table-column prop="associatedProductName" label="关联产品" min-width="140" align="center"></el-table-column> |
||||
<el-table-column prop="courseName" label="状态" min-width="140" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.isShelves ? '下架' : '上架' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="orderQuantity" label="订单量" min-width="150" align="center"></el-table-column> |
||||
<el-table-column prop="userName" label="最近编辑人" min-width="150" align="center"></el-table-column> |
||||
<el-table-column prop="selected" label="精选" min-width="150" align="center" sortable="custom"> |
||||
<template slot-scope="scope"> |
||||
<i v-auth="'/shop:产品管理:精选'" :class="['icon', scope.row.selected ? 'el-icon-check' : 'el-icon-close']" @click="selected(scope.row)"></i> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="上架/下架" align="center" width="90"> |
||||
<template slot-scope="scope"> |
||||
<el-switch |
||||
v-model="scope.row.isShelves" |
||||
:active-value="0" |
||||
:inactive-value="1" |
||||
@change="changeSwitch($event, scope.row)" |
||||
v-auth="'/shop:产品管理:上下架'"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="120"> |
||||
<template slot-scope="scope"> |
||||
<template v-if="scope.row.isShelves"> |
||||
<el-button v-auth="'/shop:产品管理:编辑'" type="text" @click="edit(scope.row)">编辑</el-button> |
||||
<el-button v-auth="'/shop:产品管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
<el-button v-else v-auth="'/shop:产品管理:查看'" type="text" @click="edit(scope.row, 1)">查看</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background layout="total, prev, pager, next" :total="total" @current-change="handleCurrentChange" :current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
<el-table :data="list" |
||||
class="table" |
||||
ref="table" |
||||
stripe |
||||
header-align="center" |
||||
@selection-change="handleSelectionChange" |
||||
row-key="id" |
||||
@sort-change="sortChange"> |
||||
<el-table-column type="selection" |
||||
width="80" |
||||
align="center" |
||||
:reserve-selection="true"></el-table-column> |
||||
<el-table-column type="index" |
||||
width="100" |
||||
label="序号" |
||||
align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.$index + (page - 1) * pageSize + 1 }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="productName" |
||||
label="产品名称" |
||||
min-width="150" |
||||
align="center"></el-table-column> |
||||
<el-table-column prop="supplierName" |
||||
label="厂商" |
||||
min-width="150" |
||||
align="center"></el-table-column> |
||||
<el-table-column prop="classificationName" |
||||
label="产品分类" |
||||
min-width="150" |
||||
align="center"></el-table-column> |
||||
<el-table-column prop="typeName" |
||||
label="产品类型" |
||||
min-width="150" |
||||
align="center"></el-table-column> |
||||
<el-table-column prop="associatedProductName" |
||||
label="关联产品" |
||||
min-width="140" |
||||
align="center"></el-table-column> |
||||
<el-table-column prop="courseName" |
||||
label="状态" |
||||
min-width="140" |
||||
align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.isShelves ? '下架' : '上架' }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="orderQuantity" |
||||
label="订单量" |
||||
min-width="150" |
||||
align="center"></el-table-column> |
||||
<el-table-column prop="userName" |
||||
label="最近编辑人" |
||||
min-width="150" |
||||
align="center"></el-table-column> |
||||
<el-table-column prop="selected" |
||||
label="精选" |
||||
min-width="150" |
||||
align="center" |
||||
sortable="custom"> |
||||
<template slot-scope="scope"> |
||||
<i v-auth="'/shop:产品管理:精选'" |
||||
:class="['icon', scope.row.selected ? 'el-icon-check' : 'el-icon-close']" |
||||
@click="selected(scope.row)"></i> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="上架/下架" |
||||
align="center" |
||||
width="90"> |
||||
<template slot-scope="scope"> |
||||
<el-switch v-model="scope.row.isShelves" |
||||
:active-value="0" |
||||
:inactive-value="1" |
||||
@change="changeSwitch($event, scope.row)" |
||||
v-auth="'/shop:产品管理:上下架'"> |
||||
</el-switch> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" |
||||
align="center" |
||||
width="120"> |
||||
<template slot-scope="scope"> |
||||
<template v-if="scope.row.isShelves"> |
||||
<el-button v-auth="'/shop:产品管理:编辑'" |
||||
type="text" |
||||
@click="edit(scope.row)">编辑</el-button> |
||||
<el-button v-auth="'/shop:产品管理:删除'" |
||||
type="text" |
||||
@click="handleDelete(scope.row)">删除</el-button> |
||||
</template> |
||||
<el-button v-else |
||||
v-auth="'/shop:产品管理:查看'" |
||||
type="text" |
||||
@click="edit(scope.row, 1)">查看</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<div class="pagination"> |
||||
<el-pagination background |
||||
layout="total, prev, pager, next" |
||||
:total="total" |
||||
@current-change="handleCurrentChange" |
||||
:current-page="page"> |
||||
</el-pagination> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import Util from "@/libs/util"; |
||||
import Setting from '@/setting' |
||||
export default { |
||||
data() { |
||||
return { |
||||
timer: null, |
||||
form: { |
||||
hotTag: 1, |
||||
sort: 0, |
||||
categoryId: '', |
||||
productClassification: '', |
||||
productName: '', |
||||
professionalCategoryId: '', |
||||
professionalId: '', |
||||
}, |
||||
subjectList: [], //专业学科 |
||||
professionalClassList: [], //专业类 |
||||
professionalList: [], //专业 |
||||
productCategoryList: [], |
||||
list: [], |
||||
multipleSelection: [], |
||||
page: +this.$route.query.page || 1, // 当前页码 |
||||
pageSize: 10, |
||||
total: 0 |
||||
}; |
||||
data () { |
||||
return { |
||||
timer: null, |
||||
form: { |
||||
hotTag: 1, |
||||
sort: 0, |
||||
categoryId: '', |
||||
productClassification: '', |
||||
productName: '', |
||||
professionalCategoryId: '', |
||||
professionalId: '', |
||||
}, |
||||
subjectList: [], //专业学科 |
||||
professionalClassList: [], //专业类 |
||||
professionalList: [], //专业 |
||||
productCategoryList: [], |
||||
list: [], |
||||
multipleSelection: [], |
||||
page: +this.$route.query.page || 1, // 当前页码 |
||||
pageSize: 10, |
||||
total: 0 |
||||
}; |
||||
}, |
||||
watch: { |
||||
'form.productName': function (val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.getSubject() |
||||
this.getCategory() |
||||
this.initData() |
||||
}, |
||||
methods: { |
||||
getData () { |
||||
this.$post(this.api.listOfGoods, { |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
...this.form |
||||
}).then(({ page }) => { |
||||
this.list = page.records; |
||||
this.total = page.total; |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
watch: { |
||||
'form.productName': function(val) { |
||||
clearTimeout(this.searchTimer); |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initData(); |
||||
}, 500); |
||||
} |
||||
initData () { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
mounted() { |
||||
this.getSubject() |
||||
this.getCategory() |
||||
this.initData() |
||||
|
||||
// 获取产品分类 |
||||
getCategory () { |
||||
this.$get(this.api.productCategoryList).then(res => { |
||||
this.productCategoryList = res.classificationList |
||||
}).catch(err => { }) |
||||
}, |
||||
methods: { |
||||
getData() { |
||||
this.$post(this.api.listOfGoods, { |
||||
pageNum: this.page, |
||||
pageSize: this.pageSize, |
||||
...this.form |
||||
}).then(({ page }) => { |
||||
this.list = page.records; |
||||
this.total = page.total; |
||||
}).catch(res => { |
||||
}); |
||||
}, |
||||
initData() { |
||||
this.page = 1; |
||||
this.getData(); |
||||
}, |
||||
|
||||
// 获取产品分类 |
||||
getCategory() { |
||||
this.$get(this.api.productCategoryList).then(res => { |
||||
this.productCategoryList = res.classificationList |
||||
}).catch(err => {}) |
||||
}, |
||||
// 获取学科类别 |
||||
getSubject() { |
||||
this.$get(this.api.courseDiscipline).then(res => { |
||||
this.subjectList = res.list; |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
// 清除学科类别 |
||||
clearClass() { |
||||
this.form.professionalCategoryId = ""; |
||||
this.form.professionalId = ""; |
||||
}, |
||||
// 获取专业类 |
||||
getProfessionalClass() { |
||||
this.clearClass(); |
||||
this.getProfessionalClassData(); |
||||
this.page = 1; |
||||
this.initData(); |
||||
}, |
||||
getProfessionalClassData() { |
||||
let data = { |
||||
disciplineId: this.form.categoryId |
||||
}; |
||||
this.$get(this.api.courseProfessionalClass, data).then(res => { |
||||
this.professionalClassList = res.list; |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
// 清除专业类 |
||||
clearProfess() { |
||||
this.form.professionalId = ""; |
||||
}, |
||||
// 获取专业 |
||||
getProfessional() { |
||||
this.clearProfess(); |
||||
this.getProfessionalData(); |
||||
this.page = 1; |
||||
// 获取学科类别 |
||||
getSubject () { |
||||
this.$get(this.api.courseDiscipline).then(res => { |
||||
this.subjectList = res.list; |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
// 清除学科类别 |
||||
clearClass () { |
||||
this.form.professionalCategoryId = ""; |
||||
this.form.professionalId = ""; |
||||
}, |
||||
// 获取专业类 |
||||
getProfessionalClass () { |
||||
this.clearClass(); |
||||
this.getProfessionalClassData(); |
||||
this.page = 1; |
||||
this.initData(); |
||||
}, |
||||
getProfessionalClassData () { |
||||
let data = { |
||||
disciplineId: this.form.categoryId |
||||
}; |
||||
this.$get(this.api.courseProfessionalClass, data).then(res => { |
||||
this.professionalClassList = res.list; |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
// 清除专业类 |
||||
clearProfess () { |
||||
this.form.professionalId = ""; |
||||
}, |
||||
// 获取专业 |
||||
getProfessional () { |
||||
this.clearProfess(); |
||||
this.getProfessionalData(); |
||||
this.page = 1; |
||||
this.initData(); |
||||
}, |
||||
getProfessionalData () { |
||||
let data = { |
||||
professionalClassId: this.form.professionalCategoryId |
||||
}; |
||||
this.$get(this.api.courseProfessional, data).then(res => { |
||||
this.professionalList = res.list; |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
addCourse () { |
||||
this.$router.push("/shop/addProduct"); |
||||
}, |
||||
edit (row, show = 0) { |
||||
this.$router.push(`/shop/addProduct?id=${row.mallId}&show=${show}`) |
||||
}, |
||||
handleDelete (row) { |
||||
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
this.$post(this.api.deletionOfGoods, row.mallId).then(res => { |
||||
Util.successMsg("删除成功"); |
||||
this.initData(); |
||||
}, |
||||
getProfessionalData() { |
||||
let data = { |
||||
professionalClassId: this.form.professionalCategoryId |
||||
}; |
||||
this.$get(this.api.courseProfessional, data).then(res => { |
||||
this.professionalList = res.list; |
||||
}).catch(err => { |
||||
}); |
||||
}, |
||||
addCourse() { |
||||
this.$router.push("/shop/addProduct"); |
||||
}, |
||||
edit(row, show = 0) { |
||||
this.$router.push(`/shop/addProduct?id=${row.mallId}&show=${show}`) |
||||
}, |
||||
handleDelete(row) { |
||||
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", { |
||||
type: "warning" |
||||
}).catch(res => { |
||||
}); |
||||
}) |
||||
.catch(() => { |
||||
}); |
||||
}, |
||||
handleSelectionChange (val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllData () { |
||||
const list = this.multipleSelection |
||||
if (list.length != "") { |
||||
this.$confirm(`确定要删除吗?`, "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
const data = [] |
||||
list.map(e => { |
||||
data.push('ids=' + e.id) |
||||
}) |
||||
.then(() => { |
||||
this.$post(this.api.deletionOfGoods, row.mallId).then(res => { |
||||
Util.successMsg("删除成功"); |
||||
this.initData(); |
||||
}).catch(res => { |
||||
}); |
||||
}) |
||||
.catch(() => { |
||||
}); |
||||
}, |
||||
handleSelectionChange(val) { |
||||
this.multipleSelection = val; |
||||
}, |
||||
delAllData() { |
||||
const list = this.multipleSelection |
||||
if (list.length != "") { |
||||
this.$confirm(`确定要删除吗?`, "提示", { |
||||
type: "warning" |
||||
}) |
||||
.then(() => { |
||||
const data = [] |
||||
list.map(e => { |
||||
data.push('ids=' + e.id) |
||||
}) |
||||
this.$post(`${this.api.delTheoreticalCourse}?${data.join('&')}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
Util.successMsg("删除成功"); |
||||
this.initData(); |
||||
}).catch(res => { |
||||
}); |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
Util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleCurrentChange(val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
// 上下架 |
||||
async changeSwitch(value, row) { |
||||
const res = await this.$get(`${this.api.detailsOfGoods}?mallId=${row.mallId}`) |
||||
const form = res.orderDetails |
||||
const { mall } = form |
||||
let err |
||||
let disErr |
||||
// for (const e of form.mallDisciplines) { |
||||
// if (!e.categoryId) { |
||||
// disErr = '请选择学科类别!' |
||||
// break |
||||
// } |
||||
// if (!e.professionalCategoryId) { |
||||
// disErr = '请选择专业类!' |
||||
// break |
||||
// } |
||||
// if (!e.professionalId) { |
||||
// disErr = '请选择专业!' |
||||
// break |
||||
// } |
||||
// } |
||||
this.$post(`${this.api.delTheoreticalCourse}?${data.join('&')}`).then(res => { |
||||
this.$refs.table.clearSelection(); |
||||
Util.successMsg("删除成功"); |
||||
this.initData(); |
||||
}).catch(res => { |
||||
}); |
||||
}).catch(() => { |
||||
}); |
||||
} else { |
||||
Util.errorMsg("请先选择数据 !"); |
||||
} |
||||
}, |
||||
handleCurrentChange (val) { |
||||
this.page = val; |
||||
this.getData(); |
||||
}, |
||||
// 上下架 |
||||
async changeSwitch (value, row) { |
||||
const res = await this.$get(`${this.api.detailsOfGoods}?mallId=${row.mallId}`) |
||||
const form = res.orderDetails |
||||
const { mall } = form |
||||
let err |
||||
let disErr |
||||
// for (const e of form.mallDisciplines) { |
||||
// if (!e.categoryId) { |
||||
// disErr = '请选择学科类别!' |
||||
// break |
||||
// } |
||||
// if (!e.professionalCategoryId) { |
||||
// disErr = '请选择专业类!' |
||||
// break |
||||
// } |
||||
// if (!e.professionalId) { |
||||
// disErr = '请选择专业!' |
||||
// break |
||||
// } |
||||
// } |
||||
|
||||
let priceErr |
||||
for (const e of form.mallPrices) { |
||||
if (e.settlementPrice === '' || e.settlementPrice === undefined || e.area === '') { |
||||
priceErr = 1 |
||||
break |
||||
} |
||||
} |
||||
if (!mall.isAssociatedProduct && !mall.associatedProduct) { |
||||
err = 1 |
||||
} else if (!form.classificationIds.length) { |
||||
err = 1 |
||||
} else if (!form.typeIds.length) { |
||||
err = 1 |
||||
} else if (!form.supplierIds.length) { |
||||
err = 1 |
||||
} else if (disErr) { |
||||
err = disErr |
||||
} else if (!mall.coverDrawing) { |
||||
err = 1 |
||||
} else if (!mall.marketUnitPrice) { |
||||
err = 1 |
||||
} else if (priceErr) { |
||||
err = 1 |
||||
} else if (!mall.productIntroduction) { |
||||
err = 1 |
||||
} else if (!mall.detailedIntroduction) { |
||||
err = 1 |
||||
} |
||||
if (err) { |
||||
Util.errorMsg('无法上架!请编辑产品后上架!') |
||||
row.isShelves = 1 |
||||
return |
||||
} |
||||
this.$post(`${this.api.goodsOffTheShelf}?mallId=${row.mallId}&isShelves=${value}`).then((res) => { |
||||
this.getData() |
||||
}).catch(({ status }) => { |
||||
if (status !== 200) row.isShelves = 1 |
||||
}) |
||||
}, |
||||
// 精选 |
||||
selected(row) { |
||||
this.$post(`${this.api.goodsSelection}?mallId=${row.mallId}&selected=${row.selected ? 0 : 1}`).then((res) => { |
||||
this.getData(); |
||||
}).catch((res) => {}) |
||||
}, |
||||
// 排序回调 |
||||
sortChange(column) { |
||||
const { order } = column |
||||
if (column.prop === 'selected') { |
||||
this.form.sort = order ? order === 'ascending' ? 4 : 3 : 0 |
||||
let priceErr |
||||
for (const e of form.mallPrices) { |
||||
if (e.settlementPrice === '' || e.settlementPrice === undefined || e.area === '') { |
||||
priceErr = 1 |
||||
break |
||||
} |
||||
} |
||||
if (!mall.isAssociatedProduct && !mall.associatedProduct) { |
||||
err = 1 |
||||
} else if (!form.classificationIds.length) { |
||||
err = 1 |
||||
} else if (!form.typeIds.length) { |
||||
err = 1 |
||||
} else if (!form.supplierIds.length) { |
||||
err = 1 |
||||
} else if (disErr) { |
||||
err = disErr |
||||
} else if (!mall.coverDrawing) { |
||||
err = 1 |
||||
} else if (!mall.marketUnitPrice) { |
||||
err = 1 |
||||
} else if (priceErr) { |
||||
err = 1 |
||||
} else if (!mall.productIntroduction) { |
||||
err = 1 |
||||
} else if (!mall.detailedIntroduction) { |
||||
err = 1 |
||||
} |
||||
if (err) { |
||||
Util.errorMsg('无法上架!请编辑产品后上架!') |
||||
row.isShelves = 1 |
||||
return |
||||
} |
||||
this.$post(`${this.api.goodsOffTheShelf}?mallId=${row.mallId}&isShelves=${value}`).then((res) => { |
||||
this.getData() |
||||
}, |
||||
} |
||||
}).catch(({ status }) => { |
||||
if (status !== 200) row.isShelves = 1 |
||||
}) |
||||
}, |
||||
// 精选 |
||||
selected (row) { |
||||
this.$post(`${this.api.goodsSelection}?mallId=${row.mallId}&selected=${row.selected ? 0 : 1}`).then((res) => { |
||||
this.getData(); |
||||
}).catch((res) => { }) |
||||
}, |
||||
// 排序回调 |
||||
sortChange (column) { |
||||
const { order } = column |
||||
if (column.prop === 'selected') { |
||||
this.form.sort = order ? order === 'ascending' ? 4 : 3 : 0 |
||||
} |
||||
this.getData() |
||||
}, |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
/deep/ .tool { |
||||
margin-bottom: 14px; |
||||
.filter { |
||||
flex-wrap: wrap; |
||||
li { |
||||
margin-bottom: 10px; |
||||
} |
||||
.el-input { |
||||
min-width: 215px; |
||||
} |
||||
} |
||||
} |
||||
.icon { |
||||
font-size: 16px; |
||||
color: #9076FF; |
||||
cursor: pointer; |
||||
font-size: 16px; |
||||
color: #9076ff; |
||||
cursor: pointer; |
||||
} |
||||
</style> |
Loading…
Reference in new issue