wave-print-order.vue 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441
  1. <template>
  2. <el-dialog
  3. title="波次详情"
  4. :close-on-click-modal="false"
  5. :visible.sync="visible"
  6. v-if="visible"
  7. :fullscreen="true"
  8. @close="dialogClose">
  9. <!-- 搜索栏 -->
  10. <div class="search-bar">
  11. <el-form :inline="true" class="search-form" ref="searchForm" :model="searchForm" label-width="auto" size="small">
  12. <div class="input-row">
  13. <el-form-item label="订单编号" class="search-form-item">
  14. <el-input v-model="searchForm.orderNumber" placeholder="请输入订单编号" :clearable="true"></el-input>
  15. </el-form-item>
  16. <el-form-item label="收件人" class="search-form-item">
  17. <el-input type="text" v-model="searchForm.receiverName" placeholder="请输入收件人" :clearable="true"></el-input>
  18. </el-form-item>
  19. <el-form-item label="运单号" class="search-form-item">
  20. <el-input type="text" v-model="searchForm.deliveryNo" placeholder="请输入运单号" :clearable="true"></el-input>
  21. </el-form-item>
  22. <el-form-item label="PDF生成状态" class="search-form-item">
  23. <el-select type="text" v-model="searchForm.workStatus" placeholder="请选择PDF生成状态" :clearable="true">
  24. <el-option label="未生成" value="0"></el-option>
  25. <el-option label="已生成" value="2"></el-option>
  26. <el-option label="失败" value="11"></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item>
  30. <div class="default-btn primary-btn" @click="searchChange(true)">{{$t('crud.searchBtn')}}</div>
  31. <div class="default-btn" @click="resetSearchForm()">{{$t('shop.resetMap')}}</div>
  32. </el-form-item>
  33. </div>
  34. </el-form>
  35. </div>
  36. <div class="mod-order-order">
  37. <div class="main">
  38. <div class="content">
  39. <div style="margin-bottom: 20px">
  40. <div style="margin: 0px 20px 20px 0">
  41. <span>波次号</span><span style="margin-left: 30px; font-weight: bold;font-size: 20px;color: red">{{wave.waveNo}}</span>
  42. <span style="margin-left: 100px">订单数量</span><span style="margin-left: 20px; font-weight: bold;font-size: 20px;color: red">{{wave.orderNum}}</span>
  43. <span v-if="wave.printChannel === 'KuaiYin'" style="margin-left: 100px">总张数</span>
  44. <span v-if="wave.printChannel === 'WoNiu'" style="margin-left: 100px">总张数(含识别页)</span>
  45. <span v-if="wave.printChannel === 'KuaiYin'" style="margin-left: 20px; font-weight: bold;font-size: 20px;color: red">{{wave.sheets}}</span>
  46. <span v-if="wave.printChannel === 'WoNiu'" style="margin-left: 20px; font-weight: bold;font-size: 20px;color: red">{{wave.sheets + wave.orderNum}}</span>
  47. <span style="margin-left: 100px" v-if="wave.printChannel === 'KuaiYin'">消耗纸张(按72张大纸)约</span><span v-if="wave.printChannel === 'KuaiYin'" style="margin-left: 20px; font-weight: bold;font-size: 20px;color: red">
  48. {{((wave.sheets + wave.sheets / 10) / 72).toFixed(2) }}</span>
  49. <span style="margin-left: 100px" v-if="wave.printChannel === 'WoNiu'">消耗纸张(按64张大纸)约</span><span v-if="wave.printChannel === 'WoNiu'" style="margin-left: 20px; font-weight: bold;font-size: 20px;color: red">
  50. {{((wave.sheets + wave.orderNum) / 64).toFixed(2) }}</span>
  51. <span style="margin-left: 100px">生成时间</span><span style="margin-left: 30px">{{wave.createTime}}</span>
  52. <span style="margin-left: 100px" >更新时间</span>
  53. <span style="margin-left: 30px" v-if="!wave.updateTime">-</span>
  54. <span style="margin-left: 30px" v-if="wave.updateTime">{{wave.updateTime}}</span>
  55. </div>
  56. <el-button size="small" @click="generatePdfCombinationBatch" :disabled="wave.productionStatus == 0" :loading="wavePrintOrderPdfDownloadLoading">批量生成PDF</el-button>
  57. <el-button size="small" @click="openPsdConfirmDialog" :disabled="wave.productionStatus == 0" :loading="wavePrintOrderPdfDownloadLoading">生成PSD</el-button>
  58. <el-button size="small" v-if="wave.printChannel === 'ChengDu'" @click="downloadPdfBatch" :disabled="wave.productionStatus == 0" :loading="wavePrintOrderPdfDownloadLoading">批量下载ZIP</el-button>
  59. <!-- <el-button size="small" @click="downloadPrintOrderPdfZip" :disabled="wave.productionStatus == 0" :loading="wavePrintOrderPdfDownloadLoading">批量下载PDF</el-button>-->
  60. <el-button size="small" v-if="wave.printChannel === 'ChengDu'" :loading="wavePrintOrderInfoDownloadLoading" @click="downloadWavePrintOrderInfo" :disabled="wave.productionStatus == 0">下载订单信息</el-button>
  61. <el-button size="small" @click="openScanDialog" :disabled="wave.productionStatus == 0">扫描发货</el-button>
  62. <el-divider direction="vertical" content-position="center"/>
  63. <el-button size="small" @click="productionLockConfirm" v-if="wave.productionStatus === 0">生产锁定</el-button>
  64. <el-button size="small" @click="productionLockCancel" v-if="wave.productionStatus === 1">取消锁定</el-button>
  65. <el-divider direction="vertical" content-position="center"/>
  66. <el-button type="text" @click="deleteWave" :disabled="wave.expressBillStatus == 1 || wave.productionStatus == 1 || wave.scanStatus == 1">删除波次</el-button>
  67. <el-button type="text" icon="el-icon-refresh-left" @click="getDataList(page, null, false)" >刷新</el-button>
  68. <el-button size="small" style="color: #2da641;font-weight: bold" @click="openWaveStatDialog(wave.waveId)" >材质小计</el-button>
  69. </div>
  70. <!-- 表格 -->
  71. <div class="table-con transport-table">
  72. <el-table
  73. border
  74. ref="transportTable"
  75. :data="dataList"
  76. header-cell-class-name="table-header"
  77. row-class-name="table-row-low"
  78. @selection-change="selectionChangeHandle"
  79. @expand-change="handleTableExpandChange"
  80. style="width: 100%">
  81. <!--<el-table-column type="expand">
  82. <template slot-scope="props">
  83. <el-form label-position="left">
  84. <el-form-item label="收件地址">
  85. <span class="expand-detail">{{ props.row.userAddrOrder.province }} </span>
  86. <span class="expand-detail">{{ props.row.userAddrOrder.city }} </span>
  87. <span class="expand-detail">{{ props.row.userAddrOrder.area }} </span>
  88. <span class="expand-detail">{{ props.row.userAddrOrder.addr }} </span>
  89. <span class="expand-detail">{{ props.row.userAddrOrder.receiverName }} </span>
  90. <span class="expand-detail">{{ props.row.userAddrOrder.receiverMobile }} </span>
  91. </el-form-item>
  92. </el-form>
  93. </template>
  94. </el-table-column>-->
  95. <!-- <el-table-column-->
  96. <!-- type="selection">-->
  97. <!-- </el-table-column>-->
  98. <el-table-column
  99. align="center"
  100. prop="serialNo"
  101. width="65"
  102. label="序号">
  103. <template slot-scope="scope">
  104. <span class="table-cell-text">{{ scope.row.serialNo }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. label="订单号"
  109. width="180"
  110. align="center"
  111. prop="orderNumber">
  112. <template slot-scope="scope">
  113. <span>{{scope.row.orderNumber }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column
  117. label="第三方单号"
  118. width="100"
  119. align="center"
  120. v-if="wave.printChannel === 'KuaiYin' && wave.printChannel === 'Lightning'"
  121. prop="orderNo">
  122. <template slot-scope="scope">
  123. <span>{{scope.row.orderNo }}</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column
  127. label="下单时间"
  128. align="center"
  129. prop="orderTime">
  130. <template slot-scope="scope">
  131. <span>{{scope.row.orderTime }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column
  135. label="收件人"
  136. align="center"
  137. prop="receiverName">
  138. <template slot-scope="scope">
  139. <div>
  140. <el-tooltip placement="top">
  141. <div slot="content" style="font-size: 8px">
  142. <span>{{scope.row.userAddrOrder.province }}</span>
  143. <span>{{scope.row.userAddrOrder.city }}</span>
  144. <span>{{scope.row.userAddrOrder.area }}</span>
  145. <span>{{scope.row.userAddrOrder.street }}</span>
  146. <span>{{scope.row.userAddrOrder.addr }}</span>
  147. </div>
  148. <div>
  149. <span>{{scope.row.userAddrOrder.receiver }}</span>
  150. <br/>
  151. <span>{{scope.row.userAddrOrder.mobile }}</span>
  152. </div>
  153. </el-tooltip>
  154. </div>
  155. </template>
  156. </el-table-column>
  157. <el-table-column
  158. label="产品名"
  159. width="300"
  160. align="center"
  161. prop="prodName">
  162. <template slot-scope="scope">
  163. <span>{{scope.row.prodName }}</span>
  164. <!--<el-tooltip placement="top">
  165. <div
  166. slot="content"
  167. style="font-size: 8px"
  168. v-for="orderItem in scope.row.orderItemList"
  169. :key="orderItem.orderItemId">
  170. <div>{{orderItem.prodName}}</div>
  171. </div>
  172. <span v-if="scope.row.orderItemList.length > 1">{{scope.row.orderItemList[0].prodName}} <br/>......</span>
  173. <span v-else>{{scope.row.orderItemList[0].prodName}}</span>
  174. </el-tooltip>-->
  175. </template>
  176. </el-table-column>
  177. <el-table-column
  178. align="center"
  179. prop="prodNums"
  180. width="65"
  181. label="数量">
  182. <template slot-scope="scope">
  183. <span>{{scope.row.prodNums }}</span>
  184. </template>
  185. </el-table-column>
  186. <!--<el-table-column
  187. align="center"
  188. prop="isMerge"
  189. width="65"
  190. label="合单">
  191. <template slot-scope="scope">
  192. <el-tag type="info" effect="dark" v-if="scope.row.isMerge == 1">否</el-tag>
  193. <el-tag type="danger" effect="dark" v-if="scope.row.isMerge == 2">是</el-tag>
  194. </template>
  195. </el-table-column>-->
  196. <el-table-column
  197. align="center"
  198. prop="deliveryName"
  199. width="110"
  200. label="快递">
  201. <template slot-scope="scope">
  202. <span>{{scope.row.deliveryName }}</span>
  203. </template>
  204. </el-table-column>
  205. <el-table-column
  206. align="center"
  207. label="快递单号"
  208. prop="deliveryNo">
  209. <template slot-scope="scope">
  210. <span>{{scope.row.deliveryNo }}</span>
  211. </template>
  212. </el-table-column>
  213. <el-table-column
  214. align="center"
  215. prop="expressBillTime"
  216. label="运单号时间">
  217. <template slot-scope="scope">
  218. <span>{{scope.row.expressBillTime }}</span>
  219. </template>
  220. </el-table-column>
  221. <el-table-column
  222. align="center"
  223. prop="scanTime"
  224. label="发货时间">
  225. <template slot-scope="scope">
  226. <span>{{scope.row.deliveryTime }}</span>
  227. </template>
  228. </el-table-column>
  229. <el-table-column
  230. align="center"
  231. prop="status"
  232. width="90"
  233. label="状态">
  234. <template slot-scope="scope">
  235. <span v-if="scope.row.status == 1">待打印</span>
  236. <span v-if="scope.row.status == 2">待发货</span>
  237. <span v-if="scope.row.status == 3">已发货</span>
  238. <span v-if="scope.row.status == 11">已取消</span>
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. align="center"
  243. prop="workStatus"
  244. width="80"
  245. label="生成状态">
  246. <template slot-scope="scope">
  247. <el-tooltip placement="top" v-if="scope.row.remark">
  248. <div slot="content" style="font-size: 8px" >
  249. <span>{{scope.row.remark }}</span>
  250. </div>
  251. <div>
  252. <el-tag type="success" v-if="scope.row.workStatus == 2" effect="dark">已生成</el-tag>
  253. <el-tag type="info" v-if="scope.row.workStatus == 0" effect="dark">未生成</el-tag>
  254. <el-tag type="danger" v-if="scope.row.workStatus == 3" effect="dark">失败</el-tag>
  255. </div>
  256. </el-tooltip>
  257. <div v-else>
  258. <el-tag type="success" v-if="scope.row.workStatus == 2" effect="dark">已生成</el-tag>
  259. <el-tag type="info" v-if="scope.row.workStatus == 0" effect="dark">未生成</el-tag>
  260. <el-tag type="danger" v-if="scope.row.workStatus == 3" effect="dark">失败</el-tag>
  261. </div>
  262. </template>
  263. </el-table-column>
  264. <el-table-column
  265. align="center"
  266. prop="remark"
  267. width="140"
  268. label="备注">
  269. <template slot-scope="scope">
  270. <span style="color:red;overflow: hidden; width: 100px; text-overflow:ellipsis">{{scope.row.remark}}</span>
  271. </template>
  272. </el-table-column>
  273. <el-table-column
  274. align="center"
  275. :label="$t('crud.menu')"
  276. width="240"
  277. >
  278. <template slot-scope="scope">
  279. <div style="display: inline-block;float: left;">
  280. <el-button v-if="scope.row.workStatus === 0 || scope.row.workStatus == 3" size="mini" @click="generatePdfCombination(scope.row)" :disabled="wave.productionStatus == 0">生成PDF</el-button>
  281. <el-button size="mini" @click="openModifyExpressBillDialog(scope.row)">修改运单号</el-button>
  282. <el-button key="removeFromWaveBtn" size="mini" type="text" v-if="wave.productionStatus == 0 || scope.row.status != 3" :disabled="wave.productionStatus == 1" @click="removeFromWave(scope.row)">移出波次</el-button>
  283. <el-button size="mini" type="text" v-if="scope.row.status == 3" @click="cancelDelivery(scope.row)">取消发货</el-button>
  284. <el-button size="mini" type="text" @click="showModifyRemark(scope.row)">备注</el-button>
  285. </div>
  286. </template>
  287. </el-table-column>
  288. </el-table>
  289. </div>
  290. <!-- 分页 -->
  291. <el-pagination
  292. v-if="dataList.length"
  293. @size-change="handleSizeChange"
  294. @current-change="handleCurrentChange"
  295. :current-page="page.currentPage"
  296. :page-sizes="[61, 200, 400, 600]"
  297. :page-size="page.pageSize"
  298. layout="total, sizes, prev, pager, next, jumper"
  299. :total="page.total">
  300. </el-pagination>
  301. </div>
  302. </div>
  303. </div>
  304. <el-dialog
  305. :append-to-body="true"
  306. title="修改运单号"
  307. :visible.sync="modifyExpressBillVisible"
  308. width="30%"
  309. left
  310. :close-on-click-modal="false"
  311. :close-on-press-escape="false"
  312. >
  313. <el-form :model="wave" label-position="right">
  314. <el-form-item label="">
  315. <span autocomplete="off">订单号:{{printOrder.orderNumber}}</span>
  316. <span autocomplete="off" style="margin-left: 30px">旧运单号:{{printOrder.oldDeliveryNo}}</span>
  317. </el-form-item>
  318. <el-form-item label="快递代号" label-width="70px">
  319. <el-select v-model="printOrder.deliveryCode" :clearable="true" @change="handleDeliveryChange">
  320. <el-option key="ZTO" label="中通快递" value="ZTO"></el-option>
  321. <el-option key="YUNDA" label="韵达速递" value="YUNDA"></el-option>
  322. <el-option key="STO" label="申通快递" value="STO"></el-option>
  323. </el-select>
  324. </el-form-item>
  325. <el-form-item label="快递名称" label-width="70px">
  326. <el-input v-model="printOrder.deliveryName" autocomplete="off"></el-input>
  327. </el-form-item>
  328. <el-form-item label="新运单号" label-width="70px">
  329. <el-input v-model="printOrder.deliveryNo" autocomplete="off"></el-input>
  330. </el-form-item>
  331. </el-form>
  332. <div slot="footer" class="dialog-footer">
  333. <el-button type="primary" @click="modifyExpressBill(wave.waveId, printOrder)">确认</el-button>
  334. </div>
  335. </el-dialog>
  336. <order-scan-delivery ref="orderScanDelivery" @refreshDataList="getDataList(page, null, false)"></order-scan-delivery>
  337. <express-bill-upload
  338. v-if="uploadVisible"
  339. ref="expressBillUpload"
  340. @refreshDataList="getWaitingConsignmentExcel">
  341. </express-bill-upload>
  342. <el-dialog
  343. :append-to-body="true"
  344. title="客服备注"
  345. :visible.sync="buyerRemarkVisible"
  346. v-if="buyerRemarkVisible"
  347. width="30%"
  348. left
  349. :close-on-click-modal="false"
  350. :close-on-press-escape="false">
  351. <el-form :model="printOrder" label-position="right">
  352. <el-form-item label="备注" label-width="70px">
  353. <el-input v-model="printOrder.remark" autocomplete="off"></el-input>
  354. </el-form-item>
  355. </el-form>
  356. <div slot="footer" class="dialog-footer">
  357. <el-button type="primary" @click="modifyBuyerRemarks(printOrder)">确认</el-button>
  358. </div>
  359. </el-dialog>
  360. <wave-stat ref="waveStatRef"></wave-stat>
  361. <el-dialog
  362. :append-to-body="true"
  363. title="PSD生成确认"
  364. :visible.sync="psdConfirmVisibale"
  365. v-if="psdConfirmVisibale"
  366. width="30%"
  367. left
  368. :close-on-click-modal="false"
  369. :close-on-press-escape="false">
  370. <el-form :model="wave" label-position="right">
  371. <el-form-item label="闪卡类型" label-width="100px">
  372. <el-select v-model="wave.skType">
  373. <el-option key="SK" label="闪卡" value="SK"></el-option>
  374. <el-option key="MXP" label="明信片" value="MXP"></el-option>
  375. <el-option key="FK" label="方卡" value="FK"></el-option>
  376. <el-option key="LSP" label="镭射票" value="LSP"></el-option>
  377. <el-option key="DLSP" label="大镭射票" value="DLSP"></el-option>
  378. </el-select>
  379. </el-form-item>
  380. <el-form-item label="材质" label-width="100px">
  381. <el-select v-model="wave.materialList" multiple>
  382. <el-option key="G" label="逆向UV" value="G"></el-option>
  383. <el-option key="V" label="UV光油" value="V"></el-option>
  384. </el-select>
  385. </el-form-item>
  386. <el-form-item label="纸张" label-width="100px">
  387. <el-select v-model="wave.paper">
  388. <el-option key="HC" label="幻彩镭射" value="HCLS"></el-option>
  389. <el-option key="BL" label="玻璃碎镭射" value="BLSLS"></el-option>
  390. </el-select>
  391. </el-form-item>
  392. <el-form-item label="单双面" label-width="100px">
  393. <el-select v-model="wave.side">
  394. <el-option key="1" label="单面" value="1"></el-option>
  395. <el-option key="2" label="双面" value="2"></el-option>
  396. <el-option key="3" label="对裱" value="3"></el-option>
  397. </el-select>
  398. </el-form-item>
  399. <el-form-item label="正背面生成" label-width="100px">
  400. <el-select v-model="wave.frontAndBack">
  401. <el-option key="1" label="只生成正面" value="Front"></el-option>
  402. <el-option key="2" label="只生成背面" value="Back"></el-option>
  403. <el-option key="3" label="同时生成两面" value="Double"></el-option>
  404. </el-select>
  405. </el-form-item>
  406. </el-form>
  407. <div slot="footer" class="dialog-footer">
  408. <el-button type="primary" @click="generateSKWavePSD()">确认</el-button>
  409. </div>
  410. </el-dialog>
  411. </el-dialog>
  412. </template>
  413. <script>
  414. import {PDFDocument} from 'pdf-lib';
  415. import ProdPic from '@/components/prod-pic';
  416. import InputNumberRange from '@/components/input-number-range';
  417. import ExpressBillUpload from './express-bill-upload';
  418. import OrderScanDelivery from '@/components/order-scan-delivery';
  419. import moment from 'moment';
  420. import {downloadPdf} from "@/utils/pdf";
  421. import {downloadXls} from "@/utils/excel";
  422. import {downloadZip} from "@/utils/zip";
  423. import { saveAs } from 'file-saver';
  424. import JSzip from 'jszip';
  425. import axios from 'axios'
  426. import WaveStat from './wave-stat';
  427. export default {
  428. data () {
  429. return {
  430. // 是否全选
  431. selectAll: false,
  432. showHeadScroll: false, // 修改物流相关
  433. logVisible: false,
  434. radio: '1',
  435. logisticsInfo: [], // 包裹列表
  436. logDataForm: {
  437. dvyId: '', // 当前物流公司id
  438. dvyFlowId: '', // 物流单号
  439. dvyNames: [] // 物流公司列表
  440. },
  441. searchForm: {},
  442. uploadVisible: false,
  443. lang: localStorage.getItem('lang'),
  444. errorNum: 0,
  445. buyerRemarkVisible: false,
  446. // 确认修改弹窗
  447. isReviseLog: true, // 是否正在修改物流信息
  448. confirmList: [], // 确认修改信息
  449. dataForm: {},
  450. sts: 0,
  451. dateRange: [],
  452. waveStat:[],
  453. productNumsRange:[],
  454. status: null,
  455. options: [
  456. {
  457. value: 1,
  458. label: "待打印"
  459. },
  460. {
  461. value: 2,
  462. label: "待发货"
  463. },
  464. {
  465. value: 3,
  466. label: "待收货"
  467. },
  468. {
  469. value: 4,
  470. label: "交易完成"
  471. }
  472. ],
  473. refund: [
  474. {
  475. value: 0,
  476. label: this.$i18n.t('order.noAfterSales')},
  477. {
  478. value: 1,
  479. label: this.$i18n.t('order.requestARefund')
  480. },
  481. {
  482. value: 2,
  483. label: this.$i18n.t('order.refundsuccessfully')
  484. },
  485. {
  486. value: 3,
  487. label: this.$i18n.t('order.partialRefundSucc')
  488. },
  489. {
  490. value: 4,
  491. label: this.$i18n.t('order.refundFailed')
  492. }],
  493. resourcesUrl: process.env.VUE_APP_RESOURCES_URL,
  494. dataList: [],
  495. page: {
  496. total: 0, // 总页数
  497. currentPage: 1, // 当前页数
  498. pageSize: 61 // 每页显示多少条
  499. },
  500. dataListLoading: false,
  501. dataListSelections: new Set(),
  502. generateWaveDialogVisible: false,
  503. timeActive: null,
  504. priceWidth: '109px',
  505. infoWidth: '400px',
  506. newWaveNo: null,
  507. visible: false,
  508. wave:{},
  509. printChannel: "ChengDu",
  510. addToWaveDialogVisible: false,
  511. wavePrintOrderInfoDownloadLoading:false,
  512. onKeyDeliveryLoading: false,
  513. operDisabled: false,
  514. productionLockDisabled: false,
  515. wavePrintOrderPdfDownloadLoading: false,
  516. modifyExpressBillVisible: false,
  517. waveStatVisible: false,
  518. printOrder:{},
  519. expandRowDetail:{},
  520. psdConfirmVisibale: false,
  521. }
  522. },
  523. components: {
  524. ProdPic,
  525. InputNumberRange,
  526. ExpressBillUpload,
  527. OrderScanDelivery,
  528. WaveStat
  529. },
  530. computed: {
  531. },
  532. created () {
  533. },
  534. activated () {
  535. // 携带参数查询
  536. var query = this.$route.query
  537. if (Object.keys(query).length > 0) {
  538. this.getDataList(this.page, query)
  539. }
  540. },
  541. mounted () {
  542. },
  543. watch: {
  544. },
  545. methods: {
  546. openPsdConfirmDialog(){
  547. this.psdConfirmVisibale = true;
  548. },
  549. generateSKWavePSD(){
  550. this.$http({
  551. url: this.$http.adornUrl('/platform/wave/generateSKWavePSD'),
  552. method: 'post',
  553. data: this.$http.adornData(this.wave),
  554. }).then(({ data }) => {
  555. if(data){
  556. this.$message({
  557. message: "生成开始请刷新等待",
  558. type: 'success'
  559. })
  560. }else{
  561. this.$message({
  562. message: "生成失败",
  563. type: 'error'
  564. })
  565. }
  566. })
  567. },
  568. handleDeliveryChange(delivery){
  569. if(delivery === 'ZTO'){
  570. this.printOrder.deliveryName = '中通快递';
  571. }else if(delivery === 'YUNDA'){
  572. this.printOrder.deliveryName = '韵达速递';
  573. }else if(delivery === 'STO'){
  574. this.printOrder.deliveryName = '申通快递';
  575. }
  576. },
  577. openWaveStatDialog(waveId){
  578. this.$refs.waveStatRef.init(waveId)
  579. },
  580. showModifyRemark(row){
  581. this.printOrder = row
  582. this.buyerRemarkVisible = true
  583. },
  584. modifyBuyerRemarks(printOrder){
  585. this.$http({
  586. url: this.$http.adornUrl('/platform/printOrder/modifyRemarks'),
  587. method: 'post',
  588. data: this.$http.adornData({
  589. orderNumber: this.printOrder.orderNumber,
  590. remark: this.printOrder.remark
  591. }),
  592. }).then(({ data }) => {
  593. this.buyerRemarkVisible = false
  594. if(data){
  595. this.$message({
  596. message: "修改成功",
  597. type: 'success'
  598. })
  599. }else{
  600. this.$message({
  601. message: "修改失败",
  602. type: 'error'
  603. })
  604. }
  605. })
  606. },
  607. onKeyDelivery(){
  608. this.$confirm('确定要一键发货吗?', '提示', {
  609. confirmButtonText: '确定',
  610. cancelButtonText: '取消',
  611. type: 'warning'
  612. }).then(() => {
  613. this.onKeyDeliveryLoading = true;
  614. this.$http({
  615. url: this.$http.adornUrl(`/platform/printOrder/onKeyDelivery`),
  616. method: 'POST',
  617. data: this.$http.adornData(this.wave)
  618. }).then(({data}) => {
  619. this.onKeyDeliveryLoading = false;
  620. this.$message({
  621. message: "发货成功",
  622. type: 'success'
  623. })
  624. this.getDataList(this.page, null, true)
  625. }).catch((e) => {
  626. this.onKeyDeliveryLoading = false;
  627. this.$message({
  628. message: "发货失败",
  629. type: 'error'
  630. })
  631. })
  632. });
  633. },
  634. openAndQueryPrintOrder(params){
  635. this.visible = true;
  636. this.$nextTick(() =>{
  637. this.getWave(params.waveId);
  638. this.searchForm.orderNumber = params.orderNumber;
  639. this.getDataList(this.page, false, null);
  640. })
  641. },
  642. init (wave) {
  643. this.wave = wave
  644. this.visible = true;
  645. this.getWave(this.wave.waveId);
  646. // 携带参数查询
  647. this.getDataList(this.page, null, true)
  648. },
  649. getWave(waveId){
  650. // 修改
  651. this.$http({
  652. url: this.$http.adornUrl(`/platform/wave/findWave/${waveId}`),
  653. method: 'GET',
  654. params: this.$http.adornParams()
  655. }).then(({ data }) => {
  656. this.wave = data
  657. })
  658. },
  659. deleteWave(){
  660. this.$confirm('确定要删除波次吗?', '提示', {
  661. confirmButtonText: '确定',
  662. cancelButtonText: '取消',
  663. type: 'warning'
  664. }).then(() => {
  665. this.$http({
  666. url: this.$http.adornUrl(`/platform/wave/deleteWave`),
  667. method: 'POST',
  668. data: this.$http.adornData(this.wave)
  669. }).then(({data}) => {
  670. if(data){
  671. this.$message({
  672. message: "删除成功",
  673. type: 'success'
  674. })
  675. this.$emit('refressWaveList', null);
  676. this.dialogClose();
  677. }else{
  678. this.$message({
  679. message: "删除失败",
  680. type: 'error'
  681. })
  682. }
  683. })
  684. })
  685. },
  686. openGenerateWaveDialog(){
  687. if(this.dataListSelections.size == 0){
  688. this.$message.error("请至少选择一个订单");
  689. return ;
  690. }
  691. this.$http({
  692. url: this.$http.adornUrl(`/platform/wave/getLatestWaveNo`),
  693. method: 'GET',
  694. params: this.$http.adornParams({printChannel:this.printChannel})
  695. }).then(({data}) => {
  696. if(data.status == "success"){
  697. this.generateWaveDialogVisible = true;
  698. this.wave.waveNo = data.result;
  699. this.wave.orderNum = data
  700. }
  701. })
  702. },
  703. openAddToWaveDialog(){
  704. if(this.dataListSelections.size == 0){
  705. this.$message.error("请至少选择一个订单");
  706. return ;
  707. }
  708. this.$http({
  709. url: this.$http.adornUrl(`/platform/wave/getLatestWave`),
  710. method: 'GET',
  711. params: this.$http.adornParams({shopId: this.$store.state.user.shopId, printChannel:this.printChannel, queryLimit: 30})
  712. }).then(({data}) => {
  713. if(data.status == "success"){
  714. this.addToWaveDialogVisible = true;
  715. this.wave.latestWaveList = data.result;
  716. }
  717. })
  718. },
  719. openScanDialog(){
  720. this.$refs.orderScanDelivery.init(this.wave);
  721. },
  722. handleWaveChange(val){
  723. this.wave.latestWaveList.forEach(item =>{
  724. if(item.waveId == val){
  725. this.wave.orderNum = item.orderNum;
  726. return;
  727. }
  728. })
  729. },
  730. handleAddToWaveDialogClose(){
  731. this.wave.selectWaveId = null;
  732. this.wave.orderNum = 0;
  733. },
  734. handleScanDialogClose(){
  735. this.theData = null;
  736. this.dataList = [];
  737. this.scanOrderNumber = null;
  738. this.waitScan = {};
  739. this.matchPrintOrder = {};
  740. },
  741. createWave(){
  742. let dataBody = {waveName: this.wave.waveName, "orderNumberList": [...this.dataListSelections], "printChannel": this.printChannel};
  743. this.$http({
  744. url: this.$http.adornUrl(`/platform/wave/create`),
  745. method: 'POST',
  746. data: this.$http.adornData(dataBody)
  747. }).then(({data}) => {
  748. if(data.status == "success"){
  749. this.generateWaveDialogVisible = false;
  750. this.$message({
  751. message: data.msg,
  752. type: 'success'
  753. })
  754. this.getDataList(this.page);
  755. }else{
  756. this.$message({
  757. message: data.msg,
  758. type: 'error'
  759. })
  760. }
  761. })
  762. },
  763. handleTableExpandChange(row){
  764. // this.expandRowDetail = {};
  765. // 修改
  766. this.$http({
  767. url: this.$http.adornUrl(`/platform/printOrder/findWavePrintOrderAddr`),
  768. method: 'GET',
  769. params: this.$http.adornParams({waveId: row.waveId, orderNumber: row.orderNumber})
  770. }).then(({ data }) => {
  771. // this.expandRowDetail = data;
  772. })
  773. },
  774. removeFromWave(row){
  775. this.$confirm('确定要移出波次吗?', '提示', {
  776. confirmButtonText: '确定',
  777. cancelButtonText: '取消',
  778. type: 'warning'
  779. }).then(() => {
  780. this.$http({
  781. url: this.$http.adornUrl(`/platform/wave/removeFromWave`),
  782. method: 'POST',
  783. data: this.$http.adornData(row)
  784. }).then(({data}) => {
  785. if(data.status == "success"){
  786. this.$message({
  787. message: data.msg,
  788. type: 'success'
  789. })
  790. this.getWave(this.wave.waveId);
  791. this.getDataList(this.page);
  792. }else{
  793. this.$message({
  794. message: data.msg,
  795. type: 'error'
  796. })
  797. }
  798. })
  799. });
  800. },
  801. //批量下载订单信息
  802. downloadWavePrintOrderInfo(){
  803. this.wavePrintOrderInfoDownloadLoading = true;
  804. this.$http({
  805. url: this.$http.adornUrl('/platform/wave/downloadWavePrintOrderInfo'),
  806. method: 'get',
  807. params: this.$http.adornParams({waveId: this.wave.waveId, printChannel: this.printChannel }),
  808. responseType: 'blob'
  809. }).then(({data}) => {
  810. this.wavePrintOrderInfoDownloadLoading = false;
  811. let fileName = this.wave.waveNo + "_" + this.wave.waveName + "_订单信息";
  812. downloadXls(data, fileName + ".xlsx");
  813. }).catch((error) => {
  814. this.wavePrintOrderInfoDownloadLoading = false;
  815. })
  816. },
  817. generatePdfCombination(row){
  818. this.$http({
  819. url: this.$http.adornUrl('/platform/printOrder/generatePdfCombination'),
  820. method: 'post',
  821. data: this.$http.adornParams(row),
  822. }).then(({data}) => {
  823. this.$message({
  824. message: "开始生成PDF,请刷新等待结果",
  825. type: 'success'
  826. })
  827. }).catch((error) => {
  828. this.$message({
  829. message: "生成PDF失败",
  830. type: 'error'
  831. })
  832. })
  833. },
  834. generatePdfCombinationBatch(){
  835. this.$confirm('确定要批量生成PDF吗?', '提示', {
  836. confirmButtonText: '确定',
  837. cancelButtonText: '取消',
  838. type: 'warning'
  839. }).then(() => {
  840. this.wavePrintOrderPdfDownloadLoading = true;
  841. // let orderNumberList = this.dataListSelections.map(item=>item['orderNumber'])
  842. // let dataBody = {"printChannel": this.printChannel, "waveId": this.wave.waveId, orderNumberList: orderNumberList};
  843. if(!this.wave.colorPrint || !this.wave.gram){
  844. this.$message({
  845. message: "波次的色数和克数未设置",
  846. type: 'error'
  847. })
  848. this.wavePrintOrderPdfDownloadLoading = false;
  849. return;
  850. }
  851. let dataBody = {"printChannel": this.printChannel, "waveId": this.wave.waveId, "colorPrint": this.wave.colorPrint, "gram": this.wave.gram};
  852. this.$http({
  853. url: this.$http.adornUrl('/platform/printOrder/generatePdfCombinationBatch'),
  854. method: 'post',
  855. data: this.$http.adornParams(dataBody),
  856. }).then(({data}) => {
  857. this.wavePrintOrderPdfDownloadLoading = false;
  858. this.$message({
  859. message: "批量生成PDF启动,请刷新等待结果",
  860. type: 'success'
  861. })
  862. }).catch((error) => {
  863. this.wavePrintOrderPdfDownloadLoading = false;
  864. // this.$message({
  865. // message: "批量生成PDF启动失败",
  866. // type: 'error'
  867. // })
  868. })
  869. });
  870. },
  871. downloadPrintOrderPdfZip(){
  872. this.wavePrintOrderPdfDownloadLoading = true;
  873. let orderNumberList = this.dataListSelections.map(item=>item['orderNumber'])
  874. let dataBody = {"printChannel": this.printChannel, "waveId": this.wave.waveId, orderNumberList: orderNumberList};
  875. this.$http({
  876. url: this.$http.adornUrl('/platform/wave/downloadWavePrintOrderPdf'),
  877. method: 'get',
  878. params: this.$http.adornParams(dataBody),
  879. responseType: 'blob'
  880. }).then(({data}) => {
  881. this.wavePrintOrderPdfDownloadLoading = false;
  882. let fileName = this.wave.waveNo + "_" + this.wave.waveName + ".zip";
  883. const blob = new Blob([data], {
  884. type: 'application/zip'
  885. })
  886. saveAs(blob, fileName)
  887. }).catch((error) => {
  888. this.wavePrintOrderPdfDownloadLoading = false;
  889. })
  890. },
  891. getPdfStream (url) {
  892. return new Promise((resolve, reject) => {
  893. let xmlhttp = new XMLHttpRequest();
  894. xmlhttp.open("GET", url, true);
  895. xmlhttp.responseType = "blob";
  896. xmlhttp.onload = function () {
  897. if (this.status == 200) {
  898. resolve(this.response);
  899. }else{
  900. reject(this.status);
  901. }
  902. }
  903. xmlhttp.send();
  904. });
  905. },
  906. getPdfFile (url) {
  907. return new Promise((resolve, reject) => {
  908. let xmlhttp = new XMLHttpRequest();
  909. xmlhttp.open("GET", url, true);
  910. xmlhttp.responseType = "blob";
  911. xmlhttp.onload = function () {
  912. if (this.status == 200) {
  913. resolve(this.response);
  914. }else{
  915. reject(this.status);
  916. }
  917. }
  918. xmlhttp.send();
  919. });
  920. },
  921. getPdfFile2 (url) {
  922. return new Promise((resolve, reject) => {
  923. try {
  924. let xmlhttp = new XMLHttpRequest();
  925. xmlhttp.open("GET", url, true);
  926. xmlhttp.responseType = "arraybuffer";
  927. xmlhttp.onload = function () {
  928. if (this.status == 200) {
  929. resolve(this.response);
  930. }else{
  931. reject(this.status);
  932. }
  933. }
  934. xmlhttp.send();
  935. } catch (ignored) {}
  936. });
  937. },
  938. downloadPdfBatch () {
  939. // if(this.dataListSelections.size == 0){
  940. // this.$message.error("请至少选择一个订单");
  941. // return ;
  942. // }
  943. this.wavePrintOrderPdfDownloadLoading = true;
  944. // 获取pdf链接集合
  945. // let orderNumberList = this.dataListSelections.map(item=>item['orderNumber'])
  946. this.$http({
  947. url: this.$http.adornUrl(`/platform/printOrder/getPrintPdfBatch`),
  948. method: 'POST',
  949. // data: this.$http.adornData({printChannel: this.wave.printChannel, waveId: this.wave.waveId, orderNumberList: orderNumberList})
  950. data: this.$http.adornData({printChannel: this.wave.printChannel, waveId: this.wave.waveId})
  951. }).then(({ data }) => {
  952. let printOrderList = data;
  953. // const arr = [{fileDownUrl:'地址', fileDownName:'文件名'}] // 需要下载打包的路径, 可以是本地相对路径, 也可以是跨域的全路径
  954. const zip = new JSzip()
  955. const cache = {}
  956. const promises = []
  957. printOrderList.forEach((printOrder, i) => {
  958. let pdfList = printOrder.pdfList;
  959. pdfList.forEach((pdf, j) => {
  960. let randomStr = Math.floor(Math.random()*100000).toString();
  961. const promise = this.getPdfFile2(this.resourcesUrl + pdf.pdfUrl).then(data => {
  962. // 下载文件, 并存成blob对象
  963. const fileName = pdf.pdfFolderName + "/" + pdf.pdfName; // 获取文件名,一定要包含文件的后缀名(因为重复的文件名只会下载一个,故需要加入下标 不同名)
  964. // zip.folder(pdf.pdfFolderName).file(pdf.pdfName, data);
  965. zip.file(pdf.pdfName, data);
  966. cache[fileName] = data
  967. })
  968. promises.push(promise)
  969. });
  970. });
  971. Promise.all(promises).then(() => {
  972. zip.generateAsync({ type: "blob" }).then(content => {
  973. // 生成二进制流 然后保存文件(如果这个下载不了 也可以将下方这一行换成a标签下载逻辑)
  974. if(this.wave.printChannel === 'KuaiYin'){
  975. saveAs(content, this.wave.waveNo + "_" + this.wave.waveName + ".zip") // 利用file-saver保存文件 自定义文件名
  976. }else{
  977. saveAs(content, this.wave.waveNo + "_" + this.wave.waveName + ".zip") // 利用file-saver保存文件 自定义文件名
  978. }
  979. this.wavePrintOrderPdfDownloadLoading = false;
  980. })
  981. })
  982. });
  983. },
  984. /*//合并并下载PDF
  985. async mergeAndDownloadPDF(){ // urlList 单个PDF文件的URL
  986. try{
  987. this.wavePrintOrderPdfDownloadLoading = true;
  988. // 获取pdf链接集合
  989. this.getPrintPdfBatch().then(async (list)=>{
  990. let pdfUrlList = [];
  991. for(let i=0 ; i <list.length; i++){
  992. let pdfList = list[i].pdfList;
  993. for(let j=0 ; j <pdfList.length; j++){
  994. pdfUrlList.push(this.resourcesUrl + pdfList[j].pdfUrl);
  995. }
  996. }
  997. let promises = [];
  998. pdfUrlList.forEach(url =>{
  999. let promise = this.getPdfFile2(url);
  1000. promises.push(promise);
  1001. })
  1002. let pdfBuffers = await Promise.all(promises);
  1003. let newPdf = await PDFDocument.create();
  1004. for (let k=0 ; k<pdfBuffers.length; k++) {
  1005. let pdfDocument = await PDFDocument.load(pdfBuffers[k]);
  1006. let contentPages = await newPdf.copyPages(pdfDocument, pdfDocument.getPageIndices());
  1007. for (let l=0; l<contentPages.length; l++) {
  1008. newPdf.addPage(contentPages[l]);
  1009. }
  1010. }
  1011. let uint8Array = await newPdf.save();
  1012. let mergeBuffer = Buffer.from(uint8Array);
  1013. downloadPdf(mergeBuffer, this.wave.waveNo + "_" + this.wave.waveName + ".pdf");
  1014. this.wavePrintOrderPdfDownloadLoading = false;
  1015. });
  1016. }catch (error) {
  1017. this.wavePrintOrderPdfDownloadLoading = false;
  1018. }
  1019. },*/
  1020. //合并并下载PDF
  1021. async mergeAndDownloadPDF(){ // urlList 单个PDF文件的URL
  1022. try{
  1023. this.wavePrintOrderPdfDownloadLoading = true;
  1024. // 获取pdf链接集合
  1025. this.getPrintPdfBatch().then(async (list)=>{
  1026. let newPdf = await PDFDocument.create();
  1027. let pageWidth = 0;
  1028. let pageHeight = 0;
  1029. for(let i=0 ; i <list.length; i++){
  1030. let pdfList = list[i].pdfList;
  1031. for(let j=0 ; j <pdfList.length; j++){
  1032. let randomStr = Math.floor(Math.random()*100000).toString();
  1033. let pdfBuffer = await this.getPdfFile2(this.resourcesUrl + pdfList[j].pdfUrl);
  1034. let pdfDocument = await PDFDocument.load(pdfBuffer);
  1035. let contentPages = await newPdf.copyPages(pdfDocument, pdfDocument.getPageIndices());
  1036. for (let l=0; l<contentPages.length; l++) {
  1037. newPdf.addPage(contentPages[l]);
  1038. if(pageWidth == 0){
  1039. pageWidth = contentPages[l].getWidth();
  1040. pageHeight = contentPages[l].getHeight();
  1041. }
  1042. }
  1043. }
  1044. }
  1045. //如果是圆角,就补充空白页
  1046. if(this.wave.printChannel === "KuaiYin"){
  1047. if(this.wave.waveName.indexOf("圆角") != -1){
  1048. let allPageSize = newPdf.getPageCount();
  1049. let totalPage = 144
  1050. if(this.wave.colorPrint === '四色'){
  1051. totalPage = 120
  1052. }
  1053. let mod = allPageSize % totalPage;
  1054. if(mod != 0){
  1055. let diff = totalPage - mod;
  1056. for(let i = 1; i <= diff; i++){
  1057. newPdf.addPage([pageWidth, pageHeight]);
  1058. }
  1059. }
  1060. }
  1061. }
  1062. let uint8Array = await newPdf.save();
  1063. let mergeBuffer = Buffer.from(uint8Array);
  1064. if(this.wave.printChannel === "KuaiYin"){
  1065. downloadPdf(mergeBuffer, this.wave.waveNo + "_" + this.wave.colorPrint + "_" + this.wave.gram + "_" + this.wave.waveName
  1066. + ".pdf");
  1067. }else{
  1068. downloadPdf(mergeBuffer, this.wave.waveNo + "_" + this.wave.waveName
  1069. + ".pdf");
  1070. }
  1071. this.wavePrintOrderPdfDownloadLoading = false;
  1072. });
  1073. }catch (error) {
  1074. this.wavePrintOrderPdfDownloadLoading = false;
  1075. }
  1076. },
  1077. /**
  1078. * 获取打印订单的所有PDF文件
  1079. */
  1080. getPrintPdfBatch(){
  1081. // if(this.dataListSelections.size == 0){
  1082. // this.$message.error("请至少选择一个订单");
  1083. // return ;
  1084. // }
  1085. return new Promise((resolve, reject) => {
  1086. // 获取pdf链接集合
  1087. // let orderNumberList = this.dataListSelections.map(item=>item['orderNumber'])
  1088. this.$http({
  1089. url: this.$http.adornUrl(`/platform/printOrder/getPrintPdfBatch`),
  1090. method: 'POST',
  1091. // data: this.$http.adornData({printChannel: this.wave.printChannel, waveId: this.wave.waveId, orderNumberList: orderNumberList})
  1092. data: this.$http.adornData({printChannel: this.wave.printChannel, waveId: this.wave.waveId})
  1093. }).then(({ data }) => {
  1094. resolve(data);
  1095. });
  1096. })
  1097. },
  1098. // 跳转至导入选择
  1099. getUpload () {
  1100. this.uploadVisible = true
  1101. this.$nextTick(() => {
  1102. this.$refs.expressBillUpload.init(this.wave.waveId)
  1103. })
  1104. },
  1105. // 刷新数据
  1106. getWaitingConsignmentExcel () {
  1107. this.getDataList(this.page);
  1108. // 修改
  1109. this.$http({
  1110. url: this.$http.adornUrl(`/platform/wave/info/${this.wave.waveId}`),
  1111. method: 'GET',
  1112. params: this.$http.adornParams()
  1113. }).then(({ data }) => {
  1114. this.wave = data
  1115. })
  1116. },
  1117. productionLockConfirm(){
  1118. this.$confirm('你确定要锁定并转为生产中吗?一旦锁定将无法增删订单', '提示', {
  1119. confirmButtonText: '确定',
  1120. cancelButtonText: '取消',
  1121. type: 'warning'
  1122. }).then(() => {
  1123. this.$http({
  1124. url: this.$http.adornUrl(`/platform/wave/confirmProductionLock`),
  1125. method: 'POST',
  1126. data: this.$http.adornData({waveId: this.wave.waveId, printChannel: this.printChannel})
  1127. }).then(({data}) => {
  1128. if(data.status == "success"){
  1129. this.$message({
  1130. message: data.msg,
  1131. type: 'success'
  1132. })
  1133. this.getWave(this.wave.waveId);
  1134. this.getDataList(this.page);
  1135. }else{
  1136. this.$message({
  1137. message: data.msg,
  1138. type: 'error'
  1139. })
  1140. }
  1141. })
  1142. }).catch(() => {
  1143. });
  1144. },
  1145. productionLockCancel(){
  1146. this.$confirm('你确定要取消锁定吗?', '提示', {
  1147. confirmButtonText: '确定',
  1148. cancelButtonText: '取消',
  1149. type: 'warning'
  1150. }).then(() => {
  1151. this.$http({
  1152. url: this.$http.adornUrl(`/platform/wave/cancelProductionLock`),
  1153. method: 'POST',
  1154. data: this.$http.adornData({waveId: this.wave.waveId, printChannel: this.printChannel})
  1155. }).then(({data}) => {
  1156. if(data){
  1157. this.$message({
  1158. message: "取消成功",
  1159. type: 'success'
  1160. })
  1161. this.getWave(this.wave.waveId);
  1162. this.getDataList(this.page, null, false);
  1163. }else{
  1164. this.$message({
  1165. message: "取消失败",
  1166. type: 'error'
  1167. })
  1168. }
  1169. })
  1170. }).catch(() => {
  1171. });
  1172. },
  1173. downloadPrintOrderPdf(printOrder){
  1174. this.wavePrintOrderPdfDownloadLoading = true;
  1175. let dataBody = {printChannel: printOrder.printChannel, orderNumber: printOrder.orderNumber, waveId: printOrder.waveId};
  1176. this.$http({
  1177. url: this.$http.adornUrl('/platform/printOrder/downloadPrintOrderPdf'),
  1178. method: 'get',
  1179. params: this.$http.adornParams(dataBody),
  1180. responseType: 'blob'
  1181. }).then(({data}) => {
  1182. this.wavePrintOrderPdfDownloadLoading = false;
  1183. let pdfName = printOrder.orderNumber + "_" + printOrder.receiverName + "_" + printOrder.prodName + ".pdf";
  1184. // downloadPdf(data, pdfName + ".pdf");
  1185. const blob = new Blob([data], {
  1186. type: 'application/pdf'
  1187. })
  1188. saveAs(blob, pdfName);
  1189. }).catch((error) => {
  1190. this.wavePrintOrderPdfDownloadLoading = false;
  1191. })
  1192. },
  1193. openModifyExpressBillDialog(row){
  1194. this.printOrder.waveId = row.waveId;
  1195. this.printOrder.orderNumber = row.orderNumber;
  1196. this.printOrder.oldDeliveryNo = row.deliveryNo;
  1197. this.modifyExpressBillVisible = true;
  1198. },
  1199. modifyExpressBill(waveId, printOrder){
  1200. let dataBody = {waveId: waveId, orderNumber: printOrder.orderNumber,
  1201. deliveryNo: printOrder.deliveryNo,
  1202. deliveryName: printOrder.deliveryName,
  1203. deliveryCode: printOrder.deliveryCode};
  1204. this.$http({
  1205. url: this.$http.adornUrl(`/platform/printOrder/modifyExpressBill`),
  1206. method: 'POST',
  1207. data: this.$http.adornData(dataBody)
  1208. }).then(({data}) => {
  1209. if(data){
  1210. this.modifyExpressBillVisible = false;
  1211. this.$message({
  1212. message: "修改成功",
  1213. type: 'success'
  1214. })
  1215. this.getDataList(this.page);
  1216. }else{
  1217. this.$message({
  1218. message: "修改失败",
  1219. type: 'error'
  1220. })
  1221. }
  1222. })
  1223. },
  1224. /**
  1225. * 页面滚动事件
  1226. */
  1227. scrollToTop () {
  1228. let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
  1229. this.showHeadScroll = scrollTop > 400
  1230. },
  1231. dialogClose(){
  1232. this.wave = {},
  1233. this.visible = false
  1234. this.theData = null;
  1235. this.dataList = [];
  1236. this.visible = false;
  1237. this.dataForm = {};
  1238. this.page = {
  1239. total: 0, // 总页数
  1240. currentPage: 1, // 当前页数
  1241. pageSize: 61 // 每页显示多少条
  1242. },
  1243. this.$emit("refressWaveList", null);
  1244. },
  1245. resetSearchForm(){
  1246. this.searchForm = {};
  1247. },
  1248. /**
  1249. * 获取数据列表
  1250. */
  1251. getDataList (page, params, newData = false) {
  1252. page = (page === undefined ? this.page : page)
  1253. this.dataListLoading = true
  1254. if (newData || !this.theData) {
  1255. this.theData = {
  1256. current: page == null ? this.page.currentPage : page.currentPage,
  1257. size: page == null ? this.page.pageSize : page.pageSize,
  1258. 'orderNumber': this.searchForm.orderNumber,
  1259. 'receiverName': this.searchForm.receiverName,
  1260. 'deliveryNo': this.searchForm.deliveryNo,
  1261. 'waveId': this.wave.waveId,
  1262. 'workStatus': this.searchForm.workStatus
  1263. }
  1264. } else {
  1265. this.theData.current = page == null ? this.page.currentPage : page.currentPage
  1266. this.theData.size = page == null ? this.page.pageSize : page.pageSize
  1267. this.theData.status = this.status
  1268. }
  1269. this.$http({
  1270. url: this.$http.adornUrl('/platform/printOrder/page'),
  1271. method: 'get',
  1272. params: this.$http.adornParams(
  1273. Object.assign(this.theData, params
  1274. ), false
  1275. )
  1276. }).then(({ data }) => {
  1277. this.dataList = data.records
  1278. this.page.total = data.total
  1279. this.sts = !this.status ? 0 : this.status
  1280. this.dataListLoading = false
  1281. })
  1282. },
  1283. // 每页数
  1284. sizeChangeHandle (val) {
  1285. this.page.pageSize = val
  1286. this.page.currentPage = 1
  1287. this.getDataList(this.page)
  1288. },
  1289. // 多选
  1290. selectionChangeHandle (val) {
  1291. this.dataListSelections = val
  1292. },
  1293. /**
  1294. * 根据选项设置时间
  1295. * 1:今天 2:昨天 3: 近七天 4:近30天 5:近60天
  1296. */
  1297. setDateRange (val) {
  1298. this.timeActive = val
  1299. var startDay = null
  1300. var endDay = null
  1301. if (val === 1) {
  1302. startDay = 0
  1303. endDay = 0
  1304. } else if (val === 2) {
  1305. startDay = -1
  1306. endDay = -1
  1307. } else if (val === 3) {
  1308. startDay = -7
  1309. endDay = -1
  1310. } else if (val === 4) {
  1311. startDay = -30
  1312. endDay = -1
  1313. } else {
  1314. return
  1315. }
  1316. // 开始时间
  1317. let startTime = moment().add(startDay, 'days').startOf('days').format('LL')
  1318. // 结束时间
  1319. let endTime = moment().add(endDay, 'days').endOf('days').format('LL')
  1320. this.dateRange = [startTime, endTime]
  1321. },
  1322. // 删除
  1323. deleteHandle (id) {
  1324. var ids = id ? [id] : this.dataListSelections.map(item => {
  1325. return item.orderId
  1326. })
  1327. this.$confirm(`${this.$i18n.t('sys.makeSure')}[${id ? this.$i18n.t('text.delBtn') : this.$i18n.t('sys.batchDelete')}]${this.$i18n.t('text.menu')}?`, this.$i18n.t('text.tips'), {
  1328. confirmButtonText: this.$i18n.t('crud.filter.submitBtn'),
  1329. cancelButtonText: this.$i18n.t('crud.filter.cancelBtn'),
  1330. type: 'warning'
  1331. }).then(() => {
  1332. this.$http({
  1333. url: this.$http.adornUrl(`/prod/spec/${ids}`),
  1334. method: 'delete',
  1335. data: this.$http.adornData(ids, false)
  1336. }).then(({ data }) => {
  1337. this.$message({
  1338. message: this.$i18n.t('publics.operation'),
  1339. type: 'success',
  1340. duration: 1500,
  1341. onClose: () => {
  1342. this.getDataList(this.page)
  1343. }
  1344. })
  1345. })
  1346. }).catch(() => { })
  1347. },
  1348. // 清空按钮
  1349. clear () {
  1350. this.dataForm = {}
  1351. this.dateRange = []
  1352. this.status = null
  1353. this.timeActive = null
  1354. },
  1355. // 搜索查询
  1356. searchChange (newData = false) {
  1357. this.page.currentPage = 1
  1358. this.getDataList(this.page, null, newData)
  1359. },
  1360. handleCurrentChange (val) {
  1361. this.page.currentPage = val
  1362. this.getDataList()
  1363. },
  1364. handleSizeChange (val) {
  1365. this.page.pageSize = val
  1366. this.getDataList()
  1367. },
  1368. cancelDelivery(row) {
  1369. this.$confirm('确定取消发货吗?', '提示', {
  1370. confirmButtonText: '确定',
  1371. cancelButtonText: '取消',
  1372. type: 'warning'
  1373. }).then(() => {
  1374. this.$http({
  1375. url: this.$http.adornUrl(`/platform/printOrder/cancelDelivery/` + row.printOrderId),
  1376. method: 'POST',
  1377. data: this.$http.adornData()
  1378. }).then(({data}) => {
  1379. if (data) {
  1380. this.getDataList(this.page, false);
  1381. this.$message({
  1382. message: "取消发货成功",
  1383. type: 'success'
  1384. })
  1385. } else {
  1386. this.$message({
  1387. message: "取消发货失败",
  1388. type: 'error'
  1389. })
  1390. }
  1391. }).catch(() => {
  1392. })
  1393. })
  1394. },
  1395. },
  1396. destroyed () {
  1397. // 页面销毁时移除监听
  1398. window.removeEventListener('scroll', this.handleScroll)
  1399. },
  1400. }
  1401. </script>
  1402. <style lang="scss" scoped>
  1403. .expand-detail{
  1404. font-size: 18px;
  1405. }
  1406. expand-detail-title{
  1407. font-size: 18px;
  1408. font-weight: bold;
  1409. }
  1410. .el-divider--vertical {
  1411. display: inline-block;
  1412. width: 1px;
  1413. height: 30px;
  1414. margin: 0 16px;
  1415. vertical-align: middle;
  1416. position: relative;
  1417. }
  1418. </style>