detail.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. <template>
  2. <div class="sellOutOrderDetail pagePadding">
  3. <div style="width: 100%; padding: 0 0 200px 0" v-if="powers.some((i) => i == '007')">
  4. <div class="detail-page-title">
  5. <span>发货申请单编号:</span><span v-if="sitem">{{ sitem.outCode }}</span>
  6. <el-button
  7. class="fr"
  8. v-if="
  9. (status === '2' || status === '3') &&
  10. powers.some((i) => i == '049') &&
  11. sitem &&
  12. sitem.order_source !== '6'
  13. "
  14. type="primary"
  15. plain
  16. :size="'mini'"
  17. style="margin: 0 0 0 10px"
  18. @click="wellReturnCode"
  19. >新建售后申请单
  20. </el-button>
  21. <el-button
  22. class="fr"
  23. v-if="status === '2' && ppowers.some((i) => i == '2')"
  24. type="primary"
  25. plain
  26. :size="'mini'"
  27. style="margin: 0 0 0 10px"
  28. @click="wentReceive"
  29. >确认收货
  30. </el-button>
  31. <el-button
  32. class="fr"
  33. v-if="Number(status) >= 2"
  34. type="primary"
  35. plain
  36. :size="'mini'"
  37. style="margin: 0 0 0 10px"
  38. @click="handleShare"
  39. >分享
  40. </el-button>
  41. </div>
  42. <!--
  43. <status-bar
  44. v-if="newTime !== ''"
  45. :newTime="newTime"
  46. :options="statusOptions"
  47. :status="status"
  48. /> -->
  49. <el-tabs v-model="activeTabs">
  50. <el-tab-pane label="业务详情" name="1">
  51. <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
  52. <el-collapse-item title="发货申请单详情" name="1">
  53. <show-data-table
  54. :newTime="newTime"
  55. v-if="newTime !== ''"
  56. :sitem="sitem"
  57. :columns="showColumns"
  58. >
  59. <template slot="status">
  60. <el-tag
  61. :size="'mini'"
  62. :type="sitem.status == '0' ? 'warning' : ''"
  63. v-text="
  64. (statusOptions.find((item) => item.value == sitem.status) || {})
  65. .label || '--'
  66. "
  67. ></el-tag>
  68. </template>
  69. <template slot="order_type">
  70. <el-tag
  71. :size="'mini'"
  72. v-text="
  73. (
  74. xs_order_type_options.find(
  75. (item) => item.id == sitem.order_type
  76. ) || {}
  77. ).label || '--'
  78. "
  79. ></el-tag>
  80. </template>
  81. <template slot="sale_price">
  82. <span>{{
  83. private_field &&
  84. private_field.length > 0 &&
  85. private_field.some((item) => item == "2")
  86. ? sitem.sale_price
  87. : "***"
  88. }}</span>
  89. </template>
  90. <template slot="total_price">
  91. <span>{{
  92. private_field &&
  93. private_field.length > 0 &&
  94. private_field.some((item) => item == "2")
  95. ? sitem.total_price
  96. : "***"
  97. }}</span>
  98. </template>
  99. </show-data-table>
  100. </el-collapse-item>
  101. <el-collapse-item title="商品信息" name="2">
  102. <show-goods-data-table
  103. :newTime="newTime"
  104. v-if="newTime !== ''"
  105. :type="sitem.order_type"
  106. :skucode="sitem.skuCode"
  107. :spucode="sitem.good_code"
  108. />
  109. </el-collapse-item>
  110. <el-collapse-item
  111. title="库管发货"
  112. name="3"
  113. v-if="
  114. status === '1' &&
  115. ppowers.some((i) => i == '1') &&
  116. sitem &&
  117. sitem.wsm_has_account + '' === '0'
  118. "
  119. >
  120. <want-deliver
  121. :newTime="newTime"
  122. v-if="newTime !== ''"
  123. :sitem="sitem"
  124. @refresh="initData"
  125. />
  126. </el-collapse-item>
  127. <el-collapse-item
  128. title="售后申请单结果"
  129. name="4"
  130. v-if="
  131. returnCode && returnCode_type && sitem && sitem.order_return && resitem
  132. "
  133. >
  134. <show-data-table
  135. :newTime="newTime"
  136. v-if="newTime !== '' && resitem"
  137. :sitem="resitem"
  138. :border="
  139. !(
  140. (resitem.is_receive === '1' && returnCode_type === '4') ||
  141. (resitem.is_receive === '1' && returnCode_type === '5')
  142. )
  143. "
  144. :columns="rshowColumns"
  145. >
  146. <template slot="status">
  147. <el-tag
  148. :size="'mini'"
  149. :type="resitem.status == '0' ? 'warning' : ''"
  150. v-text="
  151. (
  152. (resitem.is_receive === '0'
  153. ? status2Options
  154. : status1Options
  155. ).find((item) => item.id === resitem.status) || {}
  156. ).label || '--'
  157. "
  158. ></el-tag>
  159. <el-tooltip
  160. v-if="
  161. resitem.status === '3' &&
  162. resitem.is_receive === '0' &&
  163. powers.some((i) => i == '026')
  164. "
  165. class="fr"
  166. effect="dark"
  167. content="同意退货"
  168. style="padding: 3px 0 0 0"
  169. placement="top"
  170. >
  171. <i class="el-icon-video-play tb-icon" @click="agree_return"></i>
  172. </el-tooltip>
  173. <el-tooltip
  174. class="fr"
  175. effect="dark"
  176. content="取消申请"
  177. style="padding: 3px 0 0 0"
  178. v-if="
  179. (resitem.status === '1' ||
  180. resitem.status === '2' ||
  181. resitem.status === '3' ||
  182. resitem.status === '4') &&
  183. powers.some((i) => i == '027')
  184. "
  185. placement="top"
  186. >
  187. <i class="el-icon-circle-close tb-icon" @click="close_return"></i>
  188. </el-tooltip>
  189. <el-tooltip
  190. class="fr"
  191. effect="dark"
  192. :content="
  193. resitem.is_receive === '1'
  194. ? '换货'
  195. : resitem.is_receive === '0'
  196. ? '补发'
  197. : '--'
  198. "
  199. style="padding: 3px 0 0 0"
  200. v-if="
  201. resitem.status === '5' &&
  202. resitem.is_reissue + '' === '0' &&
  203. resitem.except_code === '2' &&
  204. powers.some((i) => i == '091')
  205. "
  206. placement="top"
  207. >
  208. <i class="el-icon-shopping-cart-2 tb-icon" @click="reissue"></i>
  209. </el-tooltip>
  210. </template>
  211. <template slot="order_type">
  212. <el-tag
  213. :size="'mini'"
  214. v-text="
  215. (orderOptions.find((item) => item.id == resitem.order_type) || {})
  216. .label || '--'
  217. "
  218. ></el-tag>
  219. </template>
  220. <template slot="is_receive">
  221. <el-tag :size="'mini'" :type="''">{{
  222. resitem.is_receive === "1"
  223. ? "已收到货"
  224. : resitem.is_receive === "0"
  225. ? "未收到"
  226. : "--"
  227. }}</el-tag>
  228. </template>
  229. <template slot="except_code">
  230. <el-tag
  231. :size="'mini'"
  232. v-text="
  233. (
  234. expect_options.find(
  235. (item) => item.value == resitem.except_code
  236. ) || {}
  237. ).label || '--'
  238. "
  239. ></el-tag>
  240. </template>
  241. <template slot="error_img">
  242. <img
  243. class="fl hover"
  244. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  245. v-viewer
  246. v-for="(si, i) in resitem.error_img"
  247. :src="si"
  248. :key="si + i"
  249. />
  250. </template>
  251. </show-data-table>
  252. <show-data-table
  253. :newTime="newTime"
  254. v-if="
  255. resitem &&
  256. resitem.is_receive === '1' &&
  257. (returnCode_type === '4' || returnCode_type === '5')
  258. "
  259. :sitem="resitem"
  260. border
  261. :columns="returnShowColumns"
  262. >
  263. <template slot="is_th">
  264. <el-tag
  265. :size="'mini'"
  266. v-text="
  267. (is_th_options.find((item) => item.value == resitem.is_th) || {})
  268. .label || '--'
  269. "
  270. ></el-tag>
  271. </template>
  272. <template slot="addr">
  273. <span
  274. >{{ resitem.contactor }}---{{ resitem.mobile }}---{{ resitem.addr_cn
  275. }}{{ resitem.addr }}</span
  276. >
  277. </template>
  278. </show-data-table>
  279. <show-data-table
  280. :newTime="newTime"
  281. v-if="
  282. newTime !== '' &&
  283. resitem &&
  284. resitem.is_receive === '1' &&
  285. returnCode_type === '5'
  286. "
  287. :sitem="resitem"
  288. border
  289. :columns="returnShowResColumns"
  290. >
  291. </show-data-table>
  292. <return-express
  293. :sitem="resitem"
  294. :newTime="newTime"
  295. v-if="newTime !== '' && returnCode_type === '4'"
  296. @refresh="initData"
  297. />
  298. </el-collapse-item>
  299. </el-collapse>
  300. </el-tab-pane>
  301. <el-tab-pane label="审批记录" name="2">
  302. <process-time-line
  303. v-if="newTime !== ''"
  304. :newTime="newTime"
  305. :type="'CKD'"
  306. :orderCode="queryId"
  307. />
  308. </el-tab-pane>
  309. <el-tab-pane
  310. label="物流进度"
  311. name="3"
  312. v-if="newTime !== '' && (status === '2' || status === '3')"
  313. >
  314. <logis-time-line v-if="newTime !== ''" :orderCode="sitem.post_code" />
  315. </el-tab-pane>
  316. </el-tabs>
  317. <div>
  318. <add-Edit-A
  319. :id="'add'"
  320. :sitem="sitem"
  321. :show-model="showModel"
  322. :is-detail="false"
  323. @refresh="initData"
  324. @cancel="showModel = false"
  325. />
  326. </div>
  327. </div>
  328. <div v-else>
  329. <no-auth></no-auth>
  330. </div>
  331. </div>
  332. </template>
  333. <script>
  334. import mixinPage from "@/mixins/elPaginationHandle";
  335. import resToken from "@/mixins/resToken";
  336. import asyncRequest from "@/apis/service/sellOut/sellOutOrder";
  337. import { showColumns } from "./columns";
  338. import { sellshowColumns } from "@/views/sellOut/sellAfterApply/columns";
  339. import { xs_order_type_options } from "@/assets/js/statusList";
  340. import { mapGetters } from "vuex";
  341. import { shareWebUrl } from "@/config";
  342. import returnExpress from "./components/returnExpress";
  343. import wantDeliver from "./components/want-deliver";
  344. import addEditForm from "./components/addEditForm"; //发货申请单详情
  345. import addEditA from "./components/addEditA";
  346. export default {
  347. name: "sellOutOrderDetail",
  348. mixins: [mixinPage, resToken],
  349. components: {
  350. addEditForm,
  351. addEditA,
  352. wantDeliver,
  353. returnExpress,
  354. },
  355. computed: {
  356. ...mapGetters(["private_field"]),
  357. powers() {
  358. const tran =
  359. this.$store.getters.btnList.find(
  360. (item) => item.menu_route == "sellOutOrderDetail"
  361. ) || {};
  362. const { action } = tran ?? {};
  363. return action ?? [];
  364. },
  365. ppowers() {
  366. const tran =
  367. this.$store.getters.roleProcess.find((i) => i.process_type === "CKD") || {};
  368. const { action } = tran ?? {};
  369. return action ?? [];
  370. },
  371. },
  372. data() {
  373. return {
  374. xs_order_type_options,
  375. returnCode: "",
  376. returnCode_type: "",
  377. activeTabs: "1",
  378. activeNames: ["0", "1", "2", "3", "4"],
  379. status: "", //存储详情接口状态
  380. statusList: [],
  381. showColumns: showColumns,
  382. rshowColumns: sellshowColumns,
  383. returnShowColumns: [
  384. {
  385. prop: "is_th",
  386. label: "物流承担方",
  387. _slot_: "is_th",
  388. span: 6,
  389. },
  390. {
  391. prop: "addr",
  392. label: "收货地址",
  393. _slot_: "addr",
  394. span: 18,
  395. },
  396. ],
  397. returnShowResColumns: [
  398. {
  399. prop: "post_fee",
  400. label: "退货物流费用",
  401. span: 6,
  402. },
  403. {
  404. prop: "post_company",
  405. label: "退货物流公司",
  406. span: 6,
  407. },
  408. {
  409. prop: "post_code",
  410. label: "退货物流单号",
  411. span: 12,
  412. },
  413. ],
  414. sitem: null,
  415. resitem: null,
  416. newTime: "",
  417. showModel: false,
  418. loading: false,
  419. orderOptions: [
  420. { id: "1", label: "线上商品销售" },
  421. { id: "2", label: "项目线上商品销售" },
  422. { id: "3", label: "竞价单销售" },
  423. { id: "4", label: "项目竞价单销售" },
  424. { id: "5", label: "平台部订单销售" },
  425. ],
  426. statusOptions: [
  427. { value: "0", label: "待采购备货" },
  428. { value: "1", label: "待库管发货" },
  429. { value: "2", label: "已发货待收货" },
  430. { value: "3", label: "已收货" },
  431. { value: "4", label: "已全部退货" },
  432. ],
  433. // 收到货状态
  434. status1Options: [
  435. { id: "1", label: "待业务审核" },
  436. { id: "2", label: "待采购审核" },
  437. { id: "3", label: "待设置仓库" },
  438. { id: "4", label: "待客户退货" },
  439. { id: "5", label: "售后已完成" },
  440. { id: "6", label: "业务已驳回" },
  441. { id: "7", label: "采购已驳回" },
  442. { id: "8", label: "申请已取消" },
  443. ],
  444. // 未收到货状态
  445. status2Options: [
  446. { id: "1", label: "待业务审核" },
  447. { id: "2", label: "待采购审核" },
  448. { id: "3", label: "待同意退货" },
  449. { id: "5", label: "售后已完成" },
  450. { id: "6", label: "业务已驳回" },
  451. { id: "7", label: "采购已驳回" },
  452. { id: "8", label: "申请已取消" },
  453. ],
  454. expect_options: [],
  455. expect_options1: [
  456. {
  457. value: "1",
  458. label: "退货",
  459. },
  460. {
  461. value: "2",
  462. label: "换货",
  463. },
  464. ],
  465. expect_options0: [
  466. {
  467. value: "1",
  468. label: "退货",
  469. },
  470. {
  471. value: "2",
  472. label: "补发",
  473. },
  474. ],
  475. is_th_options: [
  476. {
  477. value: "1",
  478. label: "收货人承担",
  479. },
  480. {
  481. value: "2",
  482. label: "业务公司承担",
  483. },
  484. {
  485. value: "3",
  486. label: "供应商承担",
  487. },
  488. ],
  489. queryId: "",
  490. did: "", //详情页上的id
  491. };
  492. },
  493. mounted() {
  494. this.queryId = this.$route.query.id;
  495. this.initData();
  496. },
  497. methods: {
  498. handleShare() {
  499. const url = shareWebUrl + this.sitem.outCode;
  500. const input = document.createElement("input");
  501. document.body.appendChild(input);
  502. input.value = url;
  503. input.select();
  504. document.execCommand("Copy");
  505. this.$message.success("复制成功");
  506. document.body.removeChild(input);
  507. },
  508. async updateStatus(e) {
  509. await this.setstatus(e.status);
  510. },
  511. getNewTime() {
  512. this.newTime = new Date().valueOf();
  513. },
  514. async setstatus(status) {
  515. const model = {
  516. id: this.did,
  517. status: status,
  518. };
  519. let res = await asyncRequest.status(model);
  520. if (res && res.code === 0) {
  521. this.$notify.success({
  522. title: "修改成功!",
  523. message: "",
  524. });
  525. await this.initData();
  526. } else if (res && res.code >= 100 && res.code <= 104) {
  527. await this.logout();
  528. } else {
  529. this.$message.warning(res.message);
  530. }
  531. },
  532. async reissue() {
  533. const { is_receive } = this.resitem;
  534. await this.$confirm(`确定要${is_receive === "1" ? "换货" : "补发"}?`, {
  535. confirmButtonText: "确定",
  536. cancelButtonText: "取消",
  537. type: "warning",
  538. })
  539. .then(async () => {
  540. const model = {
  541. returnCode: this.returnCode,
  542. };
  543. const res = await asyncRequest.createSaleAndCgdByAfter(model);
  544. if (res && res.code === 0) {
  545. this.$notify.success({
  546. title: `${is_receive === "1" ? "换货" : "补发"}成功!`,
  547. message: "",
  548. });
  549. await this.initData();
  550. } else if (res && res.code >= 100 && res.code <= 104) {
  551. await this.logout();
  552. } else {
  553. this.$message.warning(res.message);
  554. }
  555. })
  556. .catch(() => {
  557. console.log("取消");
  558. });
  559. },
  560. async wentReceive() {
  561. await this.$confirm("确定要确认收货?", {
  562. confirmButtonText: "确定",
  563. cancelButtonText: "取消",
  564. type: "warning",
  565. })
  566. .then(async () => {
  567. const model = {
  568. outCode: this.sitem.outCode,
  569. };
  570. const res = await asyncRequest.saleoutreceipt(model);
  571. if (res && res.code === 0) {
  572. this.$notify.success({
  573. title: "确认收货",
  574. message: "",
  575. });
  576. await this.initData();
  577. } else if (res && res.code >= 100 && res.code <= 104) {
  578. await this.logout();
  579. } else {
  580. this.$message.warning(res.message);
  581. }
  582. })
  583. .catch(() => {
  584. console.log("取消");
  585. });
  586. },
  587. async initData(e) {
  588. this.returnCode = "";
  589. this.returnCode_type = "";
  590. let model = {
  591. outCode: this.queryId,
  592. };
  593. const res = await asyncRequest.detail(model);
  594. if (res && res.code === 0 && res.data) {
  595. this.sitem = res.data;
  596. const { status, can, id, order_return } = this.sitem;
  597. this.status = status;
  598. this.did = id;
  599. if (order_return) {
  600. this.returnCode = order_return.returnCode;
  601. this.returnCode_type = order_return.status;
  602. await this.receive_initData(this.returnCode);
  603. }
  604. this.getNewTime();
  605. } else if (res && res.code >= 100 && res.code <= 104) {
  606. await this.logout();
  607. } else {
  608. this.$message.warning(res.message);
  609. }
  610. },
  611. wellReturnCode() {
  612. console.log(this.returnCode_type);
  613. if (
  614. this.returnCode_type === "1" ||
  615. this.returnCode_type === "2" ||
  616. this.returnCode_type === "3"
  617. ) {
  618. this.$message.warning("当前售后申请单未完成审批!");
  619. return;
  620. }
  621. this.showModel = true;
  622. },
  623. async receive_initData(code) {
  624. let model = {
  625. returnCode: code,
  626. };
  627. const res = await asyncRequest.afterinfo(model);
  628. if (res && res.code === 0 && res.data) {
  629. this.resitem = res.data;
  630. this.resitem.error_img = this.resitem.error_img.split(",");
  631. this.expect_options = JSON.parse(
  632. JSON.stringify(
  633. this.resitem.is_receive === "1" ? this.expect_options1 : this.expect_options0
  634. )
  635. );
  636. } else if (res && res.code >= 100 && res.code <= 104) {
  637. await this.logout();
  638. } else {
  639. this.$message.warning(res.message);
  640. }
  641. },
  642. async agree_return() {
  643. await this.$confirm("确定要同意退货?", {
  644. confirmButtonText: "确定",
  645. cancelButtonText: "取消",
  646. type: "warning",
  647. })
  648. .then(async () => {
  649. const model = {
  650. returnCode: this.returnCode,
  651. status: "5",
  652. remark: "",
  653. is_post: "",
  654. };
  655. const res = await asyncRequest.afterstatus(model);
  656. if (res && res.code === 0) {
  657. this.$notify.success({
  658. title: "退货成功",
  659. message: "",
  660. });
  661. await this.initData();
  662. } else if (res && res.code >= 100 && res.code <= 104) {
  663. await this.logout();
  664. } else {
  665. this.$message.warning(res.message);
  666. }
  667. })
  668. .catch(() => {
  669. console.log("取消");
  670. });
  671. },
  672. async close_return() {
  673. await this.$confirm("确定要取消申请?", {
  674. confirmButtonText: "确定",
  675. cancelButtonText: "取消",
  676. type: "warning",
  677. })
  678. .then(async () => {
  679. const model = {
  680. returnCode: this.returnCode,
  681. };
  682. const res = await asyncRequest.aftercancel(model);
  683. if (res && res.code === 0) {
  684. this.$notify.success({
  685. title: "取消成功",
  686. message: "",
  687. });
  688. await this.initData();
  689. } else if (res && res.code >= 100 && res.code <= 104) {
  690. await this.logout();
  691. } else {
  692. this.$message.warning(res.message);
  693. }
  694. })
  695. .catch(() => {
  696. console.log("取消");
  697. });
  698. },
  699. },
  700. };
  701. </script>