no message

This commit is contained in:
wangh 2024-02-05 17:35:38 +08:00
parent d05c5d8efb
commit a32a779fe0
44 changed files with 1890 additions and 127 deletions

View File

@ -0,0 +1,189 @@
//==本JS是加载Lodop插件或Web打印服务CLodop/Lodop7的综合示例可直接使用建议理解后融入自己程序==
// http://www.c-lodop.com/LodopDemo.html 地址
//用双端口加载主JS文件Lodop.js(或CLodopfuncs.js兼容老版本)以防其中某端口被占:
var MainJS = "CLodopfuncs.js",
URL_WS1 = "ws://localhost:8000/" + MainJS, //ws用8000/18000
URL_WS2 = "ws://localhost:18000/" + MainJS,
URL_HTTP1 = "http://localhost:8000/" + MainJS, //http用8000/18000
URL_HTTP2 = "http://localhost:18000/" + MainJS,
URL_HTTP3 = "https://localhost.lodop.net:8443/" + MainJS; //https用8000/8443
var CreatedOKLodopObject, CLodopIsLocal, LoadJsState;
//==判断是否需要CLodop(那些不支持插件的浏览器):==
function needCLodop() {
try {
var ua = navigator.userAgent;
if (ua.match(/Windows\sPhone/i) ||
ua.match(/iPhone|iPod|iPad/i) ||
ua.match(/Android/i) ||
ua.match(/Edge\D?\d+/i))
return true;
var verTrident = ua.match(/Trident\D?\d+/i);
var verIE = ua.match(/MSIE\D?\d+/i);
var verOPR = ua.match(/OPR\D?\d+/i);
var verFF = ua.match(/Firefox\D?\d+/i);
var x64 = ua.match(/x64/i);
if ((!verTrident) && (!verIE) && (x64)) return true;
else if (verFF) {
verFF = verFF[0].match(/\d+/);
if ((verFF[0] >= 41) || (x64)) return true;
} else if (verOPR) {
verOPR = verOPR[0].match(/\d+/);
if (verOPR[0] >= 32) return true;
} else if ((!verTrident) && (!verIE)) {
var verChrome = ua.match(/Chrome\D?\d+/i);
if (verChrome) {
verChrome = verChrome[0].match(/\d+/);
if (verChrome[0] >= 41) return true;
}
}
return false;
} catch (err) {
return true;
}
}
//==检查加载成功与否如没成功则用http(s)再试==
//==低版本CLODOP6.561/Lodop7.043及前)用本方法==
function checkOrTryHttp() {
if (window.getCLodop) {
LoadJsState = "complete";
return true;
}
if (LoadJsState == "loadingB" || LoadJsState == "complete") return;
LoadJsState = "loadingB";
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
var JS1 = document.createElement("script")
, JS2 = document.createElement("script")
, JS3 = document.createElement("script");
JS1.src = URL_HTTP1;
JS2.src = URL_HTTP2;
JS3.src = URL_HTTP3;
JS1.onload = JS2.onload = JS3.onload = JS2.onerror = JS3.onerror = function () { LoadJsState = "complete"; }
JS1.onerror = function (e) {
if (window.location.protocol !== 'https:')
head.insertBefore(JS2, head.firstChild); else
head.insertBefore(JS3, head.firstChild);
}
head.insertBefore(JS1, head.firstChild);
}
//==加载Lodop对象的主过程:==
(function loadCLodop() {
if (!needCLodop()) return;
CLodopIsLocal = !!((URL_WS1 + URL_WS2).match(/\/\/localho|\/\/127.0.0./i));
LoadJsState = "loadingA";
if (!window.WebSocket && window.MozWebSocket) window.WebSocket = window.MozWebSocket;
//ws方式速度快(小于200ms)且可避免CORS错误,但要求Lodop版本足够新:
try {
var WSK1 = new WebSocket(URL_WS1);
WSK1.onopen = function (e) { setTimeout("checkOrTryHttp();", 200); }
WSK1.onmessage = function (e) { if (!window.getCLodop) eval(e.data); }
WSK1.onerror = function (e) {
var WSK2 = new WebSocket(URL_WS2);
WSK2.onopen = function (e) { setTimeout("checkOrTryHttp();", 200); }
WSK2.onmessage = function (e) { if (!window.getCLodop) eval(e.data); }
WSK2.onerror = function (e) { checkOrTryHttp(); }
}
} catch (e) {
checkOrTryHttp();
}
})();
//==获取LODOP对象主过程,判断是否安装、需否升级:==
function getLodop(oOBJECT, oEMBED) {
var strFontTag = "<br><font color='#FF00FF'>打印控件";
var strLodopInstall = strFontTag + "未安装!点击这里<a href='install_lodop32.exe' target='_self'>执行安装</a>";
var strLodopUpdate = strFontTag + "需要升级!点击这里<a href='install_lodop32.exe' target='_self'>执行升级</a>";
var strLodop64Install = strFontTag + "未安装!点击这里<a href='install_lodop64.exe' target='_self'>执行安装</a>";
var strLodop64Update = strFontTag + "需要升级!点击这里<a href='install_lodop64.exe' target='_self'>执行升级</a>";
var strCLodopInstallA = "<br><font color='#FF00FF'>Web打印服务CLodop未安装启动点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
var strCLodopInstallB = "<br>(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>";
var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>";
var strLodop7FontTag = "<br><font color='#FF00FF'>Web打印服务Lodop7";
var strLodop7HrefX86 = "点击这里<a href='Lodop7_Linux_X86_64.tar.gz' target='_self'>下载安装</a>(下载后解压点击lodop文件开始执行)";
var strLodop7HrefARM = "点击这里<a href='Lodop7_Linux_ARM64.tar.gz' target='_self'>下载安装</a>(下载后解压点击lodop文件开始执行)";
var strLodop7Install_X86 = strLodop7FontTag + "未安装启动," + strLodop7HrefX86;
var strLodop7Install_ARM = strLodop7FontTag + "未安装启动," + strLodop7HrefARM;
var strLodop7Update_X86 = strLodop7FontTag + "需升级," + strLodop7HrefX86;
var strLodop7Update_ARM = strLodop7FontTag + "需升级," + strLodop7HrefARM;
var strInstallOK = ",成功后请刷新本页面或重启浏览器。</font>";
var LODOP;
try {
var isWinIE = (/MSIE/i.test(navigator.userAgent)) || (/Trident/i.test(navigator.userAgent));
var isWinIE64 = isWinIE && (/x64/i.test(navigator.userAgent));
var isLinuxX86 = (/Linux/i.test(navigator.platform)) && (/x86/i.test(navigator.platform));
var isLinuxARM = (/Linux/i.test(navigator.platform)) && (/aarch/i.test(navigator.platform));
if (needCLodop() || isLinuxX86 || isLinuxARM) {
try {
LODOP = window.getCLodop();
} catch (err) { }
if (!LODOP && LoadJsState !== "complete") {
if (!LoadJsState)
alert("未曾加载Lodop主JS文件请先调用loadCLodop过程."); else
alert("网页还没下载完毕,请稍等一下再操作.");
return;
}
var strAlertMessage;
if (!LODOP) {
if (isLinuxX86)
strAlertMessage = strLodop7Install_X86;
else if (isLinuxARM)
strAlertMessage = strLodop7Install_ARM;
else
strAlertMessage = strCLodopInstallA + (CLodopIsLocal ? strCLodopInstallB : "");
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
return;
} else {
if (isLinuxX86 && LODOP.CVERSION < "7.0.4.3")
strAlertMessage = strLodop7Update_X86;
else if (isLinuxARM && LODOP.CVERSION < "7.0.4.3")
strAlertMessage = strLodop7Update_ARM;
else if (CLODOP.CVERSION < "6.5.7.1")
strAlertMessage = strCLodopUpdate;
if (strAlertMessage)
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
}
// LODOP.SET_LICENSES("", "EE0887D00FCC7D29375A695F728489A6", "C94CEE276DB2187AE6B65D56B3FC2848", "");
} else {
//==如果页面有Lodop插件就直接使用,否则新建:==
if (oOBJECT || oEMBED) {
if (isWinIE)
LODOP = oOBJECT;
else
LODOP = oEMBED;
} else if (!CreatedOKLodopObject) {
LODOP = document.createElement("object");
LODOP.setAttribute("width", 0);
LODOP.setAttribute("height", 0);
LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
if (isWinIE)
LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
else
LODOP.setAttribute("type", "application/x-print-lodop");
document.documentElement.appendChild(LODOP);
CreatedOKLodopObject = LODOP;
} else
LODOP = CreatedOKLodopObject;
//==Lodop插件未安装时提示下载地址:==
if ((!LODOP) || (!LODOP.VERSION)) {
document.body.innerHTML = (isWinIE64 ? strLodop64Install : strLodopInstall) + strInstallOK + document.body.innerHTML;
return LODOP;
}
if (LODOP.VERSION < "6.2.2.6") {
document.body.innerHTML = (isWinIE64 ? strLodop64Update : strLodopUpdate) + strInstallOK + document.body.innerHTML;
}
}
//===如下空白位置适合调用统一功能(如注册语句、语言选择等):=======================
LODOP.SET_LICENSES("", "EE0887D00FCC7D29375A695F728489A6", "C94CEE276DB2187AE6B65D56B3FC2848", "");
//===============================================================================
return LODOP;
} catch (err) {
alert("getLodop出错:" + err);
}
}
export { getLodop };

View File

