|
@@ -2,7 +2,7 @@
|
|
|
* @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
|
|
|
* @Date: 2023-05-26 16:37:34
|
|
|
* @LastEditors: wenjie 1454560336@qq.com
|
|
|
- * @LastEditTime: 2024-04-16 11:00:27
|
|
|
+ * @LastEditTime: 2024-05-15 15:57:35
|
|
|
* @FilePath: \admin-manage\src\views\operationManage\shopManage\shopAdd.vue
|
|
|
* @Description:
|
|
|
*
|
|
@@ -54,9 +54,8 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="店铺名称:" prop="shopName">
|
|
|
<el-input
|
|
|
- v-model.number="setQuery.shopName"
|
|
|
+ v-model="setQuery.shopName"
|
|
|
size="small"
|
|
|
- :maxlength="18"
|
|
|
class="item-width-300"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
@@ -117,6 +116,7 @@
|
|
|
@uploadEnd="uploadEnd"
|
|
|
></Upload>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<!-- <el-form-item label="店铺状态:">
|
|
|
<el-radio-group v-model="setQuery.doorImg">
|
|
|
<el-radio :label="1">关闭</el-radio>
|
|
@@ -149,8 +149,8 @@
|
|
|
<el-form-item label="银联分账帐户:">
|
|
|
<el-select v-model="setQuery.authAccount" size="small" filterable class="item-width-300" placeholder="请搜索选择店铺主体">
|
|
|
<el-option
|
|
|
- v-for="item in authOptions"
|
|
|
- :key="item.value"
|
|
|
+ v-for="(item,index) in authOptions"
|
|
|
+ :key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.value">
|
|
|
</el-option>
|
|
@@ -186,6 +186,12 @@
|
|
|
<el-radio :label="2">关闭</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="绑定主商户" prop="platformType">
|
|
|
+ <el-checkbox-group v-model="setQuery.platformType">
|
|
|
+ <el-checkbox label="1">慧研学惠生活</el-checkbox>
|
|
|
+ <el-checkbox label="2" >印象贵大</el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
@@ -195,17 +201,35 @@
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
- <el-dialog title="选择地址" close="chose-model" :close-on-press-escape="false" :show-close="false" :close-on-click-modal="false" width="60vw" :visible.sync="showMap">
|
|
|
+ <el-dialog title="选择地址" close="chose-model" :close-on-press-escape="false" :close-on-click-modal="false" width="60vw" :visible.sync="showMap">
|
|
|
<div id="container"></div>
|
|
|
- <div class="address-input-box">
|
|
|
- <el-input
|
|
|
- v-model="setQuery.address"
|
|
|
- size="small"
|
|
|
- class="address-input"
|
|
|
- placeholder="请先点击地图定位,再修改详细地址"
|
|
|
- ></el-input>
|
|
|
- <el-button type="primary" size="small" class="address-btn" @click="saveAddress">提 交</el-button>
|
|
|
- </div>
|
|
|
+ <el-form
|
|
|
+ :model="setQuery"
|
|
|
+ ref="address"
|
|
|
+ :rules="rules1"
|
|
|
+ >
|
|
|
+ <el-form-item label="" prop="address">
|
|
|
+ <div class="address-input-box">
|
|
|
+ <el-select v-model="setQuery.address" :loading="addressLoading" filterable remote :remote-method="searchAddress" @change="selectAddress" class="address-input" placeholder="请选择输入地址或者点击地图">
|
|
|
+ <el-option
|
|
|
+ v-for="item in addressOptions"
|
|
|
+ :key="item.label+item.value"
|
|
|
+ :label="item.label+' '+item.value"
|
|
|
+ :value="item.value">
|
|
|
+ <span style="color: #222; font-size: 13px">{{ item.label }}</span>
|
|
|
+ <span style="margin-left:10px; color: #8492a6; font-size: 13px">{{ item.value }}</span>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <!-- <el-input
|
|
|
+ v-model="setQuery.address"
|
|
|
+ size="small"
|
|
|
+ class="address-input"
|
|
|
+ placeholder="请先点击地图定位,再修改详细地址"
|
|
|
+ ></el-input> -->
|
|
|
+ <el-button type="primary" size="small" class="address-btn" @click="saveAddress">提 交</el-button>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
@@ -233,6 +257,7 @@ import {getMenuData} from '@/api/appConfig';
|
|
|
import {getRuleList} from '@/api/rule'
|
|
|
import {getData} from '@/api/goods'
|
|
|
import {finishComplexList} from '@/api/payment'
|
|
|
+import {getSearchList,uidToAddress} from '@/api/common'
|
|
|
import { debounce } from "@/utils/index";
|
|
|
export default {
|
|
|
components: {
|
|
@@ -245,6 +270,8 @@ export default {
|
|
|
map:null,
|
|
|
mode:'detail',//编辑模式
|
|
|
showMap:false,
|
|
|
+ cityName:'',
|
|
|
+ addressLoading:false,
|
|
|
setQuery: {
|
|
|
address: "",
|
|
|
businessImg: "",
|
|
@@ -271,11 +298,13 @@ export default {
|
|
|
authAccount:"",
|
|
|
searchEnable:1,
|
|
|
state:2,
|
|
|
+ platformType:[]
|
|
|
},
|
|
|
authOptions:[],//银联账号
|
|
|
typeOptions:[],//商品分类
|
|
|
ruleOptions:[],
|
|
|
options:[],
|
|
|
+ addressOptions:[],
|
|
|
options1:[
|
|
|
{
|
|
|
value: 1,
|
|
@@ -335,40 +364,48 @@ export default {
|
|
|
serviceCode: [
|
|
|
{ required: true, message: "请选择经营商品类型", trigger: "change" },
|
|
|
],
|
|
|
+ platformType: [
|
|
|
+ { type: 'array', required: true, message: '请至少绑定一个主商户', trigger: 'change' }
|
|
|
+ ],
|
|
|
},
|
|
|
+ rules1:{
|
|
|
+ address: [
|
|
|
+ { required: true, message: "请输入商铺地址或者点击地图", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
- 'setQuery.address':debounce(function(val){
|
|
|
- if(this.map){
|
|
|
- let that = this
|
|
|
- //创建地址解析器实例
|
|
|
- var myGeo = new BMapGL.Geocoder();
|
|
|
- that.marker? that.map.removeOverlay(that.marker):''
|
|
|
- // 将地址解析结果显示在地图上,并调整地图视野
|
|
|
- myGeo.getPoint(val, function(point){
|
|
|
- if(point ){
|
|
|
- console.log(point);
|
|
|
- that.setQuery.mapLat = point.lat
|
|
|
- that.setQuery.mapLon = point.lng
|
|
|
- that.marker = new BMapGL.Marker(point, {title: val})
|
|
|
- if(that.map){
|
|
|
- that.map.centerAndZoom(point, 16);
|
|
|
- that.map.addOverlay(that.marker)
|
|
|
- myGeo.getLocation(new BMapGL.Point(point.lng, point.lat), function(result){
|
|
|
- if (result){
|
|
|
- console.log(result);
|
|
|
- // 选择营业地址时保存省市区
|
|
|
- that.setQuery.province = result.addressComponents.province;
|
|
|
- that.setQuery.city = result.addressComponents.city;
|
|
|
- that.setQuery.district = result.addressComponents.district;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }, that.setQuery.city)
|
|
|
- }
|
|
|
- }),
|
|
|
+ // 'setQuery.address':debounce(function(val){
|
|
|
+ // if(this.map){
|
|
|
+ // let that = this
|
|
|
+ // //创建地址解析器实例
|
|
|
+ // var myGeo = new BMapGL.Geocoder();
|
|
|
+ // that.marker? that.map.removeOverlay(that.marker):''
|
|
|
+ // // 将地址解析结果显示在地图上,并调整地图视野
|
|
|
+ // myGeo.getPoint(val, function(point){
|
|
|
+ // if(point ){
|
|
|
+ // console.log(point);
|
|
|
+ // that.setQuery.mapLat = point.lat
|
|
|
+ // that.setQuery.mapLon = point.lng
|
|
|
+ // that.marker = new BMapGL.Marker(point, {title: val})
|
|
|
+ // if(that.map){
|
|
|
+ // that.map.centerAndZoom(point, 16);
|
|
|
+ // that.map.addOverlay(that.marker)
|
|
|
+ // myGeo.getLocation(new BMapGL.Point(point.lng, point.lat), function(result){
|
|
|
+ // if (result){
|
|
|
+ // console.log(result);
|
|
|
+ // // 选择营业地址时保存省市区
|
|
|
+ // that.setQuery.province = result.addressComponents.province;
|
|
|
+ // that.setQuery.city = result.addressComponents.city;
|
|
|
+ // that.setQuery.district = result.addressComponents.district;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }, that.setQuery.city)
|
|
|
+ // }
|
|
|
+ // }),
|
|
|
"setQuery.shopMainId":function(val){
|
|
|
if(val){
|
|
|
this.finishComplexList()
|
|
@@ -384,6 +421,49 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 选择地址
|
|
|
+ selectAddress(val){
|
|
|
+ let item = this.addressOptions.filter(item=>item.value==val)[0]
|
|
|
+ console.log(val,item);
|
|
|
+ this.setQuery.mapLat = item.location.lat
|
|
|
+ this.setQuery.mapLon = item.location.lng
|
|
|
+ this.map.removeOverlay(this.marker); //移除点标记
|
|
|
+ this.marker = new BMapGL.Marker(item.location, {title: val})
|
|
|
+ this.map.addOverlay(this.marker)
|
|
|
+ this.setQuery.province = item.province;
|
|
|
+ this.setQuery.city = item.city;
|
|
|
+ this.setQuery.district = item.district;
|
|
|
+ this.map.centerAndZoom(item.location, 19);
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ // 查询地址
|
|
|
+ searchAddress(val){
|
|
|
+ if(val){
|
|
|
+ this.addressLoading = true
|
|
|
+ getSearchList({query:val,region:this.cityName,output:'json',ak:'7aGqlyBw6mGwS6vNMLbmMlsHqE2OGV0E',ret_coordtype:'gcj02'}).then(res=>{
|
|
|
+ this.addressLoading = false
|
|
|
+ if(res.status == 0){
|
|
|
+ this.addressOptions = []
|
|
|
+ res.result.map(item=>{
|
|
|
+ this.addressOptions.push({
|
|
|
+ label:item.name,
|
|
|
+ value:item.address,
|
|
|
+ location:item.location,
|
|
|
+ province:item.province,
|
|
|
+ city:item.city,
|
|
|
+ district:item.district,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.addressOptions = []
|
|
|
+
|
|
|
+ }
|
|
|
+ // ?query=天安门®ion=北京&city_limit=true&output=json&ak=7aGqlyBw6mGwS6vNMLbmMlsHqE2OGV0E
|
|
|
+ // }
|
|
|
+ },
|
|
|
edit(){
|
|
|
this.$router.push({
|
|
|
path: "/operationManage/shopManage/shopAdd",
|
|
@@ -397,30 +477,32 @@ export default {
|
|
|
this.$refs.setQuery.validate((v) => {
|
|
|
if (v) {
|
|
|
if(this.loading) return
|
|
|
+ let obj = JSON.parse(JSON.stringify(this.setQuery))
|
|
|
+ obj.serviceCode = obj.serviceCode.toString()
|
|
|
+ let str = ''
|
|
|
+ obj.serviceCate.map((item,index)=>{
|
|
|
+ if(index != (obj.serviceCate.length -1 )){
|
|
|
+ str += item.toString()+'/'
|
|
|
+ }else{
|
|
|
+ str += item.toString()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ obj.serviceCate = str
|
|
|
+ obj.shopMenuId = obj.shopMenuId.toString()
|
|
|
+ obj.platformType = obj.platformType.toString()
|
|
|
if (this.setQuery.shopId) {
|
|
|
- this.update();
|
|
|
+ this.update(obj);
|
|
|
} else {
|
|
|
- this.add();
|
|
|
+ this.add(obj);
|
|
|
}
|
|
|
}else{
|
|
|
this.$message.error('请检查是否有必填项未填');
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- add() {
|
|
|
+ add(obj) {
|
|
|
this.loading = true;
|
|
|
- let obj = JSON.parse(JSON.stringify(this.setQuery))
|
|
|
- obj.serviceCode = obj.serviceCode.toString()
|
|
|
- let str = ''
|
|
|
- obj.serviceCate.map((item,index)=>{
|
|
|
- if(index != (obj.serviceCate.length -1 )){
|
|
|
- str += item.toString()+'/'
|
|
|
- }else{
|
|
|
- str += item.toString()
|
|
|
- }
|
|
|
- })
|
|
|
- obj.serviceCate = str
|
|
|
- obj.shopMenuId = obj.shopMenuId.toString()
|
|
|
+
|
|
|
add(obj).then((res) => {
|
|
|
this.loading = false;
|
|
|
if (res.state == "Success") {
|
|
@@ -434,20 +516,21 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- update() {
|
|
|
+ update(obj) {
|
|
|
this.loading = true;
|
|
|
- let obj = JSON.parse(JSON.stringify(this.setQuery))
|
|
|
- obj.serviceCode = obj.serviceCode.toString()
|
|
|
- let str = ''
|
|
|
- obj.serviceCate.map((item,index)=>{
|
|
|
- if(index != (obj.serviceCate.length -1 )){
|
|
|
- str += item.toString()+'/'
|
|
|
- }else{
|
|
|
- str += item.toString()
|
|
|
- }
|
|
|
- })
|
|
|
- obj.serviceCate = str
|
|
|
- obj.shopMenuId = obj.shopMenuId.toString()
|
|
|
+ // let obj = JSON.parse(JSON.stringify(this.setQuery))
|
|
|
+ // obj.serviceCode = obj.serviceCode.toString()
|
|
|
+ // let str = ''
|
|
|
+ // obj.serviceCate.map((item,index)=>{
|
|
|
+ // if(index != (obj.serviceCate.length -1 )){
|
|
|
+ // str += item.toString()+'/'
|
|
|
+ // }else{
|
|
|
+ // str += item.toString()
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // obj.serviceCate = str
|
|
|
+ // obj.shopMenuId = obj.shopMenuId.toString()
|
|
|
+ // obj.platformType = obj.platformType.toString()
|
|
|
|
|
|
update(obj).then((res) => {
|
|
|
this.loading = false;
|
|
@@ -475,6 +558,7 @@ export default {
|
|
|
this.setQuery.serviceCode = this.setQuery.serviceCode.split(',')
|
|
|
this.setQuery.serviceCate = this.setQuery.serviceCate.split('/').map(item=>{return item = item.split(',').map(item=> Number(item))})
|
|
|
this.setQuery.shopMenuId = this.setQuery.shopMenuId.split(',').map(item=> Number(item))
|
|
|
+ this.setQuery.platformType = this.setQuery.platformType.split(',')
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -508,12 +592,13 @@ export default {
|
|
|
let that = this
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
- this.map = new BMapGL.Map("container");
|
|
|
+ this.map = new BMapGL.Map("container",{enableIconClick: true});
|
|
|
var geoc = new BMapGL.Geocoder();
|
|
|
- that.map.enableScrollWheelZoom(); // 启用滚轮放大缩小
|
|
|
+ this.map.enableScrollWheelZoom(true)
|
|
|
var myCity = new BMapGL.LocalCity();
|
|
|
myCity.get((result)=> {
|
|
|
console.log(result);
|
|
|
+ that.cityName = result.name
|
|
|
var cityName = result.name;
|
|
|
that.map.setCenter(cityName);
|
|
|
var point = new BMapGL.Point(result.center.lat, result.center.lng);
|
|
@@ -527,23 +612,43 @@ export default {
|
|
|
});
|
|
|
|
|
|
that.map.addEventListener("click", function (e) {
|
|
|
- console.log(1111111,e.latlng);
|
|
|
- var pt = e.latlng;
|
|
|
- that.map.removeOverlay(that.marker); //移除点标记
|
|
|
- geoc.getLocation(pt, function (rs) {
|
|
|
- var addComp = rs.addressComponents;
|
|
|
- let point1 = new BMapGL.Point(rs.point.lng, rs.point.lat);
|
|
|
- that.marker = new BMapGL.Marker(point1); // 创建标注
|
|
|
- that.map.addOverlay(that.marker); // 将标注添加到地图中
|
|
|
- that.setQuery.address = rs.address +rs.content.poi_desc
|
|
|
- // 选择营业地址时保存省市区
|
|
|
- that.setQuery.province = addComp.province
|
|
|
- that.setQuery.city = addComp.city
|
|
|
- that.setQuery.district = addComp.district
|
|
|
- that.setQuery.mapLat = rs.point.lat
|
|
|
- that.setQuery.mapLon = rs.point.lng
|
|
|
- console.log(rs);
|
|
|
- });
|
|
|
+ let itemId = that.map.getIconByClickPosition(e)
|
|
|
+ console.log(1111111,itemId);
|
|
|
+
|
|
|
+ if (itemId) {
|
|
|
+ uidToAddress({uid:itemId.uid,scope:2,output:'json',ak:'7aGqlyBw6mGwS6vNMLbmMlsHqE2OGV0E',ret_coordtype:'gcj02'}).then(res=>{
|
|
|
+ if(res.status == 0){
|
|
|
+ that.setQuery.mapLat = res.result.location.lat
|
|
|
+ that.setQuery.mapLon = res.result.location.lng
|
|
|
+ that.map.removeOverlay(that.marker); //移除点标记
|
|
|
+ that.marker = new BMapGL.Marker(res.result.location, {title: res.result.name})
|
|
|
+ that.map.addOverlay(that.marker)
|
|
|
+ that.setQuery.address = res.result.address;
|
|
|
+ that.setQuery.province = res.result.province;
|
|
|
+ that.setQuery.city = res.result.city;
|
|
|
+ that.setQuery.district = res.result.area;
|
|
|
+ that.map.centerAndZoom(res.result.location, 19);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // let url = "//api.map.baidu.com/?qt=inf&uid="+itemId.uid+'&operate=mapclick&clicktype=tile&ie=utf-8&oue=1&fromproduct=jsapi&res=api&&ak=7aGqlyBw6mGwS6vNMLbmMlsHqE2OGV0E&callback=sucess'
|
|
|
+
|
|
|
+ }
|
|
|
+ // var pt = e.latlng;
|
|
|
+ // that.map.removeOverlay(that.marker); //移除点标记
|
|
|
+ // geoc.getLocation(pt, function (rs) {
|
|
|
+ // var addComp = rs.addressComponents;
|
|
|
+ // let point1 = new BMapGL.Point(rs.point.lng, rs.point.lat);
|
|
|
+ // that.marker = new BMapGL.Marker(point1); // 创建标注
|
|
|
+ // that.map.addOverlay(that.marker); // 将标注添加到地图中
|
|
|
+ // that.setQuery.address = rs.address +rs.content.poi_desc
|
|
|
+ // // 选择营业地址时保存省市区
|
|
|
+ // that.setQuery.province = addComp.province
|
|
|
+ // that.setQuery.city = addComp.city
|
|
|
+ // that.setQuery.district = addComp.district
|
|
|
+ // that.setQuery.mapLat = rs.point.lat
|
|
|
+ // that.setQuery.mapLon = rs.point.lng
|
|
|
+ // console.log(rs);
|
|
|
+ // });
|
|
|
});
|
|
|
|
|
|
|
|
@@ -551,13 +656,17 @@ export default {
|
|
|
},
|
|
|
// 保存地址
|
|
|
saveAddress(){
|
|
|
- this.$confirm('请确认地址信息准确无误,并精确到门牌号?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.showMap = false
|
|
|
- })
|
|
|
+ this.$refs.address.validate((v) => {
|
|
|
+ if (v) {
|
|
|
+ this.$confirm('请确认地址信息准确无误,并精确到门牌号?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.showMap = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
// 规则
|
|
|
getRuleList() {
|
|
@@ -613,8 +722,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
-
|
|
|
// this.finishComplexList()
|
|
|
this.getData()
|
|
|
this.getRuleList()
|
|
@@ -652,5 +759,11 @@ export default {
|
|
|
width: 100%;
|
|
|
height: 600px;
|
|
|
}
|
|
|
+ .address-input-box {
|
|
|
+ display: flex;
|
|
|
+ .address-input {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+}
|
|
|
}
|
|
|
</style>
|