This commit is contained in:
cun-nan 2024-01-13 18:01:23 +08:00
parent 8889a06565
commit ea8bab751a
12 changed files with 142 additions and 55 deletions

View File

@ -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;

View File

@ -645,7 +645,10 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> i
String balanceAmount = map.get("balanceAmount");
Integer tankId = Integer.valueOf(map.get("tankId"));
Map<String, Object> 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<OilOrderMapper, OilOrder> 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<String, Object> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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<String, Object> 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<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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);
}

View File

@ -62,42 +62,63 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
// 经度
Double lon = Double.valueOf(map.get("lon"));
Double lat = Double.valueOf(map.get("lat"));
List<LJStore> 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<LJStore> 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<String,Object> map1 = new HashMap<>();
map1.put("distance",distance);

View File

@ -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)

View File

@ -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;
}
}

View File

@ -96,13 +96,23 @@
<el-table-column label="订单号" align="center" prop="orderNumber"/>
<el-table-column label="商品信息" align="center" prop="" >
<el-table-column label="简述" align="center" prop="categoryName" />
<el-table-column label="商品" align="center" prop="giftName" />
<el-table-column label="商品名称" align="center" prop="giftName" />
</el-table-column>
<el-table-column label="实付信息" align="center" >
<el-table-column label="积分" align="center" prop="integral" width=""/>
<el-table-column label="支付金额" align="center" prop="amount" width=""/>
<el-table-column label="支付金额" align="center" prop="amount" width="">
<template slot-scope="scope">
{{ scope.row.amount?scope.row.amount:"--" }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="支付状态" align="center" prop="status" width="">
<template slot-scope="scope">
<el-tag effect="plain" v-if="scope.row.status =='unpaid'"> 待支付</el-tag>
<el-tag type="success" effect="plain" v-else-if="scope.row.status =='paid'">支付成功</el-tag>
<el-tag type="warning" effect="plain" v-else>支付失败</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width=""/>
<el-table-column label="创建时间" align="center" prop="createTime" width=""/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">

View File

@ -124,9 +124,9 @@
</el-form>
</template>
</el-table-column>
<el-table-column label="订单ID" prop="id" width="80"/>
<!-- <el-table-column label="订单ID" prop="id" width="80"/>-->
<el-table-column label="终端" align="center" prop="terminal"/>
<el-table-column label="订单号" align="center" prop="orderNo" width="200"/>
<el-table-column label="订单号" align="center" prop="orderNo" width="220"/>
<el-table-column label="订单金额" align="center" prop="amount"/>
<el-table-column label="优惠金额" align="center" prop="discount"/>
<el-table-column label="商品数量" align="center" prop="goodsNum">
@ -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
})
},

View File

@ -96,7 +96,7 @@
<el-table-column
prop="terminal"
label="终端"
width="180">
width="100">
<template slot-scope="scope">
<span>{{getType(terminalList,scope.row.terminal)}}</span>
</template>
@ -104,7 +104,7 @@
<el-table-column
prop="orderNo"
label="订单号"
width="180">
width="220">
</el-table-column>
<el-table-column
prop="amount"

View File

@ -227,7 +227,6 @@
uni.setStorageSync("storeId", storeId)
}
// this.isExistStoreId()
}
this.getUserAuthority();
this.getOilType();
@ -235,7 +234,6 @@
onShow() {
this.isJoined()
this.getIndexBanner()
// this.isExistStoreId();
},
components: {
tabbar
@ -315,7 +313,7 @@
if (uni.getStorageSync("storeId")) {
this.getStore(uni.getStorageSync("storeId"));
} else {
this.getAddress();
this.getAddress(uni.getStorageSync("storeId"));
}
},
//
@ -331,7 +329,8 @@
scope: 'scope.userLocation',
success() {
//
_this.isExistStoreId()
// _this.isExistStoreId()
_this.getAddress(uni.getStorageSync("storeId"));
},
fail() {
//
@ -339,7 +338,8 @@
})
} else {
//
_this.isExistStoreId()
// _this.isExistStoreId()
_this.getAddress(uni.getStorageSync("storeId"));
}
},
fail(err) {
@ -382,7 +382,7 @@
})
},
//
getAddress() {
getAddress(storeId) {
let _this = this;
uni.getLocation({
// 使wgs84 使gcj02
@ -397,7 +397,8 @@
method: 'post',
data: {
"lon": res.longitude,
"lat": res.latitude
"lat": res.latitude,
"storeId":storeId
},
}).then((response) => {
_this.distance = (Math.ceil(response.data.distance))

View File

@ -30,7 +30,7 @@
<text style="color: #999999;">|</text>
<view class="jg-box" @click="goOil()">
<view class="jg-box-title">囤油升数</view>
<view class="jg-box-nmb">{{refuelMoney[0].incomeLitres || 0 }}L</view>
<view class="jg-box-nmb">{{refuelMoney[0].refuelMoney || 0 }}L</view>
</view>
<text style="color: #999999;">|</text>

View File

@ -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({

View File

@ -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'