editSaleOrder.vue 60 KB

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