Commit 9a0e23ab authored by lihui's avatar lihui

feat:merge

parents cb5bc6bd 1ee812e0
...@@ -89,6 +89,19 @@ exports.addMarketing = async ctx => { ...@@ -89,6 +89,19 @@ exports.addMarketing = async ctx => {
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
}; };
// 编辑营销活动
exports.updateMarketing = async ctx => {
const url = `${ACTIVITY_URI}/marketing/background/update_marketing`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
};
// 营销活动详情 // 营销活动详情
exports.marketingInfo = async ctx => { exports.marketingInfo = async ctx => {
const url = `${ACTIVITY_URI}/marketing/background/marketing_info`; const url = `${ACTIVITY_URI}/marketing/background/marketing_info`;
......
...@@ -71,14 +71,14 @@ router.post(`${API_VERSION}/marketing/background/marketing_info`, activity.check ...@@ -71,14 +71,14 @@ router.post(`${API_VERSION}/marketing/background/marketing_info`, activity.check
router.get(`${API_VERSION}/marketing/background/take_place_list`, activity.getPlaceList) router.get(`${API_VERSION}/marketing/background/take_place_list`, activity.getPlaceList)
router.post(`${API_VERSION}/marketing/background/add_take_place`, activity.addPlace) router.post(`${API_VERSION}/marketing/background/add_take_place`, activity.addPlace)
router.post(`${API_VERSION}/marketing/background/delete_take_place`, activity.deletePlace) router.post(`${API_VERSION}/marketing/background/delete_take_place`, activity.deletePlace)
//活动管理
router.get(`${API_VERSION}/goods/background/ota_list`, activity.getBusinessList); router.get(`${API_VERSION}/goods/background/ota_list`, activity.getBusinessList);
router.post(`${API_VERSION}/goods/background/add_goods`, activity.addGoods); router.post(`${API_VERSION}/goods/background/add_goods`, activity.addGoods);
router.get(`${API_VERSION}/goods/background/pindan_goods`, activity.pindanGoods); router.get(`${API_VERSION}/goods/background/pindan_goods`, activity.pindanGoods);
router.get(`${API_VERSION}/goods/background/marketing_goods_info`, activity.markGoodsInfo); router.get(`${API_VERSION}/goods/background/marketing_goods_info`, activity.markGoodsInfo);
router.post(`${API_VERSION}/goods/background/edit_goods`, activity.editGoods); router.post(`${API_VERSION}/goods/background/edit_goods`, activity.editGoods);
router.post(`${API_VERSION}/marketing/background/add_marketing`, activity.addMarketing); router.post(`${API_VERSION}/marketing/background/add_marketing`, activity.addMarketing);
router.post(`${API_VERSION}/marketing/background/marketing_info`, activity.marketingInfo);
router.post(`${API_VERSION}/marketing/background/update_marketing`, activity.updateMarketing);
......
...@@ -236,6 +236,7 @@ import { ...@@ -236,6 +236,7 @@ import {
pindanGoods, pindanGoods,
markGoodsInfo, markGoodsInfo,
editGoods, editGoods,
marketingInfo,
} from "../../../../service/Activity/index"; } from "../../../../service/Activity/index";
export default { export default {
...@@ -336,8 +337,10 @@ export default { ...@@ -336,8 +337,10 @@ export default {
let params = { ota_name: "", offset: "", limit: "" }; let params = { ota_name: "", offset: "", limit: "" };
try { try {
const res = await getBusinessList(params); const res = await getBusinessList(params);
this.businessOpt = [{ ota_id: "", ota_name: "全部" }, ...res.data.list]; this.businessOpt = [
console.log(this.businessOpt); { ota_id: "", ota_name: "全部" },
...res.result.list,
];
} catch (error) { } catch (error) {
this.$message.error("发生未知错误,请稍后再试一下吧~~~"); this.$message.error("发生未知错误,请稍后再试一下吧~~~");
console.error(error); console.error(error);
...@@ -350,8 +353,11 @@ export default { ...@@ -350,8 +353,11 @@ export default {
const res = await markGoodsInfo(params); const res = await markGoodsInfo(params);
this.commodityForm = res.result.goods_info; this.commodityForm = res.result.goods_info;
this.commodityForm.business1 = res.result.goods_info.ota_id; this.commodityForm.business1 = res.result.goods_info.ota_id;
this.commodityForm.picUrlList = res.result.goods_info.desc_pic_url_list; for (var i in res.result.goods_info.desc_pic_url_list) {
console.log(this.commodityForm.picUrlList); this.commodityForm.picUrlList.push({
url: res.result.goods_info.desc_pic_url_list[i],
});
}
}, },
// 编辑商品详情 // 编辑商品详情
...@@ -363,11 +369,11 @@ export default { ...@@ -363,11 +369,11 @@ export default {
inventory_add: this.commodityForm.inventory_total, inventory_add: this.commodityForm.inventory_total,
original_price: this.commodityForm.original_price, original_price: this.commodityForm.original_price,
price: this.commodityForm.price, price: this.commodityForm.price,
marketing_name: this.editInfo[0].title, marketing_name: this.editInfo.title,
marketing_type: "4", marketing_type: "4",
ota_id: this.commodityForm.business1, ota_id: this.commodityForm.business1,
op_cur_user: store.state.userInfo.email, op_cur_user: store.state.userInfo.email,
goods_sku_id:goodsSkuID, goods_sku_id: goodsSkuID,
}); });
if (res.code == 0) { if (res.code == 0) {
ElMessage.success({ ElMessage.success({
...@@ -379,7 +385,6 @@ export default { ...@@ -379,7 +385,6 @@ export default {
} else { } else {
ElMessage.error(res.reason); ElMessage.error(res.reason);
} }
console.log(res);
}, },
// 获取商品库列表 // 获取商品库列表
...@@ -395,7 +400,6 @@ export default { ...@@ -395,7 +400,6 @@ export default {
this.commodityForm = {}; this.commodityForm = {};
if (type == "add") { if (type == "add") {
this.commodityForm.total_amount_order = 0; this.commodityForm.total_amount_order = 0;
console.log(this.commodityForm.total_amount_order);
this.addCommodityTitle = "商品添加"; this.addCommodityTitle = "商品添加";
} else { } else {
this.addCommodityTitle = "商品编辑"; this.addCommodityTitle = "商品编辑";
...@@ -407,7 +411,7 @@ export default { ...@@ -407,7 +411,7 @@ export default {
// 添加商品 // 添加商品
async addGoodsMet() { async addGoodsMet() {
const res = await addGoods({ const res = await addGoods({
marketing_name: this.editInfo[0].title, marketing_name: this.editInfo.title,
goods_name: this.commodityForm.goods_name, goods_name: this.commodityForm.goods_name,
desc_pic_url: this.picUploadList.join(","), desc_pic_url: this.picUploadList.join(","),
desc: "", desc: "",
...@@ -423,7 +427,8 @@ export default { ...@@ -423,7 +427,8 @@ export default {
message: "添加商品成功", message: "添加商品成功",
type: "success", type: "success",
}); });
this.comTableData = [res.result.goods_info, ...this.multipleSelection]; // [res.result.goods_info, ...this.multipleSelection];
this.comTableData.push(res.result.goods_info);
this.addCommodityPopup = false; this.addCommodityPopup = false;
} else { } else {
ElMessage.error(res.reason); ElMessage.error(res.reason);
...@@ -481,9 +486,23 @@ export default { ...@@ -481,9 +486,23 @@ export default {
} }
} }
}, },
// 获取营销活动详情
async marketingInfoMet() {
let marketingId = this.$route.query.marketing_id;
if (marketingId == undefined) {
return;
}
let params = {
marketing_id: marketingId,
marketing_type: "4",
};
const res = await marketingInfo(params);
this.comTableData = res.result.goods_list;
},
}, },
created() { created() {
this.getBusinessListMet(); this.getBusinessListMet();
this.marketingInfoMet();
}, },
}; };
</script> </script>
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
<script> <script>
import { GOODS_URI } from "../../../../../server/config"; import { GOODS_URI } from "../../../../../server/config";
import { marketingInfo } from "../../../../service/Activity/index";
export default { export default {
//props: ["editInfo"], //props: ["editInfo"],
props: { props: {
...@@ -59,11 +60,11 @@ export default { ...@@ -59,11 +60,11 @@ export default {
infoEditForm: { infoEditForm: {
title: "", // 标题 title: "", // 标题
desc: "", // 介绍 desc: "", // 介绍
picUploadList: [] // 上传详情图片列表 picUploadList: [], // 上传详情图片列表
picUrlList: [] // 图片回显列表
}, },
isShowPopver: false, // 是否展示图片框 isShowPopver: false, // 是否展示图片框
picUrlList: [], // 图片回显列表
uploadUrl: `${GOODS_URI}/ksy/ks3apiunencrypt/ks3api_upload` // 金山云上传地址 uploadUrl: `${GOODS_URI}/ksy/ks3apiunencrypt/ks3api_upload` // 金山云上传地址
}; };
}, },
...@@ -76,7 +77,6 @@ export default { ...@@ -76,7 +77,6 @@ export default {
// 图片上传成功时 // 图片上传成功时
handleDetailSuccess(res) { handleDetailSuccess(res) {
console.log(res);
this.infoEditForm.picUploadList.push(res.result.image_id); this.infoEditForm.picUploadList.push(res.result.image_id);
}, },
...@@ -87,9 +87,29 @@ export default { ...@@ -87,9 +87,29 @@ export default {
this.infoEditForm.picUploadList.splice(i, 1); this.infoEditForm.picUploadList.splice(i, 1);
} }
} }
},
// 获取营销活动详情
async marketingInfoMet() {
let marketingId = this.$route.query.marketing_id;
if (marketingId == undefined) {
return;
}
let params = {
marketing_id: marketingId,
marketing_type: "4"
};
const res = await marketingInfo(params);
this.infoEditForm.title = res.result.marketing_info.marketing_name;
this.infoEditForm.desc = res.result.marketing_info.pindan_desc;
for (var i in res.result.marketing_info.pindan_pic_url) {
this.infoEditForm.picUrlList.push({
url: res.result.marketing_info.pindan_pic_url[i]
});
}
} }
}, },
created() { created() {
this.marketingInfoMet();
console.log(this.editInfo); console.log(this.editInfo);
} }
}; };
......
...@@ -41,11 +41,13 @@ ...@@ -41,11 +41,13 @@
</template> </template>
<script> <script>
import store from "../../../store/index";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import infoEditing from "./components/infoEditing.vue"; import infoEditing from "./components/infoEditing.vue";
import addProduc from "./components/addProduc.vue"; import addProduc from "./components/addProduc.vue";
import spellOrderSet from "./components/spellOrderSet.vue"; import spellOrderSet from "./components/spellOrderSet.vue";
import { addMarketing, marketingInfo } from "../../../service/Activity/index"; // , marketingInfo
import { addMarketing, updateMarketing } from "../../../service/Activity/index";
export default { export default {
components: { components: {
infoEditing, infoEditing,
...@@ -54,8 +56,13 @@ export default { ...@@ -54,8 +56,13 @@ export default {
}, },
data() { data() {
return { return {
active: 3, // 步骤条状态 active: 1, // 步骤条状态
infoEditArr: [] // 信息编辑数据 infoEditArr: [], // 信息编辑数据
addProducArr: [], // 添加商品
goodsSkuIDArr: [], // 接收goods_sku_id
// spellOrderSetArr:[]
startDate: "", // 开始时间
endDate: "" // 结束时间
}; };
}, },
...@@ -72,30 +79,40 @@ export default { ...@@ -72,30 +79,40 @@ export default {
ElMessage.error("请填写商品标题"); ElMessage.error("请填写商品标题");
return; return;
} }
// console.log(this.$refs.infoEdit.infoEditForm.picUploadList.join(",")); this.infoEditArr = {
this.infoEditArr.push(this.$refs.infoEdit.infoEditForm); title: this.$refs.infoEdit.infoEditForm.title,
desc: this.$refs.infoEdit.infoEditForm.desc,
picUploadList: this.$refs.infoEdit.infoEditForm.picUploadList.join(
","
)
};
} else if (this.active === 2) { } else if (this.active === 2) {
if (this.$refs.addProduc.comTableData.length == 0) { if (this.$refs.addProduc.comTableData.length == 0) {
ElMessage.error("请至少选择一个商品"); ElMessage.error("请至少选择一个商品");
return; return;
} }
this.addProducArr = this.$refs.addProduc;
} else {
this.startDate = this.$refs.spellOrderSet.startDate;
this.endDate = this.$refs.spellOrderSet.endDate;
} }
this.active++; this.active++;
}, },
// 获取营销活动详情 // 获取营销活动详情
async marketingInfoMet() { // async marketingInfoMet() {
let marketingId = this.$route.query.marketing_id; // let marketingId = this.$route.query.marketing_id;
if (marketingId == undefined) { // if (marketingId == undefined) {
return; // return;
} // }
let params = { // let params = {
marketing_id: marketingId, // marketing_id: marketingId,
marketing_type: "4" // marketing_type: "4",
}; // };
const res = await marketingInfo(params); // const res = await marketingInfo(params);
this.infoEditArr = res.result.marketing_info; // console.log(res);
}, // this.infoEditArr = res.result.marketing_info;
// },
// 取消 // 取消
cancel() { cancel() {
...@@ -103,23 +120,50 @@ export default { ...@@ -103,23 +120,50 @@ export default {
}, },
// 确认发布 // 确认发布
async confirmRelease() { async confirmRelease() {
// this.$refs.addProduc.comTableData for (var i in this.addProducArr.comTableData) {
const res = await addMarketing({ this.goodsSkuIDArr.push(this.addProducArr.comTableData[i].goods_sku_id);
goods_sku_id: "", }
marketing_name: "", let params = {
marketing_id:
this.$route.query.marketing_id == undefined
? ""
: this.$route.query.marketing_id,
goods_sku_id: this.goodsSkuIDArr.join(","),
marketing_name: this.infoEditArr.title,
marketing_type: "4", marketing_type: "4",
op_cur_user: "", op_cur_user: store.state.userInfo.email,
start_time: "", start_time: this.startDate,
end_time: "", end_time: this.endDate,
pindan_pic: "", pindan_pic: this.infoEditArr.picUploadList,
pindan_desc: "" pindan_desc: this.infoEditArr.desc
}); };
console.log(res); if (this.$route.query.marketing_id == undefined) {
this.$router.push({ path: "/op/activity/manage" }); const res = await addMarketing(params);
if (res.code === 0) {
ElMessage.success({
message: "添加成功",
type: "success"
});
this.$router.push({ path: "/op/activity/manage" });
} else {
ElMessage.error(res.reason);
}
} else {
const res = await updateMarketing(params);
if (res.code === 0) {
ElMessage.success({
message: "修改成功",
type: "success"
});
this.$router.push({ path: "/op/activity/manage" });
} else {
ElMessage.error(res.reason);
}
}
} }
}, },
created() { created() {
this.marketingInfoMet(); // this.marketingInfoMet();
} }
}; };
</script> </script>
......
...@@ -42,6 +42,12 @@ export async function addMarketing(params) { ...@@ -42,6 +42,12 @@ export async function addMarketing(params) {
return res; return res;
} }
// 编辑营销活动
export async function updateMarketing(params) {
const res = await axios.post("/api/v1/marketing/background/update_marketing",params);
return res;
}
// 营销活动详情 // 营销活动详情
export async function marketingInfo(params) { export async function marketingInfo(params) {
const res = await axios.post("/api/v1/marketing/background/marketing_info",params); const res = await axios.post("/api/v1/marketing/background/marketing_info",params);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment