2023-10-12 18:50:33 +08:00
|
|
|
|
<template>
|
2023-10-16 18:04:58 +08:00
|
|
|
|
<div class="app-container">
|
2023-10-13 18:11:05 +08:00
|
|
|
|
<el-card class="card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
2023-11-24 18:13:11 +08:00
|
|
|
|
<span>{{ store.name }}{{store.description? "("+store.description+")":"" }}</span>
|
2023-10-12 18:50:33 +08:00
|
|
|
|
</div>
|
2023-12-18 18:44:02 +08:00
|
|
|
|
<!-- 上传图片-->
|
|
|
|
|
<div style="display: flex">
|
|
|
|
|
<span>店铺logo:</span>
|
2023-12-19 18:03:05 +08:00
|
|
|
|
<imgUpload1 v-if="flag" :imgUrl="store.logo" :limit="1" @input="getImgUrl"></imgUpload1>
|
2023-12-18 18:44:02 +08:00
|
|
|
|
</div>
|
|
|
|
|
<!-- 上传图片-->
|
|
|
|
|
<div style="display: flex">
|
|
|
|
|
<span>门头照:</span>
|
2023-12-19 18:03:05 +08:00
|
|
|
|
<imgUpload1 v-if="flag" :doorUrl="store.doorstepPhoto" @input="getDoorImgUrl"></imgUpload1>
|
2023-12-18 18:44:02 +08:00
|
|
|
|
</div>
|
2023-10-13 18:11:05 +08:00
|
|
|
|
|
2023-10-16 18:04:58 +08:00
|
|
|
|
<map-componment :pform="form" ref="mapRef" @pform="getForm"></map-componment>
|
2023-10-13 18:11:05 +08:00
|
|
|
|
<div style="display: flex;margin-bottom: 20px">
|
|
|
|
|
<span style="margin-right: 10px">店铺福利:</span>
|
|
|
|
|
<el-checkbox-group v-model="welfare" ref="" @change="getCheckbox">
|
|
|
|
|
<el-checkbox
|
|
|
|
|
v-for="dict in dict.type.store_welfare"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
></el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</div>
|
|
|
|
|
<el-button type="primary" @click="submitStore">保存信息</el-button>
|
2023-10-12 18:50:33 +08:00
|
|
|
|
</el-card>
|
2023-10-16 18:04:58 +08:00
|
|
|
|
|
2023-10-13 18:11:05 +08:00
|
|
|
|
<el-card class="card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
2024-01-31 17:05:12 +08:00
|
|
|
|
<span>油站二维码</span>
|
2023-10-13 18:11:05 +08:00
|
|
|
|
</div>
|
|
|
|
|
<img id="collection" class="qrcode" :src="collectionImg" /><br/>
|
|
|
|
|
<el-button class="but" type="primary"
|
|
|
|
|
icon="el-icon-download"
|
|
|
|
|
@click="handleDownloadqrCode('collection')">
|
2024-01-31 17:05:12 +08:00
|
|
|
|
下载油站二维码
|
2023-10-13 18:11:05 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
</el-card>
|
2023-10-16 18:04:58 +08:00
|
|
|
|
|
2024-01-31 17:05:12 +08:00
|
|
|
|
<!-- <el-card class="card">-->
|
|
|
|
|
<!-- <div slot="header" class="clearfix">-->
|
|
|
|
|
<!-- <span>收款二维码</span>-->
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
<!-- <img id="payment" class="qrcode" :src="paymentImg" /><br/>-->
|
|
|
|
|
<!-- <el-button class="but" type="primary"-->
|
|
|
|
|
<!-- icon="el-icon-download"-->
|
|
|
|
|
<!-- @click="handleDownloadqrCode('payment')">-->
|
|
|
|
|
<!-- 下载收款二维码-->
|
|
|
|
|
<!-- </el-button>-->
|
|
|
|
|
<!-- </el-card>-->
|
2023-10-12 18:50:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import QRCode from 'qrcode'
|
2023-10-13 18:11:05 +08:00
|
|
|
|
import html2canvas from "html2canvas";
|
|
|
|
|
import {listQRCode} from "@/api/staff/qrcode";
|
|
|
|
|
import {ljStoreInfo, updateStore} from "@/api/staff/store";
|
|
|
|
|
import mapComponment from "@/components/map/mapComponent.vue";
|
2023-12-18 18:44:02 +08:00
|
|
|
|
import imgUpload from "@/components/ImageUpload/index.vue"
|
|
|
|
|
import imgUpload1 from "@/components/map/imgUpload.vue"
|
2023-10-13 18:11:05 +08:00
|
|
|
|
|
2023-10-12 18:50:33 +08:00
|
|
|
|
export default {
|
2023-10-13 18:11:05 +08:00
|
|
|
|
components:{
|
|
|
|
|
mapComponment,
|
2023-12-18 18:44:02 +08:00
|
|
|
|
imgUpload,
|
|
|
|
|
imgUpload1,
|
2023-10-13 18:11:05 +08:00
|
|
|
|
},
|
|
|
|
|
name: "map-view",
|
|
|
|
|
dicts: ['store_welfare'],
|
|
|
|
|
props: {
|
|
|
|
|
data: {
|
|
|
|
|
type: Object
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-10-12 18:50:33 +08:00
|
|
|
|
data(){
|
|
|
|
|
return{
|
2023-12-19 18:03:05 +08:00
|
|
|
|
flag:false,
|
2023-12-18 18:44:02 +08:00
|
|
|
|
// 上传文件列表
|
|
|
|
|
uploadFiles: [
|
|
|
|
|
{name:"nihao",
|
2024-02-01 10:03:16 +08:00
|
|
|
|
url:'http://localhost:8080/static/uploadImages/20231218/c4b1c4fc7cfc4dd4a4acf1e922cacc86.png'}
|
2023-12-18 18:44:02 +08:00
|
|
|
|
],
|
2023-10-13 18:11:05 +08:00
|
|
|
|
// 门店二维码
|
|
|
|
|
collectionImg:'',
|
|
|
|
|
// 收款二维码
|
|
|
|
|
paymentImg:'',
|
|
|
|
|
qrcode: {},
|
|
|
|
|
store:{},
|
|
|
|
|
// 地图实例
|
|
|
|
|
map: null,
|
|
|
|
|
polygons: [],
|
|
|
|
|
// 标记点
|
|
|
|
|
marker: "",
|
|
|
|
|
// 地址逆解析
|
|
|
|
|
geoCoder: null,
|
|
|
|
|
// 搜索提示
|
|
|
|
|
AutoComplete: null,
|
|
|
|
|
// 搜索关键字
|
|
|
|
|
keywords: "",
|
|
|
|
|
// 位置信息
|
|
|
|
|
form: {
|
|
|
|
|
lng: "",
|
|
|
|
|
lat: "",
|
|
|
|
|
address: "",
|
|
|
|
|
adcode: "", //地区编码
|
|
|
|
|
},
|
|
|
|
|
// 搜索节流阀
|
|
|
|
|
loading: false,
|
|
|
|
|
// 搜索提示信息
|
|
|
|
|
options: [],
|
|
|
|
|
welfare:[],
|
2023-10-12 18:50:33 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
2023-10-13 18:11:05 +08:00
|
|
|
|
this.getQRCodeInfo();
|
|
|
|
|
this.getStore();
|
2023-10-16 18:04:58 +08:00
|
|
|
|
this.getForm()
|
2023-10-12 18:50:33 +08:00
|
|
|
|
},
|
2023-10-13 18:11:05 +08:00
|
|
|
|
methods: {
|
2023-12-18 18:44:02 +08:00
|
|
|
|
handleUploadSuccessCover(file) {
|
|
|
|
|
this.dataForm.coverImage = file.data.fileName;
|
|
|
|
|
},
|
|
|
|
|
// 获取图片url地址
|
|
|
|
|
getImgUrl(val){
|
|
|
|
|
let list = val.split("/static")
|
|
|
|
|
this.store.logo = "/static"+list[list.length-1]
|
|
|
|
|
},
|
|
|
|
|
// 获取图片url地址
|
|
|
|
|
getDoorImgUrl(val){
|
2023-12-19 18:03:05 +08:00
|
|
|
|
let list = val.split(",")
|
|
|
|
|
let doorUrl = []
|
|
|
|
|
list.forEach(item => {
|
|
|
|
|
doorUrl.push("/static"+item.split("/static")[1])
|
|
|
|
|
})
|
|
|
|
|
// console.log(list,doorUrl)
|
|
|
|
|
this.store.doorstepPhoto = JSON.stringify(doorUrl)
|
|
|
|
|
// this.store.doorstepPhoto = val
|
2023-12-18 18:44:02 +08:00
|
|
|
|
},
|
2023-10-16 18:04:58 +08:00
|
|
|
|
getForm(data){
|
|
|
|
|
if (data != undefined){
|
|
|
|
|
this.form.lat = data.lat;
|
|
|
|
|
this.form.lng = data.lng;
|
|
|
|
|
this.form.address = data.address;
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-10-13 18:11:05 +08:00
|
|
|
|
// 获取门店信息
|
|
|
|
|
getStore() {
|
|
|
|
|
ljStoreInfo().then(response => {
|
|
|
|
|
this.store = response.data
|
2024-01-02 18:36:47 +08:00
|
|
|
|
// console.log(response.data)
|
2023-12-19 18:03:05 +08:00
|
|
|
|
this.$emit("getUrl",this.store)
|
2023-10-13 18:11:05 +08:00
|
|
|
|
this.form.lat = this.store.latitude;
|
|
|
|
|
this.form.lng = this.store.longitude;
|
|
|
|
|
this.form.address = this.store.address;
|
2023-11-24 18:13:11 +08:00
|
|
|
|
if (this.store.welfare!=null){
|
|
|
|
|
this.welfare = this.store.welfare.split(",")
|
|
|
|
|
}
|
2023-10-16 18:04:58 +08:00
|
|
|
|
this.$refs.mapRef.initAMap();
|
2023-12-19 18:03:05 +08:00
|
|
|
|
this.flag = true;
|
2023-10-13 18:11:05 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getCheckbox(){
|
|
|
|
|
this.store.welfare = this.welfare.toString();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
submitStore(){
|
2023-10-16 18:04:58 +08:00
|
|
|
|
this.store.latitude = this.form.lat;
|
|
|
|
|
this.store.longitude = this.form.lng;
|
|
|
|
|
this.store.address = this.form.address;
|
2023-10-13 18:11:05 +08:00
|
|
|
|
updateStore(this.store).then(response => {
|
|
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
|
|
this.getStore();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 获取二维码信息
|
|
|
|
|
getQRCodeInfo(){
|
|
|
|
|
listQRCode().then(response => {
|
|
|
|
|
this.qrcode = response.data.records;
|
2024-02-21 17:02:13 +08:00
|
|
|
|
this.getQRcode();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 获取二维码信息
|
|
|
|
|
getQRCodeInfoByStoreId(){
|
|
|
|
|
listQRCode().then(response => {
|
|
|
|
|
this.qrcode = response.data.records;
|
2023-10-13 18:11:05 +08:00
|
|
|
|
this.getQRcode();
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 根据字符串获取二维码图片url地址
|
2023-10-12 18:50:33 +08:00
|
|
|
|
getQRcode(){
|
2023-10-13 18:11:05 +08:00
|
|
|
|
let opts = {
|
|
|
|
|
errorCorrectionLevel: "L",//容错级别
|
|
|
|
|
type: "image/png",//生成的二维码类型
|
|
|
|
|
quality: 0.3,//二维码质量
|
|
|
|
|
margin: 0,//二维码留白边距
|
|
|
|
|
width: 180,//宽
|
|
|
|
|
height: 180,//高
|
|
|
|
|
text: "http://www.xxx.com",//二维码内容
|
|
|
|
|
color: {
|
|
|
|
|
dark: "#666666",//前景色
|
|
|
|
|
light: "#fff"//背景色
|
|
|
|
|
}
|
|
|
|
|
};
|
2023-11-24 18:13:11 +08:00
|
|
|
|
if (this.qrcode.length > 0){
|
|
|
|
|
//this.QRlink 生成的二维码地址url
|
|
|
|
|
QRCode.toDataURL(this.qrcode[0].collection, opts , (err, url) => {
|
|
|
|
|
if (err) throw err
|
|
|
|
|
//将生成的二维码路径复制给data的QRImgUrl
|
|
|
|
|
this.collectionImg= url
|
|
|
|
|
})
|
|
|
|
|
QRCode.toDataURL(this.qrcode[0].payment, opts , (err, url) => {
|
|
|
|
|
if (err) throw err
|
|
|
|
|
//将生成的二维码路径复制给data的QRImgUrl
|
|
|
|
|
this.paymentImg= url
|
|
|
|
|
})
|
|
|
|
|
}
|
2023-10-13 18:11:05 +08:00
|
|
|
|
},
|
|
|
|
|
// 根据dom生成图片并下载到本地
|
|
|
|
|
handleDownloadqrCode(id) {
|
|
|
|
|
html2canvas(document.getElementById(id)).then((canvas) => {
|
|
|
|
|
let imgUrl = canvas.toDataURL("image/png"); //可将 canvas 转为 base64 格式
|
|
|
|
|
let a = document.createElement('a')
|
|
|
|
|
a.href = imgUrl;
|
|
|
|
|
if (id=='collection'){
|
|
|
|
|
a.download = "门店二维码"; //文件名
|
|
|
|
|
}else {
|
|
|
|
|
a.download = "收款二维码"; //文件名
|
|
|
|
|
}
|
|
|
|
|
document.body.appendChild(a);
|
|
|
|
|
a.click(); // 触发点击
|
|
|
|
|
document.body.removeChild(a); // 然后移除
|
|
|
|
|
});
|
|
|
|
|
},
|
2023-10-12 18:50:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2023-10-16 18:04:58 +08:00
|
|
|
|
.app-container{
|
2023-10-18 18:31:46 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2023-10-16 18:04:58 +08:00
|
|
|
|
background: #f6f8f9;
|
|
|
|
|
}
|
2023-10-13 18:11:05 +08:00
|
|
|
|
.card{
|
2023-10-16 18:04:58 +08:00
|
|
|
|
margin: 15px auto;
|
2023-10-13 18:11:05 +08:00
|
|
|
|
}
|
2023-10-12 18:50:33 +08:00
|
|
|
|
.qrcode{
|
|
|
|
|
width: 180px;
|
|
|
|
|
height: 180px;
|
2023-10-13 18:11:05 +08:00
|
|
|
|
margin-top: 15px;
|
2023-10-12 18:50:33 +08:00
|
|
|
|
}
|
|
|
|
|
.but{
|
2023-10-13 18:11:05 +08:00
|
|
|
|
margin-top: 15px;
|
2023-10-12 18:50:33 +08:00
|
|
|
|
width: 180px;
|
|
|
|
|
}
|
|
|
|
|
.copy{
|
|
|
|
|
width: 50%;
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|