list.vue 27 KB

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