list.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <a-card size="small" :bordered="false" class="pushOrder-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="pushOrder-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="pushOrder-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="pushOrder-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="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  31. <dealerSubareaScopeList ref="shbuyerName" id="pushOrder-shbuyerName" @change="shcustChange" />
  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="pushOrder-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.voidFlag"
  49. ref="voidFlag"
  50. id="pushOrder-voidFlag"
  51. code="VOID_FLAG"
  52. placeholder="请选择单据状态"
  53. allowClear></v-select>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :md="6" :sm="24">
  57. <a-form-item label="备货打印状态">
  58. <v-select
  59. v-model="queryParam.printStatus"
  60. ref="printStatus"
  61. id="pushOrder-printStatus"
  62. code="PRINT_STATUS"
  63. placeholder="请选择备货打印状态"
  64. allowClear></v-select>
  65. </a-form-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-item label="对单状态">
  69. <v-select
  70. v-model="queryParam.checkStatus"
  71. ref="printStatus"
  72. id="pushOrder-printStatus"
  73. code="CHECK_STATUS"
  74. placeholder="请选择对单状态"
  75. allowClear></v-select>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-model-item label="所在区域">
  80. <subarea id="pushOrder-subarea" ref="subarea" @change="subareaChange"></subarea>
  81. </a-form-model-item>
  82. </a-col>
  83. <a-col :md="6" :sm="24">
  84. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  85. <Area id="pushOrder-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  86. </a-form-model-item>
  87. </a-col>
  88. <a-col :md="6" :sm="24">
  89. <a-form-model-item label="出库仓库">
  90. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  91. </a-form-model-item>
  92. </a-col>
  93. </template>
  94. <a-col :md="24" :sm="24">
  95. <div class="table-page-search-submitButtons" style="text-align:center;">
  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. </div>
  103. </a-col>
  104. </a-row>
  105. </a-form>
  106. </div>
  107. <!-- alert -->
  108. <a-alert type="info" style="margin-bottom:10px">
  109. <div slot="message">
  110. 下推总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
  111. 下推总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  112. <span v-if="$hasPermissions('M_pushOrderManagementList_salesPrice')">下推总金额:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? toThousands(totalData.totalAmount) : '--' }}</strong>;</span>
  113. </div>
  114. </a-alert>
  115. <!-- 列表 -->
  116. <s-table
  117. class="sTable fixPagination"
  118. ref="table"
  119. :style="{ height: tableHeight+84.5+'px' }"
  120. size="small"
  121. :rowKey="(record) => record.id"
  122. :columns="columns"
  123. :data="loadData"
  124. :scroll="{ y:tableHeight, x:1890 }"
  125. :defaultLoadData="false"
  126. bordered>
  127. <!-- 销售单号 -->
  128. <template slot="salesBillNo" slot-scope="text, record">
  129. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  130. <span v-else>{{ record.salesBillNo }}</span>
  131. </template>
  132. <!-- 备货单号 -->
  133. <template slot="dispatchBillNo" slot-scope="text, record">
  134. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  135. <span v-else>{{ record.dispatchBillNo }}</span>
  136. </template>
  137. <!-- 发货说明 -->
  138. <template slot="explainInfo" slot-scope="text, record">
  139. <span class="link-bule" @click="handleExplainInfo(record)" :title="record.explainInfo">{{ record.explainInfo||'--' }}</span>
  140. </template>
  141. <!-- 操作 -->
  142. <template slot="action" slot-scope="text, record">
  143. <div>
  144. <a-button
  145. size="small"
  146. type="link"
  147. class="button-warning"
  148. :loading="!!tipData"
  149. v-if="(record.printStatus=='UNABLE_PRINT'||record.printStatus=='CANCEL_PRINT')&&record.voidFlag=='0'&&$hasPermissions('B_UNABLE_PRINT')"
  150. @click="handlePrint(record,1)"
  151. >允许打印</a-button>
  152. <a-button
  153. size="small"
  154. type="link"
  155. class="button-error"
  156. :loading="!!tipData"
  157. v-if="record.printStatus=='UNABLE_PRINT'&&record.voidFlag=='0'&&$hasPermissions('B_CANSEL_PRINT')"
  158. @click="handlePrint(record,0)"
  159. >取消打印</a-button>
  160. </div>
  161. </template>
  162. </s-table>
  163. <!-- 操作提示 -->
  164. <commonModal modalTit="操作提示" :openModal="showTipModal" @cancel="canselModal" @ok="updatePrintStatus">
  165. <div style="display:flex;flex-direction: column;align-items: center;">
  166. <div style="margin-bottom: 15px;font-size: 14px;"><strong>{{ tipData&&tipData.printType==1?'确认允许此单进行备货打印吗?':'确认此单取消备货打印吗?' }}</strong></div>
  167. <div style="line-height: 24px;">
  168. <div>备货单号:{{ tipData&&tipData.dispatchBillNo }}</div>
  169. <div>客户名称:{{ tipData&&tipData.buyerName }}</div>
  170. </div>
  171. </div>
  172. </commonModal>
  173. <!-- 查看销售单或备货单详情 -->
  174. <commonModal
  175. modalTit="销售单详情"
  176. bodyPadding="10px"
  177. width="70%"
  178. :showFooter="false"
  179. :openModal="showDetailModal"
  180. @cancel="closeDetailModal">
  181. <salesDetail v-if="showDetailModal" ref="salesDetail" :bizSn="bizSn"></salesDetail>
  182. </commonModal>
  183. <!-- 发货说明 -->
  184. <explainInfoModal v-drag :rowData="tipData" :openModal="showInfoModal" @close="canselModal"></explainInfoModal>
  185. </a-spin>
  186. </a-card>
  187. </template>
  188. <script>
  189. import { commonMixin } from '@/utils/mixin'
  190. import moment from 'moment'
  191. import getDate from '@/libs/getDate.js'
  192. import rangeDate from '@/views/common/rangeDate.vue'
  193. import { STable, VSelect } from '@/components'
  194. import subarea from '@/views/common/subarea.js'
  195. import Area from '@/views/common/area.js'
  196. import chooseWarehouse from '@/views/common/chooseWarehouse'
  197. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  198. import commonModal from '@/views/common/commonModal.vue'
  199. import salesDetail from '@/views/salesManagement/salesQuery/detail.vue'
  200. import explainInfoModal from './explainInfoModal.vue'
  201. import { dispatchlList, dispatchQueryCount, dispatchPrintStatus } from '@/api/dispatch'
  202. export default {
  203. name: 'PushOrderManagementList',
  204. mixins: [commonMixin],
  205. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, commonModal, Area, salesDetail, explainInfoModal, chooseWarehouse },
  206. data () {
  207. return {
  208. spinning: false,
  209. advanced: true, // 高级搜索 展开/关闭
  210. disabled: false, // 查询、重置按钮是否可操作
  211. showDetailModal: false,
  212. showInfoModal: false,
  213. bizSn: null,
  214. tableHeight: 0,
  215. time: [
  216. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  217. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  218. ],
  219. // 查询参数
  220. queryParam: {
  221. beginDate: getDate.getThreeMonthDays().starttime,
  222. endDate: getDate.getCurrMonthDays().endtime,
  223. buyerSn: undefined, // 客户名称
  224. receiverSn: undefined, // 收货客户
  225. salesBillNo: '', // 销售单号
  226. dispatchBillNo: '', // 备货单号
  227. billStatus: undefined, // 业务状态
  228. subareaArea: {
  229. subareaSn: undefined,
  230. subareaAreaSn: undefined
  231. },
  232. voidFlag: undefined,
  233. shippingAddrProvinceSn: undefined,
  234. printStatus: undefined,
  235. checkStatus: undefined,
  236. warehouseSn: undefined
  237. },
  238. totalData: {
  239. totalAmount: 0,
  240. totalQty: 0,
  241. totalRecord: 0
  242. },
  243. showTipModal: false,
  244. tipData: null,
  245. // 加载数据方法 必须为 Promise 对象
  246. loadData: parameter => {
  247. this.disabled = true
  248. this.spinning = true
  249. // 查询总计
  250. dispatchQueryCount(Object.assign(parameter, this.queryParam)).then(res => {
  251. this.totalData = Object.assign(this.totalData, res.data || {})
  252. })
  253. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  254. let data
  255. if (res.status == 200) {
  256. data = res.data
  257. const no = (data.pageNo - 1) * data.pageSize
  258. for (var i = 0; i < data.list.length; i++) {
  259. data.list[i].no = no + i + 1
  260. }
  261. this.disabled = false
  262. }
  263. this.spinning = false
  264. return data
  265. })
  266. }
  267. }
  268. },
  269. computed: {
  270. columns () {
  271. const arr = [
  272. { title: '序号', dataIndex: 'no', width: '60px', align: 'center' },
  273. { title: '创建时间', dataIndex: 'createDate', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  274. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '120px', align: 'center' },
  275. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '120px', align: 'center' },
  276. { title: '发货编号', dataIndex: 'sendNo', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  277. { title: '发货说明', scopedSlots: { customRender: 'explainInfo' }, width: '150px', align: 'center', ellipsis: true },
  278. { title: '客户名称', dataIndex: 'buyerName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  279. { title: '收货客户名称', dataIndex: 'receiverName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  280. { title: '出库仓库', dataIndex: 'warehouseName', width: '150px', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  281. { title: '产品款数', dataIndex: 'totalCategory', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  282. { title: '产品数量', dataIndex: 'totalQty', width: '80px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  283. // { title: '总售价', dataIndex: 'totalAmount', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  284. { title: '备货打印状态', dataIndex: 'printStatusDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  285. { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  286. { title: '收款打印状态', dataIndex: 'settlePrintStateDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  287. { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  288. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  289. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  290. { title: '备货时间', dataIndex: 'stockUpDate', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  291. { title: '出库时间', dataIndex: 'stockOutDate', width: '100px', align: 'center', customRender: function (text) { return text || '--' } },
  292. { title: '操作', scopedSlots: { customRender: 'action' }, width: '100px', align: 'center', fixed: 'right' }
  293. ]
  294. if (this.$hasPermissions('M_pushOrderManagementList_salesPrice')) { // 售价权限
  295. arr.splice(10, 0, { title: '总售价', dataIndex: 'totalAmount', width: '80px', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  296. }
  297. return arr
  298. }
  299. },
  300. methods: {
  301. // 时间 change
  302. dateChange (date) {
  303. this.queryParam.beginDate = date[0]
  304. this.queryParam.endDate = date[1]
  305. },
  306. custChange (val) {
  307. this.queryParam.buyerSn = val.key
  308. },
  309. shcustChange (val) {
  310. this.queryParam.receiverSn = val.key
  311. },
  312. // 详情
  313. handleDetail (row, type) {
  314. if (type == 0) {
  315. this.$store.state.app.curActionPermission = 'B_salesDetail'
  316. this.bizSn = row.salesBillSn
  317. this.showDetailModal = true
  318. } else {
  319. this.$router.push({ name: 'pushOrderDetail', params: { sn: row.dispatchBillSn, type: 'pushOrder' } })
  320. }
  321. },
  322. closeDetailModal () {
  323. this.showDetailModal = false
  324. this.$store.state.app.curActionPermission = ''
  325. },
  326. // 查看发货说明
  327. handleExplainInfo (row) {
  328. this.tipData = row
  329. this.showInfoModal = true
  330. },
  331. // 允许备货打印
  332. handlePrint (row, type) {
  333. this.tipData = row
  334. this.tipData.printType = type
  335. this.showTipModal = true
  336. },
  337. canselModal () {
  338. this.tipData = null
  339. this.showTipModal = false
  340. this.showInfoModal = false
  341. },
  342. updatePrintStatus () {
  343. dispatchPrintStatus({ dispatchBillSn: this.tipData.dispatchBillSn, printStatus: this.tipData && this.tipData.printType == 1 ? 'NO_PRINT' : 'CANCEL_PRINT' }).then(res => {
  344. if (res.status == 200) {
  345. this.canselModal()
  346. this.$message.info(res.message)
  347. this.$refs.table.refresh()
  348. }
  349. })
  350. },
  351. subareaChange (val) {
  352. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  353. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  354. },
  355. // 重置
  356. resetSearchForm () {
  357. this.$refs.rangeDate.resetDate(this.time)
  358. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  359. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  360. this.queryParam.buyerSn = undefined
  361. this.queryParam.receiverSn = undefined
  362. this.$refs.dealerSubareaScopeList.resetForm()
  363. this.$refs.shbuyerName.resetForm()
  364. this.queryParam.salesBillNo = ''
  365. this.queryParam.dispatchBillNo = ''
  366. this.queryParam.billStatus = undefined
  367. this.queryParam.voidFlag = undefined
  368. this.queryParam.subareaArea.subareaSn = undefined
  369. this.queryParam.subareaArea.subareaAreaSn = undefined
  370. this.queryParam.shippingAddrProvinceSn = undefined
  371. this.queryParam.printStatus = undefined
  372. this.queryParam.checkStatus = undefined
  373. this.queryParam.warehouseSn = undefined
  374. if (this.advanced) {
  375. this.$refs.subarea.clearData()
  376. }
  377. this.$refs.table.refresh(true)
  378. },
  379. pageInit () {
  380. const _this = this
  381. this.$nextTick(() => { // 页面渲染完成后的回调
  382. _this.setTableH()
  383. })
  384. },
  385. setTableH () {
  386. const tableSearchH = this.$refs.tableSearch.offsetHeight
  387. this.tableHeight = window.innerHeight - tableSearchH - 240
  388. }
  389. },
  390. watch: {
  391. advanced (newValue, oldValue) {
  392. const _this = this
  393. this.$nextTick(() => { // 页面渲染完成后的回调
  394. _this.setTableH()
  395. })
  396. },
  397. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  398. this.setTableH()
  399. }
  400. },
  401. mounted () {
  402. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  403. this.pageInit()
  404. this.resetSearchForm()
  405. }
  406. },
  407. activated () {
  408. // 如果是新页签打开,则重置当前页面
  409. if (this.$store.state.app.isNewTab) {
  410. this.pageInit()
  411. this.resetSearchForm()
  412. }
  413. // 仅刷新列表,不重置页面
  414. if (this.$store.state.app.updateList) {
  415. this.pageInit()
  416. this.$refs.table.refresh()
  417. }
  418. },
  419. beforeRouteEnter (to, from, next) {
  420. next(vm => {})
  421. }
  422. }
  423. </script>
  424. <style lang="less">
  425. .pushOrder-wrap{
  426. .sTable{
  427. margin-top: 10px;
  428. }
  429. }
  430. </style>