detail.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="zxDiffOrderDetail pagePadding">
  3. <div style="width: 100%" v-if="powers.some((i) => i == '007')" v-loading="loading">
  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="title" name="1" v-if="type === 'add'">
  8. <base-form />
  9. </el-collapse-item>
  10. <template v-else>
  11. <el-collapse-item title="组合商品详情" name="2" v-if="sitem">
  12. <show-data-table :sitem="sitem" :newTime="newTime" :columns="detailColumns_j">
  13. <template #status>
  14. <el-tag
  15. size="mini"
  16. :type="sitem.status == '1' ? 'warning' : ''"
  17. >{{(statusOptions.find((item) => item.id == String(sitem.status)) || {}).label || '--'}}</el-tag>
  18. </template>
  19. <template #wsmtype>
  20. <el-tag
  21. size="mini"
  22. >{{(wsm_options.find(({value}) => value === sitem.wsm_type) || {}).label || '--'}}</el-tag>
  23. </template>
  24. </show-data-table>
  25. </el-collapse-item>
  26. <el-collapse-item title="子商品信息" name="4">
  27. <el-table :data="sitem ? sitem.combindgood : []" size="mini" border>
  28. <el-table-column label="子商品成本编号" prop="childCode" min-width="160px" />
  29. <el-table-column
  30. label="子商品名称"
  31. prop="child_name"
  32. min-width="180px"
  33. show-overflow-tooltip
  34. />
  35. <el-table-column label="组合比例" prop="child_num" />
  36. <el-table-column label="本次解除库存数">
  37. <template
  38. slot-scope="{ row }"
  39. >{{ ((row.child_num || 0) * ( sitem.stock_num || 0)) || 0}}</template>
  40. </el-table-column>
  41. <el-table-column label="锁定库存总数">
  42. <template slot-scope="scope">{{ scope.row.stock || 0 }}</template>
  43. </el-table-column>
  44. <el-table-column label="锁定库存可用库存数">
  45. <template slot-scope="scope">{{ scope.row.usable_stock || 0 }}</template>
  46. </el-table-column>
  47. </el-table>
  48. </el-collapse-item>
  49. <el-collapse-item
  50. v-if="Number(sitem.status) === 1 && !isSupertube"
  51. title="待审核"
  52. name="3"
  53. >
  54. <div style="width:600px">
  55. <wait-approval @confirm="setStatus" />
  56. </div>
  57. </el-collapse-item>
  58. </template>
  59. </el-collapse>
  60. </el-tab-pane>
  61. </el-tabs>
  62. </div>
  63. <div v-else>
  64. <no-auth></no-auth>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. import asyncRequest from "@/apis/service/sellOut/combinedAdd";
  70. import { xs_order_type_options } from "@/assets/js/statusList";
  71. import { showColumns, detailColumns_j } from "./columns";
  72. import WaitApproval from "./components/waitApproval";
  73. import mixinPage from "@/mixins/elPaginationHandle";
  74. import BaseForm from "./components/baseForm";
  75. import resToken from "@/mixins/resToken";
  76. import { mapGetters } from "vuex";
  77. export default {
  78. name: "combinedRemoveDetail",
  79. mixins: [mixinPage, resToken],
  80. components: { BaseForm, WaitApproval },
  81. computed: {
  82. ...mapGetters(["isSupertube"]),
  83. type() {
  84. return this.$route.query.id;
  85. },
  86. title() {
  87. const { query } = this.$route;
  88. return query.id === "add" ? "新建组合商品库存申请" : "组合商品库存详情";
  89. },
  90. powers() {
  91. const { btnList } = this.$store.getters;
  92. const tran =
  93. btnList.find(item => item.menu_route == "combinedRemoveDetail") || {};
  94. const { action } = tran ?? {};
  95. return action ?? [];
  96. }
  97. },
  98. data() {
  99. return {
  100. showModel: false,
  101. showColumns: showColumns,
  102. activeTabs: "1",
  103. activeNames: ["-1", "0", "1", "2", "3", "4", "5", "10"],
  104. statusOptions: [
  105. { id: "1", label: "待审核" },
  106. { id: "2", label: "审核通过" },
  107. { id: "3", label: "审核驳回" }
  108. ],
  109. detailColumns_j,
  110. xs_order_type_options,
  111. customer_remark_options: [
  112. {
  113. value: "1",
  114. label: "竞价订单减工差"
  115. },
  116. {
  117. value: "2",
  118. label: "竞价订单不减工差"
  119. }
  120. ],
  121. wsm_options: [
  122. // {
  123. // value: "1",
  124. // label: "系统仓",
  125. // },
  126. // {
  127. // value: "2",
  128. // label: "虚拟仓",
  129. // },
  130. // {
  131. // value: "3",
  132. // label: "自建仓",
  133. // },
  134. {
  135. value: "5",
  136. label: "销售仓"
  137. },
  138. {
  139. value: "4",
  140. label: "次品仓"
  141. }
  142. ],
  143. is_act_options: [
  144. {
  145. value: "1",
  146. label: "接受工差"
  147. },
  148. {
  149. value: "2",
  150. label: "不接受工差-退回重做"
  151. }
  152. ],
  153. sitem: null,
  154. status: "",
  155. newTime: "",
  156. loading: false,
  157. queryId: ""
  158. };
  159. },
  160. mounted() {
  161. this.status = "";
  162. this.queryId = this.$route.query.id;
  163. if (this.queryId !== "add") {
  164. this.initData();
  165. }
  166. },
  167. methods: {
  168. getNewTime() {
  169. this.newTime = new Date().valueOf() + "";
  170. },
  171. async setStatus(param) {
  172. if (!this.loading) {
  173. this.loading = true;
  174. let model = {
  175. id: this.queryId,
  176. ...param
  177. };
  178. const res = await asyncRequest.status(model);
  179. this.loading = false;
  180. if (res && res.code === 0) {
  181. this.initData();
  182. } else if (res && res.code >= 100 && res.code <= 104) {
  183. await this.logout();
  184. } else {
  185. this.$message.warning(res.message);
  186. }
  187. }
  188. },
  189. async initData() {
  190. const res = await asyncRequest.detail({ id: this.queryId });
  191. if (res && res.code === 0 && res.data) {
  192. this.sitem = res.data;
  193. const { can, status } = res.data;
  194. this.status = status;
  195. this.sitem.class_cat = "";
  196. if (can && can.length > 0) {
  197. can.forEach((x, i) => {
  198. this.sitem.class_cat += i === 0 ? x.name : "/" + x.name;
  199. });
  200. }
  201. this.getNewTime();
  202. } else if (res && res.code >= 100 && res.code <= 104) {
  203. await this.logout();
  204. } else {
  205. this.$message.warning(res.message);
  206. }
  207. }
  208. }
  209. };
  210. </script>
  211. <style lang="scss" scoped>
  212. .zxDiffOrderDetail {
  213. }
  214. </style>