salesReturnEdit.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  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 15px;color: #666;font-size: 18px;font-weight: 600;">退货单号:{{ ordeDetail&&ordeDetail.salesReturnNo||'--' }}</span>
  9. <a-button type="primary" ghost @click="isShowBisiceInfo=!isShowBisiceInfo" style="margin-left:10px;vertical-align:middle;">
  10. 基础信息
  11. <a-icon :type="isShowBisiceInfo ? 'up' : 'down'"/>
  12. </a-button>
  13. <a-button
  14. type="link"
  15. size="small"
  16. @click="handleEditCustom"
  17. style="margin-left:10px"
  18. class="button-info"
  19. key="0"> <a-icon type="edit"></a-icon> 编辑</a-button>
  20. </template>
  21. <!-- 操作区,位于 title 行的行尾 -->
  22. <template slot="extra" v-if="$hasPermissions('B_salesReturnPrint')">
  23. <Print :disabled="chooseLoadData.length==0" @handlePrint="handlePrint"></Print>
  24. </template>
  25. </a-page-header>
  26. <!-- 基础信息 -->
  27. <a-card size="small" :bordered="false" v-show="isShowBisiceInfo" class="pages-wrap">
  28. <a-collapse :activeKey="['1']">
  29. <a-collapse-panel key="1" header="基础信息">
  30. <a-descriptions size="small" :column="3">
  31. <a-descriptions-item label="客户名称">{{ ordeDetail&&ordeDetail.buyerNameCurrent?ordeDetail.buyerName?ordeDetail.buyerName==ordeDetail.buyerNameCurrent?ordeDetail.buyerNameCurrent:ordeDetail.buyerNameCurrent+'('+ordeDetail.buyerName+')':ordeDetail.buyerNameCurrent:'--' }}</a-descriptions-item>
  32. <a-descriptions-item label="客户地址">
  33. <div v-if="ordeDetail&&(ordeDetail.provinceName || ordeDetail.cityName || ordeDetail.countyName || ordeDetail.customerAddr)">
  34. {{ ordeDetail&&ordeDetail.provinceName || '' }}
  35. {{ ordeDetail&&ordeDetail.cityName || '' }}
  36. {{ ordeDetail&&ordeDetail.countyName || '' }}
  37. {{ ordeDetail&&ordeDetail.customerAddr || '' }}
  38. </div>
  39. <span v-else>--</span>
  40. </a-descriptions-item>
  41. <a-descriptions-item label="联系电话">{{ ordeDetail&&ordeDetail.contactTel || '--' }}</a-descriptions-item>
  42. <a-descriptions-item label="退货单号">{{ ordeDetail&&ordeDetail.salesReturnNo || '--' }}</a-descriptions-item>
  43. <a-descriptions-item label="业务状态">{{ ordeDetail&&ordeDetail.stateDictValue || '--' }}</a-descriptions-item>
  44. <a-descriptions-item label="是否抓单">{{ ordeDetail&&ordeDetail.grabFlag==1?'抓单':'不抓单' }}</a-descriptions-item>
  45. <a-descriptions-item label="备注">{{ ordeDetail&&ordeDetail.remarks || '--' }}</a-descriptions-item>
  46. </a-descriptions>
  47. </a-collapse-panel>
  48. </a-collapse>
  49. </a-card>
  50. <a-card size="small" :bordered="false" class="pages-wrap">
  51. <!-- 查询配件列表 -->
  52. <queryPart
  53. ref="queryPart"
  54. grabFlag="0"
  55. :newLoading="isInster"
  56. :warehouseCascadeData="warehouseCascadeData"
  57. @add="saveProduct"></queryPart>
  58. </a-card>
  59. <a-card size="small" :bordered="false" class="pages-wrap" ref="tableWrap">
  60. <!-- alert -->
  61. <a-alert style="margin-bottom: 10px;" type="info">
  62. <div slot="message" class="total-bar">
  63. <div v-if="countData">
  64. <span>退货总金额:{{ countData&&(countData.totalAmount || countData.totalAmount==0) ? toThousands(countData.totalAmount) : '--' }};</span>
  65. <span>总款数:{{ countData&&(countData.totalCategory || countData.totalCategory==0) ? countData.totalCategory : '--' }};</span>
  66. <span>总数量:{{ countData&&(countData.totalQty || countData.totalQty==0) ? countData.totalQty : '--' }};</span>
  67. <span>废品总数量:{{ countData&&(countData.totalCelQty || countData.totalCelQty==0) ? countData.totalCelQty : '--' }};</span>
  68. </div>
  69. <div v-if="ordeDetail">
  70. <div>
  71. 折扣金额:
  72. <a-input-number id="discount" v-model="ordeDetail.discountAmount" :min="0" :precision="2" :max="999999"/>
  73. <a-button type="primary" @click="salesReturnDiscount" class="button-info">打折</a-button>
  74. </div>
  75. <div>
  76. 折扣:<strong>{{ ordeDetail&&(ordeDetail.discountRate || ordeDetail.discountRate==0) ? ordeDetail.discountRate+'%' : '--' }}</strong>;
  77. 折后总售价:<strong>{{ ordeDetail&&(ordeDetail.discountedAmount || ordeDetail.discountedAmount==0) ? toThousands(ordeDetail.discountedAmount) : '--' }}</strong>;
  78. </div>
  79. </div>
  80. </div>
  81. </a-alert>
  82. <!-- 搜索条件 -->
  83. <div class="table-page-search-wrapper">
  84. <a-row :gutter="15">
  85. <a-col :span="18">
  86. <a-form-model layout="inline" :model="productForm" @keyup.enter.native="$refs.table.refresh(true)">
  87. <a-row :gutter="15">
  88. <a-col :md="8" :sm="24">
  89. <a-form-model-item label="产品编码">
  90. <a-input v-model.trim="productForm.productCode" allowClear placeholder="输入产品编码" />
  91. </a-form-model-item>
  92. </a-col>
  93. <a-col :md="8" :sm="24">
  94. <a-form-model-item label="产品名称">
  95. <a-input v-model.trim="productForm.productName" allowClear placeholder="输入产品名称" />
  96. </a-form-model-item>
  97. </a-col>
  98. <a-col :md="8" :sm="24">
  99. <a-form-model-item>
  100. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesReturn-refresh">查询</a-button>
  101. <a-button style="margin-left: 5px" @click="resetForm" id="salesReturn-reset">重置</a-button>
  102. </a-form-model-item>
  103. </a-col>
  104. </a-row>
  105. </a-form-model>
  106. </a-col>
  107. <a-col :span="6">
  108. <div style="float:right;overflow: hidden;">
  109. <!-- <a-button id="salesReturn-dru">导入明细</a-button> -->
  110. <a-button
  111. style="padding: 0 25px;"
  112. type="primary"
  113. :disabled="spinning"
  114. class="button-primary"
  115. @click="handleSubmit()"
  116. id="salesReturn-handleSubmit">提交</a-button>
  117. <a-button
  118. type="primary"
  119. ghost
  120. @click="salesReturnDelAll"
  121. :disabled="chooseLoadData.length==0"
  122. :loading="delLoading"
  123. style="margin-left: 10px"
  124. id="salesReturn-del-all">清空列表</a-button>
  125. </div>
  126. </a-col>
  127. </a-row>
  128. </div>
  129. <!-- 已选配件列表 -->
  130. <s-table
  131. class="sTable"
  132. ref="table"
  133. size="small"
  134. :rowKey="(record) => record.id"
  135. :columns="columns"
  136. :data="loadData"
  137. :defaultLoadData="false"
  138. :pageSize="10"
  139. :scroll="{ y: 200 }"
  140. bordered>
  141. <!-- 本次退货数量 -->
  142. <template slot="qty" slot-scope="text, record">
  143. <a-input-number
  144. id="salesReturn-qty"
  145. size="small"
  146. v-model="record.qty"
  147. :precision="0"
  148. :min="0"
  149. :max="999999"
  150. placeholder="请输入"
  151. @blur="e => onCellBlur(e.target.value, record, 'qty')"
  152. style="width: 100%;" />
  153. </template>
  154. <!-- 废品数量 -->
  155. <template slot="celQty" slot-scope="text, record">
  156. <a-input-number
  157. id="salesReturn-celQty"
  158. size="small"
  159. v-model="record.celQty"
  160. :precision="0"
  161. :min="0"
  162. :max="999999"
  163. placeholder="请输入"
  164. @blur="e => onCellBlur(e.target.value, record, 'celQty')"
  165. style="width: 100%;" />
  166. </template>
  167. <!-- 价格 -->
  168. <template slot="price" slot-scope="text, record">
  169. <a-input-number
  170. id="salesReturn-price"
  171. size="small"
  172. v-model="record.price"
  173. :precision="2"
  174. :min="0"
  175. :max="999999"
  176. placeholder="请输入"
  177. @blur="e => onCellBlur(e.target.value, record, 'price')"
  178. style="width: 100%;" />
  179. </template>
  180. <!-- 退货金额小计 -->
  181. <template slot="returnAmount" slot-scope="text, record">
  182. {{ toThousands(record.price * record.qty) }}
  183. </template>
  184. <!-- 仓库仓位 -->
  185. <template slot="warehouse" slot-scope="text, record, index">
  186. <a-cascader
  187. size="small"
  188. @change="e => changeWarehouseCascade(e, record, index)"
  189. v-model="record.warehouseCascade"
  190. expand-trigger="hover"
  191. :options="warehouseCascadeData"
  192. :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
  193. id="bulkWarehousingOrderEdit-warehouseCascade"
  194. placeholder="请选择仓库仓位"
  195. style="width: 100%;" />
  196. </template>
  197. <!-- 操作 -->
  198. <template slot="action" slot-scope="text, record">
  199. <a-button
  200. size="small"
  201. type="link"
  202. :loading="delLoading"
  203. class="button-error"
  204. @click="handleDel(record)"
  205. id="salesReturn-Del">删除</a-button>
  206. </template>
  207. </s-table>
  208. </a-card>
  209. </a-spin>
  210. <!-- <div class="affix-cont"></div> -->
  211. <!-- 选择客户弹框 -->
  212. <choose-custom-modal ref="editCustomModal" :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
  213. </div>
  214. </template>
  215. <script>
  216. import { commonMixin } from '@/utils/mixin'
  217. import { STable, VSelect } from '@/components'
  218. import queryPart from './queryPart.vue'
  219. import chooseCustomModal from './chooseCustomModal.vue'
  220. import { warehouseCascadeList } from '@/api/warehouse'
  221. import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit, salesReturnDetailPrint, salesDetailExport } from '@/api/salesReturn'
  222. import Print from '@/views/common/print.vue'
  223. import { hdPrint } from '@/libs/JGPrint'
  224. export default {
  225. name: 'SalesReturnEdit',
  226. components: {
  227. STable,
  228. VSelect,
  229. queryPart,
  230. chooseCustomModal,
  231. Print
  232. },
  233. mixins: [commonMixin],
  234. data () {
  235. const _this = this
  236. return {
  237. spinning: false,
  238. orderId: null,
  239. orderSn: null,
  240. buyerSn: null,
  241. disabled: false,
  242. openModal: false,
  243. isInster: false, // 是否正在添加产品
  244. ordeDetail: { discountAmount: 0 },
  245. delLoading: false,
  246. warehouseCascadeData: [], // 仓库仓位
  247. // 已选产品
  248. dataSource: [],
  249. productForm: {
  250. productCode: '',
  251. productName: '',
  252. orderBy: 'sales_return_bill_detail.CREATE_DATE desc'
  253. },
  254. countData: null,
  255. // 表头
  256. columns: [
  257. { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
  258. { title: '产品编码', dataIndex: 'dealerProductEntity.code', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  259. { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', width: '12%', customRender: function (text) { return text || '--' }, ellipsis: true },
  260. { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', align: 'center', width: '12%', customRender: function (text) { return text || '--' } },
  261. { title: '售价', dataIndex: 'price', align: 'center', width: '7%', scopedSlots: { customRender: 'price' } },
  262. { title: '单位', dataIndex: 'dealerProductEntity.unit', align: 'center', width: '5%', customRender: function (text) { return text || '--' } },
  263. { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: '12%', align: 'center' },
  264. { title: '退货数量', dataIndex: 'qty', align: 'center', width: '6%', scopedSlots: { customRender: 'qty' } },
  265. { title: '废品数量', dataIndex: 'celQty', align: 'center', width: '6%', scopedSlots: { customRender: 'celQty' } },
  266. { title: '退货金额小计', align: 'right', scopedSlots: { customRender: 'returnAmount' }, width: '8%' },
  267. { title: '折后金额小计', dataIndex: 'discountedAmount', align: 'right', width: '8%', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  268. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  269. ],
  270. chooseLoadData: [],
  271. // 加载数据方法 必须为 Promise 对象
  272. loadData: parameter => {
  273. this.disabled = true
  274. // 查询总计
  275. this.productForm.salesReturnBillSn = this.$route.params.sn
  276. this.getQueryCount(Object.assign(parameter, this.productForm))
  277. return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
  278. let data
  279. if (res.status == 200) {
  280. data = res.data
  281. const no = (data.pageNo - 1) * data.pageSize
  282. for (var i = 0; i < data.list.length; i++) {
  283. data.list[i].no = no + i + 1
  284. data.list[i].qtyBackups = data.list[i].qty
  285. data.list[i].celQtyBackups = data.list[i].celQty
  286. data.list[i].priceBackups = data.list[i].price
  287. const warehouseSn = data.list[i].warehouseSn || undefined
  288. const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
  289. if (warehouseSn || warehouseLocationSn) {
  290. data.list[i].warehouseSnBackups = warehouseSn
  291. data.list[i].warehouseLocationSnBackups = warehouseLocationSn
  292. data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
  293. } else {
  294. data.list[i].warehouseCascade = undefined
  295. }
  296. }
  297. this.disabled = false
  298. this.chooseLoadData = data.list
  299. }
  300. return data
  301. })
  302. },
  303. printerType: 'NEEDLE' ,// 打印机类型
  304. isShowBisiceInfo: false,
  305. }
  306. },
  307. methods: {
  308. // 返回
  309. handleBack () {
  310. this.$router.push({ path: '/salesManagement/salesReturn/list' })
  311. },
  312. // 选择客户成功
  313. chooseCustomOk (data) {},
  314. handleEditCustom () {
  315. this.openModal = true
  316. this.$refs.editCustomModal.editCust(this.ordeDetail)
  317. },
  318. // 已选产品 blur
  319. onCellBlur (val, record, type) {
  320. let valBackups
  321. if (type == 'qty') {
  322. valBackups = record.qtyBackups
  323. } else if (type == 'celQty') {
  324. valBackups = record.celQtyBackups
  325. } else if (type == 'price') {
  326. valBackups = record.priceBackups
  327. }
  328. // 光标移出,值发生改变再调用编辑接口
  329. if (val && val != valBackups) {
  330. if (Number(record.celQty) > Number(record.qty)) {
  331. this.$message.info('废品数量不可大于本次退货数量')
  332. this.reductionVal(record, type, valBackups)
  333. } else {
  334. this.saveProduct(record, 'edit')
  335. }
  336. } else {
  337. this.reductionVal(record, type, valBackups)
  338. }
  339. },
  340. reductionVal (record, type, valBackups) {
  341. if (type == 'qty') {
  342. record.qty = valBackups
  343. } else if (type == 'celQty') {
  344. record.celQty = valBackups
  345. } else if (type == 'price') {
  346. record.price = valBackups
  347. }
  348. },
  349. // 仓库仓位 级联 列表
  350. getWarehouseCascade () {
  351. warehouseCascadeList({}).then(res => {
  352. if (res.status == 200) {
  353. res.data.map(item => {
  354. item.sn = item.warehouseSn
  355. if (item.warehouseLocationList) {
  356. item.warehouseLocationList.map(subItem => {
  357. subItem.sn = subItem.warehouseLocationSn
  358. })
  359. }
  360. })
  361. this.warehouseCascadeData = res.data
  362. } else {
  363. this.warehouseCascadeData = []
  364. }
  365. })
  366. },
  367. // 修改仓库仓位
  368. changeWarehouseCascade (val, opt, ind) {
  369. let loadData = this.chooseLoadData[ind]
  370. if (val.length < 2) {
  371. this.$message.warning('当前仓库无仓位,请选择其他仓库')
  372. const warehouseSnBackups = loadData.warehouseSnBackups || undefined
  373. const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
  374. loadData.warehouseSn = warehouseSnBackups
  375. loadData.warehouseLocationSn = warehouseLocationSnBackups
  376. if (warehouseSnBackups || warehouseLocationSnBackups) {
  377. loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
  378. } else {
  379. loadData.warehouseCascade = undefined
  380. }
  381. } else {
  382. loadData.warehouseSn = val[0] ? val[0] : ''
  383. loadData.warehouseLocationSn = val[1] ? val[1] : ''
  384. loadData.warehouseSnBackups = val[0] ? val[0] : ''
  385. loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
  386. loadData = this.chooseLoadData[ind]
  387. this.saveProduct(loadData, 'edit')
  388. }
  389. },
  390. // 重置列表
  391. resetForm () {
  392. this.productForm = {
  393. productName: '',
  394. productCode: '',
  395. orderBy: 'sales_return_bill_detail.CREATE_DATE desc'
  396. }
  397. this.$refs.table.refresh(true)
  398. },
  399. // 明细统计
  400. getQueryCount (params) {
  401. salesReturnQueryCount(params).then(res => {
  402. this.countData = res.data || null
  403. })
  404. },
  405. // 获取单据详细
  406. getOrderDetail (flag) {
  407. salesReturnDetail({ sn: this.orderSn }).then(res => {
  408. this.ordeDetail = res.data || null
  409. if (!flag) {
  410. this.$refs.queryPart.pageInit(this.buyerSn, this.ordeDetail && this.ordeDetail.priceType || '')
  411. }
  412. })
  413. },
  414. // 打折
  415. salesReturnDiscount () {
  416. this.spinning = true
  417. salesReturnDiscount({
  418. discountAmount: this.ordeDetail.discountAmount || 0,
  419. salesReturnSn: this.ordeDetail.salesReturnSn,
  420. id: this.ordeDetail.id
  421. }).then(res => {
  422. if (res.status == 200) {
  423. this.getOrderDetail(true)
  424. this.$refs.table.refresh(true)
  425. this.spinning = false
  426. } else {
  427. this.spinning = false
  428. }
  429. })
  430. },
  431. // 清空列表
  432. salesReturnDelAll () {
  433. const _this = this
  434. this.$confirm({
  435. title: '提示',
  436. content: '确认要清空已选产品列表吗?',
  437. centered: true,
  438. closable: true,
  439. onOk () {
  440. _this.delLoading = true
  441. _this.spinning = true
  442. salesReturnDelAll({ sn: _this.ordeDetail.salesReturnSn }).then(res => {
  443. if (res.status == 200) {
  444. _this.resetSearchForm()
  445. }
  446. _this.$message.info(res.message)
  447. _this.delLoading = false
  448. _this.spinning = false
  449. })
  450. }
  451. })
  452. },
  453. // 删除产品
  454. handleDel (row) {
  455. const _this = this
  456. this.$confirm({
  457. title: '提示',
  458. content: '确认要删除吗?',
  459. centered: true,
  460. closable: true,
  461. onOk () {
  462. _this.delLoading = true
  463. _this.spinning = true
  464. salesReturnDetailDel({ id: row.id }).then(res => {
  465. if (res.status == 200) {
  466. _this.resetSearchForm(true)
  467. }
  468. _this.$message.info(res.message)
  469. _this.delLoading = false
  470. _this.spinning = false
  471. })
  472. }
  473. })
  474. },
  475. // 重置
  476. resetSearchForm (flag) {
  477. this.$refs.table.refresh(!!flag)
  478. if (flag) {
  479. this.getOrderDetail(true)
  480. }
  481. },
  482. // 添加或修改产品
  483. saveProduct (row, type) {
  484. console.log(row)
  485. // 防止多次添加产品
  486. if (this.isInster) {
  487. return
  488. }
  489. this.isInster = true
  490. const params = {
  491. 'salesReturnBillSn': this.orderSn,
  492. 'salesReturnBillNo': this.ordeDetail.salesReturnNo,
  493. 'salesBillSn': row.salesBillSn,
  494. 'salesBillNo': row.salesBillNo,
  495. 'salesBillDetailSn': row.salesBillDetailSn,
  496. 'price': type == 'edit' ? row.price : row.salePrice,
  497. 'cost': row.putCost,
  498. 'productSn': row.productSn,
  499. 'celQty': row.celQty,
  500. 'hasReturnQty': row.returnQty,
  501. 'qty': row.returnQty,
  502. 'warehouseLocationSn': row.warehouseLocationSn,
  503. 'warehouseSn': row.warehouseSn
  504. }
  505. // 编辑
  506. if (type == 'edit') {
  507. params.id = row.id
  508. params.qty = row.qty
  509. } else {
  510. params.salesQty = row.qty
  511. // 默认仓库
  512. // params.warehouseLocationSn = '100000000165'
  513. // params.warehouseSn = '100000000156'
  514. }
  515. this.spinning = true
  516. salesReturnSaveProduct(params).then(res => {
  517. this.resetSearchForm(type == 'edit')
  518. if (type == 'new') {
  519. this.getOrderDetail(true)
  520. }
  521. this.isInster = false
  522. this.spinning = false
  523. })
  524. },
  525. // 提交销售单
  526. handleSubmit () {
  527. this.spinning = true
  528. salesReturnSubmit({ sn: this.orderSn }).then(res => {
  529. if (res.status == 200) {
  530. this.handleBack()
  531. this.$message.success(res.message)
  532. this.spinning = false
  533. } else {
  534. this.spinning = false
  535. }
  536. })
  537. },
  538. // 打印预览/快捷打印
  539. handlePrint (type, printerType) {
  540. const _this = this
  541. _this.spinning = true
  542. let url = salesReturnDetailPrint
  543. const params = { sn: this.$route.params.sn }
  544. if (type == 'export') { // 导出
  545. url = salesDetailExport
  546. }
  547. // 打印或导出
  548. hdPrint(printerType, type, url, params, '销售退货', function () {
  549. _this.spinning = false
  550. })
  551. },
  552. pageInit () {
  553. this.orderId = this.$route.params.id
  554. this.orderSn = this.$route.params.sn
  555. this.buyerSn = this.$route.params.buyerSn
  556. this.getOrderDetail()
  557. this.getWarehouseCascade()
  558. this.resetForm()
  559. }
  560. },
  561. mounted () {
  562. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  563. this.pageInit()
  564. }
  565. },
  566. activated () {
  567. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  568. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  569. this.pageInit()
  570. }
  571. },
  572. beforeRouteEnter (to, from, next) {
  573. next(vm => {})
  574. }
  575. }
  576. </script>
  577. <style lang="less">
  578. .salesReturnEdit-wrap{
  579. position: relative;
  580. height: 100%;
  581. box-sizing: border-box;
  582. >.ant-spin-nested-loading{
  583. overflow-y: auto;
  584. height: 100%;
  585. }
  586. .pages-wrap{
  587. margin-top: 10px;
  588. .total-bar{
  589. display: flex;
  590. align-items: center;
  591. justify-content: space-between;
  592. > div{
  593. &:last-child{
  594. display: flex;
  595. align-items: center;
  596. justify-content: space-between;
  597. > div{
  598. padding: 0 10px;
  599. }
  600. }
  601. }
  602. }
  603. }
  604. }
  605. </style>