list.vue 26 KB

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