index.vue 32 KB

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