feat: 商家端使用最新地址选择器,默认在config关闭高德地图功能,开启后可继续使用

master
Yer 2023-08-02 10:53:14 +08:00
parent a4d17102f1
commit 8a43335b75
10 changed files with 342 additions and 481 deletions

View File

@ -10,6 +10,7 @@ module.exports = {
aMapSecurityJsCode: "2bd0fbf621881f4c77be74f0e76495f3", // 高德web端js申请的安全密钥 aMapSecurityJsCode: "2bd0fbf621881f4c77be74f0e76495f3", // 高德web端js申请的安全密钥
aMapKey: "7f11113750315d8543daaf5c3ba353ca", //高德web端js申请的api key aMapKey: "7f11113750315d8543daaf5c3ba353ca", //高德web端js申请的api key
website: "https://www.pickmall.cn", //官网地址 website: "https://www.pickmall.cn", //官网地址
aMapSwitch:false, //是否开启高德定位
enableCDN: true, //生产环境 是否启用cdn加载 vue等js enableCDN: true, //生产环境 是否启用cdn加载 vue等js
port: 10002, //端口 port: 10002, //端口
inputMaxLength: "140", //全局输入框默认最大输入长度字 inputMaxLength: "140", //全局输入框默认最大输入长度字

View File

@ -19,7 +19,7 @@ import {
} from "@/libs/axios"; } from "@/libs/axios";
import {setStore, getStore, removeStore} from "@/libs/storage"; import {setStore, getStore, removeStore} from "@/libs/storage";
import i18nBox from '@/views/lili-components/i18n-translate'
import util from "@/libs/util"; import util from "@/libs/util";
import VueLazyload from "vue-lazyload"; import VueLazyload from "vue-lazyload";
@ -55,7 +55,7 @@ copyViewUi.Input.props.maxlength.default = inputMaxLength // 挂载最大输入
Vue.use(copyViewUi); Vue.use(copyViewUi);
Vue.component('liliDialog', liliDialog) Vue.component('liliDialog', liliDialog)
Vue.component('i18nBox', i18nBox)
Vue.component('liliDialog', liliDialog) Vue.component('liliDialog', liliDialog)
Vue.component("vue-qr", vueQr); //此处将vue-qr添加为全局组件 Vue.component("vue-qr", vueQr); //此处将vue-qr添加为全局组件

View File

@ -1,55 +0,0 @@
<template>
<div>
<Button @click="enable = true">语言设定</Button>
<Modal v-model="enable" draggable sticky scrollable :mask="false" :title="title">
<Tabs closable type="card" @on-tab-remove="handleTabRemove" :value="language[0].title">
<TabPane v-for="(item,index) in language" :key="index" :label="item.title" :name="item.title">
<Input v-model="item.___i18n" />
</TabPane>
</Tabs>
</Modal>
</div>
</template>
<script>
import {language} from "./languages";
export default {
/**
* tabs 循环的语言内容格式 [{'title':'test','value':'val'}]
*/
props: {
value: {
type: null,
default: "",
},
},
watch: {
language: {
handler(val) {
this.$emit("language", { language: [...val], val: this.value });
},
deep: true,
},
},
data() {
return {
language,
tabVal: "",
enable: false, //modal
title: "转换语言",
};
},
methods: {
// tab
handleTabRemove(tab) {
this.language = this.language.filter((item) => {
return item.value != tab;
});
},
},
};
</script>
<style lang="scss" scoped>
</style>

View File

@ -1 +0,0 @@
export const language = [{ title: "中文",value:1 }, { title: "英文" ,value:2}];

View File

@ -1,119 +0,0 @@
<template>
<div>
<Cascader
:data="data"
:load-data="loadData"
change-on-select
@on-visible-change="handleChangeOnSelect"
@on-change="change"
></Cascader>
</div>
</template>
<script>
import * as API_Setup from "@/api/common.js";
export default {
data() {
return {
dd:"",
data: [], //
selected: [], //
changeOnSelect: false, //
id: 0 // 0id
};
},
mounted() {
this.init();
},
props: ['addressId'],
methods: {
//
change(val, selectedData) {
/**
* @returns [regionId,region]
*/
this.$emit("selected", [
val,
selectedData[selectedData.length - 1].__label.split("/"),
]);
},
/**
* 动态设置change-on-select的值
* 当级联选择器弹窗展开时设置change-on-select为true即可以点选菜单选项值发生变化
* 当级联选择器弹窗关闭时设置change-on-select为false即能够设置初始值
*/
handleChangeOnSelect(value) {
this.changeOnSelect = value;
},
//
loadData(item, callback) {
item.loading = true;
API_Setup.getChildRegion(item.value).then((res) => {
if (res.result.length <= 0) {
item.loading = false;
this.selected = item;
/**
* 处理数据并返回
*/
} else {
res.result.forEach((child) => {
item.loading = false;
let data = {
value: child.id,
label: child.name,
loading: false,
children: [],
};
if (
child.level == "street" ||
item.label == "香港特别行政区" ||
item.label == "澳门特别行政区"
) {
item.children.push({
value: child.id,
label: child.name,
});
} else {
item.children.push(data);
}
});
this.selected = item;
callback();
}
});
},
//
init() {
API_Setup.getChildRegion(this.id).then((res) => {
let way = [];
res.result.forEach((item) => {
let data;
//
if (item.name == "台湾省") {
data = {
value: item.id,
label: item.name,
};
} else {
data = {
value: item.id,
label: item.name,
loading: false,
children: [],
};
}
way.push(data);
});
this.data = way;
});
},
},
};
</script>

