addSaleOrderSend.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  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 == 'priceValue'" >
  76. <el-input
  77. style="width: 200px"
  78. v-model="scope.row.priceValue"
  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 == 'saleDateOfReceipt'">
  91. <el-date-picker
  92. class="textinput3"
  93. type="date"
  94. v-model.number="scope.row.saleDateOfReceipt"
  95. ></el-date-picker>
  96. </template>
  97. <!-- 收货客户 -->
  98. <template v-if="item.prop == 'saleOrderConsignee'">
  99. <el-input
  100. class="textinput4"
  101. placeholder="(非必填)"
  102. v-model.number="scope.row.saleOrderConsignee"
  103. ></el-input>
  104. </template>
  105. <!-- 收货客户电话号码 -->
  106. <template v-if="item.prop == 'saleOrderConsigneeTel'">
  107. <el-input
  108. class="textinput5"
  109. placeholder="(非必填)"
  110. v-model.number="scope.row.saleOrderConsigneeTel"
  111. @input="onInput"
  112. ></el-input>
  113. </template>
  114. </template>
  115. <template v-else>
  116. <span>{{ scope.row[item.prop] }}</span>
  117. </template>
  118. </template>
  119. </el-table-column>
  120. <!-- 操作列 -->
  121. <el-table-column fixed="right" label="操作" width="100">
  122. <template slot-scope="scope">
  123. <el-button
  124. @click="copyRow(scope.$index,scope.row)"
  125. type="text"
  126. size="big"
  127. >
  128. 复制
  129. </el-button>
  130. <el-button
  131. @click="deleteRow(scope.$index)"
  132. type="text"
  133. icon="el-icon-close"
  134. size="big"
  135. ></el-button>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. <!-- 线路模态框 -->
  141. <el-drawer
  142. :visible.sync="drawer"
  143. :destroy-on-close="false"
  144. direction="rtl"
  145. size="40%"
  146. :wrapperClosable="false"
  147. @keyup.enter.native="AddClick"
  148. modal
  149. close-on-press-escape
  150. >
  151. <el-input
  152. placeholder="请输入内容"
  153. v-model="lineText"
  154. style="margin-top: 10px; margin-left: 20px; width: 250px"
  155. @keyup.enter.native="selectClick"
  156. clearable
  157. >
  158. </el-input>
  159. <el-button
  160. type="primary"
  161. class="btn"
  162. @click="selectClick"
  163. style="margin-left: 5px"
  164. >
  165. <i class="el-icon-search"></i>查询
  166. </el-button>
  167. <el-button
  168. type="primary"
  169. class="btn"
  170. @click="AddClick"
  171. style="margin-left: 5px"
  172. >
  173. <i class="el-icon-check"></i>确定
  174. </el-button>
  175. <div class="tablecls">
  176. <!-- 查询所有的路线 -->
  177. <dilTable
  178. v-bind.sync="line"
  179. @radio-change="currentRadioChange5"
  180. ></dilTable>
  181. </div>
  182. </el-drawer>
  183. <!-- 车辆模态框 -->
  184. <el-drawer
  185. :visible.sync="truckDrawer"
  186. :destroy-on-close="false"
  187. direction="rtl"
  188. size="40%"
  189. @keyup.enter.native="AddTruckClick"
  190. :wrapperClosable="false"
  191. modal
  192. close-on-press-escape
  193. >
  194. <el-input
  195. placeholder="请输入内容"
  196. v-model="truckText"
  197. style="margin-top: 10px; margin-left: 20px; width: 250px"
  198. @keyup.enter.native="selectTruckClick"
  199. clearable
  200. >
  201. </el-input>
  202. <el-button
  203. type="primary"
  204. class="btn"
  205. @click="selectTruckClick"
  206. style="margin-left: 5px"
  207. >
  208. <i class="el-icon-search"></i>查询
  209. </el-button>
  210. <el-button
  211. type="primary"
  212. class="btn"
  213. @click="AddTruckClick"
  214. style="margin-left: 5px"
  215. >
  216. <i class="el-icon-check"></i>确定
  217. </el-button>
  218. <div class="tablecls">
  219. <!-- 查询所有的车辆 -->
  220. <dilTable
  221. v-bind.sync="truck"
  222. @selection-change="currentRadioChange1"
  223. ></dilTable>
  224. </div>
  225. </el-drawer>
  226. <!-- 运输单价(地址对应)的模态框 -->
  227. <el-drawer
  228. :visible.sync="addressDrawer"
  229. :destroy-on-close="false"
  230. direction="rtl"
  231. size="40%"
  232. :wrapperClosable="false"
  233. modal
  234. close-on-press-escape
  235. >
  236. <el-input v-model="addresText" placeholder="请输入内容" style="margin-top: 10px; margin-left: 20px; width: 250px"></el-input>
  237. <el-button type="primary" @click="selectAddresClick" :loading="selectLineLoading"><i class="el-icon-search"></i>查询</el-button>
  238. <!-- 已选中 省市(区)县 -->
  239. <el-form :inline="true" style="margin-top: 0.5rem;">
  240. <el-form-item>
  241. <label class="el-form-item__label" style="width: auto;">已选中省市县(区):</label>
  242. </el-form-item>
  243. <el-form-item>
  244. <el-input class="el-form-item__content" v-model="address" placeholder="请输入内容" :disabled="true"></el-input>
  245. </el-form-item>
  246. </el-form>
  247. <!-- 具体收货地址 -->
  248. <div v-if="address != null">
  249. <el-form :inline="true" style="margin-top: 0.5rem;" >
  250. <el-form-item label="具体收货地址:">
  251. <el-autocomplete
  252. class="inline-input"
  253. v-model="place"
  254. :fetch-suggestions="querySearch1"
  255. placeholder="请输入具体收货地址"
  256. :trigger-on-focus="false"
  257. @select="handleSelect1"
  258. >
  259. </el-autocomplete>
  260. </el-form-item>
  261. <el-button type="primary" @click="addAddressClick">确定</el-button>
  262. </el-form>
  263. </div>
  264. <div class="tablecls">
  265. <!-- 查询所有的运输单价 -->
  266. <dilTable
  267. v-bind.sync="Address"
  268. @radio-change="currentRadioChange2"
  269. ></dilTable>
  270. </div>
  271. </el-drawer>
  272. <div class="button_box">
  273. <el-button @click="cancel">取消</el-button>
  274. <el-button type="primary" @click="makeSure">确定</el-button>
  275. </div>
  276. </div>
  277. </template>
  278. <script>
  279. import PageTitle from "@/components/Page/Title";
  280. import { getCookie } from "@/utils/util.js";
  281. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  282. export default {
  283. components: { PageTitle },
  284. data() {
  285. return {
  286. //已选中 省市县(区)
  287. address:null,
  288. //具体收货地址
  289. place:null,
  290. //收货地址id
  291. addressId:null,
  292. //省市县(区)查询值
  293. addresText:null,
  294. //加载
  295. selectLineLoading:false,
  296. //线路名称
  297. lineName:null,
  298. lineId:null,
  299. //线路表格单选缓存数据的
  300. cacheLine:{
  301. ROW_ID : 0,
  302. lineDesk : '',
  303. lineId : 0,
  304. lineName : '',
  305. lineNo : '',
  306. lineType : '',
  307. spellNumber : 0,
  308. },
  309. //是否自提
  310. saleOrderIsselfMention:'',
  311. //单价已选数量
  312. choosePriceCount: 0,
  313. //已经选择车辆物资信息
  314. selectionList:[],
  315. //销售订单物资信息
  316. option: {
  317. // 表格请求数据的地址
  318. requestUrl:"",
  319. // 控制显示当选列
  320. selectionType: "radio",
  321. isPagination: false,
  322. },
  323. //当前选中的物资id
  324. materialId: null,
  325. //当前选中的物资名称
  326. materialName: null,
  327. //选中的线路名称
  328. lineName: null,
  329. //选中的线路id
  330. lineId: null,
  331. //是否打开选择线路的模态框
  332. drawer:false,
  333. //是否打开选择车辆的模态框
  334. truckDrawer:false,
  335. //是否打开运输单价的模态框
  336. addressDrawer:false,
  337. //线路的表格
  338. line: {
  339. requestUrl: "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con="+'销售',
  340. selectionType: "radio",
  341. },
  342. //车辆的表格
  343. truck: {
  344. requestUrl: "",
  345. selectionType: "select",
  346. },
  347. //运输单价的表格
  348. Address: {
  349. requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
  350. selectionType: "radio",
  351. },
  352. addressText:null,
  353. //线路表格的框计算输入的值
  354. lineText:null,
  355. tableTop: [
  356. {
  357. prop: "capacityNumber",
  358. label: "车牌号",
  359. width: "100",
  360. },
  361. {
  362. prop: "carrierName",
  363. label: "承运商",
  364. width: "220",
  365. },
  366. {
  367. prop: "materialName",
  368. label: "物资名称",
  369. width: "140",
  370. },
  371. {
  372. prop: "lineName",
  373. label: "运输线路",
  374. width: "220",
  375. },
  376. {
  377. prop: "orderPlanWeight",
  378. label: "重量",
  379. width: "140",
  380. slot: true,
  381. },
  382. {
  383. prop: "saleDateOfReceipt",
  384. label: "截止日期",
  385. width: "230",
  386. slot: true,
  387. },
  388. {
  389. prop: "priceValue",
  390. label: "运输单价",
  391. width: "300",
  392. slot: true,
  393. },
  394. // {
  395. // prop: "saleShipperAddressName",
  396. // label: "收货地址",
  397. // width: "300",
  398. // slot: true,
  399. // },
  400. {
  401. prop: "saleOrderConsignee",
  402. label: "收货人",
  403. width: "150",
  404. slot: true,
  405. },
  406. {
  407. prop: "saleOrderConsigneeTel",
  408. label: "收货客户电话号码",
  409. slot: true,
  410. width: "150",
  411. },
  412. ],
  413. truckText:null,
  414. //当前多选选中的车辆
  415. selectTruck:[],
  416. //销售订单与物资表主键
  417. saleMaterialId:null,
  418. //销售订单主键
  419. saleOrderId:null,
  420. //记录点击的是哪一个收货地址的浏览
  421. addressIndex:null,
  422. //缓存当前选中的运输单价
  423. // priceMap:{},
  424. };
  425. },
  426. created() {
  427. if (getCookie("orgCode") == "chengyunshang") {
  428. this.truck.requestUrl =
  429. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  430. getCookie("userId");
  431. } else {
  432. this.truck.requestUrl =
  433. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null;
  434. }
  435. this.option.requestUrl = "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId;
  436. },
  437. methods: {
  438. onInput(val){
  439. if(!isNumber(val)){
  440. this.$message.warning('重量/电话号码请输入数字')
  441. }
  442. },
  443. //收货地址弹出层
  444. handleSelect1(item) {
  445. console.log("获取所有下拉值!");
  446. },
  447. //查询全国省市县
  448. selectAddresClick(){
  449. if(this.addresText){
  450. this.Address.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con="+this.addresText;
  451. }else{
  452. this.Address.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
  453. }
  454. },
  455. //以下是收货地址边输边查搜索
  456. querySearch1(queryString, cb){
  457. this.axios
  458. .post("/api/v1/ams/getRealAddressByLike?addressId="+this.addressId + "&index=" + queryString)
  459. .then((res) => {
  460. if (res.data.code == "200") {
  461. var restaurants = res.data.data;
  462. var results = queryString
  463. ? restaurants.filter(this.createFilter1(queryString))
  464. : restaurants;
  465. // 调用 callback 返回建议列表的数据
  466. cb(results);
  467. }
  468. });
  469. },
  470. createFilter1(queryString) {
  471. return (restaurants) => {
  472. return (
  473. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  474. -1
  475. );
  476. };
  477. },
  478. //以上是收货地址边输边查搜索
  479. //点击确定按钮的事件
  480. makeSure(){
  481. let state = false;
  482. this.selectionList.forEach((e)=>{
  483. if(!isNumber(e.orderPlanWeight)){
  484. this.$message.error('重量请输入数字')
  485. }else if(e.saleOrderConsigneeTel){
  486. if(!isNumber(e.saleOrderConsigneeTel)){
  487. this.$message.error('电话号码请输入数字')
  488. }else{
  489. e.saleOrderConsigneeTel = e.saleOrderConsigneeTel+"",
  490. state = true
  491. }
  492. }else {
  493. e.saleOrderConsigneeTel = null,
  494. state = true
  495. }
  496. if(e.saleDateOfReceipt){
  497. e.saleDateOfReceipt = sjTime(e.saleDateOfReceipt)
  498. }
  499. })
  500. if(state){
  501. //校验是否自提,是自提,则运输单价必选,非自提,运输单价为空
  502. if(this.saleOrderIsselfMention=='是'){
  503. this.selectionList.forEach((e)=>{
  504. e.priceValue = null;
  505. e.priceId = null;
  506. })
  507. this.sendRequest();
  508. }else{
  509. //判断是否全部完成运输单价的选择
  510. if(this.choosePriceCount==this.selectionList.length){
  511. this.sendRequest();
  512. }else{
  513. this.$message.warning('还有运输单价未被选定!')
  514. }
  515. }
  516. }else{
  517. this.$message.warning('重量/电话号码请输入数字')
  518. }
  519. },
  520. //发送请求
  521. sendRequest(){
  522. this.axios.post('/api/v1/ams/dispatchTruckOrderBySale',{
  523. saleOrderId:this.$route.params.saleOrderId,
  524. mapList:this.selectionList,
  525. }).then((res)=>{
  526. if(res.data.code == '200'){
  527. this.$message.success('派车成功')
  528. this.cancel();
  529. }else{
  530. //若该销售订单的净重已达到97%!
  531. this.$confirm("该销售订单的净重已达到97%! 是否仍然派车", "提示", {
  532. confirmButtonText: "确定",
  533. cancelButtonText: "取消",
  534. type: "warning",
  535. center: true,
  536. })
  537. .then(() => {
  538. this.axios.post('/api/v1/ams/dispatchTruckOrderBySale',{
  539. saleOrderId:this.$route.params.saleOrderId,
  540. sendAgain:1,
  541. mapList:this.selectionList,
  542. }).then((res)=>{
  543. if(res.data.code == '200'){
  544. this.$message.success('派车成功')
  545. this.cancel();
  546. }
  547. });
  548. })
  549. .catch(() => {
  550. this.$message({
  551. type: "info",
  552. message: "取消派车!",
  553. });
  554. });
  555. }
  556. })
  557. },
  558. //点击取消按钮的事件
  559. cancel(){
  560. this.$router.push('/saleOrder')
  561. },
  562. //点击删除按钮删除当前点击的对象
  563. deleteRow(index){
  564. this.selectionList.splice(index,1)
  565. },
  566. //复制的方法
  567. copyRow(index,row){
  568. let arr = [];
  569. for(var i = 0 ;i<this.selectionList.length; i++){
  570. if(i == index){
  571. arr.push(this.selectionList[i]);
  572. arr.push({
  573. capacityId:row.capacityId,
  574. capacityNumber:row.capacityNumber,
  575. carrierName:row.carrierName,
  576. carrierId:row.carrierId,
  577. lineId:row.lineId,
  578. lineName:row.lineName,
  579. materialId:row.materialId,
  580. materialName:row.materialName,
  581. orderPlanWeight:row.orderPlanWeight,
  582. saleDateOfReceipt:row.saleDateOfReceipt,
  583. saleMaterialId:row.saleMaterialId,
  584. saleOrderConsignee:row.saleOrderConsignee,
  585. saleOrderConsigneeTel:row.saleOrderConsigneeTel,
  586. saleShipperAddressId:row.saleShipperAddressId,
  587. place:row.place,
  588. priceValue:row.priceValue,
  589. priceId:row.priceId
  590. }
  591. )
  592. }else{
  593. arr.push(this.selectionList[i]);
  594. }
  595. }
  596. this.selectionList = [];
  597. this.selectionList = arr;
  598. },
  599. //收货地址模态窗口的框计算
  600. selectAddressClick(){
  601. this.Address.requestUrl = '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con='+this.addressText;
  602. },
  603. //运输单价模态窗口的点击确定事件--------------
  604. addAddressClick(){
  605. //获取运输单价和运输单价ID
  606. let map = {
  607. place: this.place,
  608. addressId: this.addressId
  609. }
  610. this.axios.post('/api/v1/ams/getPriceMap',map)
  611. .then((res)=>{
  612. if(res.data.data.priceId==-1){
  613. this.selectionList[this.addressIndex].saleShipperAddressId = this.addressId;
  614. this.selectionList[this.addressIndex].place = this.place;
  615. this.selectionList[this.addressIndex].priceValue = '该区域尚未录入任何单价!';
  616. this.selectionList[this.addressIndex].priceId = 0;
  617. this.addAddressClickNext();
  618. }else{
  619. //赋值运输单价和运输单价ID
  620. this.selectionList[this.addressIndex].saleShipperAddressId = this.addressId;
  621. this.selectionList[this.addressIndex].place = this.place;
  622. this.selectionList[this.addressIndex].priceValue = res.data.data.priceValue;//this.priceMap.priceValue
  623. this.selectionList[this.addressIndex].priceId = res.data.data.priceId;//this.priceMap.priceId
  624. this.addAddressClickNext();
  625. }
  626. });
  627. },
  628. //运输单价模态窗口的点击确定事件接续执行方法
  629. addAddressClickNext(){
  630. this.addressDrawer = false;
  631. let arr = this.selectionList;
  632. this.selectionList = [];
  633. //统计被选中的运输单价数量
  634. var count = 0;
  635. arr.forEach((e)=>{
  636. if(e.priceValue){
  637. count++;
  638. }
  639. this.selectionList.push({
  640. //销售订单与物资表主键
  641. capacityId:e.capacityId,
  642. capacityNumber:e.capacityNumber,
  643. carrierName:e.carrierName,
  644. carrierId:e.carrierId,
  645. lineId:e.lineId,
  646. lineName:e.lineName,
  647. materialId:e.materialId,
  648. materialName:e.materialName,
  649. orderPlanWeight:e.orderPlanWeight,
  650. saleDateOfReceipt:e.saleDateOfReceipt,
  651. saleMaterialId:e.saleMaterialId,
  652. saleOrderConsignee:e.saleOrderConsignee,
  653. saleOrderConsigneeTel:e.saleOrderConsigneeTel,
  654. saleShipperAddressId:e.saleShipperAddressId,
  655. place:e.place,
  656. priceValue:e.priceValue,
  657. priceId:e.priceId,
  658. })
  659. })
  660. //赋值单价已选数量
  661. this.choosePriceCount = count;
  662. },
  663. //收货地址点击浏览的事件
  664. select(index){
  665. this.addressDrawer = true;
  666. this.addressIndex = index ;
  667. },
  668. //收货地址模态框单选选中的事件
  669. currentRadioChange2(val){
  670. //若具体地址有值,清空值
  671. if(this.place!=null){
  672. this.place=null;
  673. }
  674. this.address = val.address,
  675. this.addressId = val.addressId;
  676. // this.priceMap = {};
  677. // this.priceMap = val;
  678. },
  679. //车辆模态框的确定事件
  680. AddTruckClick(){
  681. if(this.selectTruck.length>0){
  682. this.selectTruck.forEach(e => {
  683. //通过承运商Id和销售订单Id获取运输单价和运输单价ID以提前赋值
  684. let map = {
  685. saleOrderId : this.saleOrderId,
  686. carrierId: e.carrierId,
  687. }
  688. this.axios.post('/api/v1/ams/getBenPrice',map)
  689. .then((res)=>{
  690. //生成下方表单单元格
  691. this.selectionList.push({
  692. //销售订单与物资表主键
  693. saleMaterialId:this.saleMaterialId,
  694. capacityId:e.capacityId,
  695. carrierId:e.carrierId,
  696. capacityNumber:e.capacityNumber,
  697. carrierName:e.carrierName,
  698. materialName:this.materialName,
  699. materialId:this.materialId,
  700. lineName:this.lineName,
  701. lineId:this.lineId,
  702. priceValue:res.data.data.priceValue,
  703. priceId:res.data.data.priceId,
  704. saleOrderConsignee:null
  705. })
  706. });
  707. });
  708. this.truckDrawer = false;
  709. //置空当前多选选中的车辆数据
  710. this.selectTruck = [];
  711. }
  712. },
  713. //车辆模态框框计算
  714. selectTruckClick(){
  715. if (getCookie("orgCode") == "chengyunshang") {
  716. this.truck.requestUrl =
  717. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  718. getCookie("userId") + "&index="+this.truckText;
  719. } else {
  720. this.truck.requestUrl =
  721. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null + "&index="+this.truckText;
  722. }
  723. },
  724. //车辆表格
  725. currentRadioChange1(select){
  726. this.selectTruck = [];
  727. this.selectTruck = select;
  728. },
  729. //主界面表格单选
  730. currentRadioChange(row) {
  731. this.saleOrderIsselfMention = row.saleOrderIsselfMention;
  732. this.materialId = row.materialId;
  733. this.materialName = row.materialName;
  734. this.saleMaterialId = row.saleMaterialId;
  735. this.saleOrderId = row.saleOrderId;
  736. },
  737. //线路表格的单选事件
  738. currentRadioChange5(row){
  739. //存在lineName,赋值,否则初始化
  740. if(row.lineName){
  741. this.cacheLine = row;
  742. }else{
  743. this.cacheLine = {
  744. ROW_ID : 0,
  745. lineDesk : '',
  746. lineId : 0,
  747. lineName : '',
  748. lineNo : '',
  749. lineType : '',
  750. spellNumber : 0,
  751. }
  752. }
  753. },
  754. onClick(num) {
  755. if (num == 1) {
  756. this.drawer = true;
  757. this.lineText = null;
  758. }else if(num == 2){
  759. //再度初始化选择车辆表头
  760. if (getCookie("orgCode") == "chengyunshang") {
  761. this.truck.requestUrl =
  762. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
  763. getCookie("userId") + "&i=" + new Date();
  764. } else {
  765. this.truck.requestUrl =
  766. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null + "&i=" + new Date();
  767. }
  768. //后续操作
  769. if(!this.materialId){
  770. this.$message.warning('请选择物资后,再点击')
  771. }else if(!this.lineId){
  772. this.$message.warning('请选择线路后,再点击')
  773. }else{
  774. this.truckDrawer = true;
  775. this.truckText = null;
  776. }
  777. }
  778. },
  779. //线路表格的框计算
  780. selectClick(){
  781. this.line.requestUrl = '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con='+this.lineText;
  782. },
  783. //线路表格的确定事件
  784. AddClick(){
  785. if(this.cacheLine.lineName!=''){
  786. this.drawer = false;
  787. this.lineName = this.cacheLine.lineName +" "+ this.cacheLine.lineDesk;
  788. this.lineId = this.cacheLine.lineId;
  789. }
  790. }
  791. },
  792. };
  793. </script>
  794. <style lang='scss'>
  795. .addSaleOrderSend {
  796. .from {
  797. margin-top: 20px;
  798. .line {
  799. display: flex;
  800. justify-content: center;
  801. align-items: center;
  802. .el-input {
  803. width: 350px;
  804. margin-left: 10px;
  805. margin-right: 10px;
  806. }
  807. }
  808. .vehicle {
  809. display: flex;
  810. justify-content: center;
  811. align-items: center;
  812. margin-top: 20px;
  813. .el-button {
  814. width: 250px;
  815. margin-left: 10px;
  816. margin-right: 10px;
  817. }
  818. .span {
  819. width: 70px;
  820. }
  821. }
  822. }
  823. .tablecls{
  824. margin-top: 20px;
  825. }
  826. .button_box{
  827. display: flex;
  828. justify-content: center;
  829. margin: 20px;
  830. .el-button{
  831. width: 100px;
  832. margin-left: 20px;
  833. }
  834. }
  835. }
  836. </style>