@ -0,0 +1,33 @@
import request from '@/utils/request'
export function getHandoverApi() {
return request({
url: '/business/handoverRecord/handover',
method: 'get',
// params: query
})
}
export function getHandoverListApi(query) {
return request({
url: '/business/handoverRecord/queryByPage',
method: 'get',
params: query
})
}
export function addHandoverApi(data) {
return request({
url: '/business/handoverRecord',
method: 'post',
data: data
})
}
export function printLocallyApi(data) {
return request({
url: '/business/handoverRecord/printLocally',
method: 'post',
data: data
})
}

View File

@ -16,3 +16,13 @@ export function getOrderGoods(orderId) {
method: 'get',
})
}
export function getStatisticsApi(data) {
return request({
url: 'business/integral/integralOrders/statistics',
method: 'get',
params: data
})
}

View File

@ -10,7 +10,12 @@
<search id="header-search" class="right-menu-item" />
<ScreenData class="right-menu-item hover-effect" style="font-size: 24px"></ScreenData>
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<div title="收银台" class="right-menu-item hover-effect " style="font-size: 23px">
<i class="el-icon-s-shop" @click="goToCashier()"></i>
</div>
<FuintDoc id="fuint-doc" class="right-menu-item hover-effect" />
<!-- <i class="right-menu-item hover-effect el-icon-s-shop" @click="goToCashier()"></i>-->
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
@ -100,6 +105,9 @@ export default {
location.href = '/';
})
}).catch(() => {});
},
goToCashier() {
window.open(this.pcUrl+'#/homeindex?id=0')
}
}
}

View File

@ -25,6 +25,7 @@
<li v-if="!isLastView()" @click="closeRightTags"><i class="el-icon-right"></i> 关闭右侧</li>
<li @click="closeAllTags(selectedTag)"><i class="el-icon-circle-close"></i> 全部关闭</li>
</ul>
</div>
</template>

View File

@ -50,6 +50,8 @@ Vue.prototype.getName = getName
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.imgurl = 'http://192.168.0.138:8008'
Vue.prototype.pcUrl = 'http://192.168.0.178:83/'
// 全局组件挂载
Vue.component('DictTag', DictTag)
Vue.component('Pagination', Pagination)

View File

