收银台
This commit is contained in:
parent
ec9880272c
commit
3c1a0c7ca9
@ -14,16 +14,16 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
clearable
|
||||
placeholder="全部"
|
||||
>
|
||||
<el-option label="交易" value="交易"/>
|
||||
<el-option label="退款" value="退款"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="订单类型" prop="type">-->
|
||||
<!-- <el-select-->
|
||||
<!-- v-model="queryParams.type"-->
|
||||
<!-- clearable-->
|
||||
<!-- placeholder="全部"-->
|
||||
<!-- >-->
|
||||
<!-- <el-option label="交易" value="交易"/>-->
|
||||
<!-- <el-option label="退款" value="退款"/>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="支付类型" prop="payType">
|
||||
<el-select
|
||||
v-model="queryParams.payType"
|
||||
@ -95,7 +95,7 @@
|
||||
<dict-tag :options="dict.type.payment_type" :value="scope.row.payType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单类型" align="center" prop="type"/>
|
||||
<!-- <el-table-column label="订单类型" align="center" prop="type"/>-->
|
||||
<el-table-column label="交易员工" align="center" prop="staffId">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getRealName(staffList,scope.row.staffId) }}</span>
|
||||
|
@ -7,10 +7,7 @@ import com.fuint.business.order.service.LJOrderService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 订单信息 controller层
|
||||
@ -36,4 +33,15 @@ public class LJOrderController extends BaseController {
|
||||
IPage<LJOrder> list = orderService.selectOrderList(page,order);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单号查询订单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{orderNo}")
|
||||
public ResponseObject goodsOrder(@PathVariable String orderNo){
|
||||
LJOrder ljOrder = orderService.selectGoodsOrder(orderNo);
|
||||
return getSuccessResult(ljOrder);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.fuint.business.order.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.LJOrder;
|
||||
import com.fuint.business.order.entity.OilOrder;
|
||||
import com.fuint.business.order.service.OilOrderService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
@ -41,7 +42,18 @@ public class OilOrderController extends BaseController {
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@Validated @RequestBody Map<String,String> map){
|
||||
int row = orderService.insertOilOrder(map);
|
||||
return getSuccessResult(row);
|
||||
String order = orderService.insertOilOrder(map);
|
||||
return getSuccessResult(order);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单号查询订单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{orderNo}")
|
||||
public ResponseObject goodsOrder(@PathVariable String orderNo){
|
||||
OilOrder order = orderService.selectOilOrderByOrderNo(orderNo);
|
||||
return getSuccessResult(order);
|
||||
}
|
||||
}
|
||||
|
@ -33,10 +33,6 @@ public class LJOrder extends BaseEntity implements Serializable {
|
||||
* 终端
|
||||
*/
|
||||
private String terminal;
|
||||
/**
|
||||
* 订单类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 付款用户
|
||||
*/
|
||||
@ -53,10 +49,6 @@ public class LJOrder extends BaseEntity implements Serializable {
|
||||
* 所属店铺ID
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Integer goodId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
|
@ -34,115 +34,10 @@ public class OrderGoods extends BaseEntity implements Serializable {
|
||||
* 商品ID
|
||||
*/
|
||||
private Integer goodsId;
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private Double price;
|
||||
/**
|
||||
* 优惠价
|
||||
*/
|
||||
private Double discount;
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
private Integer num;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
public void setOrderId(Integer orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
public Integer getGoodsId() {
|
||||
return goodsId;
|
||||
}
|
||||
|
||||
public void setGoodsId(Integer goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public Double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Double getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(Double discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,9 +12,6 @@
|
||||
<if test="order.staffId != null and order.staffId != ''">
|
||||
and staff_id = #{order.staffId}
|
||||
</if>
|
||||
<if test="order.type != null and order.type != ''">
|
||||
and type = #{order.type}
|
||||
</if>
|
||||
<if test="order.payType != null and order.payType != ''">
|
||||
and pay_type = #{order.payType}
|
||||
</if>
|
||||
|
@ -3,13 +3,13 @@
|
||||
<mapper namespace="com.fuint.business.order.mapper.OrderGoodsMapper">
|
||||
<sql id="selectOrderGoods">
|
||||
select mog.id,mog.order_id,mog.goods_id,mg.name,mg.retail_price,mg.member_price,mog.num
|
||||
from mt_order_goods mog inner join mt_goods mg
|
||||
from mt_order_goods mog inner join mt_goods mg on mog.goods_id = mg.id
|
||||
</sql>
|
||||
|
||||
<select id="selectOrderGoods" resultType="com.fuint.business.order.vo.OrderGoodsVo">
|
||||
<include refid="selectOrderGoods"></include>
|
||||
<where>
|
||||
mog.goods_id = mg.id and mog.order_id = #{orderId}
|
||||
mog.order_id = #{orderId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -16,4 +16,25 @@ public interface LJOrderService extends IService<LJOrder> {
|
||||
* @return
|
||||
*/
|
||||
public IPage<LJOrder> selectOrderList(Page page, LJOrder order);
|
||||
|
||||
/**
|
||||
* 根据订单号查询商品订单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
public LJOrder selectGoodsOrder(String orderNo);
|
||||
|
||||
/**
|
||||
* 添加商品订单信息
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
public int insertGoodOrder(LJOrder order);
|
||||
|
||||
/**
|
||||
* 修改商品订单信息
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
public int updateGoodOrder(LJOrder order);
|
||||
}
|
||||
|
@ -19,10 +19,24 @@ public interface OilOrderService extends IService<OilOrder> {
|
||||
*/
|
||||
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order);
|
||||
|
||||
/**
|
||||
* 根据订单号查询油品订单信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
public OilOrder selectOilOrderByOrderNo(String orderNo);
|
||||
|
||||
/**
|
||||
* 添加油品订单信息
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public int insertOilOrder(Map<String ,String> map);
|
||||
public String insertOilOrder(Map<String ,String> map);
|
||||
|
||||
/**
|
||||
* 添加油品订单信息
|
||||
* @param order
|
||||
* @return
|
||||
*/
|
||||
public int updateOilOrder(OilOrder order);
|
||||
}
|
||||
|
@ -15,4 +15,11 @@ public interface OrderGoodsService extends IService<OrderGoods> {
|
||||
* @return
|
||||
*/
|
||||
public List<OrderGoodsVo> selectOrderGoods(int orderId);
|
||||
|
||||
/**
|
||||
* 添加商品订单对应信息
|
||||
* @param goods
|
||||
* @return
|
||||
*/
|
||||
public int insertOrderGoods(OrderGoods goods);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -20,4 +21,24 @@ public class LJOrderServiceImpl extends ServiceImpl<LJOrderMapper, LJOrder> impl
|
||||
IPage<LJOrder> ljOrderIPage = baseMapper.selectOrderList(page, order);
|
||||
return ljOrderIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LJOrder selectGoodsOrder(String orderNo) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_no",orderNo);
|
||||
LJOrder ljOrder = baseMapper.selectOne(queryWrapper);
|
||||
return ljOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertGoodOrder(LJOrder order) {
|
||||
int row = baseMapper.insert(order);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateGoodOrder(LJOrder order) {
|
||||
int row = baseMapper.updateById(order);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
@ -2,24 +2,39 @@ package com.fuint.business.order.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.business.order.entity.LJOrder;
|
||||
import com.fuint.business.order.entity.OilOrder;
|
||||
import com.fuint.business.order.entity.OrderGoods;
|
||||
import com.fuint.business.order.mapper.OilOrderMapper;
|
||||
import com.fuint.business.order.service.LJOrderService;
|
||||
import com.fuint.business.order.service.OilOrderService;
|
||||
import com.fuint.business.order.service.OrderGoodsService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> implements OilOrderService {
|
||||
@Autowired
|
||||
private LJOrderService orderService;
|
||||
@Autowired
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Autowired
|
||||
private FyPayService fyPayService;
|
||||
@Autowired
|
||||
private MerchantConfigService merchantConfigService;
|
||||
|
||||
@Override
|
||||
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -30,34 +45,187 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertOilOrder(Map<String ,String> map) {
|
||||
public OilOrder selectOilOrderByOrderNo(String orderNo) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_no",orderNo);
|
||||
OilOrder order = baseMapper.selectOne(queryWrapper);
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String insertOilOrder(Map<String ,String> map) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
// 油品订单信息
|
||||
String oilOrder = map.get("oilOrder");
|
||||
// 商品订单信息
|
||||
String goodsOrder = map.get("goodsOrder");
|
||||
// 支付类型
|
||||
String payType = map.get("payType");
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(oilOrder, JSONObject.class);
|
||||
OilOrder order = new OilOrder();
|
||||
// 油品订单金额
|
||||
Double oilAmount = Double.valueOf(map.get("oilAmount"));
|
||||
// 商品订单金额
|
||||
Double goodsAmount = Double.valueOf(map.get("goodsAmount"));
|
||||
// 油品实付金额
|
||||
Double oilActualPay = Double.valueOf(map.get("oilActualPay"));
|
||||
// 商品实付金额
|
||||
Double goodsActualPay = Double.valueOf(map.get("goodsActualPay"));
|
||||
// 付款用户
|
||||
String payUser = null;
|
||||
if (map.get("payUser") != null && !map.get("payUser").equals("")){
|
||||
payUser = map.get("payUser");
|
||||
}else {
|
||||
payUser = "散客";
|
||||
}
|
||||
// 油品优惠金额
|
||||
Double oilDiscount = Double.valueOf(map.get("oilDiscount"));
|
||||
// 商品优惠金额
|
||||
Double goodsDiscount = Double.valueOf(map.get("goodsDiscount"));
|
||||
// 员工id
|
||||
Integer staffId = Integer.valueOf(map.get("staffId"));
|
||||
Integer userId = null;
|
||||
if (map.get("userId") != null && !map.get("userId").equals("")){
|
||||
// 会员id
|
||||
userId = Integer.valueOf(map.get("userId"));
|
||||
}
|
||||
// 优惠券id
|
||||
Integer couponId = null;
|
||||
if (map.get("couponId") != null && !map.get("couponId").equals("")) {
|
||||
couponId = Integer.valueOf(map.get("couponId"));
|
||||
}
|
||||
// 提成金额
|
||||
Double commissionAmount = Double.valueOf(map.get("commissionAmount"));
|
||||
// 使用积分数量
|
||||
Integer usePoint = Integer.valueOf(map.get("usePoint"));
|
||||
// 积分金额
|
||||
Double pointAmount = Double.valueOf(map.get("pointAmount"));
|
||||
// 终端
|
||||
String terminal = map.get("terminal");
|
||||
|
||||
// 根据日期生成订单信息
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
String orderNo = timestamp+randomString;
|
||||
|
||||
OilOrder oilOrder1 = null;
|
||||
LJOrder ljOrder1 = null;
|
||||
// 添加油品订单信息
|
||||
for (JSONObject object : jsonObjects) {
|
||||
order.setOrderNo(timestamp+randomString);
|
||||
double amount = (double) object.get("amount");
|
||||
double oilPrice = (double) object.get("oilPrice");
|
||||
double oilNum = amount/oilPrice;
|
||||
order.setOilNum(oilNum);
|
||||
order.setPayType(payType);
|
||||
order.setOils((String) object.get("oilName"));
|
||||
order.setOilGunNum((Integer) object.get("oilGunNum"));
|
||||
order.setOrderAmount((Double) object.get("amount"));
|
||||
System.out.println(object.get("oilGunNum"));
|
||||
System.out.println(object.get("numberId"));
|
||||
System.out.println(object.get("oilName"));
|
||||
System.out.println(object.get("oilPrice"));
|
||||
System.out.println(object.get("amount"));
|
||||
if (!oilOrder.equals("[]")){
|
||||
// 将油品订单的json数据转换为数组
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(oilOrder, JSONObject.class);
|
||||
OilOrder order = new OilOrder();
|
||||
for (JSONObject object : jsonObjects) {
|
||||
Double amount = Double.valueOf(object.get("amount").toString());
|
||||
Double oilPrice = Double.valueOf(object.get("oilPrice").toString());
|
||||
Double oilNum = amount/oilPrice;
|
||||
|
||||
order.setStoreId(storeId);
|
||||
order.setUserId(userId);
|
||||
order.setCouponId(couponId);
|
||||
order.setCommissionAmount(commissionAmount);
|
||||
order.setStaffId(staffId);
|
||||
order.setTerminal(terminal);
|
||||
order.setOrderNo(orderNo);
|
||||
order.setOils((String) object.get("oilName"));
|
||||
order.setOilGunNum(Integer.valueOf(object.get("oilGunNum").toString()));
|
||||
order.setOilNum(oilNum);
|
||||
order.setOrderAmount(oilAmount);
|
||||
order.setDiscountAmount(oilDiscount);
|
||||
order.setPayAmount(oilActualPay);
|
||||
order.setPayUser(payUser);
|
||||
order.setPayType(payType);
|
||||
order.setInvoicing("未开票");
|
||||
order.setOrderStatus("unpaid");
|
||||
baseMapper.insert(order);
|
||||
oilOrder1 = this.selectOilOrderByOrderNo(orderNo);
|
||||
}
|
||||
}
|
||||
|
||||
// int row = baseMapper.insert(order);
|
||||
return 0;
|
||||
// 添加商品订单信息
|
||||
if (!goodsOrder.equals("[]")){
|
||||
LJOrder ljOrder = new LJOrder();
|
||||
ljOrder.setTerminal(terminal);
|
||||
ljOrder.setPayUser(payUser);
|
||||
ljOrder.setPayType(payType);
|
||||
ljOrder.setOrderNo(orderNo);
|
||||
ljOrder.setStoreId(storeId);
|
||||
ljOrder.setUserId(userId);
|
||||
ljOrder.setAmount(goodsAmount);
|
||||
ljOrder.setPayAmount(goodsActualPay);
|
||||
ljOrder.setGoodsNum(Integer.valueOf(map.get("goodsNum")));
|
||||
ljOrder.setUsePoint(usePoint);
|
||||
ljOrder.setPointAmount(pointAmount);
|
||||
ljOrder.setDiscount(goodsDiscount);
|
||||
ljOrder.setStaffId(staffId);
|
||||
ljOrder.setStatus("unpaid");
|
||||
orderService.insertGoodOrder(ljOrder);
|
||||
// 将油品订单的json数据转换为数组
|
||||
List<JSONObject> goods = JSONArray.parseArray(goodsOrder, JSONObject.class);
|
||||
|
||||
// 查询商品订单号
|
||||
OilOrder order1 = this.selectOilOrderByOrderNo(orderNo);
|
||||
|
||||
// 添加商品订单记录表
|
||||
OrderGoods orderGoods = new OrderGoods();
|
||||
for (JSONObject good : goods) {
|
||||
orderGoods.setOrderId(order1.getId());
|
||||
orderGoods.setGoodsId(Integer.valueOf(good.get("id").toString()));
|
||||
orderGoods.setNum(Integer.valueOf(good.get("num").toString()));
|
||||
orderGoodsService.insertOrderGoods(orderGoods);
|
||||
}
|
||||
ljOrder1 = orderService.selectGoodsOrder(orderNo);
|
||||
}
|
||||
|
||||
// 根据店铺id查询商户配置信息
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByStoreId(storeId);
|
||||
|
||||
// 调用支付接口
|
||||
Map<String,String> map1 = new HashMap<>();
|
||||
map1.put("authCode",map.get("authCode"));
|
||||
Integer allAmount = (int) (Double.valueOf(map.get("allAmount"))*100);
|
||||
map1.put("allAmount",allAmount.toString());
|
||||
map1.put("orderNo",orderNo);
|
||||
map1.put("payType",map.get("payType"));
|
||||
map1.put("insCd",merchantConfig.getInsCd());
|
||||
map1.put("mchntCd",merchantConfig.getMchntCd());
|
||||
map1.put("goodsDes",merchantConfig.getMerchantName());
|
||||
map1.put("publicKey",merchantConfig.getPublicKey());
|
||||
map1.put("privateKey",merchantConfig.getPrivateKey());
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOilOrder(OilOrder order) {
|
||||
int row = baseMapper.updateById(order);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,10 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
||||
List<OrderGoodsVo> list = baseMapper.selectOrderGoods(orderId);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertOrderGoods(OrderGoods goods) {
|
||||
int row = baseMapper.insert(goods);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.fuint.api.cashier.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.api.cashier.entity.OilNumGunConfig;
|
||||
import com.fuint.api.cashier.mapper.OilNumGunConfigMapper;
|
||||
|
@ -37,7 +37,7 @@ public class Builder {
|
||||
SimpleDateFormat sdf_no = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// sdf_no.format(calendar.getTime()) + (int) (random.nextDouble() * 100000)
|
||||
map.put("mchnt_order_no", "14527847");
|
||||
map.put("mchnt_order_no", "");
|
||||
map.put("curr_type", "");
|
||||
map.put("order_amt", "1");
|
||||
map.put("term_ip", Const.term_ip);
|
||||
@ -66,7 +66,7 @@ public class Builder {
|
||||
map.put("random_str", randomNumberGenerator.nextBytes().toHex());
|
||||
map.put("sign", "");
|
||||
map.put("order_type", Const.order_type);
|
||||
map.put("mchnt_order_no", "14527848");
|
||||
map.put("mchnt_order_no", "");
|
||||
|
||||
return map;
|
||||
}
|
||||
|
@ -6,27 +6,14 @@ import lombok.Data;
|
||||
public class Const {
|
||||
//编码
|
||||
public static String charset = "GBK";
|
||||
//富友公钥 用于验签
|
||||
public static final String FY_PUBLIC_KEY ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCBv9K+jiuHqXIehX81oyNSD2RfVn+KTPb7NRT5HDPFE35CjZJd7Fu40r0U2Cp7Eyhayv/mRS6ZqvBT/8tQqwpUExTQQBbdZjfk+efb9bF9a+uCnAg0RsuqxeJ2r/rRTsORzVLJy+4GKcv06/p6CcBc5BI1gqSKmyyNBlgfkxLYewIDAQAB";
|
||||
public static String version = "1.0";
|
||||
//机构私钥
|
||||
public static final String INS_PRIVATE_KEY ="MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJgAzD8fEvBHQTyxUEeK963mjziM\n" +
|
||||
"WG7nxpi+pDMdtWiakc6xVhhbaipLaHo4wVI92A2wr3ptGQ1/YsASEHm3m2wGOpT2vrb2Ln/S7lz1\n" +
|
||||
"ShjTKaT8U6rKgCdpQNHUuLhBQlpJer2mcYEzG/nGzcyalOCgXC/6CySiJCWJmPyR45bJAgMBAAEC\n" +
|
||||
"gYBHFfBvAKBBwIEQ2jeaDbKBIFcQcgoVa81jt5xgz178WXUg/awu3emLeBKXPh2i0YtN87hM/+J8\n" +
|
||||
"fnt3KbuMwMItCsTD72XFXLM4FgzJ4555CUCXBf5/tcKpS2xT8qV8QDr8oLKA18sQxWp8BMPrNp0e\n" +
|
||||
"pmwun/gwgxoyQrJUB5YgZQJBAOiVXHiTnc3KwvIkdOEPmlfePFnkD4zzcv2UwTlHWgCyM/L8SCAF\n" +
|
||||
"clXmSiJfKSZZS7o0kIeJJ6xe3Mf4/HSlhdMCQQCnTow+TnlEhDTPtWa+TUgzOys83Q/VLikqKmDz\n" +
|
||||
"kWJ7I12+WX6AbxxEHLD+THn0JGrlvzTEIZyCe0sjQy4LzQNzAkEAr2SjfVJkuGJlrNENSwPHMugm\n" +
|
||||
"vusbRwH3/38ET7udBdVdE6poga1Z0al+0njMwVypnNwy+eLWhkhrWmpLh3OjfQJAI3BV8JS6xzKh\n" +
|
||||
"5SVtn/3Kv19XJ0tEIUnn2lCjvLQdAixZnQpj61ydxie1rggRBQ/5vLSlvq3H8zOelNeUF1fT1QJA\n" +
|
||||
"DNo+tkHVXLY9H2kdWFoYTvuLexHAgrsnHxONOlSA5hcVLd1B3p9utOt3QeDf6x2i1lqhTH2w8gzj\n" +
|
||||
"vsnx13tWqg==";
|
||||
public static String INS_PRIVATE_KEY ="";
|
||||
// 机构号
|
||||
public static String ins_cd = "08A9999999";
|
||||
public static String ins_cd = "";
|
||||
// public static String ins_cd = "08K0056616";
|
||||
// 商户号
|
||||
public static String mchnt_cd = "0002900F0370542";
|
||||
public static String mchnt_cd = "";
|
||||
// public static String mchnt_cd = "0004510F6119622";
|
||||
// 终端号
|
||||
public static String term_id = "88888888";
|
||||
@ -35,7 +22,7 @@ public class Const {
|
||||
// 签名
|
||||
public static String sign;
|
||||
// 订单类型
|
||||
public static String order_type = "WECHAT";
|
||||
public static String order_type = "";
|
||||
// 商品名称
|
||||
public static String goods_des = "测试";
|
||||
// 订单总金额
|
||||
@ -45,12 +32,12 @@ public class Const {
|
||||
// 交易起始时间
|
||||
public static String txn_begin_ts;
|
||||
// 扫码支付授权码
|
||||
public static String auth_code = "134429487327511978";
|
||||
public static String auth_code = "";
|
||||
// 交易关闭时间
|
||||
public static Integer reserved_expire_minute = 1;
|
||||
|
||||
//机构公钥
|
||||
public static final String INS_PUBLIC_KEY="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCYAMw/HxLwR0E8sVBHivet5o84jFhu58aYvqQzHbVompHOsVYYW2oqS2h6OMFSPdgNsK96bRkNf2LAEhB5t5tsBjqU9r629i5/0u5c9UoY0ymk/FOqyoAnaUDR1Li4QUJaSXq9pnGBMxv5xs3MmpTgoFwv+gskoiQliZj8keOWyQIDAQAB";
|
||||
public static String INS_PUBLIC_KEY="";
|
||||
|
||||
//异步通知(回调地址)
|
||||
public static String notify_url = "http://www.wrx.cn";
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.fuint.api.fuyou.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.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商户配置表(MerchantConfig)实体类
|
||||
*/
|
||||
@Data
|
||||
@TableName("merchant_config")
|
||||
@ApiModel(value = "MerchantConfig对象", description = "商户配置表")
|
||||
public class MerchantConfig extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("自增ID")
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 机构号
|
||||
*/
|
||||
private String insCd;
|
||||
/**
|
||||
* 商户号
|
||||
*/
|
||||
private String mchntCd;
|
||||
/**
|
||||
* 商户名称
|
||||
*/
|
||||
private String merchantName;
|
||||
/**
|
||||
* 公钥
|
||||
*/
|
||||
private String publicKey;
|
||||
/**
|
||||
* 私钥
|
||||
*/
|
||||
private String privateKey;
|
||||
/**
|
||||
* 是否开启规则:0不开启,1开启
|
||||
*/
|
||||
private String isOpenRule;
|
||||
/**
|
||||
* 账户金额
|
||||
*/
|
||||
private Double amount;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package com.fuint.api.fuyou.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
|
||||
public interface MerchantConfigMapper extends BaseMapper<MerchantConfig> {
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.fuint.api.fuyou.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
|
||||
/**
|
||||
* 商户配置信息 业务层
|
||||
*/
|
||||
public interface MerchantConfigService extends IService<MerchantConfig> {
|
||||
/**
|
||||
* 根据店铺id查询商户信息
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
public MerchantConfig selectMeChByStoreId(int storeId);
|
||||
}
|
@ -10,6 +10,7 @@ import com.fuint.api.fuyou.util.Utils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
@ -20,6 +21,7 @@ import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class FyPayServiceImpl implements FyPayService {
|
||||
|
||||
/**
|
||||
* 条码支付
|
||||
* @param map1
|
||||
@ -27,11 +29,25 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> pay(Map<String, String> map1) throws Exception {
|
||||
String publicKey = map1.get("publicKey");
|
||||
String privateKey = map1.get("privateKey");
|
||||
Const.INS_PUBLIC_KEY = publicKey;
|
||||
Const.INS_PRIVATE_KEY = privateKey;
|
||||
String authCode = map1.get("authCode");
|
||||
String orderNo = map1.get("orderNo");
|
||||
String payType = map1.get("payType");
|
||||
String allAmount = map1.get("allAmount");
|
||||
String insCd = map1.get("insCd");
|
||||
String mchntCd = map1.get("mchntCd");
|
||||
String goodsDes = map1.get("goodsDes");
|
||||
Map<String, String> map = Builder.buildFuiou22();
|
||||
map.put("auth_code",authCode);
|
||||
map.put("mchnt_order_no",orderNo);
|
||||
map.put("order_type",payType);
|
||||
map.put("order_amt", allAmount);
|
||||
map.put("ins_cd", insCd);
|
||||
map.put("mchnt_cd", mchntCd);
|
||||
map.put("goods_des", goodsDes);
|
||||
|
||||
// 请求报文
|
||||
String reqBody = Message.requestMsg(map);
|
||||
@ -51,14 +67,10 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
long startTime = System.currentTimeMillis();
|
||||
long endTime = startTime + 5000;
|
||||
while (System.currentTimeMillis() < endTime){
|
||||
Map<String, String> queryOrder = this.queryOrder(map1);
|
||||
String resultCode1 = queryOrder.get("result_code");
|
||||
if (resultCode1.equals("000000")){
|
||||
// 修改已支付
|
||||
}else {
|
||||
// 支付失败
|
||||
}
|
||||
this.queryOrder(map1);
|
||||
}
|
||||
Map<String, String> queryOrder = this.queryOrder(map1);
|
||||
return queryOrder;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -72,8 +84,14 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
@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);
|
||||
|
||||
// 请求报文
|
||||
String reqBody = Message.requestMsg(map);
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.fuint.api.fuyou.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.mapper.MerchantConfigMapper;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 商户配置信息 业务层
|
||||
*/
|
||||
@Service
|
||||
public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper, MerchantConfig> implements MerchantConfigService {
|
||||
@Override
|
||||
public MerchantConfig selectMeChByStoreId(int storeId) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.eq("is_open_rule",0);
|
||||
MerchantConfig merchantConfig = baseMapper.selectOne(queryWrapper);
|
||||
return merchantConfig;
|
||||
}
|
||||
}
|
@ -84,14 +84,10 @@ public class Utils {
|
||||
|
||||
String preSignStr = createLinkString(mapNew);
|
||||
|
||||
// System.out.println("==============================待签名字符串==============================\r\n" + preSignStr);
|
||||
|
||||
String sign = Sign.sign(preSignStr, Const.INS_PRIVATE_KEY);
|
||||
|
||||
sign = sign.replace("\r\n", "");
|
||||
|
||||
// System.out.println("==============================签名字符串==============================\r\n" + sign);
|
||||
|
||||
return sign;
|
||||
}
|
||||
|
||||
@ -108,7 +104,7 @@ public class Utils {
|
||||
|
||||
String preSignStr = createLinkString(mapNew);
|
||||
|
||||
return Sign.verify(preSignStr.getBytes(Const.charset), Const.FY_PUBLIC_KEY, sign);
|
||||
return Sign.verify(preSignStr.getBytes(Const.charset), Const.INS_PUBLIC_KEY, sign);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,3 +17,19 @@ export function addLJGoods(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 根据订单号查询油品订单信息
|
||||
export function oilOrder(orderNo) {
|
||||
return request({
|
||||
url: `/business/oilOrder/${orderNo}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 根据订单号查询商品订单信息
|
||||
export function goodsOrder(orderNo) {
|
||||
return request({
|
||||
url: `/business/order/${orderNo}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -54,12 +54,12 @@
|
||||
</div>
|
||||
<div class="center-left-hj">
|
||||
<div>满减活动</div>
|
||||
<div>-¥2.87</div>
|
||||
<div>-¥{{ oilDiscount + goodsDiscount }}</div>
|
||||
</div>
|
||||
<div class="center-left-th">
|
||||
<div class="th-box">
|
||||
<div>扫码支付</div>
|
||||
<div class="bule">{{ oilAmount + goodsAmount }}</div>
|
||||
<div class="bule">{{ oilActualPay + goodsActualPay }}</div>
|
||||
</div>
|
||||
<div class="th-box">
|
||||
<div>找零</div>
|
||||
@ -81,8 +81,8 @@
|
||||
</div>
|
||||
<div class="center-left-bottom">
|
||||
<div>
|
||||
<div class="bottom-price">¥{{ oilAmount + goodsAmount }}</div>
|
||||
<div class="price-red">优惠合计:5.74元</div>
|
||||
<div class="bottom-price">¥{{ oilActualPay + goodsActualPay }}</div>
|
||||
<div class="price-red">优惠合计:{{ oilDiscount + goodsDiscount }}元</div>
|
||||
</div>
|
||||
<div class="center-left-lv" @click="settlement">立即结算</div>
|
||||
</div>
|
||||
@ -110,15 +110,6 @@
|
||||
<div class="center-top-data">
|
||||
<div class="center-top-of">
|
||||
<div class="wrap-wrap">
|
||||
<!-- <div class="of-box" v-for="(item,index) in 17" :key="index"
|
||||
:style="{'background-color': colorList[index%5].color}">-->
|
||||
<!-- <div>92#</div>-->
|
||||
|
||||
<!-- <div class="of-title" >{{index+1}}号枪</div>-->
|
||||
<!-- <div>-->
|
||||
<!-- <img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<div class="of-box" v-for="(item,index) in oilNumGunList" :key="index"
|
||||
:style="{'background-color': colorList[index%5].color}"
|
||||
@click="refuel(item.id)">
|
||||
@ -210,8 +201,8 @@
|
||||
<div class="center-left-bottom">
|
||||
<div class="bottom-qk" @click="empty">清空</div>
|
||||
<div style="display: flex">
|
||||
<div class="bottom-qd">取单</div>
|
||||
<div class="bottom-gd">挂单</div>
|
||||
<div class="bottom-qd" @click="dialogTakeOrder = true">取单</div>
|
||||
<div class="bottom-gd" @click="dialogRegistration = true">挂单</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -235,43 +226,143 @@
|
||||
<!-- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>-->
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 挂单-->
|
||||
<el-dialog
|
||||
title="挂单提示"
|
||||
:visible.sync="dialogRegistration"
|
||||
width="20%"
|
||||
style="margin-top: 200px"
|
||||
:close-on-click-modal="false">
|
||||
<div class="wrap-wrap">
|
||||
<p>
|
||||
挂单只可将非油商品进行挂单,挂单成功后可在取单页面进行取单操作、挂单备注为选填
|
||||
</p>
|
||||
<div>
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
style="width: 180%"
|
||||
placeholder="请输入挂单备注(选填)"
|
||||
v-model="registrationRemark">
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogRegistration = false">关 闭</el-button>
|
||||
<el-button type="primary" @click="registration">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 挂单成功提示-->
|
||||
<el-dialog
|
||||
title="挂单成功"
|
||||
:visible.sync="dialogSuccess"
|
||||
width="20%"
|
||||
style="margin-top: 200px"
|
||||
:close-on-click-modal="false">
|
||||
<span>商品记录挂单成功</span>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<!-- <el-button @click="dialogVisible = false">取 消</el-button>-->
|
||||
<el-button type="primary" @click="dialogSuccess = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 取单提示-->
|
||||
<el-dialog
|
||||
title="取单"
|
||||
:visible.sync="dialogTakeOrder"
|
||||
width="50%"
|
||||
:close-on-click-modal="false">
|
||||
<div style="height: 500px">
|
||||
<el-row class="tac">
|
||||
<el-col :span="6">
|
||||
<el-input v-model="putRemark" placeholder="挂单备注检索" style="margin-bottom: 20px;width: 80%"></el-input>
|
||||
<el-menu
|
||||
default-active="2"
|
||||
v-for="(item,index) in registrationList"
|
||||
:key="index"
|
||||
class="el-menu-vertical-demo">
|
||||
<el-menu-item :index="index+''" @click="getTakeGoods(item,index)">
|
||||
<span slot="title">{{ item.menu }}</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<el-table ref="tables" :data="takeList">
|
||||
<el-table-column label="商品名称" align="center" prop="name" />
|
||||
<el-table-column label="零售价" align="center" prop="retailPrice"/>
|
||||
<el-table-column label="数量" align="center" prop="num"/>
|
||||
<el-table-column label="金额" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.retailPrice * scope.row.num }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<span style="display: flex;justify-content: space-between">
|
||||
<el-button class="elBut" @click="dialogTakeOrder = false" round>返 回</el-button>
|
||||
<span>
|
||||
<el-button class="elBut" type="danger" @click="cancel" round>作 废</el-button>
|
||||
<el-button class="elBut" type="success" @click="pickOrder" round>取 单</el-button>
|
||||
</span>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 立即结算-->
|
||||
<el-dialog
|
||||
title="扫码支付"
|
||||
:visible.sync="dialogVisiblej"
|
||||
width="30%"
|
||||
:close-on-click-modal="false">
|
||||
<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">
|
||||
¥{{ oilAmount + goodsAmount }}
|
||||
<div v-if="isPay">
|
||||
<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">
|
||||
¥{{ oilAmount + goodsAmount }}
|
||||
</div>
|
||||
<div style="text-align: center;margin-bottom: 10px">
|
||||
合计金额:{{ oilAmount + goodsAmount }}元、优惠合计13.02元
|
||||
</div>
|
||||
<div>
|
||||
<el-input v-model="authCode"
|
||||
autofocus="autofocus"
|
||||
@keydown.enter.native="collection"
|
||||
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
|
||||
<i
|
||||
slot="suffix">
|
||||
<svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg>
|
||||
</i>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="demo-image">
|
||||
<div class="block" style="text-align: center">
|
||||
<el-image
|
||||
style="width: 200px; height: 200px"
|
||||
fit="cover"
|
||||
src="https://oil.wudb.cn/static/img/scan-demo.fcb8b1ab.png"></el-image>
|
||||
</div>
|
||||
</div>
|
||||
<el-divider></el-divider>
|
||||
<span slot="footer" class="dialog-footer" style="display: flex;justify-content: space-around">
|
||||
<el-button @click="dialogVisiblej = false" class="but">取 消</el-button>
|
||||
<el-button type="primary" class="but" @click="collection">确 定 收 款</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<div style="text-align: center;margin-bottom: 10px">
|
||||
合计金额:{{ oilAmount + goodsAmount }}元、优惠合计13.02元
|
||||
</div>
|
||||
<div>
|
||||
<el-input v-model="authCode"
|
||||
autofocus="autofocus"
|
||||
@keydown.enter.native="collection"
|
||||
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
|
||||
<i
|
||||
slot="suffix">
|
||||
<svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg>
|
||||
</i>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="demo-image">
|
||||
<div class="block" style="text-align: center">
|
||||
<el-image
|
||||
style="width: 200px; height: 200px"
|
||||
fit="cover"
|
||||
src="https://oil.wudb.cn/static/img/scan-demo.fcb8b1ab.png"></el-image>
|
||||
<div v-else
|
||||
v-loading="loading">
|
||||
<div v-if="isPaySuccess">
|
||||
<el-result icon="success" title="收款成功">
|
||||
<template slot="extra">
|
||||
<el-button type="primary" @click="handClose">关 闭</el-button>
|
||||
</template>
|
||||
</el-result>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-result icon="error" title="支付失败,请重新支付">
|
||||
<template slot="extra">
|
||||
<el-button type="primary" @click="handClose">关 闭</el-button>
|
||||
</template>
|
||||
</el-result>
|
||||
</div>
|
||||
</div>
|
||||
<el-divider></el-divider>
|
||||
<span slot="footer" class="dialog-footer" style="display: flex;justify-content: space-around">
|
||||
<el-button @click="dialogVisiblej = false" class="but">取 消</el-button>
|
||||
<el-button type="primary" class="but" @click="collection">确 定 收 款</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 会员登录-->
|
||||
<el-dialog
|
||||
@ -313,7 +404,7 @@
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisiblevip = false">取 消</el-button>
|
||||
<el-button type="primary" @click="chooseUser">确 定</el-button>
|
||||
<el-button type="primary" @click="chooseUser(member.mobile,member.id)">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!-- 油号选择-->
|
||||
@ -337,7 +428,7 @@
|
||||
<span class="amountBlue">{{ form.oilPrice }}元/L</span>
|
||||
</div>
|
||||
<div >
|
||||
<el-input v-model="form.amount" placeholder="请输入加油金额" autofocus="autofocus"
|
||||
<el-input v-model="form.amount" placeholder="请输入加油金额"
|
||||
style="font-weight: 700;text-align: center;font-size: 20px;">
|
||||
<el-select v-model="select" style="width: 70px" @change="changeSelect" slot="append" placeholder="请选择">
|
||||
<el-option label="元" value="元"></el-option>
|
||||
@ -398,19 +489,38 @@
|
||||
import {getLJGoods, listgoods} from "@/api/cashier/ljgoods";
|
||||
import {getUserVoMobile, getUserVoName} from "@/api/cashier/user";
|
||||
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
|
||||
import {addLJGoods} from "@/api/cashier/oilorder";
|
||||
import {addLJGoods, goodsOrder, oilOrder} from "@/api/cashier/oilorder";
|
||||
import {getUserGrade} from "@/api/cashier/usergrade";
|
||||
|
||||
export default {
|
||||
name: "homeindex",
|
||||
data(){
|
||||
return{
|
||||
loading:false,
|
||||
// 油品类型
|
||||
oilType:'',
|
||||
// 取单列表
|
||||
takeList:[],
|
||||
// 挂单备注检索
|
||||
putRemark:"",
|
||||
// 挂单备注
|
||||
registrationRemark:"",
|
||||
// 挂单列表
|
||||
registrationList:[],
|
||||
// 油品订单
|
||||
oilOrder:[],
|
||||
// 油品金额
|
||||
oilAmount:0,
|
||||
// 油品订单数
|
||||
oilTotal:0,
|
||||
// 油品实付金额
|
||||
oilActualPay:0,
|
||||
// 油品优惠金额
|
||||
oilDiscount:0,
|
||||
// 商品优惠金额
|
||||
goodsDiscount:0,
|
||||
// 商品实付金额
|
||||
goodsActualPay:0,
|
||||
// 商品订单
|
||||
goodsOrder:[],
|
||||
// 商品金额
|
||||
@ -452,6 +562,9 @@
|
||||
dialogVisiblevip:false,
|
||||
dialogVisibleamount:false,
|
||||
dialogVisibleMember:false,
|
||||
dialogRegistration:false,
|
||||
dialogSuccess:false,
|
||||
dialogTakeOrder:false,
|
||||
activeName: '1',
|
||||
tabarr:[
|
||||
{name:'收银台',icon:'el-icon-s-platform'},
|
||||
@ -483,28 +596,51 @@
|
||||
// 员工信息
|
||||
staff:"",
|
||||
map:{
|
||||
allAmount:0,
|
||||
// 用户支付条码信息
|
||||
authCode:'',
|
||||
// 油品订单
|
||||
oilOrder:"",
|
||||
// 商品订单
|
||||
goodsOrder:"",
|
||||
// 支付方式
|
||||
payType:"",
|
||||
payType:"WECHAT",
|
||||
// 油品订单金额
|
||||
oilAmount:"",
|
||||
oilAmount:0,
|
||||
// 商品订单金额
|
||||
goodsAmount:"",
|
||||
goodsAmount:0,
|
||||
// 油品实付金额
|
||||
oilActualPay:"",
|
||||
oilActualPay:0,
|
||||
// 商品实付金额
|
||||
goodsActualPay:"",
|
||||
goodsActualPay:0,
|
||||
// 付款用户
|
||||
payUser:"",
|
||||
// 油品优惠金额
|
||||
oilDiscount:"",
|
||||
oilDiscount:0,
|
||||
// 商品优惠金额
|
||||
goodsDiscount:"",
|
||||
goodsDiscount:0,
|
||||
// 员工id
|
||||
staffId:"",
|
||||
// 优惠券id
|
||||
couponId:"",
|
||||
// 会员id
|
||||
userId:"",
|
||||
// 提成金额
|
||||
commissionAmount:0,
|
||||
// 使用积分数量
|
||||
usePoint:0,
|
||||
// 积分金额
|
||||
pointAmount:0,
|
||||
// 终端
|
||||
terminal:"PC",
|
||||
// 商品数量
|
||||
goodsNum:0,
|
||||
},
|
||||
gradeName:"",
|
||||
menu:1,
|
||||
index:0,
|
||||
isPay:true,
|
||||
isPaySuccess:false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -515,22 +651,69 @@
|
||||
this.getStaff();
|
||||
},
|
||||
methods:{
|
||||
// 取单
|
||||
pickOrder(){
|
||||
let list = this.takeList
|
||||
this.goodsOrder = list;
|
||||
let num = 0;
|
||||
let amount = 0;
|
||||
list.forEach(item => {
|
||||
num += item.num;
|
||||
amount += item.retailPrice;
|
||||
})
|
||||
this.goodsTotal = num;
|
||||
this.goodsAmount = amount;
|
||||
this.dialogTakeOrder = false;
|
||||
},
|
||||
// 作废
|
||||
cancel(){
|
||||
this.registrationList.splice(this.index,1);
|
||||
this.takeList = [];
|
||||
},
|
||||
// 取单列表
|
||||
getTakeGoods(data,index){
|
||||
this.takeList = data.children;
|
||||
this.index = index;
|
||||
},
|
||||
// 挂单
|
||||
registration(){
|
||||
this.dialogRegistration = false;
|
||||
this.registrationList.push({menu:this.menu,children:this.goodsOrder})
|
||||
this.menu++;
|
||||
this.goodsOrder = [];
|
||||
this.goodsTotal = 0;
|
||||
this.goodsAmount = 0;
|
||||
this.getTakeGoods(this.registrationList[0]);
|
||||
this.dialogSuccess = true;
|
||||
},
|
||||
// 重置会员
|
||||
resetMember(){
|
||||
this.member = {};
|
||||
this.isMember = false;
|
||||
this.map.payUser == ""
|
||||
},
|
||||
// 获取会员等级信息
|
||||
getGrade(id){
|
||||
getUserGrade(id).then( response => {
|
||||
this.gradeName = response.data.name;
|
||||
if (this.oilType == "汽油"){
|
||||
|
||||
}
|
||||
if (this.oilType == "柴油"){
|
||||
|
||||
}
|
||||
if (this.oilType == "天然气"){
|
||||
|
||||
}
|
||||
})
|
||||
return this.gradeName;
|
||||
},
|
||||
// 选择会员
|
||||
chooseUser(){
|
||||
chooseUser(mobile,id){
|
||||
this.dialogVisiblevip = false
|
||||
this.isMember = true;
|
||||
this.map.payUser = mobile;
|
||||
this.map.userId = id;
|
||||
},
|
||||
// 选择会员信息
|
||||
handleChoose(data){
|
||||
@ -542,16 +725,19 @@
|
||||
this.goodsOrder = [];
|
||||
this.goodsTotal = 0;
|
||||
this.goodsAmount = 0;
|
||||
this.goodsActualPay = 0;
|
||||
},
|
||||
// 获取当前账户信息
|
||||
getStaff(){
|
||||
staffInfo().then( response => {
|
||||
this.staff = response.data
|
||||
this.staff = response.data;
|
||||
this.map.staffId = this.staff.id;
|
||||
})
|
||||
},
|
||||
// 选择员工信息
|
||||
chooseStaff(data){
|
||||
this.staff = data;
|
||||
this.map.staffId = this.staff.id;
|
||||
},
|
||||
// 删除商品列表信息
|
||||
delGoods(index){
|
||||
@ -575,6 +761,7 @@
|
||||
}
|
||||
}
|
||||
this.goodsAmount = amount;
|
||||
this.goodsActualPay = this.goodsAmount - this.goodsDiscount;
|
||||
}else {
|
||||
result = true;
|
||||
}
|
||||
@ -582,6 +769,7 @@
|
||||
getLJGoods(val).then( response => {
|
||||
response.data.num = 1
|
||||
this.goodsAmount += response.data.retailPrice
|
||||
this.goodsActualPay = this.goodsAmount - this.goodsDiscount;
|
||||
this.goodsOrder.push(response.data);
|
||||
this.goodsTotal += 1;
|
||||
})
|
||||
@ -595,6 +783,7 @@
|
||||
// 新增订单(重置)
|
||||
resetting(){
|
||||
this.oilOrder = [];
|
||||
this.oilActualPay = 0;
|
||||
this.oilTotal = 0;
|
||||
this.oilAmount = 0;
|
||||
},
|
||||
@ -610,8 +799,10 @@
|
||||
this.oilOrder.push(this.form)
|
||||
if (this.select == "元"){
|
||||
this.oilAmount = +this.form.amount + this.oilAmount;
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
}else {
|
||||
this.oilAmount = +(this.form.oilPrice * this.form.amount) + this.oilAmount;
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
}
|
||||
this.oilTotal += 1;
|
||||
},
|
||||
@ -644,10 +835,12 @@
|
||||
// 获取油号名称
|
||||
getName(oilNameList,id){
|
||||
let name = ""
|
||||
let _this = this;
|
||||
if(oilNameList!=null && oilNameList!=""){
|
||||
oilNameList.forEach(item => {
|
||||
if (item.id == id){
|
||||
name = item.oilName
|
||||
name = item.oilName;
|
||||
_this.oilType = item.oilType;
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -689,19 +882,46 @@
|
||||
// 确定收款
|
||||
collection(){
|
||||
// JSON.parse()
|
||||
this.map.oilAmount = this.oilAmount;
|
||||
this.map.goodsAmount = this.goodsAmount;
|
||||
this.map.oilActualPay = this.oilActualPay;
|
||||
this.map.goodsActualPay = this.goodsActualPay;
|
||||
this.map.oilDiscount = this.oilDiscount;
|
||||
this.map.goodsDiscount = this.goodsDiscount;
|
||||
this.map.goodsNum = this.goodsTotal;
|
||||
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;
|
||||
|
||||
let _this = this;
|
||||
let orderNo = "";
|
||||
addLJGoods(this.map).then( response => {
|
||||
console.log(response)
|
||||
orderNo = response.data
|
||||
})
|
||||
// let map = {
|
||||
// authCode : this.authCode,
|
||||
// orderNo : "0000055"
|
||||
// }
|
||||
// // console.log(map)
|
||||
// fyPay(map).then( response => {
|
||||
// // console.log(response)
|
||||
// })
|
||||
oilOrder(orderNo).then( response => {
|
||||
if (response.data.orderStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
}
|
||||
})
|
||||
goodsOrder(orderNo).then( response => {
|
||||
if (response.data.status == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
}})
|
||||
this.loading = true;
|
||||
this.isPay = false;
|
||||
setTimeout(function (){
|
||||
_this.loading = false;
|
||||
},1000);
|
||||
this.authCode = "";
|
||||
},
|
||||
handClose(){
|
||||
if(this.isPaySuccess = false){
|
||||
this.isPay = true;
|
||||
}
|
||||
this.dialogVisiblej = false
|
||||
this.isPay = true;
|
||||
this.isPaySuccess = false;
|
||||
},
|
||||
// 支付方式
|
||||
payMethod(payType){
|
||||
@ -728,6 +948,9 @@
|
||||
})
|
||||
.catch(_ => {});
|
||||
},
|
||||
handleOpen(key, keyPath) {
|
||||
// console.log(key, keyPath);
|
||||
},
|
||||
handleChange(value) {
|
||||
let goods = this.goodsOrder;
|
||||
let num = 0;
|
||||
@ -1123,4 +1346,9 @@
|
||||
padding: 10px 0;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
.elBut{
|
||||
width: 85px;
|
||||
height: 50px;
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user