小票打印--积分支付--中台设置流水

This commit is contained in:
wangh 2023-12-26 09:50:37 +08:00
parent 9edf62a5a2
commit 22d78d8b5f
18 changed files with 947 additions and 98 deletions

View File

@ -165,11 +165,11 @@
<el-form-item label="节点名称" prop="deptName">
<el-input v-model="ruleForm.deptName"></el-input>
</el-form-item>
<el-form-item label="负责人名称" prop="leader_name">
<el-input v-model="ruleForm.leader_name"></el-input>
<el-form-item label="负责人名称" prop="leaderName">
<el-input v-model="ruleForm.leaderName"></el-input>
</el-form-item>
<el-form-item label="负责人电话" prop="leader_phone">
<el-input v-model="ruleForm.leader_phone"></el-input>
<el-form-item label="负责人电话" prop="leaderPhone">
<el-input v-model="ruleForm.leaderPhone"></el-input>
</el-form-item>
<el-form-item label="类型" prop="deptType">
<el-radio-group v-model="ruleForm.deptType">
@ -180,6 +180,34 @@
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-row v-if="ruleForm.deptType == 4">
<el-col :span="8">
<el-form-item label="额度设置方式" prop="">
<el-radio-group v-model="ruleForm.turnoverType">
<el-radio label="1">金额上限</el-radio>
<el-radio label="2">时间上限</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item v-if="ruleForm.turnoverType == 1" label="金额上限" prop="turnoverLimit" style="width:300px" >
<el-input v-model.number="ruleForm.turnoverLimit"></el-input>
</el-form-item>
<el-form-item v-if="ruleForm.turnoverType == 2" label="时间上限" prop="turnoverType" style="width:220px">
<el-date-picker
v-model="ruleForm.turnoverTime"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="状态" prop="name">
<el-switch v-model="value10" @change="getswitch" ></el-switch>
</el-form-item>
@ -349,10 +377,15 @@
parentId:'',
deptType:'1',
status:'qy',
leader_name:'',
leader_phone:'',
leaderName:'',
leaderPhone:'',
// parentName:'',
deptName: '',
turnoverLimit: '',
turnoverType: "1",
turnoverTime: '',
},
filterText:'',
xtitle:'',
@ -445,11 +478,11 @@
rolelist:'',
//
rules: {
leader_name: [
{ required: true, message: '不能为空', trigger: 'blur' },
leaderName: [
{ required: true, message: '姓名不能为空', trigger: 'blur' },
],
leader_phone: [
{ required: true, message: '不能为空', trigger: 'blur' },
leaderPhone: [
{ required: true, message: '电话不能为空', trigger: 'blur' },
],
deptName: [
@ -538,23 +571,31 @@
activecilck(data){
console.log('点树',data)
this.cleanUp()
//
this.queryParams.deptId = data.id
this.deptType = data.deptType
//
if(this.activeName == 'info'){
// if(this.activeName == 'info'){
this.appedit(data.id,data.label)
}
// }
//
if(this.activeName == 'list'){
// if(this.activeName == 'list'){
this.getList();
}
// }
},
cleanUp(){
this.ruleForm = {
parentId:'',
depId:'',
deptType:'1',
status:'qy',
leaderName:'',
leaderPhone:'',
// parentName:'',
deptName: '',
turnoverLimit: '',
turnoverType: "1",
turnoverTime: '',
}
},
handleChange(value) {
@ -588,8 +629,8 @@
},
//
submitFormseide(){
this.$refs[formName].validate((valid) => {
submitFormseide(ruleForm){
this.$refs[ruleForm].validate((valid) => {
if (valid) {
deptedit(this.ruleForm).then(res=>{
@ -663,8 +704,14 @@
let ancestors = res.data.ancestors.slice(2).toString();
console.log('Userlist:',res)
this.parentName = res.data.parentName
this.ruleForm.parentId = res.data.parentId
this.ruleForm.status = res.data.status
this.ruleForm = res.data
// this.ruleForm.parentId = res.data.parentId
// this.ruleForm.status = res.data.status
// this.ruleForm.leaderName = res.data.leaderName
// this.ruleForm.leaderPhone = res.data.leaderPhone
// this.ruleForm.turnoverType = res.data.turnoverType
// this.ruleForm.turnoverTime = res.data.turnoverTime
// this.ruleForm.turnoverType = res.data.turnoverType
if(res.data.status == 'qy'){
this.value10 = true
}else {

View File

@ -19,8 +19,10 @@ import com.fuint.business.petrolStationManagement.entity.OilNumber;
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
import com.fuint.business.storeInformation.entity.LJStore;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.entity.LJUserGrade;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo;
import org.springframework.stereotype.Service;
@ -215,7 +217,8 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
}
}
@Resource
LJUserGradeService ljUserGradeService;
/**
* 签到功能
@ -230,11 +233,27 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
Integer integer = todayIsSignIn(integralSettings.getStoreId());
if (integer == 0) {
// 根据店铺id 查找连锁店id
// LJStore ljStore = iljStoreService.selectStoreByIdUni(integralSettings.getStoreId());
// 查询当前用户
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(),integralSettings.getChainStoreId());
if (ObjectUtil.isEmpty(ljUserVos)) {
// 新增余额信息
UserBalance userBalanceAdd = new UserBalance();
userBalanceAdd.setMtUserId(nowAccountInfo.getId());
userBalanceAdd.setChainStoreId(integralSettings.getChainStoreId());
userBalanceAdd.setStoreId(integralSettings.getStoreId());
userBalanceAdd.setCardBalance(0.0);
userBalanceAdd.setPoints(0);
userBalanceAdd.setGrowthValue(0);
userBalanceAdd.setConsumeNum(0);
LJUserGrade ljUserGrade = ljUserGradeService.selectUserGradeByStoreId(integralSettings.getStoreId());
if (ObjectUtil.isNotEmpty(ljUserGrade) && ObjectUtil.isNotEmpty(ljUserGrade.getId())) {
userBalanceAdd.setGradeId(ljUserGrade.getId());
}
// 新增会员余额信息
userBalanceService.insertUserBalance(userBalanceAdd);
ljUserVos = ljUserMapper.selectAllInfoById4Chain(nowAccountInfo.getId(),integralSettings.getChainStoreId());
}
ljUserVos.setChainStoreId(integralSettings.getChainStoreId());
ljUserVos.setStoreId(integralSettings.getStoreId());
// 查询积分配置

View File

@ -11,6 +11,7 @@ import io.lettuce.core.dynamic.annotation.Param;
import javax.annotation.Resource;
import java.util.Map;
/**
* 交班记录表(HandoverRecord)表控制层
@ -102,5 +103,15 @@ public class HandoverRecordController extends BaseController {
return getSuccessResult(handoverRecordService.handover());
}
/**
* 本地打印
* @return
*/
@PostMapping("printLocally")
public ResponseObject printLocally(@RequestBody Map<String, Object> aa) {
handoverRecordService.printLocally(aa);
return getSuccessResult(true);
}
}

View File

@ -61,5 +61,7 @@ public interface HandoverRecordService {
public Map<String, Object> handover();
public void printLocally(Map<String, Object> aa);
}

View File

@ -13,11 +13,13 @@ import com.fuint.business.store.mapper.MtStoreMapper;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.util.TscLibDll;
import com.fuint.framework.exception.BusinessCheckException;
import com.fuint.system.dict.entity.SysDictData;
import com.fuint.system.dict.entity.SysDictType;
import com.fuint.system.dict.service.ISysDictDataService;
import com.fuint.system.dict.service.ISysDictTypeService;
import javafx.print.Printer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
@ -33,10 +35,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 交班记录表(HandoverRecord)表服务实现类
@ -197,6 +196,7 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
return handoverMap;
}
public Map<String, Object> orderSummary(String startTime, String endTime) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 油品订单(订单) 油品订单(退款) 油品订单(实收) 油品优惠(实收) 油品交易(实收)
@ -249,6 +249,13 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
boolean flag = true;
for (Map<String, Object> stringObjectMap : mapList) {
if (ObjectUtil.isEmpty(map.get("payType"))) {
map.put("payType","other");
}
if (ObjectUtil.isEmpty(stringObjectMap.get("payType"))) {
map.put("payType","other");
}
if (map.get("payType").equals(stringObjectMap.get("payType"))) {
BigDecimal paidAmount = new BigDecimal(stringObjectMap.get("paidAmount").toString()).add(new BigDecimal(map.get("paidAmount").toString()));
BigDecimal refundAmount = new BigDecimal(stringObjectMap.get("refundAmount").toString()).add(new BigDecimal(map.get("refundAmount").toString()));
@ -381,4 +388,500 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
return map;
}
private static final String LOAD_LIBRARY = "TSCLIB";
//打印机
// private static final String print_model = "58130IVC";
@Override
public void printLocally(Map<String, Object> handover) {
Map<String, Object> baseInfo = (Map<String, Object>)handover.get("baseInfo");
Map<String, Object> orderSummary = (Map<String, Object>)handover.get("orderSummary");
// 支付方式汇总
List<Map<String, Object>> paymentAggregationMap = (List<Map<String, Object>>)handover.get("paymentAggregation");
// 油号统计
List<Map<String, Object>> oilNumberStatisticsMap = (List<Map<String, Object>>)handover.get("oilNumberStatistics");
// 油枪统计
List<Map<String, Object>> greaseGunStatisticsMap = (List<Map<String, Object>>)handover.get("greaseGunStatistics");
// 员工统计
List<Map<String, Object>> employeeStatisticsMap = (List<Map<String, Object>>)handover.get("employeeStatistics");
// 挂账详情
List<Map<String, Object>> billingDetailsMap = (List<Map<String, Object>>)handover.get("billingDetails");
// 挂账归还
List<Map<String, Object>> returnedToTheAccountMap = (List<Map<String, Object>>)handover.get("returnedToTheAccount");
// System.loadLibrary(LOAD_LIBRARY);
System.setProperty("jna.encoding", "GBK");
// 获取默认打印机
Printer printer = Printer.getDefaultPrinter();
// 获取打印机的名称
String printerName = printer.getName();
TscLibDll.INSTANCE.openport(printerName);
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("------------交班统计------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("油站名称:\t"+Optional.ofNullable(baseInfo.get("storeName")).orElse("未知油站"));
TscLibDll.INSTANCE.sendcommand("收银员:\t"+Optional.ofNullable(baseInfo.get("realName")).orElse("未知姓名"));
TscLibDll.INSTANCE.sendcommand("交班方式:\t"+Optional.ofNullable(baseInfo.get("handoverType")).orElse("未知"));
TscLibDll.INSTANCE.sendcommand("开始时间:\t"+Optional.ofNullable(baseInfo.get("startTime")).orElse("-"));
TscLibDll.INSTANCE.sendcommand("结束时间:\t"+Optional.ofNullable(baseInfo.get("endTime")).orElse("-"));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("当前版本:\t"+"V1.0.1");
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**订单汇总**");
TscLibDll.INSTANCE.sendcommand("类型\t金额");
TscLibDll.INSTANCE.sendcommand("油品订单(订单):\t¥"+Optional.ofNullable(orderSummary.get("oilOrder")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("油品订单(退款):\t¥"+Optional.ofNullable(orderSummary.get("oilRefund")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("油品订单(实收):\t¥"+Optional.ofNullable(orderSummary.get("oilPaid")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("油品优惠(实收):\t¥"+Optional.ofNullable(orderSummary.get("oilDiacount")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("会员储值(订单):\t¥"+Optional.ofNullable(orderSummary.get("cardOrder")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("会员储值(退款):\t¥"+Optional.ofNullable(orderSummary.get("cardRefund")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("会员储值(实收):\t¥"+Optional.ofNullable(orderSummary.get("cardPaid")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("储值赠送(订单):\t¥"+Optional.ofNullable(orderSummary.get("cardGiftOrder")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("储值赠送(退款):\t¥"+Optional.ofNullable(orderSummary.get("cardGiftRefund")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("储值赠送(实际):\t¥"+Optional.ofNullable(orderSummary.get("cardGiftPaid")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("存油储值(订单):\t¥"+Optional.ofNullable(orderSummary.get("fuelOrder")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("存油储值(退款):\t¥"+Optional.ofNullable(orderSummary.get("fuelRefund")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("存油储值(实收):\t¥"+Optional.ofNullable(orderSummary.get("fuelPaid")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("普通收款(订单):\t¥"+Optional.ofNullable(orderSummary.get("goodsOrder")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("普通收款(退款):\t¥"+Optional.ofNullable(orderSummary.get("goodsRefund")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("普通收款(实收):\t¥"+Optional.ofNullable(orderSummary.get("goodsPaid")).orElse("0"));
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**退款汇总**");
TscLibDll.INSTANCE.sendcommand("支付方式\t金额");
List<Map<String, Object>> paymentAggregationAll = paymentAggregation("all", paymentAggregationMap);
if (ObjectUtil.isNotEmpty(paymentAggregationAll)) {
for (Map<String, Object> stringObjectMap : paymentAggregationAll) {
if (Double.parseDouble(stringObjectMap.get("refundAmount").toString()) > 0) {
TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("refundAmount")).orElse("0"));
}
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+refundAggregateTotal(paymentAggregationAll));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**实收汇总**");
TscLibDll.INSTANCE.sendcommand("支付方式\t金额");
if (ObjectUtil.isNotEmpty(paymentAggregationAll)) {
for (Map<String, Object> stringObjectMap : paymentAggregationAll) {
if (Double.parseDouble(stringObjectMap.get("paidAmount").toString()) > 0) {
TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalTotalOfActualReceipts(paymentAggregationAll));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**油品订单**");
TscLibDll.INSTANCE.sendcommand("支付方式\t金额");
List<Map<String, Object>> paymentAggregationOil = paymentAggregation("oil", paymentAggregationMap);
if (ObjectUtil.isNotEmpty(paymentAggregationOil)) {
for (Map<String, Object> stringObjectMap : paymentAggregationOil) {
TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalOilOrders(paymentAggregationOil));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**商品订单**");
TscLibDll.INSTANCE.sendcommand("支付方式\t金额");
List<Map<String, Object>> paymentAggregationGoods = paymentAggregation("goods", paymentAggregationMap);
if (ObjectUtil.isNotEmpty(paymentAggregationGoods)) {
for (Map<String, Object> stringObjectMap : paymentAggregationGoods) {
TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalOfProductOrders(paymentAggregationGoods));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**会员储值**");
TscLibDll.INSTANCE.sendcommand("支付方式\t金额");
List<Map<String, Object>> paymentAggregationFg = paymentAggregation("fg", paymentAggregationMap);
if (ObjectUtil.isNotEmpty(paymentAggregationFg)) {
for (Map<String, Object> stringObjectMap : paymentAggregationFg) {
TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+totalMemberStoredValue(paymentAggregationMap));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**积分商城**");
TscLibDll.INSTANCE.sendcommand("支付方式\t金额");
List<Map<String, Object>> paymentAggregationPoint = paymentAggregation("point", paymentAggregationMap);
if (ObjectUtil.isNotEmpty(paymentAggregationPoint)) {
for (Map<String, Object> stringObjectMap : paymentAggregationPoint) {
TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+pointsMallStatistics(paymentAggregationPoint));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**油号统计**");
TscLibDll.INSTANCE.sendcommand("油号\t笔数\t升数\t金额");
if (ObjectUtil.isNotEmpty(oilNumberStatisticsMap)) {
for (Map<String, Object> stringObjectMap : oilNumberStatisticsMap) {
TscLibDll.INSTANCE.sendcommand(
Optional.ofNullable(stringObjectMap.get("oilName")).orElse("未知")
+"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")
+"\t"+Optional.ofNullable(stringObjectMap.get("oilNum")).orElse("0")
+"\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t"+totalOilNumberStatistics(oilNumberStatisticsMap));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("**优惠统计**");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("油品\t金额");
if (ObjectUtil.isNotEmpty(oilNumberStatisticsMap)) {
for (Map<String, Object> stringObjectMap : oilNumberStatisticsMap) {
TscLibDll.INSTANCE.sendcommand(
Optional.ofNullable(stringObjectMap.get("oilName")).orElse("未知")
+"\t¥"+Optional.ofNullable(stringObjectMap.get("paidDiscount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+discountStatisticsTotal(oilNumberStatisticsMap));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("**油枪统计**");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("油枪\t笔数\t升数\t金额");
if (ObjectUtil.isNotEmpty(greaseGunStatisticsMap)) {
for (Map<String, Object> stringObjectMap : greaseGunStatisticsMap) {
TscLibDll.INSTANCE.sendcommand(
Optional.ofNullable(stringObjectMap.get("gunName")).orElse("未知")
+"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")
+"\t"+Optional.ofNullable(stringObjectMap.get("oilNum")).orElse("0")
+"\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t"+totalOfOilGunStatistics(greaseGunStatisticsMap));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**员工统计**");
TscLibDll.INSTANCE.sendcommand("员工姓名\t笔数\t金额");
if (ObjectUtil.isNotEmpty(employeeStatisticsMap)) {
for (Map<String, Object> stringObjectMap : employeeStatisticsMap) {
TscLibDll.INSTANCE.sendcommand(
Optional.ofNullable(stringObjectMap.get("name")).orElse("未知")
+"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")
+"\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t"+totalOfEmployeeStatistics(employeeStatisticsMap));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("**挂账统计**");
TscLibDll.INSTANCE.sendcommand("·····挂账详情·····");
TscLibDll.INSTANCE.sendcommand("挂账单位\t笔数\t金额");
if (ObjectUtil.isNotEmpty(billingDetailsMap)) {
for (Map<String, Object> stringObjectMap : billingDetailsMap) {
TscLibDll.INSTANCE.sendcommand(
Optional.ofNullable(stringObjectMap.get("name")).orElse("未知")
+"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")
+"\t¥"+Optional.ofNullable(stringObjectMap.get("amount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+statisticsOfAccountDetails(billingDetailsMap));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("······归还详情······");
TscLibDll.INSTANCE.sendcommand("挂账单位\t笔数\t金额");
if (ObjectUtil.isNotEmpty(returnedToTheAccountMap)) {
for (Map<String, Object> stringObjectMap : returnedToTheAccountMap) {
TscLibDll.INSTANCE.sendcommand(
Optional.ofNullable(stringObjectMap.get("name")).orElse("未知")
+"\t"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")
+"\t¥"+Optional.ofNullable(stringObjectMap.get("amount")).orElse("0"));
}
}
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("合计:\t¥"+postedAccountReturnStatistics(returnedToTheAccountMap));
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("--------------------------------");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.sendcommand("");
TscLibDll.INSTANCE.closeport();
}
public List<Map<String, Object>> paymentAggregation(String flag, List<Map<String, Object>> paymentAggregation) {
List<Map<String, Object>> count = new ArrayList<>();
if (ObjectUtil.isNotEmpty(paymentAggregation)) {
for (Map<String, Object> res : paymentAggregation) {
if ("fg".equals(flag)) {
if ("card".equals(res.get("flag")) || "fuel".equals(res.get("flag"))) {
boolean flag2 = false;
for (Map<String, Object> coun : count) {
if (Objects.equals(res.get("payType"), coun.get("payType"))) {
coun.put("paidAmount", Double.valueOf(coun.get("paidAmount").toString()) + Double.valueOf(res.get("paidAmount").toString()));
flag2 = true;
}
}
if (!flag2) {
// 创建新的对象以防修改原始数据
Map<String, Object> newRes = new HashMap<>(res);
count.add(newRes);
}
}
} else if (Objects.equals(res.get("flag"), flag)) {
count.add(res);
}
}
}
return count;
}
private int findIndexByPayType(List<Map<String, Object>> list, String payType) {
for (int i = 0; i < list.size(); i++) {
if (payType.equals(list.get(i).get("payType").toString())) {
return i;
}
}
return -1;
}
public String calculatePaymentMethod(String payType) {
switch (payType) {
case "ALIPAY":
return "支付宝";
case "WECHAT":
return "微信";
case "UNIONPAY":
return "银联二维码";
case "CASH":
return "现金";
default:
return "其他";
}
}
//退款汇总合计
public BigDecimal refundAggregateTotal(List<Map<String, Object>> paymentAggregation) {
BigDecimal totalRefundAmount = BigDecimal.ZERO;
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
for (Map<String, Object> payment : paymentAggregation) {
if ("all".equals(payment.get("flag"))) {
BigDecimal refundAmount = new BigDecimal(String.valueOf(payment.get("refundAmount")));
totalRefundAmount = totalRefundAmount.add(refundAmount);
}
}
}
return totalRefundAmount;
}
//实收汇总合计
public BigDecimal totalTotalOfActualReceipts(List<Map<String, Object>> paymentAggregation) {
BigDecimal totalPaidAmount = BigDecimal.ZERO;
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
for (Map<String, Object> payment : paymentAggregation) {
if ("all".equals(payment.get("flag"))) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
totalPaidAmount = totalPaidAmount.add(paidAmount);
}
}
}
return totalPaidAmount;
}
//油品订单合计
public BigDecimal totalOilOrders(List<Map<String, Object>> paymentAggregation) {
BigDecimal totalOilAmount = BigDecimal.ZERO;
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
for (Map<String, Object> payment : paymentAggregation) {
if ("oil".equals(payment.get("flag"))) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
totalOilAmount = totalOilAmount.add(paidAmount);
}
}
}
return totalOilAmount;
}
// 商品订单合计
public BigDecimal totalOfProductOrders(List<Map<String, Object>> paymentAggregation) {
BigDecimal totalProductAmount = BigDecimal.ZERO;
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
for (Map<String, Object> payment : paymentAggregation) {
if ("goods".equals(payment.get("flag"))) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
totalProductAmount = totalProductAmount.add(paidAmount);
}
}
}
return totalProductAmount;
}
// 会员储值合计
public BigDecimal totalMemberStoredValue(List<Map<String, Object>> paymentAggregation) {
BigDecimal totalStoredValue = BigDecimal.ZERO;
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
for (Map<String, Object> payment : paymentAggregation) {
if ("card".equals(payment.get("flag")) || "fuel".equals(payment.get("flag"))) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
totalStoredValue = totalStoredValue.add(paidAmount);
}
}
}
return totalStoredValue;
}
// 积分商城统计
public BigDecimal pointsMallStatistics(List<Map<String, Object>> paymentAggregation) {
BigDecimal totalPointsMallAmount = BigDecimal.ZERO;
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
for (Map<String, Object> payment : paymentAggregation) {
if ("point".equals(payment.get("flag"))) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
totalPointsMallAmount = totalPointsMallAmount.add(paidAmount);
}
}
}
return totalPointsMallAmount;
}
// 油号统计合计
public BigDecimal totalOilNumberStatistics(List<Map<String, Object>> oilNumberStatistics) {
BigDecimal totalOilNumberAmount = BigDecimal.ZERO;
if (oilNumberStatistics != null && !oilNumberStatistics.isEmpty()) {
for (Map<String, Object> statistics : oilNumberStatistics) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount")));
totalOilNumberAmount = totalOilNumberAmount.add(paidAmount);
}
}
return totalOilNumberAmount;
}
// 优惠统计合计
public BigDecimal discountStatisticsTotal(List<Map<String, Object>> oilNumberStatistics) {
BigDecimal totalDiscountAmount = BigDecimal.ZERO;
if (oilNumberStatistics != null && !oilNumberStatistics.isEmpty()) {
for (Map<String, Object> statistics : oilNumberStatistics) {
BigDecimal paidDiscount = new BigDecimal(String.valueOf(statistics.get("paidDiscount")));
totalDiscountAmount = totalDiscountAmount.add(paidDiscount);
}
}
return totalDiscountAmount;
}
// 油枪统计合计
public BigDecimal totalOfOilGunStatistics(List<Map<String, Object>> greaseGunStatistics) {
BigDecimal totalOilGunAmount = BigDecimal.ZERO;
if (greaseGunStatistics != null && !greaseGunStatistics.isEmpty()) {
for (Map<String, Object> statistics : greaseGunStatistics) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount")));
totalOilGunAmount = totalOilGunAmount.add(paidAmount);
}
}
return totalOilGunAmount;
}
// 员工统计合计
public BigDecimal totalOfEmployeeStatistics(List<Map<String, Object>> employeeStatistics) {
BigDecimal totalEmployeeAmount = BigDecimal.ZERO;
if (employeeStatistics != null && !employeeStatistics.isEmpty()) {
for (Map<String, Object> statistics : employeeStatistics) {
BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount")));
totalEmployeeAmount = totalEmployeeAmount.add(paidAmount);
}
}
return totalEmployeeAmount;
}
// 挂账详情统计
public BigDecimal statisticsOfAccountDetails(List<Map<String, Object>> billingDetails) {
BigDecimal totalAccountDetailsAmount = BigDecimal.ZERO;
if (billingDetails != null && !billingDetails.isEmpty()) {
for (Map<String, Object> details : billingDetails) {
BigDecimal amount = new BigDecimal(String.valueOf(details.get("amount")));
totalAccountDetailsAmount = totalAccountDetailsAmount.add(amount);
}
}
return totalAccountDetailsAmount;
}
// 挂账归还统计
public BigDecimal postedAccountReturnStatistics(List<Map<String, Object>> returnedToTheAccount) {
BigDecimal totalReturnAmount = BigDecimal.ZERO;
if (returnedToTheAccount != null && !returnedToTheAccount.isEmpty()) {
for (Map<String, Object> returnDetails : returnedToTheAccount) {
BigDecimal amount = new BigDecimal(String.valueOf(returnDetails.get("amount")));
totalReturnAmount = totalReturnAmount.add(amount);
}
}
return totalReturnAmount;
}
}

View File

@ -22,6 +22,7 @@ import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
/**
@ -107,12 +108,13 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return baseMapper.selectUserById(id);
}
@Override
public LJUserVo getByUniApp(Integer chainStoreId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
return baseMapper.selectUserByIdUni(nowAccountInfo.getId(),chainStoreId);
LJUserVo ljUserVo = baseMapper.selectUserByIdUni(nowAccountInfo.getId(), chainStoreId);
return ljUserVo;
}
/**

View File

@ -0,0 +1,40 @@
package com.fuint.common.util;
import com.sun.jna.Library;
import com.sun.jna.Native;
public interface TscLibDll extends Library {
// TscLibDll INSTANCE = (TscLibDll) Native.loadLibrary("TSCLIB", TscLibDll.class);
TscLibDll INSTANCE = Native.load("TSCLIB", TscLibDll.class);
int about();
int openport(String pirnterName);
int closeport();
int sendcommand(String printerCommand);
// int sendBinaryData(byte[] printerCommand, int CommandLength);
int setup(String width, String height, String speed, String density, String sensor, String vertical, String offset);
int downloadpcx(String filename, String image_name);
int barcode(String x, String y, String type, String height, String readable, String rotation, String narrow, String wide, String code);
int printerfont(String x, String y, String fonttype, String rotation, String xmul, String ymul, String text);
int clearbuffer();
int printlabel(String set, String copy);
int windowsfont(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, String content);
int windowsfontUnicode(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, byte[] content);
int windowsfontUnicodeLengh(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, byte[] content, int length);
byte usbportqueryprinter();
}

View File

@ -13,6 +13,7 @@ import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -63,6 +64,7 @@ public class SysDept extends BaseEntity
/** 子部门 */
@TableField(exist = false)
private List<SysDept> children = new ArrayList<SysDept>();
private String turnoverType;
private BigDecimal turnoverLimit;
private Date turnoverTime;
}

View File

@ -0,0 +1,118 @@
import com.fuint.common.util.TscLibDll;
import com.fuint.fuintApplication;
import com.sun.jna.Library;
import com.sun.jna.Native;
import javafx.print.Printer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import java.nio.charset.StandardCharsets;
@RunWith(SpringJUnit4ClassRunner.class)
//@RunWith(SpringRunner.class)
@SpringBootTest(classes = fuintApplication.class)
@Transactional
public class dyj {
private static final String LOAD_LIBRARY = "TSCLIB";
public interface TscLibDll extends Library {
TscLibDll INSTANCE = (TscLibDll) Native.loadLibrary("TSCLIB", TscLibDll.class);
// 以下为dll函数库支持的方法方法的作用与参数说明见附件dll函数库api文档
int about ();
int openport (String pirnterName);
int closeport ();
int sendcommand (String printerCommand);
int setup (String width,String height,String speed,String density,String sensor,String vertical,String offset);
int downloadpcx (String filename,String image_name);
int barcode (String x,String y,String type,String height,String readable,String rotation,String narrow,String wide,String code);
int printerfont (String x,String y,String fonttype,String rotation,String xmul,String ymul,String text);
int clearbuffer ();
int printlabel (String set, String copy);
int formfeed ();
int nobackfeed ();
int windowsfont (int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName, String content);
}
@Test
public void tt() {
// TscLibDll.INSTANCE.openport("GP-58MB Series");
// System.loadLibrary(LOAD_LIBRARY);
System.setProperty("jna.encoding", "GBK");
// TscLibDll.INSTANCE.about();
// TscLibDll.INSTANCE.openport("TSC TTP-2410M");
TscLibDll.INSTANCE.openport("GP-58MB Series");
TscLibDll.INSTANCE.sendcommand("------------交班统计------------");
// // 2.设置打印机纸张规格
// TscLibDll.INSTANCE.setup("100", "100", "5", "8", "0", "0", "0");
// // 3.清除上次打印后的缓存
// TscLibDll.INSTANCE.clearbuffer();
// // 4.将字体写入暂存区准备打印
// TscLibDll.INSTANCE.printerfont ("100", "10", "3", "0", "1", "1", "(JAVA) DLL Test!!");
// // 5.调用打印机打印
// TscLibDll.INSTANCE.printlabel("1", "1");
// 6.断开和打印机的连接
TscLibDll.INSTANCE.closeport();
// TscLibDll.INSTANCE.sendcommand("REM ***** This is a test by JAVA. *****");
// TscLibDll.INSTANCE.sendcommand("PUTPCX 550,10,\"UL.PCX\"");
// TscLibDll.INSTANCE.barcode("100", "40", "128", "50", "1", "0", "2", "2", "123456789");
// TscLibDll.INSTANCE.windowsfont(400, 200, 48, 0, 3, 1, "arial", "DEG 0");
// TscLibDll.INSTANCE.windowsfont(400, 200, 48, 90, 3, 1, "arial", "DEG 90");
}
/**
* 蜂鸣
*/
public static void buzzing(Printer printer) {
// System.loadLibrary(LOAD_LIBRARY);
//
//// TscLibDll.INSTANCE.openport(printer.getName());
// TscLibDll.INSTANCE.openport("GP-58MB Series");
//
//// TscLibDll.INSTANCE.sendBinaryData(Command.BUZZING.getCommandBytes(), Command.BUZZING.getCommandBytes().length);
// TscLibDll.INSTANCE.closeport();
}
}
enum Command {
/** 切纸 */
CUT_PAPER(new byte[]{0x1D, 0x56, 1}),
/** 蜂鸣 */
BUZZING(new byte[]{0x1B,0x42,2,6 }),
/** 水平居中 */
ALINE_CENTER(new byte[]{0x1B,0x61,1 }),
/** 左对齐 */
ALINE_LEFT(new byte[]{0x1B,0x61,0 }),
/** 右对齐 */
ALINE_RIGHT(new byte[]{0x1B,0x61,2 }),
/** 行间距 */
LINE_HEIGHT_DEFAULT(new byte[]{0x1B,0x32}),
/** 横向跳格 */
SKIP_SPACE(new byte[]{0x1B,0x44,16,20,24,28 });
Command(byte[] commandBytes) {
this.commandBytes = commandBytes;
}
private byte[] commandBytes;
public byte[] getCommandBytes() {
return commandBytes;
}
}

View File

@ -35,6 +35,22 @@
</properties>
<dependencies>
<!--打印的依赖start-->
<!-- <dependency>-->
<!-- <groupId>net.java.dev.jna</groupId>-->
<!-- <artifactId>jna</artifactId>-->
<!-- <version>3.2.5</version>-->
<!-- </dependency>-->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.10.0</version> <!-- 请使用最新版本 -->
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>

View File

@ -23,3 +23,11 @@ export function addHandoverApi(data) {
data: data
})
}
export function printLocallyApi(data) {
return request({
url: '/business/handoverRecord/printLocally',
method: 'post',
data: data
})
}

View File

@ -288,7 +288,7 @@
<div class="box-ge">
<div class="boloicon">油枪统计</div>
<div class="input-hui-frou">
<div></div>
<div></div>
<div>笔数</div>
<div>升数</div>
<div style="text-align: right">金额</div>
@ -371,8 +371,8 @@
<el-card >
<div class="bottom-xz">
<div class="anniu" v-if="handoverList && handoverList.baseInfo && handoverList.baseInfo.handoverPrem == 'yqx'" @click="shift">交班</div>
<div class="anniu-lv">云打印</div>
<div class="anniu-lv">本地打印</div>
<!-- <div class="anniu-lv">云打印</div> -->
<div class="anniu-lv" @click="printLocally()">本地打印</div>
<div ><el-link type="primary" @click="recording">交班记录</el-link></div>
</div>
</el-card>
@ -382,7 +382,7 @@
</template>
<script>
import {addHandoverApi, getHandoverApi} from "@/api/cashier/handover";
import {addHandoverApi, getHandoverApi, printLocallyApi} from "@/api/cashier/handover";
import BigNumber from "bignumber.js";
import {removeUserId} from "@/utils/auth";
@ -412,23 +412,21 @@ import {removeUserId} from "@/utils/auth";
if (this.handoverList && this.handoverList.paymentAggregation) {
this.handoverList.paymentAggregation.forEach(res=> {
if (flag == 'fg') {
if (res.flag == 'fuel' || res.flag == 'card') {
let existingElementIndex = count.findIndex(item => item.payType === res.payType);
if (existingElementIndex !== -1) {
// let existingElement = count[existingElementIndex];
// paidAmount refundAmount
// existingElement.paidAmount = (Number(existingElement.paidAmount) || 0) + (Number(res.paidAmount) || 0);
// existingElement.refundAmount = (Number(existingElement.refundAmount) || 0) + (Number(res.refundAmount) || 0);
//
// existingElement.paidAmount = existingElement.paidAmount.toString();
// existingElement.refundAmount = existingElement.refundAmount.toString();
}else {
count.push(res);
}
if (res.flag == "card" || res.flag == "fuel") {
let flag2 = false;
count.forEach(coun => {
if (res.payType === coun.payType) {
coun.paidAmount += res.paidAmount;
flag2 = true;
}
});
if (!flag2) {
//
let newRes = { ...res };
count.push(newRes);
}
}
}
else if (res.flag == flag) {
}else if (res.flag == flag) {
count.push(res)
}
})
@ -468,7 +466,6 @@ import {removeUserId} from "@/utils/auth";
return count;
},
employeeStatistics() {
console.log("this.employeeStatistics",this.handoverList.employeeStatistics)
let count = [];
if (this.handoverList && this.handoverList.employeeStatistics) {
return this.handoverList.employeeStatistics
@ -498,6 +495,11 @@ import {removeUserId} from "@/utils/auth";
}
});
},
printLocally() {
printLocallyApi(this.handoverList).then(res=>{
})
},
//
shift() {
let msg = '交班并退出系统, 是否继续?'
@ -600,6 +602,8 @@ import {removeUserId} from "@/utils/auth";
let num = new BigNumber(0);
this.handoverList.paymentAggregation.forEach(res => {
if (res.flag == "card" || res.flag == "fuel") {
// console.log("222",res)
num = num.plus(new BigNumber(res.paidAmount));
}
});

View File

@ -72,7 +72,7 @@
<el-button
size="mini"
type="text"
@click="handleDetail(scope.row)"
@click="printLocally(scope.row.recordData)"
>补打交班单</el-button>
</template>
</el-table-column>
@ -94,7 +94,7 @@
</template>
<script>
import {getHandoverListApi} from "@/api/cashier/handover";
import {getHandoverListApi,printLocallyApi} from "@/api/cashier/handover";
import {getOrderApi,getStatisticsApi } from "@/api/cashier/integralOrder/order";
import Detail from '@/views/cashier/NewComponents/integralOrder/detail'
@ -185,6 +185,11 @@ export default {
},
this.dateRange = []
},
printLocally(data) {
printLocallyApi(data).then(res=>{
})
},
handleDetail(data){
this.openDetail = true
this.recordData = data.recordData;

View File

@ -4,7 +4,7 @@
<div class="box-center">
<div class="box-title">
交班统计
<el-button style="float: right ;margin-left: 5px" size="mini" type="primary" plain>打印交班单</el-button>
<el-button style="float: right ;margin-left: 5px" size="mini" type="primary" @click="printLocally()" plain>打印交班单</el-button>
</div>
<div class="box-ge">
<div class="input-box">
@ -370,7 +370,7 @@
</template>
<script>
import {addHandoverApi, getHandoverApi} from "@/api/cashier/handover";
import {printLocallyApi,addHandoverApis} from "@/api/cashier/handover";
import BigNumber from "bignumber.js";
export default {
@ -390,6 +390,13 @@ import BigNumber from "bignumber.js";
// this.getHandover();
},
methods: {
printLocally() {
console.log("12312312312312312313213122222")
printLocallyApi(this.recordData).then(res=>{
})
},
// getHandover() {
// getHandoverApi().then(res=>{
// this.handoverList = res.data;
@ -397,6 +404,14 @@ import BigNumber from "bignumber.js";
// })
// },
getList(){
getHandoverListApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
this.dataList = res.data.records
this.total = res.data.total
})
},
//
recording() {
this.$router.push({
@ -407,28 +422,27 @@ import BigNumber from "bignumber.js";
});
},
paymentAggregation(flag) {
let count = [];
if (this.handoverList && this.handoverList.paymentAggregation) {
this.handoverList.paymentAggregation.forEach(res=> {
if (flag == 'fg') {
if (res.flag == 'fuel' || res.flag == 'card') {
let existingElementIndex = count.findIndex(item => item.payType === res.payType);
if (existingElementIndex !== -1) {
// let existingElement = count[existingElementIndex];
// paidAmount refundAmount
// existingElement.paidAmount = (Number(existingElement.paidAmount) || 0) + (Number(res.paidAmount) || 0);
// existingElement.refundAmount = (Number(existingElement.refundAmount) || 0) + (Number(res.refundAmount) || 0);
//
// existingElement.paidAmount = existingElement.paidAmount.toString();
// existingElement.refundAmount = existingElement.refundAmount.toString();
}else {
count.push(res);
if (res.flag == "card" || res.flag == "fuel") {
let flag2 = false;
count.forEach(coun => {
if (res.payType === coun.payType) {
coun.paidAmount += res.paidAmount;
flag2 = true;
}
});
if (!flag2) {
//
let newRes = { ...res };
count.push(newRes);
}
}
}
else if (res.flag == flag) {
}else if (res.flag == flag) {
count.push(res)
}
})

View File

@ -101,9 +101,38 @@
},
goorder() {
uni.navigateTo({
url: '/pagesHome/order/order'
//
request({
url: '/business/userManager/user/getByUniApp',
method: 'get',
params: {
chainStoreId: uni.getStorageSync('chainStoreId')
}
}).then((res) => {
if (res.code == 200 && res.data) {
this.myPoints = res.data.points
if (res.data.points) {
if (!this.goodsInfo.exchangePoints) {
uni.navigateTo({
url: '/pagesHome/order/order'
})
} else if (res.data.points >= this.goodsInfo.exchangePoints) {
uni.navigateTo({
url: '/pagesHome/order/order'
})
} else {
//
uni.showToast({
icon: 'none',
title: "积分不足"
})
}
}
}
})
},
goback() {
uni.navigateBack()

View File

@ -62,6 +62,7 @@
<span
v-if="goodsInfo.exchangeMethod == '积分' || goodsInfo.exchangeMethod == '积分+金额' || goodsInfo.exchangeMethod == '积分+加钱购'">{{goodsInfo.exchangePoints}}积分</span>
<span v-if="goodsInfo.exchangeMethod == '积分+金额'">+</span>
<span
v-if="goodsInfo.exchangeMethod == '金额' || goodsInfo.exchangeMethod == '积分+金额'">{{goodsInfo.exchangeAmount}}</span>
@ -76,10 +77,12 @@
</view>
<view class="endbox">
<view style="color: #666666;font-size: 14px;">{{value}}件商品合计:</view>
<view style="color: red;"> <text style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分
<view v-if="allPoints>0" style="color: red;"> <text
style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分
</view>
<span v-if="allAmout>0 && allPoints>0">+</span>
<view v-if="allAmout>0" style="color: red;"> <text
style="font-weight: bold;font-size: 20px;">+{{allAmout}}</text>
style="font-weight: bold;font-size: 20px;">{{allAmout}}</text>
</view>
</view>
</view>
@ -92,13 +95,14 @@
<view class="bottom-box">
<view class="">
<view style="color: red;">
<text style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分
<text v-if="allAmout>0" style="font-weight: bold;font-size: 20px;">+{{allAmout}}</text>
<text v-if="allPoints>0" style="font-weight: bold;font-size: 20px;">{{allPoints}}</text> 积分
<span v-if="allAmout>0 && allPoints>0">+</span>
<text v-if="allAmout>0" style="font-weight: bold;font-size: 20px;">{{allAmout}}</text>
</view>
<view style="color: #9d9d9d; font-size: 12px; ">积分账户{{myPoints}}</view>
</view>
<view class="andeniu">
<text @click="choose()">选择</text>
<view @click="choose()" class="andeniu">
<text>选择</text>
</view>
</view>
@ -223,7 +227,7 @@
storeId: _this.storeId,
},
}).then(res => {
if (res.code === 200) {
if (res.data.code === "error") {
console.log(res)
let payProvider = "wxpay"
_this.orderInfo = JSON.parse(res.data.data.reservedPayInfo);
@ -242,22 +246,28 @@
})
},
fail: function(err) {
// request({
// url: "business/oilOrder/orderStatus",
// method: 'post',
// data: {
// "orderNo": res.data.data.orderNo,
// "status": "payFail"
// },
// }).then((res) => {
// uni.showToast({
// title: "!",
// icon: "error"
// })
// })
// console.log('fail:', err);
request({
url: "business/integral/integralOrders/editPayStatus",
method: 'post',
data: {
"orderNo": res.data.data.orderNo,
"status": "payFail",
"storeId": -1
},
}).then((res) => {
uni.showToast({
title: "支付失败!",
icon: "error"
})
})
console.log('fail:', err);
}
});
} else {
uni.showToast({
title: "支付失败!",
icon: "error"
})
}
})
@ -298,10 +308,25 @@
console.log("deliveryData", deliveryData)
if (deliveryData.length >= 2) {
this.qhindex = index
} else if (deliveryData[0] == '到店自提') {
} else if (deliveryData[0] == '门店自提') {
console.log("index", index)
if (index == 1) {
uni.showToast({
title: "该商品只支持到店自提!",
icon: "none"
})
}
this.qhindex = 0
} else if (deliveryData[0] == '物流配送') {
this.qhindex = 1
if (index == 0) {
uni.showToast({
title: "该商品只支持物流配送!",
icon: "none"
})
}
}
@ -318,7 +343,11 @@
allData() {
this.allPoints = 0
this.allAmout = 0
let allPoints = new BigNumber(this.goodsInfo.exchangePoints)
let allPoints = new BigNumber(0)
if (this.goodsInfo.exchangePoints) {
allPoints = new BigNumber(this.goodsInfo.exchangePoints)
}
//
// if (this.value < 1) {
@ -328,7 +357,7 @@
allPoints = allPoints.times(value)
console.log("allPoints", allPoints)
if (this.goodsInfo.exchangeMethod == '积分+金额') {
if (this.goodsInfo.exchangeMethod == '积分+金额' || this.goodsInfo.exchangeMethod == '金额') {
let allAmout = new BigNumber(this.goodsInfo.exchangeAmount)
allAmout = allAmout.times(value)