index.vue 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  1. <template>
  2. <div class="app-container app-container-scheduling" :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 v-if="queryShow.id" label="订单号">
  6. <el-input
  7. v-model="queryParams.id"
  8. placeholder="请输入订单号"
  9. clearable
  10. style="width: 240px;"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. <span @click="clearQuery('id')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  14. </el-form-item>
  15. <el-form-item v-if="queryShow.teamName" label="团队名称" label-width="100px">
  16. <el-input
  17. v-model="queryParams.teamName"
  18. placeholder="请输入团队名称"
  19. clearable
  20. style="width: 240px;"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. <span @click="clearQuery('teamName')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  24. </el-form-item>
  25. <el-form-item v-if="queryShow.salerPerson" label="销售员" label-width="100px">
  26. <el-input
  27. v-model="queryParams.salerPerson"
  28. placeholder="请输入销售员"
  29. clearable
  30. style="width: 240px;"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. <span @click="clearQuery('salerPerson')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  34. </el-form-item>
  35. <el-form-item v-if="queryShow.teamTypeId" label="团队类型">
  36. <el-select
  37. v-model="queryParams.teamTypeId"
  38. placeholder="请选择团队类型"
  39. clearable
  40. style="width: 240px"
  41. >
  42. <el-option
  43. v-for="dict in dict.type.team_type"
  44. :key="dict.value"
  45. :label="dict.label"
  46. :value="dict.value"
  47. />
  48. </el-select>
  49. <span @click="clearQuery('teamTypeId')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  50. </el-form-item>
  51. <el-form-item v-if="queryShow.ifSuccessInvoice" label="是否成功开票" label-width="100">
  52. <el-select
  53. v-model="queryParams.ifSuccessInvoice"
  54. placeholder="请选择是否成功开票"
  55. clearable
  56. style="width: 100%"
  57. >
  58. <el-option label="否" value="0" />
  59. <el-option label="是" value="1" />
  60. </el-select>
  61. <span @click="clearQuery('ifSuccessInvoice')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  62. </el-form-item>
  63. <el-form-item v-if="queryShow.status" label="订单状态">
  64. <el-select
  65. v-model="queryParams.status"
  66. placeholder="订单状态"
  67. clearable
  68. style="width: 100%"
  69. >
  70. <el-option
  71. v-for="dict in dict.type.order_status_type"
  72. :key="dict.value"
  73. :label="dict.label"
  74. :value="dict.value"
  75. />
  76. </el-select>
  77. <span @click="clearQuery('status')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  78. </el-form-item>
  79. <el-form-item v-if="queryShow.payWay" label="支付方式">
  80. <el-select
  81. v-model="queryParams.payWay"
  82. placeholder="支付方式"
  83. clearable
  84. style="width: 100%"
  85. >
  86. <el-option
  87. v-for="dict in dict.type.pay_way_type"
  88. :key="dict.value"
  89. :label="dict.label"
  90. :value="dict.value"
  91. />
  92. </el-select>
  93. <span @click="clearQuery('payWay')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  94. </el-form-item>
  95. <el-form-item v-if="queryShow.time" label="支付时间">
  96. <el-date-picker
  97. v-model="queryParams.time"
  98. type="daterange"
  99. value-format="yyyy-MM-dd"
  100. range-separator="至"
  101. start-placeholder="开始日期"
  102. end-placeholder="结束日期">
  103. </el-date-picker>
  104. <span @click="clearQuery('time')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  105. </el-form-item>
  106. <el-form-item v-if="queryShow.paymentId" label="支付单号">
  107. <el-input
  108. v-model="queryParams.paymentId"
  109. placeholder="请输入支付单号"
  110. clearable
  111. style="width: 240px;"
  112. @keyup.enter.native="handleQuery"
  113. />
  114. <span @click="clearQuery('paymentId')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  115. </el-form-item>
  116. <!-- <el-form-item label="场次时间">
  117. <el-date-picker
  118. style="width: 230px;"
  119. v-model="queryParams.performDate"
  120. @change="pagePerformTimeListFun"
  121. type="date"
  122. value-format="yyyy-MM-dd"
  123. placeholder="选择日期">
  124. </el-date-picker>
  125. </el-form-item> -->
  126. <el-form-item v-if="queryShow.performDate" label="场次时间" label-width="70px">
  127. <el-date-picker
  128. style="width: 250px;"
  129. v-model="queryParams.performDate"
  130. @change="pagePerformTimeListFun"
  131. type="daterange"
  132. value-format="yyyy-MM-dd"
  133. range-separator="至"
  134. start-placeholder="开始日期"
  135. end-placeholder="结束日期">
  136. </el-date-picker>
  137. <span @click="clearQuery('performDate')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  138. </el-form-item>
  139. <el-form-item label="场次" v-if="!multiPerformDate && queryShow.performDate">
  140. <el-select
  141. v-model="queryParams.performTimeId"
  142. placeholder="场次"
  143. clearable
  144. style="width: 100%"
  145. >
  146. <el-option
  147. v-for="dict in pagePerformTimeList"
  148. :key="dict.id"
  149. :label="dict.timeSnapshot+'('+dict.performTimeStart+'-'+dict.performTimeEnd+')'"
  150. :value="dict.id"
  151. />
  152. </el-select>
  153. <span @click="clearQuery('performDate')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  154. </el-form-item>
  155. <el-form-item v-if="queryShow.invoiceTime" label="开票时间">
  156. <el-date-picker
  157. style="width: 230px;"
  158. v-model="queryParams.invoiceTime"
  159. type="daterange"
  160. value-format="yyyy-MM-dd"
  161. range-separator="至"
  162. start-placeholder="开始日期"
  163. end-placeholder="结束日期">
  164. </el-date-picker>
  165. <span @click="clearQuery('invoiceTime')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  166. </el-form-item>
  167. <el-form-item v-if="queryShow.refundPaymentId" label="商户退款单号" label-width="100px">
  168. <el-input
  169. v-model="queryParams.refundPaymentId"
  170. placeholder="请输入商户退款单号"
  171. clearable
  172. style="width: 240px;"
  173. @keyup.enter.native="handleQuery"
  174. />
  175. <span @click="clearQuery('refundPaymentId')" class="query_clear"><i class="el-icon-circle-close"></i></span>
  176. </el-form-item>
  177. <el-form-item>
  178. <el-dropdown @command="openQuery">
  179. <el-button size="mini" type="primary" icon="el-icon-plus"></el-button>
  180. <el-dropdown-menu slot="dropdown">
  181. <el-dropdown-item command="id">订单号</el-dropdown-item>
  182. <el-dropdown-item command="teamName">团队名称</el-dropdown-item>
  183. <el-dropdown-item command="salerPerson">销售员</el-dropdown-item>
  184. <el-dropdown-item command="teamTypeId">团队类型</el-dropdown-item>
  185. <el-dropdown-item command="ifSuccessInvoice">是否成功开票</el-dropdown-item>
  186. <el-dropdown-item command="status">订单状态</el-dropdown-item>
  187. <el-dropdown-item command="payWay">支付方式</el-dropdown-item>
  188. <el-dropdown-item command="time">支付时间</el-dropdown-item>
  189. <el-dropdown-item command="paymentId">支付单号</el-dropdown-item>
  190. <el-dropdown-item command="performDate">场次时间/场次</el-dropdown-item>
  191. <el-dropdown-item command="invoiceTime">开票时间</el-dropdown-item>
  192. <el-dropdown-item command="refundPaymentId">商户退款单号</el-dropdown-item>
  193. </el-dropdown-menu>
  194. </el-dropdown>
  195. <el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  196. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  197. </el-form-item>
  198. </el-form>
  199. </div>
  200. <div class="app-container-table-box">
  201. <el-row :gutter="10" class="mb8">
  202. <el-button
  203. type="primary"
  204. size="mini"
  205. icon="el-icon-download"
  206. v-hasPermi="['groupBuyingMr:groupBuyingMr:excel']"
  207. @click="handleExport"
  208. v-loading.fullscreen.lock="handleExportLoading"
  209. element-loading-text="正在拼命生成数据中..."
  210. element-loading-spinner="el-icon-loading"
  211. element-loading-background="rgba(0, 0, 0, 0.5)"
  212. >导出excel</el-button>
  213. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  214. </el-row>
  215. <div class="app-container-table-info">
  216. <el-table ref="tables" v-loading="loading" height="100%" :data="dataList" border>
  217. <el-table-column label="序号" align="center" :fixed="fixed" type="index" width="60"></el-table-column>
  218. <el-table-column label="订单号" align="center" :fixed="fixed" prop="id" />
  219. <el-table-column label="团队名称" align="center" :fixed="fixed" prop="teamName" />
  220. <el-table-column label="团队类型" align="center" :fixed="fixed" prop="type">
  221. <template slot-scope="scope">
  222. <dict-tag :options="dict.type.team_type" :value="scope.row.teamType"/>
  223. </template>
  224. </el-table-column>
  225. <el-table-column label="联系电话" align="center" prop="teamMobile" />
  226. <el-table-column label="客户负责人" align="center" prop="teamContact" />
  227. <el-table-column label="销售员" align="center" prop="salerPerson" />
  228. <el-table-column label="剧目名称" align="center" prop="performName" />
  229. <el-table-column label="票务名称" align="center" prop="goodsName" />
  230. <el-table-column label="座位类型" align="center" prop="seatTypeName" />
  231. <el-table-column label="场次时间" align="center" prop="performDate" />
  232. <el-table-column label="场次" width="120" align="center" prop="timeSnapshot">
  233. <template slot-scope="scope">
  234. <span>{{ scope.row.timeSnapshot }} <br /> ({{ scope.row.performTimeStart + '-' + scope.row.performTimeEnd }})</span>
  235. </template>
  236. </el-table-column>
  237. <el-table-column label="团购数量" align="center" prop="quantity" />
  238. <!-- <el-table-column label="支付总额" align="center" prop="orderPrice">
  239. <template slot-scope="scope">
  240. <span>¥{{ scope.row.orderPrice }}</span>
  241. </template>
  242. </el-table-column> -->
  243. <el-table-column label="应收金额" align="center" prop="orderPrice">
  244. <template slot-scope="scope">
  245. <span>¥{{ scope.row.orderPrice }}</span>
  246. </template>
  247. </el-table-column>
  248. <el-table-column label="实收金额" align="center" prop="realPrice">
  249. <template slot-scope="scope">
  250. <span>¥{{ scope.row.realPrice }}</span>
  251. </template>
  252. </el-table-column>
  253. <el-table-column label="支付方式" align="center" prop="type">
  254. <template slot-scope="scope">
  255. <dict-tag :options="dict.type.pay_way_type" :value="scope.row.payWay"/>
  256. </template>
  257. </el-table-column>
  258. <el-table-column label="支付时间" align="center" prop="payTime" width="160" >
  259. <template slot-scope="scope">
  260. <span>{{ parseTime(scope.row.payTime) }}</span>
  261. </template>
  262. </el-table-column>
  263. <el-table-column label="支付单号" align="center" prop="paymentId" />
  264. <el-table-column label="订单状态" align="center" prop="status">
  265. <template slot-scope="scope">
  266. <dict-tag :options="dict.type.order_status_type" :value="scope.row.status"/>
  267. </template>
  268. </el-table-column>
  269. <el-table-column label="商户退款单号" align="center" prop="refundPaymentId" />
  270. <el-table-column label="已核销票数" align="center" prop="usedTotal">
  271. <template slot-scope="scope">
  272. <span>{{ scope.row.usedTotal }}</span>
  273. </template>
  274. </el-table-column>
  275. <el-table-column label="已核销金额" align="center" prop="usedPriceTotal">
  276. <template slot-scope="scope">
  277. <span>{{ scope.row.usedPriceTotal }}</span>
  278. </template>
  279. </el-table-column>
  280. <el-table-column label="退票数量" align="center" prop="refundTotal">
  281. <template slot-scope="scope">
  282. <span>{{ scope.row.refundTotal }}</span>
  283. </template>
  284. </el-table-column>
  285. <el-table-column label="退票金额" align="center" prop="refundPriceTotal">
  286. <template slot-scope="scope">
  287. <span>{{ scope.row.refundPriceTotal && scope.row.refundPriceTotal !=0 ?('-' + scope.row.refundPriceTotal) : '' }}</span>
  288. </template>
  289. </el-table-column>
  290. <el-table-column label="是否成功开票" align="center">
  291. <template slot-scope="scope">
  292. <el-tag type="danger" v-if="scope.row.ifSuccessInvoice == '0'">否</el-tag>
  293. <el-tag type="success" v-else-if="scope.row.ifSuccessInvoice == '1'">是</el-tag>
  294. </template>
  295. </el-table-column>
  296. <el-table-column label="开票时间" align="center" prop="invoiceTime">
  297. <template slot-scope="scope">
  298. <span>{{ scope.row.invoiceTime }}</span>
  299. </template>
  300. </el-table-column>
  301. <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
  302. <template slot-scope="scope">
  303. <el-button
  304. size="mini"
  305. type="text"
  306. @click="openDetails(scope.row)"
  307. v-hasPermi="['groupBuyingMr:groupBuyingMr:details']"
  308. >详情</el-button>
  309. <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
  310. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  311. <el-dropdown-menu slot="dropdown">
  312. <el-dropdown-item
  313. command="1"
  314. v-if="hasPermi('groupBuyingMr:groupBuyingMr:duigong') && (scope.row.payWay == 'corporate'||scope.row.status === 0)">对公转账</el-dropdown-item>
  315. <el-dropdown-item
  316. command="2"
  317. v-if="hasPermi('groupBuyingMr:groupBuyingMr:cancel') && scope.row.status == 0">关闭订单</el-dropdown-item>
  318. <el-dropdown-item
  319. command="3"
  320. v-if="hasPermi('groupBuyingMr:groupBuyingMr:print') && (scope.row.status == 3 || scope.row.status == 7)">打印小票</el-dropdown-item>
  321. <el-dropdown-item
  322. command="4"
  323. v-if="hasPermi('groupBuyingMr:groupBuyingMr:reset') && scope.row.status == 0">修改订单</el-dropdown-item>
  324. <el-dropdown-item
  325. command="5"
  326. >代客下单</el-dropdown-item>
  327. </el-dropdown-menu>
  328. </el-dropdown>
  329. </template>
  330. </el-table-column>
  331. </el-table>
  332. <pagination
  333. v-show="total>0"
  334. :total="total"
  335. :page.sync="queryParams.pageNum"
  336. :limit.sync="queryParams.pageSize"
  337. @pagination="getList"
  338. />
  339. </div>
  340. </div>
  341. <!-- 详情 -->
  342. <details-dia ref="detailsDia" :dict="dict" @getList="getList"></details-dia>
  343. <!-- 重新生成订单 -->
  344. <resetOrder ref="resetOrder" :dict="dict" @getList="getList" />
  345. <el-dialog
  346. title="选择小票机"
  347. :visible.sync="dialogVisible"
  348. width="30%"
  349. :before-close="handleClose">
  350. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  351. <el-form-item label="小票机" prop="region">
  352. <el-select v-model="ruleForm.region" placeholder="选择小票机">
  353. <el-option :label="item.deviceName" :key="item.id" :value="item.id" v-for="(item,index) in printList"></el-option>
  354. </el-select>
  355. </el-form-item>
  356. </el-form>
  357. <span slot="footer" class="dialog-footer">
  358. <el-button @click="dialogVisible = false">取 消</el-button>
  359. <el-button type="primary" :loading="dialogVisibleLoading" @click="print(viewerList)">{{ dialogVisibleLoading?'打印中...':'打印' }}</el-button>
  360. </span>
  361. </el-dialog>
  362. <el-dialog
  363. title="对公信息凭证"
  364. :visible.sync="showCorporatePay"
  365. width="50%"
  366. @close="handleCorporatePayClose"
  367. :before-close="handleCorporatePayClose">
  368. <el-form v-loading="corporatePayLoading" :model="form" :rules="corporatePayRules" ref="ruleForm1" label-width="120px" class="demo-ruleForm">
  369. <el-form-item v-if="!form.eaitType" label="类型" prop="payOrCredit">
  370. <el-radio-group v-model="form.payOrCredit">
  371. <el-radio :label="1">对公支付</el-radio>
  372. <el-radio :label="2">挂账</el-radio>
  373. </el-radio-group>
  374. </el-form-item>
  375. <el-form-item v-if="form.eaitType" label="类型" prop="payOrCredit">
  376. <span>{{ form.payOrCredit == 1 ? '对公支付':'挂账' }}</span>
  377. </el-form-item>
  378. <!-- <el-form-item label="凭证上传" prop="photoList" required>
  379. <el-upload
  380. ref="upload"
  381. :class="form.photoList && form.photoList.length>=15 ? 'upload-box':''"
  382. :action="uploadObj.url"
  383. :headers="uploadObj.headers"
  384. accept=".jpg,.png"
  385. :on-success="handlePhotoListSuccess"
  386. :before-upload="beforeAvatarUpload"
  387. list-type="picture-card"
  388. :file-list="form.photoList"
  389. :on-remove="handleRemove"
  390. :limit="15"
  391. >
  392. <i class="el-icon-plus"></i>
  393. </el-upload>
  394. </el-form-item> -->
  395. <el-form-item v-if="form.payOrCredit == 2" label="账期" prop="rePaymentTime">
  396. <el-date-picker
  397. v-model="form.rePaymentTime"
  398. type="date"
  399. value-format="yyyy-MM-dd"
  400. placeholder="选择日期">
  401. </el-date-picker>
  402. </el-form-item>
  403. <el-form-item :label="form.payOrCredit != 2?'凭证上传':'挂账类型凭证'" prop="photoList">
  404. <div style="display: flex;flex-wrap: wrap;">
  405. <div
  406. v-for="(item,index) in form.photoList"
  407. :key="index"
  408. style="width: 100px; height: 100px;margin-top: 5px; position: relative;border: 1px solid #999;border-radius: 5px;margin-right: 20px;">
  409. <el-image
  410. style="width: 100%; height: 100%"
  411. :src="item"
  412. :preview-src-list="form.photoList">
  413. </el-image>
  414. <span @click="handleRemove(index)" style="position: absolute;top: -15px;right: -15px;color: red;font-size: 24px;z-index: 999;cursor: pointer;">
  415. <i class="el-icon-error"></i>
  416. </span>
  417. </div>
  418. <div
  419. style="width: 100px; height: 100px;margin-top: 5px;"
  420. v-if="!form.photoList||form.photoList.length<15"
  421. v-loading="actionUrlLoading"
  422. element-loading-text="上传中..."
  423. element-loading-spinner="el-icon-loading"
  424. element-loading-background="rgba(0, 0, 0, 0.8)"
  425. >
  426. <el-upload
  427. class="avatar-uploader"
  428. :action="uploadObj.url"
  429. :headers="uploadObj.headers"
  430. :show-file-list="false"
  431. :before-upload="beforeAvatarUpload"
  432. :on-success="handleAvatarSuccess"
  433. :on-progress="handleAvatarProgress"
  434. :disabled="actionUrlLoading"
  435. :on-error="handleAvatarError"
  436. >
  437. <i class="el-icon-plus avatar-uploader-icon"></i>
  438. </el-upload>
  439. </div>
  440. </div>
  441. </el-form-item>
  442. <el-form-item label="备注">
  443. <el-input placeholder="请备注" type="textarea" maxlength="300" show-word-limit v-model="form.corporate.remark"></el-input>
  444. </el-form-item>
  445. </el-form>
  446. <span slot="footer" class="dialog-footer">
  447. <el-button @click="showCorporatePay = false">取 消</el-button>
  448. <el-button type="primary" :loading="corporatePayLoading" @click="corporatePay">{{ dialogVisibleLoading?'操作中...':'确定' }}</el-button>
  449. </span>
  450. </el-dialog>
  451. </div>
  452. </template>
  453. <script>
  454. import { getToken } from "@/utils/auth";
  455. import auth from '@/plugins/auth'
  456. import {
  457. pageList,
  458. gotoCorporatePay,
  459. downOrderListXls,
  460. teamPayOrderUrlApi
  461. } from '@/api/order/groupBuyingMr';
  462. import { orderInfoCancel } from '@/api/windowTicketSales/ticketingSales';
  463. import detailsDia from "./dialog/details.vue";
  464. import resetOrder from "./dialog/resetOrder.vue";
  465. import { printApi } from '@/api/order/orderMr'
  466. import { getSelectById } from '@/api/order/groupBuyingMr'
  467. import { pageList as getPrintListApi } from "@/api/device/pda";
  468. import { pagePerformTimeList } from "@/api/schedulingMr/schedulingMr"
  469. import { exportExcel } from '@/utils/exportexcel'
  470. import moment from "moment"
  471. const https = require('https');
  472. const axios = require('axios');
  473. export default {
  474. name: "GroupBuyingMr",
  475. dicts: ['agreement_type', 'team_type','order_status_type','pay_way_type'],
  476. components: { detailsDia, resetOrder },
  477. data() {
  478. return {
  479. qHeight: '0px',
  480. resizeObserver: null,
  481. // 遮罩层
  482. loading: true,
  483. // 选中数组
  484. ids: [],
  485. // 非单个禁用
  486. single: true,
  487. // 非多个禁用
  488. multiple: true,
  489. // 显示搜索条件
  490. showSearch: true,
  491. // 总条数
  492. total: 0,
  493. // 用户表格数据
  494. dataList: null,
  495. // 弹出层标题
  496. title: "",
  497. // 是否显示弹出层
  498. open: false,
  499. // 日期范围
  500. dateRange: [],
  501. // 查询参数
  502. queryParams: {
  503. pageNum: 1,
  504. pageSize: 10,
  505. },
  506. visibleStatus: false,
  507. newObj: {},
  508. visibleType: '',
  509. viewerList: [],
  510. printList: [],
  511. dialogVisible: false,
  512. ruleForm: {},
  513. rules: {
  514. region: [
  515. { required: true, message: '请选择打印机', trigger: ['change','blur' ]}
  516. ],
  517. },
  518. dialogVisibleLoading: false,
  519. showCorporatePay:false,
  520. form:{
  521. payOrCredit: '',
  522. orderId:'',
  523. photoList:[],
  524. corporate:{
  525. voucherUrl:'',
  526. remark:'',
  527. }
  528. },
  529. corporatePayRules: {
  530. payOrCredit: [{ required: true, message: "选择类型", trigger: ["change","blur"] }],
  531. rePaymentTime: [{ required: true, message: "选择日期", trigger: ["change","blur"] }],
  532. photoList: [{ required: true, message: "请上传凭证", trigger: ["change","blur"] }],
  533. },
  534. uploadObj: {
  535. url: process.env.VUE_APP_UPLOAD_FILE_API + "/upload/single/minio",
  536. Headers: { Authorization: "Bearer " + getToken() },
  537. },
  538. corporatePayLoading:false,
  539. handleExportLoading: false,
  540. pagePerformTimeList: [], // 场次列表
  541. multiPerformDate:false,
  542. fixed: 'left',
  543. actionUrlLoading: false,
  544. queryShow: {
  545. id: true,
  546. teamName: true,
  547. salerPerson: false,
  548. teamTypeId: false,
  549. ifSuccessInvoice: false,
  550. payWay: false,
  551. status: false,
  552. time: false,
  553. paymentId: false,
  554. performDate: true,
  555. invoiceTime: false,
  556. refundPaymentId: false,
  557. },
  558. };
  559. },
  560. created() {
  561. this.$set(this.queryParams,'performDate',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")])
  562. this.pagePerformTimeListFun(this.queryParams.performDate)
  563. this.getList();
  564. },
  565. activated(){
  566. this.getList();
  567. },
  568. mounted() {
  569. this.resizeObserver = new ResizeObserver(entries => {
  570. for (let entry of entries) {
  571. const { width, height } = entry.contentRect;
  572. this.qHeight = height + 'px'
  573. }
  574. if(document.body.clientWidth<765) {
  575. this.fixed = false
  576. }else {
  577. this.fixed = 'left'
  578. }
  579. });
  580. this.resizeObserver.observe(this.$refs.queryFormBox);
  581. },
  582. methods: {
  583. moment,
  584. hasPermi(value){
  585. return auth.hasPermi(value)
  586. },
  587. /** 查询列表 */
  588. getList() {
  589. this.loading = true;
  590. let params = {...this.addDateRange(this.queryParams, this.dateRange)};
  591. if(params.id && params.id.length>19) {
  592. this.$message({
  593. type: 'error',
  594. message: '订单号不存在!!!'
  595. });
  596. this.loading = false
  597. return
  598. }
  599. if(params.performDate&&params.performDate.length==2){
  600. params.performDateStart = params.performDate[0];
  601. params.performDateEnd = params.performDate[1];
  602. }else {
  603. params.performDateStart = null
  604. params.performDateEnd =null
  605. }
  606. delete params.performDate;
  607. pageList(params)
  608. .then(response => {
  609. this.dataList = response.data.rows;
  610. this.total = response.data.total;
  611. this.loading = false;
  612. }).catch(()=>{
  613. this.dataList = [];
  614. this.total = 0;
  615. this.loading = false;
  616. })
  617. },
  618. // 取消按钮
  619. cancel() {
  620. this.open = false;
  621. },
  622. /** 搜索按钮操作 */
  623. handleQuery() {
  624. this.queryParams.pageNum = 1;
  625. if(this.queryParams.time){
  626. this.queryParams.beginTime = this.queryParams.time[0];
  627. this.queryParams.endTime = this.queryParams.time[1];
  628. }else{
  629. this.queryParams.beginTime = null
  630. this.queryParams.endTime = null
  631. }
  632. if(this.queryParams.invoiceTime&&this.queryParams.invoiceTime.length==2){
  633. this.queryParams.invoiceBeginTime =this.queryParams.invoiceTime[0];
  634. this.queryParams.invoiceEndTime =this.queryParams.invoiceTime[1];
  635. }else {
  636. this.queryParams.invoiceBeginTime = null
  637. this.queryParams.invoiceEndTime = null
  638. }
  639. this.getList();
  640. },
  641. /** 重置按钮操作 */
  642. resetQuery() {
  643. this.dateRange = [];
  644. this.$set(this.queryParams, 'paymentId', '');
  645. this.$set(this.queryParams, 'id', '');
  646. this.$set(this.queryParams, 'status', '');
  647. this.$set(this.queryParams, 'teamTypeId', '');
  648. this.$set(this.queryParams, 'teamName', '');
  649. this.$set(this.queryParams, 'performName', '');
  650. this.$set(this.queryParams, 'beginTime', '');
  651. this.$set(this.queryParams, 'endTime', '');
  652. this.$set(this.queryParams, 'time', '');
  653. this.$set(this.queryParams, 'performDate', '');
  654. this.$set(this.queryParams, 'performTimeId', '');
  655. this.$set(this.queryParams, 'payWay', '');
  656. this.$set(this.queryParams, 'invoiceTime', '');
  657. this.$set(this.queryParams, 'salerPerson', '');
  658. this.$set(this.queryParams, 'refundPaymentId', '');
  659. this.queryParams.pageNum = 1;
  660. this.handleQuery();
  661. },
  662. /** 详情按钮操作 */
  663. openDetails(row, type) {
  664. this.$refs["detailsDia"].openDialog("详情", row, type);
  665. },
  666. /** 修改订单按钮操作 */
  667. handleResetOpen(row, type) {
  668. /** 关闭订单 */
  669. this.$confirm("原订单以及原订单中已选择的座位将会被一并取消,确认要修改吗?", '修改订单提示', {
  670. confirmButtonText: '确定',
  671. cancelButtonText: '取消',
  672. type: 'warning'
  673. }).then(() => {
  674. orderInfoCancel({ orderId: row.id}).then((res) => {
  675. if (res.code == 200) {
  676. this.$message({
  677. type: 'success',
  678. message: '操作成功!'
  679. });
  680. this.$refs["resetOrder"].openDialog("重新生成订单", row, type);
  681. }else{
  682. this.$message({
  683. type: 'error',
  684. message: '取消失败!!!'
  685. });
  686. }
  687. });
  688. }).catch(() => {});
  689. //this.$refs["resetOrder"].openDialog("重新生成订单", row, type);
  690. },
  691. handleOpen(list=[]){
  692. if(!list||list.length==0) return
  693. let idList = []
  694. list.forEach((item,index)=>{
  695. idList.push(item.id)
  696. })
  697. this.viewerList = idList
  698. this.getPrintListApi()
  699. this.$set(this.ruleForm, 'region', '');
  700. this.$nextTick(()=>{
  701. this.$refs.ruleForm.clearValidate('region')
  702. })
  703. this.dialogVisible = true
  704. },
  705. handleClose(){
  706. this.dialogVisible = false
  707. },
  708. /** 查询打印机列表 */
  709. getPrintListApi() {
  710. getPrintListApi({deviceType:5,pageNum: 1,
  711. pageSize: 999,})
  712. .then(response => {
  713. this.printList = response.data.rows;
  714. }
  715. );
  716. },
  717. /** 选择打印机 */
  718. selectPrint(){
  719. },
  720. // 打印
  721. async print(list = []){
  722. this.$refs.ruleForm.validate(async (valid) => {
  723. if (valid) {
  724. this.dialogVisibleLoading = true
  725. try {
  726. let res = await printApi({
  727. //viewerList:list,
  728. orderId: list[0],
  729. source: 2,
  730. deviceId: this.ruleForm.region
  731. })
  732. if(res.code == 200) {
  733. let url = res.data.linkIp
  734. let printInfo = res.data.printInfo
  735. this.connectPrint(url,printInfo)
  736. }else {
  737. throw new Error(res)
  738. }
  739. } catch (error) {
  740. this.dialogVisible = false
  741. this.dialogVisibleLoading = false
  742. console.error("error=====",error)
  743. }
  744. } else {
  745. console.log('error submit!!');
  746. return false;
  747. }
  748. });
  749. },
  750. /** 连接打印机 */
  751. connectPrint(url,data){
  752. // let xhr = new XMLHttpRequest();
  753. // xhr.onreadystatechange = ()=>{
  754. // if(xhr.readyState == 4){ // 监听请求完成
  755. // if((xhr.status >=200 && xhr.status <300) || xhr.status == 304){
  756. // console.log(xhr.responseText)
  757. // this.dialogVisible = false
  758. // this.dialogVisibleLoading = false
  759. // }else{
  760. // console.log('请求失败')
  761. // this.dialogVisible = false
  762. // this.dialogVisibleLoading = false
  763. // }
  764. // }
  765. // }
  766. // xhr.open("post", url, true); // 异步请求
  767. // xhr.send(JSON.stringify(data));
  768. const ignoreSSL = axios.create({
  769. httpsAgent: new https.Agent({
  770. rejectUnauthorized: false
  771. }),
  772. withCredentials: true, // 跨域请求时发送Cookie
  773. timeout: 60000, // 请求超时
  774. headers: {
  775. "Content-Type": "application/json; charset=UTF-8;"
  776. }
  777. });
  778. ignoreSSL.post(url,
  779. { ...data }
  780. ).then(()=>{
  781. this.dialogVisible = false
  782. this.dialogVisibleLoading = false
  783. }).catch(()=>{
  784. this.dialogVisible = false
  785. this.dialogVisibleLoading = false
  786. })
  787. },
  788. async handleCorporatePay(row){
  789. this.actionUrlLoading = false
  790. console.log('corporatePay',row);
  791. this.showCorporatePay = true;
  792. this.corporatePayLoading = true;
  793. let res = await getSelectById(row.id)
  794. this.form.orderId = row.id;
  795. this.$set(this.form,'photoList',[])
  796. this.form.eaitType = null
  797. if(res.data.corporate && JSON.stringify(res.data.corporate) != '{}'){
  798. let urlList = res.data.corporate.voucherUrl.split(',')||[]
  799. this.form.eaitType = 1
  800. this.$set(this.form,'payOrCredit',1)
  801. this.$set(this.form,'rePaymentTime','')
  802. this.$set(this.form,'photoList',urlList)
  803. this.$set(this.form.corporate,'remark',res.data.corporate.remark)
  804. }else if(res.data.teamCredit && JSON.stringify(res.data.teamCredit) != '{}'){
  805. this.form.eaitType = 2
  806. let urlList = res.data.teamCredit.voucherUrl.split(',')||[]
  807. this.$set(this.form,'payOrCredit',2)
  808. this.$set(this.form,'rePaymentTime',res.data.teamCredit.repaymentTime)
  809. this.$set(this.form,'photoList',urlList)
  810. this.$set(this.form.corporate,'remark',res.data.teamCredit.remark)
  811. }else {
  812. this.$set(this.form,'payOrCredit','')
  813. this.$set(this.form,'rePaymentTime','')
  814. this.$set(this.form,'photoList',[])
  815. this.$set(this.form.corporate,'remark','')
  816. }
  817. this.$nextTick(()=>{
  818. this.$refs.ruleForm1.clearValidate()
  819. })
  820. this.corporatePayLoading = false;
  821. },
  822. handleCorporatePayClose(){
  823. this.$set(this.form,'photoList',[])
  824. console.log('1111');
  825. this.corporatePayLoading = false;
  826. this.showCorporatePay = false;
  827. },
  828. corporatePay(){
  829. console.log('form',this.form);
  830. this.$refs['ruleForm1'].validate((valid) => {
  831. if (valid) {
  832. if(this.form.photoList.length<1){
  833. this.$message.error('请上传凭证');
  834. return
  835. }
  836. this.corporatePayLoading = true;
  837. const voucherUrl = this.form.photoList.map(item => item).join(",");
  838. this.form.corporate.voucherUrl = voucherUrl;
  839. gotoCorporatePay(this.form).then((res)=>{
  840. this.$message.success(res.msg);
  841. this.corporatePayLoading = false;
  842. this.handleCorporatePayClose();
  843. }).catch((err)=>{
  844. this.corporatePayLoading = false;
  845. this.$message.error(err.msg);
  846. console.log('corporatePay err',err);
  847. })
  848. } else {
  849. console.log('error submit!!');
  850. return false;
  851. }
  852. });
  853. },
  854. /**
  855. * 剧目海报上传成功
  856. * @date 2023-11-22
  857. * @param {any} res
  858. * @returns {any}
  859. */
  860. handlePhotoListSuccess(res) {
  861. if (res.code === 200) {
  862. let photo = {
  863. imageUrl: res?.data?.url,
  864. url: res?.data?.url,
  865. photoType: '2'
  866. }
  867. if(!this.form.photoList){
  868. this.form.photoList = []
  869. }
  870. // this.form.photoList.push(photo);
  871. this.$set(this.form.photoList, this.form.photoList.length, photo);
  872. }
  873. },
  874. // handleRemove(file, fileList) {
  875. // this.form.photoList.forEach((item, index) => {
  876. // if(item.uid == file.uid){
  877. // this.form.photoList.splice(index, 1)
  878. // }
  879. // })
  880. // },
  881. /**
  882. * 上传文件之前之前
  883. * @date 2023-11-22
  884. * @param {any} file
  885. * @returns {any}
  886. */
  887. // beforeAvatarUpload(file) {
  888. // const isJPG = file.type === "image/jpeg" || "image/png";
  889. // if (!isJPG) {
  890. // this.$message.error("上传头像图片只能是jpg或png格式!");
  891. // }
  892. // return isJPG;
  893. // },
  894. /**
  895. * 导出报表
  896. * @date 2022-10-24
  897. * @returns {any}
  898. */
  899. handleExport() {
  900. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  901. confirmButtonText: '确定 ',
  902. cancelButtonText: '取消 ',
  903. type: 'warning'
  904. })
  905. .then(() => {
  906. this.handleExportLoading = true;
  907. // const { pageNum, pageSize} = this.params;
  908. let postMap = {}
  909. if(this.queryParams.time){
  910. this.queryParams.beginTime = this.queryParams.time[0];
  911. this.queryParams.endTime = this.queryParams.time[1];
  912. }else{
  913. this.queryParams.beginTime = null
  914. this.queryParams.endTime = null
  915. }
  916. if(this.queryParams.performDate&&this.queryParams.performDate.length==2){
  917. this.queryParams.performDateStart = this.queryParams.performDate[0];
  918. this.queryParams.performDateEnd = this.queryParams.performDate[1];
  919. }else {
  920. this.queryParams.performDateStart = null
  921. this.queryParams.performDateEnd =null
  922. }
  923. if(this.queryParams.invoiceTime&&this.queryParams.invoiceTime.length==2){
  924. this.queryParams.invoiceBeginTime =this.queryParams.invoiceTime[0];
  925. this.queryParams.invoiceEndTime =this.queryParams.invoiceTime[1];
  926. }else {
  927. this.queryParams.invoiceBeginTime = null
  928. this.queryParams.invoiceEndTime = null
  929. }
  930. let params = JSON.parse(JSON.stringify(this.queryParams))
  931. for (let key in params) {
  932. if(key != 'pageNum' && key != 'pageSize' && key != 'time' && key != 'performDate' && key != 'invoiceTime'){
  933. postMap[key] = params[key]
  934. }
  935. }
  936. downOrderListXls(postMap)
  937. .then((res) => {
  938. exportExcel(res, '团购订单', '.xlsx');
  939. this.handleExportLoading = false;
  940. })
  941. .catch((error) => {
  942. console.log("error===",error)
  943. this.handleExportLoading = false;
  944. });
  945. })
  946. .catch(() => {
  947. this.$message.info('您已取消导出!');
  948. });
  949. },
  950. async pagePerformTimeListFun(value) {
  951. try {
  952. this.pagePerformTimeList = []
  953. this.$set(this.queryParams,'performTimeId',null)
  954. if(!value){
  955. return
  956. }
  957. if(value.length==2&&value[0]==value[1]){
  958. this.multiPerformDate = false
  959. }else{
  960. this.multiPerformDate = true
  961. return
  962. }
  963. let { data,code } = await pagePerformTimeList({
  964. performDate: value[0],
  965. pageNum: 1,
  966. pageSize: 999
  967. })
  968. this.pagePerformTimeList = [].concat(data.rows)
  969. } catch (error) {
  970. }
  971. },
  972. /** 关闭订单 */
  973. handleCancelOrder(row) {
  974. this.$confirm("是否关闭" + row.id + "的订单?", '提示', {
  975. confirmButtonText: '确定',
  976. cancelButtonText: '取消',
  977. type: 'warning'
  978. }).then(() => {
  979. orderInfoCancel({ orderId: row.id}).then((res) => {
  980. if (res.code == 200) {
  981. this.$message({
  982. type: 'success',
  983. message: '操作成功!'
  984. });
  985. this.getList();
  986. }
  987. });
  988. }).catch(() => {});
  989. },
  990. /** 上传图片 单张 */
  991. handleAvatarSuccess(response, file, fileList) {
  992. console.log("res, file",response, file, fileList)
  993. this.actionUrlLoading = false
  994. if(response.code == 200) {
  995. this.form.photoList.push(response.data.url)
  996. }
  997. this.$refs.ruleForm1.validateField('photoList')
  998. },
  999. beforeAvatarUpload(file) {
  1000. const isLt2M = file.size / 1024 / 1024 <= 100;
  1001. let testmsg = file.name.substring(file.name.lastIndexOf('.')+1)
  1002. let typeList = ['png','jepg','jpg','gif']
  1003. const isJPG = typeList.includes(testmsg);
  1004. if (!isJPG) {
  1005. this.$message.error(`上传图片图片只能是 ${typeList} 格式!`);
  1006. }
  1007. if (!isLt2M) {
  1008. this.$message.error('上传图片图片大小不能超过 100MB!');
  1009. }
  1010. return isJPG && isLt2M;
  1011. },
  1012. handleAvatarProgress(){
  1013. this.actionUrlLoading = true
  1014. },
  1015. handleAvatarError() {
  1016. this.actionUrlLoading = false
  1017. },
  1018. handleRemove(index) {
  1019. this.form.photoList.splice(index,1)
  1020. this.$refs.ruleForm1.validateField('photoList')
  1021. },
  1022. /** 代课下单 */
  1023. handPlaceAnOrder(row) {
  1024. /** 关闭订单 */
  1025. this.$confirm("确认要生成该订单的支付链接吗?温馨提示:请勿随意将链接发送给陌生人", '提示', {
  1026. confirmButtonText: '生成并复制链接',
  1027. cancelButtonText: '取消',
  1028. type: 'warning'
  1029. }).then(() => {
  1030. teamPayOrderUrlApi({ orderId: row.id }).then((res) => {
  1031. if (res.code == 200) {
  1032. this.$message({
  1033. type: 'success',
  1034. message: res.msg
  1035. });
  1036. this.copyToClipboard(res.data.url)
  1037. }
  1038. });
  1039. }).catch(() => { });
  1040. },
  1041. /** 复制内容 */
  1042. copyToClipboard(text) {
  1043. // 创建一个临时的textarea元素
  1044. const tempInput = document.createElement('textarea');
  1045. tempInput.value = text;
  1046. document.body.appendChild(tempInput);
  1047. tempInput.select();
  1048. document.execCommand('copy');
  1049. document.body.removeChild(tempInput);
  1050. },
  1051. // 更多操作触发
  1052. handleCommand(command, row) {
  1053. switch (command) {
  1054. case "1":
  1055. this.handleCorporatePay(row);
  1056. break;
  1057. case "2":
  1058. this.handleCancelOrder(row);
  1059. break;
  1060. case "3":
  1061. this.handleOpen(row);
  1062. break;
  1063. case "4":
  1064. this.handleResetOpen(row);
  1065. break;
  1066. case "5":
  1067. this.handPlaceAnOrder(row);
  1068. break;
  1069. default:
  1070. break;
  1071. }
  1072. },
  1073. clearQuery(key) {
  1074. this.$set(this.queryShow,key,false)
  1075. this.$set(this.queryParams,key,'')
  1076. if(key == 'performDate') {
  1077. this.$set(this.queryParams,'performTimeId','')
  1078. }
  1079. },
  1080. openQuery(key) {
  1081. this.$set(this.queryShow,key,true)
  1082. }
  1083. },
  1084. beforeDestroy() {
  1085. this.resizeObserver.unobserve(this.$refs.queryFormBox);
  1086. this.resizeObserver.disconnect();
  1087. },
  1088. };
  1089. </script>
  1090. <style lang="scss" scoped>
  1091. .upload-btn {
  1092. width: 100px;
  1093. height: 100px;
  1094. background-color: #fbfdff;
  1095. border: dashed 1px #c0ccda;
  1096. border-radius: 5px;
  1097. i {
  1098. font-size: 30px;
  1099. margin-top: 20px;
  1100. }
  1101. &-text {
  1102. margin-top: -10px;
  1103. }
  1104. }
  1105. .avatar {
  1106. cursor: pointer;
  1107. }
  1108. .app-container {
  1109. height: calc( 100vh - 110px );
  1110. box-sizing: border-box;
  1111. }
  1112. .app-container-query {
  1113. }
  1114. .app-container-table-box {
  1115. height: calc( 100% - var(--q-height) );
  1116. .app-container-table-info {
  1117. height: calc( 100% - 100px );
  1118. }
  1119. }
  1120. .upload-box {
  1121. ::v-deep .el-upload--picture-card {
  1122. display: none;
  1123. }
  1124. }
  1125. ::v-deep .avatar-uploader .el-upload {
  1126. border: 1px dashed #d9d9d9;
  1127. border-radius: 6px;
  1128. cursor: pointer;
  1129. position: relative;
  1130. overflow: hidden;
  1131. }
  1132. ::v-deep .avatar-uploader .el-upload:hover {
  1133. border-color: #409EFF;
  1134. }
  1135. ::v-deep .avatar-uploader-icon {
  1136. font-size: 28px;
  1137. color: #8c939d;
  1138. width: 100px;
  1139. height: 100px;
  1140. line-height: 100px;
  1141. text-align: center;
  1142. }
  1143. ::v-deep .avatar {
  1144. width: 100px;
  1145. height: 100px;
  1146. display: block;
  1147. }
  1148. .app-container-scheduling ::v-deep .el-select__tags {
  1149. flex-wrap: inherit !important;
  1150. overflow-x: auto !important;
  1151. }
  1152. .app-container-scheduling ::v-deep .el-form-item__content {
  1153. position: relative;
  1154. }
  1155. .app-container-scheduling ::v-deep .el-form-item__content .query_clear{
  1156. position: absolute;
  1157. top: -15px;
  1158. right: -10px;
  1159. display: none;
  1160. cursor: pointer;
  1161. z-index: 99;
  1162. }
  1163. .app-container-scheduling ::v-deep .el-form-item__content:hover .query_clear {
  1164. display: block;
  1165. }
  1166. </style>