|
@@ -1,12 +1,218 @@
|
|
|
<template>
|
|
|
- <div>产品分类</div>
|
|
|
+ <div class="box">
|
|
|
+ <div class="top_box">
|
|
|
+ <el-button type="primary" @click="handlePop"> 新增</el-button>
|
|
|
+ </div>
|
|
|
+ <pub-all
|
|
|
+ :exportFlag="true"
|
|
|
+ :tableConfigArr="tableConfigArr"
|
|
|
+ api="/synclist"
|
|
|
+ apiVal="sysData"
|
|
|
+ ref="puball"
|
|
|
+ :border="false"
|
|
|
+ >
|
|
|
+ </pub-all>
|
|
|
+
|
|
|
+ <my-pop
|
|
|
+ title="礼品新增"
|
|
|
+ :dialogFormVisible="dialogFormVisible"
|
|
|
+ @handleClose="handleClose"
|
|
|
+ class="dialogClass"
|
|
|
+ >
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ action="https://info.windd.cn/collection/sys/user/upload"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
+ >
|
|
|
+ <img v-if="imageUrl" :src="imageUrl" class="avatar" />
|
|
|
+ <i v-else class="el-icon-plus avatar-uploader-icon">添加图片</i>
|
|
|
+ </el-upload>
|
|
|
+ <my-form
|
|
|
+ ref="myForm"
|
|
|
+ :formValue="formValue"
|
|
|
+ :formList="formList"
|
|
|
+ :rules="rules"
|
|
|
+ >
|
|
|
+ </my-form>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="confirm" type="primary">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </my-pop>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
name: "goods-classify",
|
|
|
data() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ imageUrl: "",
|
|
|
+ tableConfigArr: [
|
|
|
+ {
|
|
|
+ prop: "name",
|
|
|
+ label: "状态",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ fixed: false,
|
|
|
+ prop: "created_time",
|
|
|
+ label: "开始时间",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ fixed: false,
|
|
|
+ prop: "end_time",
|
|
|
+ label: "结束时间",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: "type",
|
|
|
+ label: "同步类型",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ tableSelect: [
|
|
|
+ {
|
|
|
+ prop: "name",
|
|
|
+ label: "状态",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ fixed: false,
|
|
|
+ prop: "created_time",
|
|
|
+ label: "开始时间",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ fixed: false,
|
|
|
+ prop: "end_time",
|
|
|
+ label: "结束时间",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+
|
|
|
+ formValue: {
|
|
|
+ name: "",
|
|
|
+ number: "",
|
|
|
+ grade: "",
|
|
|
+ },
|
|
|
+ formList: [
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "name",
|
|
|
+ label: "名称:",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "number",
|
|
|
+ label: "剩余数量:",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "grade",
|
|
|
+ label: "积分(分):",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ rules: {
|
|
|
+ name: [
|
|
|
+ { required: true, message: "请选择活动区域", trigger: "change" },
|
|
|
+ ],
|
|
|
+ number: [
|
|
|
+ { required: true, message: "请选择活动区域", trigger: "change" },
|
|
|
+ ],
|
|
|
+ grade: [
|
|
|
+ { required: true, message: "请选择活动区域", trigger: "change" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+
|
|
|
+ dialogFormVisible: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handlePop() {
|
|
|
+ this.dialogFormVisible = !this.dialogFormVisible;
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.formValue = {
|
|
|
+ name: "",
|
|
|
+ number: "",
|
|
|
+ grade: "",
|
|
|
+ };
|
|
|
+ this.$refs.myForm.$refs.formData.resetFields();
|
|
|
+ this.dialogFormVisible = !this.dialogFormVisible;
|
|
|
+ },
|
|
|
+
|
|
|
+ handleAvatarSuccess(res, file) {
|
|
|
+ this.imageUrl = URL.createObjectURL(file.raw);
|
|
|
+ },
|
|
|
+
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
+ console.log(isLt2M);
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error("上传头像图片大小不能超过 2MB!");
|
|
|
+ }
|
|
|
+ return isLt2M;
|
|
|
+ },
|
|
|
+ confirm() {
|
|
|
+ this.$refs.myForm.$refs.formData.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ console.log("77777");
|
|
|
+ // this.$emit("submitForm", this.formValue);
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.box {
|
|
|
+ height: 100vh;
|
|
|
+ width: 100%;
|
|
|
+ .top_box {
|
|
|
+ width: 100%;
|
|
|
+ height: 7vh;
|
|
|
+ border-bottom: 1px solid #00bfbf;
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-end;
|
|
|
+ justify-content: flex-end;
|
|
|
+ margin-bottom: 2%;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep.dialogClass .el-dialog .el-dialog__body {
|
|
|
+ padding: 0;
|
|
|
+ .el-button--primary {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ .el-form {
|
|
|
+ margin: 0 3%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar-uploader .el-upload {
|
|
|
+ // border: 1px dashed #d9d9d9;
|
|
|
+ border-radius: 6px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ .avatar-uploader .el-upload:hover {
|
|
|
+ border-color: #409eff;
|
|
|
+ }
|
|
|
+ .avatar-uploader {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .avatar-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #8c939d;
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ line-height: 178px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ .avatar {
|
|
|
+ width: 178px;
|
|
|
+ height: 178px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|