123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074 |
- <template>
- <!-- 销售订单页面 -->
- <div class="salePlan">
- <div class="top">
- <el-form :inline="true">
- <el-form-item>
- <el-date-picker
- v-model="startTime"
- type="datetime"
- placeholder="选择日期"
- style="width:220px"
- >
- </el-date-picker>
- <span>至</span>
- <el-date-picker
- v-model="endTime"
- type="datetime"
- placeholder="选择日期"
- style="width:220px"
- >
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-input
- placeholder="请输入内容"
- v-model="input"
- clearable
- style="width:250px"
- >
- </el-input>
- <el-button type="primary" @click="onclick">
- <i class="el-icon-search"></i>
- </el-button>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="btnclick(0)">
- <i class="el-icon-plus"></i>新增
- </el-button>
- <el-button type="primary" @click="refresh">
- <i class="el-icon-refresh"></i>
- </el-button>
- <el-button type="primary" @click="batchReport">
- <i class="upload2"></i>批量上传
- </el-button>
- <el-button
- type="primary"
- @click="exportData()"
- v-if="activeName == 'first'"
- ><i class="el-icon-download"></i>导出Excel</el-button
- >
- <el-form-item v-if="activeName == 'first'">
- <el-upload
- class="upload-excel"
- action=""
- :on-change="importExcel"
- :show-file-list="false"
- accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
- :auto-upload="false"
- >
- <el-button type="primary" icon="el-icon-upload"
- >导入Excel</el-button
- >
- </el-upload>
- </el-form-item>
- <el-button disabled>物资总件数</el-button>
- <el-input
- placeholder=""
- v-model="matSum"
- clearable
- style="width:100px"
- disabled
- >
- </el-input>
- </el-form-item>
- </el-form>
- </div>
- <div class="table">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <!-- 未上报 -->
- <el-tab-pane label="未上报" name="first">
- <mergeRowTable
- v-bind.sync="option"
- ref="excelDom"
- @selection-change="selectionChange"
- :pageSize="200"
- @func="func"
- >
- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- width="200"
- >
- <template slot-scope="scope">
- <el-button
- @click="uploadclick(scope.row.saleOrderId)"
- type="text"
- size="small"
- >上传</el-button
- >
- <el-button
- @click="click(scope.row.saleOrderId)"
- type="text"
- size="small"
- >修改</el-button
- >
- <el-button
- type="text"
- size="small"
- @click="deleteclick(scope.row.saleOrderId)"
- >删除</el-button
- >
- <el-button
- type="text"
- size="small"
- @click="copyClick(scope.row.saleOrderId)"
- >复制</el-button
- >
- </template>
- </el-table-column>
- </mergeRowTable>
- </el-tab-pane>
- <!-- 已审批 -->
- <el-tab-pane label="已审批" name="four">
- <mergeRowTable
- v-bind.sync="option4"
- ref="table"
- :pageSize="200"
- @func="func1"
- >
- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- width="280"
- >
- <template slot-scope="scope">
- <el-button
- @click="getOrderDetails(scope.row.saleOrderId)"
- type="text"
- size="small"
- >运单</el-button
- >
- <el-button
- @click="deleteSaleOrder(scope.row)"
- type="text"
- size="small"
- >关闭订单</el-button
- >
- <el-button
- @click="adverseCloseSaleOrder(scope.row)"
- type="text"
- size="small"
- >反关闭订单</el-button
- >
- <el-button
- @click="updateSaleOrder(scope.row)"
- type="text"
- size="small"
- >异常处理</el-button
- >
- <el-button
- type="text"
- size="small"
- @click="copyClick(scope.row.saleOrderId)"
- >复制</el-button
- >
- </template>
- </el-table-column>
- </mergeRowTable>
- </el-tab-pane>
- <el-tab-pane label="反审批" name="five">
- <mergeRowTable
- v-bind.sync="option5"
- ref="table2"
- :pageSize="200"
- @func="func3"
- >
- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- width="200"
- >
- <template slot-scope="scope">
- <el-button
- @click="updateSaleOrder(scope.row)"
- type="text"
- size="small"
- >异常处理</el-button
- >
- </template>
- </el-table-column></mergeRowTable
- >
- </el-tab-pane>
- <!-- 已上报 -->
- <el-tab-pane label="已上报" name="second">
- <mergeRowTable
- v-bind.sync="option2"
- ref="table2"
- :pageSize="200"
- @func="func2"
- >
- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- width="200"
- >
- <template slot-scope="scope">
- <el-button
- @click="closeSteelOrderAndEas(scope.row)"
- type="text"
- size="small"
- >关闭订单</el-button
- >
- <el-button
- @click="updateReportedSaleOrder(scope)"
- type="text"
- size="small"
- >修改</el-button
- >
- </template>
- </el-table-column>
- </mergeRowTable>
- </el-tab-pane>
- </el-tabs>
- </div>
- <div>
- <el-dialog
- title="销售订单预览"
- :visible.sync="dialogTableVisible"
- :center="true"
- width="100%"
- >
- <ExcelSaleOrder :tableData="tableData"></ExcelSaleOrder>
- <div class="btn">
- <el-button
- type="primary"
- @click="addExcelInport"
- @keyup.native.enter="addExcelInport"
- >确认</el-button
- >
- <el-button type="primary" @click="cancelExcelInport">取消</el-button>
- </div>
- </el-dialog>
- </div>
- </div>
- </template>
- <script>
- import { getCookie } from "@/utils/util.js";
- import { sjTime } from "@/utils/sharedJsFile";
- import { isNumber } from "../../../ADMINISTRATORS/app";
- import ExcelSaleOrder from "../saleContract/importExcelSaleOrder.vue";
- export default {
- name: "saleOrder",
- components: {
- ExcelSaleOrder
- },
- data() {
- return {
- dialogTableVisible: false,
- startTime: null,
- endTime: null,
- batchReportList: [],
- activeName: "first",
- tableTitle: "未上传销售订单报表",
- drawer: false,
- input: "",
- index: "",
- carrierId: null,
- carrierName: null,
- shipperName: "四川省达州钢铁集团有限责任公司",
- shipperId: 1,
- receivingCompany: [
- "四川省达州钢铁集团有限责任公司",
- "四川达钢商贸有限公司"
- ],
- option: {
- // 表格请求数据的地址
- requestUrl: "",
- selectionType: "select",
- comparison: "saleNumber",
- columnIndexs: [0, 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17]
- },
- option2: {
- // 表格请求数据的地址
- requestUrl: "",
- comparison: "saleNumber",
- columnIndexs: [0, 1, 2, 3, 8, 9, 10, 11, 12, 13, 14, 15, 16]
- },
- option4: {
- // 表格请求数据的地址
- requestUrl: "",
- comparison: "saleNumber",
- columnIndexs: [
- 0,
- 1,
- 2,
- 3,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 20,
- 21,
- 22
- ]
- },
- option5: {
- // 表格请求数据的地址
- requestUrl: "",
- comparison: "saleNumber",
- columnIndexs: [
- 0,
- 1,
- 2,
- 3,
- 7,
- 8,
- 9,
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 20,
- 21
- ]
- },
- mapList: [],
- mapItemList: [],
- matSum: null,
- tableData: [],
- saleDateOfReceipt: null,
- //销售订单主表数据
- saleOrderList: [
- "receiveName",
- "isSelfMention",
- "saleRemark",
- "saleOrderReceiveCustomer",
- "salerName"
- ],
- saleOrderMapList: [
- "truckNo",
- "province",
- "district",
- "town",
- "truckRemark",
- "place",
- "saleOrderConsigneeTel",
- "saleDateOfReceipt",
- "materialName",
- "materialSpecification",
- "materialModel",
- "materialNumber",
- "steelMeters",
- "isPoundSale"
- ]
- };
- },
- created() {
- if (getCookie("orgCode") == "shouhuokehu") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- getCookie("userId");
- this.option5.requestUrl =
- "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- } else if (getCookie("orgCode") == "xiaoshouyewuyuan") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&saler=" +
- getCookie("loginName") +
- "&i=" +
- new Date();
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&saler=" +
- getCookie("loginName") +
- "&i=" +
- new Date();
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&saler=" +
- getCookie("loginName") +
- "&i=" +
- new Date();
- this.option5.requestUrl =
- "/api/v1/ams/getSteelOrderDeletedList?apiId=409&saler=" +
- getCookie("loginName");
- } else {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option5.requestUrl =
- "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- }
- let loadTime1 = new Date(
- new Date(new Date().toLocaleDateString()).getTime() +
- (3600 * 1000 * 8 - 1)
- ); // 当天8点前
- let loadTime2 = new Date(
- new Date(new Date().toLocaleDateString()).getTime() +
- (3600 * 1000 * 32 - 1)
- ); // 次天8点前
- if (new Date().getTime() - loadTime1 > 0) {
- this.saleDateOfReceipt = loadTime2;
- } else {
- this.saleDateOfReceipt = loadTime1;
- }
- // document.addEventListener("keydown", e => {
- // let key = window.event.keyCode;
- // if (key == 13) {
- // // 13是enter键的键盘码 如果等于13 就调用click的登录方法
- // this.addExcelInport();
- // }
- // });
- },
- // beforeDestroy() {
- // //这里的 this.login('loginForm') 指的是键盘事件的方法名
- // document.removeEventListener("keydown", this.addExcelInport());
- // },
- methods: {
- //导入Excel格式
- //导入excel
- importExcel(file) {
- let that = this;
- if (!file) {
- that.$message({
- message: "文件错误!",
- type: "warning"
- });
- return;
- }
- this.tableData = [];
- var reader = new FileReader();
- var data = null;
- var workbook = null;
- //设置读取操作
- reader.onload = function(e) {
- console.log(e);
- data = e.target.result;
- workbook = XLSX.read(data, {
- type: "binary"
- });
- let rows = XLSX.utils.sheet_to_json(
- workbook.Sheets[workbook.SheetNames[0]]
- ); //只取第一页
- console.log("rows", rows);
- Array.from(rows).forEach((e, index) => {
- let map = {};
- try {
- Object.keys(e).forEach(e1 => {
- if (e1.includes("物资名称")) {
- map.materialName = e[e1];
- }
- if (e1.includes("下单客户")) {
- map.receiveName = e[e1];
- }
- if (e1.includes("米数")) {
- map.steelMeters = e[e1];
- }
- if (e1.includes("物资规格")) {
- if (e[e1].includes("Φ")) {
- map.materialSpecification = e[e1];
- } else {
- map.materialSpecification = "Φ" + e[e1];
- }
- }
- if (e1.includes("物资型号")) {
- map.materialModel = e[e1];
- }
- if (e1.includes("物资件数")) {
- if (isNumber(e[e1])) {
- map.materialNumber = e[e1];
- } else {
- throw new Error(
- `该Excel第--${index +
- 2}--行-“物资件数”错误,请核实后再输入(件数输入整数)`
- );
- }
- }
- if (e1.includes("车序号")) {
- if (isNumber(e[e1])) {
- map.truckNo = e[e1];
- } else {
- throw new Error(
- `该Excel第--${index +
- 2}--行-“车序号”错误,请核实后再输入(车序号输入正整数)`
- );
- }
- }
- if (e1.includes("收款公司")) {
- if (that.receivingCompany.indexOf(e[e1]) === -1) {
- throw new Error(
- `该Excel第--${index + 2}--行-“收款公司”错误,请核实后再输入`
- );
- } else {
- map.saleOrderReceiveCustomer = e[e1];
- }
- }
- if (e1.includes("业务员")) {
- map.salerName = e[e1];
- }
- if (e1.includes("摘要")) {
- map.saleRemark = e[e1];
- }
- if (e1.includes("省")) {
- map.province = e[e1];
- }
- if (e1.includes("市")) {
- map.district = e[e1];
- }
- if (e1.includes("县/区")) {
- map.town = e[e1];
- }
- if (e1.includes("具体收货地址")) {
- map.place = e[e1];
- }
- if (e1.includes("收货客户电话")) {
- map.saleOrderConsigneeTel = e[e1];
- }
- if (e1.includes("备注")) {
- map.truckRemark = e[e1];
- }
- if (e1.includes("是否磅重交货")) {
- if (e[e1] == "是") {
- map.isPoundSale = 1;
- } else if (e[e1] == "否") {
- map.isPoundSale = 0;
- } else {
- throw new Error(
- `该Excel第--${index +
- 2}--行-“是否磅重交货”-错误,请核实后再输入`
- );
- }
- }
- if (e1.includes("是否自提")) {
- if (e[e1] === "是" || e[e1] === "否") {
- map.isSelfMention = e[e1];
- } else {
- throw new Error(
- `该Excel第--${index + 2}--行-“是否自提”-错误,请核实后再输入`
- );
- }
- }
- });
- map.shipperName = that.shipperName;
- that.tableData.push(map);
- } catch (e) {
- that.$message.error(e.message);
- }
- });
- that.dialogTableVisible = true;
- return;
- };
- reader.readAsBinaryString(file.raw); //以二进制方式读取
- },
- addExcelInport() {
- this.$confirm("以上均核对正确,确定导入Excel", "提示", {
- cancelButtonText: "取消",
- confirmButtonText: "确认",
- center: true
- })
- .then(() => {
- let map = {};
- let arr = [];
- this.tableData.forEach(e => {
- let mapMaterial = {};
- Object.keys(e).forEach(e1 => {
- if (this.saleOrderList.includes(e1)) {
- map[e1] = e[e1];
- }
- if (this.saleOrderMapList.includes(e1)) {
- mapMaterial[e1] = e[e1];
- }
- });
- mapMaterial.saleDateOfReceipt = sjTime(this.saleDateOfReceipt);
- arr.push(mapMaterial);
- });
- map.shipperId = 1;
- map.mapList = arr;
- console.log(map);
- this.axios
- .post("/api/v1/ams/addSteelSaleOrder", map)
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("新增销售订单成功!");
- this.getRequestUrl();
- this.dialogTableVisible = false;
- } else {
- this.$message.error(res.data.data);
- this.getRequestUrl();
- this.dialogTableVisible = false;
- }
- })
- .catch(e => {
- this.$message.error("生成错误!");
- this.dialogTableVisible = false;
- });
- })
- .catch(() => {
- this.$message.info("取消导入");
- });
- },
- cancelExcelInport() {
- this.dialogTableVisible = false;
- },
- adverseCloseSaleOrder(row) {
- console.log(row);
- this.$confirm("确定反关闭整条订单吗?", "继续?", {
- cancelButtonText: "取消",
- confirmButtonText: "确定",
- center: true
- }).then(() => {
- this.axios
- .post(
- "/api/v1/ams/adverseCloseSaleOrder?saleOrderId=" + row.saleOrderId
- )
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("反关闭成功");
- this.getRequestUrl();
- } else {
- this.$message.error("反关闭失败");
- this.getRequestUrl();
- }
- })
- .catch(() => {
- this.$message.error("反关闭失败");
- });
- });
- },
- updateReportedSaleOrder(scope) {
- this.$router.push("/editSaleOrder/" + scope.row.saleOrderId);
- },
- updateSaleOrderStatusById(scope) {
- console.log(scope.row.saleOrderId);
- this.$confirm("是否撤销", "警告", {
- confirmButtonText: "确定撤销",
- cancelButtonText: "取消撤销",
- type: "warning",
- center: true
- })
- .then(() => {
- this.axios
- .post(
- "/api/v1/uc/updateSaleOrderStatusById?saleOrderId=" +
- scope.row.saleOrderId
- )
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("撤销成功");
- this.activeName = "first";
- this.getRequestUrl();
- } else {
- this.$message.error("撤销失败");
- }
- })
- .catch(() => {
- this.$message.error("撤销失败");
- });
- })
- .catch(() => {
- console.log("取消撤销");
- });
- },
- func(res) {
- this.matSum = res.list.reduce(function(prev, item) {
- return prev + item.materialNumber;
- }, 0);
- },
- func1(res) {
- this.matSum = res.list.reduce(function(prev, item) {
- return prev + item.materialNumber;
- }, 0);
- },
- func2(res) {
- this.matSum = res.list.reduce(function(prev, item) {
- return prev + item.materialNumber;
- }, 0);
- },
- func3(res) {
- this.matSum = res.list.reduce(function(prev, item) {
- return prev + item.materialNumber;
- }, 0);
- },
- closeSteelOrderAndEas(row) {
- this.$prompt("此操作将同步关闭金蝶和物流的销售订单,是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- inputPlaceholder: "请输入关闭原因-必填!!!",
- center: true,
- type: "warning"
- })
- .then(({ value }) => {
- if (value != null) {
- let mapValue = {
- number: row.saleNumber,
- saleOrderId: row.saleOrderId,
- reason: value
- };
- this.axios
- .post("/api/v1/ams/deleteSaleOrderById", mapValue)
- .then(res => {
- if (res.data.code == 200) {
- this.$message.success("关闭成功");
- this.getRequestUrl();
- } else {
- this.$message.error("关闭失败,请联系管理员");
- }
- })
- .catch(() => {
- this.$message.error("关闭失败,请联系管理员");
- this.getRequestUrl();
- });
- } else {
- this.$message.error("请输入理由");
- }
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消输入"
- });
- });
- },
- deleteSaleOrder(row) {
- this.$prompt("此操作将关闭订单且下面的待运输订单,是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- inputPlaceholder: "请输入关闭原因-必填!!!",
- center: true,
- type: "warning"
- })
- .then(({ value }) => {
- if (value != null) {
- let mapValue = {
- number: row.saleNumber,
- saleOrderId: row.saleOrderId,
- reason: value
- };
- this.axios
- .post("/api/v1/ams/deleteSaleOrderSame", mapValue)
- .then(res => {
- if (res.data.code == 200) {
- this.$message.success("关闭成功");
- this.getRequestUrl();
- }
- });
- } else {
- this.$message.error("请输入理由");
- }
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消输入"
- });
- });
- },
- updateSaleOrder(row) {
- console.log(row);
- this.$router.push(
- "updateSaleOrderSteel/" + row.saleOrderId + "/" + row.deleted
- );
- },
- getOrderDetails(saleOrderId) {
- console.log(saleOrderId);
- this.$router.push("saleOrderOODetails/" + saleOrderId);
- },
- getRequestUrl() {
- if (getCookie("orgCode") == "shouhuokehu") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- this.option5.requestUrl =
- "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
- getCookie("userId") +
- "&i=" +
- new Date();
- } else {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- this.option5.requestUrl =
- "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
- null +
- "&i=" +
- new Date();
- }
- },
- batchReport() {
- if (this.batchReportList.length === 0) {
- this.$message.error("请先选择需要批量上传的销售订单");
- return;
- }
- const loading = this.$loading({
- lock: true,
- text: "正在努力上传",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- this.axios
- .post("/api/v1/ams/uploadSaleOrderList", this.batchReportList)
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("上传成功");
- this.getRequestUrl();
- loading.close();
- } else {
- this.$message.error("上传失败");
- loading.close();
- }
- })
- .catch(() => {
- this.$message.error("上传失败");
- loading.close();
- });
- },
- selectionChange(selection) {
- console.log(selection);
- this.batchReportList = [];
- this.batchReportList = selection;
- },
- refresh() {
- this.$router.go(0);
- },
- handleClick(tab, event) {
- console.log(tab, event);
- },
- onclick() {
- var startTime = null;
- var endTime = null;
- if (this.startTime && this.endTime) {
- startTime = sjTime(this.startTime);
- endTime = sjTime(this.endTime);
- }
- if (getCookie("orgCode") == "shouhuokehu") {
- if (this.activeName == "first") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&saleType=1&con=" +
- this.input +
- "&consigneeSsoId=" +
- getCookie("userId") +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- } else if (this.activeName == "second") {
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&saleType=1&con=" +
- this.input +
- "&consigneeSsoId=" +
- getCookie("userId") +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- } else if (this.activeName == "four") {
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&saleType=1&shipperId=1&con=" +
- this.input +
- "&consigneeSsoId=" +
- getCookie("userId") +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- }
- } else {
- if (this.activeName == "first") {
- this.option.requestUrl =
- "/api/v1/ams/getSaleOrderInfoes?apiId=408&saleType=1&con=" +
- this.input +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- } else if (this.activeName == "second") {
- this.option2.requestUrl =
- "/api/v1/ams/getSaleOrderReportedes?apiId=408&saleType=1&con=" +
- this.input +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- } else if (this.activeName == "four") {
- this.option4.requestUrl =
- "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&saleType=1&shipperId=1&con=" +
- this.input +
- "&startTime=" +
- startTime +
- "&endTime=" +
- endTime +
- "&i=" +
- new Date();
- }
- }
- },
- handleClose() {},
- seeclick(saleOrderId) {
- this.$router.push("/saleOrderDetail/" + saleOrderId);
- },
- btnclick() {
- this.$router.push("/addSaleOrder");
- },
- click(saleOrderId) {
- this.$router.push("/editSaleOrder/" + saleOrderId);
- },
- copyClick(saleOrderId) {
- this.$router.push("/copySteelOrder/" + saleOrderId);
- },
- // 上传
- uploadclick(saleOrderId) {
- this.$confirm("是否上传", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true
- })
- .then(() => {
- const loading = this.$loading({
- lock: true,
- text: "正在努力上传",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- this.axios
- .post("/api/v1/ams/uploadSaleOrder?saleOrderId=" + saleOrderId)
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("上传成功!");
- this.getRequestUrl();
- loading.close();
- } else {
- this.$message.success("上传失败!");
- this.getRequestUrl();
- loading.close();
- }
- })
- .catch(() => {
- loading.close();
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消上传!"
- });
- });
- },
- //删除
- deleteclick(scope) {
- let saleOrderId = scope;
- this.$confirm("是否删除", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true
- })
- .then(() => {
- this.axios
- .post(
- "/api/v1/ams/deleteAmsSaleOrderBySaleOrderId?saleOrderId=" +
- saleOrderId
- )
- .then(res => {
- if (res.data.code == "200") {
- this.$message.success("删除成功");
- this.getRequestUrl();
- } else {
- this.$message.success("删除失败");
- this.getRequestUrl();
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消删除!"
- });
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .salePlan {
- .top {
- margin-left: 20px;
- margin-top: 20px;
- }
- .table {
- margin-left: 20px;
- margin-top: 20px;
- }
- .btn {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- }
- </style>
|