detail.vue 7.2 KB

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