editSaleOrder.vue 61 KB

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