index.vue 11 KB

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