fixLog V2.4.7
yujialong 2 years ago
parent a8e2b253c6
commit 3c362751b8
  1. 2042
      src/views/course/AddCurriculum.vue
  2. 5472
      src/views/order/AddOrder.vue
  3. 2611
      src/views/shop/addProduct/index.vue
  4. 484
      src/views/shop/list/market/index.vue
  5. 734
      src/views/shop/list/product/index.vue

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,76 +1,118 @@
<template>
<!-- 营销推广管理 -->
<div style="padding-top: 24px">
<div style="margin-bottom: 10px;text-align: right;">
<el-button v-auth="'/shop:营销推广管理:新增'" type="primary" round @click="add">新增</el-button>
</div>
<el-table :data="list" class="table" ref="table" stripe header-align="center" row-key="id">
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="courseName" label="图片" min-width="150" align="center">
<template slot-scope="scope">
<img width="100" :src="scope.row.banner" alt="">
</template>
</el-table-column>
<el-table-column prop="title" label="标题" min-width="150" align="center"></el-table-column>
<el-table-column prop="url" label="链接" min-width="150" align="center"></el-table-column>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isOpen"
:active-value="0"
:inactive-value="1"
@change="switchOff($event, scope.row)"
v-auth="'/shop:营销推广管理:禁用'">
</el-switch>
<el-button style="margin-left: 10px;" 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-table-column>
</el-table>
<!-- 营销推广管理 -->
<div style="padding-top: 24px">
<div style="margin-bottom: 10px;text-align: right;">
<el-button v-auth="'/shop:营销推广管理:新增'"
type="primary"
round
@click="add">新增</el-button>
</div>
<el-table :data="list"
class="table"
ref="table"
stripe
header-align="center"
row-key="id">
<el-table-column type="index"
width="100"
label="序号"
align="center"></el-table-column>
<el-table-column prop="courseName"
label="图片"
min-width="150"
align="center">
<template slot-scope="scope">
<img width="100"
:src="scope.row.banner"
alt="">
</template>
</el-table-column>
<el-table-column prop="title"
label="标题"
min-width="150"
align="center"></el-table-column>
<el-table-column prop="url"
label="链接"
min-width="150"
align="center"></el-table-column>
<el-table-column label="操作"
align="center"
width="250">
<template slot-scope="scope">
<el-switch v-model="scope.row.isOpen"
:active-value="0"
:inactive-value="1"
@change="switchOff($event, scope.row)"
v-auth="'/shop:营销推广管理:禁用'">
</el-switch>
<el-button style="margin-left: 10px;"
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-table-column>
</el-table>
<el-dialog :title="(form.id ? '编辑' : '新增') + 'banner'" :visible.sync="bannerVisible" width="500px" class="dialog" :close-on-click-modal="false">
<el-form ref="form" label-width="60px">
<el-form-item label="图片">
<el-upload
class="avatar-uploader"
accept=".jpg,.png,.jpeg,.gif"
:on-change="changeFile"
:show-file-list="false"
:action="this.api.fileupload"
:auto-upload="false"
>
<img v-if="form.banner" :src="form.banner" class="avatar">
<div class="uploader-default" v-else>
<i class="el-icon-plus"></i>
<p>上传图片</p>
</div>
</el-upload>
</el-form-item>
<el-form-item label="标题">
<el-input v-model="form.title" placeholder="请输入标题" maxlength="100"></el-input>
</el-form-item>
<el-form-item label="链接">
<el-input v-model="form.url" placeholder="请输入链接" maxlength="100"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="bannerVisible = false">取消</el-button>
<el-button type="primary" @click="submitBanner">确定</el-button>
</span>
</el-dialog>
<el-dialog :title="(form.id ? '编辑' : '新增') + 'banner'"
:visible.sync="bannerVisible"
width="500px"
class="dialog"
:close-on-click-modal="false">
<el-form ref="form"
label-width="60px">
<el-form-item label="图片">
<el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg,.gif"
:on-change="changeFile"
:show-file-list="false"
:action="this.api.fileupload"
:auto-upload="false">
<img v-if="form.banner"
:src="form.banner"
class="avatar">
<div class="uploader-default"
v-else>
<i class="el-icon-plus"></i>
<p>上传图片</p>
</div>
</el-upload>
</el-form-item>
<el-form-item label="标题">
<el-input v-model="form.title"
placeholder="请输入标题"
maxlength="100"></el-input>
</el-form-item>
<el-form-item label="链接">
<el-input v-model="form.url"
placeholder="请输入链接"
maxlength="100"></el-input>
</el-form-item>
</el-form>
<span slot="footer"
class="dialog-footer">
<el-button @click="bannerVisible = false">取消</el-button>
<el-button type="primary"
@click="submitBanner">确定</el-button>
</span>
</el-dialog>
<!-- 剪裁组件弹窗 -->
<el-dialog title="图片裁剪" append-to-body :visible.sync="cropperModel" width="1100px" :close-on-click-modal="false">
<Cropper
ref="cropper"
:img-file.sync="file"
:is-upload="isUpload"
:fixed="true"
:fixedNumber.sync="fixedNumber"
@upload="customUpload" />
</el-dialog>
</div>
<!-- 剪裁组件弹窗 -->
<el-dialog title="图片裁剪"
append-to-body
:visible.sync="cropperModel"
width="1100px"
:close-on-click-modal="false">
<Cropper ref="cropper"
:img-file.sync="file"
:is-upload="isUpload"
:fixed="true"
:fixedNumber.sync="fixedNumber"
@upload="customUpload" />
</el-dialog>
</div>
</template>
<script>
@ -79,166 +121,166 @@ import Setting from '@/setting'
import Cropper from '@/components/img-upload/Cropper'
import Axios from 'axios'
export default {
data() {
return {
headers: {
token: sessionStorage.getItem("token")
},
list: [],
bannerVisible: false,
form: {
id: '',
banner: '',
title: '',
url: '',
},
cropperModel: false,
isUpload: false,
fixedNumber: [5.7, 1],
file: ''
};
data () {
return {
headers: {
token: sessionStorage.getItem("token")
},
list: [],
bannerVisible: false,
form: {
id: '',
banner: '',
title: '',
url: '',
},
cropperModel: false,
isUpload: false,
fixedNumber: [5.48, 1],
file: ''
};
},
components: {
Cropper
},
mounted () {
this.getList()
},
methods: {
getList () {
this.$post(this.api.listMarketing, {
pageNum: 1,
pageSize: 1000
}).then(({ page }) => {
this.list = page.records;
this.total = page.total;
}).catch(res => {
});
},
components: {
Cropper
//
customUpload (data) {
const formData = new FormData()
formData.append('file', data, this.file.name)
this.imgUpload(formData)
},
mounted() {
this.getList()
//
compress (img) {
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
// let initSize = img.src.length;
const width = img.width
const height = img.height
canvas.width = width
canvas.height = height
//
ctx.fillStyle = '#fff'
ctx.fillRect(0, 0, canvas.width, canvas.height)
ctx.drawImage(img, 0, 0, width, height)
//
const ndata = canvas.toDataURL('image/jpeg', 0.8)
return ndata
},
methods: {
getList() {
this.$post(this.api.listMarketing, {
pageNum: 1,
pageSize: 1000
}).then(({ page }) => {
this.list = page.records;
this.total = page.total;
}).catch(res => {
});
},
//
customUpload(data) {
const formData = new FormData()
formData.append('file', data, this.file.name)
this.imgUpload(formData)
},
//
compress(img) {
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
// let initSize = img.src.length;
const width = img.width
const height = img.height
canvas.width = width
canvas.height = height
//
ctx.fillStyle = '#fff'
ctx.fillRect(0, 0, canvas.width, canvas.height)
ctx.drawImage(img, 0, 0, width, height)
//
const ndata = canvas.toDataURL('image/jpeg', 0.8)
return ndata
},
// base64bolb
dataURItoBlob(base64Data) {
let byteString
if (base64Data.split(',')[0].indexOf('base64') >= 0) {
byteString = atob(base64Data.split(',')[1])
} else {
byteString = unescape(base64Data.split(',')[1])
}
const mimeString = base64Data
.split(',')[0]
.split(':')[1]
.split(';')[0]
const ia = new Uint8Array(byteString.length)
for (let i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i)
}
return new Blob([ia], {
type: mimeString
})
},
//
imgUpload(formData) {
this.isUpload = true
Axios({
method: 'post',
url: this.api.fileUploadNakadai,
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
...this.headers
},
}).then(({ data }) => {
this.form.banner = data.filesResult.fileUrl
}).catch(res => {})
this.$refs.cropper.isDisabled = false
this.isUpload = false
this.cropperModel = false
},
//
changeFile(file) {
const { size, name } = file
const ext = name.substring(name.lastIndexOf('.') + 1)
if (!Util.isImg(ext)) {
this.$message.error('请上传图片!')
return false
}
this.file = file
this.cropperModel = true
this.$nextTick(() => {
this.$refs.cropper.updateImg({
url: window.URL.createObjectURL(file.raw),
size: file.size
})
})
},
add() {
this.form = {
id: '',
banner: '',
title: '',
url: '',
}
this.bannerVisible = true
},
edit(row) {
this.form = JSON.parse(JSON.stringify(row))
this.bannerVisible = true
},
// banner
submitBanner() {
const { form } = this
if (!form.banner) return Util.errorMsg('请上传图片')
this.$post(this.api[form.id ? 'updateMarketing' : 'saveMarketing'], form).then(res => {
this.getList()
this.bannerVisible = false
}).catch(res => {})
},
handleDelete(row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
this.$post(`${this.api.delMarketing}?ids=${row.id}`).then(res => {
Util.successMsg("删除成功");
this.getList();
}).catch(res => {
});
})
.catch(() => {
});
// base64bolb
dataURItoBlob (base64Data) {
let byteString
if (base64Data.split(',')[0].indexOf('base64') >= 0) {
byteString = atob(base64Data.split(',')[1])
} else {
byteString = unescape(base64Data.split(',')[1])
}
const mimeString = base64Data
.split(',')[0]
.split(':')[1]
.split(';')[0]
const ia = new Uint8Array(byteString.length)
for (let i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i)
}
return new Blob([ia], {
type: mimeString
})
},
//
imgUpload (formData) {
this.isUpload = true
Axios({
method: 'post',
url: this.api.fileUploadNakadai,
data: formData,
headers: {
'Content-Type': 'multipart/form-data',
...this.headers
},
switchOff(val, row) {
this.$post(`${this.api.bannerEnableOrDisable}?id=${row.id}&isDisable=${row.isOpen}`).then(res => {}).catch(err => {})
}
}).then(({ data }) => {
this.form.banner = data.filesResult.fileUrl
}).catch(res => { })
this.$refs.cropper.isDisabled = false
this.isUpload = false
this.cropperModel = false
},
//
changeFile (file) {
const { size, name } = file
const ext = name.substring(name.lastIndexOf('.') + 1)
if (!Util.isImg(ext)) {
this.$message.error('请上传图片!')
return false
}
this.file = file
this.cropperModel = true
this.$nextTick(() => {
this.$refs.cropper.updateImg({
url: window.URL.createObjectURL(file.raw),
size: file.size
})
})
},
add () {
this.form = {
id: '',
banner: '',
title: '',
url: '',
}
this.bannerVisible = true
},
edit (row) {
this.form = JSON.parse(JSON.stringify(row))
this.bannerVisible = true
},
// banner
submitBanner () {
const { form } = this
if (!form.banner) return Util.errorMsg('请上传图片')
this.$post(this.api[form.id ? 'updateMarketing' : 'saveMarketing'], form).then(res => {
this.getList()
this.bannerVisible = false
}).catch(res => { })
},
handleDelete (row) {
this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
type: "warning"
})
.then(() => {
this.$post(`${this.api.delMarketing}?ids=${row.id}`).then(res => {
Util.successMsg("删除成功");
this.getList();
}).catch(res => {
});
})
.catch(() => {
});
},
switchOff (val, row) {
this.$post(`${this.api.bannerEnableOrDisable}?id=${row.id}&isDisable=${row.isOpen}`).then(res => { }).catch(err => { })
}
}
};
</script>
<style lang="scss" scoped>
.m-l-10 {
margin-left: 10px;
margin-left: 10px;
}
$avatar-width: 104px;
@ -253,7 +295,7 @@ $avatar-width: 104px;
overflow: hidden;
&:hover {
border-color: #409EFF;
border-color: #409eff;
}
.uploader-default {

@ -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…
Cancel
Save