index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  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="left" type="index" width="60"></el-table-column>
  197. <el-table-column label="订单号" align="center" fixed="left" prop="id" />
  198. <el-table-column label="购票人手机号" align="center" fixed="left" prop="memberMobile" />
  199. <el-table-column label="剧目名称" align="center" fixed="left" prop="performName" />
  200. <el-table-column label="票务名称" align="center" fixed="left" prop="goodsName" />
  201. <el-table-column label="座位类型" align="center" fixed="left" prop="seatTypeName" />
  202. <el-table-column label="购票渠道" align="center" fixed="left" 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. };
  391. },
  392. created() {
  393. this.$set(this.queryParams,'performDate',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")])
  394. this.pagePerformTimeListFun(this.queryParams.performDate)
  395. this.getList();
  396. },
  397. mounted() {
  398. this.resizeObserver = new ResizeObserver(entries => {
  399. for (let entry of entries) {
  400. const { width, height } = entry.contentRect;
  401. this.qHeight = height + 'px'
  402. }
  403. });
  404. this.resizeObserver.observe(this.$refs.queryFormBox);
  405. },
  406. methods: {
  407. /** 查询列表 */
  408. getList() {
  409. this.loading = true;
  410. let params = {...this.addDateRange(this.queryParams, this.dateRange)};
  411. delete params.performDate;
  412. delete params.invoiceTime
  413. pageList(params)
  414. .then(response => {
  415. this.dataList = response.data.rows;
  416. this.total = response.data.total;
  417. this.loading = false;
  418. });
  419. },
  420. // 取消按钮
  421. cancel() {
  422. this.open = false;
  423. },
  424. /** 搜索按钮操作 */
  425. handleQuery() {
  426. this.queryParams.pageNum = 1;
  427. if(this.queryParams.time){
  428. this.queryParams.payBeginTime = this.queryParams.time[0];
  429. this.queryParams.payEndTime = this.queryParams.time[1];
  430. }else {
  431. this.queryParams.payBeginTime = null
  432. this.queryParams.payEndTime = null
  433. }
  434. if(this.queryParams.createTime&&this.queryParams.createTime.length>0){
  435. this.queryParams.createBeginTime = this.queryParams.createTime[0];
  436. this.queryParams.createEndTime = this.queryParams.createTime[1];
  437. }else {
  438. this.queryParams.createBeginTime = null
  439. this.queryParams.createEndTime = null
  440. }
  441. if(this.queryParams.performDate){
  442. this.queryParams.performDateStart = this.queryParams.performDate[0];
  443. this.queryParams.performDateEnd = this.queryParams.performDate[1];
  444. }else {
  445. this.queryParams.performDateStart = null
  446. this.queryParams.performDateEnd = null
  447. }
  448. if(this.queryParams.invoiceTime&&this.queryParams.invoiceTime.length==2){
  449. this.queryParams.invoiceBeginTime =this.queryParams.invoiceTime[0];
  450. this.queryParams.invoiceEndTime =this.queryParams.invoiceTime[1];
  451. }else {
  452. this.queryParams.invoiceBeginTime = null
  453. this.queryParams.invoiceEndTime = null
  454. }
  455. this.getList();
  456. },
  457. /** 重置按钮操作 */
  458. resetQuery() {
  459. this.dateRange = [];
  460. this.$set(this.queryParams, 'orderId', '');
  461. this.$set(this.queryParams, 'status', '');
  462. this.$set(this.queryParams, 'memberMobile', '');
  463. this.$set(this.queryParams, 'source', '');
  464. this.$set(this.queryParams, 'performName', '');
  465. this.$set(this.queryParams, 'payBeginTime', '');
  466. this.$set(this.queryParams, 'payEndTime', '');
  467. this.$set(this.queryParams, 'time', '');
  468. this.$set(this.queryParams, 'createTime', '');
  469. this.$set(this.queryParams, 'createBeginTime', '');
  470. this.$set(this.queryParams, 'createEndTime', '');
  471. this.$set(this.queryParams, 'goodsName', '');
  472. this.$set(this.queryParams, 'performDate', '');
  473. this.$set(this.queryParams, 'timeSnapshot', '');
  474. this.$set(this.queryParams, 'performTimeId', '');
  475. this.$set(this.queryParams, 'payWay', '');
  476. this.$set(this.queryParams, 'invoiceTime', '');
  477. this.queryParams.pageNum = 1;
  478. this.handleQuery();
  479. },
  480. /** 详情按钮操作 */
  481. openDetails(row, type) {
  482. this.$refs["detailsDia"].openDialog("详情", row, type);
  483. },
  484. async pagePerformTimeListFun(value) {
  485. // console.log('value',value);
  486. try {
  487. this.pagePerformTimeList = []
  488. this.$set(this.queryParams,'performTimeId',null)
  489. if(!value){
  490. return
  491. }
  492. if(value.length==2&&value[0]==value[1]){
  493. this.multiPerformDate = false
  494. }else{
  495. this.multiPerformDate = true
  496. return
  497. }
  498. let { data,code } = await pagePerformTimeList({
  499. performDate: value[0],
  500. pageNum: 1,
  501. pageSize: 999
  502. })
  503. this.pagePerformTimeList = [].concat(data.rows)
  504. } catch (error) {
  505. }
  506. },
  507. /**
  508. * 导出报表
  509. * @date 2022-10-24
  510. * @returns {any}
  511. */
  512. handleExport() {
  513. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  514. confirmButtonText: '确定 ',
  515. cancelButtonText: '取消 ',
  516. type: 'warning'
  517. })
  518. .then(() => {
  519. this.handleExportLoading = true;
  520. // const { pageNum, pageSize} = this.params;
  521. let postMap = {}
  522. if(this.queryParams.time){
  523. this.queryParams.payBeginTime = this.queryParams.time[0];
  524. this.queryParams.payEndTime = this.queryParams.time[1];
  525. }else {
  526. this.queryParams.payBeginTime = null
  527. this.queryParams.payEndTime = null
  528. }
  529. if(this.queryParams.createTime&&this.queryParams.createTime.length>0){
  530. this.queryParams.createBeginTime = this.queryParams.createTime[0];
  531. this.queryParams.createEndTime = this.queryParams.createTime[1];
  532. }else {
  533. this.queryParams.createBeginTime = null
  534. this.queryParams.createEndTime = null
  535. }
  536. if(this.queryParams.performDate){
  537. this.queryParams.performDateStart = this.queryParams.performDate[0];
  538. this.queryParams.performDateEnd = this.queryParams.performDate[1];
  539. }else {
  540. this.queryParams.performDateStart = null
  541. this.queryParams.performDateEnd = null
  542. }
  543. if(this.queryParams.invoiceTime&&this.queryParams.invoiceTime.length==2){
  544. this.queryParams.invoiceBeginTime =this.queryParams.invoiceTime[0];
  545. this.queryParams.invoiceEndTime =this.queryParams.invoiceTime[1];
  546. }else {
  547. this.queryParams.invoiceBeginTime = null
  548. this.queryParams.invoiceEndTime = null
  549. }
  550. let params = JSON.parse(JSON.stringify(this.queryParams))
  551. for (let key in params) {
  552. if(key != 'pageNum' && key != 'pageSize' && key != 'time' && key != 'createTime' && key != 'performDate' && key != 'invoiceTime'){
  553. postMap[key] = params[key]
  554. }
  555. }
  556. downOrderListXls(postMap)
  557. .then((res) => {
  558. exportExcel(res, '订单管理', '.xlsx');
  559. this.handleExportLoading = false;
  560. })
  561. .catch((error) => {
  562. console.log("error===",error)
  563. this.handleExportLoading = false;
  564. });
  565. })
  566. .catch(() => {
  567. this.$message.info('您已取消导出!');
  568. });
  569. },
  570. handleOpen(list=[]){
  571. if(!list||list.length==0) return
  572. let idList = []
  573. list.forEach((item,index)=>{
  574. idList.push(item.id)
  575. })
  576. this.viewerList = idList
  577. this.getPrintListApi()
  578. this.$set(this.ruleForm, 'region', '');
  579. this.$nextTick(()=>{
  580. this.$refs.ruleForm.clearValidate('region')
  581. })
  582. this.dialogVisible = true
  583. },
  584. handleClose(){
  585. this.dialogVisible = false
  586. },
  587. /** 查询打印机列表 */
  588. getPrintListApi() {
  589. getPrintListApi({deviceType:5,pageNum: 1,
  590. pageSize: 999,})
  591. .then(response => {
  592. this.printList = response.data.rows;
  593. }
  594. );
  595. },
  596. /** 选择打印机 */
  597. selectPrint(){
  598. },
  599. // 打印
  600. async print(list = []){
  601. this.$refs.ruleForm.validate(async (valid) => {
  602. if (valid) {
  603. this.dialogVisibleLoading = true
  604. try {
  605. let res = await printApi({
  606. //viewerList:list,
  607. orderId: list[0],
  608. source: 2,
  609. deviceId: this.ruleForm.region
  610. })
  611. if(res.code == 200) {
  612. let url = res.data.linkIp
  613. let printInfo = res.data.printInfo
  614. this.connectPrint(url,printInfo)
  615. }else {
  616. throw new Error(res)
  617. }
  618. } catch (error) {
  619. this.dialogVisible = false
  620. this.dialogVisibleLoading = false
  621. console.error("error=====",error)
  622. }
  623. } else {
  624. console.log('error submit!!');
  625. return false;
  626. }
  627. });
  628. },
  629. /** 连接打印机 */
  630. connectPrint(url,data){
  631. // let xhr = new XMLHttpRequest();
  632. // xhr.onreadystatechange = ()=>{
  633. // if(xhr.readyState == 4){ // 监听请求完成
  634. // if((xhr.status >=200 && xhr.status <300) || xhr.status == 304){
  635. // console.log(xhr.responseText)
  636. // this.dialogVisible = false
  637. // this.dialogVisibleLoading = false
  638. // }else{
  639. // console.log('请求失败')
  640. // this.dialogVisible = false
  641. // this.dialogVisibleLoading = false
  642. // }
  643. // }
  644. // }
  645. // xhr.open("post", url, true); // 异步请求
  646. // xhr.send(JSON.stringify(data));
  647. // 创建忽略 SSL 的 axios 实例
  648. const ignoreSSL = axios.create({
  649. httpsAgent: new https.Agent({
  650. rejectUnauthorized: false
  651. }),
  652. withCredentials: true, // 跨域请求时发送Cookie
  653. timeout: 60000, // 请求超时
  654. headers: {
  655. "Content-Type": "application/json; charset=UTF-8;"
  656. }
  657. });
  658. ignoreSSL.post(url,
  659. { ...data }
  660. ).then(()=>{
  661. this.dialogVisible = false
  662. this.dialogVisibleLoading = false
  663. }).catch(()=>{
  664. this.dialogVisible = false
  665. this.dialogVisibleLoading = false
  666. })
  667. },
  668. /** 关闭订单 */
  669. handleCancelOrder(row) {
  670. this.$confirm("是否关闭" + row.id + "的订单?", '提示', {
  671. confirmButtonText: '确定',
  672. cancelButtonText: '取消',
  673. type: 'warning'
  674. }).then(() => {
  675. orderInfoCancel({ orderId: row.id}).then((res) => {
  676. if (res.code == 200) {
  677. this.$message({
  678. type: 'success',
  679. message: '操作成功!'
  680. });
  681. this.getList();
  682. }
  683. });
  684. }).catch(() => {});
  685. },
  686. },
  687. beforeDestroy() {
  688. this.resizeObserver.unobserve(this.$refs.queryFormBox);
  689. this.resizeObserver.disconnect();
  690. },
  691. };
  692. </script>
  693. <style scoped lang="scss">
  694. .app-container {
  695. height: calc( 100vh - 110px );
  696. box-sizing: border-box;
  697. }
  698. .app-container-query {
  699. }
  700. .app-container-table-box {
  701. height: calc( 100% - var(--q-height) );
  702. .app-container-table-info {
  703. height: calc( 100% - 100px );
  704. }
  705. }
  706. </style>