123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <PermissionContainer
- :jiBieArr=[2]
- :tipArr="[,'班结只对站点级别开放','',,'',]"
- >
- <div>
- <el-form
- :model="queryParams"
- ref="queryForm"
- :inline="true"
- label-width="68px"
- >
- <el-form-item prop="carNumber"
- >开班时间:{{ opo.startDate }} 班结人:{{ opo.classStructureMan }}
- </el-form-item>
- <el-form-item>
- <el-button
- icon="el-icon-plus"
- type="primary"
- v-if="isclose"
- size="mini"
- @click="handleAdd"
- >添加班结</el-button
- >
- </el-form-item>
- </el-form>
- <!--按员工汇总-->
- <span style="color: #ff9955; font-size: 25px">|</span
- ><span style="font-size: 25px">按员工汇总</span>
- <el-table show-summary :data="structureList" :summary-method="getTotal">
- <el-table-column label="员工姓名" align="center" prop="oilPersonnel" />
- <el-table-column label="负责枪号" align="center" prop="oilGun" />
- <el-table-column label="销量" align="center" prop="orderLiters" />
- <el-table-column label="销额" align="center" prop="amt" />
- <el-table-column label="销售笔数" align="center" prop="orderNo" />
- </el-table>
- <!--按油品汇总-->
- <span style="color: #ff9955; font-size: 25px; padding-top: 15px">|</span
- ><span style="font-size: 25px">按油品汇总</span>
- <el-table :data="structureList1" show-summary :summary-method="getTotal2">
- <el-table-column label="油品" align="center" prop="oilName" />
- <el-table-column label="负责枪号" align="center" prop="oilGun" />
- <el-table-column label="销量" align="center" prop="orderLiters" />
- <el-table-column label="销额" align="center" prop="amt" />
- <el-table-column label="销售笔数" align="center" prop="orderNo" />
- </el-table>
- <!--按员工/支付方式汇总: -->
- <span style="color: #ff9955; font-size: 25px; padding-top: 15px">|</span
- ><span style="font-size: 25px">按员工/支付方式汇总</span>
- <el-table :data="structureList3" show-summary :summary-method="getTotal3">
- <el-table-column label="员工姓名" align="center" prop="oilPersonnel" />
- <el-table-column label="负责枪号" align="center" prop="oilGun" />
- <el-table-column label="微信笔数" align="center" prop="wxNum" />
- <el-table-column label="支付宝笔数" align="center" prop="zfbNum" />
- <el-table-column label="现金笔数" align="center" prop="xjNum" />
- <el-table-column label="优惠" align="center" prop="discountAmt" />
- <el-table-column label="优惠劵" align="center" prop="discountCouponAmt" />
- <el-table-column label="微信金额" align="center" prop="wxAmt" />
- <el-table-column label="支付宝金额" align="center" prop="zfbAmt" />
- <el-table-column label="现金金额" align="center" prop="xjAmt" />
- <el-table-column label="会员卡支付" align="center" prop="dzkAmt" />
- </el-table>
- <!-- 添加或修改班结管理对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <span>请确认当前时间没有车主正在使用系统支付</span>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </PermissionContainer>
- </template>
- <script>
- import {
- listPersonnelPayStructure,
- listClass,
- getAgeClassStructure,
- listPersonnelStructure,
- listOilStructure,
- addStructure,
- getPayOrderInfoMin,
- selectPersonnelStructure,
- selectPersonnelPayStructure,
- selectOilStructure,
- } from "@/api/station/structure";
- export default {
- name: "Station_Accounting",
- data() {
- return {
- // 班结管理表格数据
- structureList: [],
- structureList1: [],
- structureList3: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- //是否显示班结
- isclose: true,
- // 查询参数
- queryParams: {},
- stationOptions: [],
- opo: {
- classStructureMan: null,
- startDate: null,
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {},
- pageStatus: 0
- };
- },
- created() {
- // 查询班结数据
- this.getStructure();
- this.initFromOrder();
- },
- methods: {
- async getStructure() {
- this.opo.classStructureMan = this.$store.state.user.name;
- const structureRes = await getAgeClassStructure();
- if (!structureRes.data) {
- // 油站第一次班结
- const PayOrderRes = await getPayOrderInfoMin();
- if(PayOrderRes.data==null){
- this.opo.startDate ="";
- }else{
- this.opo.startDate = PayOrderRes.data.createdDate;
- }
- this.opo = {
- ...this.opo,
- startDate: PayOrderRes.data.createdDate,
- };
- return;
- } else {
- // 油站之前班结过
- this.opo.startDate = structureRes.data.classStructureDate;
- this.opo = {
- ...this.opo,
- startDate: structureRes.data.classStructureDate,
- };
- return;
- }
- },
- initFromOrder() {
- selectPersonnelStructure().then((response) => {
- this.structureList = response.rows;
- });
- selectOilStructure().then((response) => {
- this.structureList1 = response.rows;
- });
- selectPersonnelPayStructure().then((response) => {
- this.structureList3 = response.rows;
- });
- },
- /** 查询班结管理列表 */
- getList() {
- listPersonnelStructure(this.queryParams).then((response) => {
- this.structureList = response.rows;
- });
- listOilStructure(this.queryParams).then((response) => {
- this.structureList1 = response.rows;
- });
- listPersonnelPayStructure(this.queryParams).then((response) => {
- this.structureList3 = response.rows;
- });
- },
- getTotal(param) {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "合计";
- return;
- }
- const values = data.map((item) => Number(item[column.property]));
- if (column.property === "orderLiters") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "amt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "orderNo") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(0);
- } else {
- sums[index] = "";
- }
- });
- return sums;
- },
- getTotal2(param) {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "合计";
- return;
- }
- const values = data.map((item) => Number(item[column.property]));
- if (column.property === "orderLiters") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "amt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "orderNo") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(0);
- } else {
- sums[index] = "";
- }
- });
- return sums;
- },
- getTotal3(param) {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "合计";
- return;
- }
- const values = data.map((item) => Number(item[column.property]));
- if (column.property === "wxNum") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(0);
- } else if (column.property === "zfbNum") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(0);
- } else if (column.property === "xjNum") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(0);
- } else if (column.property === "discountAmt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "discountCouponAmt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "wxAmt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "zfbAmt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "xjAmt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else if (column.property === "dzkAmt") {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] = sums[index].toFixed(2);
- } else {
- sums[index] = "";
- }
- });
- return sums;
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- stationId: null,
- stationName: null,
- person: null,
- gunNo: null,
- salesVolume: null,
- salesAmount: null,
- discount: null,
- coupon: null,
- netReceipts: null,
- salesNum: null,
- printNum: null,
- classStructureNo: null,
- classStructureDate: null,
- classStructureMan: null,
- };
- this.resetForm("form");
- },
- resetQuery() {
- this.queryParams = {};
- this.resetForm("queryForm");
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- if (
- this.structureList3 == null &&
- this.structureList1 == null &&
- this.structureList2 == null
- ) {
- this.msgSuccess("没有要班结的数据");
- } else {
- this.open = true;
- this.title = "添加班结管理";
- }
- },
- getClassInfo() {
- listClass(this.queryParams).then((response) => {
- this.opo = response.data;
- this.queryParams.classStructureNo = response.data.classStructureNo;
- this.queryParams.stationId = response.data.stationId;
- this.getList();
- });
- },
- /** 提交按钮 */
- submitForm() {
- //【**】
- this.form = {
- stationName:this.$store.state.user.stationName,
- classStructureMan:this.$store.state.user.name
- }
- addStructure(this.form).then((response) => {
- this.msgSuccess("班结成功");
- this.open = false;
- this.queryParams.stationName = this.$store.state.user.stationName;
- this.queryParams.stationId = this.$store.state.user.stationId;
- this.queryParams.classStructureMan = this.$store.state.user.name;
- this.getClassInfo();
- this.isclose = false;
- });
- },
- },
- };
- </script>
|