addSaleOrder.vue 66 KB

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