addSaleOrder.vue 56 KB

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