index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  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.id"
  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.teamName"
  17. placeholder="请输入团队名称"
  18. clearable
  19. style="width: 240px;"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="销售员" label-width="100px">
  24. <el-input
  25. v-model="queryParams.salerPerson"
  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-select
  34. v-model="queryParams.teamTypeId"
  35. placeholder="团队类型"
  36. clearable
  37. style="width: 240px"
  38. >
  39. <el-option
  40. v-for="dict in dict.type.team_type"
  41. :key="dict.value"
  42. :label="dict.label"
  43. :value="dict.value"
  44. />
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item label="是否成功开票" label-width="100">
  48. <el-select
  49. v-model="queryParams.ifSuccessInvoice"
  50. placeholder="请选择"
  51. clearable
  52. style="width: 100%"
  53. >
  54. <el-option label="否" value="0" />
  55. <el-option label="是" value="1" />
  56. </el-select>
  57. </el-form-item>
  58. <el-form-item label="订单状态">
  59. <el-select
  60. v-model="queryParams.status"
  61. placeholder="订单状态"
  62. clearable
  63. style="width: 100%"
  64. >
  65. <el-option
  66. v-for="dict in dict.type.order_status_type"
  67. :key="dict.value"
  68. :label="dict.label"
  69. :value="dict.value"
  70. />
  71. </el-select>
  72. </el-form-item>
  73. <el-form-item label="支付时间">
  74. <el-date-picker
  75. v-model="queryParams.time"
  76. type="daterange"
  77. value-format="yyyy-MM-dd"
  78. range-separator="至"
  79. start-placeholder="开始日期"
  80. end-placeholder="结束日期">
  81. </el-date-picker>
  82. </el-form-item>
  83. <!-- <el-form-item label="场次时间">
  84. <el-date-picker
  85. style="width: 230px;"
  86. v-model="queryParams.performDate"
  87. @change="pagePerformTimeListFun"
  88. type="date"
  89. value-format="yyyy-MM-dd"
  90. placeholder="选择日期">
  91. </el-date-picker>
  92. </el-form-item> -->
  93. <el-form-item label="场次时间" label-width="70px">
  94. <el-date-picker
  95. style="width: 250px;"
  96. v-model="queryParams.performDate"
  97. @change="pagePerformTimeListFun"
  98. type="daterange"
  99. value-format="yyyy-MM-dd"
  100. range-separator="至"
  101. start-placeholder="开始日期"
  102. end-placeholder="结束日期">
  103. </el-date-picker>
  104. </el-form-item>
  105. <el-form-item label="场次" v-if="!multiPerformDate">
  106. <el-select
  107. v-model="queryParams.performTimeId"
  108. placeholder="场次"
  109. clearable
  110. style="width: 100%"
  111. >
  112. <el-option
  113. v-for="dict in pagePerformTimeList"
  114. :key="dict.id"
  115. :label="dict.timeSnapshot+'('+dict.performTimeStart+'-'+dict.performTimeEnd+')'"
  116. :value="dict.id"
  117. />
  118. </el-select>
  119. </el-form-item>
  120. <el-form-item label="开票时间">
  121. <el-date-picker
  122. style="width: 230px;"
  123. v-model="queryParams.invoiceTime"
  124. type="daterange"
  125. value-format="yyyy-MM-dd"
  126. range-separator="至"
  127. start-placeholder="开始日期"
  128. end-placeholder="结束日期">
  129. </el-date-picker>
  130. </el-form-item>
  131. <el-form-item>
  132. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  133. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  134. </el-form-item>
  135. </el-form>
  136. </div>
  137. <div class="app-container-table-box">
  138. <el-row :gutter="10" class="mb8">
  139. <el-button
  140. type="primary"
  141. size="mini"
  142. icon="el-icon-download"
  143. v-hasPermi="['groupBuyingMr:groupBuyingMr:excel']"
  144. @click="handleExport"
  145. v-loading.fullscreen.lock="handleExportLoading"
  146. element-loading-text="正在拼命生成数据中..."
  147. element-loading-spinner="el-icon-loading"
  148. element-loading-background="rgba(0, 0, 0, 0.5)"
  149. >导出excel</el-button>
  150. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  151. </el-row>
  152. <div class="app-container-table-info">
  153. <el-table ref="tables" v-loading="loading" height="100%" :data="dataList" border>
  154. <el-table-column label="序号" align="center" :fixed="fixed" type="index" width="60"></el-table-column>
  155. <el-table-column label="订单号" align="center" :fixed="fixed" prop="id" />
  156. <el-table-column label="团队名称" align="center" :fixed="fixed" prop="teamName" />
  157. <el-table-column label="团队类型" align="center" :fixed="fixed" prop="type">
  158. <template slot-scope="scope">
  159. <dict-tag :options="dict.type.team_type" :value="scope.row.teamType"/>
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="联系电话" align="center" prop="teamMobile" />
  163. <el-table-column label="客户负责人" align="center" prop="teamContact" />
  164. <el-table-column label="销售员" align="center" prop="salerPerson" />
  165. <el-table-column label="剧目名称" align="center" prop="performName" />
  166. <el-table-column label="票务名称" align="center" prop="goodsName" />
  167. <el-table-column label="座位类型" align="center" prop="seatTypeName" />
  168. <el-table-column label="场次时间" align="center" prop="performDate" />
  169. <el-table-column label="场次" width="120" align="center" prop="timeSnapshot">
  170. <template slot-scope="scope">
  171. <span>{{ scope.row.timeSnapshot }} <br /> ({{ scope.row.performTimeStart + '-' + scope.row.performTimeEnd }})</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="团购数量" align="center" prop="quantity" />
  175. <!-- <el-table-column label="支付总额" align="center" prop="orderPrice">
  176. <template slot-scope="scope">
  177. <span>¥{{ scope.row.orderPrice }}</span>
  178. </template>
  179. </el-table-column> -->
  180. <el-table-column label="应收金额" align="center" prop="orderPrice">
  181. <template slot-scope="scope">
  182. <span>¥{{ scope.row.orderPrice }}</span>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="实收金额" align="center" prop="realPrice">
  186. <template slot-scope="scope">
  187. <span>¥{{ scope.row.realPrice }}</span>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="支付方式" align="center" prop="type">
  191. <template slot-scope="scope">
  192. <dict-tag :options="dict.type.pay_way_type" :value="scope.row.payWay"/>
  193. </template>
  194. </el-table-column>
  195. <el-table-column label="支付时间" align="center" prop="payTime" width="160" >
  196. <template slot-scope="scope">
  197. <span>{{ parseTime(scope.row.payTime) }}</span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="订单状态" align="center" prop="type">
  201. <template slot-scope="scope">
  202. <dict-tag :options="dict.type.order_status_type" :value="scope.row.status"/>
  203. </template>
  204. </el-table-column>
  205. <el-table-column label="已核销票数" align="center" prop="usedTotal">
  206. <template slot-scope="scope">
  207. <span>{{ scope.row.usedTotal }}</span>
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="已核销金额" align="center" prop="usedPriceTotal">
  211. <template slot-scope="scope">
  212. <span>{{ scope.row.usedPriceTotal }}</span>
  213. </template>
  214. </el-table-column>
  215. <el-table-column label="退票数量" align="center" prop="refundTotal">
  216. <template slot-scope="scope">
  217. <span>{{ scope.row.refundTotal }}</span>
  218. </template>
  219. </el-table-column>
  220. <el-table-column label="退票金额" align="center" prop="refundPriceTotal">
  221. <template slot-scope="scope">
  222. <span>{{ scope.row.refundPriceTotal }}</span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="是否成功开票" align="center">
  226. <template slot-scope="scope">
  227. <el-tag type="danger" v-if="scope.row.ifSuccessInvoice == '0'">否</el-tag>
  228. <el-tag type="success" v-else-if="scope.row.ifSuccessInvoice == '1'">是</el-tag>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="开票时间" align="center" prop="invoiceTime">
  232. <template slot-scope="scope">
  233. <span>{{ scope.row.invoiceTime }}</span>
  234. </template>
  235. </el-table-column>
  236. <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
  237. <template slot-scope="scope">
  238. <el-button
  239. size="mini"
  240. type="text"
  241. @click="openDetails(scope.row)"
  242. v-hasPermi="['groupBuyingMr:groupBuyingMr:details']"
  243. >详情</el-button>
  244. <el-button
  245. v-if="scope.row.payWay == 'corporate'"
  246. size="mini"
  247. type="text"
  248. @click="handleCorporatePay(scope.row)"
  249. v-hasPermi="['groupBuyingMr:groupBuyingMr:details']"
  250. >对公转账</el-button>
  251. <el-button
  252. v-if="scope.row.status === 0"
  253. size="mini"
  254. type="text"
  255. @click="handleCancelOrder(scope.row)"
  256. v-hasPermi="['groupBuyingMr:groupBuyingMr:cancel']"
  257. >关闭订单</el-button>
  258. <el-button
  259. v-if="scope.row.status == 3 || scope.row.status == 7"
  260. size="mini"
  261. type="text"
  262. @click="handleOpen([scope.row])"
  263. v-hasPermi="['groupBuyingMr:groupBuyingMr:print']"
  264. >打印小票</el-button>
  265. </template>
  266. </el-table-column>
  267. </el-table>
  268. <pagination
  269. v-show="total>0"
  270. :total="total"
  271. :page.sync="queryParams.pageNum"
  272. :limit.sync="queryParams.pageSize"
  273. @pagination="getList"
  274. />
  275. </div>
  276. </div>
  277. <!-- 详情 -->
  278. <details-dia ref="detailsDia" :dict="dict" @getList="getList"></details-dia>
  279. <el-dialog
  280. title="选择小票机"
  281. :visible.sync="dialogVisible"
  282. width="30%"
  283. :before-close="handleClose">
  284. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  285. <el-form-item label="小票机" prop="region">
  286. <el-select v-model="ruleForm.region" placeholder="选择小票机">
  287. <el-option :label="item.deviceName" :key="item.id" :value="item.id" v-for="(item,index) in printList"></el-option>
  288. </el-select>
  289. </el-form-item>
  290. </el-form>
  291. <span slot="footer" class="dialog-footer">
  292. <el-button @click="dialogVisible = false">取 消</el-button>
  293. <el-button type="primary" :loading="dialogVisibleLoading" @click="print(viewerList)">{{ dialogVisibleLoading?'打印中...':'打印' }}</el-button>
  294. </span>
  295. </el-dialog>
  296. <el-dialog
  297. title="对公信息凭证"
  298. :visible.sync="showCorporatePay"
  299. width="50%"
  300. @close="handleCorporatePayClose"
  301. :before-close="handleCorporatePayClose">
  302. <el-form v-loading="corporatePayLoading" :model="ruleForm" :rules="corporatePayRules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  303. <el-form-item label="凭证上传" prop="photoList" required>
  304. <el-upload
  305. ref="upload"
  306. :class="form.photoList && form.photoList.length>=15 ? 'upload-box':''"
  307. :action="uploadObj.url"
  308. :headers="uploadObj.headers"
  309. accept=".jpg,.png"
  310. :on-success="handlePhotoListSuccess"
  311. :before-upload="beforeAvatarUpload"
  312. list-type="picture-card"
  313. :file-list="form.photoList"
  314. :on-remove="handleRemove"
  315. :limit="15"
  316. >
  317. <i class="el-icon-plus"></i>
  318. </el-upload>
  319. </el-form-item>
  320. <el-form-item label="备注">
  321. <el-input placeholder="请备注" type="textarea" maxlength="300" show-word-limit v-model="form.corporate.remark"></el-input>
  322. </el-form-item>
  323. </el-form>
  324. <span slot="footer" class="dialog-footer">
  325. <el-button @click="showCorporatePay = false">取 消</el-button>
  326. <el-button type="primary" :loading="corporatePayLoading" @click="corporatePay">{{ dialogVisibleLoading?'操作中...':'确定' }}</el-button>
  327. </span>
  328. </el-dialog>
  329. </div>
  330. </template>
  331. <script>
  332. import { getToken } from "@/utils/auth";
  333. import { pageList,gotoCorporatePay, downOrderListXls } from '@/api/order/groupBuyingMr';
  334. import { orderInfoCancel } from '@/api/windowTicketSales/ticketingSales';
  335. import detailsDia from "./dialog/details.vue";
  336. import { printApi } from '@/api/order/orderMr'
  337. import { getSelectById } from '@/api/order/groupBuyingMr'
  338. import { pageList as getPrintListApi } from "@/api/device/pda";
  339. import { pagePerformTimeList } from "@/api/schedulingMr/schedulingMr"
  340. import { exportExcel } from '@/utils/exportexcel'
  341. import moment from "moment"
  342. const https = require('https');
  343. const axios = require('axios');
  344. export default {
  345. name: "agreement",
  346. dicts: ['agreement_type', 'team_type','order_status_type','pay_way_type'],
  347. components: { detailsDia },
  348. data() {
  349. return {
  350. qHeight: '0px',
  351. resizeObserver: null,
  352. // 遮罩层
  353. loading: true,
  354. // 选中数组
  355. ids: [],
  356. // 非单个禁用
  357. single: true,
  358. // 非多个禁用
  359. multiple: true,
  360. // 显示搜索条件
  361. showSearch: true,
  362. // 总条数
  363. total: 0,
  364. // 用户表格数据
  365. dataList: null,
  366. // 弹出层标题
  367. title: "",
  368. // 是否显示弹出层
  369. open: false,
  370. // 日期范围
  371. dateRange: [],
  372. // 查询参数
  373. queryParams: {
  374. pageNum: 1,
  375. pageSize: 10,
  376. },
  377. statusList: {
  378. 0: '待支付',
  379. 2: '超时取消',
  380. 3: '待使用',
  381. 4: '退款中',
  382. 5: '己退款',
  383. 6: '退款失败',
  384. 7: '己使用',
  385. 8: '己超期',
  386. 9: '关闭',
  387. },
  388. statusMapList: [
  389. {id: 1, name: '待支付', value: 0},
  390. {id: 2, name: '超时取消', value: 2},
  391. {id: 3, name: '待使用', value: 3},
  392. {id: 4, name: '退款中', value: 4},
  393. {id: 5, name: '己退款', value: 5},
  394. {id: 6, name: '退款失败', value: 6},
  395. {id: 7, name: '己使用', value: 7},
  396. {id: 8, name: '己超期', value: 8},
  397. {id: 9, name: '关闭', value: 9},
  398. ],
  399. payList: {
  400. 0: '未支付',
  401. 1: '已支付',
  402. 2: '支付中',
  403. 3: '支付失败',
  404. 4: '支付退款',
  405. },
  406. payWayList: {
  407. 'cahsh': '现金',
  408. 'wecaht.applet': '微信小程序支付',
  409. 'alipay': '支付宝OTA',
  410. 'wecaht.h5': '微信公众号支付',
  411. 'meituan': '美团支付',
  412. 'corporate': '对公支付',
  413. },
  414. sourceList: {
  415. 1: '小程序',
  416. 2: '公众号',
  417. 3: '美团',
  418. 4: '携程',
  419. 5: '团购',
  420. },
  421. sourceMapList: [
  422. {id: 1, name: '小程序', value: 1},
  423. {id: 2, name: '公众号', value: 2},
  424. {id: 3, name: '美团', value: 3},
  425. {id: 4, name: '携程', value: 4},
  426. {id: 5, name: '团购', value: 5},
  427. ],
  428. visibleStatus: false,
  429. newObj: {},
  430. visibleType: '',
  431. viewerList: [],
  432. printList: [],
  433. dialogVisible: false,
  434. ruleForm: {},
  435. rules: {
  436. region: [
  437. { required: true, message: '请选择打印机', trigger: ['change','blur' ]}
  438. ],
  439. },
  440. dialogVisibleLoading: false,
  441. showCorporatePay:false,
  442. form:{
  443. orderId:'',
  444. photoList:[],
  445. corporate:{
  446. voucherUrl:'',
  447. remark:'',
  448. }
  449. },
  450. corporatePayRules: {
  451. photoList: [{ required: true, message: "请上传凭证", trigger: ["change","blur"] }],
  452. },
  453. uploadObj: {
  454. url: process.env.VUE_APP_UPLOAD_FILE_API + "/upload/single/minio",
  455. Headers: { Authorization: "Bearer " + getToken() },
  456. },
  457. corporatePayLoading:false,
  458. handleExportLoading: false,
  459. pagePerformTimeList: [], // 场次列表
  460. multiPerformDate:false,
  461. fixed: 'left',
  462. };
  463. },
  464. created() {
  465. this.$set(this.queryParams,'performDate',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")])
  466. this.pagePerformTimeListFun(this.queryParams.performDate)
  467. this.getList();
  468. },
  469. mounted() {
  470. this.resizeObserver = new ResizeObserver(entries => {
  471. for (let entry of entries) {
  472. const { width, height } = entry.contentRect;
  473. this.qHeight = height + 'px'
  474. }
  475. if(document.body.clientWidth<765) {
  476. this.fixed = false
  477. }else {
  478. this.fixed = 'left'
  479. }
  480. });
  481. this.resizeObserver.observe(this.$refs.queryFormBox);
  482. },
  483. methods: {
  484. /** 查询列表 */
  485. getList() {
  486. this.loading = true;
  487. let params = {...this.addDateRange(this.queryParams, this.dateRange)};
  488. if(params.performDate&&params.performDate.length==2){
  489. params.performDateStart = params.performDate[0];
  490. params.performDateEnd = params.performDate[1];
  491. }else {
  492. params.performDateStart = null
  493. params.performDateEnd =null
  494. }
  495. delete params.performDate;
  496. pageList(params)
  497. .then(response => {
  498. this.dataList = response.data.rows;
  499. this.total = response.data.total;
  500. this.loading = false;
  501. });
  502. },
  503. // 取消按钮
  504. cancel() {
  505. this.open = false;
  506. },
  507. /** 搜索按钮操作 */
  508. handleQuery() {
  509. this.queryParams.pageNum = 1;
  510. if(this.queryParams.time){
  511. this.queryParams.beginTime = this.queryParams.time[0];
  512. this.queryParams.endTime = this.queryParams.time[1];
  513. }else{
  514. this.queryParams.beginTime = null
  515. this.queryParams.endTime = null
  516. }
  517. if(this.queryParams.invoiceTime&&this.queryParams.invoiceTime.length==2){
  518. this.queryParams.invoiceBeginTime =this.queryParams.invoiceTime[0];
  519. this.queryParams.invoiceEndTime =this.queryParams.invoiceTime[1];
  520. }else {
  521. this.queryParams.invoiceBeginTime = null
  522. this.queryParams.invoiceEndTime = null
  523. }
  524. this.getList();
  525. },
  526. /** 重置按钮操作 */
  527. resetQuery() {
  528. this.dateRange = [];
  529. this.$set(this.queryParams, 'id', '');
  530. this.$set(this.queryParams, 'status', '');
  531. this.$set(this.queryParams, 'teamTypeId', '');
  532. this.$set(this.queryParams, 'teamName', '');
  533. this.$set(this.queryParams, 'performName', '');
  534. this.$set(this.queryParams, 'beginTime', '');
  535. this.$set(this.queryParams, 'endTime', '');
  536. this.$set(this.queryParams, 'time', '');
  537. this.$set(this.queryParams, 'performDate', '');
  538. this.$set(this.queryParams, 'performTimeId', '');
  539. this.$set(this.queryParams, 'invoiceTime', '');
  540. this.$set(this.queryParams, 'salerPerson', '');
  541. this.queryParams.pageNum = 1;
  542. this.handleQuery();
  543. },
  544. /** 详情按钮操作 */
  545. openDetails(row, type) {
  546. this.$refs["detailsDia"].openDialog("详情", row, type);
  547. },
  548. handleOpen(list=[]){
  549. if(!list||list.length==0) return
  550. let idList = []
  551. list.forEach((item,index)=>{
  552. idList.push(item.id)
  553. })
  554. this.viewerList = idList
  555. this.getPrintListApi()
  556. this.$set(this.ruleForm, 'region', '');
  557. this.$nextTick(()=>{
  558. this.$refs.ruleForm.clearValidate('region')
  559. })
  560. this.dialogVisible = true
  561. },
  562. handleClose(){
  563. this.dialogVisible = false
  564. },
  565. /** 查询打印机列表 */
  566. getPrintListApi() {
  567. getPrintListApi({deviceType:5,pageNum: 1,
  568. pageSize: 999,})
  569. .then(response => {
  570. this.printList = response.data.rows;
  571. }
  572. );
  573. },
  574. /** 选择打印机 */
  575. selectPrint(){
  576. },
  577. // 打印
  578. async print(list = []){
  579. this.$refs.ruleForm.validate(async (valid) => {
  580. if (valid) {
  581. this.dialogVisibleLoading = true
  582. try {
  583. let res = await printApi({
  584. //viewerList:list,
  585. orderId: list[0],
  586. source: 2,
  587. deviceId: this.ruleForm.region
  588. })
  589. if(res.code == 200) {
  590. let url = res.data.linkIp
  591. let printInfo = res.data.printInfo
  592. this.connectPrint(url,printInfo)
  593. }else {
  594. throw new Error(res)
  595. }
  596. } catch (error) {
  597. this.dialogVisible = false
  598. this.dialogVisibleLoading = false
  599. console.error("error=====",error)
  600. }
  601. } else {
  602. console.log('error submit!!');
  603. return false;
  604. }
  605. });
  606. },
  607. /** 连接打印机 */
  608. connectPrint(url,data){
  609. // let xhr = new XMLHttpRequest();
  610. // xhr.onreadystatechange = ()=>{
  611. // if(xhr.readyState == 4){ // 监听请求完成
  612. // if((xhr.status >=200 && xhr.status <300) || xhr.status == 304){
  613. // console.log(xhr.responseText)
  614. // this.dialogVisible = false
  615. // this.dialogVisibleLoading = false
  616. // }else{
  617. // console.log('请求失败')
  618. // this.dialogVisible = false
  619. // this.dialogVisibleLoading = false
  620. // }
  621. // }
  622. // }
  623. // xhr.open("post", url, true); // 异步请求
  624. // xhr.send(JSON.stringify(data));
  625. const ignoreSSL = axios.create({
  626. httpsAgent: new https.Agent({
  627. rejectUnauthorized: false
  628. }),
  629. withCredentials: true, // 跨域请求时发送Cookie
  630. timeout: 60000, // 请求超时
  631. headers: {
  632. "Content-Type": "application/json; charset=UTF-8;"
  633. }
  634. });
  635. ignoreSSL.post(url,
  636. { ...data }
  637. ).then(()=>{
  638. this.dialogVisible = false
  639. this.dialogVisibleLoading = false
  640. }).catch(()=>{
  641. this.dialogVisible = false
  642. this.dialogVisibleLoading = false
  643. })
  644. },
  645. async handleCorporatePay(row){
  646. console.log('corporatePay',row);
  647. this.showCorporatePay = true;
  648. this.corporatePayLoading = true;
  649. let res = await getSelectById(row.id)
  650. this.form.orderId = row.id;
  651. if(res.data.corporate){
  652. let urlList = res.data.corporate.voucherUrl.split(',')||[]
  653. let urlListObj = []
  654. urlList.forEach((item,index)=>{
  655. urlListObj.push({
  656. name: 'url_'+index,
  657. url: item
  658. })
  659. })
  660. this.$set(this.form,'photoList',urlListObj)
  661. this.$set(this.form.corporate,'remark',res.data.corporate.remark)
  662. }else {
  663. this.$set(this.form,'photoList',[])
  664. this.$set(this.form.corporate,'remark','')
  665. }
  666. this.corporatePayLoading = false;
  667. },
  668. handleCorporatePayClose(){
  669. console.log('1111');
  670. this.corporatePayLoading = false;
  671. this.showCorporatePay = false;
  672. },
  673. corporatePay(){
  674. console.log('form',this.form);
  675. if(this.form.photoList.length<1){
  676. this.$message.error('请上传凭证');
  677. return
  678. }
  679. this.corporatePayLoading = true;
  680. const voucherUrl = this.form.photoList.map(item => item.url).join(",");
  681. this.form.corporate.voucherUrl = voucherUrl;
  682. gotoCorporatePay(this.form).then((res)=>{
  683. this.$message.success(res.msg);
  684. this.corporatePayLoading = false;
  685. this.handleCorporatePayClose();
  686. }).catch((err)=>{
  687. this.corporatePayLoading = false;
  688. this.$message.error(err.msg);
  689. console.log('corporatePay err',err);
  690. })
  691. },
  692. /**
  693. * 剧目海报上传成功
  694. * @date 2023-11-22
  695. * @param {any} res
  696. * @returns {any}
  697. */
  698. handlePhotoListSuccess(res) {
  699. if (res.code === 200) {
  700. let photo = {
  701. imageUrl: res?.data?.url,
  702. url: res?.data?.url,
  703. photoType: '2'
  704. }
  705. if(!this.form.photoList){
  706. this.form.photoList = []
  707. }
  708. // this.form.photoList.push(photo);
  709. this.$set(this.form.photoList, this.form.photoList.length, photo);
  710. }
  711. },
  712. handleRemove(file, fileList) {
  713. this.form.photoList.forEach((item, index) => {
  714. if(item.uid == file.uid){
  715. this.form.photoList.splice(index, 1)
  716. }
  717. })
  718. },
  719. /**
  720. * 上传文件之前之前
  721. * @date 2023-11-22
  722. * @param {any} file
  723. * @returns {any}
  724. */
  725. beforeAvatarUpload(file) {
  726. const isJPG = file.type === "image/jpeg" || "image/png";
  727. if (!isJPG) {
  728. this.$message.error("上传头像图片只能是jpg或png格式!");
  729. }
  730. return isJPG;
  731. },
  732. /**
  733. * 导出报表
  734. * @date 2022-10-24
  735. * @returns {any}
  736. */
  737. handleExport() {
  738. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  739. confirmButtonText: '确定 ',
  740. cancelButtonText: '取消 ',
  741. type: 'warning'
  742. })
  743. .then(() => {
  744. this.handleExportLoading = true;
  745. // const { pageNum, pageSize} = this.params;
  746. let postMap = {}
  747. if(this.queryParams.time){
  748. this.queryParams.beginTime = this.queryParams.time[0];
  749. this.queryParams.endTime = this.queryParams.time[1];
  750. }else{
  751. this.queryParams.beginTime = null
  752. this.queryParams.endTime = null
  753. }
  754. if(this.queryParams.performDate&&this.queryParams.performDate.length==2){
  755. this.queryParams.performDateStart = this.queryParams.performDate[0];
  756. this.queryParams.performDateEnd = this.queryParams.performDate[1];
  757. }else {
  758. this.queryParams.performDateStart = null
  759. this.queryParams.performDateEnd =null
  760. }
  761. if(this.queryParams.invoiceTime&&this.queryParams.invoiceTime.length==2){
  762. this.queryParams.invoiceBeginTime =this.queryParams.invoiceTime[0];
  763. this.queryParams.invoiceEndTime =this.queryParams.invoiceTime[1];
  764. }else {
  765. this.queryParams.invoiceBeginTime = null
  766. this.queryParams.invoiceEndTime = null
  767. }
  768. let params = JSON.parse(JSON.stringify(this.queryParams))
  769. for (let key in params) {
  770. if(key != 'pageNum' && key != 'pageSize' && key != 'time' && key != 'performDate' && key != 'invoiceTime'){
  771. postMap[key] = params[key]
  772. }
  773. }
  774. downOrderListXls(postMap)
  775. .then((res) => {
  776. exportExcel(res, '团购订单', '.xlsx');
  777. this.handleExportLoading = false;
  778. })
  779. .catch((error) => {
  780. console.log("error===",error)
  781. this.handleExportLoading = false;
  782. });
  783. })
  784. .catch(() => {
  785. this.$message.info('您已取消导出!');
  786. });
  787. },
  788. async pagePerformTimeListFun(value) {
  789. try {
  790. this.pagePerformTimeList = []
  791. this.$set(this.queryParams,'performTimeId',null)
  792. if(!value){
  793. return
  794. }
  795. if(value.length==2&&value[0]==value[1]){
  796. this.multiPerformDate = false
  797. }else{
  798. this.multiPerformDate = true
  799. return
  800. }
  801. let { data,code } = await pagePerformTimeList({
  802. performDate: value[0],
  803. pageNum: 1,
  804. pageSize: 999
  805. })
  806. this.pagePerformTimeList = [].concat(data.rows)
  807. } catch (error) {
  808. }
  809. },
  810. /** 关闭订单 */
  811. handleCancelOrder(row) {
  812. this.$confirm("是否关闭" + row.id + "的订单?", '提示', {
  813. confirmButtonText: '确定',
  814. cancelButtonText: '取消',
  815. type: 'warning'
  816. }).then(() => {
  817. orderInfoCancel({ orderId: row.id}).then((res) => {
  818. if (res.code == 200) {
  819. this.$message({
  820. type: 'success',
  821. message: '操作成功!'
  822. });
  823. this.getList();
  824. }
  825. });
  826. }).catch(() => {});
  827. },
  828. },
  829. beforeDestroy() {
  830. this.resizeObserver.unobserve(this.$refs.queryFormBox);
  831. this.resizeObserver.disconnect();
  832. },
  833. };
  834. </script>
  835. <style lang="scss" scoped>
  836. .upload-btn {
  837. width: 100px;
  838. height: 100px;
  839. background-color: #fbfdff;
  840. border: dashed 1px #c0ccda;
  841. border-radius: 5px;
  842. i {
  843. font-size: 30px;
  844. margin-top: 20px;
  845. }
  846. &-text {
  847. margin-top: -10px;
  848. }
  849. }
  850. .avatar {
  851. cursor: pointer;
  852. }
  853. .app-container {
  854. height: calc( 100vh - 110px );
  855. box-sizing: border-box;
  856. }
  857. .app-container-query {
  858. }
  859. .app-container-table-box {
  860. height: calc( 100% - var(--q-height) );
  861. .app-container-table-info {
  862. height: calc( 100% - 100px );
  863. }
  864. }
  865. .upload-box {
  866. ::v-deep .el-upload--picture-card {
  867. display: none;
  868. }
  869. }
  870. </style>