orderRefundNewDialog.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670
  1. <template>
  2. <div class="dialog_container" v-loading.fullscreen.lock="detailLoading">
  3. <div class="main">
  4. <div class="box" style="margin-top: 15px;">
  5. <div class="item_title">{{ $t("view.shippingInfo") }}</div>
  6. <div class="ptitle">
  7. <template>
  8. <el-descriptions
  9. class="margin-top"
  10. :title="$t('title.addressInfo')"
  11. :column="4"
  12. direction="horizontal"
  13. v-if="addressInfo.length == 1"
  14. >
  15. <el-descriptions-item :label="$t('country')">{{
  16. addressInfo[0].receiverCountryCode
  17. }}</el-descriptions-item>
  18. <el-descriptions-item :label="$t('label.postalCode')">{{
  19. addressInfo[0].receiverZip
  20. }}</el-descriptions-item>
  21. <el-descriptions-item :label="$t('state')">{{
  22. addressInfo[0].receiverState
  23. }}</el-descriptions-item>
  24. <el-descriptions-item :label="$t('city')">{{
  25. addressInfo[0].receiverCity
  26. }}</el-descriptions-item>
  27. <el-descriptions-item :label="$t('suburb')">{{
  28. addressInfo[0].receiverDistrict
  29. }}</el-descriptions-item>
  30. <el-descriptions-item :label="$t('street')">{{
  31. addressInfo[0].receiverStreet
  32. }}</el-descriptions-item>
  33. <el-descriptions-item :label="$t('address')">{{
  34. addressInfo[0].receiverAddress
  35. }}</el-descriptions-item>
  36. <el-descriptions-item :label="$t('dooeNo')">{{
  37. addressInfo[0].receiverAddress2
  38. }}</el-descriptions-item>
  39. <el-descriptions-item :label="$t('recipient')">{{
  40. addressInfo[0].receiverName
  41. }}</el-descriptions-item>
  42. <el-descriptions-item :label="$t('telephone')">{{
  43. addressInfo[0].receiverPhone
  44. }}</el-descriptions-item>
  45. <el-descriptions-item :label="$t('moPhone')">{{
  46. addressInfo[0].receiverMobile
  47. }}</el-descriptions-item>
  48. <el-descriptions-item :label="$t('post')">{{
  49. addressInfo[0].email
  50. }}</el-descriptions-item>
  51. <el-descriptions-item :label="$t('label.shippingFee')">{{
  52. addressInfo[0].freight
  53. }}</el-descriptions-item>
  54. </el-descriptions>
  55. <div class="container" width="500px" v-if="addressInfo.length > 1">
  56. <div
  57. v-for="(item, index) in addressInfo"
  58. :key="index"
  59. width="100px"
  60. margin-right="50px"
  61. >
  62. <el-popover
  63. placement="top"
  64. :title="$t('title.addressInfo')"
  65. width="300"
  66. offset="300"
  67. trigger="hover"
  68. >
  69. <el-descriptions
  70. class="margin-top"
  71. title=""
  72. :column="1"
  73. direction="horizontal"
  74. >
  75. <el-descriptions-item :label="$t('country')">{{
  76. item.receiverCountryCode
  77. }}</el-descriptions-item>
  78. <el-descriptions-item :label="$t('address')">{{
  79. item.receiverAddress
  80. }}</el-descriptions-item>
  81. <el-descriptions-item :label="$t('recipient')">{{
  82. item.receiverName
  83. }}</el-descriptions-item>
  84. <el-descriptions-item :label="$t('post')">{{
  85. item.email
  86. }}</el-descriptions-item>
  87. <el-descriptions-item :label="$t('label.shippingFee')">{{
  88. item.freight
  89. }}</el-descriptions-item>
  90. </el-descriptions>
  91. <el-button
  92. slot="reference"
  93. @click="chooseClick(item.idList)"
  94. >{{ item.receiverCountryCode }}</el-button
  95. >
  96. </el-popover>
  97. </div>
  98. </div>
  99. </template>
  100. </div>
  101. </div>
  102. <div
  103. class="box"
  104. style="margin-top: 15px;padding-bottom: 10px;"
  105. v-loading="fromLoading"
  106. >
  107. <div class="item_title">{{ $t("view.refundInfo") }}</div>
  108. <div class="ptitle">
  109. <el-form
  110. label-position="left"
  111. ref="addRefundForm"
  112. :model="addRefundForm"
  113. >
  114. <div class="row">
  115. <div class="row-item">
  116. <div class="row">
  117. <el-form-item :label="$t('currency')">
  118. <el-input
  119. disabled
  120. v-model="addRefundForm.currency"
  121. placeholder
  122. class="normal-input"
  123. ></el-input>
  124. </el-form-item>
  125. <el-form-item
  126. class="inputleft"
  127. :label="$t('label.afterSalesType')"
  128. required
  129. >
  130. <el-select
  131. :placeholder="$t('place.pleaseSelect')"
  132. @change="changeRefund(null)"
  133. clearable
  134. style="width: 200px;"
  135. class="filter-item"
  136. v-model="addRefundForm.refundType"
  137. >
  138. <el-option
  139. v-for="afterSaleType in afterSaleTypes"
  140. :disabled="afterSaleType.disabled"
  141. :key="afterSaleType.value"
  142. :label="$t(afterSaleType.label)"
  143. :value="afterSaleType.value"
  144. >
  145. </el-option>
  146. </el-select>
  147. </el-form-item>
  148. <el-form-item
  149. :label="$t('label.expectedRefundAmount')"
  150. required
  151. >
  152. <el-input
  153. v-model="addRefundForm.refundTotalAmount"
  154. :disabled="true"
  155. />
  156. </el-form-item>
  157. </div>
  158. <el-form-item :label="$t('label.refundMethod')" required>
  159. <el-radio-group v-model="addRefundForm.refundMethod">
  160. <el-radio label="system">{{
  161. $t("view.systemRefund")
  162. }}</el-radio>
  163. <el-radio label="manual">{{
  164. $t("view.manualRefund")
  165. }}</el-radio>
  166. </el-radio-group>
  167. </el-form-item>
  168. <el-form-item
  169. v-if="addRefundForm.refundMethod == 'manual'"
  170. :label="$t('label.accountType')"
  171. required
  172. >
  173. <el-radio-group v-model="addRefundForm.refundAccountType">
  174. <el-radio label="PayPal">PayPal</el-radio>
  175. <!-- 银行卡暂时隐藏 -->
  176. <!-- <el-radio label="bankCard">银行卡</el-radio> -->
  177. <!-- <el-radio label="Gift Card">Gift Card</el-radio> -->
  178. </el-radio-group>
  179. </el-form-item>
  180. <el-form-item
  181. :label="$t('label.receivingAccount')"
  182. v-if="
  183. addRefundForm.refundMethod == 'manual' &&
  184. addRefundForm.refundAccountType == 'PayPal'
  185. "
  186. required
  187. >
  188. <el-input
  189. v-model="addRefundForm.refundAccount"
  190. :placeholder="$t('place.pleaseFillIn')"
  191. class="normal-input"
  192. ></el-input>
  193. </el-form-item>
  194. <el-form-item :label="$t('label.taxRefund')">
  195. <el-radio-group
  196. v-model="addRefundForm.refundTaxAble"
  197. @change="calculateRefundAmount"
  198. >
  199. <el-radio label="0">{{ $t("view.noTaxRefund") }}</el-radio>
  200. <el-radio label="1">{{ $t("view.taxRefund") }}</el-radio>
  201. </el-radio-group>
  202. </el-form-item>
  203. <el-form-item
  204. v-if="addRefundForm.refundTaxAble == 1"
  205. :label="$t('label.taxRefundAmount')"
  206. >
  207. <el-input-number
  208. v-model="addRefundForm.refundTaxAmount"
  209. :min="0.0"
  210. :step="0.01"
  211. step-strictly
  212. @change="calculateRefundAmount"
  213. ></el-input-number>
  214. </el-form-item>
  215. <!-- 选择是否退运费-->
  216. <el-form-item :label="$t('label.shippingFee')">
  217. <el-radio-group
  218. v-model="addRefundForm.refundPostage"
  219. @change="calculateRefundAmount"
  220. >
  221. <el-radio label="0">{{ $t("view.noRefund") }}</el-radio>
  222. <el-radio label="1">{{
  223. $t("view.refundShippingFee")
  224. }}</el-radio>
  225. </el-radio-group>
  226. </el-form-item>
  227. <el-form-item
  228. v-if="addRefundForm.refundPostage == 1"
  229. :label="$t('label.returnShippingFeeAmount')"
  230. >
  231. <el-input-number
  232. v-model="addRefundForm.refundPostageAmount"
  233. :min="0.0"
  234. :step="0.01"
  235. step-strictly
  236. @change="calculateRefundAmount"
  237. ></el-input-number>
  238. </el-form-item>
  239. <el-form-item
  240. v-if="this.queryRefundType == 3"
  241. :label="$t('label.receivingReturnWarehouse')"
  242. >
  243. <el-select
  244. :placeholder="$t('place.pleaseSelect')"
  245. clearable
  246. style="width: 200px;"
  247. class="filter-item"
  248. v-model="addRefundForm.warehouseCode"
  249. @change="ShippingLabelOption"
  250. >
  251. <el-option
  252. v-for="item in warehouseItems"
  253. :key="item.key"
  254. :label="item.key"
  255. :value="item.value"
  256. ></el-option>
  257. </el-select>
  258. </el-form-item>
  259. <el-form-item
  260. v-if="
  261. addRefundForm.warehouseCode == 'PSJ-G001001' ||
  262. addRefundForm.warehouseCode == 'PSJ-G001003' ||
  263. addRefundForm.warehouseCode == 'PSJ-H0000024' ||
  264. addRefundForm.warehouseCode == 'PSJ-H0000019' ||
  265. addRefundForm.warehouseCode == 'PSJ-H0000011' ||
  266. addRefundForm.warehouseCode == 'PSJ-G001004'
  267. "
  268. label="ShippingLabel"
  269. >
  270. <el-radio-group
  271. v-model="addRefundForm.slUseable"
  272. @change="changeSlradio()"
  273. >
  274. <el-radio label="0" value="0">{{
  275. $t("view.notEnabled")
  276. }}</el-radio>
  277. <el-radio label="1" value="1">{{
  278. $t("view.enabled")
  279. }}</el-radio>
  280. </el-radio-group>
  281. </el-form-item>
  282. <el-form-item
  283. v-if="
  284. this.queryRefundType == 3 &&
  285. this.addRefundForm.slUseable == 0
  286. "
  287. :label="$t('label.returnLogisticsCompanyCode')"
  288. >
  289. <el-input
  290. v-model="addRefundForm.shipmodeId"
  291. :placeholder="$t('place.pleaseFillIn')"
  292. class="normal-input"
  293. ></el-input>
  294. </el-form-item>
  295. <el-form-item
  296. v-if="
  297. this.queryRefundType == 3 &&
  298. this.addRefundForm.slUseable == 0
  299. "
  300. :label="$t('label.returnLogisticsNumber')"
  301. >
  302. <el-input
  303. v-model="addRefundForm.shippingNo"
  304. :placeholder="$t('place.pleaseFillIn')"
  305. class="normal-input"
  306. ></el-input>
  307. </el-form-item>
  308. </div>
  309. <div class="row-item">
  310. <el-form-item :label="$t('label.afterSalesInstructions')">
  311. <el-input
  312. type="textarea"
  313. class="afertextarea"
  314. :placeholder="$t('place.enterContent')"
  315. v-model="addRefundForm.notes"
  316. :rows="4"
  317. maxlength="150"
  318. show-word-limit
  319. >
  320. </el-input>
  321. </el-form-item>
  322. <el-form-item :label="$t('label.uploadVoucher')">
  323. <el-upload
  324. class="avatar-uploader"
  325. :action="uploadPhotos"
  326. :show-file-list="false"
  327. :on-success="handleAvatarSuccess"
  328. :before-upload="beforeAvatarUpload"
  329. :headers="headers"
  330. >
  331. <img v-if="imageUrl" :src="imageUrl" class="avatar" />
  332. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  333. </el-upload>
  334. </el-form-item>
  335. </div>
  336. </div>
  337. </el-form>
  338. </div>
  339. <!-- 因为要多选的问题 不考虑分页 -->
  340. <div class="box" style="margin-top: 15px;">
  341. <div class="item_title">
  342. <span>{{ $t("view.selectItems") }}</span>
  343. <el-select
  344. v-if="this.multipleSelection && this.multipleSelection.length > 0"
  345. v-model="refundReasonAss"
  346. style="width: 260px;"
  347. :placeholder="$t('place.selectCheckedRefundReasons')"
  348. clearable
  349. @change="chooseReason(refundReasonAss, reasonListAll)"
  350. >
  351. <el-option
  352. v-for="status in reasonListAll"
  353. :key="status.id"
  354. :label="status.reasonContentChinese"
  355. :value="String(status.id)"
  356. >
  357. </el-option>
  358. </el-select>
  359. <el-input
  360. v-if="otherReasonFlag == '1'"
  361. :placeholder="$t('place.enterReason')"
  362. clearable
  363. style="width: 220px;"
  364. class="filter-item"
  365. v-model="refundOtherReasonAss"
  366. @change="writeReason(refundOtherReasonAss)"
  367. />
  368. </div>
  369. <div>
  370. <el-table
  371. class="itemtable"
  372. ref="multipleTable"
  373. @select="handleSelectionChange"
  374. @select-all="handleSelectionChange"
  375. style="width: 100%;"
  376. v-loading="listLoading"
  377. :key="tableKey"
  378. :data="tableOrderDeatils"
  379. row-key="id"
  380. stripe
  381. border
  382. fit
  383. highlight-current-row
  384. >
  385. <el-table-column
  386. type="selection"
  387. width="55"
  388. :selectable="checkSelectable"
  389. fixed
  390. >
  391. </el-table-column>
  392. <el-table-column
  393. :label="$t('label.orderNumber')"
  394. width="150"
  395. align="center"
  396. prop="ordersId"
  397. fixed
  398. >
  399. </el-table-column>
  400. <el-table-column
  401. :label="$t('goodsCode')"
  402. width="150"
  403. align="center"
  404. prop="skuCode"
  405. >
  406. </el-table-column>
  407. <el-table-column
  408. :label="$t('onlyCode')"
  409. min-width="180"
  410. align="center"
  411. prop=""
  412. >
  413. <template slot-scope="scope">
  414. <div v-if="scope.row.uniqueCode">
  415. <div
  416. v-for="(item, index) in scope.row.uniqueCode"
  417. :key="index"
  418. >
  419. {{ item }}
  420. </div>
  421. </div>
  422. </template>
  423. </el-table-column>
  424. <el-table-column
  425. :label="$t('goodsName')"
  426. width="300"
  427. align="center"
  428. prop="productName"
  429. ></el-table-column>
  430. <el-table-column
  431. :label="$t('bagSkuCode')"
  432. width="180"
  433. align="center"
  434. prop="bagSkuCode"
  435. ></el-table-column>
  436. <el-table-column
  437. :label="$t('label.originalQuantity')"
  438. width="80"
  439. align="center"
  440. prop="quantity"
  441. ></el-table-column>
  442. <el-table-column
  443. :label="$t('goodsPrice')"
  444. width="80"
  445. align="center"
  446. prop="price"
  447. ></el-table-column>
  448. <el-table-column
  449. :label="$t('offerAmount')"
  450. width="80"
  451. align="center"
  452. prop="discountFee"
  453. ></el-table-column>
  454. <el-table-column
  455. :label="$t('payAmount')"
  456. width="80"
  457. align="center"
  458. prop="totalFee"
  459. ></el-table-column>
  460. <el-table-column
  461. :label="$t('label.refundPercentage')"
  462. width="150"
  463. align="center"
  464. >
  465. <template slot-scope="scope">
  466. <div v-if="multipleSelection.indexOf(scope.row) == -1">
  467. <div>{{ scope.row.refundSales }}</div>
  468. </div>
  469. <div v-else>
  470. <el-input-number
  471. v-model="scope.row.refundSales"
  472. @change="changePercentage(scope.row)"
  473. size="mini"
  474. :min="0"
  475. :max="1"
  476. :step="0.01"
  477. step-strictly
  478. ></el-input-number>
  479. </div>
  480. </template>
  481. </el-table-column>
  482. <el-table-column
  483. :label="$t('label.eligibleQuantity')"
  484. width="150"
  485. align="center"
  486. >
  487. <template slot-scope="scope">
  488. <div v-if="multipleSelection.indexOf(scope.row) == -1">
  489. <div>{{ scope.row.newQuantity }}</div>
  490. </div>
  491. <div v-else>
  492. <!-- <tableEdit :row.sync="scope.row"></tableEdit> -->
  493. <el-input-number
  494. v-model="scope.row.newQuantity"
  495. @change="changeQuantity(scope.row)"
  496. size="mini"
  497. :min="0"
  498. :max="scope.row.maxq"
  499. :step="1"
  500. step-strictly
  501. ></el-input-number>
  502. </div>
  503. </template>
  504. </el-table-column>
  505. <el-table-column
  506. :label="$t('label.refundedAmount')"
  507. width="150"
  508. align="center"
  509. >
  510. <template slot-scope="scope">
  511. <div v-if="multipleSelection.indexOf(scope.row) == -1">
  512. <div>0</div>
  513. </div>
  514. <div v-else>
  515. <el-input-number
  516. v-model="scope.row.refundAmount"
  517. size="mini"
  518. @change="refundAmountChange"
  519. :min="0.0"
  520. :max="scope.row.maxAmount"
  521. ></el-input-number>
  522. </div>
  523. </template>
  524. </el-table-column>
  525. <el-table-column
  526. :label="$t('label.needPayWithCustomers')"
  527. width="150"
  528. align="center"
  529. >
  530. <template slot-scope="scope">
  531. <div v-if="multipleSelection.indexOf(scope.row) == -1">
  532. <div>0</div>
  533. </div>
  534. <div v-else>
  535. <el-input-number
  536. v-model="scope.row.differenceAmount"
  537. size="mini"
  538. :min="0.0"
  539. :max="scope.row.originPaidAmount"
  540. @change="refundAmountChange"
  541. ></el-input-number>
  542. </div>
  543. </template>
  544. </el-table-column>
  545. <el-table-column
  546. :label="$t('label.refundReason')"
  547. width="150"
  548. align="center"
  549. >
  550. <template slot-scope="scope">
  551. <div v-if="multipleSelection.indexOf(scope.row) == -1"></div>
  552. <div v-else>
  553. <el-select
  554. v-model="scope.row.refundReason"
  555. :placeholder="$t('place.pleaseSelect')"
  556. clearable
  557. @change="refundChange(scope.row.refundReason, scope.row)"
  558. >
  559. <el-option
  560. v-for="status in scope.row.refundReasonList"
  561. :key="status.id"
  562. :label="status.reasonContentChinese"
  563. :value="String(status.id)"
  564. >
  565. </el-option>
  566. </el-select>
  567. </div>
  568. </template>
  569. </el-table-column>
  570. <el-table-column
  571. :label="$t('label.reasonExplanation')"
  572. width="150"
  573. align="center"
  574. >
  575. <template slot-scope="scope">
  576. <div v-if="multipleSelection.indexOf(scope.row) == -1"></div>
  577. <div v-else>
  578. <el-input
  579. v-if="scope.row.customOpen == '1'"
  580. :placeholder="$t('place.enterReason')"
  581. clearable
  582. style="width: 200px;"
  583. class="filter-item"
  584. v-model="scope.row.otherReason"
  585. />
  586. </div>
  587. </template>
  588. </el-table-column>
  589. <el-table-column
  590. width="55"
  591. :label="$t('label.flashPurchase')"
  592. align="center"
  593. >
  594. <template slot-scope="scope">
  595. <el-checkbox
  596. v-model="scope.row.flashPurchaseFlag == 1"
  597. ></el-checkbox>
  598. </template>
  599. </el-table-column>
  600. <el-table-column
  601. width="55"
  602. :label="$t('label.exchangePurchase')"
  603. align="center"
  604. >
  605. <template slot-scope="scope">
  606. <el-checkbox
  607. v-model="scope.row.exchangePurchaseFlag == 1"
  608. ></el-checkbox>
  609. </template>
  610. </el-table-column>
  611. <!-- 多件多折 -->
  612. <el-table-column
  613. width="80"
  614. :label="$t('multipleDiscountInfo.multipleDiscount')"
  615. align="center"
  616. >
  617. <template slot-scope="scope">
  618. <el-checkbox
  619. :value="scope.row.manyfoldFlag === 2"
  620. ></el-checkbox>
  621. </template>
  622. </el-table-column>
  623. <el-table-column
  624. :label="$t('label.refundedQuantity')"
  625. width="80"
  626. align="center"
  627. prop="refundQuantity"
  628. ></el-table-column>
  629. <el-table-column
  630. :label="$t('status')"
  631. width="80"
  632. align="center"
  633. prop="status"
  634. >
  635. <template slot-scope="scope">
  636. {{ scope.row.status | statusFilter }}
  637. </template>
  638. </el-table-column>
  639. <el-table-column
  640. :label="$t('label.signedForTheReturn')"
  641. width="80"
  642. align="center"
  643. prop="matchStatus"
  644. >
  645. <template slot-scope="scope">
  646. <span v-if="scope.row.matchStatus == 'unmatch'">
  647. {{ $t("label.notMatched") }}
  648. </span>
  649. <span
  650. v-if="
  651. scope.row.matchStatus == 'order_matched' ||
  652. scope.row.matchStatus == 'matched'
  653. "
  654. >
  655. {{ $t("label.matchedSuccess") }}
  656. </span>
  657. <span v-if="scope.row.matchStatus == null">
  658. {{ $t("label.not") }}
  659. </span>
  660. </template>
  661. </el-table-column>
  662. </el-table>
  663. </div>
  664. </div>
  665. <!-- 多件多折折扣重算 -->
  666. <div class="box" v-has="'priceRule:list'">
  667. <div class="item_title">
  668. {{ $t("multipleDiscountInfo.multipleDiscountReCal") }}
  669. </div>
  670. <div>
  671. <el-table
  672. :key="tableKey"
  673. :data="returnPreviewDatas"
  674. row-key="id"
  675. stripe
  676. border
  677. fit
  678. highlight-current-row
  679. >
  680. <el-table-column type="index" width="40" />
  681. <el-table-column
  682. :label="$t('multipleDiscountInfo.OriginalDiscount')"
  683. align="center"
  684. prop="originTip"
  685. />
  686. <el-table-column
  687. :label="$t('multipleDiscountInfo.OriginalMoneny')"
  688. align="center"
  689. prop="originalOrderAmount"
  690. />
  691. <el-table-column
  692. :label="$t('multipleDiscountInfo.afterReturnDiscount')"
  693. align="center"
  694. prop="currentTip"
  695. />
  696. <el-table-column
  697. :label="$t('multipleDiscountInfo.afterReturnMoney')"
  698. align="center"
  699. prop="currentOrderAmount"
  700. />
  701. <el-table-column
  702. :label="$t('multipleDiscountInfo.returnMoney')"
  703. align="center"
  704. prop="refundAmount"
  705. >
  706. <template slot-scope="scope">
  707. {{ scope.row.refundAmount || 0 }}
  708. </template>
  709. </el-table-column>
  710. <el-table-column
  711. :label="$t('multipleDiscountInfo.needPayMoney')"
  712. align="center"
  713. prop="differenceAmount"
  714. >
  715. <template slot-scope="scope">
  716. {{ scope.row.differenceAmount || 0 }}
  717. </template>
  718. </el-table-column>
  719. </el-table>
  720. </div>
  721. </div>
  722. <div class="box total_box">
  723. <div class="item_title">
  724. {{ $t("view.totalRefund") }}
  725. </div>
  726. <div class="item_box">
  727. {{ $t("view.totalRefund") }}:{{ addRefundForm.refundTotalAmount }}
  728. </div>
  729. </div>
  730. <div class="box btn_box">
  731. <el-button
  732. :style="btnStyle"
  733. class="save_btn"
  734. type="primary"
  735. @click="submit(this)"
  736. v-loading="btnLoading"
  737. >{{ $t("save") }}</el-button
  738. >
  739. <el-button type="danger" class="backbtn" @click="back">{{
  740. $t("back")
  741. }}</el-button>
  742. </div>
  743. </div>
  744. </div>
  745. </div>
  746. </template>
  747. <script>
  748. // import {getRefundReason} from '@/api/oms/refund/refund'
  749. import global from "@/views/oms/global";
  750. import waves from "@/directive/waves";
  751. import { getToken } from "@/utils/auth";
  752. import { dcmSub } from "@/utils/toolUtil";
  753. import {
  754. queryOrderDetailsByOrmorder,
  755. statusKeyValue
  756. } from "@/api/oms/order/order";
  757. import {
  758. validPromotionReq,
  759. warehouseList,
  760. checkSubmitRefund,
  761. backstageSubmitRefund,
  762. getDetailListByRefundId
  763. } from "@/api/oms/refund/refund";
  764. import { BigNumber } from "bignumber.js";
  765. import tableEdit from "./tableEdit";
  766. export default {
  767. name: "orderRefundNewDialog",
  768. props: ["params"],
  769. directives: {
  770. waves
  771. },
  772. components: {
  773. global,
  774. tableEdit
  775. },
  776. filters: {
  777. statusFilter(key) {
  778. return statusKeyValue[key];
  779. }
  780. },
  781. data() {
  782. return {
  783. matchStatus: null,
  784. listLoading: false,
  785. detailLoading: false,
  786. fromLoading: false,
  787. btnLoading: false,
  788. addressInfo: [],
  789. tableOrderDeatils: [],
  790. multipleSelection: [],
  791. returnPreviewDatas: [], // 勾选后,退款预览数据
  792. originReturnPreviewDatas: {}, //记录下来的,退款原来预览数据
  793. addRefundForm: {
  794. refundMethod: "system",
  795. refundAccountType: "PayPal",
  796. refundAccount: "",
  797. refundType: "",
  798. refundPostage: "0",
  799. refundAmount: 0.0, //商品退款金额
  800. differenceAmount: 0, // 补款金额
  801. refundPostageAmount: 0.0,
  802. warehouseCode: "",
  803. annexPath: "",
  804. items: [],
  805. quantity: 0,
  806. refundTaxAble: "0", //是否退税
  807. refundTaxAmount: 0.0, //退税金额
  808. refundTotalAmount: 0.0, //总计退款金额 = 商品退款金额 + 退运费金额 + 退税金额 。 实际执行时,refundAmount=商品退款金额 + 退税金额;退运费金额单独计算
  809. // refundReason:'', // 退款原因
  810. // otherReason:'', // 其他退款理由
  811. slUseable: "0", //是否开启ShippingLabel选项
  812. currency: "", //币种
  813. shipmodeId: "", //退货物流公司编号
  814. shippingNo: "", //退货物流单号
  815. notes: ""
  816. },
  817. afterSaleTypes: global.afterSaleType, //售后类型
  818. warehouseItems: [],
  819. queryRefundType: "",
  820. queryOrmorder: "",
  821. btnStyle: "",
  822. imageUrl: "",
  823. uploadPhotos: process.env.VUE_APP_OMS_API + "ordersRefund/uploadPhotos",
  824. reasonListAll: [],
  825. refundReasonAss: "",
  826. refundOtherReasonAss: "",
  827. otherReasonFlag: "",
  828. tableKey: Math.random(),
  829. isRefund: true //是否是退款 true:退款 false:补款
  830. };
  831. },
  832. created() {
  833. //情况清空数据
  834. this.getWarehouseList();
  835. this.getDetail();
  836. },
  837. computed: {
  838. // 计算属性的 getter
  839. headers: function() {
  840. return {
  841. "X-Token": getToken()
  842. };
  843. }
  844. },
  845. methods: {
  846. getDetail() {
  847. this.ShippingLabelOption();
  848. //初始化数据
  849. this.addRefundForm.refundAmount = 0.0;
  850. this.addRefundForm.differenceAmount = 0.0;
  851. this.addRefundForm.noTaxRefundAmount = 0.0;
  852. this.addRefundForm.noTaxDifferenceAmount = 0.0;
  853. this.addRefundForm.refundPostage = "0";
  854. this.addRefundForm.refundPostageAmount = 0.0;
  855. this.addRefundForm.warehouseCode = "";
  856. this.addRefundForm.annexPath = "";
  857. this.addRefundForm.items = [];
  858. this.addRefundForm.quantity = 0.0;
  859. this.addRefundForm.refundTaxAble = "0"; //是否退税
  860. this.addRefundForm.refundTaxAmount = 0.0; //退税金额
  861. this.addRefundForm.refundTotalAmount = 0.0;
  862. this.addRefundForm.shipmodeId = "";
  863. this.addRefundForm.shippingNo = "";
  864. this.addRefundForm.refundMethod = "system";
  865. this.addRefundForm.refundAccountType = "PayPal";
  866. this.addRefundForm.refundAccount = "";
  867. this.addRefundForm.notes = "";
  868. this.addressInfo = [];
  869. this.reasonListAll = [];
  870. this.refundReasonAss = "";
  871. this.refundOtherReasonAss = "";
  872. this.otherReasonFlag = "";
  873. //查询满足条件的所有订单项
  874. this.detailLoading = true;
  875. getDetailListByRefundId(this.params.id)
  876. .then(res => {
  877. if (200 == res.code) {
  878. //第一次查询的退款类型
  879. this.queryRefundType = res.data.refundType;
  880. this.queryOrmorder = res.data.ormorder;
  881. this.addRefundForm = res.data;
  882. this.addressInfo = res.data.addressList;
  883. this.reasonListAll = res.data.refundReasonList;
  884. this.selectIds = res.data.items.map(item => item.orderitemId);
  885. this.getOrders();
  886. let oldRefundTaxAmount = BigNumber(
  887. this.addRefundForm.refundTotalAmount
  888. )
  889. .plus(BigNumber(-this.addRefundForm.refundPostageAmount))
  890. .plus(BigNumber(-this.addRefundForm.refundAmount))
  891. .toFixed(2);
  892. if (oldRefundTaxAmount > 0) {
  893. this.$set(this.addRefundForm, "refundTaxAble", "1"); //是否退税
  894. } else {
  895. oldRefundTaxAmount = 0;
  896. this.$set(this.addRefundForm, "refundTaxAble", "0"); //是否退税
  897. }
  898. this.$set(
  899. this.addRefundForm,
  900. "refundTaxAmount",
  901. oldRefundTaxAmount
  902. ); //是否退税 this.addRefundForm.
  903. } else {
  904. this.$message.error(res.msg);
  905. }
  906. })
  907. .finally(() => {
  908. this.detailLoading = false;
  909. });
  910. },
  911. // 获取订单项
  912. getOrders() {
  913. this.listLoading = true;
  914. let _this = this;
  915. //查询订单详情
  916. let query = { ...this.params };
  917. queryOrderDetailsByOrmorder(query)
  918. .then(res => {
  919. if (res.code === 200) {
  920. let goodsRefundAmount = BigNumber(0);
  921. this.tableOrderDeatils = res.data;
  922. let details = [];
  923. this.refundReasonList = this.addRefundForm.refundReasonList;
  924. const selectDatas = this.addRefundForm.items;
  925. const multipleSelection = []; // 默认选中的列
  926. if (res.data) {
  927. details = res.data.map(row => {
  928. // 可用退款件数
  929. let quantity = 0;
  930. if (row.refundQuantity > 0) {
  931. quantity = dcmSub(row.quantity, row.refundQuantity);
  932. } else {
  933. quantity = row.quantity;
  934. }
  935. row.newQuantity = quantity;
  936. for (let ind2 in selectDatas) {
  937. //明细属于当前退款单
  938. row.refundReasonList = selectDatas[ind2].refundReasonList;
  939. if (selectDatas[ind2].orderitemId === row.orderitemId) {
  940. row.refundAmount = selectDatas[ind2].refundAmount;
  941. row.newQuantity = selectDatas[ind2].quantity;
  942. row.refundReason = String(selectDatas[ind2].refundReason);
  943. row.customOpen = this.getCustopen(
  944. row.refundReason,
  945. selectDatas[ind2].refundReasonList
  946. );
  947. row.otherReason = selectDatas[ind2].otherReason;
  948. row.refundReasonList = selectDatas[ind2].refundReasonList;
  949. row.refundItemId = selectDatas[ind2].id;
  950. goodsRefundAmount = goodsRefundAmount.plus(
  951. BigNumber(selectDatas[ind2].refundAmount)
  952. );
  953. row.selectedRow = 1;
  954. // 选中当前行
  955. // _this.$nextTick(() => {
  956. // _this.$refs.multipleTable.toggleRowSelection(row, true);
  957. // });
  958. multipleSelection.push(row);
  959. }
  960. }
  961. return row;
  962. });
  963. // 默认选中
  964. this.multipleSelection = multipleSelection;
  965. //退商品金额计算一下
  966. this.refundAmount = goodsRefundAmount.toFixed(2);
  967. this.tableOrderDeatils = details;
  968. this.$nextTick(() => {
  969. this.tableOrderDeatils.forEach(row => {
  970. if (row.selectedRow == 1) {
  971. this.$refs.multipleTable.toggleRowSelection(row, true);
  972. }
  973. });
  974. this.reCalReturn(); // 获取折扣信息
  975. });
  976. }
  977. }
  978. })
  979. .finally(() => {
  980. this.listLoading = false;
  981. });
  982. },
  983. getCustopen(id, arr) {
  984. let customOpen = "";
  985. if (id) {
  986. arr.forEach(item => {
  987. if (item.id == id) {
  988. customOpen = item.custom;
  989. }
  990. });
  991. }
  992. return customOpen;
  993. },
  994. //获取退货仓库信息
  995. getWarehouseList() {
  996. warehouseList().then(res => {
  997. if (200 == res.code) {
  998. this.warehouseItems = res.data;
  999. }
  1000. });
  1001. },
  1002. //计算退款总额 商品退款金额 + 退运费金额 +退税金额
  1003. calculateRefundAmount() {
  1004. //如果没选择退税 或者税费为空
  1005. if (
  1006. this.addRefundForm.refundTaxAble != "1" ||
  1007. this.addRefundForm.refundTaxAmount === "NaN" ||
  1008. !this.addRefundForm.refundTaxAmount
  1009. ) {
  1010. this.addRefundForm.refundTaxAmount = BigNumber(0)
  1011. .toNumber()
  1012. .toFixed(2);
  1013. }
  1014. //如果没选择退运费 或者运费为空
  1015. if (
  1016. this.addRefundForm.refundPostage != "1" ||
  1017. !this.addRefundForm.refundPostageAmount ||
  1018. this.addRefundForm.refundPostageAmount === "NaN"
  1019. ) {
  1020. this.addRefundForm.refundPostageAmount = BigNumber(0)
  1021. .toNumber()
  1022. .toFixed(2);
  1023. }
  1024. var taxAndShippingAmount = BigNumber(this.addRefundForm.refundTaxAmount)
  1025. .plus(BigNumber(this.addRefundForm.refundPostageAmount))
  1026. .toNumber()
  1027. .toFixed(2);
  1028. let price =
  1029. this.addRefundForm.noTaxRefundAmount !== "NaN" &&
  1030. this.addRefundForm.noTaxRefundAmount > 0
  1031. ? BigNumber(this.addRefundForm.noTaxRefundAmount)
  1032. : BigNumber(this.addRefundForm.noTaxDifferenceAmount).negated();
  1033. this.addRefundForm.refundTotalAmount = BigNumber(taxAndShippingAmount)
  1034. .plus(BigNumber(price))
  1035. .toNumber()
  1036. .toFixed(2);
  1037. },
  1038. // 重新计算退款的金额
  1039. reCalReturn() {
  1040. const formData = {
  1041. ormOrderId: this.queryOrmorder,
  1042. promotionRefundDetails: this.multipleSelection.map(item => ({
  1043. soOrderId: item.ordersId,
  1044. orderItemId: item.orderitemId,
  1045. ormOrderItemId: item.ormOrderItemId,
  1046. quantity: this.queryRefundType === 1 ? 0 : item.newQuantity
  1047. }))
  1048. };
  1049. this.listLoading = true;
  1050. checkSubmitRefund(formData)
  1051. .then(res => {
  1052. if (res.code === 200) {
  1053. const { orderPreviewVO, ordersRefund } = res.data;
  1054. const { isRefund, titleAmount } = orderPreviewVO;
  1055. const refundAmount = isRefund ? titleAmount : 0;
  1056. const differenceAmount = isRefund ? 0 : titleAmount;
  1057. this.returnPreviewDatas = [
  1058. { ...orderPreviewVO, refundAmount, differenceAmount }
  1059. ];
  1060. this.originReturnPreviewDatas = orderPreviewVO;
  1061. this.isRefund = orderPreviewVO.isRefund;
  1062. const totalPrice = this.multipleSelection.reduce((prev, cur) => {
  1063. return prev + cur.totalFee;
  1064. }, 0);
  1065. for (let k in this.multipleSelection) {
  1066. let row = this.multipleSelection[k];
  1067. let data = ordersRefund.items.find(
  1068. item => item.ormOrderItemId === row.ormOrderItemId
  1069. );
  1070. // 金额最大值
  1071. row.maxAmount =
  1072. this.queryRefundType !== "1" ? data.refundAmount : row.totalFee;
  1073. if (orderPreviewVO.isRefund) {
  1074. // 退款
  1075. row.refundAmount = data.refundAmount;
  1076. row.differenceAmount = 0;
  1077. } else {
  1078. // 补差价
  1079. const val = this.calNeedPaidMoney(
  1080. k,
  1081. row,
  1082. orderPreviewVO.titleAmount,
  1083. totalPrice
  1084. );
  1085. row.originPaidAmount = val;
  1086. row.differenceAmount = val;
  1087. row.refundAmount = 0;
  1088. }
  1089. row.originRefundAmount = data.refundAmount;
  1090. }
  1091. this.jisuan();
  1092. } else {
  1093. this.$message.error(res.msg);
  1094. }
  1095. })
  1096. .finally(() => {
  1097. this.listLoading = false;
  1098. });
  1099. },
  1100. // 计算补差价的金额
  1101. calNeedPaidMoney(i, row, differenceAmount, totalPrice) {
  1102. let data = 0;
  1103. if (this.multipleSelection.length === 1) {
  1104. data = differenceAmount;
  1105. } else if (i === String(this.multipleSelection.length - 1)) {
  1106. const price = this.multipleSelection.reduce((prev, cur) => {
  1107. const amont = cur.differenceAmount || 0;
  1108. return prev + amont;
  1109. }, 0);
  1110. // 最后一个的时候,需要用减法
  1111. data = (differenceAmount - price).toFixed(2);
  1112. } else {
  1113. data = ((row.totalFee / totalPrice) * differenceAmount).toFixed(2);
  1114. }
  1115. return Number(data);
  1116. },
  1117. // 当前选中的 退款金额
  1118. handleSelectionChange(val) {
  1119. this.refundAmount = 0;
  1120. this.differenceAmount = 0;
  1121. this.multipleSelection = val;
  1122. // 当数组没有变动时,不用重算
  1123. // if (JSON.stringify(this.selectIds) === JSON.stringify(ids)) return false;
  1124. if (this.multipleSelection && this.multipleSelection.length > 0) {
  1125. // 如果是退款新版本,包含多件多折 需要重算退款金额
  1126. this.reCalReturn();
  1127. } else {
  1128. this.refundAmount = 0;
  1129. this.addRefundForm.refundAmount = 0;
  1130. this.addRefundForm.differenceAmount = 0;
  1131. this.addRefundForm.noTaxRefundAmount = 0;
  1132. this.addRefundForm.noTaxDifferenceAmount = 0;
  1133. this.differenceAmount = 0;
  1134. this.returnPreviewDatas = [];
  1135. this.addRefundForm.refundTotalAmount = 0;
  1136. }
  1137. },
  1138. refundAmountChange() {
  1139. this.jisuan();
  1140. },
  1141. jisuan() {
  1142. this.taxAndShippingAmount = BigNumber(this.addRefundForm.refundTaxAmount)
  1143. .plus(BigNumber(this.addRefundForm.refundPostageAmount))
  1144. .toNumber();
  1145. let refundAmount = BigNumber(0); // 退款金额
  1146. let differenceAmount = BigNumber(0); // 补款单金额
  1147. if (this.multipleSelection && this.multipleSelection.length > 0) {
  1148. for (let uy in this.multipleSelection) {
  1149. var row = this.multipleSelection[uy];
  1150. refundAmount = refundAmount.plus(BigNumber(row.refundAmount));
  1151. differenceAmount = differenceAmount.plus(
  1152. BigNumber(row.differenceAmount)
  1153. );
  1154. }
  1155. this.refundAmount = refundAmount.toNumber().toFixed(2);
  1156. this.differenceAmount = differenceAmount.toNumber().toFixed(2);
  1157. }
  1158. this.$set(this.addRefundForm, "noTaxRefundAmount", this.refundAmount);
  1159. this.$set(
  1160. this.addRefundForm,
  1161. "noTaxDifferenceAmount",
  1162. this.differenceAmount
  1163. );
  1164. const refundNewAmount =
  1165. this.refundAmount === "NaN" ? 0 : this.refundAmount;
  1166. const differenceNewAmount =
  1167. this.differenceAmount === "NaN" ? 0 : this.differenceAmount;
  1168. this.returnPreviewDatas[0].refundAmount = refundNewAmount;
  1169. this.returnPreviewDatas[0].differenceAmount = differenceNewAmount;
  1170. let total = 0;
  1171. let price =
  1172. refundNewAmount > 0 ? refundAmount : differenceAmount.negated();
  1173. // 退款
  1174. total = price
  1175. .plus(BigNumber(this.taxAndShippingAmount))
  1176. .toNumber()
  1177. .toFixed(2);
  1178. this.$set(this.addRefundForm, "refundTotalAmount", total);
  1179. },
  1180. checkSelectable(row) {
  1181. // 虚拟商品不可选
  1182. if (row.skuCode === "BXGYPD250300") return false;
  1183. if (row.refundQuantity > 0) {
  1184. var refcount = dcmSub(row.quantity, row.refundQuantity);
  1185. //发生退款
  1186. if (refcount <= 0 && this.queryRefundType != "1") {
  1187. return false; //不可选择
  1188. }
  1189. row["maxq"] = refcount;
  1190. } else {
  1191. row["maxq"] = row.quantity;
  1192. }
  1193. //未发货
  1194. if (
  1195. this.queryRefundType == "2" &&
  1196. (row.status == "delivery" ||
  1197. row.status == "off" ||
  1198. row.status == "partdelivery")
  1199. ) {
  1200. return false; //不可选择
  1201. }
  1202. //退货退款
  1203. else if (
  1204. this.queryRefundType == "3" &&
  1205. (row.status == "unchecked" ||
  1206. row.status == "check" ||
  1207. row.status == "undelivery")
  1208. ) {
  1209. return false; //不可选择
  1210. }
  1211. // 促销赠品
  1212. // if (row.isGift === "1" && row.isPromotion === 1) {
  1213. // return false; //不可选择
  1214. // }
  1215. return true;
  1216. },
  1217. refundChange(id, arr) {
  1218. if (id) {
  1219. arr.refundReasonList.forEach(item => {
  1220. if (item.id == id) {
  1221. arr.customOpen = item.custom;
  1222. if (arr.customOpen && arr.customOpen != 1) {
  1223. arr.otherReason = "";
  1224. }
  1225. }
  1226. });
  1227. } else {
  1228. arr.customOpen = "";
  1229. }
  1230. },
  1231. writeReason(otherReason) {
  1232. if (this.multipleSelection && this.multipleSelection.length > 0) {
  1233. for (let uy in this.multipleSelection) {
  1234. var row = this.multipleSelection[uy];
  1235. if (row.customOpen == 1) {
  1236. row.otherReason = otherReason;
  1237. }
  1238. ``;
  1239. }
  1240. }
  1241. },
  1242. chooseReason(id, arr) {
  1243. if (id) {
  1244. arr.forEach(item => {
  1245. if (item.id == id) {
  1246. this.otherReasonFlag = item.custom;
  1247. }
  1248. });
  1249. } else {
  1250. this.otherReasonFlag = "";
  1251. }
  1252. if (this.multipleSelection && this.multipleSelection.length > 0) {
  1253. for (let uy in this.multipleSelection) {
  1254. var row = this.multipleSelection[uy];
  1255. row.refundReason = String(id);
  1256. row.customOpen = this.otherReasonFlag;
  1257. if (row.customOpen != 1) {
  1258. row.otherReason = "";
  1259. }
  1260. }
  1261. }
  1262. },
  1263. changeQuantity() {
  1264. this.reCalReturn();
  1265. },
  1266. changePercentage(row) {
  1267. //当前行的退款金额
  1268. row.refundAmount = BigNumber(row.originRefundAmount)
  1269. .multipliedBy(BigNumber(row.refundSales))
  1270. .toNumber()
  1271. .toFixed(2);
  1272. this.jisuan();
  1273. },
  1274. handleAvatarSuccess(res, file) {
  1275. this.imageUrl = res.accessUrl;
  1276. if (this.imageUrl) {
  1277. this.addRefundForm.annexPath = this.imageUrl;
  1278. }
  1279. },
  1280. beforeAvatarUpload(file) {
  1281. const isJPG = file.type === "image/jpeg";
  1282. const isLt2M = file.size / 1024 / 1024 < 2;
  1283. if (!isJPG) {
  1284. this.$message.error("上传头像图片只能是 JPG 格式!");
  1285. }
  1286. if (!isLt2M) {
  1287. this.$message.error("上传头像图片大小不能超过 2MB!");
  1288. }
  1289. return isJPG && isLt2M;
  1290. },
  1291. chooseClick(idList) {
  1292. this.getDetail(idList);
  1293. },
  1294. //创建退款单
  1295. submit() {
  1296. if (this.multipleSelection.some(it => it.matchStatus == "unmatch")) {
  1297. this.$message.error("已签收退货状态匹配错误,请匹配成功后重试!");
  1298. return false;
  1299. }
  1300. var flag = false;
  1301. var str = "";
  1302. if (this.addressInfo.length != 1) {
  1303. this.$message.error("请确保地址信息为1!");
  1304. return false;
  1305. }
  1306. if (flag) {
  1307. this.$message.error(str + ",请点击查询后继续此操作");
  1308. return false;
  1309. }
  1310. //验证通过 保存逻辑
  1311. this.addRefundForm.ormorder = this.queryOrmorder;
  1312. this.addRefundForm.refundType = this.queryRefundType;
  1313. //退货退款仓库验证
  1314. if (
  1315. this.addRefundForm.refundType == 3 &&
  1316. !this.addRefundForm.warehouseCode
  1317. ) {
  1318. this.$message.error("请选择收退货仓库!");
  1319. return false;
  1320. }
  1321. if (this.multipleSelection.length == 0) {
  1322. this.$message.error("请选择要退的货品!");
  1323. return false;
  1324. }
  1325. var items = [];
  1326. this.$confirm(
  1327. "退款总计:" + this.addRefundForm.refundTotalAmount + ",是否确认?",
  1328. "提示",
  1329. {
  1330. confirmButtonText: "确定",
  1331. cancelButtonText: "取消",
  1332. type: "warning"
  1333. }
  1334. )
  1335. .then(async () => {
  1336. for (let ind in this.multipleSelection) {
  1337. var obj = this.multipleSelection[ind];
  1338. if (!obj.refundReason) {
  1339. this.$alert(obj.ordersId + ":请选择退款原因");
  1340. return;
  1341. }
  1342. var newobj = {
  1343. productName: obj.productName,
  1344. quantity: this.queryRefundType === 1 ? 0 : obj.newQuantity,
  1345. ormOrderItemId: obj.ormOrderItemId,
  1346. orderitemId: obj.orderitemId,
  1347. skuCode: obj.skuCode,
  1348. refundAmount: obj.refundAmount,
  1349. differenceAmount: obj.differenceAmount,
  1350. refundReason: obj.refundReason,
  1351. otherReason: obj.otherReason,
  1352. soOrdersId: obj.ordersId,
  1353. isGift: obj.isGift,
  1354. isPromotion: obj.isPromotion
  1355. };
  1356. items.push(newobj);
  1357. }
  1358. this.addRefundForm.items = items;
  1359. //这里默认客服发起
  1360. this.addRefundForm.originatorFlag = 1;
  1361. // 总金额, 正数为退款 负数为补款
  1362. let val = Number(this.addRefundForm.refundTotalAmount);
  1363. if (val < 0) {
  1364. this.addRefundForm.differenceAmount = Math.abs(val);
  1365. this.addRefundForm.refundAmount = 0;
  1366. } else {
  1367. this.addRefundForm.refundAmount = val;
  1368. this.addRefundForm.differenceAmount = 0;
  1369. }
  1370. this.btnLoading = true;
  1371. const saveRefund = () => {
  1372. let query = {
  1373. orderPreviewVO: this.originReturnPreviewDatas,
  1374. ordersRefund: this.addRefundForm
  1375. };
  1376. backstageSubmitRefund(query)
  1377. .then(res => {
  1378. if (200 == res.code) {
  1379. this.$message({
  1380. message: this.$t("optSuccess"),
  1381. type: "success"
  1382. });
  1383. items = [];
  1384. this.btnStyle = "display:none";
  1385. }
  1386. })
  1387. .finally(() => {
  1388. this.btnLoading = false;
  1389. });
  1390. };
  1391. const validPromotion = async () => {
  1392. // 校验是否包含促销赠品,不包含直接返回true
  1393. if (
  1394. !this.tableOrderDeatils.some(
  1395. item => item.isGift === "1" && item.isPromotion === 1
  1396. )
  1397. ) {
  1398. return true;
  1399. }
  1400. // TODO 解开注释请求校验
  1401. // 校验是否满足促销条件 满足返回true(不提示)
  1402. const { code, data } = await validPromotionReq(this.addRefundForm);
  1403. if (code === 200) {
  1404. return data.valid;
  1405. }
  1406. return false;
  1407. };
  1408. // TODO 存在赠品的订单,在客服创建未发货退款售后单时,需判断扣除已退款明细之后是否还满足促销条件,若不满足,需弹窗提示客服,由客服判断是否继续执行退款。
  1409. if (await validPromotion()) {
  1410. saveRefund();
  1411. } else {
  1412. const res = await this.$confirm(
  1413. "退款后订单将不满足促销条件,是否确认?",
  1414. "提示",
  1415. {
  1416. confirmButtonText: "确定",
  1417. cancelButtonText: "取消",
  1418. type: "warning"
  1419. }
  1420. );
  1421. if (res === "confirm") {
  1422. saveRefund();
  1423. }
  1424. }
  1425. })
  1426. .catch(() => {
  1427. this.btnLoading = false;
  1428. this.$message({
  1429. type: "info",
  1430. message: "已取消操作"
  1431. });
  1432. });
  1433. },
  1434. //TODO 暂时关闭SL
  1435. ShippingLabelOption() {
  1436. this.addRefundForm.slUseable = "0";
  1437. if (
  1438. this.refundType == 3 &&
  1439. this.queryRefundType == 3 &&
  1440. this.addressInfo &&
  1441. this.addressInfo.length > 0 &&
  1442. this.addressInfo[0].receiverCountryCode == "US" &&
  1443. (this.addRefundForm.warehouseCode == "PSJ-H0000024" ||
  1444. this.addRefundForm.warehouseCode == "PSJ-H0000019" ||
  1445. this.addRefundForm.warehouseCode == "PSJ-H0000011" ||
  1446. this.addRefundForm.warehouseCode == "PSJ-G001001" ||
  1447. this.addRefundForm.warehouseCode == "PSJ-G001003" ||
  1448. this.addRefundForm.warehouseCode == "PSJ-G001004")
  1449. ) {
  1450. this.addRefundForm.slUseable = "1";
  1451. } else {
  1452. this.addRefundForm.slUseable = "0";
  1453. }
  1454. },
  1455. changeSlradio() {
  1456. if (this.addRefundForm.slUseable == "0") {
  1457. this.addRefundForm.shipmodeId = "";
  1458. this.addRefundForm.shippingNo = "";
  1459. }
  1460. },
  1461. back() {
  1462. this.$emit("back");
  1463. }
  1464. }
  1465. };
  1466. </script>
  1467. <style lang="scss" scoped>
  1468. .head {
  1469. padding: 0px 20px;
  1470. display: flex;
  1471. justify-content: space-between;
  1472. span:nth-child(1) {
  1473. font-size: 15px;
  1474. line-height: 25px;
  1475. color: #909399;
  1476. font-weight: 600;
  1477. }
  1478. span:nth-child(2) {
  1479. line-height: 25px;
  1480. cursor: pointer;
  1481. color: #ae8878;
  1482. font-size: 13px;
  1483. }
  1484. }
  1485. .avatar-uploader .el-upload {
  1486. border: 1px dashed #d9d9d9;
  1487. border-radius: 6px;
  1488. cursor: pointer;
  1489. position: relative;
  1490. overflow: hidden;
  1491. }
  1492. .avatar-uploader .el-upload:hover {
  1493. border-color: #409eff;
  1494. }
  1495. .avatar-uploader-icon {
  1496. font-size: 28px;
  1497. color: #8c939d;
  1498. width: 82px;
  1499. height: 82px;
  1500. line-height: 82px;
  1501. text-align: center;
  1502. border-radius: 3px;
  1503. border: 1px solid #dcdfe6;
  1504. margin-left: 49px;
  1505. }
  1506. .avatar {
  1507. width: 178px;
  1508. height: 178px;
  1509. display: block;
  1510. }
  1511. .dialog_container {
  1512. position: relative;
  1513. }
  1514. .main {
  1515. margin-top: 15px;
  1516. .box {
  1517. .item_title {
  1518. color: #606266;
  1519. font-size: 16px !important;
  1520. line-height: 16px;
  1521. position: relative;
  1522. padding-left: 8px !important;
  1523. &:before {
  1524. position: absolute;
  1525. left: 0px;
  1526. top: 13px;
  1527. content: "";
  1528. display: inline-block;
  1529. width: 3px;
  1530. height: 13px;
  1531. background: #ae8877;
  1532. border-radius: 0px 0px 0px 0px;
  1533. }
  1534. }
  1535. .box_item {
  1536. padding: 0 20px;
  1537. display: flex;
  1538. .item_title {
  1539. line-height: 40px;
  1540. font-size: 18px;
  1541. text-align: left;
  1542. font-weight: 600;
  1543. }
  1544. .item_list {
  1545. text-align: left;
  1546. font-size: 14px;
  1547. color: #606266;
  1548. display: flex;
  1549. p {
  1550. margin: 10px 0;
  1551. }
  1552. div:nth-child(2) {
  1553. margin-left: 30px;
  1554. }
  1555. }
  1556. }
  1557. .item_title {
  1558. padding-left: 20px;
  1559. line-height: 40px;
  1560. font-size: 18px;
  1561. text-align: left;
  1562. font-weight: 600;
  1563. }
  1564. }
  1565. }
  1566. .ptitle {
  1567. display: flex;
  1568. justify-content: space-between;
  1569. margin: 20px 0px;
  1570. color: #1f2d3d;
  1571. text-align: left;
  1572. font-weight: bold;
  1573. width: 100%;
  1574. /deep/.el-descriptions__title {
  1575. color: #606266;
  1576. }
  1577. }
  1578. .filter-container {
  1579. .filter-item {
  1580. margin-right: 11px;
  1581. }
  1582. }
  1583. .container {
  1584. display: flex; /* 使用 Flexbox 布局 */
  1585. justify-content: space-between; /* 将盒子平均分布在容器中 */
  1586. }
  1587. .row {
  1588. width: 100%;
  1589. display: flex;
  1590. flex-wrap: wrap;
  1591. /deep/.el-form-item {
  1592. display: flex;
  1593. }
  1594. .inputleft {
  1595. margin-right: 30px;
  1596. margin-left: 30px;
  1597. }
  1598. .row-item {
  1599. margin-right: 10vw;
  1600. &:last-child {
  1601. margin-right: 0px;
  1602. }
  1603. }
  1604. .afertextarea {
  1605. width: 306px;
  1606. }
  1607. }
  1608. .el-table {
  1609. font-size: 12px;
  1610. margin: 20px 0px;
  1611. }
  1612. .itemtable {
  1613. /deep/thead {
  1614. th {
  1615. background: #f5f0ee;
  1616. padding: 0px;
  1617. }
  1618. }
  1619. }
  1620. .total_box {
  1621. margin-bottom: 20px;
  1622. .item_box {
  1623. margin-top: 15px;
  1624. }
  1625. }
  1626. .btn_box {
  1627. position: absolute;
  1628. right: 0px;
  1629. bottom: -24px;
  1630. .el-button {
  1631. padding: 10px 37px;
  1632. }
  1633. }
  1634. </style>