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> <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'"
<el-dialog :title="(form.id ? '编辑' : '新增') + 'banner'" :visible.sync="bannerVisible" width="500px" class="dialog" :close-on-click-modal="false"> :visible.sync="bannerVisible"
<el-form ref="form" label-width="60px"> width="500px"
<el-form-item label="图片"> class="dialog"
<el-upload :close-on-click-modal="false">
class="avatar-uploader" <el-form ref="form"
accept=".jpg,.png,.jpeg,.gif" label-width="60px">
:on-change="changeFile" <el-form-item label="图片">
:show-file-list="false" <el-upload class="avatar-uploader"
:action="this.api.fileupload" accept=".jpg,.png,.jpeg,.gif"
:auto-upload="false" :on-change="changeFile"
> :show-file-list="false"
<img v-if="form.banner" :src="form.banner" class="avatar"> :action="this.api.fileupload"
<div class="uploader-default" v-else> :auto-upload="false">
<i class="el-icon-plus"></i> <img v-if="form.banner"
<p>上传图片</p> :src="form.banner"
</div> class="avatar">
</el-upload> <div class="uploader-default"
</el-form-item> v-else>
<el-form-item label="标题"> <i class="el-icon-plus"></i>
<el-input v-model="form.title" placeholder="请输入标题" maxlength="100"></el-input> <p>上传图片</p>
</el-form-item> </div>
<el-form-item label="链接"> </el-upload>
<el-input v-model="form.url" placeholder="请输入链接" maxlength="100"></el-input> </el-form-item>
</el-form-item> <el-form-item label="标题">
</el-form> <el-input v-model="form.title"
<span slot="footer" class="dialog-footer"> placeholder="请输入标题"
<el-button @click="bannerVisible = false">取消</el-button> maxlength="100"></el-input>
<el-button type="primary" @click="submitBanner">确定</el-button> </el-form-item>
</span> <el-form-item label="链接">
</el-dialog> <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: {
'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: { initData () {
'form.productName': function(val) { this.page = 1;
clearTimeout(this.searchTimer); this.getData();
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
}
}, },
mounted() {
this.getSubject() //
this.getCategory() getCategory () {
this.initData() this.$get(this.api.productCategoryList).then(res => {
this.productCategoryList = res.classificationList
}).catch(err => { })
}, },
methods: { //
getData() { getSubject () {
this.$post(this.api.listOfGoods, { this.$get(this.api.courseDiscipline).then(res => {
pageNum: this.page, this.subjectList = res.list;
pageSize: this.pageSize, }).catch(err => {
...this.form });
}).then(({ page }) => { },
this.list = page.records; //
this.total = page.total; clearClass () {
}).catch(res => { this.form.professionalCategoryId = "";
}); this.form.professionalId = "";
}, },
initData() { //
this.page = 1; getProfessionalClass () {
this.getData(); this.clearClass();
}, this.getProfessionalClassData();
this.page = 1;
// this.initData();
getCategory() { },
this.$get(this.api.productCategoryList).then(res => { getProfessionalClassData () {
this.productCategoryList = res.classificationList let data = {
}).catch(err => {}) disciplineId: this.form.categoryId
}, };
// this.$get(this.api.courseProfessionalClass, data).then(res => {
getSubject() { this.professionalClassList = res.list;
this.$get(this.api.courseDiscipline).then(res => { }).catch(err => {
this.subjectList = res.list; });
}).catch(err => { },
}); //
}, clearProfess () {
// this.form.professionalId = "";
clearClass() { },
this.form.professionalCategoryId = ""; //
this.form.professionalId = ""; getProfessional () {
}, this.clearProfess();
// this.getProfessionalData();
getProfessionalClass() { this.page = 1;
this.clearClass(); this.initData();
this.getProfessionalClassData(); },
this.page = 1; getProfessionalData () {
this.initData(); let data = {
}, professionalClassId: this.form.professionalCategoryId
getProfessionalClassData() { };
let data = { this.$get(this.api.courseProfessional, data).then(res => {
disciplineId: this.form.categoryId this.professionalList = res.list;
}; }).catch(err => {
this.$get(this.api.courseProfessionalClass, data).then(res => { });
this.professionalClassList = res.list; },
}).catch(err => { addCourse () {
}); this.$router.push("/shop/addProduct");
}, },
// edit (row, show = 0) {
clearProfess() { this.$router.push(`/shop/addProduct?id=${row.mallId}&show=${show}`)
this.form.professionalId = ""; },
}, handleDelete (row) {
// this.$confirm("此删除操作不可逆,是否确认删除选中项?", "提示", {
getProfessional() { type: "warning"
this.clearProfess(); })
this.getProfessionalData(); .then(() => {
this.page = 1; 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