list.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="salesManagementList-wrap">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper" style="margin: 0;">
  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="客户名称">
  15. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="salesManagementList-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="salesManagementList-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="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
  26. </a-form-item>
  27. </a-col>
  28. <template v-if="advanced">
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="备货打印状态">
  31. <v-select
  32. v-model="queryParam.printStatus"
  33. ref="printStatus"
  34. id="salesManagementList-printStatus"
  35. code="PRINT_STATUS"
  36. placeholder="请选择打印状态"
  37. allowClear></v-select>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="业务状态">
  42. <v-select
  43. v-model="queryParam.billStatus"
  44. ref="billStatus"
  45. id="salesManagementList-billStatus"
  46. code="SALES_BILL_STATUS"
  47. placeholder="请选择业务状态"
  48. allowClear></v-select>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :md="6" :sm="24">
  52. <a-form-item label="财务状态">
  53. <v-select
  54. v-model="queryParam.financialStatus"
  55. ref="financialStatus"
  56. id="salesManagementList-financialStatus"
  57. code="FINANCIAL_RECEIVE_STATUS"
  58. placeholder="请选择财务状态"
  59. allowClear></v-select>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :md="6" :sm="24">
  63. <a-form-item label="单据来源">
  64. <v-select
  65. v-model="queryParam.salesBillSource"
  66. ref="salesBillSource"
  67. id="salesManagementList-salesBillSource"
  68. code="SALES_SOURCE"
  69. placeholder="请选择单据来源"
  70. allowClear></v-select>
  71. </a-form-item>
  72. </a-col>
  73. <a-col :md="6" :sm="24">
  74. <a-form-model-item label="所在区域">
  75. <subarea ref="subarea" id="salesManagementList-subarea" @change="subareaChange"></subarea>
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :md="6" :sm="24">
  79. <a-form-model-item label="地区" prop="shippingAddrProvinceSn">
  80. <Area id="salesManagementList-shippingAddrProvinceSn" v-model="queryParam.shippingAddrProvinceSn" placeholder="请选择省"></Area>
  81. </a-form-model-item>
  82. </a-col>
  83. <a-col :md="6" :sm="24">
  84. <a-form-model-item label="出库仓库">
  85. <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
  86. </a-form-model-item>
  87. </a-col>
  88. <a-col :md="6" :sm="24">
  89. <a-form-item label="促销单">
  90. <v-select
  91. v-model="queryParam.cxFlag"
  92. ref="cxFlag"
  93. code="FLAG"
  94. placeholder="请选择是否促销单"
  95. allowClear></v-select>
  96. </a-form-item>
  97. </a-col>
  98. </template>
  99. <a-col :md="24" :sm="24" style="text-align: center;">
  100. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  101. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  102. <a-button
  103. style="margin-left: 10px"
  104. type="primary"
  105. class="button-warning"
  106. @click="handleExport"
  107. :disabled="disabled"
  108. :loading="exportLoading"
  109. v-if="$hasPermissions('B_sales_export')"
  110. >导出</a-button>
  111. <a @click="advanced=!advanced" style="margin-left: 8px">
  112. {{ advanced ? '收起' : '展开' }}
  113. <a-icon :type="advanced ? 'up' : 'down'"/>
  114. </a>
  115. </a-col>
  116. </a-row>
  117. </a-form>
  118. </div>
  119. </a-card>
  120. <a-card size="small" :bordered="false" class="salesManagementList-wrap">
  121. <a-spin :spinning="spinning" tip="Loading...">
  122. <!-- 操作按钮 -->
  123. <div class="table-operator" style="display: flex;justify-content: space-between;align-items: center;">
  124. <div style="padding-right: 15px;"><a-button type="primary" class="button-error" v-if="$hasPermissions('B_salesAdd')" @click="handleAdd">新增</a-button></div>
  125. <div style="flex-grow: 1;display: flex;justify-content: space-between;align-items: center;">
  126. <div>
  127. <div>
  128. 总单数:<strong>{{ totalData&&(totalData.totalRecord || totalData.totalRecord==0) ? totalData.totalRecord : '--' }}</strong>;
  129. 总款数:<strong>{{ totalData&&(totalData.totalCategory || totalData.totalCategory==0) ? totalData.totalCategory : '--' }}</strong>;
  130. 总数量:<strong>{{ totalData&&(totalData.totalQty || totalData.totalQty==0) ? totalData.totalQty : '--' }}</strong>;
  131. 已下推数量:<strong>{{ totalData&&(totalData.totalPushedQty || totalData.totalPushedQty==0) ? totalData.totalPushedQty : '--' }}</strong>;
  132. 已发货数量:<strong>{{ totalData&&(totalData.totalDispatchQty || totalData.totalDispatchQty==0) ? totalData.totalDispatchQty : '--' }}</strong>;
  133. 已取消数量:<strong>{{ totalData&&(totalData.totalCancelQty || totalData.totalCancelQty==0) ? totalData.totalCancelQty : '--' }}</strong>;
  134. 待下推数量:<strong>{{ totalData&&(totalData.totalUnpushedQty || totalData.totalUnpushedQty==0) ? totalData.totalUnpushedQty : '--' }}</strong>;
  135. </div>
  136. <div v-if="$hasPermissions('M_salesQueryList_salesPrice')">
  137. 总售价:<strong>{{ totalData&&(totalData.totalAmount || totalData.totalAmount==0) ? toThousands(totalData.totalAmount) : '--' }}</strong>;
  138. 已下推金额:<strong>{{ totalData&&(totalData.totalPushedAmount || totalData.totalPushedAmount==0) ? toThousands(totalData.totalPushedAmount) : '--' }}</strong>;
  139. 已取消金额:<strong>{{ totalData&&(totalData.totalCancelAmount || totalData.totalCancelAmount==0) ? toThousands(totalData.totalCancelAmount) : '--' }}</strong>;
  140. 待下推金额:<strong>{{ totalData&&(totalData.totalUnpushedAmount || totalData.totalUnpushedAmount==0) ? toThousands(totalData.totalUnpushedAmount) : '--' }}</strong>;
  141. 已发货金额:<strong>{{ totalData&&(totalData.totalDispatchAmount || totalData.totalDispatchAmount==0) ? toThousands(totalData.totalDispatchAmount) : '--' }}</strong>;
  142. </div>
  143. </div>
  144. <div>
  145. <a-checkbox v-model="showCancelNum"><span style="display: inline-block;margin-top: 1px;">显示促销单</span></a-checkbox>
  146. <a-checkbox v-model="showCancelNum"><span style="display: inline-block;margin-top: 1px;">显示取消数量</span></a-checkbox>
  147. </div>
  148. </div>
  149. </div>
  150. <!-- 列表 -->
  151. <s-table
  152. class="sTable fixPagination"
  153. ref="table"
  154. :style="{ height: tableHeight+75+'px' }"
  155. size="small"
  156. :rowKey="(record) => record.id"
  157. :columns="columns"
  158. :data="loadData"
  159. :scroll="{ y: tableHeight }"
  160. :defaultLoadData="false"
  161. bordered>
  162. <!-- 销售单号 -->
  163. <template slot="salesBillNo" slot-scope="text, record">
  164. <div v-if="$hasPermissions('B_salesDetail')">
  165. <a-badge :count="'改'+record.changeTimes" :offset="[16,-13]" v-if="record.changeTimes>0" class="badge-con-t">
  166. <span class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  167. </a-badge>
  168. <span v-else class="link-bule" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
  169. </div>
  170. <div v-else>{{ record.salesBillNo }}</div>
  171. </template>
  172. <!-- 出库仓库 -->
  173. <template slot="warehouseBox" slot-scope="text, record">
  174. <a-tooltip placement="right" v-if="record.warehouseNameSet && record.warehouseNameSet.length>0">
  175. <template slot="title">
  176. <span>{{ record.warehouseNameSet.toString() }}</span>
  177. </template>
  178. <div class="warehouse_box">
  179. <span>{{ record.warehouseNameSet.toString() }}</span>
  180. </div>
  181. </a-tooltip>
  182. <div v-else>--</div>
  183. </template>
  184. <!-- 总数量 -->
  185. <template slot="totalQty" slot-scope="text, record">
  186. {{ record.totalQty }}
  187. </template>
  188. <!-- 操作 -->
  189. <template slot="action" slot-scope="text, record">
  190. <div>
  191. <a-button
  192. size="small"
  193. type="link"
  194. class="button-warning"
  195. v-if="record.billStatus == 'WAIT_AUDIT'&&$hasPermissions('B_salesAudit')"
  196. @click="handleDetailAudit(record)"
  197. >审核</a-button>
  198. <a-button
  199. size="small"
  200. type="link"
  201. class="button-warning"
  202. v-if="record.billStatus == 'WAIT_PUSH'&&$hasPermissions('B_salesDispatch')"
  203. @click="handleDispatch(record)"
  204. >下推</a-button>
  205. <a-button
  206. size="small"
  207. type="link"
  208. class="button-info"
  209. v-if="(record.salesBillSource == 'SALES' && (record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'AUDIT_REJECT' || record.billStatus == 'HQ_CHANGE'))&&$hasPermissions('B_salesEdit')"
  210. @click="handleEdit(record)"
  211. >
  212. 编辑
  213. </a-button>
  214. <a-button
  215. size="small"
  216. type="link"
  217. class="button-info"
  218. v-if="record.salesBillSource == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'HQ_CHANGE') && $hasPermissions('B_salesEdit')"
  219. @click="handleEdit(record)"
  220. >
  221. 改单
  222. </a-button>
  223. <a-button
  224. size="small"
  225. type="link"
  226. class="button-error"
  227. v-if="(record.salesBillSource == 'SALES' && (record.billStatus == 'WAIT_SUBMIT' || record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'AUDIT_REJECT' || record.billStatus == 'HQ_CHANGE'))&&$hasPermissions('B_salesDel')"
  228. @click="handleDel(record)"
  229. >
  230. 删除
  231. </a-button>
  232. <a-button
  233. size="small"
  234. type="link"
  235. class="button-error"
  236. v-if="record.salesBillSource == 'PURCHASE' && (record.billStatus == 'WAIT_AUDIT' || record.billStatus == 'HQ_CHANGE') && $hasPermissions('B_salesDel')"
  237. @click="handleDel(record)"
  238. >
  239. 取消
  240. </a-button>
  241. <a-button
  242. size="small"
  243. type="link"
  244. class="button-warning"
  245. v-if="record.printStatus=='UNABLE_PRINT'&&$hasPermissions('B_Sales_UNABLE_PRINT')"
  246. @click="handlePrint(record)"
  247. >允许备货打印</a-button>
  248. <a-button
  249. size="small"
  250. type="link"
  251. class="button-warning"
  252. v-if="record.billStatus=='FINISH'"
  253. @click="handleToExpense(record)"
  254. >转费用报销单</a-button>
  255. </div>
  256. </template>
  257. </s-table>
  258. </a-spin>
  259. <!-- 选择客户弹框 -->
  260. <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
  261. <!-- 操作提示 -->
  262. <commonModal modalTit="操作提示" :width="this.tipData&&this.tipData.length == 1?'500px':'800px'" :openModal="showTipModal" @cancel="canselModal" @ok="updatePrintStatus">
  263. <div style="text-align: center;" v-if="this.tipData&&this.tipData.length">
  264. <div style="margin-bottom: 15px;font-size: 14px;"><strong>确认允许此单进行备货打印吗?</strong></div>
  265. <div style="line-height: 24px;" v-if="this.tipData.length == 1">
  266. <div>备货单号:{{ tipData[0]&&tipData[0].dispatchBillNo }}</div>
  267. <div>客户名称:{{ tipData[0]&&tipData[0].buyerName }}</div>
  268. </div>
  269. <div v-else>
  270. <a-table
  271. :row-selection="{ selectedRowKeys: selectedRowKeys,onChange: onSelectChange, getCheckboxProps: record => ({ props: { disabled: record.printStatus!=='UNABLE_PRINT' }})}"
  272. :columns="bhColumns"
  273. :data-source="tipData"
  274. :pagination="false"
  275. />
  276. </div>
  277. </div>
  278. </commonModal>
  279. <!-- 导出提示框 -->
  280. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  281. </a-card>
  282. </div>
  283. </template>
  284. <script>
  285. import { commonMixin } from '@/utils/mixin'
  286. import moment from 'moment'
  287. import getDate from '@/libs/getDate.js'
  288. import subarea from '@/views/common/subarea.js'
  289. import Area from '@/views/common/area.js'
  290. import rangeDate from '@/views/common/rangeDate.vue'
  291. import { STable, VSelect } from '@/components'
  292. import commonModal from '@/views/common/commonModal.vue'
  293. import chooseCustomModal from './chooseCustomModal.vue'
  294. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  295. import reportModal from '@/views/common/reportModal.vue'
  296. import { salesList, salesDel, salesCount } from '@/api/sales'
  297. import { hdExportExcel } from '@/libs/exportExcel'
  298. import chooseWarehouse from '@/views/common/chooseWarehouse'
  299. import { findBySalesBillSn, dispatchBatchPrintStatus, queryBySalesBillSn } from '@/api/dispatch'
  300. import { salesDetailExport } from '@/api/salesBillReport'
  301. export default {
  302. name: 'SalesQueryList',
  303. mixins: [commonMixin],
  304. components: { STable, VSelect, chooseCustomModal, dealerSubareaScopeList, Area, rangeDate, subarea, commonModal, reportModal, chooseWarehouse },
  305. data () {
  306. return {
  307. spinning: false,
  308. advanced: true, // 高级搜索 展开/关闭
  309. disabled: false, // 查询、重置按钮是否可操作
  310. openModal: false, // 选择客户弹框是否显示
  311. showTipModal: false, // 备货打印弹框
  312. showExport: false,
  313. exportLoading: false,
  314. expenseOption: false,
  315. tableHeight: 0,
  316. time: [
  317. moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
  318. moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
  319. ],
  320. // 查询参数
  321. queryParam: {
  322. beginDate: getDate.getThreeMonthDays().starttime,
  323. endDate: getDate.getCurrMonthDays().endtime,
  324. buyerSn: undefined, // 客户名称
  325. salesBillNo: '', // 销售单号
  326. purchaseBillNo: '',
  327. printStatus: undefined,
  328. billStatus: undefined, // 业务状态
  329. financialStatus: undefined, // 财务状态
  330. salesBillSource: undefined,
  331. subareaArea: {
  332. subareaSn: undefined,
  333. subareaAreaSn: undefined
  334. },
  335. shippingAddrProvinceSn: undefined,
  336. warehouseSn: undefined
  337. },
  338. totalData: {
  339. totalAmount: 0,
  340. totalCategory: 0,
  341. totalQty: 0,
  342. totalRecord: 0,
  343. totalPushedQty: 0,
  344. totalDispatchQty: 0,
  345. totalCancelQty: 0,
  346. totalUnpushedQty: 0,
  347. totalPushedAmount: 0,
  348. totalCancelAmount: 0,
  349. totalUnpushedAmount: 0,
  350. totalDispatchAmount: 0
  351. },
  352. // 加载数据方法 必须为 Promise 对象
  353. loadData: parameter => {
  354. this.disabled = true
  355. this.spinning = true
  356. delete parameter.tableId
  357. delete parameter.index
  358. // 查询总计
  359. salesCount(Object.assign(parameter, this.queryParam)).then(res => {
  360. this.totalData = Object.assign(this.totalData, res.data || {})
  361. })
  362. return salesList(Object.assign(parameter, this.queryParam)).then(res => {
  363. let data
  364. if (res.status == 200) {
  365. data = res.data
  366. const no = (data.pageNo - 1) * data.pageSize
  367. for (var i = 0; i < data.list.length; i++) {
  368. data.list[i].no = no + i + 1
  369. }
  370. this.disabled = false
  371. }
  372. this.spinning = false
  373. return data
  374. })
  375. },
  376. showCancelNum: false, // 是否显示取消数量和待下推数量
  377. tipData: null, // 备货单信息
  378. tempSalesBillSn: null,
  379. // 允许备货打印
  380. selectedRowKeys: [],
  381. bhColumns: [
  382. {
  383. title: '备货单号',
  384. dataIndex: 'dispatchBillNo'
  385. },
  386. {
  387. title: '客户名称',
  388. dataIndex: 'buyerName'
  389. },
  390. {
  391. title: '备货打印状态',
  392. dataIndex: 'printStatusDictValue'
  393. }
  394. ]
  395. }
  396. },
  397. computed: {
  398. columns () {
  399. const _this = this
  400. const arr = [
  401. { title: '创建时间', dataIndex: 'createDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  402. { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '7%', align: 'center' },
  403. { title: '提交时间', dataIndex: 'submitDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  404. { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  405. { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'center', ellipsis: true },
  406. { title: '总数量', dataIndex: 'totalQty', scopedSlots: { customRender: 'totalQty' }, width: '4%', align: 'center' },
  407. { title: '已下推数量', dataIndex: 'totalPushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  408. { title: '已发货数量', dataIndex: 'totalDispatchQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  409. { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  410. { title: '审核时间', dataIndex: 'auditDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  411. { title: '最近备货时间', dataIndex: 'lastStockUpDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
  412. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  413. { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  414. { title: '备货打印状态', dataIndex: 'printStatusDictValue', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  415. { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
  416. ]
  417. if (this.$hasPermissions('M_salesQueryList_salesPrice')) { // 售价权限
  418. arr.splice(6, 0, { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  419. arr.splice(8, 0, { title: '下推总金额', dataIndex: 'totalPushedAmount', width: '4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  420. }
  421. if (this.showCancelNum) {
  422. const ind = this.$hasPermissions('M_salesQueryList_salesPrice') ? 10 : 8
  423. arr.splice(ind, 0, { title: '已取消数量', dataIndex: 'totalCancelQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  424. arr.splice(ind + 1, 0, { title: '待下推数量', dataIndex: 'totalUnpushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  425. }
  426. return arr
  427. }
  428. },
  429. methods: {
  430. // 导出
  431. handleExport () {
  432. const _this = this
  433. _this.$store.state.app.curActionPermission = 'B_sales_export'
  434. _this.exportLoading = true
  435. _this.spinning = true
  436. hdExportExcel(salesDetailExport, _this.queryParam, '销售明细', function () {
  437. _this.exportLoading = false
  438. _this.spinning = false
  439. _this.showExport = true
  440. _this.$store.state.app.curActionPermission = ''
  441. })
  442. },
  443. // 时间 change
  444. dateChange (date) {
  445. this.queryParam.beginDate = date[0]
  446. this.queryParam.endDate = date[1]
  447. },
  448. custChange (val) {
  449. this.queryParam.buyerSn = val.key
  450. },
  451. subareaChange (val) {
  452. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  453. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  454. },
  455. // 新增
  456. handleAdd () {
  457. this.openModal = true
  458. },
  459. // 选择客户成功
  460. chooseCustomOk (data) {
  461. this.$router.push({ name: 'salesNewAdd', params: { sn: data.salesBillSn } })
  462. },
  463. // 下推
  464. handleDispatch (row) {
  465. this.spinning = true
  466. findBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => {
  467. this.spinning = false
  468. if (res.status == 200) {
  469. this.$router.push({ name: 'waitDispatchNew', params: { salesBillSn: row.salesBillSn } })
  470. }
  471. })
  472. },
  473. // 详情
  474. handleDetail (row) {
  475. this.$router.push({ name: 'salesNewDetail', params: { sn: row.salesBillSn } })
  476. },
  477. // 审核
  478. handleDetailAudit (row) {
  479. this.$router.push({ name: 'salesNewDetailAudit', params: { sn: row.salesBillSn } })
  480. },
  481. // 编辑
  482. handleEdit (row) {
  483. this.$router.push({ name: 'salesNewEdit', params: { sn: row.salesBillSn } })
  484. },
  485. // 删除
  486. handleDel (row) {
  487. const _this = this
  488. this.$confirm({
  489. title: '提示',
  490. content: row.salesBillSource == 'PURCHASE' ? '确认要取消吗?' : '确认要删除吗?',
  491. centered: true,
  492. closable: true,
  493. onOk () {
  494. _this.spinning = true
  495. salesDel({ salesBillSn: row.salesBillSn }).then(res => {
  496. if (res.status == 200) {
  497. _this.$message.success(res.message)
  498. _this.$refs.table.refresh()
  499. _this.spinning = false
  500. } else {
  501. _this.spinning = false
  502. }
  503. })
  504. }
  505. })
  506. },
  507. // 转费用单
  508. handleToExpense(){
  509. const _this = this
  510. this.$confirm({
  511. title: '转费用报销单?',
  512. centered: true,
  513. class:'confirm-center',
  514. content: <div>
  515. <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
  516. <div style="padding:0 0 10px 0;text-align:center;">
  517. <aRadioGroup onChange={_this.changeDaOpt}>
  518. <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="1">
  519. 采购额结余
  520. </aRadio>
  521. <aRadio style="height: '30px';lineHeight: '30px';padding:5px 0;" value="2">
  522. 采购额超出
  523. </aRadio>
  524. </aRadioGroup>
  525. </div>
  526. </div>,
  527. onOk() {
  528. if(_this.expenseOption){
  529. _this.expenseOption = null
  530. }else{
  531. _this.$message.info("请选择费用报销单类型!")
  532. return true
  533. }
  534. },
  535. onCancel() {
  536. _this.expenseOption = null
  537. },
  538. });
  539. },
  540. changeDaOpt(e){
  541. this.expenseOption = e.target.value
  542. },
  543. // 允许备货打印
  544. handlePrint (row) {
  545. // 获取关联的下推单
  546. this.tempSalesBillSn = row.salesBillSn
  547. queryBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => {
  548. this.tipData = res.data || []
  549. this.tipData.map(item => {
  550. item.key = item.dispatchBillSn
  551. if (item.printStatus == 'UNABLE_PRINT') {
  552. this.selectedRowKeys.push(item.dispatchBillSn)
  553. }
  554. })
  555. this.showTipModal = true
  556. })
  557. },
  558. canselModal () {
  559. this.tipData = null
  560. this.showTipModal = false
  561. this.tempSalesBillSn = null
  562. this.selectedRowKeys = []
  563. },
  564. onSelectChange (selectedRowKeys) {
  565. this.selectedRowKeys = selectedRowKeys
  566. },
  567. // 允许备货打印状态
  568. updatePrintStatus () {
  569. const isOne = this.tipData.length
  570. if (isOne > 1 && this.selectedRowKeys.length == 0) {
  571. this.$message.info('请选择备货单!')
  572. return
  573. }
  574. const dispatchBillSnList = []
  575. this.tipData.map(item => {
  576. dispatchBillSnList.push(item.dispatchBillSn)
  577. })
  578. const params = {
  579. 'salesBillSn': this.tempSalesBillSn,
  580. 'dispatchBillSnList': isOne > 1 ? this.selectedRowKeys : dispatchBillSnList,
  581. 'printStatus': 'NO_PRINT'
  582. }
  583. dispatchBatchPrintStatus(params).then(res => {
  584. if (res.status == 200) {
  585. this.canselModal()
  586. this.$message.info(res.message)
  587. this.$refs.table.refresh()
  588. }
  589. })
  590. },
  591. // 重置
  592. resetSearchForm () {
  593. this.$refs.rangeDate.resetDate(this.time)
  594. this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
  595. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  596. this.$refs.dealerSubareaScopeList.resetForm()
  597. this.queryParam.buyerSn = undefined
  598. this.queryParam.salesBillNo = ''
  599. this.queryParam.purchaseBillNo = ''
  600. this.queryParam.printStatus = undefined
  601. this.queryParam.billStatus = undefined
  602. this.queryParam.financialStatus = undefined
  603. this.queryParam.salesBillSource = undefined
  604. this.queryParam.subareaArea.subareaSn = undefined
  605. this.queryParam.subareaArea.subareaAreaSn = undefined
  606. this.queryParam.shippingAddrProvinceSn = undefined
  607. this.queryParam.warehouseSn = undefined
  608. if (this.advanced) {
  609. this.$refs.subarea.clearData()
  610. }
  611. this.$refs.table.refresh(true)
  612. },
  613. pageInit () {
  614. const _this = this
  615. this.$nextTick(() => { // 页面渲染完成后的回调
  616. _this.setTableH()
  617. })
  618. },
  619. setTableH () {
  620. const tableSearchH = this.$refs.tableSearch.offsetHeight
  621. this.tableHeight = window.innerHeight - tableSearchH - 265
  622. }
  623. },
  624. watch: {
  625. advanced (newValue, oldValue) {
  626. const _this = this
  627. this.$nextTick(() => { // 页面渲染完成后的回调
  628. _this.setTableH()
  629. })
  630. },
  631. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  632. console.log(newValue)
  633. this.setTableH()
  634. }
  635. },
  636. mounted () {
  637. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  638. this.pageInit()
  639. this.resetSearchForm()
  640. }
  641. },
  642. activated () {
  643. // 如果是新页签打开,则重置当前页面
  644. if (this.$store.state.app.isNewTab) {
  645. this.pageInit()
  646. this.resetSearchForm()
  647. }
  648. // 仅刷新列表,不重置页面
  649. if (this.$store.state.app.updateList) {
  650. this.pageInit()
  651. this.$refs.table.refresh()
  652. }
  653. },
  654. beforeRouteEnter (to, from, next) {
  655. next(vm => {})
  656. }
  657. }
  658. </script>
  659. <style lang="less" scoped>
  660. .salesManagementList-wrap{
  661. margin-bottom: 6px;
  662. .sTable{
  663. .badge-con-t{
  664. .ant-badge-count{
  665. transform: scale(0.8);
  666. font-size: 13px;
  667. }
  668. }
  669. .warehouse_box{
  670. width: 100%;
  671. overflow: hidden;
  672. white-space: nowrap;
  673. text-overflow: ellipsis;
  674. }
  675. // .warehouse_box>span::after{
  676. // content:',';
  677. // }
  678. // .warehouse_box>span:last-child::after{
  679. // content:'';
  680. // }
  681. }
  682. }
  683. </style>