addSaleOrder.vue 71 KB

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