list.vue 27 KB

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