Commit 3c24eda0 authored by lihui's avatar lihui

feat: wancheng

parents 72816d1e f54d9ce0
...@@ -123,7 +123,6 @@ exports.updateActivity = async ctx => { ...@@ -123,7 +123,6 @@ exports.updateActivity = async ctx => {
body: ctx.request.body body: ctx.request.body
}; };
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
console.log(ctx.body);
}; };
// 查看活动订单 // 查看活动订单
...@@ -152,14 +151,12 @@ exports.checkActivityDetailInfo = async ctx => { ...@@ -152,14 +151,12 @@ exports.checkActivityDetailInfo = async ctx => {
// 获取自提点列表 // 获取自提点列表
exports.getPlaceList = async ctx => { exports.getPlaceList = async ctx => {
console.log("执行-------------------");
const url = `${ACTIVITY_URI}/marketing/background/take_place_list`; const url = `${ACTIVITY_URI}/marketing/background/take_place_list`;
const opts = { const opts = {
url, url,
method: "GET" method: "GET"
}; };
ctx.body = await req(ctx, opts); ctx.body = await req(ctx, opts);
console.log("lihui", ctx.body);
}; };
// 添加自提点 // 添加自提点
......
<template> <template>
<div class="infoEditing"> <div class="infoEditing">
<el-form <el-form ref="infoEditForm" :model="infoEditForm" label-width="80px">
ref="infoEditForm"
:model="infoEditForm"
:rules="rules"
label-width="80px"
>
<el-form-item label="标题:"> <el-form-item label="标题:">
<el-input v-model="infoEditForm.title" maxlength="30"></el-input> <el-input v-model="infoEditForm.title" maxlength="30"></el-input>
</el-form-item> </el-form-item>
...@@ -91,13 +86,11 @@ export default { ...@@ -91,13 +86,11 @@ export default {
// 获取营销活动详情 // 获取营销活动详情
marketingInfoMet() { marketingInfoMet() {
console.log("执行");
let marketingId = this.$route.query.marketing_id; let marketingId = this.$route.query.marketing_id;
if (marketingId == undefined) { if (marketingId == undefined) {
return; return;
} }
this.propData = JSON.parse(localStorage.getItem("propData")); this.propData = JSON.parse(localStorage.getItem("propData"));
console.log(localStorage.getItem("propData"));
this.infoEditForm.title = this.propData.marketing_name; this.infoEditForm.title = this.propData.marketing_name;
this.infoEditForm.desc = this.propData.pindan_desc; this.infoEditForm.desc = this.propData.pindan_desc;
for (var i in this.propData.pindan_pic_url) { for (var i in this.propData.pindan_pic_url) {
...@@ -107,16 +100,6 @@ export default { ...@@ -107,16 +100,6 @@ export default {
} }
} }
}, },
watch: {
editInfo: function(newVal) {
let marketingId = this.$route.query.marketing_id;
if (marketingId == undefined) {
return;
}
localStorage.setItem("propData", JSON.stringify(newVal));
}
},
created() { created() {
this.marketingInfoMet(); this.marketingInfoMet();
} }
......
...@@ -2,6 +2,19 @@ ...@@ -2,6 +2,19 @@
<div id="map" class="mapContainer"> <div id="map" class="mapContainer">
<!-- map --> <!-- map -->
<div class="mapWrapper"> <div class="mapWrapper">
<div class="search">
<el-form-item label-position="left">
<el-button @click="handleSearch">搜索</el-button>
<el-input
class="dialog-input"
v-model="searchKey"
placeholder="请输入关键字"
autocomplete="off"
></el-input>
</el-form-item>
<div id="js-result" v-show="searchKey" class="result"></div>
</div>
<div id="js-container" class="myMap"> <div id="js-container" class="myMap">
正在加载数据 ... 正在加载数据 ...
</div> </div>
...@@ -9,6 +22,11 @@ ...@@ -9,6 +22,11 @@
<!-- info --> <!-- info -->
<div class="mapInfo"> <div class="mapInfo">
<!-- <div class="search" v-if="placeSearch">
<input type="text" placeholder="请输入关键字" v-model="searchKey" />
<button type="button" @click="handleSearch">搜索</button>
<div id="js-result" v-show="searchKey" class="result"></div>
</div> -->
<h3 class="title">拖拽选址</h3> <h3 class="title">拖拽选址</h3>
<ul class="info"> <ul class="info">
<li><span>经度:</span>{{ dragData.lng }}</li> <li><span>经度:</span>{{ dragData.lng }}</li>
...@@ -26,6 +44,7 @@ export default { ...@@ -26,6 +44,7 @@ export default {
data() { data() {
return { return {
MapCityName: "北京", MapCityName: "北京",
searchKey: "",
dragData: { dragData: {
lng: null, lng: null,
lat: null, lat: null,
...@@ -37,6 +56,12 @@ export default { ...@@ -37,6 +56,12 @@ export default {
}; };
}, },
methods: { methods: {
// 搜索
handleSearch() {
if (this.searchKey) {
this.placeSearch.search(this.searchKey);
}
},
dragMap(data) { dragMap(data) {
this.dragData = { this.dragData = {
lng: data.position.lng, lng: data.position.lng,
...@@ -54,10 +79,11 @@ export default { ...@@ -54,10 +79,11 @@ export default {
// 加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分 // 加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分
let AMapUI = (this.AMapUI = window.AMapUI); let AMapUI = (this.AMapUI = window.AMapUI);
let AMap = (this.AMap = window.AMap); let AMap = (this.AMap = window.AMap);
AMapUI.loadUI(["misc/PositionPicker"], PositionPicker => { AMapUI.loadUI(["misc/PositionPicker"], PositionPicker => {
let mapConfig = { let mapConfig = {
zoom: 16, zoom: 16
cityName: this.MapCityName // cityName: this.MapCityName
}; };
if (this.lat && this.lng) { if (this.lat && this.lng) {
mapConfig.center = [this.lng, this.lat]; mapConfig.center = [this.lng, this.lat];
...@@ -70,7 +96,7 @@ export default { ...@@ -70,7 +96,7 @@ export default {
pageSize: 5, pageSize: 5,
pageIndex: 1, pageIndex: 1,
citylimit: true, citylimit: true,
city: this.MapCityName, // city: this.MapCityName,
map: map, map: map,
panel: "js-result" panel: "js-result"
}); });
...@@ -85,6 +111,36 @@ export default { ...@@ -85,6 +111,36 @@ export default {
); );
}); });
// 地图地图定位
AMap.plugin("AMap.Geolocation", function() {
var geolocation = new AMap.Geolocation({
// 是否使用高精度定位,默认:true
enableHighAccuracy: true,
// 设置定位超时时间,默认:无穷大
timeout: 10000,
// 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
buttonOffset: new AMap.Pixel(10, 20),
// 定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
zoomToAccuracy: true,
// 定位按钮的排放位置, RB表示右下
buttonPosition: "RB"
});
map.addControl(geolocation);
geolocation.getCurrentPosition();
AMap.event.addListener(geolocation, "complete", onComplete);
AMap.event.addListener(geolocation, "error", onError);
function onComplete(data) {
console.log(data);
// data是具体的定位信息
}
function onError(data) {
console.log(data);
// 定位出错
}
});
// 创建地图拖拽 // 创建地图拖拽
let positionPicker = new PositionPicker({ let positionPicker = new PositionPicker({
mode: "dragMap", // 设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap' mode: "dragMap", // 设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
...@@ -129,8 +185,18 @@ export default { ...@@ -129,8 +185,18 @@ export default {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
.mapWrapper { .mapWrapper {
position: relative;
width: 80%; width: 80%;
height: 100%; height: 100%;
.search {
position: absolute;
top: 10px;
left: 20px;
z-index: 100000;
.dialog-input {
width: 250px;
}
}
.myMap { .myMap {
height: 100%; height: 100%;
height: 500px; height: 500px;
...@@ -148,66 +214,80 @@ export default { ...@@ -148,66 +214,80 @@ export default {
} }
} }
} }
.m-map .search {
.g-wraper { position: absolute;
width: 1000px; top: 10px;
margin: 0 auto; left: 10px;
color: #666; width: 285px;
font-size: 16px; z-index: 1;
line-height: 30px;
}
.m-part {
margin-bottom: 30px;
}
.m-part::after {
content: "";
display: block;
clear: both;
}
.m-part .title {
font-size: 30px;
line-height: 60px;
margin-bottom: 10px;
color: #333;
}
.m-part .mapbox {
width: 600px;
height: 400px;
margin-bottom: 20px;
float: left;
} }
.m-part .info { .m-map .search input {
margin: 0; width: 180px;
padding: 0; border: 1px solid #ccc;
list-style: none; line-height: 20px;
line-height: 30px; padding: 5px;
margin-left: 620px; outline: none;
}
.m-part .info span {
display: block;
color: #999;
}
.m-part ol {
line-height: 40px;
margin-left: 0;
padding-left: 0;
}
.m-part pre {
padding: 10px 20px;
line-height: 30px;
border-radius: 3px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}
.m-footer {
background: #eee;
line-height: 60px;
text-align: center;
color: #999;
font-size: 12px;
}
.m-footer a {
margin: 0 5px;
color: #999;
text-decoration: none;
} }
// .g-wraper {
// width: 1000px;
// margin: 0 auto;
// color: #666;
// font-size: 16px;
// line-height: 30px;
// }
// .m-part {
// margin-bottom: 30px;
// }
// .m-part::after {
// content: "";
// display: block;
// clear: both;
// }
// .m-part .title {
// font-size: 30px;
// line-height: 60px;
// margin-bottom: 10px;
// color: #333;
// }
// .m-part .mapbox {
// width: 600px;
// height: 400px;
// margin-bottom: 20px;
// float: left;
// }
// .m-part .info {
// margin: 0;
// padding: 0;
// list-style: none;
// line-height: 30px;
// margin-left: 620px;
// }
// .m-part .info span {
// display: block;
// color: #999;
// }
// .m-part ol {
// line-height: 40px;
// margin-left: 0;
// padding-left: 0;
// }
// .m-part pre {
// padding: 10px 20px;
// line-height: 30px;
// border-radius: 3px;
// box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
// }
// .m-footer {
// background: #eee;
// line-height: 60px;
// text-align: center;
// color: #999;
// font-size: 12px;
// }
// .m-footer a {
// margin: 0 5px;
// color: #999;
// text-decoration: none;
// }
</style> </style>
...@@ -114,7 +114,6 @@ ...@@ -114,7 +114,6 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<!-- 分页 --> <!-- 分页 -->
<div class="pagination-wrapper"> <div class="pagination-wrapper">
<el-pagination <el-pagination
...@@ -239,7 +238,6 @@ let checkphone = (rule, value, callback) => { ...@@ -239,7 +238,6 @@ let checkphone = (rule, value, callback) => {
export default { export default {
data() { data() {
return { return {
testData: this.spellOrderSetArr,
startDate: "", //开始时间 startDate: "", //开始时间
endDate: "", // 结束时间 endDate: "", // 结束时间
pickerOptions: { pickerOptions: {
...@@ -287,12 +285,14 @@ export default { ...@@ -287,12 +285,14 @@ export default {
}, },
checkedNum: 0, // 勾选自提点数量 checkedNum: 0, // 勾选自提点数量
selfLiftingPoint: "", // 自提点搜索关键词 selfLiftingPoint: "", // 自提点搜索关键词
currentList: [],
offset: 0, // 偏移量 offset: 0, // 偏移量
limit: 500, // 每页条数 limit: 500, // 每页条数
page: 1, //当前页码 page: 1, //当前页码
id: "", // 删除自提点id id: "", // 删除自提点id
pageCount: 0, // 总条数 pageCount: 0, // 总条数
takePlacelist: [], // 自提点列表 takePlacelist: [], // 自提点列表
signal: false,
checkedTakePlacelist: [], // 已选择自提点列表 活动详情中添加的自提点列表 checkedTakePlacelist: [], // 已选择自提点列表 活动详情中添加的自提点列表
hasCheckedList: false, // 表示是否有选中的自提点列表 是编辑还是添加的区别 hasCheckedList: false, // 表示是否有选中的自提点列表 是编辑还是添加的区别
multipleSelection: [], multipleSelection: [],
...@@ -314,6 +314,14 @@ export default { ...@@ -314,6 +314,14 @@ export default {
spellOrderSetArr: { spellOrderSetArr: {
type: Array, type: Array,
default: () => [] default: () => []
},
startTime1: {
type: String,
default: ""
},
endTime1: {
type: String,
default: ""
} }
}, },
components: { components: {
...@@ -322,14 +330,31 @@ export default { ...@@ -322,14 +330,31 @@ export default {
watch: { watch: {
spellOrderSetArr: { spellOrderSetArr: {
// 监听props属性 展示自提点列表 // 监听props属性 展示自提点列表
handler: function() { handler: async function() {
// TO DO this.checkedTakePlacelist = this.setTableListData(
// let a = newVal; // 选中的自提点列表
// console.log("newVal:", newVal); this.spellOrderSetArr
// console.log("oldVal:", oldVal); );
if (this.$route.query.marketing_id) {
await this.getPlaceList();
// 时间赋值
this.startDate = this.startTime1;
this.endDate = this.endTime1;
this.checkedTakePlacelist = this.setTableListData(
this.spellOrderSetArr
); // 选中的自提点列表
this.currentList = this.checkedTakePlacelist.map(item => {
return item.id;
});
let list = this.takePlacelist.filter(item => {
return this.currentList.includes(item.id);
});
this.toggleSelection(list);
this.signal = true;
}
}, },
deep: true, deep: true
immediate: true // immediate: true
} }
}, },
methods: { methods: {
...@@ -348,6 +373,16 @@ export default { ...@@ -348,6 +373,16 @@ export default {
this.pageLoading = false; this.pageLoading = false;
this.takePlacelist = this.setTableListData(data.result.list); this.takePlacelist = this.setTableListData(data.result.list);
this.pageCount = data.result.total; this.pageCount = data.result.total;
if (this.signal === true) {
this.currentList = this.checkedTakePlacelist.map(item => {
return item.id;
});
let list = this.takePlacelist.filter(item => {
return this.currentList.includes(item.id);
});
this.toggleSelection(list);
}
} catch { } catch {
this.pageLoading = false; this.pageLoading = false;
ElMessage.error("加载失败"); ElMessage.error("加载失败");
...@@ -375,7 +410,6 @@ export default { ...@@ -375,7 +410,6 @@ export default {
let params = Object.assign(this.form, { let params = Object.assign(this.form, {
take_place_id: this.id //搜索关键词 take_place_id: this.id //搜索关键词
}); });
// console.log(this.form);
try { try {
this.pageLoading = true; this.pageLoading = true;
await ActivityService.addPlace(params); await ActivityService.addPlace(params);
...@@ -437,7 +471,6 @@ export default { ...@@ -437,7 +471,6 @@ export default {
}, },
// 复选框 // 复选框
handleSelectionChange(val) { handleSelectionChange(val) {
// console.log("lihui", val);
this.checkedNum = val.length; this.checkedNum = val.length;
this.multipleSelection = val; this.multipleSelection = val;
let takePlaceIds = ""; let takePlaceIds = "";
...@@ -452,7 +485,6 @@ export default { ...@@ -452,7 +485,6 @@ export default {
}, },
// 勾选某些列表的操作 // 勾选某些列表的操作
toggleSelection(rows) { toggleSelection(rows) {
//console.log("liuna", rows);
if (rows) { if (rows) {
rows.forEach(row => { rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row); this.$refs.multipleTable.toggleRowSelection(row);
...@@ -481,16 +513,10 @@ export default { ...@@ -481,16 +513,10 @@ export default {
} }
}, },
created() { created() {
if (this.$route.query.marketing_id) { if (!this.$route.query.marketing_id) {
// 此时需要两份数据对比
this.hasCheckedList = true;
// console.log(this.spellOrderSetArr);
this.checkedTakePlacelist = this.setTableListData(this.spellOrderSetArr); // 选中的自提点列表
console.log(this.checkedTakePlacelist);
this.toggleSelection(this.checkedTakePlacelist);
}
this.getPlaceList(); this.getPlaceList();
} }
}
}; };
</script> </script>
......
...@@ -27,7 +27,9 @@ ...@@ -27,7 +27,9 @@
<spellOrderSet <spellOrderSet
ref="spellOrderSet" ref="spellOrderSet"
v-show="active === 3" v-show="active === 3"
:spellOrderSet="spellOrderSetArr" :spellOrderSetArr="spellOrderSetArr"
:startTime1="startTime"
:endTime1="endTime"
@getTakeTakePlaceListFromChild="getTakeTakePlaceListFromChild" @getTakeTakePlaceListFromChild="getTakeTakePlaceListFromChild"
/> />
</div> </div>
...@@ -117,7 +119,10 @@ export default { ...@@ -117,7 +119,10 @@ export default {
const res = await marketingInfo(params); const res = await marketingInfo(params);
this.infoEditArr = res.result.marketing_info; this.infoEditArr = res.result.marketing_info;
this.addProducArr = res.result.goods_list; this.addProducArr = res.result.goods_list;
this.spellOrderSetArr = res.result.marketing_info; this.spellOrderSetArr = res.result.take_place;
this.startTime = res.result.marketing_info.start_time;
this.endTime = res.result.marketing_info.end_time;
localStorage.setItem("propData", JSON.stringify(this.infoEditArr));
}, },
// 取消 // 取消
......
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