DeliveryDetail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <template>
  2. <div>
  3. <FullPage
  4. :title=" '发货单详情'"
  5. :list="list"
  6. @init="init"
  7. :logList="logList"
  8. :loading="loading"
  9. @searchData="init"
  10. @changePage="changePage"
  11. @changeSize="changeSize"
  12. @selectTable="selectTable"
  13. :tableColums="tableColums"
  14. :tableData="tableData"
  15. :pageIndex="pageIndex"
  16. :total="total"
  17. >
  18. <div slot="titleButton">
  19. <Button
  20. @click="exportContent"
  21. type="primary"
  22. style="margin-right: 10px"
  23. >导出</Button
  24. >
  25. <Button
  26. v-if="$route.query.type == 2"
  27. @click="handleOrderReturn(selects)"
  28. type="primary"
  29. style="margin-right:10px;"
  30. >批量退回</Button
  31. >
  32. <Button @click="back" type="primary" ghost style="margin-right:10px;"
  33. >返回</Button
  34. >
  35. <Button
  36. v-if="$route.query.type == 2"
  37. @click="exportData"
  38. type="warning"
  39. ghost
  40. style="margin-right:10px;"
  41. >待出库清单打印</Button
  42. >
  43. <Button
  44. @click="outShip(selects, 1)"
  45. type="warning"
  46. ghost
  47. style="margin-right:10px;"
  48. >批量发货完成</Button
  49. >
  50. <Button
  51. @click="outShip(selects, 2)"
  52. type="success"
  53. ghost
  54. style="margin-right:10px;"
  55. >批量收货完成</Button
  56. >
  57. </div>
  58. <template slot-scope="{ row }" slot="set">
  59. <!-- <a
  60. v-if="$route.query.type == 4"
  61. class="map-margin"
  62. :disabled="row.order_in_no"
  63. @click="confirmSuccess(row)"
  64. >确认入库</a
  65. >
  66. <a
  67. v-if="$route.query.type == 4"
  68. class="map-margin"
  69. :disabled="row.in_out_value == 1"
  70. @click="outStock(row)"
  71. >出库</a
  72. >
  73. <a
  74. v-if="$route.query.type == 2 && !row.in_out_value"
  75. class="map-margin"
  76. @click="outShip(row, 1)"
  77. >确认出库</a
  78. >
  79. <a
  80. v-if="$route.query.type == 2 && row.transport_no"
  81. class="map-margin"
  82. @click="row.sub_state != 3 ? outShip(row, 2) : ''"
  83. >{{ row.sub_state != 3 ? "运输" : "" }}</a
  84. > -->
  85. <a
  86. class="map-margin"
  87. @click="outShip([row.orders_procedure_id], 1)"
  88. v-show="row.in_out_value==0"
  89. > 发货完成 </a
  90. ><a
  91. class="map-margin"
  92. v-show='row.transportation_value==0&&row.in_out_value==1'
  93. @click="row.in_out_value == 1?outShip([row.orders_procedure_id], 2):$Message.warning('请先确认发货')"
  94. >收货完成</a
  95. >
  96. </template>
  97. <Modal
  98. class-name="vertical-center-modal"
  99. width="400"
  100. title="发货指令"
  101. v-model="showStock"
  102. @on-ok="confirmOutStock"
  103. >
  104. <Form :label-width="100">
  105. <FormItem label="选择人员">
  106. <Select clearable v-model="info.user_id">
  107. <Option
  108. v-for="item of users"
  109. :key="item.id"
  110. :value="item.id"
  111. :label="item.nickname"
  112. ></Option>
  113. </Select>
  114. </FormItem>
  115. <FormItem label="出库日期">
  116. <DatePicker
  117. :options="options"
  118. v-model="time"
  119. clearable
  120. type="date"
  121. placeholder="请选择日期"
  122. ></DatePicker>
  123. </FormItem>
  124. <FormItem label="点工单形式">
  125. <RadioGroup v-model="info.work_type">
  126. <Radio :label="1">是</Radio>
  127. <Radio :label="2">否</Radio>
  128. </RadioGroup>
  129. </FormItem>
  130. <FormItem label="日薪" v-if="info.work_type == 1">
  131. <Input v-model="info.user_salary">
  132. <span slot="append">元</span>
  133. </Input>
  134. </FormItem>
  135. </Form>
  136. </Modal>
  137. </FullPage>
  138. </div>
  139. </template>
  140. <script>
  141. import { mapActions } from "vuex";
  142. export default {
  143. data() {
  144. return {
  145. list: [
  146. {
  147. title: "楼幢",
  148. name: "Select",
  149. multiple: true,
  150. filterable: true,
  151. serverName: "house",
  152. placeholder: "请选择楼幢",
  153. value: "",
  154. option: [],
  155. },
  156. {
  157. title: "单元",
  158. name: "Select",
  159. multiple: true,
  160. filterable: true,
  161. serverName: "unit",
  162. placeholder: "请选择单元",
  163. value: "",
  164. option: [{ label: 1, value: 1 }],
  165. },
  166. {
  167. title: "楼层",
  168. name: "Select",
  169. multiple: true,
  170. filterable: true,
  171. serverName: "layer",
  172. placeholder: "请选择楼层",
  173. value: "",
  174. option: [{ label: 1, value: 1 }],
  175. },
  176. {
  177. title: "房号",
  178. name: "Select",
  179. multiple: true,
  180. filterable: true,
  181. serverName: "number_detail",
  182. placeholder: "请选择房号",
  183. value: "",
  184. option: [{ label: 1, value: 1 }],
  185. },
  186. {
  187. title: "产品",
  188. name: "Select",
  189. filterable: true,
  190. serverName: "product",
  191. placeholder: "请选择产品",
  192. value: "",
  193. option: [],
  194. },
  195. {
  196. title: "图号",
  197. name: "Select",
  198. serverName: "url_number",
  199. placeholder: "请选择图号",
  200. value: "",
  201. multiple:true,
  202. filterable:true,
  203. option: [],
  204. },
  205. {
  206. title: "部件",
  207. name: "Select",
  208. serverName: "part",
  209. filterable: true,
  210. placeholder: "请选择部件",
  211. value: "",
  212. option: [],
  213. },
  214. {
  215. title: "发货状态",
  216. name: "Select",
  217. serverName: "in_out_value",
  218. value: "",
  219. option: [
  220. { label: "已发货", value: 1 },
  221. { label: "未发货", value: 0 },
  222. ],
  223. },
  224. {
  225. title: "收货状态",
  226. name: "Select",
  227. serverName: "transportation_value",
  228. value: "",
  229. option: [
  230. { label: "已收货", value: 1 },
  231. { label: "未收货", value: 0 },
  232. ],
  233. }
  234. ],
  235. logList: [],
  236. tableColums: [
  237. { type: "selection", align: "center", width: "100", fixed: "left" },
  238. {
  239. title: "房间号",
  240. align: "center",
  241. minWidth: 100,
  242. key: "number_detail",
  243. render: (h, params) => {
  244. const { row } = params;
  245. return h(
  246. "span",
  247. `${row.house}-${row.unit}-${row.layer}-${row.number_detail}`
  248. );
  249. },
  250. },
  251. {
  252. title: "产品名称",
  253. align: "center",
  254. minWidth: 200,
  255. key: "product_title",
  256. },
  257. { title: "图号", align: "center", minWidth: 200, key: "url_number" },
  258. { title: "组合名称", align: "center", minWidth: 200, key: "compose_name" },
  259. { title: "部件", align: "center", minWidth: 200, key: "part_title" },
  260. {
  261. title: "零部件",
  262. align: "center",
  263. minWidth: 200,
  264. key: "sub_part_title",
  265. },
  266. { title: "单位", align: "center", minWidth: 100, key: "company" },
  267. {
  268. title: "发货状态",
  269. align: "center",
  270. minWidth: 200,
  271. key: "",
  272. render: (h, params) =>
  273. h(
  274. "span",
  275. {},
  276. params.row.in_out_value == 0
  277. ? "未发货"
  278. : '已发货'
  279. ),
  280. },
  281. {
  282. title: "收货状态",
  283. align: "center",
  284. minWidth: 200,
  285. key: "",
  286. render: (h, params) =>
  287. h(
  288. "span",
  289. {},
  290. params.row.transportation_value == 0
  291. ? "未收货"
  292. : '已收货'
  293. ),
  294. },
  295. { title: "芯片编号", align: "center", minWidth: 200, key: "tag" },
  296. {
  297. title: "操作",
  298. align: "center",
  299. width: "150",
  300. fixed: "right",
  301. slot: "set",
  302. },
  303. ],
  304. tableData: [],
  305. pageIndex: 1,
  306. total: 0,
  307. pageSize: 10,
  308. loading: false,
  309. selectedReturnArr: [],
  310. selects: [],
  311. selects_out: [],
  312. showStock: false,
  313. info: {
  314. user_id: "",
  315. work_type: 2,
  316. order_in_no: "",
  317. start_time: "",
  318. end_time: "",
  319. user_salary: "",
  320. },
  321. users: [],
  322. time: "",
  323. shipArray: [],
  324. options: {
  325. disabledDate(date) {
  326. return date && date.valueOf() < Date.now() - 86400000;
  327. },
  328. },
  329. };
  330. },
  331. created() {
  332. this.getOptions();
  333. },
  334. methods: {
  335. async exportContent() {
  336. const res = await this.axios("/api/transport_export", {
  337. params: { transport_no:this.$route.query.transport_no },
  338. });
  339. if (res.code == 200) {
  340. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  341. location.href = url;
  342. }
  343. },
  344. outDelivery(row){
  345. this.info.order_in_no = Array.isArray(row)
  346. ? row.join(",")
  347. : row.order_in_no;
  348. this.showStock = true;
  349. },
  350. init(row) {
  351. this.axios("/api/user").then((res) => (this.users = res.data.data));
  352. this.pageIndex = 1;
  353. row.page_index = this.pageIndex;
  354. row.page_size = this.pageSize;
  355. if (this.func.isType(row.house) == "Array") {
  356. row.house = row.house.join(",");
  357. }
  358. if (this.func.isType(row.unit) == "Array") {
  359. row.unit = row.unit.join(",");
  360. }
  361. if (this.func.isType(row.layer) == "Array") {
  362. row.layer = row.layer.join(",");
  363. }
  364. if (this.func.isType(row.number_detail) == "Array") {
  365. row.number_detail = row.number_detail.join(",");
  366. }
  367. if (this.func.isType(row.product) == "Array") {
  368. row.product = row.product.join(",");
  369. }
  370. if (this.func.isType(row.part) == "Array") {
  371. row.part = row.part.join(",");
  372. }
  373. Object.assign(row, this.$route.query);
  374. this.proxyObj = row;
  375. this.getData(row);
  376. },
  377. getOptions() {
  378. this.axios("/api/orders_list_detail", {
  379. params: {
  380. order_no: this.$route.query.order_no,
  381. type: this.$route.query.type,
  382. transport_no:this.$route.query.transport_no
  383. },
  384. }).then((res) => {
  385. res.data.house.map((v) => {
  386. v.value = v.house;
  387. v.label = v.house;
  388. });
  389. res.data.unit.map((v) => {
  390. v.value = v.unit;
  391. v.label = v.unit;
  392. });
  393. res.data.layer.map((v) => {
  394. v.value = v.layer;
  395. v.label = v.layer;
  396. });
  397. res.data.number_detail.map((v) => {
  398. v.value = v.number;
  399. v.label = v.number;
  400. });
  401. res.data.product_title.map((v) => {
  402. (v.value = v.product_title), (v.label = v.product_title);
  403. });
  404. res.data.part_title.map((v) => {
  405. (v.value = v.part_title), (v.label = v.part_title);
  406. });
  407. res.data.url_number.map((v) => {
  408. (v.value = v.url_number), (v.label = v.url_number);
  409. });
  410. this.list[0].option = res.data.house;
  411. this.list[1].option = res.data.unit;
  412. this.list[2].option = res.data.layer;
  413. this.list[3].option = res.data.number_detail;
  414. this.list[4].option = res.data.product_title;
  415. this.list[5].option = res.data.url_number;
  416. this.list[6].option = res.data.part_title;
  417. });
  418. },
  419. getData(row) {
  420. this.loading = true;
  421. this.axios("/api/orders_list_detail", { params: row }).then((res) => {
  422. this.loading = false;
  423. this.tableData = res.data.data;
  424. this.logList = res.data.detail;
  425. this.total = res.data.total || 0;
  426. });
  427. },
  428. changePage(e) {
  429. this.pageIndex = e;
  430. this.proxyObj.page_index = e;
  431. this.getData(this.proxyObj);
  432. },
  433. changeSize(e) {
  434. this.pageSize = e;
  435. this.proxyObj.page_size = this.pageSize;
  436. this.getData(this.proxyObj);
  437. },
  438. back() {
  439. this.$router.go(-1);
  440. },
  441. handleOrderReturn(row) {
  442. let params = [];
  443. if (!this.selectedReturnArr || this.selectedReturnArr.length < 1) {
  444. return this.$Message.error("请至少选择一项");
  445. }
  446. // params = this.selectedReturnArr.map((v) => {
  447. // return v.chip;
  448. // });
  449. // console.log(this.selectedReturnArr)
  450. // console.log(row)
  451. this.$Modal.confirm({
  452. title: "确认退回?",
  453. content: "此操作无法恢复,请确认!",
  454. onOk: () => {
  455. this.axios({
  456. method: "post",
  457. url: "/api/transport_callback",
  458. data: {
  459. tag: row,//params
  460. },
  461. }).then((res) => {
  462. if (res.code == 200) {
  463. this.$Message.success(res.msg);
  464. this.getData(this.proxyObj);
  465. }
  466. });
  467. },
  468. onCancel: () => {},
  469. });
  470. },
  471. selectTable(row) {
  472. this.selectedReturnArr = row;
  473. this.selects = [];
  474. row.forEach(v => {
  475. this.selects.push(v.orders_procedure_id)
  476. });
  477. console.log(this.selects)
  478. },
  479. confirmSuccess(row) {
  480. let params = "";
  481. if (!row || row.length < 1) {
  482. return this.$Message.error("请至少选择一项");
  483. }
  484. params = Array.isArray(row) ? row.join(",") : row.orders_procedure_id;
  485. this.confirmDelete({
  486. title: "包装完成",
  487. content: "是否确认包装完成",
  488. type: "primary",
  489. then: () => {
  490. this.axios
  491. .post("/api/orders_in", { orders_procedure_id: params })
  492. .then((res) => {
  493. if (res.code == 200) {
  494. this.$Message.success(res.msg);
  495. this.getData(this.proxyObj);
  496. }
  497. });
  498. },
  499. cancel: () => {
  500. this.$Message.warning("您取消了包装完成操作");
  501. },
  502. });
  503. },
  504. outStock(row) {
  505. console.log("row :>> ", row);
  506. if (!row || row.length < 1) {
  507. return this.$Message.error("您未选择或者未确认包装完成");
  508. }
  509. this.info.order_in_no = Array.isArray(row)
  510. ? row.join(",")
  511. : row.order_in_no;
  512. this.showStock = true;
  513. },
  514. confirmOutStock() {
  515. if (this.time) {
  516. this.info.start_time = new Date(this.time)
  517. .toLocaleDateString()
  518. .replace(/\//g, "-");
  519. this.info.end_time = new Date(this.time)
  520. .toLocaleDateString()
  521. .replace(/\//g, "-");
  522. }
  523. this.axios.post("/api/orders_out", this.info).then((res) => {
  524. if (res.code == 200) {
  525. this.$Message.success(res.msg);
  526. this.getData(this.proxyObj);
  527. // setTimeout(()=>this.back(),500)
  528. }
  529. });
  530. },
  531. outShip(row, type) {
  532. //type 1出库 2运输
  533. if (type == 3) {
  534. this.confirmDelete({
  535. title: "包装完成",
  536. content: "是否确认包装完成",
  537. type: "primary",
  538. then: () => {
  539. console.log(row)
  540. this.axios
  541. .post("/api/orders_in", { orders_procedure_id: row.orders_procedure_id })
  542. .then((res) => {
  543. if (res.code == 200) {
  544. this.$Message.success(res.msg);
  545. this.getData(this.proxyObj);
  546. }
  547. });
  548. },
  549. cancel: (e) => {},
  550. });
  551. } else {
  552. if (!row || row.length < 1) {
  553. return this.$Message.error("请至少选择一项");
  554. }
  555. let id = Array.isArray(row) ? row.join(",") : row.id;
  556. let post_url =
  557. type == 1 ? "/api/orders_transport" : '/api/orders_transport_confirm';
  558. let params = {};
  559. params.id = id;
  560. this.confirmDelete({
  561. title: type == 1 ? "发货完成" : "收获完成",
  562. content: type == 1 ? "是否确认发货完成" : "是否确认收获完成",
  563. type: "primary",
  564. then: (e) => {
  565. this.axios.post(post_url, params).then((res) => {
  566. if (res.code == 200) {
  567. this.$Message.success(res.msg);
  568. this.getData(this.proxyObj);
  569. }
  570. });
  571. },
  572. cancel: (e) => {},
  573. });
  574. }
  575. },
  576. async exportData() {
  577. const res = await this.axios("/api/orders_list_detail", {
  578. params: { ...this.proxyObj, sub_type: "excel" },
  579. });
  580. if (res.code == 200) {
  581. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  582. location.href = url;
  583. }
  584. },
  585. },
  586. };
  587. </script>
  588. <style lang="scss" scoped></style>