处理数据
This commit is contained in:
parent
a4c1320597
commit
b68287a4dc
@ -259,7 +259,7 @@
|
||||
|
||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="110px" class="demo-ruleForm">
|
||||
<div style="display: flex; align-items: center ">
|
||||
<el-form-item label="油品类型" prop="oilType">
|
||||
<el-form-item label="油品油号" prop="oilType">
|
||||
<el-select v-model="ruleForm.oilType" placeholder="请选择" @change="getoiltype" >
|
||||
<el-option
|
||||
v-for="dict in oilList"
|
||||
@ -269,19 +269,19 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div style="margin-left: 10px" v-if="oilPrice&&gbPrice">今日油价:<span style="color: red">{{oilPrice || ''}}</span> 元/L 国标油价:<span style="color: red">{{gbPrice || ''}}</span>元/L </div>
|
||||
|
||||
</div>
|
||||
<el-form-item label="锁价活动价" prop="lockPrice">
|
||||
<el-form-item label="充值金额" prop="rechargeBalance">
|
||||
<div style="width: 217px">
|
||||
<el-input v-model="ruleForm.lockPrice" min="1" placeholder="请输入锁价活动价">
|
||||
<template slot="append">元/升</template>
|
||||
<el-input v-model="ruleForm.rechargeBalance" min="1" placeholder="请输入充值金额">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="锁价满足金额" prop="rechargeBalance">
|
||||
<el-form-item label="锁定单价" prop="lockPrice">
|
||||
<div style="width: 217px">
|
||||
<el-input v-model="ruleForm.rechargeBalance" min="1" placeholder="请输入锁价满足金额">
|
||||
<template slot="append">元</template>
|
||||
<el-input v-model="ruleForm.lockPrice" min="1" placeholder="请输入锁定单价">
|
||||
<template slot="append">元/升</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@ -327,12 +327,12 @@
|
||||
<el-radio label="2">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="附加特权" prop="resource">
|
||||
<el-form-item label="附加特权" prop="privilege">
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
maxlength="225"
|
||||
v-model="ruleForm.fringeBenefit"
|
||||
v-model="ruleForm.privilege"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
@ -349,8 +349,7 @@
|
||||
|
||||
<script>
|
||||
import { getList,oilName,addList,eitList,getById,getoilnum,getstatistics,deleteById,cardFuleOrders} from "@/api/EventMarketing/oilBlock";
|
||||
import {cardValueRecordList, cardValueRule, deletedelById, saveOrUpdate} from "@/api/EventMarketing/SaveBlock";
|
||||
import {oilNumberList1} from "@/api/order/oilnumgun";
|
||||
import {cardValueRule, saveOrUpdate} from "@/api/EventMarketing/SaveBlock";
|
||||
export default {
|
||||
dicts: ['oil_type'],
|
||||
name: 'index',
|
||||
@ -505,6 +504,9 @@
|
||||
lockPrice: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||
],
|
||||
incomeLitres:[
|
||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,13 +213,6 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
// 获取二维码信息
|
||||
getQRCodeInfo() {
|
||||
listQRCode().then(response => {
|
||||
this.qrcode = response.data.records;
|
||||
this.getQRcode();
|
||||
})
|
||||
},
|
||||
// 获取二维码信息
|
||||
getQRCodeInfoByStoreId(type) {
|
||||
this.type = type
|
||||
|
@ -112,12 +112,11 @@ public class CardFuelDieselController extends BaseController {
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardFuelDiesel cardFuelDiesel) {
|
||||
|
||||
//计算所得升数
|
||||
cardFuelDiesel.setIncomeLitres(Double.valueOf(String.format("%.2f", cardFuelDiesel.getRechargeBalance()/cardFuelDiesel.getLockPrice())));
|
||||
ActiveApplet activeApplet = new ActiveApplet();
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
activeApplet.setStoreId(nowAccountInfo.getStoreId());
|
||||
|
||||
//根据油品id和油站id查询
|
||||
LambdaQueryWrapper<CardFuelDiesel> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardFuelDiesel::getStoreId, nowAccountInfo.getStoreId());
|
||||
@ -143,7 +142,6 @@ public class CardFuelDieselController extends BaseController {
|
||||
String formatEd = dateFormat.format(cardFuelDiesel.getEndTime());
|
||||
activeApplet.setTime(formatSt+"-" + formatEd+"");
|
||||
}
|
||||
|
||||
//油品名称
|
||||
String type = cardFuelDiesel.getType();
|
||||
String oilType = cardFuelDiesel.getOilType();
|
||||
@ -169,8 +167,6 @@ public class CardFuelDieselController extends BaseController {
|
||||
cardFuelDiesel.getRechargeBalance()+"元可以参加,所参与油品类型为:"+activeApplet.getOilName()+",锁价单价为:"+
|
||||
cardFuelDiesel.getLockPrice()+"元/L,活动时间为:"+startFormat+"-"+endFormat);
|
||||
}
|
||||
|
||||
|
||||
activeApplet.setPoints(cardFuelDiesel.getPoints());
|
||||
activeApplet.setName("囤油卡充值活动");
|
||||
activeApplet.setType("2");
|
||||
@ -193,6 +189,8 @@ public class CardFuelDieselController extends BaseController {
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardFuelDiesel cardFuelDiesel) {
|
||||
//计算所得升数
|
||||
cardFuelDiesel.setIncomeLitres(Double.valueOf(String.format("%.2f", cardFuelDiesel.getRechargeBalance()/cardFuelDiesel.getLockPrice())));
|
||||
cardFuelDiesel.setStatus(cardFuelDiesel.getStatus().equals("true") ? "1" : "2");
|
||||
if (cardFuelDiesel.getType().length() > 2){
|
||||
String substring = cardFuelDiesel.getType().substring(0, 3);
|
||||
|
@ -50,12 +50,6 @@ public class QrCodeUtils {
|
||||
*/
|
||||
public void createLogoCodePicture(InputStream backgroundStream, InputStream logoStream, String url, String outImgPath, Integer staffId, Integer storeId,String urls) {
|
||||
try {
|
||||
// 读取原图片信息
|
||||
//得到文件
|
||||
//// File file = ResourceUtils.getFile(roundImage);
|
||||
// ClassPathResource resource = new ClassPathResource(roundImage);
|
||||
// ClassPathResource logoResource = new ClassPathResource(logoImage);
|
||||
// File file = resource.getFile();
|
||||
|
||||
//文件转化为图片
|
||||
Image srcImg = ImageIO.read(backgroundStream);
|
||||
@ -262,18 +256,6 @@ public class QrCodeUtils {
|
||||
// 读取原图片信息
|
||||
//使用工具类生成二维码
|
||||
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)){
|
||||
|
@ -51,6 +51,12 @@ public class QRCodeController extends BaseController {
|
||||
}catch (Exception ignored){}
|
||||
return getSuccessResult(iqrCodeService.createStoreQrCode(type,request));
|
||||
}
|
||||
|
||||
@PostMapping("/createStoreOnlyQrCode")
|
||||
public ResponseObject createStoreOnlyQrCode(HttpServletRequest request, @RequestBody Map<String,String> map) throws Exception {
|
||||
String type = map.get("type");
|
||||
return getSuccessResult(iqrCodeService.createStoreOnlyQrCode(type,request));
|
||||
}
|
||||
@PostMapping("/createStoreQrCodeByPos")
|
||||
public ResponseObject createStoreQrCodeByPos(HttpServletRequest request, @RequestBody Map<String,String> map) throws Exception {
|
||||
String type = map.get("type");
|
||||
|
@ -22,6 +22,8 @@ public interface IQRCodeService extends IService<QRCode> {
|
||||
public IPage<QRCode> selectQRCodeList(Page page, QRCode qrCode);
|
||||
|
||||
String createStoreQrCode(String type, HttpServletRequest request) throws Exception;
|
||||
String createStoreOnlyQrCode(String type, HttpServletRequest request) throws Exception;
|
||||
|
||||
String createStoreQrCodeByPos(String type, HttpServletRequest request) throws Exception;
|
||||
|
||||
/**
|
||||
|
@ -66,9 +66,6 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
|
||||
}
|
||||
|
||||
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";
|
||||
@ -89,6 +86,34 @@ public class QRCodeServiceImpl extends ServiceImpl<QRCodeMapper, QRCode> impleme
|
||||
String saveFile = backendFileController.saveFile(resFile);
|
||||
return saveFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createStoreOnlyQrCode(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 logoImage = "static/qrCodeImg/logo.png";
|
||||
String url = qrCode.getCollection();
|
||||
String area = store.getName();
|
||||
String finalPath="/temp/qrCode/" + area + ".jpg";
|
||||
InputStream logoStream = this.getClass().getClassLoader().getResourceAsStream(logoImage);
|
||||
//背景图片路径 loge图片 二维码 输出地址
|
||||
qrCodeUtils.createLogoCodePictureByPos(null, 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);
|
||||
// 返回图片路径
|
||||
return backendFileController.saveFile(resFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createStoreQrCodeByPos(String type, HttpServletRequest request) throws Exception {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
|
@ -179,6 +179,18 @@ public class LJUserController extends BaseController {
|
||||
return getSuccessResult(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号模糊查询会员信息
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/userListByPhone")
|
||||
public ResponseObject userListByPhone(@Validated @RequestBody Map<String ,String > map){
|
||||
String mobile = map.get("mobile");
|
||||
List<LJUserVo> user = userService.userListByPhone(mobile);
|
||||
return getSuccessResult(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号查询会员信息
|
||||
* @param map
|
||||
|
@ -43,6 +43,7 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
|
||||
* @return
|
||||
*/
|
||||
public LJUserVo selectUserByMobileAndChantStoreId(@Param("mobile") String mobile,@Param("chainStoreId") int chainStoreId);
|
||||
public List<LJUserVo> userListByPhone(@Param("mobile") String mobile,@Param("storeId") int storeId);
|
||||
|
||||
/**
|
||||
* 根据id查询用户信息
|
||||
|
@ -379,4 +379,13 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="userListByPhone" resultType="com.fuint.business.userManager.vo.LJUserVo">
|
||||
select mu.*,mub.grade_id,mub.card_balance,mub.points,mub.consume_num,mub.growth_value,mub.refuel_money,
|
||||
mub.second_card,mub.fixing_level,mub.chain_store_id from mt_user mu
|
||||
left join mt_user_balance mub on mu.id = mub.mt_user_id
|
||||
<where>
|
||||
mu.mobile like concat('%',#{mobile},'%') and
|
||||
mub.store_id = #{storeId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -92,7 +92,7 @@ public interface LJUserService extends IService<LJUser> {
|
||||
* @return
|
||||
*/
|
||||
public LJUserVo selectUserByMobileAndChantStoreId(String mobile);
|
||||
|
||||
List<LJUserVo> userListByPhone(String mobile);
|
||||
|
||||
public LJUserVo getByUniApp(Integer chainStoreId);
|
||||
|
||||
|
@ -347,6 +347,12 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
|
||||
return ljUserVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LJUserVo> userListByPhone(String mobile) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
return baseMapper.userListByPhone(mobile, nowAccountInfo.getStoreId());
|
||||
}
|
||||
|
||||
@Resource
|
||||
UserBalanceService userBalanceService;
|
||||
|
||||
|
@ -1 +1 @@
|
||||
mvn install:install-file -Dfile=D:\Code\yuzhan\oil-station\fuintBackend\lib\yly_sdk_2.2.jar -DgroupId=yly_sdk -DartifactId=yly_sdk -Dversion=2.2 -Dpackaging=jar
|
||||
mvn install:install-file -Dfile=D:\Code\yuzhan\oil-station\fuintBackend\lib\yly_sdk_2.2.jar -DgroupId=yly_sdk -DartifactId=yly_sdk -Dversion=2.2 -Dpackaging=jar
|
||||
|
@ -34,7 +34,14 @@ export function getUserInfoMobile(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据手机号查询会员列表
|
||||
export function userListByPhone(data) {
|
||||
return request({
|
||||
url: '/business/userManager/user/userListByPhone',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 根据手机号查询会员详细
|
||||
export function getUserVoName(data) {
|
||||
return request({
|
||||
|
@ -8,7 +8,14 @@ export function listQRCode(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询二维码列表
|
||||
export function QRCodeByStoreId(query) {
|
||||
return request({
|
||||
url: '/business/storeInformation/qrCode/createStoreOnlyQrCode',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
// 查询二维码详细
|
||||
export function qrCodeInfo() {
|
||||
return request({
|
||||
|
@ -3988,11 +3988,6 @@
|
||||
getUserInfoMobile({mobile:this.userNo}).then( response => {
|
||||
if (response.data){
|
||||
this.member = response.data
|
||||
// if (response.data.refuelMoney){
|
||||
// this.refuelMoney = JSON.parse(response.data.refuelMoney)
|
||||
// }else {
|
||||
// this.refuelMoney = null
|
||||
// }
|
||||
this.storeId = response.data.storeId
|
||||
this.isSure = true
|
||||
}else {
|
||||
|
@ -29,8 +29,8 @@
|
||||
</div>
|
||||
<div class="o-top" v-if="!userInfo">
|
||||
<div class="left_input">
|
||||
<input type="text" placeholder="请输入会员手机号">
|
||||
<i class="el-icon-search"></i>
|
||||
<input type="text" v-model = "userMobile" @input="getUser()" placeholder="请输入会员手机号">
|
||||
<i class="el-icon-search" @click="getUser()"></i>
|
||||
</div>
|
||||
<div class="d-s">
|
||||
<div class="an_bor" @click="addVip()">新增会员</div>
|
||||
@ -84,16 +84,6 @@
|
||||
<div class="or_num">-¥0.00</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="d-b">-->
|
||||
<!-- <el-checkbox v-model="boxShow1">储值卡(账户余额:0元)</el-checkbox>-->
|
||||
|
||||
<!-- <div class="or_num">¥0.00</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="d-b">-->
|
||||
<!-- <el-checkbox v-model="boxShow2">囤油卡(账户余额:1000元)</el-checkbox>-->
|
||||
|
||||
<!-- <div class="or_num">-¥220.00</div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
</div>
|
||||
<div class="three-top">
|
||||
@ -118,6 +108,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="box-bottom">
|
||||
<div>
|
||||
<div class="price_">¥0.00</div>
|
||||
@ -135,30 +127,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-kuang" style="flex-wrap: wrap">
|
||||
<!-- <div class="card92" v-for="(item,index) in 3" @click="setRefuelingAmount()">-->
|
||||
<!-- <div>汽油 92#</div>-->
|
||||
<!-- <div class="card-title">1号枪</div>-->
|
||||
<!-- <div class="c-b-d">-->
|
||||
<!-- <img src="./imgs/92oil.png" style="width: 16px;height: 16px">-->
|
||||
<!-- <div>92号汽油罐</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="card95" v-for="(item,index) in 3">-->
|
||||
<!-- <div>汽油 95#</div>-->
|
||||
<!-- <div class="card-title">1号枪</div>-->
|
||||
<!-- <div class="c-b-d">-->
|
||||
<!-- <img src="./imgs/95oil.png" style="width: 16px;height: 16px">-->
|
||||
<!-- <div>95号汽油罐</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div class="card98" v-for="(item,index) in 3">-->
|
||||
<!-- <div>汽油 98#</div>-->
|
||||
<!-- <div class="card-title">1号枪</div>-->
|
||||
<!-- <div class="c-b-d">-->
|
||||
<!-- <img src="./imgs/98oil.png" style="width: 16px;height: 16px">-->
|
||||
<!-- <div>98号汽油罐</div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div :class=item.classStyle v-for="(item,index) in dataList" @click="setRefuelingAmount(item)">
|
||||
<div>{{ item.oilType }} {{ item.oilName }}</div>
|
||||
<div class="card-title">{{ item.gunName }}</div>
|
||||
@ -281,11 +249,12 @@
|
||||
>
|
||||
<div class="tc-box">
|
||||
<div>请顾客扫码领取会员卡</div>
|
||||
<img src="./imgs/ewm.png" style="width: 180px;height: 180px;">
|
||||
<div class="red-size">微信/支付宝扫一扫</div>
|
||||
<img id="collection" class="qrcode" :src="baseUrl + collectionImg"/><br/>
|
||||
|
||||
<div class="red-size">微信扫一扫</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="newMember = false">打印二维码</el-button>
|
||||
<el-button type="primary" @click="handleDownloadqrCode('collection')" >下载二维码</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
@ -436,17 +405,24 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import QRCode from 'qrcode'
|
||||
import html2canvas from "html2canvas";
|
||||
import pickUp from './newHomeComponents/pickUpTheOrder.vue'
|
||||
import accountPending from './newHomeComponents/accountPending.vue'
|
||||
import memberRecharge from './newHomeComponents/memberRecharge.vue'
|
||||
import refuelingAmount from './newHomeComponents/refuelingAmount.vue'
|
||||
import { cashRegisterList, cashRegisterGoodsList } from '@/api/newHome/newHome.js'
|
||||
|
||||
import {QRCodeByStoreId} from "@/api/staff/qrcode";
|
||||
import {userListByPhone} from "@/api/cashier/user";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 门店二维码
|
||||
collectionImg: '',
|
||||
baseUrl: process.env.VUE_APP_BASE_API,
|
||||
//
|
||||
value: '',
|
||||
userMobile:null,
|
||||
//商品子组件选中时 容器
|
||||
sonGoodsList: [],
|
||||
//油枪 父传子
|
||||
@ -540,7 +516,7 @@ export default {
|
||||
},
|
||||
//油枪列表数据
|
||||
dataList: {},
|
||||
userInfo: true,//判断登录状态
|
||||
userInfo: false,//判断登录状态
|
||||
ruleIndex: 0,
|
||||
tabIndex: 0,
|
||||
newMember: false,
|
||||
@ -562,7 +538,9 @@ export default {
|
||||
paymentResults: false,
|
||||
pickUpTheOrder: false,
|
||||
accountPending: false,
|
||||
memberRecharge: false
|
||||
memberRecharge: false,
|
||||
//会员搜索列表
|
||||
vipUserList:[]
|
||||
|
||||
}
|
||||
},
|
||||
@ -586,6 +564,7 @@ export default {
|
||||
//初始化 油枪 商品
|
||||
this.getOilList()
|
||||
this.getGoodsList()
|
||||
this.getQRCodeInfoByStoreId(0);
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@ -624,6 +603,68 @@ export default {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 根据手机号查询会员信息
|
||||
getUser(){
|
||||
userListByPhone({mobile:this.userMobile}).then( response => {
|
||||
if (response.data){
|
||||
this.vipUserList = response.data
|
||||
console.log(response.data,608)
|
||||
}else {
|
||||
this.$modal.msgError("会员信息不存在")
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取二维码信息
|
||||
getQRCodeInfoByStoreId(type) {
|
||||
QRCodeByStoreId({type: type}).then(response => {
|
||||
this.collectionImg = response.data;
|
||||
})
|
||||
},
|
||||
// 根据字符串获取二维码图片url地址
|
||||
getQRcode() {
|
||||
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"//背景色
|
||||
}
|
||||
};
|
||||
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
|
||||
})
|
||||
}
|
||||
},
|
||||
// 根据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); // 然后移除
|
||||
});
|
||||
},
|
||||
|
||||
//油枪初始化
|
||||
getOilList() {
|
||||
@ -1563,6 +1604,7 @@ input {
|
||||
box-sizing: border-box;
|
||||
padding: 10px 5px;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
}
|
||||
.wrap-tc{
|
||||
width: 100%;
|
||||
@ -1586,4 +1628,8 @@ input {
|
||||
background-size: 100% 100% !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
.qrcode {
|
||||
width: 350px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user