Compare commits
4 Commits
74c91e61bb
...
ab3be1546b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab3be1546b | ||
|
|
6a43e631b5 | ||
|
|
0f3a7b72d6 | ||
|
|
6a42423cfb |
@@ -1,6 +1,20 @@
|
||||
import request from '@/utils/request'
|
||||
var service_name = 'oil-mall'
|
||||
export default {
|
||||
classifySave(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/save`,
|
||||
method: 'post',
|
||||
data: page
|
||||
})
|
||||
},
|
||||
classifyUpdate(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/update`,
|
||||
method: 'post',
|
||||
data: page
|
||||
})
|
||||
},
|
||||
classifyGetByPage(page) { // 分页查询
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/getByPage`,
|
||||
@@ -35,6 +49,13 @@ delete(page) {
|
||||
data: page
|
||||
})
|
||||
},
|
||||
classifyDelete(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/delete`,
|
||||
method: 'post',
|
||||
data: page
|
||||
})
|
||||
},
|
||||
typeSave(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductAttributesType/save`,
|
||||
|
||||
@@ -1,98 +1,103 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<el-form ref="editPram" :model="editPram" label-width="130px">
|
||||
<el-form-item
|
||||
label="分类名称"
|
||||
prop="name"
|
||||
:rules="[{ required:true,message:'请输入分类名称',trigger:['blur','change'] }]"
|
||||
>
|
||||
<el-input v-model="editPram.name" placeholder="分类名称" />
|
||||
<el-form-item label="分类名称" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: ['blur', 'change'] }]">
|
||||
<el-input v-model="editPram.categoryName" placeholder="分类名称" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="URL">
|
||||
<el-input v-model="editPram.url" placeholder="URL" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="父级" >
|
||||
<el-cascader v-model="editPram.pid" :options="parentOptions" :props="categoryProps" style="width:100%" />
|
||||
<el-form-item v-if="editPram.parentCategoryName" label="父级" >
|
||||
{{ editPram.parentCategoryName }}
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="菜单图标" >
|
||||
<el-input placeholder="请选择菜单图标" v-model="editPram.extra">
|
||||
<el-button slot="append" icon="el-icon-circle-plus-outline" @click="addIcon"></el-button>
|
||||
</el-input>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="分类图标(180*180)">
|
||||
<el-form-item label="分类图标(180*180)">
|
||||
<div class="upLoadPicBox" @click="modalPicTap('1')">
|
||||
<div v-if="editPram.extra" class="pictrue">
|
||||
<img :src="editPram.extra">
|
||||
</div>
|
||||
<div v-else class="upLoad">
|
||||
<i class="el-icon-camera cameraIconfont" />
|
||||
</div>
|
||||
<upload :photo="editPram.icon" @success="uploadSuccess" tip="图标尺寸为18*18比例,大小不能超过200KB,图片只能为jpg、png、gif格式"></upload>
|
||||
</div>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="editPram.sort" :min="0"/>
|
||||
<el-input-number v-model="editPram.sort" :min="0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="editPram.status" active-text="显示"
|
||||
inactive-text="隐藏" :active-value="true" :inactive-value="false" />
|
||||
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" active-value="1"
|
||||
inactive-value="2" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="扩展字段" >
|
||||
<el-input v-model="editPram.extra" type="textarea" placeholder="扩展字段" />
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit('editPram')">确定</el-button>
|
||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<!--创建和编辑公用一个组件-->
|
||||
<script>
|
||||
<script>
|
||||
import upload from '@/components/Upload/index'
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
import { loadingFn } from "@/utils/validate"
|
||||
|
||||
export default {
|
||||
// name: "edit"
|
||||
props: { },
|
||||
// name: "edit",
|
||||
components: { upload },
|
||||
props: {
|
||||
parentOptions: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
return {
|
||||
model:"classifySave",
|
||||
loadingBtn: false,
|
||||
constants: [],
|
||||
editPram: {
|
||||
extra: null,
|
||||
name: null,
|
||||
pid: null,
|
||||
sort: 0,
|
||||
status: true,
|
||||
type: 1,
|
||||
url: null,
|
||||
id: 0
|
||||
level: 1,
|
||||
icon:"",
|
||||
showFlag: 1,
|
||||
categoryName: "",
|
||||
sort:1,
|
||||
parentId:"",
|
||||
parentCategoryName:""
|
||||
},
|
||||
categoryProps: {
|
||||
value: 'id',
|
||||
label: 'name',
|
||||
children: 'child',
|
||||
expandTrigger: 'hover',
|
||||
checkStrictly: true,
|
||||
emitPath: false
|
||||
},
|
||||
parentOptions: []
|
||||
label: 'categoryName',
|
||||
children: 'children'
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.initEditData()
|
||||
},
|
||||
methods: {
|
||||
updateModel(e){
|
||||
this.model = e
|
||||
},
|
||||
uploadSuccess(e, res) {
|
||||
if (res.code == 20000) {
|
||||
({ publicUrl: this.editPram.icon } = res.data);
|
||||
}
|
||||
},
|
||||
// 点击图标
|
||||
addIcon() {},
|
||||
addIcon() { },
|
||||
// 点击商品图
|
||||
modalPicTap (tit, num, i) {
|
||||
modalPicTap(tit, num, i) {
|
||||
},
|
||||
close() {
|
||||
this.$parent.$parent.editDialogConfig.visible=false;
|
||||
},
|
||||
initEditData() {
|
||||
},
|
||||
addTreeListLabelForCasCard(arr, child) {
|
||||
},
|
||||
handlerSubmit(formName) {
|
||||
handlerSubmit() {
|
||||
console.log(this.model,'454545')
|
||||
productApi[this.model](this.editPram).then((result) => {
|
||||
if(result.code==20000){
|
||||
this.$parent.$parent.editDialogConfig.visible=false;
|
||||
this.$message.success("添加成功!");
|
||||
this.$parent.$parent.handleCurrentChange();
|
||||
|
||||
}
|
||||
}).catch((err) => {
|
||||
|
||||
});
|
||||
},
|
||||
handlerSaveOrUpdate(isSave) {
|
||||
}
|
||||
@@ -101,5 +106,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
::v-deep .photo-container {
|
||||
align-items: flex-start !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<template>
|
||||
<div class="photo-container">
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="uploadUrl"
|
||||
:limit="1"
|
||||
:show-file-list="false"
|
||||
:on-success="uploadSuccess"
|
||||
:on-remove="removeUrl"
|
||||
:data="{'code':code}"
|
||||
>
|
||||
<div>
|
||||
<el-upload class="avatar-uploader" :action="uploadUrl" :limit="1" :show-file-list="false" :on-success="uploadSuccess"
|
||||
:on-remove="removeUrl" :data="{ 'code': code, 'ossKey': 'xingyou2', 'pathKey': 'banner-group', 'encrypt': 'PUBLIC' }">
|
||||
<img v-if="photoUrl" :src="photoUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
||||
</el-upload>
|
||||
</el-upload>
|
||||
<div @click="removeUrl" style="width: 100%;text-align: center;" v-if="photoUrl" >
|
||||
<i style="font-size: 20px;" class="el-icon-delete" />
|
||||
</div>
|
||||
</div>
|
||||
<span class="upload-span">
|
||||
<slot name="bottom">请上传图片</slot>
|
||||
<slot name="bottom">{{ tip }}</slot>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -21,6 +19,10 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
tip: {
|
||||
type: String,
|
||||
default: "请上传图片"
|
||||
},
|
||||
photo: { // 传参用的url
|
||||
type: String,
|
||||
default: null
|
||||
@@ -42,10 +44,10 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
photo: function(newVal, oldVal) {
|
||||
photo: function (newVal, oldVal) {
|
||||
this.photoUrl = newVal
|
||||
},
|
||||
isPrivate: function(newVal, oldVal) {
|
||||
isPrivate: function (newVal, oldVal) {
|
||||
this.changeUploadUrl
|
||||
}
|
||||
},
|
||||
@@ -60,16 +62,17 @@ export default {
|
||||
this.uploadUrl = process.env.VUE_APP_UPLOAD_URL
|
||||
}
|
||||
},
|
||||
removeUrl(file, fileList) {
|
||||
removeUrl(file, fileList) {
|
||||
this.$emit('success', "", {data:{publicUrl:""},code:20000});
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
if (res.code === 20000) {
|
||||
this.$message.success(res.msg)
|
||||
this.photoUrl = res.data.url
|
||||
if (this.isPrivate) {
|
||||
this.$emit('success', this.res.path)
|
||||
this.$emit('success', this.res.path, res)
|
||||
} else {
|
||||
this.$emit('success', this.photoUrl)
|
||||
this.$emit('success', this.photoUrl, res)
|
||||
}
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
@@ -78,8 +81,9 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
<style >
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed #d9d9d9;
|
||||
border-radius: 6px;
|
||||
@@ -87,9 +91,11 @@ export default {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
@@ -98,6 +104,7 @@ export default {
|
||||
line-height: 178px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
|
||||
@@ -35,8 +35,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
} else {
|
||||
try {
|
||||
await store.dispatch('user/getInfo')
|
||||
const accessRoutes = await store.dispatch('permission/generateRoutes')
|
||||
router.addRoutes(accessRoutes)
|
||||
const accessRoutes = await store.dispatch('permission/generateRoutes');
|
||||
console.log(accessRoutes,"routerrouterrouter")
|
||||
router.addRoutes(accessRoutes);
|
||||
next({ ...to, replace: true })
|
||||
} catch (error) {
|
||||
await store.dispatch('user/resetToken')
|
||||
|
||||
@@ -24,7 +24,7 @@ export const constantRoutes = [{
|
||||
redirect: 'productList',
|
||||
meta: { title: '商品', icon: 'iconkongzhitai', affix: true },
|
||||
children: [
|
||||
{
|
||||
{
|
||||
path: '/productList',
|
||||
component: () => import('@/views/product/productList/index'),
|
||||
name: 'productList',
|
||||
|
||||
@@ -7,7 +7,7 @@ import Layout from '@/layout'
|
||||
* @param routes asyncRoutes
|
||||
* @param auths
|
||||
*/
|
||||
export function filterAsyncRouter(asyncRouterMap) {
|
||||
export function filterAsyncRouter(asyncRouterMap) {
|
||||
return asyncRouterMap.filter(route => {
|
||||
if (route.component) {
|
||||
// Layout组件特殊处理
|
||||
@@ -40,9 +40,9 @@ const actions = {
|
||||
generateRoutes({ commit, dispatch }) {
|
||||
return new Promise(resolve => {
|
||||
// 向后端请求路由数据
|
||||
getRouters().then(res => {
|
||||
const accessedRoutes = filterAsyncRouter([]||res.data)
|
||||
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||
getRouters().then(res => {
|
||||
const accessedRoutes = filterAsyncRouter(res.data);
|
||||
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true });
|
||||
commit('SET_ROUTES', accessedRoutes)
|
||||
resolve(accessedRoutes)
|
||||
})
|
||||
|
||||
@@ -28,18 +28,18 @@ export function checkN(string) {
|
||||
* @constructor
|
||||
*/
|
||||
export const Debounce = (fn, t) => {
|
||||
const delay = t || 500
|
||||
let timer
|
||||
return function() {
|
||||
const args = arguments
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
timer = null
|
||||
fn.apply(this, args)
|
||||
}, delay)
|
||||
}
|
||||
const delay = t || 500
|
||||
let timer
|
||||
return function () {
|
||||
const args = arguments
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
timer = null
|
||||
fn.apply(this, args)
|
||||
}, delay)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {string} string
|
||||
@@ -152,16 +152,16 @@ export function isArray(arg) {
|
||||
}
|
||||
export function isStrictPromise(value) {
|
||||
return !!value
|
||||
&& typeof value === 'object'
|
||||
&& typeof value.then === 'function'
|
||||
&& typeof value.finally === 'function';
|
||||
&& typeof value === 'object'
|
||||
&& typeof value.then === 'function'
|
||||
&& typeof value.finally === 'function';
|
||||
}
|
||||
export function loadingFn(_loading,callback) {
|
||||
console.log(isStrictPromise(callback),_loading,'isStrictPromise(callback)')
|
||||
_loading = true;
|
||||
export function loadingFn(loading, callback) {
|
||||
this[loading] = true
|
||||
if (isStrictPromise(callback)) {
|
||||
callback.finally(() => {
|
||||
// _loading = false;
|
||||
})
|
||||
callback.finally(() => {
|
||||
console.log("运行")
|
||||
this[loading] = false
|
||||
})
|
||||
};
|
||||
}
|
||||
120
src/views/marketing/advertisement/advertisementAdd.vue
Normal file
120
src/views/marketing/advertisement/advertisementAdd.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<div style="width :100%;height:45px;line-height: 45px;background: #f3f3f3; padding-left:20px">
|
||||
添加广告
|
||||
</div>
|
||||
<el-form :rules="rules" ref="form" :model="advertisement" class="formValidate mt20 " label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="13">
|
||||
<el-form-item label="广告名称" prop="storeName">
|
||||
<el-input v-model="advertisement.storeName" maxlength="249" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="13">
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker style="width:100%" v-model="advertisement.startTime" type="date" value-format="yyyy-MM-dd" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="13">
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker style="width:100%" v-model="advertisement.endTime" type="date" value-format="yyyy-MM-dd" placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上线/下线" prop="specType">
|
||||
<el-radio-group v-model="advertisement.specType" @change="onChangeSpec(advertisement.specType)">
|
||||
<el-radio :label="false">上线</el-radio>
|
||||
<el-radio :label="true">下线</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col>
|
||||
<el-form-item label="广告图片" prop="picture">
|
||||
<el-upload
|
||||
:action="updateFileUrl"
|
||||
:data="$store.state.global.headOss"
|
||||
:before-upload="imgCompress"
|
||||
:on-remove="headPhotoRemove"
|
||||
:on-success="headPhotoSuccess"
|
||||
:headers="headers"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过50kb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="13">
|
||||
<el-form-item label="广告链接" prop="link">
|
||||
<el-input v-model="advertisement.link" placeholder="请输入广告链接" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" class="submission" @click="handleSubmit">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { imgCompress } from '@/utils'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import utils from '@/utils/encode'
|
||||
const JSESSIONID = utils.uuid()
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
advertisement: { specType: false },
|
||||
imgCompress,
|
||||
updateFileUrl: process.env.VUE_APP_UPLOAD_URL,
|
||||
headers: {
|
||||
dataSources: 'WEB',
|
||||
Authorization: getToken(),
|
||||
JSESSIONID: JSESSIONID,
|
||||
token: utils.bcrypt(JSESSIONID)
|
||||
},
|
||||
|
||||
rules: {
|
||||
storeName: [{ required: true, message: '请输入广告名称', trigger: 'blur' }],
|
||||
startTime: [{ required: true, message: '请选择开始时间', trigger: 'change' }],
|
||||
endTime: [{ required: true, message: '请选择结束时间', trigger: 'change' }],
|
||||
picture: [{ required: true, message: '请上传广告图片', trigger: 'change' }],
|
||||
link: [{ required: true, message: '请输入广告链接', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChangeSpec(num) {},
|
||||
headPhotoRemove(file, fileList) {
|
||||
// 删除
|
||||
this.advertisement.businessLienceImg = undefined
|
||||
},
|
||||
|
||||
headPhotoSuccess(res) {
|
||||
// 头像上传成功
|
||||
this.advertisement.businessLienceImg = res.data.publicUrl
|
||||
console.log(res)
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
this.save(this.advertisement)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="stylus">
|
||||
|
||||
</style>
|
||||
246
src/views/marketing/advertisement/advertisementList.vue
Normal file
246
src/views/marketing/advertisement/advertisementList.vue
Normal file
@@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<div class="article-manager">
|
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||
<div>
|
||||
<el-form ref="artFrom" :model="artFrom" label-width="80px" label-position="right" inline @submit.native.prevent>
|
||||
<el-form-item label="广告名称:" label-for="pid">
|
||||
<el-input clearable placeholder="广告名称" v-model="artFrom.name" class="form_content_width" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否上线:" label-for="store_name">
|
||||
<el-select v-model="artFrom.type" placeholder="状态" clearable @keyup.enter.native="getByPage">
|
||||
<el-option label="是" value="0" />
|
||||
<el-option label="否" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="到期时间:" label-for="store_name">
|
||||
<el-date-picker v-model="artFrom.createTime" type="date" placeholder="选择日期"> </el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="userSearchs">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" class="bnt" @click="addClass()">添加广告</el-button>
|
||||
<el-table row-key="id" class="mt14" v-loading="loading" :data="tableData" empty-text="暂无数据">
|
||||
<el-table-column prop="categoryNum" label="编号"></el-table-column>
|
||||
<el-table-column prop="categoryName" label="广告名称"></el-table-column>
|
||||
<el-table-column prop="categoryName" label="广告位置"></el-table-column>
|
||||
<el-table-column prop="icon" label="广告图片" min-width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="width: 50px; height: 50px" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"> </el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="时间" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>开始时间:{{ scope.row.createTime }}</span>
|
||||
<br />
|
||||
<span>到期时间:{{ scope.row.updateTime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="showFlag" label="上线/下线">
|
||||
<template slot-scope="scope">
|
||||
<el-switch active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" inactive-color="#ff4949"> </el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sort" label="排序" min-width="100" tooltip="true"></el-table-column>
|
||||
<el-table-column prop="date" label="操作" width="120" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
|
||||
|
||||
<el-button @click="del(scope.row, scope)" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<div class="acea-row row-right page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page.currentPage"
|
||||
:page-sizes="[10, 15, 20, 30]"
|
||||
:page-size="page.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="page.totalCount"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 添加 编辑表单-->
|
||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
||||
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||
<edit ref="edit" :parentOptions="tableData" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import edit from '@/components/Category/edit'
|
||||
import editFrom from '../../../components/from/from'
|
||||
import productApi from '@/api/product/productAttr.js'
|
||||
import { loadingFn } from '@/utils/validate'
|
||||
export default {
|
||||
name: 'product_productClassify',
|
||||
components: {
|
||||
editFrom,
|
||||
edit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editDialogConfig: {
|
||||
visible: false
|
||||
},
|
||||
treeSelect: [],
|
||||
FromData: null,
|
||||
grid: {
|
||||
xl: 7,
|
||||
lg: 7,
|
||||
md: 12,
|
||||
sm: 24,
|
||||
xs: 24
|
||||
},
|
||||
loading: false,
|
||||
artFrom: {
|
||||
page: 1,
|
||||
limit: 15
|
||||
},
|
||||
page: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
params: {},
|
||||
totalCount: 0
|
||||
},
|
||||
total: 0,
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleCommand(e) {},
|
||||
handleSizeChange(val) {
|
||||
this.page.pageSize = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page.currentPage = val
|
||||
this.getList()
|
||||
},
|
||||
// 商品分类;
|
||||
goodsCategory() {},
|
||||
// 列表
|
||||
getList() {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyGetByPage(this.page).then(res => {
|
||||
if ((res.code = 20000)) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data)
|
||||
})
|
||||
)
|
||||
},
|
||||
pageChange(index) {
|
||||
this.artFrom.page = index
|
||||
this.getList()
|
||||
},
|
||||
// 添加
|
||||
addClass(parent = null) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$refs.edit.model = 'classifySave'
|
||||
// this.$nextTick(()=>{
|
||||
// this.$refs.edit.parent = parent;
|
||||
// });
|
||||
if (parent) {
|
||||
let { categoryName, id } = parent
|
||||
this.$nextTick(() => {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 })
|
||||
})
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$nextTick(() => {
|
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row
|
||||
console.log(this.tableData.find(item => item == parentId), 'categoryName')
|
||||
if (row.level == 1) {
|
||||
this.$refs.edit.model = 'classifyUpdate'
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
||||
} else {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, {
|
||||
level,
|
||||
icon,
|
||||
showFlag,
|
||||
parentCategoryName: this.tableData.find(item => item == parentId).categoryName,
|
||||
categoryName,
|
||||
sort,
|
||||
parentId,
|
||||
id
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 修改状态
|
||||
onchangeIsShow(row) {
|
||||
let data = {
|
||||
id: row.id,
|
||||
is_show: row.is_show
|
||||
}
|
||||
setShowApi(data)
|
||||
.then(async res => {
|
||||
this.$message.success(res.msg)
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.msg)
|
||||
})
|
||||
},
|
||||
|
||||
// 删除
|
||||
del(row, scope) {
|
||||
console.log(scope)
|
||||
this.$alert('请确定删除!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
if (action == 'confirm') {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyDelete(row).then(res => {
|
||||
if ((res.code = 20000)) {
|
||||
this.$message.success('操作成功!')
|
||||
this.handleCurrentChange()
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表格搜索
|
||||
userSearchs() {
|
||||
this.artFrom.page = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="stylus">
|
||||
.treeSel ::v-deep .ivu-select-dropdown-list {
|
||||
padding: 0 10px !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tabBox_img {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
230
src/views/marketing/home/homeFreshList.vue
Normal file
230
src/views/marketing/home/homeFreshList.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<div class="article-manager">
|
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||
<div>
|
||||
<el-form ref="artFrom" :model="artFrom" label-width="80px" label-position="right" inline @submit.native.prevent>
|
||||
<el-form-item label="商品名称:" label-for="pid">
|
||||
<el-input clearable placeholder="商品名称" v-model="artFrom.name" class="form_content_width" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐状态:" label-for="store_name">
|
||||
<el-select v-model="artFrom.type" placeholder="状态" clearable @keyup.enter.native="getByPage">
|
||||
<el-option label="是" value="0" />
|
||||
<el-option label="否" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="userSearchs">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" class="bnt" @click="addClass()">选择商品</el-button>
|
||||
<el-table row-key="id" class="mt14" v-loading="loading" :data="tableData" empty-text="暂无数据">
|
||||
<el-table-column prop="categoryNum" label="编号"></el-table-column>
|
||||
<el-table-column prop="categoryName" label="商品名称"></el-table-column>
|
||||
|
||||
<el-table-column prop="showFlag" label="是否推荐">
|
||||
<template slot-scope="scope">
|
||||
<el-switch active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" inactive-color="#ff4949"> </el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" label="操作" width="120" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="edit(scope.row)">置顶</el-button>
|
||||
|
||||
<el-button @click="del(scope.row, scope)" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<div class="acea-row row-right page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page.currentPage"
|
||||
:page-sizes="[10, 15, 20, 30]"
|
||||
:page-size="page.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="page.totalCount"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 添加 编辑表单-->
|
||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
||||
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||
<edit ref="edit" :parentOptions="tableData" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import edit from '@/components/Category/edit'
|
||||
import editFrom from '../../../components/from/from'
|
||||
import productApi from '@/api/product/productAttr.js'
|
||||
import { loadingFn } from '@/utils/validate'
|
||||
export default {
|
||||
name: 'product_productClassify',
|
||||
components: {
|
||||
editFrom,
|
||||
edit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editDialogConfig: {
|
||||
visible: false
|
||||
},
|
||||
treeSelect: [],
|
||||
FromData: null,
|
||||
grid: {
|
||||
xl: 7,
|
||||
lg: 7,
|
||||
md: 12,
|
||||
sm: 24,
|
||||
xs: 24
|
||||
},
|
||||
loading: false,
|
||||
artFrom: {
|
||||
page: 1,
|
||||
limit: 15
|
||||
},
|
||||
page: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
params: {},
|
||||
totalCount: 0
|
||||
},
|
||||
total: 0,
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleCommand(e) {},
|
||||
handleSizeChange(val) {
|
||||
this.page.pageSize = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page.currentPage = val
|
||||
this.getList()
|
||||
},
|
||||
// 商品分类;
|
||||
goodsCategory() {},
|
||||
// 列表
|
||||
getList() {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyGetByPage(this.page).then(res => {
|
||||
if ((res.code = 20000)) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data)
|
||||
})
|
||||
)
|
||||
},
|
||||
pageChange(index) {
|
||||
this.artFrom.page = index
|
||||
this.getList()
|
||||
},
|
||||
// 添加
|
||||
addClass(parent = null) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$refs.edit.model = 'classifySave'
|
||||
// this.$nextTick(()=>{
|
||||
// this.$refs.edit.parent = parent;
|
||||
// });
|
||||
if (parent) {
|
||||
let { categoryName, id } = parent
|
||||
this.$nextTick(() => {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 })
|
||||
})
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$nextTick(() => {
|
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row
|
||||
console.log(this.tableData.find(item => item == parentId), 'categoryName')
|
||||
if (row.level == 1) {
|
||||
this.$refs.edit.model = 'classifyUpdate'
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
||||
} else {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, {
|
||||
level,
|
||||
icon,
|
||||
showFlag,
|
||||
parentCategoryName: this.tableData.find(item => item == parentId).categoryName,
|
||||
categoryName,
|
||||
sort,
|
||||
parentId,
|
||||
id
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 修改状态
|
||||
onchangeIsShow(row) {
|
||||
let data = {
|
||||
id: row.id,
|
||||
is_show: row.is_show
|
||||
}
|
||||
setShowApi(data)
|
||||
.then(async res => {
|
||||
this.$message.success(res.msg)
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.msg)
|
||||
})
|
||||
},
|
||||
|
||||
// 删除
|
||||
del(row, scope) {
|
||||
console.log(scope)
|
||||
this.$alert('请确定删除!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
if (action == 'confirm') {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyDelete(row).then(res => {
|
||||
if ((res.code = 20000)) {
|
||||
this.$message.success('操作成功!')
|
||||
this.handleCurrentChange()
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表格搜索
|
||||
userSearchs() {
|
||||
this.artFrom.page = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="stylus">
|
||||
.treeSel ::v-deep .ivu-select-dropdown-list {
|
||||
padding: 0 10px !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tabBox_img {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
230
src/views/marketing/home/homeLikeList.vue
Normal file
230
src/views/marketing/home/homeLikeList.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<div class="article-manager">
|
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||
<div>
|
||||
<el-form ref="artFrom" :model="artFrom" label-width="80px" label-position="right" inline @submit.native.prevent>
|
||||
<el-form-item label="商品名称:" label-for="pid">
|
||||
<el-input clearable placeholder="商品名称" v-model="artFrom.name" class="form_content_width" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐状态:" label-for="store_name">
|
||||
<el-select v-model="artFrom.type" placeholder="状态" clearable @keyup.enter.native="getByPage">
|
||||
<el-option label="是" value="0" />
|
||||
<el-option label="否" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="userSearchs">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" class="bnt" @click="addClass()">选择商品</el-button>
|
||||
<el-table row-key="id" class="mt14" v-loading="loading" :data="tableData" empty-text="暂无数据">
|
||||
<el-table-column prop="categoryNum" label="编号"></el-table-column>
|
||||
<el-table-column prop="categoryName" label="商品名称"></el-table-column>
|
||||
|
||||
<el-table-column prop="showFlag" label="是否推荐">
|
||||
<template slot-scope="scope">
|
||||
<el-switch active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" inactive-color="#ff4949"> </el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" label="操作" width="120" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="edit(scope.row)">置顶</el-button>
|
||||
|
||||
<el-button @click="del(scope.row, scope)" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<div class="acea-row row-right page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page.currentPage"
|
||||
:page-sizes="[10, 15, 20, 30]"
|
||||
:page-size="page.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="page.totalCount"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 添加 编辑表单-->
|
||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
||||
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||
<edit ref="edit" :parentOptions="tableData" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import edit from '@/components/Category/edit'
|
||||
import editFrom from '../../../components/from/from'
|
||||
import productApi from '@/api/product/productAttr.js'
|
||||
import { loadingFn } from '@/utils/validate'
|
||||
export default {
|
||||
name: 'product_productClassify',
|
||||
components: {
|
||||
editFrom,
|
||||
edit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editDialogConfig: {
|
||||
visible: false
|
||||
},
|
||||
treeSelect: [],
|
||||
FromData: null,
|
||||
grid: {
|
||||
xl: 7,
|
||||
lg: 7,
|
||||
md: 12,
|
||||
sm: 24,
|
||||
xs: 24
|
||||
},
|
||||
loading: false,
|
||||
artFrom: {
|
||||
page: 1,
|
||||
limit: 15
|
||||
},
|
||||
page: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
params: {},
|
||||
totalCount: 0
|
||||
},
|
||||
total: 0,
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleCommand(e) {},
|
||||
handleSizeChange(val) {
|
||||
this.page.pageSize = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page.currentPage = val
|
||||
this.getList()
|
||||
},
|
||||
// 商品分类;
|
||||
goodsCategory() {},
|
||||
// 列表
|
||||
getList() {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyGetByPage(this.page).then(res => {
|
||||
if ((res.code = 20000)) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data)
|
||||
})
|
||||
)
|
||||
},
|
||||
pageChange(index) {
|
||||
this.artFrom.page = index
|
||||
this.getList()
|
||||
},
|
||||
// 添加
|
||||
addClass(parent = null) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$refs.edit.model = 'classifySave'
|
||||
// this.$nextTick(()=>{
|
||||
// this.$refs.edit.parent = parent;
|
||||
// });
|
||||
if (parent) {
|
||||
let { categoryName, id } = parent
|
||||
this.$nextTick(() => {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 })
|
||||
})
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$nextTick(() => {
|
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row
|
||||
console.log(this.tableData.find(item => item == parentId), 'categoryName')
|
||||
if (row.level == 1) {
|
||||
this.$refs.edit.model = 'classifyUpdate'
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
||||
} else {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, {
|
||||
level,
|
||||
icon,
|
||||
showFlag,
|
||||
parentCategoryName: this.tableData.find(item => item == parentId).categoryName,
|
||||
categoryName,
|
||||
sort,
|
||||
parentId,
|
||||
id
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 修改状态
|
||||
onchangeIsShow(row) {
|
||||
let data = {
|
||||
id: row.id,
|
||||
is_show: row.is_show
|
||||
}
|
||||
setShowApi(data)
|
||||
.then(async res => {
|
||||
this.$message.success(res.msg)
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.msg)
|
||||
})
|
||||
},
|
||||
|
||||
// 删除
|
||||
del(row, scope) {
|
||||
console.log(scope)
|
||||
this.$alert('请确定删除!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
if (action == 'confirm') {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyDelete(row).then(res => {
|
||||
if ((res.code = 20000)) {
|
||||
this.$message.success('操作成功!')
|
||||
this.handleCurrentChange()
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表格搜索
|
||||
userSearchs() {
|
||||
this.artFrom.page = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="stylus">
|
||||
.treeSel ::v-deep .ivu-select-dropdown-list {
|
||||
padding: 0 10px !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tabBox_img {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
230
src/views/marketing/home/homePopularityList.vue
Normal file
230
src/views/marketing/home/homePopularityList.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<div class="article-manager">
|
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||
<div>
|
||||
<el-form ref="artFrom" :model="artFrom" label-width="80px" label-position="right" inline @submit.native.prevent>
|
||||
<el-form-item label="商品名称:" label-for="pid">
|
||||
<el-input clearable placeholder="商品名称" v-model="artFrom.name" class="form_content_width" />
|
||||
</el-form-item>
|
||||
<el-form-item label="推荐状态:" label-for="store_name">
|
||||
<el-select v-model="artFrom.type" placeholder="状态" clearable @keyup.enter.native="getByPage">
|
||||
<el-option label="是" value="0" />
|
||||
<el-option label="否" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="userSearchs">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-button type="primary" class="bnt" @click="addClass()">选择商品</el-button>
|
||||
<el-table row-key="id" class="mt14" v-loading="loading" :data="tableData" empty-text="暂无数据">
|
||||
<el-table-column prop="categoryNum" label="编号"></el-table-column>
|
||||
<el-table-column prop="categoryName" label="商品名称"></el-table-column>
|
||||
|
||||
<el-table-column prop="showFlag" label="是否推荐">
|
||||
<template slot-scope="scope">
|
||||
<el-switch active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66" inactive-color="#ff4949"> </el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="date" label="操作" width="120" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="edit(scope.row)">置顶</el-button>
|
||||
|
||||
<el-button @click="del(scope.row, scope)" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<div class="acea-row row-right page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="page.currentPage"
|
||||
:page-sizes="[10, 15, 20, 30]"
|
||||
:page-size="page.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="page.totalCount"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 添加 编辑表单-->
|
||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
||||
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||
<edit ref="edit" :parentOptions="tableData" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import edit from '@/components/Category/edit'
|
||||
import editFrom from '../../../components/from/from'
|
||||
import productApi from '@/api/product/productAttr.js'
|
||||
import { loadingFn } from '@/utils/validate'
|
||||
export default {
|
||||
name: 'product_productClassify',
|
||||
components: {
|
||||
editFrom,
|
||||
edit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editDialogConfig: {
|
||||
visible: false
|
||||
},
|
||||
treeSelect: [],
|
||||
FromData: null,
|
||||
grid: {
|
||||
xl: 7,
|
||||
lg: 7,
|
||||
md: 12,
|
||||
sm: 24,
|
||||
xs: 24
|
||||
},
|
||||
loading: false,
|
||||
artFrom: {
|
||||
page: 1,
|
||||
limit: 15
|
||||
},
|
||||
page: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
params: {},
|
||||
totalCount: 0
|
||||
},
|
||||
total: 0,
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleCommand(e) {},
|
||||
handleSizeChange(val) {
|
||||
this.page.pageSize = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page.currentPage = val
|
||||
this.getList()
|
||||
},
|
||||
// 商品分类;
|
||||
goodsCategory() {},
|
||||
// 列表
|
||||
getList() {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyGetByPage(this.page).then(res => {
|
||||
if ((res.code = 20000)) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data)
|
||||
})
|
||||
)
|
||||
},
|
||||
pageChange(index) {
|
||||
this.artFrom.page = index
|
||||
this.getList()
|
||||
},
|
||||
// 添加
|
||||
addClass(parent = null) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$refs.edit.model = 'classifySave'
|
||||
// this.$nextTick(()=>{
|
||||
// this.$refs.edit.parent = parent;
|
||||
// });
|
||||
if (parent) {
|
||||
let { categoryName, id } = parent
|
||||
this.$nextTick(() => {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 })
|
||||
})
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
this.editDialogConfig.visible = true
|
||||
this.$nextTick(() => {
|
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row
|
||||
console.log(this.tableData.find(item => item == parentId), 'categoryName')
|
||||
if (row.level == 1) {
|
||||
this.$refs.edit.model = 'classifyUpdate'
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
||||
} else {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, {
|
||||
level,
|
||||
icon,
|
||||
showFlag,
|
||||
parentCategoryName: this.tableData.find(item => item == parentId).categoryName,
|
||||
categoryName,
|
||||
sort,
|
||||
parentId,
|
||||
id
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 修改状态
|
||||
onchangeIsShow(row) {
|
||||
let data = {
|
||||
id: row.id,
|
||||
is_show: row.is_show
|
||||
}
|
||||
setShowApi(data)
|
||||
.then(async res => {
|
||||
this.$message.success(res.msg)
|
||||
})
|
||||
.catch(res => {
|
||||
this.$message.error(res.msg)
|
||||
})
|
||||
},
|
||||
|
||||
// 删除
|
||||
del(row, scope) {
|
||||
console.log(scope)
|
||||
this.$alert('请确定删除!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
if (action == 'confirm') {
|
||||
loadingFn.call(
|
||||
this,
|
||||
'loading',
|
||||
productApi.classifyDelete(row).then(res => {
|
||||
if ((res.code = 20000)) {
|
||||
this.$message.success('操作成功!')
|
||||
this.handleCurrentChange()
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表格搜索
|
||||
userSearchs() {
|
||||
this.artFrom.page = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="stylus">
|
||||
.treeSel ::v-deep .ivu-select-dropdown-list {
|
||||
padding: 0 10px !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tabBox_img {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
0
src/views/marketing/home/moduleSetting.vue
Normal file
0
src/views/marketing/home/moduleSetting.vue
Normal file
8
src/views/marketing/index.vue
Normal file
8
src/views/marketing/index.vue
Normal file
@@ -0,0 +1,8 @@
|
||||
<template>
|
||||
<div>
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {}
|
||||
</script>
|
||||
@@ -142,8 +142,7 @@ export default {
|
||||
if (this.formDynamic.spec.length === 0) {
|
||||
return this.$message.warning('请至少添加一条商品规格!');
|
||||
}
|
||||
this.modal_loading = true;
|
||||
console.log('this.formDynamic',this.model,this.formDynamic)
|
||||
this.modal_loading = true;
|
||||
Promise.all([...this.formDynamic.spec.map(item => {
|
||||
return productApi[this.model]({
|
||||
"attributeName": item.value,
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
|
||||
export default {
|
||||
name: "attrList",
|
||||
@@ -104,7 +104,7 @@ export default {
|
||||
},
|
||||
edit(row) {
|
||||
let data = Object.assign({}, row, {
|
||||
name:this.selectAttrId.split("/")[1],
|
||||
name: this.selectAttrId.split("/")[1] || "",
|
||||
spec: [{
|
||||
value: row.attributeName,
|
||||
detail: row.attributeContent.split(",")
|
||||
@@ -114,7 +114,12 @@ export default {
|
||||
this.$parent.$parent.addAttr('update');
|
||||
},
|
||||
init() {
|
||||
if (this.selectAttrId) this.page.params.typeId = this.selectAttrId.split("/")[0] && this.getByPage();
|
||||
if (this.selectAttrId && this.selectAttrId.indexOf("/") !== -1) {
|
||||
this.page.params.typeId = this.selectAttrId.split("/")[0] || "";
|
||||
this.getByPage();
|
||||
} else {
|
||||
this.$message.warning("初始化出错")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,47 +28,65 @@
|
||||
</div>
|
||||
</el-card> -->
|
||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||
<el-button type="primary" class="bnt" @click="addClass">添加分类</el-button>
|
||||
<el-table class="mt14" :loading="loading" :data="tableData">
|
||||
<el-table-column field="id" label="ID" tooltip width="80"></el-table-column>
|
||||
<el-table-column field="cate_name" tree-node label="分类名称" min-width="250"></el-table-column>
|
||||
<el-table-column field="pic" label="分类图标" min-width="100">
|
||||
<template v-slot="{ row }">
|
||||
<div class="tabBox_img" v-viewer v-if="row.pic">
|
||||
<img v-lazy="row.pic" />
|
||||
</div>
|
||||
<el-button type="primary" class="bnt" @click="addClass(null)">添加分类</el-button>
|
||||
<el-table row-key="id" class="mt14" v-loading="loading" :tree-props="{ children: 'children' }" :data="tableData">
|
||||
<el-table-column prop="categoryNum" label="编号"></el-table-column>
|
||||
<el-table-column prop="categoryName" label="分类名称"></el-table-column>
|
||||
<el-table-column prop="level" label="级别"></el-table-column>
|
||||
<el-table-column prop="icon" label="分类图标" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="width: 50px; height: 50px" :src="scope.row.icon" :preview-src-list="[scope.row.icon]">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column field="sort" label="排序" min-width="100" tooltip="true"></el-table-column>
|
||||
<el-table-column field="is_show" label="状态" min-width="120">
|
||||
<template v-slot="{ row }">
|
||||
<el-switch class="defineSwitch" :active-value="1" :inactive-value="0" v-model="row.is_show"
|
||||
:value="row.is_show" @change="onchangeIsShow(row)" size="large" active-text="开启" inactive-text="关闭">
|
||||
<el-table-column prop="showFlag" label="是否显示">
|
||||
<template slot-scope="scope">
|
||||
<el-switch disabled active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66"
|
||||
inactive-color="#ff4949">
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column field="date" label="操作" width="120" fixed="right">
|
||||
<template v-slot="{ row, index }">
|
||||
<a @click="edit(row)">编辑</a>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<a @click="del(row, '删除商品分类', index)">删除</a>
|
||||
<el-table-column prop="sort" label="排序" min-width="100" tooltip="true"></el-table-column>
|
||||
<el-table-column prop="date" label="操作" width="120" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown>
|
||||
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item>
|
||||
<span @click="edit(scope.row)">编辑</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="scope.row.level == 1">
|
||||
<span @click="addClass(scope.row)">新增下级</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="scope.row.level == 1">查看下级 </el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button type=text>
|
||||
</el-button>
|
||||
<el-button @click="del(scope.row, scope)" type=text>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
<div class="acea-row row-right page">
|
||||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" />
|
||||
</div>
|
||||
|
||||
<!-- 添加 编辑表单-->
|
||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
||||
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||
<edit />
|
||||
<el-dialog title="分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||
<edit ref="edit" :parentOptions="tableData" />
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import edit from '@/components/Category/edit'
|
||||
import edit from '@/components/Category/edit'
|
||||
import editFrom from '../../../components/from/from';
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
import {loadingFn} from "@/utils/validate"
|
||||
import productApi from '@/api/product/productAttr.js';
|
||||
import { loadingFn } from "@/utils/validate"
|
||||
export default {
|
||||
name: 'product_productClassify',
|
||||
components: {
|
||||
@@ -99,47 +117,67 @@ export default {
|
||||
total: 0,
|
||||
tableData: [],
|
||||
};
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// this.goodsCategory();
|
||||
// this.getList();
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
handleCommand(e) {
|
||||
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.page.pageSize = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page.currentPage = val
|
||||
this.getList()
|
||||
},
|
||||
// 商品分类;
|
||||
goodsCategory() {
|
||||
goodsCategory() {
|
||||
},
|
||||
// 列表
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// console.log(,'loadingFn')
|
||||
// loadingFn(this.loading,productApi.classifyGetByPage(this.page))
|
||||
// this.artFrom.is_show = this.artFrom.is_show || '';
|
||||
// this.artFrom.pid = this.artFrom.pid || '';
|
||||
// productListApi(this.artFrom)
|
||||
// .then(async (res) => {
|
||||
// let data = res.data;
|
||||
// this.tableData = data.list;
|
||||
// this.total = data.count;
|
||||
// this.loading = false;
|
||||
// })
|
||||
// .catch((res) => {
|
||||
// this.loading = false;
|
||||
// this.$message.error(res.msg);
|
||||
// });
|
||||
// productApi.classifyGetByPage()
|
||||
loadingFn.call(this, "loading", productApi.classifyGetByPage(this.page).then(res => {
|
||||
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data);
|
||||
}));
|
||||
},
|
||||
pageChange(index) {
|
||||
this.artFrom.page = index;
|
||||
this.getList();
|
||||
},
|
||||
// 添加
|
||||
addClass() {
|
||||
this.editDialogConfig.visible = true
|
||||
// this.$modalForm(productCreateApi()).then(() => this.getList());
|
||||
addClass(parent = null) {
|
||||
this.editDialogConfig.visible = true;
|
||||
if (parent) {
|
||||
let { categoryName, id } = parent;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.edit.updateModel("classifySave");
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 });
|
||||
})
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
// this.$modalForm(productEditApi(row.id)).then(() => this.getList());
|
||||
this.editDialogConfig.visible = true;
|
||||
this.$nextTick(() => {
|
||||
let { level, icon, showFlag, categoryName, sort, parentId, id } = row;
|
||||
this.$refs.edit.updateModel("classifyUpdate");
|
||||
if (row.level == 1) {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId, id })
|
||||
} else {
|
||||
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram,
|
||||
{
|
||||
level,
|
||||
icon,
|
||||
showFlag,
|
||||
parentCategoryName: this.tableData.find(item => item.id == parentId).categoryName,
|
||||
categoryName,
|
||||
sort,
|
||||
parentId, id
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 修改状态
|
||||
onchangeIsShow(row) {
|
||||
@@ -175,22 +213,21 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
// 删除
|
||||
del(row, tit, num) {
|
||||
let delfromData = {
|
||||
title: tit,
|
||||
num: num,
|
||||
url: `product/category/${row.id}`,
|
||||
method: 'DELETE',
|
||||
ids: '',
|
||||
};
|
||||
this.$modalSure(delfromData)
|
||||
.then((res) => {
|
||||
this.$message.success(res.msg);
|
||||
this.getList();
|
||||
})
|
||||
.catch((res) => {
|
||||
this.$message.error(res.msg);
|
||||
});
|
||||
del(row, scope) {
|
||||
console.log(scope)
|
||||
this.$alert('请确定删除!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: action => {
|
||||
if (action == "confirm") {
|
||||
loadingFn.call(this, "loading", productApi.classifyDelete(row).then(res => {
|
||||
if (res.code = 20000) {
|
||||
this.$message.success("操作成功!")
|
||||
this.handleCurrentChange()
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 表格搜索
|
||||
userSearchs() {
|
||||
|
||||
Reference in New Issue
Block a user