Commit ceff8c49 authored by liwenhong's avatar liwenhong

fix:自提点地址+活动配置日期格式

parent dc24f027
...@@ -32,14 +32,20 @@ ...@@ -32,14 +32,20 @@
<el-button type="text" @click="handleActivityOnline(scope.row)"> <el-button type="text" @click="handleActivityOnline(scope.row)">
{{ scope.row.online_status == 1 ? "活动下线" : "活动上线" }} {{ scope.row.online_status == 1 ? "活动下线" : "活动上线" }}
</el-button> </el-button>
<el-button type="text" @click="handleConfig(scope.row)">活动配置</el-button> <el-button type="text" v-if="scope.row.marketing_type == 6" @click="handleConfig(scope.row)">活动配置</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog title="活动配置-团长分销" v-model="showConfigDialog" width="50%" top="2%" center> <el-dialog title="活动配置-团长分销" v-model="showConfigDialog" width="50%" top="2%" center>
<el-form :model="configForm" :rules="rules"> <el-form :model="configForm" :rules="rules">
<el-form-item label="设置时间:"> <el-form-item label="设置时间:">
<el-date-picker v-model="configForm.date" type="datetime" @change="timeChange" placeholder="请设置时间"></el-date-picker> <el-date-picker
v-model="configForm.date"
type="datetime"
@change="timeChange"
format="YYYY-MM-DD"
placeholder="请设置时间"
></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
class="config" class="config"
...@@ -198,7 +204,7 @@ ...@@ -198,7 +204,7 @@
}, },
async handleConfig(item) { async handleConfig(item) {
this.listParams.marketing_id = item.marketing_id; this.listParams.marketing_id = item.marketing_id;
let res = await yingxiaoConfig({ date: moment(new Date()).format("YYYY-MM-DD HH:mm:ss") }); let res = await yingxiaoConfig({ date: moment(new Date()).format("YYYY-MM-DD") });
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success("操作成功"); else this.$message.success("操作成功");
this.configForm = { this.configForm = {
...@@ -209,7 +215,7 @@ ...@@ -209,7 +215,7 @@
this.showConfigDialog = true; this.showConfigDialog = true;
}, },
async timeChange(val) { async timeChange(val) {
let res = await yingxiaoConfig({ date: moment(val).format("YYYY-MM-DD HH:mm:ss") }); let res = await yingxiaoConfig({ date: moment(val).format("YYYY-MM-DD") });
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
this.configForm = { this.configForm = {
result: res.result.list, result: res.result.list,
......
...@@ -42,19 +42,36 @@ ...@@ -42,19 +42,36 @@
</el-dialog> </el-dialog>
<el-dialog title="添加自提点" v-model="showAddPointDialog" width="50%" top="2%" inline> <el-dialog title="添加自提点" v-model="showAddPointDialog" width="50%" top="2%" inline>
<el-form :model="pointObj" :rules="rules"> <el-form :model="pointObj" :rules="rules">
<el-form-item label="联系人姓名"> <el-form-item label="联系人姓名" prop="contact_name">
<el-input maxlength="15" v-model="pointObj.contact_name" placeholder="请输入联系人姓名"></el-input> <el-input maxlength="15" v-model="pointObj.contact_name" placeholder="请输入联系人姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="联系人电话"> <el-form-item label="联系人电话" prop="phone">
<el-input v-model="pointObj.phone" placeholder="请输入联系人电话"></el-input> <el-input v-model="pointObj.phone" placeholder="请输入联系人电话"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="自提点名称"> <el-form-item label="自提点名称" prop="take_place_name">
<el-input v-model="pointObj.take_place_name" placeholder="请输入自提点名称"></el-input> <el-input v-model="pointObj.take_place_name" placeholder="请输入自提点名称"></el-input>
</el-form-item> </el-form-item>
<!-- <div id="js-container" class="myMap">正在加载数据 ...</div> --> <el-form-item>
<my-map class="my-map" @getMapInfo="getMapInfo" /> <div class="mapContainer">
<el-form-item label="详细地址"> <div class="search">
<el-input v-model="pointObj.location" placeholder="请输入自提点地址"></el-input> <el-form ref="form" @submit.prevent>
<el-form-item label-position="left">
<el-button @click="handleSearch">搜索</el-button>
<el-input class="dialog-input" v-model="searchKey" placeholder="请输入关键字" autocomplete="on">
<template #suffix>
<i @click="searchKey = ''" class="el-input__icon el-icon-close"></i>
</template>
</el-input>
</el-form-item>
</el-form>
<div id="js-result" v-show="searchKey" class="result"></div>
</div>
<div id="js-container" class="myMap">正在加载数据 ...</div>
</div>
</el-form-item>
<div>自提点地址: {{ pointObj.location }}</div>
<el-form-item label="详细地址" prop="address">
<el-input v-model="pointObj.address" placeholder="请输入自提点地址"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="自提点图片"> <el-form-item label="自提点图片">
<!-- <el-image <!-- <el-image
...@@ -113,7 +130,7 @@ ...@@ -113,7 +130,7 @@
</template> </template>
<script> <script>
import myMap from "@/pages/Activity/releaseProduc/components/myMap.vue"; // import myMap from "@/pages/Activity/releaseProduc/components/myMap.vue";
import Layout from "../../Groupmeal/layout/index.vue"; import Layout from "../../Groupmeal/layout/index.vue";
// import page from "@/components/Pagination"; // import page from "@/components/Pagination";
import { ColoneList, ColoneApplyList, colonelAudit, colonelApplyPoint, colonelAddApplyPoint } from "@/service/Goods/goods"; import { ColoneList, ColoneApplyList, colonelAudit, colonelApplyPoint, colonelAddApplyPoint } from "@/service/Goods/goods";
...@@ -123,11 +140,12 @@ ...@@ -123,11 +140,12 @@
name: "MarketingCenter", name: "MarketingCenter",
components: { components: {
Layout, Layout,
myMap, // myMap,
// page, // page,
}, },
data() { data() {
return { return {
searchKey: "",
coloneList: [], coloneList: [],
coloneApplyList: [], coloneApplyList: [],
params: { params: {
...@@ -135,15 +153,17 @@ ...@@ -135,15 +153,17 @@
page_size: 20, page_size: 20,
}, },
applyPopTitle: "", applyPopTitle: "",
pointObj: {}, pointObj: {
location: "",
},
showAddPointDialog: false, showAddPointDialog: false,
fileList: [], fileList: [],
uploadUrl: `${GOODS_URI}/ksy/ks3apiunencrypt/ks3api_upload`, // 金山云上传地址 uploadUrl: `${GOODS_URI}/ksy/ks3apiunencrypt/ks3api_upload`, // 金山云上传地址
pickStation: {},
dialogFormVisible: false, dialogFormVisible: false,
applyItem: {}, applyItem: {},
rules: { rules: {
take_place_name: [{ required: true, message: "请输入详细地址", trigger: "change" }], take_place_name: [{ required: true, message: "请输入自提点名称", trigger: "change" }],
address: [{ required: true, message: "请输入详细地址", trigger: "change" }],
}, },
}; };
}, },
...@@ -152,6 +172,11 @@ ...@@ -152,6 +172,11 @@
await this.getColoneApplyList(); await this.getColoneApplyList();
}, },
methods: { methods: {
handleSearch() {
if (this.searchKey) {
this.placeSearch.search(this.searchKey);
}
},
handleApplyItem(item) { handleApplyItem(item) {
this.applyItem = item; this.applyItem = item;
this.dialogFormVisible = true; this.dialogFormVisible = true;
...@@ -161,7 +186,7 @@ ...@@ -161,7 +186,7 @@
}, },
async comLibrarySave() { async comLibrarySave() {
let res = await colonelAddApplyPoint(this.pointObj); let res = await colonelAddApplyPoint(this.pointObj);
this.showAddPointDialog = false; // this.showAddPointDialog = false;
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
else return this.$message.success("添加成功"); else return this.$message.success("添加成功");
}, },
...@@ -179,7 +204,7 @@ ...@@ -179,7 +204,7 @@
let res = await colonelApplyPoint({ colonel_apply_id: id }); let res = await colonelApplyPoint({ colonel_apply_id: id });
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
this.pointObj = res.result; this.pointObj = res.result;
this.pickStation = `${this.pointObj.province}-${this.pointObj.city}-${this.pointObj.area}`; await this.initMap();
this.pointObj.take_place_pic && (this.fileList[0] = this.pointObj.take_place_pic); this.pointObj.take_place_pic && (this.fileList[0] = this.pointObj.take_place_pic);
this.showAddPointDialog = true; this.showAddPointDialog = true;
}, },
...@@ -201,10 +226,111 @@ ...@@ -201,10 +226,111 @@
console.error(error); console.error(error);
} }
}, },
initMap() {
// 加载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
};
if (this.lat && this.lng) {
mapConfig.center = [this.lng, this.lat];
}
let map = new AMap.Map("js-container", mapConfig);
let _this = this;
// 加载地图搜索插件
AMap.service("AMap.PlaceSearch", () => {
_this.placeSearch = new AMap.PlaceSearch({
pageSize: 5,
pageIndex: 1,
citylimit: true,
// city: this.MapCityName,
map: map,
panel: "js-result",
});
_this.placeSearch.on("selectChanged", function ({ selected }) {
console.log(selected);
const { address, location, pname, cityname, adname } = selected.data;
_this.pointObj.location = pname + cityname + adname + address;
_this.dragData = {
lng: location.lng,
lat: location.lat,
address: address,
province: pname,
city: cityname,
area: adname,
};
_this.getMapInfo(_this.dragData);
_this.searchKey = "";
});
});
// 启用工具条
AMap.plugin(["AMap.ToolBar"], function () {
map.addControl(
new AMap.ToolBar({
position: "RB",
}),
);
});
// 地图地图定位
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'
// map: map, // 依赖地图对象
// iconStyle: {
// //自定义外观
// url: "//webapi.amap.com/ui/1.0/assets/position-picker2.png", //图片地址
// size: [50, 50], //要显示的点大小,将缩放图片
// ancher: [24, 40], //锚点的位置,即被size缩放之后,图片的什么位置作为选中的位置
// },
// });
// // 拖拽完成发送自定义 drag 事件
// positionPicker.on("success", (positionResult) => {
// this.dragMap(positionResult);
// });
// // 启动拖放
// positionPicker.start();
});
},
getMapInfo(mapInfo) { getMapInfo(mapInfo) {
console.log("mapInfo", mapInfo); console.log("mapInfo", mapInfo);
this.pointObj.address = mapInfo.address; this.pointObj.address = mapInfo.address;
this.pointObj.location = mapInfo.location;
this.pointObj.province = mapInfo.province; this.pointObj.province = mapInfo.province;
this.pointObj.city = mapInfo.city; this.pointObj.city = mapInfo.city;
this.pointObj.area = mapInfo.area; this.pointObj.area = mapInfo.area;
...@@ -223,8 +349,36 @@ ...@@ -223,8 +349,36 @@
padding: 10px; padding: 10px;
} }
} }
.myMap { .mapContainer {
position: relative;
width: 100%; width: 100%;
height: 200px; height: 300px;
.search {
position: absolute;
top: 10px;
left: 20px;
z-index: 100000;
.dialog-input {
width: 250px;
}
}
.myMap {
height: 100%;
height: 100%;
}
}
.m-map .search {
position: absolute;
top: 10px;
left: 10px;
width: 285px;
z-index: 1;
}
.m-map .search input {
width: 180px;
border: 1px solid #ccc;
line-height: 20px;
padding: 5px;
outline: none;
} }
</style> </style>
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