|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="activeAdd pagePadding">
|
|
|
+ <div class="activeAdd">
|
|
|
<el-form
|
|
|
:model="ruleForm"
|
|
|
status-icon
|
|
@@ -14,7 +14,7 @@
|
|
|
<el-form-item label="业务企业" prop="company_id">
|
|
|
<search-work-company
|
|
|
:value="ruleForm.company_id"
|
|
|
- :disabled="false"
|
|
|
+ :disabled="status !== ''"
|
|
|
:size="'mini'"
|
|
|
:isDetail="false"
|
|
|
:placeholder="'业务企业'"
|
|
@@ -26,6 +26,7 @@
|
|
|
<el-form-item label="活动标题" prop="activity_name">
|
|
|
<el-input
|
|
|
placeholder="活动标题"
|
|
|
+ :disabled="status !== ''"
|
|
|
v-model="ruleForm.activity_name"
|
|
|
maxlength="100"
|
|
|
/>
|
|
@@ -35,7 +36,7 @@
|
|
|
<el-form-item label="所属平台" prop="platform_code">
|
|
|
<search-terrace
|
|
|
:value="ruleForm.platform_code"
|
|
|
- :disabled="false"
|
|
|
+ :disabled="status !== ''"
|
|
|
:size="'mini'"
|
|
|
:isDetail="false"
|
|
|
:placeholder="'所属平台'"
|
|
@@ -51,6 +52,7 @@
|
|
|
<el-date-picker
|
|
|
type="datetime"
|
|
|
placeholder="开始时间"
|
|
|
+ :disabled="status !== ''"
|
|
|
value-format="yyyy-MM-dd hh:mm:ss"
|
|
|
:picker-options="pickerOptions1"
|
|
|
v-model="ruleForm.activity_start"
|
|
@@ -65,6 +67,7 @@
|
|
|
type="datetime"
|
|
|
value-format="yyyy-MM-dd hh:mm:ss"
|
|
|
placeholder="结束时间"
|
|
|
+ :disabled="status !== ''"
|
|
|
:picker-options="pickerOptions2"
|
|
|
v-model="ruleForm.activity_end"
|
|
|
style="width: 100%"
|
|
@@ -79,6 +82,7 @@
|
|
|
<el-select
|
|
|
v-model="ruleForm.is_stock"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="status !== ''"
|
|
|
placeholder="库存类型"
|
|
|
>
|
|
|
<el-option
|
|
@@ -97,13 +101,14 @@
|
|
|
placeholder="活动描述"
|
|
|
type="textarea"
|
|
|
:rows="2"
|
|
|
+ :disabled="status !== ''"
|
|
|
show-word-limit
|
|
|
v-model="ruleForm.activity_desc"
|
|
|
maxlength="500"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="24" v-if="status !== '1'">
|
|
|
<el-form-item
|
|
|
label="活动商品"
|
|
|
:label-position="'top'"
|
|
@@ -116,17 +121,83 @@
|
|
|
:size="'mini'"
|
|
|
style="width: 100%"
|
|
|
>
|
|
|
- <el-table-column prop="skuCode" label="商品编码" width="180">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="good_name" label="商品名称" width="180">
|
|
|
+ <el-table-column
|
|
|
+ prop="skuCode"
|
|
|
+ label="商品编码"
|
|
|
+ show-overflow-tooltip
|
|
|
+ width="170"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="good_name"
|
|
|
+ label="商品名称"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="activity_stock"
|
|
|
+ label="活动库存"
|
|
|
+ width="100"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="moq_num"
|
|
|
+ label="起订量"
|
|
|
+ width="100"
|
|
|
+ v-if="!(status === '' || status === '0')"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="cost_price"
|
|
|
+ label="成本单价(元)"
|
|
|
+ width="100"
|
|
|
+ v-if="!(status === '' || status === '0')"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="sale_price"
|
|
|
+ label="非活动价(元)"
|
|
|
+ width="100"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="activity_price"
|
|
|
+ label="活动价(元)"
|
|
|
+ width="100"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ <el-table-column prop="status" label="审核状态" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag
|
|
|
+ :size="'mini'"
|
|
|
+ :type="
|
|
|
+ scope.row.status == '0'
|
|
|
+ ? 'warning'
|
|
|
+ : scope.row.status == '2'
|
|
|
+ ? 'danger'
|
|
|
+ : ''
|
|
|
+ "
|
|
|
+ v-text="
|
|
|
+ (
|
|
|
+ options.find(
|
|
|
+ (item) => item.value == scope.row.status
|
|
|
+ ) || {}
|
|
|
+ ).label || '--'
|
|
|
+ "
|
|
|
+ ></el-tag>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="address" label="地址"> </el-table-column>
|
|
|
- <el-table-column fixed="right" width="100">
|
|
|
+ <el-table-column
|
|
|
+ prop="remark"
|
|
|
+ label="审核备注"
|
|
|
+ width="100"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
+ <el-table-column fixed="right" width="80">
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
<span>操作</span>
|
|
|
<el-tooltip
|
|
|
class="item"
|
|
|
effect="dark"
|
|
|
+ v-if="status === ''"
|
|
|
content="添加活动商品"
|
|
|
placement="top"
|
|
|
>
|
|
@@ -138,13 +209,22 @@
|
|
|
</el-tooltip>
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tooltip effect="dark" content="查看" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ effect="dark"
|
|
|
+ content="查看商品信息"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i
|
|
|
class="el-icon-view tb-icon"
|
|
|
@click="openEdit(scope.$index, scope.row)"
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip effect="dark" content="删除" placement="top">
|
|
|
+ <el-tooltip
|
|
|
+ v-if="status === ''"
|
|
|
+ effect="dark"
|
|
|
+ content="删除"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
<i
|
|
|
class="el-icon-delete tb-icon"
|
|
|
@click="openCostEditDelete(scope.$index)"
|
|
@@ -164,6 +244,7 @@
|
|
|
/>
|
|
|
<el-col
|
|
|
:span="24"
|
|
|
+ v-if="status === ''"
|
|
|
style="
|
|
|
text-align: right;
|
|
|
padding: 15px 0 15px 0;
|
|
@@ -184,6 +265,7 @@ import searchGoodOnlineModal from "@/components/search-good-online-modal";
|
|
|
export default {
|
|
|
name: "activeAdd",
|
|
|
mixins: [resToken],
|
|
|
+ props: ["showModel", "id", "type", "sitem"],
|
|
|
components: {
|
|
|
searchGoodOnlineModal,
|
|
|
},
|
|
@@ -194,6 +276,21 @@ export default {
|
|
|
return {
|
|
|
size: "small",
|
|
|
activeName: "3",
|
|
|
+ status: "",
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "0",
|
|
|
+ label: "待审核",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ label: "通过",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "2",
|
|
|
+ label: "驳回",
|
|
|
+ },
|
|
|
+ ],
|
|
|
is_stock: [
|
|
|
{ id: "0", name: "非库存品" },
|
|
|
{ id: "1", name: "库存品" },
|
|
@@ -229,6 +326,8 @@ export default {
|
|
|
once: false,
|
|
|
rulesThis: this.rules,
|
|
|
ruleForm: {},
|
|
|
+ // 表格 - 数据
|
|
|
+ tableData: [],
|
|
|
rules: {
|
|
|
activity_name: [
|
|
|
{
|
|
@@ -357,16 +456,32 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
resetFormData() {
|
|
|
+ this.tableData = [];
|
|
|
+ const {
|
|
|
+ activity_name,
|
|
|
+ activity_desc,
|
|
|
+ is_stock,
|
|
|
+ end,
|
|
|
+ start,
|
|
|
+ platform_code,
|
|
|
+ company_id,
|
|
|
+ info,
|
|
|
+ status,
|
|
|
+ } = this.sitem;
|
|
|
this.ruleForm = {
|
|
|
- activity_name: "活动",
|
|
|
- platform_code: ["8"],
|
|
|
- company_id: "GSe61q220222143052",
|
|
|
- activity_start: "",
|
|
|
- activity_end: "",
|
|
|
- activity_desc: "活动备注",
|
|
|
- is_stock: "1",
|
|
|
- good_list: [],
|
|
|
+ activity_name: activity_name || "",
|
|
|
+ platform_code: platform_code ? [platform_code] : [],
|
|
|
+ company_id: company_id || "",
|
|
|
+ activity_start: start || "",
|
|
|
+ activity_end: end || "",
|
|
|
+ activity_desc: activity_desc || "",
|
|
|
+ is_stock: is_stock || "",
|
|
|
+ good_list:
|
|
|
+ info && info.length > 0 ? JSON.parse(JSON.stringify(info)) : [],
|
|
|
};
|
|
|
+ this.status = status || "";
|
|
|
+ this.tableData =
|
|
|
+ info && info.length > 0 ? JSON.parse(JSON.stringify(info)) : [];
|
|
|
},
|
|
|
handleClick(row) {
|
|
|
console.log(row);
|
|
@@ -393,45 +508,40 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
- model.cat_id = model.cat_id[model.cat_id.length - 1];
|
|
|
- model.brandid = model.brandid.toString();
|
|
|
- model.supplierNo = model.supplierNo.toString();
|
|
|
- model.delivery_place = model.delivery_place.toString();
|
|
|
- model.origin_place = model.origin_place.toString();
|
|
|
- model.good_info_img = model.good_info_img.toString();
|
|
|
- model.unit = model.unit.toString();
|
|
|
- model.speclist = JSON.parse(JSON.stringify(this.setResData(1)));
|
|
|
- model.good_ladder = JSON.parse(JSON.stringify(this.setResData(2)));
|
|
|
+ model.platform_code = model.platform_code.toString();
|
|
|
+ const { good_list } = model;
|
|
|
+
|
|
|
+ let list = JSON.parse(JSON.stringify(good_list));
|
|
|
+ let newList = [];
|
|
|
+ model.good_list = [];
|
|
|
+ list.forEach((e) => {
|
|
|
+ let item = {
|
|
|
+ skuCode: e.skuCode,
|
|
|
+ activity_stock: 1 + "",
|
|
|
+ };
|
|
|
+ newList.push(item);
|
|
|
+ });
|
|
|
+ model.good_list = newList;
|
|
|
let res = {};
|
|
|
- delete model["id"];
|
|
|
+ console.log(this.id, this.type);
|
|
|
if (this.type === "add") {
|
|
|
delete model["id"];
|
|
|
delete model["spuCode"];
|
|
|
res = await asyncRequest.add(model);
|
|
|
- } else if (this.type === "editBase") {
|
|
|
- let item1 = this.setModel(model, "1");
|
|
|
- res = await asyncRequest.update(item1);
|
|
|
} else {
|
|
|
- let item2 = this.setModel(model, "2");
|
|
|
- res = await asyncRequest.updateP(item2);
|
|
|
+ res = await asyncRequest.update(model);
|
|
|
}
|
|
|
console.log(res);
|
|
|
this.loading = false;
|
|
|
if (res && res.code === 0) {
|
|
|
- const { spuCode } = res.data;
|
|
|
- const title =
|
|
|
- this.type === "add"
|
|
|
- ? "新建成功!"
|
|
|
- : this.type === "editBase"
|
|
|
- ? "基础信息修改成功!"
|
|
|
- : "成本信息修改成功!";
|
|
|
+ const title = this.type === "add" ? "新建成功!" : "库存修改成功!";
|
|
|
this.$notify.success({
|
|
|
title: title,
|
|
|
message: "",
|
|
|
});
|
|
|
this.showModelThis = false;
|
|
|
// 刷新
|
|
|
- this.$emit("refresh", { spuCode: spuCode });
|
|
|
+ this.$emit("refresh", true);
|
|
|
}
|
|
|
} else {
|
|
|
console.log("error submit!!");
|