收银台打印小票

This commit is contained in:
齐天大圣 2024-10-28 09:26:02 +08:00
parent 3e812bd148
commit 202399cfbf
4 changed files with 122 additions and 52 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -2,13 +2,17 @@
<div class="container">
<!-- <img :src="logo" alt="Logo" style="margin-left: 80px;" class="logo">-->
<div class="left-img">
<div class="top-p" style="height: 130px" >
<div v-if="this.form.logoSet === '0'">
<img class="logostat" :src="imagePath + this.form.logeImage" alt="">
<hr class="dashed-line">
</div>
<div class="top-p">
<div v-if="iflogoSet(0)" style="font-size: 16px;font-weight: bold">{{form.storeName}}</div>
<div v-if="iflogoSet(1)" >{{form.title}}</div>
<div v-if="iflogoSet(2)">会员充值一件加油收银台消费</div>
</div>
<div class="conten-p" style="height: 150px">
<hr class="dashed-line">
<div class="conten-p">
<div v-if="ifcentent(0)" >订单编号xf155666555</div>
<div v-if="ifcentent(1)">卡号15xx858777</div>
<div v-if="ifcentent(2)">车牌号鲁A7788</div>
@ -16,13 +20,15 @@
<div v-if="ifcentent(4)">手机号13583017106</div>
<div v-if="ifcentent(5)">余额999</div>
</div>
<div class="conten-p" style="height: 150px">
<hr class="dashed-line">
<div class="conten-p" style="height: 30px">
该区域为小票模板的固定排版
</div>
<div class="conten-p" style="height: 150px">
<hr class="dashed-line">
<div class="conten-p" style="height: 30px">
该区域为小票模板的固定排版
</div>
<hr class="dashed-line">
<div class="conten-p">
<div v-if="ifbottoms(0)">操作时间2019-09-09 12:00:00</div>
<div v-if="ifbottoms(1)">联系方式13583017776</div>
@ -31,8 +37,13 @@
<div v-if="ifbottoms(4)">地址xx街道</div>
<div v-if="ifbottoms(5)">备注{{form.remarks}}</div>
</div>
<div>
<img v-if="this.form.logeImage" :src="imagePath + this.form.logeImage" alt="">
<hr class="dashed-line">
<div v-if="this.form.codeSet === '1'">
<img class="logostat" :src="imagePath + this.form.codeImage" alt="">
<hr class="dashed-line">
</div>
<div class="left-img_down">
谢谢惠顾欢迎下次光临
</div>
</div>
<div class="form-container">
@ -44,23 +55,6 @@
<el-radio v-model="logoSet" label="1">不打印小票LOGO</el-radio>
</el-radio-group>
<!-- logo -->
<el-upload
:action="uploadAction"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="handleUploadSuccessCover">
<img
v-if="this.form.logeImage"
:src="imagePath + this.form.logeImage"
class="list-img"
style="width: 100%; height: auto;"
/>
<i v-if="!this.form.logeImage" class="el-icon-plus"></i>
</el-upload>
</div>
<p style="font-weight: bold;">抬头脚注设置</p>
<el-checkbox-group v-model="form.headfootSets" class="vertical-checkbox-group">
@ -72,7 +66,7 @@
<div class="checkbox-input-container">
<el-checkbox :label="2">小票类型</el-checkbox>
<span style="font-size: 10px">会员充值加油收银台消费</span>
<span style="font-size: 10px">会员充值加油收银台消费</span>
</div>
<div class="checkbox-input-container">
@ -108,30 +102,62 @@
<el-radio v-model="logoSet" label="1">自定义二维码</el-radio>
<el-radio v-model="logoSet" label="2">不打印二维码</el-radio>
</el-radio-group>
<!-- 二维码 -->
<el-upload
:action="uploadAction"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="ermUploadSuccessCover">
<img
v-if="this.form.codeImage"
:src="imagePath + this.form.codeImage"
class="list-img"
style="width: 100%; height: auto"
/>
<i v-if="!this.form.codeImage" class="el-icon-plus"></i>
</el-upload>
<div style="width: 600px; margin-left: auto">
<el-input
v-if="this.form.codeSet==='1'"
v-model="form.codeContent" placeholder="请输入二维码的内容"></el-input>
</div>
</div>
<el-form-item>
<el-button type="primary" @click="submitForm3('form')">保存并同步更新小票样式</el-button>
</el-form-item>
</el-form>
</div>
<div class="relative">
<el-upload
:action="uploadAction"
v-if="this.form.logoSet === '0'"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="handleUploadSuccessCover">
<img
v-if="this.form.logeImage"
:src="imagePath + this.form.logeImage"
class="list-img"
style="width: 100%; height: auto;"
/>
<i v-if="!this.form.logeImage" class="el-icon-plus"></i>
</el-upload>
</div>
<div class="relative1">
<div>
样例
</div>
<!-- 二维码 -->
<el-upload
v-if="this.form.codeSet==='1'"
:action="uploadAction"
list-type="picture-card"
:class="{hide:hideUpload}"
:file-list="uploadFiles"
:auto-upload="true"
:show-file-list="false"
:headers="uploadHeader"
:on-success="ermUploadSuccessCover">
<img
v-if="this.form.codeImage"
:src="imagePath + this.form.codeImage"
class="list-img"
style="width: 100%; height: auto"
/>
<i v-if="!this.form.codeImage" class="el-icon-plus"></i>
</el-upload>
</div>
</div>
</template>
@ -157,6 +183,7 @@ export default {
codeImage:'',
title:'',
foot:'',
codeContent:'',
},
form2: {
id:'',
@ -170,6 +197,7 @@ export default {
codeImage:'',
title:'',
foot:'',
codeContent:'',
},
logoSet: '', //
ding: '',
@ -245,6 +273,7 @@ export default {
this.form2.codeImage= this.form.codeImage
this.form2.title= this.form.title
this.form2.foot= this.form.foot
this.form2.codeContent= this.form.codeContent
return this.form2;
}
}
@ -253,6 +282,8 @@ export default {
<style lang="scss" scoped>
.left-img{
position: relative;
display: inline-block;
width: 300px;
height: 830px;
background: url("../../assets/images/xpiao.png") no-repeat;
@ -311,16 +342,14 @@ export default {
.top-p{
text-align: center;
box-sizing: border-box;
padding: 15px;
padding-top: 30px;
padding-top: 10px;
font-size: 14px;
}
.conten-p{
box-sizing: border-box;
padding: 15px;
padding-left: 30px;
font-size: 14px;
margin-top: 10px;
}
.container {
@ -397,7 +426,37 @@ avatar-uploader .el-upload {
.el-form-item {
display: flex;
justify-content: center;
margin-top: 20px;
margin-top: 70px;
}
.relative {
position: relative;
left: 20px; /* 向左偏移20像素 */
top: 10px; /* 向上偏移10像素 */
}
.relative1 {
position: relative;
left: -130px; /* 向左偏移20像素 */
top: 600px; /* 向上偏移10像素 */
}
.logostat{
filter: grayscale(100%);
width: 100px;
height: 100px;
margin-left: 30%;
margin-top: 20px;
}
.dashed-line {
border-top: 1px dashed #f2f2f2; /* 虚线的颜色和宽度 */
width: 92%; /* 虚线的长度 */
margin:11px 10px 0; /* 上下外边距 */
clear: both; /* 清除浮动,如果有的话 */
}
.left-img_down{
margin-top: 10px;
margin-left: 5%;
width: 90%;
text-align: center;
font-size: 12px;
}
</style>

View File

@ -17,7 +17,7 @@
order_number, member_card, plate_number, membership_level, phone_number,
member_points, bottom_set, operate_time,
contact_way, console_operator, address, remarks, code_set, code_image,
loge_image,store_id,create_name,create_time,create_by,update_time,update_by,print_template_top,print_template_down)
loge_image,store_id,create_name,create_time,create_by,update_time,update_by,print_template_top,print_template_down,code_content)
VALUES (#{receiptPrinting.logoSet}, #{receiptPrinting.headfootSet}, #{receiptPrinting.shopName}, #{receiptPrinting.title},
#{receiptPrinting.receiptType}, #{receiptPrinting.foot}, #{receiptPrinting.topSet},
#{receiptPrinting.orderNumber}, #{receiptPrinting.memberCard}, #{receiptPrinting.plateNumber},
@ -26,7 +26,7 @@
#{receiptPrinting.contactWay}, #{receiptPrinting.consoleOperator}, #{receiptPrinting.address},
#{receiptPrinting.remarks}, #{receiptPrinting.codeSet}, #{receiptPrinting.codeImage}, #{receiptPrinting.logeImage}
, #{receiptPrinting.storeId}, #{receiptPrinting.createName}, #{receiptPrinting.createTime}, #{receiptPrinting.createBy}
, #{receiptPrinting.updateTime}, #{receiptPrinting.updateBy}, #{receiptPrinting.printTemplateTop}, #{receiptPrinting.printTemplateDown})
, #{receiptPrinting.updateTime}, #{receiptPrinting.updateBy}, #{receiptPrinting.printTemplateTop}, #{receiptPrinting.printTemplateDown},#{receiptPrinting.codeContent})
ON DUPLICATE KEY UPDATE
logo_set = #{receiptPrinting.logoSet}, headfoot_set = #{receiptPrinting.headfootSet}, shop_name = #{receiptPrinting.shopName},
title = #{receiptPrinting.title}, receipt_type = #{receiptPrinting.receiptType}, foot = #{receiptPrinting.foot},
@ -38,6 +38,7 @@
address = #{receiptPrinting.address}, remarks = #{receiptPrinting.remarks}, code_set = #{receiptPrinting.codeSet},
code_image = #{receiptPrinting.codeImage},loge_image = #{receiptPrinting.logeImage},update_time = #{receiptPrinting.updateTime},
update_by = #{receiptPrinting.updateBy},print_template_top= #{receiptPrinting.printTemplateTop},print_template_down= #{receiptPrinting.printTemplateDown}
,code_content=#{receiptPrinting.codeContent}
</insert>
<select id="queryReceiptPrintingOne" resultType="com.fuint.business.setting.entity.ReceiptPrinting">

View File

@ -24,6 +24,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
@ -182,7 +184,7 @@ public class ReceiptPrintingServiceImpl extends ServiceImpl<ReceiptPrintingMappe
}
if(receiptPrinting.getCodeSet().equals("1")){
// sb1.append("<QR>"+receiptPrinting.getCodeContent()+"</QR>\r\n");
sb1.append("<QR>www.baidu.com</QR>\r\n");
sb1.append("<QR>"+receiptPrinting.getCodeContent()+"</QR>\r\n");
}
sb1.append("----------------------------\r\n");
sb1.append("<center>谢谢惠顾,欢迎下次光临!</center>\r\n");
@ -253,6 +255,14 @@ public class ReceiptPrintingServiceImpl extends ServiceImpl<ReceiptPrintingMappe
}
}
m.init(infoByStoreId.get(i).getAppKey(), infoByStoreId.get(i).getAppSecret());
InetAddress inetAddress = null;
try {
inetAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
String ipAddress = inetAddress.getHostAddress();
System.out.println(ipAddress);
System.out.println("http://192.168.31.54:81/dev-api/static/uploadImages/20241021/1be3cfc573d043d6b6eb42eac97e05a5.jpg");
String url=m.setIcon(infoByStoreId.get(i).getMachineCode(), "https://www.baidu.com/img/flexible/logo/pc/result.png");
if (ObjectUtil.isNotEmpty(url)) {