dev2 #1

Open
panjunjie wants to merge 201 commits from dev2 into main
4 changed files with 238 additions and 2 deletions
Showing only changes of commit 9c49263515 - Show all commits

View File

@ -112,3 +112,14 @@ export function exportFile(params) {
params,
})
}
//开分店
export function createSubStore(data) {
return request({
url: URL.shop.store.base.subStore,
method: 'post',
data:data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}

View File

@ -936,6 +936,7 @@ let url = {
//商家端-获取门店信息
get: api_url + '/admin/shop/shop-store-base/get',
exportFile: api_url + '/admin/shop/shop-store-base/exportFile',
subStore:api_url+'/admin/shop/merch/branch/apply/store',
},
activity: {
base: {

View File

@ -0,0 +1,214 @@
<template>
<el-dialog title="创建分店" :visible.sync="visible" width="50%" custom-class="center-dialog">
<div>
<el-form v-model="subStoreForm" label-width="150px">
<el-form-item label="总店" >
<el-select
v-model="subStoreForm.parent_store_id"
clearable
filterable
placeholder="选择店铺"
style="width: 200px;"
>
<el-option
v-for="item in shopList"
:key="item.store_id"
:label="item.store_name"
:value="item.store_id"
/>
</el-select>
</el-form-item>
<el-form-item label="登录手机号">
<el-input v-model="subStoreForm.login_mobile" placeholder="请输入分店登录手机号" style="width: 200px;" clearable />
</el-form-item>
<el-form-item label="登陆密码">
<el-input v-model="subStoreForm.password" type="password" placeholder="请输入登陆密码" style="width: 200px;" clearable/>
</el-form-item>
<el-form-item label="店铺名字">
<el-input v-model="subStoreForm.store_name" placeholder="请输入店铺名字" style="width: 150px;" clearable />
</el-form-item>
<el-form-item label="联系人姓名">
<el-input v-model="subStoreForm.contact_name" placeholder="请输入联系人姓名" style="width: 200px;" clearable />
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="subStoreForm.email" placeholder="请输入联系人电子邮箱" style="width: 200px;" clearable />
</el-form-item>
<div style="display: flex;margin: 20px 0;">
<div style="display: flex;align-items: center;justify-content: center;">
<div class="item-lable">门脸图</div>
<div>
<el-image
style="margin-right: 20px; width: 300px; height: 200px"
:src="subStoreForm.front_facade_image || require('@/assets/index_images/image.jpg')"
:preview-src-list="srcList1"
lazy />
<div class="upload-btn">
<el-upload
class="upload-demo"
:action="uploadUrl"
:data="uploadParams"
:show-file-list="false"
:limit="1"
:on-success="(res,file,fileList)=>handleAvatarSuccess(res,file,fileList,'front_facade_image')">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</el-upload>
</div>
</div>
</div>
<div style="display: flex;align-items: center;justify-content: center;">
<div class="item-lable">环境图</div>
<div>
<el-image
style="margin-right: 20px; width: 300px; height: 200px"
:src="subStoreForm.environment_image || require('@/assets/index_images/image.jpg')"
:preview-src-list="srcList2"
lazy />
<div class="upload-btn">
<el-upload
class="upload-demo"
:action="uploadUrl"
:data="uploadParams"
:show-file-list="false"
:limit="1"
:on-success="(res,file,fileList)=>handleAvatarSuccess(res,file,fileList,'environment_image')">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</el-upload>
</div>
</div>
</div>
</div>
<!-- <el-form-item label="店铺地址">
<el-input v-model="subStoreForm.store_address" style="width: 100%;" clearable/>
</el-form-item> -->
<el-form-item label="实体店铺详细地址"label-width="130px">
<keyword
:keyword="subStoreForm.store_address"
:location="queryArea.city.name"
:style="{ width: '100%' }"
@getAddress="getAddress"
/>
</el-form-item>
<el-form-item label="经度" size="normal">
<el-input v-model="subStoreForm.store_longitude" style="width: 150px;" disabled clearable />
</el-form-item>
<el-form-item label="纬度" size="normal">
<el-input v-model="subStoreForm.store_latitude" style="width: 150px;" disabled clearable />
</el-form-item>
</el-form>
</div>
<template #footer>
<span>
<el-button @click="close">取消</el-button>
<el-button type="primary" @click="submitSubStore">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import {createSubStore} from '@/api/store/base.js'
import GoodsToolApi from '@/api/goodsTool'
import keyword from '@/components/baiduMap/keyword'
import { URL } from '@/config'
import { getToken } from '@/utils/token'
export default {
data() {
return {
visible: false,
subStoreForm:{
parent_store_id:'',
login_mobile:'',
password:'',
store_name:'',
contact_name:'',
email:'',
front_facade_image:'',
environment_image:'',
store_address:'',
store_longitude:'',
store_latitude:'',
},
queryArea: {
province: { code: '', name: '' },
city: { code: '', name: '' },
district: { code: '', name: '' },
},
shopList: [],
srcList1:[],
srcList2:[],
uploadParams: {
authorization: "",
gallery_id: 0,
},
uploadUrl: URL.action,
}
},
components: { keyword },
created() {
this.uploadParams.authorization = getToken();
},
mounted() {
this.getShopList()
},
methods:{
open(){
this.visible=true
},
close(){
this.visible=false
},
async getShopList() {
try {
let res = await GoodsToolApi.getShopList()
this.shopList = res.data.items || []
} catch (error) {
console.error('获取店铺列表失败:', error)
}
},
async submitSubStore(){
let res=await createSubStore(this.subStoreForm);
if(res.status==200){
console.log("dadad")
}
},
getAddress(address) {
this.subStoreForm.store_address = address.value
this.echoAddress(address.lng, address.lat)
},
//
echoAddress(lng, lat) {
this.subStoreForm.store_longitude = lng
this.subStoreForm.store_latitude = lat
},
async handleAvatarSuccess(response, file, fileList, type){
if (response && response.status === 200 && response.code === 0) {
if (response.data && response.data.media_url) {
if(type != 'license_image'){
this.subStoreForm[type] = response.data.media_url
}else{
this.subStoreForm[type].push(response.data.media_url)
}
switch (type) {
case 'front_facade_image':
this.srcList1 = [response.data.media_url];
break;
case 'environment_image':
this.srcList2 = [response.data.media_url];
break;
}
}
}
},
}
}
</script>
<style scoped>
</style>

View File

@ -17,8 +17,11 @@
>
{{ __('导出打印') }}
</el-button>
<el-button icon="el-icon-plus" type="primary" @click="handleEdit()">
<!-- <el-button icon="el-icon-plus" type="primary" @click="handleEdit()">
{{ __('添加') }}
</el-button> -->
<el-button icon="el-icon-plus" type="primary" @click="handleSubStore()">
{{ __('添加分店') }}
</el-button>
</vab-query-form-left-panel>
<vab-query-form-right-panel :span="21">
@ -385,6 +388,7 @@
<detail ref="detail" @fetch-data="fetchData" />
<setState ref="setState" @fetch-data="fetchData" />
<SetCategory ref="SetCategory" />
<CreateSubStore ref="subStoreRef"/>
</div>
</template>
@ -400,6 +404,7 @@
import Detail from './components/StoreBaseDetailEdit'
import setState from './components/setState'
import LocationEdit from './components/LocationEdit'
import CreateSubStore from './components/createSubStore.vue'
import {getList as getSubsite} from "@/api/plantform/subsite";
export default {
@ -412,6 +417,7 @@
Detail,
SetCategory,
setState,
CreateSubStore
},
data() {
return {
@ -453,6 +459,7 @@
},
],
store_type: 2,
subStoreRef:null,
storeList: [
{
store_is_selfsupport: 1,
@ -571,6 +578,9 @@
this.$refs['edit'].showEdit()
}
},
handleSubStore(){
this.$refs.subStoreRef?.open()
},
handleLocationEdit(row) {
if (row) {
this.$refs['locationEdit'].showEdit(row)