index.vue 31 KB

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