shish пре 3 година
родитељ
комит
0b348fa59e

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

@@ -29,7 +29,9 @@ import shop from '@/service/shop/index';
 import chat from '@/service/chat/index';
 import sj from '@/service/sj/index';
 import itemClass from '@/service/item-class/index';
+import itemCat from '@/service/item-cat/index';
 import item from '@/service/item/index';
+import itemCatRelate from '@/service/item-cat-relate/index';
 import unit from '@/service/unit/index';
 import merchant from '@/service/merchant/index';
 import shopAdmin from '@/service/shop-admin/index';
@@ -73,7 +75,9 @@ export function SET_SERVICE({ store }) {
 		chat,
 		sj,
 		itemClass,
+		itemCat,
 		item,
+		itemCatRelate,
 		unit,
 		merchant,
 		shopAdmin,

+ 3 - 1
pt/src/mock/userInfo.js

@@ -177,8 +177,10 @@ let menu = {
 		{id: '5',parentId: null,name: '商品',type: 1,icon: 'icongongzuotai',orderNum: 5,router: '/saas/goods/list',viewPath: 'saas/goods/list',keepAlive: 1},
 		{id: '6',parentId: null,name: '节日',type: 1,icon: 'icongongzuotai',orderNum: 6,router: '/saas/fest/list',viewPath: 'saas/fest/list',keepAlive: 1},
 		{id: '8',parentId: null,name: '花材',type: 0,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: '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: '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: '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/auth',viewPath: 'saas/manage/auth',keepAlive: 1},

+ 6 - 0
pt/src/service/item-cat-relate/index.js

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

+ 6 - 0
pt/src/service/item-cat/index.js

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

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

@@ -0,0 +1,217 @@
+<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>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</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>
+				</div>
+			</template>
+		</x-crud>
+	</div>
+</template>
+<script>
+import { mapGetters } from 'vuex';
+export default {
+	name: 'item_list',
+	components: {},
+	data() {
+		return {
+			app: null,
+			sortLink: '',
+			operateData: {},
+			tabIndex: '0',
+			tabsData: [
+				{
+					text: '花材列表(供)',
+					key: '0',
+				},
+			],
+			selects: {},
+			sort: {
+				status: false,
+			},
+			catId: '',
+			addDialog: false,
+			itemClassList: [],
+			unitList: [],
+			currentItemId: 0
+		};
+	},
+	computed: {},
+	methods: {
+		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.itemCatRelate)
+				.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: 'stockWarning',
+							label: '库存预警值',
+							align: 'center',
+							'min-width': 100,
+						},
+						{
+							prop: 'cost',
+							label: '成本价',
+							align: 'center',
+							'min-width': 100,
+						},
+						{
+							prop: 'addPrice',
+							label: '加价',
+							align: 'center',
+							'min-width': 100,
+						},
+						{
+							prop: 'weight',
+							label: '重量(公斤)',
+							align: 'center',
+							'min-width': 100,
+						},
+						{
+							prop: 'unit',
+							label: '单位',
+							align: 'center',
+							minWidth: 100,
+						},
+						{
+							prop: 'ratio',
+							label: '单位比',
+							align: 'center',
+							minWidth: 60,
+						},
+						{
+							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: [],
+					},
+				})
+				.set('pagination', {
+					size: 50
+				})
+				.set('layout', [
+					['slot-tabs'],
+					['flex1', 'refresh-btn'],
+					['data-table'],
+					['flex1', 'pagination'],
+				])
+				.done();
+				app.refresh({ catId: this.catId });
+		},
+
+		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>

+ 209 - 0
pt/src/views/item-cat/list.vue

