orderRefundNewDialog.vue 55 KB

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