index.vue 29 KB

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