list.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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. <div style="margin-bottom:12px;text-align: right;">
  153. <a-checkbox id="salesDetailsList-cityPrice" v-model="isAveragePrice" v-if="$hasPermissions('B_salesDetails_avgprice')"><span style="display: inline-block;margin-top: 1px;">平均公斤单价</span></a-checkbox>
  154. </div>
  155. <!-- 列表 -->
  156. <s-table
  157. class="sTable fixPagination"
  158. ref="table"
  159. size="small"
  160. :rowKey="(record) => record.no"
  161. rowKeyName="no"
  162. :columns="columns"
  163. :data="loadData"
  164. :pageSize="30"
  165. :style="{ height: tableHeight+84.5+'px' }"
  166. :scroll="{ x: 2480 , y: tableHeight - 50 }"
  167. :defaultLoadData="false"
  168. bordered>
  169. <!-- 产品编码 -->
  170. <template slot="productCode" slot-scope="text, record">
  171. <span style="padding-right: 15px;">{{ text }}</span>
  172. <a-badge count="促" v-if="record.promotionFlag=='GIFT'" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
  173. <a-badge count="特" v-if="record.promotionFlag=='DISCOUNT'" :number-style="{ backgroundColor: '#faad14', zoom:'80%' }"></a-badge>
  174. <a-badge count="槛" v-if="record.promotionFlag=='GATE'" :number-style="{ backgroundColor: '#108ee9', zoom:'80%' }"></a-badge>
  175. </template>
  176. <template slot="footer">
  177. <a-row :gutter="15">
  178. <a-col :md="4" :sm="24">下推数量:{{ (totalData && (totalData.qty || totalData.qty==0)) ? totalData.qty : '--' }}</a-col>
  179. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_costPrice')">成本金额:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? toThousands(totalData.totalCost) : '--' }}</a-col>
  180. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">总优惠金额(含特价):{{ (totalData && (totalData.discountAmount || totalData.discountAmount==0)) ? toThousands(totalData.discountAmount) : '--' }}</a-col>
  181. <a-col :md="4" :sm="24">毛利率(减促销费用):{{ (totalData && (totalData.grossMargin || totalData.grossMargin==0)) ? (totalData.grossMargin*100).toFixed(2)+'%' : '--' }}</a-col>
  182. <a-col :md="4" :sm="24" v-if="isAveragePrice"><label>合计重量(kg):</label>{{ (totalData && (totalData.totalWeight || totalData.totalWeight==0)) ? totalData.totalWeight : '--' }}</a-col>
  183. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_costPrice')&&isAveragePrice"><label>平均成本公斤单价:</label>{{ (totalData && (totalData.weightAvgCost || totalData.weightAvgCost==0)) ? toThousands(totalData.weightAvgCost) : '--' }}</a-col>
  184. </a-row>
  185. <a-row :gutter="15">
  186. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">开单金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
  187. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">实售金额:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? toThousands(totalData.totalRealAmount) : '--' }}</a-col>
  188. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')">&nbsp;&nbsp;特价产品优惠金额:{{ (totalData && (totalData.specialDiscountAmount || totalData.specialDiscountAmount==0)) ? toThousands(totalData.specialDiscountAmount) : '--' }}</a-col>
  189. <a-col :md="4" :sm="24">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;实际毛利率:{{ (totalData && (totalData.realGrossMargin || totalData.realGrossMargin==0)) ? (totalData.realGrossMargin*100).toFixed(2)+'%' : '--' }}</a-col>
  190. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_costPrice')&&isAveragePrice"><label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返利金额:</label>{{ (totalData && (totalData.totalFactoryRebateAmount || totalData.totalFactoryRebateAmount==0)) ? toThousands(totalData.totalFactoryRebateAmount) : '--' }}</a-col>
  191. <a-col :md="4" :sm="24" v-if="$hasPermissions('M_salesDetailsList_salesPrice')&&isAveragePrice"><label>平均售价公斤单价:</label>{{ (totalData && (totalData.weightAvgPrice || totalData.weightAvgPrice==0)) ? toThousands(totalData.weightAvgPrice) : '--' }}</a-col>
  192. </a-row>
  193. </template></s-table>
  194. </a-spin>
  195. <!-- 导出提示框 -->
  196. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  197. </a-card>
  198. </div>
  199. </template>
  200. <script>
  201. import { commonMixin } from '@/utils/mixin'
  202. import getDate from '@/libs/getDate.js'
  203. import { hdExportExcel } from '@/libs/exportExcel'
  204. // 组件
  205. import { STable, VSelect } from '@/components'
  206. import rangeDate from '@/views/common/rangeDate.vue'
  207. import subarea from '@/views/common/subarea.js'
  208. import custList from '@/views/common/custList.vue'
  209. import AreaList from '@/views/common/areaList.js'
  210. import reportModal from '@/views/common/reportModal.vue'
  211. import ProductBrand from '@/views/common/productBrand.js'
  212. import ProductType from '@/views/common/productType.js'
  213. import chooseWarehouse from '@/views/common/chooseWarehouse'
  214. import customerService from '@/views/common/customerService'
  215. import BizUser from '@/views/common/bizUser.js'
  216. // 接口
  217. import { reportSalesBillDetailList, reportSalesBillDetailCount, reportSalesBillDetailExport } from '@/api/reportData'
  218. export default {
  219. name: 'SalesDetailsList',
  220. mixins: [commonMixin],
  221. components: { STable, VSelect, rangeDate, custList, subarea, ProductBrand, ProductType, reportModal, AreaList, chooseWarehouse, BizUser, customerService },
  222. data () {
  223. return {
  224. spinning: false,
  225. advanced: false, // 高级搜索 展开/关闭
  226. disabled: false, // 查询、重置按钮是否可操作
  227. exportLoading: false, // 导出加载状态
  228. tableHeight: 0, // 表格高度
  229. showExport: false, // 导出提示弹窗
  230. // 查询条件
  231. queryParam: {
  232. // 默认时间
  233. time: [
  234. getDate.getCurrMonthDays().starttime,
  235. getDate.getCurrMonthDays().endtime
  236. ],
  237. beginDate: getDate.getCurrMonthDays().starttime, // 开始时间
  238. endDate: getDate.getCurrMonthDays().endtime, // 结束时间
  239. salesBillNo: '', // 销售单号
  240. dispatchBillNo: '', // 备货单号
  241. productCode: '', // 产品编码
  242. productName: '', // 产品名称
  243. dealerName: '', // 客户名称
  244. dealerLevel: undefined, // 客户等价
  245. productBrandTypeSn: undefined,
  246. productBrandSn: undefined, // 产品品牌
  247. productTypeSn1: '', // 产品一级分类
  248. productTypeSn2: '', // 产品二级分类
  249. productTypeSn3: '', // 产品三级分类
  250. subareaArea: {
  251. subareaSn: undefined, // 区域
  252. subareaAreaSn: undefined, // 分区
  253. bizUserSn: undefined// 区域负责人
  254. },
  255. dealerProvinceSn: undefined, // 省
  256. dealerCitySn: undefined, // 市
  257. dealerCountySn: undefined, // 区
  258. warehouseSn: undefined, // 出库仓库
  259. giftFLag: undefined, // 是否是促销产品 1是 0不是
  260. promotionFlag: undefined, // 产品类型
  261. bizUserSn: undefined // 客服
  262. },
  263. isAveragePrice: false, // 平均公斤单价
  264. productType: [], // 产品分类
  265. totalData: null, // 统计数据
  266. rules: {
  267. 'time': [{ required: true, message: '请选择下推时间', trigger: 'change' }]
  268. },
  269. // 加载数据方法 必须为 Promise 对象
  270. loadData: parameter => {
  271. this.disabled = true
  272. this.spinning = true
  273. const params = Object.assign(parameter, this.queryParam)
  274. // 查询列表
  275. return reportSalesBillDetailList(params).then(res => {
  276. let data
  277. if (res.status == 200) {
  278. data = res.data
  279. // 统计查询
  280. this.getCount(params)
  281. // 计算列表序号
  282. const no = (data.pageNo - 1) * data.pageSize
  283. for (var i = 0; i < data.list.length; i++) {
  284. data.list[i].no = no + i + 1
  285. }
  286. this.disabled = false
  287. }
  288. this.spinning = false
  289. return data
  290. })
  291. },
  292. // 列表列显示
  293. colsArr: [
  294. {
  295. title: '单重',
  296. value: 'directRebateAmountInfo',
  297. key: 'directRebateAmountInfo',
  298. disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
  299. },
  300. {
  301. title: '平均公斤单价',
  302. value: 'indirectRebateAmountInfo',
  303. key: 'indirectRebateAmountInfo',
  304. disabled: !this.$hasPermissions('M_salesOrderTotalList_salesPrice')
  305. }
  306. ],
  307. showCols: []// 已勾选显示的列
  308. }
  309. },
  310. computed: {
  311. columns () {
  312. const _this = this
  313. const arr = [
  314. { title: '区域', dataIndex: 'subareaArea.subareaName', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  315. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
  316. { title: '区域负责人', dataIndex: 'subareaArea.bizUserName', width: 80, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  317. { title: '销售单号', dataIndex: 'salesBillNo', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  318. { title: '备货单号', dataIndex: 'dispatchBillNo', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  319. { title: '出库仓库', dataIndex: 'warehouseName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  320. { title: '省份', dataIndex: 'dealerProvinceName', width: 80, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  321. { title: '客户名称', dataIndex: 'dealerName', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  322. { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  323. // { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  324. // { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 120, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  325. { title: '创建时间', dataIndex: 'createDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  326. { title: '销售审核时间', dataIndex: 'auditDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  327. { title: '下推时间', dataIndex: 'pushedDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
  328. { title: '品牌', dataIndex: 'productBrandName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  329. { title: '二级分类', dataIndex: 'productTypeName2', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
  330. { title: '产品名称', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  331. { title: '产品编码', dataIndex: 'productCode', width: 120, align: 'center', scopedSlots: { customRender: 'productCode' } },
  332. { title: '单位', dataIndex: 'productUnit', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
  333. { title: '下推数量', dataIndex: 'qty', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  334. // { title: '成本价', dataIndex: 'totalCost', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  335. // { title: '实售价', dataIndex: 'totalRealAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  336. // { title: '开单价', dataIndex: 'totalAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  337. // { title: '市级价', dataIndex: 'totalCityAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  338. // { title: '直接差价', dataIndex: 'directRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  339. // { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  340. // { title: '折后单价', dataIndex: 'discountedPrice', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  341. // { title: '折扣金额', dataIndex: 'discountAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  342. ]
  343. if (this.isAveragePrice) {
  344. arr.push({ title: '单重(kg)', dataIndex: 'weight', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  345. arr.push({ title: '合计重量(kg)', dataIndex: 'totalWeight', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
  346. }
  347. if (this.$hasPermissions('M_salesDetailsList_costPrice')) { // 成本价权限
  348. arr.push({ title: '成本金额', dataIndex: 'totalCost', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  349. if (this.isAveragePrice) {
  350. arr.push({ title: '平均成本公斤单价', dataIndex: 'weightAvgCost', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  351. }
  352. }
  353. if (this.$hasPermissions('M_salesDetailsList_salesPrice')) { // 售价权限
  354. arr.push({ title: '实售金额', dataIndex: 'totalRealAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  355. if (this.isAveragePrice) {
  356. arr.push({ title: '平均售价公斤单价', dataIndex: 'weightAvgPrice', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  357. }
  358. }
  359. if (this.$hasPermissions('M_salesDetailsList_costPrice') && this.isAveragePrice) {
  360. arr.push({ title: '返利金额', dataIndex: 'totalFactoryRebateAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  361. }
  362. if (this.$hasPermissions('M_salesDetailsList_salesPrice')) {
  363. arr.push({ title: '开单金额', dataIndex: 'totalAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  364. }
  365. if (this.$hasPermissions('M_salesDetailsList_cityPrice')) { // 市级价权限
  366. arr.push({ title: '市级金额', dataIndex: 'totalCityAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  367. }
  368. if (this.$hasPermissions('M_salesDetailsList_salesPrice')) { // 售价权限
  369. arr.push({ title: '直接差金额', dataIndex: 'reportRebateAmountInfo.directRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  370. arr.push({ title: '间接差金额', dataIndex: 'reportRebateAmountInfo.indirectRebateAmount', width: 90, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  371. arr.push({ title: '直接上级差金额', dataIndex: 'reportRebateAmountInfo.directRebateUpAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  372. arr.push({ title: '间接上级差金额', dataIndex: 'reportRebateAmountInfo.indirectRebateUpAmount', width: 120, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  373. arr.push({ title: '指定差价金额', dataIndex: 'reportRebateAmountInfo.assignRebateAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  374. arr.push({ title: '总部差价金额', dataIndex: 'reportRebateAmountInfo.headRebateAmount', width: 100, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  375. arr.push({ title: '优惠金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  376. // arr.push({ title: '折后单价', dataIndex: 'discountedPrice', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  377. // arr.push({ title: '折扣金额', dataIndex: 'discountAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  378. }
  379. arr.push({ title: '操作员', dataIndex: 'operatorName', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true })
  380. return arr
  381. }
  382. },
  383. watch: {
  384. // 展开收起
  385. advanced (newValue, oldValue) {
  386. const _this = this
  387. this.$nextTick(() => { // 页面渲染完成后的回调
  388. _this.setTableH()
  389. })
  390. },
  391. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  392. this.setTableH()
  393. }
  394. },
  395. methods: {
  396. // 总计
  397. getCount (params) {
  398. reportSalesBillDetailCount(params).then(res => {
  399. if (res.status == 200 && res.data) {
  400. this.totalData = res.data
  401. } else {
  402. this.totalData = null
  403. }
  404. })
  405. },
  406. // 查询
  407. handleSearch () {
  408. const _this = this
  409. this.$refs.ruleForm.validate(valid => {
  410. if (valid) {
  411. _this.$refs.table.refresh(true)
  412. } else {
  413. _this.$message.error('请选择下推时间')
  414. return false
  415. }
  416. })
  417. },
  418. // 下推时间 change
  419. dateChange (date) {
  420. if (date[0] && date[1]) {
  421. this.queryParam.time = date
  422. } else {
  423. this.queryParam.time = []
  424. }
  425. this.queryParam.beginDate = date[0] || ''
  426. this.queryParam.endDate = date[1] || ''
  427. },
  428. // 区域 change
  429. subareaChange (val) {
  430. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  431. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  432. },
  433. // 重置
  434. resetSearchForm () {
  435. this.queryParam.time = [
  436. getDate.getCurrMonthDays().starttime,
  437. getDate.getCurrMonthDays().endtime
  438. ]
  439. this.$refs.rangeDate.resetDate(this.queryParam.time)
  440. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  441. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  442. this.queryParam.salesBillNo = ''
  443. this.queryParam.dispatchBillNo = ''
  444. this.queryParam.productCode = ''
  445. this.queryParam.productName = ''
  446. this.queryParam.dealerName = ''
  447. this.queryParam.dealerLevel = undefined
  448. this.queryParam.productBrandTypeSn = undefined
  449. this.queryParam.productBrandSn = undefined
  450. this.queryParam.productTypeSn1 = ''
  451. this.queryParam.productTypeSn2 = ''
  452. this.queryParam.productTypeSn3 = ''
  453. this.queryParam.subareaArea.subareaSn = undefined
  454. this.queryParam.subareaArea.subareaAreaSn = undefined
  455. this.queryParam.subareaArea.bizUserSn = undefined
  456. this.queryParam.dealerProvinceSn = undefined
  457. this.queryParam.dealerCitySn = undefined
  458. this.queryParam.dealerCountySn = undefined
  459. this.queryParam.warehouseSn = undefined
  460. this.queryParam.giftFLag = undefined
  461. this.queryParam.promotionFlag = undefined
  462. this.queryParam.bizUserSn = undefined
  463. if (this.advanced) {
  464. this.$refs.subarea.clearData()
  465. this.$refs.areaList.clearData()
  466. }
  467. this.productType = []
  468. this.totalData = null
  469. this.$refs.ruleForm.resetFields()
  470. this.$refs.table.clearTable()
  471. },
  472. // 导出
  473. handleExport () {
  474. const _this = this
  475. this.$refs.ruleForm.validate(valid => {
  476. if (valid) {
  477. const params = _this.queryParam
  478. _this.$store.state.app.curActionPermission = 'B_salesDetailsExport'
  479. _this.showExport = true
  480. _this.exportLoading = true
  481. _this.spinning = true
  482. hdExportExcel(reportSalesBillDetailExport, params, '销售明细(开单统计)报表', function () {
  483. _this.exportLoading = false
  484. _this.spinning = false
  485. _this.$store.state.app.curActionPermission = ''
  486. })
  487. } else {
  488. return false
  489. }
  490. })
  491. },
  492. // 产品分类 change
  493. changeProductType (val, opt) {
  494. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  495. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  496. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  497. },
  498. // 地区 change
  499. areaChange (val) {
  500. this.queryParam.dealerProvinceSn = val[0] ? val[0] : ''
  501. this.queryParam.dealerCitySn = val[1] ? val[1] : ''
  502. this.queryParam.dealerCountySn = val[2] ? val[2] : ''
  503. },
  504. // 初始化
  505. pageInit () {
  506. const _this = this
  507. this.$nextTick(() => { // 页面渲染完成后的回调
  508. _this.setTableH()
  509. })
  510. _this.resetSearchForm()
  511. },
  512. // 计算表格高度
  513. setTableH () {
  514. const tableSearchH = this.$refs.tableSearch.offsetHeight
  515. this.tableHeight = window.innerHeight - tableSearchH - 215
  516. }
  517. },
  518. mounted () {
  519. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  520. this.pageInit()
  521. }
  522. },
  523. activated () {
  524. // 如果是新页签打开,则重置当前页面
  525. if (this.$store.state.app.isNewTab) {
  526. this.pageInit()
  527. }
  528. },
  529. beforeRouteEnter (to, from, next) {
  530. next(vm => {})
  531. }
  532. }
  533. </script>
  534. <style lang="less" scoped>
  535. .footerBox{
  536. /deep/ label{
  537. display: inline-block;
  538. width: 135px;
  539. text-align: right;
  540. }
  541. }
  542. </style>