index.vue 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  1. <template>
  2. <div class="tenant">
  3. <!-- <Banner /> -->
  4. <div class="content">
  5. <byTable
  6. :source="sourceList.data"
  7. :pagination="sourceList.pagination"
  8. :config="config"
  9. :loading="loading"
  10. highlight-current-row
  11. :selectConfig="selectConfig"
  12. :table-events="{
  13. //element talbe事件都能传
  14. select: select,
  15. }"
  16. :action-list="[
  17. {
  18. text: 'Excel导入',
  19. action: () => openExcel(),
  20. disabled: false,
  21. },
  22. {
  23. text: '添加订单',
  24. action: () => openModal('add'),
  25. },
  26. ]"
  27. @get-list="getList"
  28. >
  29. <template #code="{ item }">
  30. <div
  31. style="cursor: pointer; color: #409eff"
  32. @click="handleClickCode(item)"
  33. >
  34. {{ item.code }}
  35. </div>
  36. </template>
  37. <template #address="{ item }">
  38. <div>
  39. {{ item.countryName }}, {{ item.provinceName }} ,
  40. {{ item.cityName }}
  41. </div>
  42. </template>
  43. <template #status="{ item }">
  44. <div
  45. style="cursor: pointer; color: #409eff"
  46. @click="handleClickStatus(item)"
  47. >
  48. {{ dictValueLabel(item.status, outboundType) }}
  49. </div>
  50. </template>
  51. </byTable>
  52. </div>
  53. <el-dialog
  54. :title="modalType == 'add' ? '添加订单' : '调仓接收'"
  55. v-model="dialogVisible"
  56. width="800"
  57. v-loading="loading"
  58. >
  59. <byForm
  60. :formConfig="formConfig"
  61. :formOption="formOption"
  62. v-model="formData.data"
  63. :rules="rules"
  64. ref="byform"
  65. >
  66. <template #distributionCenter>
  67. <div>
  68. <el-autocomplete
  69. v-model="formData.data.distributionCenter"
  70. :fetch-suggestions="querySearchPerson"
  71. clearable
  72. class="inline-input w-50"
  73. placeholder="请输入"
  74. @select="handlePerson"
  75. >
  76. </el-autocomplete>
  77. </div>
  78. </template>
  79. <template #countryId>
  80. <div>
  81. <el-select
  82. v-model="formData.data.countryId"
  83. placeholder="国家"
  84. @change="(val) => getCityData(val, '20', true)"
  85. >
  86. <el-option
  87. v-for="item in countryData"
  88. :label="item.chineseName"
  89. :value="item.id"
  90. >
  91. </el-option>
  92. </el-select>
  93. </div>
  94. </template>
  95. <template #provinceId>
  96. <div>
  97. <selectCity
  98. placeholder="省/洲"
  99. @change="(val) => getCityData(val, '30', true)"
  100. addressId="provinceId"
  101. addressName="provinceName"
  102. v-model="formData.data"
  103. :data="provinceData"
  104. >
  105. </selectCity>
  106. </div>
  107. </template>
  108. <template #cityId>
  109. <div>
  110. <selectCity
  111. placeholder="城市"
  112. addressId="cityId"
  113. addressName="cityName"
  114. v-model="formData.data"
  115. :data="cityData"
  116. >
  117. </selectCity>
  118. </div>
  119. </template>
  120. <template #products>
  121. <div style="width: 100%">
  122. <el-button
  123. type="primary"
  124. @click="openProduct = true"
  125. style="margin-bottom: 10px"
  126. >
  127. 添加物品
  128. </el-button>
  129. <el-table
  130. :data="formData.data.jdOrderDetailsList"
  131. show-summary
  132. :summary-method="getSummaries"
  133. >
  134. <el-table-column prop="productCode" label="产品编码" />
  135. <el-table-column prop="productName" label="产品名称" />
  136. <el-table-column prop="price" label="单价" min-width="150">
  137. <template #default="{ row, $index }">
  138. <el-form-item
  139. :prop="'jdOrderDetailsList.' + $index + '.price'"
  140. :rules="rules.price"
  141. :inline-message="true"
  142. >
  143. <el-input-number
  144. v-model="row.price"
  145. :precision="4"
  146. :controls="false"
  147. :min="0"
  148. @change="totalAmount"
  149. onmousewheel="return false;"
  150. />
  151. </el-form-item>
  152. </template>
  153. </el-table-column>
  154. <el-table-column prop="quantity" label="数量" min-width="150">
  155. <template #default="{ row, $index }">
  156. <el-form-item
  157. :prop="'jdOrderDetailsList.' + $index + '.quantity'"
  158. :rules="rules.quantity"
  159. :inline-message="true"
  160. >
  161. <el-input-number
  162. v-model="row.quantity"
  163. :precision="4"
  164. :controls="false"
  165. :min="0"
  166. @change="totalAmount"
  167. onmousewheel="return false;"
  168. />
  169. </el-form-item>
  170. </template>
  171. </el-table-column>
  172. <el-table-column prop="total" label="小计" />
  173. <el-table-column prop="remark" label="备注" min-width="200">
  174. <template #default="{ row, $index }">
  175. <el-form-item
  176. :prop="'jdOrderDetailsList.' + $index + '.remark'"
  177. :rules="rules.remark"
  178. :inline-message="true"
  179. >
  180. <el-input v-model="row.remark" placeholder="请输入" />
  181. </el-form-item>
  182. </template>
  183. </el-table-column>
  184. <el-table-column
  185. prop="zip"
  186. label="操作"
  187. width="60"
  188. fixed="right"
  189. align="center"
  190. >
  191. <template #default="{ $index }">
  192. <el-button type="primary" link @click="handleRemove($index)"
  193. >删除</el-button
  194. >
  195. </template>
  196. </el-table-column>
  197. </el-table>
  198. </div>
  199. </template>
  200. </byForm>
  201. <template #footer>
  202. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  203. <el-button
  204. type="primary"
  205. @click="submitForm('byform')"
  206. size="large"
  207. :loading="submitLoading"
  208. >
  209. 确 定
  210. </el-button>
  211. </template>
  212. </el-dialog>
  213. <el-dialog
  214. v-model="openProduct"
  215. title="选择产品"
  216. width="70%"
  217. append-to-body
  218. >
  219. <SelectProduct @handleSelect="handleSelect"></SelectProduct>
  220. <template #footer>
  221. <span class="dialog-footer">
  222. <el-button @click="openProduct = false">取消</el-button>
  223. </span>
  224. </template>
  225. </el-dialog>
  226. <el-dialog
  227. v-model="openDetails"
  228. title="订单详情"
  229. width="40%"
  230. append-to-body
  231. >
  232. <OrderDetails
  233. :orderData="formData.orderData"
  234. :key="formData.orderData.id"
  235. ></OrderDetails>
  236. <template #footer>
  237. <span class="dialog-footer">
  238. <el-button @click="openDetails = false">取消</el-button>
  239. </span>
  240. </template>
  241. </el-dialog>
  242. <el-dialog
  243. title="Excel导入"
  244. v-model="openExcelDialog"
  245. width="400"
  246. v-loading="excelLoading"
  247. >
  248. <div style="margin-bottom: 10px">导入前请先选择客户</div>
  249. <el-select v-model="importData.customerId" placeholder="请选择客户">
  250. <el-option
  251. v-for="item in warehouseList"
  252. :key="item.id"
  253. :label="item.name"
  254. :value="item.id"
  255. />
  256. </el-select>
  257. <div style="margin-top: 20px" v-show="importData.customerId">
  258. <div style="margin-bottom: 10px">上传附件</div>
  259. <el-upload
  260. :action="actionUrl + '/jdOrder/excelImport'"
  261. :data="importData"
  262. :headers="headers"
  263. :before-upload="useImportExcelStore().updateRequestHeaders"
  264. :on-success="handleSuccess"
  265. :on-progress="handleProgress"
  266. :show-file-list="false"
  267. :on-error="handleError"
  268. accept=".xls, .xlsx"
  269. >
  270. <el-button type="primary">选择</el-button>
  271. </el-upload>
  272. </div>
  273. <template #footer>
  274. <el-button @click="openExcelDialog = false">取 消</el-button>
  275. </template>
  276. </el-dialog>
  277. <el-dialog
  278. :title="'查看'"
  279. v-model="recordDialog"
  280. width="900"
  281. destroy-on-close
  282. >
  283. <byForm
  284. :formConfig="recordFormConfig"
  285. :formOption="recordFormOption"
  286. v-model="recordFormData.data"
  287. >
  288. <template #products>
  289. <div style="width: 100%">
  290. <el-table :data="recordFormData.data.list">
  291. <el-table-column
  292. prop="logisticsCompanyName"
  293. label="物流/快递公司"
  294. />
  295. <el-table-column prop="code" label="物流/快递单号" />
  296. <el-table-column
  297. prop="logisticsStatus"
  298. label="物流状态"
  299. width="100"
  300. :formatter="(row) => handleShowKdStatus(row.logisticsStatus)"
  301. />
  302. <el-table-column prop="createTime" label="创建时间" width="155" />
  303. <el-table-column label="操作" width="90" align="center">
  304. <template #default="{ row, $index }">
  305. <el-button type="primary" text @click="pushKdRoute(row)"
  306. >查看</el-button
  307. >
  308. </template>
  309. </el-table-column>
  310. </el-table>
  311. </div>
  312. </template>
  313. </byForm>
  314. <template #footer>
  315. <el-button @click="recordDialog = false" size="large">取 消</el-button>
  316. </template>
  317. </el-dialog>
  318. </div>
  319. </template>
  320. <script setup>
  321. /* eslint-disable vue/no-unused-components */
  322. import { ElMessage, ElMessageBox } from "element-plus";
  323. import byTable from "@/components/byTable/index";
  324. import byForm from "@/components/byForm/index";
  325. import { computed, defineComponent, ref } from "vue";
  326. import useUserStore from "@/store/modules/user";
  327. import SelectProduct from "@/components/WDLY/product/SelectProduct";
  328. import OrderDetails from "@/components/WDLY/order/details";
  329. import selectCity from "@/components/selectCity/index.vue";
  330. import { getToken } from "@/utils/auth";
  331. import useImportExcelStore from "@/store/modules/importExcel";
  332. const headers = computed(() => useImportExcelStore().requestHeaders);
  333. const actionUrl = import.meta.env.VITE_APP_BASE_API;
  334. const loading = ref(false);
  335. const submitLoading = ref(false);
  336. const sourceList = ref({
  337. data: [],
  338. pagination: {
  339. total: 3,
  340. pageNum: 1,
  341. pageSize: 10,
  342. },
  343. });
  344. let dialogVisible = ref(false);
  345. let openProduct = ref(false);
  346. let openDetails = ref(false);
  347. const importData = reactive({});
  348. let roomDialogVisible = ref(false);
  349. let excelLoading = ref(false);
  350. let modalType = ref("add");
  351. let rules = ref({
  352. customerId: [
  353. {
  354. required: true,
  355. message: "请选择客户",
  356. trigger: "change",
  357. },
  358. ],
  359. type: [
  360. {
  361. required: true,
  362. message: "请选择订单类型",
  363. trigger: "change",
  364. },
  365. ],
  366. countryId: [
  367. {
  368. required: true,
  369. message: "请选择国家",
  370. trigger: "change",
  371. },
  372. ],
  373. // provinceId: [
  374. // {
  375. // required: true,
  376. // message: "请选择省/洲",
  377. // trigger: "change",
  378. // },
  379. // ],
  380. // cityId: [
  381. // {
  382. // required: true,
  383. // message: "请选择城市",
  384. // trigger: "change",
  385. // },
  386. // ],
  387. code: [
  388. {
  389. required: true,
  390. message: "请输入订单编号",
  391. trigger: "blur",
  392. },
  393. ],
  394. contactPerson: [
  395. {
  396. required: true,
  397. message: "请输入收货负责人",
  398. trigger: "blur",
  399. },
  400. ],
  401. contactNumber: [
  402. {
  403. required: true,
  404. message: "请输入收货电话",
  405. trigger: "blur",
  406. },
  407. ],
  408. detailedAddress: [
  409. {
  410. required: true,
  411. message: "请输入详细地址",
  412. trigger: "blur",
  413. },
  414. ],
  415. price: [
  416. {
  417. required: true,
  418. message: "请输入单价",
  419. trigger: "blur",
  420. },
  421. ],
  422. quantity: [
  423. {
  424. required: true,
  425. message: "请输入数量",
  426. trigger: "blur",
  427. },
  428. ],
  429. distributionCenter: [
  430. {
  431. required: true,
  432. message: "请输入/选择配送中心",
  433. trigger: "blur",
  434. },
  435. ],
  436. });
  437. const { proxy } = getCurrentInstance();
  438. const outboundType = ref([
  439. {
  440. label: "未出库",
  441. value: "1",
  442. },
  443. {
  444. label: "部分出库",
  445. value: "2",
  446. },
  447. {
  448. label: "已出库",
  449. value: "3",
  450. },
  451. ]);
  452. const selectConfig = reactive([
  453. {
  454. label: "入库状态",
  455. prop: "status",
  456. data: outboundType.value,
  457. },
  458. ]);
  459. const config = computed(() => {
  460. return [
  461. {
  462. attrs: {
  463. label: "订单编号",
  464. prop: "code",
  465. },
  466. },
  467. {
  468. attrs: {
  469. label: "客户名称",
  470. prop: "customerName",
  471. },
  472. },
  473. {
  474. attrs: {
  475. label: "配送中心",
  476. prop: "distributionCenter",
  477. },
  478. },
  479. {
  480. attrs: {
  481. label: "所在城市",
  482. prop: "address",
  483. slot: "address",
  484. },
  485. },
  486. {
  487. attrs: {
  488. label: "详细地址",
  489. prop: "detailedAddress",
  490. },
  491. },
  492. {
  493. attrs: {
  494. label: "收货负责人",
  495. prop: "contactPerson",
  496. },
  497. },
  498. {
  499. attrs: {
  500. label: "收货电话",
  501. prop: "contactNumber",
  502. },
  503. },
  504. {
  505. attrs: {
  506. label: "订单金额",
  507. prop: "amount",
  508. },
  509. render(amount) {
  510. return proxy.moneyFormat(amount, 2);
  511. },
  512. },
  513. {
  514. attrs: {
  515. label: "出库状态",
  516. prop: "status",
  517. slot: "status",
  518. },
  519. },
  520. ];
  521. });
  522. let formData = reactive({
  523. data: {},
  524. treeData: [],
  525. orderData: {},
  526. });
  527. const formOption = reactive({
  528. inline: true,
  529. labelWidth: 100,
  530. itemWidth: 100,
  531. rules: [],
  532. });
  533. const byform = ref(null);
  534. const treeData = ref([]);
  535. const formConfig = reactive([
  536. {
  537. type: "title",
  538. title: "基础信息",
  539. },
  540. {
  541. type: "select",
  542. prop: "customerId",
  543. label: "客户名称",
  544. isLoad: {
  545. url: "/customer/page",
  546. req: {
  547. pageNum: 1,
  548. pageSize: 9999,
  549. },
  550. labelKey: "name",
  551. labelVal: "id",
  552. method: "post",
  553. resUrl: "rows",
  554. },
  555. itemWidth: 30,
  556. },
  557. {
  558. type: "input",
  559. prop: "code",
  560. label: "订单编号",
  561. itemWidth: 20,
  562. },
  563. {
  564. type: "slot",
  565. prop: "distributionCenter",
  566. label: "配送中心",
  567. slotName: "distributionCenter",
  568. },
  569. {
  570. type: "input",
  571. prop: "contactPerson",
  572. label: "收货信息",
  573. itemWidth: 20,
  574. placeholder: "收货负责人",
  575. },
  576. {
  577. type: "input",
  578. prop: "contactNumber",
  579. label: " ",
  580. itemWidth: 80,
  581. placeholder: "收货电话",
  582. style: {
  583. width: "30%",
  584. },
  585. },
  586. {
  587. type: "slot",
  588. slotName: "countryId",
  589. prop: "countryId",
  590. label: "详细地址",
  591. itemWidth: 33.33,
  592. },
  593. {
  594. type: "slot",
  595. slotName: "provinceId",
  596. label: " ",
  597. itemWidth: 33.33,
  598. },
  599. {
  600. type: "slot",
  601. slotName: "cityId",
  602. prop: "cityId",
  603. label: " ",
  604. itemWidth: 33.33,
  605. },
  606. {
  607. type: "input",
  608. itemType: "textarea",
  609. prop: "detailedAddress",
  610. },
  611. {
  612. type: "title",
  613. title: "订单明细",
  614. },
  615. {
  616. type: "slot",
  617. slotName: "products",
  618. },
  619. {
  620. type: "input",
  621. prop: "amountMoney",
  622. label: "订单金额",
  623. disabled: true,
  624. itemWidth: 20,
  625. },
  626. ]);
  627. const getList = async (req) => {
  628. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  629. loading.value = true;
  630. proxy.post("/jdOrder/page", sourceList.value.pagination).then((message) => {
  631. console.log(message);
  632. sourceList.value.data = message.rows;
  633. sourceList.value.pagination.total = message.total;
  634. setTimeout(() => {
  635. loading.value = false;
  636. }, 200);
  637. });
  638. };
  639. const openModal = () => {
  640. dialogVisible.value = true;
  641. modalType.value = "add";
  642. formData.data = {
  643. jdOrderDetailsList: [],
  644. countryId: "44",
  645. };
  646. getCityData(formData.data.countryId, "20");
  647. };
  648. const submitForm = () => {
  649. console.log(byform.value);
  650. byform.value.handleSubmit((valid) => {
  651. const list = formData.data.jdOrderDetailsList;
  652. if (!list.length > 0)
  653. return ElMessage({
  654. message: `请添加订单明细!`,
  655. type: "info",
  656. });
  657. for (let i = 0; i < list.length; i++) {
  658. const e = list[i];
  659. if (e.quantity == 0) {
  660. return ElMessage({
  661. message: `数量不能为0!`,
  662. type: "info",
  663. });
  664. }
  665. }
  666. submitLoading.value = true;
  667. proxy.post("/jdOrder/" + modalType.value, formData.data).then(
  668. (res) => {
  669. ElMessage({
  670. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  671. type: "success",
  672. });
  673. dialogVisible.value = false;
  674. submitLoading.value = false;
  675. getList();
  676. },
  677. (err) => (submitLoading.value = false)
  678. );
  679. });
  680. };
  681. const getDtl = (row, status) => {
  682. const statusNmae = status == 2 ? "结束" : "取消";
  683. // 弹窗提示是否删除
  684. ElMessageBox.confirm(`您确定执行${statusNmae}操作吗?`, "提示", {
  685. confirmButtonText: "确定",
  686. cancelButtonText: "取消",
  687. type: "warning",
  688. }).then(() => {
  689. // 删除
  690. proxy
  691. .post("/orderInfo/edit", {
  692. id: row.id,
  693. status,
  694. })
  695. .then((res) => {
  696. ElMessage({
  697. message: "操作成功",
  698. type: "success",
  699. });
  700. getList();
  701. });
  702. });
  703. };
  704. const warehouseList = ref([]);
  705. const salesType = ref([]);
  706. const getDict = () => {
  707. proxy.getDict(["order_sales_type"]).then((res) => {
  708. salesType.value = res["order_sales_type"];
  709. formConfig[1].data = salesType.value.map((x) => ({
  710. label: x.dictValue,
  711. value: x.dictKey,
  712. }));
  713. });
  714. };
  715. const countryData = ref([]);
  716. const provinceData = ref([]);
  717. const cityData = ref([]);
  718. const getCityData = (id, type, flag) => {
  719. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  720. if (type === "20") {
  721. provinceData.value = res;
  722. if (flag) {
  723. formData.data.provinceId = "";
  724. formData.data.provinceName = "";
  725. formData.data.cityId = "";
  726. formData.data.cityName = "";
  727. }
  728. } else if (type === "30") {
  729. cityData.value = res;
  730. if (flag) {
  731. formData.data.cityId = "";
  732. formData.data.cityName = "";
  733. }
  734. } else {
  735. countryData.value = res;
  736. }
  737. });
  738. };
  739. getCityData("0");
  740. getList();
  741. // getDict();
  742. const totalAmount = () => {
  743. let sum = 0;
  744. for (let i = 0; i < formData.data.jdOrderDetailsList.length; i++) {
  745. const e = formData.data.jdOrderDetailsList[i];
  746. e.total = (e.price * 1000000 * e.quantity) / 1000000;
  747. sum += e.total;
  748. }
  749. formData.data.amountMoney = sum;
  750. };
  751. const handleSelect = (row) => {
  752. const flag = formData.data.jdOrderDetailsList.some(
  753. (x) => x.productId === row.id
  754. );
  755. if (flag)
  756. return ElMessage({
  757. message: "该物品已选择",
  758. type: "info",
  759. });
  760. formData.data.jdOrderDetailsList.push({
  761. productName: row.name,
  762. productCode: row.code,
  763. productId: row.id,
  764. total: "",
  765. quantity: null,
  766. price: null,
  767. remark: "",
  768. });
  769. return ElMessage({
  770. message: "选择成功",
  771. type: "success",
  772. });
  773. };
  774. const handleRemove = (index) => {
  775. formData.data.jdOrderDetailsList.splice(index, 1);
  776. totalAmount();
  777. return ElMessage({
  778. message: "删除成功",
  779. type: "success",
  780. });
  781. };
  782. const handleClickCode = (row) => {
  783. formData.orderData = row;
  784. openDetails.value = true;
  785. };
  786. const openExcelDialog = ref(false);
  787. const openExcel = () => {
  788. importData.customerId = "";
  789. openExcelDialog.value = true;
  790. };
  791. const handleProgress = () => {
  792. excelLoading.value = true;
  793. };
  794. const handleError = (err) => {
  795. ElMessage({
  796. message: `${err},请重试!`,
  797. type: "info",
  798. });
  799. openExcelDialog.value = false;
  800. excelLoading.value = false;
  801. };
  802. const handleSuccess = (res) => {
  803. if (res.code != 200) {
  804. return ElMessage({
  805. message: `${res.msg},请重试!`,
  806. type: "info",
  807. });
  808. } else {
  809. ElMessage({
  810. message: "导入成功!",
  811. type: "success",
  812. });
  813. openExcelDialog.value = false;
  814. excelLoading.value = false;
  815. getList();
  816. }
  817. };
  818. const createFilter = (queryString) => {
  819. return (restaurant) => {
  820. return (
  821. restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
  822. );
  823. };
  824. };
  825. const distributionCenterData = ref([]);
  826. const querySearchPerson = (queryString, callback) => {
  827. const results = queryString
  828. ? distributionCenterData.value.filter(createFilter(queryString))
  829. : distributionCenterData.value;
  830. callback(results);
  831. };
  832. const handlePerson = (item) => {
  833. formData.data.buyContactNumber = item.phone;
  834. };
  835. const getDistributionCenter = () => {
  836. proxy.post("/jdOrder/getDistributionCenter").then(
  837. (res) => {
  838. distributionCenterData.value = res.map((x) => ({
  839. label: x,
  840. value: x,
  841. }));
  842. },
  843. (err) => {
  844. console.log(err);
  845. }
  846. );
  847. proxy.post("/customer/page", { pageNum: 1, pageSize: 9999 }).then(
  848. (res) => {
  849. warehouseList.value = res.rows;
  850. },
  851. (err) => {
  852. console.log(err);
  853. }
  854. );
  855. };
  856. getDistributionCenter();
  857. const kdStatusData = ref([
  858. {
  859. label: "在途",
  860. value: "0",
  861. },
  862. {
  863. label: "揽收",
  864. value: "1",
  865. },
  866. {
  867. label: "疑难",
  868. value: "2",
  869. },
  870. {
  871. label: "签收",
  872. value: "3",
  873. },
  874. {
  875. label: "退签",
  876. value: "4",
  877. },
  878. {
  879. label: "派件",
  880. value: "5",
  881. },
  882. {
  883. label: "退回",
  884. value: "6",
  885. },
  886. {
  887. label: "转投",
  888. value: "7",
  889. },
  890. {
  891. label: "清关",
  892. value: "8",
  893. },
  894. {
  895. label: "拒签",
  896. value: "14",
  897. },
  898. {
  899. label: "完成",
  900. value: "15",
  901. },
  902. ]);
  903. const recordDialog = ref(false);
  904. const recordFormOption = reactive({
  905. disabled: false,
  906. inline: true,
  907. labelWidth: 100,
  908. itemWidth: 100,
  909. rules: [],
  910. });
  911. const recordFormConfig = reactive([
  912. {
  913. type: "title",
  914. title: "物流数据",
  915. },
  916. {
  917. type: "slot",
  918. slotName: "products",
  919. },
  920. ]);
  921. const recordFormData = reactive({
  922. data: {
  923. list: [],
  924. },
  925. });
  926. const handleClickStatus = (row) => {
  927. recordDialog.value = true;
  928. proxy.post("/jdOrder/getLogisticsInfo", { id: row.id }).then((res) => {
  929. recordFormData.data.list = res;
  930. });
  931. };
  932. const handleShowKdStatus = (status) => {
  933. const current = kdStatusData.value.find((x) => x.value === status);
  934. if (current && current.label) {
  935. return current.label;
  936. } else {
  937. return "异常";
  938. }
  939. };
  940. const pushKdRoute = (row) => {
  941. proxy.$router.push({
  942. name: "Logistics",
  943. query: {
  944. keyword: row.code,
  945. },
  946. });
  947. };
  948. const getSummaries = (param) => {
  949. const { columns, data } = param; //columns是每列的信息,data是每行的信息
  950. const sums = [];
  951. columns.forEach((column, index) => {
  952. if (index === 0) {
  953. sums[index] = "合计"; //此处是在index=0的这一列显示为“合计”
  954. return;
  955. }
  956. const values = data.map((item) => Number(item[column.property]));
  957. if (column.property === "quantity" || column.property === "total") {
  958. sums[index] = values.reduce((prev, curr) => {
  959. const value = Number(curr);
  960. if (!isNaN(value)) {
  961. return Number(parseFloat(prev + curr).toFixed(4));
  962. } else {
  963. return prev;
  964. }
  965. }, 0);
  966. sums[index];
  967. }
  968. });
  969. return sums;
  970. };
  971. </script>
  972. <style lang="scss" scoped>
  973. .tenant {
  974. padding: 20px;
  975. }
  976. </style>