detail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <div class="sellAfterApplyDetail pagePadding">
  3. <div style="width: 100%" v-if="powers.some((i) => i == '007')">
  4. <el-tabs v-model="activeTabs">
  5. <el-tab-pane label="业务详情" name="1">
  6. <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
  7. <el-collapse-item title="售后退货详情" name="1">
  8. <show-data-table
  9. :newTime="newTime"
  10. v-if="newTime !== ''"
  11. :sitem="sitem"
  12. :columns="sellshowColumns"
  13. >
  14. <template slot="status">
  15. <el-tag
  16. :size="'mini'"
  17. :type="sitem.status == '0' ? 'warning' : ''"
  18. v-text="
  19. (
  20. statusOptions.find(
  21. (item) => String(item.id) === String( sitem.status)
  22. ) || {}
  23. ).label || '--'
  24. "
  25. ></el-tag>
  26. </template>
  27. <template slot="returnWsm">
  28. <span>{{ sitem.wsm_name }}</span>
  29. <el-popover placement="top" width="400" trigger="hover">
  30. <ul>
  31. <li><h3>退货仓库</h3></li>
  32. <li>
  33. <span>编码:</span><span>{{ sitem.wsm_code }}</span>
  34. </li>
  35. <li>
  36. <span>名称:</span><span>{{ sitem.wsm_name }}</span>
  37. </li>
  38. <li>
  39. <span>所在供应商编码:</span><span>{{ sitem.wsm_supplierNo }}</span>
  40. </li>
  41. <li>
  42. <span>所在供应商名称:</span><span>{{ sitem.wsm_supplier }}</span>
  43. </li>
  44. </ul>
  45. <i slot="reference" class="el-icon-warning-outline fr" />
  46. </el-popover>
  47. </template>
  48. <template slot="order_type">
  49. <el-tag
  50. :size="'mini'"
  51. v-text="
  52. (
  53. xs_order_type_options.find(
  54. (item) => item.id == sitem.order_type
  55. ) || {}
  56. ).label || '--'
  57. "
  58. ></el-tag>
  59. </template>
  60. <template slot="is_receive">
  61. <el-tag :size="'mini'" :type="''">{{
  62. sitem.is_receive + '' === "1"
  63. ? "销售订单退货,采购订单也退货"
  64. : sitem.is_receive + '' === "0"
  65. ? "采购订单不退货(货物已丢失,且无法找回,由业务公司承担)"
  66. : "--"
  67. }}</el-tag>
  68. </template>
  69. <template slot="except_code">
  70. <el-tag
  71. :size="'mini'"
  72. v-text="
  73. (
  74. expect_options.find((item) => item.value == sitem.except_code) ||
  75. {}
  76. ).label || '--'
  77. "
  78. ></el-tag>
  79. </template>
  80. <template slot="error_img">
  81. <img
  82. class="fl hover"
  83. style="width: 23px; height: 23px; margin: 0 5px 0 0"
  84. v-viewer
  85. v-for="(si, i) in sitem.error_img"
  86. :src="si"
  87. :key="si + i"
  88. />
  89. </template>
  90. </show-data-table>
  91. </el-collapse-item>
  92. <el-collapse-item title="商品信息" name="2">
  93. <show-goods-data-table
  94. :newTime="newTime"
  95. v-if="newTime !== '' && sitem"
  96. :type="sitem.order_type"
  97. :skucode="sitem.skuCode"
  98. :spucode="sitem.good_code"
  99. />
  100. </el-collapse-item>
  101. <el-collapse-item name="5" title="供应商审核" v-if="isHasPermission({status:'9', process:'9'})">
  102. <supplier-exam :sitem="sitem" @changeStatus="handleSupplierExam" />
  103. </el-collapse-item>
  104. <el-collapse-item name="7" title="业务公司修改,待供应商确认" v-if="isHasPermission({status:'10', process:'10'})">
  105. <supplier-confrim :sitem="sitem" @changeStatus="handleSupplierConfirm"/>
  106. </el-collapse-item>
  107. </el-collapse>
  108. </el-tab-pane>
  109. <el-tab-pane label="审批记录" name="2">
  110. <process-time-line
  111. v-if="newTime !== ''"
  112. :newTime="newTime"
  113. :type="'SHD'"
  114. :orderCode="orderCode"
  115. />
  116. </el-tab-pane>
  117. <el-tab-pane label="流程图" name="4" v-if="newTime !== ''">
  118. <flow-chart process_id="6" type="SHD" :orderCode="orderCode" />
  119. </el-tab-pane>
  120. </el-tabs>
  121. </div>
  122. <div v-else>
  123. <no-auth></no-auth>
  124. </div>
  125. </div>
  126. </template>
  127. <script>
  128. import mixinPage from "@/mixins/elPaginationHandle";
  129. import resToken from "@/mixins/resToken";
  130. import asyncRequest from "@/apis/service/supplierSellOut/supplierSellAfterApply";
  131. import { sellshowColumns } from "./columns";
  132. import purchaseExam from "./components/purchase_exam";
  133. import SupplierExam from "./components/supplier_exam.vue";
  134. import { xs_order_type_options } from "@/assets/js/statusList";
  135. import WaitReturn from "./components/wait-return.vue";
  136. import SupplierConfrim from "./components/supplier-confirm.vue";
  137. import SetWorkOrder from "./components/set-work-order.vue"
  138. import WaitStockman from "./components/wait-stockman.vue";
  139. import { mapGetters } from "vuex";
  140. export default {
  141. name: "sellAfterApplyDetail",
  142. mixins: [mixinPage, resToken],
  143. components: {
  144. WaitReturn,
  145. SupplierExam,
  146. purchaseExam,
  147. SupplierConfrim,
  148. SetWorkOrder,
  149. WaitStockman
  150. },
  151. computed: {
  152. ...mapGetters(['isSuppertube']),
  153. powers() {
  154. const tran = this.$store.getters.btnList.find(
  155. (item) => item.menu_route == "supplierSellAfterApplyDetail"
  156. ) || {};
  157. const { action } = tran ?? {};
  158. return action ?? [];
  159. },
  160. ppowers() {
  161. const tran =
  162. this.$store.getters.roleProcess.find((i) => i.process_type === "SHD") || {};
  163. const { action } = tran ?? {};
  164. return action ?? [];
  165. },
  166. },
  167. data() {
  168. return {
  169. xs_order_type_options,
  170. activeTabs: "1",
  171. expect_options: [],
  172. expect_options1: [
  173. {
  174. value: "1",
  175. label: "退货",
  176. },
  177. {
  178. value: "2",
  179. label: "换货",
  180. },
  181. ],
  182. expect_options0: [
  183. {
  184. value: "1",
  185. label: "退货",
  186. },
  187. {
  188. value: "2",
  189. label: "补发",
  190. },
  191. ],
  192. activeNames: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
  193. status: "", //存储详情接口状态
  194. statusList: [],
  195. sellshowColumns: sellshowColumns,
  196. sitem: null,
  197. newTime: "",
  198. loading: false,
  199. // 收到货状态
  200. statusOptions: [
  201. { id: "1", label: "待业务审核" },
  202. { id: "9", label: "供应商审核" },
  203. { id: "2", label: "供应商驳回,待采购审核" }, // id: "2", label: "供应商驳回,待供应商负责人审核" },
  204. { id: "10", label: "业务公司修改,待供应商确认" },
  205. { id: "11", label: "待设置工单" }, //已收到货才有
  206. { id: "4", label: "待客户退货" }, //已收到货才有
  207. { id: "12", label: "待库管收货" }, //已收到货才有
  208. { id: "5", label: "售后已完成" },
  209. { id: "6", label: "业务已驳回" },
  210. { id: "8", label: "申请已取消" },
  211. ],
  212. orderCode: "",
  213. return_code: "",
  214. code: "",
  215. };
  216. },
  217. mounted() {
  218. this.code = this.$route.query.id;
  219. this.initData();
  220. },
  221. methods: {
  222. isHasPermission({ status, process }){
  223. return (
  224. this.sitem
  225. && status === String(this.sitem.status)
  226. && this.ppowers.includes(process)
  227. && !this.isSupertube
  228. )
  229. },
  230. async handleExpress(data){
  231. let res = await asyncRequest.express({
  232. ...data,
  233. returnCode: this.code
  234. });
  235. if (res && res.code === 0) {
  236. this.$notify.success({
  237. title: "修改成功!",
  238. message: "",
  239. });
  240. await this.initData();
  241. } else if (res && res.code >= 100 && res.code <= 104) {
  242. await this.logout();
  243. } else {
  244. this.$message.warning(res.message);
  245. }
  246. },
  247. async handleSupplierConfirm(data){
  248. const params = {
  249. ...data,
  250. returnCode: this.code
  251. }
  252. const { is_receive } = this.sitem
  253. if(params.status === '4' && String(is_receive) === '0'){
  254. params.status = '5'
  255. }
  256. let res = await asyncRequest.status(params);
  257. if (res && res.code === 0) {
  258. this.$notify.success({
  259. title: "修改成功!",
  260. message: "",
  261. });
  262. await this.initData();
  263. } else if (res && res.code >= 100 && res.code <= 104) {
  264. await this.logout();
  265. } else {
  266. this.$message.warning(res.message);
  267. }
  268. },
  269. async handleSupplierExam(data){
  270. const params = {
  271. ...data,
  272. returnCode: this.code
  273. }
  274. const { is_receive } = this.sitem
  275. if(params.status === '4' && String(is_receive) === '0'){
  276. params.status = '5'
  277. }
  278. let res = await asyncRequest.status(params);
  279. if (res && res.code === 0) {
  280. this.$notify.success({
  281. title: "修改成功!",
  282. message: "",
  283. });
  284. await this.initData();
  285. } else if (res && res.code >= 100 && res.code <= 104) {
  286. await this.logout();
  287. } else {
  288. this.$message.warning(res.message);
  289. }
  290. },
  291. getNewTime() {
  292. this.newTime = new Date().valueOf();
  293. },
  294. async handlePurchaseConfirm(data){
  295. const model = {
  296. returnCode: this.code,
  297. ...data
  298. };
  299. let res = await asyncRequest.status(model);
  300. if (res && res.code === 0) {
  301. this.$notify.success({
  302. title: "修改成功!",
  303. message: "",
  304. });
  305. await this.initData();
  306. } else if (res && res.code >= 100 && res.code <= 104) {
  307. await this.logout();
  308. } else {
  309. this.$message.warning(res.message);
  310. }
  311. },
  312. async statusConfirm(status, message, remark = "") {
  313. this.$confirm(`确定要${message}?`, {
  314. confirmButtonText: "确定",
  315. cancelButtonText: "取消",
  316. type: "warning",
  317. })
  318. .then(async () => {
  319. if (status + '' === "-1") {
  320. await this.deleteById(message);
  321. } else {
  322. await this.setstatus(status, message, remark);
  323. }
  324. })
  325. .catch(() => {
  326. console.log("取消");
  327. });
  328. },
  329. // 点击业务审核的保存按钮
  330. async examForm(e) {
  331. if (!this.loading) {
  332. let type = e.state + '' === "1" ? "9" : "6";
  333. const { order_type } = this.sitem;
  334. const isStock = order_type === "1"
  335. if(isStock && type === "9") type = "2"
  336. let message = e.state + '' === "1" ? "提交业务审核" : "提交业务审核";
  337. await this.statusConfirm(type, message, e.remark);
  338. }
  339. },
  340. //
  341. async setstatus(type, detail, remark = "") {
  342. const model = {
  343. remark,
  344. returnCode: this.code,
  345. status: type,
  346. };
  347. let res = await asyncRequest.status(model);
  348. if (res && res.code === 0) {
  349. this.$notify.success({
  350. title: "修改成功!",
  351. message: "",
  352. });
  353. await this.initData();
  354. } else if (res && res.code >= 100 && res.code <= 104) {
  355. await this.logout();
  356. } else {
  357. this.$message.warning(res.message);
  358. }
  359. },
  360. hasPermission({status, process}){
  361. console.log(this.sitem)
  362. return !this.isSupertube && String(this.sitem.status) === status && this.ppowers.includes(process)
  363. },
  364. async initData() {
  365. let model = {
  366. returnCode: this.code,
  367. };
  368. const res = await asyncRequest.detail(model);
  369. if (res && res.code === 0 && res.data) {
  370. this.sitem = res.data;
  371. const { status, can, returnCode } = this.sitem;
  372. this.status = status;
  373. this.orderCode = returnCode;
  374. this.sitem.error_img = this.sitem.error_img.split(",");
  375. this.expect_options = JSON.parse(
  376. JSON.stringify(
  377. this.sitem.is_receive + '' === "1" ? this.expect_options1 : this.expect_options0
  378. )
  379. );
  380. this.getNewTime();
  381. } else if (res && res.code >= 100 && res.code <= 104) {
  382. await this.logout();
  383. } else {
  384. this.$message.warning(res.message);
  385. }
  386. },
  387. },
  388. };
  389. </script>