orderReport.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <div class="mod-config">
  3. <el-form
  4. :inline="true"
  5. :model="dataForm"
  6. @keyup.enter.native="getDataList()"
  7. >
  8. <el-form-item>
  9. <el-input
  10. v-model="dataForm.groupName"
  11. placeholder="店铺"
  12. clearable
  13. ></el-input>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-input
  17. v-model="dataForm.hotelName"
  18. placeholder="酒店名称"
  19. clearable
  20. ></el-input>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-input
  24. v-model="dataForm.orderCode"
  25. placeholder="订单号"
  26. clearable
  27. ></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-input
  31. v-model="dataForm.city"
  32. placeholder="城市"
  33. clearable
  34. ></el-input>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-date-picker
  38. value-format="yyyy-MM-dd HH:mm:ss"
  39. v-model="dataForm.orderDate"
  40. type="daterange"
  41. range-separator="至"
  42. start-placeholder="开始日期"
  43. end-placeholder="结束日期"
  44. :default-time="['00:00:00', '23:59:59']"
  45. :clearable="false"
  46. >
  47. </el-date-picker>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-select
  51. v-model="dataForm.buyStatus"
  52. placeholder="采购状态"
  53. multiple
  54. clearable
  55. >
  56. <el-option
  57. v-for="item in buyStatusOptions"
  58. :key="item.value"
  59. :label="item.label"
  60. :value="item.value"
  61. >
  62. </el-option>
  63. </el-select>
  64. </el-form-item>
  65. <el-form-item>
  66. <el-select
  67. v-model="dataForm.orderStatus"
  68. placeholder="订单状态"
  69. multiple
  70. clearable
  71. >
  72. <el-option
  73. v-for="item in orderStatusOptions"
  74. :key="item.value"
  75. :label="item.label"
  76. :value="item.value"
  77. >
  78. </el-option>
  79. </el-select>
  80. </el-form-item>
  81. <el-form-item>
  82. <el-button @click="getDataList()">查询</el-button>
  83. </el-form-item>
  84. <el-form-item>
  85. <el-button @click="reFresh()">重置</el-button>
  86. </el-form-item>
  87. <el-form-item>
  88. <el-button @click="getExcel()">导出</el-button>
  89. </el-form-item>
  90. </el-form>
  91. <el-table
  92. :data="dataList"
  93. border
  94. v-loading="dataListLoading"
  95. style="width: 100%"
  96. >
  97. <el-table-column
  98. prop="groupName"
  99. header-align="center"
  100. align="center"
  101. label="店铺"
  102. :show-overflow-tooltip="true"
  103. >
  104. </el-table-column>
  105. <el-table-column
  106. prop="orderDate"
  107. header-align="center"
  108. align="center"
  109. label="订购日期"
  110. :show-overflow-tooltip="true"
  111. >
  112. </el-table-column>
  113. <el-table-column
  114. prop="orderCode"
  115. header-align="center"
  116. align="center"
  117. label="飞猪订单号"
  118. :show-overflow-tooltip="true"
  119. >
  120. </el-table-column>
  121. <el-table-column
  122. prop="orderTime"
  123. header-align="center"
  124. align="center"
  125. label="订单创建时间"
  126. :show-overflow-tooltip="true"
  127. >
  128. </el-table-column>
  129. <el-table-column
  130. prop="lockTime"
  131. header-align="center"
  132. align="center"
  133. label="跟单时间"
  134. :show-overflow-tooltip="true"
  135. >
  136. </el-table-column>
  137. <el-table-column
  138. prop="payPrice"
  139. header-align="center"
  140. align="center"
  141. label="付款金额"
  142. :show-overflow-tooltip="true"
  143. >
  144. </el-table-column>
  145. <el-table-column
  146. prop="buyOrderPrice"
  147. header-align="center"
  148. align="center"
  149. label="采购价"
  150. :show-overflow-tooltip="true"
  151. >
  152. </el-table-column>
  153. <el-table-column
  154. prop="grossProfit"
  155. header-align="center"
  156. align="center"
  157. label="毛利"
  158. :show-overflow-tooltip="true"
  159. >
  160. </el-table-column>
  161. <el-table-column
  162. prop="grossProfitMargin"
  163. header-align="center"
  164. align="center"
  165. label="毛利率(%)"
  166. :show-overflow-tooltip="true"
  167. >
  168. </el-table-column>
  169. <el-table-column
  170. prop="hotelName"
  171. header-align="center"
  172. align="center"
  173. label="酒店名称"
  174. :show-overflow-tooltip="true"
  175. >
  176. </el-table-column>
  177. <el-table-column
  178. prop="roomNum"
  179. header-align="center"
  180. align="center"
  181. label="间夜数"
  182. :show-overflow-tooltip="true"
  183. >
  184. </el-table-column>
  185. <el-table-column
  186. :formatter="dateStr"
  187. header-align="center"
  188. align="center"
  189. label="入离时间"
  190. :show-overflow-tooltip="true"
  191. >
  192. </el-table-column>
  193. <el-table-column
  194. prop="name"
  195. header-align="center"
  196. align="center"
  197. label="订单入住人信息"
  198. :show-overflow-tooltip="true"
  199. >
  200. </el-table-column>
  201. <el-table-column
  202. prop="city"
  203. header-align="center"
  204. align="center"
  205. label="城市"
  206. :show-overflow-tooltip="true"
  207. >
  208. </el-table-column>
  209. <el-table-column
  210. prop="orderStatus"
  211. header-align="center"
  212. align="center"
  213. label="订单状态"
  214. :show-overflow-tooltip="true"
  215. >
  216. </el-table-column>
  217. <el-table-column
  218. prop="buyStatus"
  219. header-align="center"
  220. align="center"
  221. label="采购状态"
  222. :show-overflow-tooltip="true"
  223. >
  224. </el-table-column>
  225. </el-table>
  226. <el-pagination
  227. @size-change="sizeChangeHandle"
  228. @current-change="currentChangeHandle"
  229. :current-page="pageIndex"
  230. :page-sizes="[10, 20, 50, 100]"
  231. :page-size="pageSize"
  232. :total="totalPage"
  233. layout="total, sizes, prev, pager, next, jumper"
  234. >
  235. </el-pagination>
  236. <!-- 入住人详情 -->
  237. <!-- <peo-info v-if="infoVisible" ref="peoInfo"></peo-info> -->
  238. <!--弹窗,处理订单-->
  239. <deal-with v-if="dealWithVisible" ref="dealWith"> </deal-with>
  240. <!-- 发票详情 -->
  241. <!-- <invo v-if="invoVisible" ref="invo"> </invo> -->
  242. <!-- 备注 -->
  243. <!-- <note v-if="noteVisible" ref="note"></note> -->
  244. </div>
  245. </template>
  246. <script>
  247. // import PeoInfo from "./ordorder-peo-info"
  248. import DealWith from "./ordorder-dealwith";
  249. import axios from "axios";
  250. // import Invo from "./ordorder-invo"
  251. // import Note from "./ordorder-note"
  252. export default {
  253. data() {
  254. return {
  255. dataForm: {
  256. orderCode: "",
  257. orderDate: null,
  258. groupName: "",
  259. hotelName: "",
  260. city: "",
  261. buyStatus: [],
  262. orderStatus: []
  263. },
  264. me: 0,
  265. dataList: [],
  266. pageIndex: 1,
  267. pageSize: 10,
  268. totalPage: 0,
  269. dataListLoading: false,
  270. peoInfoVisible: false,
  271. dealWithVisible: false,
  272. infoVisible: false,
  273. invoVisible: false,
  274. noteVisible: false,
  275. buyStatusOptions: [
  276. {
  277. value: "0",
  278. label: "未采购"
  279. },
  280. {
  281. value: "1",
  282. label: "已受理"
  283. },
  284. {
  285. value: "2",
  286. label: "采购中"
  287. },
  288. {
  289. value: "3",
  290. label: "已采购"
  291. },
  292. {
  293. value: "-1",
  294. label: "采购失败"
  295. },
  296. {
  297. value: "-2",
  298. label: "退款中"
  299. },
  300. {
  301. value: "-3",
  302. label: "已退款"
  303. },
  304. {
  305. value: "-4",
  306. label: "退款失败"
  307. },
  308. {
  309. value: "-5",
  310. label: "订单取消中"
  311. },
  312. {
  313. value: "-6",
  314. label: "已取消"
  315. },
  316. {
  317. value: "-7",
  318. label: "取消失败"
  319. },
  320. {
  321. value: "-8",
  322. label: "已入住"
  323. }
  324. ],
  325. orderStatusOptions: [
  326. {
  327. value: "1",
  328. label: "未支付"
  329. },
  330. {
  331. value: "2",
  332. label: "已支付"
  333. },
  334. {
  335. value: "3",
  336. label: "已发货"
  337. },
  338. {
  339. value: "4",
  340. label: "已入住"
  341. },
  342. {
  343. value: "-1",
  344. label: "申请退款"
  345. },
  346. {
  347. value: "-2",
  348. label: "已退款"
  349. },
  350. {
  351. value: "-3",
  352. label: "关单"
  353. },
  354. {
  355. value: "-4",
  356. label: "已入住"
  357. },
  358. {
  359. value: "-5",
  360. label: "申请取消订单"
  361. }
  362. ]
  363. };
  364. },
  365. components: {
  366. // "peo-info": PeoInfo,
  367. "deal-with": DealWith
  368. // invo: Invo,
  369. // note: Note
  370. },
  371. activated() {
  372. this.reFresh();
  373. },
  374. methods: {
  375. // 导出订单excel
  376. getExcel() {
  377. this.$http({
  378. responseType: "blob",
  379. method: "get",
  380. url: this.$http.adornUrl("/ord/orderReport/excel"),
  381. // 请求参数,可以为空
  382. params: this.$http.adornParams({
  383. orderCode: this.dataForm.orderCode,
  384. orderDateStart: this.dataForm.orderDate[0] || "",
  385. orderDateEnd: this.dataForm.orderDate[1] || "",
  386. groupName: this.dataForm.groupName,
  387. hotelName: this.dataForm.hotelName,
  388. city: this.dataForm.city,
  389. buyStatus: this.dataForm.buyStatus.join(","),
  390. orderStatus: this.dataForm.orderStatus.join(",")
  391. })
  392. }).then(({ data }) => {
  393. let objectUrl = data;
  394. const blob = new Blob([data], ["application/vnd.ms-excel"]);
  395. objectUrl = URL.createObjectURL(blob);
  396. const a = document.createElement("a");
  397. a.href = objectUrl;
  398. //这里可以重新定义文件名,以前端为准
  399. a.download = "orderReportForm.xlsx";
  400. a.click();
  401. a.remove();
  402. URL.revokeObjectURL(objectUrl);
  403. });
  404. },
  405. reFresh() {
  406. this.dataForm = {
  407. orderCode: "",
  408. orderDate: null,
  409. groupName: "",
  410. hotelName: "",
  411. city: "",
  412. buyStatus: [],
  413. orderStatus: []
  414. };
  415. let date = new Date();
  416. this.dataForm.orderDate = [
  417. date.getFullYear() +
  418. "-" +
  419. (date.getMonth() + 1) +
  420. "-" +
  421. date.getDate() +
  422. " 00:00:00",
  423. date.getFullYear() +
  424. "-" +
  425. (date.getMonth() + 1) +
  426. "-" +
  427. date.getDate() +
  428. " 23:59:59"
  429. ];
  430. this.getDataList();
  431. },
  432. // 获取数据列表
  433. getDataList() {
  434. this.dataListLoading = true;
  435. this.$http({
  436. url: this.$http.adornUrl("/ord/orderReport/list"),
  437. method: "get",
  438. params: this.$http.adornParams({
  439. page: this.pageIndex,
  440. limit: this.pageSize,
  441. orderCode: this.dataForm.orderCode,
  442. orderDateStart: this.dataForm.orderDate[0] || "",
  443. orderDateEnd: this.dataForm.orderDate[1] || "",
  444. groupName: this.dataForm.groupName,
  445. hotelName: this.dataForm.hotelName,
  446. city: this.dataForm.city,
  447. buyStatus: this.dataForm.buyStatus.join(","),
  448. orderStatus: this.dataForm.orderStatus.join(",")
  449. })
  450. }).then(({ data }) => {
  451. if (data && data.code === 0) {
  452. this.dataList = data.page.list;
  453. this.totalPage = data.page.totalCount;
  454. this.me = data.me;
  455. } else {
  456. this.dataList = [];
  457. this.totalPage = 0;
  458. }
  459. this.dataListLoading = false;
  460. });
  461. },
  462. // 采购渠道 1,携程 2,美团 3,人工线下采购 4,其他
  463. buySource(data) {
  464. let status = data.buySource;
  465. return status === 1
  466. ? "携程"
  467. : status === 2
  468. ? "美团"
  469. : status === 3
  470. ? "人工线下采购"
  471. : status === 4
  472. ? "其他"
  473. : "";
  474. },
  475. // 入住时间段
  476. dateStr(data) {
  477. return data.checkInDate + "~" + data.checkOutDate;
  478. },
  479. // 订单类型
  480. orderType(data) {
  481. let status = data.orderType;
  482. return status === 0 ? "人工订单" : status === 1 ? "直连订单" : "其他";
  483. },
  484. statusSources(data) {
  485. let status = data.buySource;
  486. return status === 2
  487. ? "美团"
  488. : status === 1
  489. ? "携程"
  490. : status === 3
  491. ? "线下"
  492. : "";
  493. },
  494. // 订单状态判断
  495. statusOrder(data) {
  496. let status = data.orderStatus;
  497. return status === 1
  498. ? "未支付"
  499. : status === 2
  500. ? "已支付"
  501. : status === 3
  502. ? "已发货"
  503. : status === 4
  504. ? "已入住"
  505. : status === -1
  506. ? "申请退款"
  507. : status === -2
  508. ? "已退款"
  509. : status === -3
  510. ? "关单"
  511. : status === -4
  512. ? "已入住"
  513. : status === -5
  514. ? "申请取消订单"
  515. : "其他";
  516. },
  517. // 采购状态判断
  518. // 0未采购,1已受理(已提交)2已采购 -1 采购失败 -2 已退单
  519. statusBuy(data) {
  520. let status = data.buyStatus;
  521. return status === 0
  522. ? "未采购"
  523. : status === 1
  524. ? "已受理"
  525. : status === 2
  526. ? "采购中"
  527. : status === 3
  528. ? "已采购"
  529. : status === -1
  530. ? "采购失败"
  531. : status === -2
  532. ? "退款中"
  533. : status === -3
  534. ? "已退款"
  535. : status === -4
  536. ? "退款失败"
  537. : status === -5
  538. ? "订单取消中"
  539. : status === -6
  540. ? "已取消"
  541. : status === -7
  542. ? "取消失败"
  543. : status === -8
  544. ? "已入住"
  545. : "其他";
  546. },
  547. // 每页数
  548. sizeChangeHandle(val) {
  549. this.pageSize = val;
  550. this.pageIndex = 1;
  551. this.reFresh();
  552. },
  553. // 当前页
  554. currentChangeHandle(val) {
  555. this.pageIndex = val;
  556. this.getDataList();
  557. }
  558. }
  559. };
  560. </script>
  561. <style>
  562. .demo-table-expand {
  563. font-size: 0;
  564. }
  565. .demo-table-expand label {
  566. width: 90px;
  567. color: #99a9bf;
  568. }
  569. .demo-table-expand .el-form-item {
  570. margin-right: 0;
  571. margin-bottom: 0;
  572. width: 50%;
  573. }
  574. </style>