This commit is contained in:
cun-nan 2024-07-06 15:02:10 +08:00
parent aaa5ca3c24
commit f075b31b3a
9 changed files with 141 additions and 121 deletions

View File

@ -77,6 +77,9 @@
.el-range-editor.el-input__inner {
display: inline-flex !important;
}
.el-input__inner:focus {
border-color: #FF9655 !important;
}
// to fix el-date-picker css style
.el-range-separator {

View File

@ -2,79 +2,85 @@
<div class="app-container">
<el-row>
<el-col :span="18">
<el-card class="card" style="height: 75vh">
<el-card class="card">
<div slot="header" class="clearfix">
<span>{{ store.name }}{{store.description? "("+store.description+")":"" }}</span>
<span>{{ store.name }}{{ store.description ? "(" + store.description + ")" : "" }}</span>
</div>
<el-row>
<el-col :span="12">
<!-- <el-col :span="12">-->
<!-- 上传图片-->
<div style="display: flex">
<span style="margin-right: 10px">店铺logo</span>
<imgUpload1 v-if="flag" :imgUrl="store.logo" :limit="1" @input="getImgUrl"></imgUpload1>
</div>
<!-- 上传图片-->
<div style="display: flex; margin-top: 20px ">
<span style="margin-right: 20px">门头照</span>
<imgUpload1 v-if="flag" :doorUrl="store.doorstepPhoto" @input="getDoorImgUrl"></imgUpload1>
</div>
<!-- 上传图片-->
<div style="display: flex">
<span style="margin-right: 10px">店铺logo</span>
<imgUpload1 v-if="flag" :imgUrl="store.logo" :limit="1" @input="getImgUrl"></imgUpload1>
</div>
<!-- 上传图片-->
<div style="display: flex; margin-top: 20px ">
<span style="margin-right: 20px">门头照</span>
<imgUpload1 v-if="flag" :doorUrl="store.doorstepPhoto" @input="getDoorImgUrl"></imgUpload1>
</div>
<div style="display: flex;margin-bottom: 20px">
<p>退款密码
<el-input v-model="store.refPass" style="width: 50%" show-password></el-input>
</p>
</div>
</el-col>
<el-col :span="12">
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<map-componment :pform="form" ref="mapRef" @pform="getForm"></map-componment>
<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>
<map-componment :pform="form" ref="mapRef" @pform="getForm"></map-componment>
<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-col>
<!-- </el-col>-->
</el-row>
<el-button type="primary" @click="submitStore">保存信息</el-button>
</el-card>
<el-button type="primary" @click="submitStore">保存信息</el-button>
</el-card>
</el-col>
<el-col :span="6">
<el-card class="card" style="margin-left: 20px; height: 75vh">
<div slot="header" class="clearfix">
<span>油站二维码</span>
</div>
<el-button style="margin-left: 0px" type="text" v-if="type==0" @click="getQRCodeInfoByStoreId(1)">切换样式</el-button><br/>
<el-button style="margin-left: 0px" type="text" v-if="type==1" @click="getQRCodeInfoByStoreId(0)">切换样式</el-button><br/>
<img id="collection" class="qrcode" :src="baseUrl + collectionImg" /><br/>
<el-button class="but" type="primary"
icon="el-icon-download"
@click="handleDownloadqrCode('collection')">
下载油站二维码
</el-button>
</el-card>
<el-card class="card" style="margin-left: 20px;">
<div slot="header" class="clearfix">
<span>油站二维码</span>
</div>
<div style="position: relative;">
<img id="collection" class="qrcode" :src="baseUrl + collectionImg"/><br/>
<div style="display: flex;justify-content: center;position: absolute;bottom: 25px;left: 90px" >
<el-button type="warning" size="small"
@click="handleDownloadqrCode('collection')">
下载图片
</el-button>
<el-button style="margin-left: 10px;color: #409EFF" size="small" v-if="type==0" @click="getQRCodeInfoByStoreId(1)">切换样式
</el-button>
<br/>
<el-button style="margin-left: 10px;color: #409EFF" size="small" v-if="type==1" @click="getQRCodeInfoByStoreId(0)">切换样式
</el-button>
</div>
</div>
</el-card>
</el-col>
</el-row>
<!-- <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>-->
<!-- <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>-->
</div>
</template>
<script>
@ -87,7 +93,7 @@ import imgUpload from "@/components/ImageUpload/index.vue"
import imgUpload1 from "@/components/map/imgUpload.vue"
export default {
components:{
components: {
mapComponment,
imgUpload,
imgUpload1,
@ -99,20 +105,22 @@ export default {
type: Object
}
},
data(){
return{
flag:false,
data() {
return {
flag: false,
//
uploadFiles: [
{name:"nihao",
url:'http://localhost:8080/static/uploadImages/20231218/c4b1c4fc7cfc4dd4a4acf1e922cacc86.png'}
{
name: "nihao",
url: 'http://localhost:8080/static/uploadImages/20231218/c4b1c4fc7cfc4dd4a4acf1e922cacc86.png'
}
],
//
collectionImg:'',
collectionImg: '',
//
paymentImg:'',
paymentImg: '',
qrcode: {},
store:{},
store: {},
//
map: null,
polygons: [],
@ -135,9 +143,9 @@ export default {
loading: false,
//
options: [],
welfare:[],
type:0,
baseUrl:process.env.VUE_APP_BASE_API,
welfare: [],
type: 0,
baseUrl: process.env.VUE_APP_BASE_API,
}
},
created() {
@ -151,23 +159,23 @@ export default {
this.dataForm.coverImage = file.data.fileName;
},
// url
getImgUrl(val){
getImgUrl(val) {
let list = val.split("/static")
this.store.logo = "/static"+list[list.length-1]
this.store.logo = "/static" + list[list.length - 1]
},
// url
getDoorImgUrl(val){
getDoorImgUrl(val) {
let list = val.split(",")
let doorUrl = []
list.forEach(item => {
doorUrl.push("/static"+item.split("/static")[1])
doorUrl.push("/static" + item.split("/static")[1])
})
// console.log(list,doorUrl)
this.store.doorstepPhoto = JSON.stringify(doorUrl)
// this.store.doorstepPhoto = val
},
getForm(data){
if (data != undefined){
getForm(data) {
if (data != undefined) {
this.form.lat = data.lat;
this.form.lng = data.lng;
this.form.address = data.address;
@ -178,12 +186,12 @@ export default {
ljStoreInfo().then(response => {
this.store = response.data
// console.log(response.data)
this.$emit("getUrl",this.store)
this.$emit("getUrl", this.store)
this.form.lat = this.store.latitude;
this.form.lng = this.store.longitude;
this.form.address = this.store.address;
this.form.refPass = this.store.refPass;
if (this.store.welfare!=null){
if (this.store.welfare != null) {
this.welfare = this.store.welfare.split(",")
}
this.$refs.mapRef.initAMap();
@ -192,11 +200,11 @@ export default {
})
},
getCheckbox(){
getCheckbox() {
this.store.welfare = this.welfare.toString();
},
submitStore(){
submitStore() {
this.store.latitude = this.form.lat;
this.store.longitude = this.form.lng;
this.store.address = this.form.address;
@ -207,21 +215,21 @@ export default {
},
//
getQRCodeInfo(){
getQRCodeInfo() {
listQRCode().then(response => {
this.qrcode = response.data.records;
this.getQRcode();
})
},
//
getQRCodeInfoByStoreId(type){
getQRCodeInfoByStoreId(type) {
this.type = type
QRCodeByStoreId({type:type}).then(response => {
QRCodeByStoreId({type: type}).then(response => {
this.collectionImg = response.data;
})
},
// url
getQRcode(){
getQRcode() {
let opts = {
errorCorrectionLevel: "L",//
type: "image/png",//
@ -235,17 +243,17 @@ export default {
light: "#fff"//
}
};
if (this.qrcode.length > 0){
if (this.qrcode.length > 0) {
//this.QRlink url
QRCode.toDataURL(this.qrcode[0].collection, opts , (err, url) => {
QRCode.toDataURL(this.qrcode[0].collection, opts, (err, url) => {
if (err) throw err
//dataQRImgUrl
this.collectionImg= url
this.collectionImg = url
})
QRCode.toDataURL(this.qrcode[0].payment, opts , (err, url) => {
QRCode.toDataURL(this.qrcode[0].payment, opts, (err, url) => {
if (err) throw err
//dataQRImgUrl
this.paymentImg= url
this.paymentImg = url
})
}
},
@ -255,9 +263,9 @@ export default {
let imgUrl = canvas.toDataURL("image/png"); // canvas base64
let a = document.createElement('a')
a.href = imgUrl;
if (id=='collection'){
if (id == 'collection') {
a.download = "门店二维码"; //
}else {
} else {
a.download = "收款二维码"; //
}
document.body.appendChild(a);
@ -270,25 +278,28 @@ export default {
</script>
<style lang="scss" scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
.card{
margin: 15px auto;
}
.qrcode{
width: 300px;
margin-top: 0px;
}
.but{
margin-top: 20px;
margin-left: 50px;
width: 180px;
}
.copy{
width: 50%;
margin-top: 20px;
}
.app-container {
width: 100%;
height: 100%;
background: #f6f8f9;
}
.card {
margin: 15px auto;
}
.qrcode {
width: 350px;
margin-top: 0px;
}
.but {
margin-top: 20px;
margin-left: 50px;
}
.copy {
width: 50%;
margin-top: 20px;
}
</style>

View File

@ -77,6 +77,9 @@
.el-range-editor.el-input__inner {
display: inline-flex !important;
}
.el-input__inner:focus {
border-color: #FF9655 !important;
}
// to fix el-date-picker css style
.el-range-separator {

View File

@ -339,7 +339,7 @@ public class LJStaffServiceImpl extends ServiceImpl<LJStaffMapper, LJStaff> impl
LJStaff staff = this.selectStaffById(id);
LJStore store = storeService.selectStoreByStoreId(staff.getStoreId());
//在图片上生成二维码
String backgroundImage = "static/qrCodeImg/laigeyouhui_bg.jpg";
String backgroundImage = "static/qrCodeImg/mendian_bg2.png";
String logoImage = "static/qrCodeImg/logo.png";
// if (StringUtils.isNotEmpty(store.getLogo())){
// logoImage = store.getLogo();

View File

@ -69,10 +69,10 @@ public class QrCodeUtils {
g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null);
//使用工具类生成二维码
// Image image = createQrCode(logoStream, url, 360, 360);
Image image = createQrCode(logoStream, url, 270, 270);
Image image = createQrCode(logoStream, url, 294, 294);
//将小图片绘到大图片上,500,300 .表示你的小图片在大图片上的位置
// g.drawImage(image, (bufImg.getWidth()-360)/2, 320, null);
g.drawImage(image, (bufImg.getWidth()-270)/2, 153, null);
g.drawImage(image, (bufImg.getWidth()-294)/2, 139, null);
// 设置字体样式字体大小
// g.setFont(new Font("TimesRoman", Font.BOLD, 20));
g.setFont(chineseFont());
@ -90,18 +90,18 @@ public class QrCodeUtils {
LJStaff staff1 = staffService.selectStaffByStoreId(storeId);
// 店铺名称位置文字绘制到指定位置
g.drawString(store.getName(), returnX(g,bufImg.getWidth(),store.getName()), 300);
g.drawString(store.getName(), returnX(g,bufImg.getWidth(),store.getName()), 560);
// 加油员姓名位置文字绘制到指定位置
if (ObjectUtil.isNotEmpty(staff)) {
g.drawString("加油员:"+staff.getRealName(), returnX(g, bufImg.getWidth(), "加油员:"+staff.getRealName()), 750);
g.drawString("加油员:"+staff.getRealName(), 50, 680);
}
// 站长名称位置文字绘制到指定位置
g.drawString("站长名称:"+staff1.getRealName(), returnX(g, bufImg.getWidth(), "站长名称:"+staff1.getRealName()), 810);
g.drawString("站长名称:"+staff1.getRealName(), 50, 590);
// 服务监督电话位置文字绘制到指定位置
g.drawString("服务监督电话:"+staff1.getMobile(), returnX(g, bufImg.getWidth(), "服务监督电话:"+staff1.getMobile()), 870);
g.drawString("服务监督电话:"+staff1.getMobile(), 50, 620);
// 店铺地址位置文字绘制到指定位置
// g.drawString(store.getAddress(), returnX(g,bufImg.getWidth(),store.getAddress()), 900);
drawStringWithMultiLine(g,store.getAddress(), bufImg.getWidth()-20,20,940,10 );
drawStringWithMultiLine(g,store.getAddress(), bufImg.getWidth()-90,51,650,5 );
}else {
drawStringWithMultiLine(g,"欢迎光临", bufImg.getWidth()-20,20,940,10 );
g.drawString("欢迎光临:", returnX(g, bufImg.getWidth(), "服务监督电话:"), 870);
@ -306,17 +306,17 @@ public class QrCodeUtils {
// Font font = Font.createFont(Font.TRUETYPE_FONT, new ClassPathResource("classpath:font/msyh.ttc").getFile());
// b = font.deriveFont(Font.BOLD, 40);
b = new Font("TimesRoman", Font.BOLD, 40);
b = new Font("TimesRoman", Font.BOLD, 16);
} else {
prefixFont = "/usr/share/fonts" + File.separator + "msyh.ttc";
try {
Font font = Font.createFont(Font.TRUETYPE_FONT, new File(prefixFont));
b = font.deriveFont(Font.BOLD, 40);
b = font.deriveFont(Font.BOLD, 16);
// b = new Font("msyh", Font.BOLD, 40);
} catch (Exception e) {
//如果发生异常执行默认的字体
b = new Font("msyh", Font.BOLD, 40);
b = new Font("msyh", Font.BOLD, 16);
log.error(e.getMessage(),"找不到字体");
}

View File

@ -60,9 +60,9 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
//在图片上生成二维码
String backgroundImage = "";
if (type.equals("0")){
backgroundImage = "static/qrCodeImg/mendian_bg1.png";
}else {
backgroundImage = "static/qrCodeImg/mendian_bg2.png";
}else {
backgroundImage = "static/qrCodeImg/mendian_bg1.png";
}
String logoImage = "static/qrCodeImg/logo.png";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -77,6 +77,9 @@
.el-range-editor.el-input__inner {
display: inline-flex !important;
}
.el-input__inner:focus {
border-color: #FF9655 !important;
}
// to fix el-date-picker css style
.el-range-separator {