addSaleOrder.vue 69 KB

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