list.vue 21 KB

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