timeDetailsWeight.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. // 计费详单
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <span>详单时间:</span>
  6. <el-date-picker
  7. v-model="startTime"
  8. type="datetime"
  9. placeholder="选择日期"
  10. >
  11. </el-date-picker>
  12. <span>至</span>
  13. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  14. </el-date-picker>
  15. <el-button type="primary" class="btn" @click="onclick">
  16. <i class="el-icon-search"></i>查询
  17. </el-button>
  18. <el-button type="primary" @click="exportAllExcel()"
  19. ><i class="el-icon-download"></i>导出(Excel)</el-button
  20. >
  21. <span style="margin-left: 1rem;">合计时间:</span>
  22. <el-input
  23. v-model="totalTime"
  24. :disabled="true"
  25. style="width: 140px;"
  26. ></el-input>
  27. <span style="margin-left: 1rem;">合计金额:</span>
  28. <el-input
  29. v-model="totalMoney"
  30. :disabled="true"
  31. style="width: 100px;"
  32. ></el-input>
  33. </div>
  34. <div class="table">
  35. <el-tabs v-model="activeName">
  36. <!-- 未结算 -->
  37. <el-tab-pane label="未结算" name="first">
  38. <dilTable v-bind.sync="options1" ref="excelDom" @func="func">
  39. </dilTable>
  40. </el-tab-pane>
  41. <!-- 已结算 -->
  42. <el-tab-pane label="已结算" name="second">
  43. <dilTable v-bind.sync="options2"> </dilTable>
  44. </el-tab-pane>
  45. </el-tabs>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import { sjTime } from "@/utils/sharedJsFile";
  51. import { getCookie } from "@/utils/util.js";
  52. export default {
  53. data() {
  54. return {
  55. startTime: null,
  56. endTime: null,
  57. totalMoney: null,
  58. totalTime: null,
  59. //单价
  60. Fee: null,
  61. //加载
  62. selectLineLoading: false,
  63. input: "",
  64. activeName: "first",
  65. ssoId: null,
  66. //详单Id
  67. detailsId: null,
  68. options1: {
  69. // first请求数据的地址
  70. requestUrl: ""
  71. },
  72. options2: {
  73. // second请求数据的地址
  74. requestUrl: ""
  75. },
  76. //是否打开修改详单地址弹出框
  77. dialogFormVisible: false,
  78. //原详单单价
  79. originalPriceValue: null,
  80. //新详单单价
  81. newPriceValue: null,
  82. //原详单地址
  83. originalAddress: null,
  84. //新详单地址
  85. newAddress: null,
  86. //新单价Id
  87. priceId: null,
  88. //是否打开运输单价的模态框
  89. addressDrawer: false,
  90. //运输单价的表格
  91. Address: {
  92. requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
  93. selectionType: "radio"
  94. },
  95. // addressText:null,
  96. //缓存当前选中的运输单价
  97. priceMap: {},
  98. formLabelWidth: "125px",
  99. tableTitle: "内转计时计费详单"
  100. };
  101. },
  102. created() {
  103. this.options1GetRequestUrl();
  104. this.options2GetRequestUrl();
  105. },
  106. methods: {
  107. exportAllExcel() {
  108. let startTime = null
  109. let endTime = null
  110. let orgCode = null
  111. let carrierSsoId = null
  112. if (this.startTime && this.endTime) {
  113. startTime = sjTime(this.startTime)
  114. endTime = sjTime(this.endTime)
  115. }
  116. if (getCookie('orgCode') == 'chengyunshang') {
  117. carrierSsoId = getCookie('userId')
  118. }
  119. if (
  120. getCookie('orgCode') == 'dagangadmin' ||
  121. getCookie('orgCode') == 'zidonghuabu' ||
  122. getCookie('orgCode') == 'wuliuchuyunzhongxin'
  123. ) {
  124. orgCode = null
  125. } else {
  126. orgCode = getCookie('orgCode')
  127. }
  128. if (this.activeName == 'first') {
  129. this.tableTitle = '未结算计费详单'
  130. this.axios
  131. .post(
  132. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0" +
  133. "&startTime=" +
  134. startTime +
  135. "&endTime=" +
  136. endTime +
  137. "&i" +
  138. new Date()
  139. )
  140. .then(res => {
  141. console.log(res.data.data)
  142. console.log(res.data.data)
  143. this.exportAllList = res.data.data.list
  144. this.noSettleDetailsColumn=res.data.data.columnData
  145. this.exportAllReportToExcel(
  146. this.tableTitle,
  147. this.exportAllList,
  148. this.noSettleDetailsColumn
  149. )
  150. })
  151. } else if (this.activeName == 'second') {
  152. this.tableTitle = '已结算计费详单'
  153. this.axios
  154. .post(
  155. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0" +
  156. "&startTime=" +
  157. startTime +
  158. "&endTime=" +
  159. endTime +
  160. "&i" +
  161. new Date()
  162. )
  163. .then(res => {
  164. console.log(res.data.data)
  165. this.exportAllList = res.data.data.list
  166. this.noSettleDetailsColumn=res.data.data.columnData
  167. this.exportAllReportToExcel(
  168. this.tableTitle,
  169. this.exportAllList,
  170. this.settleDetailsColumn
  171. )
  172. })
  173. }
  174. },
  175. //导出excel
  176. exportAllReportToExcel(tableTitle, dataArr, columnData) {
  177. var title = tableTitle
  178. let tHeader = []
  179. let filterVal = []
  180. columnData.forEach(e1 => {
  181. if (tHeader.indexOf(e1.label) === -1) {
  182. tHeader.push(e1.label)
  183. }
  184. if (filterVal.indexOf(e1.prop) === -1) {
  185. filterVal.push(e1.prop)
  186. }
  187. })
  188. //导出为excel
  189. this.downloadLoading = true
  190. require.ensure([], () => {
  191. const {
  192. export_json_to_excel
  193. } = require('@/assets/excel/Export2Excel.js') //这里必须使用绝对路径,使用@/+存放export2Excel的路径
  194. // let list = this.$refs.excelDom.dataTabel;
  195. let data = dataArr.map(v => filterVal.map(j => v[j])) //3.formatJson格式转换
  196. export_json_to_excel(tHeader, data, title) // (title)导出的表格名称
  197. })
  198. },
  199. //未结算数据
  200. options1GetRequestUrl() {
  201. if (getCookie("orgCode") == "chengyunshang") {
  202. this.ssoId = getCookie("userId");
  203. this.options1.requestUrl =
  204. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0&carrierSsoId=" +
  205. getCookie("userId");
  206. } else if (
  207. getCookie("orgCode") == "dagangadmin" ||
  208. getCookie("orgCode") == "zidonghuabu" ||
  209. getCookie("orgCode") == "wuliuchuyunzhongxin"
  210. ) {
  211. this.options1.requestUrl =
  212. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0";
  213. } else {
  214. this.options1.requestUrl =
  215. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0&userId=" +
  216. getCookie("orgCode");
  217. }
  218. },
  219. //已结算数据
  220. options2GetRequestUrl() {
  221. if (getCookie("orgCode") == "chengyunshang") {
  222. this.ssoId = getCookie("userId");
  223. this.options2.requestUrl =
  224. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1&carrierSsoId=" +
  225. getCookie("userId");
  226. } else if (
  227. getCookie("orgCode") == "dagangadmin" ||
  228. getCookie("orgCode") == "zidonghuabu" ||
  229. getCookie("orgCode") == "wuliuchuyunzhongxin"
  230. ) {
  231. this.options2.requestUrl =
  232. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1";
  233. } else {
  234. this.options2.requestUrl =
  235. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1&userId=" +
  236. getCookie("orgCode");
  237. }
  238. },
  239. toInsert() {
  240. this.$router.push("/insertCheckInventory");
  241. },
  242. func(res) {
  243. console.log(res);
  244. var totalAllTime = 0;
  245. var totalAllMoney = 0;
  246. res.list.forEach(e => {
  247. totalAllTime = totalAllTime + e.resultTime;
  248. totalAllMoney = totalAllMoney + e.detailsAmount;
  249. });
  250. this.totalMoney = totalAllMoney;
  251. this.totalTime = totalAllTime;
  252. },
  253. onclick() {
  254. let startTime = null;
  255. let endTime = null;
  256. if (this.startTime) {
  257. startTime = sjTime(this.startTime);
  258. }
  259. if (this.endTime) {
  260. endTime = sjTime(this.endTime);
  261. }
  262. if (startTime && endTime) {
  263. if (startTime < endTime) {
  264. if (
  265. getCookie("orgCode") == "dagangadmin" ||
  266. getCookie("orgCode") == "zidonghuabu" ||
  267. getCookie("orgCode") == "wuliuchuyunzhongxin"
  268. ) {
  269. this.options1.requestUrl =
  270. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0" +
  271. "&startTime=" +
  272. startTime +
  273. "&endTime=" +
  274. endTime +
  275. "&i" +
  276. new Date();
  277. this.options2.requestUrl =
  278. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1" +
  279. "&startTime=" +
  280. startTime +
  281. "&endTime=" +
  282. endTime +
  283. "&i" +
  284. new Date();
  285. } else if (getCookie("orgCode") == "chengyunshang") {
  286. this.options1.requestUrl =
  287. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0&carrierSsoId=" +
  288. getCookie("userId") +
  289. "&startTime=" +
  290. startTime +
  291. "&endTime=" +
  292. endTime +
  293. "&i" +
  294. new Date();
  295. this.options2.requestUrl =
  296. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1&carrierSsoId=" +
  297. getCookie("userId") +
  298. "&startTime=" +
  299. startTime +
  300. "&endTime=" +
  301. endTime +
  302. "&i" +
  303. new Date();
  304. } else {
  305. this.options1.requestUrl =
  306. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0&userId=" +
  307. getCookie("orgCode") +
  308. "&startTime=" +
  309. startTime +
  310. "&endTime=" +
  311. endTime +
  312. "&i" +
  313. new Date();
  314. this.options2.requestUrl =
  315. "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1&userId=" +
  316. getCookie("orgCode") +
  317. "&startTime=" +
  318. startTime +
  319. "&endTime=" +
  320. endTime +
  321. "&i" +
  322. new Date();
  323. }
  324. } else {
  325. this.startTime = null;
  326. this.endTime = null;
  327. this.$message.warning("开始时间要比结束时间早");
  328. }
  329. } else {
  330. }
  331. },
  332. //运输订单点击浏览的事件
  333. select() {
  334. this.addressDrawer = true;
  335. },
  336. //运输单价模态窗口的框计算
  337. selectAddressClick() {
  338. this.Price.requestUrl =
  339. "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" +
  340. this.addressText;
  341. }
  342. }
  343. };
  344. </script>
  345. <style lang="scss" scode>
  346. .steel_inbound {
  347. .sache {
  348. margin-left: 20px;
  349. margin-top: 20px;
  350. .el-input {
  351. width: 20%;
  352. margin-right: 1.25rem;
  353. }
  354. }
  355. .table {
  356. margin-left: 20px;
  357. margin-top: 20px;
  358. }
  359. }
  360. </style>