Commit e3060510 by ym

config

1 parent e329f0dc
......@@ -3,6 +3,9 @@
"env": {
"node": true
},
"globals": {
"AMap": true
},
"extends": ["plugin:vue/essential", "@vue/prettier"],
"rules": {
"no-console": "off",
......
......@@ -16,6 +16,7 @@
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<link href="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script" />
<% } %>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.8&key=bd290dc27d0945959280753215ddda71&plugin=AMap.Geocoder"></script>
<title>微前端子应用:博客</title>
</head>
......
/**
* 新增参数sign 判断接口是否需要sign签名
*/
/**
* 用法 : this.$apis.demo.GETLISTDEVICEFILEUNSTOCK(...)
* @param {*} params
* @returns
*/
import { http } from '@/main'
const pictureUpload = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload'
return http({
url: '/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
pictureUpload
}
\ No newline at end of file
......@@ -25,7 +25,37 @@ const findAllDictData = params => {
sign: true
})
}
const getCarbrandTree = params => {
params.method = 'cn.com.glsx.merchants.merchantCommon.getCarbrandTree'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const findMerchantDetail = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMerchantDetail'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const saveMerchant = params => {
params.method = 'cn.com.glsx.merchants.merchant.saveMerchant'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
findMerchantByPage,
findAllDictData
findAllDictData,
getCarbrandTree,
findMerchantDetail,
saveMerchant
}
\ No newline at end of file
......@@ -104,6 +104,26 @@ img {
box-shadow: 0 10px 20px 0 rgba(88, 80, 255, 0.10);
}
.scrm-flex {
display: flex;
}
.scrm-grid {
display: grid;
}
.scrm-flex-center {
display: flex;
align-items: center;
justify-content: center;
}
.scrm-flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
::-webkit-scrollbar {
/*滚动条整体样式*/
width: 6px;
......
<template>
<div class="btn-unselect" :class="{ 'selectd-type': typeStatus }" @click="tabType">
<span class="select-type-title">{{ btnLabel }}</span
><i class="btn-icon" :class="{ 'el-icon-check': typeStatus }"></i>
</div>
</template>
<script>
export default {
name: "auto-button",
props: {
btnLabel: {
type: String,
default: "",
},
typeStatus: {
type: Boolean,
default: false,
}
},
data() {
return {
};
},
methods: {
tabType() {
this.typeStatus = !this.typeStatus;
this.$emit('getBtnStatus',this.typeStatus)
},
}
};
</script>
<style lang="scss" scoped>
.btn-unselect {
display: inline-block;
cursor: pointer;
position: relative;
height: 30px;
line-height: 30px;
margin-top: 6px;
padding-right: 30px;
cursor: pointer;
font-size: 0;
-webkit-transition: 0.1s linear;
transition: 0.1s linear;
box-sizing: border-box;
&.selectd-type {
.select-type-title {
background: #5850ff;
}
}
.select-type-title {
display: inline-block;
padding: 0 16px;
height: 100%;
font-size: 14px;
border-radius: 2px 0 0 2px;
background-color: #d2d2d2;
color: #fff;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.btn-icon {
display: inline-block;
position: absolute;
right: 0;
top: 0;
width: 30px;
height: 28px;
line-height: 28px;
border: 1px solid #dcdfe6;
border-left: none;
border-radius: 2px 0px 0px 2px;
color: #5850ff;
font-size: 20px;
text-align: center;
}
}
</style>
\ No newline at end of file
<template>
<div class="map-box" :style="{height: mapHeight+ 'px'}">
<div id="container" style="width: 100%; height: 100%"></div>
<div class="map-address">{{ address }}</div>
<div id="myPageTop" style="position: absolute; top: 10px; width: 50%; left: 25%">
<el-input placeholder="请输入关键字" v-model="input" class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="searchAddress"></el-button>
</el-input>
</div>
</div>
</template>
<script>
import AMap from "AMap";
let map, placeSearch;
export default {
name: "map",
props: {
mapHeight: {
type: Number,
default: 300
}
},
data() {
return {
input: "",
address: "",
};
},
methods: {
mapInit() {
map = new AMap.Map("container", {
resizeEnable: true,
zoom: 10,
});
AMap.service(["AMap.PlaceSearch"], function () {
//构造地点查询类
placeSearch = new AMap.PlaceSearch({
citylimit: false, //是否强制限制在设置的城市内搜索
map: map, // 展现结果的地图实例
autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
renderStyle: "default",
});
});
// 添加列表点选监听事件
AMap.event.addListener(map, "click", this.getAddress);
AMap.event.addListener(placeSearch, "selectChanged", this.getAddress);
},
getAddress(e) {
let self = this;
let lnglat;
if (e.type == "click") {
lnglat = e.lnglat
} else {
console.log(e.selected.data.location)
let { lng, lat } = e.selected.data.location;
lnglat = [lng, lat];
}
AMap.plugin("AMap.Geocoder", () => {
const geocoder = new AMap.Geocoder();
geocoder.getAddress(lnglat, (status, result) => {
self.address = result.regeocode.formattedAddress;
});
});
},
searchAddress() {
placeSearch.search(this.input, function (status, result) {
if (status == "complete") {
// console.log(result.poiList.pois);
}
});
},
selectAddress(e) {
//这里获得点选地点的经纬度
this.getAddress();
},
},
mounted() {
this.mapInit();
}
};
</script>
<style scoped lang="scss">
.map-box {
position: relative;
width: 100%;
}
#container {
position: absolute;
height: 100%;
}
#panel {
position: absolute;
max-height: 90%;
overflow-y: auto;
top: 80px;
right: 10px;
width: 280px;
}
.map-address {
position: absolute;
line-height: 20px;
bottom: -30px;
}
</style>
\ No newline at end of file
......@@ -17,7 +17,7 @@ module.exports = {
code_message_map: {}
},
request: {
baseURL: 'http://rop-merchant.test.glsx.com.cn',
baseURL: '/api',
// 设置超时时间
timeout: 180000,
// 携带凭证
......@@ -33,5 +33,8 @@ module.exports = {
},
secret: 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b',
cdn: 'https://www.xxx.cn/static'
cdn: 'https://www.xxx.cn/static',
headers: {
sessionId: '123'
}
}
\ No newline at end of file
const staticRoutes = Object.freeze([
{
name: 'home',
path: '/',
meta: {},
component: resolve => require([`@/views/home/index.vue`], resolve)
}
const staticRoutes = Object.freeze([{
name: 'home',
path: '/',
meta: {},
component: resolve => require([`@/views/home/index.vue`], resolve)
},
{
name: 'addAccount',
path: '/acount/addAccount',
meta: {},
component: resolve => require([`@/views/home/addAccount.vue`], resolve)
}
])
export default staticRoutes
\ No newline at end of file
<template>
<div class="scrm-main">
<div class="account-header scrm-flex-between scrm-box-f">创建子商户/门店</div>
<div class="account-body scrm-box-f">
<div class="form-title">企业基本信息</div>
<el-form
ref="baseForm"
:model="accountAddForm"
class="account-body-form"
label-width="120px"
:rules="baseRules"
>
<el-row>
<el-col :span="12">
<el-form-item label="商户名称" prop="merchantName">
<el-input
size="small"
v-model="accountAddForm.merchantName"
placeholder="请输入商户名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商户简称">
<el-input
size="small"
v-model="accountAddForm.merchantName"
placeholder="请输入商户简称"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商户类型" class="merchant-row">
<el-input
size="small"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入组织机构号码"
v-if="accountAddForm.merchantType == 2"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" value="1"></el-option>
<el-option label="企业" value="2"></el-option>
</el-select>
</el-input>
<el-input
size="small"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入正确的身份证号"
v-if="accountAddForm.merchantType == 1"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" value="1"></el-option>
<el-option label="企业" value="2"></el-option>
</el-select>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商户地址">
<el-input size="small" v-model="accountAddForm.merchantAddress">
<el-button slot="append" @click="dialogMapVisible = true"
>选择地址</el-button
>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="联系电话" prop="merchantLegalPersonPhone">
<el-input
size="small"
v-model="accountAddForm.merchantLegalPersonPhone"
placeholder="请输入联系电话"
></el-input>
<el-checkbox v-model="accountAddForm.isloginName"
>联系电话同时作为登录账户名</el-checkbox
>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<el-input
size="small"
v-model="accountAddForm.merchantLegalPerson"
placeholder="请输入联系人"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="驻店联系人">
<el-input
size="small"
v-model="accountAddForm.residentContact"
placeholder="请输入驻店联系人"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驻店电话">
<el-input
size="small"
v-model="accountAddForm.residentPhone"
placeholder="请输入驻店电话"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业范围">
<el-checkbox-group v-model="accountAddForm.businessScope">
<el-checkbox
v-for="item in businessOption"
:label="item.dictValue"
:key="item"
>{{ item.dictLabel }}</el-checkbox
>
</el-checkbox-group>
<div class="scrm-flex-center" v-for="(item,index) in businessScopeCustomize" :key="index">
<el-input
size="small"
v-model="businessScopeCustomize[index].name"
placeholder="请自定义营业范围,建议不超过10个"
></el-input>
<i class="el-icon-circle-plus el-icon-btn" @click="addBusinessScope" v-if="index == businessScopeCustomize.length - 1"></i>
<i class="el-icon-remove el-icon-btn" @click="removeBusinessScope" v-else></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业时间">
<el-time-picker
size="small"
value-format="HH:mm:ss"
is-range
v-model="accountAddForm.bussinessTime"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
></el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="主营品牌">
<el-input size="small" v-model="accountAddForm.name"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="门店照片">
<el-upload
action=""
class="image-uploader"
:show-file-list="false"
list-type="picture-card"
v-loading="loadingImg"
:before-upload="upLoadImg"
>
<i class="el-icon-plus"></i>
</el-upload>
<div class="tips">图片格式仅支持JPG,PNG格式,大小1M</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="account-body scrm-box-f">
<div class="form-title">账户信息</div>
<el-form
ref="form"
:model="accountDetail"
class="account-body-form"
label-width="120px"
>
<el-row>
<el-col :span="12">
<el-form-item label="上级商户">
{{ accountDetail.merchantName }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上级商户模式">
{{ accountDetail.merchantModelName }}
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="账户等级">
<el-select
size="small"
v-model="accountDetail.merchantAccountLevel"
placeholder="请选择"
>
<el-option
v-for="item in accountLevel"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="登录账户名">
<el-input
size="small"
v-model="accountAddForm.merchantLoginAccount"
placeholder="请输入登录账户名"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="登录密码">
<el-input
size="small"
type="password"
v-model="accountAddForm.merchantLoginPassword"
placeholder="请输入登录密码"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="账户类型">
{{ accountAddForm.accountType }}
<auto-button :btnLabel="typeLabel" :typeStatus="false" @getBtnStatus="getBtnStatus"></auto-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="footer-panel">
<el-button type="primary" @click="handleNext">下一步</el-button>
<el-button type="primary">取消</el-button>
</div>
<el-dialog :visible.sync="dialogMapVisible" width="60%">
<map-view ref="mapForm" :mapHeight="mapHeight"></map-view>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogMapVisible = false">取 消</el-button>
<el-button type="primary" @click="getAddress">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import mapView from "@/components/mapView/index";
import autoButton from '@/components/auto-button/index'
export default {
name: "index",
components: {
mapView,
autoButton
},
data() {
return {
mapHeight: 400,
typeLabel: "",
typeStatus: false,
loadingImg: false,
dialogMapVisible: false,
businessScopeCustomize: [{name: ''}],
accountAddForm: {
merchantType: "1",
businessScope: [],
},
accountDetail: {},
accountLevel: [],
accountType: [],
businessOption: [],
accountValidityPeriod: [],
baseRules: {
merchantName: [{ required: true, message: "请输入商户名称", trigger: "blur" }],
merchantLegalPersonPhone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
],
},
};
},
methods: {
getAddress() {
this.dialogMapVisible = false;
console.log(this.$refs.mapForm.address);
},
getBtnStatus(status) {
console.log(status)
},
upLoadImg(file) {
let fileName = file.name;
if (file.name.lastIndexOf(".") === -1) {
this.$message.info("路径不正确");
return false;
}
let AllImgExt = ".jpg|.jpeg|.gif|.bmp|.png|.swf";
let extName = file.name.substring(file.name.lastIndexOf(".")).toLowerCase();
if (AllImgExt.indexOf(extName + "|") === -1) {
this.$message.info("图片格式不正确");
return false;
}
// if (fileSize < 3145728) {
if (window.FileReader) {
let reader = new FileReader();
let self = this;
reader.readAsDataURL(file);
reader.onload = (img) => {
console.log(file);
let type = fileName.split(".")[1];
let imgUrl = img.target.result.split(",")[1];
self.loadingImg = true;
self.$apis.common
.pictureUpload({
file: `${type}@${imgUrl}`,
})
.then((res) => {
if (res) {
console.log(res);
}
});
};
}
},
handleNext() {
let params = this.accountAddForm;
if (params.bussinessTime) {
params.bussinessBegintime = params.bussinessTime[0];
params.bussinessEndtime = params.bussinessTime[1];
}
// if (params.businessScope) {
// params.businessScope = params.businessScope.join(",");
// }
this.$apis.store.saveMerchant(params).then((res) => {
console.log(res);
});
},
findAllDictData(dictType) {
var params = {
dictType,
};
this.$apis.store.findAllDictData(params).then((res) => {
if (res) {
if (dictType == "account_level") {
this.accountLevel = res;
}
if (dictType == "account_type") {
this.accountType = res;
let idx = this.accountType.findIndex(
(item) => (item.dictValue = this.accountDetail.accountType)
);
this.typeLabel = this.accountType[idx].dictLabel;
}
if (dictType == "business_scope") {
this.businessOption = res;
}
}
});
},
addBusinessScope() {
this.businessScopeCustomize.push({name: ''})
},
removeBusinessScope(index) {
this.businessScopeCustomize.splice(index,1)
},
async findMerchantDetail() {
this.accountDetail = await this.$apis.store.findMerchantDetail({ id: "41352" });
this.findAllDictData("account_type");
},
},
mounted() {
this.findMerchantDetail();
this.findAllDictData("account_level");
this.findAllDictData("business_scope");
},
};
</script>
<style scoped lang="scss">
.account-header {
height: 78px;
box-sizing: border-box;
font-size: 20px;
font-weight: 500;
color: #333333;
line-height: 20px;
padding: 0px 20px;
}
.merchant-row {
/deep/ {
.el-form-item__content {
line-height: 1;
}
.el-select {
.el-input {
width: 110px;
}
}
}
}
.account-body {
margin-top: 20px;
&:nth-of-type(3) {
margin-bottom: 70px;
}
.form-title {
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 60px;
height: 60px;
border-bottom: 1px solid #d8d8d8;
padding-left: 20px;
}
&-form {
width: 80%;
margin: 20px auto;
.el-icon-btn {
color: #5850ff;
font-size: 16px;
margin-left: 6px;
cursor: pointer;
}
.tips {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 30px;
}
.btn-unselect {
display: inline-block;
cursor: pointer;
position: relative;
height: 30px;
line-height: 30px;
margin-top: 6px;
padding-right: 30px;
cursor: pointer;
font-size: 0;
-webkit-transition: 0.1s linear;
transition: 0.1s linear;
box-sizing: border-box;
&.selectd-type {
.select-type-title {
background: #5850ff;
}
}
.select-type-title {
display: inline-block;
padding: 0 16px;
height: 100%;
font-size: 14px;
border-radius: 2px 0 0 2px;
background-color: #d2d2d2;
color: #fff;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.btn-icon {
display: inline-block;
position: absolute;
right: 0;
top: 0;
width: 30px;
height: 28px;
line-height: 28px;
border: 1px solid #dcdfe6;
border-left: none;
border-radius: 2px 0px 0px 2px;
color: #5850ff;
font-size: 20px;
text-align: center;
}
}
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
bottom: 0px;
height: 64px;
background: #ffffff;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
</style>
\ No newline at end of file
......@@ -41,7 +41,8 @@ module.exports = {
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'axios': 'axios',
'echarts': 'echarts'
'echarts': 'echarts',
'AMap': 'AMap'
}
},
devServer: {
......@@ -52,15 +53,17 @@ module.exports = {
headers: {
'Access-Control-Allow-Origin': '*' // 主应用获取子应用时跨域响应头
},
// proxy: {
//     '/api': {
//         target: 'http://rop-merchant.test.glsx.com.cn',
//         changeOrigin: true,
//         pathRewrite: {
//             '^/api': '/'
//         }
//     }
// },
proxy: {    
'/api': {        
target: 'http://rop-merchant.test.glsx.com.cn',
        
changeOrigin: true,
        
pathRewrite: {            
'^/api': '/'        
}    
},
},
},
chainWebpack: config => {
config.plugin('html')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!