list.vue 34 KB

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