diff --git a/fuintAdmin/src/views/convenienceStore/goodsFile.vue b/fuintAdmin/src/views/convenienceStore/goodsFile.vue index f04e21e64..f0a794bc1 100644 --- a/fuintAdmin/src/views/convenienceStore/goodsFile.vue +++ b/fuintAdmin/src/views/convenienceStore/goodsFile.vue @@ -328,7 +328,7 @@ import {cvsGoodsAll, cvsGoodsTree, selectTree} from "@/api/convenienceStore/goods"; -import {addSupplier, listSupplier} from "@/api/convenienceStore/supplier"; +import {addSupplier, getSupplier, listSupplier} from "@/api/convenienceStore/supplier"; import { addLJGoods, createGoodsNo, @@ -453,6 +453,7 @@ export default { results = []; let falg = false; _this.supplierList.forEach(item => { + console.log(item) if(item.name.includes(queryString)){ results.push(item) falg = true @@ -468,7 +469,7 @@ export default { selectSupplier(data){ this.supplier = data.name; this.form.supplierId = data.id - console.log(data,this.form) + // console.log(data,this.form) }, addSupplier(val){ // console.log(val,222) @@ -666,6 +667,11 @@ export default { } } }) + this.supplierList.forEach(item => { + if (item.id == response.data.supplierId){ + this.supplier = item.name + } + }) // this.cvsGoodId = response.data.cvsGoodId this.open = true; this.isAdd = true; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index 73b6eb7f4..7def83026 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -645,7 +645,10 @@ public class OilOrderServiceImpl extends ServiceImpl i }else { allOrderInfo.setContent("收银台订单"); } - allOrderInfoService.insertAllOrderInfo(allOrderInfo); + AllOrderInfo allOrderInfo1 = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo); + if (ObjectUtil.isEmpty(allOrderInfo1)){ + allOrderInfoService.insertAllOrderInfo(allOrderInfo); + } } /** @@ -738,6 +741,12 @@ public class OilOrderServiceImpl extends ServiceImpl i String balanceAmount = map.get("balanceAmount"); Integer tankId = Integer.valueOf(map.get("tankId")); + Map applet = new HashMap<>(); + applet.put("success",""); + applet.put("error",""); + + OilTank oilTank = oilTankService.queryById(tankId); + Double storedQuantity = oilTank.getStoredQuantity(); // 是否使用子卡消费 String isUseChildCard = map.get("isUseChildCard"); @@ -749,12 +758,20 @@ public class OilOrderServiceImpl extends ServiceImpl i boolean result = false; Integer userId = oilOrder.getUserId(); + if (ObjectUtil.isEmpty(storedQuantity) || storedQuantity - oilOrder.getOilNum() <=0){ +// throw new RuntimeException("油罐容量不足!"); + applet.put("error","油罐容量不足!"); + this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(), oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail"); + result = true; + } if (isUseChildCard.equals("true")){ Map map1 = userService.queryUserByStoreId(oilOrder.getStoreId(), oilOrder.getUserId()); String isUseChild = map1.get("isUseChild").toString(); LJUserVo userVo = (LJUserVo) map1.get("userVo"); userId = userVo.getId(); if (!isUseChild.equals("yes")){ + applet.put("error","不可使用子卡消费!"); + this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(), oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail"); result = true; } } @@ -764,12 +781,16 @@ public class OilOrderServiceImpl extends ServiceImpl i // 校验囤油卡升数 if (balanceAmount.equals("0") && map.get("payAmount").equals("0")) { if (Double.compare(oilCardLiters,oilOrder.getOilNum())!=0){ + applet.put("error","囤油卡消费升数不对!"); + this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(), oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail"); result = true; } }else { Double useLiters = oilOrder.getOilNum() - oilCardLiters; Double residueAmount = useLiters * oilNumber.getOilPrice(); if ((Double.valueOf(map.get("payAmount"))+Double.valueOf(balanceAmount)-residueAmount)>=0.05){ + applet.put("error","消费总金额不对!"); + this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(), oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail"); result = true; } } @@ -778,19 +799,18 @@ public class OilOrderServiceImpl extends ServiceImpl i // 校验支付金额和优惠金额数据是否相同 Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) + Double.valueOf(map.get("discountAmount")); if (Double.compare(realAmount,oilOrder.getOrderAmount())!=0){ + applet.put("error","消费总金额不对!"); + this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(), oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail"); result = true; } } if (result){ - return null; + return applet; } oilOrder.setTankId(tankId); - Map applet = new HashMap<>(); - applet.put("success",""); - // 判断是否使用储值卡消费 if (!balanceAmount.equals("0")){ this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId()); @@ -950,6 +970,11 @@ public class OilOrderServiceImpl extends ServiceImpl i @Override public void addOilTracks(OilOrder oilOrder,Integer storeId){ OilTank oilTank = oilTankService.queryById(oilOrder.getTankId()); +// 修改油罐容量 + Double storedQuantity = oilTank.getStoredQuantity(); + if (ObjectUtil.isEmpty(storedQuantity) || storedQuantity - oilOrder.getOilNum() <=0){ + throw new RuntimeException("油罐容量不足!"); + } // 添加库存跟踪信息 OilTracking oilTracking = new OilTracking(); oilTracking.setDocument("油品出售"); @@ -963,11 +988,6 @@ public class OilOrderServiceImpl extends ServiceImpl i oilTracking.setTankId(oilOrder.getTankId()); oilTrackingService.insert(oilTracking); -// 修改油罐容量 - Double storedQuantity = oilTank.getStoredQuantity(); - if (ObjectUtil.isEmpty(storedQuantity) || storedQuantity - oilOrder.getOilNum() <=0){ - throw new RuntimeException("油罐容量不足!"); - } oilTank.setStoredQuantity(storedQuantity-oilOrder.getOilNum()); oilTankService.update(oilTank); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java index 44b21eb7a..397691d40 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/storeInformation/service/impl/LJStoreServiceImpl.java @@ -62,42 +62,63 @@ public class LJStoreServiceImpl extends ServiceImpl impl // 经度 Double lon = Double.valueOf(map.get("lon")); Double lat = Double.valueOf(map.get("lat")); - List list = baseMapper.selectList(null); + Integer storeId = Integer.valueOf(map.get("storeId")); LJStore ljStore = new LJStore(); Double distance = 0.0; double earthRadius = 6371; // 地球半径,单位为公里 + if (storeId==null){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("if_delete","0"); + queryWrapper.eq("status","qy"); + List list = baseMapper.selectList(queryWrapper); - double dLat = Math.toRadians(Double.parseDouble(list.get(0).getLatitude()) - lat); - double dLon = Math.toRadians(Double.parseDouble(list.get(0).getLongitude()) - lon); + double dLat = Math.toRadians(Double.parseDouble(list.get(0).getLatitude()) - lat); + double dLon = Math.toRadians(Double.parseDouble(list.get(0).getLongitude()) - lon); - double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + - Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(0).getLatitude()))) * - Math.sin(dLon / 2) * Math.sin(dLon / 2); + double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + + Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(0).getLatitude()))) * + Math.sin(dLon / 2) * Math.sin(dLon / 2); - double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); + double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); - double min = earthRadius * c; - ljStore = list.get(0); + double min = earthRadius * c; + ljStore = list.get(0); // 计算最小距离 - for (int i = 0; i < list.size(); i++){ - if (StringUtils.isNotEmpty(list.get(i).getLatitude()) && StringUtils.isNotEmpty(list.get(i).getLongitude())){ - double dLat1 = Math.toRadians(Double.parseDouble(list.get(i).getLatitude()) - lat); - double dLon1 = Math.toRadians(Double.parseDouble(list.get(i).getLongitude()) - lon); + for (int i = 0; i < list.size(); i++){ + if (StringUtils.isNotEmpty(list.get(i).getLatitude()) && StringUtils.isNotEmpty(list.get(i).getLongitude())){ + double dLat1 = Math.toRadians(Double.parseDouble(list.get(i).getLatitude()) - lat); + double dLon1 = Math.toRadians(Double.parseDouble(list.get(i).getLongitude()) - lon); - double a1 = Math.sin(dLat1 / 2) * Math.sin(dLat1 / 2) + - Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(i).getLatitude()))) * - Math.sin(dLon1 / 2) * Math.sin(dLon1 / 2); + double a1 = Math.sin(dLat1 / 2) * Math.sin(dLat1 / 2) + + Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(list.get(i).getLatitude()))) * + Math.sin(dLon1 / 2) * Math.sin(dLon1 / 2); - double c1 = 2 * Math.atan2(Math.sqrt(a1), Math.sqrt(1 - a1)); + double c1 = 2 * Math.atan2(Math.sqrt(a1), Math.sqrt(1 - a1)); - if ((earthRadius * c1) < min){ - min = earthRadius * c1; - ljStore = list.get(i); + if ((earthRadius * c1) < min){ + min = earthRadius * c1; + ljStore = list.get(i); + } } } + distance = min; + }else { + LJStore store = this.selectStoreByStoreId(storeId); + double dLat = Math.toRadians(Double.parseDouble(store.getLatitude()) - lat); + double dLon = Math.toRadians(Double.parseDouble(store.getLongitude()) - lon); + + double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + + Math.cos(Math.toRadians(lat)) * Math.cos(Math.toRadians(Double.parseDouble(store.getLatitude()))) * + Math.sin(dLon / 2) * Math.sin(dLon / 2); + + double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); + + double min = earthRadius * c; + distance = min; + ljStore = store; } - distance = min; + Map map1 = new HashMap<>(); map1.put("distance",distance); diff --git a/fuintCashierWeb/src/utils/request.js b/fuintCashierWeb/src/utils/request.js index 178388b01..e2297c9d0 100644 --- a/fuintCashierWeb/src/utils/request.js +++ b/fuintCashierWeb/src/utils/request.js @@ -49,7 +49,7 @@ service.interceptors.request.use(config => { const s_url = sessionObj.url; // 请求地址 const s_data = sessionObj.data; // 请求数据 const s_time = sessionObj.time; // 请求时间 - const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交 + const interval = 2000; // 间隔时间(ms),小于此时间视为重复提交 if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { const message = '数据正在处理,请耐心等待'; console.warn(`[${s_url}]: ` + message) diff --git a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue index c6b6136ee..61de8b0cc 100644 --- a/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue +++ b/fuintCashierWeb/src/views/cashier/NewComponents/homeindex.vue @@ -2318,8 +2318,8 @@ } this.authCode = "" this.seekZero = 0; - this.isPay = false this.dialogVisiblej = true + this.isPay = false this.getStaff() }, // 重置油品订单 @@ -2598,13 +2598,20 @@ if (resp.data.success=='success'){ this.loading = true; setTimeout(function (){ - _this.isPaySuccess = true; _this.loading = false; + _this.isPaySuccess = true; _this.isPay = true; _this.resetting1(); },3000) }else { - this.$modal.msgError(resp.data.error) + this.loading = true; + setTimeout(function (){ + _this.loading = false; + _this.isPaySuccess = false; + _this.isPay = true; + _this.resetting1(); + this.$modal.msgError(resp.data.error) + },3000) } }) return; @@ -2615,15 +2622,19 @@ if (response.data.oilOrder!=null){ if (response.data.oilOrder.orderStatus == "paid"){ _this.isPaySuccess = true; + _this.isPay = true; _this.seekZero = 0 _this.amount = 0 + return; } } if (response.data.goodsOrder!=null){ if (response.data.goodsOrder.status == "paid"){ _this.isPaySuccess = true; + _this.isPay = true; _this.seekZero = 0 _this.amount = 0 + return; } } if (response.data.error==1){ @@ -2657,6 +2668,7 @@ let _this = this; this.authCode = ""; if (_this.isPaySuccess == true){ + _this.isPay = false; _this.oilAmount = 0; _this.oilActualPay = 0; _this.oilDiscount = 0; @@ -2742,11 +2754,13 @@ } if (response.data.status == "paid"){ _this.isPaySuccess = true; + _this.isPay = true; _this.isQuery = false; _this.amount = 0 } if (response.data.status == "payFail"){ _this.isPaySuccess = false; + _this.isPay = true; _this.isQuery = false; } } diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/integralComponents/pointsCashier.vue b/fuintCashierWeb/src/views/cashier/orderComponents/integralComponents/pointsCashier.vue index 8ba7f77db..a6f5fb68f 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/integralComponents/pointsCashier.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/integralComponents/pointsCashier.vue @@ -96,13 +96,23 @@ - + - + + + + + + - - + - + @@ -299,7 +299,7 @@ export default { getGoods(id){ this.open = true; this.title = "商品详情" - getOrderGoods(id).then( response => { + getOrderGoods({orderId:id}).then( response => { this.goodsList = response.data }) }, diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue b/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue index 5aad5696d..cf6e1a885 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue @@ -96,7 +96,7 @@ + width="100"> @@ -104,7 +104,7 @@ + width="220"> { _this.distance = (Math.ceil(response.data.distance)) diff --git a/gasStation-uni/pages/my/my.vue b/gasStation-uni/pages/my/my.vue index d2f8073c9..b8bf8960d 100644 --- a/gasStation-uni/pages/my/my.vue +++ b/gasStation-uni/pages/my/my.vue @@ -30,7 +30,7 @@ | 囤油升数 - {{refuelMoney[0].incomeLitres || 0 }}L + {{refuelMoney[0].refuelMoney || 0 }}L | diff --git a/gasStation-uni/pages/refuel/refuel.vue b/gasStation-uni/pages/refuel/refuel.vue index 32241bd2e..5154ee99e 100644 --- a/gasStation-uni/pages/refuel/refuel.vue +++ b/gasStation-uni/pages/refuel/refuel.vue @@ -312,6 +312,7 @@ method: 'get', }).then((res)=>{ _this.oilGunList = res.data + _this.oilOrder.oilGunNum = res.data[0].id }) }, // 获取当前店铺员工信息列表 @@ -365,7 +366,7 @@ // 选择油枪信息 getQIndex(index,data) { this.qindex = index - this.oilOrder.oilGunNum = data.gunName + this.oilOrder.oilGunNum = data.id }, goRefuel() { uni.navigateTo({ diff --git a/gasStation-uni/pagesRefuel/orderDetail/index.vue b/gasStation-uni/pagesRefuel/orderDetail/index.vue index 8c40b8223..d484ed2dd 100644 --- a/gasStation-uni/pagesRefuel/orderDetail/index.vue +++ b/gasStation-uni/pagesRefuel/orderDetail/index.vue @@ -202,7 +202,7 @@ }, onLoad(e) { this.orderNo = e.orderNo - // this.orderNo = "234520240111104725ec1fbe" + // this.orderNo = "234520240113160238a6efad" }, onShow() { this.getOilOrder(); @@ -239,6 +239,20 @@ }else{ payProvider = "alipay" } + if(res.data.error){ + request({ + url: "/business/allOrderInfo/orderStatus", + method: 'post', + data: {"orderNo":_this.orderNo,"status":"payFail"}, + }).then((ress)=>{ + console.log(ress); + }) + uni.showToast({ + title:res.data.error, + icon:"none" + }) + return; + } if(res.data.success == "ok"){ uni.reLaunch({ url: '/pagesRefuel/orderSuccess/index'