addSaleOrder.vue 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290
  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: "dzgt",
  885. saleMan: null,
  886. saleManText: null,
  887. saleMans: [],
  888. tableTop: [
  889. {
  890. prop: "cxh",
  891. label: "车序号",
  892. width: "50px"
  893. },
  894. {
  895. prop: "materialName",
  896. label: "物资名称",
  897. width: "300px",
  898. slot: true
  899. },
  900. {
  901. prop: "meterNumber",
  902. label: "米数",
  903. width: "60px",
  904. slot: true
  905. },
  906. {
  907. prop: "Specification",
  908. label: "规格型号",
  909. width: "140px",
  910. slot: true
  911. },
  912. {
  913. prop: "orderPlanWeight",
  914. label: "件数",
  915. width: "60px",
  916. slot: true
  917. },
  918. {
  919. prop: "isPound",
  920. label: "是否磅重销售",
  921. width: "80px",
  922. slot: true
  923. },
  924. {
  925. prop: "saleShipperAddressName",
  926. label: "收货地址",
  927. width: "400px",
  928. slot: true
  929. },
  930. {
  931. prop: "saleOrderConsigneeTel",
  932. label: "收货客户电话",
  933. width: "120px",
  934. slot: true
  935. },
  936. {
  937. prop: "truckRemark",
  938. label: "备注",
  939. slot: true
  940. }
  941. ],
  942. row: {},
  943. //打开更改改物资弹出框
  944. drawer: false,
  945. //记录为内层打开
  946. isOpenDrawer: 0,
  947. //记录修改物资单选行的位置
  948. indexChangeMaterial: null,
  949. //记录单选物资Id
  950. selectedMaterialId: null,
  951. //记录单选物资名称
  952. selectedMaterialName: null,
  953. //记录单选物资规格
  954. selectedMaterialSpecification: null,
  955. //记录单选物资型号
  956. selectedMaterialModel: null,
  957. //记录单选物资编码
  958. selectedMaterialCode: null,
  959. //订单确认
  960. orderMakeSure: false,
  961. //是否自提记录字段
  962. saleOrderIsselfMention: null,
  963. //收款公司
  964. saleOrderReceiveCustomer: null,
  965. //是否忽视收货客户电话字段
  966. ignoreSaleOrderConsigneeTel: 0,
  967. restaurants: [],
  968. saleAreaId: null,
  969. isNiTui: 0,
  970. datalistindex: 0,
  971. temporarylist: []
  972. };
  973. },
  974. created() {
  975. let loadTime1 = new Date(
  976. new Date(new Date().toLocaleDateString()).getTime() +
  977. (3600 * 1000 * 8 - 1)
  978. ); // 当天8点前
  979. let loadTime2 = new Date(
  980. new Date(new Date().toLocaleDateString()).getTime() +
  981. (3600 * 1000 * 32 - 1)
  982. ); // 次天8点前
  983. if (new Date().getTime() - loadTime1 > 0) {
  984. this.saleDateOfReceipt = loadTime2;
  985. } else {
  986. this.saleDateOfReceipt = loadTime1;
  987. }
  988. //获取所有的省
  989. this.getAllProvince();
  990. //获取所有的业务员
  991. this.getAllsaleMan();
  992. },
  993. mounted() {
  994. if (getCookie("orgCode") == "shouhuokehu") {
  995. this.consigneeDisable = true;
  996. this.axios
  997. .get("/api/v1/uc/getConsigneeByuserid?userId=" + getCookie("userId"))
  998. .then(res => {
  999. console.log(res);
  1000. if (res.status == 200) {
  1001. console.log(res.data);
  1002. this.consigneeName = res.data.consigneeCompanyName;
  1003. this.consigneeId = res.data.consigneeId;
  1004. //带出摘要
  1005. this.axios
  1006. .post("/api/v1/uc/getSaleArea?receiveId=" + this.consigneeId)
  1007. .then(res => {
  1008. this.remarks = res.data.data;
  1009. });
  1010. this.axios
  1011. .post(
  1012. "/api/v1/ams/matchingAddressRecently?receiveId=" +
  1013. this.consigneeId
  1014. )
  1015. .then(res => {
  1016. this.restaurants = res.data.data;
  1017. const place = res.data.data;
  1018. this.saleShipperAddressName =
  1019. place[0].addressProvince +
  1020. place[0].addressDistrict +
  1021. place[0].addressTown +
  1022. place[0].place;
  1023. this.saleShipperAddressId = place[0].shipperAddressId;
  1024. this.place1 = place[0].place;
  1025. this.saleMan = place[0].salerId;
  1026. this.saleOrderConsigneeTel = place[0].saleOrderConsigneeTel;
  1027. });
  1028. }
  1029. });
  1030. }
  1031. },
  1032. methods: {
  1033. handleSelectSaleArea(item) {
  1034. this.saleAreaId = item.areaId;
  1035. this.remarks = item.value;
  1036. },
  1037. onclikSaleArea() {
  1038. if (this.saleAreaId == null) {
  1039. this.$message.warning("请先选择片区");
  1040. return;
  1041. }
  1042. this.axios
  1043. .post("/api/v1/uc/bandSaleArea", {
  1044. areaId: this.saleAreaId,
  1045. receiveId: this.consigneeId
  1046. })
  1047. .then(res => {
  1048. if (res.data.code == "200") {
  1049. this.$message.success("绑定片区成功");
  1050. this.isHaveArea = false;
  1051. } else {
  1052. this.$message.error("绑定片区失败");
  1053. this.isHaveArea = false;
  1054. }
  1055. })
  1056. .catch(() => {
  1057. this.$message.error("绑定片区失败");
  1058. this.isHaveArea = false;
  1059. });
  1060. },
  1061. isReceiveHaveArea(receiveId) {
  1062. this.axios
  1063. .post("/api/v1/uc/isReceiveHaveArea?receiveId=" + receiveId)
  1064. .then(res => {
  1065. if (res.data.code == "201") {
  1066. this.isHaveArea = true;
  1067. }
  1068. });
  1069. },
  1070. querySearchSaleArea(queryString, cb) {
  1071. this.axios
  1072. .post("/api/v1/uc/getSaleAreaByLike?index=" + queryString)
  1073. .then(res => {
  1074. var restaurants = res.data.data;
  1075. console.log(restaurants);
  1076. var results = queryString
  1077. ? restaurants.filter(this.createStateFilterSaleArea(queryString))
  1078. : restaurants;
  1079. cb(results);
  1080. });
  1081. },
  1082. createStateFilterSaleArea(queryString) {
  1083. return restaurants => {
  1084. return (
  1085. restaurants.label.toLowerCase().indexOf(queryString.toLowerCase()) >
  1086. -1
  1087. );
  1088. };
  1089. },
  1090. handleSelectAddress(item) {
  1091. this.saleShipperAddressName = item.addressPlace;
  1092. this.province = item.addressProvince;
  1093. this.city = item.addressDistrict;
  1094. this.county = item.addressTown;
  1095. this.saleShipperAddressId = item.shipperAddressId;
  1096. this.addressId = item.shipperAddressId;
  1097. this.place1 = item.place;
  1098. this.saleOrderConsigneeTel = item.saleOrderConsigneeTel;
  1099. },
  1100. querySearchAddress(queryString, cb) {
  1101. if (this.consigneeId != null) {
  1102. this.axios
  1103. .post(
  1104. "/api/v1/ams/matchingAddressRecently?receiveId=" + this.consigneeId
  1105. )
  1106. .then(res => {
  1107. var restaurants = res.data.data;
  1108. console.log(restaurants);
  1109. var results = queryString
  1110. ? restaurants.filter(this.createStateFilter(queryString))
  1111. : restaurants;
  1112. cb(results);
  1113. });
  1114. }
  1115. },
  1116. createStateFilter(queryString) {
  1117. return restaurants => {
  1118. return (
  1119. restaurants.addressPlace
  1120. .toLowerCase()
  1121. .indexOf(queryString.toLowerCase()) > -1
  1122. );
  1123. };
  1124. },
  1125. onblur() {
  1126. this.isCellClick = 0;
  1127. },
  1128. goclick() {
  1129. this.isCellClick = 1;
  1130. },
  1131. rowDbClick1(row) {
  1132. this.selectedMaterialId = row.materialId;
  1133. this.selectedMaterialName = row.materialName;
  1134. this.selectedMaterialSpecification = row.materialSpecification;
  1135. this.selectedMaterialModel = row.materialModel;
  1136. this.selectedMaterialCode = row.materialCode;
  1137. this.makeSureChange();
  1138. },
  1139. rowDbClick(row) {
  1140. this.materialList1 = [];
  1141. this.materialList1.push(row);
  1142. this.makeSureMaterial();
  1143. },
  1144. //获取所有的业务员数据
  1145. getAllsaleMan() {
  1146. this.axios.get("/api/v1/uc/getSalerList").then(res => {
  1147. this.saleMans = res.data.data;
  1148. });
  1149. },
  1150. //获取所有省数据
  1151. getAllProvince() {
  1152. this.axios.post("/api/v1/uc/getAllProvince").then(res => {
  1153. this.provinceList = res.data.data;
  1154. });
  1155. },
  1156. //省改变
  1157. onchangeProvince() {
  1158. this.axios
  1159. .post(
  1160. "/api/v1/uc/getDistrictByProvince?addressProvince=" +
  1161. this.province +
  1162. "&i=" +
  1163. new Date()
  1164. )
  1165. .then(res => {
  1166. this.cityList = res.data.data;
  1167. // this.city = "";
  1168. // this.county = "";
  1169. });
  1170. },
  1171. //市改变
  1172. onchangeCity() {
  1173. this.axios
  1174. .post(
  1175. "/api/v1/uc/getTownByDistrict?addressDistrict=" +
  1176. this.city +
  1177. "&i=" +
  1178. new Date()
  1179. )
  1180. .then(res => {
  1181. this.countyList = res.data.data;
  1182. });
  1183. },
  1184. //县(区)改变
  1185. onchangeCounty() {
  1186. let mapValue = {
  1187. addressProvince: this.province,
  1188. addressDistrict: this.city,
  1189. addressTown: this.county
  1190. };
  1191. this.axios.post("/api/v1/uc/getPlaceByAllAddress", mapValue).then(res => {
  1192. this.addressId = res.data.data[0].addressId;
  1193. });
  1194. },
  1195. //发货单位弹出层
  1196. handleSelectCarrier(item) {
  1197. this.shipperName = item.shipperName;
  1198. this.shipperId = item.shipperId;
  1199. },
  1200. //以下是发货单位边输边查搜索
  1201. querySearchCarrier(queryString, cb) {
  1202. this.axios
  1203. .post("/api/v1/uc/getRequireUnitName?index=" + queryString)
  1204. .then(res => {
  1205. if (res.data.code == "200") {
  1206. var restaurantsCarrier = res.data.data;
  1207. var results = queryString
  1208. ? restaurantsCarrier.filter(this.createFilterCarrier(queryString))
  1209. : restaurantsCarrier;
  1210. // 调用 callback 返回建议列表的数据
  1211. cb(results);
  1212. }
  1213. });
  1214. },
  1215. createFilterCarrier(queryString) {
  1216. return restaurantsCarrier => {
  1217. return (
  1218. restaurantsCarrier.shipperName
  1219. .toLowerCase()
  1220. .indexOf(queryString.toLowerCase()) > -1
  1221. );
  1222. };
  1223. },
  1224. //以上是发货单位边输边查搜索
  1225. //下单客户弹出层
  1226. handleSelectConsignee(item) {
  1227. this.saleShipperAddressName = null;
  1228. this.saleShipperAddressId = null;
  1229. this.addressId = null;
  1230. this.place1 = null;
  1231. this.saleMan = null;
  1232. this.saleOrderConsigneeTel = null;
  1233. this.province = null;
  1234. this.city = null;
  1235. this.county = null;
  1236. this.consigneeName = item.consigneeCompanyName;
  1237. this.consigneeId = item.consigneeId;
  1238. this.isReceiveHaveArea(this.consigneeId);
  1239. //带出摘要
  1240. this.axios
  1241. .post("/api/v1/uc/getSaleArea?receiveId=" + this.consigneeId)
  1242. .then(res => {
  1243. this.remarks = res.data.data;
  1244. });
  1245. this.axios
  1246. .post(
  1247. "/api/v1/ams/matchingAddressRecently?receiveId=" + this.consigneeId
  1248. )
  1249. .then(res => {
  1250. const place = res.data.data;
  1251. console.log(place);
  1252. this.saleShipperAddressName =
  1253. place[0].addressProvince +
  1254. place[0].addressDistrict +
  1255. place[0].addressTown +
  1256. place[0].place;
  1257. this.saleShipperAddressId = place[0].shipperAddressId;
  1258. this.addressId = place[0].shipperAddressId;
  1259. this.place1 = place[0].place;
  1260. this.saleMan = place[0].salerId;
  1261. this.saleOrderConsigneeTel = place[0].saleOrderConsigneeTel;
  1262. this.province = place[0].addressProvince;
  1263. this.city = place[0].addressDistrict;
  1264. this.county = place[0].addressTown;
  1265. });
  1266. },
  1267. //以下是下单客户边输边查搜索
  1268. querySearchConsignee(queryString, cb) {
  1269. this.axios
  1270. .post("/api/v1/uc/getConsigneeByLike?index=" + queryString)
  1271. .then(res => {
  1272. if (res.data.code == "200") {
  1273. var restaurantsConsignee = res.data.data;
  1274. var results = queryString
  1275. ? restaurantsConsignee.filter(
  1276. this.createFilterConsignee(queryString)
  1277. )
  1278. : restaurantsConsignee;
  1279. // 调用 callback 返回建议列表的数据
  1280. cb(results);
  1281. }
  1282. });
  1283. },
  1284. createFilterConsignee(queryString) {
  1285. return restaurantsConsignee => {
  1286. return (
  1287. restaurantsConsignee.value
  1288. .toLowerCase()
  1289. .indexOf(queryString.toLowerCase()) > -1
  1290. );
  1291. };
  1292. },
  1293. //以上是下单客户边输边查搜索
  1294. //新增物资
  1295. addMaterial() {
  1296. if (!this.shipperName) {
  1297. this.$message.warning("发货单位未填写!");
  1298. } else if (!this.consigneeName) {
  1299. this.$message.warning("下单客户未填写!");
  1300. } else if (!this.consigneeId) {
  1301. this.$message.error("请选择一个下单客户下拉框中的选项!");
  1302. } else if (!this.saleMan) {
  1303. this.$message.warning("业务员未选择!");
  1304. } else {
  1305. this.option.requestUrl =
  1306. "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
  1307. this.materialNameText = null;
  1308. this.materialSpecificationText = null;
  1309. this.table1 = true;
  1310. }
  1311. },
  1312. //返回选中的物资信息
  1313. selectionChange(selection) {
  1314. this.materialList1 = [];
  1315. this.materialList1 = selection;
  1316. },
  1317. //确认新增物资
  1318. makeSureMaterial() {
  1319. //记录是理重还是磅重
  1320. var getisPound = 1;
  1321. this.materialList1.forEach(e => {
  1322. if (!e.materialSpecification) {
  1323. e.materialSpecification = "";
  1324. }
  1325. if (!e.materialModel) {
  1326. e.materialModel = "";
  1327. }
  1328. //判断物资是否为盘螺或非定尺
  1329. if (
  1330. e.materialName.includes("盘螺") ||
  1331. e.materialName.includes("乱尺") ||
  1332. e.materialName.includes("盘元") ||
  1333. e.materialName.includes("盘圆")
  1334. ) {
  1335. getisPound = 0;
  1336. } else {
  1337. getisPound = 1;
  1338. }
  1339. //若物资为带有盘螺、盘圆、盘元,默认无米数
  1340. if (
  1341. e.materialName.includes("盘螺") ||
  1342. e.materialName.includes("盘圆") ||
  1343. e.materialName.includes("盘元")
  1344. ) {
  1345. var addmap = {
  1346. materialName: e.materialName,
  1347. Specification: e.materialSpecification + e.materialModel,
  1348. materialCode: e.materialCode,
  1349. orderPlanWeight: null,
  1350. meterNumber: null,
  1351. isPound: getisPound,
  1352. //物资Id
  1353. materialId: e.materialId,
  1354. //无米数
  1355. haveMeter: 0
  1356. };
  1357. } else {
  1358. if (e.materialName.includes("米")) {
  1359. var addmap = {
  1360. materialName: e.materialName,
  1361. Specification: e.materialSpecification + e.materialModel,
  1362. materialCode: e.materialCode,
  1363. orderPlanWeight: null,
  1364. meterNumber: Number(e.materialName.replace(/[^0-9]/gi, "")),
  1365. isPound: getisPound,
  1366. //物资Id
  1367. materialId: e.materialId,
  1368. //有米数
  1369. haveMeter: 1,
  1370. isDisable: 1
  1371. };
  1372. } else {
  1373. var addmap = {
  1374. materialName: e.materialName,
  1375. Specification: e.materialSpecification + e.materialModel,
  1376. materialCode: e.materialCode,
  1377. orderPlanWeight: null,
  1378. meterNumber: null,
  1379. isPound: getisPound,
  1380. //物资Id
  1381. materialId: e.materialId,
  1382. //有米数
  1383. haveMeter: 1
  1384. };
  1385. }
  1386. }
  1387. this.materialList.push(addmap);
  1388. });
  1389. this.materialList1 = [];
  1390. this.table1 = false;
  1391. //初始化查询数据
  1392. this.materialNameText = null;
  1393. this.materialSpecificationText = null;
  1394. this.materialModelText = null;
  1395. this.onblur();
  1396. },
  1397. //删除物资行数据
  1398. deleteMaterialRow(index, rows) {
  1399. rows.splice(index, 1);
  1400. this.onblur();
  1401. },
  1402. //删除一车数据
  1403. deleteRow(index, rows) {
  1404. //删除车序号相同的行
  1405. if (this.spanArr[index] == 1) {
  1406. //动态调整车序号
  1407. rows.forEach(e => {
  1408. if (rows[index].cxh < e.cxh) {
  1409. e.cxh -= 1;
  1410. }
  1411. });
  1412. //最大车序号减1
  1413. this.maxCxh -= 1;
  1414. }
  1415. rows.splice(index, 1);
  1416. //调用记录每一行的合并数的方法
  1417. this.getSpanArr(this.selectionList);
  1418. },
  1419. copyRow(index, row) {
  1420. let copyRow = new Object();
  1421. Object.keys(row).forEach(key => {
  1422. copyRow[key] = row[key];
  1423. });
  1424. copyRow.cxh = this.maxCxh;
  1425. this.selectionList.push(copyRow);
  1426. this.getSpanArr(this.selectionList);
  1427. this.maxCxh++;
  1428. },
  1429. copyRowflu(index, row) {
  1430. console.log(index);
  1431. let copyRowflu = new Object();
  1432. Object.keys(row).forEach(key => {
  1433. copyRowflu[key] = row[key];
  1434. });
  1435. this.selectionList.splice(index + 1, 0, copyRowflu);
  1436. // this.selectionList.push(copyRowflu);
  1437. this.getSpanArr(this.selectionList);
  1438. },
  1439. copyRowfluAll(index, row) {
  1440. let arr = [];
  1441. //复制整车,根据车序号去寻找相同的列
  1442. arr = this.selectionList.concat([]).filter((item, index) => {
  1443. return item.cxh == row.cxh;
  1444. });
  1445. arr.forEach(e => {
  1446. let copyRow = new Object();
  1447. Object.keys(e).forEach(key => {
  1448. copyRow[key] = e[key];
  1449. });
  1450. copyRow.cxh = this.maxCxh;
  1451. this.selectionList.push(copyRow);
  1452. });
  1453. this.getSpanArr(this.selectionList);
  1454. this.maxCxh++;
  1455. },
  1456. singleDistribute() {
  1457. let ml = this.materialList.length;
  1458. if (ml == 0) {
  1459. this.$message.warning("请至少填入一车物资");
  1460. return;
  1461. }
  1462. let singleArr = this.materialList;
  1463. this.$confirm(
  1464. `以上${ml}车物资将分配到不同的${ml}车,确定继续分配?`,
  1465. "提醒",
  1466. {
  1467. cancelButtonText: "取消",
  1468. confirmButtonText: "确定",
  1469. center: true
  1470. }
  1471. ).then(() => {
  1472. this.creatArtSingle(singleArr);
  1473. });
  1474. this.isNiTui = 0;
  1475. },
  1476. async creatArtSingle(singleArr) {
  1477. let i = 0;
  1478. singleArr.forEach(e => {
  1479. if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
  1480. e.orderPlanWeight = null;
  1481. i++;
  1482. }
  1483. });
  1484. if (i != 0) {
  1485. this.$message.error("件数必填且请输入正整数");
  1486. return;
  1487. }
  1488. singleArr.forEach(e => {
  1489. if (e.materialName.includes("定尺")) {
  1490. if (!e.meterNumber) {
  1491. i++;
  1492. }
  1493. }
  1494. });
  1495. if (i != 0) {
  1496. this.$message.error("定尺必须填写米数");
  1497. return;
  1498. }
  1499. if (
  1500. !this.saleOrderConsigneeTel &&
  1501. this.ignoreSaleOrderConsigneeTel == 0
  1502. ) {
  1503. this.$confirm(
  1504. "收货客户电话未填写会导致无法接收车辆发货短信, 是否继续?",
  1505. "提示",
  1506. {
  1507. confirmButtonText: "确定",
  1508. cancelButtonText: "取消",
  1509. type: "warning"
  1510. }
  1511. )
  1512. .then(() => {
  1513. this.ignoreSaleOrderConsigneeTel = 1;
  1514. this.addMaterialToSaleOrderSingle();
  1515. })
  1516. .catch(() => {
  1517. this.$message.info("已取消!");
  1518. });
  1519. } else {
  1520. this.addMaterialToSaleOrderSingle();
  1521. }
  1522. },
  1523. addMaterialToSaleOrderSingle() {
  1524. this.materialList.forEach(e => {
  1525. var addmap = {
  1526. cxh: this.maxCxh,
  1527. materialName: e.materialName,
  1528. Specification: e.Specification,
  1529. materialCode: e.materialCode,
  1530. orderPlanWeight: e.orderPlanWeight,
  1531. meterNumber: e.meterNumber,
  1532. isPound: e.isPound,
  1533. saleShipperAddressId: this.saleShipperAddressId,
  1534. place: this.place1,
  1535. saleShipperAddressName: this.saleShipperAddressName,
  1536. saleDateOfReceipt: this.saleDateOfReceipt,
  1537. saleOrderConsigneeTel: this.saleOrderConsigneeTel,
  1538. truckRemark: this.truckRemark,
  1539. materialId: e.materialId,
  1540. haveMeter: e.haveMeter,
  1541. isDisable: e.isDisable
  1542. };
  1543. console.log(addmap);
  1544. this.selectionList.push(addmap);
  1545. //最大车序号加1
  1546. this.maxCxh += 1;
  1547. this.onblur();
  1548. });
  1549. this.materialList = [];
  1550. this.getSpanArr(this.selectionList);
  1551. },
  1552. //准备生成部分订单
  1553. createACar() {
  1554. let i = 0;
  1555. this.materialList.forEach(e => {
  1556. if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
  1557. e.orderPlanWeight = null;
  1558. i++;
  1559. }
  1560. });
  1561. if (i != 0) {
  1562. this.$message.error("件数必填且请输入正整数");
  1563. return;
  1564. }
  1565. this.materialList.forEach(e => {
  1566. if (e.materialName.includes("定尺")) {
  1567. if (!e.meterNumber) {
  1568. i++;
  1569. }
  1570. }
  1571. });
  1572. if (i != 0) {
  1573. this.$message.error("定尺必须填写米数");
  1574. return;
  1575. }
  1576. if (
  1577. !this.saleOrderConsigneeTel &&
  1578. this.ignoreSaleOrderConsigneeTel == 0
  1579. ) {
  1580. this.$confirm(
  1581. "收货客户电话未填写会导致无法接收车辆发货短信, 是否继续?",
  1582. "提示",
  1583. {
  1584. confirmButtonText: "确定",
  1585. cancelButtonText: "取消",
  1586. type: "warning"
  1587. }
  1588. )
  1589. .then(() => {
  1590. this.ignoreSaleOrderConsigneeTel = 1;
  1591. this.addMaterialToSaleOrder();
  1592. })
  1593. .catch(() => {
  1594. this.$message.info("已取消!");
  1595. });
  1596. } else {
  1597. this.addMaterialToSaleOrder();
  1598. }
  1599. this.isNiTui = 0;
  1600. },
  1601. //添加物资到订单
  1602. addMaterialToSaleOrder() {
  1603. console.log(this.materialList);
  1604. if (this.materialList.length == 0) {
  1605. this.$message.warning("请至少为这一车添加一个物资!");
  1606. } else if (!this.saleShipperAddressName && this.values == "no") {
  1607. this.$message.warning("收货地址未填写!");
  1608. } else if (
  1609. this.materialList.length == 1 &&
  1610. this.materialList[0].carNumber != null
  1611. ) {
  1612. var eachOrderPlanWeight =
  1613. this.materialList[0].orderPlanWeight / this.materialList[0].carNumber;
  1614. if (isIntegerNumber(eachOrderPlanWeight)) {
  1615. var e = this.materialList[0];
  1616. for (var i = 0; i < this.materialList[0].carNumber; i++) {
  1617. var addmap = {
  1618. cxh: this.maxCxh,
  1619. materialName: e.materialName,
  1620. Specification: e.Specification,
  1621. materialCode: e.materialCode,
  1622. orderPlanWeight: eachOrderPlanWeight,
  1623. meterNumber: e.meterNumber,
  1624. isPound: e.isPound,
  1625. saleShipperAddressId: this.saleShipperAddressId,
  1626. place: this.place1,
  1627. saleShipperAddressName: this.saleShipperAddressName,
  1628. saleDateOfReceipt: this.saleDateOfReceipt,
  1629. saleOrderConsigneeTel: this.saleOrderConsigneeTel,
  1630. truckRemark: this.truckRemark,
  1631. materialId: e.materialId,
  1632. haveMeter: e.haveMeter,
  1633. isDisable: e.isDisable
  1634. };
  1635. this.selectionList.push(addmap);
  1636. //最大车序号加1
  1637. this.maxCxh += 1;
  1638. }
  1639. //清空materialList
  1640. this.materialList = [];
  1641. //调用记录每一行的合并数的方法
  1642. this.getSpanArr(this.selectionList);
  1643. } else {
  1644. this.$message.warning("分配件数不是整数!");
  1645. }
  1646. } else {
  1647. this.materialList.forEach(e => {
  1648. var addmap = {
  1649. cxh: this.maxCxh,
  1650. materialName: e.materialName,
  1651. Specification: e.Specification,
  1652. materialCode: e.materialCode,
  1653. orderPlanWeight: e.orderPlanWeight,
  1654. meterNumber: e.meterNumber,
  1655. isPound: e.isPound,
  1656. saleShipperAddressId: this.saleShipperAddressId,
  1657. place: this.place1,
  1658. saleShipperAddressName: this.saleShipperAddressName,
  1659. saleDateOfReceipt: this.saleDateOfReceipt,
  1660. saleOrderConsigneeTel: this.saleOrderConsigneeTel,
  1661. truckRemark: this.truckRemark,
  1662. materialId: e.materialId,
  1663. haveMeter: e.haveMeter,
  1664. isDisable: e.isDisable
  1665. };
  1666. console.log(addmap);
  1667. this.selectionList.push(addmap);
  1668. });
  1669. //清空materialList
  1670. this.materialList = [];
  1671. //最大车序号加1
  1672. this.maxCxh += 1;
  1673. //调用记录每一行的合并数的方法
  1674. this.getSpanArr(this.selectionList);
  1675. this.onblur();
  1676. }
  1677. },
  1678. //更改行物资
  1679. changeMaterial(index) {
  1680. this.option1.requestUrl =
  1681. "/api/v1/uc/getSteelMaterial?apiId=244&i=" + new Date();
  1682. this.drawer = true;
  1683. this.materialNameText = null;
  1684. this.materialSpecificationText = null;
  1685. this.isOpenDrawer = 1;
  1686. this.indexChangeMaterial = index;
  1687. },
  1688. //关闭更改行物资
  1689. closeChangeMaterial() {
  1690. this.drawer = false;
  1691. this.isOpenDrawer = 0;
  1692. this.$message.info("取消更改!");
  1693. },
  1694. //单选一行物资
  1695. currentRadioChange(row) {
  1696. this.selectedMaterialId = row.materialId;
  1697. this.selectedMaterialName = row.materialName;
  1698. this.selectedMaterialSpecification = row.materialSpecification;
  1699. this.selectedMaterialModel = row.materialModel;
  1700. this.selectedMaterialCode = row.materialCode;
  1701. },
  1702. //确认物资修改
  1703. makeSureChange() {
  1704. if (!this.selectedMaterialId) {
  1705. this.$message.warning("请先选择一个物资!");
  1706. } else {
  1707. if (!this.selectedMaterialSpecification) {
  1708. this.selectedMaterialSpecification = "";
  1709. }
  1710. if (!this.selectedMaterialModel) {
  1711. this.selectedMaterialModel = "";
  1712. }
  1713. //记录是理重还是磅重
  1714. var getisPound = 1;
  1715. //判断物资是否为盘螺或非定尺
  1716. if (
  1717. this.selectedMaterialName.includes("盘螺") ||
  1718. this.selectedMaterialName.includes("乱尺") ||
  1719. this.selectedMaterialName.includes("盘元") ||
  1720. this.selectedMaterialName.includes("盘圆")
  1721. ) {
  1722. getisPound = 0;
  1723. } else {
  1724. getisPound = 1;
  1725. }
  1726. this.selectionList[
  1727. this.indexChangeMaterial
  1728. ].materialId = this.selectedMaterialId;
  1729. this.selectionList[
  1730. this.indexChangeMaterial
  1731. ].materialName = this.selectedMaterialName;
  1732. this.selectionList[this.indexChangeMaterial].Specification =
  1733. this.selectedMaterialSpecification + this.selectedMaterialModel;
  1734. this.selectionList[
  1735. this.indexChangeMaterial
  1736. ].materialCode = this.selectedMaterialModel;
  1737. this.selectionList[this.indexChangeMaterial].isPound = getisPound;
  1738. //确定更改的物资有无米数
  1739. if (
  1740. this.selectedMaterialName.includes("盘螺") ||
  1741. this.selectedMaterialName.includes("盘圆") ||
  1742. this.selectedMaterialName.includes("盘元")
  1743. ) {
  1744. this.selectionList[this.indexChangeMaterial].haveMeter = 0;
  1745. this.selectionList[this.indexChangeMaterial].meterNumber = null;
  1746. } else {
  1747. if (this.selectedMaterialName.includes("米")) {
  1748. this.selectionList[this.indexChangeMaterial].haveMeter = 1;
  1749. this.selectionList[this.indexChangeMaterial].isDisable = 1;
  1750. this.selectionList[this.indexChangeMaterial].meterNumber = Number(
  1751. this.selectedMaterialName.replace(/[^0-9]/gi, "")
  1752. );
  1753. } else {
  1754. this.selectionList[this.indexChangeMaterial].haveMeter = 1;
  1755. this.selectionList[this.indexChangeMaterial].isDisable = 0;
  1756. this.selectionList[this.indexChangeMaterial].meterNumber = null;
  1757. }
  1758. }
  1759. //重新初始化
  1760. this.indexChangeMaterial = null;
  1761. this.selectedMaterialId = null;
  1762. this.selectedMaterialName = null;
  1763. this.selectedMaterialSpecification = null;
  1764. this.selectedMaterialModel = null;
  1765. this.selectedMaterialCode = null;
  1766. //关闭弹出框
  1767. this.drawer = false;
  1768. this.isOpenDrawer = 0;
  1769. //初始化查询数据
  1770. (this.materialNameText = null),
  1771. (this.materialSpecificationText = null),
  1772. (this.materialModelText = null);
  1773. this.$message.success("成功更改!");
  1774. this.onblur();
  1775. }
  1776. },
  1777. //记录每一行的合并数
  1778. getSpanArr(data) {
  1779. //每次调用方法初始化
  1780. this.spanArr = [];
  1781. for (var i = 0; i < data.length; i++) {
  1782. if (i === 0) {
  1783. this.spanArr.push(1);
  1784. this.pos = 0;
  1785. } else {
  1786. // 判断当前元素与上一个元素是否相同
  1787. if (data[i].cxh === data[i - 1].cxh) {
  1788. this.spanArr[this.pos] += 1;
  1789. this.spanArr.push(0);
  1790. } else {
  1791. this.spanArr.push(1);
  1792. this.pos = i;
  1793. }
  1794. }
  1795. }
  1796. },
  1797. //根据条件合并行
  1798. cellMerge({ row, column, rowIndex, columnIndex }) {
  1799. if (columnIndex === 0) {
  1800. const _row = this.spanArr[rowIndex];
  1801. const _col = _row > 0 ? 1 : 0;
  1802. return {
  1803. rowspan: _row,
  1804. colspan: _col
  1805. };
  1806. }
  1807. if (columnIndex === 6) {
  1808. const _row = this.spanArr[rowIndex];
  1809. const _col = _row > 0 ? 1 : 0;
  1810. return {
  1811. rowspan: _row,
  1812. colspan: _col
  1813. };
  1814. }
  1815. if (columnIndex === 7) {
  1816. const _row = this.spanArr[rowIndex];
  1817. const _col = _row > 0 ? 1 : 0;
  1818. return {
  1819. rowspan: _row,
  1820. colspan: _col
  1821. };
  1822. }
  1823. if (columnIndex === 8) {
  1824. const _row = this.spanArr[rowIndex];
  1825. const _col = _row > 0 ? 1 : 0;
  1826. return {
  1827. rowspan: _row,
  1828. colspan: _col
  1829. };
  1830. }
  1831. if (columnIndex === 10) {
  1832. const _row = this.spanArr[rowIndex];
  1833. const _col = _row > 0 ? 1 : 0;
  1834. return {
  1835. rowspan: _row,
  1836. colspan: _col
  1837. };
  1838. }
  1839. },
  1840. //点击外层收货地址浏览事件
  1841. ondrawerOut() {
  1842. if (this.inOrOut % 2 == 0) {
  1843. this.inOrOut += 1;
  1844. }
  1845. this.frist.requestUrl =
  1846. "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
  1847. this.drawer1 = true;
  1848. this.onchangeProvince();
  1849. this.onchangeCity();
  1850. },
  1851. //点击内层收货地址浏览事件
  1852. ondrawer(row, index) {
  1853. if (this.inOrOut % 2 == 1) {
  1854. this.inOrOut += 1;
  1855. }
  1856. this.row = row;
  1857. this.row.index = index;
  1858. this.frist.requestUrl =
  1859. "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
  1860. this.drawer1 = true;
  1861. this.onchangeProvince();
  1862. this.onchangeCity();
  1863. },
  1864. //查询全国省市县
  1865. selectAddresClick() {
  1866. if (this.addresText) {
  1867. this.frist.requestUrl =
  1868. "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" +
  1869. this.addresText;
  1870. } else {
  1871. this.frist.requestUrl =
  1872. "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
  1873. }
  1874. },
  1875. //收货地址弹出层
  1876. handleSelect1(item) {
  1877. console.log(item);
  1878. if (this.isNiTui == 1) {
  1879. this.province = item.province;
  1880. this.city = item.district;
  1881. this.county = item.town;
  1882. this.place1 = item.place;
  1883. this.addressId = item.shipperAddressId;
  1884. this.place = item.place;
  1885. }
  1886. },
  1887. //以下是收货地址边输边查搜索
  1888. querySearch1(queryString, cb) {
  1889. if (this.addressId != null) {
  1890. this.axios
  1891. .post(
  1892. "/api/v1/ams/getRealAddressByLike?addressId=" +
  1893. this.addressId +
  1894. "&index=" +
  1895. queryString
  1896. )
  1897. .then(res => {
  1898. this.isNiTui = 0;
  1899. if (res.data.code == "200") {
  1900. var restaurants = res.data.data;
  1901. var results = queryString
  1902. ? restaurants.filter(this.createFilter1(queryString))
  1903. : restaurants;
  1904. // 调用 callback 返回建议列表的数据
  1905. cb(results);
  1906. }
  1907. });
  1908. } else {
  1909. this.axios
  1910. .post("/api/v1/uc/getPlaceAndAddress?index=" + queryString)
  1911. .then(res => {
  1912. this.isNiTui = 1;
  1913. if (res.data.code == "200") {
  1914. console.log(res.data.data);
  1915. var restaurants = res.data.data;
  1916. var results = queryString
  1917. ? restaurants.filter(this.createFilter1(queryString))
  1918. : restaurants;
  1919. // 调用 callback 返回建议列表的数据
  1920. cb(results);
  1921. }
  1922. });
  1923. }
  1924. },
  1925. createFilter1(queryString) {
  1926. return restaurants => {
  1927. return (
  1928. restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
  1929. -1
  1930. );
  1931. };
  1932. },
  1933. //以上是收货地址边输边查搜索
  1934. //监听收货地址模态框点击事件
  1935. currentRadioChange1(radioList) {
  1936. this.addressId = radioList.addressId;
  1937. this.address = radioList.address;
  1938. },
  1939. //确定收货地址事件
  1940. addAddressClick() {
  1941. //不管是外层还是内层都需要修改,如果存在都需要修改收货客户的电话
  1942. //定义一个正则表达式判断是否有电话
  1943. var est = /\d{11}/g;
  1944. var string2 = this.place.match(est);
  1945. console.log("-----------这是抓取到的数据----------");
  1946. console.log(string2);
  1947. if (string2 != null) {
  1948. for (i = 0; i < string2.length; i++) {
  1949. var reg = /^1[3456789]\d{9}$/;
  1950. if (reg.test(string2[i])) {
  1951. this.saleOrderConsigneeTel = string2;
  1952. }
  1953. }
  1954. }
  1955. if (this.inOrOut % 2 == 0) {
  1956. for (
  1957. var i = this.row.index;
  1958. i < this.spanArr[this.row.index] + this.row.index;
  1959. i++
  1960. ) {
  1961. this.selectionList[i].saleShipperAddressId = this.addressId;
  1962. this.selectionList[i].place = this.place;
  1963. this.selectionList[i].saleShipperAddressName =
  1964. this.province + this.city + this.county + this.place;
  1965. }
  1966. this.drawer1 = false;
  1967. } else {
  1968. this.saleShipperAddressId = this.addressId;
  1969. this.saleShipperAddressName =
  1970. this.province + this.city + this.county + this.place;
  1971. this.drawer1 = false;
  1972. }
  1973. // //初始化
  1974. // this.addressId = null;
  1975. // this.province = null;
  1976. // this.cityList = [];
  1977. // this.city = null;
  1978. // this.countyList = [];
  1979. // this.county = null;
  1980. //暂存具体地址
  1981. this.place1 = this.place;
  1982. // this.place = null;
  1983. // this.addresText = null;
  1984. },
  1985. //批量修改内层值
  1986. batchUpdateValue(row, index) {
  1987. for (var i = index; i < this.spanArr[index] + index; i++) {
  1988. this.selectionList[i].saleOrderConsigneeTel = row.saleOrderConsigneeTel;
  1989. }
  1990. },
  1991. //物资模态框查询
  1992. onclick() {
  1993. if (this.isOpenDrawer == 0) {
  1994. this.option.requestUrl =
  1995. "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
  1996. this.materialNameText +
  1997. "&materialSpecificationText=" +
  1998. this.materialSpecificationText;
  1999. } else {
  2000. this.option1.requestUrl =
  2001. "/api/v1/uc/getSteelMaterial?apiId=244&materialNameText=" +
  2002. this.materialNameText +
  2003. "&materialSpecificationText=" +
  2004. this.materialSpecificationText;
  2005. }
  2006. },
  2007. // 确定
  2008. async makeSure() {
  2009. if (this.selectionList.length == 0) {
  2010. this.$message.warning("请先填写具体信息");
  2011. return;
  2012. }
  2013. let i = 0;
  2014. this.selectionList.forEach(e => {
  2015. if (!/(^[1-9]\d*$)/.test(e.orderPlanWeight)) {
  2016. e.orderPlanWeight = null;
  2017. i++;
  2018. }
  2019. });
  2020. let flag = 0;
  2021. await this.axios
  2022. .post("/api/v1/ams/queryFormat", this.selectionList)
  2023. .then(res => {
  2024. if (res.data.code == "500") {
  2025. flag = 1;
  2026. }
  2027. });
  2028. if (flag == 1) {
  2029. this.$message.error("规格型号有问题,请重新输入");
  2030. return;
  2031. }
  2032. if (i != 0) {
  2033. this.$message.error("件数必填且请输入正整数");
  2034. return;
  2035. }
  2036. this.selectionList.forEach(e => {
  2037. if (e.materialName.includes("定尺")) {
  2038. if (!e.meterNumber) {
  2039. i++;
  2040. }
  2041. }
  2042. });
  2043. if (i != 0) {
  2044. this.$message.error("定尺必须填写米数");
  2045. return;
  2046. }
  2047. //获取是否自提字段
  2048. this.options.forEach(e => {
  2049. if (this.values == e.values) {
  2050. this.saleOrderIsselfMention = e.label;
  2051. }
  2052. });
  2053. //获取收款公司字段
  2054. this.receivingCompany.forEach(f => {
  2055. if (this.values1 == f.values1) {
  2056. this.saleOrderReceiveCustomer = f.label1;
  2057. }
  2058. });
  2059. //获取业务员姓名
  2060. this.saleMans.forEach(g => {
  2061. if (this.saleMan == g.value) {
  2062. this.saleManText = g.label;
  2063. }
  2064. });
  2065. this.orderMakeSure = true;
  2066. },
  2067. //发送请求
  2068. async sendRequest() {
  2069. this.orderMakeSure = false;
  2070. //是否还有件数未填写
  2071. var orderPlanWeightAllFill = 0;
  2072. //根据规格型号与物资名称获取对应的物资ID||确认规格型号格式是否正确
  2073. //先把暂存区的数据清空
  2074. this.temporarylist = [];
  2075. let flag = 0;
  2076. await this.axios
  2077. .post("/api/v1/ams/queryMaterial", this.selectionList)
  2078. .then(res => {
  2079. if (res.data.code === "500") {
  2080. flag = 1;
  2081. }
  2082. console.log(res.data.code);
  2083. //给暂存区的数据赋值
  2084. this.temporarylist = res.data.data;
  2085. console.log("以下是查询出来的数据");
  2086. console.log(res.data.data);
  2087. });
  2088. if (flag === 1) {
  2089. this.$message.error("规格型号不对");
  2090. return;
  2091. }
  2092. this.selectionList = this.temporarylist;
  2093. //初始化maplist
  2094. var mapList = [];
  2095. this.selectionList.forEach(item => {
  2096. if (!item.orderPlanWeight) {
  2097. orderPlanWeightAllFill++;
  2098. }
  2099. //初始化mapItem
  2100. var mapItem = {
  2101. //车序号
  2102. truckNo: 0,
  2103. //省市县id
  2104. shipperAddressId: 0,
  2105. //具体地址
  2106. place: null,
  2107. //截止日期
  2108. saleDateOfReceipt: null,
  2109. //收货方电话
  2110. saleOrderConsigneeTel: "",
  2111. //车序号物资ID
  2112. materialId: 0,
  2113. //物资件数
  2114. materialNumber: 0,
  2115. //米数
  2116. steelMeters: 0,
  2117. //是否磅重销售
  2118. isPoundSale: 0,
  2119. //备注
  2120. truckRemark: "",
  2121. //物资名称
  2122. materialName: ""
  2123. };
  2124. mapItem.truckNo = item.cxh;
  2125. mapItem.shipperAddressId = item.saleShipperAddressId;
  2126. mapItem.place = item.place;
  2127. mapItem.saleDateOfReceipt = sjTime(item.saleDateOfReceipt);
  2128. mapItem.saleOrderConsigneeTel = item.saleOrderConsigneeTel;
  2129. mapItem.materialId = item.materialId;
  2130. mapItem.materialNumber = item.orderPlanWeight;
  2131. mapItem.steelMeters = item.meterNumber;
  2132. mapItem.isPoundSale = item.isPound;
  2133. mapItem.truckRemark = item.truckRemark;
  2134. mapItem.materialName = item.materialName;
  2135. mapList.push(mapItem);
  2136. });
  2137. let mapValue = {
  2138. shipperId: this.shipperId,
  2139. receiveId: this.consigneeId,
  2140. isSelfMention: this.saleOrderIsselfMention,
  2141. saleOrderReceiveCustomer: this.saleOrderReceiveCustomer,
  2142. salerId: this.saleMan,
  2143. saleRemark: this.remarks,
  2144. mapList: mapList
  2145. };
  2146. console.log(mapValue);
  2147. //所有列件数都填写
  2148. if (orderPlanWeightAllFill == 0) {
  2149. this.axios
  2150. .post("/api/v1/ams/addSteelSaleOrder", mapValue)
  2151. .then(res => {
  2152. if (res.data.code == "200") {
  2153. this.$router.go(-1);
  2154. this.notDebounce = false;
  2155. }
  2156. this.$message.success("新增订单成功!");
  2157. })
  2158. .catch(() => {
  2159. this.$message.error();
  2160. });
  2161. } else {
  2162. this.$message.error("还有物资件数未填写!");
  2163. this.notDebounce = false;
  2164. }
  2165. },
  2166. // 取消
  2167. cancel() {
  2168. this.$router.go(-1);
  2169. },
  2170. //关闭事件
  2171. handleClose(done) {
  2172. this.$confirm("确认关闭?")
  2173. .then(_ => {
  2174. done();
  2175. })
  2176. .catch(_ => {});
  2177. },
  2178. //点击事件(上)
  2179. clicks(index) {
  2180. console.log(index);
  2181. console.log(this.materialList);
  2182. console.log(this.materialList.length - 1);
  2183. console.log("clicks=e", arguments);
  2184. if (index == 0) {
  2185. console.log("向上1");
  2186. //this.datalistindex=this.materialTableTop.length-1
  2187. document
  2188. .getElementById("input" + (this.materialList.length - 1))
  2189. .focus();
  2190. } else {
  2191. console.log("向上2");
  2192. //this.$refs.materialTableTop.bodyWrapper.scrollTop=index
  2193. document.getElementById("input" + (index - 1)).focus();
  2194. }
  2195. },
  2196. //点击事件(下)
  2197. clickx(index) {
  2198. console.log(index);
  2199. console.log(this.materialList);
  2200. console.log(this.materialList.length - 1);
  2201. if (index == this.materialList.length - 1) {
  2202. console.log("向下1");
  2203. document.getElementById("input" + 0).focus();
  2204. } else {
  2205. console.log("向下2");
  2206. //this.datalistindex+=1
  2207. //this.$refs.materialTableTop.bodyWrapper.scrollTop=(index+1)*height
  2208. //var tbl=document.getElementById("table").childNodes[0]
  2209. //tbl.childNodes[len].childNodes[0].childNodes[0].focus()children[3]
  2210. //const rowlist=this.$refs.materialTableTop.$el.children[3].children[1].children[0]
  2211. //.children[1].children[len].children[3].children[0].children[0].children[0].focus()
  2212. //console.log(rowlist)
  2213. var nextInput = document.getElementById("input" + (index + 1));
  2214. nextInput.focus();
  2215. }
  2216. }
  2217. }
  2218. };
  2219. </script>
  2220. <style lang="scss" scoped>
  2221. .addSalePlan {
  2222. width: 100%;
  2223. .el-drawer__body {
  2224. overflow: auto;
  2225. }
  2226. .el-drawer__container ::-webkit-scrollbar {
  2227. display: none;
  2228. }
  2229. }
  2230. .form-box,
  2231. .from {
  2232. display: flex;
  2233. align-items: center;
  2234. justify-content: center;
  2235. margin-top: 5px;
  2236. margin-bottom: 20px;
  2237. }
  2238. .button-box {
  2239. display: flex;
  2240. text-align: center;
  2241. align-items: center;
  2242. justify-content: center;
  2243. margin-top: 0.3125rem;
  2244. margin-bottom: 1.25rem;
  2245. }
  2246. .select {
  2247. margin-left: -10rem;
  2248. }
  2249. .demo-form-inline {
  2250. margin-left: 2rem;
  2251. }
  2252. .table_form {
  2253. margin-left: -16rem;
  2254. }
  2255. .textinput111 {
  2256. width: 83px;
  2257. }
  2258. .textinput {
  2259. width: 50px;
  2260. }
  2261. .textinput1 {
  2262. width: 50px;
  2263. text-align: center;
  2264. size: small;
  2265. }
  2266. .textinput2 {
  2267. width: 50px;
  2268. margin-right: 30px;
  2269. }
  2270. .textinput3 {
  2271. width: 190px;
  2272. }
  2273. .textinput4 {
  2274. width: 60px;
  2275. }
  2276. .textinput5 {
  2277. width: 120px;
  2278. }
  2279. </style>