list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <a-card size="small" :bordered="false" class="chainStockReportList-wrap">
  3. <a-alert :show-icon="false" type="error" message="注:连锁销售单报表包含急件销售数量、售价,连锁销售明细报表不包含急件销售数量、成本、售价" banner style="margin-bottom: 10px;" />
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form-model
  7. id="chainStockReportList-form"
  8. ref="ruleForm"
  9. :model="queryParam"
  10. :rules="rules"
  11. :labelCol="labelCol"
  12. :wrapperCol="wrapperCol"
  13. @keyup.enter.native="handleSearch" >
  14. <a-row :gutter="15">
  15. <a-col :md="6" :sm="24">
  16. <a-form-model-item label="连锁店" prop="targetName">
  17. <a-select
  18. placeholder="请选择连锁店"
  19. id="chainStockReportList-targetName"
  20. allowClear
  21. v-model="queryParam.targetName"
  22. :showSearch="true"
  23. option-filter-prop="children"
  24. :filter-option="filterOption">
  25. <a-select-option v-for="item in allocateTypeList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
  26. </a-select>
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :md="6" :sm="24">
  30. <a-form-item label="审核时间">
  31. <rangeDate ref="rangeDate" @change="dateChange" />
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="24">
  35. <a-form-item label="客户名称">
  36. <a-input id="chainStockReportList-targetName" v-model.trim="queryParam.code" allowClear placeholder="请输入客户名称"/>
  37. </a-form-item>
  38. </a-col>
  39. <template v-if="advanced">
  40. <a-col :md="6" :sm="24">
  41. <a-form-item label="客户类型">
  42. <a-select id="chainStockReportList-targetName" v-model="queryParam.allocateTypeSn" placeholder="请选择客户类型" allowClear >
  43. <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
  44. </a-select>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :md="12" :sm="24">
  48. <a-row>
  49. <a-form-item label="客户所在区" :labelCol="{span: 4}" :wrapperCol="{ span: 20 }">
  50. <a-col span="7">
  51. <a-form-item prop="dealerProvinceSn" style="margin: 0;">
  52. <a-select v-model="queryParam.dealerProvinceSn" @change="getCityList" placeholder="请选择省">
  53. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  54. </a-select>
  55. </a-form-item>
  56. </a-col>
  57. <a-col span="7" offset="1">
  58. <a-form-item prop="dealerCitySn" style="margin: 0;">
  59. <a-select v-model="queryParam.dealerCitySn" @change="getAreaList" placeholder="请选择市">
  60. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  61. </a-select>
  62. </a-form-item>
  63. </a-col>
  64. <a-col span="7" offset="1">
  65. <a-form-item prop="dealerCountySn" style="margin: 0;">
  66. <a-select v-model="queryParam.dealerCountySn" placeholder="请选择区/县">
  67. <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
  68. </a-select>
  69. </a-form-item>
  70. </a-col>
  71. </a-form-item>
  72. </a-row>
  73. </a-col>
  74. <a-col :md="6" :sm="24">
  75. <a-form-item label="支付方式">
  76. <a-select id="chainStockReportList-targetName" v-model="queryParam.allocateTypeSn" placeholder="请选择收款方式" allowClear >
  77. <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
  78. </a-select>
  79. </a-form-item>
  80. </a-col>
  81. <a-col :md="6" :sm="24">
  82. <a-form-item label="收款方式">
  83. <a-select id="chainStockReportList-targetName" v-model="queryParam.allocateTypeSn" placeholder="请选择收款方式" allowClear >
  84. <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
  85. </a-select>
  86. </a-form-item>
  87. </a-col>
  88. <a-col :md="12" :sm="24">
  89. <a-row>
  90. <a-form-item label="产品类别" :labelCol="{span: 4}" :wrapperCol="{ span: 20 }">
  91. <a-col span="7">
  92. <a-form-item prop="dealerProvinceSn" style="margin: 0;">
  93. <a-select v-model="queryParam.dealerProvinceSn" @change="getCityList" placeholder="请选择">
  94. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  95. </a-select>
  96. </a-form-item>
  97. </a-col>
  98. <a-col span="7" offset="1">
  99. <a-form-item prop="dealerCitySn" style="margin: 0;">
  100. <a-select v-model="queryParam.dealerCitySn" @change="getAreaList" placeholder="请选择">
  101. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  102. </a-select>
  103. </a-form-item>
  104. </a-col>
  105. <a-col span="7" offset="1">
  106. <a-form-item prop="dealerCountySn" style="margin: 0;">
  107. <a-select v-model="queryParam.dealerCountySn" placeholder="请选择">
  108. <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
  109. </a-select>
  110. </a-form-item>
  111. </a-col>
  112. </a-form-item>
  113. </a-row>
  114. </a-col>
  115. <a-col :md="6" :sm="24">
  116. <a-form-item label="产品编码">
  117. <a-input id="chainStockReportList-targetName" v-model.trim="queryParam.code" allowClear placeholder="请输入单号"/>
  118. </a-form-item>
  119. </a-col>
  120. <a-col :md="6" :sm="24">
  121. <a-form-item label="产品名称">
  122. <a-input id="chainStockReportList-targetName" v-model.trim="queryParam.code" allowClear placeholder="请输入业务员"/>
  123. </a-form-item>
  124. </a-col>
  125. <a-col :md="12" :sm="24">
  126. <a-row>
  127. <a-form-item label="仓库仓位" :labelCol="{span: 4}" :wrapperCol="{ span: 20 }">
  128. <a-col span="7">
  129. <a-form-item prop="dealerProvinceSn" style="margin: 0;">
  130. <a-select v-model="queryParam.dealerProvinceSn" @change="getCityList" placeholder="请选择">
  131. <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
  132. </a-select>
  133. </a-form-item>
  134. </a-col>
  135. <a-col span="7" offset="1">
  136. <a-form-item prop="dealerCitySn" style="margin: 0;">
  137. <a-select v-model="queryParam.dealerCitySn" @change="getAreaList" placeholder="请选择">
  138. <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
  139. </a-select>
  140. </a-form-item>
  141. </a-col>
  142. </a-form-item>
  143. </a-row>
  144. </a-col>
  145. <a-col :md="6" :sm="24">
  146. <a-form-item label="单号">
  147. <a-input id="chainStockReportList-targetName" v-model.trim="queryParam.code" allowClear placeholder="请输入单号"/>
  148. </a-form-item>
  149. </a-col>
  150. <a-col :md="6" :sm="24">
  151. <a-form-item label="业务员">
  152. <a-input id="chainStockReportList-targetName" v-model.trim="queryParam.code" allowClear placeholder="请输入业务员"/>
  153. </a-form-item>
  154. </a-col>
  155. <a-col :md="6" :sm="24">
  156. <a-form-item label="订单类型">
  157. <a-select id="chainStockReportList-targetName" v-model="queryParam.allocateTypeSn" placeholder="请选择收款方式" allowClear >
  158. <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
  159. </a-select>
  160. </a-form-item>
  161. </a-col>
  162. </template>
  163. <a-col :md="6" :sm="24">
  164. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="chainStockReportList-refresh">查询</a-button>
  165. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainStockReportList-reset">重置</a-button>
  166. <a @click="advanced=!advanced" style="margin-left: 8px">
  167. {{ advanced ? '收起' : '展开' }}
  168. <a-icon :type="advanced ? 'up' : 'down'"/>
  169. </a>
  170. </a-col>
  171. </a-row>
  172. </a-form-model>
  173. </div>
  174. <!-- 合计 -->
  175. <a-alert type="info" showIcon style="margin-bottom:15px">
  176. <div class="ftext" slot="message">
  177. 总成本:<strong>¥33.00</strong>;
  178. 总售价:<strong>¥48.00</strong>;
  179. 总毛利:<strong>¥15.00</strong>。
  180. </div>
  181. </a-alert>
  182. <!-- 列表 -->
  183. <s-table
  184. class="sTable"
  185. ref="table"
  186. size="small"
  187. :rowKey="(record) => record.id"
  188. :columns="columns"
  189. :data="loadData"
  190. :scroll="{ x: 1170 }"
  191. bordered>
  192. </s-table>
  193. </a-card>
  194. </template>
  195. <script>
  196. import { STable, VSelect } from '@/components'
  197. import rangeDate from '@/views/common/rangeDate.vue'
  198. import { getArea } from '@/api/data'
  199. // import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
  200. // import { allocateTypeAllList } from '@/api/allocateType'
  201. export default {
  202. components: { STable, VSelect, rangeDate },
  203. data () {
  204. return {
  205. labelCol: { span: 8 },
  206. wrapperCol: { span: 16 },
  207. advanced: false, // 高级搜索 展开/关闭
  208. tableHeight: 0,
  209. queryParam: { // 查询条件
  210. beginDate: '',
  211. endDate: '',
  212. targetName: undefined,
  213. code: '', // 产品编码
  214. name: '', // 产品名称
  215. origCode: '', // 原厂编码
  216. productBrandSn: undefined, // 产品品牌
  217. productTypeSn1: '', // 产品一级分类
  218. productTypeSn2: '', // 产品二级分类
  219. productTypeSn3: '' // 产品三级分类
  220. },
  221. rules: {
  222. 'targetName': [{ required: true, message: '请选择连锁店', trigger: 'change' }]
  223. },
  224. disabled: false, // 查询、重置按钮是否可操作
  225. exportLoading: false,
  226. columns: [
  227. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  228. { title: '销售单号', dataIndex: 'code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
  229. { title: '客户名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  230. { title: '订单类型', dataIndex: 'orderType', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  231. { title: '支付方式', dataIndex: 'payType', width: 165, align: 'center', customRender: function (text) { return text || '--' } },
  232. { title: '收款方式', dataIndex: 'currentStockCost', width: 165, align: 'center', customRender: function (text) { return text || '--' } },
  233. { title: '产品编码', dataIndex: 'proCode', width: 165, align: 'center', customRender: function (text) { return text || '--' } },
  234. { title: '产品名称', dataIndex: 'proName', width: 165, align: 'center', customRender: function (text) { return text || '--' } },
  235. { title: '单位', dataIndex: 'unit', width: 165, align: 'center', customRender: function (text) { return text || '--' } },
  236. { title: '数量', dataIndex: 'totalQty', width: 165, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  237. { title: '成本', dataIndex: 'totalCost', width: 165, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  238. { title: '售价', dataIndex: 'totalAmount', width: 165, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  239. { title: '毛利', dataIndex: 'totalMl', width: 165, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  240. { title: '审核时间', dataIndex: 'auditDate', width: 165, align: 'center', customRender: function (text) { return text || '--' } }
  241. ],
  242. // 加载数据方法 必须为 Promise 对象
  243. loadData: parameter => {
  244. this.disabled = true
  245. // return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
  246. // const data = res.data
  247. // const no = (data.pageNo - 1) * data.pageSize
  248. // for (var i = 0; i < data.list.length; i++) {
  249. // data.list[i].no = no + i + 1
  250. // }
  251. // this.disabled = false
  252. // return data
  253. // })
  254. const _this = this
  255. return new Promise(function (resolve, reject) {
  256. const data = {
  257. pageNo: 1,
  258. pageSize: 10,
  259. list: [
  260. { id: '1', code: '159177', name: '支持市级', orderType: '线下', payType: '货到付款', currentStockCost: '现金', proCode: '00004', proName: 'xl测试00004', unit: '个', totalCategory: '3', totalQty: '3', totalCost: '33.00', totalAmount: '48.00', totalMl: '15.00', billName: '', auditDate: '2021-03-19 18:27:48' }
  261. ],
  262. count: 10
  263. }
  264. for (var i = 0; i < data.list.length; i++) {
  265. data.list[i].no = i + 1
  266. }
  267. _this.disabled = false
  268. resolve(data)
  269. })
  270. },
  271. addrProvinceList: [], // 省下拉
  272. addrCityList: [], // 市下拉
  273. addrDistrictList: [], // 区下拉
  274. allocateTypeList: [] // 调拨类型
  275. }
  276. },
  277. methods: {
  278. // 创建时间 change
  279. dateChange (date) {
  280. this.queryParam.beginDate = date[0]
  281. this.queryParam.endDate = date[1]
  282. },
  283. // 查询
  284. handleSearch () {
  285. this.$refs.ruleForm.validate(valid => {
  286. if (valid) {
  287. this.$refs.table.refresh(true)
  288. } else {
  289. console.log('error submit!!')
  290. return false
  291. }
  292. })
  293. },
  294. // 重置
  295. resetSearchForm () {
  296. this.queryParam.targetName = undefined
  297. this.queryParam.code = ''
  298. this.queryParam.name = ''
  299. this.queryParam.origCode = ''
  300. this.queryParam.productBrandSn = undefined
  301. this.queryParam.productTypeSn1 = ''
  302. this.queryParam.productTypeSn2 = ''
  303. this.queryParam.productTypeSn3 = ''
  304. this.productType = []
  305. this.$refs.table.refresh(true)
  306. },
  307. filterOption (input, option) {
  308. return (
  309. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  310. )
  311. },
  312. // 获取城市列表
  313. getCityList (val) {
  314. this.addrCityList = []
  315. this.addrDistrictList = []
  316. this.queryParam.dealerCitySn = undefined
  317. this.queryParam.dealerCountySn = undefined
  318. this.getArea('city', val)
  319. },
  320. // 获取区县列表
  321. getAreaList (val) {
  322. this.addrDistrictList = []
  323. this.queryParam.dealerCountySn = undefined
  324. this.getArea('district', val)
  325. },
  326. // 省/市/区
  327. getArea (leve, sn) {
  328. let params
  329. if (leve == 'province') {
  330. params = { type: '2' }
  331. } else {
  332. params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
  333. }
  334. getArea(params).then(res => {
  335. if (res.status == 200) {
  336. if (leve == 'province') {
  337. this.addrProvinceList = res.data || []
  338. } else if (leve == 'city') {
  339. this.addrCityList = res.data || []
  340. } else if (leve == 'district') {
  341. this.addrDistrictList = res.data || []
  342. }
  343. } else {
  344. if (leve == 'province') {
  345. this.addrProvinceList = []
  346. } else if (leve == 'city') {
  347. this.addrCityList = []
  348. } else if (leve == 'district') {
  349. this.addrDistrictList = []
  350. }
  351. }
  352. })
  353. }
  354. },
  355. beforeRouteEnter (to, from, next) {
  356. next(vm => {
  357. vm.getArea('province')
  358. })
  359. }
  360. }
  361. </script>