list.vue 20 KB

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