addSaleOrder.vue 51 KB

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