detail.vue 12 KB

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