@@ -0,0 +1,209 @@
+<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="getItemList(scope.row)"
+				>{{ scope.row.num }}</el-link>
+			</template>
+
+			<template #table-column-name="{scope}">
+				<el-link
+					@click="getItemList(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="getItemList(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 });
+		},
+		getItemList(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.itemCat)
+				.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.getItemList(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>

+ 24 - 69
pt/src/views/item/list.vue

@@ -32,7 +32,7 @@
 			</template>
 
 			<template #table-column-unit="{scope}">
-				<span>{{ scope.row.bigUnit }} / {{scope.row.smallUnit}}</span>
+				<span>{{ scope.row.ratio }}{{ scope.row.bigUnit }}/{{scope.row.smallUnit}}</span>
 			</template>
 
 			<template #table-column-inTurn="{ scope }">
@@ -110,14 +110,6 @@
 						></el-input>
 					</el-form-item>
 
-					<el-form-item label="别名" prop="alias">
-						<el-input
-							v-model="replaceForm.alias"
-							placeholder="请输入别名"
-							size="small"
-						></el-input>
-					</el-form-item>
-
 					<el-form-item label="图片" prop="cover">
 						<cl-upload v-model="replaceForm.cover" :success="uploadSuccess"></cl-upload>
 						<p style="font-size: 14px; color: #cccccc">建议上传图片比例 400X400</p>
@@ -151,6 +143,12 @@
 						</el-select>
 					</el-form-item>
 
+					<el-form-item label="单位比类型" prop="ratioType">
+						<el-select v-model="replaceForm.ratioTypeName" size="small" placeholder="请选择单位" @change="changeRatioTypeFn">
+							<el-option v-for="(item, index) in ratioTypeList" :key="index" :value="item.name" >{{ item.name }}</el-option>
+						</el-select>
+					</el-form-item>
+
 					<el-form-item label="单位比" prop="ratio">
 						<el-input
 							v-model="replaceForm.ratio"
@@ -175,21 +173,6 @@
 						></el-input>
 					</el-form-item>
 
-					<el-form-item label="每扎成本价" prop="cost">
-						<el-input
-							v-model="replaceForm.cost"
-							placeholder="请输入成本价"
-							size="small"
-						></el-input>
-					</el-form-item>
-
-					<el-form-item label="每扎加价" prop="addPrice">
-						<el-input
-							v-model="replaceForm.addPrice"
-							placeholder="请输入加价"
-							size="small"
-						></el-input>
-					</el-form-item>
 
 				</el-form>
 			</div>
@@ -227,7 +210,6 @@ export default {
 			replaceForm: {
 				name: '',
 				py:'',
-				alias: '',
 				classId: '',
 				className: '',
 				cover: '',
@@ -236,10 +218,10 @@ export default {
 				smallUnitId: '',
 				smallUnit: '',
 				stockWarning:'',
-				cost:'',
-				addPrice:'',
 				weight:'',
-				ratio:''
+				ratio:'',
+				ratioType:0,
+				ratioTypeName:''
 			},
 			replaceFormRules: {
 				name: {
@@ -270,14 +252,6 @@ export default {
 					required: true,
 					message: '最低库存不能为空',
 				},
-				cost: {
-					required: true,
-					message: '运费不能为空',
-				},
-				addPrice: {
-					required: true,
-					message: '加价不能为空',
-				},
 				weight: {
 					required: true,
 					message: '重量不能为空',
@@ -286,6 +260,7 @@ export default {
 			//分类列表
 			itemClassList: [],
 			unitList: [],
+			ratioTypeList:[{name:'固定比例',id:0},{name:'模糊比例',id:1}],
 			currentItemId: 0
 		};
 	},
@@ -299,6 +274,11 @@ export default {
 			let index = this.unitList.findIndex((e) => e.name == val);
 			this.replaceForm.bigUnitId = this.unitList[index].id;
 		},
+		changeRatioTypeFn(val){
+			console.log(val)
+			let index = this.ratioTypeList.findIndex((e) => e.name == val);
+			this.replaceForm.ratioType = this.ratioTypeList[index].id;
+		},
 		selSmallUnitFn(val) {
 			let index = this.unitList.findIndex((e) => e.name == val);
 			this.replaceForm.smallUnitId = this.unitList[index].id;
@@ -331,7 +311,6 @@ export default {
 				this.replaceFormRules = {};
 				this.replaceForm = {
 					name: '',
-					alias: '',
 					classId:'',
 					cover: '',
 					bigUnitId: '',
@@ -339,11 +318,10 @@ export default {
 					smallUnitId: '',
 					smallUnit: '',
 					stockWarning:'',
-					cost:'',
-					addPrice:'',
 					className:'',
 					weight:'',
 					ratio:'',
+					ratioType:0,
 					py:''
 				}
 			}else{
@@ -377,14 +355,6 @@ export default {
 							required: true,
 								message: '最低库存不能为空',
 						},
-						cost: {
-							required: true,
-								message: '运费不能为空',
-						},
-						addPrice: {
-							required: true,
-								message: '加价不能为空',
-						},
 						weight: {
 							required: true,
 								message: '重量不能为空',
@@ -392,17 +362,20 @@ export default {
 					};
 					let index = this.itemClassList.findIndex((e) => e.id == res.classId)
 					this.replaceForm.name = res.name
-					this.replaceForm.alias = res.alias
 					this.replaceForm.cover = res.cover
 					this.replaceForm.bigUnitId = res.bigUnitId
 					this.replaceForm.bigUnit = res.bigUnit
 					this.replaceForm.smallUnitId = res.smallUnitId
 					this.replaceForm.smallUnit = res.smallUnit
 					this.replaceForm.stockWarning = res.stockWarning
-					this.replaceForm.cost = res.cost
-					this.replaceForm.addPrice = res.addPrice
 					this.replaceForm.weight = res.weight
 					this.replaceForm.ratio = res.ratio
+					this.replaceForm.ratioType = res.ratioType
+					if(res.ratioType == 0){
+						this.replaceForm.ratioTypeName = '固定比例'
+					}else{
+						this.replaceForm.ratioTypeName = '模糊比例'
+					}
 					this.replaceForm.classId = res.classId
 					this.replaceForm.py = res.py
 					this.replaceForm.className = this.itemClassList[index].name
@@ -455,18 +428,6 @@ export default {
 							align: 'center',
 							'min-width': 100,
 						},
-						{
-							prop: 'cost',
-							label: '每扎成本价',
-							align: 'center',
-							'min-width': 100,
-						},
-						{
-							prop: 'addPrice',
-							label: '每扎加价',
-							align: 'center',
-							'min-width': 100,
-						},
 						{
 							prop: 'weight',
 							label: '重量(公斤)',
@@ -479,12 +440,6 @@ export default {
 							align: 'center',
 							minWidth: 100,
 						},
-						{
-							prop: 'ratio',
-							label: '单位比',
-							align: 'center',
-							minWidth: 60,
-						},
 						{
 							prop: 'inTurn',
 							label: '排序',
@@ -524,7 +479,7 @@ export default {
 				})
 				.set('layout', [
 					['slot-tabs'],['search-key'],
-					['flex1', 'slot-add-goods-btn',  'refresh-btn'],
+					['flex1', 'refresh-btn'],
 					['data-table'],
 					['flex1', 'pagination'],
 				])