Commit dc24f027 authored by liwenhong's avatar liwenhong

fix: 配置商品回显

parent 9c37bb18
...@@ -444,14 +444,207 @@ ...@@ -444,14 +444,207 @@
<style lang="less" scoped> <style lang="less" scoped>
.spell_order_set_wrapper { .spell_order_set_wrapper {
//text-align: center; .spell_order_set_wrapper {
// 时间选择 //text-align: center;
// 时间选择
.datepickerWrapper {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
.demonstration {
margin: 20px;
}
/deep/ .start_time_picker {
margin: 20px;
}
/deep/ .end_time_picker {
margin: 20px;
}
}
.add_takePlace_dialog {
.location_wrapper {
/deep/ .el-form-item__content {
width: calc(100% - 120px);
display: inline-flex;
flex-wrap: wrap;
}
.location_input_wrapper {
width: 60%;
min-width: 178px;
}
.location_text_wrapper {
width: 40%;
}
}
}
//添加自提点dialog
@media screen and (max-width: 800px) {
/deep/ .add_takePlace_dialog {
width: 100% !important;
}
}
}
.card-wrapper {
width: 100%;
.search_form_wrapper {
text-align: center;
.title {
height: 50px;
line-height: 30px;
}
}
// table 自提点表格
.tabla-wrapper {
> p {
margin-left: 10px;
text-align: left;
}
.tableList {
height: 600px;
.delete_button {
margin: 0;
}
}
}
}
.pagination-wrapper {
height: 60px;
display: flex;
justify-content: center;
align-items: center;
}
.tabList {
margin-top: 10px;
}
.location {
margin-bottom: 10px;
margin-left: 14%;
}
.dialog-footer {
display: flex;
justify-content: center;
align-items: center;
}
/deep/ .el-dialog__body {
height: 85% !important;
}
/deep/ .mapDialog {
margin-top: 10vh !important;
height: 80%;
display: flex !important;
flex-direction: column !important;
/deep/ .el-dialog__body {
height: 90%;
}
}
.spell_order_set_wrapper {
//text-align: center;
// 时间选择
.datepickerWrapper {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
.demonstration {
margin: 20px;
}
/deep/ .start_time_picker {
margin: 20px;
}
/deep/ .end_time_picker {
margin: 20px;
}
}
.add_takePlace_dialog {
.location_wrapper {
/deep/ .el-form-item__content {
width: calc(100% - 120px);
display: inline-flex;
flex-wrap: wrap;
}
.location_input_wrapper {
width: 60%;
min-width: 178px;
}
.location_text_wrapper {
width: 40%;
}
}
}
//添加自提点dialog
@media screen and (max-width: 800px) {
/deep/ .add_takePlace_dialog {
width: 100% !important;
}
}
}
.card-wrapper {
width: 100%;
.search_form_wrapper {
text-align: center;
.title {
height: 50px;
line-height: 30px;
}
}
// table 自提点表格
.tabla-wrapper {
> p {
margin-left: 10px;
text-align: left;
}
.tableList {
height: 600px;
.delete_button {
margin: 0;
}
}
}
}
.pagination-wrapper {
height: 60px;
display: flex;
justify-content: center;
align-items: center;
}
.tabList {
margin-top: 10px;
}
.location {
margin-bottom: 10px;
margin-left: 14%;
}
.dialog-footer {
display: flex;
justify-content: center;
align-items: center;
}
/deep/ .el-dialog__body {
height: 85% !important;
}
/deep/ .mapDialog {
margin-top: 10vh !important;
height: 80%;
display: flex !important;
flex-direction: column !important;
/deep/ .el-dialog__body {
height: 90%;
}
}
.datepickerWrapper { .datepickerWrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
.demonstration { .demonstration {
margin: 20px; margin: 20px;
} }
...@@ -469,7 +662,6 @@ ...@@ -469,7 +662,6 @@
display: inline-flex; display: inline-flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.location_input_wrapper { .location_input_wrapper {
width: 60%; width: 60%;
min-width: 178px; min-width: 178px;
...@@ -479,8 +671,104 @@ ...@@ -479,8 +671,104 @@
} }
} }
} }
.spell_order_set_wrapper {
//text-align: center;
// 时间选择
.datepickerWrapper {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
.demonstration {
margin: 20px;
}
/deep/ .start_time_picker {
margin: 20px;
}
/deep/ .end_time_picker {
margin: 20px;
}
}
.add_takePlace_dialog {
.location_wrapper {
/deep/ .el-form-item__content {
width: calc(100% - 120px);
display: inline-flex;
flex-wrap: wrap;
}
.location_input_wrapper {
width: 60%;
min-width: 178px;
}
.location_text_wrapper {
width: 40%;
}
}
}
//添加自提点dialog
@media screen and (max-width: 800px) {
/deep/ .add_takePlace_dialog {
width: 100% !important;
}
}
}
.card-wrapper {
width: 100%;
.search_form_wrapper {
text-align: center;
.title {
height: 50px;
line-height: 30px;
}
}
// table 自提点表格
.tabla-wrapper {
> p {
margin-left: 10px;
text-align: left;
}
.tableList {
height: 600px;
.delete_button {
margin: 0;
}
}
}
}
.pagination-wrapper {
height: 60px;
display: flex;
justify-content: center;
align-items: center;
}
//添加自提点dialog .tabList {
margin-top: 10px;
}
.location {
margin-bottom: 10px;
margin-left: 14%;
}
.dialog-footer {
display: flex;
justify-content: center;
align-items: center;
}
/deep/ .el-dialog__body {
height: 85% !important;
}
/deep/ .mapDialog {
margin-top: 10vh !important;
height: 80%;
display: flex !important;
flex-direction: column !important;
/deep/ .el-dialog__body {
height: 90%;
}
}
@media screen and (max-width: 800px) { @media screen and (max-width: 800px) {
/deep/ .add_takePlace_dialog { /deep/ .add_takePlace_dialog {
width: 100% !important; width: 100% !important;
...@@ -496,7 +784,104 @@ ...@@ -496,7 +784,104 @@
line-height: 30px; line-height: 30px;
} }
} }
// table 自提点表格 .spell_order_set_wrapper {
//text-align: center;
// 时间选择
.datepickerWrapper {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
.demonstration {
margin: 20px;
}
/deep/ .start_time_picker {
margin: 20px;
}
/deep/ .end_time_picker {
margin: 20px;
}
}
.add_takePlace_dialog {
.location_wrapper {
/deep/ .el-form-item__content {
width: calc(100% - 120px);
display: inline-flex;
flex-wrap: wrap;
}
.location_input_wrapper {
width: 60%;
min-width: 178px;
}
.location_text_wrapper {
width: 40%;
}
}
}
//添加自提点dialog
@media screen and (max-width: 800px) {
/deep/ .add_takePlace_dialog {
width: 100% !important;
}
}
}
.card-wrapper {
width: 100%;
.search_form_wrapper {
text-align: center;
.title {
height: 50px;
line-height: 30px;
}
}
// table 自提点表格
.tabla-wrapper {
> p {
margin-left: 10px;
text-align: left;
}
.tableList {
height: 600px;
.delete_button {
margin: 0;
}
}
}
}
.pagination-wrapper {
height: 60px;
display: flex;
justify-content: center;
align-items: center;
}
.tabList {
margin-top: 10px;
}
.location {
margin-bottom: 10px;
margin-left: 14%;
}
.dialog-footer {
display: flex;
justify-content: center;
align-items: center;
}
/deep/ .el-dialog__body {
height: 85% !important;
}
/deep/ .mapDialog {
margin-top: 10vh !important;
height: 80%;
display: flex !important;
flex-direction: column !important;
/deep/ .el-dialog__body {
height: 90%;
}
}
.tabla-wrapper { .tabla-wrapper {
> p { > p {
margin-left: 10px; margin-left: 10px;
...@@ -516,7 +901,6 @@ ...@@ -516,7 +901,6 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.tabList { .tabList {
margin-top: 10px; margin-top: 10px;
} }
......
<template> <template>
<layout> <layout>
<div class="marketing"> <div class="marketing">
<!-- 表头 --> <!-- 表头 -->
<div class="header"> <div class="header">
<h2>账户信息</h2> <h2>账户信息</h2>
</div> </div>
<!-- 列表区 --> <!-- 列表区 -->
<el-table class="goods_list" :data="anlysis" border stripe> <el-table class="goods_list" :data="anlysis" border stripe>
<el-table-column <el-table-column prop="title" align="center"></el-table-column>
prop="title" <el-table-column prop="total" align="center"></el-table-column>
align="center" <el-table-column prop="explain" align="center"></el-table-column>
></el-table-column> </el-table>
<el-table-column </div>
prop="total" <div class="marketing">
align="center" <!-- 表头 -->
></el-table-column> <div class="header">
<el-table-column <h2>活动列表</h2>
prop="explain" </div>
align="center" <!-- 列表区 -->
></el-table-column> <el-table class="goods_list" :data="activityList" border stripe>
</el-table> <el-table-column label="活动名称" prop="marketing_name" align="center"></el-table-column>
</div> <el-table-column label="预算" prop="capital_pool.capital_pool_total" align="center"></el-table-column>
<div class="marketing"> <el-table-column label="已消耗" prop="capital_pool.capital_pool_used" align="center"></el-table-column>
<!-- 表头 --> <el-table-column label="已占用" prop="capital_pool.capital_pool_lock" align="center"></el-table-column>
<div class="header"> <el-table-column label="状态" prop="online_status_desc" align="center"></el-table-column>
<h2>活动列表</h2> <!-- 操作快捷键 -->
</div> <el-table-column label="操作" align="center" fixed="right" width="200">
<!-- 列表区 --> <template #default="scope">
<el-table class="goods_list" :data="activityList" border stripe> <el-button @click.stop="handleAddAmount(scope.row)" type="text">充值</el-button>
<el-table-column <!-- <el-button>预算分配</el-button> -->
label="活动名称" <el-button type="text" @click="handleActivityOnline(scope.row)">
prop="marketing_name" {{ scope.row.online_status == 1 ? "活动下线" : "活动上线" }}
align="center" </el-button>
></el-table-column> <el-button type="text" @click="handleConfig(scope.row)">活动配置</el-button>
<el-table-column </template>
label="预算" </el-table-column>
prop="capital_pool.capital_pool_total" </el-table>
align="center" <el-dialog title="活动配置-团长分销" v-model="showConfigDialog" width="50%" top="2%" center>
></el-table-column> <el-form :model="configForm" :rules="rules">
<el-table-column <el-form-item label="设置时间:">
label="已消耗" <el-date-picker v-model="configForm.date" type="datetime" @change="timeChange" placeholder="请设置时间"></el-date-picker>
prop="capital_pool.capital_pool_used" </el-form-item>
align="center" <el-form-item
></el-table-column> class="config"
<el-table-column v-for="(config, index) in configForm.result"
label="已占用" :key="config.key"
prop="capital_pool.capital_pool_lock" :rules="{
align="center" required: true,
></el-table-column> message: '不能为空',
<el-table-column trigger: 'blur',
label="状态" }"
prop="online_status_desc" >
align="center" <h4>档位{{ index + 1 }}</h4>
></el-table-column> <div class="form-item">
<!-- 操作快捷键 --> <span>设置考核单量:</span>
<el-table-column label="操作" align="center" fixed="right" width="200"> <el-input size="mini" v-model="config.assess_order_num"></el-input>
<template #default="scope"> </div>
<el-button @click.stop="handleAddAmount(scope.row)" type="text">充值</el-button> <div class="form-item">
<!-- <el-button>预算分配</el-button> --> <span>设置奖励金额:</span>
<el-button type="text" @click="handleActivityOnline(scope.row)">{{scope.row.online_status==1?'活动下线':'活动上线'}}</el-button> <el-input size="mini" v-model="config.reward_amount"></el-input>
<el-button type="text" @click="handleConfig(scope.row)">活动配置</el-button> <el-icon class="el-icon-delete" @click.prevent="removeDomain(config)"><delete /></el-icon>
</div>
</template> </el-form-item>
</el-table-column> <el-form-item>
</el-table> <el-button @click="addDomain">新增档位</el-button>
<el-dialog </el-form-item>
title="活动配置-团长分销" </el-form>
v-model="showConfigDialog" <template #footer>
width="50%" <span class="dialog-footer">
top="2%" <el-button @click="showConfigDialog = false">取 消</el-button>
center <el-button type="primary" @click="handleSaveConfig">确认</el-button>
> </span>
<el-form :model="configForm" :rules="rules"> </template>
<el-form-item label="设置时间:"> </el-dialog>
<el-date-picker </div>
v-model="configForm.date" </layout>
type="datetime"
@change="expirDateChange"
placeholder="请设置时间"
>
</el-date-picker>
</el-form-item>
<el-form-item
class="config"
v-for="(config, index) in configForm.result"
:key="config.key"
:rules="{
required: true, message: '不能为空', trigger: 'blur'
}"
>
<h4>档位{{index + 1}}</h4>
<div class="form-item"><span>设置考核单量: </span><el-input size="mini" v-model="config.assess_order_num"></el-input></div>
<div class="form-item"><span>设置奖励金额: </span><el-input size="mini" v-model="config.reward_amount"></el-input><el-icon class="el-icon-delete" @click.prevent="removeDomain(config)"><delete /></el-icon></div>
</el-form-item>
<el-form-item>
<el-button @click="addDomain">新增档位</el-button>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showConfigDialog = false">取 消</el-button>
<el-button type="primary" @click="handleSaveConfig">确认</el-button>
</span>
</template>
</el-dialog>
</div>
</layout>
</template> </template>
<script> <script>
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 { import { yingxiaoList, addAmount, toogleYingxiaoOnlineStatus, yingxiaoConfig, yingxiaoSaveConfig } from "@/service/Goods/goods";
yingxiaoList, import moment from "moment";
addAmount, // import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no";
toogleYingxiaoOnlineStatus, export default {
yingxiaoConfig, name: "MarketingCenter",
yingxiaoSaveConfig components: {
} from "@/service/Goods/goods"; Layout,
// page,
// import { getLifeNoList as reqGetLifeNoList } from "../../service/life-no"; },
export default { data() {
name: "MarketingCenter", return {
components: { rules: {
Layout, date: [
page {
}, required: true,
data () { message: "时间不能为空",
return { trigger: "blur",
rules: { },
date: [ {
{ required: true, message: "时间不能为空", trigger: "blur" }, min: 0,
{ min: 0, max: 30, message: "长度在 0 到 30 个字符", trigger: "blur" } max: 30,
], message: "长度在 0 到 30 个字符",
}, trigger: "blur",
activityList: [], },
configForm: { ],
date: '', },
result: [] activityList: [],
}, configForm: {
anlysis: [{ date: "",
title: '营销账户预算', result: [],
explain: '运营申请的用户业务增长的营销总预算', },
total: '' anlysis: [
},{ {
title: '已消耗(T+1更新)', title: "营销账户预算",
explain: '目前已经确认消耗的营销预算', explain: "运营申请的用户业务增长的营销总预算",
total: '' total: "",
},{ },
title: '已占用(每10分钟更新)', {
explain: '分享裂变活动中派发出的有效优惠券的总额', title: "已消耗(T+1更新)",
total: '' explain: "目前已经确认消耗的营销预算",
},{ total: "",
title: '可用余额', },
explain: '目前平台可使用的余额', {
total: '' title: "已占用(每10分钟更新)",
}], explain: "分享裂变活动中派发出的有效优惠券的总额",
anlysisObj: {}, total: "",
params: { },
page: 1, {
page_size: 20, title: "可用余额",
}, explain: "目前平台可使用的余额",
showConfigDialog: false, total: "",
listParams: { },
marketing_id: '', ],
date: '', anlysisObj: {},
config: [] params: {
} page: 1,
} page_size: 20,
}, },
created () { showConfigDialog: false,
this.getMarketingActivityList() listParams: {
}, marketing_id: "",
methods: { date: "",
async getMarketingActivityList() { config: [],
const res = await yingxiaoList(); },
if (res.code !== 0) return this.$message.error(res.reason); };
this.activityList = res.result.list; },
this.anlysisObj = res.result.anlysis; created() {
let list = []; this.getMarketingActivityList();
for(let k in this.anlysisObj) { },
list.push(this.anlysisObj[k]) methods: {
} async getMarketingActivityList() {
this.anlysis.map((item, index) => item.total = list[index]) const res = await yingxiaoList();
}, if (res.code !== 0) return this.$message.error(res.reason);
handleActivityOnline(item) { this.activityList = res.result.list;
this.$confirm(`您确定要${item.online_status == 1?'下线':'上线'}${item.marketing_name}吗`, `活动${item.online_status == 1?'下线':'上线'}`, { this.anlysisObj = res.result.anlysis;
confirmButtonText: '确定', let list = [];
cancelButtonText: '取消', for (let k in this.anlysisObj) {
center: true list.push(this.anlysisObj[k]);
}).then(async () => { }
let res = await toogleYingxiaoOnlineStatus({marketing_id: item.marketing_id, online_status: item.online_status == 1?2:1}) //1上线 2下线 this.anlysis.map((item, index) => (item.total = list[index]));
this.getMarketingActivityList() },
if (res.code !== 0) return this.$message.error(res.reason); handleActivityOnline(item) {
else this.$message.success('操作成功'); this.$confirm(
}) `您确定要${item.online_status == 1 ? "下线" : "上线"}${item.marketing_name}吗`,
}, `活动${item.online_status == 1 ? "下线" : "上线"}`,
async handleAddAmount(item) { {
this.$prompt(`当前账户预算:${this.anlysisObj.total} \n 当前账户可用余额:${this.anlysisObj.balance}`, '充值', { confirmButtonText: "确定",
confirmButtonText: '确定', cancelButtonText: "取消",
cancelButtonText: '取消', center: true,
inputLabel: '输入调整后的账户总预算', },
inputPattern: /\d{1,5}/, ).then(async () => {
inputErrorMessage: '格式不正确' let res = await toogleYingxiaoOnlineStatus({
}).then(async ({ value }) => { marketing_id: item.marketing_id,
let res = await addAmount({capital_pool_id: item.capital_pool_id, amount: value}) online_status: item.online_status == 1 ? 2 : 1,
if (res.code !== 0) return this.$message.error(res.reason); }); //1上线 2下线
else this.$message.success('充值成功'); this.getMarketingActivityList();
}) if (res.code !== 0) return this.$message.error(res.reason);
}, else this.$message.success("操作成功");
async handleConfig(item) { });
this.listParams.marketing_id = item.marketing_id; },
let res = await yingxiaoConfig({date: new Date()}) async handleAddAmount(item) {
if (res.code !== 0) return this.$message.error(res.reason); this.$prompt(`当前账户预算:${this.anlysisObj.total} \n 当前账户可用余额:${this.anlysisObj.balance}`, "充值", {
else this.$message.success('操作成功'); confirmButtonText: "确定",
this.configForm = {result: res.result.list, date: res.result.date}; cancelButtonText: "取消",
console.log('this.configForm',this.configForm) inputLabel: "输入调整后的账户总预算",
this.showConfigDialog = true inputPattern: /\d{1,5}/,
}, inputErrorMessage: "格式不正确",
removeDomain(item) { }).then(async ({ value }) => {
var index = this.configForm.result.indexOf(item) let res = await addAmount({
if (index !== -1) { capital_pool_id: item.capital_pool_id,
this.configForm.result.splice(index, 1) amount: value,
} });
}, if (res.code !== 0) return this.$message.error(res.reason);
addDomain() { else this.$message.success("充值成功");
this.configForm.result.push({}); });
}, },
async handleSaveConfig() { async handleConfig(item) {
this.configForm.result.map((item, index) => item.level = index+1) this.listParams.marketing_id = item.marketing_id;
this.listParams.config = JSON.stringify(this.configForm.result); let res = await yingxiaoConfig({ date: moment(new Date()).format("YYYY-MM-DD HH:mm:ss") });
this.listParams.date = this.configForm.date; if (res.code !== 0) return this.$message.error(res.reason);
let res = await yingxiaoSaveConfig(this.listParams) else this.$message.success("操作成功");
if (res.code !== 0) return this.$message.error(res.reason); this.configForm = {
else this.$message.success('设置成功'); result: res.result.list,
this.showConfigDialog = false date: res.result.date,
} };
} console.log("this.configForm", this.configForm);
} this.showConfigDialog = true;
},
async timeChange(val) {
let res = await yingxiaoConfig({ date: moment(val).format("YYYY-MM-DD HH:mm:ss") });
if (res.code !== 0) return this.$message.error(res.reason);
this.configForm = {
result: res.result.list,
date: res.result.date,
};
},
removeDomain(item) {
var index = this.configForm.result.indexOf(item);
if (index !== -1) {
this.configForm.result.splice(index, 1);
}
},
addDomain() {
this.configForm.result.push({});
},
async handleSaveConfig() {
this.configForm.result.map((item, index) => (item.level = index + 1));
this.listParams.config = JSON.stringify(this.configForm.result);
this.listParams.date = this.configForm.date;
let res = await yingxiaoSaveConfig(this.listParams);
if (res.code !== 0) return this.$message.error(res.reason);
else this.$message.success("设置成功");
this.showConfigDialog = false;
},
},
};
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.marketing { .marketing {
padding: 30px; padding: 30px;
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 10px; padding: 10px;
} }
.config { .config {
position: relative; position: relative;
.form-item { .form-item {
width: 50%; width: 50%;
span { span {
display: flex; display: flex;
} }
.el-input { .el-input {
width: 100%; width: 100%;
} }
.el-icon-delete { .el-icon-delete {
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 20px; top: 20px;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
color: #f00; color: #f00;
margin: 0 10px; margin: 0 10px;
line-height: 40px; line-height: 40px;
cursor: pointer; cursor: pointer;
} }
}
}
} }
}
}
</style> </style>
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
<el-dialog title="添加自提点" v-model="showAddPointDialog" width="50%" top="2%"> <el-dialog title="添加自提点" v-model="showAddPointDialog" width="50%" top="2%" inline>
<el-form :model="pointObj"> <el-form :model="pointObj" :rules="rules">
<el-form-item label="联系人姓名"> <el-form-item label="联系人姓名">
<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>
...@@ -51,8 +51,9 @@ ...@@ -51,8 +51,9 @@
<el-form-item label="自提点名称"> <el-form-item label="自提点名称">
<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> <!-- <div id="js-container" class="myMap">正在加载数据 ...</div> -->
<el-form-item label="自提点地址"> <my-map class="my-map" @getMapInfo="getMapInfo" />
<el-form-item label="详细地址">
<el-input v-model="pointObj.location" placeholder="请输入自提点地址"></el-input> <el-input v-model="pointObj.location" placeholder="请输入自提点地址"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="自提点图片"> <el-form-item label="自提点图片">
...@@ -112,6 +113,7 @@ ...@@ -112,6 +113,7 @@
</template> </template>
<script> <script>
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";
...@@ -121,6 +123,7 @@ ...@@ -121,6 +123,7 @@
name: "MarketingCenter", name: "MarketingCenter",
components: { components: {
Layout, Layout,
myMap,
// page, // page,
}, },
data() { data() {
...@@ -139,6 +142,9 @@ ...@@ -139,6 +142,9 @@
pickStation: {}, pickStation: {},
dialogFormVisible: false, dialogFormVisible: false,
applyItem: {}, applyItem: {},
rules: {
take_place_name: [{ required: true, message: "请输入详细地址", trigger: "change" }],
},
}; };
}, },
async created() { async created() {
...@@ -160,7 +166,10 @@ ...@@ -160,7 +166,10 @@
else return this.$message.success("添加成功"); else return this.$message.success("添加成功");
}, },
async apply(item, type) { async apply(item, type) {
let res = await colonelAudit({ colonel_apply_id: item.colonel_apply_id, audit_status: type }); let res = await colonelAudit({
colonel_apply_id: item.colonel_apply_id,
audit_status: type,
});
await this.getColoneApplyList(); await this.getColoneApplyList();
this.dialogFormVisible = false; this.dialogFormVisible = false;
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
...@@ -171,7 +180,6 @@ ...@@ -171,7 +180,6 @@
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}`; this.pickStation = `${this.pointObj.province}-${this.pointObj.city}-${this.pointObj.area}`;
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;
}, },
...@@ -193,109 +201,15 @@ ...@@ -193,109 +201,15 @@
console.error(error); console.error(error);
} }
}, },
// getMapInfo(mapInfo) { getMapInfo(mapInfo) {
// this.form.location = mapInfo.address; console.log("mapInfo", mapInfo);
// this.form.province = mapInfo.province; this.pointObj.address = mapInfo.address;
// this.form.city = mapInfo.city; this.pointObj.location = mapInfo.location;
// this.form.area = mapInfo.area; this.pointObj.province = mapInfo.province;
// this.form.longitude = mapInfo.lng; // longitude latitude contactor this.pointObj.city = mapInfo.city;
// this.form.latitude = mapInfo.lat; this.pointObj.area = mapInfo.area;
// }, this.pointObj.longitude = mapInfo.lng; // longitude latitude contactor
dragMap(data) { this.pointObj.latitude = mapInfo.lat;
console.log(data);
this.pointObj.location = data.address;
this.pointObj.longitude = data.position.lng;
this.pointObj.latitude = data.position.lat;
this.pointObj.province = data.regeocode.addressComponent.province;
this.pointObj.city = data.regeocode.addressComponent.city;
this.pointObj.province = data.regeocode.addressComponent.district;
},
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.coloneApplyList.latitude && this.coloneApplyList.longitude) {
mapConfig.center = [this.coloneApplyList.longitude, this.coloneApplyList.latitude];
}
let map = new AMap.Map("js-container", mapConfig);
// 加载地图搜索插件
AMap.service("AMap.PlaceSearch", () => {
this.placeSearch = new AMap.PlaceSearch({
pageSize: 5,
pageIndex: 1,
citylimit: true,
// city: this.MapCityName,
map: map,
panel: "js-result",
});
});
// 启用工具条
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);
console.log("positionResult", positionResult);
});
// 启动拖放
// positionPicker.start();
});
}, },
}, },
}; };
......
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