index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. <template>
  2. <div class="app-container" :style="{'--q-height':qHeight}">
  3. <div class="app-container-query" ref="queryFormBox">
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item label="订单号">
  6. <el-input
  7. v-model="queryParams.orderId"
  8. placeholder="请输入订单号"
  9. clearable
  10. style="width: 240px;"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="购票人手机号" label-width="100px">
  15. <el-input
  16. v-model="queryParams.memberMobile"
  17. placeholder="请输入购票人手机号"
  18. clearable
  19. style="width: 240px;"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="剧目名称">
  24. <el-input
  25. v-model="queryParams.performName"
  26. placeholder="请输入剧目名称"
  27. clearable
  28. style="width: 240px;"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item label="票务名称">
  33. <el-input
  34. v-model="queryParams.goodsName"
  35. placeholder="请输入票务名称"
  36. clearable
  37. style="width: 240px;"
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <el-form-item label="是否成功开票" label-width="100">
  42. <el-select
  43. v-model="queryParams.ifSuccessInvoice"
  44. placeholder="请选择"
  45. clearable
  46. style="width: 100%"
  47. >
  48. <el-option label="否" value="0" />
  49. <el-option label="是" value="1" />
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item label="订单状态">
  53. <el-select
  54. v-model="queryParams.status"
  55. placeholder="订单状态"
  56. clearable
  57. style="width: 100%"
  58. >
  59. <el-option
  60. v-for="dict in dict.type.order_status_type"
  61. :key="dict.value"
  62. :label="dict.label"
  63. :value="dict.value"
  64. />
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item label="支付方式">
  68. <el-select
  69. v-model="queryParams.payWay"
  70. placeholder="支付方式"
  71. clearable
  72. style="width: 100%"
  73. >
  74. <el-option
  75. v-for="dict in dict.type.pay_way_type"
  76. :key="dict.value"
  77. :label="dict.label"
  78. :value="dict.value"
  79. />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="购票渠道">
  83. <el-select
  84. v-model="queryParams.source"
  85. placeholder="购票渠道"
  86. clearable
  87. style="width: 100%"
  88. >
  89. <!-- <el-option
  90. v-for="dict in sourceMapList"
  91. :key="dict.value"
  92. :label="dict.name"
  93. :value="dict.value"
  94. /> -->
  95. <el-option
  96. v-for="dict in dict.type.order_form_type"
  97. :key="dict.value"
  98. :label="dict.label"
  99. :value="dict.value"
  100. />
  101. </el-select>
  102. </el-form-item>
  103. <el-form-item label="支付时间">
  104. <el-date-picker
  105. style="width: 230px;"
  106. v-model="queryParams.time"
  107. type="daterange"
  108. value-format="yyyy-MM-dd"
  109. range-separator="至"
  110. start-placeholder="开始日期"
  111. end-placeholder="结束日期">
  112. </el-date-picker>
  113. </el-form-item>
  114. <el-form-item label="支付单号">
  115. <el-input
  116. v-model="queryParams.paymentId"
  117. placeholder="请输入支付单号"
  118. clearable
  119. style="width: 240px;"
  120. @keyup.enter.native="handleQuery"
  121. />
  122. </el-form-item>
  123. <el-form-item label="下单时间">
  124. <el-date-picker
  125. style="width: 230px;"
  126. v-model="queryParams.createTime"
  127. type="daterange"
  128. value-format="yyyy-MM-dd"
  129. range-separator="至"
  130. start-placeholder="开始日期"
  131. end-placeholder="结束日期">
  132. </el-date-picker>
  133. </el-form-item>
  134. <!-- <el-form-item label="场次时间">
  135. <el-date-picker
  136. style="width: 230px;"
  137. v-model="queryParams.performDate"
  138. @change="pagePerformTimeListFun"
  139. type="date"
  140. value-format="yyyy-MM-dd"
  141. placeholder="选择日期">
  142. </el-date-picker>
  143. </el-form-item> -->
  144. <el-form-item label="场次时间" label-width="70px">
  145. <el-date-picker
  146. style="width: 250px;"
  147. v-model="queryParams.performDate"
  148. @change="pagePerformTimeListFun"
  149. type="daterange"
  150. value-format="yyyy-MM-dd"
  151. range-separator="至"
  152. start-placeholder="开始日期"
  153. end-placeholder="结束日期">
  154. </el-date-picker>
  155. </el-form-item>
  156. <el-form-item label="场次" v-if="!multiPerformDate">
  157. <el-select
  158. v-model="queryParams.performTimeId"
  159. placeholder="场次"
  160. clearable
  161. style="width: 100%"
  162. >
  163. <el-option
  164. v-for="dict in pagePerformTimeList"
  165. :key="dict.id"
  166. :label="dict.timeSnapshot+'('+dict.performTimeStart+'-'+dict.performTimeEnd+')'"
  167. :value="dict.id"
  168. />
  169. </el-select>
  170. </el-form-item>
  171. <el-form-item label="开票时间">
  172. <el-date-picker
  173. style="width: 230px;"
  174. v-model="queryParams.invoiceTime"
  175. type="daterange"
  176. value-format="yyyy-MM-dd"
  177. range-separator="至"
  178. start-placeholder="开始日期"
  179. end-placeholder="结束日期">
  180. </el-date-picker>
  181. </el-form-item>
  182. <el-form-item label="商户退款单号" label-width="100px">
  183. <el-input
  184. v-model="queryParams.refundPaymentId"
  185. placeholder="请输入商户退款单号"
  186. clearable
  187. style="width: 240px;"
  188. @keyup.enter.native="handleQuery"
  189. />
  190. </el-form-item>
  191. <el-form-item>
  192. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  193. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  194. </el-form-item>
  195. </el-form>
  196. </div>
  197. <div class="app-container-table-box">
  198. <el-row :gutter="10" class="mb8">
  199. <el-button
  200. type="primary"
  201. size="mini"
  202. icon="el-icon-download"
  203. v-hasPermi="['order:orderMr:downloadExcel']"
  204. @click="handleExport"
  205. v-loading.fullscreen.lock="handleExportLoading"
  206. element-loading-text="正在拼命生成数据中..."
  207. element-loading-spinner="el-icon-loading"
  208. element-loading-background="rgba(0, 0, 0, 0.5)"
  209. >导出excel</el-button>
  210. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  211. </el-row>
  212. <div class="app-container-table-info">
  213. <el-table ref="tables" height="100%" v-loading="loading" :data="dataList" border>
  214. <el-table-column label="序号" align="center" :fixed="fixed" type="index" width="60"></el-table-column>
  215. <el-table-column label="订单号" align="center" :fixed="fixed" prop="id" />
  216. <el-table-column label="购票人手机号" align="center" :fixed="fixed" prop="memberMobile" />
  217. <el-table-column label="剧目名称" align="center" :fixed="fixed" prop="performName" />
  218. <el-table-column label="票务名称" align="center" :fixed="fixed" prop="goodsName" />
  219. <el-table-column label="座位类型" align="center" :fixed="fixed" prop="seatTypeName" />
  220. <el-table-column label="购票渠道" align="center" :fixed="fixed" prop="source">
  221. <template slot-scope="scope">
  222. <dict-tag :options="dict.type.order_form_type" :value="scope.row.source"/>
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="场次时间" align="center" prop="performDate" />
  226. <el-table-column label="场次" width="120" align="center" prop="timeSnapshot">
  227. <template slot-scope="scope">
  228. <span>{{ scope.row.timeSnapshot }} <br /> ({{ scope.row.performTimeStart + '-' + scope.row.performTimeEnd }})</span>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="下单时间" align="center" prop="createTime" />
  232. <el-table-column label="购票数量" align="center" prop="quantity" />
  233. <el-table-column label="应收金额" align="center" prop="orderPrice">
  234. <template slot-scope="scope">
  235. <span>¥{{ scope.row.orderPrice }}</span>
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="实收金额" align="center" prop="realPrice">
  239. <template slot-scope="scope">
  240. <span>¥{{ scope.row.realPrice }}</span>
  241. </template>
  242. </el-table-column>
  243. <el-table-column label="支付方式" align="center" prop="payWay">
  244. <template slot-scope="scope">
  245. <dict-tag :options="dict.type.pay_way_type" :value="scope.row.payWay"/>
  246. </template>
  247. </el-table-column>
  248. <el-table-column label="支付时间" align="center" prop="payTime" width="160" >
  249. <template slot-scope="scope">
  250. <span>{{ parseTime(scope.row.payTime) }}</span>
  251. </template>
  252. </el-table-column>
  253. <el-table-column label="支付单号" align="center" prop="paymentId" />
  254. <el-table-column label="订单状态" align="center" prop="status">
  255. <template slot-scope="scope">
  256. <dict-tag :options="dict.type.order_status_type" :value="scope.row.status"/>
  257. </template>
  258. </el-table-column>
  259. <el-table-column label="商户退款单号" align="center" prop="refundPaymentId" />
  260. <el-table-column label="已核销票数" align="center" prop="usedTotal">
  261. <template slot-scope="scope">
  262. <span>{{ scope.row.usedTotal }}</span>
  263. </template>
  264. </el-table-column>
  265. <el-table-column label="已核销金额" align="center" prop="usedPriceTotal">
  266. <template slot-scope="scope">
  267. <span>{{ scope.row.usedPriceTotal }}</span>
  268. </template>
  269. </el-table-column>
  270. <el-table-column label="退票数量" align="center" prop="refundTotal">
  271. <template slot-scope="scope">
  272. <span>{{ scope.row.refundTotal }}</span>
  273. </template>
  274. </el-table-column>
  275. <el-table-column label="退票金额" align="center" prop="refundPriceTotal">
  276. <template slot-scope="scope">
  277. <span>{{ scope.row.refundPriceTotal && scope.row.refundPriceTotal !=0 ? ('-' + scope.row.refundPriceTotal) : '' }}</span>
  278. </template>
  279. </el-table-column>
  280. <el-table-column label="是否成功开票" align="center">
  281. <template slot-scope="scope">
  282. <el-tag type="danger" v-if="scope.row.ifSuccessInvoice == '0'">否</el-tag>
  283. <el-tag type="success" v-else-if="scope.row.ifSuccessInvoice == '1'">是</el-tag>
  284. </template>
  285. </el-table-column>
  286. <el-table-column label="开票时间" align="center" prop="invoiceTime">
  287. <template slot-scope="scope">
  288. <span>{{ scope.row.invoiceTime }}</span>
  289. </template>
  290. </el-table-column>
  291. <el-table-column label="备注" align="center" prop="remark">
  292. <template slot-scope="scope">
  293. <span>{{ scope.row.remark }}</span>
  294. </template>
  295. </el-table-column>
  296. <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
  297. <template slot-scope="scope">
  298. <el-button
  299. size="mini"
  300. type="text"
  301. @click="openDetails(scope.row)"
  302. v-hasPermi="['orderMr:orderMr:details']"
  303. >详情</el-button>
  304. <span v-hasPermi="['orderMr:orderMr:cancel']" style="display: inline-block;margin-left: 10px;">
  305. <el-button
  306. v-if="scope.row.status == 0"
  307. size="mini"
  308. type="text"
  309. @click="handleCancelOrder(scope.row)"
  310. >关闭订单</el-button>
  311. </span>
  312. <span v-hasPermi="['orderMr:orderMr:print']" style="display: inline-block;margin-left: 10px;">
  313. <el-button
  314. v-if="scope.row.status == 3 || scope.row.status == 7"
  315. size="mini"
  316. type="text"
  317. @click="handleOpen([scope.row])"
  318. >打印小票</el-button>
  319. </span>
  320. </template>
  321. </el-table-column>
  322. </el-table>
  323. </div>
  324. <pagination
  325. v-show="total>0"
  326. :total="total"
  327. :page.sync="queryParams.pageNum"
  328. :limit.sync="queryParams.pageSize"
  329. @pagination="getList"
  330. />
  331. </div>
  332. <!-- 详情 -->
  333. <details-dia ref="detailsDia" @getList="getList"></details-dia>
  334. <el-dialog
  335. title="选择小票机"
  336. :visible.sync="dialogVisible"
  337. width="30%"
  338. :before-close="handleClose">
  339. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  340. <el-form-item label="小票机" prop="region">
  341. <el-select v-model="ruleForm.region" placeholder="选择小票机">
  342. <el-option :label="item.deviceName" :key="item.id" :value="item.id" v-for="(item,index) in printList"></el-option>
  343. </el-select>
  344. </el-form-item>
  345. </el-form>
  346. <span slot="footer" class="dialog-footer">
  347. <el-button @click="dialogVisible = false">取 消</el-button>
  348. <el-button type="primary" :loading="dialogVisibleLoading" @click="print(viewerList)">{{ dialogVisibleLoading?'打印中...':'打印' }}</el-button>
  349. </span>
  350. </el-dialog>
  351. </div>
  352. </template>
  353. <script>
  354. import { pageList,downOrderListXls, printApi } from '@/api/order/orderMr';
  355. import { orderInfoCancel } from '@/api/windowTicketSales/ticketingSales';
  356. import detailsDia from "./dialog/details";
  357. import { pagePerformTimeList } from "@/api/schedulingMr/schedulingMr"
  358. import { exportExcel } from '@/utils/exportexcel'
  359. import { pageList as getPrintListApi } from "@/api/device/pda";
  360. const https = require('https');
  361. const axios = require('axios');
  362. import moment from "moment"
  363. export default {
  364. name: "OrderMr",
  365. dicts: ['order_form_type','order_status_type','pay_way_type'],
  366. components: { detailsDia },
  367. data() {
  368. return {
  369. qHeight: '0px',
  370. resizeObserver: null,
  371. // 遮罩层
  372. loading: true,
  373. // 选中数组
  374. ids: [],
  375. // 非单个禁用
  376. single: true,
  377. // 非多个禁用
  378. multiple: true,
  379. // 显示搜索条件
  380. showSearch: true,
  381. // 总条数
  382. total: 0,
  383. // 用户表格数据
  384. dataList: null,
  385. // 弹出层标题
  386. title: "",
  387. // 是否显示弹出层
  388. open: false,
  389. // 日期范围
  390. dateRange: [],
  391. // 查询参数
  392. queryParams: {
  393. pageNum: 1,
  394. pageSize: 10,
  395. },
  396. visibleStatus: false,
  397. newObj: {},
  398. visibleType: '',
  399. pagePerformTimeList: [], // 场次列表
  400. handleExportLoading: false,
  401. viewerList: [],
  402. printList: [],
  403. dialogVisible: false,
  404. ruleForm: {},
  405. rules: {
  406. region: [
  407. { required: true, message: '请选择打印机', trigger: ['change','blur' ]}
  408. ],
  409. },
  410. dialogVisibleLoading: false,
  411. multiPerformDate:false,
  412. fixed: 'left',
  413. };
  414. },
  415. created() {
  416. this.$set(this.queryParams,'performDate',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")])
  417. this.pagePerformTimeListFun(this.queryParams.performDate)
  418. this.getList();
  419. },
  420. activated(){
  421. this.getList();
  422. },
  423. mounted() {
  424. this.resizeObserver = new ResizeObserver(entries => {
  425. for (let entry of entries) {
  426. const { width, height } = entry.contentRect;
  427. this.qHeight = height + 'px'
  428. }
  429. if(document.body.clientWidth<765) {
  430. this.fixed = false
  431. }else {
  432. this.fixed = 'left'
  433. }
  434. });
  435. this.resizeObserver.observe(this.$refs.queryFormBox);
  436. },
  437. methods: {
  438. /** 查询列表 */
  439. getList() {
  440. this.loading = true;
  441. let params = {...this.addDateRange(this.queryParams, this.dateRange)};
  442. if(params.time){
  443. params.payBeginTime = params.time[0];
  444. params.payEndTime = params.time[1];
  445. }else {
  446. params.payBeginTime = null
  447. params.payEndTime = null
  448. }
  449. if(params.createTime&&params.createTime.length>0){
  450. params.createBeginTime = params.createTime[0];
  451. params.createEndTime = params.createTime[1];
  452. }else {
  453. params.createBeginTime = null
  454. params.createEndTime = null
  455. }
  456. if(params.performDate){
  457. params.performDateStart = params.performDate[0];
  458. params.performDateEnd = params.performDate[1];
  459. }else {
  460. params.performDateStart = null
  461. params.performDateEnd = null
  462. }
  463. if(params.invoiceTime&&params.invoiceTime.length==2){
  464. params.invoiceBeginTime =params.invoiceTime[0];
  465. params.invoiceEndTime =params.invoiceTime[1];
  466. }else {
  467. params.invoiceBeginTime = null
  468. params.invoiceEndTime = null
  469. }
  470. delete params.performDate;
  471. delete params.invoiceTime
  472. pageList(params)
  473. .then(response => {
  474. this.dataList = response.data.rows;
  475. this.total = response.data.total;
  476. this.loading = false;
  477. }).catch(()=>{
  478. this.dataList = [];
  479. this.total = 0;
  480. this.loading = false;
  481. })
  482. },
  483. // 取消按钮
  484. cancel() {
  485. this.open = false;
  486. },
  487. /** 搜索按钮操作 */
  488. handleQuery() {
  489. this.queryParams.pageNum = 1;
  490. this.getList();
  491. },
  492. /** 重置按钮操作 */
  493. resetQuery() {
  494. this.dateRange = [];
  495. this.$set(this.queryParams, 'paymentId', '');
  496. this.$set(this.queryParams, 'orderId', '');
  497. this.$set(this.queryParams, 'status', '');
  498. this.$set(this.queryParams, 'memberMobile', '');
  499. this.$set(this.queryParams, 'source', '');
  500. this.$set(this.queryParams, 'performName', '');
  501. this.$set(this.queryParams, 'payBeginTime', '');
  502. this.$set(this.queryParams, 'payEndTime', '');
  503. this.$set(this.queryParams, 'time', '');
  504. this.$set(this.queryParams, 'createTime', '');
  505. this.$set(this.queryParams, 'createBeginTime', '');
  506. this.$set(this.queryParams, 'createEndTime', '');
  507. this.$set(this.queryParams, 'goodsName', '');
  508. this.$set(this.queryParams, 'performDate', '');
  509. this.$set(this.queryParams, 'timeSnapshot', '');
  510. this.$set(this.queryParams, 'performTimeId', '');
  511. this.$set(this.queryParams, 'payWay', '');
  512. this.$set(this.queryParams, 'invoiceTime', '');
  513. this.$set(this.queryParams, 'refundPaymentId', '');
  514. this.queryParams.pageNum = 1;
  515. this.handleQuery();
  516. },
  517. /** 详情按钮操作 */
  518. openDetails(row, type) {
  519. this.$refs["detailsDia"].openDialog("详情", row, type);
  520. },
  521. async pagePerformTimeListFun(value) {
  522. // console.log('value',value);
  523. try {
  524. this.pagePerformTimeList = []
  525. this.$set(this.queryParams,'performTimeId',null)
  526. if(!value){
  527. return
  528. }
  529. if(value.length==2&&value[0]==value[1]){
  530. this.multiPerformDate = false
  531. }else{
  532. this.multiPerformDate = true
  533. return
  534. }
  535. let { data,code } = await pagePerformTimeList({
  536. performDate: value[0],
  537. pageNum: 1,
  538. pageSize: 999
  539. })
  540. this.pagePerformTimeList = [].concat(data.rows)
  541. } catch (error) {
  542. }
  543. },
  544. /**
  545. * 导出报表
  546. * @date 2022-10-24
  547. * @returns {any}
  548. */
  549. handleExport() {
  550. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  551. confirmButtonText: '确定 ',
  552. cancelButtonText: '取消 ',
  553. type: 'warning'
  554. })
  555. .then(() => {
  556. this.handleExportLoading = true;
  557. // const { pageNum, pageSize} = this.params;
  558. let postMap = {}
  559. if(this.queryParams.time){
  560. this.queryParams.payBeginTime = this.queryParams.time[0];
  561. this.queryParams.payEndTime = this.queryParams.time[1];
  562. }else {
  563. this.queryParams.payBeginTime = null
  564. this.queryParams.payEndTime = null
  565. }
  566. if(this.queryParams.createTime&&this.queryParams.createTime.length>0){
  567. this.queryParams.createBeginTime = this.queryParams.createTime[0];
  568. this.queryParams.createEndTime = this.queryParams.createTime[1];
  569. }else {
  570. this.queryParams.createBeginTime = null
  571. this.queryParams.createEndTime = null
  572. }
  573. if(this.queryParams.performDate){
  574. this.queryParams.performDateStart = this.queryParams.performDate[0];
  575. this.queryParams.performDateEnd = this.queryParams.performDate[1];
  576. }else {
  577. this.queryParams.performDateStart = null
  578. this.queryParams.performDateEnd = null
  579. }
  580. if(this.queryParams.invoiceTime&&this.queryParams.invoiceTime.length==2){
  581. this.queryParams.invoiceBeginTime =this.queryParams.invoiceTime[0];
  582. this.queryParams.invoiceEndTime =this.queryParams.invoiceTime[1];
  583. }else {
  584. this.queryParams.invoiceBeginTime = null
  585. this.queryParams.invoiceEndTime = null
  586. }
  587. let params = JSON.parse(JSON.stringify(this.queryParams))
  588. for (let key in params) {
  589. if(key != 'pageNum' && key != 'pageSize' && key != 'time' && key != 'createTime' && key != 'performDate' && key != 'invoiceTime'){
  590. postMap[key] = params[key]
  591. }
  592. }
  593. downOrderListXls(postMap)
  594. .then((res) => {
  595. exportExcel(res, '订单管理', '.xlsx');
  596. this.handleExportLoading = false;
  597. })
  598. .catch((error) => {
  599. console.log("error===",error)
  600. this.handleExportLoading = false;
  601. });
  602. })
  603. .catch(() => {
  604. this.$message.info('您已取消导出!');
  605. });
  606. },
  607. handleOpen(list=[]){
  608. if(!list||list.length==0) return
  609. let idList = []
  610. list.forEach((item,index)=>{
  611. idList.push(item.id)
  612. })
  613. this.viewerList = idList
  614. this.getPrintListApi()
  615. this.$set(this.ruleForm, 'region', '');
  616. this.$nextTick(()=>{
  617. this.$refs.ruleForm.clearValidate('region')
  618. })
  619. this.dialogVisible = true
  620. },
  621. handleClose(){
  622. this.dialogVisible = false
  623. },
  624. /** 查询打印机列表 */
  625. getPrintListApi() {
  626. getPrintListApi({deviceType:5,pageNum: 1,
  627. pageSize: 999,})
  628. .then(response => {
  629. this.printList = response.data.rows;
  630. }
  631. );
  632. },
  633. /** 选择打印机 */
  634. selectPrint(){
  635. },
  636. // 打印
  637. async print(list = []){
  638. this.$refs.ruleForm.validate(async (valid) => {
  639. if (valid) {
  640. this.dialogVisibleLoading = true
  641. try {
  642. let res = await printApi({
  643. //viewerList:list,
  644. orderId: list[0],
  645. source: 2,
  646. deviceId: this.ruleForm.region
  647. })
  648. if(res.code == 200) {
  649. let url = res.data.linkIp
  650. let printInfo = res.data.printInfo
  651. this.connectPrint(url,printInfo)
  652. }else {
  653. throw new Error(res)
  654. }
  655. } catch (error) {
  656. this.dialogVisible = false
  657. this.dialogVisibleLoading = false
  658. console.error("error=====",error)
  659. }
  660. } else {
  661. console.log('error submit!!');
  662. return false;
  663. }
  664. });
  665. },
  666. /** 连接打印机 */
  667. connectPrint(url,data){
  668. // let xhr = new XMLHttpRequest();
  669. // xhr.onreadystatechange = ()=>{
  670. // if(xhr.readyState == 4){ // 监听请求完成
  671. // if((xhr.status >=200 && xhr.status <300) || xhr.status == 304){
  672. // console.log(xhr.responseText)
  673. // this.dialogVisible = false
  674. // this.dialogVisibleLoading = false
  675. // }else{
  676. // console.log('请求失败')
  677. // this.dialogVisible = false
  678. // this.dialogVisibleLoading = false
  679. // }
  680. // }
  681. // }
  682. // xhr.open("post", url, true); // 异步请求
  683. // xhr.send(JSON.stringify(data));
  684. // 创建忽略 SSL 的 axios 实例
  685. const ignoreSSL = axios.create({
  686. httpsAgent: new https.Agent({
  687. rejectUnauthorized: false
  688. }),
  689. withCredentials: true, // 跨域请求时发送Cookie
  690. timeout: 60000, // 请求超时
  691. headers: {
  692. "Content-Type": "application/json; charset=UTF-8;"
  693. }
  694. });
  695. ignoreSSL.post(url,
  696. { ...data }
  697. ).then(()=>{
  698. this.dialogVisible = false
  699. this.dialogVisibleLoading = false
  700. }).catch(()=>{
  701. this.dialogVisible = false
  702. this.dialogVisibleLoading = false
  703. })
  704. },
  705. /** 关闭订单 */
  706. handleCancelOrder(row) {
  707. this.$confirm("是否关闭" + row.id + "的订单?", '提示', {
  708. confirmButtonText: '确定',
  709. cancelButtonText: '取消',
  710. type: 'warning'
  711. }).then(() => {
  712. orderInfoCancel({ orderId: row.id}).then((res) => {
  713. if (res.code == 200) {
  714. this.$message({
  715. type: 'success',
  716. message: '操作成功!'
  717. });
  718. this.getList();
  719. }
  720. });
  721. }).catch(() => {});
  722. },
  723. },
  724. beforeDestroy() {
  725. this.resizeObserver.unobserve(this.$refs.queryFormBox);
  726. this.resizeObserver.disconnect();
  727. },
  728. };
  729. </script>
  730. <style scoped lang="scss">
  731. .app-container {
  732. height: calc( 100vh - 110px );
  733. box-sizing: border-box;
  734. }
  735. .app-container-query {
  736. }
  737. .app-container-table-box {
  738. height: calc( 100% - var(--q-height) );
  739. .app-container-table-info {
  740. height: calc( 100% - 100px );
  741. }
  742. }
  743. </style>