list.vue 18 KB

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