list.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="salesDetailsList-wrap searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper" ref="tableSearch">
  6. <a-form-model
  7. id="salesSlipReportList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :model="queryParam"
  12. :rules="rules"
  13. @keyup.enter.native="handleSearch">
  14. <a-row :gutter="15">
  15. <a-col :md="6" :sm="24">
  16. <a-form-model-item label="下推时间" prop="time">
  17. <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :md="6" :sm="24">
  21. <a-form-model-item label="销售单号">
  22. <a-input id="salesDetailsList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-model-item label="备货单号">
  27. <a-input id="salesDetailsList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :md="6" :sm="24">
  31. <a-form-model-item label="产品编码">
  32. <a-input id="salesDetailsList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
  33. </a-form-model-item>
  34. </a-col>
  35. <a-col :md="6" :sm="24">
  36. <a-form-model-item label="产品名称">
  37. <a-input id="salesDetailsList-productName" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
  38. </a-form-model-item>
  39. </a-col>
  40. <a-col :md="6" :sm="24">
  41. <a-form-model-item label="客户名称">
  42. <a-input id="salesDetailsList-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客户名称"/>
  43. </a-form-model-item>
  44. </a-col>
  45. <a-col :md="6" :sm="24">
  46. <a-form-model-item label="客户级别">
  47. <v-select
  48. v-model="queryParam.dealerLevel"
  49. ref="dealerLevel"
  50. id="salesDetailsList-dealerLevel"
  51. code="DEALER_LEVEL"
  52. placeholder="请选择客户级别"
  53. allowClear></v-select>
  54. </a-form-model-item>
  55. </a-col>
  56. <template v-if="advanced">
  57. <a-col :md="6" :sm="24" v-if="!isShowCustomerSearch">
  58. <a-form-model-item label="品牌分类">
  59. <v-select code="BRAND_TYPE" id="salesDetailsList-productBrandTypeSn" v-model="queryParam.productBrandTypeSn" allowClear placeholder="请选择品牌分类"></v-select>
  60. </a-form-model-item>
  61. </a-col>
  62. <a-col :md="6" :sm="24">
  63. <a-form-model-item label="产品品牌">
  64. <ProductBrand id="salesDetailsList-productBrandSn" :brandType="queryParam.productBrandTypeSn" v-model="queryParam.productBrandSn"></ProductBrand>
  65. </a-form-model-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-model-item label="产品分类">
  69. <ProductType id="salesDetailsList-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
  70. </a-form-model-item>
  71. </a-col>
  72. <a-col :md="6" :sm="24">
  73. <a-form-model-item label="出库仓库">
  74. <chooseWarehouse ref="warehouse" isPermission v-model="queryParam.warehouseSn"></chooseWarehouse>
  75. </a-form-model-item>
  76. </a-col>
  77. <a-col :md="6" :sm="24">
  78. <a-form-model-item label="所在区域">
  79. <subarea id="salesDetailsList-subareaSn" ref="subarea" @change="subareaChange"></subarea>
  80. </a-form-model-item>
  81. </a-col>
  82. <a-col :md="6" :sm="24">
  83. <a-form-model-item label="区域负责人">
  84. <BizUser v-model="queryParam.subareaArea.bizUserSn"></BizUser>
  85. </a-form-model-item>
  86. </a-col>
  87. <a-col :md="6" :sm="24">
  88. <a-form-model-item label="地区">
  89. <AreaList id="salesDetailsList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  90. </a-form-model-item>
  91. </a-col>
  92. <a-col :md="6" :sm="24">
  93. <a-form-model-item label="促销产品">
  94. <a-select v-model="queryParam.giftFLag" placeholder="请选择促销产品" allowClear>
  95. <a-select-option value="1">
  96. </a-select-option>
  97. <a-select-option value="0">
  98. </a-select-option>
  99. </a-select>
  100. </a-form-model-item>
  101. </a-col>
  102. <a-col :md="6" :sm="24">
  103. <a-form-model-item label="产品类型" prop="promotionFlag">
  104. <a-select allowClear v-model.trim="queryParam.promotionFlag" :dropdownMatchSelectWidth="false" placeholder="请选择产品类型">
  105. <a-select-option value="0">
  106. 正常产品
  107. </a-select-option>
  108. <a-select-option value="REGULAR">
  109. 正价产品(活动)
  110. </a-select-option>
  111. <a-select-option value="DISCOUNT">
  112. 特价产品
  113. </a-select-option>
  114. <a-select-option value="GIFT">
  115. 促销产品
  116. </a-select-option>
  117. <a-select-option value="GATE">
  118. 门槛产品
  119. </a-select-option>
  120. </a-select>
  121. </a-form-model-item>
  122. </a-col>
  123. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  124. <a-form-item label="客服">
  125. <customerService ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  126. </a-form-item>
  127. </a-col>
  128. </template>
  129. <a-col :md="isShowCustomerSearch?24:6" :sm="24" style="margin-bottom: 10px;" :style="{textAlign: isShowCustomerSearch?'center':''}">
  130. <a-button style="margin-left: 5px" type="primary" @click="handleSearch" :disabled="disabled" id="salesDetailsList-refresh">查询</a-button>
  131. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesDetailsList-reset">重置</a-button>
  132. <a-button
  133. style="margin-left: 5px"
  134. type="primary"
  135. class="button-warning"
  136. @click="handleExport"
  137. :disabled="disabled"
  138. :loading="exportLoading"
  139. v-if="$hasPermissions('B_salesDetailsExport')"
  140. id="salesDetailsList-export">导出</a-button>
  141. <a @click="advanced=!advanced" style="margin-left: 5px">
  142. {{ advanced ? '收起' : '展开' }}
  143. <a-icon :type="advanced ? 'up' : 'down'"/>
  144. </a>
  145. </a-col>
  146. </a-row>
  147. </a-form-model>
  148. </div>
  149. </a-card>
  150. <a-card size="small" :bordered="false">
  151. <a-spin :spinning="spinning" tip="Loading...">
  152. <!-- 列表 -->
  153. <s-table
  154. class="sTable fixPagination"
  155. ref="table"
  156. size="small"
  157. :rowKey="(record) => record.no"
  158. rowKeyName="no"
  159. :columns="columns"
  160. :data="loadData"
  161. :pageSize="30"
  162. :style="{ height: tableHeight+84.5+'px' }"
  163. :scroll="{ x: 2480 , y: tableHeight - 30 }"
  164. :defaultLoadData="false"
  165. bordered>
  166. <!-- 产品编码 -->
  167. <template slot="productCode" slot-scope="text, record">
  168. <span style="padding-right: 15px;">{{ text }}</span>
  169. <a-badge count="促" v-if="record.promotionFlag=='GIFT'" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
  170. <a-badge count="特" v-if="record.promotionFlag=='DISCOUNT'" :number-style="{ backgroundColor: '#faad14', zoom:'80%' }"></a-badge>
  171. <a-badge count="槛" v-if="record.promotionFlag=='GATE'" :number-style="{ backgroundColor: '#108ee9', zoom:'80%' }"></a-badge>
  172. </template>
  173. <template slot="footer">
  174. <a-row :gutter="15">
  175. <a-col :md="4" :sm="24">下推数量:{{ (totalData && (totalData.qty || totalData.qty==0)) ? totalData.qty : '--' }}</a-col>
  176. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">实售金额:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? toThousands(totalData.totalRealAmount) : '--' }}</a-col>
  177. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">开单金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
  178. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_costPrice')">成本金额:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? toThousands(totalData.totalCost) : '--' }}</a-col>
  179. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">优惠金额:{{ (totalData && (totalData.discountAmount || totalData.discountAmount==0)) ? toThousands(totalData.discountAmount) : '--' }}</a-col>
  180. <!-- <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">折后金额:{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? toThousands(totalData.discountedAmount) : '--' }}</a-col>
  181. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">折扣金额:{{ (totalData && (totalData.discountAmount || totalData.discountAmount==0)) ? toThousands(totalData.discountAmount) : '--' }}</a-col> -->
  182. </a-row>
  183. </template>
  184. </s-table>
  185. </a-spin>
  186. <!-- 导出提示框 -->
  187. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  188. </a-card>
  189. </div>
  190. </template>
  191. <script>
  192. import { commonMixin } from '@/utils/mixin'
  193. import getDate from '@/libs/getDate.js'
  194. import { STable, VSelect } from '@/components'
  195. import rangeDate from '@/views/common/rangeDate.vue'
  196. import subarea from '@/views/common/subarea.js'
  197. import custList from '@/views/common/custList.vue'
  198. import reportModal from '@/views/common/reportModal.vue'
  199. import AreaList from '@/views/common/areaList.js'
  200. import ProductBrand from '@/views/common/productBrand.js'
  201. import ProductType from '@/views/common/productType.js'
  202. import chooseWarehouse from '@/views/common/chooseWarehouse'
  203. import customerService from '@/views/common/customerService'
  204. import BizUser from '@/views/common/bizUser.js'
  205. import { hdExportExcel } from '@/libs/exportExcel'
  206. import { reportSalesBillDetailList, reportSalesBillDetailCount, reportSalesBillDetailExport } from '@/api/reportData'
  207. export default {
  208. name: 'SalesDetailsList',
  209. mixins: [commonMixin],
  210. components: { STable, VSelect, rangeDate, custList, subarea, ProductBrand, ProductType, reportModal, AreaList, chooseWarehouse, BizUser, customerService },
  211. data () {
  212. return {
  213. spinning: false,
  214. advanced: false, // 高级搜索 展开/关闭
  215. tableHeight: 0,
  216. showExport: false,
  217. queryParam: { // 查询条件
  218. time: [
  219. getDate.getCurrMonthDays().starttime,
  220. getDate.getCurrMonthDays().endtime
  221. ],
  222. beginDate: getDate.getCurrMonthDays().starttime,
  223. endDate: getDate.getCurrMonthDays().endtime,
  224. salesBillNo: '',
  225. dispatchBillNo: '', // 备货单号
  226. productCode: '',
  227. productName: '',
  228. dealerName: '',
  229. dealerLevel: undefined,
  230. productBrandTypeSn: undefined,
  231. productBrandSn: undefined, // 产品品牌
  232. productTypeSn1: '', // 产品一级分类
  233. productTypeSn2: '', // 产品二级分类
  234. productTypeSn3: '', // 产品三级分类
  235. subareaArea: {
  236. subareaSn: undefined,
  237. subareaAreaSn: undefined,
  238. bizUserSn: undefined
  239. },
  240. dealerProvinceSn: undefined,
  241. dealerCitySn: undefined,
  242. dealerCountySn: undefined,
  243. warehouseSn: undefined,
  244. giftFLag: undefined,
  245. promotionFlag: undefined,
  246. bizUserSn: undefined // 客服
  247. },
  248. productType: [],
  249. rules: {
  250. 'time': [{ required: true, message: '请选择下推时间', trigger: 'change' }]
  251. },
  252. disabled: false, // 查询、重置按钮是否可操作
  253. exportLoading: false,
  254. // 加载数据方法 必须为 Promise 对象
  255. loadData: parameter => {
  256. this.disabled = true
  257. this.spinning = true
  258. const params = Object.assign(parameter, this.queryParam)
  259. return reportSalesBillDetailList(params).then(res => {
  260. let data
  261. if (res.status == 200) {
  262. data = res.data
  263. this.getCount(params)
  264. const no = (data.pageNo - 1) * data.pageSize
  265. for (var i = 0; i < data.list.length; i++) {
  266. data.list[i].no = no + i + 1
  267. }
  268. this.disabled = false
  269. }
  270. this.spinning = false
  271. return data
  272. })
  273. },
  274. totalData: null
  275. }
  276. },
  277. computed: {
  278. columns () {
  279. const _this = this
  280. const arr = [
  281. { title: '区域', dataIndex: 'subareaArea.subareaName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  282. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  283. { title: '区域负责人', dataIndex: 'subareaArea.bizUserName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  284. { title: '销售单号', dataIndex: 'salesBillNo', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  285. { title: '备货单号', dataIndex: 'dispatchBillNo', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  286. { title: '出库仓库', dataIndex: 'warehouseName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  287. { title: '省份', dataIndex: 'dealerProvinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  288. { title: '客户名称', dataIndex: 'dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  289. { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  290. // { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  291. // { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  292. { title: '创建时间', dataIndex: 'createDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  293. { title: '销售审核时间', dataIndex: 'auditDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  294. { title: '下推时间', dataIndex: 'pushedDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  295. { title: '品牌', dataIndex: 'productBrandName', width: 130, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  296. { title: '二级分类', dataIndex: 'productTypeName2', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  297. { title: '产品名称', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  298. { title: '产品编码', dataIndex: 'productCode', width: 150, align: 'center', scopedSlots: { customRender: 'productCode' } },
  299. { title: '单位', dataIndex: 'productUnit', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
  300. { title: '下推数量', dataIndex: 'qty', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  301. // { title: '成本价', dataIndex: 'totalCost', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  302. // { title: '实售价', dataIndex: 'totalRealAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  303. // { title: '开单价', dataIndex: 'totalAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  304. // { title: '市级价', dataIndex: 'totalCityAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  305. // { title: '直接差价', dataIndex: 'directRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  306. // { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  307. // { title: '折后单价', dataIndex: 'discountedPrice', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  308. // { title: '折扣金额', dataIndex: 'discountAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  309. ]
  310. if (this.$hasPermissions('M_salesDetailsList_costPrice')) { // 成本价权限
  311. arr.splice(21, 0, { title: '成本金额', dataIndex: 'totalCost', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  312. }
  313. if (this.$hasPermissions('M_salesDetailsList_salesPrice')) { // 售价权限
  314. arr.push({ title: '实售金额', dataIndex: 'totalRealAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  315. arr.push({ title: '开单金额', dataIndex: 'totalAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  316. }
  317. if (this.$hasPermissions('M_salesDetailsList_cityPrice')) { // 市级价权限
  318. arr.push({ title: '市级金额', dataIndex: 'totalCityAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  319. }
  320. if (this.$hasPermissions('M_salesDetailsList_salesPrice')) { // 售价权限
  321. arr.push({ title: '直接上级差金额', dataIndex: 'reportRebateAmountInfoEntity.directRebateUpAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  322. arr.push({ title: '间接上级差金额', dataIndex: 'reportRebateAmountInfoEntity.indirectRebateUpAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  323. arr.push({ title: '指定差价金额', dataIndex: 'assignRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  324. arr.push({ title: '总部差价金额', dataIndex: 'headRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  325. arr.push({ title: '优惠金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  326. // arr.push({ title: '折后单价', dataIndex: 'discountedPrice', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  327. // arr.push({ title: '折扣金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  328. }
  329. arr.push({ title: '操作员', dataIndex: 'operatorName', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  330. return arr
  331. }
  332. },
  333. watch: {
  334. advanced (newValue, oldValue) {
  335. const _this = this
  336. this.$nextTick(() => { // 页面渲染完成后的回调
  337. _this.setTableH()
  338. })
  339. },
  340. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  341. this.setTableH()
  342. }
  343. },
  344. methods: {
  345. // 盘点库存日期
  346. handleStock () {
  347. this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
  348. },
  349. // 总计
  350. getCount (params) {
  351. reportSalesBillDetailCount(params).then(res => {
  352. if (res.status == 200 && res.data) {
  353. this.totalData = res.data
  354. } else {
  355. this.totalData = null
  356. }
  357. })
  358. },
  359. handleSearch () {
  360. const _this = this
  361. this.$refs.ruleForm.validate(valid => {
  362. if (valid) {
  363. _this.$refs.table.refresh(true)
  364. } else {
  365. _this.$message.error('请选择下推时间')
  366. return false
  367. }
  368. })
  369. },
  370. // 创建时间 change
  371. dateChange (date) {
  372. if (date[0] && date[1]) {
  373. this.queryParam.time = date
  374. } else {
  375. this.queryParam.time = []
  376. }
  377. this.queryParam.beginDate = date[0] || ''
  378. this.queryParam.endDate = date[1] || ''
  379. },
  380. custChange (val) {
  381. this.queryParam.dealerSn = val.key
  382. },
  383. subareaChange (val) {
  384. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  385. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  386. },
  387. // 重置
  388. resetSearchForm () {
  389. this.queryParam.time = [
  390. getDate.getCurrMonthDays().starttime,
  391. getDate.getCurrMonthDays().endtime
  392. ]
  393. this.$refs.rangeDate.resetDate(this.queryParam.time)
  394. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  395. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  396. this.queryParam.salesBillNo = ''
  397. this.queryParam.dispatchBillNo = ''
  398. this.queryParam.productCode = ''
  399. this.queryParam.productName = ''
  400. this.queryParam.dealerName = ''
  401. this.queryParam.dealerLevel = undefined
  402. this.queryParam.productBrandTypeSn = undefined
  403. this.queryParam.productBrandSn = undefined
  404. this.queryParam.productTypeSn1 = ''
  405. this.queryParam.productTypeSn2 = ''
  406. this.queryParam.productTypeSn3 = ''
  407. this.queryParam.subareaArea.subareaSn = undefined
  408. this.queryParam.subareaArea.subareaAreaSn = undefined
  409. this.queryParam.subareaArea.bizUserSn = undefined
  410. this.queryParam.dealerProvinceSn = undefined
  411. this.queryParam.dealerCitySn = undefined
  412. this.queryParam.dealerCountySn = undefined
  413. this.queryParam.warehouseSn = undefined
  414. this.queryParam.giftFLag = undefined
  415. this.queryParam.promotionFlag = undefined
  416. this.queryParam.bizUserSn = undefined
  417. if (this.advanced) {
  418. this.$refs.subarea.clearData()
  419. this.$refs.areaList.clearData()
  420. }
  421. this.productType = []
  422. this.totalData = null
  423. this.$refs.ruleForm.resetFields()
  424. this.$refs.table.clearTable()
  425. },
  426. // 导出
  427. handleExport () {
  428. const _this = this
  429. this.$refs.ruleForm.validate(valid => {
  430. if (valid) {
  431. const params = _this.queryParam
  432. _this.$store.state.app.curActionPermission = 'B_salesDetailsExport'
  433. _this.showExport = true
  434. _this.exportLoading = true
  435. _this.spinning = true
  436. hdExportExcel(reportSalesBillDetailExport, params, '销售明细(开单统计)报表', function () {
  437. _this.exportLoading = false
  438. _this.spinning = false
  439. _this.$store.state.app.curActionPermission = ''
  440. })
  441. } else {
  442. return false
  443. }
  444. })
  445. },
  446. // 产品分类 change
  447. changeProductType (val, opt) {
  448. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  449. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  450. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  451. },
  452. areaChange (val) {
  453. this.queryParam.dealerProvinceSn = val[0] ? val[0] : ''
  454. this.queryParam.dealerCitySn = val[1] ? val[1] : ''
  455. this.queryParam.dealerCountySn = val[2] ? val[2] : ''
  456. },
  457. pageInit () {
  458. const _this = this
  459. this.$nextTick(() => { // 页面渲染完成后的回调
  460. _this.setTableH()
  461. })
  462. _this.resetSearchForm()
  463. },
  464. setTableH () {
  465. const tableSearchH = this.$refs.tableSearch.offsetHeight
  466. this.tableHeight = window.innerHeight - tableSearchH - 215
  467. }
  468. },
  469. mounted () {
  470. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  471. this.pageInit()
  472. }
  473. },
  474. activated () {
  475. // 如果是新页签打开,则重置当前页面
  476. if (this.$store.state.app.isNewTab) {
  477. this.pageInit()
  478. }
  479. },
  480. beforeRouteEnter (to, from, next) {
  481. next(vm => {})
  482. }
  483. }
  484. </script>