Commit 3c24eda0 authored by lihui's avatar lihui

feat: wancheng

parents 72816d1e f54d9ce0
......@@ -123,7 +123,6 @@ exports.updateActivity = async ctx => {
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
console.log(ctx.body);
};
// 查看活动订单
......@@ -152,14 +151,12 @@ exports.checkActivityDetailInfo = async ctx => {
// 获取自提点列表
exports.getPlaceList = async ctx => {
console.log("执行-------------------");
const url = `${ACTIVITY_URI}/marketing/background/take_place_list`;
const opts = {
url,
method: "GET"
};
ctx.body = await req(ctx, opts);
console.log("lihui", ctx.body);
};
// 添加自提点
......
<template>
<div class="infoEditing">
<el-form
ref="infoEditForm"
:model="infoEditForm"
:rules="rules"
label-width="80px"
>
<el-form ref="infoEditForm" :model="infoEditForm" label-width="80px">
<el-form-item label="标题:">
<el-input v-model="infoEditForm.title" maxlength="30"></el-input>
</el-form-item>
......@@ -91,13 +86,11 @@ export default {
// 获取营销活动详情
marketingInfoMet() {
console.log("执行");
let marketingId = this.$route.query.marketing_id;
if (marketingId == undefined) {
return;
}
this.propData = JSON.parse(localStorage.getItem("propData"));
console.log(localStorage.getItem("propData"));
this.infoEditForm.title = this.propData.marketing_name;
this.infoEditForm.desc = this.propData.pindan_desc;
for (var i in this.propData.pindan_pic_url) {
......@@ -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() {
this.marketingInfoMet();
}
......
......@@ -2,6 +2,19 @@
<div id="map" class="mapContainer">
<!-- map -->
<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>
......@@ -9,6 +22,11 @@
<!-- info -->
<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>
<ul class="info">
<li><span>经度:</span>{{ dragData.lng }}</li>
......@@ -26,6 +44,7 @@ export default {
data() {
return {
MapCityName: "北京",
searchKey: "",
dragData: {
lng: null,
lat: null,
......@@ -37,6 +56,12 @@ export default {
};
},
methods: {
// 搜索
handleSearch() {
if (this.searchKey) {
this.placeSearch.search(this.searchKey);
}
},
dragMap(data) {
this.dragData = {
lng: data.position.lng,
......@@ -54,10 +79,11 @@ export default {
// 加载PositionPicker,loadUI的路径参数为模块名中 'ui/' 之后的部分
let AMapUI = (this.AMapUI = window.AMapUI);
let AMap = (this.AMap = window.AMap);
AMapUI.loadUI(["misc/PositionPicker"], PositionPicker => {
let mapConfig = {
zoom: 16,
cityName: this.MapCityName
zoom: 16
// cityName: this.MapCityName
};
if (this.lat && this.lng) {
mapConfig.center = [this.lng, this.lat];
......@@ -70,7 +96,7 @@ export default {
pageSize: 5,
pageIndex: 1,
citylimit: true,
city: this.MapCityName,
// city: this.MapCityName,
map: map,
panel: "js-result"
});
......@@ -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({
mode: "dragMap", // 设定为拖拽地图模式,可选'dragMap'、'dragMarker',默认为'dragMap'
......@@ -129,8 +185,18 @@ export default {
display: flex;
flex-direction: row;
.mapWrapper {
position: relative;
width: 80%;
height: 100%;
.search {
position: absolute;
top: 10px;
left: 20px;
z-index: 100000;
.dialog-input {
width: 250px;
}
}
.myMap {
height: 100%;
height: 500px;
......@@ -148,66 +214,80 @@ export default {
}
}
}
.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-map .search {
position: absolute;
top: 10px;
left: 10px;
width: 285px;
z-index: 1;
}
.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;
.m-map .search input {
width: 180px;
border: 1px solid #ccc;
line-height: 20px;
padding: 5px;
outline: 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>
......@@ -114,7 +114,6 @@
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<div class="pagination-wrapper">
<el-pagination
......@@ -239,7 +238,6 @@ let checkphone = (rule, value, callback) => {
export default {
data() {
return {
testData: this.spellOrderSetArr,
startDate: "", //开始时间
endDate: "", // 结束时间
pickerOptions: {
......@@ -287,12 +285,14 @@ export default {
},
checkedNum: 0, // 勾选自提点数量
selfLiftingPoint: "", // 自提点搜索关键词
currentList: [],
offset: 0, // 偏移量
limit: 500, // 每页条数
page: 1, //当前页码
id: "", // 删除自提点id
pageCount: 0, // 总条数
takePlacelist: [], // 自提点列表
signal: false,
checkedTakePlacelist: [], // 已选择自提点列表 活动详情中添加的自提点列表
hasCheckedList: false, // 表示是否有选中的自提点列表 是编辑还是添加的区别
multipleSelection: [],
......@@ -314,6 +314,14 @@ export default {
spellOrderSetArr: {
type: Array,
default: () => []
},
startTime1: {
type: String,
default: ""
},
endTime1: {
type: String,
default: ""
}
},
components: {
......@@ -322,14 +330,31 @@ export default {
watch: {
spellOrderSetArr: {
// 监听props属性 展示自提点列表
handler: function() {
// TO DO
// let a = newVal;
// console.log("newVal:", newVal);
// console.log("oldVal:", oldVal);
handler: async function() {
this.checkedTakePlacelist = this.setTableListData(
// 选中的自提点列表
this.spellOrderSetArr
);
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,
immediate: true
deep: true
// immediate: true
}
},
methods: {
......@@ -348,6 +373,16 @@ export default {
this.pageLoading = false;
this.takePlacelist = this.setTableListData(data.result.list);
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 {
this.pageLoading = false;
ElMessage.error("加载失败");
......@@ -375,7 +410,6 @@ export default {
let params = Object.assign(this.form, {
take_place_id: this.id //搜索关键词
});
// console.log(this.form);
try {
this.pageLoading = true;
await ActivityService.addPlace(params);
......@@ -437,7 +471,6 @@ export default {
},
// 复选框
handleSelectionChange(val) {
// console.log("lihui", val);
this.checkedNum = val.length;
this.multipleSelection = val;
let takePlaceIds = "";
......@@ -452,7 +485,6 @@ export default {
},
// 勾选某些列表的操作
toggleSelection(rows) {
//console.log("liuna", rows);
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
......@@ -481,15 +513,9 @@ export default {
}
},
created() {
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);
if (!this.$route.query.marketing_id) {
this.getPlaceList();
}
this.getPlaceList();
}
};
</script>
......
......@@ -27,7 +27,9 @@
<spellOrderSet
ref="spellOrderSet"
v-show="active === 3"
:spellOrderSet="spellOrderSetArr"
:spellOrderSetArr="spellOrderSetArr"
:startTime1="startTime"
:endTime1="endTime"
@getTakeTakePlaceListFromChild="getTakeTakePlaceListFromChild"
/>
</div>
......@@ -117,7 +119,10 @@ export default {
const res = await marketingInfo(params);
this.infoEditArr = res.result.marketing_info;
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