SaleOrderList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <template>
  2. <ContainerQuery>
  3. <div v-if="$accessCheck($Access.saleOrderListSearch)" slot="more">
  4. <el-form size="small" :inline="true" :model="search_form">
  5. <el-form-item>
  6. <el-input
  7. v-model="searchDate.keyword"
  8. clearable
  9. style="width: 260px"
  10. placeholder="订单编号/商品名称/备注"
  11. @keyup.enter.native="pageChange(1)"
  12. @clear="pageChange(1)"
  13. >
  14. <el-button
  15. slot="append"
  16. icon="el-icon-search"
  17. @click="pageChange(1)"
  18. ></el-button>
  19. </el-input>
  20. </el-form-item>
  21. <el-form-item>
  22. <SelectCustomer
  23. v-model="customer_name"
  24. @clear="customerClear"
  25. @change="customerSel"
  26. />
  27. </el-form-item>
  28. <el-form-item>
  29. <el-date-picker
  30. v-model="search_form.time"
  31. clearable
  32. type="daterange"
  33. value-format="timestamp"
  34. range-separator="-"
  35. start-placeholder="开始日期"
  36. end-placeholder="结束日期"
  37. @change="orderDate"
  38. ></el-date-picker>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-select
  42. v-model="searchDate.customerType"
  43. clearable
  44. style="width: 150px"
  45. placeholder="客户类型"
  46. @change="customerTypes"
  47. >
  48. <el-option
  49. v-for="(item, index) in customerType"
  50. :key="index"
  51. :label="item.name"
  52. :value="item.id"
  53. ></el-option>
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item>
  57. <SelectShop
  58. v-model="searchDate.shopId"
  59. width="150"
  60. placeholder="选择商铺"
  61. @clear="clearShop"
  62. @change="selShop"
  63. />
  64. </el-form-item>
  65. <el-form-item>
  66. <el-input
  67. v-model="staffName"
  68. clearable
  69. style="width: 150px"
  70. placeholder="业务员"
  71. @clear="staffClear"
  72. @blur="staffName = ''"
  73. >
  74. <i
  75. slot="suffix"
  76. class="el-input__icon el-icon-search"
  77. @click="staff_show = true"
  78. ></i>
  79. </el-input>
  80. </el-form-item>
  81. </el-form>
  82. </div>
  83. <div slot="left">
  84. <el-dropdown
  85. v-if="
  86. $accessCheck($Access.addSaleOrder) && $route.name !== 'CashierOrder'
  87. "
  88. split-button
  89. type="primary"
  90. @click="goAddOrder"
  91. >
  92. 新建订单
  93. <el-dropdown-menu slot="dropdown">
  94. <el-dropdown-item>
  95. <div class="dropdown-div" @click="getData(1)">导出</div>
  96. </el-dropdown-item>
  97. </el-dropdown-menu>
  98. </el-dropdown>
  99. <el-button v-else type="primary" plain size="small" @click="getData(1)">
  100. 导出
  101. </el-button>
  102. </div>
  103. <el-table :data="order_list" @row-dblclick="goDetail">
  104. <el-table-column
  105. prop="id"
  106. label="ID"
  107. fixed="left"
  108. width="80"
  109. ></el-table-column>
  110. <el-table-column prop="no" label="订单号" min-width="180">
  111. <template slot-scope="scope">
  112. <span
  113. v-if="$accessCheck($Access.saleOrderListGetOrderInfoById)"
  114. class="click-div"
  115. @click="goDetail(scope.row)"
  116. >
  117. {{ scope.row.no }}
  118. </span>
  119. <span v-else>{{ scope.row.no }}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column
  123. prop="customerName"
  124. show-overflow-tooltip
  125. label="客户"
  126. min-width="140"
  127. >
  128. <template slot-scope="scope">
  129. <el-popover
  130. v-if="$route.name !== 'CashierOrder'"
  131. placement="right"
  132. width="400"
  133. trigger="hover"
  134. >
  135. <div>
  136. <p class="order-info-p">
  137. <span class="order-info-label">收货人:</span>
  138. {{ scope.row.receiveData.realName }}
  139. </p>
  140. <p class="order-info-p">
  141. <span class="order-info-label">联系电话:</span>
  142. {{ scope.row.receiveData.mobile }}
  143. </p>
  144. <p v-if="scope.row.receiveData.area" class="order-info-p">
  145. <span class="order-info-label">联系地址:</span>
  146. {{ scope.row.receiveData.area.provinceName
  147. }}{{ scope.row.receiveData.area.cityName
  148. }}{{ scope.row.receiveData.area.districtName
  149. }}{{ scope.row.receiveData.address }}
  150. </p>
  151. </div>
  152. <span slot="reference" class="click-div">
  153. {{ scope.row.customerName }}
  154. </span>
  155. </el-popover>
  156. <span v-else>{{ scope.row.customerName }}</span>
  157. </template>
  158. </el-table-column>
  159. <el-table-column
  160. v-if="moneyFlag"
  161. prop="payAmount"
  162. label="订单金额"
  163. min-width="100"
  164. ></el-table-column>
  165. <el-table-column
  166. v-if="stateFlag"
  167. prop="orderMsg"
  168. label="订单状态"
  169. min-width="100"
  170. >
  171. <template slot-scope="scope">
  172. <span
  173. :class="[
  174. scope.row.orderMsg === '待审核'
  175. ? 'warning-status'
  176. : scope.row.orderMsg === '已关闭'
  177. ? 'info-status'
  178. : scope.row.orderMsg === '已出库'
  179. ? 'primary-status'
  180. : scope.row.orderMsg === '已完成'
  181. ? 'success-status'
  182. : scope.row.orderMsg === '待出库'
  183. ? 'danger-status'
  184. : 'primary-status',
  185. ]"
  186. >
  187. {{ scope.row.orderMsg }}
  188. </span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column
  192. v-if="salesmanFlag"
  193. prop="salesManName"
  194. label="业务员"
  195. min-width="100"
  196. >
  197. <template slot-scope="scope">
  198. {{ scope.row.salesManName || "未分配" }}
  199. </template>
  200. </el-table-column>
  201. <el-table-column
  202. v-if="remarkFlag"
  203. prop="remark"
  204. label="备注"
  205. show-overflow-tooltip
  206. min-width="160"
  207. >
  208. <template slot-scope="scope">
  209. {{ scope.row.remark || "无" }}
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. v-if="storeFlag"
  214. prop="shopName"
  215. label="店铺"
  216. min-width="100"
  217. :show-overflow-tooltip="true"
  218. ></el-table-column>
  219. <el-table-column
  220. v-if="codeFlag"
  221. prop="verifyCode"
  222. label="自提码"
  223. min-width="100"
  224. >
  225. <template slot-scope="scope">
  226. <p
  227. v-if="scope.row.verifyCode"
  228. style="font-weight: bold; color: #67c23a"
  229. >
  230. {{ scope.row.verifyCode }}
  231. </p>
  232. <p v-else>--</p>
  233. </template>
  234. </el-table-column>
  235. <el-table-column
  236. v-if="timeFlag"
  237. prop="createTime"
  238. label="创建时间"
  239. min-width="160"
  240. >
  241. <template slot-scope="scope">
  242. {{ $_common.formatDate(scope.row.createTime) }}
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="操作" fixed="right" min-width="85">
  246. <template slot="header" slot-scope="scope">
  247. <span v-if="false">{{ scope.$index }}</span>
  248. <span class="operation">操作</span>
  249. <el-popover popper-class="custom-table-checkbox" trigger="click">
  250. <el-checkbox-group v-model="checkList">
  251. <el-checkbox
  252. v-for="(item, index) in columns"
  253. :key="index"
  254. :label="item.label"
  255. @change="change"
  256. ></el-checkbox>
  257. </el-checkbox-group>
  258. <el-button
  259. slot="reference"
  260. icon="el-icon-setting"
  261. type="text"
  262. ></el-button>
  263. </el-popover>
  264. </template>
  265. <template slot-scope="scope">
  266. <el-button-group class="table-btn-group">
  267. <el-popconfirm
  268. v-if="accessDetail"
  269. title="请选择要打印的单据"
  270. confirm-button-text="小票打印机"
  271. cancel-button-text="网页打印"
  272. @onConfirm="toPrint(scope.row)"
  273. @onCancel="openUrl(scope.row)"
  274. >
  275. <el-button slot="reference" type="text">打印</el-button>
  276. </el-popconfirm>
  277. </el-button-group>
  278. </template>
  279. </el-table-column>
  280. </el-table>
  281. <FooterPage
  282. :page-size="pageSize"
  283. :total-page.sync="total"
  284. :current-page.sync="page"
  285. @pageChange="pageChange"
  286. @sizeChange="sizeChange"
  287. ></FooterPage>
  288. <staffListModal
  289. v-if="staff_show"
  290. :is-show="staff_show"
  291. :is-check="false"
  292. @cancel="staff_show = false"
  293. @confirm="staffSel"
  294. />
  295. </ContainerQuery>
  296. </template>
  297. <script>
  298. import SelectCustomer from "@/component/common/SelectCustomer.vue";
  299. import SelectShop from "@/component/goods/SelectShop.vue";
  300. import staffListModal from "@/component/common/staffListModal";
  301. import { getAllCustomerSource } from "@/api/System";
  302. import {
  303. getAllOrder,
  304. exportGetAllOrder,
  305. searchOrder,
  306. exportSearchOrder,
  307. updateOrderStatus,
  308. } from "@/api/Order";
  309. import { toPrint } from "@/api/common";
  310. export default {
  311. name: "NewOrderList",
  312. components: {
  313. SelectCustomer,
  314. SelectShop,
  315. staffListModal,
  316. },
  317. data() {
  318. return {
  319. staff_show: false,
  320. customerType: [],
  321. customer_name: "",
  322. searchDate: {
  323. keyword: "",
  324. orderStatus: "",
  325. payType: "",
  326. provinceCode: "",
  327. cityCode: "",
  328. districtCode: "",
  329. start: "",
  330. end: "",
  331. customerId: "",
  332. customerType: "",
  333. salesManId: "",
  334. shopId: "",
  335. source: "",
  336. },
  337. staffName: "",
  338. customer_show: false,
  339. order_list: [],
  340. total: 0,
  341. page: 1,
  342. pageSize: 10,
  343. search_form: {
  344. time: [],
  345. customType: "",
  346. customer: "",
  347. },
  348. // 权限
  349. accessAdd: true,
  350. accessAudit: true,
  351. accessCancel: true,
  352. accessDetail: true,
  353. orderType: 23,
  354. checkList: [
  355. "订单金额",
  356. "订单状态",
  357. "业务员",
  358. "备注",
  359. "店铺",
  360. "自提码",
  361. "创建时间",
  362. ],
  363. columns: [
  364. {
  365. label: "订单金额",
  366. },
  367. {
  368. label: "订单状态",
  369. },
  370. {
  371. label: "业务员",
  372. },
  373. {
  374. label: "备注",
  375. },
  376. {
  377. label: "店铺",
  378. },
  379. {
  380. label: "自提码",
  381. },
  382. {
  383. label: "创建时间",
  384. },
  385. ],
  386. moneyFlag: true,
  387. stateFlag: true,
  388. salesmanFlag: true,
  389. remarkFlag: true,
  390. storeFlag: true,
  391. codeFlag: true,
  392. timeFlag: true,
  393. };
  394. },
  395. async mounted() {
  396. this.orderType = this.$route.name === "CashierOrder" ? 24 : 23;
  397. await this.getAllOrder();
  398. await this.getAllCustomerSource();
  399. // 判断企业是否到期
  400. this.enterExpireTime();
  401. },
  402. activated() {
  403. if (this.$_isInit()) return;
  404. this.getData();
  405. },
  406. methods: {
  407. clearShop() {
  408. this.searchDate.shopId = "";
  409. this.pageChange(1);
  410. },
  411. selShop(val) {
  412. this.pageChange(1);
  413. },
  414. // 选择员工
  415. staffSel(val) {
  416. const row = val[0];
  417. this.searchDate.salesManId = row.id;
  418. this.staffName = row.staffName;
  419. this.pageChange(1);
  420. },
  421. // 清除员工输入框
  422. staffClear() {
  423. this.searchDate.salesManId = "";
  424. this.staffName = "";
  425. this.pageChange(1);
  426. },
  427. // 客户类型
  428. async getAllCustomerSource() {
  429. if (!this.customerType.length) {
  430. const data = await getAllCustomerSource({
  431. page: 1,
  432. pageSize: 99,
  433. });
  434. this.customerType = data.data;
  435. }
  436. },
  437. customerTypes(val) {
  438. this.searchDate.customerType = val;
  439. this.pageChange(1);
  440. },
  441. // 获取列表
  442. async getAllOrder(exports) {
  443. let search = {
  444. orderType: this.orderType,
  445. };
  446. if (this.$route.name === "CashierOrder") {
  447. search.isAll = 5;
  448. }
  449. let params = {
  450. page: this.page,
  451. pageSize: this.pageSize,
  452. search: search,
  453. };
  454. if (exports) {
  455. params.export = 1;
  456. const target = await exportGetAllOrder({
  457. ...params,
  458. });
  459. } else {
  460. const data = await getAllOrder({
  461. ...params,
  462. });
  463. this.order_list = data.data;
  464. this.total = data.pageTotal;
  465. }
  466. },
  467. // 订单搜索searchOrder
  468. async searchOrder(exports) {
  469. const params = {
  470. keyword: this.searchDate.keyword,
  471. payType: this.searchDate.payType,
  472. provinceCode: this.searchDate.provinceCode,
  473. cityCode: this.searchDate.cityCode,
  474. districtCode: this.searchDate.districtCode,
  475. start: this.searchDate.start,
  476. end: this.searchDate.end,
  477. customerId: this.searchDate.customerId,
  478. customerType: this.searchDate.customerType,
  479. salesManId: this.searchDate.salesManId,
  480. source: this.searchDate.source,
  481. page: this.page,
  482. pageSize: this.pageSize,
  483. shopId: this.searchDate.shopId,
  484. orderType: this.orderType,
  485. };
  486. if (this.$route.name === "CashierOrder") {
  487. params.isAll = 5;
  488. }
  489. if (exports) {
  490. params.export = 1;
  491. const target = await exportSearchOrder({
  492. ...params,
  493. });
  494. } else {
  495. const data = await searchOrder({
  496. ...params,
  497. });
  498. this.order_list = data.data;
  499. this.total = data.pageTotal;
  500. }
  501. },
  502. // 判断
  503. getData(exports) {
  504. const obj = {
  505. keyword: this.searchDate.keyword,
  506. // 'orderStatus': this.searchDate.orderStatus,
  507. payType: this.searchDate.payType,
  508. provinceCode: this.searchDate.provinceCode,
  509. cityCode: this.searchDate.cityCode,
  510. districtCode: this.searchDate.districtCode,
  511. start: this.searchDate.start,
  512. end: this.searchDate.end,
  513. customerId: this.searchDate.customerId,
  514. customerType: this.searchDate.customerType,
  515. salesManId: this.searchDate.salesManId,
  516. shopId: this.searchDate.shopId,
  517. source: this.searchDate.source,
  518. };
  519. const isKey = this.$_common.isSerch(obj);
  520. if (isKey) {
  521. this.searchOrder(exports);
  522. } else {
  523. this.getAllOrder(exports);
  524. }
  525. },
  526. // 选择客户
  527. customerSel(val, list) {
  528. this.searchDate.customerId = list[0].id;
  529. this.pageChange(1);
  530. },
  531. customerClear() {
  532. this.searchDate.customerId = "";
  533. this.customer_name = "";
  534. this.pageChange(1);
  535. },
  536. // 订单时间
  537. orderDate(val) {
  538. if (val && val.length) {
  539. this.searchDate.start = val[0] / 1000;
  540. this.searchDate.end = val[1] / 1000 + 86399;
  541. } else {
  542. this.searchDate.start = "";
  543. this.searchDate.end = "";
  544. }
  545. this.pageChange(1);
  546. },
  547. // 切页
  548. pageChange(val) {
  549. this.page = val;
  550. this.getData();
  551. },
  552. // 每页数据大小改变
  553. sizeChange(val) {
  554. this.pageSize = val;
  555. this.pageChange(1);
  556. },
  557. goAddOrder() {
  558. this.$router.push({
  559. path: "/order/saleO/AddSaleOrder",
  560. });
  561. },
  562. goDetail(row) {
  563. if (!this.$accessCheck(this.$Access.saleOrderListGetOrderInfoById)) {
  564. return;
  565. }
  566. this.$router.push({
  567. path: `/order/manageO/OrderDetails/${row.userCenterId}/${row.id}`,
  568. });
  569. },
  570. openUrl(row) {
  571. let routeData = this.$router.resolve({
  572. path: `/OrderPrinting/${row.userCenterId}/${row.id}`,
  573. });
  574. window.open(routeData.href, "_blank");
  575. },
  576. // 单据小票打印
  577. async toPrint(row) {
  578. const data = await toPrint({
  579. objectId: row.id,
  580. objectType: 23, // 销售单
  581. });
  582. this.$message({
  583. type: "success",
  584. message: "操作成功",
  585. });
  586. },
  587. // 取消订单
  588. async updateOrderStatus(row) {
  589. this.$confirm("确定要取消该订单吗?", "提示", {
  590. confirmButtonText: "确定",
  591. cancelButtonText: "取消",
  592. type: "warning",
  593. }).then(async () => {
  594. const data = await updateOrderStatus(row.userCenterId, {
  595. orderId: row.id,
  596. });
  597. this.$message({
  598. type: "success",
  599. message: "操作成功",
  600. });
  601. this.getData();
  602. });
  603. },
  604. change() {
  605. this.moneyFlag = this.checkList.some((item) => item === "订单金额");
  606. this.stateFlag = this.checkList.some((item) => item === "订单状态");
  607. this.salesmanFlag = this.checkList.some((item) => item === "业务员");
  608. this.remarkFlag = this.checkList.some((item) => item === "备注");
  609. this.storeFlag = this.checkList.some((item) => item === "店铺");
  610. this.codeFlag = this.checkList.some((item) => item === "自提码");
  611. this.timeFlag = this.checkList.some((item) => item === "创建时间");
  612. },
  613. },
  614. };
  615. </script>
  616. <style scoped lang="scss">
  617. .order-table-out {
  618. padding: 14px;
  619. height: calc(100vh - 380px);
  620. overflow-y: auto;
  621. overflow-x: hidden;
  622. border-bottom: 1px solid #ebeef5;
  623. }
  624. .order-table-head th {
  625. text-align: center;
  626. font-size: 13px;
  627. height: 40px;
  628. background-color: #f7f7f7;
  629. }
  630. .order-empty {
  631. height: 14px;
  632. }
  633. .order-time-no {
  634. font-size: 13px;
  635. border: 1px solid #ebeef5;
  636. }
  637. .tbody-view .order-time-no td {
  638. padding: 10px 14px;
  639. }
  640. .order-time-text {
  641. padding-right: 24px;
  642. }
  643. .tbody-view tr td {
  644. padding: 8px 0;
  645. }
  646. .tbody-view .order-detail-tr td {
  647. text-align: center;
  648. font-size: 13px;
  649. border: 1px solid #ebeef5;
  650. }
  651. .tbody-view .order-detail-tr .goods-td {
  652. text-align: left;
  653. padding: 10px 14px;
  654. }
  655. .goods-img {
  656. width: 72px;
  657. height: 72px;
  658. margin-right: 10px;
  659. object-fit: cover;
  660. }
  661. .goods-info .goods-tit {
  662. line-height: 30px;
  663. }
  664. .goods-info .goods-spec {
  665. color: #666;
  666. }
  667. .order-payAmount {
  668. font-weight: 600;
  669. font-size: 16px;
  670. color: #ff4040;
  671. }
  672. .order-info-p {
  673. padding-bottom: 4px;
  674. }
  675. .order-info-label {
  676. color: #888;
  677. }
  678. .tbody-view .table-handel-div {
  679. /*transform: translateX(400px);*/
  680. transition: 0.2s;
  681. opacity: 0;
  682. }
  683. .tbody-view:hover .table-handel-div {
  684. /*transform: translateX(0);*/
  685. opacity: 1;
  686. }
  687. .custom-table-checkbox {
  688. .el-checkbox {
  689. display: block !important;
  690. margin: 0 0 $base-padding/4 0;
  691. }
  692. }
  693. </style>