salesReturnEdit.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. <template>
  2. <div class="salesReturnEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="salesReturnEdit-back" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <span style="margin: 0 10px;color: #666;font-weight: bold;">
  9. 单号:{{ ordeDetail&&ordeDetail.salesReturnBillNo }}
  10. </span>
  11. <span style="margin: 0 10px;color: #666;">客户名称:{{ ordeDetail&&ordeDetail.buyerName || '--' }}</span>
  12. <span style="margin: 0 10px;color: #666;">
  13. 退货仓库:{{ ordeDetail&&ordeDetail.warehouseName }}
  14. </span>
  15. <span style="margin: 0 10px;color: #666;">
  16. 退货类别:{{ ordeDetail&&ordeDetail.goodFlagDictValue }}
  17. </span>
  18. </template>
  19. <!-- 操作区,位于 title 行的行尾 -->
  20. <template slot="extra">
  21. <a-button
  22. key="3"
  23. type="default"
  24. class="button-info"
  25. id="salesReturnEdit-preview-btn"
  26. v-if="$hasPermissions('B_salesReturnPrint')"
  27. :disabled="chooseLoadData.length==0"
  28. @click="handlePrint('preview')">打印预览</a-button>
  29. <a-button
  30. key="2"
  31. type="primary"
  32. class="button-info"
  33. id="salesReturnEdit-print-btn"
  34. v-if="$hasPermissions('B_salesReturnPrint')"
  35. :disabled="chooseLoadData.length==0"
  36. @click="handlePrint('print')">快捷打印</a-button>
  37. <a-divider type="vertical" />
  38. <a-button
  39. key="1"
  40. type="default"
  41. class="button-warning"
  42. id="salesReturnEdit-export-btn"
  43. v-if="$hasPermissions('B_salesReturnExport')"
  44. :disabled="chooseLoadData.length==0"
  45. @click="handlePrint('export')">导出Excel</a-button>
  46. </template>
  47. </a-page-header>
  48. <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
  49. <!-- 查询配件列表 -->
  50. <queryPart ref="partQuery" :newLoading="isInster" @add="saveProduct"></queryPart>
  51. </a-card>
  52. <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
  53. <a-alert style="margin-bottom: 10px;" type="info">
  54. <div slot="message" class="total-bar">
  55. <div>
  56. <span>申请退货数量:{{ ordeDetail&&(ordeDetail.totalInitialQty || ordeDetail.totalInitialQty==0) ? ordeDetail.totalInitialQty : '--' }};</span>
  57. <span v-if="$hasPermissions('B_salesReturnEdit_salesPrice')">参考退货金额:{{ ordeDetail&&(ordeDetail.totalAmount || ordeDetail.totalAmount==0) ? toThousands(ordeDetail.totalAmount) : '--' }};</span>
  58. </div>
  59. </div>
  60. </a-alert>
  61. <div class="table-page-search-wrapper" style="display:flex;align-items: center;justify-content: space-between;">
  62. <div style="flex-grow:1;">
  63. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  64. <a-row :gutter="15">
  65. <a-col :md="6" :sm="24">
  66. <a-form-item label="产品编码">
  67. <a-input v-model.trim="productForm.productCode" allowClear placeholder="请输入产品编码"/>
  68. </a-form-item>
  69. </a-col>
  70. <a-col :md="6" :sm="24">
  71. <a-form-item label="产品名称">
  72. <a-input v-model.trim="productForm.productName" allowClear placeholder="请输入产品名称"/>
  73. </a-form-item>
  74. </a-col>
  75. <a-col :md="6" :sm="24">
  76. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled">查询</a-button>
  77. <a-button style="margin-left: 5px" @click="resetSearchForm(true)" :disabled="disabled">重置</a-button>
  78. </a-col>
  79. </a-row>
  80. </a-form>
  81. </div>
  82. <div>
  83. <span style="margin-right: 10px;" v-if="selNums">已选{{ selNums }}项</span>
  84. <a-button v-if="goodFlag == 'GOOD_PRODUCT_RETURN'" type="default" class="button-info" @click="openPlSetReason(1)">整单设置退货原因</a-button>
  85. <a-button type="default" class="button-info" style="margin-left: 5px;" @click="openPlSetReason(0)">批量设置退货原因</a-button>
  86. <a-button type="primary" class="button-info" id="salesReturnEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
  87. </div>
  88. </div>
  89. <!-- 已选配件列表 -->
  90. <s-table
  91. class="sTable"
  92. ref="table"
  93. size="small"
  94. :rowKey="(record) => record.id"
  95. :row-selection="{ columnWidth: 40 }"
  96. @rowSelection="rowSelectionFun"
  97. :columns="columns"
  98. :data="loadData"
  99. :defaultLoadData="false"
  100. :scroll="{ y: 300 }"
  101. bordered>
  102. <!-- 本次退货数量 -->
  103. <template slot="qty" slot-scope="text, record">
  104. <a-input-number
  105. id="salesReturn-qty"
  106. size="small"
  107. v-model="record.initialQty"
  108. :precision="0"
  109. :min="0"
  110. :max="99999999"
  111. placeholder="请输入"
  112. @blur="e => onCellBlur(e.target.value, record, 'qty')"
  113. style="width: 100%;" />
  114. </template>
  115. <!-- 退货原因 -->
  116. <template slot="returnReason" slot-scope="text, record">
  117. <returnReason :goodFlag="goodFlag" v-model="record.returnReasonCode" @change="e => updateReason(e, record, 0)"></returnReason>
  118. </template>
  119. <!-- 备注 -->
  120. <template slot="returnRemarks" slot-scope="text, record">
  121. <a-input size="small" placeholder="请输入备注" v-model="record.returnReasonRemarks" @blur="e => updateReason(e, record, 1)"></a-input>
  122. </template>
  123. <!-- 操作 -->
  124. <template slot="action" slot-scope="text, record">
  125. <a-button
  126. size="small"
  127. type="link"
  128. :loading="delLoading"
  129. class="button-error"
  130. @click="handleDel(record)"
  131. id="salesReturn-Del">删除</a-button>
  132. </template>
  133. </s-table>
  134. </a-card>
  135. </a-spin>
  136. <div class="affix-cont">
  137. <a-button
  138. size="large"
  139. style="padding: 0 60px;"
  140. :disabled="spinning"
  141. type="primary"
  142. class="button-primary"
  143. @click="beforeSubmit()"
  144. id="salesReturn-handleSubmit">提交</a-button>
  145. </div>
  146. <!-- 选择审核人员 -->
  147. <chooseDepartUserModal ref="chooseDepart" :showDefUser="true" :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
  148. <!-- 导入产品 -->
  149. <importGuideModal :goodFlag="goodFlag == 'GOOD_PRODUCT_RETURN' ? 1 : 0" :openModal="openGuideModal" :params="{salesReturnBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
  150. <!-- 批量设置退货原因 -->
  151. <commonModal modalTit="批量设置退货原因" :openModal="showPlModal" @cancel="showPlModal=false" @ok="setPlReturnReason">
  152. <div style="text-align: left;">
  153. <div style="line-height: 24px;">
  154. <div><span style="color:red;">*</span>退货原因</div>
  155. <div><returnReason size="large" :goodFlag="goodFlag" v-model="plReturnReason"></returnReason></div>
  156. </div>
  157. <div style="line-height: 24px;margin-top:10px;">
  158. <a-checkbox :checked="showEditRemarks" @change="e => showEditRemarks=!showEditRemarks">是否设置备注</a-checkbox>
  159. </div>
  160. <div style="line-height: 24px;margin-top:10px;" v-if="showEditRemarks">
  161. <div>备注</div>
  162. <div><a-input size="large" :maxLength="50" placeholder="请输入备注(最多50字符)" v-model="plReturnRemark"></a-input></div>
  163. </div>
  164. </div>
  165. </commonModal>
  166. </div>
  167. </template>
  168. <script>
  169. import { commonMixin } from '@/utils/mixin'
  170. import { STable, VSelect } from '@/components'
  171. import { printFun, exportExcel } from '@/libs/JGPrint.js'
  172. import ImportGuideModal from './importGuideModal.vue'
  173. import queryPart from './queryPart.vue'
  174. import commonModal from '@/views/common/commonModal.vue'
  175. import EditableCell from '@/views/common/editInput.js'
  176. import chooseDepartUserModal from './chooseDepartUserModal.vue'
  177. import warehouse from '@/views/common/chooseWarehouse.js'
  178. import returnReason from '@/views/common/returnReason'
  179. import {
  180. salesReturnDetail,
  181. salesReturnSubmit,
  182. salesReturnBatchInsert,
  183. salesReturnPrint,
  184. salesReturnExport,
  185. salesReturnModify,
  186. submitVerify
  187. } from '@/api/salesReturn'
  188. import {
  189. salesReturnDetailList,
  190. salesReturnDetailDel,
  191. salesReturnDetailInsert,
  192. salesReturnDetailUpdateQty,
  193. salesReturnDetailUpdateReason,
  194. salesReturnDetailSetReason,
  195. salesReturnUpdateAllReason
  196. } from '@/api/salesReturnDetail'
  197. export default {
  198. name: 'SalesReturnEdit',
  199. mixins: [commonMixin],
  200. components: {
  201. STable,
  202. VSelect,
  203. queryPart,
  204. EditableCell,
  205. ImportGuideModal,
  206. chooseDepartUserModal,
  207. returnReason,
  208. commonModal,
  209. warehouse
  210. },
  211. data () {
  212. return {
  213. spinning: false,
  214. orderId: null,
  215. orderSn: null,
  216. buyerSn: null,
  217. disabled: false,
  218. isInster: false, // 是否正在添加产品
  219. openDepartUserModal: false,
  220. ordeDetail: { discountAmount: 0 },
  221. delLoading: false,
  222. // 已选产品
  223. dataSource: [],
  224. productForm: {
  225. salesReturnBillSn: '',
  226. productName: '',
  227. productCode: ''
  228. },
  229. chooseLoadData: [],
  230. // 加载数据方法 必须为 Promise 对象
  231. loadData: parameter => {
  232. this.disabled = true
  233. // 查询总计
  234. this.productForm.salesReturnBillSn = this.orderSn
  235. return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
  236. let data
  237. if (res.status == 200) {
  238. data = res.data
  239. const no = (data.pageNo - 1) * data.pageSize
  240. for (var i = 0; i < data.list.length; i++) {
  241. data.list[i].no = no + i + 1
  242. data.list[i].qtyBackups = data.list[i].initialQty
  243. data.list[i].returnReasonBackups = data.list[i].returnReasonCode
  244. data.list[i].bakReamrks = data.list[i].returnReasonRemarks
  245. }
  246. this.disabled = false
  247. this.chooseLoadData = data.list
  248. this.total = res.data.count
  249. }
  250. return data
  251. })
  252. },
  253. openGuideModal: false, // 导入产品引导
  254. total: 0,
  255. rowSelectionInfo: null,
  256. plReturnReason: undefined,
  257. plReturnRemark: undefined,
  258. showEditRemarks: false,
  259. showPlModal: false,
  260. returnReasonlist: []
  261. }
  262. },
  263. watch: {
  264. showPlModal (newValue, oldValue) {
  265. if (!newValue) {
  266. this.plReturnReason = undefined
  267. this.plReturnRemark = undefined
  268. this.showEditRemarks = false
  269. }
  270. }
  271. },
  272. computed: {
  273. goodFlag () {
  274. return this.ordeDetail && this.ordeDetail.goodFlag || ''
  275. },
  276. selNums () {
  277. return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
  278. },
  279. columns () {
  280. const arr = [
  281. { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
  282. { title: '产品编码', dataIndex: 'productEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
  283. { title: '产品名称', dataIndex: 'productEntity.name', width: '20%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  284. { title: '单位', dataIndex: 'productEntity.unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
  285. { title: '申请退货数量', dataIndex: 'initialQty', align: 'center', width: '8%', scopedSlots: { customRender: 'qty' } },
  286. { title: '退货原因', dataIndex: 'returnReason', align: 'center', width: '13%', scopedSlots: { customRender: 'returnReason' } },
  287. { title: '备注', scopedSlots: { customRender: 'returnRemarks' }, width: '10%', align: 'center' },
  288. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  289. ]
  290. if (this.$hasPermissions('B_salesReturnEdit_salesPrice')) { // 售价权限
  291. arr.splice(4, 0, { title: '参考退货单价', dataIndex: 'price', align: 'right', width: '8%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  292. arr.splice(7, 0, { title: '参考退货金额', align: 'right', dataIndex: 'totalAmount', width: '8%', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  293. }
  294. return arr
  295. }
  296. },
  297. methods: {
  298. // 返回
  299. handleBack () {
  300. this.$router.push({ name: 'salesReturnList', query: { closeLastOldTab: true } })
  301. },
  302. // 表格选中项
  303. rowSelectionFun (obj) {
  304. this.rowSelectionInfo = obj || null
  305. },
  306. // 已选产品 blur
  307. onCellBlur (val, record, type) {
  308. const valBackups = record.qtyBackups
  309. // 光标移出,值发生改变再调用编辑接口
  310. if (val && val != valBackups) {
  311. this.spinning = true
  312. salesReturnDetailUpdateQty({
  313. salesReturnDetailSn: record.salesReturnDetailSn,
  314. initialQty: record.initialQty,
  315. price: record.price
  316. }).then(res => {
  317. if (res.status == 200) {
  318. this.resetTable(false)
  319. this.$message.success(res.message)
  320. this.spinning = false
  321. record.qtyBackups = record.initialQty
  322. } else {
  323. this.spinning = false
  324. record.initialQty = valBackups
  325. }
  326. })
  327. } else {
  328. record.initialQty = valBackups
  329. }
  330. },
  331. // 修改仓库
  332. updateWarehouse (warehouseSn) {
  333. const _this = this
  334. _this.spinning = true
  335. const params = { id: this.ordeDetail.id, warehouseSn: warehouseSn }
  336. salesReturnModify(params).then(res => {
  337. if (res.status == 200) {
  338. _this.$message.success(res.message)
  339. _this.getOrderDetail()
  340. }
  341. _this.spinning = false
  342. })
  343. },
  344. // 修改退货原因
  345. updateReason (val, record, type) {
  346. console.log(val, record, type)
  347. const params = {
  348. salesReturnDetailSn: record.salesReturnDetailSn,
  349. goodFlag: this.goodFlag
  350. }
  351. // 退货原因
  352. if (type == 0) {
  353. const rows = this.returnReasonlist.find(item => item.code == val)
  354. params.returnReasonCode = val || ''
  355. params.returnReason = rows ? rows.dispName : ''
  356. } else {
  357. // 备注
  358. params.returnReasonRemarks = val.target.value
  359. if (params.returnReasonRemarks == record.bakReamrks) {
  360. return
  361. }
  362. }
  363. this.spinning = true
  364. salesReturnDetailUpdateReason(params).then(res => {
  365. if (res.status == 200) {
  366. this.resetTable(false)
  367. this.$message.success(res.message)
  368. } else {
  369. record.returnReasonCode = record.returnReasonBackups
  370. }
  371. this.spinning = false
  372. })
  373. },
  374. // 批量设置退货原因
  375. openPlSetReason (type) {
  376. // 整单设置
  377. if (type == 1) {
  378. this.$refs.table.clearSelected()
  379. this.showPlModal = true
  380. } else {
  381. if (this.selNums) {
  382. this.showPlModal = true
  383. } else {
  384. this.$message.warning('请先选择产品!')
  385. }
  386. }
  387. },
  388. setPlReturnReason () {
  389. if (!this.plReturnReason) {
  390. this.$message.warning('请选择退货原因!')
  391. } else {
  392. const rows = this.returnReasonlist.find(item => item.code == this.plReturnReason)
  393. const params = {
  394. salesReturnBillSn: this.orderSn,
  395. returnReason: rows ? rows.dispName : '',
  396. returnReasonCode: this.plReturnReason,
  397. returnReasonRemarks: this.showEditRemarks ? this.plReturnRemark || '' : undefined
  398. }
  399. // 批量或整单设置
  400. const funs = this.selNums ? salesReturnDetailSetReason : salesReturnUpdateAllReason
  401. // 批量设置
  402. if (this.selNums) {
  403. const snList = []
  404. const arr = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
  405. arr.map(item => snList.push(item.salesReturnDetailSn))
  406. params.salesReturnBillDetailSnList = snList
  407. }
  408. this.spinning = true
  409. funs(params).then(res => {
  410. if (res.status == 200) {
  411. this.showPlModal = false
  412. this.$refs.table.clearSelected()
  413. this.resetTable(false)
  414. }
  415. this.spinning = false
  416. })
  417. }
  418. },
  419. // 获取单据详细
  420. getOrderDetail (flag) {
  421. salesReturnDetail({ sn: this.orderSn }).then(res => {
  422. this.ordeDetail = res.data || null
  423. if (res.data.goodFlag == 'DEFECTIVE_PRODUCT_RETURN') {
  424. this.returnReasonlist = this.$store.state.app.defectiveReturnReason
  425. }
  426. // 良品
  427. if (res.data.goodFlag == 'GOOD_PRODUCT_RETURN') {
  428. this.returnReasonlist = this.$store.state.app.goodReturnReason
  429. }
  430. this.$refs.table.refresh(!flag)
  431. if (!flag) {
  432. this.$refs.partQuery.pageInit(this.buyerSn, this.ordeDetail.warehouseSn, this.goodFlag)
  433. }
  434. })
  435. },
  436. // 删除产品
  437. handleDel (row) {
  438. const _this = this
  439. this.$confirm({
  440. title: '提示',
  441. content: '确认要删除吗?',
  442. centered: true,
  443. closable: true,
  444. onOk () {
  445. _this.delLoading = true
  446. _this.spinning = true
  447. salesReturnDetailDel({ salesReturnDetailSn: row.salesReturnDetailSn, salesReturnBillSn: _this.orderSn }).then(res => {
  448. if (res.status == 200) {
  449. _this.resetTable(false)
  450. }
  451. _this.$message.info(res.message)
  452. _this.delLoading = false
  453. _this.spinning = false
  454. })
  455. }
  456. })
  457. },
  458. resetTable (flag) {
  459. this.$refs.table.refresh(flag)
  460. this.getOrderDetail(true)
  461. },
  462. // 重置
  463. resetSearchForm (flag) {
  464. this.productForm.productName = ''
  465. this.productForm.productCode = ''
  466. this.getOrderDetail(flag)
  467. },
  468. // 添加或修改产品
  469. saveProduct (row) {
  470. // 防止多次添加产品
  471. if (this.isInster) {
  472. return
  473. }
  474. // 退货原因
  475. const rows = this.returnReasonlist.find(item => item.code == row.returnReasonCode)
  476. this.isInster = true
  477. const params = {
  478. 'salesReturnBillSn': this.orderSn,
  479. 'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
  480. 'price': row.productPrice,
  481. 'returnReasonCode': row.returnReasonCode,
  482. 'returnReason': rows ? rows.dispName : '',
  483. 'goodFlag': this.goodFlag,
  484. 'productSn': row.productSn,
  485. 'initialQty': row.qty
  486. }
  487. this.spinning = true
  488. salesReturnDetailInsert(params).then(res => {
  489. if (res.status == 200) {
  490. this.resetSearchForm(true)
  491. this.$message.success(res.message)
  492. }
  493. this.isInster = false
  494. this.spinning = false
  495. })
  496. },
  497. beforeSubmit () {
  498. if (this.total) {
  499. const hasKong = this.chooseLoadData.find(item => !item.returnReason)
  500. if (hasKong) {
  501. this.$message.warning('请输入退货原因!')
  502. } else {
  503. // 判断价格
  504. submitVerify({ salesReturnBillSn: this.orderSn }).then(res => {
  505. if (res.status == 200) {
  506. if (!res.data) {
  507. this.openDepartUserModal = true
  508. if (this.ordeDetail.billStatus == 'AUDIT_REJECT') {
  509. this.$refs.chooseDepart.getDetail(this.ordeDetail)
  510. }
  511. } else {
  512. const arr = res.data.split('\n')
  513. this.$notification.open({
  514. message: '提示',
  515. description:
  516. <div>
  517. {arr.map(item =>
  518. (<p>{item}</p>)
  519. )}
  520. </div>
  521. })
  522. }
  523. }
  524. })
  525. }
  526. } else {
  527. this.$message.warning('请添加产品!')
  528. }
  529. },
  530. // 提交销售退货
  531. handleSubmit (data) {
  532. this.spinning = true
  533. salesReturnSubmit({ salesReturnBillSn: this.orderSn, ...data }).then(res => {
  534. if (res.status == 200) {
  535. this.handleBack()
  536. this.$message.success(res.message)
  537. }
  538. this.spinning = false
  539. })
  540. },
  541. closeGuideModel () {
  542. this.openGuideModal = false
  543. },
  544. // 导入产品
  545. hanldeOk (obj) {
  546. salesReturnBatchInsert(obj).then(res => {
  547. if (res.status == 200) {
  548. this.resetTable(true)
  549. }
  550. })
  551. },
  552. // 打印预览/快捷打印
  553. handlePrint (type) {
  554. const _this = this
  555. const a = ['WAIT_CUSTOMER_SERVICE_CONFIRM', 'WAIT_FINANCIAL_AUDIT', 'FINANCIAL_REJECT', 'FINISH'].find(item => item == this.ordeDetail.billStatus)
  556. const status = a ? 'SALES_RETURN_AMOUNT' : 'SALES_RETURN_REASON'
  557. const params = { salesReturnBillSn: this.$route.params.sn, priceType: status }
  558. _this.spinning = true
  559. // 导出
  560. if (type == 'export') {
  561. exportExcel(salesReturnExport, params, '销售退货', function () {
  562. _this.spinning = false
  563. _this.$store.state.app.curActionPermission = ''
  564. })
  565. } else {
  566. // 打印或预览
  567. printFun(salesReturnPrint, params, type, '销售退货', () => {
  568. _this.spinning = false
  569. _this.$store.state.app.curActionPermission = ''
  570. })
  571. }
  572. },
  573. pageInit () {
  574. this.orderSn = this.$route.params.sn
  575. this.buyerSn = this.$route.params.buyerSn
  576. this.resetSearchForm()
  577. }
  578. },
  579. mounted () {
  580. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  581. this.pageInit()
  582. }
  583. },
  584. activated () {
  585. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  586. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  587. this.pageInit()
  588. }
  589. },
  590. beforeRouteEnter (to, from, next) {
  591. next(vm => {})
  592. }
  593. }
  594. </script>
  595. <style lang="less">
  596. .salesReturnEdit-wrap{
  597. position: relative;
  598. height: 100%;
  599. padding-bottom: 51px;
  600. box-sizing: border-box;
  601. >.ant-spin-nested-loading{
  602. overflow-y: scroll;
  603. height: 100%;
  604. }
  605. .salesReturnEdit-cont{
  606. margin-top: 6px;
  607. .total-bar{
  608. display: flex;
  609. align-items: center;
  610. justify-content: space-between;
  611. > div{
  612. &:last-child{
  613. display: flex;
  614. align-items: center;
  615. justify-content: space-between;
  616. > div{
  617. padding: 0 10px;
  618. }
  619. }
  620. }
  621. }
  622. }
  623. }
  624. </style>