addSaleCokeSend.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. <template>
  2. <div class="addSaleOrderSend">
  3. <page-title>新增销售订单派车</page-title>
  4. <!-- 销售订单表的数据 -->
  5. <div class="saleOrder">
  6. <dilTable
  7. v-bind.sync="option"
  8. @radio-change="currentRadioChange"
  9. ></dilTable>
  10. </div>
  11. <!-- 表单选择车辆和线路 -->
  12. <div class="from">
  13. <div class="line">
  14. <span class="text">线路</span>
  15. <el-input
  16. v-model="lineName"
  17. placeholder="请选择线路"
  18. disabled
  19. ></el-input>
  20. <el-button type="primary" @click="onClick(1)">浏览</el-button>
  21. </div>
  22. <div class="vehicle">
  23. <span class="text">车辆</span>
  24. <el-button type="primary" @click="onClick(2)">浏览</el-button>
  25. <span class="span"></span>
  26. </div>
  27. </div>
  28. <!-- 派车表格 -->
  29. <div class="selectionTable from">
  30. <el-table
  31. :data="selectionList"
  32. border
  33. style="width: 100%"
  34. highlight-current-row
  35. >
  36. <el-table-column type="index" label="序号" width="50">
  37. </el-table-column>
  38. <el-table-column
  39. v-for="(item, i) in tableTop"
  40. :key="i"
  41. :prop="item.prop"
  42. :label="item.label"
  43. :width="item.width"
  44. align="center"
  45. show-overflow-tooltip
  46. >
  47. <template slot="scope" v-if="item.label !== '重量'">
  48. <span>{{ item.label }}</span>
  49. </template>
  50. <template slot="scope" v-if="item.label !== '收货地址'">
  51. <span>{{ item.label }}</span>
  52. </template>
  53. <template slot="scope" v-if="item.label !== '截止日期'">
  54. <span>{{ item.label }}</span>
  55. </template>
  56. <template slot="scope" v-if="item.label !== '收货姓名'">
  57. <span>{{ item.label }}</span>
  58. </template>
  59. <template slot="scope" v-if="item.label !== '收货方电话'">
  60. <span>{{ item.label }}</span>
  61. </template>
  62. <!-- 插入输入框 -->
  63. <template slot-scope="scope">
  64. <template v-if="item.slot">
  65. <!-- 物资重量 -->
  66. <template v-if="item.prop == 'orderPlanWeight'">
  67. <el-input
  68. class="textinput"
  69. @input="onInput"
  70. placeholder="(必填)"
  71. v-model.number="scope.row.orderPlanWeight"
  72. ></el-input>
  73. </template>
  74. <!-- 收货地址id -->
  75. <template v-if="item.prop == 'saleShipperAddressName'" >
  76. <el-input
  77. style="width: 200px"
  78. v-model="scope.row.saleShipperAddressName"
  79. disabled
  80. >
  81. </el-input>
  82. <el-button
  83. type="primary"
  84. placeholder="(非必填)"
  85. @click="select(scope.$index,3)"
  86. >浏览</el-button
  87. >
  88. </template>
  89. <!-- 收货客户 -->
  90. <template v-if="item.prop == 'saleOrderConsignee'">
  91. <el-input
  92. class="textinput4"
  93. placeholder="(非必填)"
  94. v-model.number="scope.row.saleOrderConsignee"
  95. ></el-input>
  96. </template>
  97. <!-- 收货客户电话号码 -->
  98. <template v-if="item.prop == 'saleOrderConsigneeTel'">
  99. <el-input
  100. class="textinput5"
  101. placeholder="(非必填)"
  102. v-model.number="scope.row.saleOrderConsigneeTel"
  103. @input="onInput"
  104. ></el-input>
  105. </template>
  106. </template>
  107. <template v-else>
  108. <span>{{ scope.row[item.prop] }}</span>
  109. </template>
  110. </template>
  111. </el-table-column>
  112. <!-- 操作列 -->
  113. <el-table-column fixed="right" label="操作" width="100">
  114. <template slot-scope="scope">
  115. <el-button
  116. @click="copyRow(scope.$index,scope.row)"
  117. type="text"
  118. size="big"
  119. >
  120. 复制
  121. </el-button>
  122. <el-button
  123. @click="deleteRow(scope.$index)"
  124. type="text"
  125. icon="el-icon-close"
  126. size="big"
  127. ></el-button>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. </div>
  132. <!-- 线路模态框 -->
  133. <el-drawer
  134. :visible.sync="drawer"
  135. :destroy-on-close="false"
  136. direction="rtl"
  137. size="40%"
  138. :wrapperClosable="false"
  139. @keyup.enter.native="AddClick"
  140. modal
  141. close-on-press-escape
  142. >
  143. <el-input
  144. placeholder="请输入内容"
  145. v-model="lineText"
  146. style="margin-top: 10px; margin-left: 20px; width: 250px"
  147. @keyup.enter.native="selectClick"
  148. clearable
  149. >
  150. </el-input>
  151. <el-button
  152. type="primary"
  153. class="btn"
  154. @click="selectClick"
  155. style="margin-left: 5px"
  156. >
  157. <i class="el-icon-search"></i>查询
  158. </el-button>
  159. <el-button
  160. type="primary"
  161. class="btn"
  162. @click="AddClick"
  163. style="margin-left: 5px"
  164. >
  165. <i class="el-icon-check"></i>确定
  166. </el-button>
  167. <div class="tablecls">
  168. <!-- 查询所有的路线 -->
  169. <dilTable
  170. v-bind.sync="line"
  171. @radio-change="currentRadioChange5"
  172. ></dilTable>
  173. </div>
  174. </el-drawer>
  175. <!-- 车辆模态框 -->
  176. <el-drawer
  177. :visible.sync="truckDrawer"
  178. :destroy-on-close="false"
  179. direction="rtl"
  180. size="40%"
  181. @keyup.enter.native="AddTruckClick"
  182. :wrapperClosable="false"
  183. modal
  184. close-on-press-escape
  185. >
  186. <el-input
  187. placeholder="请输入内容"
  188. v-model="truckText"
  189. style="margin-top: 10px; margin-left: 20px; width: 250px"
  190. @keyup.enter.native="selectTruckClick"
  191. clearable
  192. >
  193. </el-input>
  194. <el-button
  195. type="primary"
  196. class="btn"
  197. @click="selectTruckClick"
  198. style="margin-left: 5px"
  199. >
  200. <i class="el-icon-search"></i>查询
  201. </el-button>
  202. <el-button
  203. type="primary"
  204. class="btn"
  205. @click="AddTruckClick"
  206. style="margin-left: 5px"
  207. >
  208. <i class="el-icon-check"></i>确定
  209. </el-button>
  210. <div class="tablecls">
  211. <!-- 查询所有的车辆 -->
  212. <dilTable
  213. v-bind.sync="truck"
  214. @selection-change="currentRadioChange1"
  215. ></dilTable>
  216. </div>
  217. </el-drawer>
  218. <!-- 收货地址的模态框 -->
  219. <el-drawer
  220. :visible.sync="addressDrawer"
  221. :destroy-on-close="false"
  222. direction="rtl"
  223. size="40%"
  224. :wrapperClosable="false"
  225. modal
  226. close-on-press-escape
  227. >
  228. <el-input
  229. placeholder="请输入内容"
  230. v-model="addressText"
  231. style="margin-top: 10px; margin-left: 20px; width: 250px"
  232. clearable
  233. >
  234. </el-input>
  235. <el-button
  236. type="primary"
  237. class="btn"
  238. @click="selectAddressClick"
  239. style="margin-left: 5px"
  240. >
  241. <i class="el-icon-search"></i>查询
  242. </el-button>
  243. <el-button
  244. type="primary"
  245. class="btn"
  246. @click="addAddressClick"
  247. style="margin-left: 5px"
  248. >
  249. <i class="el-icon-check"></i>确定
  250. </el-button>
  251. <div class="tablecls">
  252. <!-- 查询所有的收货地址 -->
  253. <dilTable
  254. v-bind.sync="Address"
  255. @radio-change="currentRadioChange2"
  256. ></dilTable>
  257. </div>
  258. </el-drawer>
  259. <div class="button_box">
  260. <el-button @click="cancel">取消</el-button>
  261. <el-button type="primary" @click="makeSure">确定</el-button>
  262. </div>
  263. </div>
  264. </template>
  265. <script>
  266. import PageTitle from "@/components/Page/Title";
  267. import { getCookie } from "@/utils/util.js";
  268. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  269. export default {
  270. components: { PageTitle },
  271. data() {
  272. return {
  273. //线路名称
  274. lineName:null,
  275. lineId:null,
  276. //线路表格单选缓存数据的
  277. cacheLine:{
  278. ROW_ID : 0,
  279. lineDesk : '',
  280. lineId : 0,
  281. lineName : '',
  282. lineNo : '',
  283. lineType : '',
  284. spellNumber : 0,
  285. },
  286. //已经选择车辆物资信息
  287. selectionList:[],
  288. //销售订单物资信息
  289. option: {
  290. // 表格请求数据的地址
  291. requestUrl:"",
  292. // 控制显示当选列
  293. selectionType: "radio",
  294. isPagination: false,
  295. },
  296. //当前选中的物资id
  297. materialId: null,
  298. //当前选中的物资名称
  299. materialName: null,
  300. //选中的线路名称
  301. lineName: null,
  302. //选中的线路id
  303. lineId: null,
  304. //是否打开选择线路的模态框
  305. drawer:false,
  306. //是否打开选择车辆的模态框
  307. truckDrawer:false,
  308. //是否打开收货地址的模态框
  309. addressDrawer:false,
  310. //线路的表格
  311. line: {
  312. requestUrl: "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con="+'销售',
  313. selectionType: "radio",
  314. },
  315. //车辆的表格
  316. truck: {
  317. requestUrl: "",
  318. selectionType: "select",
  319. },
  320. //收货地址的表格
  321. Address: {
  322. requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
  323. selectionType: "radio",
  324. },
  325. addressText:null,
  326. //线路表格的框计算输入的值
  327. lineText:null,
  328. tableTop: [
  329. {
  330. prop: "capacityNumber",
  331. label: "车牌号",
  332. width: "100",
  333. },
  334. {
  335. prop: "materialName",
  336. label: "物资名称",
  337. width: "140",
  338. },
  339. {
  340. prop: "carrierName",
  341. label: "承运商",
  342. width: "220",
  343. },
  344. {
  345. prop: "lineName",
  346. label: "运输线路",
  347. width: "220",
  348. },
  349. {
  350. prop: "orderPlanWeight",
  351. label: "重量",
  352. width: "140",
  353. slot: true,
  354. },
  355. {
  356. prop: "saleShipperAddressName",
  357. label: "收货地址",
  358. width: "300",
  359. slot: true,
  360. },
  361. {
  362. prop: "saleOrderConsignee",
  363. label: "收货客户",
  364. width: "150",
  365. slot: true,
  366. },
  367. {
  368. prop: "saleOrderConsigneeTel",
  369. label: "收货客户电话号码",
  370. slot: true,
  371. width: "150",
  372. },
  373. ],
  374. truckText:null,
  375. //当前多选选中的车辆
  376. selectTruck:[],
  377. //销售订单与物资表主键
  378. saleMaterialId:null,
  379. //记录点击的市哪一个收货地址的浏览
  380. addressIndex:null,
  381. //缓存当前选中的收货地址
  382. addressMap:{},
  383. };
  384. },
  385. created() {
  386. if (getCookie("orgCode") == "chengyunshang") {
  387. this.truck.requestUrl =
  388. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  389. getCookie("userId");
  390. } else {
  391. this.truck.requestUrl =
  392. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null;
  393. }
  394. this.option.requestUrl = "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId;
  395. },
  396. methods: {
  397. onInput(val){
  398. if(!isNumber(val)){
  399. this.$message.warning('重量/电话号码请输入数字')
  400. }
  401. },
  402. //点击确定按钮的事件
  403. makeSure(){
  404. let state = false;
  405. this.selectionList.forEach((e)=>{
  406. if(!isNumber(e.orderPlanWeight)){
  407. this.$message.error('重量请输入数字')
  408. }else if(e.saleOrderConsigneeTel){
  409. if(!isNumber(e.saleOrderConsigneeTel)){
  410. this.$message.error('电话号码请输入数字')
  411. }else{
  412. e.saleOrderConsigneeTel = e.saleOrderConsigneeTel+"",
  413. state = true
  414. }
  415. }else {
  416. e.saleOrderConsigneeTel = null,
  417. state = true
  418. }
  419. })
  420. if(state){
  421. this.axios.post('/api/v1/ams/dispatchTruckOrderByCarrier',{
  422. saleOrderId:this.$route.params.saleOrderId,
  423. mapList:this.selectionList,
  424. orgCode:getCookie("orgCode"),
  425. }).then((res)=>{
  426. if(res.data.code == '200'){
  427. this.$message.success('派车成功')
  428. this.cancel();
  429. }else{
  430. this.$message.warning(res.data.data)
  431. }
  432. })
  433. }else{
  434. this.$message.warning('重量/电话号码请输入数字')
  435. }
  436. },
  437. //点击取消按钮的事件
  438. cancel(){
  439. this.$router.push('/saleCokeInward')
  440. },
  441. //点击删除按钮删除当前点击的对象
  442. deleteRow(index){
  443. this.selectionList.splice(index,1)
  444. },
  445. //复制的方法
  446. copyRow(index,row){
  447. let arr = [];
  448. for(var i = 0 ;i<this.selectionList.length; i++){
  449. if(i == index){
  450. arr.push(this.selectionList[i]);
  451. arr.push({
  452. capacityId:row.capacityId,
  453. capacityNumber:row.capacityNumber,
  454. carrierName:row.carrierName,
  455. carrierId:e.carrierId,
  456. lineId:row.lineId,
  457. lineName:row.lineName,
  458. materialId:row.materialId,
  459. materialName:row.materialName,
  460. orderPlanWeight:row.orderPlanWeight,
  461. saleMaterialId:row.saleMaterialId,
  462. saleOrderConsignee:row.saleOrderConsignee,
  463. saleOrderConsigneeTel:row.saleOrderConsigneeTel,
  464. saleShipperAddressName:row.saleShipperAddressName,
  465. saleShippingAddressId:row.saleShippingAddressId,
  466. }
  467. )
  468. }else{
  469. arr.push(this.selectionList[i]);
  470. }
  471. }
  472. this.selectionList = [];
  473. this.selectionList = arr;
  474. },
  475. //收货地址模态窗口的框计算
  476. selectAddressClick(){
  477. this.Address.requestUrl = '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con='+this.addressText;
  478. },
  479. //收货地址模态窗口的点击事件
  480. addAddressClick(){
  481. this.selectionList[this.addressIndex].saleShipperAddressName = this.addressMap.address
  482. this.selectionList[this.addressIndex].saleShippingAddressId = this.addressMap.addressId
  483. this.addressDrawer = false;
  484. let arr = this.selectionList;
  485. this.selectionList = [];
  486. arr.forEach((e)=>{
  487. this.selectionList.push({
  488. //销售订单与物资表主键
  489. capacityId:e.capacityId,
  490. capacityNumber:e.capacityNumber,
  491. carrierName:e.carrierName,
  492. carrierId:e.carrierId,
  493. lineId:e.lineId,
  494. lineName:e.lineName,
  495. materialId:e.materialId,
  496. materialName:e.materialName,
  497. orderPlanWeight:e.orderPlanWeight,
  498. saleMaterialId:e.saleMaterialId,
  499. saleOrderConsignee:e.saleOrderConsignee,
  500. saleOrderConsigneeTel:e.saleOrderConsigneeTel,
  501. saleShipperAddressName:e.saleShipperAddressName,
  502. saleShippingAddressId:e.saleShippingAddressId,
  503. })
  504. })
  505. },
  506. //收货地址点击浏览的事件
  507. select(index){
  508. this.addressDrawer = true;
  509. this.addressIndex = index ;
  510. },
  511. //收货地址模态框单选选中的事件
  512. currentRadioChange2(val){
  513. this.addressMap = {};
  514. this.addressMap = val;
  515. },
  516. //车辆模态框的确定事件
  517. AddTruckClick(){
  518. if(this.selectTruck.length>0){
  519. this.selectTruck.forEach(e => {
  520. this.selectionList.push({
  521. //销售订单与物资表主键
  522. saleMaterialId:this.saleMaterialId,
  523. capacityId:e.capacityId,
  524. capacityNumber:e.capacityNumber,
  525. carrierName:e.carrierName,
  526. carrierId:e.carrierId,
  527. materialName:this.materialName,
  528. materialId:this.materialId,
  529. lineName:this.lineName,
  530. lineId:this.lineId,
  531. })
  532. });
  533. this.truckDrawer = false;
  534. //置空当前多选选中的车辆数据
  535. this.selectTruck = [];
  536. }
  537. },
  538. //车辆模态框框计算
  539. selectTruckClick(){
  540. if (getCookie("orgCode") == "chengyunshang") {
  541. this.truck.requestUrl =
  542. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  543. getCookie("userId") + "&index="+this.truckText;
  544. } else {
  545. this.truck.requestUrl =
  546. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null + "&index="+this.truckText;
  547. }
  548. },
  549. //车辆表格
  550. currentRadioChange1(select){
  551. this.selectTruck = [];
  552. this.selectTruck = select;
  553. },
  554. //主界面表格单选
  555. currentRadioChange(row) {
  556. this.materialId = row.materialId;
  557. this.materialName = row.materialName;
  558. this.saleMaterialId = row.saleMaterialId;
  559. },
  560. //线路表格的单选事件
  561. currentRadioChange5(row){
  562. //存在lineName,赋值,否则初始化
  563. if(row.lineName){
  564. this.cacheLine = row;
  565. }else{
  566. this.cacheLine = {
  567. ROW_ID : 0,
  568. lineDesk : '',
  569. lineId : 0,
  570. lineName : '',
  571. lineNo : '',
  572. lineType : '',
  573. spellNumber : 0,
  574. }
  575. }
  576. },
  577. onClick(num) {
  578. if (num == 1) {
  579. this.drawer = true;
  580. this.lineText = null;
  581. }else if(num == 2){
  582. //再度初始化选择车辆表头
  583. if (getCookie("orgCode") == "chengyunshang") {
  584. this.truck.requestUrl =
  585. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  586. getCookie("userId") + "&i=" + new Date();
  587. } else {
  588. this.truck.requestUrl =
  589. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null + "&i=" + new Date();;
  590. }
  591. //后续操作
  592. if(!this.materialId){
  593. this.$message.warning('请选择物资后,再点击')
  594. }else if(!this.lineId){
  595. this.$message.warning('请选择线路后,再点击')
  596. }else{
  597. this.truckDrawer = true;
  598. this.truckText = null;
  599. }
  600. }
  601. },
  602. //线路表格的框计算
  603. selectClick(){
  604. this.line.requestUrl = '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con='+this.lineText;
  605. },
  606. //线路表格的确定事件
  607. AddClick(){
  608. if(this.cacheLine.lineName!=''){
  609. this.drawer = false;
  610. this.lineName = this.cacheLine.lineName +" "+ this.cacheLine.lineDesk;
  611. this.lineId = this.cacheLine.lineId;
  612. }
  613. }
  614. },
  615. };
  616. </script>
  617. <style lang='scss'>
  618. .addSaleOrderSend {
  619. .from {
  620. margin-top: 20px;
  621. .line {
  622. display: flex;
  623. justify-content: center;
  624. align-items: center;
  625. .el-input {
  626. width: 350px;
  627. margin-left: 10px;
  628. margin-right: 10px;
  629. }
  630. }
  631. .vehicle {
  632. display: flex;
  633. justify-content: center;
  634. align-items: center;
  635. margin-top: 20px;
  636. .el-button {
  637. width: 250px;
  638. margin-left: 10px;
  639. margin-right: 10px;
  640. }
  641. .span {
  642. width: 70px;
  643. }
  644. }
  645. }
  646. .tablecls{
  647. margin-top: 20px;
  648. }
  649. .button_box{
  650. display: flex;
  651. justify-content: center;
  652. margin: 20px;
  653. .el-button{
  654. width: 100px;
  655. margin-left: 20px;
  656. }
  657. }
  658. }
  659. </style>