editSaleOrder.vue 60 KB

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