list.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  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="salesDetailsList-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" id="salesDetailsList-time" :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-productCode" v-model.trim="queryParam.productCode" 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-dealerName" v-model.trim="queryParam.dealerName" 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-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
  33. </a-form-model-item>
  34. </a-col>
  35. <a-col :md="6" :sm="24">
  36. <a-form-model-item label="出库仓库">
  37. <chooseWarehouse id="salesDetailsList-warehouseSn" ref="warehouse" isPermission v-model="queryParam.warehouseSn"></chooseWarehouse>
  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-productName" v-model.trim="queryParam.productName" 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. <a-col :md="6" :sm="24">
  57. <a-form-model-item label="备货单号">
  58. <a-input id="salesDetailsList-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
  59. </a-form-model-item>
  60. </a-col>
  61. <template v-if="advanced">
  62. <a-col :md="6" :sm="24" v-if="!isShowCustomerSearch">
  63. <a-form-model-item label="品牌分类">
  64. <v-select code="BRAND_TYPE" id="salesDetailsList-productBrandTypeSn" v-model="queryParam.productBrandTypeSn" allowClear placeholder="请选择品牌分类"></v-select>
  65. </a-form-model-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-model-item label="产品品牌">
  69. <ProductBrand id="salesDetailsList-productBrandSn" :brandType="queryParam.productBrandTypeSn" v-model="queryParam.productBrandSn"></ProductBrand>
  70. </a-form-model-item>
  71. </a-col>
  72. <a-col :md="6" :sm="24">
  73. <a-form-model-item label="产品分类">
  74. <ProductType id="salesDetailsList-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
  75. </a-form-model-item>
  76. </a-col>
  77. <a-col :md="6" :sm="24">
  78. <a-form-model-item label="产品类型" prop="promotionFlag">
  79. <a-select id="salesDetailsList-promotionFlag" allowClear v-model.trim="queryParam.promotionFlag" :dropdownMatchSelectWidth="false" placeholder="请选择产品类型">
  80. <a-select-option value="0">
  81. 正常产品
  82. </a-select-option>
  83. <a-select-option value="REGULAR">
  84. 正价产品(活动)
  85. </a-select-option>
  86. <a-select-option value="DISCOUNT">
  87. 特价产品
  88. </a-select-option>
  89. <a-select-option value="GIFT">
  90. 促销产品
  91. </a-select-option>
  92. <a-select-option value="GATE">
  93. 门槛产品
  94. </a-select-option>
  95. </a-select>
  96. </a-form-model-item>
  97. </a-col>
  98. <a-col :md="6" :sm="24">
  99. <a-form-model-item label="是否促销产品">
  100. <a-select id="salesDetailsList-giftFlag" v-model="queryParam.giftFLag" placeholder="请选择是否促销产品" allowClear>
  101. <a-select-option value="1">
  102. </a-select-option>
  103. <a-select-option value="0">
  104. </a-select-option>
  105. </a-select>
  106. </a-form-model-item>
  107. </a-col>
  108. <a-col :md="6" :sm="24">
  109. <a-form-model-item label="所在区域">
  110. <subarea id="salesDetailsList-subareaSn" ref="subarea" @change="subareaChange"></subarea>
  111. </a-form-model-item>
  112. </a-col>
  113. <a-col :md="6" :sm="24">
  114. <a-form-model-item label="区域负责人">
  115. <BizUser id="salesDetailsList-bizUserSn" v-model="queryParam.subareaArea.bizUserSn"></BizUser>
  116. </a-form-model-item>
  117. </a-col>
  118. <a-col :md="6" :sm="24">
  119. <a-form-model-item label="地区">
  120. <AreaList id="salesDetailsList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  121. </a-form-model-item>
  122. </a-col>
  123. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  124. <a-form-model-item label="客服">
  125. <customerService id="salesDetailsList-customerName" ref="customerName" v-model="queryParam.bizUserSn"></customerService>
  126. </a-form-model-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 - 50 }"
  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="8" :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">毛利率(减促销费用):{{ (totalData && (totalData.grossMargin || totalData.grossMargin==0)) ? (totalData.grossMargin*100).toFixed(2)+'%' : '--' }}</a-col>
  181. <a-col :md="4" :sm="24">实际毛利率:{{ (totalData && (totalData.realGrossMargin || totalData.realGrossMargin==0)) ? (totalData.realGrossMargin*100).toFixed(2)+'%' : '--' }}</a-col>
  182. <!-- <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">折后金额:{{ (totalData && (totalData.discountedAmount || totalData.discountedAmount==0)) ? toThousands(totalData.discountedAmount) : '--' }}</a-col>
  183. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">折扣金额:{{ (totalData && (totalData.discountAmount || totalData.discountAmount==0)) ? toThousands(totalData.discountAmount) : '--' }}</a-col> -->
  184. </a-row>
  185. </template>
  186. </s-table>
  187. </a-spin>
  188. <!-- 导出提示框 -->
  189. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  190. </a-card>
  191. </div>
  192. </template>
  193. <script>
  194. import { commonMixin } from '@/utils/mixin'
  195. import getDate from '@/libs/getDate.js'
  196. import { hdExportExcel } from '@/libs/exportExcel'
  197. // 组件
  198. import { STable, VSelect } from '@/components'
  199. import rangeDate from '@/views/common/rangeDate.vue'
  200. import subarea from '@/views/common/subarea.js'
  201. import custList from '@/views/common/custList.vue'
  202. import AreaList from '@/views/common/areaList.js'
  203. import reportModal from '@/views/common/reportModal.vue'
  204. import ProductBrand from '@/views/common/productBrand.js'
  205. import ProductType from '@/views/common/productType.js'
  206. import chooseWarehouse from '@/views/common/chooseWarehouse'
  207. import customerService from '@/views/common/customerService'
  208. import BizUser from '@/views/common/bizUser.js'
  209. // 接口
  210. import { reportSalesBillDetailList, reportSalesBillDetailCount, reportSalesBillDetailExport } from '@/api/reportData'
  211. export default {
  212. name: 'SalesDetailsList',
  213. mixins: [commonMixin],
  214. components: { STable, VSelect, rangeDate, custList, subarea, ProductBrand, ProductType, reportModal, AreaList, chooseWarehouse, BizUser, customerService },
  215. data () {
  216. return {
  217. spinning: false,
  218. advanced: false, // 高级搜索 展开/关闭
  219. disabled: false, // 查询、重置按钮是否可操作
  220. exportLoading: false, // 导出加载状态
  221. tableHeight: 0, // 表格高度
  222. showExport: false, // 导出提示弹窗
  223. // 查询条件
  224. queryParam: {
  225. // 默认时间
  226. time: [
  227. getDate.getCurrMonthDays().starttime,
  228. getDate.getCurrMonthDays().endtime
  229. ],
  230. beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
  231. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  232. salesBillNo: '', // 销售单号
  233. dispatchBillNo: '', // 备货单号
  234. productCode: '', // 产品编码
  235. productName: '', // 产品名称
  236. dealerName: '', // 客户名称
  237. dealerLevel: undefined, // 客户等价
  238. productBrandTypeSn: undefined,
  239. productBrandSn: undefined, // 产品品牌
  240. productTypeSn1: '', // 产品一级分类
  241. productTypeSn2: '', // 产品二级分类
  242. productTypeSn3: '', // 产品三级分类
  243. subareaArea: {
  244. subareaSn: undefined, // 区域
  245. subareaAreaSn: undefined, // 分区
  246. bizUserSn: undefined// 区域负责人
  247. },
  248. dealerProvinceSn: undefined, // 省
  249. dealerCitySn: undefined, // 市
  250. dealerCountySn: undefined, // 区
  251. warehouseSn: undefined, // 出库仓库
  252. giftFLag: undefined, // 是否是促销产品 1是 0不是
  253. promotionFlag: undefined, // 产品类型
  254. bizUserSn: undefined // 客服
  255. },
  256. productType: [], // 产品分类
  257. totalData: null, // 统计数据
  258. rules: {
  259. 'time': [{ required: true, message: '请选择下推时间', trigger: 'change' }]
  260. },
  261. // 加载数据方法 必须为 Promise 对象
  262. loadData: parameter => {
  263. this.disabled = true
  264. this.spinning = true
  265. const params = Object.assign(parameter, this.queryParam)
  266. // 查询列表
  267. return reportSalesBillDetailList(params).then(res => {
  268. let data
  269. if (res.status == 200) {
  270. data = res.data
  271. // 统计查询
  272. this.getCount(params)
  273. // 计算列表序号
  274. const no = (data.pageNo - 1) * data.pageSize
  275. for (var i = 0; i < data.list.length; i++) {
  276. data.list[i].no = no + i + 1
  277. }
  278. this.disabled = false
  279. }
  280. this.spinning = false
  281. return data
  282. })
  283. }
  284. }
  285. },
  286. computed: {
  287. columns () {
  288. const _this = this
  289. const arr = [
  290. { title: '区域', dataIndex: 'subareaArea.subareaName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  291. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  292. { title: '区域负责人', dataIndex: 'subareaArea.bizUserName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  293. { title: '销售单号', dataIndex: 'salesBillNo', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  294. { title: '备货单号', dataIndex: 'dispatchBillNo', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
  295. { title: '出库仓库', dataIndex: 'warehouseName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  296. { title: '省份', dataIndex: 'dealerProvinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  297. { title: '客户名称', dataIndex: 'dealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  298. { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  299. // { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  300. // { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  301. { title: '创建时间', dataIndex: 'createDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  302. { title: '销售审核时间', dataIndex: 'auditDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  303. { title: '下推时间', dataIndex: 'pushedDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  304. { title: '品牌', dataIndex: 'productBrandName', width: 130, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  305. { title: '二级分类', dataIndex: 'productTypeName2', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  306. { title: '产品名称', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  307. { title: '产品编码', dataIndex: 'productCode', width: 150, align: 'center', scopedSlots: { customRender: 'productCode' } },
  308. { title: '单位', dataIndex: 'productUnit', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
  309. { title: '下推数量', dataIndex: 'qty', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  310. // { title: '成本价', dataIndex: 'totalCost', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  311. // { title: '实售价', dataIndex: 'totalRealAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  312. // { title: '开单价', dataIndex: 'totalAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  313. // { title: '市级价', dataIndex: 'totalCityAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  314. // { title: '直接差价', dataIndex: 'directRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  315. // { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  316. // { title: '折后单价', dataIndex: 'discountedPrice', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  317. // { title: '折扣金额', dataIndex: 'discountAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  318. ]
  319. if (this.$hasPermissions('M_salesDetailsList_costPrice')) { // 成本价权限
  320. arr.splice(21, 0, { title: '成本金额', dataIndex: 'totalCost', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  321. }
  322. if (this.$hasPermissions('M_salesDetailsList_salesPrice')) { // 售价权限
  323. arr.push({ title: '实售金额', dataIndex: 'totalRealAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  324. arr.push({ title: '开单金额', dataIndex: 'totalAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  325. }
  326. if (this.$hasPermissions('M_salesDetailsList_cityPrice')) { // 市级价权限
  327. arr.push({ title: '市级金额', dataIndex: 'totalCityAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  328. }
  329. if (this.$hasPermissions('M_salesDetailsList_salesPrice')) { // 售价权限
  330. arr.push({ title: '直接差金额', dataIndex: 'reportRebateAmountInfo.directRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  331. arr.push({ title: '间接差金额', dataIndex: 'reportRebateAmountInfo.indirectRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  332. arr.push({ title: '直接上级差金额', dataIndex: 'reportRebateAmountInfo.directRebateUpAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  333. arr.push({ title: '间接上级差金额', dataIndex: 'reportRebateAmountInfo.indirectRebateUpAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  334. arr.push({ title: '指定差价金额', dataIndex: 'reportRebateAmountInfo.assignRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  335. arr.push({ title: '总部差价金额', dataIndex: 'reportRebateAmountInfo.headRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  336. arr.push({ title: '优惠金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  337. // arr.push({ title: '折后单价', dataIndex: 'discountedPrice', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  338. // arr.push({ title: '折扣金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  339. }
  340. arr.push({ title: '操作员', dataIndex: 'operatorName', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  341. return arr
  342. }
  343. },
  344. watch: {
  345. // 展开收起
  346. advanced (newValue, oldValue) {
  347. const _this = this
  348. this.$nextTick(() => { // 页面渲染完成后的回调
  349. _this.setTableH()
  350. })
  351. },
  352. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  353. this.setTableH()
  354. }
  355. },
  356. methods: {
  357. // 总计
  358. getCount (params) {
  359. reportSalesBillDetailCount(params).then(res => {
  360. if (res.status == 200 && res.data) {
  361. this.totalData = res.data
  362. } else {
  363. this.totalData = null
  364. }
  365. })
  366. },
  367. // 查询
  368. handleSearch () {
  369. const _this = this
  370. this.$refs.ruleForm.validate(valid => {
  371. if (valid) {
  372. _this.$refs.table.refresh(true)
  373. } else {
  374. _this.$message.error('请选择下推时间')
  375. return false
  376. }
  377. })
  378. },
  379. // 下推时间 change
  380. dateChange (date) {
  381. if (date[0] && date[1]) {
  382. this.queryParam.time = date
  383. } else {
  384. this.queryParam.time = []
  385. }
  386. this.queryParam.beginDate = date[0] || ''
  387. this.queryParam.endDate = date[1] || ''
  388. },
  389. // 区域 change
  390. subareaChange (val) {
  391. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  392. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  393. },
  394. // 重置
  395. resetSearchForm () {
  396. this.queryParam.time = [
  397. getDate.getCurrMonthDays().starttime,
  398. getDate.getCurrMonthDays().endtime
  399. ]
  400. this.$refs.rangeDate.resetDate(this.queryParam.time)
  401. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  402. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  403. this.queryParam.salesBillNo = ''
  404. this.queryParam.dispatchBillNo = ''
  405. this.queryParam.productCode = ''
  406. this.queryParam.productName = ''
  407. this.queryParam.dealerName = ''
  408. this.queryParam.dealerLevel = undefined
  409. this.queryParam.productBrandTypeSn = undefined
  410. this.queryParam.productBrandSn = undefined
  411. this.queryParam.productTypeSn1 = ''
  412. this.queryParam.productTypeSn2 = ''
  413. this.queryParam.productTypeSn3 = ''
  414. this.queryParam.subareaArea.subareaSn = undefined
  415. this.queryParam.subareaArea.subareaAreaSn = undefined
  416. this.queryParam.subareaArea.bizUserSn = undefined
  417. this.queryParam.dealerProvinceSn = undefined
  418. this.queryParam.dealerCitySn = undefined
  419. this.queryParam.dealerCountySn = undefined
  420. this.queryParam.warehouseSn = undefined
  421. this.queryParam.giftFLag = undefined
  422. this.queryParam.promotionFlag = undefined
  423. this.queryParam.bizUserSn = undefined
  424. if (this.advanced) {
  425. this.$refs.subarea.clearData()
  426. this.$refs.areaList.clearData()
  427. }
  428. this.productType = []
  429. this.totalData = null
  430. this.$refs.ruleForm.resetFields()
  431. this.$refs.table.clearTable()
  432. },
  433. // 导出
  434. handleExport () {
  435. const _this = this
  436. this.$refs.ruleForm.validate(valid => {
  437. if (valid) {
  438. const params = _this.queryParam
  439. _this.$store.state.app.curActionPermission = 'B_salesDetailsExport'
  440. _this.showExport = true
  441. _this.exportLoading = true
  442. _this.spinning = true
  443. hdExportExcel(reportSalesBillDetailExport, params, '销售明细(开单统计)报表', function () {
  444. _this.exportLoading = false
  445. _this.spinning = false
  446. _this.$store.state.app.curActionPermission = ''
  447. })
  448. } else {
  449. return false
  450. }
  451. })
  452. },
  453. // 产品分类 change
  454. changeProductType (val, opt) {
  455. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  456. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  457. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  458. },
  459. // 地区 change
  460. areaChange (val) {
  461. this.queryParam.dealerProvinceSn = val[0] ? val[0] : ''
  462. this.queryParam.dealerCitySn = val[1] ? val[1] : ''
  463. this.queryParam.dealerCountySn = val[2] ? val[2] : ''
  464. },
  465. // 初始化
  466. pageInit () {
  467. const _this = this
  468. this.$nextTick(() => { // 页面渲染完成后的回调
  469. _this.setTableH()
  470. })
  471. _this.resetSearchForm()
  472. },
  473. // 计算表格高度
  474. setTableH () {
  475. const tableSearchH = this.$refs.tableSearch.offsetHeight
  476. this.tableHeight = window.innerHeight - tableSearchH - 215
  477. }
  478. },
  479. mounted () {
  480. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  481. this.pageInit()
  482. }
  483. },
  484. activated () {
  485. // 如果是新页签打开,则重置当前页面
  486. if (this.$store.state.app.isNewTab) {
  487. this.pageInit()
  488. }
  489. },
  490. beforeRouteEnter (to, from, next) {
  491. next(vm => {})
  492. }
  493. }
  494. </script>