@ -43,7 +43,7 @@
<td><span class="underlined-text">{{inventoryForm.orderNumber}}</span></td>
</tr>
</table>
</div>
<div style="height: 100%; width: 30%; display: flex; align-items: center; justify-content: flex-end;">
<el-button type="primary" v-if="state=='await'" :disabled="saveFlag" @click="save()">保存</el-button>
@ -76,16 +76,53 @@
:default-sort="defaultSort">
<el-table-column label="序号" align="center" prop="commodityName"/>
<el-table-column label="商品名称" align="center" prop="commodityName"/>
<el-table-column label="商品编码" align="center" prop="goodsNo"/>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="当前进价" align="center" prop="purchasePrice"/>
<el-table-column label="库存数量" align="center" prop="stock"/>
<el-table-column label="盘点数量" align="center" prop="inventoryQuantity">
<el-table-column label="进货量" align="center" prop="purchase">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.inventoryQuantity" @change="change(scope.row,2)" controls-position="right" :precision="0" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
{{scope.row.purchase?scope.row.purchase:'--'}}
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="销售量" align="center" prop="unit">
<el-table-column label="便利店销售" align="center" prop="goodsSales">
<template slot-scope="scope">
{{scope.row.goodsSales?scope.row.goodsSales:'--'}}
</template>
</el-table-column>
<el-table-column label="积分兑换" align="center" prop="inventorySales">
<template slot-scope="scope">
{{scope.row.inventorySales?scope.row.inventorySales:'--'}}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="当前进价" align="center" prop="purchasePrice"/>
<el-table-column label="库存数量" align="center" prop="stock"/>
<el-table-column label="盘点数量" align="center" prop="unit">
<el-table-column label="正常商品" align="center" prop="purchasePrice">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.inventoryQuantity" @change="change(scope.row,2)" controls-position="right" :precision="0" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="货损数量" align="center" prop="damageQuantity">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.damageQuantity" @change="change(scope.row,2)" controls-position="right" :precision="0" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="总盘点数量" align="center" prop="inventoryQuantity">
<template slot-scope="scope">
{{ scope.row.inventoryQuantity + scope.row.damageQuantity}}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="库存差异" align="center" prop="inventoryDiscrepancy"/>
<el-table-column label="盈亏金额" align="center" prop="profitLossAmount"/>
@ -235,7 +272,7 @@ export default {
pageSize: 10,
isRecovery:0,
},
inventoryForm: {
inventoryId:this.$props.PinventoryId,
id:this.$props.PinventoryId,
@ -245,11 +282,12 @@ export default {
creataByName: this.$props.PcreataByName,
roductQuantity:0, //
inventoryQuantity: 0 ,//
damageQuantity: 0 ,//
inventoryDiscrepancy: 0,//
profitLossAmount: 0//
},
inventoryId : this.$props.PinventoryId,
@ -361,7 +399,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
}).then(() => {
if (data.id != null) {
delDetailsApi(data).then(res=>{
})
@ -377,12 +415,12 @@ export default {
this.$message({
type: 'info',
message: '已取消删除'
});
});
});
},
//
@ -395,14 +433,17 @@ export default {
let profitLossAmount = new BigNumber(data.profitLossAmount);
let inventoryDiscrepancy = new BigNumber(data.inventoryDiscrepancy);
let inventoryQuantity = new BigNumber(data.inventoryQuantity);
let damageQuantity = new BigNumber(data.damageQuantity);
let purchasePrice = new BigNumber(data.purchasePrice);
let stock = new BigNumber(data.stock);
//
inventoryDiscrepancy = inventoryQuantity.minus(stock)
let addStocke = inventoryQuantity.plus(damageQuantity)
inventoryDiscrepancy = addStocke.minus(stock)
//
profitLossAmount = inventoryDiscrepancy.multipliedBy(purchasePrice);
data.inventoryDiscrepancy = inventoryDiscrepancy.toNumber();
data.profitLossAmount = profitLossAmount.toNumber();
data.inventoryDiscrepancy = inventoryDiscrepancy.toNumber();
data.profitLossAmount = profitLossAmount.toNumber();
this.sumMethod(this.detailsList)
},
@ -419,12 +460,14 @@ export default {
this_.inventoryForm.productQuantity = data.length,
this_.inventoryForm.inventoryQuantity = new BigNumber(0),
this_.inventoryForm.damageQuantity = new BigNumber(0),
this_.inventoryForm.inventoryDiscrepancy = new BigNumber(0),
this_.inventoryForm.profitLossAmount = new BigNumber(0),
data.forEach(da => {
if (da.inventoryQuantity != null) {
this_.inventoryForm.inventoryQuantity= this_.inventoryForm.inventoryQuantity.plus(da.inventoryQuantity)
}
if (da.inventoryDiscrepancy != null) {
@ -459,6 +502,7 @@ export default {
purchasePrice: mul.buyingPrice,
goodsNo:mul.goodsNo,
inventoryQuantity:1,
damageQuantity:0,
profitLossAmount:0, //
inventoryDiscrepancy:0, //
}
@ -576,7 +620,7 @@ export default {
}).catch(res=>{
this.$modal.msgError("保存失败");
})
})
},
@ -625,9 +669,9 @@ export default {
message: '已取消'
});
});
},
},
//
abolition(){
if (this.inventoryId < 0) {
@ -702,7 +746,7 @@ export default {
/* text-decoration: underline; 添加下划线 */
/* border-bottom: 1px solid; */
/* padding-bottom: 3px; */
/* } */
/* } */
.container {
@ -719,9 +763,9 @@ export default {
}
.underlined-text {
border-bottom: 1px solid;
border-bottom: 1px solid;
padding-bottom: 3px;
/* text-decoration: underline; */
/* text-decoration: underline; */
/* vertical-align: middle; */
}

View File

@ -0,0 +1,255 @@
<template>
<div class="app-container">
<el-card >
<div slot="header" class="clearfix">
<!-- <el-link icon="el-icon-edit" :underline="false" @click="goToAbout">编辑</el-link>-->
<span>交班详情</span>
</div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
<el-form-item label="交班方式" prop="status">
<el-select v-model="queryParams.status" style="width: 150px" placeholder="交班方式" clearable>
<el-option
v-for="option in shiftHandoverList"
:key="option.dictCode"
:label="option.dictLabel"
:value="option.dictLabel"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="交班状态">
<el-select v-model="queryParams.type" style="width: 150px" placeholder="交班状态" clearable>
<el-option label="交班" value="0">交班</el-option>
<el-option label="未交班" value="1">未交班</el-option>
</el-select>
</el-form-item>
<el-form-item label="交班时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
size="medium"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
clearable
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- style="width: 1500px"-->
<el-card style="margin-top: 20px" class="box-card">
<el-table
ref="tables"
v-loading="loading"
:data="dataList"
:default-sort="defaultSort">
<el-table-column label="班次员工" align="center" prop="staffName"/>
<el-table-column label="开始时间" align="center" prop="startTime"/>
<el-table-column label="结束时间" align="center" prop="endTime" />
<el-table-column label="交班状态" align="center" prop="status" width="">
<template slot-scope="scope">
<el-tag effect="plain" v-if="scope.row.type =='0'"> 已交班</el-tag>
<el-tag type="success" effect="plain" v-else-if="scope.row.type =='1'">未交班</el-tag>
</template>
</el-table-column>
<!-- <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">
<el-button
size="mini"
type="text"
@click="handleDetail(scope.row)"
>交班数据</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- @click="printLocally(scope.row.recordData)"-->
<!-- >补打交班单</el-button>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<el-dialog title="订单详情" :visible.sync="openDetail" width="600px" append-to-body :close-on-click-modal="false">
<!-- <detail :dataForm = "recordData"></detail>-->
<HandoverOnly :recordData = "recordData"></HandoverOnly>
</el-dialog>
</div>
</template>
<script>
import {getHandoverListApi,printLocallyApi} from "@/api/handover/handover";
import {getStatisticsApi } from "@/api/order/order";
import {getDicts} from "@/api/order/data";
import HandoverOnly from "@/views/handover/HandoverOnly.vue";
export default {
name: "pointsCashier",
components: {HandoverOnly},
// dicts: ['zhzt'],
data() {
return {
openDetail:false,
dataForm:{},
dataList:[],
recordData:'',
zhztList:'',
shiftHandoverList:'',
queryParams: {
status: '',
type: '',
page:null,
pageSize:null
},
loading: false,
dateRange: [],
defaultSort: {prop: 'createTime', order: 'descending'},
total: 0,
statisticsForm: {
num:0,
exchangeQuantity:0,
integral:0,
amount:0
}
}
},
created() {
this.getList();
this.getStatistics();
this.getStatus();
},
methods: {
getList(){
getHandoverListApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
this.dataList = res.data.records
this.total = res.data.total
})
},
getStatistics() {
getStatisticsApi().then(res=>{
this.statisticsForm = res.data
})
console.log("123123123",this.statisticsForm)
},
//
getZhzt() {
getDicts("zhzt").then(response => {
this.zhztList = response.data;
})
},
getStatus() {
getDicts("handover").then(response => {
this.shiftHandoverList = response.data;
})
},
handleUpdate(){},
handleQuery(){
this.getList();
},
resetQuery(){
this.queryParams = {
giftName: '',
status: '',
mobile: '',
orderNumber: '',
page:1,
pageSize:10
},
this.dateRange = []
},
printLocally(data) {
printLocallyApi(data).then(res=>{
})
},
handleDetail(data){
this.openDetail = true
this.recordData = data.recordData;
// JSON.parse(this.recordData )
console.log("data.recordData;",this.recordData)
},
goToAbout() {
this.$router.push({
path:'/Handover',
query:{
id:9
}
});
}
}
}
</script>
<style scoped>
.app-container {
width: 100%;
height: 100%;
background: #f6f8f9;
//padding-top: 0px;
//padding: 0px
}
.box {
padding: 10px;
height: 80px;
width: 150px;
margin-right: 0px;
background-color: rgba(204, 204, 204, 0.3);
border-radius: 8px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: left;
text-align: left;
}
.box-card{
width: 100%;
margin-bottom: 15px;
}
.font-chinese {
font-size: 15px;
font-family:Microsoft YaHei;
font-weight: bold;
line-height:1.5
}
.font-number {
font-size: 20px;
font-family: PingFang SC,sans-serif;
font-weight: bold;
line-height:1.3
}
.table-box{
width: 100%;
}
</style>

View File

@ -0,0 +1,879 @@
<!--发票-->
<template>
<div class="app-center">
<el-button style="float: left ;margin-left: 5px" size="mini" type="primary" @click="printLocally()" plain>打印交班单</el-button>
<div id="report" ref="report" class="box-center">
<div class="box-title">
交班统计
</div>
<div class="box-ge">
<div class="input-box">
<div>油站名称:</div>
<div>{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.storeName : '未知油站' }}</div>
</div>
<div class="input-box">
<div>收银员:</div>
<div>{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.realName : '未知姓名' }}</div>
</div>
<div class="input-box">
<div>交班方式:</div>
<div>门店统一交班</div>
</div>
<div class="input-box">
<div>开始时间:</div>
<div>{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.startTime : '/--/' }}</div>
</div>
<div class="input-box">
<div>结束时间:</div>
<div>{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.endTime : '/--/' }}</div>
</div>
</div>
<div class="box-ge">
<div class="input-box">
<div>当前版本:</div>
<div>V1.0.1</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">订单汇总</div>
<div class="input-hui">
<div>类型</div>
<div>金额</div>
</div>
<div class="input-box">
<div>油品订单(订单)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilOrder : '0' }}</div>
</div>
<div class="input-box">
<div>油品订单(退款)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilRefund : '0' }}</div>
</div>
<div class="input-box">
<div>油品订单(实收)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilPaid : '0' }}</div>
</div>
<div class="input-box">
<div>油品优惠(实收)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.oilDiacount : '0' }}</div>
</div>
<!-- <div class="input-box">-->
<!-- <div>抹零总额(实收)</div>-->
<!-- <div>2164.55</div>-->
<!-- </div>-->
<el-divider></el-divider>
<!-- 六个一条线 -->
<div class="input-box">
<div>会员储值(订单)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardOrder : '0' }}</div>
</div>
<div class="input-box">
<div>会员储值(退款)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardRefund : '0' }}</div>
</div>
<div class="input-box">
<div>会员储值(实收)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardPaid : '0' }}</div>
</div>
<div class="input-box">
<div>储值赠送(订单)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardGiftOrder : '0' }}</div>
</div>
<div class="input-box">
<div>储值赠送(退款)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardGiftRefund : '0' }}</div>
</div>
<div class="input-box">
<div>储值赠送(实际)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.cardGiftPaid : '0' }}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>存油储值(订单)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.fuelOrder : '0' }}</div>
</div>
<div class="input-box">
<div>存油储值(退款)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.fuelRefund : '0' }}</div>
</div>
<div class="input-box">
<div>存油储值(实收)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.fuelPaid : '0' }}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>普通收款(订单)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.goodsOrder : '0' }}</div>
</div>
<div class="input-box">
<div>普通收款(退款)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.goodsRefund : '0' }}</div>
</div>
<div class="input-box">
<div>普通收款(实收)</div>
<div>{{ handoverList && handoverList.orderSummary ? handoverList.orderSummary.goodsPaid : '0' }}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">退款汇总</div>
<div class="input-hui">
<div>支付方式</div>
<div>退款金额</div>
</div>
<div class="input-box" v-for="item in paymentAggregation('all')" v-if="item.refundAmount > 0">
<div>{{calculateThePaymentMethod(item.payType)}}</div>
<div>{{item.refundAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box" >
<div>合计</div>
<div>{{refundAggregateTotal}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">实收汇总</div>
<div class="input-hui">
<div>支付方式</div>
<div>金额</div>
</div>
<div class="input-box" v-for="item in paymentAggregation('all')" v-if="item.paidAmount > 0">
<div>{{calculateThePaymentMethod(item.payType)}}</div>
<div>{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{totalTotalOfActualReceipts}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">油品订单</div>
<div class="input-hui">
<div>支付方式</div>
<div>金额</div>
</div>
<div class="input-box" v-for="item in paymentAggregation('oil')">
<div>{{calculateThePaymentMethod(item.payType)}}</div>
<div>{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{totalOilOrders}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">商品订单</div>
<div class="input-hui">
<div>支付方式</div>
<div>金额</div>
</div>
<div class="input-box" v-for="item in paymentAggregation('goods')">
<div>{{calculateThePaymentMethod(item.payType)}}</div>
<div>{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{totalOfProductOrders}}</div>
</div>
</div>
<!-- <div class="box-ge">-->
<!-- <div class="boloicon">普通订单</div>-->
<!-- <div class="input-hui">-->
<!-- <div>支付方式</div>-->
<!-- <div>金额</div>-->
<!-- </div>-->
<!-- <div class="input-box" v-for="item in paymentAggregation('goods')">-->
<!-- <div>{{calculateThePaymentMethod(item.payType)}}</div>-->
<!-- <div>{{item.paidAmount}}</div>-->
<!-- </div>-->
<!-- <el-divider></el-divider>-->
<!-- <div class="input-box">-->
<!-- <div>合计</div>-->
<!-- <div>0.00</div>-->
<!-- </div>-->
<!-- </div>-->
<div class="box-ge">
<div class="boloicon">会员储值</div>
<div class="input-hui">
<div>支付方式</div>
<div>金额</div>
</div>
<div class="input-box" v-for="item in paymentAggregation('fg')">
<div>{{calculateThePaymentMethod(item.payType)}}</div>
<div>{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{totalMemberStoredValue}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">积分商城</div>
<div class="input-hui">
<div>支付方式</div>
<div>金额</div>
</div>
<div class="input-box" v-for="item in paymentAggregation('point')" v-if="item.paidAmount>0">
<div>{{calculateThePaymentMethod(item.payType)}}</div>
<div>{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{pointsMallStatistics}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">油号统计</div>
<div class="input-hui-frou">
<div>油号</div>
<div>笔数</div>
<div>升数</div>
<div style="text-align: right">金额</div>
</div>
<div class="input-box-frou" v-for="item in oilNumberStatistics()">
<div>{{item.oilName}}</div>
<div>{{item.numberOfDeals}}</div>
<div>{{item.oilNum}}</div>
<div style="text-align: right">{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{totalOilNumberStatistics}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">优惠统计</div>
<div class="input-hui">
<div>油品</div>
<div>金额</div>
</div>
<div class="input-box" v-for="item in oilNumberStatistics()">
<div>{{item.oilName}}</div>
<div>{{item.paidDiscount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{discountStatisticsTotal}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">油枪统计</div>
<div class="input-hui-frou">
<div>油号</div>
<div>笔数</div>
<div>升数</div>
<div style="text-align: right">金额</div>
</div>
<div class="input-box-frou" v-for="item in greaseGunStatistics()">
<div>{{item.gunName}}</div>
<div>{{item.numberOfDeals}}</div>
<div>{{item.oilNum}}</div>
<div style="text-align: right">{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{totalOfOilGunStatistics}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">员工统计</div>
<div class="input-hui-frou">
<div>员工姓名</div>
<div>笔数</div>
<div style="text-align: right">金额</div>
</div>
<div class="input-box-frou" v-for="item in employeeStatistics()">
<div>{{item.name}}</div>
<div>{{item.numberOfDeals}}</div>
<div style="text-align: right">{{item.paidAmount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{totalOfEmployeeStatistics}}</div>
</div>
</div>
<div class="box-ge">
<div class="boloicon">挂账统计</div>
<el-divider>挂账详情</el-divider>
<div class="input-hui-frou">
<div>挂账单位</div>
<div>笔数</div>
<div style="text-align: right">金额</div>
</div>
<div class="input-box-frou" v-for="item in billingDetails()">
<div>{{item.name}}</div>
<div>{{item.numberOfDeals}}</div>
<div style="text-align: right">{{item.amount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{statisticsOfAccountDetails}}</div>
</div>
<el-divider>归还详情</el-divider>
<div class="input-hui-frou">
<div>挂账单位</div>
<div>笔数</div>
<div style="text-align: right">金额</div>
</div>
<div class="input-box-frou" v-for="item in returnedToTheAccount()">
<div>{{item.name}}</div>
<div>{{item.numberOfDeals}}</div>
<div style="text-align: right">{{item.amount}}</div>
</div>
<el-divider></el-divider>
<div class="input-box">
<div>合计</div>
<div>{{postedAccountReturnStatistics}}</div>
</div>
</div>
</div>
<div style="width: 100%; height: 100px"></div>
</div>
</template>
<script>
// import {printLocallyApi,addHandoverApis} from "@/api/handover/handover";
import BigNumber from "bignumber.js";
import {getLodop} from "@/api/LodopFuncs";
export default {
name: "HandoverOnly",
props: {
recordData:''
},
data() {
return {
handoverList : {},
}
},
created() {
console.log("12312231",this.recordData)
this.handoverList = JSON.parse(this.recordData)
// this.getHandover();
},
methods: {
printLocally() {
// const printHTML = document.querySelector('#report').innerHTML
// //
// window.document.body.innerHTML = printHTML
// window.print() // window
// window.location.reload() //
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.box-ge{
border-bottom: 1px solid #000000 ;
box-sizing: border-box;
padding: 10px;
}
.box-title{
font-size: 18px;
text-align: center;
align-items: center;
margin-top: 15px;
}
.input-hui{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
}
.input-hui-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
.input-box-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
// let preview = LODOP.PREVIEW();
// console.log("preview",preview);
LODOP.PRINT();
},
// getHandover() {
// getHandoverApi().then(res=>{
// this.handoverList = res.data;
// console.log("this.handoverList",this.handoverList)
// })
// },
getList(){
getHandoverListApi(this.addDateRange(this.queryParams, this.dateRange)).then(res=>{
this.dataList = res.data.records
this.total = res.data.total
})
},
//
recording() {
this.$router.push({
path:'/HandoverDetails',
query:{
id:9
}
});
},
paymentAggregation(flag) {
let count = [];
if (this.handoverList && this.handoverList.paymentAggregation) {
this.handoverList.paymentAggregation.forEach(res=> {
if (flag == 'fg') {
if (res.flag == "card" || res.flag == "fuel") {
let flag2 = false;
count.forEach(coun => {
if (res.payType === coun.payType) {
coun.paidAmount += res.paidAmount;
flag2 = true;
}
});
if (!flag2) {
//
let newRes = { ...res };
count.push(newRes);
}
}
}else if (res.flag == flag) {
count.push(res)
}
})
}
return count;
},
calculateThePaymentMethod(payType) {
switch (payType) {
case 'ALIPAY':
return '支付宝'
break;
case 'WECHAT':
return '微信'
break;
case 'UNIONPAY':
return '银联二维码'
break;
case 'CASH':
return '现金'
break;
}
return '未知'
},
oilNumberStatistics() {
let count = [];
if (this.handoverList && this.handoverList.oilNumberStatistics) {
return this.handoverList.oilNumberStatistics
}
return count;
},
greaseGunStatistics() {
let count = [];
if (this.handoverList && this.handoverList.greaseGunStatistics) {
return this.handoverList.greaseGunStatistics
}
return count;
},
employeeStatistics() {
console.log("this.employeeStatistics",this.handoverList.employeeStatistics)
let count = [];
if (this.handoverList && this.handoverList.employeeStatistics) {
return this.handoverList.employeeStatistics
}
return count;
},
billingDetails() {
let count = [];
if (this.handoverList && this.handoverList.billingDetails) {
return this.handoverList.billingDetails
}
return count;
},
returnedToTheAccount() {
let count = [];
if (this.handoverList && this.handoverList.returnedToTheAccount) {
return this.handoverList.returnedToTheAccount
}
return count;
},
shift() {
this.$confirm('交班并退出系统, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let recordData = this.handoverList
let handoverRecord = {
startTime:this.handoverList.baseInfo.endTime,
recordData:JSON.stringify(recordData),
type:0,
status:0,
}
addHandoverApi(handoverRecord).then(res=>{
console.log("")
})
//
// this.$message({
// type: 'success',
// message: '!'
// });
}).catch(() => {
this.$message({
type: 'info',
message: '已取消交班'
});
});
}
},
computed:{
//退
refundAggregateTotal() {
if (this.handoverList && this.handoverList.paymentAggregation) {
let num = new BigNumber(0);
this.handoverList.paymentAggregation.forEach(res => {
if (res.flag == "all"){
num = num.plus(new BigNumber(res.refundAmount));
}
});
return Number(num.toString()); //
}
return 0.00;
},
//
totalTotalOfActualReceipts() {
if (this.handoverList && this.handoverList.paymentAggregation) {
let num = new BigNumber(0);
this.handoverList.paymentAggregation.forEach(res => {
if (res.flag == "all") {
num = num.plus(new BigNumber(res.paidAmount));
}
});
return Number(num.toString()); //
}
return 0.00;
},
//
totalOilOrders() {
if (this.handoverList && this.handoverList.paymentAggregation) {
let num = new BigNumber(0);
this.handoverList.paymentAggregation.forEach(res => {
if (res.flag == "oil") {
num = num.plus(new BigNumber(res.paidAmount));
}
});
return Number(num.toString()); //
}
return 0.00;
},
//
totalOfProductOrders() {
if (this.handoverList && this.handoverList.paymentAggregation) {
let num = new BigNumber(0);
this.handoverList.paymentAggregation.forEach(res => {
if (res.flag == "goods") {
num = num.plus(new BigNumber(res.paidAmount));
}
});
return Number(num.toString()); //
}
return 0.00;
},
//
totalMemberStoredValue() {
if (this.handoverList && this.handoverList.paymentAggregation) {
let num = new BigNumber(0);
this.handoverList.paymentAggregation.forEach(res => {
if (res.flag == "card" || res.flag == "fuel") {
num = num.plus(new BigNumber(res.paidAmount));
}
});
return Number(num.toString()); //
}
return 0.00;
},
//
pointsMallStatistics() {
if (this.handoverList && this.handoverList.paymentAggregation) {
let num = new BigNumber(0);
this.handoverList.paymentAggregation.forEach(res => {
if (res.flag == "point") {
num = num.plus(new BigNumber(res.paidAmount));
}
});
return Number(num.toString()); //
}
return 0.00;
},
//
totalOilNumberStatistics() {
if (this.handoverList && this.handoverList.oilNumberStatistics) {
let num = new BigNumber(0);
this.handoverList.oilNumberStatistics.forEach(res=>{
num = num.plus(new BigNumber(res.paidAmount));
})
return Number(num.toString()); //
}
return 0;
},
//
discountStatisticsTotal() {
if (this.handoverList && this.handoverList.oilNumberStatistics) {
let num = new BigNumber(0);
this.handoverList.oilNumberStatistics.forEach(res=>{
num = num.plus(new BigNumber(res.paidDiscount));
})
return Number(num.toString()); //
}
return 0;
},
//
totalOfOilGunStatistics() {
if (this.handoverList && this.handoverList.greaseGunStatistics) {
let num = new BigNumber(0);
this.handoverList.greaseGunStatistics.forEach(res=>{
num = num.plus(new BigNumber(res.paidAmount));
})
return Number(num.toString()); //
}
return 0;
},
//
totalOfEmployeeStatistics() {
if (this.handoverList && this.handoverList.employeeStatistics) {
let num = new BigNumber(0);
this.handoverList.employeeStatistics.forEach(res=>{
num = num.plus(new BigNumber(res.paidAmount));
})
return Number(num.toString()); //
}
return 0;
},
//
statisticsOfAccountDetails(){
if (this.handoverList && this.handoverList.billingDetails) {
let num = new BigNumber(0);
this.handoverList.billingDetails.forEach(res=>{
num = num.plus(new BigNumber(res.amount));
})
return Number(num.toString()); //
}
return 0;
},
//
postedAccountReturnStatistics(){
if (this.handoverList && this.handoverList.returnedToTheAccount) {
let num = new BigNumber(0);
this.handoverList.returnedToTheAccount.forEach(res=>{
num = num.plus(new BigNumber(res.amount));
})
return Number(num.toString()); //
}
return 0;
}
}
}
</script>
<style scoped lang="scss">
.app-center{
width: 100%;
box-sizing: border-box;
padding: 10px;
}
.box-center{
width: 508px;
height: 85vh;
background-color: white;
margin: 10px auto;
box-sizing: border-box;
overflow: auto;
}
.box-ge{
border-bottom: 1px solid #ececec ;
box-sizing: border-box;
padding: 10px;
}
.box-title{
font-size: 18px;
text-align: center;
align-items: center;
margin-top: 15px;
}
.input-box{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.input-box-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
.input-hui{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #f7f7f7;
box-sizing: border-box;
padding: 5px 0px;
}
.input-hui-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #f7f7f7;
box-sizing: border-box;
padding: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
.boloicon{
font-weight: bold;
margin: 10px 0px;
}
.app-bottom{
position: fixed;
bottom: 0px;
height: 100px;
width: 90%;
}
.bottom-xz{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.anniu{
width: 100px;
height: 40px;
background: #00afff;
color: white;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
border-radius: 50px;
margin: 0px 15px;
cursor: pointer;
}
.anniu-lv{
background: #1ab394;
width: 100px;
height: 40px;
color: white;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
border-radius: 50px;
margin: 0px 15px;
cursor: pointer;
}
</style>

View File

@ -88,6 +88,36 @@
:default-sort="defaultSort">
<el-table-column label="油罐名称" align="center" prop="tankName"/>
<el-table-column label="油品名称" align="center" prop="numberName"/>
<el-table-column label="上次采购信息" align="center" prop="numberName">
<el-table-column label="采购总价" align="center" prop="theTotalPurchasePrice">
<template slot-scope="scope">
{{scope.row.theTotalPurchasePrice?scope.row.theTotalPurchasePrice:'--'}}
</template>
</el-table-column>
<el-table-column label="采购油量" align="center" prop="theAmountOfOilPurchased"/>
<el-table-column label="采购单价" align="center" prop="purchaseUnitPrice"/>
</el-table-column>
<el-table-column label="销售信息" align="center" prop="numberName">
<el-table-column label="销售总油量" align="center" prop="totalOilVolumeSold">
<template slot-scope="scope">
{{scope.row.totalOilVolumeSold?scope.row.totalOilVolumeSold:'--'}}
</template>
</el-table-column>
<!-- <el-table-column label="销售售出价" align="center" prop="numberName"/>-->
<el-table-column label="销售总价" align="center" prop="theTotalSalePrice">
<template slot-scope="scope">
{{scope.row.theTotalSalePrice?scope.row.theTotalSalePrice:'--'}}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="当前剩余油量" align="center" prop="currentInventoryVolume"/>
<el-table-column label="当前剩余油量总价" align="center" prop="totalPrice"/>
<el-table-column label="油品名称" align="center" prop="numberName"/>
<el-table-column label="当前均进价" align="center" prop="currentAveragePrice" />
<el-table-column label="当前库存升数(L)" align="center" prop="currentInventoryVolume"/>
<el-table-column label="盘点升数(L)" align="center" prop="inventoryVolume">

View File

@ -127,7 +127,7 @@
<el-form ref="form" :model="orderForm" :rules="rules" label-width="120px">
<el-row :gutter="24">
<el-col :span="22">
<el-form-item label="采购油品" prop="numberId">
<el-form-item label="采购油品" prop="numberId">
<el-select v-model="orderForm.numberId" placeholder="请选择油品" style="width:100%" @change="chooseOilNumber($event)">
<el-option
v-for="option in numberList"
@ -150,15 +150,8 @@
:value="option.id"
></el-option>
</el-select>
<!-- :title="'该油罐总容量'+tankVolume+unit+',可用约'+canUseVolume+unit+ '&#45;&#45; 可用约'+canUseT+'吨'"-->
<el-alert
v-if="orderForm.tankId"
style="height: 25px;line-height: 16px;"
:title='tTitle'
type="warning"
:closable="false">
</el-alert>
</el-form-item>
</el-col>
@ -180,9 +173,16 @@
<el-row :gutter="24">
<el-col :span="22">
<el-form-item label="油品密度" prop="productDensity">
<el-input v-model="orderForm.productDensity" placeholder="请输入油品密度" >
<el-input v-model="orderForm.productDensity" @input="aaa()" placeholder="请输入油品密度" >
<template slot="append">g/ml</template>
</el-input>
<el-alert
v-if="orderForm.tankId"
style="height: 25px;line-height: 16px;"
:title='tTitle'
type="warning"
:closable="false">
</el-alert>
</el-form-item>
</el-col>
</el-row>
@ -406,20 +406,27 @@ export default {
},
computed: {
tTitle() {
// return ""+this.tankVolume+' '+this.unit+"" + this.canUseVolume+' '+this.unit +"-- "+this.canUseT+""
return "油罐总容量"+this.tankVolume+' '+this.unit+"-- 可用约"+this.canUseT+"吨"
return "油罐总容量"+this.tankVolume+' '+this.unit+",当前密度下可用约"+this.canUseT+"吨"
}
},
methods: {
aaa() {
this.densityCalculations()
this.$forceUpdate();
console.log(" orderForm.productDensity()\n",this.orderForm.productDensity)
},
getList(){
this.loading = true;
getPurchaseOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.orderList = response.data.records;
this.total = response.data.total;
console.log("response",response.data.records[0].purchaseWeight)
console.log("orderList",this.orderList)
// console.log("response",response.data.records[0].purchaseWeight)
// console.log("orderList",this.orderList)
//
// this.sumMethod(response.data.records);
if (this.orderList) {
this.sumMethod(response.data.records);
}
})
this.loading = false;
},
@ -552,6 +559,9 @@ export default {
data.discountedPrice = new BigNumber(data.totalAmount).dividedBy(data.purchaseVolume).toFixed(2);
}
this.sumMethod(this.orderList)
//
// this.orderForm = data
// this.edit()
@ -580,12 +590,6 @@ export default {
this.nowVolume = su.storedQuantity
this.unit = su.unit
this.densityCalculations();
// tankVolume:'0', //
// nowVolume:'0', //
// canUseVolume:'0',//
// canUseT:'0',//
// unit:'L',//
//
}
})
},
@ -594,7 +598,7 @@ export default {
this.canUseVolume = this.tankVolume - this.nowVolume
//
const volumeLiters = new BigNumber(this.canUseVolume); //
const densityGramsPerML = new BigNumber(this.orderForm.productDensity); // /
const densityGramsPerML = new BigNumber(this.orderForm.productDensity?this.orderForm.productDensity:0); // /
//
@ -602,7 +606,6 @@ export default {
const massTons = Math.floor(volumeLiters.times(densityGramsPerML).times(1e-3) * 100) / 100;
this.canUseT = massTons; //
// console.log("canUseT",this.tankVolume)
console.log("canUseT",this.canUseT)
},
@ -612,7 +615,7 @@ export default {
return
}
if (!this.canUseT) {
this.$message('请先选择油罐');
this.$message('请先选择油罐和填写密度');
this.orderForm.purchaseWeight = ''
return
}

View File

@ -279,7 +279,7 @@
<el-col :span="10">
<el-form-item label="时间范围">
<el-date-picker
v-model="ruleForm.timeFrame"
v-model="timeFrame"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
@ -313,7 +313,7 @@
<el-row v-if="ruleForm.deptType === '3'">
<el-form-item label="时间范围">
<el-date-picker
v-model="ruleForm.turnoverTime"
v-model="timeFrame"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
@ -820,7 +820,6 @@ export default {
this.ruleForm.turnoverStartTime = this.timeFrame[0]
this.ruleForm.turnoverEndTime = this.timeFrame[1]
}
deptadd(this.ruleForm).then(res=>{
if(res.code == 200){
this.$message({
@ -842,6 +841,11 @@ export default {
this.$refs[ruleForm].validate((valid) => {
if (valid) {
if (this.timeFrame){
this.ruleForm.turnoverStartTime = this.timeFrame[0]
this.ruleForm.turnoverEndTime = this.timeFrame[1]
}
deptedit(this.ruleForm).then(res=>{
// console.log(res)
if(res.code == 200){
@ -930,11 +934,21 @@ export default {
// this.ruleForm.leaderPhone = res.data.leaderPhone
// this.ruleForm.turnoverType = res.data.turnoverType
// this.ruleForm.turnoverType = res.data.turnoverType
if(res.data.status == 'qy'){
this.value10 = true
}else {
this.value10 = false
}
if (this.ruleForm.turnoverStartTime) {
const date = new Date(this.ruleForm.turnoverStartTime);
this.timeFrame[0] = date.toString();
}
if (this.ruleForm.turnoverEndTime) {
const date = new Date(this.ruleForm.turnoverEndTime);
this.timeFrame[1] = date.toString();
}
if(res.data.status == 'qy'){
this.value10 = true
}else {
this.value10 = false
}
let temp = ancestors.split(',')
this.cascader = []

View File

@ -340,3 +340,11 @@ export default {
}
};
</script>
<style scoped>
.app-container{
width: 100%;
height: 100%;
//background: #f6f8f9;
}
</style>

View File

@ -51,5 +51,6 @@ public class MtInventoryDetails extends BaseEntity {
* 店铺ID
*/
private Integer storeId;
private Integer damageQuantity;
}

View File

@ -45,7 +45,7 @@ public interface MtPurchaseDetailsMapper {
List<MtPurchaseDetailsExcel> getListByExcel(@Param("mtPurchaseDetails") MtPurchaseDetails mtPurchaseDetails);
int editGoods(MtPurchaseDetailsVO mtPurchaseDetails);
int editGoods(MtPurchaseDetailsVO mtPurchaseDetails);
/**
* 统计总行数
*
@ -97,5 +97,6 @@ public interface MtPurchaseDetailsMapper {
*/
int deleteById(Integer id);
MtPurchaseDetailsVO getIncomingGoodsData(Integer goodsId);
}

View File

@ -127,6 +127,7 @@
md.inventory_discrepancy inventoryDiscrepancy,
md.inventory_quantity inventoryQuantity,
md.purchase_price purchasePrice,
md.damage_quantity damageQuantity,
mg.name commodityName,
mg.goods_no goodsNo,
mg.cvs_good_id cvsGoodId,
@ -214,10 +215,10 @@
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_inventory_details(goods_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by)
insert into mt_inventory_details(goods_id, inventory_id, purchase_price, stock, profit_loss_amount, inventory_discrepancy, inventory_quantity, store_id, create_time, update_time, create_by, update_by,damage_quantity)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.goodsId}, #{entity.inventoryId}, #{entity.purchasePrice}, #{entity.stock}, #{entity.profitLossAmount}, #{entity.inventoryDiscrepancy}, #{entity.inventoryQuantity}, #{entity.storeId},NOW(), NOW(), #{entity.createBy}, #{entity.updateBy})
(#{entity.goodsId}, #{entity.inventoryId}, #{entity.purchasePrice}, #{entity.stock}, #{entity.profitLossAmount}, #{entity.inventoryDiscrepancy}, #{entity.inventoryQuantity}, #{entity.storeId},NOW(), NOW(), #{entity.createBy}, #{entity.updateBy},#{entity.damageQuantity})
</foreach>
</insert>
@ -325,6 +326,9 @@
<if test="user.updateBy != null">
update_by = #{user.updateBy},
</if>
<if test="user.damageQuantity != null">
damage_quantity = #{user.damageQuantity},
</if>
</set>
where id = #{user.id}
</foreach>

View File

@ -182,6 +182,14 @@
purchase_id = #{mtPurchaseDetails.purchaseId}
</select>
<select id="getIncomingGoodsData" resultMap="MtPurchaseDetailsMap">
select opo.*,
op.update_time updateTime
from mt_purchase_details opo
left join mt_purchase op ON opo.purchase_id = op.id
where op.status = 'qrts' and opo.goods_id = #{goodsId}
order by op.update_time DESC limit 1
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
@ -300,8 +308,9 @@
<update id="editGoods">
update mt_goods set
stock = stock + #{quantityPurchased} ,
update_time = NOW()
stock = stock + #{quantityPurchased},
update_time = NOW(),
buying_price = #{unitPrice}
where id = #{goodsId}
</update>

View File

@ -66,4 +66,8 @@ public interface MtPurchaseDetailsService {
void export(HttpServletResponse response, MtPurchaseDetails mtPurchaseDetails);
/**
* 根据商品id获取上次的进货数据
*/
MtPurchaseDetails getIncomingGoodsData(Integer goodsId);
}

View File

@ -1,5 +1,6 @@
package com.fuint.business.convenienceSore.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -7,16 +8,27 @@ import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.mapper.MtInventoryDetailsMapper;
import com.fuint.business.convenienceSore.service.MtInventoryDetailsService;
import com.fuint.business.convenienceSore.service.MtPurchaseDetailsService;
import com.fuint.business.convenienceSore.vo.MtInventoryDetailsVO;
import com.fuint.business.convenienceSore.vo.excel.MtInventoryDetailsExcel;
import com.fuint.business.convenienceSore.vo.excel.MtPurchaseDetailsExcel;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.entity.IntegralGift;
import com.fuint.business.integral.entity.IntegralOrders;
import com.fuint.business.integral.service.IntegralDetailService;
import com.fuint.business.integral.service.IntegralGiftService;
import com.fuint.business.integral.service.IntegralOrdersService;
import com.fuint.business.order.entity.LJOrder;
import com.fuint.business.order.service.LJOrderService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.repository.model.MtOrder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -57,12 +69,49 @@ public class MtInventoryDetailsServiceImpl implements MtInventoryDetailsService
return MtInventoryDetailsIPage;
}
@Resource
MtPurchaseDetailsService mtPurchaseDetailsService;
@Resource
LJOrderService ljOrderService;
@Resource
IntegralOrdersService integralOrdersService;
@Resource
IntegralGiftService integralGiftService;
@Override
public IPage<MtInventoryDetailsVO> getListByPage(Page page, MtInventoryDetails mtInventoryDetails) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtInventoryDetails.setStoreId(storeId);
IPage<MtInventoryDetailsVO> MtInventoryDetailsIPage = mtInventoryDetailsDao.getListByPage(page, mtInventoryDetails);
for (MtInventoryDetailsVO record : MtInventoryDetailsIPage.getRecords()) {
Date queryTime = new Date();
// 查询进货数据
MtPurchaseDetails incomingGoodsData = mtPurchaseDetailsService.getIncomingGoodsData(record.getGoodsId());
if (ObjectUtil.isNotEmpty(incomingGoodsData)) {
record.setPurchase(incomingGoodsData.getQuantityPurchased().toString());
queryTime = incomingGoodsData.getUpdateTime();
}
// 查询销售数据
LJOrder statisticsByTime = ljOrderService.getStatisticsByTime(queryTime, record.getGoodsId());
// 查询积分兑换数据
IntegralOrders statisticsByTime1 = integralOrdersService.getStatisticsByTime(queryTime, record.getGoodsId());
// 查询积分商品库存
IntegralGift stockByGoodsId = integralGiftService.getStockByGoodsId(record.getGoodsId());
if (ObjectUtil.isNotEmpty(statisticsByTime)) {
record.setGoodsSales(statisticsByTime.getGoodsNum().toString());
}
if (ObjectUtil.isNotEmpty(statisticsByTime1)) {
record.setInventorySales(statisticsByTime1.getExchangeQuantity().toString());
}
if (ObjectUtil.isNotEmpty(stockByGoodsId)) {
record.setStock(record.getStock()+stockByGoodsId.getRemainingInventory());
}
}
return MtInventoryDetailsIPage;
}

View File

@ -174,6 +174,18 @@ public class MtInventoryServiceImpl implements MtInventoryService {
stockTrack.setChangeNumber(mtReturnsDetailsVO.getInventoryDiscrepancy().intValue());
stockTrack.setOddNumber(mtReturnsDetailsVO.getOrderNumber());
stockService.insertStockTrack(stockTrack);
//添加货损出库的数据
if (mtReturnsDetailsVO.getDamageQuantity()>0) {
stockTrack = new StockTrack();
stockTrack.setStockId(stockStatistic.getId());
stockTrack.setStoreId(nowAccountInfo.getStoreId());
stockTrack.setDocument("商品货损");
stockTrack.setChangeNumber(-mtReturnsDetailsVO.getDamageQuantity().intValue());
stockTrack.setOddNumber(mtReturnsDetailsVO.getOrderNumber());
stockService.insertStockTrack(stockTrack);
}
}
}
String status = "qrts";

View File

@ -163,4 +163,16 @@ public class MtPurchaseDetailsServiceImpl implements MtPurchaseDetailsService {
throw new RuntimeException(e);
}
}
/**
* 获取上次进货数据
* @param goodsId
* @return
*/
@Override
public MtPurchaseDetails getIncomingGoodsData(Integer goodsId) {
mtPurchaseDetailsDao.getIncomingGoodsData(goodsId);
return null;
}
}

View File

@ -1,18 +1,18 @@
package com.fuint.business.convenienceSore.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.dto.MtPurchaseDto;
import com.fuint.business.convenienceSore.entity.*;
import com.fuint.business.convenienceSore.mapper.MtPurchaseDetailsMapper;
import com.fuint.business.convenienceSore.mapper.MtPurchaseMapper;
import com.fuint.business.convenienceSore.service.MtPurchaseService;
import com.fuint.business.convenienceSore.service.StockStatisticService;
import com.fuint.business.convenienceSore.service.StockTrackService;
import com.fuint.business.convenienceSore.service.SupplierService;
import com.fuint.business.convenienceSore.service.*;
import com.fuint.business.convenienceSore.vo.MtPurchaseDetailsVO;
import com.fuint.business.convenienceSore.vo.MtPurchaseVO;
import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.order.entity.LJOrder;
import com.fuint.business.order.service.LJOrderService;
import com.fuint.business.petrolStationManagement.entity.OilInventory;
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
import com.fuint.business.petrolStationManagement.entity.OilTank;
@ -182,6 +182,9 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
return false;
}
@Resource
LJGoodsService ljGoodsService;
@Override
@Transactional(rollbackFor = Exception.class)
public boolean storage(Integer id) {
@ -195,6 +198,29 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
mtPurchaseDetails.setStoreId(nowAccountInfo.getStoreId());
List<MtPurchaseDetailsVO> allList2 = detailsMapper.getAllList2(mtPurchaseDetails);
for (MtPurchaseDetailsVO mtPurchaseDetailsVO : allList2) {
// 查询商品数据
LJGoods byId = ljGoodsService.getById(mtPurchaseDetailsVO.getGoodsId());
Double unitPrice = mtPurchaseDetailsVO.getUnitPrice();
// 计算单价
if (ObjectUtil.isNotEmpty(byId.getBuyingPrice()) && byId.getBuyingPrice()>0 && byId.getStock() > 0){
BigDecimal priceBig = new BigDecimal(byId.getBuyingPrice());
BigDecimal stockBig = new BigDecimal(byId.getStock());
BigDecimal resSum = priceBig.multiply(stockBig);
// 进货的数据
BigDecimal nowSumBig = new BigDecimal(mtPurchaseDetailsVO.getSubtotalAmount());
BigDecimal sumBig=resSum.add(nowSumBig);
// 计算总库存
BigDecimal sumStock = stockBig.add(new BigDecimal(mtPurchaseDetailsVO.getQuantityPurchased().toString()));
unitPrice = Double.parseDouble( sumBig.divide(sumStock).toString());
}
//获取原总价
mtPurchaseDetailsVO.setUnitPrice(unitPrice);
// 修改库存
int i = detailsMapper.editGoods(mtPurchaseDetailsVO);
if (i>0) {
@ -209,7 +235,7 @@ public class MtPurchaseServiceImpl implements MtPurchaseService {
stockService.insertStockTrack(stockTrack);
}
}
// 2.将数据填充到油罐里面
// 2.将数据填充到
String status = "qrts";
boolean edit = edit(id);
int i = mtPurchaseDao.editStateById(id, status);

View File

@ -16,4 +16,12 @@ public class MtInventoryDetailsVO extends MtInventoryDetails {
* 业务单号
*/
private String orderNumber;
// 上次进货量
private String purchase;
// 便利店销售量
private String goodsSales;
// 积分商品兑换量
private String inventorySales;
}

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.integral.entity.IntegralDetail;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.Date;
import java.util.List;
/**

View File

@ -88,5 +88,6 @@ public interface IntegralGiftMapper {
int updateInventoryByLock(@Param("id") Integer id,@Param("editInventory") Integer editInventory);
IntegralGift getStockByGoodsId(Integer goodsId);
}

View File

@ -3,6 +3,7 @@ package com.fuint.business.integral.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.integral.dto.IntegralOrdersDTO;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.entity.IntegralGift;
import com.fuint.business.integral.entity.IntegralOrders;
import com.fuint.business.integral.vo.IntegralGiftVO;
@ -10,6 +11,8 @@ import com.fuint.business.integral.vo.IntegralOrdersVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -112,5 +115,9 @@ public interface IntegralOrdersMapper {
* @return
*/
IntegralOrders queryIntegralOrdersByOrderNo(@Param("orderNumber") String orderNo,@Param("storeId") Integer storeId);
IntegralOrders getStatisticsByTime(@Param("time") Date time, @Param("goodsId") Integer goodsId);
}

View File

@ -246,6 +246,13 @@
</if>
</where>
</select>
<select id="getStockByGoodsId" resultType="com.fuint.business.integral.entity.IntegralGift">
select
sum(remaining_inventory) remainingInventory
from integral_gift
where gift_type = '实物商品'
and goods_id = #{goodsId}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">

View File

@ -453,5 +453,21 @@
</if>
</select>
<select id="getStatisticsByTime" resultType="com.fuint.business.integral.entity.IntegralOrders">
select
SUM(exchange_quantity) exchangeQuantity
from integral_orders io
left join integral_gift ig ON io.gift_id = ig.id
where
ig.gift_type = '实物商品'
and ig.goods_id = #{goodsId}
and io.order_status = '已完成'
<if test="time != null"><!-- 开始时间检索 -->
and io.create_time &gt;= #{time}
</if>
</select>
</mapper>

View File

@ -3,8 +3,11 @@ package com.fuint.business.integral.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.order.entity.LJOrder;
import io.lettuce.core.dynamic.annotation.Param;
import java.util.Date;
/**
* 积分明细表(IntegralDetail)表服务接口
@ -65,4 +68,5 @@ public interface IntegralDetailService {
*/
boolean deleteById(Integer id);
}

View File

@ -73,4 +73,9 @@ public interface IntegralGiftService {
boolean updateInventoryByLock(@Param("id") Integer id,@Param("editInventory") Integer editInventory);
/**
* 根据商品id查询库存
*/
IntegralGift getStockByGoodsId(Integer goodsId);
}

View File

@ -3,12 +3,14 @@ package com.fuint.business.integral.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.integral.dto.IntegralOrdersDTO;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.entity.IntegralOrders;
import com.fuint.business.integral.vo.IntegralOrdersRequest;
import com.fuint.business.integral.vo.IntegralOrdersVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -98,4 +100,7 @@ public interface IntegralOrdersService {
*/
IntegralOrders queryIntegralOrdersByOrderNo(String orderNo,Integer storeId);
IntegralOrders getStatisticsByTime(Date time, Integer goodsId);
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.mapper.IntegralDetailMapper;
import com.fuint.business.integral.service.IntegralDetailService;
import com.fuint.business.order.entity.LJOrder;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
@ -13,6 +14,7 @@ import com.fuint.common.dto.AccountInfo;
import javax.annotation.Resource;
import java.util.Date;
/**
* 积分明细表(IntegralDetail)表服务实现类
@ -109,4 +111,6 @@ public class IntegralDetailServiceImpl implements IntegralDetailService {
public boolean deleteById(Integer id) {
return this.integralDetailMapper.deleteById(id) > 0;
}
}

View File

@ -3,8 +3,13 @@ package com.fuint.business.integral.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.dto.LJGoodsDto;
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.integral.entity.IntegralGift;
import com.fuint.business.integral.entity.IntegralGiftCategory;
import com.fuint.business.integral.mapper.IntegralGiftMapper;
@ -18,8 +23,10 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -75,6 +82,14 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
return integralGiftVOIPage;
}
@Resource
LJGoodsService ljGoodsService;
@Autowired
private StockStatisticService stockService;
@Autowired
private StockTrackService trackService;
/**
* 新增数据
*
@ -82,15 +97,48 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
* @return 实例对象
*/
@Override
@Transactional
public IntegralGift insert(IntegralGift integralGift) {
determineTheInventoryOfTheProduct(integralGift);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
integralGift.setStoreId(nowAccountInfo.getStoreId());
integralGift.setCreateBy(nowAccountInfo.getStaffId().toString());
// 增加库存时 从商品拿库存
if ("实物商品".equals(integralGift.getGiftType()) && integralGift.getTotalInventory() > 0) {
ljGoodsService.subtractGoodesStockByLock(integralGift.getGoodsId(),integralGift.getTotalInventory());
// 添加统计信息
addStockStatistic(integralGift);
// 增加库存跟踪信息
addStockTrack(integralGift);
}
this.integralGiftDao.insert(integralGift);
return integralGift;
}
public boolean addStockStatistic(IntegralGift integralGift) {
StockStatistic stock = new StockStatistic();
stock.setGoodsId(integralGift.getGoodsId());
LJGoods byId = ljGoodsService.getById(integralGift.getGoodsId());
stock.setCostAmount(byId.getBuyingPrice());
int i = stockService.editStockCostAmount(stock);
return i>0;
}
public boolean addStockTrack(IntegralGift integralGift) {
StockStatistic stockStatistic = stockService.selectStockByGoodsId(integralGift.getGoodsId());
StockTrack stockTrack = new StockTrack();
stockTrack.setStockId(stockStatistic.getId());
stockTrack.setStoreId(integralGift.getStoreId());
stockTrack.setDocument("增加积分商品兑换");
stockTrack.setChangeNumber(-integralGift.getTotalInventory());
int i = trackService.insertStockTrack(stockTrack);
return i>0;
}
/**
* 修改数据
*
@ -105,8 +153,6 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
return this.queryById(integralGift.getId());
}
@Resource
LJGoodsService ljGoodsService;
/**
* 判断商品库存是否足够
*/
@ -154,7 +200,7 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
*/
@Override
public boolean updateInventoryByLock(@Param("id") Integer id,@Param("editInventory") Integer editInventory) {
// 根据油罐id加锁 同一时间只能
// 根据id加锁 同一时间只能
String lockKey = "integralGift-"+id;
Boolean isLock = redisLock.tryLock(lockKey,500,5000, TimeUnit.MILLISECONDS);
if (isLock) {
@ -169,4 +215,11 @@ public class IntegralGiftServiceImpl implements IntegralGiftService {
}
return true;
}
@Override
public IntegralGift getStockByGoodsId(Integer goodsId) {
integralGiftDao.getStockByGoodsId(goodsId);
return null;
}
}

View File

@ -183,12 +183,11 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
}
// 插入订单
List<IntegralOrders> integralOrdersList1 = integralOrdersList.getIntegralOrdersList();
if (integralOrdersList1.size() < 0) throw new RuntimeException("未选择兑换商品");
// 当积分兑换为商品是需要判断库存是否足够
if (integralOrdersList1.size() < 0) return null;
// todo 判断积分商城库存是否足够
// 当不足时直接返回错误
String status = "unpaid";
// 添加储存充值
@ -214,8 +213,6 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
integralOrders.setStatus(status);
integralOrders.setOrderType("1"); // 设置交易类型
integralOrders.setChainStoreId(nowAccountInfo.getChainStoreId()); // 设置交易类型
}
integralOrdersDao.insertBatch(integralOrdersList.getIntegralOrdersList());
@ -365,12 +362,12 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
cardFavorableRecordService.addCardFavorableRecord(cardFavorableRecord);
}else if(integralGift.getGiftType().equals("实物商品")) {
// 修改商品库存并增加记录
LJGoodsDto goods = new LJGoodsDto();
goods.setId(integralGift.getGoodsId());
goods.setDocument("积分兑换");
goods.setNumberOfChanges(-integralOrders.getExchangeQuantity());
goods.setGoodsNo(integralOrders.getOrderNumber());
ljGoodsService.editGoodsInventory(goods);
// LJGoodsDto goods = new LJGoodsDto();
// goods.setId(integralGift.getGoodsId());
// goods.setDocument("积分兑换");
// goods.setNumberOfChanges(-integralOrders.getExchangeQuantity());
// goods.setGoodsNo(integralOrders.getOrderNumber());
// ljGoodsService.editGoodsInventory(goods);
}
// 处理积分库存
@ -456,10 +453,6 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
return applet;
}
// 判断是否达到最高的商品领取上线
//1根据商品id查询
// enquiryForCollection();
//2.
// 插入订单
List<IntegralOrders> integralOrdersList1 = integralOrdersList.getIntegralOrdersList();
@ -585,4 +578,9 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
public IntegralOrders queryIntegralOrdersByOrderNo(String orderNo,Integer storeId) {
return integralOrdersDao.queryIntegralOrdersByOrderNo(orderNo,storeId);
}
@Override
public IntegralOrders getStatisticsByTime(Date time, Integer goodsId) {
return integralOrdersDao.getStatisticsByTime(time, goodsId);
}
}

View File

@ -8,6 +8,7 @@ import com.fuint.business.order.vo.Excel.LJOrderExcel;
import com.fuint.business.order.vo.LJOrderVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -35,4 +36,5 @@ public interface LJOrderMapper extends BaseMapper<LJOrder> {
Map<String, String> orderStatistics(@Param("order") LJOrder order);
LJOrder getStatisticsByTime(@Param("time") Date time,@Param("goodsId") Integer goodsId);
}

View File

@ -195,6 +195,17 @@
</if>
</where>
</select>
<select id="getStatisticsByTime" resultType="com.fuint.business.order.entity.LJOrder">
select
SUM(mog.num) goodsNum
from mt_order mo
left join mt_order_goods mog ON mo.id = mog.goods_id
where
mog.goods_id = #{goodsId}
<if test="time != null"><!-- 开始时间检索 -->
and mo.create_time &gt;= #{time}
</if>
</select>
</mapper>

View File

@ -549,13 +549,13 @@
SUM(pay_amount) + SUM(balance_amount) + SUM(oil_card_amount) payAmount
from oil_order
<where>
<if test="time != null'"><!-- 开始时间检索 -->
and date_format(update_time),'%y%m%d') &gt;= date_format(#{time},'%y%m%d')
<if test="time != null"><!-- 开始时间检索 -->
and update_time &gt;= #{time}
</if>
<if test="list != null and list != ''">
<if test="list != null and list.size() > 0"><!-- 修改此处 -->
and tank_id in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{list.tankId}
#{item.tankId} <!-- 修改此处 -->
</foreach>
</if>
</where>

View File

@ -8,6 +8,7 @@ import com.fuint.business.order.vo.LJOrderVo;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.Map;
/**
@ -58,4 +59,6 @@ public interface LJOrderService extends IService<LJOrder> {
public int updateGoodOrder(LJOrder order);
Map<String, String> orderStatistics(LJOrder order);
LJOrder getStatisticsByTime(Date time ,Integer goodsId);
}

View File

@ -152,7 +152,7 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
@Transactional
public int refund(Map<String, String> map) {
Map<String, String> refund = new HashMap<>();
try {
// try {
AllOrderInfo allOrderInfo = selectAllOrderInfoByOrderNo(map.get("orderNo"));
if (ObjectUtil.isEmpty(map.get("type"))) {
@ -182,14 +182,18 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
map.putAll(getMerchantConfig(allOrderInfo));
}else {
throw new Exception("退款失败,无退款金额");
throw new RuntimeException("退款失败,无退款金额");
}
} else {
throw new RuntimeException("该订单类型不支持退款!");
}
boolean flag = false;
if (!"CASH".equals(allOrderInfo.getPayType())) {
refund = fyPayService.refund(map);
try {
refund = fyPayService.refund(map);
} catch (Exception e) {
throw new RuntimeException(e);
}
}else {
// 现金退款处理
refund.put("result_msg","SUCCESS");
@ -236,10 +240,11 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
throw new RuntimeException("退款失败,请联系管理员! 失败原因:"+refund.get("result_msg"));
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("退款失败!");
}
// }
// catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("退款失败!");
// }
log.info("refund{}",refund);
return 0;
@ -289,6 +294,15 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper,AllO
oilTracking.setTankId(oilGun.getTankId());
oilTracking.setOrderNumber(refundOrderNo);
OilTracking insert = oilTrackingService.insert(oilTracking);
// 处理储值卡
// if (ObjectUtil.isNotEmpty()) {}
// 处理屯油卡
// if (ObjectUtil.isNotEmpty()) {}
// 处理优惠券
// if (ObjectUtil.isNotEmpty()) {}
}
}

View File

@ -15,6 +15,7 @@ import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -103,4 +104,10 @@ public class LJOrderServiceImpl extends ServiceImpl<LJOrderMapper, LJOrder> impl
order.setStoreId(nowAccountInfo.getStoreId());
return baseMapper.orderStatistics(order);
}
@Override
public LJOrder getStatisticsByTime(Date time, Integer goodsId) {
return baseMapper.getStatisticsByTime(time, goodsId);
}
}

View File

@ -96,7 +96,7 @@
<script>
import {getHandoverListApi,printLocallyApi} from "@/api/cashier/handover";
import {getOrderApi,getStatisticsApi } from "@/api/cashier/integralOrder/order";
import {getStatisticsApi } from "@/api/cashier/integralOrder/order";
import Detail from '@/views/cashier/NewComponents/integralOrder/detail'
import {getDicts} from "@/api/dict/data";
import HandoverOnly from "@/views/cashier/NewComponents/HandoverOnly";

View File

@ -541,22 +541,22 @@ import {getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/u
},
//
async addGift(data) {
if (data.giftType === "实物商品") {
//()
let stock = 1;
if (data.markPurchases) {
stock = data.markPurchases+1
}
await getDetermineTheInventoryOfTheProductApi({id:data.goodsId,
stock:stock}).then(res=> {
if (!res.data) {
// data.markPurchases = data.markPurchases-1
this.$message.error('该商品库存不足');
return
}
})
}
// if (data.giftType === "") {
// //()
//
// let stock = 1;
// if (data.markPurchases) {
// stock = data.markPurchases+1
// }
// await getDetermineTheInventoryOfTheProductApi({id:data.goodsId,
// stock:stock}).then(res=> {
// if (!res.data) {
// // data.markPurchases = data.markPurchases-1
// this.$message.error('');
// return
// }
// })
// }

View File

@ -193,6 +193,14 @@
</div>
<div class="tk">退款金额</div>
<div class="tk">退款单号{{ goods.orderNo }}</div>
<el-input placeholder="请输入退款金额" v-model="refundRemark"></el-input>
<br>
<div>使用的优惠项</div>
<el-checkbox>备选项</el-checkbox>
<el-checkbox>备选项</el-checkbox>
<div style="margin: 10px 0">
退款原因<br/>
<el-radio-group v-model="radio1" style="margin: 10px 0">
@ -475,20 +483,21 @@ export default {
}
}
});
this.dialogRefund = true;
this.$confirm(title+', 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.dialogRefund = true;
}).catch(() => {
this.$message({
type: 'info',
message: '已取消退款'
});
this.dialogRefund = false;
});
// this.$confirm(title+', ?', '', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning'
// }).then(() => {
// this.dialogRefund = true;
// }).catch(() => {
// this.$message({
// type: 'info',
// message: '退'
// });
// this.dialogRefund = false;
// });
},
// 退
@ -500,6 +509,7 @@ export default {
orderNo: this.goods.orderNo,
storeId: this.goods.storeId,
refundRemark:this.radio1 +"-"+ this.refundRemark,
// refAmount: this.
type: "canRefund"
}
await refundApi(map).then(res=>{
@ -658,6 +668,10 @@ export default {
.top-app-sou{
width: 20%;
}
.tk{
text-align: center;
color: grey;
margin: 10px 0;
}
</style>

View File

@ -247,8 +247,15 @@
<div style="text-align: center;font-weight: bold">
<span style="font-size: 35px">{{ oilOrder.payAmount }}</span>
</div>
<div class="tk">退款金额</div>
<div class="tk">订单金额</div>
<div class="tk">退款单号{{ oilOrder.orderNo }}</div>
<!-- <el-input placeholder="请输入退款金额" v-model="refundRemark"></el-input>-->
<!-- 是否推掉优惠券-->
<br>
<span>是否退掉优惠券: </span>
<el-checkbox>优惠卷信息</el-checkbox>
<div style="margin: 10px 0">
退款原因<br/>
<el-radio-group v-model="radio1" style="margin: 10px 0">
@ -557,7 +564,8 @@
orderNo: this.oilOrder.orderNo,
storeId: this.oilOrder.storeId,
refundRemark:this.radio1 +"-"+ this.refundRemark,
type: "canRefund"
type: "canRefund",
refType: "oilOrder",
}
await refundApi(map).then(res=>{
this.$message({