sum_list.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowPrint">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <el-form ref="screenForm" :model="screenForm" label-width="120px" size="mini" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="12" :lg="6">
  9. <el-form-item label="产品名称" prop="goodsName">
  10. <el-input v-model="screenForm.goodsName" placeholder="请输入产品名称"></el-input>
  11. </el-form-item>
  12. </el-col>
  13. <el-col :xs="24" :sm="12" :lg="6">
  14. <el-form-item label="物料编码" prop="goodsCode">
  15. <el-input v-model="screenForm.goodsCode" placeholder="请输入物料编码"></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :xs="24" :sm="12" :lg="6">
  19. <el-form-item label="产品编码" prop="goodsOldCode">
  20. <el-input v-model="screenForm.goodsOldCode" placeholder="请输入产品编码"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :xs="24" :sm="12" :lg="6">
  24. <el-form-item label="规格型号" prop="model">
  25. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :xs="24" :sm="12" :lg="6">
  29. <el-form-item label="制单日期" prop="createDate">
  30. <el-date-picker v-model="screenForm.createDate" type="datetimerange" range-separator="至"
  31. style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期"
  32. end-placeholder="结束日期">
  33. </el-date-picker>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :xs="24" :sm="12" :lg="6">
  37. <el-form-item label="发货日期" prop="deliverDate">
  38. <el-date-picker v-model="screenForm.deliverDate" type="datetimerange" range-separator="至"
  39. style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期"
  40. end-placeholder="结束日期">
  41. </el-date-picker>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :xs="24" :sm="12" :lg="6">
  45. <el-form-item label="经销商编号" prop="jxsNum">
  46. <el-input v-model="screenForm.jxsNum" placeholder="请输入经销商编号"></el-input>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="6">
  50. <el-form-item label="经销商名称" prop="jxsName">
  51. <el-input v-model="screenForm.jxsName" placeholder="请输入经销商名称"></el-input>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :xs="24" :sm="12" :lg="6">
  55. <el-form-item label="发货单号" prop="orderNum">
  56. <el-input v-model="screenForm.orderNum" placeholder="请输入发货单号"></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="6">
  60. <el-form-item label="订单" prop="mainOrderId">
  61. <el-input v-model="screenForm.mainOrderId" placeholder="请输入订单"></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="12" :lg="6">
  65. <el-form-item label="存货类别" prop="type">
  66. <el-select v-model="screenForm.type" placeholder="选择存货类别" style="width: 100%" clearable>
  67. <el-option v-for="item in categoryList" :key="item.name" :label="item.name" :value="item.name">
  68. </el-option>
  69. </el-select>
  70. </el-form-item>
  71. </el-col>
  72. <el-col :xs="24" :sm="12" :lg="6">
  73. <el-form-item label="表头业务员" prop="k3ServiceId">
  74. <el-select v-model="screenForm.k3ServiceId" placeholder="选择表头业务员" clearable filterable
  75. style="width: 100%">
  76. <el-option v-for="item in salesmanList" :key="item.adminUserId" :label="item.nickName"
  77. :value="item.adminUserId">
  78. </el-option>
  79. </el-select>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :xs="24" :sm="12" :lg="6">
  83. <el-form-item label="表体业务员" prop="salesMan">
  84. <el-select v-model="screenForm.salesMan" placeholder="选择表体业务员" clearable filterable style="width: 100%">
  85. <el-option v-for="item in salesmanList" :key="item.adminUserId" :label="item.nickName"
  86. :value="item.adminUserId">
  87. </el-option>
  88. </el-select>
  89. </el-form-item>
  90. </el-col>
  91. <el-col :xs="24" :sm="12" :lg="6">
  92. <el-form-item label="审核时间" prop="approvaTime">
  93. <el-date-picker v-model="screenForm.approvaTime" type="datetimerange" range-separator="至"
  94. style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期"
  95. end-placeholder="结束日期">
  96. </el-date-picker>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :xs="24" :sm="24" :lg="12" class="tr">
  100. <el-form-item label="">
  101. <el-button @click="resetScreenForm">清空</el-button>
  102. <el-button type="primary" @click="submitScreenForm">搜索</el-button>
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. </el-form>
  107. </div>
  108. <div class="mymain-container">
  109. <div class="btn-group clearfix">
  110. <div class="fl">
  111. <el-button type="primary" size="mini" @click="toPrint" v-if="$checkBtnRole('print', $route.meta.roles)" :disabled="tableSelection.length < 1">打印发货单
  112. </el-button>
  113. <div class="num" v-if="totalNum">
  114. 当前列表总发货数量:{{ totalNum }}
  115. </div>
  116. </div>
  117. <!-- -->
  118. <div class="fr" style="display: flex;">
  119. <el-button size="mini" type="primary" v-if="$checkBtnRole('refund', $route.meta.roles)"
  120. style="margin-right: 10px;" icon="el-icon-plus"
  121. @click="$router.push('/supply/deliver/apply_list?isShow=true')">零售退货申请</el-button>
  122. <el-button size="mini" type="primary" v-if="$checkBtnRole('refund', $route.meta.roles)"
  123. style="margin-right: 10px;" icon="el-icon-plus"
  124. @click="$router.push('/supply/deliver/engin_list?isShow=true')">工程退货申请</el-button>
  125. <ExportButton :exUrl="'invoice/exportInvoice'" :exParams="exParams" />
  126. </div>
  127. </div>
  128. <div class="table">
  129. <el-table ref="table" v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit
  130. highlight-current-row stripe @select="handleSelect" @select-all="handleSelectAll" show-summary
  131. :summary-method="$getSummaries" max-height="500">
  132. <el-table-column align="center" type="selection" width="55"></el-table-column>
  133. <el-table-column align="right" label="打印次数" prop="printNum" min-width="80" show-overflow-tooltip>
  134. </el-table-column>
  135. <el-table-column align="left" label="订单类型" prop="orderType" min-width="100" show-overflow-tooltip>
  136. <template slot-scope="scope">
  137. {{ scope.row.orderType | orderTypeFilter }}
  138. </template>
  139. </el-table-column>
  140. <el-table-column align="left" label="审核日期" prop="approvalTime" min-width="160" show-overflow-tooltip>
  141. </el-table-column>
  142. <el-table-column align="left" label="发货日期" prop="orderTime" min-width="160" show-overflow-tooltip>
  143. </el-table-column>
  144. <el-table-column align="left" label="订单日期" prop="theTime" min-width="160" show-overflow-tooltip>
  145. </el-table-column>
  146. <el-table-column align="left" label="发货单号" prop="id" min-width="130" show-overflow-tooltip>
  147. <template slot-scope="scope">
  148. <CopyButton :copyText="scope.row.id" />
  149. <span>{{ scope.row.id }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column align="left" label="订单号" prop="orderId" min-width="140" show-overflow-tooltip>
  153. <template slot-scope="scope">
  154. <CopyButton
  155. :copyText="scope.row.enginOrderType == 'HOME' || scope.row.enginOrderType == 'TRADE' ? scope.row.enginOrderNo : scope.row.mainOrderId" />
  156. <span>{{ scope.row.enginOrderType == 'HOME' || scope.row.enginOrderType == 'TRADE' ?
  157. scope.row.enginOrderNo
  158. : scope.row.mainOrderId
  159. }}</span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column align="left" label="经销商编码" prop="customerNumber" min-width="100" show-overflow-tooltip>
  163. <template slot-scope="scope">
  164. <CopyButton :copyText="scope.row.customerNumber" />
  165. <span>{{ scope.row.customerNumber }}</span>
  166. </template>
  167. </el-table-column>
  168. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
  169. <template slot-scope="scope">
  170. <CopyButton :copyText="scope.row.customerName" />
  171. <span>{{ scope.row.customerName }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip>
  175. </el-table-column>
  176. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
  177. <template slot-scope="scope">
  178. <CopyButton :copyText="scope.row.materialCode" />
  179. <span>{{ scope.row.materialCode }}</span>
  180. </template>
  181. </el-table-column>
  182. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  183. <template slot-scope="scope">
  184. <CopyButton :copyText="scope.row.materialOldNumber" />
  185. <span>{{ scope.row.materialOldNumber }}</span>
  186. </template>
  187. </el-table-column>
  188. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  189. <template slot-scope="scope">
  190. <CopyButton :copyText="scope.row.materialName" />
  191. <span>{{ scope.row.materialName }}</span>
  192. </template>
  193. </el-table-column>
  194. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  195. <template slot-scope="scope">
  196. <CopyButton :copyText="scope.row.specification" />
  197. <span>{{ scope.row.specification }}</span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column align="left" label="仓库" prop="correspondName" min-width="100" show-overflow-tooltip>
  201. </el-table-column>
  202. <el-table-column align="right" label="未出库数量" prop="compute_wckNum" min-width="100" show-overflow-tooltip>
  203. <template slot-scope="scope">
  204. {{ comRefundableQty(scope.row.type, scope.row.salesExamineStatus, scope.row) }}
  205. </template>
  206. </el-table-column>
  207. <el-table-column align="right" label="发货数量" prop="refundableQty" min-width="100" show-overflow-tooltip>
  208. </el-table-column>
  209. <el-table-column align="right" label="发货金额" prop="payAmount" min-width="100" show-overflow-tooltip>
  210. <template slot-scope="scope">
  211. {{ scope.row.payAmount | numToFixed }}
  212. </template>
  213. </el-table-column>
  214. <el-table-column align="right" label="发货返利金额" prop="payRebateAmount" min-width="110" show-overflow-tooltip>
  215. <template slot-scope="scope">
  216. {{ scope.row.payRebateAmount | numToFixed }}
  217. </template>
  218. </el-table-column>
  219. <el-table-column align="right" label="发货折扣金额" prop="totalDiscAmount" min-width="110" show-overflow-tooltip>
  220. <template slot-scope="scope">
  221. {{ scope.row.totalDiscAmount | numToFixed }}
  222. </template>
  223. </el-table-column>
  224. <el-table-column align="right" label="折扣额合计" prop="compute_zkeAmount" min-width="100" show-overflow-tooltip>
  225. <template slot-scope="scope">
  226. {{ (scope.row.totalDiscAmount + scope.row.payRebateAmount) | numToFixed }}
  227. </template>
  228. </el-table-column>
  229. <el-table-column align="right" label="含税单价" prop="singlePayPrice" min-width="100" show-overflow-tooltip>
  230. <template slot-scope="scope">
  231. {{ scope.row.singlePayPrice | numToFixed }}
  232. </template>
  233. </el-table-column>
  234. <el-table-column align="right" label="含税总额" prop="payAmount" min-width="100" show-overflow-tooltip>
  235. <template slot-scope="scope">
  236. {{ scope.row.payAmount | numToFixed }}
  237. </template>
  238. </el-table-column>
  239. <el-table-column align="left" label="表头业务员" prop="k3ServiceName" min-width="100" show-overflow-tooltip>
  240. </el-table-column>
  241. <el-table-column align="left" label="表体业务员" prop="serviceName" min-width="100" show-overflow-tooltip>
  242. </el-table-column>
  243. <el-table-column align="left" label="政策单号" prop="policyCode" min-width="100" show-overflow-tooltip>
  244. </el-table-column>
  245. <el-table-column align="left" label="政策名称" prop="policyTitle" min-width="100" show-overflow-tooltip>
  246. </el-table-column>
  247. <el-table-column align="left" label="区域" prop="adminArea" min-width="100" show-overflow-tooltip>
  248. </el-table-column>
  249. <el-table-column align="left" label="业务区域" prop="serviceArea" min-width="100" show-overflow-tooltip>
  250. </el-table-column>
  251. <el-table-column align="left" label="月份" prop="month" min-width="100" show-overflow-tooltip>
  252. </el-table-column>
  253. <el-table-column align="left" label="项目编码" prop="refEnginRecordNo" min-width="160" show-overflow-tooltip>
  254. </el-table-column>
  255. <el-table-column align="left" label="项目名称" prop="refProjectName" min-width="160" show-overflow-tooltip>
  256. </el-table-column>
  257. <el-table-column align="left" label="存货类别" prop="categoryName" min-width="160" show-overflow-tooltip>
  258. </el-table-column>
  259. <el-table-column align="left" label="申请发货单备注" prop="remark" min-width="200" show-overflow-tooltip>
  260. </el-table-column>
  261. <el-table-column align="left" label="表头备注" prop="headerRemark" min-width="200" show-overflow-tooltip>
  262. </el-table-column>
  263. <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="200" show-overflow-tooltip>
  264. </el-table-column>
  265. <el-table-column align="left" label="打印次数" prop="printNum" min-width="100" show-overflow-tooltip>
  266. </el-table-column>
  267. <el-table-column align="left" label="经销商现金钱包" prop="customerWalletName" min-width="120"
  268. show-overflow-tooltip></el-table-column>
  269. <el-table-column align="left" label="经销商返利钱包" prop="customerWalletName2" min-width="120"
  270. show-overflow-tooltip></el-table-column>
  271. <el-table-column align="left" label="文件编号" prop="itemFileNo" min-width="100" show-overflow-tooltip>
  272. </el-table-column>
  273. </el-table>
  274. </div>
  275. </div>
  276. <div class="pagination clearfix">
  277. <div class="fr">
  278. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  279. :current-page="currentPage" :page-sizes="[10, 20, 50, 100, 500, 1000, 2000]" :page-size="10"
  280. layout="total, sizes, prev, pager, next, jumper" :total="listTotal">
  281. </el-pagination>
  282. </div>
  283. </div>
  284. </div>
  285. <print-preview ref="preView" />
  286. <el-dialog title="密码确认" :visible.sync="isShowDialog" :show-close="false" width="40%" :close-on-click-modal="false">
  287. <el-form ref="dialogForm" :model="dialogForm" :rules="dialogFormRules" label-position="right" label-width="70px">
  288. <el-row :gutter="20">
  289. <el-col :xs="24" :sm="24" :lg="24">
  290. <el-form-item label="密码" prop="password">
  291. <el-input v-model="dialogForm.password" autocomplete="off" placeholder="请输入密码"></el-input>
  292. </el-form-item>
  293. </el-col>
  294. <el-col :xs="24" :sm="12" :lg="12">
  295. <el-form-item label="操作人" prop="createMan">
  296. <el-input v-model="dialogForm.createMan" readonly></el-input>
  297. </el-form-item>
  298. </el-col>
  299. <el-col :xs="24" :sm="12" :lg="12" style="height: 51px;">
  300. <el-form-item label="操作日期" prop="createDate">
  301. <el-date-picker v-model="dialogForm.createDate" readonly type="date" value-format="yyyy-MM-dd"
  302. style="width: 100%;" placeholder="选择日期">
  303. </el-date-picker>
  304. </el-form-item>
  305. </el-col>
  306. </el-row>
  307. </el-form>
  308. <div slot="footer" class="dialog-footer">
  309. <el-button @click="cancelDialogForm">取 消</el-button>
  310. <el-button type="primary" @click="submitDialogForm">确 定</el-button>
  311. </div>
  312. </el-dialog>
  313. </div>
  314. </template>
  315. <script>
  316. import { getSumList } from '@/api/supply/deliver'
  317. import { checkPassword, getListInvoiceNumber } from "@/api/supply/pickup";
  318. import { getCategoryList, getSalesmanList } from '@/api/common'
  319. import SumPrint from '@/views/supply/deliver/components/sum_print'
  320. import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
  321. disAutoConnect();
  322. import panel from './components/design/panel'
  323. import { getDetail, detailArr } from './components/design/print-data'
  324. import printPreview from './components/design/preview.vue'
  325. export default {
  326. components: {
  327. SumPrint,
  328. printPreview
  329. },
  330. filters: {
  331. orderTypeFilter(val) {
  332. const MAP = {
  333. HOME: '家用单',
  334. TRADE: '商用单',
  335. RETAIL: '零售单',
  336. RETAIL_POLICY: '销售政策单',
  337. PERMU_HOME: '置换家用单',
  338. PERMU_TRADE: '置换商用单',
  339. PERMU_RETAIL: '置换零售单',
  340. PERMU_RETAIL_POLICY: '置换销售政策单',
  341. REQUISITION_HOME: '调拨家用单',
  342. REQUISITION_TRADE: '调拨商用单',
  343. REQUISITION_RETAIL: '调拨零售单',
  344. REQUISITION_RETAIL_POLICY: '调拨销售政策单',
  345. }
  346. return MAP[val];
  347. }
  348. },
  349. data() {
  350. return {
  351. currentPage: 1, // 当前页码
  352. pageSize: 10, // 每页数量
  353. listTotal: 0, // 列表总数
  354. dataList: null, // 列表数据
  355. listLoading: false, // 列表加载loading
  356. screenForm: { // 筛选表单数据
  357. goodsName: '',
  358. goodsCode: '',
  359. goodsOldCode: '',
  360. model: '',
  361. createDate: '',
  362. deliverDate: '',
  363. jxsNum: '',
  364. jxsName: '',
  365. orderNum: '',
  366. type: '',
  367. salesMan: '',
  368. k3ServiceId: '',
  369. mainOrderId: '',
  370. approvaTime: ''
  371. },
  372. categoryList: [],
  373. salesmanList: [],
  374. tableSelection: [],
  375. queryItem: {},
  376. isShowPrint: false,
  377. totalNum: 0,
  378. curPaper: {
  379. type: 'A5',
  380. width: 500,
  381. height: 147.6
  382. },
  383. paperTypes: {
  384. 'A3': {
  385. width: 420,
  386. height: 296.6
  387. },
  388. 'A4': {
  389. width: 210,
  390. height: 296.6
  391. },
  392. 'A5': {
  393. width: 210,
  394. height: 147.6
  395. },
  396. 'B3': {
  397. width: 500,
  398. height: 352.6
  399. },
  400. 'B4': {
  401. width: 250,
  402. height: 352.6
  403. },
  404. 'B5': {
  405. width: 250,
  406. height: 175.6
  407. }
  408. },
  409. scaleValue: 1,
  410. scaleMax: 5,
  411. scaleMin: 0.5,
  412. hiprintTemplate: '',
  413. isShowDialog: false,
  414. dialogForm: {
  415. password: "",
  416. createMan: "",
  417. createDate: "",
  418. },
  419. dialogFormRules: {
  420. password: [{ required: true, message: "请输入密码", trigger: "blur" }],
  421. },
  422. }
  423. },
  424. computed: {
  425. exParams() {
  426. return {
  427. materialName: this.screenForm.goodsName,
  428. materialNumber: this.screenForm.goodsCode,
  429. materialOldNumber: this.screenForm.goodsOldCode,
  430. specification: this.screenForm.model,
  431. createStartTime: this.screenForm.createDate ? this.screenForm.createDate[0] : '',
  432. createEndTime: this.screenForm.createDate ? this.screenForm.createDate[1] : '',
  433. startTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[0] : '',
  434. endTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[1] : '',
  435. customerNumber: this.screenForm.jxsNum,
  436. customerName: this.screenForm.jxsName,
  437. id: this.screenForm.orderNum,
  438. categoryName: this.screenForm.type,
  439. serviceId: this.screenForm.salesMan,
  440. k3ServiceId: this.screenForm.k3ServiceId,
  441. approvalEndTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[1] : '',
  442. approvalStartTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[0] : '',
  443. }
  444. },
  445. comRefundableQty() {
  446. return (type, status, row) => {
  447. if (type == 2) {
  448. return ''
  449. } else {
  450. if (status == 'OK') {
  451. return 0
  452. } else {
  453. return row.refundableQty
  454. }
  455. }
  456. }
  457. },
  458. curPaperType() {
  459. let type = 'other'
  460. let types = this.paperTypes
  461. for (const key in types) {
  462. let item = types[key]
  463. let { width, height } = this.curPaper
  464. if (item.width === width && item.height === height) {
  465. type = key
  466. }
  467. }
  468. return type
  469. }
  470. },
  471. watch: {
  472. dataList: {
  473. handler(newValue, oldValue) {
  474. if(newValue && newValue.length) {
  475. newValue.forEach((item, index) => {
  476. this.dataList[index].compute_zkeAmount = item.totalDiscAmount + item.payRebateAmount;
  477. this.dataList[index].compute_wckNum = this.comRefundableQty(item.type, item.salesExamineStatus, item);
  478. })
  479. }
  480. },
  481. immediate: true,
  482. deep: true
  483. }
  484. },
  485. created() {
  486. this.getSalesmanList();
  487. this.getCategoryList();
  488. this.getList();
  489. },
  490. // activated() {
  491. // this.initPrint()
  492. // },
  493. mounted() {
  494. this.initPrint()
  495. },
  496. methods: {
  497. initPrint() {
  498. hiprint.init({
  499. providers: [new defaultElementTypeProvider()]
  500. });
  501. // 还原配置
  502. hiprint.setConfig()
  503. // 替换配置
  504. hiprint.setConfig({
  505. movingDistance: 2.5,
  506. text: {
  507. supportOptions: [
  508. {
  509. name: 'styler',
  510. hidden: true
  511. },
  512. {
  513. name: 'formatter',
  514. hidden: true
  515. },
  516. ]
  517. }
  518. })
  519. // eslint-disable-next-line no-undef
  520. hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
  521. this.hiprintTemplate = new hiprint.PrintTemplate({
  522. template: panel,
  523. settingContainer: '#PrintElementOptionSetting',
  524. paginationContainer: '.hiprint-printPagination'
  525. });
  526. this.hiprintTemplate.design('#hiprint-printTemplate');
  527. // 获取当前放大比例, 当zoom时传true 才会有
  528. // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
  529. }
  530. ,
  531. // 获取业务员列表
  532. getSalesmanList() {
  533. getSalesmanList({
  534. pageNum: 1,
  535. pageSize: -1,
  536. isCustomer: 0,
  537. status: true,
  538. }).then(res => {
  539. this.salesmanList = res.data.records;
  540. })
  541. },
  542. // 获取存货类别列表
  543. getCategoryList() {
  544. getCategoryList({
  545. pageNum: 1,
  546. pageSize: -1,
  547. }).then(res => {
  548. this.categoryList = res.data.records;
  549. })
  550. },
  551. // 查询列表
  552. getList() {
  553. this.listLoading = true;
  554. let params = {
  555. pageNum: this.currentPage,
  556. pageSize: this.pageSize,
  557. materialName: this.screenForm.goodsName,
  558. materialNumber: this.screenForm.goodsCode,
  559. materialOldNumber: this.screenForm.goodsOldCode,
  560. specification: this.screenForm.model,
  561. createStartTime: this.screenForm.createDate ? this.screenForm.createDate[0] : '',
  562. createEndTime: this.screenForm.createDate ? this.screenForm.createDate[1] : '',
  563. startTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[0] : '',
  564. endTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[1] : '',
  565. customerNumber: this.screenForm.jxsNum,
  566. customerName: this.screenForm.jxsName,
  567. id: this.screenForm.orderNum,
  568. categoryName: this.screenForm.type,
  569. serviceId: this.screenForm.salesMan,
  570. k3ServiceId: this.screenForm.k3ServiceId,
  571. mainOrderId: this.screenForm.mainOrderId,
  572. approvalEndTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[1] : '',
  573. approvalStartTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[0] : '',
  574. };
  575. getSumList(params).then((res) => {
  576. res.data.records.forEach(item => {
  577. item.notOutNumber = item.salesStatus ? 0 : item.refundableQty;
  578. item.sums1 = ['refundableQty', 'compute_wckNum'];
  579. item.sums2 = ['payAmount', 'payRebateAmount', 'discAmount', 'totalDiscAmount', 'singlePayPrice', 'compute_zkeAmount'];
  580. })
  581. this.dataList = res.data.records;
  582. this.listTotal = res.data.total;
  583. this.listLoading = false;
  584. })
  585. this.getListInvoiceNumber()
  586. },
  587. getListInvoiceNumber() {
  588. let params = {
  589. materialName: this.screenForm.goodsName,
  590. materialNumber: this.screenForm.goodsCode,
  591. materialOldNumber: this.screenForm.goodsOldCode,
  592. specification: this.screenForm.model,
  593. createStartTime: this.screenForm.createDate ? this.screenForm.createDate[0] : '',
  594. createEndTime: this.screenForm.createDate ? this.screenForm.createDate[1] : '',
  595. startTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[0] : '',
  596. endTime: this.screenForm.deliverDate ? this.screenForm.deliverDate[1] : '',
  597. customerNumber: this.screenForm.jxsNum,
  598. customerName: this.screenForm.jxsName,
  599. id: this.screenForm.orderNum,
  600. categoryName: this.screenForm.type,
  601. serviceId: this.screenForm.salesMan,
  602. k3ServiceId: this.screenForm.k3ServiceId,
  603. mainOrderId: this.screenForm.mainOrderId,
  604. approvalEndTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[1] : '',
  605. approvalStartTime: this.screenForm.approvaTime ? this.screenForm.approvaTime[0] : '',
  606. };
  607. getListInvoiceNumber(params).then(res => {
  608. // console.log(res,'ii');
  609. this.totalNum = res.data
  610. })
  611. }
  612. ,
  613. // 提交筛选表单
  614. submitScreenForm() {
  615. this.currentPage = 1;
  616. this.getList();
  617. },
  618. // 重置筛选表单
  619. resetScreenForm() {
  620. this.$refs.screenForm.resetFields();
  621. this.currentPage = 1;
  622. this.getList();
  623. },
  624. // 更改每页数量
  625. handleSizeChange(val) {
  626. this.pageSize = val;
  627. this.currentPage = 1;
  628. this.getList();
  629. },
  630. // 更改当前页
  631. handleCurrentChange(val) {
  632. this.currentPage = val;
  633. this.getList();
  634. },
  635. handleSelect(selection, row) {
  636. this.$refs.table.toggleRowSelection(row);
  637. this.dataList.forEach((item) => {
  638. if (item.id === row.id) {
  639. this.$refs.table.toggleRowSelection(item);
  640. }
  641. });
  642. this.tableSelection = this.$refs.table.selection;
  643. },
  644. handleSelectAll(selection) {
  645. this.tableSelection = this.$refs.table.selection;
  646. },
  647. // 点击打印
  648. toPrint() {
  649. // this.$refs
  650. this.queryItem = this.tableSelection;
  651. // console.log(this.tableSelection);
  652. // this.isShowPrint = true;
  653. // this.$refs.myPdfComponent.print()
  654. // console.log(this.hiprintTemplate, detailArr);
  655. // getDetail(this.tableSelection)
  656. // this.$refs.preView.show(this.hiprintTemplate, detailArr)
  657. if (!this.tableSelection[0].printNum) {
  658. this.queryItem = this.tableSelection;
  659. // this.isShowPrint = true;
  660. getDetail(this.tableSelection, JSON.parse(
  661. localStorage.getItem("supply_user")
  662. ).nickName)
  663. this.$refs.preView.show(this.hiprintTemplate, detailArr)
  664. } else {
  665. this.queryItem = this.tableSelection;
  666. this.dialogForm.createMan = JSON.parse(
  667. localStorage.getItem("supply_user")
  668. ).nickName;
  669. this.dialogForm.createDate = this.getDate();
  670. this.isShowDialog = true;
  671. }
  672. },
  673. // 关闭弹窗
  674. cancelDialogForm() {
  675. this.isShowDialog = false;
  676. this.$refs.dialogForm.resetFields();
  677. },
  678. // 提交 弹窗
  679. submitDialogForm() {
  680. this.$refs.dialogForm.validate((valid) => {
  681. if (valid) {
  682. let params = {
  683. shipId: this.queryItem[0].invoiceId,
  684. password: this.dialogForm.password,
  685. };
  686. checkPassword(params).then((res) => {
  687. this.cancelDialogForm();
  688. getDetail(this.tableSelection, JSON.parse(
  689. localStorage.getItem("supply_user")
  690. ).nickName)
  691. this.$refs.preView.show(this.hiprintTemplate, detailArr)
  692. });
  693. }
  694. });
  695. },
  696. getDate() {
  697. var date = new Date();
  698. var seperator1 = "-";
  699. var year = date.getFullYear();
  700. var month = date.getMonth() + 1;
  701. var strDate = date.getDate();
  702. if (month >= 1 && month <= 9) {
  703. month = "0" + month;
  704. }
  705. if (strDate >= 0 && strDate <= 9) {
  706. strDate = "0" + strDate;
  707. }
  708. var currentdate = year + seperator1 + month + seperator1 + strDate;
  709. return currentdate;
  710. },
  711. backList() {
  712. this.queryItem = {};
  713. this.isShowPrint = false;
  714. },
  715. /**
  716. * 设置纸张大小
  717. * @param type [A3, A4, A5, B3, B4, B5, other]
  718. * @param value {width,height} mm
  719. */
  720. setPaper(type, value) {
  721. try {
  722. if (Object.keys(this.paperTypes).includes(type)) {
  723. this.curPaper = { type: type, width: value.width, height: value.height }
  724. this.hiprintTemplate.setPaper(value.width, value.height)
  725. } else {
  726. this.curPaper = { type: 'other', width: value.width, height: value.height }
  727. this.hiprintTemplate.setPaper(value.width, value.height)
  728. }
  729. } catch (error) {
  730. this.$message.error(`操作失败: ${error}`)
  731. }
  732. },
  733. }
  734. }
  735. </script>
  736. <style lang="scss" scoped>
  737. .num {
  738. display: inline-block;
  739. font-size: 16px;
  740. margin-left: 20px;
  741. color: #909399;
  742. vertical-align: middle;
  743. }
  744. </style>