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 {cvsGoodsAll, cvsGoodsTree, selectTree} from "@/api/convenienceStore/goods";
import {addSupplier, listSupplier} from "@/api/convenienceStore/supplier"; import {addSupplier, getSupplier, listSupplier} from "@/api/convenienceStore/supplier";
import { import {
addLJGoods, addLJGoods,
createGoodsNo, createGoodsNo,
@ -453,6 +453,7 @@ export default {
results = []; results = [];
let falg = false; let falg = false;
_this.supplierList.forEach(item => { _this.supplierList.forEach(item => {
console.log(item)
if(item.name.includes(queryString)){ if(item.name.includes(queryString)){
results.push(item) results.push(item)
falg = true falg = true
@ -468,7 +469,7 @@ export default {
selectSupplier(data){ selectSupplier(data){
this.supplier = data.name; this.supplier = data.name;
this.form.supplierId = data.id this.form.supplierId = data.id
console.log(data,this.form) // console.log(data,this.form)
}, },
addSupplier(val){ addSupplier(val){
// console.log(val,222) // 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.cvsGoodId = response.data.cvsGoodId
this.open = true; this.open = true;
this.isAdd = true; this.isAdd = true;

View File

@ -645,8 +645,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}else { }else {
allOrderInfo.setContent("收银台订单"); allOrderInfo.setContent("收银台订单");
} }
AllOrderInfo allOrderInfo1 = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo);
if (ObjectUtil.isEmpty(allOrderInfo1)){
allOrderInfoService.insertAllOrderInfo(allOrderInfo); allOrderInfoService.insertAllOrderInfo(allOrderInfo);
} }
}
/** /**
* 修改用户成长储值卡信息 * 修改用户成长储值卡信息
@ -738,6 +741,12 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
String balanceAmount = map.get("balanceAmount"); String balanceAmount = map.get("balanceAmount");
Integer tankId = Integer.valueOf(map.get("tankId")); 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"); String isUseChildCard = map.get("isUseChildCard");
@ -749,12 +758,20 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
boolean result = false; boolean result = false;
Integer userId = oilOrder.getUserId(); 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")){ if (isUseChildCard.equals("true")){
Map<String, Object> map1 = userService.queryUserByStoreId(oilOrder.getStoreId(), oilOrder.getUserId()); Map<String, Object> map1 = userService.queryUserByStoreId(oilOrder.getStoreId(), oilOrder.getUserId());
String isUseChild = map1.get("isUseChild").toString(); String isUseChild = map1.get("isUseChild").toString();
LJUserVo userVo = (LJUserVo) map1.get("userVo"); LJUserVo userVo = (LJUserVo) map1.get("userVo");
userId = userVo.getId(); userId = userVo.getId();
if (!isUseChild.equals("yes")){ if (!isUseChild.equals("yes")){
applet.put("error","不可使用子卡消费!");
this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(), oilOrder.getPayType(), userId,oilOrder.getPayType(),"1","payFail");
result = true; result = true;
} }
} }
@ -764,12 +781,16 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
// 校验囤油卡升数 // 校验囤油卡升数
if (balanceAmount.equals("0") && map.get("payAmount").equals("0")) { if (balanceAmount.equals("0") && map.get("payAmount").equals("0")) {
if (Double.compare(oilCardLiters,oilOrder.getOilNum())!=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; result = true;
} }
}else { }else {
Double useLiters = oilOrder.getOilNum() - oilCardLiters; Double useLiters = oilOrder.getOilNum() - oilCardLiters;
Double residueAmount = useLiters * oilNumber.getOilPrice(); Double residueAmount = useLiters * oilNumber.getOilPrice();
if ((Double.valueOf(map.get("payAmount"))+Double.valueOf(balanceAmount)-residueAmount)>=0.05){ 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; 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")); Double realAmount = Double.valueOf(map.get("payAmount")) + Double.valueOf(balanceAmount) + Double.valueOf(map.get("discountAmount"));
if (Double.compare(realAmount,oilOrder.getOrderAmount())!=0){ 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; result = true;
} }
} }
if (result){ if (result){
return null; return applet;
} }
oilOrder.setTankId(tankId); oilOrder.setTankId(tankId);
Map<String, Object> applet = new HashMap<>();
applet.put("success","");
// 判断是否使用储值卡消费 // 判断是否使用储值卡消费
if (!balanceAmount.equals("0")){ if (!balanceAmount.equals("0")){
this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId()); this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId());
@ -950,6 +970,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
@Override @Override
public void addOilTracks(OilOrder oilOrder,Integer storeId){ public void addOilTracks(OilOrder oilOrder,Integer storeId){
OilTank oilTank = oilTankService.queryById(oilOrder.getTankId()); 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 oilTracking = new OilTracking();
oilTracking.setDocument("油品出售"); oilTracking.setDocument("油品出售");
@ -963,11 +988,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
oilTracking.setTankId(oilOrder.getTankId()); oilTracking.setTankId(oilOrder.getTankId());
oilTrackingService.insert(oilTracking); oilTrackingService.insert(oilTracking);
// 修改油罐容量
Double storedQuantity = oilTank.getStoredQuantity();
if (ObjectUtil.isEmpty(storedQuantity) || storedQuantity - oilOrder.getOilNum() <=0){
throw new RuntimeException("油罐容量不足!");
}
oilTank.setStoredQuantity(storedQuantity-oilOrder.getOilNum()); oilTank.setStoredQuantity(storedQuantity-oilOrder.getOilNum());
oilTankService.update(oilTank); oilTankService.update(oilTank);
} }

View File

@ -62,10 +62,15 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
// 经度 // 经度
Double lon = Double.valueOf(map.get("lon")); Double lon = Double.valueOf(map.get("lon"));
Double lat = Double.valueOf(map.get("lat")); Double lat = Double.valueOf(map.get("lat"));
List<LJStore> list = baseMapper.selectList(null); Integer storeId = Integer.valueOf(map.get("storeId"));
LJStore ljStore = new LJStore(); LJStore ljStore = new LJStore();
Double distance = 0.0; Double distance = 0.0;
double earthRadius = 6371; // 地球半径单位为公里 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 dLat = Math.toRadians(Double.parseDouble(list.get(0).getLatitude()) - lat);
double dLon = Math.toRadians(Double.parseDouble(list.get(0).getLongitude()) - lon); double dLon = Math.toRadians(Double.parseDouble(list.get(0).getLongitude()) - lon);
@ -98,6 +103,22 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
} }
} }
distance = min; 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;
}
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
map1.put("distance",distance); map1.put("distance",distance);

View File

@ -49,7 +49,7 @@ service.interceptors.request.use(config => {
const s_url = sessionObj.url; // 请求地址 const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据 const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间 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) { if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请耐心等待'; const message = '数据正在处理,请耐心等待';
console.warn(`[${s_url}]: ` + message) console.warn(`[${s_url}]: ` + message)

View File

@ -2318,8 +2318,8 @@
} }
this.authCode = "" this.authCode = ""
this.seekZero = 0; this.seekZero = 0;
this.isPay = false
this.dialogVisiblej = true this.dialogVisiblej = true
this.isPay = false
this.getStaff() this.getStaff()
}, },
// //
@ -2598,13 +2598,20 @@
if (resp.data.success=='success'){ if (resp.data.success=='success'){
this.loading = true; this.loading = true;
setTimeout(function (){ setTimeout(function (){
_this.isPaySuccess = true;
_this.loading = false; _this.loading = false;
_this.isPaySuccess = true;
_this.isPay = true; _this.isPay = true;
_this.resetting1(); _this.resetting1();
},3000) },3000)
}else { }else {
this.loading = true;
setTimeout(function (){
_this.loading = false;
_this.isPaySuccess = false;
_this.isPay = true;
_this.resetting1();
this.$modal.msgError(resp.data.error) this.$modal.msgError(resp.data.error)
},3000)
} }
}) })
return; return;
@ -2615,15 +2622,19 @@
if (response.data.oilOrder!=null){ if (response.data.oilOrder!=null){
if (response.data.oilOrder.orderStatus == "paid"){ if (response.data.oilOrder.orderStatus == "paid"){
_this.isPaySuccess = true; _this.isPaySuccess = true;
_this.isPay = true;
_this.seekZero = 0 _this.seekZero = 0
_this.amount = 0 _this.amount = 0
return;
} }
} }
if (response.data.goodsOrder!=null){ if (response.data.goodsOrder!=null){
if (response.data.goodsOrder.status == "paid"){ if (response.data.goodsOrder.status == "paid"){
_this.isPaySuccess = true; _this.isPaySuccess = true;
_this.isPay = true;
_this.seekZero = 0 _this.seekZero = 0
_this.amount = 0 _this.amount = 0
return;
} }
} }
if (response.data.error==1){ if (response.data.error==1){
@ -2657,6 +2668,7 @@
let _this = this; let _this = this;
this.authCode = ""; this.authCode = "";
if (_this.isPaySuccess == true){ if (_this.isPaySuccess == true){
_this.isPay = false;
_this.oilAmount = 0; _this.oilAmount = 0;
_this.oilActualPay = 0; _this.oilActualPay = 0;
_this.oilDiscount = 0; _this.oilDiscount = 0;
@ -2742,11 +2754,13 @@
} }
if (response.data.status == "paid"){ if (response.data.status == "paid"){
_this.isPaySuccess = true; _this.isPaySuccess = true;
_this.isPay = true;
_this.isQuery = false; _this.isQuery = false;
_this.amount = 0 _this.amount = 0
} }
if (response.data.status == "payFail"){ if (response.data.status == "payFail"){
_this.isPaySuccess = false; _this.isPaySuccess = false;
_this.isPay = true;
_this.isQuery = false; _this.isQuery = false;
} }
} }

View File

@ -96,13 +96,23 @@
<el-table-column label="订单号" align="center" prop="orderNumber"/> <el-table-column label="订单号" align="center" prop="orderNumber"/>
<el-table-column label="商品信息" align="center" prop="" > <el-table-column label="商品信息" align="center" prop="" >
<el-table-column label="简述" align="center" prop="categoryName" /> <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>
<el-table-column label="实付信息" align="center" > <el-table-column label="实付信息" align="center" >
<el-table-column label="积分" align="center" prop="integral" width=""/> <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>
<el-table-column label="状态" align="center" prop="status" width=""/>
<el-table-column label="创建时间" align="center" prop="createTime" width=""/> <el-table-column label="创建时间" align="center" prop="createTime" width=""/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">

View File

@ -124,9 +124,9 @@
</el-form> </el-form>
</template> </template>
</el-table-column> </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="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="amount"/>
<el-table-column label="优惠金额" align="center" prop="discount"/> <el-table-column label="优惠金额" align="center" prop="discount"/>
<el-table-column label="商品数量" align="center" prop="goodsNum"> <el-table-column label="商品数量" align="center" prop="goodsNum">
@ -299,7 +299,7 @@ export default {
getGoods(id){ getGoods(id){
this.open = true; this.open = true;
this.title = "商品详情" this.title = "商品详情"
getOrderGoods(id).then( response => { getOrderGoods({orderId:id}).then( response => {
this.goodsList = response.data this.goodsList = response.data
}) })
}, },

View File

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

View File

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

View File

@ -30,7 +30,7 @@
<text style="color: #999999;">|</text> <text style="color: #999999;">|</text>
<view class="jg-box" @click="goOil()"> <view class="jg-box" @click="goOil()">
<view class="jg-box-title">囤油升数</view> <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> </view>
<text style="color: #999999;">|</text> <text style="color: #999999;">|</text>

View File

@ -312,6 +312,7 @@
method: 'get', method: 'get',
}).then((res)=>{ }).then((res)=>{
_this.oilGunList = res.data _this.oilGunList = res.data
_this.oilOrder.oilGunNum = res.data[0].id
}) })
}, },
// //
@ -365,7 +366,7 @@
// //
getQIndex(index,data) { getQIndex(index,data) {
this.qindex = index this.qindex = index
this.oilOrder.oilGunNum = data.gunName this.oilOrder.oilGunNum = data.id
}, },
goRefuel() { goRefuel() {
uni.navigateTo({ uni.navigateTo({

View File

@ -202,7 +202,7 @@
}, },
onLoad(e) { onLoad(e) {
this.orderNo = e.orderNo this.orderNo = e.orderNo
// this.orderNo = "234520240111104725ec1fbe" // this.orderNo = "234520240113160238a6efad"
}, },
onShow() { onShow() {
this.getOilOrder(); this.getOilOrder();
@ -239,6 +239,20 @@
}else{ }else{
payProvider = "alipay" 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"){ if(res.data.success == "ok"){
uni.reLaunch({ uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index' url: '/pagesRefuel/orderSuccess/index'