addSaleOrderArrange.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. <template>
  2. <!-- 添加销售订单排车 -->
  3. <div class="addSalePlan">
  4. <page-title>新增销售订单排车</page-title>
  5. <!-- 销售订单表的数据 -->
  6. <div class="saleOrder">
  7. <dilTable v-bind.sync="option" @selection-change="selectionChange">
  8. </dilTable>
  9. </div>
  10. <div class="button-box">
  11. <el-button type="primary" @click="arragne">确定排车</el-button>
  12. </div>
  13. <!-- 车序号表格 -->
  14. <div class="switch" v-if="selectionList.length > 0">
  15. <el-tooltip placement="top">
  16. <div slot="content">下面表格已有数据,不能进行更改!!!</div>
  17. <el-switch
  18. v-model="value"
  19. active-text="件数"
  20. inactive-text="重量"
  21. disabled
  22. >
  23. </el-switch>
  24. </el-tooltip>
  25. </div>
  26. <div class="switch" v-else>
  27. <el-tooltip placement="top">
  28. <div slot="content">当下面表格有数据之后,将不能进行更改!!!</div>
  29. <el-switch v-model="value" active-text="件数" inactive-text="重量">
  30. </el-switch>
  31. </el-tooltip>
  32. </div>
  33. <!-- 排车表格 -->
  34. <div class="selectionTable from">
  35. <el-table
  36. :data="selectionList"
  37. border
  38. style="width: 100%"
  39. highlight-current-row
  40. >
  41. <el-table-column type="index" label="序号" width="50">
  42. </el-table-column>
  43. <el-table-column
  44. v-for="(item, i) in tableTop"
  45. :key="i"
  46. :prop="item.prop"
  47. :label="item.label"
  48. :width="item.width"
  49. align="center"
  50. show-overflow-tooltip
  51. >
  52. <template slot="scope" v-if="item.label !== '重量'">
  53. <span>{{ item.label }}</span>
  54. </template>
  55. <template slot="scope" v-if="item.label !== '车序号'">
  56. <span>{{ item.label }}</span>
  57. </template>
  58. <template slot="scope" v-if="item.label !== '收货地址'">
  59. <span>{{ item.label }}</span>
  60. </template>
  61. <template slot="scope" v-if="item.label !== '运输单价'">
  62. <span>{{ item.label }}</span>
  63. </template>
  64. <template slot="scope" v-if="item.label !== '截止日期'">
  65. <span>{{ item.label }}</span>
  66. </template>
  67. <template slot="scope" v-if="item.label !== '收货姓名'">
  68. <span>{{ item.label }}</span>
  69. </template>
  70. <template slot="scope" v-if="item.label !== '收货方电话'">
  71. <span>{{ item.label }}</span>
  72. </template>
  73. <!-- 插入输入框 -->
  74. <template slot-scope="scope">
  75. <template v-if="item.slot">
  76. <!-- 物资件数 -->
  77. <template v-if="item.prop == 'orderPlanWeight'">
  78. <el-input
  79. class="textinput"
  80. placeholder="(必填)"
  81. v-model.number="scope.row.orderPlanWeight"
  82. ></el-input>
  83. </template>
  84. <!-- 车序号 -->
  85. <template v-if="item.prop == 'cxh'">
  86. <el-input
  87. class="textinput1"
  88. placeholder="(必填)"
  89. v-model.number="scope.row.cxh"
  90. @change="updateArragneCxh(scope.row.cxh)"
  91. ></el-input>
  92. </template>
  93. <!-- 收货地址 -->
  94. <template v-if="item.prop == 'saleShipperAddressName'" >
  95. <el-input
  96. style="width: 200px"
  97. v-model="scope.row.saleShipperAddressName"
  98. disabled
  99. >
  100. </el-input>
  101. <el-button
  102. type="primary"
  103. placeholder="()"
  104. @click="select(scope.$index,1)"
  105. >浏览</el-button
  106. >
  107. </template>
  108. <!-- 运输单价id -->
  109. <template v-if="item.prop == 'priceValue'" >
  110. <el-input
  111. style="width: 200px"
  112. v-model="scope.row.priceValue"
  113. disabled
  114. >
  115. </el-input>
  116. <el-button
  117. type="primary"
  118. placeholder="()"
  119. @click="select(scope.$index,2)"
  120. >浏览</el-button
  121. >
  122. </template>
  123. <!-- 截止日期 -->
  124. <template v-if="item.prop == 'saleDateOfReceipt'">
  125. <el-date-picker
  126. class="textinput3"
  127. type="date"
  128. v-model.number="scope.row.saleDateOfReceipt"
  129. ></el-date-picker>
  130. </template>
  131. <!-- 收货客户 -->
  132. <template v-if="item.prop == 'saleOrderConsignee'">
  133. <el-input
  134. class="textinput4"
  135. placeholder="(非必填)"
  136. v-model.number="scope.row.saleOrderConsignee"
  137. ></el-input>
  138. </template>
  139. <!-- 收货客户电话号码 -->
  140. <template v-if="item.prop == 'saleOrderConsigneeTel'">
  141. <el-input
  142. class="textinput5"
  143. placeholder="(非必填)"
  144. v-model.number="scope.row.saleOrderConsigneeTel"
  145. ></el-input>
  146. </template>
  147. <!-- 排车数 -->
  148. <template v-if="item.prop == 'arragneCount'">
  149. <el-input
  150. class="textinput6"
  151. v-model.number="scope.row.arragneCount"
  152. ></el-input>
  153. </template>
  154. </template>
  155. <template v-else>
  156. <span>{{ scope.row[item.prop] }}</span>
  157. </template>
  158. </template>
  159. </el-table-column>
  160. <!-- 操作列 -->
  161. <el-table-column fixed="right" label="操作" width="200">
  162. <template slot-scope="scope">
  163. <el-button
  164. @click="copyRow(scope.$index,scope.row)"
  165. type="text"
  166. size="big"
  167. >
  168. 复制
  169. </el-button>
  170. <el-input
  171. style="width: 50px;"
  172. v-model.number="scope.row.arragneCount"
  173. ></el-input>
  174. <el-button
  175. @click="deleteRow(scope.$index,scope.row)"
  176. type="text"
  177. icon="el-icon-close"
  178. size="big"
  179. ></el-button>
  180. </template>
  181. </el-table-column>
  182. </el-table>
  183. </div>
  184. <!-- 运输单价(地址对应)的模态框 -->
  185. <el-drawer
  186. :visible.sync="addressDrawer"
  187. :destroy-on-close="false"
  188. direction="rtl"
  189. size="40%"
  190. :wrapperClosable="false"
  191. modal
  192. close-on-press-escape
  193. >
  194. <el-input placeholder="请输入内容" v-model="addressText" style="margin-top: 10px; margin-left: 20px; width: 250px" clearable>
  195. </el-input>
  196. <el-button type="primary" class="btn" @click="selectAddressClick" style="margin-left: 5px">
  197. <i class="el-icon-search"></i>查询
  198. </el-button>
  199. <!-- 已选中 省市(区)县 -->
  200. <el-form :inline="true" style="margin-top: 0.5rem;">
  201. <el-form-item>
  202. <label class="el-form-item__label" style="width: auto;">已选中省市县(区):</label>
  203. </el-form-item>
  204. <el-form-item>
  205. <el-input class="el-form-item__content" v-model="address" placeholder="请输入内容" :disabled="true"></el-input>
  206. </el-form-item>
  207. </el-form>
  208. <!-- 具体收货地址 -->
  209. <div v-if="address != null">
  210. <el-form :inline="true" style="margin-top: 0.5rem;" >
  211. <el-form-item label="具体收货地址:">
  212. <el-autocomplete
  213. class="inline-input"
  214. v-model="place"
  215. :fetch-suggestions="querySearch1"
  216. placeholder="请输入具体收货地址"
  217. :trigger-on-focus="false"
  218. @select="handleSelect1"
  219. >
  220. </el-autocomplete>
  221. </el-form-item>
  222. <el-button type="primary" @click="addAddressClick">确定</el-button>
  223. </el-form>
  224. </div>
  225. <div class="tablecls">
  226. <!-- 查询所有的运输单价 -->
  227. <dilTable
  228. v-bind.sync="Address"
  229. @radio-change="currentRadioChange2"
  230. ></dilTable>
  231. </div>
  232. </el-drawer>
  233. <div class="button-box">
  234. <el-button @click="cancel">取消</el-button>
  235. <el-button type="primary" @click="makeSure">确定</el-button>
  236. </div>
  237. </div>
  238. </template>
  239. <script>
  240. import PageTitle from "@/components/Page/Title";
  241. import { sjTime,isNumber } from "@/utils/sharedJsFile";
  242. export default {
  243. components: { PageTitle },
  244. data() {
  245. return {
  246. //已选中 省市县(区)
  247. address:null,
  248. //具体收货地址
  249. place:null,
  250. //收货地址id
  251. addressId:null,
  252. //当前是哪一个浏览按钮触发
  253. browseButton:null,
  254. textInput: "",
  255. input: "",
  256. //排车数默认
  257. arragneCount: 1,
  258. //初始化车序号
  259. arragneCxh: 1,
  260. //是否自提
  261. saleOrderIsselfMention:'',
  262. //单价已选数量
  263. choosePriceCount: 0,
  264. option: {
  265. // 表格请求数据的地址
  266. requestUrl: "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId,
  267. // 控制显示多选列
  268. selectionType: "select",
  269. },
  270. //是否打开收货地址的模态框
  271. addressDrawer:false,
  272. //地址的框计算输入的值
  273. addressText:null,
  274. //收货地址的表格
  275. Address: {
  276. requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
  277. selectionType: "radio",
  278. },
  279. //原运输单价的表格
  280. // Price: {
  281. // requestUrl: "/api/v1/ams/getAmsContractTransportPrice1?apiId=109&deleted=0",
  282. // selectionType: "radio",
  283. // },
  284. table: false,
  285. selectionList: [],
  286. selectionList1: [],
  287. drawer: false,
  288. direction: "rtl",
  289. form1: {},
  290. value: false,
  291. frist: {
  292. requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
  293. selectionType: "radio",
  294. mapList: [],
  295. },
  296. options: [
  297. {
  298. values: "yes",
  299. label: "是",
  300. },
  301. {
  302. values: "no",
  303. label: "否",
  304. },
  305. ],
  306. values: "yes",
  307. tableTop: [
  308. {
  309. prop: "cxh",
  310. label: "车序号",
  311. width: "80",
  312. slot: true,
  313. },
  314. {
  315. prop: "materialName",
  316. label: "物资名称",
  317. width: "140",
  318. },
  319. {
  320. prop: "Specification",
  321. label: "规格型号",
  322. width: "140",
  323. },
  324. {
  325. prop: "orderPlanWeight",
  326. label: "重量",
  327. width: "80",
  328. slot: true,
  329. },
  330. {
  331. prop: "saleDateOfReceipt",
  332. label: "截止日期",
  333. width: "230",
  334. slot: true,
  335. },
  336. {
  337. prop: "saleShipperAddressName",
  338. label: "收货地址",
  339. width: "300",
  340. slot: true,
  341. },
  342. {
  343. prop: "priceValue",
  344. label: "运输单价",
  345. width: "300",
  346. slot: true,
  347. },
  348. {
  349. prop: "saleOrderConsignee",
  350. label: "收货客户",
  351. width: "150",
  352. slot: true,
  353. },
  354. {
  355. prop: "saleOrderConsigneeTel",
  356. label: "收货客户电话号码",
  357. width: "150",
  358. slot: true,
  359. },
  360. {
  361. prop: "arragneCount",
  362. label: "复制数",
  363. width: "80",
  364. slot: true,
  365. },
  366. ],
  367. row: {},
  368. //缓存当前选中的运输单价
  369. priceMap:{},
  370. };
  371. },
  372. // mounted() {
  373. // this.dianji();
  374. // },
  375. watch: {
  376. value() {
  377. if (this.value) {
  378. this.tableTop[3]={
  379. prop: "orderPlanWeight",
  380. label: "件数",
  381. slot: true,
  382. };
  383. } else {
  384. this.tableTop[3]={
  385. prop: "orderPlanWeight",
  386. label: "重量",
  387. slot: true,
  388. };
  389. }
  390. },
  391. },
  392. methods: {
  393. //点击浏览事件
  394. ondrawer(row,index) {
  395. this.row = row;
  396. this.row.index = index;
  397. this.drawer = true;
  398. },
  399. //收货地址弹出层
  400. handleSelect1(item) {
  401. console.log("获取所有下拉值!");
  402. },
  403. //收货地址模态窗口的框计算
  404. selectAddressClick(){
  405. if(this.addressText){
  406. this.Address.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con="+this.addressText;
  407. }else{
  408. this.Address.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
  409. }
  410. },
  411. //以下是收货地址边输边查搜索
  412. querySearch1(queryString, cb){
  413. this.axios
  414. .post("/api/v1/ams/getRealAddressByLike?addressId="+this.addressId + "&index=" + queryString)
  415. .then((res) => {
  416. if (res.data.code == "200") {
  417. // console.log(res.data.data);
  418. var restaurants = res.data.data;
  419. // console.log(restaurants, "restaurants");
  420. var results = queryString
  421. ? restaurants.filter(this.createFilter1(queryString))
  422. : restaurants;
  423. // 调用 callback 返回建议列表的数据
  424. cb(results);
  425. }
  426. });
  427. },
  428. createFilter1(queryString) {
  429. return (restaurants) => {
  430. return (
  431. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  432. -1
  433. );
  434. };
  435. },
  436. //以上是收货地址边输边查搜索
  437. //修改输入框中的车序号,自动获取车序号最大值
  438. updateArragneCxh(cxh){
  439. if(this.arragneCxh<cxh){
  440. this.arragneCxh = ++cxh;
  441. }
  442. },
  443. //复制多条的方法
  444. copyRow(index,row){
  445. let arr = [];
  446. for(var i = 0 ;i<this.selectionList.length; i++){
  447. if(i == index){
  448. arr.push(this.selectionList[i]);
  449. //车序号自增
  450. var cxhStart = row.cxh;
  451. for(var j = 0;j<this.selectionList[i].arragneCount; j++){
  452. arr.push({
  453. Specification:row.Specification,
  454. arragneCount:this.arragneCount,
  455. cxh:++cxhStart,
  456. materialName:row.materialName,
  457. orderPlanWeight:row.orderPlanWeight,
  458. saleDateOfReceipt:row.saleDateOfReceipt,
  459. saleMaterialId:row.saleMaterialId,
  460. saleOrderConsignee:row.saleOrderConsignee,
  461. saleOrderConsigneeTel:row.saleOrderConsigneeTel,
  462. priceValue:row.priceValue,
  463. priceId:row.priceId,
  464. saleShipperAddressId:row.saleShipperAddressId,
  465. place:row.place,
  466. saleShipperAddressName:row.saleShipperAddressName,
  467. })
  468. }
  469. //确定车序号最大值并赋值给初始化车序号
  470. if(this.arragneCxh<cxhStart){
  471. this.arragneCxh = ++cxhStart;
  472. }
  473. }else{
  474. arr.push(this.selectionList[i]);
  475. }
  476. }
  477. this.selectionList = [];
  478. this.selectionList = arr;
  479. },
  480. //点击删除按钮删除当前点击的对象
  481. deleteRow(index,row){
  482. //统计与当前最大车序号相等的车序号
  483. var equalArragneCxh = 0;
  484. //若为最后一个删除对象,初始化this.arragneCxh的值
  485. if(this.selectionList.length==1){
  486. this.arragneCxh = 1;
  487. }else{
  488. for(var i = 0 ;i<this.selectionList.length; i++){
  489. if(this.selectionList[i].cxh==this.arragneCxh){
  490. equalArragneCxh++;
  491. }
  492. }
  493. //判断是否要减小最大车序号数
  494. if(equalArragneCxh==0){
  495. if((this.arragneCxh-1)==row.cxh){
  496. this.arragneCxh=row.cxh;
  497. }
  498. }
  499. }
  500. //删除当前点击的对象
  501. this.selectionList.splice(index,1);
  502. },
  503. //监听模态框点击事件
  504. currentRadioChange1(radioList) {
  505. this.selectionList[this.row.index].saleShipperAddressId = radioList.addressId;
  506. this.selectionList[this.row.index].saleShipperAddressName = radioList.address;
  507. },
  508. //运输单价模态窗口的点击事件
  509. addAddressClick(){
  510. //priceMap
  511. // this.selectionList[this.addressIndex].priceValue = this.priceMap.priceValue
  512. // this.selectionList[this.addressIndex].priceId = this.priceMap.priceId
  513. //获取运输单价和运输单价ID
  514. let map = {
  515. place: this.place,
  516. addressId: this.addressId
  517. }
  518. this.axios.post('/api/v1/ams/getPriceMap',map)
  519. .then((res)=>{
  520. if(res.data.data.priceId==-1){
  521. if(this.browseButton==1){
  522. this.selectionList[this.addressIndex].saleShipperAddressName = this.address+this.place;
  523. this.selectionList[this.addressIndex].saleShipperAddressId = this.addressId;
  524. this.selectionList[this.addressIndex].place = this.place;
  525. }
  526. this.selectionList[this.addressIndex].priceValue = '该区域尚未录入任何单价!';
  527. this.selectionList[this.addressIndex].priceId = 0;
  528. this.addAddressClickNext();
  529. }else{
  530. //赋值运输单价和运输单价ID
  531. if(this.browseButton==1){
  532. this.selectionList[this.addressIndex].saleShipperAddressName = this.address+this.place;
  533. this.selectionList[this.addressIndex].saleShipperAddressId = this.addressId;
  534. this.selectionList[this.addressIndex].place = this.place;
  535. }
  536. this.selectionList[this.addressIndex].priceValue = res.data.data.priceValue;//this.priceMap.priceValue
  537. this.selectionList[this.addressIndex].priceId = res.data.data.priceId;//this.priceMap.priceId
  538. this.addAddressClickNext();
  539. }
  540. });
  541. },
  542. //运输单价模态窗口的点击事件接续执行方法
  543. addAddressClickNext(){
  544. this.addressDrawer = false;
  545. let arr = this.selectionList;
  546. this.selectionList = [];
  547. //统计被选中的运输单价数量
  548. var count = 0;
  549. arr.forEach((e)=>{
  550. if(e.priceValue){
  551. count++;
  552. }
  553. this.selectionList.push({
  554. //销售订单与物资表主键
  555. Specification:e.Specification,
  556. arragneCount:e.arragneCount,
  557. cxh:e.cxh,
  558. materialName:e.materialName,
  559. orderPlanWeight:e.orderPlanWeight,
  560. saleDateOfReceipt:e.saleDateOfReceipt,
  561. saleMaterialId:e.saleMaterialId,
  562. saleOrderConsignee:e.saleOrderConsignee,
  563. saleOrderConsigneeTel:e.saleOrderConsigneeTel,
  564. priceValue:e.priceValue,
  565. priceId:e.priceId,
  566. saleShipperAddressId:e.saleShipperAddressId,
  567. place:e.place,
  568. saleShipperAddressName:e.saleShipperAddressName,
  569. })
  570. })
  571. //赋值单价已选数量
  572. this.choosePriceCount = count;
  573. //缩小运价省市县的范围
  574. if(this.browseButton==1){
  575. this.Address.requestUrl = "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con="+this.address;
  576. }
  577. },
  578. //收货地址点击浏览的事件---------------------修改点
  579. select(index,type){
  580. this.browseButton = type;
  581. this.addressDrawer = true;
  582. this.addressIndex = index ;
  583. },
  584. //收货地址模态框单选选中的事件----------------------------修改点
  585. currentRadioChange2(val){
  586. //若具体地址有值,清空值
  587. if(this.place!=null){
  588. this.place=null;
  589. }
  590. this.address = val.address;
  591. this.addressId = val.addressId;
  592. // this.priceMap = {};
  593. // this.priceMap = val;
  594. },
  595. // 框计算
  596. onclick() {
  597. this.option.requestUrl =
  598. "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId;
  599. //"/api/v1/uc/queryMaterialByLike?apiId=244&index=" + this.input;
  600. },
  601. open() {
  602. if (this.selectionList1.length != 0) {
  603. this.$confirm("取消会将已选择的数据清空, 是否继续?", "提示", {
  604. confirmButtonText: "确定",
  605. cancelButtonText: "取消",
  606. type: "warning",
  607. })
  608. .then(() => {
  609. this.selectionList1 = [];
  610. this.table = false;
  611. })
  612. .catch(() => {});
  613. } else {
  614. this.table = false;
  615. }
  616. },
  617. // 进行排车
  618. arragne() {
  619. this.selectionList1.forEach((e) => {
  620. var addmap = {
  621. // materialCode: e.materialCode,
  622. cxh: this.arragneCxh,
  623. materialName: e.materialName,
  624. Specification: e.specificationModel,
  625. orderPlanWeight: null,
  626. saleShipperAddressId: null,
  627. saleShipperAddressName:null,
  628. saleDateOfReceipt: null,
  629. saleOrderConsignee: null,
  630. saleOrderConsigneeTel: null,
  631. saleMaterialId: e.saleMaterialId,
  632. priceValue:e.priceValue,
  633. priceId:e.priceId,
  634. // materialTheoreticalWeight: e.materialTheoreticalWeight,
  635. arragneCount : this.arragneCount,
  636. };
  637. this.selectionList.push(addmap);
  638. });
  639. //获取是否自提判断
  640. this.saleOrderIsselfMention = this.selectionList1[0].saleOrderIsselfMention;
  641. this.selectionList1 = [];
  642. this.table = false;
  643. //重置销售订单信息
  644. this.option.requestUrl = "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" + this.$route.params.saleOrderId + "&i=" + new Date();
  645. },
  646. // 返回选中的物资信息
  647. selectionChange(selection) {
  648. this.selectionList1 = [];
  649. this.selectionList1 = selection;
  650. },
  651. // 确定
  652. makeSure() {
  653. //初始化maplist
  654. var mapList = [];
  655. this.selectionList.forEach((item) => {
  656. //初始化mapItem
  657. var mapItem={
  658. //销售订单id
  659. saleOrderId : 0,
  660. //车序号
  661. truckNo : "",
  662. //省市县id
  663. shippingAddressId : 0,
  664. //具体地址
  665. place :null,
  666. //截止日期
  667. dateOfReceipt :null,
  668. //收货方姓名
  669. orderConsignee :"",
  670. //收货方电话
  671. orderConsigneeTel :"",
  672. //车序号物资ID
  673. saleMaterialId : 0,
  674. //物资数量
  675. materialNumber : 0,
  676. //运输单价ID
  677. priceId: 0,
  678. };
  679. mapItem.saleOrderId=this.$route.params.saleOrderId;
  680. mapItem.truckNo=item.cxh;
  681. mapItem.shippingAddressId=item.saleShipperAddressId;
  682. mapItem.place=item.place;
  683. mapItem.dateOfReceipt=sjTime(item.saleDateOfReceipt);
  684. mapItem.orderConsignee=item.saleOrderConsignee;
  685. mapItem.orderConsigneeTel=item.saleOrderConsigneeTel;
  686. mapItem.saleMaterialId=item.saleMaterialId;
  687. mapItem.materialNumber=item.orderPlanWeight;
  688. mapItem.priceId=item.priceId;
  689. mapList.push(mapItem);
  690. });
  691. //校验是否自提,是自提,则运输单价必选,非自提,运输单价为空
  692. if(this.saleOrderIsselfMention=='是'){
  693. mapList.forEach((e)=>{
  694. e.priceId = null;
  695. })
  696. //发送请求
  697. this.axios.post("/api/v1/ams/addTruckNo", mapList).then((res) => {
  698. if (res.data.code == "200") {
  699. this.$router.go(-1);
  700. }
  701. this.$message({
  702. type: "success",
  703. message: "新增车序号成功!",
  704. });
  705. });
  706. }else{
  707. //判断是否全部完成运输单价的选择
  708. if(this.choosePriceCount==this.selectionList.length){
  709. //发送请求
  710. this.axios.post("/api/v1/ams/addTruckNo", mapList).then((res) => {
  711. if (res.data.code == "200") {
  712. this.$router.go(-1);
  713. }
  714. this.$message({
  715. type: "success",
  716. message: "新增车序号成功!",
  717. });
  718. });
  719. }else{
  720. this.$message.warning('还有运输单价未被选定!')
  721. }
  722. }
  723. },
  724. // 取消
  725. cancel() {
  726. this.$router.go(-1);
  727. },
  728. //关闭事件
  729. handleClose(done) {
  730. this.$confirm("确认关闭?")
  731. .then((_) => {
  732. done();
  733. })
  734. .catch((_) => {});
  735. },
  736. CloseClick() {},
  737. },
  738. };
  739. </script>
  740. <style lang='scss' scoped>
  741. .addSalePlan{
  742. width: 100%;
  743. }
  744. .switch{
  745. margin-left: 60rem;
  746. }
  747. .form-box,
  748. .from {
  749. display: flex;
  750. align-items: center;
  751. justify-content: center;
  752. margin-top: 5px;
  753. margin-bottom: 20px;
  754. }
  755. .button-box{
  756. display: flex;
  757. text-align: center;
  758. align-items: center;
  759. justify-content: center;
  760. margin-top: 0.3125rem;
  761. margin-bottom: 1.25rem;
  762. }
  763. .select {
  764. margin-left: -10rem;
  765. }
  766. .demo-form-inline {
  767. margin-left: 2rem;
  768. }
  769. .table_form {
  770. margin-left: -16rem;
  771. }
  772. .textinput {
  773. width: 70px;
  774. }
  775. .textinput1 {
  776. width: 70px;
  777. text-align: center;
  778. size: small;
  779. }
  780. .textinput2 {
  781. width: 50px;
  782. margin-right: 30px;
  783. }
  784. .textinput3 {
  785. width: 240px;
  786. }
  787. .textinput4 {
  788. width: 120px;
  789. }
  790. .textinput5 {
  791. width: 120px;
  792. }
  793. .textinput6{
  794. width: 70px;
  795. }
  796. </style>