DeliveryDetail.vue 16 KB

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