shish 2 лет назад
Родитель
Сommit
f58759ae1c

+ 4 - 0
pt/src/cool/request/index.js

@@ -41,12 +41,16 @@ import cash from '@/service/deposit/index';
 import ptYeChange from '@/service/assets/ptYeChange/index';
 import ptYeChange from '@/service/assets/ptYeChange/index';
 import ptAsset from '@/service/ptAsset/index';
 import ptAsset from '@/service/ptAsset/index';
 import shopYeChange from '@/service/shop-ye-change/index';
 import shopYeChange from '@/service/shop-ye-change/index';
+import cp from '@/service/cp/index';
+import cpClass from '@/service/cp-class/index';
 
 
 export function SET_SERVICE({ store }) {
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const ignore = ['./request.js'];
 	// const ignore = ['./request.js'];
 
 
 	let modules = {
 	let modules = {
+		cp,
+		cpClass,
 		common,
 		common,
 		system,
 		system,
 		test,
 		test,

+ 4 - 2
pt/src/mock/userInfo.js

@@ -179,8 +179,10 @@ let menu = {
 		{id: '8',parentId: null,name: '花材',type: 0,icon: 'icongongzuotai',orderNum: 4,router: '/item/list',viewPath: 'views/item/list.vue',keepAlive: 1},
 		{id: '8',parentId: null,name: '花材',type: 0,icon: 'icongongzuotai',orderNum: 4,router: '/item/list',viewPath: 'views/item/list.vue',keepAlive: 1},
 		{id: '805',parentId: '8',name: '花材分类',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item-class/list',viewPath: 'views/item-class/list.vue',keepAlive: 1},
 		{id: '805',parentId: '8',name: '花材分类',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item-class/list',viewPath: 'views/item-class/list.vue',keepAlive: 1},
 		{id: '810',parentId: '8',name: '花材列表',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item/list',viewPath: 'views/item/list.vue',keepAlive: 1},
 		{id: '810',parentId: '8',name: '花材列表',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item/list',viewPath: 'views/item/list.vue',keepAlive: 1},
-		{id: '806',parentId: '8',name: '花材分类(供)',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item-cat/list',viewPath: 'views/item-cat/list.vue',keepAlive: 1},
-		{id: '810',parentId: '8',name: '花材列表(供)',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item-cat-relate/list',viewPath: 'views/item-cat-relate/list.vue',keepAlive: 1},
+		{id: '815',parentId: '8',name: '基础分类',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item-cat/list',viewPath: 'views/item-cat/list.vue',keepAlive: 1},
+		{id: '820',parentId: '8',name: '基础花材',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/item-cat-relate/list',viewPath: 'views/item-cat-relate/list.vue',keepAlive: 1},
+		{id: '825',parentId: '8',name: '产品列表',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/cp/list',viewPath: 'views/cp/list.vue',keepAlive: 1},
+		{id: '830',parentId: '8',name: '产品分类',type: 1,icon: 'icongongzuotai',orderNum: 4,router: '/cp/cp-class',viewPath: 'views/cp/cp-class.vue',keepAlive: 1},
 		{id: '7',parentId: null,name: '套餐',type: 0,icon: 'icongongzuotai',orderNum: 7,router: '/saas/manage/list',viewPath: 'saas/manage/list',keepAlive: 1},
 		{id: '7',parentId: null,name: '套餐',type: 0,icon: 'icongongzuotai',orderNum: 7,router: '/saas/manage/list',viewPath: 'saas/manage/list',keepAlive: 1},
 		{id: '701',parentId: '7',name: '套餐列表',type: 1,icon: 'icongongzuotai',orderNum: 7,router: '/saas/manage/package',viewPath: 'saas/manage/package',keepAlive: 1},
 		{id: '701',parentId: '7',name: '套餐列表',type: 1,icon: 'icongongzuotai',orderNum: 7,router: '/saas/manage/package',viewPath: 'saas/manage/package',keepAlive: 1},
 		{id: '701',parentId: '7',name: '权限',type: 1,icon: 'icongongzuotai',orderNum: 7,router: '/saas/manage/auth',viewPath: 'saas/manage/auth',keepAlive: 1},
 		{id: '701',parentId: '7',name: '权限',type: 1,icon: 'icongongzuotai',orderNum: 7,router: '/saas/manage/auth',viewPath: 'saas/manage/auth',keepAlive: 1},

+ 6 - 0
pt/src/service/cp-class/index.js

@@ -0,0 +1,6 @@
+import { BaseService, Service } from '@/cool';
+@Service('cp-class')
+export class CpService extends BaseService {
+
+}
+export default new CpService();

+ 6 - 0
pt/src/service/cp/index.js

@@ -0,0 +1,6 @@
+import { BaseService, Service } from '@/cool';
+@Service('cp')
+export class CpService extends BaseService {
+
+}
+export default new CpService();

+ 203 - 0
pt/src/views/cp/cp-class.vue

@@ -0,0 +1,203 @@
+<template>
+	<div class="app-list-content">
+		<x-crud class="liu-crud-wrap" @load="onLoad">
+			<template #slot-tabs>
+				<el-tabs class="liu-tabs" type="border-card" v-model="tabIndex" @tab-click="handleClick" >
+					<el-tab-pane v-for="(item, index) in tabsData" :key="index" :label="item.text" :name="item.key" >
+					</el-tab-pane>
+				</el-tabs>
+			</template>
+
+			<template #table-column-num="{scope}">
+				<el-link
+					@click="getCpList(scope.row)"
+				>{{ scope.row.num }}</el-link>
+			</template>
+
+			<template #table-column-name="{scope}">
+				<el-link
+					@click="getCpList(scope.row)"
+				>{{ scope.row.name }}</el-link>
+			</template>
+
+			<template #table-column-inTurn="{scope}">
+				<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
+				<el-input ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row)">
+				</el-input>
+			</template>
+
+			<!-- 排序 -->
+			<template #table-header-inTurn>
+				<div class="set-sort">
+					<span>排序</span>
+				</div>
+			</template>
+
+			<template #slot-item-list="{scope}">
+				<el-button type="text" @click.native.stop="getCpList(scope.row)">查看产品</el-button>
+			</template>
+
+		</x-crud>
+	</div>
+</template>
+<script>
+import { mapGetters } from 'vuex';
+export default {
+	data() {
+		return {
+			app: null,
+			sortLink: '',
+			operateData: {},
+			tabIndex: '0',
+			tabsData: [{text: '产品分类', key: '0'}],
+			selects: {},
+			sort: {
+				status: false
+			},
+			replaceDialog:false,
+			id:0,
+			replaceForm: {
+				name: ''
+			},
+			ruleForm: {
+				name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+			},
+		};
+	},
+	computed: {
+	},
+	methods: {
+		handleClick(tab, e) {
+			this.app.refresh({ type: this.tabIndex });
+		},
+		getCpList(data) {
+			let query = {};
+			query.catId = data.id
+			query.tabName = data.name
+			this.$router.push({ path: '/item-cat-relate/list', query });
+		},
+		onLoad({ ctx, app }) {
+			this.app = app;
+			ctx.service(this.$service.cpClass)
+				.set('table', {
+					columns: [
+						{
+							prop: 'id',
+							label: 'ID',
+							align: 'center'
+						},
+						{
+							prop: 'name',
+							label: '标题',
+							align: 'center',
+							'min-width': 180
+						},
+						{
+							prop: 'num',
+							label: '产品数',
+							align: 'center',
+							'min-width': 100
+						},
+						{
+							prop: 'inTurn',
+							label: '排序',
+							align: 'center',
+							minWidth: 100
+						},
+						{
+							prop: 'addTime',
+							label: '创建时间',
+							align: 'center',
+							minWidth: 180
+						}
+					],
+					on: {
+						'row-click': (row, column) => {
+							this.getCpList(row)
+						}
+					},
+					op: {
+						visible: true,
+						props: {
+							width: 300,
+							align: 'center',
+							fixed: 'right',
+							label: '操作'
+						},
+						layout: ['slot-item-list']
+					}
+				})
+				.set('dict', {
+					search: {
+						keyWord: 'goodsName'
+					}
+				})
+				.set('search', {
+					key: {
+						placeholder: '分类名称'
+					}
+				})
+				.set('pagination', {
+					size: 100
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['flex1', 'refresh-btn'],
+					['data-table'],
+					['flex1', 'pagination']
+				])
+				.on('delete', (selection, { next }) => {
+					next({
+						id: selection.map(e => e.id).join(',')
+					});
+				})
+				.done();
+				app.refresh({ type:0 });
+		},
+		refresh(params) {
+			this.app.refresh(params);
+		},
+		showSort(e) {
+			this.sort.status = true;
+		},
+		hideSort(e) {
+			this.sort.status = false;
+		},
+		changeSort(d) {
+			this.$service.goods
+				.sort({
+					inTurn: d.inTurn,
+					id: d.id
+				})
+				.then(() => {
+					this.$message.success('修改成功');
+					this.refresh();
+				})
+				.catch(err => {
+					this.$message.error(err);
+				});
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.short-link {
+	color: $mainColor;
+	margin-left: 10px;
+	cursor: pointer;
+}
+.set-sort {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	.el-button {
+		margin-left: 10px;
+	}
+	.show {
+		font-size: 16px;
+	}
+	.hide {
+		padding: 2px 5px;
+	}
+}
+</style>

+ 264 - 0
pt/src/views/cp/list.vue

@@ -0,0 +1,264 @@
+<template>
+	<div class="app-list-content">
+		<x-crud class="liu-crud-wrap" @load="onLoad">
+			<template #slot-tabs>
+				<el-tabs class="liu-tabs" type="border-card" v-model="tabIndex">
+					<el-tab-pane v-for="(item, index) in tabsData" :key="index" :label="item.text" :name="item.key" >
+					</el-tab-pane>
+				</el-tabs>
+			</template>
+			<template #table-column-cover="{ scope }">
+				<cl-avatar shape="square" :size="36" :src="scope.row.cover" :style="{ margin: 'auto' }" >
+				</cl-avatar>
+			</template>
+			<template #table-column-goodsName="{ scope }">
+				<span>{{ scope.row.goodsName }}</span>
+			</template>
+
+			<template #table-column-unit="{scope}">
+				<span v-if="scope.row.ratioType == 0">{{ scope.row.ratio }}{{scope.row.smallUnit}}/{{ scope.row.bigUnit }}</span>
+				<span v-else>若干{{scope.row.smallUnit}}/{{ scope.row.bigUnit }}</span>
+			</template>
+
+			<template #table-column-inTurn="{ scope }">
+				<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
+				<el-input ref="sort-input" focus size="mini" v-else v-model="scope.row.inTurn" @blur="changeSort(scope.row)" ></el-input>
+			</template>
+			<!-- 排序 -->
+			<template #table-header-inTurn>
+				<div class="set-sort">
+					<span>排序</span>
+					<el-button v-if="!sort.status" icon="el-icon-edit-outline" size="small" type="text" @click="showSort" class="show" >
+					</el-button>
+					<el-button class="hide" v-else size="mini" @click="hideSort" type="primary" >完成</el-button >
+				</div>
+			</template>
+
+			<template #slot-cp-classStyle="{scope}">
+				<el-radio-group v-model="classStyle" @change="changeClassify" style="margin-right:20px;padding-top:6px;margin-left:20px;">
+				<el-radio label="-1">全部</el-radio>
+				<el-radio label="1">有归类</el-radio>
+				<el-radio label="0">未归类</el-radio>
+				</el-radio-group>
+			</template>
+
+			<template #slot-cp-class="{scope}">
+				<el-select size="mini" v-model="getCpClass" placeholder="请选分类" style="width:150px;margin-right:10px;">
+					<el-option v-for="item in cpClassData" :key="item.value" :label="item.label" :value="item.value"> </el-option>
+				</el-select>				
+			</template>
+
+			<template #slot-column-option="{scope}">
+					<template>
+						<el-popover placement="top" width="160" :ref="'popover-' + scope.row.id">
+							<p>确定要删除?</p>
+							<div style="text-align: right; margin: 0">
+								<el-button size="mini" type="text" @click="cancelDel(scope.row.id)">取消</el-button>
+								<el-button type="primary" size="mini" @click="confirmDel(scope.row)">确定</el-button>
+							</div>
+							<el-button type="text" size="small" slot="reference">删除</el-button>
+						</el-popover>
+					</template>
+			</template>
+
+		</x-crud>
+	</div>
+</template>
+<script>
+import { mapGetters } from 'vuex';
+export default {
+	name: 'item_list',
+	components: {},
+	data() {
+		return {
+			cpClassData: [{
+				value: '选项1',
+				label: '黄金糕'
+				}, {
+				value: '选项2',
+				label: '双皮奶'
+				}, {
+				value: '选项3',
+				label: '蚵仔煎'
+				}, {
+				value: '选项4',
+				label: '龙须面'
+				}, {
+				value: '选项5',
+				label: '北京烤鸭'
+			}],
+			getCpClass: '',
+			app: null,
+			sortLink: '',
+			operateData: {},
+			tabIndex: '0',
+			tabsData: [
+				{
+					text: '产品列表',
+					key: '0',
+				},
+			],
+			selects: {},
+			sort: {
+				status: false,
+			},
+			catId: '',
+			addDialog: false,
+			itemClassList: [],
+			unitList: [],
+			currentItemId: 0,
+			classStyle:"-1",//-1全部 1有归类 0未归类
+		};
+	},
+	computed: {},
+	methods: {
+    	changeClassify(e){
+			this.classStyle = e
+			this.app.refresh({ classStyle:this.classStyle })
+		},
+		cancelDel(id) {
+			this.$refs[`popover-` + id].doClose();
+		},
+		confirmDel(item) {
+			this.$service.itemCatRelate.delRelate({ itemId: item.id }).then(res => {
+				this.$message.success('删除成功');
+				this.$refs[`popover-` + item.id].doClose();
+				this.app.refresh({ classStyle:this.classStyle })
+			});
+		},
+		onLoad({ ctx, app }) {
+			this.app = app;
+			if (this.$route.query.catId) {
+				this.catId = this.$route.query.catId;
+				if (this.$route.query.name != '') {
+					this.tabsData[0].text = this.$route.query.tabName;
+					this.$forceUpdate();
+				}
+			}
+			ctx.service(this.$service.cp)
+				.set('table', {
+					columns: [
+						{
+							prop: 'id',
+							label: 'ID',
+							align: 'center',
+						},
+						{
+							prop: 'cover',
+							label: '封面',
+							align: 'center',
+							'min-width': 100,
+						},
+						{
+							prop: 'name',
+							label: '名称',
+							align: 'center',
+							'min-width': 180,
+						},
+						{
+							prop: 'maxPrice',
+							label: '最大价',
+							align: 'center',
+							minWidth: 100,
+						},
+						{
+							prop: 'miniPrice',
+							label: '最小价',
+							align: 'center',
+							minWidth: 100,
+						},
+						{
+							prop: 'auth',
+							label: '认证',
+							align: 'center',
+							minWidth: 100,
+						},
+						{
+							prop: 'inTurn',
+							label: '排序',
+							align: 'center',
+							minWidth: 100,
+						},
+						{
+							prop: 'addTime',
+							label: '创建时间',
+							align: 'center',
+							minWidth: 180,
+						},
+					],
+					op: {
+						visible: true,
+						props: {
+							width: 250,
+							align: 'center',
+							fixed: 'right',
+							label: '操作',
+						},
+						layout: ['slot-column-option'],
+					},
+				})
+				.set('pagination', {
+					size: 50
+				})
+				.set('dict', {
+					search: {
+					keyWord: 'name'
+					}
+				})
+				.set('search', {
+					key: { placeholder: '产品名称' }
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['slot-cp-classStyle','slot-cp-class','search-key', 'flex1','refresh-btn'],
+					['data-table'],
+					['flex1', 'pagination'],
+				])
+				.done();
+				app.refresh({ classStyle:this.classStyle })
+		},
+		exeRefresh(params) {
+			this.app.refresh(params);
+		},
+		showSort(e) {
+			this.sort.status = true;
+		},
+
+		hideSort(e) {
+			this.sort.status = false;
+		},
+		changeSort(d) {
+			this.$service.goods .sort({ inTurn: d.inTurn, id: d.id, })
+				.then(() => {
+					this.$message.success('修改成功')
+					this.exeRefresh({classStyle:this.classStyle})
+				})
+				.catch((err) => {
+					this.$message.error(err)
+				});
+		}
+	},
+};
+</script>
+
+<style lang="scss" scoped>
+.short-link {
+	color: $mainColor;
+	margin-left: 10px;
+	cursor: pointer;
+}
+.set-sort {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	.el-button {
+		margin-left: 10px;
+	}
+	.show {
+		font-size: 16px;
+	}
+	.hide {
+		padding: 2px 5px;
+	}
+}
+</style>

+ 1 - 1
pt/src/views/item-cat-relate/list.vue

@@ -64,7 +64,7 @@ export default {
 			tabIndex: '0',
 			tabIndex: '0',
 			tabsData: [
 			tabsData: [
 				{
 				{
-					text: '花材列表(供)',
+					text: '平台花材列表',
 					key: '0',
 					key: '0',
 				},
 				},
 			],
 			],