updateSaleOrderSteel.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290
  1. <template>
  2. <div class="updateSteelDetails">
  3. <!-- 车牌号查询框 -->
  4. <div class="top">
  5. <el-input
  6. v-model="inputCapacity"
  7. placeholder="请输入车牌号"
  8. clearable
  9. ></el-input>
  10. <el-button type="primary" @click="onclick">查询</el-button>
  11. <el-button type="primary" @click="back" icon="el-icon-d-arrow-left"
  12. >返回</el-button
  13. >
  14. </div>
  15. <!-- //物资模态框多选 -->
  16. <div class="edrwer">
  17. <!-- 物资选择模态框 -->
  18. <el-drawer
  19. title="选择物资信息"
  20. :visible.sync="table1"
  21. direction="rtl"
  22. size="90%"
  23. :show-close="true"
  24. >
  25. <el-form :inline="true" style="margin-top: 0.5rem;">
  26. <el-form-item>
  27. <label class="el-form-item__label" style="width: auto;"
  28. >物资名称/型号</label
  29. >
  30. </el-form-item>
  31. <el-form-item>
  32. <el-input
  33. placeholder="请输入物资名称或型号"
  34. v-model="materialNameText"
  35. clearable
  36. ></el-input>
  37. </el-form-item>
  38. <el-form-item>
  39. <label class="el-form-item__label" style="width: auto;">规格</label>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-input
  43. placeholder="请输入内容"
  44. v-model="materialSpecificationText"
  45. clearable
  46. ><template slot="prepend">Φ</template></el-input
  47. >
  48. </el-form-item>
  49. <el-button
  50. type="primary"
  51. class="btn"
  52. @click="onclick"
  53. style="margin-left: 4px;"
  54. ><i class="el-icon-search"></i>查询</el-button
  55. >
  56. <el-button type="primary" @click="makeSureMaterial"
  57. ><i class="el-icon-check"></i>确定</el-button
  58. >
  59. </el-form>
  60. <div class="tablecls">
  61. <!-- 查询所有的物资 -->
  62. <dilTable
  63. v-bind.sync="option"
  64. @selection-change="selectionChange"
  65. @rowDbClick="rowDbClick"
  66. >
  67. </dilTable>
  68. </div>
  69. </el-drawer>
  70. </div>
  71. <!-- //物资模态框单选 -->
  72. <div class="edrwer">
  73. <!-- 物资选择模态框 -->
  74. <el-drawer
  75. title="选择物资信息"
  76. :visible.sync="currentTable"
  77. direction="rtl"
  78. size="90%"
  79. :show-close="true"
  80. >
  81. <el-form :inline="true" style="margin-top: 0.5rem;">
  82. <el-form-item>
  83. <label class="el-form-item__label" style="width: auto;"
  84. >物资名称/型号</label
  85. >
  86. </el-form-item>
  87. <el-form-item>
  88. <el-input
  89. placeholder="请输入物资名称或型号"
  90. v-model="materialNameText"
  91. clearable
  92. ></el-input>
  93. </el-form-item>
  94. <el-form-item>
  95. <label class="el-form-item__label" style="width: auto;">规格</label>
  96. </el-form-item>
  97. <el-form-item>
  98. <el-input
  99. placeholder="请输入内容"
  100. v-model="materialSpecificationText"
  101. clearable
  102. ><template slot="prepend">Φ</template></el-input
  103. >
  104. </el-form-item>
  105. <el-button
  106. type="primary"
  107. class="btn"
  108. @click="onclick1"
  109. style="margin-left: 4px;"
  110. ><i class="el-icon-search"></i>查询</el-button
  111. >
  112. <el-button type="primary" @click="makeSureChange"
  113. ><i class="el-icon-check"></i>确定</el-button
  114. >
  115. </el-form>
  116. <div class="tablecls">
  117. <!-- 查询所有的物资 -->
  118. <dilTable
  119. v-bind.sync="option1"
  120. @radio-change="currentRadioChange"
  121. @rowDbClick="rowDbClick1"
  122. >
  123. </dilTable>
  124. </div>
  125. </el-drawer>
  126. </div>
  127. <div class="table">
  128. <el-table
  129. :data="tableData"
  130. style="width: 100%"
  131. :span-method="objectSpanMethod"
  132. border
  133. key="orderTable"
  134. >
  135. <el-table-column
  136. width="50"
  137. label="序号"
  138. align="center"
  139. fixed="left"
  140. :resizable="false"
  141. >
  142. <template slot-scope="scope">{{ scope.row.group + 1 }}</template>
  143. </el-table-column>
  144. <el-table-column property="capacityNumber" label="车牌号" width="120">
  145. </el-table-column>
  146. <el-table-column property="consigneeCompanyName" label="收货单位">
  147. </el-table-column>
  148. <el-table-column property="completeAddress" label="收货地址">
  149. </el-table-column>
  150. <el-table-column property="carrierName" label="承运商">
  151. </el-table-column>
  152. <el-table-column property="materialName" label="物资名称">
  153. </el-table-column>
  154. <el-table-column property="materialSpecification" label="规格">
  155. </el-table-column>
  156. <el-table-column property="orderPlanWeight" label="物资件数">
  157. </el-table-column>
  158. <el-table-column property="materialModel" label="型号">
  159. </el-table-column>
  160. <el-table-column fixed="right" label="操作" width="200">
  161. <template slot-scope="scope">
  162. <el-button
  163. type="text"
  164. size="mini"
  165. @click="updateMaterial(scope)"
  166. v-if="deleted == 1"
  167. >
  168. 物资变更
  169. </el-button>
  170. <el-button
  171. type="text"
  172. size="mini"
  173. @click="updateCapacity(scope)"
  174. v-if="deleted == 0"
  175. >
  176. 车辆变更
  177. </el-button>
  178. <el-button
  179. type="text"
  180. size="mini"
  181. @click="closeFlu(scope)"
  182. v-if="deleted == 0 && scope.row.materialStatus == null"
  183. >
  184. 关闭分录
  185. </el-button>
  186. <el-button
  187. type="text"
  188. size="mini"
  189. @click="updateAddress(scope)"
  190. v-if="deleted == 0"
  191. >
  192. 收货地址变更
  193. </el-button>
  194. </template>
  195. </el-table-column>
  196. </el-table>
  197. </div>
  198. <div class="dialog">
  199. <el-dialog
  200. :title="title"
  201. :visible.sync="dialogTableVisible"
  202. :center="true"
  203. width="1100px"
  204. >
  205. <div class="errorMaterial">
  206. <el-button @click="openDrawer" type="primary">新增拼数</el-button>
  207. </div>
  208. <div class="">
  209. <el-table
  210. :data="materialList"
  211. border
  212. :span-method="objectSpanMethod1"
  213. highlight-current-row
  214. key="materialTable"
  215. >
  216. <el-table-column
  217. v-for="(item, i) in materialTableTop"
  218. :key="i"
  219. :prop="item.prop"
  220. :label="item.label"
  221. :width="item.width"
  222. align="center"
  223. show-overflow-tooltip
  224. >
  225. <!-- 插入输入框 -->
  226. <template slot-scope="scope">
  227. <template v-if="item.slot">
  228. <!-- 物资名称 -->
  229. <template v-if="item.prop == 'materialName'">
  230. <el-input
  231. style="width: 200px"
  232. v-model="scope.row.materialName"
  233. disabled
  234. >
  235. </el-input>
  236. <el-button
  237. type="primary"
  238. @click="changeMaterial(scope.$index)"
  239. v-if="scope.row.netWeight == null"
  240. >更改</el-button
  241. >
  242. </template>
  243. <!-- 物资件数 -->
  244. <template v-if="item.prop == 'orderPlanWeight'">
  245. <el-input
  246. class="textinput111"
  247. v-model.number="scope.row.orderPlanWeight"
  248. placeholder="(必填)"
  249. :disabled="scope.row.netWeight != null"
  250. ></el-input>
  251. </template>
  252. <!-- 米数 -->
  253. <template v-if="item.prop == 'meterNumber'">
  254. <el-input
  255. v-if="scope.row.haveMeter == 1"
  256. :disabled="
  257. scope.row.isDisable == 1 || scope.row.netWeight != null
  258. "
  259. class="textinput111"
  260. v-model.number="scope.row.meterNumber"
  261. placeholder="(必填)"
  262. ></el-input>
  263. </template>
  264. <!-- 是否磅重销售 -->
  265. <template v-if="item.prop == 'isPound'">
  266. <el-select
  267. v-model="scope.row.isPound"
  268. placeholder="请选择"
  269. style="width:65px"
  270. :disabled="scope.row.netWeight != null"
  271. >
  272. <el-option
  273. v-for="item in options2"
  274. :key="item.values2"
  275. :label="item.label2"
  276. :value="item.values2"
  277. >
  278. </el-option>
  279. </el-select>
  280. </template>
  281. </template>
  282. <template v-else>
  283. <span>{{ scope.row[item.prop] }}</span>
  284. </template>
  285. </template>
  286. </el-table-column>
  287. <!-- 操作列 -->
  288. <el-table-column fixed="right" label="操作" width="100">
  289. <template slot-scope="scope">
  290. <el-button
  291. @click.native.prevent="
  292. deleteMaterialRow(scope.$index, materialList)
  293. "
  294. type="text"
  295. icon="el-icon-close"
  296. size="big"
  297. v-if="scope.row.netWeight == null"
  298. ></el-button>
  299. </template>
  300. </el-table-column>
  301. </el-table>
  302. </div>
  303. <div class="buttonx">
  304. <el-button type="primary" @click="makeSureUpdateMaterial"
  305. >确定</el-button
  306. >
  307. <el-button type="primary" @click="cancelUpdateMaterial"
  308. >取消</el-button
  309. >
  310. </div>
  311. </el-dialog>
  312. </div>
  313. <div class="addressDialog">
  314. <!-- 收货地址弹出框 -->
  315. <el-dialog title="收货地址" :visible.sync="addressDialog" width="90%">
  316. <div style="magin-bottom:20px,color: red;">
  317. 原收货地址:{{ oldAddress }}
  318. </div>
  319. <div class="addressItem">
  320. <el-form :inline="true">
  321. <el-form-item>
  322. <label class="el-form-item__label" style="width: auto;">省</label>
  323. <el-select
  324. v-model="province"
  325. filterable
  326. placeholder="请选择"
  327. @change="onchangeProvince"
  328. >
  329. <el-option
  330. v-for="item in provinceList"
  331. :key="item.id"
  332. :label="item.addressProvince"
  333. :value="item.id"
  334. ></el-option>
  335. </el-select>
  336. </el-form-item>
  337. <el-form-item>
  338. <label class="el-form-item__label" style="width: auto;">市</label>
  339. <el-select
  340. v-model="city"
  341. filterable
  342. placeholder="请选择"
  343. @change="onchangeCity"
  344. >
  345. <el-option
  346. v-for="item in cityList"
  347. :key="item.id"
  348. :label="item.addressDistrict"
  349. :value="item.id"
  350. ></el-option>
  351. </el-select>
  352. </el-form-item>
  353. <el-form-item>
  354. <label class="el-form-item__label" style="width: auto;"
  355. >县(区)</label
  356. >
  357. <el-select
  358. v-model="county"
  359. filterable
  360. placeholder="请选择"
  361. @change="onchangeCounty"
  362. >
  363. <el-option
  364. v-for="item in countyList"
  365. :key="item.id"
  366. :label="item.addressTown"
  367. :value="item.id"
  368. ></el-option>
  369. </el-select>
  370. </el-form-item>
  371. <el-form-item>
  372. <label class="el-form-item__label" style="width: auto;"
  373. >具体收货地址</label
  374. >
  375. <el-autocomplete
  376. class="inline-input"
  377. v-model="place"
  378. :fetch-suggestions="querySearch1"
  379. placeholder="请输入具体收货地址"
  380. :trigger-on-focus="false"
  381. @select="handleSelect1"
  382. >
  383. </el-autocomplete>
  384. </el-form-item>
  385. </el-form>
  386. </div>
  387. <div slot="footer" class="button-box">
  388. <el-button @click="addressDialog = false">取 消</el-button>
  389. <el-button type="primary" @click="addAddressClick">确定</el-button>
  390. </div>
  391. </el-dialog>
  392. </div>
  393. <!-- 修改运力弹窗 -->
  394. <div class="updateCapcityDialog">
  395. <el-dialog title="修改车牌号" :visible.sync="capacityDialog" width="90%">
  396. <div style="magin-bottom:20px,color: red;">
  397. 原车牌号:{{ oldCapacityNum }}
  398. </div>
  399. <div class="inputItem">
  400. <el-input v-model="inputCapacity1" style="width:200px"></el-input>
  401. <el-button type="primary" @click="handleCapacity"
  402. ><i class="el-icon-search"></i
  403. ></el-button>
  404. </div>
  405. <div class="capacityItem">
  406. <dilTable
  407. v-bind.sync="capacityOptions"
  408. @radio-change="radioChangeCapcity"
  409. ></dilTable>
  410. </div>
  411. <div slot="footer" class="button-box">
  412. <el-button @click="capacityDialog = false">取 消</el-button>
  413. <el-button type="primary" @click="updateCapacitySure">确定</el-button>
  414. </div>
  415. </el-dialog>
  416. </div>
  417. </div>
  418. </template>
  419. <script>
  420. export default {
  421. data() {
  422. return {
  423. inputCapacity1: null,
  424. newCapacityId: null,
  425. newCapacityNum: null,
  426. oldCapacityNum: null,
  427. capacityDialog: false,
  428. addressDialog: false,
  429. currentTable: false,
  430. title: "",
  431. capacityNumber: null,
  432. oldAddress: null,
  433. //是否磅重销售
  434. options2: [
  435. {
  436. values2: 0,
  437. label2: "是"
  438. },
  439. {
  440. values2: 1,
  441. label2: "否"
  442. }
  443. ],
  444. capacityOptions: {
  445. requestUrl: "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248",
  446. // 控制显示单选列
  447. selectionType: "radio"
  448. },
  449. table1: false,
  450. isDelete: false,
  451. dialogTableVisible: false,
  452. inputCapacity: null,
  453. tableData: [],
  454. tableData1: [],
  455. materialList1: [],
  456. materialList: [],
  457. //存放每一行记录的合并数
  458. spanArr: [],
  459. spanArr1: [],
  460. status: null,
  461. //物资表格多选
  462. option: {
  463. // 表格请求数据的地址
  464. requestUrl: "",
  465. // 控制显示多选列
  466. selectionType: "select"
  467. },
  468. //物资表格单选
  469. option1: {
  470. // 表格请求数据的地址
  471. requestUrl: "",
  472. // 控制显示单选列
  473. selectionType: "radio"
  474. },
  475. materialSpecificationText: null,
  476. materialNameText: null,
  477. spanArr: [],
  478. materialTableTop: [
  479. {
  480. prop: "capacityNumber",
  481. label: "车牌号",
  482. width: "100px"
  483. },
  484. {
  485. prop: "materialName",
  486. label: "物资名称",
  487. width: "400px",
  488. slot: true
  489. },
  490. {
  491. prop: "meterNumber",
  492. label: "米数",
  493. width: "100px",
  494. slot: true
  495. },
  496. {
  497. prop: "Specification",
  498. label: "规格型号",
  499. width: "140px"
  500. },
  501. {
  502. prop: "orderPlanWeight",
  503. label: "件数",
  504. width: "100px",
  505. slot: true
  506. },
  507. {
  508. prop: "isPound",
  509. label: "是否磅重销售",
  510. width: "100px",
  511. slot: true
  512. }
  513. ],
  514. orderId: null,
  515. selectedMaterialCode: null,
  516. selectedMaterialModel: null,
  517. selectedMaterialSpecification: null,
  518. selectedMaterialName: null,
  519. selectedMaterialId: null,
  520. //所有省
  521. provinceList: [],
  522. //选中的省
  523. province: "",
  524. //所有市
  525. cityList: [],
  526. //选中的市
  527. city: "",
  528. //所有的县(区)
  529. countyList: [],
  530. //选中的县
  531. county: "",
  532. //判断是内层还是外层点击的收货地址浏览
  533. inOrOut: 0,
  534. //地址输入框的值
  535. addresText: "",
  536. //已选中省市县
  537. address: null,
  538. //具体地址
  539. place: null,
  540. //暂存具体地址
  541. place1: null,
  542. //省市县Id
  543. addressId: null,
  544. orderSaleMap: {},
  545. isNewCar: null,
  546. deleted: 0,
  547. lineSequence: null
  548. };
  549. },
  550. watch: {
  551. dialogTableVisible() {
  552. this.getOrderList();
  553. },
  554. capacityDialog() {
  555. this.getOrderList();
  556. this.inputCapacity1 = null;
  557. this.capacityOptions.requestUrl =
  558. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&i=" + new Date();
  559. }
  560. },
  561. created() {
  562. this.deleted = this.$route.params.deleted;
  563. },
  564. mounted() {
  565. console.log(this.$route);
  566. console.log(this.$route.params.deleted);
  567. this.getOrderList();
  568. this.getAllProvince();
  569. },
  570. methods: {
  571. closeFlu(scope) {
  572. this.capacityNumber = scope.row.capacityNumber;
  573. this.deleteEasEntryId(scope.row);
  574. console.log(scope.row);
  575. },
  576. //车辆变更
  577. updateCapacity(scope) {
  578. this.oldCapacityNum = scope.row.capacityNumber;
  579. this.saleOrderMaterialId = scope.row.saleOrderMaterialId;
  580. this.lineSequence = scope.row.lineSequence;
  581. this.orderId = scope.row.orderId;
  582. this.$confirm("确定变更车辆吗?", "提示", {
  583. confirmButtonText: "确定",
  584. cancelButtonText: "取消",
  585. center: true,
  586. type: "info"
  587. })
  588. .then(() => {
  589. this.capacityDialog = true;
  590. })
  591. .catch(() => {
  592. this.$message.info("取消变更");
  593. });
  594. },
  595. radioChangeCapcity(row) {
  596. this.newCapacityNum = row.capacityNumber;
  597. this.newCapacityId = row.capacityId;
  598. },
  599. updateCapacitySure() {
  600. let map = {
  601. orderId: this.orderId,
  602. saleOrderMaterialId: this.saleOrderMaterialId,
  603. lineSequence: this.lineSequence,
  604. capacityId: this.newCapacityId
  605. };
  606. let title = `确定将-${this.oldCapacityNum}-替换为-${this.newCapacityNum}?`;
  607. this.$confirm(title, "提示", {
  608. confirmButtonText: "确定",
  609. cancelButtonText: "取消",
  610. type: "info",
  611. center: true
  612. }).then(() => {
  613. this.axios
  614. .post("/api/v1/ams/updateCapacityNumberInFactory", map)
  615. .then(res => {
  616. if (res.data.code == 200) {
  617. this.$message.success("变更成功");
  618. this.getOrderList();
  619. this.capacityDialog = false;
  620. } else {
  621. this.$message.success("变更失败,请联系管理员");
  622. this.capacityDialog = false;
  623. }
  624. })
  625. .catch(() => {
  626. this.$message.success("变更失败,请联系管理员");
  627. this.capacityDialog = false;
  628. });
  629. });
  630. },
  631. handleCapacity() {
  632. this.capacityOptions.requestUrl =
  633. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&index=" +
  634. this.inputCapacity1 +
  635. "&i=" +
  636. new Date();
  637. },
  638. updateAddress(scope) {
  639. this.capacityNumber = scope.row.capacityNumber;
  640. this.oldAddress = scope.row.completeAddress;
  641. this.orderSaleMap = scope.row;
  642. console.log(this.orderSaleMap);
  643. let title = `请选择对-${scope.row.capacityNumber}-进行的操作?`;
  644. let confirmText = `关闭-${scope.row.capacityNumber}-金蝶分录`;
  645. let cancelText = `不关闭-${scope.row.capacityNumber}-金蝶分录`;
  646. this.$confirm(title, "提示", {
  647. confirmButtonText: confirmText,
  648. cancelButtonText: cancelText,
  649. distinguishCancelAndClose: true,
  650. center: true,
  651. type: "info"
  652. })
  653. .then(() => {
  654. this.deleteEasEntryId(scope.row);
  655. })
  656. .catch(action => {
  657. console.log(action);
  658. if (action === "cancel") {
  659. this.noDeleteEasEntryId();
  660. }
  661. });
  662. },
  663. //删除金蝶分录
  664. deleteEasEntryId(row) {
  665. let title = `确定关闭-${this.capacityNumber}-金蝶分录?`;
  666. this.$confirm(title, {
  667. confirmButtonText: "是",
  668. cancelButtonText: "否",
  669. center: true,
  670. type: "warning"
  671. })
  672. .then(() => {
  673. let map = row;
  674. map.isCloseEas = Number(0);
  675. map.saleOrderId = this.$route.params.saleOrderId;
  676. this.axios
  677. .post("/api/v1/ams/updateCarAddress", map)
  678. .then(res => {
  679. if (res.data.code == "200") {
  680. this.$message.success("关闭成功");
  681. this.getOrderList();
  682. } else {
  683. this.$message.error("关闭失败");
  684. this.getOrderList();
  685. }
  686. })
  687. .catch(() => {
  688. this.$message.error("关闭失败");
  689. this.getOrderList();
  690. });
  691. })
  692. .catch(() => {
  693. this.$message.info("取消删除");
  694. });
  695. },
  696. //不删除金蝶分录,继续选择
  697. noDeleteEasEntryId() {
  698. let title = `请选择对-${this.capacityNumber}-进行的操作?`;
  699. let confirmText = `仅更换-${this.capacityNumber}-的收货地址`;
  700. this.$confirm(title, {
  701. confirmButtonText: confirmText,
  702. cancelButtonText: "更换地址且换车",
  703. center: true,
  704. distinguishCancelAndClose: true,
  705. type: "info"
  706. })
  707. .then(() => {
  708. this.onlyUpdateAddress();
  709. })
  710. .catch(action => {
  711. if (action === "cancel") {
  712. this.updateAddressAndCar();
  713. }
  714. });
  715. },
  716. onlyUpdateAddress() {
  717. let title = `仅更换-${this.capacityNumber}-的收货地址吗`;
  718. this.$confirm(title, {
  719. confirmButtonText: "是",
  720. cancelButtonText: "否",
  721. center: true,
  722. type: "warning"
  723. }).then(() => {
  724. this.addressDialog = true;
  725. this.isNewCar = 1;
  726. });
  727. },
  728. //收货地址弹出层
  729. handleSelect1(item) {
  730. console.log("获取所有下拉值!");
  731. },
  732. //以下是收货地址边输边查搜索
  733. querySearch1(queryString, cb) {
  734. this.axios
  735. .post(
  736. "/api/v1/ams/getRealAddressByLike?addressId=" +
  737. this.addressId +
  738. "&index=" +
  739. queryString
  740. )
  741. .then(res => {
  742. if (res.data.code == "200") {
  743. var restaurants = res.data.data;
  744. var results = queryString
  745. ? restaurants.filter(this.createFilter1(queryString))
  746. : restaurants;
  747. // 调用 callback 返回建议列表的数据
  748. cb(results);
  749. }
  750. });
  751. },
  752. createFilter1(queryString) {
  753. return restaurants => {
  754. return (
  755. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  756. -1
  757. );
  758. };
  759. },
  760. //以上是收货地址边输边查搜索
  761. //监听收货地址模态框点击事件
  762. currentRadioChange1(radioList) {
  763. this.addressId = radioList.addressId;
  764. this.address = radioList.address;
  765. },
  766. //确定收货地址事件
  767. addAddressClick() {
  768. let map = this.orderSaleMap;
  769. map.isCloseEas = Number(1);
  770. map.isNewCar = Number(this.isNewCar);
  771. map.saleOrderId = this.$route.params.saleOrderId;
  772. map.place = this.place;
  773. map.shipperAddressId = this.addressId;
  774. this.axios.post("/api/v1/ams/updateCarAddress", map).then(res => {
  775. console.log(res.data);
  776. if (res.data.code == "200") {
  777. this.$message.success("修改成功");
  778. this.getOrderList();
  779. } else {
  780. this.$message.error("修改失败");
  781. this.getOrderList();
  782. }
  783. });
  784. this.addressDialog = false;
  785. //初始化
  786. this.addressId = null;
  787. this.province = null;
  788. this.cityList = [];
  789. this.city = null;
  790. this.countyList = [];
  791. this.county = null;
  792. //暂存具体地址
  793. this.place1 = this.place;
  794. this.place = null;
  795. this.addresText = null;
  796. },
  797. updateAddressAndCar() {
  798. this.$confirm("确定修改收货地址且换车?将会解除授权!", {
  799. confirmButtonText: "确定",
  800. cancelButtonText: "取消",
  801. center: true,
  802. type: "warning"
  803. })
  804. .then(() => {
  805. this.addressDialog = true;
  806. this.isNewCar = 0;
  807. })
  808. .catch(() => {
  809. this.$message.info("取消");
  810. });
  811. },
  812. //获取所有省数据
  813. getAllProvince() {
  814. this.axios.post("/api/v1/uc/getAllProvince").then(res => {
  815. this.provinceList = res.data.data;
  816. });
  817. },
  818. //省改变
  819. onchangeProvince() {
  820. this.axios
  821. .post(
  822. "/api/v1/uc/getDistrictByProvince?addressProvince=" + this.province
  823. )
  824. .then(res => {
  825. this.cityList = res.data.data;
  826. });
  827. },
  828. //市改变
  829. onchangeCity() {
  830. this.axios
  831. .post("/api/v1/uc/getTownByDistrict?addressDistrict=" + this.city)
  832. .then(res => {
  833. this.countyList = res.data.data;
  834. });
  835. },
  836. //县(区)改变
  837. onchangeCounty() {
  838. let mapValue = {
  839. addressProvince: this.province,
  840. addressDistrict: this.city,
  841. addressTown: this.county
  842. };
  843. this.axios.post("/api/v1/uc/getPlaceByAllAddress", mapValue).then(res => {
  844. this.addressId = res.data.data[0].addressId;
  845. });
  846. },
  847. rowDbClick1(row) {
  848. this.selectedMaterialId = row.materialId;
  849. this.selectedMaterialName = row.materialName;
  850. this.selectedMaterialSpecification = row.materialSpecification;
  851. this.selectedMaterialModel = row.materialModel;
  852. this.selectedMaterialCode = row.materialCode;
  853. this.makeSureChange();
  854. },
  855. //更改行物资
  856. changeMaterial(index) {
  857. this.option1.requestUrl =
  858. "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
  859. this.currentTable = true;
  860. this.materialNameText = null;
  861. this.materialSpecificationText = null;
  862. this.isOpenDrawer = 1;
  863. this.indexChangeMaterial = index;
  864. },
  865. //单选一行物资
  866. currentRadioChange(row) {
  867. this.selectedMaterialId = row.materialId;
  868. this.selectedMaterialName = row.materialName;
  869. this.selectedMaterialSpecification = row.materialSpecification;
  870. this.selectedMaterialModel = row.materialModel;
  871. this.selectedMaterialCode = row.materialCode;
  872. },
  873. //确认物资修改
  874. makeSureChange() {
  875. if (!this.selectedMaterialId) {
  876. this.$message.warning("请先选择一个物资!");
  877. } else {
  878. if (!this.selectedMaterialSpecification) {
  879. this.selectedMaterialSpecification = "";
  880. }
  881. if (!this.selectedMaterialModel) {
  882. this.selectedMaterialModel = "";
  883. }
  884. //记录是理重还是磅重
  885. var getisPound = 1;
  886. //判断物资是否为盘螺或非定尺
  887. if (
  888. this.selectedMaterialName.includes("盘螺") ||
  889. this.selectedMaterialName.includes("乱尺") ||
  890. this.selectedMaterialName.includes("盘元") ||
  891. this.selectedMaterialName.includes("盘圆")
  892. ) {
  893. getisPound = 0;
  894. } else {
  895. getisPound = 1;
  896. }
  897. this.materialList[
  898. this.indexChangeMaterial
  899. ].materialId = this.selectedMaterialId;
  900. this.materialList[
  901. this.indexChangeMaterial
  902. ].materialName = this.selectedMaterialName;
  903. this.materialList[this.indexChangeMaterial].Specification =
  904. this.selectedMaterialSpecification + this.selectedMaterialModel;
  905. this.materialList[
  906. this.indexChangeMaterial
  907. ].materialCode = this.selectedMaterialModel;
  908. this.materialList[this.indexChangeMaterial].isPound = getisPound;
  909. //确定更改的物资有无米数
  910. if (
  911. this.selectedMaterialName.includes("盘螺") ||
  912. this.selectedMaterialName.includes("盘圆") ||
  913. this.selectedMaterialName.includes("盘元")
  914. ) {
  915. this.materialList[this.indexChangeMaterial].haveMeter = 0;
  916. this.materialList[this.indexChangeMaterial].meterNumber = null;
  917. } else {
  918. if (this.selectedMaterialName.includes("米")) {
  919. this.materialList[this.indexChangeMaterial].haveMeter = 1;
  920. this.materialList[this.indexChangeMaterial].isDisable = 1;
  921. this.materialList[this.indexChangeMaterial].meterNumber = Number(
  922. this.selectedMaterialName.replace(/[^0-9]/gi, "")
  923. );
  924. } else {
  925. this.materialList[this.indexChangeMaterial].haveMeter = 1;
  926. this.materialList[this.indexChangeMaterial].isDisable = 0;
  927. this.materialList[this.indexChangeMaterial].meterNumber = null;
  928. }
  929. }
  930. //重新初始化
  931. this.indexChangeMaterial = null;
  932. this.selectedMaterialId = null;
  933. this.selectedMaterialName = null;
  934. this.selectedMaterialSpecification = null;
  935. this.selectedMaterialModel = null;
  936. this.selectedMaterialCode = null;
  937. //关闭弹出框
  938. this.currentTable = false;
  939. this.isOpenDrawer = 0;
  940. //初始化查询数据
  941. this.materialNameText = null;
  942. this.materialSpecificationText = null;
  943. }
  944. },
  945. cancelUpdateMaterial() {
  946. this.getOrderList();
  947. this.dialogTableVisible = false;
  948. },
  949. makeSureUpdateMaterial() {
  950. let i = 0;
  951. if (this.materialList.length == 0) {
  952. this.$message.error("物资信息不能为空");
  953. return;
  954. }
  955. this.materialList.forEach(e => {
  956. if (!/(^[1-9]\d*$)/.test(e.meterNumber) && e.meterNumber != null) {
  957. e.meterNumber = null;
  958. i++;
  959. }
  960. });
  961. if (i != 0) {
  962. i = 0;
  963. this.$message.error("米数请输入正整数");
  964. return;
  965. }
  966. this.materialList.forEach(e => {
  967. if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
  968. e.orderPlanWeight = null;
  969. i++;
  970. }
  971. });
  972. if (i != 0) {
  973. this.$message.error("件数必填且请输入正整数");
  974. return;
  975. }
  976. this.materialList.forEach(e => {
  977. if (e.materialName.includes("定尺")) {
  978. if (!e.meterNumber) {
  979. i++;
  980. }
  981. }
  982. });
  983. if (i != 0) {
  984. this.$message.error("定尺必须填写米数");
  985. return;
  986. }
  987. this.dialogTableVisible = false;
  988. this.saleOrderId = this.$route.params.saleOrderId;
  989. let mapVal = {
  990. orderId: this.orderId,
  991. saleOrderMaterialId: this.saleOrderMaterialId,
  992. saleOrderId: this.saleOrderId,
  993. mapList: this.materialList
  994. };
  995. console.log(mapVal);
  996. this.axios
  997. .post("/api/v1/ams/updateAllMaterialInSale", mapVal)
  998. .then(res => {
  999. console.log(res.data);
  1000. if (res.data.code == "200") {
  1001. this.$message.success("修改成功!");
  1002. this.getOrderList();
  1003. } else {
  1004. this.$message.warning("修改失败");
  1005. this.getOrderList();
  1006. }
  1007. });
  1008. },
  1009. makeSureMaterial() {
  1010. //记录是理重还是磅重
  1011. var getisPound = 1;
  1012. this.materialList1.forEach(e => {
  1013. if (!e.materialSpecification) {
  1014. e.materialSpecification = "";
  1015. }
  1016. if (!e.materialModel) {
  1017. e.materialModel = "";
  1018. }
  1019. //判断物资是否为盘螺或非定尺
  1020. if (
  1021. e.materialName.includes("盘螺") ||
  1022. e.materialName.includes("乱尺") ||
  1023. e.materialName.includes("盘元") ||
  1024. e.materialName.includes("盘圆")
  1025. ) {
  1026. getisPound = 0;
  1027. } else {
  1028. getisPound = 1;
  1029. }
  1030. //若物资为带有盘螺、盘圆、盘元,默认无米数
  1031. if (
  1032. e.materialName.includes("盘螺") ||
  1033. e.materialName.includes("盘圆") ||
  1034. e.materialName.includes("盘元")
  1035. ) {
  1036. var addmap = {
  1037. orderId: this.orderId,
  1038. capacityNumber: this.capacityNumber,
  1039. materialName: e.materialName,
  1040. Specification: e.materialSpecification + e.materialModel,
  1041. materialCode: e.materialCode,
  1042. orderPlanWeight: null,
  1043. meterNumber: null,
  1044. isPound: getisPound,
  1045. //物资Id
  1046. materialId: e.materialId,
  1047. haveMeter: 0
  1048. };
  1049. } else {
  1050. if (e.materialName.includes("米")) {
  1051. var addmap = {
  1052. capacityNumber: this.capacityNumber,
  1053. orderId: this.orderId,
  1054. materialName: e.materialName,
  1055. Specification: e.materialSpecification + e.materialModel,
  1056. materialCode: e.materialCode,
  1057. orderPlanWeight: null,
  1058. haveMeter: 1,
  1059. meterNumber: e.materialName.replace(/[^0-9]/gi, ""),
  1060. isPound: getisPound,
  1061. //物资Id
  1062. materialId: e.materialId,
  1063. isDisable: 1
  1064. //有米数
  1065. };
  1066. console.log(addmap);
  1067. } else {
  1068. var addmap = {
  1069. capacityNumber: this.capacityNumber,
  1070. orderId: this.orderId,
  1071. materialName: e.materialName,
  1072. Specification: e.materialSpecification + e.materialModel,
  1073. materialCode: e.materialCode,
  1074. orderPlanWeight: null,
  1075. meterNumber: null,
  1076. isPound: getisPound,
  1077. haveMeter: 1,
  1078. //物资Id
  1079. materialId: e.materialId
  1080. };
  1081. }
  1082. }
  1083. this.materialList.push(addmap);
  1084. this.materialList.forEach(e => {
  1085. this.$set(e, "capacityNumber", this.capacityNumber);
  1086. });
  1087. this.getSpanArr1(this.materialList);
  1088. console.log(this.materialList);
  1089. });
  1090. this.materialList1 = [];
  1091. this.table1 = false;
  1092. },
  1093. rowDbClick(row) {
  1094. this.materialList1 = [];
  1095. this.materialList1.push(row);
  1096. this.makeSureMaterial();
  1097. },
  1098. openDrawer() {
  1099. this.option.requestUrl =
  1100. "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
  1101. this.materialModelText = null;
  1102. this.materialSpecificationText = null;
  1103. this.materialNameText = null;
  1104. this.table1 = true;
  1105. },
  1106. //返回选中的物资信息
  1107. selectionChange(selection) {
  1108. this.materialList1 = [];
  1109. this.materialList1 = selection;
  1110. },
  1111. //物资模态框查询
  1112. onclick() {
  1113. this.option.requestUrl =
  1114. "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
  1115. this.materialNameText +
  1116. "&materialSpecificationText=" +
  1117. this.materialSpecificationText +
  1118. "&i=" +
  1119. new Date();
  1120. },
  1121. onclick1() {
  1122. this.option1.requestUrl =
  1123. "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
  1124. this.materialNameText +
  1125. "&materialSpecificationText=" +
  1126. this.materialSpecificationText +
  1127. "&i=" +
  1128. new Date();
  1129. },
  1130. //开关是否删除
  1131. showDelete() {
  1132. this.isDelete = true;
  1133. },
  1134. deleteMaterialRow(index, rows) {
  1135. rows.splice(index, 1);
  1136. this.status = 1;
  1137. },
  1138. updateMaterial(scope) {
  1139. this.materialList = [];
  1140. this.materialList = this.tableData.filter((item, index) => {
  1141. return item.orderId == scope.row.orderId;
  1142. });
  1143. this.materialList.forEach(e => {
  1144. this.capacityNumber = e.capacityNumber;
  1145. this.orderId = e.orderId;
  1146. if (
  1147. e.materialName.includes("盘螺") ||
  1148. e.materialName.includes("盘圆") ||
  1149. e.materialName.includes("盘元")
  1150. ) {
  1151. e.haveMeter = 0;
  1152. } else {
  1153. e.haveMeter = 1;
  1154. if (e.materialName.includes("米")) {
  1155. e.isDisable = 1;
  1156. }
  1157. }
  1158. });
  1159. this.getSpanArr1(this.materialList);
  1160. this.title = "处理" + "-" + this.capacityNumber + "-" + "异常物资信息";
  1161. this.dialogTableVisible = true;
  1162. },
  1163. getOrderList() {
  1164. this.axios
  1165. .post(
  1166. "/api/v1/oms/getDriverInfoForSale1?saleOrderId=" +
  1167. this.$route.params.saleOrderId +
  1168. "&i=" +
  1169. new Date()
  1170. )
  1171. .then(res => {
  1172. console.log(res.data.data);
  1173. this.tableData = [];
  1174. this.tableData = res.data.data;
  1175. // this.orderId = this.tableData[0].orderId;
  1176. // this.lineSequence = this.tableData[0].lineSequence;
  1177. // this.saleOrderMaterialId = this.tableData[0].saleOrderMaterialId;
  1178. this.getSpanArr(this.tableData);
  1179. });
  1180. },
  1181. back() {
  1182. this.$router.push("/saleOrderSteel");
  1183. },
  1184. //合并方法
  1185. getSpanArr1(data) {
  1186. //每次调用方法初始化
  1187. this.spanArr1 = [];
  1188. for (var i = 0; i < data.length; i++) {
  1189. if (i === 0) {
  1190. this.spanArr1.push(1);
  1191. this.pos1 = 0;
  1192. } else {
  1193. // 判断当前元素与上一个元素是否相同
  1194. if (data[i].saleOrderMaterialId === data[i - 1].saleOrderMaterialId) {
  1195. this.spanArr1[this.pos1] += 1;
  1196. this.spanArr1.push(0);
  1197. } else {
  1198. this.spanArr1.push(1);
  1199. this.pos1 = i;
  1200. }
  1201. }
  1202. }
  1203. },
  1204. objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
  1205. if (columnIndex === 0) {
  1206. const _row = this.spanArr1[rowIndex];
  1207. const _col = _row > 0 ? 1 : 0;
  1208. return {
  1209. rowspan: _row,
  1210. colspan: _col
  1211. };
  1212. }
  1213. },
  1214. //记录每一行的合并数
  1215. getSpanArr(data) {
  1216. //每次调用方法初始化
  1217. this.spanArr = [];
  1218. for (var i = 0; i < data.length; i++) {
  1219. if (i === 0) {
  1220. this.spanArr.push(1);
  1221. this.pos = 0;
  1222. data[i].group = i;
  1223. } else {
  1224. // 判断当前元素与上一个元素是否相同
  1225. if (data[i].orderId === data[i - 1].orderId) {
  1226. this.spanArr[this.pos] += 1;
  1227. this.spanArr.push(0);
  1228. data[i].group = data[i - 1].group;
  1229. } else {
  1230. this.spanArr.push(1);
  1231. this.pos = i;
  1232. data[i].group = data[i - 1].group + 1;
  1233. }
  1234. }
  1235. }
  1236. },
  1237. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  1238. if (
  1239. columnIndex === 0 ||
  1240. columnIndex === 1 ||
  1241. columnIndex === 2 ||
  1242. columnIndex === 3 ||
  1243. columnIndex === 4
  1244. ) {
  1245. const _row = this.spanArr[rowIndex];
  1246. const _col = _row > 0 ? 1 : 0;
  1247. return {
  1248. rowspan: _row,
  1249. colspan: _col
  1250. };
  1251. }
  1252. }
  1253. }
  1254. };
  1255. </script>
  1256. <style lang="scss" scoped>
  1257. .updateSteelDetails {
  1258. .top {
  1259. margin-top: 20px;
  1260. margin-left: 20px;
  1261. .el-input {
  1262. width: 250px;
  1263. }
  1264. }
  1265. .table {
  1266. margin-top: 20px;
  1267. margin-left: 20px;
  1268. }
  1269. .dialog {
  1270. .buttonx {
  1271. display: flex;
  1272. justify-content: center;
  1273. align-items: center;
  1274. }
  1275. }
  1276. .addressDialog {
  1277. .addressDialog {
  1278. display: flex;
  1279. justify-content: center;
  1280. align-items: center;
  1281. }
  1282. .button-box {
  1283. display: flex;
  1284. justify-content: center;
  1285. align-items: center;
  1286. }
  1287. }
  1288. }
  1289. </style>