View File

@ -1,31 +1,23 @@
<template> <template>
<div class="map"> <div class="map">
<Modal v-model="showMap" title="选择地址" width="800">
<div class="address">{{ addrContent.address }}</div>
<div id="map-container"></div>
<div class="search-con"> <div class="address">{{ addrContent.address }}</div>
<Input <div id="map-container"></div>
placeholder="输入关键字搜索"
id="input-map" <div class="search-con">
v-model="mapSearch" <Input placeholder="输入关键字搜索" id="input-map" v-model="mapSearch" />
/> <ul>
<ul> <li v-for="(tip, index) in tips" :key="index" @click="selectAddr(tip.location)">
<li <p>{{ tip.name }}</p>
v-for="(tip, index) in tips" <p>{{ tip.district + tip.address }}</p>
:key="index" </li>
@click="selectAddr(tip.location)" </ul>
> </div>
<p>{{ tip.name }}</p> <div slot="footer" class="footer">
<p>{{ tip.district + tip.address }}</p>
</li> <Button type="primary" :loading="loading" @click="ok"></Button>
</ul> </div>
</div>
<div slot="footer">
<Button type="default" @click="showMap = false">取消</Button>
<Button type="primary" :loading="loading" @click="ok"></Button>
</div>
</Modal>
</div> </div>
</template> </template>
<script> <script>
@ -56,21 +48,25 @@ export default {
}, },
methods: { methods: {
ok() { ok() {
//
this.loading = true; if (this.addrContent && this.addrContent.regeocode) {
const params = { const params = {
cityCode: this.addrContent.regeocode.addressComponent.citycode, cityCode: this.addrContent.regeocode.addressComponent.citycode,
townName: this.addrContent.regeocode.addressComponent.township, townName: this.addrContent.regeocode.addressComponent.township,
}; };
getRegion(params).then((res) => { getRegion(params).then((res) => {
if (res.success) { if (res.success) {
this.addrContent.addr = res.result.name.replace(/,/g, " "); this.addrContent.addr = res.result.name.replace(/,/g, " ");
this.addrContent.addrId = res.result.id; this.addrContent.addrId = res.result.id;
this.loading = false; this.loading = false;
this.showMap = false;
this.$emit("getAddress", this.addrContent); this.$emit("getAddress", this.addrContent);
} }
}); });
} else {
this.$Message.error('未获取到坐标信息请查看高德API配置是否正确')
}
}, },
init() { init() {
AMapLoader.load({ AMapLoader.load({
@ -122,7 +118,7 @@ export default {
that.addrContent = positionResult; that.addrContent = positionResult;
}); });
}) })
.catch((e) => {}); .catch((e) => { });
}, },
searchOfMap(val) { searchOfMap(val) {
// //
@ -162,16 +158,20 @@ export default {
right: 20px; right: 20px;
top: 64px; top: 64px;
width: 260px; width: 260px;
ul { ul {
width: 260px; width: 260px;
height: 400px; height: 360px;
overflow: scroll; overflow: scroll;
li { li {
padding: 5px; padding: 5px;
p:nth-child(2) { p:nth-child(2) {
color: #999; color: #999;
font-size: 12px; font-size: 12px;
} }
&:hover { &:hover {
background-color: #eee; background-color: #eee;
cursor: pointer; cursor: pointer;
@ -185,4 +185,9 @@ export default {
// color: $theme_color; // color: $theme_color;
font-weight: bold; font-weight: bold;
} }
.footer {
text-align: right;
margin: 10px 0;
}
</style> </style>

View File

@ -0,0 +1,143 @@
<template>
<Modal width="800" footer-hide v-model="enableMap">
<RadioGroup @on-change="changeMap" v-model="mapDefault" type="button">
<Radio label="select">级联选择</Radio>
<Radio label="map" v-if="aMapSwitch"></Radio>
</RadioGroup>
<div>
<div v-if="mapDefault === 'select'">
<div class="selector">
<div class="selector-item" v-for="(plant, plantIndex) in Object.keys(data)" :key="plantIndex">
<div :class="{ 'active': chiosend[plantIndex].id == item.id }" v-for="(item, index) in data[plant]"
:key="index"
@click="init(item, plantIndex != Object.keys(data).length - 1 ? Object.keys(data)[plantIndex + 1] : 0, plantIndex)"
class="map-item">
{{ item.name }}
</div>
</div>
</div>
<div class="footer">
<Button type="primary" @click="finished"></Button>
</div>
</div>
<mapping v-if="mapDefault === 'map'" ref="map" @getAddress="getAddress" />
</div>
</Modal>
</template>
<script>
import { aMapSwitch } from '@/config/index'
import mapping from "@/views/my-components/map/index.vue";
import * as API_Setup from "@/api/common.js";
export default {
components: { mapping },
data() {
return {
aMapSwitch,
enableMap: false,
mapDefault: "select",
data: {
province: [], //
city: [], //
area: [], //
street: [], //
},
chiosend: [],
};
},
mounted() {
this.chiosend = new Array(4).fill("");
},
methods: {
open() {
this.enableMap = true
this.init({ id: 0 }, 'province');
},
changeMap(val) {
this.mapDefault = val
},
init(val, level = 'province', index) {
if (level == 0) {
// id
this.chiosend.splice(3, 1, val);
}
else {
API_Setup.getChildRegion(val.id).then((res) => {
if (res.result.length && val.id !== 0) {
this.chiosend[index] = val
}
this.data[level] = res.result;
if (level == 'city') {
this.data.area = []
this.data.street = []
}
if (level == 'area') {
this.data.street = []
}
});
}
},
getAddress(center) {
this.$emit('callback', {
type: this.mapDefault,
data: center
})
this.enableMap = false;
},
//
finished() {
const params = this.chiosend.filter((item) => item.value !== "");
this.enableMap = false;
this.$emit('callback', {
type: this.mapDefault,
data: params
})
},
},
}
</script>
<style lang="scss" scoped>
.selector {
height: 400px;
padding: 10px 0;
display: flex;
}
.selector-item {
width: 100%;
flex: 1;
overflow: auto;
}
.map-item {
width: 100%;
padding: 10px;
border-bottom: 1px solid #eee;
cursor: pointer;
&:hover {
background: #eee;
}
}
.active {
background: #eee;
}
.footer {
text-align: right;
margin: 10px 0;
}
</style>

View File

@ -12,7 +12,7 @@
<Button @click="sfPrint" type="primary" ghost <Button @click="sfPrint" type="primary" ghost
v-if="allowOperation.showLogistics && logisticsType == 'SHUNFENG'">下载面单</Button> v-if="allowOperation.showLogistics && logisticsType == 'SHUNFENG'">下载面单</Button>
<Button @click="Toprint" type="primary" ghost <Button @click="toPrint" type="primary" ghost
v-if="allowOperation.ship && logisticsType != 'SHUNFENG'">打印电子面单</Button> v-if="allowOperation.ship && logisticsType != 'SHUNFENG'">打印电子面单</Button>
</div> </div>
</Card> </Card>
@ -290,11 +290,11 @@
<Input v-model="addressForm.consigneeMobile" size="large" maxlength="11"></Input> <Input v-model="addressForm.consigneeMobile" size="large" maxlength="11"></Input>
</FormItem> </FormItem>
<FormItem label="地址信息" prop="consigneeAddressPath"> <FormItem label="地址信息" prop="consigneeAddressPath">
<Input v-model="addressForm.consigneeAddressPath" disabled style="width: 325px" v-if="showRegion == false" /> <span>{{ addressForm.consigneeAddressPath }}</span>
<Button v-if="showRegion == false" size="small" @click="regionClick" :loading="submitLoading" type="primary" <Button size="small" type="default" @click="$refs.map.open()"
style="margin-left: 8px">修改 style="margin-left: 8px">修改
</Button> </Button>
<region style="width: 400px" @selected="selectedRegion" v-if="showRegion == true" />
</FormItem> </FormItem>
<FormItem label="详细地址" prop="consigneeDetail"> <FormItem label="详细地址" prop="consigneeDetail">
<Input v-model="addressForm.consigneeDetail" size="large" maxlength="11"></Input> <Input v-model="addressForm.consigneeDetail" size="large" maxlength="11"></Input>
@ -471,24 +471,27 @@
<Button type="primary" v-print="printInfoObj"></Button> <Button type="primary" v-print="printInfoObj"></Button>
</div> </div>
</Modal> </Modal>
<multipleMap ref="map" @callback="getAddress"></multipleMap>
</div> </div>
</template> </template>
<script> <script>
import * as API_Order from "@/api/order"; import * as API_Order from "@/api/order";
import * as API_Logistics from "@/api/logistics"; import * as API_Logistics from "@/api/logistics";
import liliMap from "@/views/my-components/map/index";
import * as RegExp from "@/libs/RegExp.js"; import * as RegExp from "@/libs/RegExp.js";
import region from "@/views/lili-components/region";
import multipleMap from "@/views/my-components/map/multiple-map";
export default { export default {
name: "orderDetail", name: "orderDetail",
components: { components: {
liliMap, multipleMap,
region,
}, },
data () { data () {
return { return {
loading:false,
typeList: [], typeList: [],
showPrices: false, showPrices: false,
printHiddenFlag: false,// printHiddenFlag: false,//
@ -498,10 +501,8 @@ export default {
extraHead: '',// extraHead: '',//
}, },
submitLoading: false, // submitLoading: false, //
region: [], //
regionId: [], //id
logisticsType: 'KUAIDINIAO', // logisticsType: 'KUAIDINIAO', //
showRegion: false,
someJSONdata: '', someJSONdata: '',
faceSheetForm: { faceSheetForm: {
logisticsId: '', logisticsId: '',
@ -692,11 +693,20 @@ export default {
}; };
}, },
methods: { methods: {
// //
regionClick () { getAddress(val){
this.showRegion = true; if(val.type === 'select'){
this.regionId = ""; const paths = val.data.map(item => item.name).join(',')
const ids = val.data.map(item => item.id).join(',')
this.$set(this.addressForm, 'consigneeAddressPath', paths)
this.$set(this.addressForm, 'consigneeAddressIdPath', ids)
}
else{
this.$set(this.addressForm, 'consigneeAddressPath', val.data.addr)
this.$set(this.addressForm, 'consigneeAddressIdPath', val.data.addrId)
}
}, },
// //
orderTake () { orderTake () {
this.orderTakeForm.qrCode = this.orderInfo.order.verificationCode; this.orderTakeForm.qrCode = this.orderInfo.order.verificationCode;
@ -766,7 +776,7 @@ export default {
} }
}); });
}, },
Toprint () { toPrint () {
this.facesheetFlag = true; this.facesheetFlag = true;
API_Logistics.getCheckedOn().then(res => { API_Logistics.getCheckedOn().then(res => {
if (res.success) { if (res.success) {
@ -797,11 +807,6 @@ export default {
} }
}); });
}, },
//
selectedRegion (val) {
this.region = val[1];
this.regionId = val[0];
},
// //
logistics () { logistics () {
this.logisticsModal = true; this.logisticsModal = true;
@ -869,7 +874,7 @@ export default {
} }
}) })
}, },
Toprints () { toPrints () {
if (this.form.logisticsId != null && this.form.logisticsId != '') { if (this.form.logisticsId != null && this.form.logisticsId != '') {
this.orderDeliverModal = false; this.orderDeliverModal = false;
} }
@ -882,7 +887,7 @@ export default {
API_Order.getOrderFaceSheet(this.sn, this.faceSheetForm).then(res => { API_Order.getOrderFaceSheet(this.sn, this.faceSheetForm).then(res => {
if (res.success) { if (res.success) {
this.someJSONdata = res.result.printTemplate; this.someJSONdata = res.result.printTemplate;
this.Toprints(); this.toPrints();
} }
}) })
} }
@ -906,9 +911,6 @@ export default {
// //
editAddress () { editAddress () {
this.addressModal = true; this.addressModal = true;
this.showRegion = false;
this.regionId = this.orderInfo.order.consigneeAddressIdPath;
this.region = this.orderInfo.order.consigneeAddressPath;
this.addressForm.consigneeName = this.orderInfo.order.consigneeName; this.addressForm.consigneeName = this.orderInfo.order.consigneeName;
this.addressForm.consigneeMobile = this.orderInfo.order.consigneeMobile; this.addressForm.consigneeMobile = this.orderInfo.order.consigneeMobile;
this.addressForm.consigneeDetail = this.orderInfo.order.consigneeDetail; this.addressForm.consigneeDetail = this.orderInfo.order.consigneeDetail;
@ -919,12 +921,6 @@ export default {
}, },
// //
editAddressSubmit () { editAddressSubmit () {
if (this.regionId == "") {
this.$Message.error("请选择地址");
return;
}
this.addressForm.consigneeAddressPath = this.region;
this.addressForm.consigneeAddressIdPath = this.regionId;
this.$refs.addressForm.validate((valid) => { this.$refs.addressForm.validate((valid) => {
if (valid) { if (valid) {
API_Order.editOrderConsignee(this.sn, this.addressForm).then( API_Order.editOrderConsignee(this.sn, this.addressForm).then(

View File

@ -36,7 +36,8 @@
<Input v-model="form.addressName" clearable style="width: 90%"/> <Input v-model="form.addressName" clearable style="width: 90%"/>
</FormItem> </FormItem>
<FormItem label="详细地址" prop="address"> <FormItem label="详细地址" prop="address">
<Input v-model="form.address" @on-focus="$refs.liliMap.showMap = true" clearable style="width: 90%"/> <span>{{ form.address || '暂无地址' }}</span>
<Button type="default" style="margin-left: 10px;" @click="$refs.map.open()"></Button>
</FormItem> </FormItem>
<FormItem label="联系电话" prop="mobile"> <FormItem label="联系电话" prop="mobile">
<Input v-model="form.mobile" clearable style="width: 90%" maxlength="11"/> <Input v-model="form.mobile" clearable style="width: 90%" maxlength="11"/>
@ -50,20 +51,21 @@
> >
</div> </div>
</Modal> </Modal>
<liliMap ref="liliMap" @getAddress="getAddress"></liliMap> <multipleMap ref="map" @callback="getAddress"></multipleMap>
</div> </div>
</template> </template>
<script> <script>
import * as API_Shop from "@/api/shops"; import * as API_Shop from "@/api/shops";
import { validateMobile } from "@/libs/validate"; import { validateMobile } from "@/libs/validate";
import liliMap from "@/views/my-components/map/index";
import multipleMap from "@/views/my-components/map/multiple-map";
export default { export default {
name: "shopAddress", name: "shopAddress",
components: { components: {
liliMap multipleMap
}, },
data() { data() {
return { return {
@ -224,10 +226,19 @@
this.getDataList(); this.getDataList();
}, },
// //
getAddress(item){ getAddress(val){
this.$set(this.form, 'address', item.addr) if(val.type === 'select'){
this.form.address = item.address const paths = val.data.map(item => item.name).join(',')
this.form.center = item.position.lat + "," + item.position.lng this.$set(this.form, 'address', paths)
this.form.center = val.data[val.data.length - 1].center
}
else{
this.$set(this.form, 'address', val.data.addr)
this.form.address = val.data.address
this.form.center = val.data.position.lng + "," + val.data.position.lat
}
}, },
// //
getDataList() { getDataList() {

View File

@ -3,115 +3,50 @@
<Card style="margin-left: 10px"> <Card style="margin-left: 10px">
<Tabs v-model="type" @on-click="handleClickType"> <Tabs v-model="type" @on-click="handleClickType">
<TabPane label="基本信息" name="INFO"> <TabPane label="基本信息" name="INFO">
<Form <Form ref="form" :model="form" :label-width="100" :rules="formValidate">
ref="form"
:model="form"
:label-width="100"
:rules="formValidate"
>
<FormItem label="店铺名称"> <FormItem label="店铺名称">
<Input <Input v-model="storeName" disabled clearable style="width: 20%" />
v-model="storeName"
disabled
clearable
style="width: 20%"
/>
</FormItem> </FormItem>
<FormItem label="店铺地址" prop="address"> <FormItem label="店铺地址" prop="storeAddressPath">
<Input <span>{{ form.storeAddressPath }}</span>
v-model="form.address" <Button style="margin-left: 10px;" @click="handleChangeAddress('storeAddress')"></Button>
@on-focus="$refs.liliMap.showMap = true"
clearable
style="width: 20%"
/>
</FormItem> </FormItem>
<FormItem label="详细地址" prop="shopAddressDetail"> <FormItem label="详细地址" prop="shopAddressDetail">
<Input <Input v-model="form.storeAddressDetail" clearable style="width: 20%" maxlength="50" />
v-model="form.storeAddressDetail"
clearable
style="width: 20%"
maxlength="50"
/>
</FormItem> </FormItem>
<FormItem label="店铺LOGO"> <FormItem label="店铺LOGO">
<upload-pic-thumb <upload-pic-thumb v-model="form.storeLogo" :multiple="false"></upload-pic-thumb>
v-model="form.storeLogo"
:multiple="false"
></upload-pic-thumb>
</FormItem> </FormItem>
<FormItem label="店铺简介" prop="content" class="wangEditor"> <FormItem label="店铺简介" prop="content" class="wangEditor">
<Input <Input type="textarea" :rows="8" v-model="form.storeDesc" style="width: 30%"></Input>
type="textarea"
:rows="8"
v-model="form.storeDesc"
style="width: 30%"
></Input>
</FormItem> </FormItem>
<FormItem label="店铺楼层" prop="content" class="wangEditor"> <FormItem label="店铺楼层" prop="content" class="wangEditor">
<i-switch v-model="form.pageShow" @on-change="pageShow"></i-switch> <i-switch v-model="form.pageShow" @on-change="pageShow"></i-switch>
<span class="desc">店铺楼层装修是否开启开启后移动端PC端将会自动展示装修的内容</span> <span class="desc">店铺楼层装修是否开启开启后移动端PC端将会自动展示装修的内容</span>
</FormItem> </FormItem>
<FormItem label="开启自提" prop="content" class="wangEditor"> <FormItem label="开启自提" prop="content" class="wangEditor">
<i-switch v-model="form.selfPickFlag" @on-change="changeSelfPickFlag"></i-switch> <i-switch v-model="form.selfPickFlag" @on-change="changeSelfPickFlag"></i-switch>
<span class="desc">店铺是否开启自提功能</span> <span class="desc">店铺是否开启自提功能</span>
</FormItem> </FormItem>
<Form-item> <Form-item>
<Button <Button @click="handleSubmit" :loading="submitLoading" type="primary" style="margin-right: 5px">修改
@click="handleSubmit"
:loading="submitLoading"
type="primary"
style="margin-right: 5px"
>修改
</Button> </Button>
</Form-item> </Form-item>
</Form> </Form>
</TabPane> </TabPane>
<TabPane label="发货地址"> <TabPane label="发货地址">
<Form <Form ref="addressGoods" :model="addressGoods" :label-width="100" :rules="addressGoodsValidate">
ref="addressGoods"
:model="addressGoods"
:label-width="100"
:rules="addressGoodsValidate"
>
<FormItem label="发货人姓名" prop="salesConsignorName"> <FormItem label="发货人姓名" prop="salesConsignorName">
<Input <Input v-model="addressGoods.salesConsignorName" maxlength="11" clearable style="width: 20%">
v-model="addressGoods.salesConsignorName"
maxlength="11"
clearable
style="width: 20%"
>
</Input> </Input>
</FormItem> </FormItem>
<FormItem label="发货人手机号" prop="salesConsignorMobile"> <FormItem label="发货人手机号" prop="salesConsignorMobile">
<Input <Input v-model="addressGoods.salesConsignorMobile" maxlength="11" clearable style="width: 20%">
v-model="addressGoods.salesConsignorMobile"
maxlength="11"
clearable
style="width: 20%"
>
</Input> </Input>
</FormItem> </FormItem>
<FormItem label="地址" prop="salesConsignorAddressId"> <FormItem label="地址" prop="salesConsignorAddressId">
<Input <span>{{ addressGoods.salesConsignorAddressPath }}</span>
v-model="regionGoods" <Button style="margin-left: 10px;" @click="handleChangeAddress('addressGoods')"></Button>
clearable
disabled
style="width: 20%"
v-if="showRegion == false"
>
</Input>
<regionMap
style="width: 20%"
@selected="selectedRegionGoods"
v-if="showRegion == true"
/>
<Button
v-if="showRegion == false"
@click="regionClicks"
type="primary"
style="margin-left: 8px"
>修改
</Button>
</FormItem> </FormItem>
<!-- <FormItem label="地址名称" prop="salesConsignorAddressPath"> <!-- <FormItem label="地址名称" prop="salesConsignorAddressPath">
<Input <Input
@ -122,110 +57,45 @@
</Input> </Input>
</FormItem> --> </FormItem> -->
<FormItem label="详细地址" prop="salesConsignorDetail"> <FormItem label="详细地址" prop="salesConsignorDetail">
<Input <Input v-model="addressGoods.salesConsignorDetail" clearable style="width: 20%">
v-model="addressGoods.salesConsignorDetail"
clearable
style="width: 20%"
>
</Input> </Input>
</FormItem> </FormItem>
<Button <Button @click="setAddressGoods" type="primary" style="margin-left: 8px">确认
@click="SetAddressGoods"
type="primary"
style="margin-left: 8px"
>确认
</Button> </Button>
</Form> </Form>
</TabPane> </TabPane>
<TabPane label="退货地址" name="REFUND_GOODS_ADDRESS"> <TabPane label="退货地址" name="REFUND_GOODS_ADDRESS">
<Form <Form ref="addressForm" :model="addressForm" :label-width="100" :rules="afterFormValidate">
ref="addressForm"
:model="addressForm"
:label-width="100"
:rules="afterFormValidate"
>
<FormItem label="收货人" prop="salesConsigneeName"> <FormItem label="收货人" prop="salesConsigneeName">
<Input <Input v-model="addressForm.salesConsigneeName" maxlength="11" clearable style="width: 20%" />
v-model="addressForm.salesConsigneeName"
maxlength="11"
clearable
style="width: 20%"
/>
</FormItem> </FormItem>
<FormItem label="收货人电话" prop="salesConsigneeMobile"> <FormItem label="收货人电话" prop="salesConsigneeMobile">
<Input <Input v-model="addressForm.salesConsigneeMobile" maxlength="11" style="width: 20%" />
v-model="addressForm.salesConsigneeMobile"
maxlength="11"
style="width: 20%"
/>
</FormItem> </FormItem>
<FormItem label="售后地址"> <FormItem label="售后地址">
<Input <span>{{ addressForm.salesConsigneeAddressPath }}</span>
v-model="region" <Button style="margin-left: 10px;" @click="handleChangeAddress('salesConsigneeAddressPath')"></Button>
disabled
style="width: 20%"
v-if="showRegion == false"
/>
<Button
v-if="showRegion == false"
@click="regionClick"
:loading="submitLoading"
type="primary"
style="margin-left: 8px"
>修改
</Button>
<regionMap
style="width: 20%"
@selected="selectedRegion"
v-if="showRegion == true"
/>
</FormItem> </FormItem>
<FormItem label="详细地址" prop="salesConsigneeDetail"> <FormItem label="详细地址" prop="salesConsigneeDetail">
<Input <Input v-model="addressForm.salesConsigneeDetail" clearable style="width: 20%" maxlength="50" />
v-model="addressForm.salesConsigneeDetail"
clearable
style="width: 20%"
maxlength="50"
/>
</FormItem> </FormItem>
<Form-item> <Form-item>
<Button <Button @click="afterHandleSubmit" :loading="submitLoading" type="primary" style="margin-right: 5px">修改
@click="afterHandleSubmit"
:loading="submitLoading"
type="primary"
style="margin-right: 5px"
>修改
</Button> </Button>
</Form-item> </Form-item>
</Form> </Form>
</TabPane> </TabPane>
<TabPane label="库存预警" name="STOCK_WARNING"> <TabPane label="库存预警" name="STOCK_WARNING">
<Form <Form ref="stockWarningForm" :model="stockWarningForm" :label-width="100" :rules="stockWarningFormValidate">
ref="stockWarningForm"
:model="stockWarningForm"
:label-width="100"
:rules="stockWarningFormValidate"
>
<FormItem label="预警数" prop="stockWarning"> <FormItem label="预警数" prop="stockWarning">
<InputNumber <InputNumber :min="0" :max="99999" v-model="stockWarningForm.stockWarning" type="number" maxlength="6"
:min="0" clearable style="width: 20%" />
:max="99999"
v-model="stockWarningForm.stockWarning"
type="number"
maxlength="6"
clearable
style="width: 20%"
/>
</FormItem> </FormItem>
<Form-item> <Form-item>
<Button <Button @click="stockWarningHandleSubmit" :loading="submitLoading" type="primary"
@click="stockWarningHandleSubmit" style="margin-right: 5px">修改
:loading="submitLoading"
type="primary"
style="margin-right: 5px"
>修改
</Button> </Button>
</Form-item> </Form-item>
</Form> </Form>
@ -260,7 +130,7 @@
</Tabs> </Tabs>
</Card> </Card>
<liliMap ref="liliMap" @getAddress="getAddress"></liliMap> <multipleMap ref="map" @callback="callbackAddress" />
</div> </div>
</template> </template>
@ -268,23 +138,25 @@
import * as API_Shop from "@/api/shops"; import * as API_Shop from "@/api/shops";
import { validateMobile } from "@/libs/validate"; import { validateMobile } from "@/libs/validate";
import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb"; import uploadPicThumb from "@/views/my-components/lili/upload-pic-thumb";
import liliMap from "@/views/my-components/map/index";
import regionMap from "@/views/lili-components/region"; import multipleMap from "@/views/my-components/map/multiple-map";
import * as RegExp from "@/libs/RegExp.js"; import * as RegExp from "@/libs/RegExp.js";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
export default { export default {
name: "shopSetting", name: "shopSetting",
components: { components: {
uploadPicThumb, uploadPicThumb,
liliMap,
regionMap, multipleMap
}, },
data() { data() {
return { return {
currentKey: "", //key
showMap: false, //
type: "INFO", type: "INFO",
showRegion: false, //
storeName: "", // storeName: "", //
region: "", //
regionId: [], // id regionId: [], // id
addressForm: { addressForm: {
// 退 // 退
@ -304,7 +176,7 @@ export default {
}, },
stockWarningFormValidate: { stockWarningFormValidate: {
stockWarning: [ stockWarning: [
{ required: true, type:'number', message: "请输入库存预警数", trigger: "blur" }, { required: true, type: 'number', message: "请输入库存预警数", trigger: "blur" },
], ],
}, },
udeskFormValidate: { udeskFormValidate: {
@ -386,13 +258,13 @@ export default {
submitLoading: false, // submitLoading: false, //
// //
addressGoods: { addressGoods: {
salesConsignorName:" ", salesConsignorName: " ",
salesConsignorMobile:" ", salesConsignorMobile: " ",
salesConsignorAddressId: " ", salesConsignorAddressId: " ",
salesConsignorAddressPath: " ", salesConsignorAddressPath: " ",
salesConsignorDetail: " ", salesConsignorDetail: " ",
}, },
regionGoods:"",//
addressGoodsValidate: { addressGoodsValidate: {
salesConsignorName: [ salesConsignorName: [
{ required: true, message: "请输入发货人姓名", trigger: "blur" }, { required: true, message: "请输入发货人姓名", trigger: "blur" },
@ -412,31 +284,63 @@ export default {
}; };
}, },
methods: { methods: {
//
callbackAddress(val) {
if (val.type === 'select') {
const paths = val.data.map(item => item.name).join(',')
const ids = val.data.map(item => item.id).join(',')
if (this.currentKey === 'storeAddress') {
this.form.storeAddressPath = paths
this.form.storeAddressIdPath = ids
this.form.storeCenter = val.data[val.data.length - 1].center
}
if (this.currentKey === 'addressGoods') {
this.addressGoods.salesConsignorAddressPath = paths
this.addressGoods.salesConsignorAddressId = ids
}
if (this.currentKey === 'salesConsigneeAddressPath') {
this.addressForm.salesConsigneeAddressPath = paths
this.addressForm.salesConsigneeAddressId = ids
}
}
else {
if (this.currentKey === 'storeAddressstoreAddress') {
this.form.storeAddressPath = val.data.addr;
this.form.storeAddressIdPath = val.data.addrId;
this.form.storeCenter = val.data.position.lng + "," + val.data.position.lat;
}
if (this.currentKey === 'addressGoods') {
this.addressGoods.salesConsignorAddressPath = val.data.addr;
this.addressGoods.salesConsignorAddressId = val.data.addrId;
}
if (this.currentKey === 'salesConsigneeAddressPath') {
this.addressForm.salesConsigneeAddressPath = val.data.addr;
this.addressForm.salesConsigneeAddressId = val.data.addrId;
}
}
},
//
handleChangeAddress(key) {
this.currentKey = key
this.$refs.map.open();
},
// //
init() { init() {
this.getShopInfo(); this.getShopInfo();
this.getDeliverAddress() this.getDeliverAddress()
}, },
selectedRegionGoods(val){
this.regionGoods = val[1];
this.regionIdS = val[0]; setAddressGoods() {
},
regionClicks(){
this.showRegion = true;
this.regionIdS = "";
},
SetAddressGoods(){
console.log(this.$refs.addressGoods) console.log(this.$refs.addressGoods)
if (this.regionIdS == "") {
this.$Message.error("请选择地址");
return;
}
this.$refs.addressGoods.validate((valid) => { this.$refs.addressGoods.validate((valid) => {
if (valid) { if (valid) {
this.addressGoods.salesConsignorAddressPath = this.regionGoods; API_Shop.editDeliverAddress(this.addressGoods).then(res => {
this.addressGoods.salesConsignorAddressId = this.regionIdS; if (res.success) {
API_Shop.editDeliverAddress(this.addressGoods).then(res=>{
if(res.success){
this.$Message.success("修改成功") this.$Message.success("修改成功")
} }
}) })
@ -450,7 +354,7 @@ export default {
this.loading = false; this.loading = false;
if (res.success) { if (res.success) {
this.form = res.result; this.form = res.result;
this.$set(this.form, "address", res.result.storeAddressPath);
this.storeName = res.result.storeName; this.storeName = res.result.storeName;
this.form.storeCenter = res.result.storeCenter; this.form.storeCenter = res.result.storeCenter;
Cookies.set("userInfoSeller", JSON.stringify(res.result)); Cookies.set("userInfoSeller", JSON.stringify(res.result));
@ -468,15 +372,15 @@ export default {
pageShow(type) { pageShow(type) {
this.form.pageShow = type this.form.pageShow = type
}, },
changeSelfPickFlag(item){ changeSelfPickFlag(item) {
if(item){ if (item) {
this.form.selfPickFlag = item this.form.selfPickFlag = item
} }
}, },
getDeliverAddress(){ getDeliverAddress() {
API_Shop.getDeliverAddress().then(res=>{ API_Shop.getDeliverAddress().then(res => {
if(res.success){ if (res.success) {
if(res.result!= '' && res.result != null){ if (res.result != '' && res.result != null) {
this.addressGoods = res.result; this.addressGoods = res.result;
this.regionGoods = res.result.salesConsignorAddressPath; this.regionGoods = res.result.salesConsignorAddressPath;
this.regionIdS = res.result.salesConsignorAddressId; this.regionIdS = res.result.salesConsignorAddressId;
@ -484,11 +388,7 @@ export default {
} }
}) })
}, },
//
regionClick() {
this.showRegion = true;
this.regionId = "";
},
// //
handleReset() { handleReset() {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
@ -537,11 +437,7 @@ export default {
} }
}); });
}, },
//
selectedRegion(val) {
this.region = val[1];
this.regionId = val[0];
},
//tab //tab
handleClickType(v) { handleClickType(v) {
//退 //退
@ -558,40 +454,24 @@ export default {
API_Shop.getRefundGoodsAddress().then((res) => { API_Shop.getRefundGoodsAddress().then((res) => {
if (res.result != null) { if (res.result != null) {
this.addressForm = res.result; this.addressForm = res.result;
this.regionId = res.result.salesConsigneeAddressId;
this.region = res.result.salesConsigneeAddressPath;
} }
}); });
}, },
// //
afterHandleSubmit() { afterHandleSubmit() {
if (this.regionId == "") {
this.$Message.error("请选择地址");
return;
}
this.$refs.addressForm.validate((valid) => { this.$refs.addressForm.validate((valid) => {
if (valid) { if (valid) {
this.addressForm.salesConsigneeAddressPath = this.region;
this.addressForm.salesConsigneeAddressId = this.regionId;
this.submitLoading = true; this.submitLoading = true;
API_Shop.saveRefundGoodsAddress(this.addressForm).then((res) => { API_Shop.saveRefundGoodsAddress(this.addressForm).then((res) => {
this.submitLoading = false; this.submitLoading = false;
if (res.success) { if (res.success) {
this.$Message.success("修改成功"); this.$Message.success("修改成功");
this.getRefundGoodsAddress(); this.getRefundGoodsAddress();
this.showRegion = false;
} }
}); });
} }
}); });
}, },
//
getAddress(item) {
this.$set(this.form, "address", item.addr);
this.form.storeAddressPath = item.addr;
this.form.storeAddressIdPath = item.addrId;
this.form.storeCenter = item.position.lng + "," + item.position.lat;
},
}, },
mounted() { mounted() {
this.init(); this.init();
@ -599,7 +479,7 @@ export default {
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.desc{ .desc {
margin-left: 10px; margin-left: 10px;
color: #999; color: #999;
} }