list.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  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="examineVerifyList-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="examineVerifyList-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="examineVerifyList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="出库单号">
  31. <a-input id="examineVerifyList-stockOutNo" v-model.trim="queryParam.stockOutNo" allowClear placeholder="请输入出库单号"/>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="业务状态">
  36. <v-select
  37. v-model="queryParam.billStatus"
  38. ref="billStatus"
  39. id="examineVerifyList-billStatus"
  40. code="DISPATCH_BILL_STATUS"
  41. placeholder="请选择单据状态"
  42. allowClear></v-select>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="24">
  46. <a-form-item label="打印状态">
  47. <v-select
  48. v-model="queryParam.printStatus"
  49. ref="printStatus"
  50. id="examineVerifyList-printStatus"
  51. code="PRINT_STATUS"
  52. placeholder="请选择打印状态"
  53. allowClear></v-select>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-model-item label="所在区域">
  58. <subarea id="examineVerifyList-subarea" ref="subarea" @change="subareaChange"></subarea>
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :md="6" :sm="24">
  62. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  63. <Area id="examineVerifyList-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  64. </a-form-model-item>
  65. </a-col>
  66. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  67. <a-form-model-item label="仓库">
  68. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  69. </a-form-model-item>
  70. </a-col>
  71. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  72. <a-form-item label="客服">
  73. <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  74. </a-form-item>
  75. </a-col>
  76. </template>
  77. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  78. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="examineVerifyList-refresh">查询</a-button>
  79. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="examineVerifyList-reset">重置</a-button>
  80. <a @click="advanced=!advanced" style="margin-left: 5px">
  81. {{ advanced ? '收起' : '展开' }}
  82. <a-icon :type="advanced ? 'up' : 'down'"/>
  83. </a>
  84. </a-col>
  85. </a-row>
  86. </a-form>
  87. </div>
  88. </a-card>
  89. <a-card size="small" :bordered="false" class="examineVerifyList-wrap">
  90. <a-spin :spinning="spinning" tip="Loading...">
  91. <!-- alert -->
  92. <div class="tongji-bar">
  93. <span v-if="$hasPermissions('M_examineVerifyList_salesPrice')">总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? toThousands(totalData.totalAmount) : '--' }}</strong>;</span>
  94. 总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
  95. 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
  96. 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  97. </div>
  98. <!-- 列表 -->
  99. <s-table
  100. class="sTable fixPagination"
  101. ref="table"
  102. :style="{ height: tableHeight+70+'px' }"
  103. size="small"
  104. :rowKey="(record) => record.id"
  105. :columns="columns"
  106. :data="loadData"
  107. :scroll="{ y:tableHeight }"
  108. :defaultLoadData="false"
  109. bordered>
  110. <!-- 销售单号 -->
  111. <template slot="salesBillNo" slot-scope="text, record">
  112. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  113. <span v-else>{{ record.salesBillNo }}</span>
  114. </template>
  115. <!-- 备货单号 -->
  116. <template slot="dispatchBillNo" slot-scope="text, record">
  117. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  118. <span v-else>{{ record.dispatchBillNo }}</span>
  119. </template>
  120. <!-- 操作 -->
  121. <template slot="action" slot-scope="text, record">
  122. <div>
  123. <a-button
  124. size="small"
  125. type="link"
  126. class="button-info"
  127. v-if="record.billStatus=='WAIT_STOCK_UP_AUDIT'&&$hasPermissions('B_dispatchAduit')"
  128. @click="handleExamine(record)"
  129. id="examineVerifyList-examine-btn">备货审核</a-button>
  130. <!-- <a-button
  131. size="small"
  132. type="link"
  133. class="button-info"
  134. v-if="record.billStatus=='OUTING_WAREHOUSE'&&$hasPermissions('B_dispatchAduit')"
  135. @click="handleNAudit(record)"
  136. id="examineVerifyList-examine-btn">反审核</a-button> -->
  137. </div>
  138. </template>
  139. </s-table>
  140. </a-spin>
  141. <!-- 审核 -->
  142. <auditModal
  143. v-drag
  144. :openModal="visibleAudit"
  145. :spinning="spinningAudit"
  146. @close="visibleAudit=false"
  147. @ok="auditOrder('OUTING_WAREHOUSE')"
  148. @fail="auditOrder('STOCK_UP_REJECT')" />
  149. <auditRejectModal
  150. v-drag
  151. :openModal="visibleAuditReject"
  152. :spinning="spinningAuditReject"
  153. :itemData="auditInfo"
  154. @close="visibleAuditReject=false"
  155. @ok="auditReject" />
  156. <!-- 查看销售单或备货单详情 -->
  157. <commonModal
  158. :modalTit="detailType?'备货单详情':'销售单详情'"
  159. bodyPadding="10px"
  160. width="70%"
  161. :showFooter="false"
  162. :openModal="showDetailModal"
  163. @cancel="cancelDetail">
  164. <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
  165. <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
  166. </commonModal>
  167. </a-card>
  168. </div>
  169. </template>
  170. <script>
  171. import { commonMixin } from '@/utils/mixin'
  172. import moment from 'moment'
  173. import commonModal from '@/views/common/commonModal.vue'
  174. import salesDetail from '@/views/salesManagement/salesQueryNew/detailAll.vue'
  175. import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
  176. import getDate from '@/libs/getDate.js'
  177. import subarea from '@/views/common/subarea.js'
  178. import Area from '@/views/common/area.js'
  179. import rangeDate from '@/views/common/rangeDate.vue'
  180. import auditModal from '@/views/common/auditModal.vue'
  181. import { STable, VSelect } from '@/components'
  182. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  183. import auditRejectModal from './auditRejectModal.vue'
  184. import chooseWarehouse from '@/views/common/chooseWarehouse'
  185. import customerService from '@/views/common/customerService'
  186. import { dispatchlBhshList, dispatchQueryBhshCount, dispatchStockUpAduit } from '@/api/dispatch'
  187. export default {
  188. name: 'ExamineVerifyList',
  189. mixins: [commonMixin],
  190. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, commonModal, salesDetail, dispatchDetail, auditModal, subarea, auditRejectModal, Area, chooseWarehouse, customerService },
  191. data () {
  192. return {
  193. spinning: false,
  194. advanced: true, // 高级搜索 展开/关闭
  195. tableHeight: 0,
  196. showDetailModal: false,
  197. detailType: 2,
  198. bizSn: null,
  199. time: [
  200. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  201. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  202. ],
  203. queryParam: { // 查询条件
  204. pushedBeginDate: getDate.getThreeMonthDays().starttime,
  205. pushedEndDate: getDate.getCurrMonthDays().endtime,
  206. buyerSn: undefined, // 客户名称
  207. salesBillNo: '', // 销售单号
  208. dispatchBillNo: '', // 备货单号
  209. stockOutNo: '', // 出库单号
  210. printStatus: undefined, // 打印状态
  211. billStatus: undefined, // 业务状态
  212. subareaArea: {
  213. subareaSn: undefined,
  214. subareaAreaSn: undefined
  215. },
  216. shippingAddrProvinceSn: undefined,
  217. warehouseSn: undefined,
  218. bizUserSn: undefined
  219. },
  220. disabled: false, // 查询、重置按钮是否可操作
  221. selectedRowKeys: [], // Check here to configure the default column
  222. loading: false,
  223. totalData: {
  224. totalAmount: 0,
  225. totalQty: 0,
  226. totalRecord: 0
  227. },
  228. // 加载数据方法 必须为 Promise 对象
  229. loadData: parameter => {
  230. this.disabled = true
  231. this.spinning = true
  232. // 查询总计
  233. dispatchQueryBhshCount(Object.assign(parameter, this.queryParam)).then(res => {
  234. this.totalData = Object.assign(this.totalData, res.data || {})
  235. })
  236. return dispatchlBhshList(Object.assign(parameter, this.queryParam)).then(res => {
  237. let data
  238. if (res.status == 200) {
  239. data = res.data
  240. const no = (data.pageNo - 1) * data.pageSize
  241. for (var i = 0; i < data.list.length; i++) {
  242. data.list[i].no = no + i + 1
  243. }
  244. this.disabled = false
  245. }
  246. this.spinning = false
  247. return data
  248. })
  249. },
  250. visibleAudit: false,
  251. visibleAuditReject: false,
  252. auditInfo: null,
  253. spinningAudit: false,
  254. spinningAuditReject: false
  255. }
  256. },
  257. computed: {
  258. columns () {
  259. const arr = [
  260. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  261. { title: '下推时间', dataIndex: 'pushedDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  262. { title: '单据来源', dataIndex: 'salesBillEntity.salesBillSourceDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  263. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '9%', align: 'center' },
  264. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '9%', align: 'center' },
  265. { title: '出库单号', dataIndex: 'stockOutNo', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  266. { title: '客户名称', dataIndex: 'buyerName', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  267. { title: '数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  268. // { title: '售价', dataIndex: 'totalAmount', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  269. { title: '备货时间', dataIndex: 'stockUpDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  270. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  271. { title: '打印次数', dataIndex: 'stockUpPrintTimes', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  272. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  273. ]
  274. // 仓库管理权限设置是否显示 (当客户有且只有一条仓库管理权限时,不显示仓库信息)
  275. if (this.isShowWarehouse) {
  276. arr.splice(7, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  277. }
  278. if (this.$hasPermissions('M_examineVerifyList_salesPrice')) { // 售价权限
  279. arr.splice(this.isShowWarehouse ? 9 : 8, 0, { title: '售价', dataIndex: 'totalAmount', width: '5%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  280. }
  281. return arr
  282. }
  283. },
  284. methods: {
  285. custChange (val) {
  286. this.queryParam.buyerSn = val.key
  287. },
  288. // 时间 change
  289. dateChange (date) {
  290. this.queryParam.pushedBeginDate = date[0]
  291. this.queryParam.pushedEndDate = date[1]
  292. },
  293. subareaChange (val) {
  294. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  295. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  296. },
  297. // 重置
  298. resetSearchForm () {
  299. this.$refs.rangeDate.resetDate(this.time)
  300. this.queryParam.pushedBeginDate = getDate.getThreeMonthDays().starttime
  301. this.queryParam.pushedEndDate = getDate.getCurrMonthDays().endtime
  302. this.queryParam.buyerSn = undefined
  303. this.$refs.dealerSubareaScopeList.resetForm()
  304. this.queryParam.salesBillNo = ''
  305. this.queryParam.dispatchBillNo = '' // 备货单号
  306. this.queryParam.stockOutNo = '' // 出库单号
  307. this.queryParam.billStatus = undefined
  308. this.queryParam.printStatus = undefined
  309. this.queryParam.subareaArea.subareaSn = undefined
  310. this.queryParam.subareaArea.subareaAreaSn = undefined
  311. this.queryParam.warehouseSn = undefined
  312. this.queryParam.bizUserSn = undefined
  313. if (this.advanced) {
  314. this.$refs.subarea.clearData()
  315. }
  316. this.$refs.table.refresh(true)
  317. },
  318. // 审核
  319. handleExamine (row) {
  320. this.auditInfo = row
  321. this.visibleAudit = true
  322. },
  323. // 反审核
  324. handleNAudit (row) {
  325. const _this = this
  326. this.$confirm({
  327. title: '操作提示',
  328. content: '该单据状态会改为待备货审核状态,可再次对该单据进行审核操作,确认操作吗?',
  329. centered: true,
  330. closable: true,
  331. onOk () {
  332. _this.spinning = true
  333. financeBookDgainEditBySn({ bookSn: row.bookSn }).then(res => {
  334. if (res.status == 200) {
  335. _this.$message.success(res.message)
  336. _this.$refs.table.refresh()
  337. }
  338. _this.spinning = false
  339. })
  340. }
  341. })
  342. },
  343. auditOrder (billStatus) {
  344. if (billStatus == 'STOCK_UP_REJECT') { // 审核不通过
  345. // 已对单
  346. if (this.auditInfo.checkStatus == 'PASS') {
  347. this.$info({
  348. title: '操作提示',
  349. content: '此备货单已经对单通过,不能操作备货审核不通过。'
  350. })
  351. } else {
  352. this.visibleAuditReject = true
  353. }
  354. } else {
  355. const params = {
  356. dispatchBillSn: this.auditInfo.dispatchBillSn,
  357. billStatus: billStatus
  358. }
  359. this.auditFun(params)
  360. }
  361. },
  362. auditFun (params) {
  363. this.spinningAudit = true
  364. this.spinningAuditReject = true
  365. dispatchStockUpAduit(params).then(res => {
  366. if (res.status == 200) {
  367. this.visibleAudit = false
  368. this.visibleAuditReject = false
  369. this.$message.success(res.message)
  370. this.$refs.table.refresh()
  371. this.spinningAudit = false
  372. this.spinningAuditReject = false
  373. } else {
  374. this.visibleAudit = false
  375. this.visibleAuditReject = false
  376. this.spinningAudit = false
  377. this.spinningAuditReject = false
  378. }
  379. })
  380. },
  381. // 审核不通过 提交
  382. auditReject (remarks) {
  383. const params = {
  384. dispatchBillSn: this.auditInfo.dispatchBillSn,
  385. billStatus: 'STOCK_UP_REJECT',
  386. remarks: remarks
  387. }
  388. this.auditFun(params)
  389. },
  390. // 详情
  391. handleDetail (row, type) {
  392. this.detailType = type
  393. this.bizSn = type == 0 ? row.salesBillSn : row.dispatchBillSn
  394. this.$store.state.app.curActionPermission = type == 0 ? 'B_salesDetail' : 'B_dispatchDetail'
  395. this.showDetailModal = true
  396. },
  397. cancelDetail () {
  398. this.showDetailModal = false
  399. this.detailType = 2
  400. this.bizSn = null
  401. this.$store.state.app.curActionPermission = ''
  402. },
  403. pageInit () {
  404. const _this = this
  405. this.$nextTick(() => { // 页面渲染完成后的回调
  406. _this.setTableH()
  407. })
  408. },
  409. setTableH () {
  410. const tableSearchH = this.$refs.tableSearch.offsetHeight
  411. this.tableHeight = window.innerHeight - tableSearchH - 228
  412. }
  413. },
  414. watch: {
  415. advanced (newValue, oldValue) {
  416. const _this = this
  417. this.$nextTick(() => { // 页面渲染完成后的回调
  418. _this.setTableH()
  419. })
  420. },
  421. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  422. this.setTableH()
  423. }
  424. },
  425. mounted () {
  426. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  427. this.pageInit()
  428. this.resetSearchForm()
  429. }
  430. },
  431. activated () {
  432. // 如果是新页签打开,则重置当前页面
  433. if (this.$store.state.app.isNewTab) {
  434. this.pageInit()
  435. this.resetSearchForm()
  436. }
  437. // 仅刷新列表,不重置页面
  438. if (this.$store.state.app.updateList) {
  439. this.pageInit()
  440. this.$refs.table.refresh()
  441. }
  442. },
  443. beforeRouteEnter (to, from, next) {
  444. next(vm => {})
  445. }
  446. }
  447. </script>
  448. <style lang="less">
  449. .examineVerifyList-wrap{
  450. .sTable{
  451. margin-top: 8px;
  452. }
  453. }
  454. </style>