lalala 6 лет назад
Родитель
Сommit
200852dfbb

+ 8 - 0
admin-code/src/Home.vue

@@ -90,6 +90,14 @@
 			</div>
 		</div>
 
+		<div class="card card-visitor">
+			<p class="card-title">用户访客</p>
+
+			<div class="card-body">
+				<echart1></echart1>
+			</div>
+		</div>
+
 		<div class="card card-plan">
 			<p class="card-title">计划</p>
 

+ 11 - 0
admin-code/src/assets/css/base.scss

@@ -32,6 +32,17 @@ $backColor: #f5f5f5;
     align-items: center;
 }
 
+.app-content {
+    padding: 10px;
+    background-color: #fff;
+    // .app-content-title {
+    //     padding: 0 10px 10px;
+    //     margin-bottom: 10px;
+    //     color: #666;
+    //     background-color: #f5f5f5;
+    // }
+}
+
 // .app-content {
     // line-height: 1;
     // background-color: $backColor;

+ 44 - 33
admin-code/src/mock/userInfo.js

@@ -170,17 +170,17 @@ let menu = {
 		// 	viewPath: 'https://docs.cool-admin.com/#/',
 		// 	keepAlive: 1
 		// },
-		// {
-		// 	id: '1',
-		// 	parentId: null,
-		// 	name: '工作台',
-		// 	type: 0,
-		// 	icon: 'icon-gongzuotai',
-		// 	orderNum: 1,
-		// 	router: '/',
-		// 	viewPath: null,
-		// 	keepAlive: 1
-		// },
+		{
+			id: '1',
+			parentId: null,
+			name: '工作台',
+			type: 0,
+			icon: 'icon-gongzuotai',
+			orderNum: 1,
+			router: '/',
+			viewPath: null,
+			keepAlive: 1
+		},
 		{
 			id: '10',
 			parentId: '8',
@@ -203,6 +203,17 @@ let menu = {
 			viewPath: 'views/goods/goods-list.vue',
 			keepAlive: 1
 		},
+		{
+			id: '204',
+			parentId: '27',
+			name: '添加商品',
+			type: 1,
+			icon: 'icon-user',
+			orderNum: 1,
+			router: '/goods/add',
+			viewPath: 'views/goods/goods-add.vue',
+			keepAlive: 1
+		},
 		{
 			id: '200',
 			parentId: '27',
@@ -324,17 +335,17 @@ let menu = {
 			viewPath: 'views/workbench/ui-components',
 			keepAlive: 1
 		},
-		// {
-		// 	id: '2',
-		// 	parentId: null,
-		// 	name: '系统',
-		// 	type: 0,
-		// 	icon: 'icon-systemfill',
-		// 	orderNum: 2,
-		// 	router: '/sys',
-		// 	viewPath: null,
-		// 	keepAlive: 1
-		// },
+		{
+			id: '2',
+			parentId: null,
+			name: '系统',
+			type: 0,
+			icon: 'icon-systemfill',
+			orderNum: 2,
+			router: '/sys',
+			viewPath: null,
+			keepAlive: 1
+		},
 		{
 			id: '8',
 			parentId: '27',
@@ -401,17 +412,17 @@ let menu = {
 			viewPath: null,
 			keepAlive: 1
 		},
-		{
-			id: '46',
-			parentId: '45',
-			name: 'Froala富文本',
-			type: 1,
-			icon: 'icon-radioboxfill',
-			orderNum: 2,
-			router: '/editor-froala',
-			viewPath: 'views/test/editor-froala.vue',
-			keepAlive: 1
-		},
+		// {
+		// 	id: '46',
+		// 	parentId: '45',
+		// 	name: 'Froala富文本',
+		// 	type: 1,
+		// 	icon: 'icon-radioboxfill',
+		// 	orderNum: 2,
+		// 	router: '/editor-froala',
+		// 	viewPath: 'views/test/editor-froala.vue',
+		// 	keepAlive: 1
+		// },
 		{
 			id: '12',
 			parentId: '8',

+ 3 - 3
admin-code/src/pages/layout/index.vue

@@ -98,9 +98,9 @@ export default {
 				border-radius: 3px;
 				margin-top: 10px;
 
-				& > div, & > section {
-					height: 100%;
-				}
+				// & > div, & > section {
+				// 	height: 100%;
+				// }
 			}
 		}
 	// }

+ 148 - 0
admin-code/src/views/goods/goods-add.vue

@@ -0,0 +1,148 @@
+<template>
+	<div class="app-content">
+		<div class="form-wrap">
+			<el-form ref="form" :model="ruleForm" :rules="rules" label-width="120px">
+				<el-form-item label="名称" prop="name">
+					<el-input v-model="ruleForm.name"></el-input>
+				</el-form-item>
+				<el-form-item label="已售" prop="name">
+					<el-input v-model="ruleForm.name"></el-input>
+				</el-form-item>
+				<el-form-item label="库存" prop="name">
+					<el-input v-model="ruleForm.name"></el-input>
+				</el-form-item>
+				<el-form-item label="分类">
+					<el-checkbox-group v-model="ruleForm.type">
+						<el-checkbox label="M" name="type"></el-checkbox>
+						<el-checkbox label="X" name="type"></el-checkbox>
+						<el-checkbox label="XL" name="type"></el-checkbox>
+						<el-checkbox label="2XL" name="type"></el-checkbox>
+						<el-checkbox label="3XL" name="type"></el-checkbox>
+						<el-checkbox label="4XL" name="type"></el-checkbox>
+					</el-checkbox-group>
+				</el-form-item>
+				<el-form-item label="款式">
+					<el-checkbox-group v-model="ruleForm.type">
+						<el-checkbox label="多款式" name="type"></el-checkbox>
+					</el-checkbox-group>
+				</el-form-item>
+				<el-form-item label="图片">
+					<div class="list-wrap">
+						<el-upload
+							action="https://jsonplaceholder.typicode.com/posts/"
+							list-type="picture-card"
+							:on-preview="handlePictureCardPreview"
+							:on-remove="handleRemove"
+						>
+							<i class="el-icon-plus"></i>
+						</el-upload>
+						<div>
+							<el-button type="primary" size="small">商品主图</el-button>
+							<el-button type="warning" size="small">删除</el-button>
+						</div>
+					</div>
+					<div>
+						<el-button type="primary" size="small">从图库选择</el-button>
+					</div>
+					<el-dialog :visible.sync="dialogVisible">
+						<img width="100%" :src="dialogImageUrl" alt="" />
+					</el-dialog>
+				</el-form-item>
+				<el-form-item label="活动形式">
+					<cl-editor-quill v-model="ruleForm.desc" @load="editor"></cl-editor-quill>
+					<!-- <el-input type="textarea" v-model="ruleForm.desc"></el-input> -->
+				</el-form-item>
+				<el-form-item label="节假日自动涨价">
+					<el-checkbox-group v-model="ruleForm.type">
+						<el-checkbox label="需要" name="type"></el-checkbox>
+					</el-checkbox-group>
+				</el-form-item>
+				<el-form-item label="配送方式">
+					<el-checkbox-group v-model="ruleForm.type">
+						<el-checkbox label="到店自提" name="type"></el-checkbox>
+					</el-checkbox-group>
+				</el-form-item>
+				<el-form-item label="配送方式">
+					<el-radio-group v-model="ruleForm.resource">
+						<el-radio label="按距离收费">
+							<span>按距离收费</span>
+							<i class="el-icon-question"></i>
+						</el-radio>
+						<el-radio label="免运费"></el-radio>
+					</el-radio-group>
+				</el-form-item>
+				<el-form-item>
+					<el-button type="primary" @click="submitForm('ruleForm')">上架出售</el-button>
+					<el-button @click="resetForm('ruleForm')">加入仓库</el-button>
+				</el-form-item>
+			</el-form>
+		</div>
+	</div>
+</template>
+
+<script>
+export default {
+	name: 'goods-add',
+	data() {
+		return {
+			ruleForm: {
+				name: '',
+				region: '',
+				date1: '',
+				date2: '',
+				delivery: false,
+				type: [],
+				resource: '',
+				desc: ''
+			},
+			rules: {
+				name: [
+					{ required: true, message: '请输入活动名称', trigger: 'blur' },
+					{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
+				]
+			},
+			// 图片
+			dialogImageUrl: '',
+			dialogVisible: false
+		};
+	},
+	methods: {
+		submitForm(formName) {
+			this.$refs[formName].validate(valid => {
+				if (valid) {
+					alert('submit!');
+				} else {
+					console.log('error submit!!');
+					return false;
+				}
+			});
+		},
+		resetForm(formName) {
+			this.$refs[formName].resetFields();
+		},
+		// 图片上传
+		handleRemove(file, fileList) {
+			console.log(file, fileList);
+		},
+		handlePictureCardPreview(file) {
+			this.dialogImageUrl = file.url;
+			this.dialogVisible = true;
+		},
+		// 编辑器
+		editor(ref) {
+			console.log(ref);
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.form-wrap {
+	// width: 60%;
+}
+.cl-editor-quill {
+	/deep/ .editor {
+		height: 300px;
+	}
+}
+</style>

+ 13 - 1
admin-code/src/views/goods/goods-list.vue

@@ -21,6 +21,11 @@
 				<span @click="openLinkFn(scope.row.shortUrl)">链接</span>
 			</template>
 
+			<!-- 添加商品 -->
+			<template #slot-add-goods-btn="{scope}">
+				<el-button type="primary" size="mini" @click="addFn">添加</el-button>
+			</template>
+
 			<!-- 状态 -->
 			<template #table-column-status="{scope}">
 				<span>{{ scope.row.status == 1 ? '上架' : '下架' }}</span>
@@ -30,6 +35,7 @@
 			<template #slot-modify="{scope}">
 				<el-button type="text">修改</el-button>
 			</template>
+
 			<!-- 下架 -->
 			<template #slot-takeOff="{scope}">
 				<el-button type="text">下架</el-button>
@@ -57,10 +63,16 @@ export default {
 		};
 	},
 	methods: {
+		// 打开链接
 		openLinkFn(link) {
 			this.sortLink = link || '';
 			this.dialogFormVisible = true;
 		},
+		// 添加商品
+		addFn() {
+			this.$router.push('/goods/add');
+			alert('asdfasdf');
+		},
 		// cl-crud 组件
 		onLoad({ ctx, app }) {
 			ctx.service(this.$service.member)
@@ -130,7 +142,7 @@ export default {
 				})
 				.set('layout', [
 					['slot-tabs'],
-					['search-key', 'flex1', 'refresh-btn', 'add-btn'],
+					['search-key', 'flex1', 'refresh-btn', 'slot-add-goods-btn'],
 					['data-table'],
 					['flex1', 'pagination']
 				])