DeliveryDetail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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. serverName: "product",
  190. placeholder: "请选择产品",
  191. value: "",
  192. option: [],
  193. },
  194. {
  195. title: "图号",
  196. name: "Select",
  197. serverName: "url_number",
  198. placeholder: "请选择产品",
  199. value: "",
  200. option: [],
  201. },
  202. {
  203. title: "部件",
  204. name: "Select",
  205. serverName: "part",
  206. placeholder: "请选择部件",
  207. value: "",
  208. option: [],
  209. },
  210. {
  211. title: "发货状态",
  212. name: "Select",
  213. serverName: "in_out_value",
  214. value: "",
  215. option: [
  216. { label: "已发货", value: 1 },
  217. { label: "未发货", value: 0 },
  218. ],
  219. },
  220. {
  221. title: "收货状态",
  222. name: "Select",
  223. serverName: "transportation_value",
  224. value: "",
  225. option: [
  226. { label: "已收货", value: 1 },
  227. { label: "未收货", value: 0 },
  228. ],
  229. }
  230. ],
  231. logList: [],
  232. tableColums: [
  233. { type: "selection", align: "center", width: "100", fixed: "left" },
  234. {
  235. title: "房间号",
  236. align: "center",
  237. minWidth: 100,
  238. key: "number_detail",
  239. render: (h, params) => {
  240. const { row } = params;
  241. return h(
  242. "span",
  243. `${row.house}-${row.unit}-${row.layer}-${row.number_detail}`
  244. );
  245. },
  246. },
  247. {
  248. title: "产品名称",
  249. align: "center",
  250. minWidth: 200,
  251. key: "product_title",
  252. },
  253. { title: "图号", align: "center", minWidth: 200, key: "url_number" },
  254. { title: "部件", align: "center", minWidth: 200, key: "part_title" },
  255. {
  256. title: "零部件",
  257. align: "center",
  258. minWidth: 200,
  259. key: "sub_part_title",
  260. },
  261. { title: "单位", align: "center", minWidth: 100, key: "company" },
  262. {
  263. title: "发货状态",
  264. align: "center",
  265. minWidth: 200,
  266. key: "",
  267. render: (h, params) =>
  268. h(
  269. "span",
  270. {},
  271. params.row.in_out_value == 0
  272. ? "未发货"
  273. : '已发货'
  274. ),
  275. },
  276. {
  277. title: "收货状态",
  278. align: "center",
  279. minWidth: 200,
  280. key: "",
  281. render: (h, params) =>
  282. h(
  283. "span",
  284. {},
  285. params.row.transportation_value == 0
  286. ? "未收货"
  287. : '已收货'
  288. ),
  289. },
  290. { title: "芯片编号", align: "center", minWidth: 200, key: "tag" },
  291. {
  292. title: "操作",
  293. align: "center",
  294. width: "150",
  295. fixed: "right",
  296. slot: "set",
  297. },
  298. ],
  299. tableData: [],
  300. pageIndex: 1,
  301. total: 0,
  302. pageSize: 10,
  303. loading: false,
  304. selectedReturnArr: [],
  305. selects: [],
  306. selects_out: [],
  307. showStock: false,
  308. info: {
  309. user_id: "",
  310. work_type: 2,
  311. order_in_no: "",
  312. start_time: "",
  313. end_time: "",
  314. user_salary: "",
  315. },
  316. users: [],
  317. time: "",
  318. shipArray: [],
  319. options: {
  320. disabledDate(date) {
  321. return date && date.valueOf() < Date.now() - 86400000;
  322. },
  323. },
  324. };
  325. },
  326. created() {
  327. this.getOptions();
  328. },
  329. methods: {
  330. async exportContent() {
  331. const res = await this.axios("/api/transport_export", {
  332. params: { transport_no:this.$route.query.transport_no },
  333. });
  334. if (res.code == 200) {
  335. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  336. location.href = url;
  337. }
  338. },
  339. outDelivery(row){
  340. this.info.order_in_no = Array.isArray(row)
  341. ? row.join(",")
  342. : row.order_in_no;
  343. this.showStock = true;
  344. },
  345. init(row) {
  346. this.axios("/api/user").then((res) => (this.users = res.data.data));
  347. this.pageIndex = 1;
  348. row.page_index = this.pageIndex;
  349. row.page_size = this.pageSize;
  350. if (this.func.isType(row.house) == "Array") {
  351. row.house = row.house.join(",");
  352. }
  353. if (this.func.isType(row.unit) == "Array") {
  354. row.unit = row.unit.join(",");
  355. }
  356. if (this.func.isType(row.layer) == "Array") {
  357. row.layer = row.layer.join(",");
  358. }
  359. if (this.func.isType(row.number_detail) == "Array") {
  360. row.number_detail = row.number_detail.join(",");
  361. }
  362. if (this.func.isType(row.product) == "Array") {
  363. row.product = row.product.join(",");
  364. }
  365. if (this.func.isType(row.part) == "Array") {
  366. row.part = row.part.join(",");
  367. }
  368. Object.assign(row, this.$route.query);
  369. this.proxyObj = row;
  370. this.getData(row);
  371. },
  372. getOptions() {
  373. this.axios("/api/orders_list_detail", {
  374. params: {
  375. order_no: this.$route.query.order_no,
  376. type: this.$route.query.type,
  377. transport_no:this.$route.query.transport_no
  378. },
  379. }).then((res) => {
  380. res.data.house.map((v) => {
  381. v.value = v.house;
  382. v.label = v.house;
  383. });
  384. res.data.unit.map((v) => {
  385. v.value = v.unit;
  386. v.label = v.unit;
  387. });
  388. res.data.layer.map((v) => {
  389. v.value = v.layer;
  390. v.label = v.layer;
  391. });
  392. res.data.number_detail.map((v) => {
  393. v.value = v.number;
  394. v.label = v.number;
  395. });
  396. res.data.product_title.map((v) => {
  397. (v.value = v.product_title), (v.label = v.product_title);
  398. });
  399. res.data.part_title.map((v) => {
  400. (v.value = v.part_title), (v.label = v.part_title);
  401. });
  402. res.data.url_number.map((v) => {
  403. (v.value = v.url_number), (v.label = v.url_number);
  404. });
  405. this.list[0].option = res.data.house;
  406. this.list[1].option = res.data.unit;
  407. this.list[2].option = res.data.layer;
  408. this.list[3].option = res.data.number_detail;
  409. this.list[4].option = res.data.product_title;
  410. this.list[5].option = res.data.url_number;
  411. this.list[6].option = res.data.part_title;
  412. });
  413. },
  414. getData(row) {
  415. this.loading = true;
  416. this.axios("/api/orders_list_detail", { params: row }).then((res) => {
  417. this.loading = false;
  418. this.tableData = res.data.data;
  419. this.logList = res.data.detail;
  420. this.total = res.data.total || 0;
  421. });
  422. },
  423. changePage(e) {
  424. this.pageIndex = e;
  425. this.proxyObj.page_index = e;
  426. this.getData(this.proxyObj);
  427. },
  428. changeSize(e) {
  429. this.pageSize = e;
  430. this.proxyObj.page_size = this.pageSize;
  431. this.getData(this.proxyObj);
  432. },
  433. back() {
  434. this.$router.go(-1);
  435. },
  436. handleOrderReturn(row) {
  437. let params = [];
  438. if (!this.selectedReturnArr || this.selectedReturnArr.length < 1) {
  439. return this.$Message.error("请至少选择一项");
  440. }
  441. // params = this.selectedReturnArr.map((v) => {
  442. // return v.chip;
  443. // });
  444. // console.log(this.selectedReturnArr)
  445. // console.log(row)
  446. this.$Modal.confirm({
  447. title: "确认退回?",
  448. content: "此操作无法恢复,请确认!",
  449. onOk: () => {
  450. this.axios({
  451. method: "post",
  452. url: "/api/transport_callback",
  453. data: {
  454. tag: row,//params
  455. },
  456. }).then((res) => {
  457. if (res.code == 200) {
  458. this.$Message.success(res.msg);
  459. this.getData(this.proxyObj);
  460. }
  461. });
  462. },
  463. onCancel: () => {},
  464. });
  465. },
  466. selectTable(row) {
  467. this.selectedReturnArr = row;
  468. this.selects = [];
  469. row.forEach(v => {
  470. this.selects.push(v.orders_procedure_id)
  471. });
  472. console.log(this.selects)
  473. },
  474. confirmSuccess(row) {
  475. let params = "";
  476. if (!row || row.length < 1) {
  477. return this.$Message.error("请至少选择一项");
  478. }
  479. params = Array.isArray(row) ? row.join(",") : row.orders_procedure_id;
  480. this.confirmDelete({
  481. title: "包装完成",
  482. content: "是否确认包装完成",
  483. type: "primary",
  484. then: () => {
  485. this.axios
  486. .post("/api/orders_in", { orders_procedure_id: params })
  487. .then((res) => {
  488. if (res.code == 200) {
  489. this.$Message.success(res.msg);
  490. this.getData(this.proxyObj);
  491. }
  492. });
  493. },
  494. cancel: () => {
  495. this.$Message.warning("您取消了包装完成操作");
  496. },
  497. });
  498. },
  499. outStock(row) {
  500. console.log("row :>> ", row);
  501. if (!row || row.length < 1) {
  502. return this.$Message.error("您未选择或者未确认包装完成");
  503. }
  504. this.info.order_in_no = Array.isArray(row)
  505. ? row.join(",")
  506. : row.order_in_no;
  507. this.showStock = true;
  508. },
  509. confirmOutStock() {
  510. if (this.time) {
  511. this.info.start_time = new Date(this.time)
  512. .toLocaleDateString()
  513. .replace(/\//g, "-");
  514. this.info.end_time = new Date(this.time)
  515. .toLocaleDateString()
  516. .replace(/\//g, "-");
  517. }
  518. this.axios.post("/api/orders_out", this.info).then((res) => {
  519. if (res.code == 200) {
  520. this.$Message.success(res.msg);
  521. this.getData(this.proxyObj);
  522. // setTimeout(()=>this.back(),500)
  523. }
  524. });
  525. },
  526. outShip(row, type) {
  527. //type 1出库 2运输
  528. if (type == 3) {
  529. this.confirmDelete({
  530. title: "包装完成",
  531. content: "是否确认包装完成",
  532. type: "primary",
  533. then: () => {
  534. console.log(row)
  535. this.axios
  536. .post("/api/orders_in", { orders_procedure_id: row.orders_procedure_id })
  537. .then((res) => {
  538. if (res.code == 200) {
  539. this.$Message.success(res.msg);
  540. this.getData(this.proxyObj);
  541. }
  542. });
  543. },
  544. cancel: (e) => {},
  545. });
  546. } else {
  547. if (!row || row.length < 1) {
  548. return this.$Message.error("请至少选择一项");
  549. }
  550. let id = Array.isArray(row) ? row.join(",") : row.id;
  551. let post_url =
  552. type == 1 ? "/api/orders_transport" : '/api/orders_transport_confirm';
  553. let params = {};
  554. params.id = id;
  555. this.confirmDelete({
  556. title: type == 1 ? "发货完成" : "收获完成",
  557. content: type == 1 ? "是否确认发货完成" : "是否确认收获完成",
  558. type: "primary",
  559. then: (e) => {
  560. this.axios.post(post_url, params).then((res) => {
  561. if (res.code == 200) {
  562. this.$Message.success(res.msg);
  563. this.getData(this.proxyObj);
  564. }
  565. });
  566. },
  567. cancel: (e) => {},
  568. });
  569. }
  570. },
  571. async exportData() {
  572. const res = await this.axios("/api/orders_list_detail", {
  573. params: { ...this.proxyObj, sub_type: "excel" },
  574. });
  575. if (res.code == 200) {
  576. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  577. location.href = url;
  578. }
  579. },
  580. },
  581. };
  582. </script>
  583. <style lang="scss" scoped></style>