index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow">
  4. <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" @row-del="rowDel"
  5. @row-update="rowUpdate" :before-open="beforeOpen" :before-close="beforeClose" :search.sync="search"
  6. @row-save="rowSave" @saveColumn="saveColumn" @search-change="searchChange" @search-reset="searchReset"
  7. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  8. @refresh-change="refreshChange" @on-load="onLoad" @tree-load="treeLoad" :cell-style="tableRowClassName"
  9. :table-loading="loading" @expand-change="expandChange" @resetColumn="resetColumn"
  10. @search-criteria-switch="searchCriteriaSwitch">
  11. <template slot-scope="scope" slot="expand">
  12. <el-table :data="scope.row.insideList" v-loading="scope.row.loading" :cell-style="tableRowClassName">
  13. <el-table-column label="产品分类" prop="priceCategory" align="center" show-overflow-tooltip width="200">
  14. </el-table-column>
  15. <el-table-column label="价格类别" prop="priceType" align="center" show-overflow-tooltip width="180">
  16. </el-table-column>
  17. <el-table-column label="商品名称" prop="cname" align="center" show-overflow-tooltip width="120">
  18. </el-table-column>
  19. <el-table-column label="编码" prop="code" align="center" show-overflow-tooltip width="120"></el-table-column>
  20. <el-table-column label="规格型号" prop="typeno" align="center" show-overflow-tooltip width="120">
  21. </el-table-column>
  22. <el-table-column label="供应商" prop="corpName" align="center" show-overflow-tooltip width="120">
  23. </el-table-column>
  24. <el-table-column label="订货数量" prop="orderQuantity" align="center" show-overflow-tooltip width="180">
  25. </el-table-column>
  26. <el-table-column label="发货数量" prop="actualQuantity" align="center" show-overflow-tooltip width="200">
  27. </el-table-column>
  28. <el-table-column label="库存" prop="storageQuantity" align="center" show-overflow-tooltip width="200">
  29. </el-table-column>
  30. <el-table-column label="采购价格" prop="purchaseAmount" align="center" show-overflow-tooltip width="200">
  31. </el-table-column>
  32. <el-table-column label="最新单价" prop="price" align="center" show-overflow-tooltip width="200">
  33. </el-table-column>
  34. <el-table-column label="金额" prop="amount" align="center" show-overflow-tooltip width="200">
  35. </el-table-column>
  36. </el-table>
  37. </template>
  38. <!--车号1-->
  39. <template slot="wagonNumberOne" slot-scope="{ row }">
  40. <span style="color: #409EFF; cursor: pointer;" @click="openTrack(row,1, row.wagonNumberOne)">{{row.wagonNumberOne}}</span>
  41. </template>
  42. <!--车号2-->
  43. <template slot="wagonNumberTwo" slot-scope="{ row }">
  44. <span style="color: #409EFF; cursor: pointer;" @click="openTrack(row,1, row.wagonNumberTwo)">{{row.wagonNumberTwo}}</span>
  45. </template>
  46. <template slot-scope="scope" slot="orderNo">
  47. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{scope.row.orgOrderNo}}</span>
  48. </template>
  49. <template slot="corpIdSearch">
  50. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  51. </template>
  52. <template slot-scope="scope" slot="corpId">
  53. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row, scope.index)">{{scope.row.corpsName}}</span>
  54. </template>
  55. <template slot-scope="scope" slot="createUser">
  56. {{ scope.row.createUserName }}
  57. </template>
  58. <template slot-scope="scope" slot="createPurchase">
  59. {{ scope.row.createPurchase == 1 ? "是" : "否" }}
  60. </template>
  61. <template slot-scope="scope" slot="createFreight">
  62. {{ scope.row.createFreight == 1 ? "是" : "否" }}
  63. </template>
  64. <template slot="status" slot-scope="scope">
  65. <span v-if="scope.row.status == 0">暂存</span>
  66. <span v-else-if="scope.row.status == 1">提交请核</span>
  67. <span v-else-if="scope.row.status == 2">审批中</span>
  68. <span v-else-if="scope.row.status == 3">审批通过</span>
  69. </template>
  70. <template slot="specialCheck" slot-scope="scope">
  71. <span v-if="scope.row.specialCheck == 0">否</span>
  72. <span v-else>是</span>
  73. </template>
  74. <template slot="specialCheckStatus" slot-scope="scope">
  75. <span v-if="scope.row.specialCheckStatus == 0">未提交</span>
  76. <span v-if="scope.row.specialCheckStatus == 1">提交</span>
  77. <span v-if="scope.row.specialCheckStatus == 2">审批中</span>
  78. <span v-if="scope.row.specialCheckStatus == 3">审批通过</span>
  79. </template>
  80. <template slot="menuLeft" slot-scope="{ size }">
  81. <el-button type="success" :size="size" style="font-size: 12px;" @click="copyOrder" :disabled="single">复制单据</el-button>
  82. <el-button type="info" :size="size" style="font-size: 12px;" icon="el-icon-printer" @click="exportExcel">导 出</el-button>
  83. <el-button type="info" size="small" style="font-size: 12px;" icon="el-icon-download" @click="exportHandle">库 存</el-button>
  84. </template>
  85. <template slot-scope="scope" slot="menu">
  86. <el-button type="text" size="small" v-debounce @click="saveSell(scope.row)"
  87. :disabled="scope.row.status < 3 || scope.row.createPurchase == 1" v-if="isProcurements">生成采购</el-button>
  88. <el-button type="text" size="small" v-debounce @click="customerReceipt(scope.row)" :disabled="
  89. !scope.row.status ||
  90. scope.row.status < 3 ||
  91. scope.row.createFreight == 1
  92. ">客户收货</el-button>
  93. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="rowDel(scope.row, scope.index)"
  94. :disabled="scope.row.status > 0">删除
  95. </el-button>
  96. </template>
  97. </avue-crud>
  98. </basic-container>
  99. <detail-page ref="detail" :isProcurements = "isProcurements" @goBack="goBack" :detailData="detailData" v-if="!isShow"></detail-page>
  100. <el-dialog
  101. title="实时位置"
  102. append-to-body
  103. custom-class="dialog_two"
  104. :visible.sync="dialogVisible"
  105. lock-scroll
  106. width="80%">
  107. <div id="container"></div>
  108. </el-dialog>
  109. </div>
  110. </template>
  111. <script>
  112. import option from "./configuration/mainList.json";
  113. import {
  114. customerList,
  115. typeSave,
  116. deleteDetails,
  117. saveSell,
  118. detail,
  119. generateShipment,
  120. genClient,
  121. warehouseList,
  122. isProcurement
  123. } from "@/api/basicData/configuration";
  124. import detailPage from "./detailsPageEdit";
  125. import search from "../../../page/index/search";
  126. import { defaultDate } from "@/util/date";
  127. import { getToken } from "@/util/auth";
  128. import os from "os";
  129. import { gainUser } from "@/api/basicData/customerInquiry";
  130. import { getCurrentDate } from "@/util/date";
  131. import {location} from "@/api/gaude";
  132. export default {
  133. name: "customerInformation",
  134. components: {
  135. detailPage
  136. },
  137. data() {
  138. return {
  139. loading: false,
  140. configuration: {
  141. multipleChoices: false,
  142. multiple: false,
  143. collapseTags: false,
  144. placeholder: "请点击右边按钮选择",
  145. dicData: [],
  146. clearable: true
  147. },
  148. form: {},
  149. option: {},
  150. parentId: 0,
  151. search: {},
  152. dataList: [],
  153. isProcurements:true,
  154. page: {
  155. pageSize: 10,
  156. currentPage: 1,
  157. total: 0,
  158. pageSizes: [10, 50, 100, 200, 300]
  159. },
  160. // 非单个禁用
  161. single: true,
  162. // 非多个禁用
  163. multiple: true,
  164. selection: [],
  165. isShow: true,
  166. detailData: {},
  167. warehouseTypeOption: [],
  168. warehouseList: [],
  169. // 车号弹窗显示位置
  170. dialogVisible:false,
  171. // 当前用户的租户号
  172. hctenantId:null,
  173. };
  174. },
  175. async created() {
  176. // 获取缓存里的租户号信息
  177. this.hctenantId = JSON.parse(localStorage.getItem('saber-tenantId')).content
  178. // this.search.businesDate = defaultDate(1);
  179. this.search.createTime = defaultDate(3);
  180. // this.option = option
  181. this.option = await this.getColumnData(this.getColumnName(14), option);
  182. this.getWorkDicts("payment_term").then(res => {
  183. this.findObject(this.option.column, "paymentType").dicData =
  184. res.data.data;
  185. });
  186. this.getWorkDicts("order_status").then(res => {
  187. this.findObject(this.option.column, "orderStatus").dicData =
  188. res.data.data;
  189. });
  190. gainUser().then(res => {
  191. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  192. });
  193. let i = 0;
  194. this.option.column.forEach(item => {
  195. if (item.search) i++;
  196. });
  197. if (i % 3 !== 0) {
  198. const num = 3 - Number(i % 3);
  199. this.option.searchMenuSpan = num * 8;
  200. this.option.searchMenuPosition = "right";
  201. }
  202. this.option.column.forEach(item => {
  203. if (item.pickerOptions) {
  204. item.pickerOptions = {
  205. shortcuts: [
  206. {
  207. text: "最近一周",
  208. onClick(picker) {
  209. const end = new Date();
  210. const start = new Date();
  211. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  212. picker.$emit("pick", [start, end]);
  213. }
  214. },
  215. {
  216. text: "最近一个月",
  217. onClick(picker) {
  218. const end = new Date();
  219. const start = new Date();
  220. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  221. picker.$emit("pick", [start, end]);
  222. }
  223. },
  224. {
  225. text: "最近三个月",
  226. onClick(picker) {
  227. const end = new Date();
  228. const start = new Date();
  229. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  230. picker.$emit("pick", [start, end]);
  231. }
  232. }
  233. ]
  234. };
  235. }
  236. });
  237. this.getWorkDicts("warehouseType").then(res => {
  238. this.warehouseTypeOption = res.data.data
  239. })
  240. warehouseList().then(res => {
  241. this.warehouseList = res.data.data.records
  242. if (this.hctenantId != 681169) {
  243. this.isProcurements = false
  244. }
  245. })
  246. },
  247. activated() {
  248. setTimeout(() => {
  249. if (this.$route.query.id) {
  250. this.isShow = true;
  251. this.beforeOpenPage({ id: this.$route.query.id });
  252. }
  253. if (this.$route.query.check) {
  254. this.isShow = true;
  255. // this.beforeOpenPage({id: this.$route.query.check.billId})
  256. this.detailData = {
  257. id: this.$route.query.check.billId,
  258. check: this.$route.query.check,
  259. auditId: this.$route.query.check.id
  260. };
  261. this.isShow = false;
  262. this.$store.commit("DOMXS_IN_DETAIL");
  263. }
  264. if (this.$route.query.params) {
  265. this.beforeOpenPage({ id: this.$route.query.params });
  266. }
  267. }, 100);
  268. },
  269. methods: {
  270. // 车号查询位置
  271. openTrack(row, index, wagonNumber) {
  272. // location({itemId: row.itemId, plateNo: row.wagonNumberOne, tenantId: this.hctenantId, color: '2'}).then(res => {
  273. // row.wagonNumberOne = '鲁RM9561'
  274. location({itemId: row.id, plateNo: wagonNumber, tenantId: this.hctenantId, color: '2'}).then(res => {
  275. this.dialogVisible = true
  276. let this_ = this
  277. setTimeout(function () {
  278. this_.initMap(res.data.data, wagonNumber);
  279. }, 1000)
  280. })
  281. },
  282. markerClick(e) {
  283. this.infoWindow.setContent(e.target.content);
  284. this.infoWindow.open(this.map, e.target.getPosition());
  285. },
  286. initMap(data, plateNo) {
  287. this.map = new AMap.Map("container", {resizeEnable: true});
  288. this.infoWindow = new AMap.InfoWindow({
  289. ffset: new AMap.Pixel(0, -30),
  290. offset: new AMap.Pixel(0, -30)
  291. });
  292. let icon = new AMap.Icon({
  293. size: new AMap.Size(52, 26), // 图标尺寸
  294. image: 'https://trade.tubaosoft.com/file/bladex/000000/1123598821738675201/che.png',
  295. imageSize: new AMap.Size(52, 26), // 根据所设置的大小拉伸或压缩图片
  296. });
  297. this.marker = new AMap.Marker({
  298. position: data.location,
  299. map: this.map,
  300. icon: icon,
  301. markerMeta: new AMap.Size(28, 28),
  302. offset: new AMap.Pixel(-26, -15),
  303. autoRotation: true,
  304. angle: -15
  305. });
  306. this.marker.content = '<div style="width: 300px;">'
  307. + '<p style="font-size: 22px;font-weight: bold;background-color: #2d8cf0;color: #fff;">' + plateNo + '</p>'
  308. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">最后上报时间:</span>' + new Date(Number(data.time) + 8 * 60 * 60 * 1000).toJSON().split('T').join(' ').substr(0, 19) + '</p>'
  309. + '<div style="width: 150px;float: left;">'
  310. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">车辆状态:</span>' + (data.speed > 0 ? '行驶中' : '停车') + '</p>'
  311. + '</div>'
  312. + '<div style="width: 150px;float: right;">'
  313. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">速度:</span>' + data.speed + 'km/h</p>'
  314. + '</div>'
  315. + '<p><span style="color: #a0a0a0">当前位置:</span>' + data.address + '</p>'
  316. + '<p style="padding: 5px 0"><span style="color: #a0a0a0">经纬度:</span>' + data.location.join(',') + '</p>'
  317. + '</div>'
  318. this.infoWindow.open(this.map, this.map.getCenter());
  319. this.marker.on('click', this.markerClick);
  320. this.marker.emit('click', {target: this.marker});
  321. this.map.setFitView();
  322. },
  323. searchCriteriaSwitch(type) {
  324. if (type) {
  325. this.option.height = this.option.height - 190;
  326. } else {
  327. this.option.height = this.option.height + 190;
  328. }
  329. this.$refs.crud.getTableHeight();
  330. },
  331. tableRowClassName({ row, column, rowIndex, columnIndex }) {
  332. if (row.orderStatus == "录入" && columnIndex == 19) {
  333. return {
  334. background: "#eceb3c"
  335. };
  336. } else if (row.orderStatus == "成交") {
  337. return "success-row";
  338. } else if (row.orderStatus == "已报价") {
  339. return "quote-row";
  340. } else if (row.orderStatus == "未成交") {
  341. return "warning-row";
  342. }
  343. return "padding:0;height:40px;";
  344. },
  345. //删除列表后面的删除按钮触发触发(row, index, done)
  346. rowDel(row, index, done) {
  347. this.$confirm("确定将选择数据删除?", {
  348. confirmButtonText: "确定",
  349. cancelButtonText: "取消",
  350. type: "warning"
  351. })
  352. .then(() => {
  353. return deleteDetails(row.id);
  354. })
  355. .then(() => {
  356. this.$message({
  357. type: "success",
  358. message: "操作成功!"
  359. });
  360. this.page.currentPage = 1;
  361. this.onLoad(this.page, { parentId: 0 });
  362. });
  363. },
  364. //修改时的修改按钮点击触发
  365. rowUpdate(row, index, done, loading) {
  366. typeSave(row).then(
  367. () => {
  368. this.$message({
  369. type: "success",
  370. message: "操作成功!"
  371. });
  372. // 数据回调进行刷新
  373. done(row);
  374. },
  375. error => {
  376. window.console.log(error);
  377. loading();
  378. }
  379. );
  380. },
  381. //新增修改时保存触发
  382. rowSave(row, done, loading) {
  383. typeSave(row).then(res => {
  384. console.log(res);
  385. done();
  386. });
  387. },
  388. //查询全部
  389. initData() {
  390. customerList().then(res => {
  391. console.log(this.form);
  392. const column = this.findObject(this.option.column, "parentId");
  393. column.dicData = res.data.data.records;
  394. });
  395. },
  396. //新增子项触发
  397. handleAdd(row) {
  398. this.parentId = row.id;
  399. const column = this.findObject(this.option.column, "parentId");
  400. column.value = row.id;
  401. column.addDisabled = true;
  402. this.$refs.crud.rowAdd();
  403. },
  404. closeDetailPage() {
  405. this.isShow = true;
  406. },
  407. //查看跳转页面
  408. beforeOpenPage(row, index) {
  409. const data = {
  410. moduleName: "xs",
  411. tableName: "business_order",
  412. billId: row.id,
  413. no: localStorage.getItem("browserID")
  414. };
  415. this.checkLock(data).then(res => {
  416. if (res.data.code == 200) {
  417. this.detailData = {
  418. seeDisabled: true,
  419. id: row.id
  420. };
  421. this.isShow = false;
  422. this.$store.commit("DOMXS_IN_DETAIL");
  423. }
  424. }).catch(err => {
  425. this.detailData = {
  426. id: row.id,
  427. seeDisabled: true,
  428. opDisabled: true
  429. };
  430. this.isShow = false;
  431. this.$store.commit("DOMXS_IN_DETAIL");
  432. });
  433. },
  434. //新增跳转页面
  435. beforeOpen(row, index) {
  436. this.detailData = {
  437. id: row.id
  438. };
  439. this.isShow = false;
  440. this.$store.commit("DOMXS_IN_DETAIL");
  441. },
  442. editOpen(row, index) {
  443. this.detailData = {
  444. id: row.id
  445. };
  446. this.isShow = false;
  447. this.$store.commit("DOMXS_IN_DETAIL");
  448. },
  449. // 复制新单
  450. copyOrder() {
  451. const id = this.selection[0].id;
  452. this.detailData = {
  453. copyId: id
  454. };
  455. this.isShow = false;
  456. this.$store.commit("DOMXS_IN_DETAIL");
  457. },
  458. //点击新增时触发
  459. beforeClose(done) {
  460. this.parentId = "";
  461. const column = this.findObject(this.option.column, "parentId");
  462. column.value = "";
  463. column.addDisabled = false;
  464. done();
  465. },
  466. //点击搜索按钮触发
  467. searchChange(params, done) {
  468. if (params.businesDate) {
  469. params.orderStartDate = params.businesDate[0] + " " + "00:00:00";
  470. params.orderEndDate = params.businesDate[1] + " " + "23:59:59";
  471. delete params.businesDate;
  472. }
  473. if (params.requiredDeliveryDate) {
  474. params.deliveryStartDate =
  475. params.requiredDeliveryDate[0] + " " + "00:00:00";
  476. params.deliveryEndDate =
  477. params.requiredDeliveryDate[1] + " " + "23:59:59";
  478. this.$delete(params, "requiredDeliveryDate");
  479. }
  480. if (params.requiredArrivalDate) {
  481. params.arrivalDateStart =
  482. params.requiredArrivalDate[0] + " " + "00:00:00";
  483. params.arrivalDateEnd =
  484. params.requiredArrivalDate[1] + " " + "23:59:59";
  485. this.$delete(params, "requiredArrivalDate");
  486. }
  487. if (params.actualDeliveryDate) {
  488. params.actualDeliveryDateStart =
  489. params.actualDeliveryDate[0] + " " + "00:00:00";
  490. params.actualDeliveryDateEnd =
  491. params.actualDeliveryDate[1] + " " + "23:59:59";
  492. this.$delete(params, "actualDeliveryDate");
  493. }
  494. if (params.createTime) {
  495. params.createTimeStart = params.createTime[0] + " " + "00:00:00";
  496. params.createTimeEnd = params.createTime[1] + " " + "23:59:59";
  497. this.$delete(params, "createTime");
  498. }
  499. this.page.currentPage = 1;
  500. this.onLoad(this.page, params);
  501. done();
  502. },
  503. searchReset() {
  504. this.configuration.dicData = [];
  505. },
  506. // 选择框
  507. selectionChange(list) {
  508. this.selection = list;
  509. this.single = list.length !== 1;
  510. },
  511. currentChange(currentPage) {
  512. this.page.currentPage = currentPage;
  513. },
  514. sizeChange(pageSize) {
  515. this.page.pageSize = pageSize;
  516. },
  517. //列表刷新触发
  518. refreshChange() {
  519. this.dataList.forEach(item => {
  520. this.$refs.crud.toggleRowExpansion(item, false);
  521. });
  522. this.page.currentPage = 1;
  523. this.onLoad(this.page, this.search);
  524. },
  525. // 表格展开触发
  526. expandChange(row, index) {
  527. if (row.loading) {
  528. detail(row.id).then(res => {
  529. row.insideList = res.data.data.orderItemsList;
  530. row.loading = false;
  531. });
  532. }
  533. },
  534. onLoad(page, params) {
  535. // 重置掉展开
  536. this.dataList.forEach(item => {
  537. this.$refs.crud.toggleRowExpansion(item, false);
  538. });
  539. let data = this.gobackSearch(params);
  540. console.log(data)
  541. let queryParams = Object.assign({}, data, {
  542. size: page.pageSize,
  543. current: page.currentPage,
  544. billType: "XS",
  545. corpsTypeId: this.treeDeptId
  546. });
  547. this.loading = true;
  548. customerList(queryParams)
  549. .then(res => {
  550. this.dataList = res.data.data.records;
  551. this.dataList.forEach(item => {
  552. this.$set(item, "insideList", []);
  553. this.$set(item, "loading", true);
  554. });
  555. this.page.total = res.data.data.total;
  556. this.option.height = window.innerHeight - 240;
  557. })
  558. .finally(() => {
  559. this.loading = false;
  560. });
  561. isProcurement({"param":"synchronous"})
  562. .then(res=>{
  563. this.isProcurements = res.data.data
  564. })
  565. },
  566. //树桩列点击展开触发
  567. treeLoad(tree, treeNode, resolve) {
  568. const parentId = tree.id;
  569. customerList({ parentId: parentId }).then(res => {
  570. resolve(res.data.data.records);
  571. });
  572. },
  573. goBack() {
  574. this.detailData = this.$options.data().detailData;
  575. if (JSON.stringify(this.$route.query) != "{}") {
  576. this.$router.$avueRouter.closeTag();
  577. this.$router.push({
  578. path: "/businessManagement/salesOrder/index"
  579. });
  580. }
  581. this.dataList.forEach(item => {
  582. this.$refs.crud.toggleRowExpansion(item, false);
  583. });
  584. this.isShow = true;
  585. this.onLoad(this.page, this.search);
  586. },
  587. gobackSearch(params) {
  588. params = Object.assign({}, this.search);
  589. if (params.businesDate && params.businesDate != "") {
  590. params.orderStartDate = params.businesDate[0] + " " + "00:00:00";
  591. params.orderEndDate = params.businesDate[1] + " " + "23:59:59";
  592. this.$delete(params, "businesDate");
  593. }
  594. if (params.receiptTime && params.receiptTime != "") {
  595. params.receiptTimeStart = params.receiptTime[0] + " " + "00:00:00";
  596. params.receiptTimeEnd = params.receiptTime[1] + " " + "23:59:59";
  597. this.$delete(params, "receiptTime");
  598. }
  599. if (params.arrivalTime && params.arrivalTime != "") {
  600. params.arrivalTimeStart = params.arrivalTime[0] + " " + "00:00:00";
  601. params.arrivalTimeEnd = params.arrivalTime[1] + " " + "23:59:59";
  602. this.$delete(params, "arrivalTime");
  603. }
  604. if (params.requiredDeliveryDate && params.requiredDeliveryDate != "") {
  605. params.deliveryStartDate =
  606. params.requiredDeliveryDate[0] + " " + "00:00:00";
  607. params.deliveryEndDate =
  608. params.requiredDeliveryDate[1] + " " + "23:59:59";
  609. this.$delete(params, "requiredDeliveryDate");
  610. }
  611. if (params.requiredArrivalDate && params.requiredArrivalDate != "") {
  612. params.arrivalDateStart =
  613. params.requiredArrivalDate[0] + " " + "00:00:00";
  614. params.arrivalDateEnd =
  615. params.requiredArrivalDate[1] + " " + "23:59:59";
  616. this.$delete(params, "requiredArrivalDate");
  617. }
  618. if (params.actualDeliveryDate && params.actualDeliveryDate != "") {
  619. params.actualDeliveryDateStart =
  620. params.actualDeliveryDate[0] + " " + "00:00:00";
  621. params.actualDeliveryDateEnd =
  622. params.actualDeliveryDate[1] + " " + "23:59:59";
  623. this.$delete(params, "actualDeliveryDate");
  624. }
  625. if (params.createTime && params.createTime != "") {
  626. params.createTimeStart = params.createTime[0] + " " + "00:00:00";
  627. params.createTimeEnd = params.createTime[1] + " " + "23:59:59";
  628. this.$delete(params, "createTime");
  629. }
  630. return params;
  631. },
  632. exportExcel() {
  633. let data = this.gobackSearch()
  634. const routeData = this.$router.resolve({
  635. path: '/api/blade-purchase-sales/order/saleOrderExport', //跳转目标窗口的地址
  636. query: {
  637. 'Blade-Auth': getToken(),
  638. ...data //括号内是要传递给新窗口的参数
  639. }
  640. })
  641. window.open(routeData.href.slice(1, routeData.href.length));
  642. },
  643. //列保存触发
  644. async saveColumn() {
  645. /**
  646. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  647. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  648. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  649. */
  650. const inSave = await this.saveColumnData(
  651. this.getColumnName(14),
  652. this.option
  653. );
  654. if (inSave) {
  655. this.$message.success("保存成功");
  656. //关闭窗口
  657. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  658. this.$nextTick(() => {
  659. this.$refs.crud.doLayout();
  660. });
  661. }
  662. },
  663. async resetColumn() {
  664. this.option = option;
  665. const inSave = await this.delColumnData(this.getColumnName(14), option);
  666. if (inSave) {
  667. this.$nextTick(() => {
  668. this.$refs.crud.doLayout();
  669. });
  670. this.$message.success("重置成功");
  671. //关闭窗口
  672. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  673. }
  674. },
  675. // 导出
  676. exportHandle() {
  677. this.$confirm("是否导出产品信息?", "提示", {
  678. confirmButtonText: "确定",
  679. cancelButtonText: "取消",
  680. type: "warning"
  681. })
  682. .then(() => {
  683. window.open(
  684. `/api/blade-client/goodsdesc/export-out-info?${this.website.tokenHeader
  685. }=${getToken()}`
  686. );
  687. })
  688. .catch(() => {
  689. this.$message({
  690. type: "info",
  691. message: "已取消" //
  692. });
  693. });
  694. },
  695. // 生成采购
  696. saveSell(row) {
  697. if (
  698. Number(row.settlmentAmount) < Number(row.debitAmount) &&
  699. row.specialCheckStatus != 3
  700. )
  701. return this.$message.error("收款未收齐,禁止生成采购单");
  702. this.$confirm("是否生成采购单?", {
  703. confirmButtonText: "确定",
  704. cancelButtonText: "取消",
  705. type: "warning"
  706. }).then(() => {
  707. this.loading = true
  708. saveSell(row.id).then(res => {
  709. if (res.data.code == 200) {
  710. this.$message.success("生成成功");
  711. }
  712. }).finally(() => {
  713. this.loading = false;
  714. this.onLoad(this.page, this.search);
  715. })
  716. });
  717. },
  718. customerReceipt(row) {
  719. if (this.$store.getters.inStatus) {
  720. this.$alert("客户收货存在,请保存客户收货再进行操作", "温馨提示", {
  721. confirmButtonText: "确定",
  722. type: "warning",
  723. callback: action => { }
  724. });
  725. } else {
  726. let arr = [];
  727. this.openFullScreen(false, "正在生成客户收货...");
  728. detail(row.id).then(res => {
  729. console.log('detail',res.data.data);
  730. arr = res.data.data.orderItemsList
  731. ? res.data.data.orderItemsList
  732. : [];
  733. if (arr.length === 0)
  734. return this.$message.error("该单子明细为空,不能生成客户收货");
  735. let ids = [];
  736. let storageIds = res.data.data.storageId
  737. arr.forEach(item => ids.push(item.id));
  738. this.$confirm("此操作将进行客户收货,是否继续?", {
  739. confirmButtonText: "确定",
  740. cancelButtonText: "取消",
  741. type: "warning"
  742. }).then(() => {
  743. this.openFullScreen(false, "正在生成客户收货...");
  744. res.data.data.orgId = res.data.data.id
  745. res.data.data.deliveryStatus = '录入'
  746. res.data.data.srcOrderNo = res.data.data.orgOrderNo
  747. res.data.data.arrivalContact = res.data.data.corpAttn
  748. res.data.data.arrivalTel = res.data.data.corpTel
  749. res.data.data.totalWeight = res.data.data.cartonWeight
  750. res.data.data.totalVolumn = res.data.data.cntrVolumn
  751. res.data.data.deliveryItemsList = res.data.data.orderItemsList
  752. res.data.data.deliveryFeesList = res.data.data.orderFeesList
  753. res.data.data.salesCompany = res.data.data.belongToCorpId
  754. res.data.data.deliveryAmount = 0
  755. res.data.data.totalQuantity = 0
  756. res.data.data.totalCost = 0
  757. res.data.data.billType = 'FH'
  758. res.data.data.saleman = res.data.data.chargeMember
  759. res.data.data.orderItemsList.forEach(item => {
  760. item.containerVolume = item.cntrVolumn
  761. item.actualWeight = item.cartonWeight
  762. item.specificationAndModel = item.itemType
  763. item.orgOrderNo = res.data.data.orgOrderNo
  764. item.srcOrderNo = res.data.data.srcOrderNo
  765. item.srcId = item.id
  766. item.actualQuantity = (Number(item.orderQuantity) - Number(item.actualQuantity))
  767. item.arrivalQuantity = item.actualQuantity
  768. item.deliveryAmount = item.amount
  769. item.purchaseTotalAmount = (Number(item.purchaseAmount) * Number(item.actualQuantity))
  770. item.purchaseTotalAmount = item.purchaseTotalAmount.toFixed(2)
  771. item.inventoryNumber = item.storageQuantity
  772. res.data.data.deliveryAmount += Number(item.deliveryAmount)
  773. res.data.data.totalQuantity += Number(item.actualQuantity)
  774. res.data.data.totalCost += Number(item.deliveryAmount)
  775. delete item.id
  776. delete item.pid
  777. delete item.createTime
  778. delete item.createUser
  779. delete item.status
  780. delete item.updateTime
  781. delete item.updateUser
  782. })
  783. res.data.data.orderFeesList.forEach(item => {
  784. delete item.createDept
  785. delete item.createTime
  786. delete item.createUser
  787. delete item.id
  788. delete item.isDeleted
  789. delete item.pid
  790. delete item.status
  791. delete item.tenantId
  792. delete item.updateTime
  793. delete item.updateUser
  794. })
  795. this.warehouseTypeOption.forEach((item, index) => {
  796. if (index == 0) {
  797. res.data.data.warehouseType = item.dictValue
  798. }
  799. })
  800. this.warehouseList.forEach((item, index) => {
  801. if (index == 0) {
  802. res.data.data.storageId = item.id
  803. }
  804. })
  805. res.data.data.businessDate = getCurrentDate()
  806. delete res.data.data.createTime
  807. delete res.data.data.id
  808. delete res.data.data.sysNo
  809. delete res.data.data.corpName
  810. delete res.data.data.belongToCorpList
  811. //上面接口返回的storageId赋给下面的
  812. res.data.data.storageId = storageIds
  813. genClient(res.data.data).then(() => {
  814. this.$message.success('客户收货成功')
  815. this.openFullScreen(true);
  816. this.onLoad(this.page, this.search);
  817. })
  818. });
  819. }).finally(() => {
  820. this.openFullScreen(true);
  821. });
  822. }
  823. },
  824. //遮罩层
  825. openFullScreen(res, text) {
  826. const loading = this.$loading({
  827. lock: true,
  828. text: text,
  829. spinner: "el-icon-loading",
  830. background: "rgba(0, 0, 0, 0.7)"
  831. });
  832. if (res === true) loading.close();
  833. }
  834. }
  835. };
  836. </script>
  837. <style scoped src="@/styles/demo-center.css"></style>
  838. <style scoped>
  839. #container {
  840. height: 80vh;
  841. width: 100%;
  842. }
  843. .input-card .btn {
  844. margin-right: 1.2rem;
  845. width: 9rem;
  846. }
  847. .input-card .btn:last-child {
  848. margin-right: 0;
  849. }
  850. </style>
  851. <!--<style scoped>-->
  852. <!--</style>-->