list.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <template>
  2. <div class="jg-page-wrap onlinePayOrderList-wrap">
  3. <a-card size="small" :bordered="false" class="table-page-search-wrapper">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch">
  6. <a-form layout="inline" @keyup.enter.native="searchForm">
  7. <a-row type="flex" justify="start" :gutter="15">
  8. <a-col :span="6">
  9. <a-form-item label="创建时间">
  10. <rangeDate
  11. id="onlinePayOrderList-creatdate"
  12. :allowClear="isByCustQuery"
  13. :hasDisabledAreaTime="false"
  14. ref="rangeDate"
  15. :value="time"
  16. @change="dateChange" />
  17. </a-form-item>
  18. </a-col>
  19. <a-col :span="6">
  20. <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}" :required="isByCustQuery">
  21. <custList id="onlinePayOrderList-custList" ref="custList" @change="custChange"></custList>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="6" :sm="24">
  25. <a-form-item label="销售单号">
  26. <a-input id="onlinePayOrderList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  27. </a-form-item>
  28. </a-col>
  29. <template v-if="advanced">
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="业务状态">
  32. <v-select
  33. v-model="queryParam.billStatus"
  34. @change="setIsHomeNav($route.name, null)"
  35. ref="billStatus"
  36. id="onlinePayOrderList-billStatus"
  37. code="SALES_BILL_STATUS"
  38. :notIn="['WAIT_SUBMIT','SUPERIOR_CHANGE']"
  39. placeholder="请选择业务状态"
  40. allowClear></v-select>
  41. </a-form-item>
  42. </a-col>
  43. <a-col :md="6" :sm="24">
  44. <a-form-item label="出库时间">
  45. <rangeDate id="onlinePayOrderList-outWareTime" ref="outWareRangeDate" v-model="outWareTime" @change="outWareDateChange" />
  46. </a-form-item>
  47. </a-col>
  48. <a-col :md="6" :sm="24">
  49. <a-form-model-item label="客户关系">
  50. <v-select code="CUSTOMER_RELATION_TYPE" id="chainTransferOutList-buyerRelationType" v-model="queryParam.buyerRelationType" allowClear placeholder="请选择客户关系"></v-select>
  51. </a-form-model-item>
  52. </a-col>
  53. <a-col :md="6" :sm="24">
  54. <a-form-item label="采购单号">
  55. <a-input id="onlinePayOrderList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  56. </a-form-item>
  57. </a-col>
  58. <a-col :md="6" :sm="24">
  59. <a-form-item label="财务状态">
  60. <v-select
  61. v-model="queryParam.financialStatus"
  62. ref="financialStatus"
  63. id="onlinePayOrderList-financialStatus"
  64. code="FINANCIAL_ONLINE_RECEIVE_STATUS"
  65. placeholder="请选择财务状态"
  66. allowClear></v-select>
  67. </a-form-item>
  68. </a-col>
  69. <a-col :md="6" :sm="24">
  70. <a-form-item label="审核时间">
  71. <rangeDate id="onlinePayOrderList-auditTime" ref="auditRangeDate" v-model="auditTime" @change="auditDateChange" />
  72. </a-form-item>
  73. </a-col>
  74. <a-col :md="6" :sm="24">
  75. <a-form-item label="取消时间">
  76. <rangeDate id="onlinePayOrderList-cancelTime" ref="cancelRangeDate" v-model="cancelTime" @change="cancelDateChange" />
  77. </a-form-item>
  78. </a-col>
  79. <a-col :md="6" :sm="24">
  80. <a-form-item label="收款方式">
  81. <v-select
  82. code="ONLINE_SETTLE_STYLE"
  83. id="onlinePayOrderList-settleStyleSn"
  84. v-model="queryParam.settleStyleSn"
  85. allowClear
  86. placeholder="请选择收款方式"
  87. ></v-select>
  88. </a-form-item>
  89. </a-col>
  90. </template>
  91. <a-col :md="6" :sm="24">
  92. <a-button id="onlinePayOrderList-search" type="primary" :disabled="disabled" @click="searchForm">查询</a-button>
  93. <a-button id="onlinePayOrderList-reset" style="margin-left: 5px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  94. <a-button
  95. type="primary"
  96. v-if="$hasPermissions('B_onlinePayExport')"
  97. class="button-warning"
  98. @click="handleExport"
  99. :disabled="disabled"
  100. :loading="exportLoading"
  101. id="onlinePayOrderList-export">导出</a-button>
  102. <a @click="advanced=!advanced" style="margin-left: 5px" id="onlinePayOrderList-advanced">
  103. {{ advanced ? '收起' : '展开' }}
  104. <a-icon :type="advanced ? 'up' : 'down'"/>
  105. </a>
  106. </a-col>
  107. <a-col :span="24" style="display:flex;align-items: center;">
  108. <div style="text-align:left;width:50%;">
  109. <a-checkbox v-model="isByCustQuery" id="sales-byCustQuery">按客户查询</a-checkbox>
  110. <a-popover placement="right">
  111. <template slot="content">
  112. 使用此查询时,时间可清空,必须选择一个客户
  113. </template>
  114. <a-icon type="question-circle" />
  115. </a-popover>
  116. <a-checkbox id="onlinePayOrderList-custQuery" style="margin-left:10px;" v-model="isAbandonOrder" @change="handleAbandonOrder">包括废弃单</a-checkbox>
  117. <a-popover placement="right">
  118. <template slot="content">
  119. 废弃单:指【已取消】和【审核不通过】状态的订单
  120. </template>
  121. <a-icon type="question-circle" />
  122. </a-popover>
  123. </div>
  124. </a-col>
  125. </a-row>
  126. </a-form>
  127. </div>
  128. </a-card>
  129. <a-card size="small" :bordered="false">
  130. <a-spin :spinning="spinning" tip="Loading...">
  131. <!-- 统计 -->
  132. <div class="table-operator" style="display:flex;align-items:center;justify-content: space-between;">
  133. <div class="alert-message">
  134. 合计:
  135. 总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
  136. 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
  137. 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  138. 总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? toThousands(totalData.totalAmount) : '--' }}</strong>;
  139. 已收款金额:<strong>{{ totalData&&(totalData.paymentAmount || totalData.paymentAmount==0) ? toThousands(totalData.paymentAmount) : '--' }}</strong>;
  140. 退款中金额:<strong>{{ totalData&&(totalData.refundingAmount || totalData.refundingAmount==0) ? toThousands(totalData.refundingAmount) : '--' }}</strong>;
  141. 已退款金额:<strong>{{ totalData&&(totalData.refundedAmount || totalData.refundedAmount==0) ? toThousands(totalData.refundedAmount) : '--' }}</strong>;
  142. </div>
  143. <div class="action-buttons">
  144. <hideCellMenus id="onlinePayOrderList-showCellMenus" placeholder="显示" :defHiddenKes="colsArr" v-model="showCell"></hideCellMenus>
  145. </div>
  146. </div>
  147. <!-- 列表 -->
  148. <s-table
  149. class="sTable fixPagination"
  150. ref="table"
  151. :style="{ height: tableHeight+64+'px' }"
  152. size="small"
  153. :rowKey="(record) => record.id"
  154. :columns="columns"
  155. :data="loadData"
  156. :scroll="{ y:tableHeight }"
  157. :defaultLoadData="false"
  158. bordered>
  159. <!-- 销售单号 -->
  160. <template slot="salesBillNo" slot-scope="text, record">
  161. <span class="table-td-link" :id="'onlinePayOrderList-detail-'+record.id" v-if="$hasPermissions('M_onlinePayOrderDetail')" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  162. <span v-else>{{ record.salesBillNo }}</span>
  163. <a-badge count="改" :number-style="{ zoom:'80%',marginLeft:'5px' }" v-if="record.billStatus=='SUPERIOR_CHANGE'"></a-badge>
  164. </template>
  165. <!-- 取消时间 -->
  166. <template slot="cancelTime" slot-scope="text, record">
  167. <span v-if="record.billStatus=='CANCEL'">{{ record.customCancelDate || '--' }}</span>
  168. <span v-else>--</span>
  169. </template>
  170. <!-- 审核icon -->
  171. <template slot="audit" slot-scope="text, record">
  172. <stateIcon :title="record.billStatusDictValue" v-if="record.billStatus!='AUDIT_REJECT'" :state="record.billStatus == 'WAIT_OUT_WAREHOUSE'||record.billStatus == 'FINISH'?'1':'2'"></stateIcon>
  173. <stateIcon :title="record.billStatusDictValue" v-else :state="0"></stateIcon>
  174. </template>
  175. <!-- 急件icon -->
  176. <template slot="oosFlag" slot-scope="text, record">
  177. <stateIcon :state="record.oosFlag==1?'1':'2'"></stateIcon>
  178. </template>
  179. <!-- 出库icon -->
  180. <template slot="waitOut" slot-scope="text, record">
  181. <stateIcon :state="record.billStatus == 'FINISH'?'1':'2'"></stateIcon>
  182. </template>
  183. <!-- 收款icon -->
  184. <template slot="financial" slot-scope="text, record">
  185. <stateIcon :title="record.financialStatusDictValue" :state="record.financialStatus == 'REFUNDED'?'3':record.financialStatus == 'FINISH'?'1':'4'"></stateIcon>
  186. </template>
  187. <!-- 操作按钮 -->
  188. <!-- billStatus WAIT_SUBMIT待提交 WAIT_AUDIT待审核 AUDIT_REJECT审核不通过 WAIT_OUT_WAREHOUSE待出库 FINISH已完结 SUPERIOR_CHANGE上级改单 CANCEL已取消 -->
  189. <template slot="action" slot-scope="text, record">
  190. <a-button
  191. :id="'onlinePayOrderList-audit-'+record.id"
  192. size="small"
  193. type="link"
  194. class="button-primary"
  195. v-if="record.billStatus == 'WAIT_AUDIT' && $hasPermissions('B_onlinePayAudit')"
  196. @click="handleEexamine(record)"
  197. >审核</a-button>
  198. <a-button
  199. :id="'onlinePayOrderList-outStock-'+record.id"
  200. size="small"
  201. type="link"
  202. v-if="record.billStatus == 'WAIT_OUT_WAREHOUSE' && $hasPermissions('B_onlinePayStockOut')"
  203. class="button-primary"
  204. @click="handleSend(record)"
  205. >出库</a-button>
  206. <span v-if="record.billStatus != 'WAIT_AUDIT' && record.billStatus != 'WAIT_OUT_WAREHOUSE'">--</span>
  207. </template>
  208. </s-table>
  209. </a-spin>
  210. <!-- 审核 -->
  211. <auditModal :openModal="visibleAudit" :spinning="spinningAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_OUT_WAREHOUSE')" @fail="auditOrder('AUDIT_REJECT')" />
  212. </a-card>
  213. </div>
  214. </template>
  215. <script>
  216. import { commonMixin } from '@/utils/mixin'
  217. import getDate from '@/libs/getDate.js'
  218. import { downloadExcel } from '@/libs/JGPrint.js'
  219. // 组件
  220. import { STable, VSelect } from '@/components'
  221. import auditModal from '@/views/common/auditModal.vue'
  222. import rangeDate from '@/views/common/rangeDate.vue'
  223. import custList from '@/views/common/custList.vue'
  224. import stateIcon from '@/views/common/stateIcon'
  225. import hideCellMenus from '@/views/common/hideCellMenus'
  226. // 接口
  227. import { salesList, salesWriteAudit, salesWriteStockOut, salesCount, salesExport } from '@/api/sales'
  228. import moment from 'moment'
  229. export default {
  230. name: 'OnlinePayOrderList',
  231. components: { STable, VSelect, rangeDate, auditModal, custList, stateIcon, hideCellMenus },
  232. mixins: [commonMixin],
  233. data () {
  234. return {
  235. spinning: false,
  236. tableHeight: 0, // 表格高度
  237. advanced: true, // 高级搜索 展开/关闭
  238. disabled: false, // 查询、重置按钮是否可操作
  239. exportLoading: false, // 导出loading
  240. isByCustQuery: false, // 是否按客户查询
  241. time: [ // 创建时间
  242. getDate.getMonthDays(3).starttime,
  243. getDate.getMonthDays(3).endtime
  244. ],
  245. auditTime: [], // 审核时间
  246. outWareTime: [], // 出库时间
  247. cancelTime: [], // 取消时间
  248. // 查询参数
  249. queryParam: {
  250. beginDate: getDate.getMonthDays(3).starttime, // 开始创建时间
  251. endDate: getDate.getMonthDays(3).endtime, // 结束创建时间
  252. auditBeginDate: '', // 开始审核时间
  253. auditEndDate: '', // 结束审核时间
  254. outWarehouseBeginDate: '', // 开始出库时间
  255. outWarehouseEndDate: '', // 结束出库时间
  256. buyerNameCurrent: undefined, // 客户名称
  257. buyerSn: undefined, // 客户sn
  258. salesBillNo: '', // 销售单号
  259. purchaseBillNo: '', // 采购单号
  260. payType: undefined, // 支付方式
  261. settleStyleSn: undefined, // 收款方式
  262. billStatus: undefined, // 业务状态
  263. financialStatus: undefined, // 财务状态
  264. buyerRelationType: undefined, // 客户关系
  265. payOnlineFlag: 1, // 线上订单
  266. cancelStartDate: undefined,
  267. cancelEndDate: undefined
  268. },
  269. totalData: { // 统计数据
  270. totalAmount: 0, // 总销价
  271. totalCategory: 0, // 总款数
  272. totalQty: 0, // 总数量
  273. totalRecord: 0 // 总条数
  274. },
  275. // 加载数据方法 必须为 Promise 对象
  276. loadData: parameter => {
  277. this.disabled = true
  278. this.spinning = true
  279. // 是否包含废弃单
  280. this.queryParam.disuseFlag = this.isAbandonOrder ? '1' : '0'
  281. // 查询总计
  282. salesCount(Object.assign(parameter, this.queryParam)).then(res => {
  283. this.totalData = res.data
  284. })
  285. // 查询列表
  286. return salesList(Object.assign(parameter, this.queryParam)).then(res => {
  287. let data
  288. if (res.status == 200) {
  289. data = res.data
  290. const no = (data.pageNo - 1) * data.pageSize
  291. for (var i = 0; i < data.list.length; i++) {
  292. data.list[i].no = no + i + 1
  293. }
  294. this.disabled = false
  295. }
  296. this.spinning = false
  297. return data
  298. })
  299. },
  300. visibleAudit: false, // 审核弹框
  301. auditInfo: null, // 审核信息
  302. spinningAudit: false, // 审核操作loading
  303. isAbandonOrder: true, // 包含废弃单
  304. colsArr: [// 需要显示的列
  305. {
  306. title: '客户关系',
  307. key: 'buyerRelationTypeDictValue',
  308. disabled: false,
  309. checked: false
  310. },
  311. {
  312. title: '取消时间',
  313. key: 'customCancelDate',
  314. disabled: false,
  315. checked: false
  316. },
  317. {
  318. title: '退款时间',
  319. key: 'refundData',
  320. disabled: false,
  321. checked: false
  322. },
  323. {
  324. title: '采购单号',
  325. key: 'purchaseBillNo',
  326. disabled: false,
  327. checked: false
  328. }
  329. ],
  330. showCell: []// 已选要显示的列
  331. }
  332. },
  333. computed: {
  334. columns () {
  335. const _this = this
  336. const arr = [
  337. { title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
  338. { title: '来源', dataIndex: 'sourceTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  339. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '6%', align: 'center' },
  340. { title: '采购单号', dataIndex: 'purchaseBillNo', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
  341. { title: '客户名称', dataIndex: 'buyerNameCurrent', align: 'center', width: '10%', customRender: function (text) { return text || '--' }, ellipsis: true },
  342. { title: '客户关系', dataIndex: 'buyerRelationTypeDictValue', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
  343. { title: '总款数', dataIndex: 'totalCategory', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  344. { title: '总数量', dataIndex: 'totalQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  345. { title: '总售价', dataIndex: 'totalAmount', align: 'right', width: '5%', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  346. { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  347. { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  348. { title: '审核时间', dataIndex: 'auditDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  349. { title: '取消时间', dataIndex: 'customCancelDate', width: '8%', align: 'center', scopedSlots: { customRender: 'cancelTime' } },
  350. { title: '退款时间', dataIndex: 'refundData', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  351. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  352. { title: '审核', scopedSlots: { customRender: 'audit' }, width: '3%', align: 'center' },
  353. { title: '急件', scopedSlots: { customRender: 'oosFlag' }, width: '3%', align: 'center' },
  354. { title: '出库', scopedSlots: { customRender: 'waitOut' }, width: '3%', align: 'center' },
  355. { title: '收款', scopedSlots: { customRender: 'financial' }, width: '3%', align: 'center' },
  356. { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
  357. ]
  358. return arr.filter(item => !this.showCell.includes(item.dataIndex))
  359. }
  360. },
  361. methods: {
  362. // 包含废弃单
  363. handleAbandonOrder () {
  364. this.$refs.table.refresh()
  365. },
  366. // 选择创建时间
  367. dateChange (date) {
  368. this.queryParam.beginDate = date[0]
  369. this.queryParam.endDate = date[1]
  370. },
  371. // 选择审核时间
  372. auditDateChange (date) {
  373. this.auditTime = date
  374. this.queryParam.auditBeginDate = date[0]
  375. this.queryParam.auditEndDate = date[1]
  376. },
  377. // 选择出库时间
  378. outWareDateChange (date) {
  379. this.outWareTime = date
  380. this.queryParam.outWarehouseBeginDate = date[0]
  381. this.queryParam.outWarehouseEndDate = date[1]
  382. },
  383. // 取消时间
  384. cancelDateChange (date) {
  385. this.cancelTime = date
  386. this.queryParam.cancelStartDate = date[0]
  387. this.queryParam.cancelEndDate = date[1]
  388. },
  389. // 选择客户
  390. custChange (v, row) {
  391. console.log(v, row)
  392. if (row && row.customerSn) {
  393. this.queryParam.buyerSn = row.customerSn
  394. this.queryParam.buyerNameCurrent = undefined
  395. } else {
  396. this.queryParam.buyerNameCurrent = v
  397. this.queryParam.buyerSn = undefined
  398. }
  399. },
  400. // 打开审核弹框
  401. handleEexamine (row) {
  402. this.auditInfo = row
  403. this.visibleAudit = true
  404. },
  405. // 提交审核
  406. auditOrder (billStatus) {
  407. this.spinningAudit = true
  408. salesWriteAudit({
  409. id: this.auditInfo.id,
  410. billStatus: billStatus
  411. }).then(res => {
  412. if (res.status == 200) {
  413. this.$message.success(res.message)
  414. this.$refs.table.refresh()
  415. this.visibleAudit = false
  416. }
  417. this.spinningAudit = false
  418. })
  419. },
  420. // 出库
  421. handleSend (row) {
  422. const _this = this
  423. this.$confirm({
  424. title: '提示',
  425. content: '确认要出库吗?',
  426. centered: true,
  427. closable: true,
  428. onOk () {
  429. _this.spinning = true
  430. salesWriteStockOut({
  431. salesBillSn: row.salesBillSn
  432. }).then(res => {
  433. if (res.status == 200) {
  434. _this.$message.success(res.message)
  435. _this.$refs.table.refresh()
  436. }
  437. _this.spinning = false
  438. })
  439. }
  440. })
  441. },
  442. // 详情
  443. handleDetail (row) {
  444. this.$router.push({ name: 'onlinePayOrderDetail', params: { sn: row.salesBillSn } })
  445. },
  446. // 选择客户成功
  447. chooseCustomOk (data) {
  448. this.$router.push({ name: 'salesNewAdd', params: { id: data.id, sn: data.salesBillSn, priceType: data.priceType } })
  449. },
  450. // 查询列表
  451. searchForm (flag) {
  452. // 是否按客户查询
  453. if (!this.isByCustQuery) {
  454. const a = moment(this.queryParam.beginDate)
  455. const b = moment(this.queryParam.endDate)
  456. // 最多只能选择2年的时间区间
  457. if (b.diff(a, 'days') > 730) {
  458. this.$message.info('最多只能选择2年的时间区间')
  459. return false
  460. }
  461. this.$refs.table.refresh(!flag)
  462. } else {
  463. // 按客户查询
  464. if (this.queryParam.buyerSn) {
  465. this.$refs.table.refresh(!flag)
  466. } else {
  467. this.$message.info('请选择客户')
  468. return false
  469. }
  470. }
  471. },
  472. // 重置
  473. resetSearchForm () {
  474. this.resetData()
  475. this.$refs.table.refresh(true)
  476. },
  477. // 重置数据
  478. resetData (flag) {
  479. this.$refs.rangeDate.resetDate(flag ? '' : this.time)
  480. this.queryParam.beginDate = flag ? '' : getDate.getMonthDays(3).starttime
  481. this.queryParam.endDate = flag ? '' : getDate.getMonthDays(3).endtime
  482. this.queryParam.auditBeginDate = ''
  483. this.queryParam.auditEndDate = ''
  484. this.queryParam.outWarehouseBeginDate = ''
  485. this.queryParam.outWarehouseEndDate = ''
  486. this.auditTime = []
  487. this.outWareTime = []
  488. this.cancelTime = []
  489. if (this.advanced) {
  490. this.$refs.auditRangeDate.resetDate('')
  491. this.$refs.outWareRangeDate.resetDate('')
  492. this.$refs.cancelRangeDate.resetDate('')
  493. }
  494. this.queryParam.buyerNameCurrent = undefined
  495. this.queryParam.buyerSn = undefined
  496. this.queryParam.salesBillNo = ''
  497. this.queryParam.purchaseBillNo = ''
  498. this.queryParam.payType = undefined
  499. this.queryParam.settleStyleSn = undefined
  500. this.queryParam.billStatus = undefined
  501. this.queryParam.financialStatus = undefined
  502. this.queryParam.buyerRelationType = undefined
  503. this.queryParam.cancelStartDate = undefined
  504. this.queryParam.cancelEndDate = undefined
  505. this.queryParam.payOnlineFlag = 1
  506. this.$refs.custList.resetForm()
  507. if (!flag) {
  508. // 重置单据状态
  509. this.setIsHomeNav(this.$route.name, null)
  510. }
  511. },
  512. // 导出
  513. handleExport () {
  514. const _this = this
  515. const params = this.queryParam
  516. params.showDiscountAmountFlag = 0
  517. this.exportLoading = true
  518. _this.spinning = true
  519. salesExport(params).then(res => {
  520. this.exportLoading = false
  521. _this.spinning = false
  522. if (res.type == 'application/json') {
  523. var reader = new FileReader()
  524. reader.addEventListener('loadend', function () {
  525. const obj = JSON.parse(reader.result)
  526. _this.$notification.error({
  527. message: '提示',
  528. description: obj.message
  529. })
  530. })
  531. reader.readAsText(res)
  532. } else {
  533. downloadExcel(res, '销售列表')
  534. }
  535. })
  536. },
  537. // 表格高度
  538. setTableH () {
  539. const tableSearchH = this.$refs.tableSearch.offsetHeight
  540. this.tableHeight = window.innerHeight - tableSearchH - 247
  541. },
  542. // 初始化页面
  543. pageInit () {
  544. const _this = this
  545. this.$nextTick(() => { // 页面渲染完成后的回调
  546. _this.setTableH()
  547. })
  548. // 是否打开的页签
  549. const a = this.$store.state.app.isNewTab
  550. // 是否要刷新列表
  551. const b = this.$store.state.app.updateList
  552. // 是否从首页点击进入
  553. const isHomeNav = this.getIsHomeNav()[this.$route.name]
  554. // 从首页进入,判断式新建还式待办查询
  555. if (isHomeNav) {
  556. // 待办
  557. if (isHomeNav.type == 'todo') {
  558. this.resetData(true)
  559. this.$refs.rangeDate.resetDate([isHomeNav.pageParams.beginDate, isHomeNav.pageParams.endDate])
  560. this.queryParam = Object.assign(this.queryParam, isHomeNav.pageParams)
  561. this.$refs.table.refresh(true)
  562. }
  563. } else {
  564. // 如果是新页签打开,则重置当前页面
  565. if (a && !b) {
  566. this.resetSearchForm()
  567. }
  568. // 仅刷新列表,不重置页面
  569. if (b || a == b) {
  570. this.$refs.table.refresh()
  571. }
  572. }
  573. }
  574. },
  575. watch: {
  576. // 展开收起查询条件
  577. advanced (newValue, oldValue) {
  578. const _this = this
  579. this.$nextTick(() => { // 页面渲染完成后的回调
  580. _this.setTableH()
  581. })
  582. },
  583. // 窗口变更时,需同时更改表格高度
  584. '$store.state.app.winHeight' (newValue, oldValue) {
  585. this.setTableH()
  586. },
  587. // 按客户查询复选框变更
  588. isByCustQuery (newValue, oldValue) {
  589. if (!newValue) {
  590. this.resetSearchForm()
  591. }
  592. }
  593. },
  594. activated () {
  595. this.pageInit()
  596. },
  597. beforeRouteEnter (to, from, next) {
  598. next(vm => {
  599. })
  600. }
  601. }
  602. </script>