list.vue 27 KB

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