list.vue 27 KB

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