list.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <a-card size="small" :bordered="false" class="salesManagementList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="创建时间">
  10. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  15. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesManagementList-buyerName" @change="custChange" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="销售单号">
  20. <a-input id="salesManagementList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <template v-if="advanced">
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="采购单号">
  26. <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="备货打印状态">
  31. <v-select
  32. v-model="queryParam.printStatus"
  33. ref="printStatus"
  34. id="salesManagementList-printStatus"
  35. code="PRINT_STATUS"
  36. placeholder="请选择打印状态"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="业务状态">
  42. <v-select
  43. v-model="queryParam.billStatus"
  44. ref="billStatus"
  45. id="salesManagementList-billStatus"
  46. code="SALES_BILL_STATUS"
  47. placeholder="请选择业务状态"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-form-item label="财务状态">
  53. <v-select
  54. v-model="queryParam.financialStatus"
  55. ref="financialStatus"
  56. id="salesManagementList-financialStatus"
  57. code="FINANCIAL_RECEIVE_STATUS"
  58. placeholder="请选择财务状态"
  59. allowClear></v-select>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :md="6" :sm="24">
  63. <a-form-item label="单据来源">
  64. <v-select
  65. v-model="queryParam.salesBillSource"
  66. ref="salesBillSource"
  67. id="salesManagementList-salesBillSource"
  68. code="SALES_SOURCE"
  69. placeholder="请选择单据来源"
  70. allowClear></v-select>
  71. </a-form-item>
  72. </a-col>
  73. <a-col :md="6" :sm="24">
  74. <a-form-model-item label="所在区域">
  75. <subarea ref="subarea" id="salesManagementList-subarea" @change="subareaChange"></subarea>
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  80. <Area id="salesManagementList-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  81. </a-form-model-item>
  82. </a-col>
  83. </template>
  84. <a-col :md="6" :sm="24">
  85. <span class="table-page-search-submitButtons">
  86. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  87. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  88. <a-button
  89. style="margin-left: 10px"
  90. type="primary"
  91. class="button-warning"
  92. @click="handleExport"
  93. :disabled="disabled"
  94. :loading="exportLoading"
  95. v-if="$hasPermissions('B_sales_export')"
  96. >导出</a-button>
  97. <a @click="advanced=!advanced" style="margin-left: 8px">
  98. {{ advanced ? '收起' : '展开' }}
  99. <a-icon :type="advanced ? 'up' : 'down'"/>
  100. </a>
  101. </span>
  102. </a-col>
  103. </a-row>
  104. </a-form>
  105. </div>
  106. <!-- 操作按钮 -->
  107. <div class="table-operator">
  108. <a-button type="primary" class="button-error" v-if="$hasPermissions('B_salesAdd')" @click="handleAdd">新增</a-button>
  109. </div>
  110. <!-- alert -->
  111. <a-alert type="info" style="margin-bottom:10px">
  112. <div slot="message">
  113. <div style="display: flex;justify-content: space-between;align-items: center;">
  114. <div>
  115. <div>
  116. 总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
  117. 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
  118. 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  119. 已下推数量:<strong>{{ totalData&&(totalData.totalPushedQty || totalData.totalPushedQty==0) ? totalData.totalPushedQty : '--' }}</strong>;
  120. 已发货数量:<strong>{{ totalData&&(totalData.totalDispatchQty || totalData.totalDispatchQty==0) ? totalData.totalDispatchQty : '--' }}</strong>;
  121. 已取消数量:<strong>{{ totalData&&(totalData.totalCancelQty || totalData.totalCancelQty==0) ? totalData.totalCancelQty : '--' }}</strong>;
  122. 待下推数量:<strong>{{ totalData&&(totalData.totalUnpushedQty || totalData.totalUnpushedQty==0) ? totalData.totalUnpushedQty : '--' }}</strong>;
  123. </div>
  124. <div v-if="$hasPermissions('M_salesQueryList_salesPrice')">
  125. 总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? toThousands(totalData.totalAmount) : '--' }}</strong>;
  126. 已下推金额::<strong>{{ totalData&&(totalData.totalPushedAmount || totalData.totalPushedAmount==0) ? toThousands(totalData.totalPushedAmount) : '--' }}</strong>;
  127. 已取消金额::<strong>{{ totalData&&(totalData.totalCancelAmount || totalData.totalCancelAmount==0) ? toThousands(totalData.totalCancelAmount) : '--' }}</strong>;
  128. 待下推金额::<strong>{{ totalData&&(totalData.totalUnpushedAmount || totalData.totalUnpushedAmount==0) ? toThousands(totalData.totalUnpushedAmount) : '--' }}</strong>;
  129. 已发货金额::<strong>{{ totalData&&(totalData.totalDispatchAmount || totalData.totalDispatchAmount==0) ? toThousands(totalData.totalDispatchAmount) : '--' }}</strong>;
  130. </div>
  131. </div>
  132. <a-checkbox v-model="showCancelNum"><span style="display: inline-block;margin-top: 1px;">显示取消数量</span></a-checkbox>
  133. </div>
  134. </div>
  135. </a-alert>
  136. <!-- 列表 -->
  137. <s-table
  138. class="sTable fixPagination"
  139. ref="table"
  140. :style="{ height: tableHeight+75+'px' }"
  141. size="small"
  142. :rowKey="(record) => record.id"
  143. :columns="columns"
  144. :data="loadData"
  145. :scroll="{ y: tableHeight }"
  146. :defaultLoadData="false"
  147. bordered>
  148. <!-- 销售单号 -->
  149. <template slot="salesBillNo" slot-scope="text, record">
  150. <div v-if="$hasPermissions('B_salesDetail')">
  151. <a-badge :count="'改'+record.changeTimes" :offset="[16,-13]" v-if="record.changeTimes>0" class="badge-con-t">
  152. <span class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  153. </a-badge>
  154. <span v-else class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  155. </div>
  156. <div v-else>{{ record.salesBillNo }}</div>
  157. </template>
  158. <!-- 总数量 -->
  159. <template slot="totalQty" slot-scope="text, record">
  160. {{ record.totalQty }}
  161. </template>
  162. <!-- 操作 -->
  163. <template slot="action" slot-scope="text, record">
  164. <div>
  165. <a-button
  166. size="small"
  167. type="link"
  168. class="button-warning"
  169. v-if="record.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
  170. @click="handleDetailAudit(record)"
  171. >审核</a-button>
  172. <a-button
  173. size="small"
  174. type="link"
  175. class="button-warning"
  176. v-if="record.billStatus == 'WAIT_PUSH'&&$hasPermissions('B_salesDispatch')"
  177. @click="handleDispatch(record)"
  178. >下推</a-button>
  179. <a-button
  180. size="small"
  181. type="link"
  182. class="button-info"
  183. v-if="(record.salesBillSource == 'SALES' && (record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'AUDIT_REJECT' || record.billStatus == 'HQ_CHANGE'))&&$hasPermissions('B_salesEdit')"
  184. @click="handleEdit(record)"
  185. >
  186. 编辑
  187. </a-button>
  188. <a-button
  189. size="small"
  190. type="link"
  191. class="button-info"
  192. v-if="record.salesBillSource == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'HQ_CHANGE') && $hasPermissions('B_salesEdit')"
  193. @click="handleEdit(record)"
  194. >
  195. 改单
  196. </a-button>
  197. <a-button
  198. size="small"
  199. type="link"
  200. class="button-error"
  201. v-if="(record.salesBillSource == 'SALES' && (record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'AUDIT_REJECT' || record.billStatus == 'HQ_CHANGE'))&&$hasPermissions('B_salesDel')"
  202. @click="handleDel(record)"
  203. >
  204. 删除
  205. </a-button>
  206. <a-button
  207. size="small"
  208. type="link"
  209. class="button-error"
  210. v-if="record.salesBillSource == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'HQ_CHANGE') && $hasPermissions('B_salesDel')"
  211. @click="handleDel(record)"
  212. >
  213. 取消
  214. </a-button>
  215. <a-button
  216. size="small"
  217. type="link"
  218. class="button-warning"
  219. v-if="record.printStatus=='UNABLE_PRINT'&&$hasPermissions('B_Sales_UNABLE_PRINT')"
  220. @click="handlePrint(record)"
  221. >允许备货打印</a-button>
  222. </div>
  223. </template>
  224. </s-table>
  225. </a-spin>
  226. <!-- 选择客户弹框 -->
  227. <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
  228. <!-- 操作提示 -->
  229. <commonModal modalTit="操作提示" :width="this.tipData&&this.tipData.length == 1?'500px':'800px'" :openModal="showTipModal" @cancel="canselModal" @ok="updatePrintStatus">
  230. <div style="text-align: center;" v-if="this.tipData&&this.tipData.length">
  231. <div style="margin-bottom: 15px;font-size: 14px;"><strong>确认允许此单进行备货打印吗?</strong></div>
  232. <div style="line-height: 24px;" v-if="this.tipData.length == 1">
  233. <div>备货单号:{{ tipData[0]&&tipData[0].dispatchBillNo }}</div>
  234. <div>客户名称:{{ tipData[0]&&tipData[0].buyerName }}</div>
  235. </div>
  236. <div v-else>
  237. <a-table
  238. :row-selection="{ selectedRowKeys: selectedRowKeys,onChange: onSelectChange, getCheckboxProps: record => ({ props: { disabled: record.printStatus!=='UNABLE_PRINT' }})}"
  239. :columns="bhColumns"
  240. :data-source="tipData"
  241. :pagination="false"
  242. />
  243. </div>
  244. </div>
  245. </commonModal>
  246. <!-- 导出提示框 -->
  247. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  248. </a-card>
  249. </template>
  250. <script>
  251. import { commonMixin } from '@/utils/mixin'
  252. import moment from 'moment'
  253. import getDate from '@/libs/getDate.js'
  254. import subarea from '@/views/common/subarea.js'
  255. import Area from '@/views/common/area.js'
  256. import rangeDate from '@/views/common/rangeDate.vue'
  257. import { STable, VSelect } from '@/components'
  258. import commonModal from '@/views/common/commonModal.vue'
  259. import chooseCustomModal from './chooseCustomModal.vue'
  260. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  261. import reportModal from '@/views/common/reportModal.vue'
  262. import { salesList, salesDel, salesCount } from '@/api/sales'
  263. import { hdExportExcel } from '@/libs/exportExcel'
  264. import { findBySalesBillSn, dispatchBatchPrintStatus, queryBySalesBillSn } from '@/api/dispatch'
  265. import { salesDetailExport } from '@/api/salesBillReport'
  266. export default {
  267. name: 'SalesQueryList',
  268. mixins: [commonMixin],
  269. components: { STable, VSelect, chooseCustomModal, dealerSubareaScopeList, Area, rangeDate, subarea, commonModal, reportModal },
  270. data () {
  271. return {
  272. spinning: false,
  273. advanced: true, // 高级搜索 展开/关闭
  274. disabled: false, // 查询、重置按钮是否可操作
  275. openModal: false, // 选择客户弹框是否显示
  276. showTipModal: false, // 备货打印弹框
  277. showExport: false,
  278. exportLoading: false,
  279. tableHeight: 0,
  280. time: [
  281. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  282. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  283. ],
  284. // 查询参数
  285. queryParam: {
  286. beginDate: getDate.getThreeMonthDays().starttime,
  287. endDate: getDate.getCurrMonthDays().endtime,
  288. buyerSn: undefined, // 客户名称
  289. salesBillNo: '', // 销售单号
  290. purchaseBillNo: '',
  291. printStatus: undefined,
  292. billStatus: undefined, // 业务状态
  293. financialStatus: undefined, // 财务状态
  294. salesBillSource: undefined,
  295. subareaSn: undefined,
  296. subareaAreaSn: undefined,
  297. shippingAddrProvinceSn: undefined
  298. },
  299. totalData: {
  300. totalAmount: 0,
  301. totalCategory: 0,
  302. totalQty: 0,
  303. totalRecord: 0,
  304. totalPushedQty: 0,
  305. totalDispatchQty: 0,
  306. totalCancelQty: 0,
  307. totalUnpushedQty: 0,
  308. totalPushedAmount: 0,
  309. totalCancelAmount: 0,
  310. totalUnpushedAmount: 0,
  311. totalDispatchAmount: 0
  312. },
  313. // 加载数据方法 必须为 Promise 对象
  314. loadData: parameter => {
  315. this.disabled = true
  316. this.spinning = true
  317. delete parameter.tableId
  318. delete parameter.index
  319. // 查询总计
  320. salesCount(Object.assign(parameter, this.queryParam)).then(res => {
  321. this.totalData = Object.assign(this.totalData, res.data || {})
  322. })
  323. return salesList(Object.assign(parameter, this.queryParam)).then(res => {
  324. let data
  325. if (res.status == 200) {
  326. data = res.data
  327. const no = (data.pageNo - 1) * data.pageSize
  328. for (var i = 0; i < data.list.length; i++) {
  329. data.list[i].no = no + i + 1
  330. }
  331. this.disabled = false
  332. }
  333. this.spinning = false
  334. return data
  335. })
  336. },
  337. showCancelNum: false, // 是否显示取消数量和待下推数量
  338. tipData: null, // 备货单信息
  339. tempSalesBillSn: null,
  340. // 允许备货打印
  341. selectedRowKeys: [],
  342. bhColumns: [
  343. {
  344. title: '备货单号',
  345. dataIndex: 'dispatchBillNo'
  346. },
  347. {
  348. title: '客户名称',
  349. dataIndex: 'buyerName'
  350. },
  351. {
  352. title: '备货打印状态',
  353. dataIndex: 'printStatusDictValue'
  354. }
  355. ]
  356. }
  357. },
  358. computed: {
  359. columns () {
  360. const _this = this
  361. const arr = [
  362. { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  363. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '7%', align: 'center' },
  364. { title: '提交时间', dataIndex: 'submitDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  365. { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  366. { title: '总数量', dataIndex: 'totalQty', scopedSlots: { customRender: 'totalQty' }, width: '4%', align: 'center' },
  367. // { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  368. { title: '已下推数量', dataIndex: 'totalPushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  369. // { title: '下推总金额', dataIndex: 'totalPushedAmount', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  370. { title: '已发货数量', dataIndex: 'totalDispatchQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  371. { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  372. { title: '审核时间', dataIndex: 'auditDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  373. { title: '最近备货时间', dataIndex: 'lastStockUpDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  374. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  375. { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  376. { title: '备货打印状态', dataIndex: 'printStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  377. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  378. ]
  379. if (this.showCancelNum) {
  380. const ind = this.$hasPermissions('M_salesQueryList_salesPrice') ? 10 : 8
  381. arr.splice(ind, 0, { title: '已取消数量', dataIndex: 'totalCancelQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  382. arr.splice(ind + 1, 0, { title: '待下推数量', dataIndex: 'totalUnpushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  383. }
  384. if (this.$hasPermissions('M_salesQueryList_salesPrice')) { // 售价权限
  385. arr.splice(6, 0, { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  386. arr.splice(8, 0, { title: '下推总金额', dataIndex: 'totalPushedAmount', width: '4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  387. }
  388. return arr
  389. }
  390. },
  391. methods: {
  392. // 导出
  393. handleExport () {
  394. const _this = this
  395. _this.$store.state.app.curActionPermission = 'B_sales_export'
  396. _this.exportLoading = true
  397. _this.spinning = true
  398. hdExportExcel(salesDetailExport, _this.queryParam, '销售明细', function () {
  399. _this.exportLoading = false
  400. _this.spinning = false
  401. _this.showExport = true
  402. _this.$store.state.app.curActionPermission = ''
  403. })
  404. },
  405. // 时间 change
  406. dateChange (date) {
  407. this.queryParam.beginDate = date[0]
  408. this.queryParam.endDate = date[1]
  409. },
  410. custChange (val) {
  411. this.queryParam.buyerSn = val.key
  412. },
  413. subareaChange (val) {
  414. this.queryParam.subareaSn = val[0] ? val[0] : undefined
  415. this.queryParam.subareaAreaSn = val[1] ? val[1] : undefined
  416. },
  417. // 新增
  418. handleAdd () {
  419. this.openModal = true
  420. },
  421. // 选择客户成功
  422. chooseCustomOk (data) {
  423. this.$router.push({ name: 'salesAdd', params: { sn: data.salesBillSn } })
  424. },
  425. // 下推
  426. handleDispatch (row) {
  427. this.spinning = true
  428. findBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => {
  429. this.spinning = false
  430. if (res.status == 200) {
  431. this.$router.push({ name: 'waitDispatch', params: { salesBillSn: row.salesBillSn, dispatchBillSn: res.data.dispatchBillSn } })
  432. }
  433. })
  434. },
  435. // 详情
  436. handleDetail (row) {
  437. this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
  438. },
  439. // 审核
  440. handleDetailAudit (row) {
  441. this.$router.push({ name: 'salesDetailAudit', params: { sn: row.salesBillSn } })
  442. },
  443. // 编辑
  444. handleEdit (row) {
  445. this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
  446. },
  447. // 删除
  448. handleDel (row) {
  449. const _this = this
  450. this.$confirm({
  451. title: '提示',
  452. content: row.salesBillSource == 'PURCHASE' ? '确认要取消吗?' : '确认要删除吗?',
  453. centered: true,
  454. closable: true,
  455. onOk () {
  456. _this.spinning = true
  457. salesDel({ salesBillSn: row.salesBillSn }).then(res => {
  458. if (res.status == 200) {
  459. _this.$message.success(res.message)
  460. _this.$refs.table.refresh()
  461. _this.spinning = false
  462. } else {
  463. _this.spinning = false
  464. }
  465. })
  466. }
  467. })
  468. },
  469. // 允许备货打印
  470. handlePrint (row) {
  471. // 获取关联的下推单
  472. this.tempSalesBillSn = row.salesBillSn
  473. queryBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => {
  474. this.tipData = res.data || []
  475. this.tipData.map(item => {
  476. item.key = item.dispatchBillSn
  477. if (item.printStatus == 'UNABLE_PRINT') {
  478. this.selectedRowKeys.push(item.dispatchBillSn)
  479. }
  480. })
  481. this.showTipModal = true
  482. })
  483. },
  484. canselModal () {
  485. this.tipData = null
  486. this.showTipModal = false
  487. this.tempSalesBillSn = null
  488. this.selectedRowKeys = []
  489. },
  490. onSelectChange (selectedRowKeys) {
  491. this.selectedRowKeys = selectedRowKeys
  492. },
  493. // 允许备货打印状态
  494. updatePrintStatus () {
  495. const isOne = this.tipData.length
  496. if (isOne > 1 && this.selectedRowKeys.length == 0) {
  497. this.$message.info('请选择备货单!')
  498. return
  499. }
  500. const dispatchBillSnList = []
  501. this.tipData.map(item => {
  502. dispatchBillSnList.push(item.dispatchBillSn)
  503. })
  504. const params = {
  505. 'salesBillSn': this.tempSalesBillSn,
  506. 'dispatchBillSnList': isOne > 1 ? this.selectedRowKeys : dispatchBillSnList,
  507. 'printStatus': 'NO_PRINT'
  508. }
  509. dispatchBatchPrintStatus(params).then(res => {
  510. if (res.status == 200) {
  511. this.canselModal()
  512. this.$message.info(res.message)
  513. this.$refs.table.refresh()
  514. }
  515. })
  516. },
  517. // 重置
  518. resetSearchForm () {
  519. this.$refs.rangeDate.resetDate(this.time)
  520. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  521. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  522. this.$refs.dealerSubareaScopeList.resetForm()
  523. this.queryParam.buyerSn = undefined
  524. this.queryParam.salesBillNo = ''
  525. this.queryParam.purchaseBillNo = ''
  526. this.queryParam.printStatus = undefined
  527. this.queryParam.billStatus = undefined
  528. this.queryParam.financialStatus = undefined
  529. this.queryParam.salesBillSource = undefined
  530. this.queryParam.subareaSn = undefined
  531. this.queryParam.subareaAreaSn = undefined
  532. this.queryParam.shippingAddrProvinceSn = undefined
  533. if (this.advanced) {
  534. this.$refs.subarea.clearData()
  535. }
  536. this.$refs.table.refresh(true)
  537. },
  538. pageInit () {
  539. const _this = this
  540. this.$nextTick(() => { // 页面渲染完成后的回调
  541. _this.setTableH()
  542. })
  543. },
  544. setTableH () {
  545. const tableSearchH = this.$refs.tableSearch.offsetHeight
  546. this.tableHeight = window.innerHeight - tableSearchH - 290
  547. }
  548. },
  549. watch: {
  550. advanced (newValue, oldValue) {
  551. const _this = this
  552. this.$nextTick(() => { // 页面渲染完成后的回调
  553. _this.setTableH()
  554. })
  555. },
  556. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  557. console.log(newValue)
  558. this.setTableH()
  559. }
  560. },
  561. mounted () {
  562. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  563. this.pageInit()
  564. this.resetSearchForm()
  565. }
  566. },
  567. activated () {
  568. // 如果是新页签打开,则重置当前页面
  569. if (this.$store.state.app.isNewTab) {
  570. this.pageInit()
  571. this.resetSearchForm()
  572. }
  573. // 仅刷新列表,不重置页面
  574. if (this.$store.state.app.updateList) {
  575. this.pageInit()
  576. this.$refs.table.refresh()
  577. }
  578. },
  579. beforeRouteEnter (to, from, next) {
  580. next(vm => {})
  581. }
  582. }
  583. </script>
  584. <style lang="less" scoped>
  585. .salesManagementList-wrap{
  586. .sTable{
  587. margin-top: 10px;
  588. .badge-con-t{
  589. .ant-badge-count{
  590. transform: scale(0.8);
  591. font-size: 13px;
  592. }
  593. }
  594. }
  595. }
  596. </style>