Merge branch 'master' of https://gitee.com/nny_1/oilSystem
This commit is contained in:
commit
b00edb2f12
@ -94,11 +94,12 @@
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd"
|
||||
>新增商品</el-button>
|
||||
<el-table ref="tables" v-loading="loading" :data="list"
|
||||
<el-table ref="tables" v-loading="loading" :data="list">
|
||||
<!--
|
||||
@selection-change="handleSelectionChange" :default-sort="defaultSort"
|
||||
@sort-change="handleSortChange">
|
||||
@sort-change="handleSortChange"-->
|
||||
<el-table-column label="ID" prop="id" align="center" width="60"/>
|
||||
<el-table-column label="分类名称" prop="cvsGoodId" align="center">
|
||||
<el-table-column label="分类名称" prop="cvsGoodId" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getName(cvsGoodList, scope.row.cvsGoodId) }}</span>
|
||||
</template>
|
||||
@ -111,12 +112,12 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="条码" prop="goodsNo" align="center" width="160"/>
|
||||
<el-table-column label="拼音码" prop="pinyinCode" align="center" width="120"/>
|
||||
<el-table-column label="货架号" prop="shelfNumber" align="center"/>
|
||||
<el-table-column label="库存" prop="stock" align="center"/>
|
||||
<el-table-column label="单位" prop="unit" align="center"/>
|
||||
<el-table-column label="进货价" prop="buyingPrice" align="center"/>
|
||||
<el-table-column label="零售价" prop="retailPrice" align="center"/>
|
||||
<el-table-column label="会员价" prop="memberPrice" align="center"/>
|
||||
<el-table-column label="货架号" prop="shelfNumber" align="center" width="60"/>
|
||||
<el-table-column label="库存" prop="stock" align="center" width="100"/>
|
||||
<el-table-column label="单位" prop="unit" align="center" width="60"/>
|
||||
<el-table-column label="进货价" prop="buyingPrice" align="center" width="70"/>
|
||||
<el-table-column label="零售价" prop="retailPrice" align="center" width="70"/>
|
||||
<el-table-column label="会员价" prop="memberPrice" align="center" width="70"/>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status=='qy'">启用</el-tag>
|
||||
@ -181,6 +182,7 @@
|
||||
<el-input v-model="form.goodsNo"
|
||||
@keydown.enter.native="getGoods(form)"
|
||||
v-focus
|
||||
clearable
|
||||
placeholder="商品的条码信息">
|
||||
<el-button slot="append" @click="getGoods(form)">查询</el-button>
|
||||
</el-input>
|
||||
@ -282,7 +284,7 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input-number v-model="form.sort" @change="handleChange" :min="0" label="0"></el-input-number>
|
||||
<el-input-number v-model="form.sort" :min="0" label="0"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@ -505,7 +507,7 @@ export default {
|
||||
},
|
||||
// 排序计步器
|
||||
handleChange(value) {
|
||||
console.log(value);
|
||||
console.log(value,this.form.sort);
|
||||
},
|
||||
// 获取分类名称
|
||||
getType(){
|
||||
@ -611,7 +613,10 @@ export default {
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
// console.log(this.form.supplierId)
|
||||
if (this.form.stock==0){
|
||||
this.$modal.msgError("库存不可为0");
|
||||
return;
|
||||
}
|
||||
if (this.form.id) {
|
||||
updateLJGoods(this.form).then(response => {
|
||||
this.$modal.msgSuccess("商品信息更新成功");
|
||||
|
@ -114,37 +114,38 @@
|
||||
<!-- </el-table>-->
|
||||
|
||||
</el-card>
|
||||
<!-- 添加类别对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" class="roll-dialog"
|
||||
:close-on-click-modal="false" append-to-body width="500px">
|
||||
<el-form :model="form" :inline="true" :rules="rules" ref="form" >
|
||||
<el-form-item label="上级分类" >
|
||||
<el-select v-model="form.pid" placeholder="请选择上级分类">
|
||||
<el-option label="无上级" :value="0">无上级</el-option>
|
||||
<el-option
|
||||
v-for="item in goodsOptions"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="name" style="margin-left: -8px;">
|
||||
<el-input v-model="form.name" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序规则">
|
||||
<el-input-number v-model="form.sorted" @change="handleChange" :min="0" :max="10" style="width: 300px;"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item >
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加类别对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" class="roll-dialog"
|
||||
:close-on-click-modal="false" append-to-body width="500px">
|
||||
<el-form :model="form" :inline="true" :rules="rules" ref="form" >
|
||||
<el-form-item label="上级分类" >
|
||||
<el-select v-model="form.pid" placeholder="请选择上级分类">
|
||||
<el-option label="无上级" :value="0">无上级</el-option>
|
||||
<el-option
|
||||
v-for="item in goodsOptions"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="name" style="margin-left: -8px;">
|
||||
<el-input v-model="form.name" style="width: 300px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序规则">
|
||||
<el-input-number v-model="form.sorted" @change="handleChange" :min="0" :max="10" style="width: 300px;"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item >
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="dict in dict.type.zhzt" :label="dict.value">{{ dict.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 修改类别对话框 -->
|
||||
<!-- <el-dialog title="修改分类" :visible.sync="editDialogFormVisible" width="500px">-->
|
||||
@ -346,8 +347,13 @@ export default {
|
||||
getList(){
|
||||
this.loading = true;
|
||||
selectTree(this.queryParams).then(response => {
|
||||
this.list = response.data.records;
|
||||
this.total = response.data.total;
|
||||
if (response.data!=null){
|
||||
this.list = response.data.records;
|
||||
this.total = response.data.total;
|
||||
}else {
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
@ -369,6 +375,7 @@ export default {
|
||||
this.$modal.msgSuccess("分类更新成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.getFirstMenu();
|
||||
});
|
||||
} else {
|
||||
insertCvsGoods(this.form).then(response => {
|
||||
@ -378,6 +385,7 @@ export default {
|
||||
this.$modal.msgSuccess("分类添加成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.getFirstMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -408,6 +416,7 @@ export default {
|
||||
}).then(() => {
|
||||
this.queryParams.page = 1
|
||||
this.getList();
|
||||
this.getFirstMenu();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
@ -422,7 +431,7 @@ export default {
|
||||
this.queryParams.isAsc = column.order;
|
||||
this.getList();
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -3,6 +3,8 @@ package com.fuint.api.fuyou.service.impl;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.fuint.api.fuyou.entity.Builder;
|
||||
import com.fuint.api.fuyou.entity.Const;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
@ -109,6 +111,8 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
private ReturnRecordService returnRecordService;
|
||||
@Autowired
|
||||
private CardFavorableRecordService cardFavorableRecordService;
|
||||
@Autowired
|
||||
private OrderGoodsService orderGoodsService;
|
||||
|
||||
@Override
|
||||
public Map<String, String> queryOrder(Map<String, String> map1) throws Exception {
|
||||
@ -154,6 +158,14 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
// 油品订单
|
||||
oilOrder.setOrderStatus("paid");
|
||||
oilOrder.setPayTime(date);
|
||||
// 修改油罐容量
|
||||
if (!oilOrder.equals("[]")) {
|
||||
// 将油品订单的json数据转换为数组
|
||||
List<JSONObject> jsonObjects = JSONArray.parseArray(map.get("oilOrder"), JSONObject.class);
|
||||
for (JSONObject jsonObject : jsonObjects) {
|
||||
oilOrderService.addOilTrack(jsonObject,oilOrder.getStoreId());
|
||||
}
|
||||
}
|
||||
// 修改优惠券使用状态
|
||||
CardFavorableRecord byId = cardFavorableRecordService.getById(oilOrder.getCouponId());
|
||||
if (!ObjectUtil.isEmpty(byId)){
|
||||
@ -165,6 +177,16 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
// 商品订单
|
||||
goodsOrder.setStatus("paid");
|
||||
goodsOrder.setPayTime(date);
|
||||
if (!map.get("goodsOrder").equals("[]")){
|
||||
List<JSONObject> goods = JSONArray.parseArray(map.get("goodsOrder"), JSONObject.class);
|
||||
OrderGoods orderGoods = new OrderGoods();
|
||||
for (JSONObject good : goods) {
|
||||
orderGoods.setOrderId(goodsOrder.getId());
|
||||
orderGoods.setGoodsId(Integer.valueOf(good.get("id").toString()));
|
||||
orderGoods.setNum(Integer.valueOf(good.get("num").toString()));
|
||||
orderGoodsService.insertOrderGoods(orderGoods);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(cashierOrder)){
|
||||
// 收银台订单
|
||||
|
@ -37,6 +37,7 @@
|
||||
or shelf_number like concat('%', #{goods.remark}, '%')
|
||||
)
|
||||
</if>
|
||||
order by sort
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -115,7 +115,10 @@ public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> im
|
||||
|
||||
//查询一级节点
|
||||
public List<CvsGoods> selectCvsGoodsList(CvsGoods goods){
|
||||
AccountInfo nowAccountInfo1 = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo1.getStoreId();
|
||||
LambdaQueryWrapper<CvsGoods> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CvsGoods::getStoreId,storeId);
|
||||
queryWrapper.eq(CvsGoods::getPid,"0").orderByAsc(CvsGoods::getSorted);
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
@ -169,6 +172,11 @@ public class CvsGoodsServiceImpl extends ServiceImpl<CvsGoodsMapper,CvsGoods> im
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIdVo(Integer id){
|
||||
// 根据pid查询是否存在二级菜单
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("pid",id);
|
||||
// 删除一级菜单对应的二级菜单
|
||||
baseMapper.delete(queryWrapper);
|
||||
baseMapper.deleteByIdVo(id);
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ public class StockTrackServiceImpl extends ServiceImpl<StockTrackMapper, StockTr
|
||||
QueryWrapper<StockTrack> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("store_id",storeId);
|
||||
queryWrapper.eq("stock_id",stockId);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
IPage<StockTrack> iPage = baseMapper.selectPage(page, queryWrapper);
|
||||
return iPage;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.order.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -56,6 +57,13 @@ public interface OilOrderService extends IService<OilOrder> {
|
||||
*/
|
||||
public Map<String,Object> insertOilOrder(Map<String ,String> map);
|
||||
|
||||
/**
|
||||
* 添加油品跟踪信息
|
||||
* @param oilOrder
|
||||
* @param storeId
|
||||
*/
|
||||
public void addOilTrack(JSONObject oilOrder, Integer storeId);
|
||||
|
||||
/**
|
||||
* 添加油品订单信息
|
||||
* @param order
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.fuint.business.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.convenienceSore.service.StockStatisticService;
|
||||
import com.fuint.business.convenienceSore.service.StockTrackService;
|
||||
import com.fuint.business.order.entity.OrderGoods;
|
||||
import com.fuint.business.order.vo.OrderGoodsVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -22,4 +25,10 @@ public interface OrderGoodsService extends IService<OrderGoods> {
|
||||
* @return
|
||||
*/
|
||||
public int insertOrderGoods(OrderGoods goods);
|
||||
|
||||
/**
|
||||
* 添加库存跟踪信息
|
||||
* @param goods
|
||||
*/
|
||||
public void insertStockTrack(OrderGoods goods);
|
||||
}
|
||||
|
@ -4,9 +4,14 @@ 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.business.convenienceSore.entity.StockStatistic;
|
||||
import com.fuint.business.convenienceSore.entity.StockTrack;
|
||||
import com.fuint.business.convenienceSore.service.StockStatisticService;
|
||||
import com.fuint.business.convenienceSore.service.StockTrackService;
|
||||
import com.fuint.business.order.entity.LJOrder;
|
||||
import com.fuint.business.order.mapper.LJOrderMapper;
|
||||
import com.fuint.business.order.service.LJOrderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
|
@ -11,12 +11,18 @@ import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.api.fuyou.service.OilConfigService;
|
||||
import com.fuint.business.convenienceSore.entity.LJGoods;
|
||||
import com.fuint.business.convenienceSore.service.LJGoodsService;
|
||||
import com.fuint.business.order.entity.*;
|
||||
import com.fuint.business.order.mapper.OilOrderMapper;
|
||||
import com.fuint.business.order.service.*;
|
||||
import com.fuint.business.order.vo.OilOrderVo;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilName;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTracking;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
import com.fuint.business.petrolStationManagement.service.OilTankService;
|
||||
import com.fuint.business.petrolStationManagement.service.OilTrackingService;
|
||||
import com.fuint.business.userManager.entity.LJUser;
|
||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
@ -52,6 +58,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
private CardBalanceChangeService cardBalanceChangeService;
|
||||
@Autowired
|
||||
private OilConfigService oilConfigService;
|
||||
@Autowired
|
||||
private LJGoodsService goodsService;
|
||||
|
||||
@Override
|
||||
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
|
||||
@ -147,7 +155,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
|
||||
// 支付状态
|
||||
String payStatus = "unpaid";
|
||||
if (payType.equals("CASH") && map.get("allAmount").equals("0")){
|
||||
if (payType.equals("CASH")){
|
||||
payStatus = "paid";
|
||||
}else {
|
||||
payStatus = "unpaid";
|
||||
@ -159,6 +167,61 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
String orderNo = timestamp+randomString;
|
||||
|
||||
|
||||
Map<String,Object> orders = new HashMap<>();
|
||||
|
||||
OilOrder oilOrder1 = null;
|
||||
LJOrder ljOrder1 = null;
|
||||
|
||||
// 添加商品订单信息
|
||||
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(payStatus);
|
||||
if (payType.equals("CASH")){
|
||||
ljOrder.setPayTime(new Date());
|
||||
}
|
||||
// 将商品订单的json数据转换为数组
|
||||
List<JSONObject> goods = JSONArray.parseArray(goodsOrder, JSONObject.class);
|
||||
|
||||
for (JSONObject good : goods) {
|
||||
// 查询商品库存信息 看是否能购买
|
||||
LJGoods ljGoods = goodsService.selectLJGoodsById(Integer.parseInt(good.get("id").toString()));
|
||||
if (ljGoods.getStock()<Integer.parseInt(good.get("num").toString())){
|
||||
orders.put("error","1");
|
||||
return orders;
|
||||
}
|
||||
}
|
||||
|
||||
orderService.insertGoodOrder(ljOrder);
|
||||
|
||||
// 查询商品订单号
|
||||
LJOrder ljOrder2 = orderService.selectGoodsOrder(orderNo);
|
||||
if (payType.equals("CASH")) {
|
||||
// 添加商品订单记录表
|
||||
OrderGoods orderGoods = new OrderGoods();
|
||||
for (JSONObject good : goods) {
|
||||
orderGoods.setOrderId(ljOrder2.getId());
|
||||
orderGoods.setGoodsId(Integer.valueOf(good.get("id").toString()));
|
||||
orderGoods.setNum(Integer.valueOf(good.get("num").toString()));
|
||||
orderGoodsService.insertOrderGoods(orderGoods);
|
||||
}
|
||||
}
|
||||
ljOrder1 = orderService.selectGoodsOrder(orderNo);
|
||||
}
|
||||
|
||||
// 添加收银台订单信息
|
||||
CashierOrder cashierOrder = new CashierOrder();
|
||||
cashierOrder.setStaffId(staffId);
|
||||
@ -175,9 +238,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
cashierOrder.setGoodsDiscountAmount(goodsDiscount);
|
||||
cashierOrder.setOilOrderAmount(oilAmount);
|
||||
cashierOrder.setOilDiscountAmount(oilDiscount);
|
||||
|
||||
OilOrder oilOrder1 = null;
|
||||
LJOrder ljOrder1 = null;
|
||||
// 添加油品订单信息
|
||||
if (!oilOrder.equals("[]")){
|
||||
// 将油品订单的json数据转换为数组
|
||||
@ -218,50 +278,13 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
order.setOrderStatus(payStatus);
|
||||
if (payType.equals("CASH")){
|
||||
order.setPayTime(new Date());
|
||||
this.addOilTrack(jsonObjects.get(i),storeId);
|
||||
}
|
||||
baseMapper.insert(order);
|
||||
oilOrder1 = this.selectOilOrderByOrderNo(orderNo);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加商品订单信息
|
||||
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(payStatus);
|
||||
if (payType.equals("CASH")){
|
||||
ljOrder.setPayTime(new Date());
|
||||
}
|
||||
orderService.insertGoodOrder(ljOrder);
|
||||
// 将油品订单的json数据转换为数组
|
||||
List<JSONObject> goods = JSONArray.parseArray(goodsOrder, JSONObject.class);
|
||||
|
||||
// 查询商品订单号
|
||||
LJOrder ljOrder2 = orderService.selectGoodsOrder(orderNo);
|
||||
|
||||
// 添加商品订单记录表
|
||||
OrderGoods orderGoods = new OrderGoods();
|
||||
for (JSONObject good : goods) {
|
||||
orderGoods.setOrderId(ljOrder2.getId());
|
||||
orderGoods.setGoodsId(Integer.valueOf(good.get("id").toString()));
|
||||
orderGoods.setNum(Integer.valueOf(good.get("num").toString()));
|
||||
orderGoodsService.insertOrderGoods(orderGoods);
|
||||
}
|
||||
ljOrder1 = orderService.selectGoodsOrder(orderNo);
|
||||
}
|
||||
|
||||
// 如果金额不等于0调用第三方支付接口
|
||||
if (!map.get("allAmount").equals("0") && !map.get("payType").equals("CASH")){
|
||||
Integer allAmount = (int) (Double.valueOf(map.get("allAmount"))*100);
|
||||
@ -283,6 +306,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
map1.put("goodsDes",merchantConfig.getMerchantName());
|
||||
map1.put("publicKey",merchantConfig.getPublicKey());
|
||||
map1.put("privateKey",merchantConfig.getPrivateKey());
|
||||
map1.put("goodsOrder",map.get("goodsOrder"));
|
||||
map1.put("oilOrder",map.get("oilOrder"));
|
||||
|
||||
// 调用支付接口
|
||||
try {
|
||||
@ -292,7 +317,6 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,Object> orders = new HashMap<>();
|
||||
OilOrder oilOrder2 = this.selectOilOrderByOrderNo(orderNo);
|
||||
LJOrder goodsOrder1 = orderService.selectGoodsOrder(orderNo);
|
||||
if (!ObjectUtil.isEmpty(oilOrder2)){
|
||||
@ -307,6 +331,39 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
|
||||
return orders;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private OilTankService oilTankService;
|
||||
@Autowired
|
||||
private OilTrackingService oilTrackingService;
|
||||
|
||||
/**
|
||||
* 添加油品库存跟踪信息
|
||||
* @param oilOrder
|
||||
*/
|
||||
@Override
|
||||
public void addOilTrack(JSONObject oilOrder,Integer storeId){
|
||||
OilTank oilTank = oilTankService.queryById(Integer.valueOf(oilOrder.get("tankId").toString()));
|
||||
// 添加库存跟踪信息
|
||||
OilTracking oilTracking = new OilTracking();
|
||||
oilTracking.setDocument("油品出售");
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
oilTracking.setOrderNumber(timestamp+randomString);
|
||||
Double amount = Double.valueOf(oilOrder.get("amount").toString());
|
||||
Double oilPrice = Double.valueOf(oilOrder.get("oilPrice").toString());
|
||||
Double oilNum = amount/oilPrice;
|
||||
oilTracking.setQuantityChange(-Double.parseDouble(oilOrder.get("liters").toString()));
|
||||
oilTracking.setStoreId(storeId);
|
||||
oilTracking.setTankId(Integer.valueOf(oilOrder.get("tankId").toString()));
|
||||
oilTrackingService.insert(oilTracking);
|
||||
|
||||
// 修改油罐容量
|
||||
Double storedQuantity = oilTank.getStoredQuantity();
|
||||
oilTank.setStoredQuantity(storedQuantity-Double.parseDouble(oilOrder.get("liters").toString()));
|
||||
oilTankService.update(oilTank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOilOrder(OilOrder order) {
|
||||
int row = baseMapper.updateById(order);
|
||||
|
@ -1,16 +1,33 @@
|
||||
package com.fuint.business.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.convenienceSore.entity.LJGoods;
|
||||
import com.fuint.business.convenienceSore.entity.StockStatistic;
|
||||
import com.fuint.business.convenienceSore.entity.StockTrack;
|
||||
import com.fuint.business.convenienceSore.service.LJGoodsService;
|
||||
import com.fuint.business.convenienceSore.service.StockStatisticService;
|
||||
import com.fuint.business.convenienceSore.service.StockTrackService;
|
||||
import com.fuint.business.order.entity.OrderGoods;
|
||||
import com.fuint.business.order.mapper.OrderGoodsMapper;
|
||||
import com.fuint.business.order.service.LJOrderService;
|
||||
import com.fuint.business.order.service.OrderGoodsService;
|
||||
import com.fuint.business.order.vo.OrderGoodsVo;
|
||||
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.util.List;
|
||||
|
||||
@Service
|
||||
public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGoods> implements OrderGoodsService {
|
||||
@Autowired
|
||||
private StockStatisticService stockService;
|
||||
@Autowired
|
||||
private StockTrackService trackService;
|
||||
@Autowired
|
||||
private LJGoodsService goodsService;
|
||||
|
||||
@Override
|
||||
public List<OrderGoodsVo> selectOrderGoods(int orderId) {
|
||||
List<OrderGoodsVo> list = baseMapper.selectOrderGoods(orderId);
|
||||
@ -20,6 +37,28 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
|
||||
@Override
|
||||
public int insertOrderGoods(OrderGoods goods) {
|
||||
int row = baseMapper.insert(goods);
|
||||
this.insertStockTrack(goods);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertStockTrack(OrderGoods goods) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
// 查询插入的库存统计信息
|
||||
StockStatistic stockStatistic = stockService.selectStockByGoodsId(goods.getGoodsId());
|
||||
// 添加库存跟踪信息
|
||||
StockTrack stockTrack = new StockTrack();
|
||||
stockTrack.setStockId(stockStatistic.getId());
|
||||
stockTrack.setStoreId(storeId);
|
||||
stockTrack.setDocument("商品购买");
|
||||
stockTrack.setChangeNumber(-goods.getNum());
|
||||
trackService.insertStockTrack(stockTrack);
|
||||
|
||||
// 修改库存数量
|
||||
LJGoods ljGoods = goodsService.selectLJGoodsById(goods.getGoodsId());
|
||||
Integer stock = ljGoods.getStock();
|
||||
ljGoods.setStock(stock-goods.getNum());
|
||||
goodsService.updateLJGoods(ljGoods);
|
||||
}
|
||||
}
|
||||
|
@ -9,45 +9,10 @@ export function getOilGun(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 查询油罐列表
|
||||
export function getGunApi(data) {
|
||||
// 查询油罐信息
|
||||
export function getOilTank(id) {
|
||||
return request({
|
||||
url: '/business/petrolStationManagement/oilGun/selectByNumberTGUn',
|
||||
url: '/business/petrolStationManagement/oilTank/'+id,
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 新增有关信息
|
||||
export function insertGunApi(data) {
|
||||
return request({
|
||||
url: 'business/petrolStationManagement/oilGun',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 修改有关信息
|
||||
export function updateGunApi(data) {
|
||||
return request({
|
||||
url: 'business/petrolStationManagement/oilGun',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 根据油号查询油罐
|
||||
export function selectTankByNumberApi(data) {
|
||||
return request({
|
||||
url: 'business/petrolStationManagement/oilTank/selectList?numberId='+data,
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询油罐列表
|
||||
export function delGunApi(data) {
|
||||
return request({
|
||||
url: '/business/petrolStationManagement/oilGun/',
|
||||
method: 'delete',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
@ -955,10 +955,10 @@ import {listReturnRecord, returnRecordByOrderNo, returnRecordInfo} from "@/api/c
|
||||
this.getList();
|
||||
},
|
||||
// 收款
|
||||
collection(val){
|
||||
collection(){
|
||||
if (this.payType=="CASH"){
|
||||
if (this.authCode==undefined || this.authCode=="" || this.seekZero<0){
|
||||
this.$modal.msgError("请输入正确的金额变化");
|
||||
this.$modal.msgError("请输入正确的金额");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -334,6 +334,7 @@
|
||||
<div class="data-top">
|
||||
<div class="data-top-title">商品</div>
|
||||
<div class="data-top-three">
|
||||
<div>库存</div>
|
||||
<div v-if="isMember == false">单价</div>
|
||||
<div v-else>会员价</div>
|
||||
<div>数量</div>
|
||||
@ -343,6 +344,7 @@
|
||||
<div class="data-top-box" v-for="(item,index) in goodsOrder" :key="index">
|
||||
<div class="data-top-title">{{ item.name }}</div>
|
||||
<div class="data-top-three">
|
||||
<div>{{ item.stock }}</div>
|
||||
<div v-if="isMember == false">{{ item.retailPrice }}</div>
|
||||
<div v-else>{{ item.memberPrice }}</div>
|
||||
<div>
|
||||
@ -489,7 +491,7 @@
|
||||
<div v-if="map.payType != 'CASH'">
|
||||
<div>
|
||||
<el-input v-model="authCode"
|
||||
autofocus="autofocus"
|
||||
:autofocus="true"
|
||||
@keydown.enter.native="collection"
|
||||
placeholder="扫描或输入付款码、支持微信、支付宝、云闪付">
|
||||
<i
|
||||
@ -509,7 +511,7 @@
|
||||
<div v-else>
|
||||
<div>
|
||||
<el-input v-model="authCode"
|
||||
autofocus="autofocus"
|
||||
:autofocus="true"
|
||||
@input="changeSeekZero"
|
||||
@keydown.enter.native="collection"
|
||||
placeholder="请输入收款金额">
|
||||
@ -522,7 +524,7 @@
|
||||
</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 @click="clear" class="but">取 消</el-button>
|
||||
<el-button type="primary" class="but" @click="collection">确 定 收 款</el-button>
|
||||
</span>
|
||||
</div>
|
||||
@ -783,7 +785,7 @@
|
||||
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
|
||||
import {addLJGoods, goodsOrder, oilOrder} from "@/api/cashier/oilorder";
|
||||
import {getUserGrade, listUserGrade, userGradeInfo} from "@/api/cashier/usergrade";
|
||||
import {getOilGun} from "@/api/cashier/oilGuns";
|
||||
import {getOilGun, getOilTank} from "@/api/cashier/oilGuns";
|
||||
import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
|
||||
import {getOilNumberById, oilNumberList} from "@/api/cashier/oilnumber";
|
||||
import {selectCoupon, selectPreferential} from "@/api/cashier/preferential";
|
||||
@ -1071,6 +1073,10 @@
|
||||
this.getUnitList();
|
||||
},
|
||||
methods:{
|
||||
clear(){
|
||||
this.dialogVisiblej = false
|
||||
this.seekZero = 0
|
||||
},
|
||||
getOilNames(list,id){
|
||||
let name = ""
|
||||
let _this = this;
|
||||
@ -1169,7 +1175,7 @@
|
||||
},
|
||||
// 计算找零金额
|
||||
changeSeekZero(){
|
||||
this.seekZero = this.authCode - this.oilActualPay - this.goodsActualPay
|
||||
this.seekZero = (this.authCode - this.oilActualPay - this.goodsActualPay).toFixed(2)
|
||||
},
|
||||
// 获取会员等级id
|
||||
getGradeName(list,id){
|
||||
@ -1644,7 +1650,6 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log(response)
|
||||
_this.oilDiscount = gasolineDiscount + dieselDiscount + naturalGasDiscount
|
||||
_this.checkAll2 = true;
|
||||
_this.isExclusion();
|
||||
@ -1960,33 +1965,41 @@
|
||||
let result = true;
|
||||
let goods = this.goodsOrder;
|
||||
let _this = this;
|
||||
if (this.goodsOrder.length>0){
|
||||
if (this.goodsOrder.length > 0) {
|
||||
let amount = 0;
|
||||
for (let i = 0; i<goods.length; i++){
|
||||
if (_this.isMember){
|
||||
for (let i = 0; i < goods.length; i++) {
|
||||
if (_this.isMember) {
|
||||
amount += +(goods[i].memberPrice * goods[i].num).toFixed(2)
|
||||
}else {
|
||||
} else {
|
||||
amount += +(goods[i].retailPrice * goods[i].num).toFixed(2)
|
||||
}
|
||||
if (goods[i].id == val.id){
|
||||
if (goods[i].id == val.id) {
|
||||
if (val.stock<goods[i].num + 1){
|
||||
this.$modal.msgError("商品库存不足,请重新选择商品")
|
||||
break;
|
||||
}
|
||||
goods[i].num = goods[i].num + 1;
|
||||
this.goodsTotal += 1;
|
||||
result = false;
|
||||
break;
|
||||
}else {
|
||||
} else {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
this.goodsAmount = amount;
|
||||
this.goodsActualPay = this.goodsAmount - this.goodsDiscount;
|
||||
}else {
|
||||
} else {
|
||||
result = true;
|
||||
}
|
||||
if (result){
|
||||
if (result) {
|
||||
if (val.stock==0){
|
||||
this.$modal.msgError("商品库存不足,请重新选择商品")
|
||||
return;
|
||||
}
|
||||
val.num = 1;
|
||||
if (_this.isMember){
|
||||
if (_this.isMember) {
|
||||
this.goodsAmount += +val.memberPrice
|
||||
}else {
|
||||
} else {
|
||||
this.goodsAmount += +val.retailPrice
|
||||
}
|
||||
this.goodsActualPay = this.goodsAmount - this.goodsDiscount;
|
||||
@ -1994,6 +2007,7 @@
|
||||
this.goodsTotal += 1;
|
||||
}
|
||||
this.goods = ""
|
||||
|
||||
},
|
||||
// 立即结算
|
||||
settlement(){
|
||||
@ -2041,32 +2055,41 @@
|
||||
this.form.liters = this.form.amount
|
||||
this.form.amount = (this.form.oilPrice * this.form.amount).toFixed(2)
|
||||
}
|
||||
// 判断此油品是否被加购
|
||||
if (this.isExistOilOrder){
|
||||
for (let i = 0; i<this.oilOrder.length;i++){
|
||||
if (this.oilOrder[i].id == this.form.id){
|
||||
this.oilOrder.splice(i,1,this.form)
|
||||
|
||||
// 校验油罐内油是否足够
|
||||
getOilTank(this.form.tankId).then(res => {
|
||||
if (res.data.tankVolume-this.form.liters<0){
|
||||
this.$modal.msgError("所加油的升数大于油罐内的升数,请重新选择加油升数")
|
||||
return;
|
||||
}else {
|
||||
// 判断此油品是否被加购
|
||||
if (this.isExistOilOrder){
|
||||
for (let i = 0; i<this.oilOrder.length;i++){
|
||||
if (this.oilOrder[i].id == this.form.id){
|
||||
this.oilOrder.splice(i,1,this.form)
|
||||
}
|
||||
}
|
||||
}else {
|
||||
this.oilOrder.push(this.form)
|
||||
}
|
||||
this.oilAmount = 0
|
||||
this.oilOrder.forEach(item => {
|
||||
this.oilAmount += +item.amount
|
||||
})
|
||||
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
this.oilTotal = this.oilOrder.length;
|
||||
this.select = "元";
|
||||
if (this.isMember){
|
||||
this.getGrade(this.member.gradeId)
|
||||
this.changeRefuelMoney();
|
||||
if (this.oilOrder.length>0){
|
||||
this.preferential();
|
||||
this.getCoupon();
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
this.oilOrder.push(this.form)
|
||||
}
|
||||
this.oilAmount = 0
|
||||
this.oilOrder.forEach(item => {
|
||||
this.oilAmount += +item.amount
|
||||
})
|
||||
|
||||
this.oilActualPay = this.oilAmount - this.oilDiscount;
|
||||
this.oilTotal = this.oilOrder.length;
|
||||
this.select = "元";
|
||||
if (this.isMember){
|
||||
this.getGrade(this.member.gradeId)
|
||||
this.changeRefuelMoney();
|
||||
if (this.oilOrder.length>0){
|
||||
this.preferential();
|
||||
this.getCoupon();
|
||||
}
|
||||
}
|
||||
},
|
||||
// 囤油卡变化后总金额的变化
|
||||
changeRefuelMoney(){
|
||||
@ -2200,6 +2223,7 @@
|
||||
}
|
||||
getOilNumberById(data.numberId).then( response => {
|
||||
this.form = response.data;
|
||||
this.form.tankId = data.tankId
|
||||
this.gunList.forEach(item => {
|
||||
if (item.id==data.id){
|
||||
this.form.id = item.id
|
||||
@ -2210,6 +2234,12 @@
|
||||
},
|
||||
// 确定收款
|
||||
collection(){
|
||||
if (this.payType=="CASH"){
|
||||
if (this.authCode==undefined || this.authCode=="" || this.seekZero<0){
|
||||
this.$modal.msgError("请输入正确的金额");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// JSON.parse()
|
||||
this.map.seekZero = this.seekZero;
|
||||
this.map.oilAmount = this.oilAmount;
|
||||
@ -2234,13 +2264,21 @@
|
||||
_this.orderNo = response.data.oilOrder.orderNo;
|
||||
if (response.data.oilOrder.orderStatus == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
_this.seekZero = 0
|
||||
}
|
||||
}
|
||||
if (response.data.goodsOrder!=null){
|
||||
if (response.data.goodsOrder.status == "paid"){
|
||||
_this.isPaySuccess = true;
|
||||
_this.seekZero = 0
|
||||
}
|
||||
}
|
||||
if (response.data.error==1){
|
||||
this.$modal.msgError("商品库存不足,请重新选择商品")
|
||||
this.loading = false;
|
||||
this.dialogVisiblej = false;
|
||||
return;
|
||||
}
|
||||
})
|
||||
this.loading = true;
|
||||
_this.queryPayStatus();
|
||||
|
Loading…
Reference in New Issue
Block a user