sum_list.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :getList="getList"
  5. :exportList="exportList"
  6. :tableAttributes="tableAttributes"
  7. :tableEvents="tableEvents"
  8. :optionsEvensGroup="optionsEvensGroup"
  9. :columnParsing="columnParsing"
  10. >
  11. <template #moreSearch>
  12. <div style="margin-bottom: 20px">
  13. <div class="num" style="margin: 0">当前列表总发货数量:{{ totalNum.invoiceNumber }}</div>
  14. <div class="num">总含税金额:{{ totalNum.payAmount | toThousandFilter }}</div>
  15. </div>
  16. </template>
  17. <Popu v-if="isShow !== 1">
  18. <apply-return-form v-if="isShow === 2" @backListFormDetail="backList" />
  19. <engin-return-form v-if="isShow === 3" @backListFormDetail="backList" />
  20. </Popu>
  21. <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" :addPrint="addPrint"/>
  22. <el-dialog
  23. title="密码确认"
  24. :visible.sync="isShowDialog"
  25. :show-close="false"
  26. width="40%"
  27. :close-on-click-modal="false"
  28. >
  29. <el-form ref="dialogForm" :model="dialogForm" :rules="dialogFormRules" label-position="right" label-width="70px">
  30. <el-row :gutter="20">
  31. <el-col :xs="24" :sm="24" :lg="24">
  32. <el-form-item label="密码" prop="password">
  33. <el-input v-model="dialogForm.password" autocomplete="off" placeholder="请输入密码" />
  34. </el-form-item>
  35. </el-col>
  36. <el-col :xs="24" :sm="12" :lg="12">
  37. <el-form-item label="操作人" prop="createMan">
  38. <el-input v-model="dialogForm.createMan" readonly />
  39. </el-form-item>
  40. </el-col>
  41. <el-col :xs="24" :sm="12" :lg="12" style="height: 51px">
  42. <el-form-item label="操作日期" prop="createDate">
  43. <el-date-picker
  44. v-model="dialogForm.createDate"
  45. readonly
  46. type="date"
  47. value-format="yyyy-MM-dd"
  48. style="width: 100%"
  49. placeholder="选择日期"
  50. />
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. </el-form>
  55. <div slot="footer" class="dialog-footer">
  56. <el-button @click="cancelDialogForm">取 消</el-button>
  57. <el-button type="primary" @click="submitDialogForm">确 定</el-button>
  58. </div>
  59. </el-dialog>
  60. <el-dialog title="导出项" :visible.sync="dialogVisible" width="50%">
  61. <el-checkbox v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
  62. <div style="margin: 15px 0" />
  63. <el-checkbox-group v-model="check" @change="handleCheckedCitiesChange">
  64. <el-checkbox v-for="item in excelData" :label="item.value">{{ item.name }}</el-checkbox>
  65. </el-checkbox-group>
  66. <span slot="footer" class="dialog-footer">
  67. <el-button @click="dialogVisible = false">取 消</el-button>
  68. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  69. </span>
  70. </el-dialog>
  71. </template-page>
  72. </template>
  73. <script>
  74. import TemplatePage from '@/components/template/template-page-1.vue'
  75. import import_mixin from '@/components/template/import_mixin.js'
  76. import add_callback_mixin from '@/components/template/add_callback_mixin.js'
  77. import Popu from '@/components/template/popu.vue'
  78. import { getSumList, getSumListV2, exportSumListV2 } from '@/api/supply/deliver'
  79. import print from '@/mixin/print'
  80. import { checkPassword, getListInvoiceNumber, getListInvoiceNumberV2 } from '@/api/supply/pickup'
  81. import { getCategoryList, getSalesmanList } from '@/api/common'
  82. import SumPrint from '@/views/supply/deliver/components/sum_print'
  83. import { getWarehouseList } from '@/api/supply/apply'
  84. import ApplyReturnForm from './components/apply_return_form.vue'
  85. import EnginReturnForm from './components/engin_return_form.vue'
  86. import printPreview from './components/design/preview.vue'
  87. export default {
  88. components: { TemplatePage, Popu, SumPrint, ApplyReturnForm, EnginReturnForm, printPreview },
  89. mixins: [import_mixin, add_callback_mixin, print],
  90. data() {
  91. return {
  92. visible: false,
  93. // 事件组合
  94. optionsEvensGroup: [
  95. [
  96. [
  97. {
  98. name: '打印发货单',
  99. click: () => {
  100. if (this.recordSelected.length === 0) {
  101. this.$message.error('请选择需要删除的数据')
  102. return
  103. }
  104. this.toPrint()
  105. }
  106. }
  107. ]
  108. ],
  109. [
  110. [
  111. {
  112. name: '零售退货申请',
  113. click: () => {
  114. this.isShow = 2
  115. },
  116. isRole: this.$checkBtnRole('refund', this.$route.meta.roles)
  117. }
  118. ]
  119. ],
  120. [
  121. [
  122. {
  123. name: '工程退货申请',
  124. click: () => {
  125. this.isShow = 3
  126. },
  127. isRole: this.$checkBtnRole('refund', this.$route.meta.roles)
  128. }
  129. ]
  130. ]
  131. ],
  132. // 表格属性
  133. tableAttributes: {
  134. // 启用勾选列
  135. selectColumn: true
  136. }, // 关闭新增弹窗
  137. // 表格事件
  138. tableEvents: {
  139. 'selection-change': this.handleSelect
  140. },
  141. recordSelected: [],
  142. currentPage: 1, // 当前页码
  143. pageSize: 10, // 每页数量
  144. listTotal: 0, // 列表总数
  145. dataList: null, // 列表数据
  146. listLoading: false, // 列表加载loading
  147. screenForm: {
  148. // 筛选表单数据
  149. goodsName: '',
  150. goodsCode: '',
  151. goodsOldCode: '',
  152. model: '',
  153. createDate: [],
  154. deliverDate: [],
  155. correspondId: [],
  156. jxsNum: '',
  157. jxsName: '',
  158. orderNum: '',
  159. type: '',
  160. salesMan: '',
  161. k3ServiceId: '',
  162. mainOrderId: '',
  163. approvaTime: [],
  164. types: '',
  165. printStatus: '',
  166. discriminate: '',
  167. refEnginRecordNo: '',
  168. invoicePrintStatus: '',
  169. createBy: ''
  170. },
  171. invoiceList: [
  172. {
  173. value: 1,
  174. label: '申请发货单'
  175. },
  176. {
  177. value: 2,
  178. label: '退货单'
  179. },
  180. {
  181. value: 3,
  182. label: '直调发货单'
  183. }
  184. ],
  185. categoryList: [],
  186. salesmanList: [],
  187. tableSelection: [],
  188. queryItem: {},
  189. isShowPrint: false,
  190. totalNum: {},
  191. isShowDialog: false,
  192. dialogForm: {
  193. password: '',
  194. createMan: '',
  195. createDate: ''
  196. },
  197. warehouseList: [],
  198. dialogFormRules: {
  199. password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
  200. },
  201. dialogVisible: false,
  202. excelData: [
  203. {
  204. value: 1,
  205. name: '状态'
  206. },
  207. {
  208. value: 2,
  209. name: '打印时间'
  210. }
  211. ],
  212. check: [],
  213. checkAll: false,
  214. isCollapse: true,
  215. isIndeterminate: false,
  216. isShow: 1
  217. }
  218. },
  219. mounted() {
  220. this.$nextTick(() => {
  221. this.initPrint()
  222. })
  223. },
  224. methods: {
  225. // 列表请求函数
  226. getList(...p) {
  227. this.recordSelected = []
  228. getListInvoiceNumberV2( ...p ).then(res => {
  229. this.totalNum = res.data
  230. })
  231. return getSumListV2(...p)
  232. },
  233. // 列表导出函数
  234. exportList: exportSumListV2,
  235. // 表格列解析渲染数据更改
  236. columnParsing(item, defaultData) {
  237. return defaultData
  238. },
  239. // 监听勾选变化
  240. selectionChange(data) {
  241. this.recordSelected = data
  242. },
  243. operation() {
  244. return (h, { row, index, column }) => {
  245. return <div class="operation-btns"></div>
  246. }
  247. },
  248. handleClose() {
  249. this.addOff(() => {
  250. this.visible = false
  251. })()
  252. },
  253. handleFilterData() {
  254. this.dialogVisible = true
  255. },
  256. handleCheckAllChange(val) {
  257. const arr = []
  258. if (val) {
  259. for (let i = 1; i <= this.excelData.length; i++) {
  260. arr.push(i)
  261. }
  262. }
  263. this.check = val ? arr : []
  264. this.isIndeterminate = false
  265. },
  266. handleCheckedCitiesChange() {
  267. console.log(this.checkAll)
  268. },
  269. // 获取业务员列表
  270. getSalesmanList() {
  271. getSalesmanList({
  272. pageNum: 1,
  273. pageSize: -1,
  274. isCustomer: 0,
  275. status: true
  276. }).then(res => {
  277. this.salesmanList = res.data.records
  278. })
  279. },
  280. // 获取存货类别列表
  281. getCategoryList() {
  282. getCategoryList({
  283. pageNum: 1,
  284. pageSize: -1
  285. }).then(res => {
  286. this.categoryList = res.data.records
  287. })
  288. },
  289. // 获取仓库列表
  290. getWarehouseList() {
  291. getWarehouseList({
  292. pageNum: 1,
  293. pageSize: -1
  294. }).then(res => {
  295. this.warehouseList = res.data.records
  296. })
  297. },
  298. // // 查询列表
  299. // getList() {
  300. // this.listLoading = true
  301. // const params = {
  302. // pageNum: this.currentPage,
  303. // pageSize: this.pageSize,
  304. // materialName: this.screenForm.goodsName,
  305. // materialNumber: this.screenForm.goodsCode,
  306. // materialOldNumber: this.screenForm.goodsOldCode,
  307. // specification: this.screenForm.model,
  308. // printStatus: this.screenForm.printStatus,
  309. // invoicePrintStatus: this.screenForm.invoicePrintStatus,
  310. // discriminate: this.screenForm.discriminate,
  311. // createBy: this.screenForm.createBy,
  312. // refEnginRecordNo: this.screenForm.refEnginRecordNo,
  313. // createStartTime: this.screenForm.createDate ? this.screenForm.createDate[0] : '',
  314. // createEndTime: this.screenForm.createDate ? this.screenForm.createDate[1] : '',
  315. // startTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[0] : '',
  316. // endTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[1] : '',
  317. // customerNumber: this.screenForm.jxsNum,
  318. // customerName: this.screenForm.jxsName,
  319. // id: this.screenForm.orderNum,
  320. // categoryName: this.screenForm.type,
  321. // serviceId: this.screenForm.salesMan,
  322. // k3ServiceId: this.screenForm.k3ServiceId,
  323. // mainOrderId: this.screenForm.mainOrderId,
  324. // approvalEndTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[1] : '',
  325. // approvalStartTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[0] : '',
  326. // correspondId: this.screenForm.correspondId.join(','),
  327. // type: this.screenForm.types
  328. // }
  329. // getSumList(params).then(res => {
  330. // res.data.records.forEach(item => {
  331. // item.notOutNumber = item.salesStatus ? 0 : item.refundableQty
  332. // item.sums1 = ['refundableQty', 'compute_wckNum']
  333. // item.sums2 = [
  334. // 'payAmount',
  335. // 'payRebateAmount',
  336. // 'discAmount',
  337. // 'totalDiscAmount',
  338. // 'singlePayPrice',
  339. // 'compute_zkeAmount'
  340. // ]
  341. // })
  342. // this.dataList = res.data.records
  343. // this.listTotal = res.data.total
  344. // this.listLoading = false
  345. // })
  346. // this.getListInvoiceNumber()
  347. // },
  348. getListInvoiceNumber() {
  349. const params = {
  350. materialName: this.screenForm.goodsName,
  351. materialNumber: this.screenForm.goodsCode,
  352. materialOldNumber: this.screenForm.goodsOldCode,
  353. specification: this.screenForm.model,
  354. printStatus: this.screenForm.printStatus,
  355. invoicePrintStatus: this.screenForm.invoicePrintStatus,
  356. discriminate: this.screenForm.discriminate,
  357. createBy: this.screenForm.createBy,
  358. refEnginRecordNo: this.screenForm.refEnginRecordNo,
  359. createStartTime: this.screenForm.createDate ? this.screenForm.createDate[0] : '',
  360. createEndTime: this.screenForm.createDate ? this.screenForm.createDate[1] : '',
  361. startTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[0] : '',
  362. endTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[1] : '',
  363. customerNumber: this.screenForm.jxsNum,
  364. customerName: this.screenForm.jxsName,
  365. id: this.screenForm.orderNum,
  366. categoryName: this.screenForm.type,
  367. serviceId: this.screenForm.salesMan,
  368. k3ServiceId: this.screenForm.k3ServiceId,
  369. mainOrderId: this.screenForm.mainOrderId,
  370. approvalEndTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[1] : '',
  371. approvalStartTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[0] : '',
  372. correspondId: this.screenForm.correspondId.join(','),
  373. type: this.screenForm.types
  374. }
  375. getListInvoiceNumber(params).then(res => {
  376. // console.log(res,'ii');
  377. this.totalNum = res.data
  378. })
  379. },
  380. // 提交筛选表单
  381. submitScreenForm() {
  382. this.currentPage = 1
  383. this.$refs.pageRef.refreshList()
  384. },
  385. // 重置筛选表单
  386. resetScreenForm() {
  387. this.$refs.screenForm.resetFields()
  388. this.currentPage = 1
  389. this.$refs.pageRef.refreshList()
  390. },
  391. // 更改每页数量
  392. handleSizeChange(val) {
  393. this.pageSize = val
  394. this.currentPage = 1
  395. this.$refs.pageRef.refreshList()
  396. },
  397. // 更改当前页
  398. handleCurrentChange(val) {
  399. this.currentPage = val
  400. this.$refs.pageRef.refreshList()
  401. },
  402. handleSelect(data) {
  403. this.recordSelected = data
  404. // console.log(selection,row);
  405. // this.$refs.table.toggleRowSelection(row)
  406. // this.dataList.forEach(item => {
  407. // if (item.id === row.id) {
  408. // this.$refs.table.toggleRowSelection(item)
  409. // }
  410. // })
  411. // this.tableSelection = this.$refs.table.selection
  412. this.tableSelection = data
  413. },
  414. // 点击打印
  415. toPrint() {
  416. this.queryItem = this.tableSelection
  417. if (this.tableSelection.every(e => e.printNum == 0)) {
  418. this.queryItem = this.tableSelection
  419. this.getDateil(this.tableSelection, 'getDeliverDetail').then(res => {
  420. this.$endLoading()
  421. this.$refs.preView.show(this.hiprintTemplate, this.outputData)
  422. })
  423. } else {
  424. this.queryItem = this.tableSelection
  425. this.dialogForm.createMan = JSON.parse(localStorage.getItem('supply_user')).nickName
  426. this.dialogForm.createDate = this.getDate()
  427. this.isShowDialog = true
  428. }
  429. },
  430. // 关闭弹窗
  431. cancelDialogForm() {
  432. this.isShowDialog = false
  433. this.$refs.dialogForm.resetFields()
  434. },
  435. // 提交 弹窗
  436. submitDialogForm() {
  437. this.$refs.dialogForm.validate(valid => {
  438. if (valid) {
  439. const params = {
  440. shipId: this.queryItem[0].invoiceId,
  441. password: this.dialogForm.password
  442. }
  443. checkPassword(params).then(res => {
  444. this.getDateil(this.tableSelection, 'getDeliverDetail').then(res => {
  445. this.$endLoading()
  446. this.$refs.preView.show(this.hiprintTemplate, this.outputData)
  447. })
  448. this.cancelDialogForm()
  449. })
  450. }
  451. })
  452. },
  453. getDate() {
  454. var date = new Date()
  455. var seperator1 = '-'
  456. var year = date.getFullYear()
  457. var month = date.getMonth() + 1
  458. var strDate = date.getDate()
  459. if (month >= 1 && month <= 9) {
  460. month = '0' + month
  461. }
  462. if (strDate >= 0 && strDate <= 9) {
  463. strDate = '0' + strDate
  464. }
  465. var currentdate = year + seperator1 + month + seperator1 + strDate
  466. return currentdate
  467. },
  468. backList() {
  469. this.isShow = 1
  470. this.$refs.pageRef.refreshList()
  471. }
  472. ,
  473. handleRefreshList(){
  474. this.recordSelected = []
  475. this.tableSelection = []
  476. this.$refs.pageRef.refreshList()
  477. console.log(999);
  478. },
  479. handleInitPrint(){
  480. this.$nextTick(() => {
  481. this.initPrint()
  482. })
  483. }
  484. }
  485. }
  486. </script>
  487. <style lang="scss" scoped>
  488. .num {
  489. display: inline-block;
  490. font-size: 16px;
  491. margin-left: 20px;
  492. color: #909399;
  493. vertical-align: middle;
  494. }
  495. </style>