list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <div class="receiptPrint-wrap">
  3. <div style="background-color: #fff;">
  4. <a-tabs v-model="currentTab" @change="changeTab">
  5. <a-tab-pane :key="1" tab="全部">
  6. </a-tab-pane>
  7. <a-tab-pane :key="2" tab="待打印">
  8. </a-tab-pane>
  9. </a-tabs>
  10. </div>
  11. <a-card style="margin-top: 5px;" size="small" :bordered="false">
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <!-- 搜索条件 -->
  14. <div ref="tableSearch" class="table-page-search-wrapper">
  15. <a-form layout="inline">
  16. <a-row :gutter="15">
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="创建时间">
  19. <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="6" :sm="24">
  23. <a-form-item label="客户名称">
  24. <dealerSubareaScopeList ref="settleClientName" id="salesCollectionList-settleClientName" @change="custChange" />
  25. </a-form-item>
  26. </a-col>
  27. <a-col :md="6" :sm="24">
  28. <a-form-item label="销售单号">
  29. <a-input id="salesCollectionList-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入销售单号"/>
  30. </a-form-item>
  31. </a-col>
  32. <template v-if="advanced">
  33. <a-col :md="6" :sm="24">
  34. <a-form-item label="备货单号">
  35. <a-input id="salesCollectionList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24">
  39. <a-form-item label="收货客户名称">
  40. <dealerSubareaScopeList ref="receiverName" id="salesCollectionList-receiverName" @change="receiverChange" />
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="24">
  44. <a-form-item label="业务状态">
  45. <v-select
  46. v-model="queryParam.billStatus"
  47. ref="billStatus"
  48. id="salesCollectionList-billStatus"
  49. code="DISPATCH_BILL_STATUS"
  50. placeholder="请选择业务状态"
  51. allowClear></v-select>
  52. </a-form-item>
  53. </a-col>
  54. <a-col :md="6" :sm="24">
  55. <a-form-item label="单据状态">
  56. <v-select
  57. v-model="queryParam.voidFlag"
  58. ref="voidFlag"
  59. id="salesCollectionList-voidFlag"
  60. code="VOID_FLAG"
  61. placeholder="请选择单据状态"
  62. allowClear></v-select>
  63. </a-form-item>
  64. </a-col>
  65. <a-col :md="6" :sm="24" v-if="currentTab == 1">
  66. <a-form-item label="收款打印状态">
  67. <v-select
  68. v-model="queryParam.printState"
  69. ref="printState"
  70. id="salesCollectionList-printState"
  71. code="RECEIPT_PRINT"
  72. placeholder="请选择打印状态"
  73. allowClear
  74. ></v-select>
  75. </a-form-item>
  76. </a-col>
  77. <a-col :md="6" :sm="24">
  78. <a-form-item label="所在区域">
  79. <subarea id="salesCollectionList-subarea" v-model="queryParam.subareaSn"></subarea>
  80. </a-form-item>
  81. </a-col>
  82. <a-col :md="6" :sm="24">
  83. <a-row>
  84. <a-form-item label="地区">
  85. <a-col span="24">
  86. <a-form-item prop="dealerProvinceSn" style="margin: 0;">
  87. <Area id="salesCollectionList-dealerProvinceSn" v-model="queryParam.dealerProvinceSn" placeholder="请选择省"></Area>
  88. </a-form-item>
  89. </a-col>
  90. </a-form-item>
  91. </a-row>
  92. </a-col>
  93. </template>
  94. <a-col :md="6" :sm="24">
  95. <span class="table-page-search-submitButtons">
  96. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  97. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  98. <a @click="advanced=!advanced" style="margin-left: 8px">
  99. {{ advanced ? '收起' : '展开' }}
  100. <a-icon :type="advanced ? 'up' : 'down'"/>
  101. </a>
  102. </span>
  103. </a-col>
  104. </a-row>
  105. </a-form>
  106. </div>
  107. <!-- 列表 -->
  108. <s-table
  109. class="sTable fixPagination"
  110. ref="table"
  111. :style="{ height: tableHeight+60.5+'px' }"
  112. size="small"
  113. :rowKey="(record) => record.id"
  114. :columns="columns"
  115. :data="loadData"
  116. :scroll="{ y:tableHeight }"
  117. :defaultLoadData="false"
  118. bordered>
  119. <!-- 单号 -->
  120. <template slot="bizNo" slot-scope="text, record">
  121. <span v-if="$hasPermissions('B_salesDetail')" class="link-bule" @click="handleDetail(record)">{{ record.bizNo }}</span>
  122. <span v-else>{{ record.bizNo }}</span>
  123. </template>
  124. <!-- 下推单号 -->
  125. <template slot="dispatchBillNo" slot-scope="text, record">
  126. <span v-if="$hasPermissions('B_dispatchDetail')" class="link-bule" @click="handleBhDetail(record)">{{ record.dispatchBillNo }}</span>
  127. <span v-else>{{ record.dispatchBillNo || '--' }}</span>
  128. </template>
  129. <!-- 操作 -->
  130. <template slot="action" slot-scope="text, record">
  131. <a-button
  132. size="small"
  133. type="link"
  134. v-if="record.printState == 'NO_PRINT'&&$hasPermissions('B_SkPrint')"
  135. class="button-warning"
  136. @click="handlePrint(record)"
  137. >收款打印</a-button>
  138. <a-button
  139. size="small"
  140. type="link"
  141. class="button-warning"
  142. v-else-if="record.printState == 'PRINT'&&$hasPermissions('B_SKPrintRecord')"
  143. @click="viewPrint(record)"
  144. >打印记录</a-button>
  145. <span v-else>--</span>
  146. </template>
  147. </s-table>
  148. <!-- 收款打印 -->
  149. <commonModal
  150. modalTit="收款打印"
  151. bodyPadding="10px"
  152. width="1024px"
  153. :showFooter="false"
  154. :openModal="showTipModal"
  155. @cancel="showTipModal=false">
  156. <printModel ref="printModel" @cancel="showTipModal=false" @printOk="printOk"></printModel>
  157. </commonModal>
  158. <!-- 打印记录 -->
  159. <recordModal ref="recordModal" modalTit="打印记录" :openModal="showRecordModal" @cancel="showRecordModal=false"></recordModal>
  160. </a-spin>
  161. </a-card>
  162. </div>
  163. </template>
  164. <script>
  165. import { commonMixin } from '@/utils/mixin'
  166. import moment from 'moment'
  167. import rangeDate from '@/views/common/rangeDate.vue'
  168. import { STable, VSelect } from '@/components'
  169. import subarea from '@/views/common/subarea.js'
  170. import Area from '@/views/common/area.js'
  171. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  172. import commonModal from '@/views/common/commonModal.vue'
  173. import recordModal from './recordModal.vue'
  174. import printModel from './printModel.vue'
  175. import { settleReceiptList } from '@/api/settleReceipt'
  176. export default {
  177. name: 'PushOrderManagementList',
  178. mixins: [commonMixin],
  179. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, commonModal, recordModal, Area, printModel },
  180. data () {
  181. return {
  182. spinning: false,
  183. advanced: true, // 高级搜索 展开/关闭
  184. disabled: false, // 查询、重置按钮是否可操作
  185. tableHeight: 0,
  186. time: [],
  187. currentTab: 2,
  188. // 查询参数
  189. queryParam: {
  190. beginDate: '',
  191. endDate: '',
  192. bizNo: '',
  193. dispatchBillNo: '',
  194. settleClientName: '',
  195. receiverName: '',
  196. subareaSn: undefined,
  197. billStatus: undefined,
  198. voidFlag: undefined,
  199. dealerProvinceSn: undefined,
  200. printState: 'NO_PRINT'
  201. },
  202. totalData: {
  203. totalAmount: 0,
  204. totalQty: 0,
  205. totalRecord: 0
  206. },
  207. showTipModal: false,
  208. showRecordModal: false,
  209. // 加载数据方法 必须为 Promise 对象
  210. loadData: parameter => {
  211. this.disabled = true
  212. this.spinning = true
  213. return settleReceiptList(Object.assign(parameter, this.queryParam)).then(res => {
  214. let data
  215. if (res.status == 200) {
  216. data = res.data
  217. const no = (data.pageNo - 1) * data.pageSize
  218. for (var i = 0; i < data.list.length; i++) {
  219. data.list[i].no = no + i + 1
  220. }
  221. this.disabled = false
  222. }
  223. this.spinning = false
  224. return data
  225. })
  226. }
  227. }
  228. },
  229. computed: {
  230. columns () {
  231. const arr = [
  232. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  233. { title: '创建时间', dataIndex: 'createDate', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
  234. { title: '销售单号', scopedSlots: { customRender: 'bizNo' }, width: '9%', align: 'center' },
  235. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '9%', align: 'center' },
  236. { title: '发货编号', dataIndex: 'sendNo', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  237. { title: '客户名称', dataIndex: 'settleClientName', align: 'left', width: '10%', customRender: function (text) { return text || '--' }, ellipsis: true },
  238. { title: '收货客户名称', dataIndex: 'receiverName', align: 'left', width: '10%', customRender: function (text) { return text || '--' }, ellipsis: true },
  239. { title: '产品款数', dataIndex: 'totalCategory', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  240. { title: '产品数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  241. // { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  242. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  243. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  244. { title: '收款打印状态', dataIndex: 'printStateDictValue', width: '6%', align: 'center' },
  245. { title: '打印次数', dataIndex: 'printCount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  246. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  247. ]
  248. if (this.$hasPermissions('B_isShowPrice')) { // 售价权限
  249. arr.splice(9, 0, { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  250. }
  251. return arr
  252. }
  253. },
  254. methods: {
  255. changeTab (v) {
  256. this.currentTab = v
  257. this.resetSearchForm()
  258. },
  259. // 时间 change
  260. dateChange (date) {
  261. this.queryParam.beginDate = date[0]
  262. this.queryParam.endDate = date[1]
  263. },
  264. custChange (val) {
  265. this.queryParam.settleClientName = val.name
  266. },
  267. receiverChange (val) {
  268. this.queryParam.receiverName = val.name
  269. },
  270. // 销售单详情
  271. handleDetail (row) {
  272. this.$router.push({ name: 'salesDetail', params: { sn: row.bizSn, type: 'salesCollection' } })
  273. },
  274. // 备货单号
  275. handleBhDetail (row) {
  276. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'salesCollection' } })
  277. },
  278. // 收款打印
  279. handlePrint (row) {
  280. this.showTipModal = true
  281. this.$nextTick(() => {
  282. this.$refs.printModel.getData(row)
  283. })
  284. },
  285. printOk () {
  286. this.$refs.table.refresh()
  287. },
  288. // 打印记录
  289. viewPrint (row) {
  290. this.showRecordModal = true
  291. this.$refs.recordModal.setData(row, {
  292. billType: 'SETTLE_RECEIPT',
  293. billSn: row.accountReceiptSn
  294. })
  295. },
  296. // 重置
  297. resetSearchForm () {
  298. this.time = []
  299. if (this.advanced) {
  300. this.$refs.rangeDate.resetDate(this.time)
  301. this.$refs.receiverName.resetForm()
  302. }
  303. this.$refs.settleClientName.resetForm()
  304. this.queryParam = {
  305. beginDate: '',
  306. endDate: '',
  307. bizNo: '',
  308. dispatchBillNo: '',
  309. settleClientName: '',
  310. receiverName: '',
  311. subareaSn: undefined,
  312. billStatus: undefined,
  313. voidFlag: undefined,
  314. dealerProvinceSn: undefined,
  315. printState: this.currentTab == 2 ? 'NO_PRINT' : undefined
  316. }
  317. this.$refs.table.refresh(true)
  318. },
  319. pageInit () {
  320. const _this = this
  321. this.$nextTick(() => { // 页面渲染完成后的回调
  322. _this.setTableH()
  323. })
  324. },
  325. setTableH () {
  326. const tableSearchH = this.$refs.tableSearch.offsetHeight
  327. this.tableHeight = window.innerHeight - tableSearchH - 228
  328. }
  329. },
  330. watch: {
  331. advanced (newValue, oldValue) {
  332. const _this = this
  333. this.$nextTick(() => { // 页面渲染完成后的回调
  334. _this.setTableH()
  335. })
  336. },
  337. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  338. this.setTableH()
  339. }
  340. },
  341. mounted () {
  342. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  343. this.pageInit()
  344. this.resetSearchForm()
  345. }
  346. },
  347. activated () {
  348. // 如果是新页签打开,则重置当前页面
  349. if (this.$store.state.app.isNewTab) {
  350. this.pageInit()
  351. this.resetSearchForm()
  352. }
  353. // 仅刷新列表,不重置页面
  354. if (this.$store.state.app.updateList) {
  355. this.pageInit()
  356. this.$refs.table.refresh()
  357. }
  358. },
  359. beforeRouteEnter (to, from, next) {
  360. next(vm => {})
  361. }
  362. }
  363. </script>
  364. <style lang="less">
  365. .receiptPrint-wrap{
  366. .sTable{
  367. margin-top: 10px;
  368. }
  369. .ant-tabs-bar{
  370. margin:0;
  371. }
  372. }
  373. </style>