displace_list.vue 46 KB

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