index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <script>
  2. import test from "@/components/form-test/index.vue";
  3. import query from "@/components/query/index.vue";
  4. import purchaseInbound from "./purchaseInbound.vue";
  5. import JDbackInbound from "./JDbackInbound.vue";
  6. import * as API from "@/api/inbound-outbound/treatIn.js";
  7. import {
  8. logisticsDetails,
  9. purchaseAdd,
  10. } from "@/api/inbound-outbound/inbound/purchaseInbound.js";
  11. import { JDreGoodsDetails } from "@/api/order-management/JDReturnGoods/index.js";
  12. export default {
  13. components: {
  14. test,
  15. query,
  16. purchaseInbound,
  17. JDbackInbound,
  18. },
  19. data() {
  20. return {
  21. inBoundTypeList: [
  22. { dictValue: "采购入库", dictKey: "1" },
  23. { dictValue: "京东退货", dictKey: "4" },
  24. ],
  25. inStockStatusList: [],
  26. queryParams: {
  27. pageNum: 1,
  28. pageSize: 10,
  29. keyword: "",
  30. type: "",
  31. },
  32. selectConfig: [
  33. {
  34. label: "类型",
  35. prop: "type",
  36. data: [
  37. { label: "采购入库", value: "1" },
  38. { label: "京东退货", value: "4" },
  39. ],
  40. },
  41. ],
  42. tableList: [],
  43. total: 0,
  44. loading: false,
  45. titleText: "",
  46. open: false,
  47. form: {},
  48. rowData: {},
  49. };
  50. },
  51. created() {
  52. const businessDictData = JSON.parse(
  53. window.localStorage.getItem("businessDict")
  54. );
  55. this.inStockStatusList = businessDictData.find(
  56. (item) => item.code === "inStockStatus"
  57. ).children;
  58. this.selectConfig[0].data = this.inBoundTypeList.map((x) => ({
  59. value: x.dictKey,
  60. label: x.dictValue,
  61. }));
  62. this.getList();
  63. },
  64. methods: {
  65. getList() {
  66. this.loading = true;
  67. API.inList(this.queryParams).then(
  68. (res) => {
  69. this.tableList = res.data.data.records;
  70. this.total = res.data.data.total;
  71. this.loading = false;
  72. },
  73. (err) => {
  74. console.log("inList: " + err);
  75. this.loading = false;
  76. }
  77. );
  78. },
  79. handleQuery() {
  80. this.getList();
  81. },
  82. handleInbound(row) {
  83. this.rowData = { ...row };
  84. this.open = true;
  85. if (row.businessType === 1) {
  86. this.titleText = "采购入库";
  87. this.$nextTick(() => {
  88. this.$refs.purchaseInbound.loading = true;
  89. logisticsDetails({ logisticsInfoId: row.id }).then(
  90. (res) => {
  91. let list = res.data.data;
  92. list = list.map((x) => ({
  93. ...x,
  94. changeQuantity:
  95. Number(x.shipmentQuantity) - Number(x.receiptQuantity),
  96. }));
  97. this.form = {
  98. id: row.id,
  99. purchaseCode: row.purchaseCode,
  100. supplierName: row.supplierName,
  101. logisticsCompanyName: row.logisticsCompanyName,
  102. code: row.code,
  103. changeDetailsList: list,
  104. };
  105. this.$refs.purchaseInbound.loading = false;
  106. },
  107. (err) => {
  108. console.log("logisticsDetails: " + err);
  109. this.$refs.purchaseInbound.loading = false;
  110. }
  111. );
  112. });
  113. } else if (row.businessType === 4) {
  114. this.titleText = "京东退货入库";
  115. this.$nextTick(() => {
  116. this.$refs.JDbackInbound.loading = true;
  117. JDreGoodsDetails({ id: row.businessId }).then((res) => {
  118. this.form = {
  119. logisticsId: row.id,
  120. warehouseId: "",
  121. logisticsCompanyName: row.logisticsCompanyName,
  122. code: row.code,
  123. logisticsDetailsList: res.data.data,
  124. };
  125. this.$refs.JDbackInbound.loading = false;
  126. });
  127. });
  128. }
  129. },
  130. handleCancel() {
  131. this.open = false;
  132. },
  133. handleSubmit() {
  134. if (this.rowData.businessType === 1) {
  135. purchaseAdd({
  136. logisticsInfoId: this.form.id,
  137. list: this.form.changeDetailsList,
  138. }).then(
  139. () => {
  140. this.msgSuccess("入库成功");
  141. this.$refs.purchaseInbound.loading = false;
  142. this.open = false;
  143. this.getList();
  144. },
  145. (err) => {
  146. console.log("purchaseAdd: " + err);
  147. this.$refs.purchaseInbound.loading = false;
  148. }
  149. );
  150. } else {
  151. const data = {
  152. logisticsId: this.form.logisticsId,
  153. warehouseId: this.form.warehouseId,
  154. };
  155. API.JDInBound(data).then(
  156. () => {
  157. this.msgSuccess("入库成功");
  158. this.$refs.JDbackInbound.loading = false;
  159. this.open = false;
  160. this.getList();
  161. },
  162. (err) => {
  163. console.log("outboundAdd: " + err);
  164. this.$refs.JDbackInbound.loading = false;
  165. }
  166. );
  167. }
  168. },
  169. },
  170. };
  171. </script>
  172. <template>
  173. <div class="box-card">
  174. <el-card>
  175. <query
  176. :selectConfig="selectConfig"
  177. :req="queryParams"
  178. :isShowMore="true"
  179. @handleQuery="handleQuery"
  180. @handleMore="
  181. () => {
  182. queryDialog = true;
  183. }
  184. "
  185. ></query>
  186. <el-table :data="tableList" v-loading="loading">
  187. <el-table-column
  188. label="类型"
  189. align="left"
  190. prop="businessType"
  191. width="120"
  192. :formatter="(row) => dictDataEcho(row.businessType, inBoundTypeList)"
  193. />
  194. <el-table-column
  195. label="仓库名称"
  196. align="left"
  197. prop="warehouseName"
  198. width="150"
  199. />
  200. <el-table-column
  201. label="单号"
  202. align="left"
  203. prop="purchaseCode"
  204. width="180"
  205. />
  206. <el-table-column
  207. label="物流/快递公司"
  208. align="left"
  209. prop="logisticsCompanyName"
  210. width="150"
  211. />
  212. <el-table-column label="物流/快递单号" align="left" prop="code" />
  213. <el-table-column
  214. label="操作人"
  215. align="left"
  216. prop="purchaseName"
  217. width="120"
  218. />
  219. <el-table-column
  220. label="操作时间"
  221. align="left"
  222. prop="updateTime"
  223. width="150"
  224. />
  225. <el-table-column
  226. label="状态"
  227. align="left"
  228. prop="inStockStatus"
  229. width="100"
  230. :formatter="
  231. (row) => dictDataEcho(row.inStockStatus, inStockStatusList)
  232. "
  233. />
  234. <el-table-column label="操作" align="center" width="120">
  235. <template slot-scope="scope">
  236. <el-button
  237. type="text"
  238. @click="handleInbound(scope.row)"
  239. v-if="scope.row.status < 30"
  240. >入库
  241. </el-button>
  242. </template>
  243. </el-table-column>
  244. </el-table>
  245. <pagination
  246. v-show="total > 0"
  247. :total="total"
  248. :page.sync="queryParams.pageNum"
  249. :limit.sync="queryParams.pageSize"
  250. @pagination="getList"
  251. />
  252. </el-card>
  253. <el-dialog
  254. :title="titleText"
  255. :visible.sync="open"
  256. v-if="open"
  257. width="80%"
  258. top="60px"
  259. >
  260. <purchase-inbound
  261. v-if="rowData.businessType === 1"
  262. :form="form"
  263. @submit="handleSubmit"
  264. @cancel="handleCancel"
  265. ref="purchaseInbound"
  266. ></purchase-inbound>
  267. <JDbackInbound
  268. v-else
  269. :form="form"
  270. @submit="handleSubmit"
  271. @cancel="handleCancel"
  272. ref="JDbackInbound"
  273. >
  274. </JDbackInbound>
  275. </el-dialog>
  276. </div>
  277. </template>
  278. <style lang="scss" scoped>
  279. .box-card {
  280. height: calc(100vh - 110px);
  281. overflow-y: auto;
  282. }
  283. </style>