editSaleOrder.vue 68 KB

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