123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722 |
- <template>
- <div class="addSaleOrderSend">
- <page-title>新增销售订单派车</page-title>
- <!-- 销售订单表的数据 -->
- <div class="saleOrder">
- <dilTable
- v-bind.sync="option"
- @radio-change="currentRadioChange"
- ></dilTable>
- </div>
- <!-- 表单选择车辆和线路 -->
- <div class="from">
- <div class="line">
- <span class="text">线路</span>
- <el-input
- v-model="lineName"
- placeholder="请选择线路"
- disabled
- ></el-input>
- <el-button type="primary" @click="onClick(1)">浏览</el-button>
- </div>
- <div class="vehicle">
- <span class="text">车辆</span>
- <el-button type="primary" @click="onClick(2)">浏览</el-button>
- <span class="span"></span>
- </div>
- </div>
- <!-- 派车表格 -->
- <div class="selectionTable from">
- <el-table
- :data="selectionList"
- border
- style="width: 100%"
- highlight-current-row
- >
- <el-table-column type="index" label="序号" width="50">
- </el-table-column>
- <el-table-column
- v-for="(item, i) in tableTop"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- :width="item.width"
- align="center"
- show-overflow-tooltip
- >
- <template slot="scope" v-if="item.label !== '重量'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '运输单价'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '截止日期'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '收货姓名'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '收货方电话'">
- <span>{{ item.label }}</span>
- </template>
- <!-- 插入输入框 -->
- <template slot-scope="scope">
- <template v-if="item.slot">
- <!-- 物资重量 -->
- <template v-if="item.prop == 'orderPlanWeight'">
- <el-input
- class="textinput"
- @input="onInput"
- placeholder="(必填)"
- v-model.number="scope.row.orderPlanWeight"
- ></el-input>
- </template>
- <!-- 运输单价id -->
- <template v-if="item.prop == 'priceValue'" >
- <el-input
- style="width: 200px"
- v-model="scope.row.priceValue"
- disabled
- >
- </el-input>
- <el-button
- type="primary"
- placeholder="(非必填)"
- @click="select(scope.$index,3)"
- >浏览</el-button
- >
- </template>
- <!-- 截止日期 -->
- <template v-if="item.prop == 'saleDateOfReceipt'">
- <el-date-picker
- class="textinput3"
- type="date"
- v-model.number="scope.row.saleDateOfReceipt"
- ></el-date-picker>
- </template>
- <!-- 收货客户 -->
- <template v-if="item.prop == 'saleOrderConsignee'">
- <el-input
- class="textinput4"
- placeholder="(非必填)"
- v-model.number="scope.row.saleOrderConsignee"
- ></el-input>
- </template>
- <!-- 收货客户电话号码 -->
- <template v-if="item.prop == 'saleOrderConsigneeTel'">
- <el-input
- class="textinput5"
- placeholder="(非必填)"
- v-model.number="scope.row.saleOrderConsigneeTel"
- @input="onInput"
- ></el-input>
- </template>
- </template>
- <template v-else>
- <span>{{ scope.row[item.prop] }}</span>
- </template>
- </template>
- </el-table-column>
- <!-- 操作列 -->
- <el-table-column fixed="right" label="操作" width="100">
- <template slot-scope="scope">
- <el-button
- @click="copyRow(scope.$index,scope.row)"
- type="text"
- size="big"
- >
- 复制
- </el-button>
- <el-button
- @click="deleteRow(scope.$index)"
- type="text"
- icon="el-icon-close"
- size="big"
- ></el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 线路模态框 -->
- <el-drawer
- :visible.sync="drawer"
- :destroy-on-close="false"
- direction="rtl"
- size="40%"
- :wrapperClosable="false"
- @keyup.enter.native="AddClick"
- modal
- close-on-press-escape
-
- >
- <el-input
- placeholder="请输入内容"
- v-model="lineText"
- style="margin-top: 10px; margin-left: 20px; width: 250px"
- @keyup.enter.native="selectClick"
- clearable
- >
- </el-input>
- <el-button
- type="primary"
- class="btn"
- @click="selectClick"
- style="margin-left: 5px"
- >
- <i class="el-icon-search"></i>查询
- </el-button>
- <el-button
- type="primary"
- class="btn"
- @click="AddClick"
- style="margin-left: 5px"
- >
- <i class="el-icon-check"></i>确定
- </el-button>
- <div class="tablecls">
- <!-- 查询所有的路线 -->
- <dilTable
- v-bind.sync="line"
- @radio-change="currentRadioChange5"
- ></dilTable>
- </div>
- </el-drawer>
- <!-- 车辆模态框 -->
- <el-drawer
- :visible.sync="truckDrawer"
- :destroy-on-close="false"
- direction="rtl"
- size="40%"
- @keyup.enter.native="AddTruckClick"
- :wrapperClosable="false"
- modal
- close-on-press-escape
-
- >
- <el-input
- placeholder="请输入内容"
- v-model="truckText"
- style="margin-top: 10px; margin-left: 20px; width: 250px"
- @keyup.enter.native="selectTruckClick"
- clearable
- >
- </el-input>
- <el-button
- type="primary"
- class="btn"
- @click="selectTruckClick"
- style="margin-left: 5px"
- >
- <i class="el-icon-search"></i>查询
- </el-button>
- <el-button
- type="primary"
- class="btn"
- @click="AddTruckClick"
- style="margin-left: 5px"
- >
- <i class="el-icon-check"></i>确定
- </el-button>
- <div class="tablecls">
- <!-- 查询所有的车辆 -->
- <dilTable
- v-bind.sync="truck"
- @selection-change="currentRadioChange1"
- ></dilTable>
- </div>
- </el-drawer>
- <!-- 运输单价的模态框 -->
- <el-drawer
- :visible.sync="addressDrawer"
- :destroy-on-close="false"
- direction="rtl"
- size="70%"
- :wrapperClosable="false"
- modal
- close-on-press-escape
-
- >
- <el-input
- placeholder="请输入内容"
- v-model="addressText"
- style="margin-top: 10px; margin-left: 20px; width: 250px"
- clearable
- >
- </el-input>
- <el-button
- type="primary"
- class="btn"
- @click="selectAddressClick"
- style="margin-left: 5px"
- >
- <i class="el-icon-search"></i>查询
- </el-button>
- <el-button
- type="primary"
- class="btn"
- @click="addAddressClick"
- style="margin-left: 5px"
- >
- <i class="el-icon-check"></i>确定
- </el-button>
- <div class="tablecls">
- <!-- 查询所有的运输单价 -->
- <dilTable
- v-bind.sync="Price"
- @radio-change="currentRadioChange2"
- ></dilTable>
- </div>
- </el-drawer>
- <div class="button_box">
- <el-button @click="cancel">取消</el-button>
- <el-button type="primary" @click="makeSure">确定</el-button>
- </div>
- </div>
- </template>
- <script>
- import PageTitle from "@/components/Page/Title";
- import { getCookie } from "@/utils/util.js";
- import { sjTime,isNumber } from "@/utils/sharedJsFile";
- export default {
- components: { PageTitle },
- data() {
- return {
- //线路名称
- lineName:null,
- lineId:null,
- //线路表格单选缓存数据的
- cacheLine:{
- ROW_ID : 0,
- lineDesk : '',
- lineId : 0,
- lineName : '',
- lineNo : '',
- lineType : '',
- spellNumber : 0,
- },
- //已经选择车辆物资信息
- selectionList:[],
- //销售订单物资信息
- option: {
- // 表格请求数据的地址
- requestUrl:"",
- // 控制显示当选列
- selectionType: "radio",
- isPagination: false,
- },
- //当前选中的物资id
- materialId: null,
- //当前选中的物资名称
- materialName: null,
- //选中的线路名称
- lineName: null,
- //选中的线路id
- lineId: null,
- //是否打开选择线路的模态框
- drawer:false,
- //是否打开选择车辆的模态框
- truckDrawer:false,
- //是否打开运输单价的模态框
- addressDrawer:false,
- //线路的表格
- line: {
- requestUrl: "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3",
- selectionType: "radio",
- },
- //车辆的表格
- truck: {
- requestUrl: "",
- selectionType: "select",
- },
- //运输单价的表格
- Price: {
- requestUrl: "/api/v1/ams/getAmsContractTransportPrice1?apiId=109&deleted=0",
- selectionType: "radio",
- },
- addressText:null,
- //线路表格的框计算输入的值
- lineText:null,
- tableTop: [
- {
- prop: "capacityNumber",
- label: "车牌号",
- width: "100",
- },
- {
- prop: "materialName",
- label: "物资名称",
- width: "140",
- },
- {
- prop: "carrierName",
- label: "承运商",
- width: "220",
- },
- {
- prop: "lineName",
- label: "运输线路",
- width: "220",
- },
- {
- prop: "orderPlanWeight",
- label: "重量",
- width: "140",
- slot: true,
- },
- {
- prop: "saleDateOfReceipt",
- label: "截止日期",
- width: "230",
- slot: true,
- },
- {
- prop: "priceValue",
- label: "运输单价",
- width: "300",
- slot: true,
- },
- // {
- // prop: "saleShipperAddressName",
- // label: "收货地址",
- // width: "300",
- // slot: true,
- // },
- {
- prop: "saleOrderConsignee",
- label: "收货客户",
- width: "150",
- slot: true,
- },
- {
- prop: "saleOrderConsigneeTel",
- label: "收货客户电话号码",
- slot: true,
- width: "150",
- },
- ],
- truckText:null,
- //当前多选选中的车辆
- selectTruck:[],
- //销售订单与物资表主键
- saleMaterialId:null,
- //记录点击的市哪一个收货地址的浏览
- addressIndex:null,
- //缓存当前选中的运输单价
- priceMap:{},
- };
- },
- created() {
- if (getCookie("orgCode") == "chengyunshang") {
- this.truck.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
- getCookie("userId");
- } else {
- this.truck.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null;
- }
- this.option.requestUrl = "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId;
- },
- methods: {
- onInput(val){
- if(!isNumber(val)){
- this.$message.warning('重量/电话号码请输入数字')
- }
- },
- //点击确定按钮的事件
- makeSure(){
- let state = false;
- this.selectionList.forEach((e)=>{
- if(!isNumber(e.orderPlanWeight)){
- this.$message.error('重量请输入数字')
- }else if(e.saleOrderConsigneeTel){
- if(!isNumber(e.saleOrderConsigneeTel)){
- this.$message.error('电话号码请输入数字')
- }else{
- e.saleOrderConsigneeTel = e.saleOrderConsigneeTel+"",
- state = true
- }
- }else {
- e.saleOrderConsigneeTel = null,
- state = true
- }
- if(e.saleDateOfReceipt){
- e.saleDateOfReceipt = sjTime(e.saleDateOfReceipt)
- }
- })
- if(state){
- this.axios.post('/api/v1/ams/dispatchTruckOrderBySale',{
- saleOrderId:this.$route.params.saleOrderId,
- mapList:this.selectionList,
- }).then((res)=>{
- console.log("res",res)
- if(res.data.code == '200'){
- this.$message.success('派车成功')
- this.cancel();
- }else{
- //若该销售订单的净重已达到97%!
- this.$confirm("该销售订单的净重已达到97%! 是否仍然派车", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- center: true,
- })
- .then(() => {
- this.axios.post('/api/v1/ams/dispatchTruckOrderBySale',{
- saleOrderId:this.$route.params.saleOrderId,
- sendAgain:1,
- mapList:this.selectionList,
- }).then((res)=>{
- if(res.data.code == '200'){
- this.$message.success('派车成功')
- this.cancel();
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "取消派车!",
- });
- });
- }
- })
- }else{
- this.$message.warning('重量/电话号码请输入数字')
- }
- },
- //点击取消按钮的事件
- cancel(){
- this.$router.push('/saleOrder')
- },
- //点击删除按钮删除当前点击的对象
- deleteRow(index){
- this.selectionList.splice(index,1)
- },
- //复制的方法
- copyRow(index,row){
- let arr = [];
- for(var i = 0 ;i<this.selectionList.length; i++){
- if(i == index){
- arr.push(this.selectionList[i]);
- arr.push({
- capacityId:row.capacityId,
- capacityNumber:row.capacityNumber,
- carrierName:row.carrierName,
- lineId:row.lineId,
- lineName:row.lineName,
- materialId:row.materialId,
- materialName:row.materialName,
- orderPlanWeight:row.orderPlanWeight,
- saleDateOfReceipt:row.saleDateOfReceipt,
- saleMaterialId:row.saleMaterialId,
- saleOrderConsignee:row.saleOrderConsignee,
- saleOrderConsigneeTel:row.saleOrderConsigneeTel,
- priceValue:row.priceValue,
- priceId:row.priceId,
- saleShippingAddressId:row.saleShippingAddressId,
- }
- )
- }else{
- arr.push(this.selectionList[i]);
- }
- }
- this.selectionList = [];
- this.selectionList = arr;
- },
- //收货地址模态窗口的框计算
- selectAddressClick(){
- this.Price.requestUrl = '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con='+this.addressText;
- },
- //运输单价模态窗口的点击事件
- addAddressClick(){
- //priceMap
- this.selectionList[this.addressIndex].priceValue = this.priceMap.priceValue
- this.selectionList[this.addressIndex].priceId = this.priceMap.priceId
- this.addressDrawer = false;
- let arr = this.selectionList;
- this.selectionList = [];
- arr.forEach((e)=>{
- this.selectionList.push({
- //销售订单与物资表主键
- capacityId:e.capacityId,
- capacityNumber:e.capacityNumber,
- carrierName:e.carrierName,
- carrierId:e.carrierId,
- lineId:e.lineId,
- lineName:e.lineName,
- materialId:e.materialId,
- materialName:e.materialName,
- orderPlanWeight:e.orderPlanWeight,
- saleDateOfReceipt:e.saleDateOfReceipt,
- saleMaterialId:e.saleMaterialId,
- saleOrderConsignee:e.saleOrderConsignee,
- saleOrderConsigneeTel:e.saleOrderConsigneeTel,
- priceValue:e.priceValue,
- priceId:e.priceId,
- saleShippingAddressId:e.saleShippingAddressId,
- })
- })
- },
- //收货地址点击浏览的事件
- select(index){
- this.addressDrawer = true;
- this.addressIndex = index ;
- },
- //收货地址模态框单选选中的事件
- currentRadioChange2(val){
- this.priceMap = {};
- this.priceMap = val;
- },
- //车辆模态框的确定事件
- AddTruckClick(){
- if(this.selectTruck.length>0){
- this.selectTruck.forEach(e => {
- this.selectionList.push({
- //销售订单与物资表主键
- saleMaterialId:this.saleMaterialId,
- capacityId:e.capacityId,
- carrierId:e.carrierId,
- capacityNumber:e.capacityNumber,
- carrierName:e.carrierName,
- materialName:this.materialName,
- materialId:this.materialId,
- lineName:this.lineName,
- lineId:this.lineId,
- })
- });
- this.truckDrawer = false;
- //置空当前多选选中的车辆数据
- this.selectTruck = [];
- }
-
- },
- //车辆模态框框计算
- selectTruckClick(){
- if (getCookie("orgCode") == "chengyunshang") {
- this.truck.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
- getCookie("userId") + "&index="+this.truckText;
- } else {
- this.truck.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null + "&index="+this.truckText;
- }
- },
- //车辆表格
- currentRadioChange1(select){
- this.selectTruck = [];
- this.selectTruck = select;
- },
- //主界面表格单选
- currentRadioChange(row) {
- this.materialId = row.materialId;
- this.materialName = row.materialName;
- this.saleMaterialId = row.saleMaterialId;
- },
- //线路表格的单选事件
- currentRadioChange5(row){
- //存在lineName,赋值,否则初始化
- if(row.lineName){
- this.cacheLine = row;
- }else{
- this.cacheLine = {
- ROW_ID : 0,
- lineDesk : '',
- lineId : 0,
- lineName : '',
- lineNo : '',
- lineType : '',
- spellNumber : 0,
- }
- }
- },
- onClick(num) {
- if (num == 1) {
- this.drawer = true;
- this.lineText = null;
- }else if(num == 2){
- //再度初始化选择车辆表头
- if (getCookie("orgCode") == "chengyunshang") {
- this.truck.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
- getCookie("userId") + "&i=" + new Date();
- } else {
- this.truck.requestUrl =
- "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null + "&i=" + new Date();;
- }
- //后续操作
- if(!this.materialId){
- this.$message.warning('请选择物资后,再点击')
- }else if(!this.lineId){
- this.$message.warning('请选择线路后,再点击')
- }else{
- this.truckDrawer = true;
- this.truckText = null;
- }
- }
- },
- //线路表格的框计算
- selectClick(){
- this.line.requestUrl = '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con='+this.lineText;
- },
- //线路表格的确定事件
- AddClick(){
- if(this.cacheLine.lineName!=''){
- this.drawer = false;
- this.lineName = this.cacheLine.lineName +" "+ this.cacheLine.lineDesk;
- this.lineId = this.cacheLine.lineId;
- }
- }
- },
- };
- </script>
- <style lang='scss'>
- .addSaleOrderSend {
- .from {
- margin-top: 20px;
- .line {
- display: flex;
- justify-content: center;
- align-items: center;
- .el-input {
- width: 350px;
- margin-left: 10px;
- margin-right: 10px;
- }
- }
- .vehicle {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-top: 20px;
- .el-button {
- width: 250px;
- margin-left: 10px;
- margin-right: 10px;
- }
- .span {
- width: 70px;
- }
- }
- }
- .tablecls{
- margin-top: 20px;
- }
- .button_box{
- display: flex;
- justify-content: center;
- margin: 20px;
- .el-button{
- width: 100px;
- margin-left: 20px;
- }
- }
- }
- </style>
|