index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  1. <template>
  2. <div>
  3. <el-card :class="props.selectStatus ? 'select-card' : 'box-card'">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :searchConfig="searchConfig"
  10. highlight-current-row
  11. :action-list="[
  12. props.selectStatus
  13. ? {}
  14. : {
  15. text: '操作日志',
  16. action: () => viewLogs(),
  17. },
  18. props.selectStatus
  19. ? {}
  20. : {
  21. text: '复制E10单号',
  22. action: () => clickCopyWLNCode(),
  23. },
  24. props.selectStatus
  25. ? {}
  26. : {
  27. text: '同步订单',
  28. action: () => clickSynchronousOrder(),
  29. loading: btnLoading,
  30. },
  31. ]"
  32. @get-list="getList"
  33. @clickReset="clickReset">
  34. <template #code="{ item }">
  35. <div>
  36. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  37. </div>
  38. </template>
  39. <template #totalAmount="{ item }">
  40. <div style="color: #409eff">{{ moneyFormat(item.totalAmount) }}</div>
  41. </template>
  42. <template #address="{ item }">
  43. <div>{{ item.province }}, {{ item.city }}, {{ item.county }}, {{ item.detailedAddress }}</div>
  44. </template>
  45. </byTable>
  46. </el-card>
  47. <el-dialog title="操作日志" v-if="openLogs" v-model="openLogs" width="50%">
  48. <byTable
  49. :source="logsList.data"
  50. :pagination="logsList.pagination"
  51. :config="configLogs"
  52. :loading="loadingLogs"
  53. highlight-current-row
  54. @get-list="getLogsList">
  55. </byTable>
  56. <template #footer>
  57. <el-button @click="openLogs = false" size="large">关 闭</el-button>
  58. </template>
  59. </el-dialog>
  60. <el-dialog title="售后类型" v-if="openAfterSale" v-model="openAfterSale" width="300px" style="margin-top: 20vh !important">
  61. <template #footer>
  62. <el-button type="primary" @click="applyForAfterSale(1)" size="large" v-preReClick>退 货</el-button>
  63. <el-button @click="applyForAfterSale(2)" size="large" v-preReClick>换 货</el-button>
  64. </template>
  65. </el-dialog>
  66. <el-dialog title="送货单" v-if="openDeliveryNote" v-model="openDeliveryNote" width="1000px">
  67. <DeliveryNote :rowData="rowData" @clickCancel="clickCancel"></DeliveryNote>
  68. </el-dialog>
  69. <el-dialog title="删除并退料入库" v-if="openDelete" v-model="openDelete" width="1000px">
  70. <div v-loading="loadingDelete">
  71. <el-table :data="deleteList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
  72. <el-table-column label="BOM品号" prop="bomSpecCode" width="140" />
  73. <el-table-column label="BOM品名" prop="bomSpecName" min-width="220" />
  74. <el-table-column label="仓库名称" prop="warehouseName" width="100" />
  75. <el-table-column label="出库数量" prop="outQuantity" width="100" />
  76. </el-table>
  77. </div>
  78. <template #footer>
  79. <el-button @click="openDelete = false" size="large" v-preReClick>取 消</el-button>
  80. <el-button type="primary" @click="submitDelete()" size="large" v-preReClick>确认删除</el-button>
  81. </template>
  82. </el-dialog>
  83. <el-dialog title="产品包装配置" v-if="openShippingPackage" v-model="openShippingPackage" width="80%" :close-on-press-escape="false" :show-close="false">
  84. <div style="height: calc(100vh - 184px); overflow-y: auto; overflow-x: hidden" v-loading="loadingPackage">
  85. <el-form :model="formData.data" :rules="rulesShippingPackage" ref="shippingPackage">
  86. <div style="font-weight: 700; margin: 20px 0 10px 0">发货包装</div>
  87. <div style="margin-bottom: 10px">
  88. <el-button type="primary" size="small" @click="clickExpressPacking()">选择快递物流包材</el-button>
  89. </div>
  90. <el-table :data="formData.data.orderPackageBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
  91. <el-table-column label="品号" prop="code" width="160" />
  92. <el-table-column label="品名" prop="name" min-width="220" />
  93. <el-table-column label="销售单价" prop="internalSellingPrice" width="100" />
  94. <el-table-column label="数量" width="120">
  95. <template #default="{ row, $index }">
  96. <div class="shippingPackage">
  97. <el-form-item
  98. :prop="'orderPackageBomList.' + $index + '.quantity'"
  99. :rules="rulesShippingPackage.quantity"
  100. :inline-message="true"
  101. style="width: 100%">
  102. <el-input-number
  103. onmousewheel="return false;"
  104. v-model="row.quantity"
  105. placeholder="修正数量"
  106. style="width: 100%"
  107. :controls="false"
  108. :min="0"
  109. :precision="0" />
  110. </el-form-item>
  111. </div>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="销售小计" width="120">
  115. <template #default="{ row }">
  116. {{ moneyFormat(computePackagingMoney(row, "internalSellingPrice"), 2) }}
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="操作" align="center" fixed="right" width="80">
  120. <template #default="{ $index }">
  121. <el-button type="danger" @click="clickPackagingDelete($index)" text>删除</el-button>
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. <div style="font-weight: 700; margin: 20px 0 10px 0">外箱不干胶图稿</div>
  126. <div style="display: flex; width: 100%">
  127. <div style="width: 80px; line-height: 32px">不干胶图片:</div>
  128. <div style="width: calc(100% - 80px)">
  129. <el-image
  130. fit="scale-down"
  131. style="width: 148px; height: 148px; margin-right: 10px; cursor: pointer"
  132. v-if="formData.data.outerBoxSelfAdhesiveStickerFile && formData.data.outerBoxSelfAdhesiveStickerFile.fileUrl"
  133. :src="formData.data.outerBoxSelfAdhesiveStickerFile.fileUrl"
  134. @click="openFile(formData.data.outerBoxSelfAdhesiveStickerFile.fileUrl)" />
  135. <div style="display: flex">
  136. <el-upload
  137. :show-file-list="false"
  138. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  139. :data="uploadAdhesiveData"
  140. :before-upload="uploadAdhesiveFile"
  141. :on-success="
  142. (response, uploadFile) => {
  143. return handleAdhesivePackagingSuccess(uploadFile);
  144. }
  145. "
  146. style="width: 100%">
  147. <el-button type="primary" text>上传文件</el-button>
  148. </el-upload>
  149. </div>
  150. </div>
  151. </div>
  152. </el-form>
  153. </div>
  154. <template #footer>
  155. <el-button @click="openShippingPackage = false" v-preReClick>取 消</el-button>
  156. <el-button type="primary" @click="clickSaveShippingPackage" v-preReClick>提 交</el-button>
  157. </template>
  158. </el-dialog>
  159. <el-dialog title="选择快递包装" v-if="openExpressPacking" v-model="openExpressPacking" width="90%">
  160. <SelectBOM :selectStatus="true" :expressStatus="true" @selectBOM="selectExpressPacking"></SelectBOM>
  161. <template #footer>
  162. <el-button @click="openExpressPacking = false">关 闭</el-button>
  163. </template>
  164. </el-dialog>
  165. </div>
  166. </template>
  167. <script setup>
  168. import byTable from "/src/components/byTable/index";
  169. import { ElMessage, ElMessageBox } from "element-plus";
  170. import { copyText } from "vue3-clipboard";
  171. import DeliveryNote from "/src/components/order/deliveryNote/index";
  172. import SelectBOM from "/src/views/group/BOM/management/index";
  173. const { proxy } = getCurrentInstance();
  174. const props = defineProps({
  175. selectStatus: Boolean,
  176. departmentId: String,
  177. });
  178. const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
  179. const sourceList = ref({
  180. data: [],
  181. pagination: {
  182. total: 0,
  183. pageNum: 1,
  184. pageSize: 10,
  185. departmentId: "",
  186. code: "",
  187. wlnCode: "",
  188. status: "",
  189. settlementStatus: "",
  190. exception: "0",
  191. },
  192. });
  193. const loading = ref(false);
  194. const searchConfig = computed(() => {
  195. return [
  196. {
  197. type: "input",
  198. prop: "code",
  199. label: "订单号",
  200. },
  201. {
  202. type: "input",
  203. prop: "wlnCode",
  204. label: "E10单号",
  205. },
  206. props.departmentId
  207. ? {}
  208. : {
  209. type: "select",
  210. prop: "departmentId",
  211. data: departmentList.value,
  212. label: "事业部",
  213. },
  214. props.departmentId
  215. ? {}
  216. : {
  217. type: "select",
  218. prop: "status",
  219. dictKey: "order_status",
  220. label: "订单状态",
  221. },
  222. {
  223. type: "select",
  224. prop: "settlementStatus",
  225. label: "结算状态",
  226. data: proxy.useUserStore().allDict["settlement_status"],
  227. },
  228. ];
  229. });
  230. const config = computed(() => {
  231. return [
  232. {
  233. attrs: {
  234. label: "事业部",
  235. prop: "departmentName",
  236. width: 120,
  237. },
  238. },
  239. {
  240. attrs: {
  241. label: "订单号",
  242. slot: "code",
  243. width: 200,
  244. },
  245. },
  246. {
  247. attrs: {
  248. label: "E10单号",
  249. prop: "wlnCode",
  250. width: 160,
  251. },
  252. },
  253. {
  254. attrs: {
  255. label: "快递单号",
  256. prop: "expressDeliveryCode",
  257. width: 140,
  258. },
  259. },
  260. {
  261. attrs: {
  262. label: "订单状态",
  263. prop: "status",
  264. width: 120,
  265. },
  266. render(val) {
  267. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
  268. },
  269. },
  270. {
  271. attrs: {
  272. label: "结算状态",
  273. prop: "settlementStatus",
  274. width: 120,
  275. },
  276. render(val) {
  277. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_status"]);
  278. },
  279. },
  280. {
  281. attrs: {
  282. label: "税率",
  283. prop: "taxRate",
  284. width: 80,
  285. },
  286. render(val) {
  287. return val + "%";
  288. },
  289. },
  290. {
  291. attrs: {
  292. label: "订单总金额 ¥",
  293. slot: "totalAmount",
  294. width: 120,
  295. align: "right",
  296. },
  297. },
  298. {
  299. attrs: {
  300. label: "产品总金额 ¥",
  301. prop: "productTotalAmount",
  302. width: 120,
  303. align: "right",
  304. },
  305. render(val) {
  306. return proxy.moneyFormat(val);
  307. },
  308. },
  309. {
  310. attrs: {
  311. label: "定制加工费 ¥",
  312. prop: "customProcessingFee",
  313. width: 120,
  314. align: "right",
  315. },
  316. render(val) {
  317. return proxy.moneyFormat(val);
  318. },
  319. },
  320. {
  321. attrs: {
  322. label: "代发费 ¥",
  323. prop: "lssueFee",
  324. width: 120,
  325. align: "right",
  326. },
  327. render(val) {
  328. return proxy.moneyFormat(val);
  329. },
  330. },
  331. {
  332. attrs: {
  333. label: "快递包材费 ¥",
  334. prop: "deliveryMaterialsFee",
  335. width: 120,
  336. align: "right",
  337. },
  338. render(val) {
  339. return proxy.moneyFormat(val);
  340. },
  341. },
  342. {
  343. attrs: {
  344. label: "包装人工费 ¥",
  345. prop: "packingLabor",
  346. width: 120,
  347. align: "right",
  348. },
  349. render(val) {
  350. return proxy.moneyFormat(val);
  351. },
  352. },
  353. {
  354. attrs: {
  355. label: "包材费 ¥",
  356. prop: "packagingMaterialCost",
  357. width: 120,
  358. align: "right",
  359. },
  360. render(val) {
  361. return proxy.moneyFormat(val);
  362. },
  363. },
  364. {
  365. attrs: {
  366. label: "管理费 ¥",
  367. prop: "managementFee",
  368. width: 120,
  369. align: "right",
  370. },
  371. render(val) {
  372. return proxy.moneyFormat(val);
  373. },
  374. },
  375. {
  376. attrs: {
  377. label: "交期",
  378. prop: "deliveryTime",
  379. width: 160,
  380. align: "center",
  381. },
  382. },
  383. {
  384. attrs: {
  385. label: "发货时间",
  386. prop: "shippingTime",
  387. width: 160,
  388. align: "center",
  389. },
  390. },
  391. {
  392. attrs: {
  393. label: "收货人",
  394. prop: "consignee",
  395. width: 140,
  396. },
  397. },
  398. {
  399. attrs: {
  400. label: "收货人电话",
  401. prop: "consigneeNumber",
  402. width: 140,
  403. },
  404. },
  405. {
  406. attrs: {
  407. label: "收货人地址",
  408. slot: "address",
  409. width: 400,
  410. },
  411. },
  412. {
  413. attrs: {
  414. label: "操作",
  415. width: 240,
  416. align: "center",
  417. fixed: "right",
  418. },
  419. renderHTML(row) {
  420. return [
  421. {
  422. attrs: {
  423. label: "修改包装配置",
  424. type: "primary",
  425. text: true,
  426. },
  427. el: "button",
  428. click() {
  429. clickChangePackaging(row);
  430. },
  431. },
  432. props.selectStatus
  433. ? {
  434. attrs: {
  435. label: "选择",
  436. type: "primary",
  437. text: true,
  438. },
  439. el: "button",
  440. click() {
  441. clickSelect(row);
  442. },
  443. }
  444. : [40, 50].includes(row.status)
  445. ? {
  446. attrs: {
  447. label: "售后",
  448. type: "primary",
  449. text: true,
  450. },
  451. el: "button",
  452. click() {
  453. clickAfterSale(row);
  454. },
  455. }
  456. : {},
  457. !props.selectStatus && row.type === 1 && row.status == 40
  458. ? {
  459. attrs: {
  460. label: "送货单",
  461. type: "primary",
  462. text: true,
  463. },
  464. el: "button",
  465. click() {
  466. clickDeliveryNote(row);
  467. },
  468. }
  469. : {},
  470. !props.selectStatus && row.status == 20
  471. ? {
  472. attrs: {
  473. label: "挂起",
  474. type: "primary",
  475. text: true,
  476. },
  477. el: "button",
  478. click() {
  479. clickHangUp(row);
  480. },
  481. }
  482. : {},
  483. !props.selectStatus && row.status == 60
  484. ? {
  485. attrs: {
  486. label: "取消挂起",
  487. type: "primary",
  488. text: true,
  489. },
  490. el: "button",
  491. click() {
  492. clickCancelHangUp(row);
  493. },
  494. }
  495. : {},
  496. !props.selectStatus && [0, 10, 20].includes(row.status) && proxy.useUserStore().user.userId === "1"
  497. ? {
  498. attrs: {
  499. label: "删除",
  500. type: "danger",
  501. text: true,
  502. },
  503. el: "button",
  504. click() {
  505. clickDelete(row);
  506. },
  507. }
  508. : {},
  509. !props.selectStatus && [30, 40].includes(row.status) && proxy.useUserStore().user.userId === "1"
  510. ? {
  511. attrs: {
  512. label: "删除",
  513. type: "danger",
  514. text: true,
  515. },
  516. el: "button",
  517. click() {
  518. clickDeleteTwo(row);
  519. },
  520. }
  521. : {},
  522. ];
  523. },
  524. },
  525. ];
  526. });
  527. const getDemandData = () => {
  528. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  529. if (res.rows && res.rows.length > 0) {
  530. departmentList.value = departmentList.value.concat(
  531. res.rows.map((item) => {
  532. return {
  533. dictKey: item.id,
  534. dictValue: item.name,
  535. };
  536. })
  537. );
  538. }
  539. });
  540. };
  541. getDemandData();
  542. const getList = async (req, status) => {
  543. if (status) {
  544. sourceList.value.pagination = {
  545. pageNum: sourceList.value.pagination.pageNum,
  546. pageSize: sourceList.value.pagination.pageSize,
  547. exception: "0",
  548. };
  549. } else {
  550. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  551. }
  552. if (props.selectStatus) {
  553. sourceList.value.pagination.linkedStatementOfAccount = 0;
  554. }
  555. if (props.departmentId) {
  556. sourceList.value.pagination.departmentId = props.departmentId;
  557. }
  558. loading.value = true;
  559. proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
  560. sourceList.value.data = res.rows;
  561. sourceList.value.pagination.total = res.total;
  562. setTimeout(() => {
  563. loading.value = false;
  564. }, 200);
  565. });
  566. };
  567. getList();
  568. const clickReset = () => {
  569. getList("", true);
  570. };
  571. const clickCode = (row) => {
  572. proxy.$router.replace({
  573. path: "/order-detail",
  574. query: {
  575. detailId: row.id,
  576. text: "订单详情",
  577. random: proxy.random(),
  578. },
  579. });
  580. };
  581. const clickDelete = (row) => {
  582. ElMessageBox.confirm("你是否确认此操作", "提示", {
  583. confirmButtonText: "确定",
  584. cancelButtonText: "取消",
  585. type: "warning",
  586. })
  587. .then(() => {
  588. proxy.post("/orderInfo/delete", { id: row.id }).then(() => {
  589. ElMessage({ message: "删除成功", type: "success" });
  590. getList();
  591. });
  592. })
  593. .catch(() => {});
  594. };
  595. const openDelete = ref(false);
  596. const loadingDelete = ref(false);
  597. const deleteList = ref([]);
  598. const deleteRow = ref({});
  599. const clickDeleteTwo = (row) => {
  600. deleteList.value = [];
  601. loadingDelete.value = true;
  602. openDelete.value = true;
  603. deleteRow.value = row;
  604. proxy.post("/orderInfo/returnBomList", { id: row.id }).then((res) => {
  605. deleteList.value = res;
  606. loadingDelete.value = false;
  607. });
  608. };
  609. const submitDelete = () => {
  610. ElMessageBox.confirm("你是否确认此操作", "提示", {
  611. confirmButtonText: "确定",
  612. cancelButtonText: "取消",
  613. type: "warning",
  614. })
  615. .then(() => {
  616. proxy.post("/orderInfo/deleteAndStore", { id: deleteRow.value.id }).then(() => {
  617. ElMessage({ message: "删除成功", type: "success" });
  618. openDelete.value = false;
  619. getList();
  620. });
  621. })
  622. .catch(() => {});
  623. };
  624. const clickHangUp = (row) => {
  625. ElMessageBox.confirm("你是否确认此操作", "提示", {
  626. confirmButtonText: "确定",
  627. cancelButtonText: "取消",
  628. type: "warning",
  629. })
  630. .then(() => {
  631. proxy.post("/orderInfo/suspendOrder", { id: row.id }).then(() => {
  632. ElMessage({ message: "操作成功", type: "success" });
  633. getList();
  634. });
  635. })
  636. .catch(() => {});
  637. };
  638. const clickCancelHangUp = (row) => {
  639. ElMessageBox.confirm("你是否确认此操作", "提示", {
  640. confirmButtonText: "确定",
  641. cancelButtonText: "取消",
  642. type: "warning",
  643. })
  644. .then(() => {
  645. proxy.post("/orderInfo/cancelSuspendOrder", { id: row.id }).then(() => {
  646. ElMessage({ message: "操作成功", type: "success" });
  647. getList();
  648. });
  649. })
  650. .catch(() => {});
  651. };
  652. const openLogs = ref(false);
  653. const loadingLogs = ref(false);
  654. const logsList = ref({
  655. data: [],
  656. pagination: {
  657. total: 0,
  658. pageNum: 1,
  659. pageSize: 10,
  660. },
  661. });
  662. const type = ref([
  663. { dictKey: "10", dictValue: "新增订单" },
  664. { dictKey: "20", dictValue: "图稿上传" },
  665. { dictKey: "21", dictValue: "修改税率" },
  666. { dictKey: "30", dictValue: "删除订单" },
  667. ]);
  668. const configLogs = computed(() => {
  669. return [
  670. {
  671. attrs: {
  672. label: "操作时间",
  673. prop: "createTime",
  674. width: 160,
  675. align: "center",
  676. },
  677. },
  678. {
  679. attrs: {
  680. label: "操作人",
  681. prop: "userName",
  682. align: "center",
  683. },
  684. },
  685. {
  686. attrs: {
  687. label: "订单号",
  688. prop: "orderCode",
  689. align: "center",
  690. },
  691. },
  692. {
  693. attrs: {
  694. label: "行为",
  695. prop: "type",
  696. width: 100,
  697. align: "center",
  698. },
  699. render(val) {
  700. return proxy.dictKeyValue(val, type.value);
  701. },
  702. },
  703. ];
  704. });
  705. const viewLogs = () => {
  706. logsList.value.data = [];
  707. logsList.value.pagination.total = 0;
  708. openLogs.value = true;
  709. getLogsList({ pageNum: 1, pageSize: 10 });
  710. };
  711. const getLogsList = async (req) => {
  712. logsList.value.pagination = { ...logsList.value.pagination, ...req };
  713. loadingLogs.value = true;
  714. proxy.post("/orderOperatingLog/page", logsList.value.pagination).then((res) => {
  715. logsList.value.data = res.rows;
  716. logsList.value.pagination.total = res.total;
  717. setTimeout(() => {
  718. loadingLogs.value = false;
  719. }, 200);
  720. });
  721. };
  722. const emit = defineEmits(["selectOrder"]);
  723. const clickSelect = (item) => {
  724. emit("selectOrder", item);
  725. };
  726. const clickCopyWLNCode = () => {
  727. ElMessage("复制数据中,请稍后");
  728. proxy.post("/orderInfo/getOrderWlnCodeStr", sourceList.value.pagination).then((res) => {
  729. copyText(res, undefined, (error) => {
  730. if (error) {
  731. ElMessage.error(`复制失败: ${error} !`);
  732. } else {
  733. ElMessage.success(`复制成功!`);
  734. }
  735. });
  736. });
  737. };
  738. const btnLoading = ref(false);
  739. const clickSynchronousOrder = () => {
  740. btnLoading.value = true;
  741. proxy.post("/orderHandle/bathSyncOrder", {}).then(
  742. () => {
  743. ElMessage.success("同步完成成功");
  744. btnLoading.value = false;
  745. getList();
  746. },
  747. (err) => {
  748. ElMessage.error(`同步失败: ${err} !`);
  749. btnLoading.value = false;
  750. }
  751. );
  752. };
  753. const openAfterSale = ref(false);
  754. const rowData = ref({});
  755. const clickAfterSale = (row) => {
  756. rowData.value = row;
  757. openAfterSale.value = true;
  758. };
  759. const applyForAfterSale = (type) => {
  760. openAfterSale.value = false;
  761. proxy.$router.replace({
  762. path: "/order/after-sale/initiate",
  763. query: {
  764. orderInfoId: rowData.value.id,
  765. type: type,
  766. random: proxy.random(),
  767. },
  768. });
  769. };
  770. const openDeliveryNote = ref(false);
  771. const clickDeliveryNote = (row) => {
  772. rowData.value = row;
  773. openDeliveryNote.value = true;
  774. };
  775. const clickCancel = (status) => {
  776. openDeliveryNote.value = false;
  777. if (status) {
  778. getList();
  779. }
  780. };
  781. const formData = reactive({
  782. data: {
  783. orderPackageBomList: [],
  784. outerBoxSelfAdhesiveStickerFile: {},
  785. },
  786. });
  787. const rulesShippingPackage = ref({
  788. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  789. });
  790. const openShippingPackage = ref(false);
  791. const loadingPackage = ref(false);
  792. const clickChangePackaging = (row) => {
  793. loadingPackage.value = true;
  794. openShippingPackage.value = true;
  795. proxy.post("/orderInfo/detail", { id: row.id }).then(
  796. (res) => {
  797. formData.data = res;
  798. proxy.post("/fileInfo/getList", { businessIdList: [formData.data.id] }).then((fileObj) => {
  799. if (fileObj[formData.data.id] && fileObj[formData.data.id].length > 0) {
  800. let outerBoxSelfAdhesiveStickerFile = fileObj[formData.data.id].filter((item) => item.businessType == "1");
  801. if (outerBoxSelfAdhesiveStickerFile && outerBoxSelfAdhesiveStickerFile.length > 0) {
  802. formData.data.outerBoxSelfAdhesiveStickerFile = outerBoxSelfAdhesiveStickerFile[0];
  803. } else {
  804. formData.data.outerBoxSelfAdhesiveStickerFile = {};
  805. }
  806. }
  807. });
  808. loadingPackage.value = false;
  809. },
  810. (err) => {
  811. console.log(err);
  812. loadingPackage.value = false;
  813. }
  814. );
  815. };
  816. const computePackagingMoney = (item, label) => {
  817. let money = 0;
  818. if (item.quantity && item[label]) {
  819. money = Number(Math.round(item.quantity * item[label] * 100) / 100);
  820. }
  821. return money;
  822. };
  823. const clickPackagingDelete = (index) => {
  824. formData.data.orderPackageBomList.splice(index, 1);
  825. };
  826. const openFile = (path) => {
  827. window.open(path);
  828. };
  829. const uploadAdhesiveData = ref({});
  830. const uploadAdhesiveFile = async (file) => {
  831. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  832. uploadAdhesiveData.value = res.uploadBody;
  833. file.id = res.id;
  834. file.fileName = res.fileName;
  835. file.fileUrl = res.fileUrl;
  836. return true;
  837. };
  838. const handleAdhesivePackagingSuccess = (UploadFile) => {
  839. formData.data.outerBoxSelfAdhesiveStickerFile = {
  840. id: UploadFile.raw.id,
  841. fileName: UploadFile.raw.fileName,
  842. fileUrl: UploadFile.raw.fileUrl,
  843. };
  844. };
  845. const clickSaveShippingPackage = () => {
  846. proxy.$refs.shippingPackage.validate((valid) => {
  847. if (valid) {
  848. loadingPackage.value = true;
  849. if (formData.data.orderPackageBomList && formData.data.orderPackageBomList.length > 0) {
  850. proxy
  851. .post("/orderInfo/editOrderPackageBom", {
  852. id: formData.data.id,
  853. orderPackageBomList: formData.data.orderPackageBomList,
  854. outerBoxSelfAdhesiveStickerFile: formData.data.outerBoxSelfAdhesiveStickerFile,
  855. })
  856. .then(
  857. () => {
  858. ElMessage({ message: "提交成功", type: "success" });
  859. openShippingPackage.value = false;
  860. getList();
  861. },
  862. (err) => {
  863. console.log(err);
  864. loadingPackage.value = false;
  865. }
  866. );
  867. } else {
  868. ElMessageBox.confirm("是否确认无产品发货包装", "提示", {
  869. confirmButtonText: "确定",
  870. cancelButtonText: "取消",
  871. type: "warning",
  872. })
  873. .then(() => {
  874. proxy
  875. .post("/orderInfo/editOrderPackageBom", {
  876. id: formData.data.id,
  877. orderPackageBomList: formData.data.orderPackageBomList,
  878. outerBoxSelfAdhesiveStickerFile: formData.data.outerBoxSelfAdhesiveStickerFile,
  879. })
  880. .then(
  881. () => {
  882. ElMessage({ message: "提交成功", type: "success" });
  883. openShippingPackage.value = false;
  884. getList();
  885. },
  886. (err) => {
  887. console.log(err);
  888. loadingPackage.value = false;
  889. }
  890. );
  891. })
  892. .catch(() => {});
  893. }
  894. }
  895. });
  896. };
  897. const openExpressPacking = ref(false);
  898. const clickExpressPacking = () => {
  899. openExpressPacking.value = true;
  900. };
  901. const selectExpressPacking = (data) => {
  902. if (formData.data.orderPackageBomList && formData.data.orderPackageBomList.length > 0) {
  903. let list = formData.data.orderPackageBomList.filter((item) => item.bomSpecId === data.id);
  904. if (list && list.length > 0) {
  905. return ElMessage("快递物流包材已添加");
  906. }
  907. formData.data.orderPackageBomList.push({
  908. bomSpecId: data.id,
  909. code: data.code,
  910. name: data.name,
  911. internalSellingPrice: data.internalSellingPrice,
  912. quantity: undefined,
  913. });
  914. } else {
  915. formData.data.orderPackageBomList = [
  916. {
  917. bomSpecId: data.id,
  918. code: data.code,
  919. name: data.name,
  920. internalSellingPrice: data.internalSellingPrice,
  921. quantity: undefined,
  922. },
  923. ];
  924. }
  925. ElMessage({ message: "添加成功", type: "success" });
  926. };
  927. </script>
  928. <style lang="scss" scoped>
  929. ::v-deep(.el-input-number .el-input__inner) {
  930. text-align: left;
  931. }
  932. :deep(.el-dialog) {
  933. margin-top: 10px !important;
  934. margin-bottom: 10px !important;
  935. }
  936. .select-card {
  937. height: calc(100vh - 184px);
  938. overflow-y: auto;
  939. overflow-x: hidden;
  940. }
  941. .shippingPackage {
  942. .el-form-item {
  943. margin-bottom: 0;
  944. }
  945. }
  946. </style>