list.vue 21 KB

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