index.vue 26 KB

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