displace_list.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198
  1. <template>
  2. <div class="app-container">
  3. <div class="main-top">
  4. <div class="title">选择置换方式</div>
  5. <el-radio-group v-model="type" @change="changeType">
  6. <!-- <el-radio :label="1">订单置换</el-radio> -->
  7. <el-radio :label="2">批量置换</el-radio>
  8. </el-radio-group>
  9. </div>
  10. <div class="main-title">
  11. <div class="title">被置换产品信息</div>
  12. <div>
  13. <el-button size="mini" type="primary" @click="openBeiGoodsDialog">选择机型</el-button>
  14. </div>
  15. </div>
  16. <div class="table">
  17. <el-table :data="beiGoodsList" border fit highlight-current-row stripe>
  18. <el-table-column
  19. align="left"
  20. label="物料编码"
  21. prop="number"
  22. min-width="160"
  23. show-overflow-tooltip
  24. ></el-table-column>
  25. <el-table-column
  26. align="left"
  27. label="产品编码"
  28. prop="oldNumber"
  29. min-width="160"
  30. show-overflow-tooltip
  31. ></el-table-column>
  32. <el-table-column
  33. align="left"
  34. label="产品名称"
  35. prop="name"
  36. min-width="160"
  37. show-overflow-tooltip
  38. ></el-table-column>
  39. <el-table-column
  40. align="left"
  41. label="规格型号"
  42. prop="specification"
  43. min-width="350"
  44. show-overflow-tooltip
  45. ></el-table-column>
  46. <el-table-column
  47. align="left"
  48. label="单位"
  49. prop="baseUnitId"
  50. min-width="100"
  51. show-overflow-tooltip
  52. ></el-table-column>
  53. <el-table-column align="center" label="操作" min-width="100" fixed="right">
  54. <template slot-scope="scope">
  55. <el-button type="text" @click="deleteBeiGoodsList(scope.$index)">删除</el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. </div>
  60. <div class="main-title">
  61. <div class="title">可置换产品信息</div>
  62. <div>
  63. <el-button size="mini" type="primary" @click="openKeGoodsDialog">选择机型</el-button>
  64. </div>
  65. </div>
  66. <div class="table">
  67. <el-table :data="keGoodsList" border fit highlight-current-row stripe>
  68. <el-table-column
  69. align="left"
  70. label="物料编码"
  71. prop="number"
  72. min-width="160"
  73. show-overflow-tooltip
  74. ></el-table-column>
  75. <el-table-column
  76. align="left"
  77. label="产品编码"
  78. prop="oldNumber"
  79. min-width="160"
  80. show-overflow-tooltip
  81. ></el-table-column>
  82. <el-table-column
  83. align="left"
  84. label="产品名称"
  85. prop="name"
  86. min-width="160"
  87. show-overflow-tooltip
  88. ></el-table-column>
  89. <el-table-column
  90. align="left"
  91. label="规格型号"
  92. prop="specification"
  93. min-width="350"
  94. show-overflow-tooltip
  95. ></el-table-column>
  96. <el-table-column
  97. align="left"
  98. label="单位"
  99. prop="baseUnitId"
  100. min-width="100"
  101. show-overflow-tooltip
  102. ></el-table-column>
  103. <el-table-column align="center" label="操作" min-width="100" fixed="right">
  104. <template slot-scope="scope">
  105. <el-button type="text" @click="deleteKeGoodsList(scope.$index)">删除</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. </div>
  110. <div class="main-title">
  111. <div class="title">被置换订单信息</div>
  112. <div>
  113. <el-button size="mini" type="primary" @click="openOrderDialog">选择置换订单</el-button>
  114. </div>
  115. </div>
  116. <div class="table">
  117. <el-table :data="orderList" border fit highlight-current-row stripe>
  118. <el-table-column align="left" label="订单号" prop="id" min-width="120" show-overflow-tooltip></el-table-column>
  119. <el-table-column align="left" label="经销商信息" prop="displaceOrderId" min-width="250" show-overflow-tooltip>
  120. <template slot-scope="scope">
  121. {{ scope.row.customerName + '(' + scope.row.customerNumber + ')' }}
  122. </template>
  123. </el-table-column>
  124. <el-table-column align="center" label="被置换机型" prop="displaceOrderId" min-width="160" show-overflow-tooltip>
  125. <el-table-column
  126. align="left"
  127. label="销售类型"
  128. prop="saleTypeName"
  129. min-width="100"
  130. show-overflow-tooltip
  131. ></el-table-column>
  132. <el-table-column
  133. align="left"
  134. label="产品名称"
  135. prop="materialName"
  136. min-width="160"
  137. show-overflow-tooltip
  138. ></el-table-column>
  139. <el-table-column
  140. align="left"
  141. label="规格型号"
  142. prop="specification"
  143. min-width="250"
  144. show-overflow-tooltip
  145. ></el-table-column>
  146. <el-table-column
  147. align="right"
  148. label="单价"
  149. prop="price"
  150. min-width="100"
  151. show-overflow-tooltip
  152. ></el-table-column>
  153. <el-table-column
  154. align="right"
  155. label="可被置换数量"
  156. prop="refundableQty"
  157. min-width="100"
  158. show-overflow-tooltip
  159. ></el-table-column>
  160. <el-table-column
  161. align="left"
  162. label="返利类型"
  163. prop="rebateWalletName"
  164. min-width="100"
  165. show-overflow-tooltip
  166. ></el-table-column>
  167. <el-table-column
  168. align="right"
  169. label="使用返利金额"
  170. prop="payRebateAmount"
  171. min-width="100"
  172. show-overflow-tooltip
  173. ></el-table-column>
  174. <el-table-column
  175. align="right"
  176. label="格力折扣"
  177. prop="totalDiscAmount"
  178. min-width="100"
  179. show-overflow-tooltip
  180. ></el-table-column>
  181. <el-table-column
  182. align="left"
  183. label="现金钱包"
  184. prop="walletName"
  185. min-width="100"
  186. show-overflow-tooltip
  187. ></el-table-column>
  188. <el-table-column
  189. align="right"
  190. label="实付金额"
  191. prop="payAmount"
  192. min-width="100"
  193. show-overflow-tooltip
  194. ></el-table-column>
  195. </el-table-column>
  196. <el-table-column align="center" label="置换机型" prop="displaceOrderId" min-width="160" show-overflow-tooltip>
  197. <el-table-column
  198. align="left"
  199. label="销售类型"
  200. prop="saleTypeName"
  201. min-width="160"
  202. show-overflow-tooltip
  203. ></el-table-column>
  204. <el-table-column
  205. align="left"
  206. label="产品名称"
  207. prop="ke_materialName"
  208. min-width="160"
  209. show-overflow-tooltip
  210. ></el-table-column>
  211. <el-table-column
  212. align="left"
  213. label="规格型号"
  214. prop="ke_specification"
  215. min-width="350"
  216. show-overflow-tooltip
  217. ></el-table-column>
  218. <el-table-column
  219. align="right"
  220. label="单价"
  221. prop="price"
  222. min-width="100"
  223. show-overflow-tooltip
  224. ></el-table-column>
  225. <el-table-column align="right" label="置换数量" prop="ke_refundableQty" min-width="100" show-overflow-tooltip>
  226. <template slot-scope="scope">
  227. <el-input v-model="scope.row.ke_refundableQty" size="mini" type="number"></el-input>
  228. </template>
  229. </el-table-column>
  230. <el-table-column
  231. align="left"
  232. label="返利类型"
  233. prop="rebateWalletName"
  234. min-width="100"
  235. show-overflow-tooltip
  236. ></el-table-column>
  237. <el-table-column
  238. align="right"
  239. label="使用返利金额"
  240. prop="singleRebateAmount"
  241. min-width="100"
  242. show-overflow-tooltip
  243. >
  244. <template slot-scope="scope">
  245. {{ scope.row.singleRebateAmount * scope.row.ke_refundableQty }}
  246. </template>
  247. </el-table-column>
  248. <el-table-column
  249. align="right"
  250. label="格力折扣"
  251. prop="discAmount"
  252. min-width="100"
  253. show-overflow-tooltip
  254. ></el-table-column>
  255. <el-table-column
  256. align="left"
  257. label="现金钱包"
  258. prop="walletName"
  259. min-width="100"
  260. show-overflow-tooltip
  261. ></el-table-column>
  262. <el-table-column align="right" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip>
  263. <template slot-scope="scope">
  264. {{
  265. scope.row.price * scope.row.ke_refundableQty -
  266. scope.row.singleRebateAmount * scope.row.ke_refundableQty -
  267. scope.row.discAmount
  268. }}
  269. </template>
  270. </el-table-column>
  271. </el-table-column>
  272. <el-table-column align="center" label="操作" min-width="100" fixed="right">
  273. <template slot-scope="scope">
  274. <el-button type="text" @click="deleteOrderList(scope.$index)">删除</el-button>
  275. </template>
  276. </el-table-column>
  277. </el-table>
  278. </div>
  279. <div class="page-footer">
  280. <div class="footer">
  281. <el-button type="primary" @click="submitForm">提交置换</el-button>
  282. <el-popconfirm title="确定要重置吗?" @onConfirm="resetForm" style="margin-left: 10px">
  283. <el-button slot="reference">重 置</el-button>
  284. </el-popconfirm>
  285. </div>
  286. </div>
  287. <el-dialog title="选择被置换产品" :visible.sync="beiGoodsDialog_show" width="80%">
  288. <el-form
  289. ref="beiGoodsDialog_screenForm"
  290. :model="beiGoodsDialog_screenForm"
  291. size="mini"
  292. label-position="left"
  293. label-width="80px"
  294. >
  295. <el-row :gutter="20">
  296. <el-col :xs="12" :sm="6" :lg="6">
  297. <el-form-item prop="number" label="物料编码">
  298. <el-input v-model="beiGoodsDialog_screenForm.number" placeholder="请输入物料编码"></el-input>
  299. </el-form-item>
  300. </el-col>
  301. <el-col :xs="12" :sm="6" :lg="6">
  302. <el-form-item prop="oldNumber" label="产品编码">
  303. <el-input v-model="beiGoodsDialog_screenForm.oldNumber" placeholder="请输入产品编码"></el-input>
  304. </el-form-item>
  305. </el-col>
  306. <el-col :xs="12" :sm="6" :lg="6">
  307. <el-form-item prop="keyword" label="产品名称">
  308. <el-input v-model="beiGoodsDialog_screenForm.keyword" placeholder="请输入产品名称"></el-input>
  309. </el-form-item>
  310. </el-col>
  311. <el-col :xs="12" :sm="6" :lg="6">
  312. <el-form-item label="规格型号" prop="specification">
  313. <el-input v-model="beiGoodsDialog_screenForm.specification" placeholder="请输入规格型号"></el-input>
  314. </el-form-item>
  315. </el-col>
  316. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  317. <el-form-item label="">
  318. <el-button @click="resetBeiGoodsDialogScreenForm">清空</el-button>
  319. <el-button type="primary" @click="submitBeiGoodsDialogScreenForm">搜索</el-button>
  320. </el-form-item>
  321. </el-col>
  322. </el-row>
  323. </el-form>
  324. <div class="table">
  325. <el-table
  326. :data="beiGoodsDialog_list"
  327. element-loading-text="Loading"
  328. border
  329. fit
  330. highlight-current-row
  331. stripe
  332. height="400"
  333. >
  334. <el-table-column align="center" width="80">
  335. <template slot-scope="scope">
  336. <el-button
  337. type="primary"
  338. size="mini"
  339. @click="submitChooseBeiGoods(scope.row)"
  340. :disabled="scope.row.selected"
  341. >选择
  342. </el-button
  343. >
  344. </template>
  345. </el-table-column>
  346. <el-table-column
  347. align="left"
  348. label="物料编码"
  349. prop="number"
  350. min-width="100"
  351. show-overflow-tooltip
  352. ></el-table-column>
  353. <el-table-column
  354. align="left"
  355. label="产品编码"
  356. prop="oldNumber"
  357. min-width="100"
  358. show-overflow-tooltip
  359. ></el-table-column>
  360. <el-table-column
  361. align="left"
  362. label="产品名称"
  363. prop="name"
  364. min-width="160"
  365. show-overflow-tooltip
  366. ></el-table-column>
  367. <el-table-column
  368. align="left"
  369. label="规格型号"
  370. prop="specification"
  371. min-width="160"
  372. show-overflow-tooltip
  373. ></el-table-column>
  374. <el-table-column
  375. align="left"
  376. label="是否可被置换"
  377. prop="unit"
  378. min-width="80"
  379. show-overflow-tooltip
  380. ></el-table-column>
  381. </el-table>
  382. <div class="pagination clearfix" style="margin-top: 10px">
  383. <div class="fr">
  384. <el-pagination
  385. @current-change="changeBeiGoodsDialogPage"
  386. :current-page="beiGoodsDialog_currentPage"
  387. :page-size="10"
  388. background
  389. layout="prev, pager, next"
  390. :total="beiGoodsDialog_listTotal"
  391. >
  392. </el-pagination>
  393. </div>
  394. </div>
  395. </div>
  396. <span slot="footer" class="dialog-footer">
  397. <el-button @click="closeBeiGoodsDialog">取 消</el-button>
  398. </span>
  399. </el-dialog>
  400. <el-dialog title="选择可置换产品" :visible.sync="keGoodsDialog_show" width="80%">
  401. <el-form
  402. ref="keGoodsDialog_screenForm"
  403. :model="keGoodsDialog_screenForm"
  404. size="mini"
  405. label-position="left"
  406. label-width="80px"
  407. >
  408. <el-row :gutter="20">
  409. <el-col :xs="12" :sm="6" :lg="6">
  410. <el-form-item prop="number" label="物料编码">
  411. <el-input v-model="keGoodsDialog_screenForm.number" placeholder="请输入物料编码"></el-input>
  412. </el-form-item>
  413. </el-col>
  414. <el-col :xs="12" :sm="6" :lg="6">
  415. <el-form-item prop="oldNumber" label="产品编码">
  416. <el-input v-model="keGoodsDialog_screenForm.oldNumber" placeholder="请输入产品编码"></el-input>
  417. </el-form-item>
  418. </el-col>
  419. <el-col :xs="12" :sm="6" :lg="6">
  420. <el-form-item prop="keyword" label="产品名称">
  421. <el-input v-model="keGoodsDialog_screenForm.keyword" placeholder="请输入产品名称"></el-input>
  422. </el-form-item>
  423. </el-col>
  424. <el-col :xs="12" :sm="6" :lg="6">
  425. <el-form-item label="规格型号" prop="specification">
  426. <el-input v-model="keGoodsDialog_screenForm.specification" placeholder="请输入规格型号"></el-input>
  427. </el-form-item>
  428. </el-col>
  429. <!-- <el-col :xs="12" :sm="6" :lg="6">
  430. <el-form-item label="置换产品价格类型" prop="displaceType" label-width="125px">
  431. <el-select v-model="keGoodsDialog_screenForm.displaceType" placeholder="请选择置换产品价格类型">
  432. <el-option
  433. v-for="item in displaceTypeList"
  434. :key="item.value"
  435. :label="item.label"
  436. :value="item.value">
  437. </el-option>
  438. </el-select>
  439. </el-form-item>
  440. </el-col> -->
  441. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  442. <el-form-item label="">
  443. <el-button @click="resetKeGoodsDialogScreenForm">清空</el-button>
  444. <el-button type="primary" @click="submitKeGoodsDialogScreenForm">搜索</el-button>
  445. </el-form-item>
  446. </el-col>
  447. </el-row>
  448. </el-form>
  449. <div class="table">
  450. <el-table
  451. :data="keGoodsDialog_list"
  452. element-loading-text="Loading"
  453. border
  454. fit
  455. highlight-current-row
  456. stripe
  457. height="400"
  458. @selection-change="changeKeGoodsDialogSelection"
  459. v-show="type === 1"
  460. >
  461. <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect"></el-table-column>
  462. <el-table-column
  463. align="left"
  464. label="物料编码"
  465. prop="number"
  466. min-width="100"
  467. show-overflow-tooltip
  468. ></el-table-column>
  469. <el-table-column
  470. align="left"
  471. label="产品编码"
  472. prop="oldNumber"
  473. min-width="100"
  474. show-overflow-tooltip
  475. ></el-table-column>
  476. <el-table-column
  477. align="left"
  478. label="产品名称"
  479. prop="name"
  480. min-width="160"
  481. show-overflow-tooltip
  482. ></el-table-column>
  483. <el-table-column
  484. align="left"
  485. label="规格型号"
  486. prop="specification"
  487. min-width="160"
  488. show-overflow-tooltip
  489. ></el-table-column>
  490. </el-table>
  491. <el-table
  492. :data="keGoodsDialog_list"
  493. element-loading-text="Loading"
  494. border
  495. fit
  496. highlight-current-row
  497. stripe
  498. height="400"
  499. v-show="type === 2"
  500. >
  501. <el-table-column align="center" width="80">
  502. <template slot-scope="scope">
  503. <el-button
  504. type="primary"
  505. size="mini"
  506. @click="submitChooseKeGoods(scope.row)"
  507. :disabled="scope.row.selected"
  508. >选择
  509. </el-button
  510. >
  511. </template>
  512. </el-table-column>
  513. <el-table-column
  514. align="left"
  515. label="物料编码"
  516. prop="number"
  517. min-width="100"
  518. show-overflow-tooltip
  519. ></el-table-column>
  520. <el-table-column
  521. align="left"
  522. label="产品编码"
  523. prop="oldNumber"
  524. min-width="100"
  525. show-overflow-tooltip
  526. ></el-table-column>
  527. <el-table-column
  528. align="left"
  529. label="产品名称"
  530. prop="name"
  531. min-width="160"
  532. show-overflow-tooltip
  533. ></el-table-column>
  534. <el-table-column
  535. align="left"
  536. label="规格型号"
  537. prop="specification"
  538. min-width="160"
  539. show-overflow-tooltip
  540. ></el-table-column>
  541. </el-table>
  542. <div class="pagination clearfix" style="margin-top: 10px">
  543. <div class="fr">
  544. <el-pagination
  545. @current-change="changeKeGoodsDialogPage"
  546. :current-page="keGoodsDialog_currentPage"
  547. :page-size="10"
  548. background
  549. layout="prev, pager, next"
  550. :total="keGoodsDialog_listTotal"
  551. >
  552. </el-pagination>
  553. </div>
  554. </div>
  555. </div>
  556. <span slot="footer" class="dialog-footer">
  557. <el-button @click="closeKeGoodsDialog">取 消</el-button>
  558. <el-button type="primary" @click="submitChooseKeGoods" v-if="type === 1">确 定</el-button>
  559. </span>
  560. </el-dialog>
  561. <el-dialog title="选择被置换订单" :visible.sync="orderDialog_show" width="80%">
  562. <el-form
  563. ref="orderDialog_screenForm"
  564. :model="orderDialog_screenForm"
  565. size="mini"
  566. label-position="left"
  567. label-width="85px"
  568. >
  569. <el-row :gutter="20">
  570. <el-col :xs="12" :sm="6" :lg="6">
  571. <el-form-item prop="id" label="订单号">
  572. <el-input v-model="orderDialog_screenForm.id" placeholder="请输入订单号"></el-input>
  573. </el-form-item>
  574. </el-col>
  575. <el-col :xs="12" :sm="6" :lg="6">
  576. <el-form-item prop="customerName" label="经销商名称">
  577. <el-input v-model="orderDialog_screenForm.customerName" placeholder="请输入经销商名称"></el-input>
  578. </el-form-item>
  579. </el-col>
  580. <el-col :xs="12" :sm="6" :lg="6">
  581. <el-form-item prop="customerNumber" label="经销商编号">
  582. <el-input v-model="orderDialog_screenForm.customerNumber" placeholder="请输入经销商编号"></el-input>
  583. </el-form-item>
  584. </el-col>
  585. <el-col :xs="12" :sm="6" :lg="6" class="tr">
  586. <el-form-item label="">
  587. <el-button @click="resetOrderDialogScreenForm">清空</el-button>
  588. <el-button type="primary" @click="submitOrderDialogScreenForm">搜索</el-button>
  589. </el-form-item>
  590. </el-col>
  591. </el-row>
  592. </el-form>
  593. <div class="table">
  594. <el-table
  595. :data="orderDialog_list"
  596. element-loading-text="Loading"
  597. border
  598. fit
  599. highlight-current-row
  600. stripe
  601. height="400"
  602. v-show="type === 1"
  603. >
  604. <el-table-column align="center" width="80">
  605. <template slot-scope="scope">
  606. <el-button type="primary" size="mini" @click="submitChooseOrder(scope.row)" :disabled="scope.row.selected"
  607. >选择
  608. </el-button
  609. >
  610. </template>
  611. </el-table-column>
  612. <el-table-column
  613. align="left"
  614. label="订单号"
  615. prop="id"
  616. min-width="120"
  617. show-overflow-tooltip
  618. ></el-table-column>
  619. <el-table-column
  620. align="left"
  621. label="直调状态"
  622. prop="directTransferStatusName"
  623. min-width="100"
  624. show-overflow-tooltip
  625. ></el-table-column>
  626. <el-table-column align="left" label="经销商信息" prop="materialName" min-width="250" show-overflow-tooltip>
  627. <template slot-scope="scope">
  628. {{ scope.row.customerName + '(' + scope.row.customerNumber + ')' }}
  629. </template>
  630. </el-table-column>
  631. <el-table-column
  632. align="left"
  633. label="销售类型"
  634. prop="saleTypeName"
  635. min-width="100"
  636. show-overflow-tooltip
  637. ></el-table-column>
  638. <el-table-column
  639. align="left"
  640. label="产品名称"
  641. prop="materialName"
  642. min-width="160"
  643. show-overflow-tooltip
  644. ></el-table-column>
  645. <el-table-column
  646. align="left"
  647. label="规格型号"
  648. prop="specification"
  649. min-width="250"
  650. show-overflow-tooltip
  651. ></el-table-column>
  652. <el-table-column
  653. align="left"
  654. label="可被置换数量"
  655. prop="refundableQty"
  656. min-width="100"
  657. show-overflow-tooltip
  658. ></el-table-column>
  659. </el-table>
  660. <el-table
  661. :data="orderDialog_list"
  662. element-loading-text="Loading"
  663. border
  664. fit
  665. highlight-current-row
  666. stripe
  667. height="400"
  668. @selection-change="changeOrderDialogSelection"
  669. v-show="type === 2"
  670. >
  671. <el-table-column
  672. align="center"
  673. type="selection"
  674. width="55"
  675. :selectable="checkboxSelect"
  676. v-if="type === 2"
  677. ></el-table-column>
  678. <el-table-column
  679. align="left"
  680. label="订单号"
  681. prop="id"
  682. min-width="120"
  683. show-overflow-tooltip
  684. ></el-table-column>
  685. <el-table-column
  686. align="left"
  687. label="直调状态"
  688. prop="directTransferStatusName"
  689. min-width="100"
  690. show-overflow-tooltip
  691. ></el-table-column>
  692. <el-table-column align="left" label="经销商信息" prop="materialName" min-width="250" show-overflow-tooltip>
  693. <template slot-scope="scope">
  694. {{ scope.row.customerName + '(' + scope.row.customerNumber + ')' }}
  695. </template>
  696. </el-table-column>
  697. <el-table-column
  698. align="left"
  699. label="销售类型"
  700. prop="saleTypeName"
  701. min-width="100"
  702. show-overflow-tooltip
  703. ></el-table-column>
  704. <el-table-column
  705. align="left"
  706. label="产品名称"
  707. prop="materialName"
  708. min-width="160"
  709. show-overflow-tooltip
  710. ></el-table-column>
  711. <el-table-column
  712. align="left"
  713. label="规格型号"
  714. prop="specification"
  715. min-width="250"
  716. show-overflow-tooltip
  717. ></el-table-column>
  718. <el-table-column
  719. align="left"
  720. label="可被置换数量"
  721. prop="refundableQty"
  722. min-width="100"
  723. show-overflow-tooltip
  724. ></el-table-column>
  725. </el-table>
  726. <div class="pagination clearfix" style="margin-top: 10px">
  727. <div class="fr">
  728. <el-pagination
  729. @current-change="changeOrderDialogPage"
  730. :current-page="orderDialog_currentPage"
  731. :page-size="10"
  732. background
  733. layout="prev, pager, next"
  734. :total="orderDialog_listTotal"
  735. >
  736. </el-pagination>
  737. </div>
  738. </div>
  739. </div>
  740. <span slot="footer" class="dialog-footer">
  741. <el-button @click="closeOrderDialog">取 消</el-button>
  742. <el-button type="primary" @click="submitChooseOrder" v-if="type === 2">确 定</el-button>
  743. </span>
  744. </el-dialog>
  745. </div>
  746. </template>
  747. <script>
  748. import { getGoodsList, getOrderList, addDisplace } from '@/api/supply/displace'
  749. export default {
  750. data() {
  751. return {
  752. // 主表单信息
  753. type: 2,
  754. beiGoodsList: [], // 被置换产品列表
  755. keGoodsList: [], // 可置换产品列表
  756. orderList: [], // 被置换订单列表
  757. // 被置换产品弹窗信息
  758. beiGoodsDialog_show: false,
  759. beiGoodsDialog_screenForm: {
  760. number: '',
  761. oldNumber: '',
  762. name: '',
  763. specification: ''
  764. },
  765. beiGoodsDialog_list: [],
  766. beiGoodsDialog_currentPage: 1,
  767. beiGoodsDialog_listTotal: 0,
  768. // 可置换产品弹窗信息
  769. keGoodsDialog_show: false,
  770. keGoodsDialog_screenForm: {
  771. number: '',
  772. oldNumber: '',
  773. name: '',
  774. specification: ''
  775. },
  776. keGoodsDialog_list: [],
  777. keGoodsDialog_selection: [],
  778. keGoodsDialog_currentPage: 1,
  779. keGoodsDialog_listTotal: 0,
  780. // 被置换订单弹窗信息
  781. orderDialog_show: false,
  782. orderDialog_screenForm: {
  783. id: '',
  784. customerName: '',
  785. customerNumber: ''
  786. },
  787. orderDialog_list: [],
  788. orderDialog_selection: [],
  789. orderDialog_currentPage: 1,
  790. orderDialog_listTotal: 0,
  791. // 其他
  792. displaceTypeList: [
  793. { label: '基础产品价格表', value: '1' },
  794. { label: '家用产品价格表', value: '2' },
  795. { label: '商用产品价格表', value: '3' }
  796. ]
  797. }
  798. },
  799. created() {
  800. },
  801. methods: {
  802. // 切换置换类型
  803. changeType() {
  804. this.resetForm()
  805. },
  806. // 查询重复值并禁选
  807. checkboxSelect(row, rowIndex) {
  808. if (row.selected) {
  809. return false // 禁用
  810. } else {
  811. return true // 不禁用
  812. }
  813. },
  814. // 获取列表 - 被置换产品
  815. getBeiGoodsList() {
  816. getGoodsList({
  817. pageNum: this.beiGoodsDialog_currentPage,
  818. pageSize: 100,
  819. ...this.beiGoodsDialog_screenForm
  820. }).then(res => {
  821. let oldGoodsList = this.beiGoodsList
  822. let newGoodsList = res.data.records
  823. for (let i = 0; i < oldGoodsList.length; i++) {
  824. let oldItem = oldGoodsList[i]
  825. for (let j = 0; j < newGoodsList.length; j++) {
  826. let newItem = newGoodsList[j]
  827. if (newItem.id === oldItem.id) {
  828. newGoodsList[j].selected = true
  829. break
  830. }
  831. }
  832. }
  833. this.beiGoodsDialog_list = newGoodsList
  834. this.beiGoodsDialog_listTotal = res.data.total
  835. })
  836. },
  837. // 收藏商品
  838. handleCollect(id) {
  839. if (!this.token) {
  840. return console.log('请先登录')
  841. }
  842. collectData({ id }).then(res => {
  843. // api请求
  844. console.log('收藏成功', res.data)
  845. })
  846. },
  847. // 加入购物车
  848. addToCart(id) {
  849. if (!this.token) {
  850. return console.log('请先登录')
  851. }
  852. addData({ id }).then(res => {
  853. // api请求
  854. console.log('加入购物车成功', res.data)
  855. })
  856. },
  857. // 立即购买
  858. bug() {
  859. if (!this.token) {
  860. return console.log('请先登录')
  861. }
  862. buyData({ id }).then(res => {
  863. // api请求
  864. console.log('下单成功', res.data)
  865. wx.requestPayment({
  866. // 支付
  867. timeStamp: '',
  868. nonceStr: '',
  869. package: '',
  870. signType: 'MD5',
  871. paySign: '',
  872. success(res) {
  873. },
  874. fail(res) {
  875. }
  876. })
  877. })
  878. },
  879. // 打开弹窗 - 被置换产品
  880. openBeiGoodsDialog() {
  881. if (this.orderList.length > 0) {
  882. return this.$errorMsg('已选择订单不可更改产品')
  883. }
  884. this.beiGoodsDialog_show = true
  885. this.getBeiGoodsList()
  886. },
  887. // 关闭弹窗 - 被置换产品
  888. closeBeiGoodsDialog() {
  889. this.beiGoodsDialog_show = false
  890. },
  891. // 提交筛选表单 - 被置换产品
  892. submitBeiGoodsDialogScreenForm() {
  893. this.beiGoodsDialog_currentPage = 1
  894. this.getBeiGoodsList()
  895. },
  896. // 重置筛选表单 - 被置换产品
  897. resetBeiGoodsDialogScreenForm() {
  898. this.$refs.beiGoodsDialog_screenForm.resetFields()
  899. this.beiGoodsDialog_currentPage = 1
  900. this.beiGoodsDialog_list = []
  901. this.getBeiGoodsList()
  902. },
  903. // 更改列表页码 - 被置换产品
  904. changeBeiGoodsDialogPage(val) {
  905. this.beiGoodsDialog_currentPage = val
  906. this.getBeiGoodsList()
  907. },
  908. // 确认选择产品 - 被置换产品
  909. submitChooseBeiGoods(item) {
  910. this.beiGoodsList = [item]
  911. this.closeBeiGoodsDialog()
  912. },
  913. // 删除产品 - 被置换产品
  914. deleteBeiGoodsList(index) {
  915. if (this.orderList.length > 0) {
  916. return this.$errorMsg('已选择订单不可更改产品')
  917. }
  918. this.beiGoodsList.splice(index, 1)
  919. },
  920. // 获取列表 - 可置换产品
  921. getKeGoodsList() {
  922. getGoodsList({
  923. pageNum: this.keGoodsDialog_currentPage,
  924. pageSize: 100,
  925. ...this.keGoodsDialog_screenForm
  926. }).then(res => {
  927. let oldGoodsList = this.keGoodsList
  928. let newGoodsList = res.data.records
  929. for (let i = 0; i < oldGoodsList.length; i++) {
  930. let oldItem = oldGoodsList[i]
  931. for (let j = 0; j < newGoodsList.length; j++) {
  932. let newItem = newGoodsList[j]
  933. if (newItem.id === oldItem.id) {
  934. newGoodsList[j].selected = true
  935. break
  936. }
  937. }
  938. }
  939. this.keGoodsDialog_list = newGoodsList
  940. this.keGoodsDialog_listTotal = res.data.total
  941. })
  942. },
  943. // 打开弹窗 - 可置换产品
  944. openKeGoodsDialog() {
  945. if (this.orderList.length > 0) {
  946. return this.$errorMsg('已选择订单不可更改产品')
  947. }
  948. this.keGoodsDialog_show = true
  949. this.getKeGoodsList()
  950. },
  951. // 关闭弹窗 - 可置换产品
  952. closeKeGoodsDialog() {
  953. this.keGoodsDialog_show = false
  954. },
  955. // 提交筛选表单 - 可置换产品
  956. submitKeGoodsDialogScreenForm() {
  957. this.keGoodsDialog_currentPage = 1
  958. this.getKeGoodsList()
  959. },
  960. // 重置筛选表单 - 可置换产品
  961. resetKeGoodsDialogScreenForm() {
  962. this.$refs.keGoodsDialog_screenForm.resetFields()
  963. this.keGoodsDialog_currentPage = 1
  964. this.keGoodsDialog_list = []
  965. this.getKeGoodsList()
  966. },
  967. // 更改列表页码 - 可置换产品
  968. changeKeGoodsDialogPage(val) {
  969. this.keGoodsDialog_currentPage = val
  970. this.getKeGoodsList()
  971. },
  972. // 选择列 - 可置换产品
  973. changeKeGoodsDialogSelection(val) {
  974. this.keGoodsDialog_selection = val
  975. },
  976. // 确认选择产品 - 可置换产品
  977. submitChooseKeGoods(item) {
  978. // 订单置换(多选)
  979. if (this.type === 1) {
  980. this.keGoodsList = this.keGoodsList.concat(this.keGoodsDialog_selection)
  981. }
  982. // 批量置换(单选)
  983. else {
  984. this.keGoodsList = [item]
  985. }
  986. this.closeKeGoodsDialog()
  987. },
  988. // 删除产品 - 可置换产品
  989. deleteKeGoodsList(index) {
  990. if (this.orderList.length > 0) {
  991. return this.$errorMsg('已选择订单不可更改产品')
  992. }
  993. this.keGoodsList.splice(index, 1)
  994. },
  995. // 获取列表 - 被置换订单
  996. getOrderList() {
  997. getOrderList({
  998. pageNum: this.orderDialog_currentPage,
  999. pageSize: 100,
  1000. type: 2,
  1001. materialOldNumber: this.beiGoodsList[0].oldNumber,
  1002. isOver: false,
  1003. ...this.orderDialog_screenForm
  1004. }).then(res => {
  1005. let oldGoodsList = this.orderList
  1006. let newGoodsList = res.data.records
  1007. for (let i = 0; i < oldGoodsList.length; i++) {
  1008. let oldItem = oldGoodsList[i]
  1009. for (let j = 0; j < newGoodsList.length; j++) {
  1010. let newItem = newGoodsList[j]
  1011. if (newItem.orderItemId === oldItem.orderItemId) {
  1012. newGoodsList[j].selected = true
  1013. break
  1014. }
  1015. }
  1016. }
  1017. this.orderDialog_list = newGoodsList
  1018. this.orderDialog_listTotal = res.data.total
  1019. })
  1020. },
  1021. // 打开弹窗 - 被置换订单
  1022. openOrderDialog() {
  1023. if (this.beiGoodsList.length < 1) {
  1024. return this.$errorMsg('请先选择被置换产品')
  1025. }
  1026. if (this.keGoodsList.length < 1) {
  1027. return this.$errorMsg('请先选择可置换产品')
  1028. }
  1029. this.orderDialog_show = true
  1030. this.getOrderList()
  1031. },
  1032. // 关闭弹窗 - 被置换订单
  1033. closeOrderDialog() {
  1034. this.orderDialog_show = false
  1035. },
  1036. // 提交筛选表单 - 被置换订单
  1037. submitOrderDialogScreenForm() {
  1038. this.orderDialog_currentPage = 1
  1039. this.getOrderList()
  1040. },
  1041. // 重置筛选表单 - 被置换订单
  1042. resetOrderDialogScreenForm() {
  1043. this.$refs.orderDialog_screenForm.resetFields()
  1044. this.orderDialog_currentPage = 1
  1045. this.orderDialog_list = []
  1046. this.getOrderList()
  1047. },
  1048. // 更改列表页码 - 被置换订单
  1049. changeOrderDialogPage(val) {
  1050. this.orderDialog_currentPage = val
  1051. this.getOrderList()
  1052. },
  1053. // 选择列 - 被置换订单
  1054. changeOrderDialogSelection(val) {
  1055. this.orderDialog_selection = val
  1056. },
  1057. // 确认选择产品 - 被置换订单
  1058. submitChooseOrder(item) {
  1059. // 订单置换(单选)
  1060. if (this.type === 1) {
  1061. this.orderList = [item]
  1062. }
  1063. // 批量置换(多选)
  1064. else {
  1065. let orderList = JSON.parse(JSON.stringify(this.orderDialog_selection))
  1066. orderList.forEach(item => {
  1067. item.ke_materialName = this.keGoodsList[0].name
  1068. item.ke_specification = this.keGoodsList[0].specification
  1069. item.ke_refundableQty = ''
  1070. })
  1071. this.orderList = this.orderList.concat(orderList)
  1072. }
  1073. this.closeOrderDialog()
  1074. },
  1075. // 删除产品 - 被置换订单
  1076. deleteOrderList(index) {
  1077. this.orderList.splice(index, 1)
  1078. },
  1079. // 判断是否存在被置换订单
  1080. checkOrder() {
  1081. if (this.orderList.length > 0) {
  1082. return this.$errorMsg('已选择订单不可更改产品')
  1083. }
  1084. return true
  1085. },
  1086. // 提交
  1087. submitForm() {
  1088. for (let i = 0; i < this.orderList.length; i++) {
  1089. if (!this.orderList[i].ke_refundableQty || this.orderList[i].ke_refundableQty < 1) {
  1090. this.$errorMsg('置换数量需大于0')
  1091. return
  1092. }
  1093. }
  1094. let params = {
  1095. type: this.type,
  1096. newMaterialIds: this.keGoodsList.map(item => {
  1097. return item.id
  1098. }),
  1099. orderItems: this.orderList.map(item => {
  1100. return {
  1101. orderId: item.id,
  1102. orderItemId: item.orderItemId,
  1103. displaceQty: item.ke_refundableQty
  1104. }
  1105. })
  1106. }
  1107. addDisplace(params).then(res => {
  1108. this.$successMsg('提交成功')
  1109. this.resetForm()
  1110. })
  1111. },
  1112. // 重置
  1113. resetForm() {
  1114. this.beiGoodsList = []
  1115. this.keGoodsList = []
  1116. this.orderList = []
  1117. }
  1118. }
  1119. }
  1120. </script>
  1121. <style lang="scss" scoped>
  1122. .main-top {
  1123. display: flex;
  1124. align-items: center;
  1125. height: 60px;
  1126. border-bottom: 1px solid #dcdfe6;
  1127. margin-bottom: 20px;
  1128. .title {
  1129. font-size: 16px;
  1130. padding-left: 10px;
  1131. font-weight: 600;
  1132. }
  1133. .el-radio-group {
  1134. margin-left: 30px;
  1135. }
  1136. }
  1137. </style>