list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <div class="matchSoo-wrap">
  3. <a-card size="small" class="searchBoxNormal" :bordered="false">
  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="matchSoo-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="matchSoo-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. <v-select
  26. v-model="queryParam.billStatus"
  27. ref="billStatus"
  28. id="matchSoo-billStatus"
  29. code="DISPATCH_BILL_STATUS"
  30. placeholder="请选择业务状态"
  31. allowClear></v-select>
  32. </a-form-item>
  33. </a-col>
  34. <template v-if="advanced">
  35. <a-col :md="6" :sm="24">
  36. <a-form-item label="对单时间">
  37. <rangeDate ref="checkDate" :value="checktime" @change="checkDateChange" />
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  42. <dealerSubareaScopeList ref="shbuyerName" id="matchSoo-shbuyerName" @change="shcustChange" />
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="24">
  46. <a-form-item label="备货单号">
  47. <a-input id="matchSoo-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="6" :sm="24">
  51. <a-form-item label="单据状态">
  52. <v-select
  53. v-model="queryParam.voidFlag"
  54. ref="voidFlag"
  55. id="pushOrder-voidFlag"
  56. code="VOID_FLAG"
  57. placeholder="请选择单据状态"
  58. allowClear></v-select>
  59. </a-form-item>
  60. </a-col>
  61. <a-col :md="6" :sm="24">
  62. <a-form-model-item label="所在区域">
  63. <subarea id="matchSoo-subarea" ref="subarea" @change="subareaChange"></subarea>
  64. </a-form-model-item>
  65. </a-col>
  66. <a-col :md="6" :sm="24">
  67. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  68. <Area id="matchSoo-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  69. </a-form-model-item>
  70. </a-col>
  71. <a-col :md="6" :sm="24" v-show="isShowWarehouse">
  72. <a-form-model-item label="仓库">
  73. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" :isPermission="true"></chooseWarehouse>
  74. </a-form-model-item>
  75. </a-col>
  76. <a-col :md="6" :sm="24">
  77. <a-form-item label="对单状态">
  78. <v-select
  79. v-model="queryParam.checkStatus"
  80. ref="checkStatus"
  81. id="matchSoo-checkStatus"
  82. code="CHECK_STATUS"
  83. placeholder="请选择对单状态"
  84. allowClear></v-select>
  85. </a-form-item>
  86. </a-col>
  87. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  88. <a-form-item label="客服">
  89. <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  90. </a-form-item>
  91. </a-col>
  92. </template>
  93. <a-col :md="isShowCustomerSearch&&advanced?6:24" :sm="24">
  94. <div class="table-page-search-submitButtons" :style="{textAlign:isShowCustomerSearch&&advanced?'':'center'}">
  95. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  96. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  97. <a @click="advanced=!advanced" style="margin-left: 8px">
  98. {{ advanced ? '收起' : '展开' }}
  99. <a-icon :type="advanced ? 'up' : 'down'"/>
  100. </a>
  101. </div>
  102. </a-col>
  103. </a-row>
  104. </a-form>
  105. </div>
  106. </a-card>
  107. <a-card style="margin-top: 5px;" size="small" :bordered="false">
  108. <a-spin :spinning="spinning" tip="Loading...">
  109. <!-- 列表 -->
  110. <s-table
  111. class="sTable fixPagination"
  112. ref="table"
  113. :style="{ height: tableHeight+70+'px' }"
  114. size="small"
  115. :rowKey="(record) => record.id"
  116. :columns="columns"
  117. :data="loadData"
  118. :pageSize="30"
  119. :scroll="{ y:tableHeight }"
  120. :defaultLoadData="false"
  121. bordered>
  122. <!-- 销售单号 -->
  123. <template slot="salesBillNo" slot-scope="text, record">
  124. <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
  125. <span v-else>{{ record.salesBillNo }}</span>
  126. </template>
  127. <!-- 备货单号 -->
  128. <template slot="dispatchBillNo" slot-scope="text, record">
  129. <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
  130. <span v-else>{{ record.dispatchBillNo }}</span>
  131. </template>
  132. <!-- 操作 -->
  133. <template slot="action" slot-scope="text, record">
  134. <a-button
  135. size="small"
  136. type="link"
  137. class="button-warning"
  138. v-if="record.checkStatus =='WAIT'&&record.voidFlag==0&&$hasPermissions('B_DDAudit')"
  139. @click="handleAudit(record)"
  140. >对单通过</a-button>
  141. <span v-else>--</span>
  142. </template>
  143. </s-table>
  144. </a-spin>
  145. </a-card>
  146. <!-- 查看销售单或备货单详情 -->
  147. <commonModal
  148. :modalTit="detailType?'备货单详情':'销售单详情'"
  149. bodyPadding="10px"
  150. width="70%"
  151. :showFooter="false"
  152. :openModal="showDetailModal"
  153. @cancel="cancelDetail">
  154. <salesDetail v-if="detailType==0" ref="salesDetail" :bizSn="bizSn"></salesDetail>
  155. <dispatchDetail v-if="detailType==1" ref="dispatchDetail" :bizSn="bizSn"></dispatchDetail>
  156. </commonModal>
  157. </div>
  158. </template>
  159. <script>
  160. import { commonMixin } from '@/utils/mixin'
  161. import moment from 'moment'
  162. import rangeDate from '@/views/common/rangeDate.vue'
  163. import getDate from '@/libs/getDate.js'
  164. import { STable, VSelect } from '@/components'
  165. import subarea from '@/views/common/subarea.js'
  166. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  167. import Area from '@/views/common/area.js'
  168. import { dispatchlList, dispatchCheck } from '@/api/dispatch'
  169. import commonModal from '@/views/common/commonModal.vue'
  170. import salesDetail from '@/views/salesManagement/salesQueryNew/detailAll.vue'
  171. import chooseWarehouse from '@/views/common/chooseWarehouse'
  172. import customerService from '@/views/common/customerService'
  173. import dispatchDetail from '@/views/salesManagement/pushOrderManagement/detail.vue'
  174. export default {
  175. name: 'MatchSendOutOrderList',
  176. mixins: [commonMixin],
  177. components: { STable, VSelect, dealerSubareaScopeList, rangeDate, subarea, Area, commonModal, salesDetail, dispatchDetail, chooseWarehouse, customerService },
  178. data () {
  179. return {
  180. spinning: false,
  181. advanced: true, // 高级搜索 展开/关闭
  182. disabled: false, // 查询、重置按钮是否可操作
  183. showDetailModal: false,
  184. detailType: 2,
  185. bizSn: null,
  186. tableHeight: 0,
  187. time: [
  188. moment(getDate.getCurrMonthDays().starttime, 'YYYY-MM-DD'),
  189. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  190. ],
  191. checktime: [],
  192. // 查询参数
  193. queryParam: {
  194. beginDate: getDate.getThreeMonthDays().starttime, // 开始时间
  195. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  196. checkBeginDate: '',
  197. checkEndDate: '',
  198. buyerSn: undefined, // 客户名称
  199. receiverSn: undefined, // 收货客户
  200. salesBillNo: '', // 销售单号
  201. dispatchBillNo: '', // 备货单号
  202. billStatus: undefined, // 业务状态
  203. subareaArea: {
  204. subareaSn: undefined,
  205. subareaAreaSn: undefined
  206. },
  207. voidFlag: undefined,
  208. shippingAddrProvinceSn: undefined,
  209. checkStatus: undefined,
  210. warehouseSn: undefined,
  211. bizUserSn: undefined
  212. },
  213. // 加载数据方法 必须为 Promise 对象
  214. loadData: parameter => {
  215. this.disabled = true
  216. this.spinning = true
  217. return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
  218. let data
  219. if (res.status == 200) {
  220. data = res.data
  221. const no = (data.pageNo - 1) * data.pageSize
  222. for (var i = 0; i < data.list.length; i++) {
  223. data.list[i].no = no + i + 1
  224. }
  225. this.disabled = false
  226. }
  227. this.spinning = false
  228. return data
  229. })
  230. }
  231. }
  232. },
  233. computed: {
  234. columns () {
  235. const arr = [
  236. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  237. { title: '创建时间', dataIndex: 'createDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  238. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '10%', align: 'center' },
  239. { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '10%', align: 'center' },
  240. { title: '发货编号', dataIndex: 'sendNo', width: '6%', align: 'center' },
  241. { title: '客户名称', dataIndex: 'buyerName', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  242. // { title: '仓库', dataIndex: 'warehouseName', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  243. { title: '收货客户名称', dataIndex: 'receiverName', width: '14%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  244. { title: '产品款数', dataIndex: 'totalCategory', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  245. { title: '产品数量', dataIndex: 'totalQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  246. // { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  247. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  248. { title: '单据状态', dataIndex: 'voidFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  249. { title: '对单状态', dataIndex: 'checkStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  250. { title: '对单人员', dataIndex: 'checkPersonName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  251. { title: '对单时间', dataIndex: 'checkDate', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
  252. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  253. ]
  254. if (this.isShowWarehouse) {
  255. arr.splice(7, 0, { title: '仓库', dataIndex: 'warehouseName', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  256. }
  257. if (this.$hasPermissions('M_matchSendOutOrderList_salesPrice')) { // 售价权限
  258. arr.splice(this.isShowWarehouse ? 10 : 9, 0, { title: '总售价', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
  259. }
  260. return arr
  261. }
  262. },
  263. methods: {
  264. // 时间 change
  265. dateChange (date) {
  266. this.queryParam.beginDate = date[0]
  267. this.queryParam.endDate = date[1]
  268. },
  269. checkDateChange (date) {
  270. this.queryParam.checkBeginDate = date[0]
  271. this.queryParam.checkEndDate = date[1]
  272. },
  273. custChange (val) {
  274. this.queryParam.buyerSn = val.key
  275. },
  276. shcustChange (val) {
  277. this.queryParam.receiverSn = val.key
  278. },
  279. // 详情
  280. handleDetail (row, type) {
  281. this.detailType = type
  282. this.bizSn = type == 0 ? row.salesBillSn : row.dispatchBillSn
  283. this.$store.state.app.curActionPermission = type == 0 ? 'B_salesDetail' : 'B_dispatchDetail'
  284. this.showDetailModal = true
  285. },
  286. cancelDetail () {
  287. this.showDetailModal = false
  288. this.detailType = 2
  289. this.bizSn = null
  290. this.$store.state.app.curActionPermission = ''
  291. },
  292. // 对单
  293. handleAudit (row) {
  294. const _this = this
  295. this.$confirm({
  296. title: '操作提示',
  297. content: '确认对单通过吗?',
  298. centered: true,
  299. onOk () {
  300. _this.spinning = true
  301. dispatchCheck({ dispatchBillSn: row.dispatchBillSn }).then(res => {
  302. _this.$message.info(res.message)
  303. if (res.status == 200) {
  304. _this.$refs.table.refresh()
  305. }
  306. _this.spinning = false
  307. })
  308. }
  309. })
  310. },
  311. subareaChange (val) {
  312. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  313. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  314. },
  315. // 重置
  316. resetSearchForm () {
  317. this.time = [
  318. getDate.getCurrMonthDays().starttime,
  319. getDate.getCurrMonthDays().endtime
  320. ]
  321. this.$refs.rangeDate.resetDate(this.time)
  322. this.checktime = []
  323. this.$refs.checkDate.resetDate(this.checktime)
  324. this.$refs.dealerSubareaScopeList.resetForm()
  325. this.$refs.shbuyerName.resetForm()
  326. this.queryParam = {
  327. beginDate: getDate.getCurrMonthDays().starttime,
  328. endDate: getDate.getCurrMonthDays().endtime,
  329. checkBeginDate: '',
  330. checkEndDate: '',
  331. buyerSn: undefined, // 客户名称
  332. receiverSn: undefined, // 收货客户
  333. salesBillNo: '', // 销售单号
  334. dispatchBillNo: '', // 备货单号
  335. billStatus: undefined, // 业务状态
  336. subareaArea: {
  337. subareaSn: undefined,
  338. subareaAreaSn: undefined
  339. },
  340. voidFlag: undefined,
  341. shippingAddrProvinceSn: undefined,
  342. checkStatus: undefined,
  343. warehouseSn: undefined,
  344. bizUserSn: undefined
  345. }
  346. if (this.advanced) {
  347. this.$refs.subarea.clearData()
  348. }
  349. this.$refs.table.refresh(true)
  350. },
  351. pageInit () {
  352. const _this = this
  353. this.$nextTick(() => { // 页面渲染完成后的回调
  354. _this.setTableH()
  355. })
  356. },
  357. setTableH () {
  358. const tableSearchH = this.$refs.tableSearch.offsetHeight
  359. this.tableHeight = window.innerHeight - tableSearchH - 210
  360. }
  361. },
  362. watch: {
  363. advanced (newValue, oldValue) {
  364. const _this = this
  365. this.$nextTick(() => { // 页面渲染完成后的回调
  366. _this.setTableH()
  367. })
  368. },
  369. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  370. this.setTableH()
  371. }
  372. },
  373. mounted () {
  374. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  375. this.pageInit()
  376. this.resetSearchForm()
  377. }
  378. },
  379. activated () {
  380. // 如果是新页签打开,则重置当前页面
  381. if (this.$store.state.app.isNewTab) {
  382. this.pageInit()
  383. this.resetSearchForm()
  384. }
  385. // 仅刷新列表,不重置页面
  386. if (this.$store.state.app.updateList) {
  387. this.pageInit()
  388. this.$refs.table.refresh()
  389. }
  390. },
  391. beforeRouteEnter (to, from, next) {
  392. next(vm => {})
  393. }
  394. }
  395. </script>
  396. <style lang="less">
  397. .matchSoo-wrap{
  398. .sTable{
  399. margin-top: 10px;
  400. }
  401. }
  402. </style>