list.vue 26 KB

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