收银台
This commit is contained in:
parent
46e0745947
commit
79cded741a
@ -57,7 +57,7 @@ public class LJGoodsController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询商品信息
|
||||
* 根据条码查询商品信息
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
|
@ -218,29 +218,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
|
||||
// 调用支付接口
|
||||
try {
|
||||
Map<String, String> pay = fyPayService.pay(map1);
|
||||
String resultCode = pay.get("result_code");
|
||||
if (resultCode.equals("000000")){
|
||||
if (oilOrder1!=null){
|
||||
oilOrder1.setOrderStatus("paid");
|
||||
oilOrder1.setPayTime(new Date());
|
||||
this.updateOilOrder(oilOrder1);
|
||||
}
|
||||
if (ljOrder1!=null){
|
||||
ljOrder1.setStatus("paid");
|
||||
ljOrder1.setPayTime(new Date());
|
||||
orderService.updateGoodOrder(ljOrder1);
|
||||
}
|
||||
}else {
|
||||
if (oilOrder1!=null){
|
||||
oilOrder1.setOrderStatus("unpaid");
|
||||
this.updateOilOrder(oilOrder1);
|
||||
}
|
||||
if (ljOrder1!=null){
|
||||
ljOrder1.setStatus("unpaid");
|
||||
orderService.updateGoodOrder(ljOrder1);
|
||||
}
|
||||
}
|
||||
fyPayService.pay(map1);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -60,13 +60,6 @@
|
||||
<version>0.0.9</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.fuint</groupId>-->
|
||||
<!-- <artifactId>fuint-application</artifactId>-->
|
||||
<!-- <version>1.0.0</version>-->
|
||||
<!-- <scope>compile</scope>-->
|
||||
<!-- </dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,26 +1,29 @@
|
||||
package com.fuint.api.fuyou.service.impl;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.fuint.api.fuyou.entity.Builder;
|
||||
import com.fuint.api.fuyou.entity.Const;
|
||||
import com.fuint.api.fuyou.entity.Message;
|
||||
import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.util.Utils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import com.fuint.api.order.entity.GoodsOrder;
|
||||
import com.fuint.api.order.entity.OilOrders;
|
||||
import com.fuint.api.order.service.GoodsOrderService;
|
||||
import com.fuint.api.order.service.OilOrdersService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class FyPayServiceImpl implements FyPayService {
|
||||
@Autowired
|
||||
private GoodsOrderService goodsOrderService;
|
||||
@Autowired
|
||||
private OilOrdersService oilOrderService;
|
||||
|
||||
/**
|
||||
* 条码支付
|
||||
@ -59,53 +62,89 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
String str = resMap.get("sign");
|
||||
if (Utils.verifySign(resMap, str)){
|
||||
String resultCode = resMap.get("result_code");
|
||||
if (resultCode.equals("000000")){
|
||||
return resMap;
|
||||
}else {
|
||||
// if (resultCode.equals("000000")){
|
||||
// return resMap;
|
||||
// }else {
|
||||
ThreadUtil.execAsync(() -> {
|
||||
try {
|
||||
long startTime = System.currentTimeMillis();
|
||||
long endTime = startTime + 5000;
|
||||
while (System.currentTimeMillis() < endTime){
|
||||
this.queryOrder(map1);
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Map<String, String> orderQueryRes = queryOrder(map1);
|
||||
if(!orderQueryRes.get("msg").equals("unpaid")){
|
||||
timer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
Map<String, String> queryOrder = this.queryOrder(map1);
|
||||
return queryOrder;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
//定时器 立即开始 0.5s一次
|
||||
}, 0, 500);
|
||||
Thread.currentThread().interrupt();
|
||||
});
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
return null;
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, String> queryOrder(Map<String, String> map1) throws Exception {
|
||||
String orderNo = map1.get("orderNo");
|
||||
String payType = map1.get("payType");
|
||||
String insCd = map1.get("insCd");
|
||||
String mchntCd = map1.get("mchntCd");
|
||||
Map<String, String> map = Builder.buildFuiou30();
|
||||
map.put("mchnt_order_no",orderNo);
|
||||
map.put("order_type",payType);
|
||||
map.put("ins_cd", insCd);
|
||||
map.put("mchnt_cd", mchntCd);
|
||||
Map<String, String> resMap =new HashMap<>();
|
||||
resMap.put("msg","error");
|
||||
try {
|
||||
String orderNo = map1.get("orderNo");
|
||||
String payType = map1.get("payType");
|
||||
String insCd = map1.get("insCd");
|
||||
String mchntCd = map1.get("mchntCd");
|
||||
Map<String, String> map = Builder.buildFuiou30();
|
||||
map.put("mchnt_order_no",orderNo);
|
||||
map.put("order_type",payType);
|
||||
map.put("ins_cd", insCd);
|
||||
map.put("mchnt_cd", mchntCd);
|
||||
|
||||
// 请求报文
|
||||
String reqBody = Message.requestMsg(map);
|
||||
// 响应报文
|
||||
String rspXml = Message.responseMsg(reqBody,Const.fuiou_30_url);
|
||||
// 请求报文
|
||||
String reqBody = Message.requestMsg(map);
|
||||
// 响应报文
|
||||
String rspXml = Message.responseMsg(reqBody,Const.fuiou_30_url);
|
||||
|
||||
//响应报文验签
|
||||
Map<String, String> resMap = Utils.xmlStr2Map(rspXml);
|
||||
String str = resMap.get("sign");
|
||||
if (Utils.verifySign(resMap, str)){
|
||||
return resMap;
|
||||
//响应报文验签
|
||||
Map<String, String> reqMap = Utils.xmlStr2Map(rspXml);
|
||||
String str = reqMap.get("sign");
|
||||
if (Utils.verifySign(reqMap, str)){
|
||||
OilOrders oilOrder = oilOrderService.selectOilOrderByOrderNo(orderNo);
|
||||
GoodsOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo);
|
||||
if (reqMap.get("trans_stat").equals("SUCCESS")){
|
||||
if (!ObjectUtil.isEmpty(oilOrder)){
|
||||
oilOrder.setOrderStatus("paid");
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(goodsOrder)){
|
||||
goodsOrder.setStatus("paid");
|
||||
}
|
||||
resMap.put("msg","success");
|
||||
}else if (reqMap.get("trans_stat").equals("USERPAYING")){
|
||||
resMap.put("msg","unpaid");
|
||||
}else {
|
||||
if (!ObjectUtil.isEmpty(oilOrder)){
|
||||
oilOrder.setOrderStatus("payFail");
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(goodsOrder)){
|
||||
goodsOrder.setStatus("payFail");
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(oilOrder)){
|
||||
oilOrderService.updateOilOrder(oilOrder);
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(goodsOrder)){
|
||||
goodsOrderService.updateGoodOrder(goodsOrder);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
return resMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,97 @@
|
||||
package com.fuint.api.order.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商品订单表(Order)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 15:04:17
|
||||
*/
|
||||
@Data
|
||||
@TableName("mt_order")
|
||||
@ApiModel(value = "LJOrder对象", description = "商品订单表")
|
||||
public class GoodsOrder extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@ApiModelProperty("自增ID")
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 终端
|
||||
*/
|
||||
private String terminal;
|
||||
/**
|
||||
* 付款用户
|
||||
*/
|
||||
private String payUser;
|
||||
/**
|
||||
* 支付类型
|
||||
*/
|
||||
private String payType;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 所属店铺ID
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
private Double amount;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
private Double payAmount;
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer goodsNum;
|
||||
/**
|
||||
* 使用积分数量
|
||||
*/
|
||||
private Integer usePoint;
|
||||
/**
|
||||
* 积分金额
|
||||
*/
|
||||
private Double pointAmount;
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private Double discount;
|
||||
/**
|
||||
* 用户备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
private Date payTime;
|
||||
/**
|
||||
* 操作员工
|
||||
*/
|
||||
private Integer staffId;
|
||||
}
|
||||
|
@ -0,0 +1,118 @@
|
||||
package com.fuint.api.order.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 油品订单表(OilOrder)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-07 15:10:07
|
||||
*/
|
||||
@Data
|
||||
@TableName("oil_order")
|
||||
@ApiModel(value = "OilOrder对象", description = "油品订单表")
|
||||
public class OilOrders extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@ApiModelProperty("自增ID")
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 优惠券id
|
||||
*/
|
||||
private Integer couponId;
|
||||
/**
|
||||
* 提成金额
|
||||
*/
|
||||
private Double commissionAmount;
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
private Integer staffId;
|
||||
/**
|
||||
* 终端
|
||||
*/
|
||||
private String terminal;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 油品
|
||||
*/
|
||||
private String oils;
|
||||
/**
|
||||
* 油枪号
|
||||
*/
|
||||
private Integer oilGunNum;
|
||||
/**
|
||||
* 油品数量
|
||||
*/
|
||||
private Double oilNum;
|
||||
/**
|
||||
* 订单金额
|
||||
*/
|
||||
private Double orderAmount;
|
||||
/**
|
||||
* 优惠金额
|
||||
*/
|
||||
private Double discountAmount;
|
||||
/**
|
||||
* 实付金额
|
||||
*/
|
||||
private Double payAmount;
|
||||
/**
|
||||
* 付款用户
|
||||
*/
|
||||
private String payUser;
|
||||
/**
|
||||
* 付款类型:微信、支付宝等、赊账
|
||||
*/
|
||||
private String payType;
|
||||
/**
|
||||
* 开票标识:已开票、未开票
|
||||
*/
|
||||
private String invoicing;
|
||||
/**
|
||||
* 订单状态:已支付、未支付
|
||||
*/
|
||||
private String orderStatus;
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
private Date payTime;
|
||||
/**
|
||||
* 富友订单号
|
||||
*/
|
||||
private Integer reservedFyOrderNo;
|
||||
/**
|
||||
* 富友渠道交易流水号
|
||||
*/
|
||||
private Integer reservedTransactionId;
|
||||
/**
|
||||
* 订单备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fuint.api.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.api.order.entity.GoodsOrder;
|
||||
|
||||
/**
|
||||
* 订单信息 Mapper层
|
||||
*/
|
||||
public interface GoodsOrderMapper extends BaseMapper<GoodsOrder> {
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.fuint.api.order.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.api.order.entity.OilOrders;
|
||||
|
||||
/**
|
||||
* 油品订单表 Mapper层
|
||||
*/
|
||||
public interface OilOrdersMapper extends BaseMapper<OilOrders> {
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.fuint.api.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.api.order.entity.GoodsOrder;
|
||||
|
||||
/**
|
||||
* 订单信息 业务层
|
||||
*/
|
||||
public interface GoodsOrderService extends IService<GoodsOrder> {
|
||||
/**
|
||||
* 根据订单号查询商品订单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
public GoodsOrder selectGoodsOrder(String orderNo);
|
||||
|
||||
/**
|
||||
* 修改商品订单信息
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
public int updateGoodOrder(GoodsOrder order);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.fuint.api.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.api.order.entity.OilOrders;
|
||||
|
||||
/**
|
||||
* 油品订单信息 业务层
|
||||
*/
|
||||
public interface OilOrdersService extends IService<OilOrders> {
|
||||
/**
|
||||
* 根据订单号查询油品订单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
public OilOrders selectOilOrderByOrderNo(String orderNo);
|
||||
|
||||
/**
|
||||
* 添加油品订单信息
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
public int updateOilOrder(OilOrders order);
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.fuint.api.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.api.order.entity.GoodsOrder;
|
||||
import com.fuint.api.order.mapper.GoodsOrderMapper;
|
||||
import com.fuint.api.order.service.GoodsOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GoodsOrderServiceImpl extends ServiceImpl<GoodsOrderMapper, GoodsOrder> implements GoodsOrderService {
|
||||
|
||||
@Override
|
||||
public GoodsOrder selectGoodsOrder(String orderNo) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_no",orderNo);
|
||||
GoodsOrder ljOrder = baseMapper.selectOne(queryWrapper);
|
||||
return ljOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateGoodOrder(GoodsOrder order) {
|
||||
int row = baseMapper.updateById(order);
|
||||
return row;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.fuint.api.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.api.order.entity.OilOrders;
|
||||
import com.fuint.api.order.mapper.OilOrdersMapper;
|
||||
import com.fuint.api.order.service.OilOrdersService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class OilOrdersServiceImpl extends ServiceImpl<OilOrdersMapper, OilOrders> implements OilOrdersService {
|
||||
@Override
|
||||
public OilOrders selectOilOrderByOrderNo(String orderNo) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_no",orderNo);
|
||||
OilOrders order = baseMapper.selectOne(queryWrapper);
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOilOrder(OilOrders order) {
|
||||
int row = baseMapper.updateById(order);
|
||||
return row;
|
||||
}
|
||||
}
|
@ -56,11 +56,11 @@
|
||||
<div>满减活动</div>
|
||||
<div>-¥{{ oilDiscount + goodsDiscount }}</div>
|
||||
</div>
|
||||
<div class="center-left-hj">
|
||||
<div class="center-left-hj" v-show="isMember">
|
||||
<div>充值优惠</div>
|
||||
<div>-¥0</div>
|
||||
</div>
|
||||
<div class="center-left-hj">
|
||||
<div class="center-left-hj" v-show="isMember">
|
||||
<div>
|
||||
储值卡
|
||||
<span>(账户余额:{{ balance }}元)</span>
|
||||
@ -152,20 +152,29 @@
|
||||
<div class="center-top-title">非油商品</div>
|
||||
<div class="center-top-input">
|
||||
<template>
|
||||
<el-select v-model="goods" filterable
|
||||
style="width: 95%;font-size: 20px;"
|
||||
@change="changeGoods"
|
||||
clearable
|
||||
placeholder="请输入商品名称,商品关键词">
|
||||
<el-option
|
||||
v-for="item in goodsList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.retailPrice }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-autocomplete
|
||||
class="inline-input"
|
||||
v-model="goods"
|
||||
:fetch-suggestions="querySearch"
|
||||
placeholder="请输入内容"
|
||||
:trigger-on-focus="false"
|
||||
@select="queryGoods"
|
||||
></el-autocomplete>
|
||||
<!-- <el-select v-model="goods" filterable-->
|
||||
<!-- style="width: 95%;font-size: 20px;"-->
|
||||
<!-- @change="changeGoods"-->
|
||||
<!-- @keydown.enter.native="queryGoods"-->
|
||||
<!-- clearable-->
|
||||
<!-- placeholder="请输入商品名称,商品关键词">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="item in goodsList"-->
|
||||
<!-- :key="item.id"-->
|
||||
<!-- :label="item.name"-->
|
||||
<!-- :value="item.id">-->
|
||||
<!-- <span style="float: left">{{ item.name }}</span>-->
|
||||
<!-- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.retailPrice }}</span>-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
</template>
|
||||
</div>
|
||||
<div class="center-top-data">
|
||||
@ -311,7 +320,8 @@
|
||||
:visible.sync="dialogVisiblej"
|
||||
width="30%"
|
||||
:close-on-click-modal="false">
|
||||
<div v-if="isPay">
|
||||
<div v-if="isPay == true"
|
||||
v-loading="loading">
|
||||
<div style="text-align: center;font-size: 15px;font-weight: bold">应收金额</div>
|
||||
<div style="text-align: center;font-size: 30px;font-weight: bold;color: red;margin: 10px 0">
|
||||
¥{{ oilActualPay + goodsActualPay }}
|
||||
@ -344,8 +354,7 @@
|
||||
<el-button type="primary" class="but" @click="collection">确 定 收 款</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<div v-else
|
||||
v-loading="loading">
|
||||
<div v-else>
|
||||
<div v-if="isPaySuccess">
|
||||
<el-result icon="success" title="收款成功">
|
||||
<template slot="extra">
|
||||
@ -484,7 +493,7 @@
|
||||
<script>
|
||||
import {getDicts} from "@/api/dict/data";
|
||||
import {getOilNameList, getOilNumGun, getOilNumGunById, listOilNumGun} from "@/api/cashier/oilnumgun";
|
||||
import {getLJGoods, listgoods} from "@/api/cashier/ljgoods";
|
||||
import {getLJGoods, listgoods, queryLJGoods} from "@/api/cashier/ljgoods";
|
||||
import {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
|
||||
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
|
||||
import {addLJGoods, goodsOrder, oilOrder} from "@/api/cashier/oilorder";
|
||||
@ -582,8 +591,7 @@
|
||||
{name:'交班',icon: 'el-icon-s-flag'},
|
||||
],
|
||||
leftindex:0,
|
||||
oilList:[
|
||||
],
|
||||
oilList:[],
|
||||
colorList:[
|
||||
{color:'#e5f0ff'},
|
||||
{color:'#fff2e5'},
|
||||
@ -649,6 +657,8 @@
|
||||
isPay:true,
|
||||
isPaySuccess:false,
|
||||
orderNo:'',
|
||||
timer: null,
|
||||
isQuery:true,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -658,7 +668,23 @@
|
||||
this.getStaffList();
|
||||
this.getStaff();
|
||||
},
|
||||
mounted(){
|
||||
// this.restaurants = this.goodsList;
|
||||
},
|
||||
methods:{
|
||||
querySearch(queryString, cb) {
|
||||
let _this = this;
|
||||
let results = [];
|
||||
if (queryString == ""){
|
||||
cb(results);
|
||||
} else {
|
||||
queryLJGoods({goodsNo:_this.goods}).then( response => {
|
||||
results = [];
|
||||
results.push(response.data)
|
||||
})
|
||||
cb(results);
|
||||
}
|
||||
},
|
||||
// 取单
|
||||
pickOrder(){
|
||||
let list = this.takeList
|
||||
@ -810,8 +836,16 @@
|
||||
}
|
||||
this.goods = ""
|
||||
},
|
||||
// 回车触发商品搜索
|
||||
queryGoods(){
|
||||
let _this = this;
|
||||
queryLJGoods({goodsNo:_this.goods}).then( response => {
|
||||
console.log(response)
|
||||
})
|
||||
},
|
||||
// 立即结算
|
||||
settlement(){
|
||||
this.isPay = true
|
||||
this.dialogVisiblej = true
|
||||
},
|
||||
// 新增订单(重置)
|
||||
@ -945,11 +979,12 @@
|
||||
this.map.oilOrder = JSON.stringify(this.oilOrder);
|
||||
this.map.goodsOrder = JSON.stringify(this.goodsOrder);
|
||||
this.map.authCode = this.authCode;
|
||||
this.map.allAmount = this.map.oilActualPay + this.map.goodsActualPay;
|
||||
this.map.allAmount = this.oilActualPay + this.goodsActualPay;
|
||||
|
||||
let _this = this;
|
||||
addLJGoods(_this.map).then( response => {
|
||||
if (response.data.oilOrder!=null){
|
||||
_this.orderNo = response.data.oilOrder.orderNo;
|
||||
if (response.data.oilOrder.orderStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
}
|
||||
@ -961,10 +996,18 @@
|
||||
}
|
||||
})
|
||||
this.loading = true;
|
||||
this.isPay = false;
|
||||
_this.queryPayStatus();
|
||||
let timer = setInterval(function () {
|
||||
if (_this.isQuery == false) {
|
||||
_this.loading = false;
|
||||
_this.isPay = false;
|
||||
clearInterval(_this.timer);
|
||||
}
|
||||
},500)
|
||||
setTimeout(function (){
|
||||
_this.loading = false;
|
||||
},1000);
|
||||
clearInterval(timer);
|
||||
},30000)
|
||||
|
||||
this.authCode = "";
|
||||
if (_this.isPaySuccess == true){
|
||||
_this.oilAmount = 0;
|
||||
@ -978,10 +1021,44 @@
|
||||
_this.goodsTotal = 0;
|
||||
}
|
||||
},
|
||||
// 查询订单支付状态
|
||||
queryPayStatus(){
|
||||
let _this = this;
|
||||
_this.timer = setInterval(function (){
|
||||
oilOrder({orderNo:_this.orderNo}).then( response => {
|
||||
if (response.data!=null){
|
||||
if (response.data.orderStatus == "unpaid"){
|
||||
_this.isQuery = true;
|
||||
}
|
||||
if (response.data.orderStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
if (response.data.orderStatus == "payFail"){
|
||||
_this.isPaySuccess = false;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
goodsOrder({orderNo:_this.orderNo}).then( response => {
|
||||
if (response.data!=null){
|
||||
if (response.data.status == "unpaid"){
|
||||
_this.isQuery = true;
|
||||
}
|
||||
if (response.data.status == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
if (response.data.status == "payFail"){
|
||||
_this.isPaySuccess = false;
|
||||
_this.isQuery = false;
|
||||
}
|
||||
}
|
||||
})
|
||||
},500)
|
||||
},
|
||||
handClose(){
|
||||
if(this.isPaySuccess = false){
|
||||
this.isPay = true;
|
||||
}else {
|
||||
if(this.isPaySuccess){
|
||||
this.oilAmount = 0;
|
||||
this.oilActualPay = 0;
|
||||
this.oilDiscount = 0;
|
||||
@ -992,6 +1069,7 @@
|
||||
this.oilTotal = 0;
|
||||
this.goodsTotal = 0;
|
||||
}
|
||||
this.isPay = true;
|
||||
this.dialogVisiblej = false
|
||||
this.isPaySuccess = false;
|
||||
},
|
||||
|
@ -366,25 +366,26 @@ export default {
|
||||
}
|
||||
// 如果触发了回车事件(扫码结束时间)
|
||||
if (nextCode === 13) {
|
||||
if (code.length < 3) {
|
||||
return;
|
||||
}
|
||||
if (app.openScanPayCodeDialog == true) {
|
||||
app.$refs.scanPayCodeDialog.submit(code);
|
||||
return false;
|
||||
}
|
||||
if (app.openSwitchMemberDialog == true) {
|
||||
return false;
|
||||
}
|
||||
if (app.openSettlementDialog == true) {
|
||||
app.$alert("请点击确定收款!");
|
||||
return false;
|
||||
}
|
||||
app.addToCart(code);
|
||||
code = '';
|
||||
lastCode = '';
|
||||
lastTime = '';
|
||||
return true;
|
||||
|
||||
// if (code.length < 3) {
|
||||
// return;
|
||||
// }
|
||||
// if (app.openScanPayCodeDialog == true) {
|
||||
// app.$refs.scanPayCodeDialog.submit(code);
|
||||
// return false;
|
||||
// }
|
||||
// if (app.openSwitchMemberDialog == true) {
|
||||
// return false;
|
||||
// }
|
||||
// if (app.openSettlementDialog == true) {
|
||||
// app.$alert("请点击确定收款!");
|
||||
// return false;
|
||||
// }
|
||||
// app.addToCart(code);
|
||||
// code = '';
|
||||
// lastCode = '';
|
||||
// lastTime = '';
|
||||
// return true;
|
||||
}
|
||||
nextTime = new Date().getTime(); // 记录最新时间
|
||||
if (!lastTime && !lastCode) { // 如果上次时间和上次按键为空
|
||||
|
Loading…
Reference in New Issue
Block a user