index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <script>
  2. import test from "@/components/form-test/index.vue";
  3. import query from "@/components/query/index.vue";
  4. import sendGoods from "./sendGoods.vue";
  5. import * as API from "@/api/purchase-management/deliver-goods/index.js";
  6. import PurchaseDetails from "@/components/purchase/details.vue";
  7. export default {
  8. components: {
  9. query,
  10. sendGoods,
  11. test,
  12. PurchaseDetails,
  13. },
  14. data() {
  15. return {
  16. purchaseStatusList: [],
  17. productTypeList: [],
  18. supplySelectList: [],
  19. supplyTypeList: [],
  20. queryParams: {
  21. pageNum: 1,
  22. pageSize: 10,
  23. status: "",
  24. code: "",
  25. },
  26. selectConfig: [
  27. {
  28. label: "发货状态",
  29. prop: "status",
  30. data: [],
  31. },
  32. // {
  33. // label: "付款状态",
  34. // prop: "type",
  35. // data: [],
  36. // },
  37. ],
  38. tableList: [],
  39. total: 0,
  40. loading: false,
  41. titleText: "",
  42. open: false,
  43. form: {
  44. businessId: "",
  45. businessType: "1",
  46. logisticsCompanyCode: "",
  47. code: "",
  48. details: [],
  49. fileInfos: [],
  50. },
  51. openArrive: false,
  52. arriveForm: {
  53. name: "",
  54. id: "",
  55. code: "",
  56. },
  57. arriveFormRules: {
  58. id: [
  59. {
  60. required: true,
  61. message: "请选择物流/快递单号",
  62. trigger: "change",
  63. },
  64. ],
  65. },
  66. selectData: [],
  67. logisticsData: [],
  68. rowData: {},
  69. detailsDialog: false,
  70. };
  71. },
  72. created() {
  73. const businessDictData = JSON.parse(
  74. window.localStorage.getItem("businessDict")
  75. );
  76. this.purchaseStatusList = businessDictData.find(
  77. (item) => item.code === "sendGoodsStatus"
  78. ).children;
  79. this.selectConfig[0].data = this.purchaseStatusList
  80. .filter((x) => Number(x.dictKey) > 20)
  81. .map((item) => ({
  82. label: item.dictValue,
  83. value: item.dictKey,
  84. }));
  85. this.getList();
  86. },
  87. methods: {
  88. deliverGoods() {
  89. this.$router.push({
  90. path: "/purchase-management/deliver-goods/index",
  91. });
  92. },
  93. getList() {
  94. this.loading = true;
  95. API.deliveryList(this.queryParams).then(
  96. (res) => {
  97. this.tableList = res.data.data.records;
  98. this.total = res.data.data.total;
  99. this.loading = false;
  100. },
  101. (err) => {
  102. console.log("deliveryList: " + err);
  103. this.loading = false;
  104. }
  105. );
  106. },
  107. handleQuery() {
  108. this.getList();
  109. },
  110. handleSelectionChange(arr) {
  111. this.selectData = arr;
  112. },
  113. handleReturn(row) {
  114. console.log(row, "ass");
  115. },
  116. handleSend(row) {
  117. this.form = {
  118. businessId: row.id,
  119. businessType: "1",
  120. logisticsCompanyCode: "",
  121. code: "",
  122. puCode: row.code,
  123. supplierName: row.supplierName,
  124. details: [],
  125. fileInfos: [],
  126. };
  127. this.titleText = "发货通知";
  128. this.open = true;
  129. this.$nextTick(() => {
  130. this.$refs.sendGoods.loading = true;
  131. API.lookSendGoodsDetails({ id: row.id }).then(
  132. (res) => {
  133. this.form.details = res.data.data.map((x) => ({
  134. goodsCode: x.productCode,
  135. goodsName: x.productName,
  136. quantity: x.purchaseQuantity,
  137. purchaseId: row.id,
  138. applyPurchaseId: x.applyPurchaseId,
  139. shipmentQuantity:
  140. Number(x.purchaseQuantity) - Number(x.deliverQuantity) > 0
  141. ? Number(x.purchaseQuantity) - Number(x.deliverQuantity)
  142. : 0,
  143. deliverQuantity: x.deliverQuantity,
  144. }));
  145. console.log(this.form.details, "ass");
  146. this.$refs.sendGoods.loading = false;
  147. },
  148. (err) => {
  149. this.$refs.sendGoods.loading = false;
  150. }
  151. );
  152. });
  153. },
  154. handleCancel() {
  155. this.form = {
  156. businessId: "",
  157. businessType: "1",
  158. logisticsCompanyCode: "",
  159. code: "",
  160. details: [],
  161. fileInfos: [],
  162. };
  163. this.open = false;
  164. },
  165. handleSubmit() {
  166. API.deliveryNotice(this.form).then(
  167. () => {
  168. this.msgSuccess("添加成功");
  169. this.$refs.sendGoods.loading = false;
  170. this.open = false;
  171. this.getList();
  172. this.handleCancel();
  173. },
  174. (err) => {
  175. console.log("sendPurchase: " + err);
  176. this.$refs.sendGoods.loading = false;
  177. }
  178. );
  179. },
  180. handleArrive(row) {
  181. this.openArrive = true;
  182. this.titleText = "到货通知";
  183. API.logisticsSelectData({ businessId: row.id }).then(
  184. (res) => {
  185. this.logisticsData = res.data.data;
  186. this.arriveForm = {
  187. code: row.code,
  188. supplierName: row.supplierName,
  189. purchaseId: row.id,
  190. id: "",
  191. };
  192. },
  193. (err) => {
  194. console.log("logisticsSelectData: " + err);
  195. }
  196. );
  197. },
  198. handlePurchaseEnd(row) {
  199. this.$confirm("是否确定此操作 ?", {
  200. confirmButtonText: "确定",
  201. cancelButtonText: "取消",
  202. type: "warning",
  203. }).then(() => {
  204. API.purchaseEnd({ id: row.id }).then(() => {
  205. this.msgSuccess("操作成功");
  206. this.getList();
  207. });
  208. });
  209. },
  210. handlePurchaseCancel(row) {
  211. this.$confirm("是否确定此操作 ?", {
  212. confirmButtonText: "确定",
  213. cancelButtonText: "取消",
  214. type: "warning",
  215. }).then(() => {
  216. API.purchaseCancel({ id: row.id }).then(() => {
  217. this.msgSuccess("操作成功");
  218. this.getList();
  219. });
  220. });
  221. },
  222. handleSubmit1() {
  223. this.$refs.arriveForm.validate((valid) => {
  224. if (valid) {
  225. delete this.arriveForm.code;
  226. delete this.arriveForm.supplierName;
  227. API.arrivalNotice(this.arriveForm).then(() => {
  228. this.msgSuccess("操作成功");
  229. this.getList();
  230. this.handleCancel1();
  231. });
  232. }
  233. });
  234. },
  235. handleCancel1() {
  236. this.openArrive = false;
  237. this.getList();
  238. },
  239. isSelectable(row) {
  240. if (row.status != 30) {
  241. return false;
  242. } else {
  243. return true;
  244. }
  245. },
  246. showAddress(row) {
  247. return (
  248. <div>
  249. {row.countryName} , {row.provinceName} , {row.cityName}
  250. </div>
  251. );
  252. },
  253. openDetails(row) {
  254. this.rowData = { ...row };
  255. this.detailsDialog = true;
  256. },
  257. },
  258. };
  259. </script>
  260. <template>
  261. <div>
  262. <el-card class="box-card">
  263. <query
  264. :selectConfig="selectConfig"
  265. :req="queryParams"
  266. :isShowMore="false"
  267. @handleQuery="handleQuery"
  268. @handleMore="
  269. () => {
  270. queryDialog = true;
  271. }
  272. "
  273. ></query>
  274. <el-table :data="tableList" v-loading="loading">
  275. <el-table-column label="采购单号" align="left" prop="code" width="150">
  276. <template slot-scope="scope">
  277. <div class="show_underline" @click="openDetails(scope.row)">
  278. {{ scope.row.code }}
  279. </div>
  280. </template>
  281. </el-table-column>
  282. <el-table-column label="供应商" align="left" prop="supplierName" />
  283. <el-table-column
  284. label="采购总金额"
  285. align="left"
  286. prop="price"
  287. width="140"
  288. />
  289. <el-table-column
  290. label="采购员"
  291. align="left"
  292. prop="createName"
  293. width="120"
  294. />
  295. <el-table-column
  296. label="采购时间"
  297. align="left"
  298. prop="createTime"
  299. width="160"
  300. />
  301. <el-table-column
  302. label="状态"
  303. align="left"
  304. width="120"
  305. :formatter="(row) => dictDataEcho(row.status, purchaseStatusList)"
  306. />
  307. <!-- <el-table-column
  308. label="付款状态"
  309. align="left"
  310. prop="createName"
  311. width="120"
  312. /> -->
  313. <el-table-column label="操作" align="center" width="280">
  314. <template slot-scope="scope">
  315. <div v-if="scope.row.status !== 99 && scope.row.status !== 50">
  316. <el-button type="text" @click="handleReturn(scope.row)">
  317. 退货
  318. </el-button>
  319. <el-button type="text" @click="handleSend(scope.row)">
  320. 发货通知
  321. </el-button>
  322. <el-button type="text" @click="handleArrive(scope.row)"
  323. >到货通知
  324. </el-button>
  325. <el-button type="text" @click="handlePurchaseEnd(scope.row)"
  326. >结束
  327. </el-button>
  328. <el-button type="text" @click="handlePurchaseCancel(scope.row)"
  329. >取消
  330. </el-button>
  331. </div>
  332. </template>
  333. </el-table-column>
  334. </el-table>
  335. <pagination
  336. v-show="total > 0"
  337. :total="total"
  338. :page.sync="queryParams.pageNum"
  339. :limit.sync="queryParams.pageSize"
  340. @pagination="getList"
  341. />
  342. </el-card>
  343. <el-dialog
  344. :title="titleText"
  345. :visible.sync="open"
  346. v-if="open"
  347. width="80%"
  348. top="60px"
  349. >
  350. <send-goods
  351. :form="form"
  352. @submit="handleSubmit"
  353. @cancel="handleCancel"
  354. ref="sendGoods"
  355. ></send-goods>
  356. </el-dialog>
  357. <el-dialog
  358. title="到货通知"
  359. :visible.sync="openArrive"
  360. v-if="openArrive"
  361. width="30%"
  362. top="60px"
  363. >
  364. <el-form
  365. label-position="top"
  366. :model="arriveForm"
  367. ref="arriveForm"
  368. :rules="arriveFormRules"
  369. label-width="100px"
  370. >
  371. <el-row>
  372. <el-col :span="8">
  373. <el-form-item label="采购单号" prop="code">
  374. <el-input
  375. v-model="arriveForm.code"
  376. placeholder="请输入"
  377. disabled
  378. ></el-input>
  379. </el-form-item>
  380. </el-col>
  381. </el-row>
  382. <el-form-item label="供应商" prop="supplierName">
  383. <el-input
  384. v-model="arriveForm.supplierName"
  385. placeholder="请输入"
  386. disabled
  387. ></el-input>
  388. </el-form-item>
  389. <el-row>
  390. <el-col :span="8">
  391. <el-form-item label="物流/快递单号" prop="id">
  392. <el-select
  393. v-model="arriveForm.id"
  394. placeholder="请选择"
  395. style="width: 100%"
  396. >
  397. <el-option
  398. v-for="item in logisticsData"
  399. :key="item.id"
  400. :label="item.code"
  401. :value="item.id"
  402. >
  403. </el-option>
  404. </el-select>
  405. </el-form-item>
  406. </el-col>
  407. </el-row>
  408. </el-form>
  409. <div style="text-align: center; margin-top: 15px">
  410. <el-button size="small" @click="handleCancel1">取消 </el-button>
  411. <el-button type="primary" size="small" @click="handleSubmit1">
  412. 确定</el-button
  413. >
  414. </div>
  415. </el-dialog>
  416. <el-dialog
  417. title="采购详情"
  418. v-if="detailsDialog"
  419. :visible.sync="detailsDialog"
  420. width="50%"
  421. top="60px"
  422. >
  423. <PurchaseDetails :rowData="rowData"></PurchaseDetails>
  424. </el-dialog>
  425. </div>
  426. </template>
  427. <style lang="scss" scoped>
  428. .box-card {
  429. height: calc(100vh - 110px);
  430. overflow-y: auto;
  431. }
  432. </style>