fixLog V2.4.7
yujialong 2 years ago
parent a8e2b253c6
commit 3c362751b8
  1. 2038
      src/views/course/AddCurriculum.vue
  2. 5466
      src/views/order/AddOrder.vue
  3. 2601
      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> <template>
<!-- 营销推广管理 --> <!-- 营销推广管理 -->
<div style="padding-top: 24px"> <div style="padding-top: 24px">
<div style="margin-bottom: 10px;text-align: right;"> <div style="margin-bottom: 10px;text-align: right;">
<el-button v-auth="'/shop:营销推广管理:新增'" type="primary" round @click="add">新增</el-button> <el-button v-auth="'/shop:营销推广管理:新增'"
</div> type="primary"
<el-table :data="list" class="table" ref="table" stripe header-align="center" row-key="id"> round
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> @click="add">新增</el-button>
<el-table-column prop="courseName" label="图片" min-width="150" align="center"> </div>
<template slot-scope="scope"> <el-table :data="list"
<img width="100" :src="scope.row.banner" alt=""> class="table"
</template> ref="table"
</el-table-column> stripe
<el-table-column prop="title" label="标题" min-width="150" align="center"></el-table-column> header-align="center"
<el-table-column prop="url" label="链接" min-width="150" align="center"></el-table-column> row-key="id">
<el-table-column label="操作" align="center" width="250"> <el-table-column type="index"
<template slot-scope="scope"> width="100"
<el-switch label="序号"
v-model="scope.row.isOpen" align="center"></el-table-column>
:active-value="0" <el-table-column prop="courseName"
:inactive-value="1" label="图片"
@change="switchOff($event, scope.row)" min-width="150"
v-auth="'/shop:营销推广管理:禁用'"> align="center">
</el-switch> <template slot-scope="scope">
<el-button style="margin-left: 10px;" v-auth="'/shop:营销推广管理:编辑'" type="text" @click="edit(scope.row)">编辑</el-button> <img width="100"
<el-button v-auth="'/shop:营销推广管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button> :src="scope.row.banner"
</template> alt="">
</el-table-column> </template>
</el-table> </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-dialog :title="(form.id ? '编辑' : '新增') + 'banner'"
<el-form ref="form" label-width="60px"> :visible.sync="bannerVisible"
<el-form-item label="图片"> width="500px"
<el-upload class="dialog"
class="avatar-uploader" :close-on-click-modal="false">
accept=".jpg,.png,.jpeg,.gif" <el-form ref="form"
:on-change="changeFile" label-width="60px">
:show-file-list="false" <el-form-item label="图片">
:action="this.api.fileupload" <el-upload class="avatar-uploader"
:auto-upload="false" accept=".jpg,.png,.jpeg,.gif"
> :on-change="changeFile"
<img v-if="form.banner" :src="form.banner" class="avatar"> :show-file-list="false"
<div class="uploader-default" v-else> :action="this.api.fileupload"
<i class="el-icon-plus"></i> :auto-upload="false">
<p>上传图片</p> <img v-if="form.banner"
</div> :src="form.banner"
</el-upload> class="avatar">
</el-form-item> <div class="uploader-default"
<el-form-item label="标题"> v-else>
<el-input v-model="form.title" placeholder="请输入标题" maxlength="100"></el-input> <i class="el-icon-plus"></i>
</el-form-item> <p>上传图片</p>
<el-form-item label="链接"> </div>
<el-input v-model="form.url" placeholder="请输入链接" maxlength="100"></el-input> </el-upload>
</el-form-item> </el-form-item>
</el-form> <el-form-item label="标题">
<span slot="footer" class="dialog-footer"> <el-input v-model="form.title"
<el-button @click="bannerVisible = false">取消</el-button> placeholder="请输入标题"
<el-button type="primary" @click="submitBanner">确定</el-button> maxlength="100"></el-input>
</span> </el-form-item>
</el-dialog> <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"> <el-dialog title="图片裁剪"
<Cropper append-to-body
ref="cropper" :visible.sync="cropperModel"
:img-file.sync="file" width="1100px"
:is-upload="isUpload" :close-on-click-modal="false">
:fixed="true" <Cropper ref="cropper"
:fixedNumber.sync="fixedNumber" :img-file.sync="file"
@upload="customUpload" /> :is-upload="isUpload"
</el-dialog> :fixed="true"
</div> :fixedNumber.sync="fixedNumber"
@upload="customUpload" />
</el-dialog>
</div>
</template> </template>
<script> <script>
@ -79,166 +121,166 @@ import Setting from '@/setting'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
import Axios from 'axios' import Axios from 'axios'
export default { export default {
data() { data () {
return { return {
headers: { headers: {
token: sessionStorage.getItem("token") token: sessionStorage.getItem("token")
}, },
list: [], list: [],
bannerVisible: false, bannerVisible: false,
form: { form: {
id: '', id: '',
banner: '', banner: '',
title: '', title: '',
url: '', url: '',
}, },
cropperModel: false, cropperModel: false,
isUpload: false, isUpload: false,
fixedNumber: [5.7, 1], fixedNumber: [5.48, 1],
file: '' 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: { // base64bolb
getList() { dataURItoBlob (base64Data) {
this.$post(this.api.listMarketing, { let byteString
pageNum: 1, if (base64Data.split(',')[0].indexOf('base64') >= 0) {
pageSize: 1000 byteString = atob(base64Data.split(',')[1])
}).then(({ page }) => { } else {
this.list = page.records; byteString = unescape(base64Data.split(',')[1])
this.total = page.total; }
}).catch(res => { const mimeString = base64Data
}); .split(',')[0]
}, .split(':')[1]
// .split(';')[0]
customUpload(data) { const ia = new Uint8Array(byteString.length)
const formData = new FormData() for (let i = 0; i < byteString.length; i++) {
formData.append('file', data, this.file.name) ia[i] = byteString.charCodeAt(i)
this.imgUpload(formData) }
}, return new Blob([ia], {
// type: mimeString
compress(img) { })
const canvas = document.createElement('canvas') },
const ctx = canvas.getContext('2d') //
// let initSize = img.src.length; imgUpload (formData) {
const width = img.width this.isUpload = true
const height = img.height Axios({
canvas.width = width method: 'post',
canvas.height = height url: this.api.fileUploadNakadai,
// data: formData,
ctx.fillStyle = '#fff' headers: {
ctx.fillRect(0, 0, canvas.width, canvas.height) 'Content-Type': 'multipart/form-data',
ctx.drawImage(img, 0, 0, width, height) ...this.headers
//
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(() => {
});
}, },
switchOff(val, row) { }).then(({ data }) => {
this.$post(`${this.api.bannerEnableOrDisable}?id=${row.id}&isDisable=${row.isOpen}`).then(res => {}).catch(err => {}) 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.m-l-10 { .m-l-10 {
margin-left: 10px; margin-left: 10px;
} }
$avatar-width: 104px; $avatar-width: 104px;
@ -253,7 +295,7 @@ $avatar-width: 104px;
overflow: hidden; overflow: hidden;
&:hover { &:hover {
border-color: #409EFF; border-color: #409eff;
} }
.uploader-default { .uploader-default {

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