Station_Accounting.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <PermissionContainer
  3. :jiBieArr=[2]
  4. :tipArr="[,'班结只对站点级别开放','',,'',]"
  5. >
  6. <div>
  7. <el-form
  8. :model="queryParams"
  9. ref="queryForm"
  10. :inline="true"
  11. label-width="68px"
  12. >
  13. <el-form-item prop="carNumber"
  14. >开班时间:{{ opo.startDate }} 班结人:{{ opo.classStructureMan }}
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button
  18. icon="el-icon-plus"
  19. type="primary"
  20. v-if="isclose"
  21. size="mini"
  22. @click="handleAdd"
  23. >添加班结</el-button
  24. >
  25. </el-form-item>
  26. </el-form>
  27. <!--按员工汇总-->
  28. <span style="color: #ff9955; font-size: 25px">|</span
  29. ><span style="font-size: 25px">按员工汇总</span>
  30. <el-table show-summary :data="structureList" :summary-method="getTotal">
  31. <el-table-column label="员工姓名" align="center" prop="oilPersonnel" />
  32. <el-table-column label="负责枪号" align="center" prop="oilGun" />
  33. <el-table-column label="销量" align="center" prop="orderLiters" />
  34. <el-table-column label="销额" align="center" prop="amt" />
  35. <el-table-column label="销售笔数" align="center" prop="orderNo" />
  36. </el-table>
  37. <!--按油品汇总-->
  38. <span style="color: #ff9955; font-size: 25px; padding-top: 15px">|</span
  39. ><span style="font-size: 25px">按油品汇总</span>
  40. <el-table :data="structureList1" show-summary :summary-method="getTotal2">
  41. <el-table-column label="油品" align="center" prop="oilName" />
  42. <el-table-column label="负责枪号" align="center" prop="oilGun" />
  43. <el-table-column label="销量" align="center" prop="orderLiters" />
  44. <el-table-column label="销额" align="center" prop="amt" />
  45. <el-table-column label="销售笔数" align="center" prop="orderNo" />
  46. </el-table>
  47. <!--按员工/支付方式汇总: -->
  48. <span style="color: #ff9955; font-size: 25px; padding-top: 15px">|</span
  49. ><span style="font-size: 25px">按员工/支付方式汇总</span>
  50. <el-table :data="structureList3" show-summary :summary-method="getTotal3">
  51. <el-table-column label="员工姓名" align="center" prop="oilPersonnel" />
  52. <el-table-column label="负责枪号" align="center" prop="oilGun" />
  53. <el-table-column label="微信笔数" align="center" prop="wxNum" />
  54. <el-table-column label="支付宝笔数" align="center" prop="zfbNum" />
  55. <el-table-column label="现金笔数" align="center" prop="xjNum" />
  56. <el-table-column label="优惠" align="center" prop="discountAmt" />
  57. <el-table-column label="优惠劵" align="center" prop="discountCouponAmt" />
  58. <el-table-column label="微信金额" align="center" prop="wxAmt" />
  59. <el-table-column label="支付宝金额" align="center" prop="zfbAmt" />
  60. <el-table-column label="现金金额" align="center" prop="xjAmt" />
  61. <el-table-column label="会员卡支付" align="center" prop="dzkAmt" />
  62. </el-table>
  63. <!-- 添加或修改班结管理对话框 -->
  64. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  65. <span>请确认当前时间没有车主正在使用系统支付</span>
  66. <div slot="footer" class="dialog-footer">
  67. <el-button type="primary" @click="submitForm">确 定</el-button>
  68. <el-button @click="cancel">取 消</el-button>
  69. </div>
  70. </el-dialog>
  71. </div>
  72. </PermissionContainer>
  73. </template>
  74. <script>
  75. import {
  76. listPersonnelPayStructure,
  77. listClass,
  78. getAgeClassStructure,
  79. listPersonnelStructure,
  80. listOilStructure,
  81. addStructure,
  82. getPayOrderInfoMin,
  83. selectPersonnelStructure,
  84. selectPersonnelPayStructure,
  85. selectOilStructure,
  86. } from "@/api/station/structure";
  87. export default {
  88. name: "Station_Accounting",
  89. data() {
  90. return {
  91. // 班结管理表格数据
  92. structureList: [],
  93. structureList1: [],
  94. structureList3: [],
  95. // 弹出层标题
  96. title: "",
  97. // 是否显示弹出层
  98. open: false,
  99. //是否显示班结
  100. isclose: true,
  101. // 查询参数
  102. queryParams: {},
  103. stationOptions: [],
  104. opo: {
  105. classStructureMan: null,
  106. startDate: null,
  107. },
  108. // 表单参数
  109. form: {},
  110. // 表单校验
  111. rules: {},
  112. pageStatus: 0
  113. };
  114. },
  115. created() {
  116. // 查询班结数据
  117. this.getStructure();
  118. this.initFromOrder();
  119. },
  120. methods: {
  121. async getStructure() {
  122. this.opo.classStructureMan = this.$store.state.user.name;
  123. const structureRes = await getAgeClassStructure();
  124. if (!structureRes.data) {
  125. // 油站第一次班结
  126. const PayOrderRes = await getPayOrderInfoMin();
  127. if(PayOrderRes.data==null){
  128. this.opo.startDate ="";
  129. }else{
  130. this.opo.startDate = PayOrderRes.data.createdDate;
  131. }
  132. this.opo = {
  133. ...this.opo,
  134. startDate: PayOrderRes.data.createdDate,
  135. };
  136. return;
  137. } else {
  138. // 油站之前班结过
  139. this.opo.startDate = structureRes.data.classStructureDate;
  140. this.opo = {
  141. ...this.opo,
  142. startDate: structureRes.data.classStructureDate,
  143. };
  144. return;
  145. }
  146. },
  147. initFromOrder() {
  148. selectPersonnelStructure().then((response) => {
  149. this.structureList = response.rows;
  150. });
  151. selectOilStructure().then((response) => {
  152. this.structureList1 = response.rows;
  153. });
  154. selectPersonnelPayStructure().then((response) => {
  155. this.structureList3 = response.rows;
  156. });
  157. },
  158. /** 查询班结管理列表 */
  159. getList() {
  160. listPersonnelStructure(this.queryParams).then((response) => {
  161. this.structureList = response.rows;
  162. });
  163. listOilStructure(this.queryParams).then((response) => {
  164. this.structureList1 = response.rows;
  165. });
  166. listPersonnelPayStructure(this.queryParams).then((response) => {
  167. this.structureList3 = response.rows;
  168. });
  169. },
  170. getTotal(param) {
  171. const { columns, data } = param;
  172. const sums = [];
  173. columns.forEach((column, index) => {
  174. if (index === 0) {
  175. sums[index] = "合计";
  176. return;
  177. }
  178. const values = data.map((item) => Number(item[column.property]));
  179. if (column.property === "orderLiters") {
  180. sums[index] = values.reduce((prev, curr) => {
  181. const value = Number(curr);
  182. if (!isNaN(value)) {
  183. return prev + curr;
  184. } else {
  185. return prev;
  186. }
  187. }, 0);
  188. sums[index] = sums[index].toFixed(2);
  189. } else if (column.property === "amt") {
  190. sums[index] = values.reduce((prev, curr) => {
  191. const value = Number(curr);
  192. if (!isNaN(value)) {
  193. return prev + curr;
  194. } else {
  195. return prev;
  196. }
  197. }, 0);
  198. sums[index] = sums[index].toFixed(2);
  199. } else if (column.property === "orderNo") {
  200. sums[index] = values.reduce((prev, curr) => {
  201. const value = Number(curr);
  202. if (!isNaN(value)) {
  203. return prev + curr;
  204. } else {
  205. return prev;
  206. }
  207. }, 0);
  208. sums[index] = sums[index].toFixed(0);
  209. } else {
  210. sums[index] = "";
  211. }
  212. });
  213. return sums;
  214. },
  215. getTotal2(param) {
  216. const { columns, data } = param;
  217. const sums = [];
  218. columns.forEach((column, index) => {
  219. if (index === 0) {
  220. sums[index] = "合计";
  221. return;
  222. }
  223. const values = data.map((item) => Number(item[column.property]));
  224. if (column.property === "orderLiters") {
  225. sums[index] = values.reduce((prev, curr) => {
  226. const value = Number(curr);
  227. if (!isNaN(value)) {
  228. return prev + curr;
  229. } else {
  230. return prev;
  231. }
  232. }, 0);
  233. sums[index] = sums[index].toFixed(2);
  234. } else if (column.property === "amt") {
  235. sums[index] = values.reduce((prev, curr) => {
  236. const value = Number(curr);
  237. if (!isNaN(value)) {
  238. return prev + curr;
  239. } else {
  240. return prev;
  241. }
  242. }, 0);
  243. sums[index] = sums[index].toFixed(2);
  244. } else if (column.property === "orderNo") {
  245. sums[index] = values.reduce((prev, curr) => {
  246. const value = Number(curr);
  247. if (!isNaN(value)) {
  248. return prev + curr;
  249. } else {
  250. return prev;
  251. }
  252. }, 0);
  253. sums[index] = sums[index].toFixed(0);
  254. } else {
  255. sums[index] = "";
  256. }
  257. });
  258. return sums;
  259. },
  260. getTotal3(param) {
  261. const { columns, data } = param;
  262. const sums = [];
  263. columns.forEach((column, index) => {
  264. if (index === 0) {
  265. sums[index] = "合计";
  266. return;
  267. }
  268. const values = data.map((item) => Number(item[column.property]));
  269. if (column.property === "wxNum") {
  270. sums[index] = values.reduce((prev, curr) => {
  271. const value = Number(curr);
  272. if (!isNaN(value)) {
  273. return prev + curr;
  274. } else {
  275. return prev;
  276. }
  277. }, 0);
  278. sums[index] = sums[index].toFixed(0);
  279. } else if (column.property === "zfbNum") {
  280. sums[index] = values.reduce((prev, curr) => {
  281. const value = Number(curr);
  282. if (!isNaN(value)) {
  283. return prev + curr;
  284. } else {
  285. return prev;
  286. }
  287. }, 0);
  288. sums[index] = sums[index].toFixed(0);
  289. } else if (column.property === "xjNum") {
  290. sums[index] = values.reduce((prev, curr) => {
  291. const value = Number(curr);
  292. if (!isNaN(value)) {
  293. return prev + curr;
  294. } else {
  295. return prev;
  296. }
  297. }, 0);
  298. sums[index] = sums[index].toFixed(0);
  299. } else if (column.property === "discountAmt") {
  300. sums[index] = values.reduce((prev, curr) => {
  301. const value = Number(curr);
  302. if (!isNaN(value)) {
  303. return prev + curr;
  304. } else {
  305. return prev;
  306. }
  307. }, 0);
  308. sums[index] = sums[index].toFixed(2);
  309. } else if (column.property === "discountCouponAmt") {
  310. sums[index] = values.reduce((prev, curr) => {
  311. const value = Number(curr);
  312. if (!isNaN(value)) {
  313. return prev + curr;
  314. } else {
  315. return prev;
  316. }
  317. }, 0);
  318. sums[index] = sums[index].toFixed(2);
  319. } else if (column.property === "wxAmt") {
  320. sums[index] = values.reduce((prev, curr) => {
  321. const value = Number(curr);
  322. if (!isNaN(value)) {
  323. return prev + curr;
  324. } else {
  325. return prev;
  326. }
  327. }, 0);
  328. sums[index] = sums[index].toFixed(2);
  329. } else if (column.property === "zfbAmt") {
  330. sums[index] = values.reduce((prev, curr) => {
  331. const value = Number(curr);
  332. if (!isNaN(value)) {
  333. return prev + curr;
  334. } else {
  335. return prev;
  336. }
  337. }, 0);
  338. sums[index] = sums[index].toFixed(2);
  339. } else if (column.property === "xjAmt") {
  340. sums[index] = values.reduce((prev, curr) => {
  341. const value = Number(curr);
  342. if (!isNaN(value)) {
  343. return prev + curr;
  344. } else {
  345. return prev;
  346. }
  347. }, 0);
  348. sums[index] = sums[index].toFixed(2);
  349. } else if (column.property === "dzkAmt") {
  350. sums[index] = values.reduce((prev, curr) => {
  351. const value = Number(curr);
  352. if (!isNaN(value)) {
  353. return prev + curr;
  354. } else {
  355. return prev;
  356. }
  357. }, 0);
  358. sums[index] = sums[index].toFixed(2);
  359. } else {
  360. sums[index] = "";
  361. }
  362. });
  363. return sums;
  364. },
  365. // 取消按钮
  366. cancel() {
  367. this.open = false;
  368. this.reset();
  369. },
  370. // 表单重置
  371. reset() {
  372. this.form = {
  373. id: null,
  374. stationId: null,
  375. stationName: null,
  376. person: null,
  377. gunNo: null,
  378. salesVolume: null,
  379. salesAmount: null,
  380. discount: null,
  381. coupon: null,
  382. netReceipts: null,
  383. salesNum: null,
  384. printNum: null,
  385. classStructureNo: null,
  386. classStructureDate: null,
  387. classStructureMan: null,
  388. };
  389. this.resetForm("form");
  390. },
  391. resetQuery() {
  392. this.queryParams = {};
  393. this.resetForm("queryForm");
  394. },
  395. /** 新增按钮操作 */
  396. handleAdd() {
  397. this.reset();
  398. if (
  399. this.structureList3 == null &&
  400. this.structureList1 == null &&
  401. this.structureList2 == null
  402. ) {
  403. this.msgSuccess("没有要班结的数据");
  404. } else {
  405. this.open = true;
  406. this.title = "添加班结管理";
  407. }
  408. },
  409. getClassInfo() {
  410. listClass(this.queryParams).then((response) => {
  411. this.opo = response.data;
  412. this.queryParams.classStructureNo = response.data.classStructureNo;
  413. this.queryParams.stationId = response.data.stationId;
  414. this.getList();
  415. });
  416. },
  417. /** 提交按钮 */
  418. submitForm() {
  419. //【**】
  420. this.form = {
  421. stationName:this.$store.state.user.stationName,
  422. classStructureMan:this.$store.state.user.name
  423. }
  424. addStructure(this.form).then((response) => {
  425. this.msgSuccess("班结成功");
  426. this.open = false;
  427. this.queryParams.stationName = this.$store.state.user.stationName;
  428. this.queryParams.stationId = this.$store.state.user.stationId;
  429. this.queryParams.classStructureMan = this.$store.state.user.name;
  430. this.getClassInfo();
  431. this.isclose = false;
  432. });
  433. },
  434. },
  435. };
  436. </script>