Merge remote-tracking branch 'origin/master'

This commit is contained in:
齐天大圣 2024-06-03 08:40:24 +08:00
commit 5419d6bf53
7 changed files with 217 additions and 22 deletions

View File

@ -129,6 +129,43 @@ public class QrCodeUtils {
} }
} }
public void createLogoCodePictureByPos(InputStream backgroundStream, InputStream logoStream, String url, String outImgPath, Integer staffId, Integer storeId,String urls) {
try {
// 读取原图片信息
//使用工具类生成二维码
Image image = createQrCode(null, url, 200, 200);
// 查询当前店铺信息
if (ObjectUtils.isNotEmpty(storeId)){
LJStore store = storeService.selectStoreByStoreId(storeId);
// 查询加油员信息
LJStaff staff = null;
if (ObjectUtil.isNotEmpty(staffId)){
staff = staffService.selectStaffById(staffId);
}
LJStaff staff1 = staffService.selectStaffByStoreId(storeId);
}else {
}
// 输出图片
String urlsss = "/temp/qrCode/";
if (ObjectUtils.isNotEmpty(urls)){
urlsss = urls;
}
File file1 = new File(urlsss);
// 判断目录是否存在
if (!file1.exists()) {
file1.mkdirs();
}
FileOutputStream outImgStream = new FileOutputStream(outImgPath);
ImageIO.write((RenderedImage) image, "jpg", outImgStream);
outImgStream.flush();
outImgStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void createLogoCodePictures(InputStream logoStream, String url, String outImgPath, Integer staffId, Integer storeId,String urls) { public void createLogoCodePictures(InputStream logoStream, String url, String outImgPath, Integer staffId, Integer storeId,String urls) {
try { try {
// 读取原图片信息 // 读取原图片信息

View File

@ -40,6 +40,11 @@ public class QRCodeController extends BaseController {
String type = map.get("type"); String type = map.get("type");
return getSuccessResult(iqrCodeService.createStoreQrCode(type,request)); return getSuccessResult(iqrCodeService.createStoreQrCode(type,request));
} }
@PostMapping("/createStoreQrCodeByPos")
public ResponseObject createStoreQrCodeByPos(HttpServletRequest request, @RequestBody Map<String,String> map) throws Exception {
String type = map.get("type");
return getSuccessResult(iqrCodeService.createStoreQrCodeByPos(type,request));
}
/** /**
* 根据店铺id查询二维码信息 * 根据店铺id查询二维码信息

View File

@ -22,6 +22,7 @@ public interface IQRCodeService extends IService<QRCode> {
public IPage<QRCode> selectQRCodeList(Page page, QRCode qrCode); public IPage<QRCode> selectQRCodeList(Page page, QRCode qrCode);
String createStoreQrCode(String type, HttpServletRequest request) throws Exception; String createStoreQrCode(String type, HttpServletRequest request) throws Exception;
String createStoreQrCodeByPos(String type, HttpServletRequest request) throws Exception;
/** /**
* 根据店铺id查询二维码信息 * 根据店铺id查询二维码信息

View File

@ -90,6 +90,45 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
String saveFile = backendFileController.saveFile(resFile); String saveFile = backendFileController.saveFile(resFile);
return saveFile; return saveFile;
} }
@Override
public String createStoreQrCodeByPos(String type, HttpServletRequest request) throws Exception {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
QRCode qrCode = selectQRCodeByStoreId(storeId);
// 根据id查询员工信息和店铺信息
LJStore store = storeService.selectStoreByStoreId(storeId);
//在图片上生成二维码
String backgroundImage = "";
// if (type.equals("0")){
// backgroundImage = "static/qrCodeImg/laigeyouhui_bg.jpg";
// }else {
// backgroundImage = "static/qrCodeImg/laigeyouhui_bg1.png";
// }
String logoImage = "static/qrCodeImg/logo.png";
// if (StringUtils.isNotEmpty(store.getLogo())){
// logoImage = store.getLogo();
// }
String url = qrCode.getCollection();
String area = store.getName();
String finalPath="/temp/qrCode/" + area + ".jpg";
InputStream backgroundStream = this.getClass().getClassLoader().getResourceAsStream(backgroundImage);
InputStream logoStream = this.getClass().getClassLoader().getResourceAsStream(logoImage);
//背景图片路径 loge图片 二维码 输出地址
qrCodeUtils.createLogoCodePictureByPos(backgroundStream, logoStream, url, finalPath, null,store.getId(),null);
File file1 = new File("/temp/qrCode/");
// 判断目录是否存在
if (!file1.exists()) {
file1.mkdirs();
}
File file =new File(finalPath);
FileInputStream fileInputStream =new FileInputStream(file);
MultipartFile resFile = new MockMultipartFile("file", file.getName(), null, fileInputStream);
// 返回图片路径
String saveFile = backendFileController.saveFile(resFile);
return saveFile;
}
@Override @Override
public QRCode selectQRCode() { public QRCode selectQRCode() {

View File

@ -7,11 +7,14 @@
<view class="title_">扫码成为京博加油站会员</view> <view class="title_">扫码成为京博加油站会员</view>
<view <view
style="background: #fff;width: 215px; height: 220px; border-radius: 8px ; margin: 15px auto; box-sizing: border-box; padding-top: 10px; "> style="background: #fff;width: 215px; height: 220px; border-radius: 8px ; margin: 15px auto; box-sizing: border-box; padding-top: 10px; ">
<canvas id="qrcode" canvas-id="qrcode" <canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px; margin: 0px auto; ">
style="width: 200px;height: 200px; margin: 0px auto; "></canvas> <!-- <image url="https://cdn.uviewui.com/uview/resources/18496183264.png"></image> -->
</canvas>
</view> </view>
<view class="title_">长按识别领取会员卡</view> <view class="title_">扫码识别领取会员卡</view>
</view> </view>
<view class="p-bottom"> <view class="p-bottom">
@ -26,6 +29,7 @@
<script> <script>
import request from "../../utils/request"; import request from "../../utils/request";
import config from '@/config'
import headers from '../../components/header/headers.vue' import headers from '../../components/header/headers.vue'
import UQRCode from '../../uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js'; import UQRCode from '../../uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
@ -33,6 +37,9 @@
data() { data() {
return { return {
titles: "新增会员", titles: "新增会员",
storeId: '',
collectionImg: '',
baseUrl: config.baseUrl,
} }
}, },
@ -40,7 +47,10 @@
// this.actList = ["1", "1", "1", "1", "1", ] // this.actList = ["1", "1", "1", "1", "1", ]
// this.status = "nomore" // this.status = "nomore"
this.onReady() // this.getStore()
this.getQRCodeInfoByStoreId()
// this.onReady2()
// await this.onReady()
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log("刷新"); console.log("刷新");
@ -56,7 +66,47 @@
headers headers
}, },
methods: { methods: {
onReady() { // async getStore() {
// await request({
// url: 'business/storeInformation/store',
// method: 'get',
// params: this.form
// }).then((res) => {
// if (res.code == 200) {
// this.storeId = res.data.id
// } else {
// uni.showToast({
// title: res.data,
// icon: "none"
// })
// }
// })
// },
getQRCodeInfoByStoreId() {
request({
url: 'business/storeInformation/qrCode/createStoreQrCodeByPos',
method: 'post',
data: {
type: 0
}
}).then((res) => {
if (res.code == 200) {
this.collectionImg = res.data;
console.log("res", res)
this.onReady2()
} else {
uni.showToast({
title: res.data,
icon: "none"
})
}
})
},
onReady2() {
// uQRCode // uQRCode
var qr = new UQRCode(); var qr = new UQRCode();
// //
@ -66,11 +116,18 @@
// //
qr.make(); qr.make();
// canvas // canvas
var canvasContext = uni.createCanvasContext('qrcode', this); // this // var canvasContext = uni.createCanvasContext('qrcode', this); // this
// uQRCodecanvas // // uQRCodecanvas
qr.canvasContext = canvasContext; // qr.canvasContext = canvasContext;
// canvas // // canvas
qr.drawCanvas(); // qr.drawCanvas();
const url = this.baseUrl + this.collectionImg
// const url = ""
console.log("this.collectionImg()", url)
const ctx = uni.createCanvasContext('qrcode', this);
ctx.drawImage(url, 0, 0, 200, 200);
ctx.draw(true, () => {})
}, },
goback() { goback() {
uni.navigateTo({ uni.navigateTo({

View File

@ -38,7 +38,7 @@
</view> </view>
<view class="d-bs"> <view class="d-bs">
<view class="title_h">充值面额</view> <view class="title_h">充值面额</view>
<view class="title_lan">充值记录</view> <!-- <view class="title_lan">充值记录</view> -->
</view> </view>
<view class="wrap-box"> <view class="wrap-box">
<view class="w-box" v-for="(item,index) in numList " :key="index" @click="getindex(index,item)"> <view class="w-box" v-for="(item,index) in numList " :key="index" @click="getindex(index,item)">
@ -279,9 +279,9 @@
method: 'post', method: 'post',
data: this.order data: this.order
}).then((res) => { }).then((res) => {
// uni.navigateTo({ uni.navigateTo({
// url: '/pagesHome/PaymentResults/PaymentResults' url: '/pagesHome/PaymentResults/PaymentResults?type=1&orderNo=' + res.data.orderNo
// }) })
}) })
}, },

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="content"> <view class="content">
<view class="container"> <view class="container" v-if="oilOrder">
<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers> <headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
<view class="top_"> <view class="top_">
<image src="../../static/imgs/zfcg.png" mode=""></image> <image src="../../static/imgs/zfcg.png" mode=""></image>
@ -35,6 +35,41 @@
<view class="h-size" v-if="oilOrder.payType=='APPLET_CODE'">小程序码支付</view> <view class="h-size" v-if="oilOrder.payType=='APPLET_CODE'">小程序码支付</view>
</view> </view>
</view> </view>
<view class="container" v-if="balanceOrder">
<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
<view class="top_">
<image src="../../static/imgs/zfcg.png" mode=""></image>
</view>
<view class="title_">支付成功</view>
<!-- <view class="top_" v-if="oilOrder.orderStatus!='paid'">
<image src="../../static/imgs/zfsb.png" mode=""></image>
</view>
<view class="title_" v-if="oilOrder.orderStatus!='paid'">支付失败</view> -->
<view class="b-bs">
<view class="h-size">应收金额</view>
<view class="red-size">{{balanceOrder.orderAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">优惠金额</view>
<view class="red-size">{{balanceOrder.discountAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">实收金额</view>
<view class="red-size">{{balanceOrder.payAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">储值卡消费金额</view>
<view class="red-size">{{balanceOrder.balanceAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">支付方式</view>
<view class="h-size" v-if="balanceOrder.payType=='ALIPAY'">支付宝支付</view>
<view class="h-size" v-if="balanceOrder.payType=='WECHAT'">微信支付</view>
<view class="h-size" v-if="balanceOrder.payType=='UNIONPAY'">银联二维码支付</view>
<view class="h-size" v-if="balanceOrder.payType=='CASH'">现金支付</view>
<view class="h-size" v-if="balanceOrder.payType=='APPLET_CODE'">小程序码支付</view>
</view>
</view>
<view class="p-bottom"> <view class="p-bottom">
<view class="anniu" @click="goback()"> <view class="anniu" @click="goback()">
返回 返回
@ -53,15 +88,23 @@
titles: "支付结果", titles: "支付结果",
orderNo: "", orderNo: "",
oilOrder: {}, oilOrder: {},
balanceOrder: {},
} }
}, },
onLoad(e) { onLoad(e) {
if (e.type && e.type == 1) {
this.orderNo = e.orderNo this.orderNo = e.orderNo
this.getBalanceOrder()
} else {
this.orderNo = e.orderNo
this.getOilOrder()
}
}, },
onShow() { onShow() {
// this.actList = ["1", "1", "1", "1", "1", ] // this.actList = ["1", "1", "1", "1", "1", ]
// this.status = "nomore" // this.status = "nomore"
this.getOilOrder()
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log("刷新"); console.log("刷新");
@ -82,11 +125,24 @@
request({ request({
url: '/business/oilOrder/orderNo', url: '/business/oilOrder/orderNo',
method: 'post', method: 'post',
data:{orderNo:this.orderNo} data: {
orderNo: this.orderNo
}
}).then((res) => { }).then((res) => {
this.oilOrder = res.data this.oilOrder = res.data
}) })
}, },
getBalanceOrder() {
request({
url: 'business/marketingActivity/activeExchange/cardValueOrders/getOneByOrderNo',
method: 'post',
data: {
orderNo: this.orderNo
}
}).then((res) => {
this.balanceOrder = res.data
})
},
goback() { goback() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/index" url: "/pages/index/index"