order.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. <template>
  2. <div>
  3. <div class="btn">
  4. <el-button type="primary">同步订单</el-button>
  5. </div>
  6. <div class="search">
  7. <el-form ref="advancedForm" :model="advancedForm" label-width="160px">
  8. <el-row>
  9. <el-col :span="8">
  10. <el-form-item label="订单日期">
  11. <el-date-picker
  12. v-model="advancedForm.goodsExchange_time_range"
  13. type="daterange"
  14. align="center"
  15. :editable="false"
  16. unlink-panels
  17. :clearable="false"
  18. :default-time="['00:00:00', '23:59:59']"
  19. range-separator="-"
  20. start-placeholder="开始日期"
  21. end-placeholder="结束日期"
  22. value-format="timestamp"
  23. :picker-options="{
  24. disabledDate(time) {
  25. return (
  26. time.getTime() - 1 >=
  27. new Date(
  28. new Date().getFullYear(),
  29. new Date().getMonth(),
  30. new Date().getDate()
  31. ).getTime() +
  32. 86400000 -
  33. 1
  34. );
  35. },
  36. shortcuts: MixinPickerShortcuts,
  37. }"
  38. >
  39. </el-date-picker>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="8">
  43. <el-form-item label="仓库">
  44. <el-select v-model="advancedForm.warehouse_id" clearable>
  45. <el-option
  46. v-for="item in warehouseList"
  47. :key="item.id"
  48. :label="item.name"
  49. :value="item.id"
  50. />
  51. </el-select>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="8">
  55. <el-form-item label="订单编号">
  56. <el-input
  57. v-model="advancedForm.sn"
  58. placeholder="请输入订单编号"
  59. ></el-input>
  60. </el-form-item>
  61. </el-col>
  62. </el-row>
  63. </el-form>
  64. <el-button @click="advancedSearchEvent"> 搜索 </el-button>
  65. </div>
  66. <en-table-layout
  67. toolbar
  68. pagination
  69. :loading="loading"
  70. :tableData="tableData"
  71. @selection-change="handleSelectionChange"
  72. >
  73. <div slot="toolbar" class="inner-toolbar">
  74. <div class="toolbar-btns">
  75. <el-button
  76. size="mini"
  77. type="primary"
  78. v-if="checkPermission(['order:add'])"
  79. @click="handleAdd"
  80. >新增</el-button
  81. >
  82. <!-- <el-button size="mini" type="primary" v-if="checkPermission(['order:outbound'])"
  83. @click="batchOutbound">批量出库</el-button> -->
  84. </div>
  85. <!-- <div class="toolbar-search">
  86. <en-table-search
  87. @search="searchEvent"
  88. @advancedSearch="advancedSearchEvent"
  89. advanced
  90. advancedWidth="465"
  91. placeholder="请输入订单编号或会员名称"
  92. >
  93. <template slot="advanced-content">
  94. <el-form
  95. ref="advancedForm"
  96. :model="advancedForm"
  97. label-width="80px"
  98. >
  99. <el-form-item label="订单时间">
  100. <el-date-picker
  101. v-model="advancedForm.order_time"
  102. type="daterange"
  103. align="center"
  104. :default-time="['00:00:00', '23:59:59']"
  105. :editable="false"
  106. unlink-panels
  107. range-separator="-"
  108. start-placeholder="开始日期"
  109. end-placeholder="结束日期"
  110. >
  111. </el-date-picker>
  112. </el-form-item>
  113. <el-form-item label="仓库">
  114. <el-select v-model="advancedForm.status" clearable>
  115. <el-option label="待提交" value="WAIT_SUBMIT" />
  116. <el-option label="待审核" value="WAIT_AUDIT" />
  117. <el-option label="审核驳回" value="AUDIT_REJECT" />
  118. <el-option label="待出库" value="WAIT_WAREHOUSE_OUT" />
  119. <el-option label="待发货" value="WAIT_SHIP" />
  120. <el-option label="已发货" value="SHIPPED" />
  121. </el-select>
  122. </el-form-item>
  123. <el-form-item label="订单编号">
  124. <el-select v-model="advancedForm.payment_status" clearable>
  125. <el-option label="未支付" value="NOT_PAY" />
  126. <el-option label="已支付" value="PAY" />
  127. </el-select>
  128. </el-form-item>
  129. </el-form>:selectable="canWarehouseOut"
  130. </template>
  131. </en-table-search>
  132. </div> -->
  133. </div>
  134. <template slot="table-columns">
  135. <el-table-column type="selection" width="55" />
  136. <el-table-column prop="sn" label="订单编号">
  137. <template slot-scope="scope">
  138. {{ scope.row.sn }}
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="客户">
  142. <template slot-scope="scope">{{
  143. memberType(scope.row.member_id)
  144. }}</template>
  145. </el-table-column>
  146. <el-table-column label="下单时间">
  147. <template slot-scope="scope">{{
  148. scope.row.order_time | unixToDate
  149. }}</template>
  150. </el-table-column>
  151. <el-table-column prop="warehouse_id" label="仓库名称">
  152. <template slot-scope="scope">
  153. {{ warehouseName(scope.row.warehouse_id) }}
  154. </template>
  155. </el-table-column>
  156. <el-table-column prop="send_type" label="配送方式">
  157. <template slot-scope="scope">{{
  158. deliveryType(scope.row.send_type)
  159. }}</template>
  160. </el-table-column>
  161. <el-table-column prop="pay_type" label="付款方式">
  162. <template slot-scope="scope">{{
  163. payType(scope.row.pay_type)
  164. }}</template>
  165. </el-table-column>
  166. <el-table-column prop="status" label="实付金额">
  167. <template slot-scope="scope">{{
  168. "¥" + scope.row.pay_price
  169. }}</template>
  170. </el-table-column>
  171. <el-table-column prop="status" label="订单状态">
  172. <template slot-scope="scope">
  173. {{ typeName(scope.row.status) }}
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="延期次数">
  177. <template slot-scope="scope">
  178. {{ scope.row.extension }}
  179. </template>
  180. </el-table-column>
  181. <el-table-column prop="status" label="订单类型">
  182. <template slot-scope="scope">{{ scope.row.type=='TO_B'?'销售订单':'租赁订单' }}</template>
  183. </el-table-column>
  184. <el-table-column label="操作" width="300">
  185. <template slot-scope="scope">
  186. <el-button size="mini" @click="handleAudit(scope.row)"
  187. >查看</el-button
  188. >
  189. <el-button
  190. size="mini"
  191. type="success"
  192. v-if="scope.row.status === 'TO_BE_COMMIT'"
  193. @click="handleSubmit(scope.row.id)"
  194. >确认</el-button
  195. >
  196. <el-button
  197. size="mini"
  198. @click="handleEdit(scope.row)"
  199. v-if="scope.row.status === 'TO_BE_COMMIT'"
  200. >编辑</el-button
  201. >
  202. <el-button size="mini" type="danger" v-if="scope.row.type === 'TO_C'"
  203. @click="handleWithdraw(scope.row.id)">延期</el-button>
  204. <!-- <el-button size="mini" type="primary" v-if="scope.row.allowable.payment && checkPermission(['order:payment'])"
  205. @click="handlePayment(scope.row.id)">设为已支付</el-button> -->
  206. </template>
  207. </el-table-column>
  208. </template>
  209. <el-pagination
  210. slot="pagination"
  211. v-if="pageData"
  212. @size-change="handlePageSizeChange"
  213. @current-change="handlePageCurrentChange"
  214. :current-page="pageData.page_no"
  215. :page-sizes="[10, 20, 50, 100]"
  216. :page-size="pageData.page_size"
  217. layout="total, sizes, prev, pager, next, jumper"
  218. :total="pageData.data_total"
  219. >
  220. </el-pagination>
  221. </en-table-layout>
  222. </div>
  223. </template>
  224. <script>
  225. import * as API_order from "@/api/order";
  226. import Storage from "@/utils/storage";
  227. import * as API_BasicSetting from "@/api/basicSetting";
  228. import * as API_Setting from "@/api/setting";
  229. import * as API_CollectingAccount from "@/api/collectingAccount";
  230. export default {
  231. name: "orderList",
  232. data() {
  233. return {
  234. warehouseList: [],
  235. /** 列表loading状态 */
  236. loading: false,
  237. /** 列表参数 */
  238. params: {
  239. page_no: 1,
  240. page_size: 10,
  241. ...this.$route.query,
  242. },
  243. cancelpopup: false,
  244. cancelLister: "",
  245. /** 列表数据 */
  246. tableData: [],
  247. /** 列表分页数据 */
  248. pageData: [],
  249. /** 高级搜索数据 */
  250. advancedForm: {},
  251. /** 表格最大高度 */
  252. tableMaxHeight: document.body.clientHeight - 54 - 34 - 50 - 15,
  253. accessToken: Storage.getItem("seller_access_token"),
  254. multipleSelection: [],
  255. orderType: [],
  256. collectingAccountList: [], // 支付方式列表
  257. deliveryTypeList: [
  258. ],
  259. customerList: [],
  260. };
  261. },
  262. mounted() {
  263. this.GET_OrderList();
  264. this.GET_WarehouseList();
  265. this.GET_CollectingAccountList();
  266. this.GET_CustomerList();
  267. },
  268. activated() {
  269. delete this.params.market_enable;
  270. this.params = {
  271. ...this.params,
  272. ...this.$route.query,
  273. };
  274. this.GET_OrderList();
  275. window.onresize = this.countTableHeight;
  276. },
  277. beforeRouteUpdate(to, from, next) {
  278. delete this.params.market_enable;
  279. this.params = {
  280. ...this.params,
  281. ...this.$route.query,
  282. };
  283. this.GET_OrderList();
  284. next();
  285. },
  286. methods: {
  287. memberType(val) {
  288. let name = "";
  289. this.customerList.map((el) => {
  290. if (el.id == val) {
  291. return (name = el.name);
  292. }
  293. });
  294. return name;
  295. },
  296. //获取客户列表
  297. GET_CustomerList() {
  298. API_BasicSetting.customer(this.params)
  299. .then((response) => {
  300. this.customerList = response.data;
  301. })
  302. .catch(() => {});
  303. },
  304. //配送方式查看
  305. deliveryType(val) {
  306. let name = "";
  307. this.deliveryTypeList.map((el) => {
  308. if (el.value == val) {
  309. return (name = el.label);
  310. }
  311. });
  312. return name;
  313. },
  314. //获取付款方式
  315. payType(val) {
  316. let name = "";
  317. this.collectingAccountList.map((el) => {
  318. if (el.id == val) {
  319. return (name = el.name);
  320. }
  321. });
  322. return name;
  323. },
  324. /** 获取支付方式列表 */
  325. GET_CollectingAccountList() {
  326. API_CollectingAccount.getList({
  327. page_no: 1,
  328. page_size: -1,
  329. enable_flag: true,
  330. }).then((response) => {
  331. this.collectingAccountList = response.data;
  332. });
  333. },
  334. //获取订单状态大小写转换.toUpperCase()
  335. typeName(val) {
  336. let name = "";
  337. this.orderType.map((el) => {
  338. if (el.value == val) {
  339. return (name = el.label);
  340. }
  341. });
  342. return name;
  343. },
  344. //获取仓库名称
  345. warehouseName(val) {
  346. let name = [];
  347. this.warehouseList.map((el) => {
  348. val.map((e) => {
  349. if (el.id == e) {
  350. return name.push(el.name)
  351. }
  352. });
  353. });
  354. return name.join('/');
  355. },
  356. batchOutbound() {
  357. if (this.multipleSelection.length === 0) {
  358. this.$message.error("请选择订单!");
  359. return;
  360. }
  361. const orderIds = this.multipleSelection.map((order) => order.id);
  362. this.$router.push({
  363. name: "orderOutbound",
  364. params: { orderIds: orderIds },
  365. });
  366. },
  367. /** 获取仓库 */
  368. GET_WarehouseList() {
  369. API_BasicSetting.getWarehouseListAll().then((response) => {
  370. this.warehouseList = response;
  371. });
  372. API_Setting.getPage({ dictType: "order_status" }).then((res) => {
  373. this.orderType = res.data;
  374. });
  375. API_Setting.getPage({ dictType: "order_send_type" }).then((res) => {
  376. this.deliveryTypeList = res.data;
  377. });
  378. },
  379. /** 计算高度 */
  380. countTableHeight() {
  381. this.tableHeight = document.body.clientHeight - 54 - 35 - 50;
  382. },
  383. /** 多选改变 */
  384. handleSelectionChange(val) {
  385. this.multipleSelection = val;
  386. },
  387. /** 新增 */
  388. handleAdd() {
  389. this.$router.push({
  390. name: "orderAdd",
  391. params: { callback: this.GET_OrderList },
  392. });
  393. },
  394. /** 是否可以出库 */
  395. /* canWarehouseOut(row) {
  396. return row.allowable.warehouse_out;
  397. }, */
  398. /** 分页大小发生改变 */
  399. handlePageSizeChange(size) {
  400. this.params.page_size = size;
  401. this.GET_OrderList();
  402. },
  403. /** 分页页数发生改变 */
  404. handlePageCurrentChange(page) {
  405. this.params.page_no = page;
  406. this.GET_OrderList();
  407. },
  408. /** 搜索事件触发 */
  409. searchEvent(data) {
  410. this.params = {
  411. ...this.params,
  412. keywords: data,
  413. };
  414. this.params.page_no = 1;
  415. delete this.params.order_status;
  416. Object.keys(this.advancedForm).forEach((key) => delete this.params[key]);
  417. this.GET_OrderList();
  418. },
  419. /** 高级搜索事件触发 */
  420. advancedSearchEvent() {
  421. this.params = {
  422. ...this.params,
  423. ...this.advancedForm,
  424. };
  425. this.params.page_no = 1;
  426. delete this.params.start_time;
  427. delete this.params.end_time;
  428. if (this.advancedForm.order_time) {
  429. this.advancedForm.order_time[0] =
  430. this.advancedForm.order_time[0].getTime() / 1000;
  431. this.advancedForm.order_time[1] =
  432. this.advancedForm.order_time[1].getTime() / 1000;
  433. }
  434. delete this.params.keywords;
  435. this.GET_OrderList();
  436. },
  437. /** 编辑订单 */
  438. handleEdit(order) {
  439. this.$router.push({
  440. name: "orderEdit",
  441. params: { id: order.id, callback: this.GET_OrderList },
  442. });
  443. },
  444. /** 查看订单 */
  445. handleAudit(order) {
  446. this.$router.push({
  447. name: "orderDetail",
  448. params: { id: order.id, callback: this.GET_OrderList,type:'check' },
  449. });
  450. },
  451. /** 订单设为已支付 */
  452. async handlePayment(id) {
  453. // 二次确认
  454. await this.$confirm(`确认要设为已支付吗?`, "提示");
  455. // 发起修改
  456. await API_order.payment(id);
  457. this.$message.success("操作成功!");
  458. // 刷新列表
  459. this.GET_OrderList();
  460. },
  461. /** 提交订单 */
  462. async handleSubmit(id) {
  463. // 发起修改
  464. await API_order.submit(id);
  465. this.$message.success("操作成功!");
  466. // 刷新列表
  467. this.GET_OrderList();
  468. },
  469. /** 延期 */
  470. async handleWithdraw(id) {
  471. this.$router.push({
  472. name: "orderEdit",
  473. params: { id: id,type:'pone' },
  474. });
  475. },
  476. GET_OrderList() {
  477. this.loading = true;
  478. API_order.getOrderList(this.params).then((response) => {
  479. this.loading = false;
  480. this.tableData = response.data;
  481. this.pageData = {
  482. page_no: response.page_no,
  483. page_size: response.page_size,
  484. data_total: response.data_total,
  485. };
  486. }).catch(() => {
  487. this.loading = false;
  488. })
  489. },
  490. },
  491. };
  492. </script>
  493. <style type="text/scss" lang="scss" scoped>
  494. .btn {
  495. display: flex;
  496. justify-content: flex-end;
  497. padding: 30px 20px 5px;
  498. border-radius: 5px;
  499. background-color: #fff;
  500. .el-button {
  501. width: 100px;
  502. }
  503. }
  504. .search {
  505. display: flex;
  506. align-items: center;
  507. background: #fff;
  508. overflow: hidden;
  509. padding: 30px 10px 10px 10px;
  510. /deep/ .el-form-item {
  511. .el-form-item__content {
  512. .el-input {
  513. width: 200px;
  514. }
  515. }
  516. }
  517. .el-button {
  518. margin-top: -19px;
  519. margin-left: 20px;
  520. }
  521. }
  522. /* .container {
  523. padding: 10px 10px 0 10px;
  524. } */
  525. /deep/ .el-table {
  526. min-height: auto !important;
  527. }
  528. /deep/ div.toolbar {
  529. height: 70px;
  530. padding: 20px 0;
  531. }
  532. /* 工具条*/
  533. .inner-toolbar {
  534. display: flex;
  535. width: 100%;
  536. justify-content: space-between;
  537. padding: 0 20px;
  538. }
  539. .empty-block {
  540. position: relative;
  541. min-height: 60px;
  542. line-height: 60px;
  543. text-align: center;
  544. width: 262%;
  545. font-size: 14px;
  546. color: #606266;
  547. }
  548. /*表格信息*/
  549. .my-table-out {
  550. white-space: nowrap;
  551. overflow-y: scroll;
  552. overflow-x: hidden;
  553. text-overflow: ellipsis;
  554. width: 100%;
  555. max-height: 800px;
  556. margin: 0 10px;
  557. min-height: 480px !important;
  558. background: #fff;
  559. }
  560. .my-table {
  561. width: 100%;
  562. margin-bottom: 40px;
  563. background: #fff;
  564. border-collapse: collapse;
  565. font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
  566. Microsoft YaHei, Arial, sans-serif;
  567. font-size: 14px;
  568. font-bold: 700;
  569. .bg-order {
  570. background: #fafafa;
  571. }
  572. thead {
  573. th {
  574. padding: 10px 0;
  575. border: 1px solid #ebeef5;
  576. border-collapse: collapse;
  577. color: #909399;
  578. }
  579. th.shoplist-header {
  580. padding: 10px 20px;
  581. display: flex;
  582. flex-direction: row;
  583. flex-wrap: nowrap;
  584. justify-content: space-between;
  585. align-items: center;
  586. }
  587. }
  588. tbody {
  589. margin-top: 10px;
  590. td {
  591. border: 1px solid #ebeef5;
  592. border-collapse: collapse;
  593. text-align: center;
  594. padding: 0;
  595. }
  596. td:first-child {
  597. text-align: left;
  598. }
  599. td:not(:first-child) {
  600. padding: 3px;
  601. }
  602. td.shoplist-content-out {
  603. padding-left: 20px;
  604. }
  605. /*商品信息*/
  606. p.shoplist-content:not(:last-child) {
  607. border-bottom: 1px solid #ebeef5;
  608. border-collapse: collapse;
  609. }
  610. p.shoplist-content {
  611. margin: 0;
  612. padding: 0 20px;
  613. box-sizing: padding-box;
  614. display: flex;
  615. flex-direction: row;
  616. flex-wrap: nowrap;
  617. justify-content: space-between;
  618. align-items: center;
  619. .goods-info {
  620. display: flex;
  621. flex-direction: row;
  622. flex-wrap: nowrap;
  623. justify-content: flex-start;
  624. align-items: center;
  625. padding: 10px 0;
  626. img {
  627. display: block;
  628. margin-right: 10px;
  629. }
  630. a {
  631. display: block;
  632. color: #409eff;
  633. }
  634. }
  635. }
  636. div.order-money {
  637. display: flex;
  638. flex-direction: column;
  639. flex-wrap: nowrap;
  640. justify-content: center;
  641. align-items: center;
  642. span {
  643. display: inline-block;
  644. padding: 5px;
  645. }
  646. span.order-amount {
  647. color: red;
  648. }
  649. }
  650. }
  651. /* 商品图片 */
  652. .goods-image {
  653. width: 50px;
  654. height: 50px;
  655. }
  656. /** 交易快照 */
  657. .trade-record {
  658. display: inline-block;
  659. margin-right: 50px;
  660. }
  661. }
  662. /*分页信息*/
  663. section > div {
  664. position: relative;
  665. }
  666. .el-pagination {
  667. text-align: right;
  668. width: 100%;
  669. background: #ffffff;
  670. height: 100px;
  671. padding: 5px 20px;
  672. margin: 0 10px;
  673. }
  674. .exprot-tip {
  675. margin-left: 5px;
  676. color: red;
  677. font-size: 12px;
  678. }
  679. </style>