editSaleOrder.vue 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218
  1. <template>
  2. <!-- 修改销售订单 -->
  3. <div class="addSalePlan">
  4. <page-title>钢材订单修改</page-title>
  5. <!-- 订单基础信息 -->
  6. <el-form
  7. :inline="true"
  8. style="margin-top: 1rem;box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)"
  9. >
  10. <el-form-item>
  11. <label class="el-form-item__label" style="width: auto;">发货单位</label>
  12. <el-autocomplete
  13. class="inline-input"
  14. v-model="shipperName"
  15. :fetch-suggestions="querySearchCarrier"
  16. placeholder="请输入发货单位名称"
  17. :trigger-on-focus="false"
  18. @select="handleSelectCarrier"
  19. style="width:245px"
  20. disabled
  21. >
  22. <template slot-scope="{ item }">
  23. <div class="name">{{ item.shipperName }}</div>
  24. </template>
  25. </el-autocomplete>
  26. </el-form-item>
  27. <el-form-item>
  28. <label class="el-form-item__label" style="width: auto;">下单客户</label>
  29. <el-autocomplete
  30. class="inline-input"
  31. v-model="consigneeName"
  32. :fetch-suggestions="querySearchConsignee"
  33. placeholder="请输入下单客户名称"
  34. :trigger-on-focus="false"
  35. @select="handleSelectConsignee"
  36. style="width:300px"
  37. >
  38. <template slot-scope="{ item }">
  39. <div class="name">{{ item.consigneeCompanyName }}</div>
  40. </template>
  41. </el-autocomplete>
  42. </el-form-item>
  43. <el-form-item>
  44. <label class="el-form-item__label" style="width: auto;">是否自提</label>
  45. <el-select v-model="values" placeholder="请选择" style="width:60px">
  46. <el-option
  47. v-for="item in options"
  48. :key="item.values"
  49. :label="item.label"
  50. :value="item.values"
  51. >
  52. </el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item>
  56. <label class="el-form-item__label" style="width: auto;">收款公司</label>
  57. <el-select v-model="values1" placeholder="请选择" style="width: 255px">
  58. <el-option
  59. v-for="item in receivingCompany"
  60. :key="item.values1"
  61. :label="item.label1"
  62. :value="item.values1"
  63. >
  64. </el-option>
  65. </el-select>
  66. </el-form-item>
  67. <el-form-item>
  68. <label class="el-form-item__label" style="width: auto;">业务员</label>
  69. <el-select v-model="saleMan" placeholder="请选择" style="width: 90px">
  70. <el-option
  71. v-for="item in saleMans"
  72. :key="item.value"
  73. :label="item.label"
  74. :value="item.value"
  75. >
  76. </el-option>
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item>
  80. <label
  81. class="el-form-item__label"
  82. style="width: auto;margin-top: 0.3rem;"
  83. >摘要</label
  84. >
  85. </el-form-item>
  86. <el-form-item>
  87. <el-input
  88. v-model="remarks"
  89. placeholder="(非必填)"
  90. style="width: 180px"
  91. ></el-input>
  92. </el-form-item>
  93. </el-form>
  94. <!-- 车序号基础信息 -->
  95. <el-form :inline="true" style="margin-top: 1rem;">
  96. <el-form-item>
  97. <label class="el-form-item__label" style="width: auto;">收货地址</label>
  98. <el-autocomplete
  99. style="width:400px"
  100. v-model="saleShipperAddressName"
  101. :fetch-suggestions="querySearchAddress"
  102. placeholder="请输入内容"
  103. @select="handleSelectAddress"
  104. >
  105. <template slot-scope="{ item }">
  106. <span class="addr">{{ item.addressPlace }}</span>
  107. </template>
  108. </el-autocomplete>
  109. <el-button type="primary" @click="ondrawerOut">选择</el-button>
  110. </el-form-item>
  111. <el-form-item>
  112. <label
  113. class="el-form-item__label"
  114. style="width: auto;margin-top: 0.4rem;"
  115. >收货客户电话</label
  116. >
  117. </el-form-item>
  118. <el-form-item>
  119. <el-input
  120. style="width: 150px"
  121. v-model="saleOrderConsigneeTel"
  122. placeholder="(非必填)"
  123. ></el-input>
  124. </el-form-item>
  125. <el-form-item>
  126. <label
  127. class="el-form-item__label"
  128. style="width: auto;margin-top: 0.4rem;"
  129. >备注</label
  130. >
  131. </el-form-item>
  132. <el-form-item>
  133. <el-input
  134. style="width: 180px"
  135. v-model="truckRemark"
  136. placeholder="(非必填)"
  137. ></el-input>
  138. </el-form-item>
  139. <el-form-item>
  140. <label class="el-form-item__label" style="width: auto;"
  141. >可装货时间</label
  142. >
  143. <el-date-picker
  144. class="textinput3"
  145. v-model.number="saleDateOfReceipt"
  146. type="datetime"
  147. placeholder="选择日期时间"
  148. disabled
  149. >
  150. </el-date-picker>
  151. </el-form-item>
  152. </el-form>
  153. <div class="button-box">
  154. <el-button type="primary" class="btn" @click="addMaterial"
  155. ><i class="el-icon-circle-plus-outline"></i>新增物资</el-button
  156. >
  157. </div>
  158. <!-- 车辆拼装物资信息table1 -->
  159. <div class="selectionTable from">
  160. <el-table
  161. :data="materialList"
  162. border
  163. style="width: 100%"
  164. highlight-current-row
  165. >
  166. <el-table-column
  167. v-for="(item, i) in materialTableTop"
  168. :key="i"
  169. :prop="item.prop"
  170. :label="item.label"
  171. align="center"
  172. show-overflow-tooltip
  173. >
  174. <!-- 插入输入框 -->
  175. <template slot-scope="scope">
  176. <template v-if="item.slot">
  177. <!-- 物资件数 -->
  178. <template v-if="item.prop == 'orderPlanWeight'">
  179. <el-input
  180. class="textinput111"
  181. v-model.number="scope.row.orderPlanWeight"
  182. placeholder="(必填)"
  183. :id="'input' + scope.$index"
  184. @keyup.up.native="clicks(scope.$index)"
  185. @keyup.down.native="clickx(scope.$index)"
  186. @keyup.enter.native="createACar"
  187. ></el-input>
  188. </template>
  189. <!-- 米数 -->
  190. <template v-if="item.prop == 'meterNumber'">
  191. <el-input
  192. v-if="scope.row.haveMeter == 1"
  193. class="textinput111"
  194. v-model.number="scope.row.meterNumber"
  195. :disabled="scope.row.isDisable == 1"
  196. placeholder="(必填)"
  197. ></el-input>
  198. </template>
  199. <!-- 分装车数 -->
  200. <template v-if="item.prop == 'carNumber'">
  201. <el-input
  202. v-if="materialList.length == 1"
  203. class="textinput111"
  204. v-model.number="scope.row.carNumber"
  205. placeholder="(非必填)"
  206. ></el-input>
  207. </template>
  208. <!-- 是否磅重销售 -->
  209. <template v-if="item.prop == 'isPound'">
  210. <el-select
  211. v-model="scope.row.isPound"
  212. placeholder="请选择"
  213. style="width:65px"
  214. >
  215. <el-option
  216. v-for="item in options2"
  217. :key="item.values2"
  218. :label="item.label2"
  219. :value="item.values2"
  220. >
  221. </el-option>
  222. </el-select>
  223. </template>
  224. </template>
  225. <template v-else>
  226. <span>{{ scope.row[item.prop] }}</span>
  227. </template>
  228. </template>
  229. </el-table-column>
  230. <!-- 操作列 -->
  231. <el-table-column fixed="right" label="操作" width="100">
  232. <template slot-scope="scope">
  233. <el-button
  234. @click.native.prevent="
  235. deleteMaterialRow(scope.$index, materialList)
  236. "
  237. type="text"
  238. icon="el-icon-close"
  239. size="big"
  240. ></el-button>
  241. </template>
  242. </el-table-column>
  243. </el-table>
  244. </div>
  245. <!-- 新增物资和生成一车 -->
  246. <div class="button-box">
  247. <el-input
  248. style="width: 60px;margin-right: 0.3rem;border:2px solid;"
  249. v-model="toCxh"
  250. ></el-input>
  251. <el-button type="primary" class="btn" @click="addToCxh"
  252. >添加到车序号</el-button
  253. >
  254. <el-button type="primary" class="btn" @click="createACar"
  255. >添加到订单</el-button
  256. >
  257. </div>
  258. <div style="margin-left: 0.3rem;color:red">(注:一个车序号代表一辆车)</div>
  259. <!-- 销售订单信息table2 -->
  260. <div class="selectionTable from">
  261. <el-table
  262. :data="selectionList"
  263. border
  264. style="width: 100%"
  265. :span-method="cellMerge"
  266. @cell-click="goclick"
  267. highlight-current-row
  268. >
  269. <el-table-column
  270. v-for="(item, i) in tableTop"
  271. :key="i"
  272. :prop="item.prop"
  273. :label="item.label"
  274. :width="item.width"
  275. align="center"
  276. show-overflow-tooltip
  277. >
  278. <template slot="scope" v-if="item.label !== '物资名称'">
  279. <span>{{ item.label }}</span>
  280. </template>
  281. <template slot="scope" v-if="item.label !== '件数'">
  282. <span>{{ item.label }}</span>
  283. </template>
  284. <template slot="scope" v-if="item.label !== '收货地址'">
  285. <span>{{ item.label }}</span>
  286. </template>
  287. <!-- <template slot="scope" v-if="item.label !== '收货日期'">
  288. <span>{{ item.label }}</span>
  289. </template> -->
  290. <template slot="scope" v-if="item.label !== '收货姓名'">
  291. <span>{{ item.label }}</span>
  292. </template>
  293. <template slot="scope" v-if="item.label !== '收货方电话'">
  294. <span>{{ item.label }}</span>
  295. </template>
  296. <template slot="scope" v-if="item.label !== '备注'">
  297. <span>{{ item.label }}</span>
  298. </template>
  299. <!-- 插入输入框 -->
  300. <template slot-scope="scope">
  301. <template v-if="item.slot">
  302. <!-- 物资名称 -->
  303. <template v-if="item.prop == 'materialName'">
  304. <el-input
  305. style="width: 200px"
  306. v-model="scope.row.materialName"
  307. disabled
  308. >
  309. </el-input>
  310. <!--更改-->
  311. <i
  312. class="el-icon-edit"
  313. @click="changeMaterial(scope.$index)"
  314. style="font-size: 20px"
  315. v-if="isCellClick == 1"
  316. ></i>
  317. </template>
  318. <!-- 物资件数 -->
  319. <template v-if="item.prop == 'orderPlanWeight'">
  320. <el-input
  321. class="textinput"
  322. v-model.number="scope.row.orderPlanWeight"
  323. ></el-input>
  324. </template>
  325. <!--规格型号-->
  326. <template v-if="item.prop == 'Specification'">
  327. <el-input
  328. class="textinput"
  329. v-model.number="scope.row.Specification"
  330. style="width:120px"
  331. ></el-input>
  332. </template>
  333. <!-- 米数 -->
  334. <template v-if="item.prop == 'meterNumber'">
  335. <el-input
  336. v-if="scope.row.haveMeter == 1"
  337. class="textinput"
  338. v-model.number="scope.row.meterNumber"
  339. :disabled="scope.row.isDisable == 1"
  340. ></el-input>
  341. </template>
  342. <!-- 是否磅重销售 -->
  343. <template v-if="item.prop == 'isPound'">
  344. <el-select
  345. v-model="scope.row.isPound"
  346. placeholder="请选择"
  347. style="width:65px"
  348. >
  349. <el-option
  350. v-for="item in options2"
  351. :key="item.values2"
  352. :label="item.label2"
  353. :value="item.values2"
  354. >
  355. </el-option>
  356. </el-select>
  357. </template>
  358. <!-- 收货地址id -->
  359. <template
  360. style="width: 380px"
  361. v-if="item.prop == 'saleShipperAddressName'"
  362. >
  363. <el-input
  364. style="width: 310px"
  365. v-model="scope.row.saleShipperAddressName"
  366. disabled
  367. >
  368. </el-input>
  369. <!--增加-->
  370. <i
  371. class="el-icon-folder-add"
  372. @click="ondrawer(scope.row, scope.$index)"
  373. v-if="isCellClick == 1"
  374. style="font-size: 20px"
  375. ></i>
  376. </template>
  377. <!-- 收货客户电话号码 -->
  378. <template v-if="item.prop == 'saleOrderConsigneeTel'">
  379. <el-input
  380. class="textinput5"
  381. placeholder="(必填)"
  382. v-model.number="scope.row.saleOrderConsigneeTel"
  383. @change="batchUpdateValue(scope.row, scope.$index)"
  384. ></el-input>
  385. </template>
  386. <!-- 备注 -->
  387. <template v-if="item.prop == 'truckRemark'">
  388. <el-input
  389. class="textinput5"
  390. placeholder="(必填)"
  391. v-model="scope.row.truckRemark"
  392. ></el-input>
  393. </template>
  394. </template>
  395. <template v-else>
  396. <span>{{ scope.row[item.prop] }}</span>
  397. </template>
  398. </template>
  399. </el-table-column>
  400. <!-- 操作列 -->
  401. <el-table-column
  402. fixed="right"
  403. label="操作"
  404. width="200"
  405. v-if="isCellClick == 1"
  406. >
  407. <template slot-scope="scope">
  408. <el-button
  409. @click.native.prevent="deleteRow(scope.$index, selectionList)"
  410. type="text"
  411. icon="el-icon-close"
  412. size="big"
  413. ></el-button>
  414. <el-button
  415. @click.native.prevent="copyRow(scope.$index, scope.row)"
  416. type="text"
  417. size="big"
  418. >复制为一车</el-button
  419. >
  420. <el-button
  421. @click.native.prevent="copyRowflu(scope.$index, scope.row)"
  422. type="text"
  423. size="big"
  424. >复制为分录</el-button
  425. >
  426. </template>
  427. </el-table-column>
  428. <el-table-column fixed="right" width="80" v-if="isCellClick == 1">
  429. <template slot-scope="scope">
  430. <el-button
  431. @click.native.prevent="copyRowfluAll(scope.$index, scope.row)"
  432. type="text"
  433. size="big"
  434. >复制整车</el-button
  435. >
  436. </template>
  437. </el-table-column>
  438. </el-table>
  439. </div>
  440. <!-- 收货地址弹出框 -->
  441. <el-dialog title="收货地址" :visible.sync="drawer1" width="90%">
  442. <el-form :inline="true">
  443. <el-form-item>
  444. <label class="el-form-item__label" style="width: auto;">省</label>
  445. <el-select
  446. v-model="province"
  447. filterable
  448. placeholder="请选择"
  449. @change="onchangeProvince"
  450. >
  451. <el-option
  452. v-for="item in provinceList"
  453. :key="item.id"
  454. :label="item.addressProvince"
  455. :value="item.id"
  456. ></el-option>
  457. </el-select>
  458. </el-form-item>
  459. <el-form-item>
  460. <label class="el-form-item__label" style="width: auto;">市</label>
  461. <el-select
  462. v-model="city"
  463. filterable
  464. placeholder="请选择"
  465. @change="onchangeCity"
  466. >
  467. <el-option
  468. v-for="item in cityList"
  469. :key="item.id"
  470. :label="item.addressDistrict"
  471. :value="item.id"
  472. ></el-option>
  473. </el-select>
  474. </el-form-item>
  475. <el-form-item>
  476. <label class="el-form-item__label" style="width: auto;">县(区)</label>
  477. <el-select
  478. v-model="county"
  479. filterable
  480. placeholder="请选择"
  481. @change="onchangeCounty"
  482. >
  483. <el-option
  484. v-for="item in countyList"
  485. :key="item.id"
  486. :label="item.addressTown"
  487. :value="item.id"
  488. ></el-option>
  489. </el-select>
  490. </el-form-item>
  491. <el-form-item>
  492. <label class="el-form-item__label" style="width: auto;"
  493. >具体收货地址</label
  494. >
  495. <el-autocomplete
  496. class="inline-input"
  497. v-model="place"
  498. :fetch-suggestions="querySearch1"
  499. placeholder="请输入具体收货地址"
  500. :trigger-on-focus="false"
  501. @select="handleSelect1"
  502. >
  503. </el-autocomplete>
  504. </el-form-item>
  505. </el-form>
  506. <div slot="footer" class="button-box">
  507. <el-button @click="drawer1 = false">取 消</el-button>
  508. <el-button type="primary" @click="addAddressClick">确定</el-button>
  509. </div>
  510. </el-dialog>
  511. <!-- 物资选择模态框 -->
  512. <el-drawer
  513. title="选择物资信息"
  514. :visible.sync="table1"
  515. direction="rtl"
  516. size="90%"
  517. :show-close="true"
  518. >
  519. <el-form :inline="true" style="margin-top: 0.5rem;">
  520. <el-form-item>
  521. <label class="el-form-item__label" style="width: auto;"
  522. >物资名称/型号</label
  523. >
  524. </el-form-item>
  525. <el-form-item>
  526. <el-input
  527. placeholder="请输入物资名称/型号"
  528. v-model="materialNameText"
  529. clearable
  530. ></el-input>
  531. </el-form-item>
  532. <el-form-item>
  533. <label class="el-form-item__label" style="width: auto;">规格</label>
  534. </el-form-item>
  535. <el-form-item>
  536. <el-input
  537. placeholder="请输入内容"
  538. v-model="materialSpecificationText"
  539. clearable
  540. ><template slot="prepend">Φ</template></el-input
  541. >
  542. </el-form-item>
  543. <el-button
  544. type="primary"
  545. class="btn"
  546. @click="onclick"
  547. style="margin-left: 4px;"
  548. ><i class="el-icon-search"></i>查询</el-button
  549. >
  550. <el-button type="primary" @click="makeSureMaterial"
  551. ><i class="el-icon-check"></i>确定</el-button
  552. >
  553. </el-form>
  554. <div class="tablecls">
  555. <!-- 查询所有的物资 -->
  556. <dilTable
  557. v-bind.sync="option"
  558. @selection-change="selectionChange"
  559. @rowDbClick="rowDbClick"
  560. >
  561. </dilTable>
  562. </div>
  563. </el-drawer>
  564. <!-- 更改行物资 -->
  565. <el-dialog title="更改物资" :visible.sync="drawer" width="80%">
  566. <el-form :inline="true" style="margin-top: 0.5rem;">
  567. <el-form-item>
  568. <label class="el-form-item__label" style="width: auto;"
  569. >物资名称</label
  570. >
  571. </el-form-item>
  572. <el-form-item>
  573. <el-input
  574. placeholder="请输入内容"
  575. v-model="materialNameText"
  576. clearable
  577. ></el-input>
  578. </el-form-item>
  579. <el-form-item>
  580. <label class="el-form-item__label" style="width: auto;">规格</label>
  581. </el-form-item>
  582. <el-button
  583. type="primary"
  584. class="btn"
  585. @click="onclick"
  586. style="margin-left: 4px;"
  587. ><i class="el-icon-search"></i>查询</el-button
  588. >
  589. </el-form>
  590. <div class="tablecls">
  591. <!-- 查询所有的物资 -->
  592. <dilTable
  593. v-bind.sync="option1"
  594. @radio-change="currentRadioChange"
  595. :drawer="drawer"
  596. >
  597. </dilTable>
  598. </div>
  599. <div class="button-box">
  600. <el-button @click="closeChangeMaterial">取消更改</el-button>
  601. <el-button type="primary" @click="makeSureChange">确认更改</el-button>
  602. </div>
  603. </el-dialog>
  604. <!-- 订单确认 -->
  605. <el-dialog
  606. title="订单明细 (注*: 请仔细确认订单物资和件数后再提交)"
  607. :visible.sync="orderMakeSure"
  608. width="94%"
  609. >
  610. <el-form :inline="true" style="margin-top: 0.5rem;">
  611. <el-form-item>
  612. <label class="el-form-item__label" style="width: auto;"
  613. >发货单位:</label
  614. >
  615. <el-tag size="big">{{ shipperName }}</el-tag>
  616. </el-form-item>
  617. <el-form-item>
  618. <label class="el-form-item__label" style="width: auto;"
  619. >下单客户:</label
  620. >
  621. <el-tag size="big">{{ consigneeName }}</el-tag>
  622. </el-form-item>
  623. <el-form-item>
  624. <label class="el-form-item__label" style="width: auto;"
  625. >是否自提:</label
  626. >
  627. <el-tag size="big">{{ saleOrderIsselfMention }}</el-tag>
  628. </el-form-item>
  629. <el-form-item>
  630. <label class="el-form-item__label" style="width: auto;"
  631. >收款公司:</label
  632. >
  633. <el-tag size="big">{{ saleOrderReceiveCustomer }}</el-tag>
  634. </el-form-item>
  635. <el-form-item>
  636. <label class="el-form-item__label" style="width: auto;"
  637. >业务员:</label
  638. >
  639. <el-tag size="big">{{ saleManText }}</el-tag>
  640. </el-form-item>
  641. <el-form-item>
  642. <label class="el-form-item__label" style="width: auto;">摘要:</label>
  643. <el-tag size="big" v-if="remarks != null">{{ remarks }}</el-tag>
  644. </el-form-item>
  645. </el-form>
  646. <!-- 物资明细信息 -->
  647. <el-table
  648. :data="selectionList"
  649. border
  650. style="width: 100%;margin-top: 0.5rem;"
  651. :span-method="cellMerge"
  652. highlight-current-row
  653. >
  654. <el-table-column
  655. v-for="(item, i) in tableTop"
  656. :key="i"
  657. :prop="item.prop"
  658. :label="item.label"
  659. :width="item.width"
  660. align="center"
  661. show-overflow-tooltip
  662. >
  663. </el-table-column>
  664. </el-table>
  665. <div class="button-box">
  666. <el-button @click="orderMakeSure = false">返回编辑</el-button>
  667. <el-button type="primary" @click="sendRequest">提交订单</el-button>
  668. </div>
  669. </el-dialog>
  670. <div class="button-box">
  671. <el-button @click="cancel">取消</el-button>
  672. <el-button type="primary" @click="makeSure">确定</el-button>
  673. </div>
  674. </div>
  675. </template>
  676. <script>
  677. import PageTitle from '@/components/Page/Title'
  678. import { sjTime, isIntegerNumber } from '@/utils/sharedJsFile'
  679. export default {
  680. components: { PageTitle },
  681. data() {
  682. return {
  683. isCellClick: null,
  684. truckRemark: '',
  685. shipperName: '四川省达州钢铁集团有限责任公司',
  686. shipperId: 1,
  687. consigneeName: null,
  688. consigneeId: null,
  689. remarks: null,
  690. saleShipperAddressName: null,
  691. saleShipperAddressId: null,
  692. saleDateOfReceipt: null,
  693. saleOrderConsigneeTel: null,
  694. //加载
  695. selectLineLoading: false,
  696. //物资选中暂存
  697. materialList1: [],
  698. //物资信息查询内容
  699. materialNameText: null,
  700. materialSpecificationText: null,
  701. materialModelText: null,
  702. //物资选中表格
  703. materialList: [],
  704. materialTableTop: [
  705. {
  706. prop: 'materialName',
  707. label: '物资名称',
  708. width: '140'
  709. },
  710. {
  711. prop: 'meterNumber',
  712. label: '米数',
  713. slot: true
  714. },
  715. {
  716. prop: 'Specification',
  717. label: '规格型号',
  718. width: '140'
  719. },
  720. {
  721. prop: 'orderPlanWeight',
  722. label: '件数',
  723. slot: true
  724. },
  725. {
  726. prop: 'carNumber',
  727. label: '分装车数',
  728. slot: true
  729. },
  730. {
  731. prop: 'isPound',
  732. label: '是否磅重销售',
  733. slot: true
  734. }
  735. ],
  736. truckRemark: '',
  737. table1: false,
  738. //添加到那个车序号
  739. toCxh: null,
  740. //最大车序号数
  741. maxCxh: 1,
  742. //存放每一行记录的合并数
  743. spanArr: [],
  744. //pos是spanArr的索引
  745. pos: 0,
  746. //判断是内层还是外层点击的收货地址浏览
  747. inOrOut: 0,
  748. //地址输入框的值
  749. addresText: '',
  750. //已选中省市县
  751. address: null,
  752. //具体地址
  753. place: null,
  754. //暂存具体地址
  755. place1: null,
  756. //省市县Id
  757. addressId: null,
  758. // input: "",
  759. //物资表格多选
  760. option: {
  761. // 表格请求数据的地址
  762. requestUrl: '/api/v1/uc/getSteelMaterial?apiId=244',
  763. // 控制显示多选列
  764. selectionType: 'select'
  765. },
  766. //物资表格单选
  767. option1: {
  768. // 表格请求数据的地址
  769. requestUrl: '/api/v1/uc/getSteelMaterial?apiId=244',
  770. // 控制显示单选列
  771. selectionType: 'radio'
  772. },
  773. selectionList: [],
  774. selectionList1: [],
  775. drawer1: false,
  776. direction: 'rtl',
  777. form1: {},
  778. value: undefined,
  779. frist: {
  780. requestUrl: '/api/v1/ams/getAddressDeliveryAddress?apiId=255',
  781. selectionType: 'radio',
  782. mapList: []
  783. },
  784. //所有省
  785. provinceList: [],
  786. //选中的省
  787. province: '',
  788. //所有市
  789. cityList: [],
  790. //选中的市
  791. city: '',
  792. //所有的县(区)
  793. countyList: [],
  794. //选中的县
  795. county: '',
  796. options: [
  797. {
  798. values: 'yes',
  799. label: '是'
  800. },
  801. {
  802. values: 'no',
  803. label: '否'
  804. }
  805. ],
  806. values: 'no',
  807. //是否磅重销售
  808. options2: [
  809. {
  810. values2: 0,
  811. label2: '是'
  812. },
  813. {
  814. values2: 1,
  815. label2: '否'
  816. }
  817. ],
  818. values2: 1,
  819. receivingCompany: [
  820. {
  821. values1: 'dzgt',
  822. label1: '四川省达州钢铁集团有限责任公司'
  823. },
  824. {
  825. values1: 'dgsm',
  826. label1: '四川达钢商贸有限公司'
  827. },
  828. {
  829. values1: 'jxjl',
  830. label1: '江西久隆贸易有限公司'
  831. },
  832. {
  833. values1: 'hnht',
  834. label1: '海南瀚途贸易有限公司'
  835. },
  836. {
  837. values1: 'cdxc',
  838. label1: '成都兴城道成物流有限公司'
  839. }
  840. ],
  841. values1: 'dzgt',
  842. saleMan: null,
  843. saleManText: null,
  844. saleMans: [],
  845. tableTop: [
  846. {
  847. prop: 'cxh',
  848. label: '车序号',
  849. width: '50'
  850. },
  851. {
  852. prop: 'materialName',
  853. label: '物资名称',
  854. width: '300',
  855. slot: true
  856. },
  857. {
  858. prop: 'meterNumber',
  859. label: '米数',
  860. width: '60',
  861. slot: true
  862. },
  863. {
  864. prop: 'Specification',
  865. label: '规格型号',
  866. width: '140',
  867. slot: true
  868. },
  869. {
  870. prop: 'orderPlanWeight',
  871. label: '件数',
  872. width: '60',
  873. slot: true
  874. },
  875. {
  876. prop: 'isPound',
  877. label: '是否磅重销售',
  878. width: '80',
  879. slot: true
  880. },
  881. {
  882. prop: 'saleShipperAddressName',
  883. label: '收货地址',
  884. width: '400',
  885. slot: true
  886. },
  887. {
  888. prop: 'saleOrderConsigneeTel',
  889. label: '收货客户电话',
  890. width: '140',
  891. slot: true
  892. },
  893. {
  894. prop: 'truckRemark',
  895. label: '备注',
  896. width: '140',
  897. slot: true
  898. }
  899. ],
  900. row: {},
  901. //打开更改改物资弹出框
  902. drawer: false,
  903. //记录为内层打开
  904. isOpenDrawer: 0,
  905. //记录修改物资单选行的位置
  906. indexChangeMaterial: null,
  907. //记录单选物资Id
  908. selectedMaterialId: null,
  909. //记录单选物资名称
  910. selectedMaterialName: null,
  911. //记录单选物资规格
  912. selectedMaterialSpecification: null,
  913. //记录单选物资型号
  914. selectedMaterialModel: null,
  915. //记录单选物资编码
  916. selectedMaterialCode: null,
  917. //订单确认
  918. orderMakeSure: false,
  919. //是否自提记录字段
  920. saleOrderIsselfMention: null,
  921. //收款公司
  922. saleOrderReceiveCustomer: null,
  923. //是否忽视收货客户电话字段
  924. ignoreSaleOrderConsigneeTel: 0,
  925. //暂时存取的数据
  926. temporarylist: []
  927. }
  928. },
  929. created() {
  930. this.getRmsReceivingCompany()
  931. let loadTime1 = new Date(
  932. new Date(new Date().toLocaleDateString()).getTime() +
  933. (3600 * 1000 * 8 - 1)
  934. ) // 当天8点前
  935. let loadTime2 = new Date(
  936. new Date(new Date().toLocaleDateString()).getTime() +
  937. (3600 * 1000 * 32 - 1)
  938. ) // 次天8点前
  939. if (new Date().getTime() - loadTime1 > 0) {
  940. this.saleDateOfReceipt = loadTime2
  941. } else {
  942. this.saleDateOfReceipt = loadTime1
  943. }
  944. //获取所有的省
  945. this.getAllProvince()
  946. //获取所有的业务员
  947. this.getAllsaleMan()
  948. //获取所有的销售订单信息
  949. this.getAllSaleMessages()
  950. },
  951. methods: {
  952. getRmsReceivingCompany() {
  953. this.axios.post('/api/v1/rmsReceivingCompany/map').then(res => {
  954. console.log(res.data)
  955. this.receivingCompany = res.data
  956. })
  957. },
  958. handleSelectAddress(item) {
  959. this.saleShipperAddressName = item.addressPlace
  960. this.province = item.addressProvince
  961. this.city = item.addressDistrict
  962. this.county = item.addressTown
  963. this.saleShipperAddressId = item.shipperAddressId
  964. this.addressId = item.shipperAddressId
  965. this.place1 = item.place
  966. this.saleOrderConsigneeTel = item.saleOrderConsigneeTel
  967. },
  968. querySearchAddress(queryString, cb) {
  969. if (this.consigneeId != null) {
  970. this.axios
  971. .post(
  972. '/api/v1/ams/matchingAddressRecently?receiveId=' + this.consigneeId
  973. )
  974. .then(res => {
  975. var restaurants = res.data.data
  976. console.log(restaurants)
  977. var results = queryString
  978. ? restaurants.filter(this.createStateFilter(queryString))
  979. : restaurants
  980. cb(results)
  981. })
  982. }
  983. },
  984. createStateFilter(queryString) {
  985. return restaurants => {
  986. return (
  987. restaurants.addressPlace
  988. .toLowerCase()
  989. .indexOf(queryString.toLowerCase()) > -1
  990. )
  991. }
  992. },
  993. copyRow(index, row) {
  994. let copyRow = new Object()
  995. Object.keys(row).forEach(key => {
  996. copyRow[key] = row[key]
  997. })
  998. copyRow.cxh = this.maxCxh
  999. this.selectionList.push(copyRow)
  1000. this.getSpanArr(this.selectionList)
  1001. this.maxCxh++
  1002. },
  1003. copyRowflu(index, row) {
  1004. console.log(index)
  1005. let copyRowflu = new Object()
  1006. Object.keys(row).forEach(key => {
  1007. copyRowflu[key] = row[key]
  1008. })
  1009. this.selectionList.splice(index + 1, 0, copyRowflu)
  1010. // this.selectionList.push(copyRowflu);
  1011. this.getSpanArr(this.selectionList)
  1012. },
  1013. copyRowfluAll(index, row) {
  1014. let arr = []
  1015. //复制整车,根据车序号去寻找相同的列
  1016. arr = this.selectionList.concat([]).filter((item, index) => {
  1017. return item.cxh == row.cxh
  1018. })
  1019. arr.forEach(e => {
  1020. let copyRow = new Object()
  1021. Object.keys(e).forEach(key => {
  1022. copyRow[key] = e[key]
  1023. })
  1024. copyRow.cxh = this.maxCxh
  1025. this.selectionList.push(copyRow)
  1026. })
  1027. this.getSpanArr(this.selectionList)
  1028. this.maxCxh++
  1029. },
  1030. onblur() {
  1031. this.isCellClick = 0
  1032. console.log('我这里值也变化了')
  1033. },
  1034. goclick() {
  1035. this.isCellClick = 1
  1036. console.log('我这里值变化了')
  1037. },
  1038. rowDbClick(row) {
  1039. this.materialList1 = []
  1040. this.materialList1.push(row)
  1041. this.makeSureMaterial()
  1042. },
  1043. //获取所有的销售订单信息
  1044. getAllSaleMessages() {
  1045. this.axios
  1046. .post(
  1047. '/api/v1/ams/getAllSaleMessages?saleOrderId=' +
  1048. this.$route.params.saleOrderId
  1049. )
  1050. .then(res => {
  1051. //销售订单基础数据
  1052. console.log(res.data.data)
  1053. this.shipperName = res.data.data.shipperName
  1054. this.shipperId = res.data.data.shipperId
  1055. this.consigneeName = res.data.data.receiveName
  1056. this.consigneeId = res.data.data.receiveId
  1057. this.remarks = res.data.data.saleRemark
  1058. if (res.data.data.isSelfMention == '否') {
  1059. this.values = 'no'
  1060. } else {
  1061. this.values = 'yes'
  1062. }
  1063. if (
  1064. res.data.data.saleOrderReceiveCustomer ==
  1065. '四川省达州钢铁集团有限责任公司'
  1066. ) {
  1067. this.values1 = 'dzgt'
  1068. } else {
  1069. this.values1 = 'dgsm'
  1070. }
  1071. this.salerId = res.data.data.salerId
  1072. this.saleMan = res.data.data.salerId
  1073. this.saleRemark = res.data.data.saleRemark
  1074. //下方车序号数据
  1075. res.data.data.mapList.forEach(e => {
  1076. var haveMeter
  1077. if (e.steelMeters) {
  1078. haveMeter = 1
  1079. } else {
  1080. haveMeter = 0
  1081. }
  1082. if (e.materialName.includes('米')) {
  1083. var addmap = {
  1084. cxh: e.truckNo,
  1085. materialName: e.materialName,
  1086. Specification: e.Specification,
  1087. materialCode: e.materialCode,
  1088. orderPlanWeight: e.materialNumber,
  1089. isPound: e.isPoundSale,
  1090. saleShipperAddressId: e.shipperAddressId,
  1091. place: e.place,
  1092. saleShipperAddressName: e.saleShipperAddressName + e.place,
  1093. saleDateOfReceipt: e.saleDateOfReceipt,
  1094. saleOrderConsigneeTel: e.saleOrderConsigneeTel,
  1095. materialId: e.materialId,
  1096. truckRemark: e.truckRemark,
  1097. haveMeter: haveMeter,
  1098. meterNumber: Number(e.materialName.replace(/[^0-9]/gi, '')),
  1099. //有米数
  1100. haveMeter: 1,
  1101. isDisable: 1
  1102. }
  1103. } else {
  1104. var addmap = {
  1105. cxh: e.truckNo,
  1106. materialName: e.materialName,
  1107. Specification: e.Specification,
  1108. materialCode: e.materialCode,
  1109. orderPlanWeight: e.materialNumber,
  1110. meterNumber: e.steelMeters,
  1111. isPound: e.isPoundSale,
  1112. saleShipperAddressId: e.shipperAddressId,
  1113. place: e.place,
  1114. saleShipperAddressName: e.saleShipperAddressName + e.place,
  1115. saleDateOfReceipt: e.saleDateOfReceipt,
  1116. saleOrderConsigneeTel: e.saleOrderConsigneeTel,
  1117. materialId: e.materialId,
  1118. truckRemark: e.truckRemark,
  1119. haveMeter: haveMeter
  1120. }
  1121. }
  1122. this.selectionList.push(addmap)
  1123. })
  1124. //调用记录每一行的合并数的方法
  1125. this.getSpanArr(this.selectionList)
  1126. //确定有多少车序号
  1127. this.spanArr.forEach(item => {
  1128. if (item > 0) {
  1129. //最大车序号加1
  1130. this.maxCxh += 1
  1131. }
  1132. })
  1133. })
  1134. },
  1135. //获取所有的业务员数据
  1136. getAllsaleMan() {
  1137. this.axios.get('/api/v1/uc/getSalerList').then(res => {
  1138. this.saleMans = res.data.data
  1139. })
  1140. },
  1141. //获取所有省数据
  1142. getAllProvince() {
  1143. this.axios.post('/api/v1/uc/getAllProvince').then(res => {
  1144. this.provinceList = res.data.data
  1145. })
  1146. },
  1147. //省改变
  1148. onchangeProvince() {
  1149. this.axios
  1150. .post(
  1151. '/api/v1/uc/getDistrictByProvince?addressProvince=' + this.province
  1152. )
  1153. .then(res => {
  1154. this.cityList = res.data.data
  1155. })
  1156. },
  1157. //市改变
  1158. onchangeCity() {
  1159. this.axios
  1160. .post('/api/v1/uc/getTownByDistrict?addressDistrict=' + this.city)
  1161. .then(res => {
  1162. this.countyList = res.data.data
  1163. })
  1164. },
  1165. //县(区)改变
  1166. onchangeCounty() {
  1167. let mapValue = {
  1168. addressProvince: this.province,
  1169. addressDistrict: this.city,
  1170. addressTown: this.county
  1171. }
  1172. this.axios.post('/api/v1/uc/getPlaceByAllAddress', mapValue).then(res => {
  1173. this.addressId = res.data.data[0].addressId
  1174. })
  1175. },
  1176. //发货单位弹出层
  1177. handleSelectCarrier(item) {
  1178. this.shipperName = item.shipperName
  1179. this.shipperId = item.shipperId
  1180. },
  1181. //以下是发货单位边输边查搜索
  1182. querySearchCarrier(queryString, cb) {
  1183. this.axios
  1184. .post('/api/v1/uc/getRequireUnitName?index=' + queryString)
  1185. .then(res => {
  1186. if (res.data.code == '200') {
  1187. var restaurantsCarrier = res.data.data
  1188. var results = queryString
  1189. ? restaurantsCarrier.filter(this.createFilterCarrier(queryString))
  1190. : restaurantsCarrier
  1191. // 调用 callback 返回建议列表的数据
  1192. cb(results)
  1193. }
  1194. })
  1195. },
  1196. createFilterCarrier(queryString) {
  1197. return restaurantsCarrier => {
  1198. return (
  1199. restaurantsCarrier.shipperName
  1200. .toLowerCase()
  1201. .indexOf(queryString.toLowerCase()) > -1
  1202. )
  1203. }
  1204. },
  1205. //以上是发货单位边输边查搜索
  1206. //下单客户弹出层
  1207. handleSelectConsignee(item) {
  1208. this.consigneeName = item.consigneeCompanyName
  1209. this.consigneeId = item.consigneeId
  1210. //带出摘要
  1211. this.axios
  1212. .post('/api/v1/uc/getSaleArea?receiveId=' + this.consigneeId)
  1213. .then(res => {
  1214. this.remarks = res.data.data
  1215. })
  1216. this.axios
  1217. .post(
  1218. '/api/v1/ams/matchingAddressRecently?receiveId=' + this.consigneeId
  1219. )
  1220. .then(res => {
  1221. const place = res.data.data
  1222. console.log(place)
  1223. this.saleShipperAddressName =
  1224. place[0].addressProvince +
  1225. place[0].addressDistrict +
  1226. place[0].addressTown +
  1227. place[0].place
  1228. this.saleShipperAddressId = place[0].shipperAddressId
  1229. this.place1 = place[0].place
  1230. this.saleMan = place[0].salerId
  1231. this.saleOrderConsigneeTel = place[0].saleOrderConsigneeTel
  1232. })
  1233. },
  1234. //以下是下单客户边输边查搜索
  1235. querySearchConsignee(queryString, cb) {
  1236. this.axios
  1237. .post('/api/v1/uc/getConsigneeByLike?index=' + queryString)
  1238. .then(res => {
  1239. if (res.data.code == '200') {
  1240. var restaurantsConsignee = res.data.data
  1241. var results = queryString
  1242. ? restaurantsConsignee.filter(
  1243. this.createFilterConsignee(queryString)
  1244. )
  1245. : restaurantsConsignee
  1246. // 调用 callback 返回建议列表的数据
  1247. cb(results)
  1248. }
  1249. })
  1250. },
  1251. createFilterConsignee(queryString) {
  1252. return restaurantsConsignee => {
  1253. return (
  1254. restaurantsConsignee.value
  1255. .toLowerCase()
  1256. .indexOf(queryString.toLowerCase()) > -1
  1257. )
  1258. }
  1259. },
  1260. //以上是下单客户边输边查搜索
  1261. //新增物资
  1262. addMaterial() {
  1263. if (!this.shipperName) {
  1264. this.$message.warning('发货单位未填写!')
  1265. } else if (!this.consigneeName) {
  1266. this.$message.warning('下单客户未填写!')
  1267. } else if (!this.consigneeId) {
  1268. this.$message.error('请选择一个下单客户下拉框中的选项!')
  1269. } else if (!this.saleMan) {
  1270. this.$message.warning('业务员未选择!')
  1271. } else {
  1272. this.option.requestUrl =
  1273. '/api/v1/uc/getSteelMaterial?apiId=244&i=' + new Date()
  1274. this.table1 = true
  1275. }
  1276. },
  1277. //返回选中的物资信息
  1278. selectionChange(selection) {
  1279. this.materialList1 = []
  1280. this.materialList1 = selection
  1281. },
  1282. //确认新增物资
  1283. makeSureMaterial() {
  1284. this.onblur()
  1285. //记录是理重还是磅重
  1286. var getisPound = 1
  1287. this.materialList1.forEach(e => {
  1288. if (!e.materialSpecification) {
  1289. e.materialSpecification = ''
  1290. }
  1291. if (!e.materialModel) {
  1292. e.materialModel = ''
  1293. }
  1294. //判断物资是否为盘螺或非定尺
  1295. if (
  1296. e.materialName.includes('盘螺') ||
  1297. e.materialName.includes('乱尺') ||
  1298. e.materialName.includes('盘元') ||
  1299. e.materialName.includes('盘圆')
  1300. ) {
  1301. getisPound = 0
  1302. } else {
  1303. getisPound = 1
  1304. }
  1305. //若物资为带有盘螺、盘圆、盘元,默认无米数
  1306. if (
  1307. e.materialName.includes('盘螺') ||
  1308. e.materialName.includes('盘圆') ||
  1309. e.materialName.includes('盘元')
  1310. ) {
  1311. var addmap = {
  1312. materialName: e.materialName,
  1313. Specification: e.materialSpecification + e.materialModel,
  1314. materialCode: e.materialCode,
  1315. orderPlanWeight: null,
  1316. meterNumber: null,
  1317. isPound: getisPound,
  1318. //物资Id
  1319. materialId: e.materialId,
  1320. //无米数
  1321. haveMeter: 0
  1322. }
  1323. } else {
  1324. if (e.materialName.includes('米')) {
  1325. console.log(e.materialName.replace(/[^0-9]/gi, ''))
  1326. var addmap = {
  1327. materialName: e.materialName,
  1328. Specification: e.materialSpecification + e.materialModel,
  1329. materialCode: e.materialCode,
  1330. orderPlanWeight: null,
  1331. meterNumber: Number(e.materialName.replace(/[^0-9]/gi, '')),
  1332. isPound: getisPound,
  1333. //物资Id
  1334. materialId: e.materialId,
  1335. //有米数
  1336. haveMeter: 1,
  1337. isDisable: 1
  1338. }
  1339. } else {
  1340. var addmap = {
  1341. materialName: e.materialName,
  1342. Specification: e.materialSpecification + e.materialModel,
  1343. materialCode: e.materialCode,
  1344. orderPlanWeight: null,
  1345. meterNumber: null,
  1346. isPound: getisPound,
  1347. //物资Id
  1348. materialId: e.materialId,
  1349. //有米数
  1350. haveMeter: 1
  1351. }
  1352. }
  1353. }
  1354. this.materialList.push(addmap)
  1355. })
  1356. this.materialList1 = []
  1357. this.table1 = false
  1358. //初始化查询数据
  1359. ;(this.materialNameText = null),
  1360. (this.materialSpecificationText = null),
  1361. (this.materialModelText = null)
  1362. },
  1363. //删除物资行数据
  1364. deleteMaterialRow(index, rows) {
  1365. rows.splice(index, 1)
  1366. this.onblur()
  1367. },
  1368. //删除一车数据
  1369. deleteRow(index, rows) {
  1370. this.onblur()
  1371. //删除车序号相同的行
  1372. if (this.spanArr[index] == 1) {
  1373. //动态调整车序号
  1374. rows.forEach(e => {
  1375. if (rows[index].cxh < e.cxh) {
  1376. e.cxh -= 1
  1377. }
  1378. })
  1379. //最大车序号减1
  1380. this.maxCxh -= 1
  1381. }
  1382. rows.splice(index, 1)
  1383. //调用记录每一行的合并数的方法
  1384. this.getSpanArr(this.selectionList)
  1385. },
  1386. //准备生成部分订单
  1387. createACar() {
  1388. this.onblur()
  1389. let i = 0
  1390. this.materialList.forEach(e => {
  1391. if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
  1392. e.orderPlanWeight = null
  1393. i++
  1394. }
  1395. })
  1396. if (i != 0) {
  1397. this.$message.error('件数必填且请输入正整数')
  1398. return
  1399. }
  1400. this.materialList.forEach(e => {
  1401. if (e.materialName.includes('定尺')) {
  1402. if (!e.meterNumber) {
  1403. i++
  1404. }
  1405. }
  1406. })
  1407. if (i != 0) {
  1408. this.$message.error('定尺必须填写米数')
  1409. return
  1410. }
  1411. if (
  1412. !this.saleOrderConsigneeTel &&
  1413. this.ignoreSaleOrderConsigneeTel == 0
  1414. ) {
  1415. this.$confirm(
  1416. '收货客户电话未填写会导致无法接收车辆发货短信, 是否继续?',
  1417. '提示',
  1418. {
  1419. confirmButtonText: '确定',
  1420. cancelButtonText: '取消',
  1421. type: 'warning'
  1422. }
  1423. )
  1424. .then(() => {
  1425. this.ignoreSaleOrderConsigneeTel = 1
  1426. this.addMaterialToSaleOrder()
  1427. })
  1428. .catch(() => {
  1429. this.$message.info('已取消!')
  1430. })
  1431. } else {
  1432. this.addMaterialToSaleOrder()
  1433. }
  1434. },
  1435. //添加物资到订单
  1436. addMaterialToSaleOrder() {
  1437. this.onblur()
  1438. if (this.materialList.length == 0) {
  1439. this.$message.warning('请至少为这一车添加一个物资!')
  1440. } else if (!this.saleShipperAddressName && this.values == 'no') {
  1441. this.$message.warning('收货地址未填写!')
  1442. } else if (
  1443. this.materialList.length == 1 &&
  1444. this.materialList[0].carNumber != null
  1445. ) {
  1446. var eachOrderPlanWeight =
  1447. this.materialList[0].orderPlanWeight / this.materialList[0].carNumber
  1448. if (isIntegerNumber(eachOrderPlanWeight)) {
  1449. var e = this.materialList[0]
  1450. for (var i = 0; i < this.materialList[0].carNumber; i++) {
  1451. var addmap = {
  1452. cxh: this.maxCxh,
  1453. materialName: e.materialName,
  1454. Specification: e.Specification,
  1455. materialCode: e.materialCode,
  1456. orderPlanWeight: eachOrderPlanWeight,
  1457. meterNumber: e.meterNumber,
  1458. isPound: e.isPound,
  1459. saleShipperAddressId: this.saleShipperAddressId,
  1460. place: this.place1,
  1461. saleShipperAddressName: this.saleShipperAddressName,
  1462. saleDateOfReceipt: this.saleDateOfReceipt,
  1463. saleOrderConsigneeTel: this.saleOrderConsigneeTel,
  1464. truckRemark: this.truckRemark,
  1465. materialId: e.materialId,
  1466. haveMeter: e.haveMeter,
  1467. isDisable: e.isDisable
  1468. }
  1469. this.selectionList.push(addmap)
  1470. //最大车序号加1
  1471. this.maxCxh += 1
  1472. }
  1473. //清空materialList
  1474. this.materialList = []
  1475. //调用记录每一行的合并数的方法
  1476. this.getSpanArr(this.selectionList)
  1477. } else {
  1478. this.$message.warning('分配件数不是整数!')
  1479. }
  1480. } else {
  1481. this.materialList.forEach(e => {
  1482. var addmap = {
  1483. cxh: this.maxCxh,
  1484. materialName: e.materialName,
  1485. Specification: e.Specification,
  1486. materialCode: e.materialCode,
  1487. orderPlanWeight: e.orderPlanWeight,
  1488. meterNumber: e.meterNumber,
  1489. isPound: e.isPound,
  1490. saleShipperAddressId: this.saleShipperAddressId,
  1491. place: this.place1,
  1492. saleShipperAddressName: this.saleShipperAddressName,
  1493. saleDateOfReceipt: this.saleDateOfReceipt,
  1494. saleOrderConsigneeTel: this.saleOrderConsigneeTel,
  1495. truckRemark: this.truckRemark,
  1496. materialId: e.materialId,
  1497. haveMeter: e.haveMeter,
  1498. isDisable: e.isDisable
  1499. }
  1500. this.selectionList.push(addmap)
  1501. })
  1502. //清空materialList
  1503. this.materialList = []
  1504. //最大车序号加1
  1505. this.maxCxh += 1
  1506. //调用记录每一行的合并数的方法
  1507. this.getSpanArr(this.selectionList)
  1508. }
  1509. },
  1510. // 添加物资到某个车序号
  1511. addToCxh() {
  1512. this.onblur()
  1513. console.log('wkk')
  1514. if (!this.toCxh) {
  1515. this.$message.warning('请先在左侧输入要添加物资的车序号!')
  1516. } else {
  1517. this.addMaterialToCxh(this.toCxh)
  1518. }
  1519. },
  1520. //添加物资到某个车序号
  1521. addMaterialToCxh(toCxh) {
  1522. this.onblur()
  1523. let i = 0
  1524. this.materialList.forEach(e => {
  1525. if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
  1526. e.orderPlanWeight = null
  1527. i++
  1528. }
  1529. })
  1530. if (i != 0) {
  1531. this.$message.error('件数必填且请输入正整数')
  1532. return
  1533. }
  1534. this.materialList.forEach(e => {
  1535. if (e.materialName.includes('定尺')) {
  1536. if (!e.meterNumber) {
  1537. i++
  1538. }
  1539. }
  1540. })
  1541. if (i != 0) {
  1542. this.$message.error('定尺必须填写米数')
  1543. return
  1544. }
  1545. if (this.materialList.length == 0) {
  1546. this.$message.warning('请至少为这车序号添加一个物资!')
  1547. } else {
  1548. //保存当前车序号数据
  1549. var arr = this.selectionList
  1550. //清空原车序号数据
  1551. this.selectionList = []
  1552. //记录是否已经执行了新增物资插入操作
  1553. var alreadyAdd = 0
  1554. //获取新增物资应当插入的位置并插入
  1555. arr.forEach((item, index) => {
  1556. if (item.cxh <= toCxh) {
  1557. //插入到新增物资之前
  1558. this.selectionList.push(item)
  1559. } else {
  1560. //插入新增物资
  1561. if (alreadyAdd == 0) {
  1562. this.materialList.forEach(e => {
  1563. var addmap = {
  1564. cxh: this.selectionList[index - 1].cxh,
  1565. materialName: e.materialName,
  1566. Specification: e.Specification,
  1567. materialCode: e.materialCode,
  1568. orderPlanWeight: e.orderPlanWeight,
  1569. meterNumber: e.meterNumber,
  1570. isPound: e.isPound,
  1571. saleShipperAddressId: this.selectionList[index - 1]
  1572. .saleShipperAddressId,
  1573. place: this.selectionList[index - 1].place,
  1574. saleShipperAddressName: this.selectionList[index - 1]
  1575. .saleShipperAddressName,
  1576. saleDateOfReceipt: this.selectionList[index - 1]
  1577. .saleDateOfReceipt,
  1578. saleOrderConsigneeTel: this.selectionList[index - 1]
  1579. .saleOrderConsigneeTel,
  1580. materialId: e.materialId,
  1581. haveMeter: e.haveMeter,
  1582. isDisable: e.isDisable
  1583. }
  1584. this.selectionList.push(addmap)
  1585. })
  1586. //清空materialList
  1587. this.materialList = []
  1588. //设定为已经执行了车序号物资新增操作
  1589. alreadyAdd = 1
  1590. }
  1591. //插入到新增物资之后
  1592. this.selectionList.push(item)
  1593. }
  1594. })
  1595. //若添加的车序号为最后一个车序号
  1596. if (alreadyAdd == 0) {
  1597. //插入新增物资
  1598. console.log('1345wjj')
  1599. this.materialList.forEach(e => {
  1600. var addmap = {
  1601. cxh: arr[this.selectionList.length - 1].cxh,
  1602. materialName: e.materialName,
  1603. Specification: e.Specification,
  1604. materialCode: e.materialCode,
  1605. orderPlanWeight: e.orderPlanWeight,
  1606. meterNumber: e.meterNumber,
  1607. isPound: e.isPound,
  1608. saleShipperAddressId:
  1609. arr[this.selectionList.length - 1].saleShipperAddressId,
  1610. place: arr[this.selectionList.length - 1].place,
  1611. saleShipperAddressName:
  1612. arr[this.selectionList.length - 1].saleShipperAddressName,
  1613. saleDateOfReceipt:
  1614. arr[this.selectionList.length - 1].saleDateOfReceipt,
  1615. saleOrderConsigneeTel:
  1616. arr[this.selectionList.length - 1].saleOrderConsigneeTel,
  1617. materialId: e.materialId,
  1618. haveMeter: e.haveMeter,
  1619. isDisable: e.isDisable
  1620. }
  1621. this.selectionList.push(addmap)
  1622. })
  1623. //清空materialList
  1624. this.materialList = []
  1625. }
  1626. //调用记录每一行的合并数的方法
  1627. this.getSpanArr(this.selectionList)
  1628. }
  1629. },
  1630. //更改行物资
  1631. changeMaterial(index) {
  1632. this.option1.requestUrl =
  1633. '/api/v1/uc/getSteelMaterial?apiId=244&i=' + new Date()
  1634. this.drawer = true
  1635. this.isOpenDrawer = 1
  1636. this.indexChangeMaterial = index
  1637. },
  1638. //关闭更改行物资
  1639. closeChangeMaterial() {
  1640. this.drawer = false
  1641. this.isOpenDrawer = 0
  1642. this.$message.info('取消更改!')
  1643. },
  1644. //单选一行物资
  1645. currentRadioChange(row) {
  1646. this.selectedMaterialId = row.materialId
  1647. this.selectedMaterialName = row.materialName
  1648. this.selectedMaterialSpecification = row.materialSpecification
  1649. this.selectedMaterialModel = row.materialModel
  1650. this.selectedMaterialCode = row.materialCode
  1651. },
  1652. //确认物资修改
  1653. makeSureChange() {
  1654. this.onblur()
  1655. if (!this.selectedMaterialId) {
  1656. this.$message.warning('请先选择一个物资!')
  1657. } else {
  1658. if (!this.selectedMaterialSpecification) {
  1659. this.selectedMaterialSpecification = ''
  1660. }
  1661. if (!this.selectedMaterialModel) {
  1662. this.selectedMaterialModel = ''
  1663. }
  1664. //记录是理重还是磅重
  1665. var getisPound = 1
  1666. //判断物资是否为盘螺或非定尺
  1667. if (
  1668. this.selectedMaterialName.includes('盘螺') ||
  1669. this.selectedMaterialName.includes('乱尺') ||
  1670. this.selectedMaterialName.includes('盘元') ||
  1671. this.selectedMaterialName.includes('盘圆')
  1672. ) {
  1673. getisPound = 0
  1674. } else {
  1675. getisPound = 1
  1676. }
  1677. this.selectionList[
  1678. this.indexChangeMaterial
  1679. ].materialId = this.selectedMaterialId
  1680. this.selectionList[
  1681. this.indexChangeMaterial
  1682. ].materialName = this.selectedMaterialName
  1683. this.selectionList[this.indexChangeMaterial].Specification =
  1684. this.selectedMaterialSpecification + this.selectedMaterialModel
  1685. this.selectionList[
  1686. this.indexChangeMaterial
  1687. ].materialCode = this.selectedMaterialModel
  1688. this.selectionList[this.indexChangeMaterial].isPound = getisPound
  1689. //确定更改的物资有无米数
  1690. if (
  1691. this.selectedMaterialName.includes('盘螺') ||
  1692. this.selectedMaterialName.includes('盘圆') ||
  1693. this.selectedMaterialName.includes('盘元')
  1694. ) {
  1695. this.selectionList[this.indexChangeMaterial].haveMeter = 0
  1696. this.selectionList[this.indexChangeMaterial].meterNumber = null
  1697. } else {
  1698. this.selectionList[this.indexChangeMaterial].haveMeter = 1
  1699. }
  1700. //重新初始化
  1701. this.indexChangeMaterial = null
  1702. this.selectedMaterialId = null
  1703. this.selectedMaterialName = null
  1704. this.selectedMaterialSpecification = null
  1705. this.selectedMaterialModel = null
  1706. this.selectedMaterialCode = null
  1707. //关闭弹出框
  1708. this.drawer = false
  1709. this.isOpenDrawer = 0
  1710. //初始化查询数据
  1711. ;(this.materialNameText = null),
  1712. (this.materialSpecificationText = null),
  1713. (this.materialModelText = null)
  1714. this.$message.success('成功更改!')
  1715. }
  1716. },
  1717. //记录每一行的合并数
  1718. getSpanArr(data) {
  1719. //每次调用方法初始化
  1720. this.spanArr = []
  1721. for (var i = 0; i < data.length; i++) {
  1722. if (i === 0) {
  1723. this.spanArr.push(1)
  1724. this.pos = 0
  1725. } else {
  1726. // 判断当前元素与上一个元素是否相同
  1727. if (data[i].cxh === data[i - 1].cxh) {
  1728. this.spanArr[this.pos] += 1
  1729. this.spanArr.push(0)
  1730. } else {
  1731. this.spanArr.push(1)
  1732. this.pos = i
  1733. }
  1734. }
  1735. }
  1736. },
  1737. //根据条件合并行
  1738. cellMerge({ row, column, rowIndex, columnIndex }) {
  1739. if (columnIndex === 0) {
  1740. const _row = this.spanArr[rowIndex]
  1741. const _col = _row > 0 ? 1 : 0
  1742. return {
  1743. rowspan: _row,
  1744. colspan: _col
  1745. }
  1746. }
  1747. if (columnIndex === 6) {
  1748. const _row = this.spanArr[rowIndex]
  1749. const _col = _row > 0 ? 1 : 0
  1750. return {
  1751. rowspan: _row,
  1752. colspan: _col
  1753. }
  1754. }
  1755. if (columnIndex === 7) {
  1756. const _row = this.spanArr[rowIndex]
  1757. const _col = _row > 0 ? 1 : 0
  1758. return {
  1759. rowspan: _row,
  1760. colspan: _col
  1761. }
  1762. }
  1763. if (columnIndex === 8) {
  1764. const _row = this.spanArr[rowIndex]
  1765. const _col = _row > 0 ? 1 : 0
  1766. return {
  1767. rowspan: _row,
  1768. colspan: _col
  1769. }
  1770. }
  1771. if (columnIndex === 10) {
  1772. const _row = this.spanArr[rowIndex]
  1773. const _col = _row > 0 ? 1 : 0
  1774. return {
  1775. rowspan: _row,
  1776. colspan: _col
  1777. }
  1778. }
  1779. },
  1780. //点击外层收货地址浏览事件
  1781. ondrawerOut() {
  1782. if (this.inOrOut % 2 == 0) {
  1783. this.inOrOut += 1
  1784. }
  1785. this.frist.requestUrl =
  1786. '/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=' + new Date()
  1787. this.drawer1 = true
  1788. },
  1789. //点击内层收货地址浏览事件
  1790. ondrawer(row, index) {
  1791. if (this.inOrOut % 2 == 1) {
  1792. this.inOrOut += 1
  1793. }
  1794. this.row = row
  1795. this.row.index = index
  1796. this.frist.requestUrl =
  1797. '/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=' + new Date()
  1798. this.drawer1 = true
  1799. },
  1800. //查询全国省市县
  1801. selectAddresClick() {
  1802. if (this.addresText) {
  1803. this.frist.requestUrl =
  1804. '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=' +
  1805. this.addresText
  1806. } else {
  1807. this.frist.requestUrl =
  1808. '/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=' + new Date()
  1809. }
  1810. },
  1811. //收货地址弹出层
  1812. handleSelect1(item) {
  1813. console.log('获取所有下拉值!')
  1814. },
  1815. //以下是收货地址边输边查搜索
  1816. querySearch1(queryString, cb) {
  1817. this.axios
  1818. .post(
  1819. '/api/v1/ams/getRealAddressByLike?addressId=' +
  1820. this.addressId +
  1821. '&index=' +
  1822. queryString
  1823. )
  1824. .then(res => {
  1825. if (res.data.code == '200') {
  1826. var restaurants = res.data.data
  1827. var results = queryString
  1828. ? restaurants.filter(this.createFilter1(queryString))
  1829. : restaurants
  1830. // 调用 callback 返回建议列表的数据
  1831. cb(results)
  1832. }
  1833. })
  1834. },
  1835. createFilter1(queryString) {
  1836. return restaurants => {
  1837. return (
  1838. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  1839. -1
  1840. )
  1841. }
  1842. },
  1843. //以上是收货地址边输边查搜索
  1844. //监听收货地址模态框点击事件
  1845. currentRadioChange1(radioList) {
  1846. this.addressId = radioList.addressId
  1847. this.address = radioList.address
  1848. },
  1849. //确定收货地址事件
  1850. addAddressClick() {
  1851. //不管是外层还是内层都需要修改,如果存在都需要修改收货客户的电话
  1852. //定义一个正则表达式判断是否有电话
  1853. var est = /\d{11}/g
  1854. var string2 = this.place.match(est)
  1855. console.log('-----------这是抓取到的数据----------')
  1856. console.log(string2)
  1857. if (string2 != null) {
  1858. for (i = 0; i < string2.length; i++) {
  1859. var reg = /^1[3456789]\d{9}$/
  1860. if (reg.test(string2[i])) {
  1861. this.saleOrderConsigneeTel = string2
  1862. }
  1863. }
  1864. }
  1865. if (this.inOrOut % 2 == 0) {
  1866. for (
  1867. var i = this.row.index;
  1868. i < this.spanArr[this.row.index] + this.row.index;
  1869. i++
  1870. ) {
  1871. this.selectionList[i].saleShipperAddressId = this.addressId
  1872. this.selectionList[i].place = this.place
  1873. this.selectionList[i].saleShipperAddressName =
  1874. this.province + this.city + this.county + this.place
  1875. }
  1876. this.drawer1 = false
  1877. } else {
  1878. this.saleShipperAddressId = this.addressId
  1879. this.saleShipperAddressName =
  1880. this.province + this.city + this.county + this.place
  1881. this.drawer1 = false
  1882. }
  1883. //初始化
  1884. this.addressId = null
  1885. this.province = null
  1886. this.cityList = []
  1887. this.city = null
  1888. this.countyList = []
  1889. this.county = null
  1890. //暂存具体地址
  1891. this.place1 = this.place
  1892. this.place = null
  1893. this.addresText = null
  1894. },
  1895. //批量修改内层值
  1896. batchUpdateValue(row, index) {
  1897. for (var i = index; i < this.spanArr[index] + index; i++) {
  1898. this.selectionList[i].saleOrderConsigneeTel = row.saleOrderConsigneeTel
  1899. }
  1900. },
  1901. //物资模态框查询
  1902. onclick() {
  1903. if (this.isOpenDrawer == 0) {
  1904. this.option.requestUrl =
  1905. '/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=' +
  1906. this.materialNameText +
  1907. '&materialSpecificationText=' +
  1908. this.materialSpecificationText +
  1909. '&materialModelText=' +
  1910. this.materialModelText
  1911. } else {
  1912. this.option1.requestUrl =
  1913. '/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=' +
  1914. this.materialNameText +
  1915. '&materialSpecificationText=' +
  1916. this.materialSpecificationText +
  1917. '&materialModelText=' +
  1918. this.materialModelText
  1919. }
  1920. },
  1921. // 确定
  1922. async makeSure() {
  1923. if (this.selectionList.length == 0) {
  1924. this.$message.warning('请先填写具体信息')
  1925. return
  1926. }
  1927. let i = 0
  1928. this.selectionList.forEach(e => {
  1929. if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
  1930. e.orderPlanWeight = null
  1931. i++
  1932. }
  1933. })
  1934. let s = 0
  1935. //确认规格型号格式是否正确
  1936. await this.axios
  1937. .post('/api/v1/ams/queryFormat', this.selectionList)
  1938. .then(res => {
  1939. if (res.data.code == '500') {
  1940. s = 1
  1941. }
  1942. })
  1943. console.log('这是获取到的数据')
  1944. if (s == 1) {
  1945. this.$message.error('规格型号有问题,请重新输入')
  1946. return
  1947. }
  1948. if (i != 0) {
  1949. this.$message.error('件数必填且请输入正整数')
  1950. return
  1951. }
  1952. this.selectionList.forEach(e => {
  1953. if (e.materialName.includes('定尺')) {
  1954. if (!e.meterNumber) {
  1955. i++
  1956. }
  1957. }
  1958. })
  1959. if (i != 0) {
  1960. this.$message.error('定尺必须填写米数')
  1961. return
  1962. }
  1963. //获取是否自提字段
  1964. this.options.forEach(e => {
  1965. if (this.values == e.values) {
  1966. this.saleOrderIsselfMention = e.label
  1967. }
  1968. })
  1969. //获取收款公司字段
  1970. this.receivingCompany.forEach(f => {
  1971. if (this.values1 == f.values1) {
  1972. this.saleOrderReceiveCustomer = f.label1
  1973. }
  1974. })
  1975. //获取业务员姓名
  1976. this.saleMans.forEach(g => {
  1977. if (this.saleMan == g.value) {
  1978. this.saleManText = g.label
  1979. }
  1980. })
  1981. this.orderMakeSure = true
  1982. },
  1983. async getlist() {
  1984. let res = await this.axios.post(
  1985. '/api/v1/ams/queryMaterial',
  1986. this.selectionList
  1987. )
  1988. this.selectionList = res.data.data
  1989. console.log('这是查询出来的')
  1990. console.log(res.data.data)
  1991. console.log('这是修改后的数据')
  1992. console.log(this.selectionList)
  1993. },
  1994. //发送请求
  1995. async sendRequest() {
  1996. //根据规格型号与物资名称获取对应的物资ID||确认规格型号格式是否正确
  1997. //先把暂存区的数据清空
  1998. this.temporarylist = []
  1999. let flag = 0
  2000. await this.axios
  2001. .post('/api/v1/ams/queryMaterial', this.selectionList)
  2002. .then(res => {
  2003. if (res.data.code === '500') {
  2004. flag = 1
  2005. }
  2006. console.log(res.data.code)
  2007. //给暂存区的数据赋值
  2008. this.temporarylist = res.data.data
  2009. console.log('以下是查询出来的数据')
  2010. console.log(res.data.data)
  2011. })
  2012. if (flag === 1) {
  2013. this.$message.error('规格型号不对')
  2014. return
  2015. }
  2016. //先调删除订单接口
  2017. this.axios
  2018. .post(
  2019. '/api/v1/ams/deleteSaleOrderById?saleOrderId=' +
  2020. this.$route.params.saleOrderId
  2021. )
  2022. .then(res => {
  2023. if (res.data.code == '200') {
  2024. this.orderMakeSure = false
  2025. //是否还有件数未填写
  2026. var orderPlanWeightAllFill = 0
  2027. //初始化maplist
  2028. this.selectionList = this.temporarylist
  2029. var mapList = []
  2030. this.selectionList.forEach(item => {
  2031. if (!item.orderPlanWeight) {
  2032. orderPlanWeightAllFill++
  2033. }
  2034. //初始化mapItem
  2035. var mapItem = {
  2036. //车序号
  2037. truckNo: 0,
  2038. //省市县id
  2039. shipperAddressId: 0,
  2040. //具体地址
  2041. place: null,
  2042. //截止日期
  2043. saleDateOfReceipt: null,
  2044. //收货方电话
  2045. saleOrderConsigneeTel: '',
  2046. //车序号物资ID
  2047. materialId: 0,
  2048. //物资件数
  2049. materialNumber: 0,
  2050. //米数
  2051. steelMeters: 0,
  2052. //是否磅重销售
  2053. isPoundSale: 0,
  2054. truckRemark: null
  2055. }
  2056. mapItem.truckNo = item.cxh
  2057. mapItem.shipperAddressId = item.saleShipperAddressId
  2058. mapItem.place = item.place
  2059. mapItem.saleDateOfReceipt = sjTime(item.saleDateOfReceipt)
  2060. mapItem.saleOrderConsigneeTel = item.saleOrderConsigneeTel
  2061. mapItem.materialId = item.materialId
  2062. mapItem.materialNumber = item.orderPlanWeight
  2063. mapItem.steelMeters = item.meterNumber
  2064. mapItem.isPoundSale = item.isPound
  2065. mapItem.truckRemark = item.truckRemark
  2066. mapList.push(mapItem)
  2067. })
  2068. let mapValue = {
  2069. shipperId: this.shipperId,
  2070. receiveId: this.consigneeId,
  2071. isSelfMention: this.saleOrderIsselfMention,
  2072. saleOrderReceiveCustomer: this.saleOrderReceiveCustomer,
  2073. salerId: this.saleMan,
  2074. saleRemark: this.remarks,
  2075. mapList: mapList
  2076. }
  2077. //所有列件数都填写
  2078. if (orderPlanWeightAllFill == 0) {
  2079. this.axios
  2080. .post('/api/v1/ams/addSteelSaleOrder', mapValue)
  2081. .then(res => {
  2082. if (res.data.code == '200') {
  2083. this.$router.go(-1)
  2084. }
  2085. this.$message.success('修改订单成功!')
  2086. })
  2087. } else {
  2088. this.$message.error('还有物资件数未填写!')
  2089. }
  2090. } else {
  2091. this.$message.error('修改订单失败,请联系管理员!')
  2092. }
  2093. })
  2094. },
  2095. // 取消
  2096. cancel() {
  2097. this.$router.go(-1)
  2098. },
  2099. //关闭事件
  2100. handleClose(done) {
  2101. this.$confirm('确认关闭?')
  2102. .then(_ => {
  2103. done()
  2104. })
  2105. .catch(_ => {})
  2106. },
  2107. CloseClick() {},
  2108. //点击事件(上)
  2109. clicks(index) {
  2110. console.log(index)
  2111. console.log(this.materialList)
  2112. console.log(this.materialList.length - 1)
  2113. console.log('clicks=e', arguments)
  2114. if (index == 0) {
  2115. console.log('向上1')
  2116. //this.datalistindex=this.materialTableTop.length-1
  2117. document
  2118. .getElementById('input' + (this.materialList.length - 1))
  2119. .focus()
  2120. } else {
  2121. console.log('向上2')
  2122. //this.$refs.materialTableTop.bodyWrapper.scrollTop=index
  2123. document.getElementById('input' + (index - 1)).focus()
  2124. }
  2125. },
  2126. //点击事件(下)
  2127. clickx(index) {
  2128. console.log(index)
  2129. console.log(this.materialList)
  2130. console.log(this.materialList.length - 1)
  2131. if (index == this.materialList.length - 1) {
  2132. console.log('向下1')
  2133. document.getElementById('input' + 0).focus()
  2134. } else {
  2135. console.log('向下2')
  2136. //this.datalistindex+=1
  2137. //this.$refs.materialTableTop.bodyWrapper.scrollTop=(index+1)*height
  2138. //var tbl=document.getElementById("table").childNodes[0]
  2139. //tbl.childNodes[len].childNodes[0].childNodes[0].focus()children[3]
  2140. //const rowlist=this.$refs.materialTableTop.$el.children[3].children[1].children[0]
  2141. //.children[1].children[len].children[3].children[0].children[0].children[0].focus()
  2142. //console.log(rowlist)
  2143. var nextInput = document.getElementById('input' + (index + 1))
  2144. nextInput.focus()
  2145. }
  2146. }
  2147. }
  2148. }
  2149. </script>
  2150. <style lang="scss" scoped>
  2151. .addSalePlan {
  2152. width: 100%;
  2153. }
  2154. .el-drawer__body {
  2155. overflow: auto;
  2156. }
  2157. .el-drawer__container ::-webkit-scrollbar {
  2158. display: none;
  2159. }
  2160. .form-box,
  2161. .from {
  2162. display: flex;
  2163. align-items: center;
  2164. justify-content: center;
  2165. margin-top: 5px;
  2166. margin-bottom: 20px;
  2167. }
  2168. .button-box {
  2169. display: flex;
  2170. text-align: center;
  2171. align-items: center;
  2172. justify-content: center;
  2173. margin-top: 0.3125rem;
  2174. margin-bottom: 1.25rem;
  2175. }
  2176. .select {
  2177. margin-left: -10rem;
  2178. }
  2179. .demo-form-inline {
  2180. margin-left: 2rem;
  2181. }
  2182. .table_form {
  2183. margin-left: -16rem;
  2184. }
  2185. .textinput111 {
  2186. width: 83px;
  2187. }
  2188. .textinput {
  2189. width: 50px;
  2190. }
  2191. .textinput1 {
  2192. width: 50px;
  2193. text-align: center;
  2194. size: small;
  2195. }
  2196. .textinput2 {
  2197. width: 50px;
  2198. margin-right: 30px;
  2199. }
  2200. .textinput3 {
  2201. width: 190px;
  2202. }
  2203. .textinput4 {
  2204. width: 60px;
  2205. }
  2206. .textinput5 {
  2207. width: 120px;
  2208. }
  2209. </style>