addSaleOrder.vue 71 KB

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