|
@@ -0,0 +1,216 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ v-loading="loading"
|
|
|
+ :title="'添加商品上线'"
|
|
|
+ :center="true"
|
|
|
+ align="left"
|
|
|
+ top="18vh"
|
|
|
+ width="1040px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="showModelThis"
|
|
|
+ element-loading-text="拼命加载中"
|
|
|
+ element-loading-spinner="el-icon-loading"
|
|
|
+ element-loading-background="rgba(0, 0, 0, 0.8)"
|
|
|
+ @close="showModelThis = false"
|
|
|
+ >
|
|
|
+ <el-card style="margin: -20px 0 0 0; padding-bottom: 0;">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-table
|
|
|
+ :data="sitem"
|
|
|
+ stripe
|
|
|
+ :size="'mini'"
|
|
|
+ border
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-table-column prop="date" label="日期" width="180">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="姓名" width="180">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="地址"> </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form
|
|
|
+ ref="ruleForm"
|
|
|
+ :model="ruleForm"
|
|
|
+ status-icon
|
|
|
+
|
|
|
+ :rules="rulesThis"
|
|
|
+ label-width="80px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-row style="padding-bottom">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="所属平台" prop="platform">
|
|
|
+ <search-terrace
|
|
|
+ :value="ruleForm.platform"
|
|
|
+ :disabled="false"
|
|
|
+ :isDetail="false"
|
|
|
+ :placeholder="'所属平台'"
|
|
|
+ @searchChange="platform_codesearchChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上线原因" prop="online_reason">
|
|
|
+ <el-input
|
|
|
+ :disabled="false"
|
|
|
+ placeholder="上线原因"
|
|
|
+ v-model="ruleForm.online_reason"
|
|
|
+ maxlength="200"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="16" style="text-align: right">
|
|
|
+ <el-form-item label="上线备注" prop="online_remark">
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ :rows="3"
|
|
|
+ :disabled="false"
|
|
|
+ placeholder="商品备注"
|
|
|
+ maxlength="2000"
|
|
|
+ v-model="ruleForm.online_remark"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-button
|
|
|
+ v-if="id !== '007'"
|
|
|
+ type="primary"
|
|
|
+ :size="'mini'"
|
|
|
+ @click="submitForm"
|
|
|
+ >保 存
|
|
|
+ </el-button>
|
|
|
+ <el-button :size="'mini'" @click="showModelThis = false">{{
|
|
|
+ id == "007" ? "关 闭" : "取 消"
|
|
|
+ }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-card>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import asyncRequest from "@/apis/service/goodStore/brand";
|
|
|
+import resToken from "@/mixins/resToken";
|
|
|
+export default {
|
|
|
+ name: "brand",
|
|
|
+ props: ["showModel", "id", "sitem"],
|
|
|
+ mixins: [resToken],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ showModelThis: this.showModel,
|
|
|
+ ruleForm: {
|
|
|
+ platform: [], //string 平台id
|
|
|
+ online_reason: "", //string 上线原因
|
|
|
+ online_remark: "", //string 上线备注
|
|
|
+ },
|
|
|
+ rulesThis: this.rules,
|
|
|
+ rules: {
|
|
|
+ platform: [
|
|
|
+ {
|
|
|
+ type: "array",
|
|
|
+ required: true,
|
|
|
+ message: "请选择所属平台",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ online_reason: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "上线原因不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ online_remark: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "上线备注不能为空",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ showModel: function (val) {
|
|
|
+ this.showModelThis = val;
|
|
|
+ if (val) {
|
|
|
+ this.initForm();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ showModelThis(val) {
|
|
|
+ if (!val) {
|
|
|
+ this.$emit("cancel");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async initForm() {
|
|
|
+ this.loading = true;
|
|
|
+ this.rulesThis = this.rules;
|
|
|
+ await this.resetForm();
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+ async resetForm() {
|
|
|
+ // 重置
|
|
|
+ await this.$nextTick(() => {
|
|
|
+ if (this.$refs.ruleForm) {
|
|
|
+ this.$refs.ruleForm.resetFields();
|
|
|
+ this.$refs.ruleForm.clearValidate();
|
|
|
+ const { id, brand_name } = this.sitem;
|
|
|
+ this.ruleForm = {
|
|
|
+ platform: [], //string 平台id
|
|
|
+ online_reason: "", //string 上线原因
|
|
|
+ online_remark: "", //string 上线备注
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ platform_codesearchChange(e) {
|
|
|
+ const { id, code, label } = e;
|
|
|
+ this.ruleForm.platform = id ? [id] : [];
|
|
|
+ this.$refs.ruleForm.validateField("platform");
|
|
|
+ },
|
|
|
+ async submitForm() {
|
|
|
+ await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true;
|
|
|
+ let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
+ let res = {};
|
|
|
+ if (this.id === "003") {
|
|
|
+ delete model["id"];
|
|
|
+ res = await asyncRequest.add(model);
|
|
|
+ } else {
|
|
|
+ res = await asyncRequest.update(model);
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
+ this.$notify.success({
|
|
|
+ title,
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+ this.showModelThis = false;
|
|
|
+ // 刷新
|
|
|
+ this.$emit("refresh");
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+ <style lang="scss" scoped>
|
|
|
+.brand {
|
|
|
+
|
|
|
+}
|
|
|
+</style>
|