list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <a-card size="small" :bordered="false" class="salesDetailsList-wrap">
  3. <!-- 搜索条件 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form-model
  6. ref="ruleForm"
  7. class="form-model-con"
  8. layout="inline"
  9. :model="queryParam"
  10. :rules="rules"
  11. @keyup.enter.native="$refs.table.refresh(true)">
  12. <a-row :gutter="15">
  13. <a-col :md="6" :sm="24">
  14. <a-form-model-item label="销售日期" prop="time">
  15. <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
  16. </a-form-model-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-model-item label="销售单号">
  20. <a-input id="salesDetailsList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入销售单号"/>
  21. </a-form-model-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-model-item label="产品编码">
  25. <a-input id="salesDetailsList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码"/>
  26. </a-form-model-item>
  27. </a-col>
  28. <template v-if="advanced">
  29. <a-col :md="6" :sm="24">
  30. <a-form-model-item label="区域">
  31. <a-select id="salesDetailsList-allocateTypeSn" v-model="queryParam.allocateTypeSn" placeholder="请选择区域" allowClear >
  32. <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
  33. </a-select>
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :md="6" :sm="24">
  37. <a-form-model-item label="省份">
  38. <a-select id="salesDetailsList-state" v-model="queryParam.state" placeholder="请选择省份" allowClear >
  39. <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
  40. </a-select>
  41. </a-form-model-item>
  42. </a-col>
  43. <a-col :md="6" :sm="24">
  44. <a-form-model-item label="产品名称">
  45. <a-input id="salesDetailsList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
  46. </a-form-model-item>
  47. </a-col>
  48. <a-col :md="6" :sm="24">
  49. <a-form-model-item label="客户名称">
  50. <a-input id="salesDetailsList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入客户名称"/>
  51. </a-form-model-item>
  52. </a-col>
  53. <a-col :md="6" :sm="24">
  54. <a-form-model-item label="产品品牌">
  55. <a-select
  56. placeholder="请选择"
  57. id="salesDetailsList-productBrandSn"
  58. allowClear
  59. v-model="queryParam.productBrandSn"
  60. :showSearch="true"
  61. option-filter-prop="children"
  62. :filter-option="filterOption">
  63. <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
  64. </a-select>
  65. </a-form-model-item>
  66. </a-col>
  67. <a-col :md="6" :sm="24">
  68. <a-form-model-item label="客户级别">
  69. <a-select
  70. placeholder="请选择"
  71. id="salesDetailsList-productBrandSn"
  72. allowClear
  73. v-model="queryParam.productBrandSn"
  74. :showSearch="true"
  75. option-filter-prop="children"
  76. :filter-option="filterOption">
  77. <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
  78. </a-select>
  79. </a-form-model-item>
  80. </a-col>
  81. <a-col :md="6" :sm="24">
  82. <a-form-model-item label="品牌类别">
  83. <v-select code="BRAND_TYPE" id="salesDetailsList-brandType" v-model="queryParam.brandType" allowClear placeholder="请选择品牌分类"></v-select>
  84. </a-form-model-item>
  85. </a-col>
  86. <a-col :md="6" :sm="24">
  87. <a-form-model-item label="二级分类">
  88. <a-select
  89. placeholder="请选择"
  90. id="salesDetailsList-productBrandSn"
  91. allowClear
  92. v-model="queryParam.productBrandSn"
  93. :showSearch="true"
  94. option-filter-prop="children"
  95. :filter-option="filterOption">
  96. <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
  97. </a-select>
  98. </a-form-model-item>
  99. </a-col>
  100. <a-col :md="6" :sm="24">
  101. <a-form-model-item label="三级分类">
  102. <a-select
  103. placeholder="请选择"
  104. id="salesDetailsList-productBrandSn"
  105. allowClear
  106. v-model="queryParam.productBrandSn"
  107. :showSearch="true"
  108. option-filter-prop="children"
  109. :filter-option="filterOption">
  110. <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
  111. </a-select>
  112. </a-form-model-item>
  113. </a-col>
  114. <a-col :md="6" :sm="24">
  115. <a-form-model-item label="盘点区间日期">
  116. <a-checkbox @change="onChange"></a-checkbox>
  117. </a-form-model-item>
  118. </a-col>
  119. </template>
  120. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  121. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesDetailsList-refresh">查询</a-button>
  122. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesDetailsList-reset">重置</a-button>
  123. <a @click="advanced=!advanced" style="margin-left: 5px">
  124. {{ advanced ? '收起' : '展开' }}
  125. <a-icon :type="advanced ? 'up' : 'down'"/>
  126. </a>
  127. </a-col>
  128. </a-row>
  129. </a-form-model>
  130. </div>
  131. <!-- 列表 -->
  132. <s-table
  133. class="sTable"
  134. ref="table"
  135. size="small"
  136. :rowKey="(record) => record.id"
  137. :columns="columns"
  138. :data="loadData"
  139. :scroll="{ x: 3500 }"
  140. bordered>
  141. <template slot="footer" slot-scope="currentPageData">
  142. <a-row :gutter="15">
  143. <a-col :md="4" :sm="24">
  144. 数量:69
  145. </a-col>
  146. <a-col :md="4" :sm="24">
  147. 实售价:1130.36
  148. </a-col>
  149. <a-col :md="4" :sm="24">
  150. 开单价:1187.11
  151. </a-col>
  152. <a-col :md="4" :sm="24">
  153. 成本:1052.30
  154. </a-col>
  155. <a-col :md="4" :sm="24">
  156. 折后金额:1187.11
  157. </a-col>
  158. </a-row>
  159. </template>
  160. </s-table>
  161. </a-card>
  162. </template>
  163. <script>
  164. import getDate from '@/libs/getDate.js'
  165. import { STable, VSelect } from '@/components'
  166. import reportData from '@/libs/reportData'
  167. import rangeDate from '@/views/common/rangeDate.vue'
  168. // import { allocateBillList, allocateBillDel, allocateBillAudit, allocateBillExport } from '@/api/allocateBill'
  169. // import { allocateTypeAllList } from '@/api/allocateType'
  170. export default {
  171. components: { STable, VSelect, rangeDate },
  172. data () {
  173. return {
  174. advanced: false, // 高级搜索 展开/关闭
  175. tableHeight: 0,
  176. queryParam: { // 查询条件
  177. time: [
  178. getDate.getCurrMonthDays().starttime,
  179. getDate.getCurrMonthDays().endtime
  180. ],
  181. beginDate: getDate.getCurrMonthDays().starttime,
  182. endDate: getDate.getCurrMonthDays().endtime,
  183. targetName: '', // 调往对象
  184. allocateTypeSn: undefined, // 调拨类型
  185. state: undefined, // 业务状态
  186. allocateNo: '' // 调拨单号
  187. },
  188. rules: {
  189. 'time': [{ required: true, message: '请选择调拨开单日期', trigger: 'change' }]
  190. },
  191. disabled: false, // 查询、重置按钮是否可操作
  192. exportLoading: false,
  193. checkVal: '',
  194. reportData: reportData.reportDataList,
  195. columns: [
  196. { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
  197. { title: '区域', dataIndex: 'data1', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  198. { title: '销售单号', dataIndex: 'data2', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
  199. { title: '省份', dataIndex: 'data3', align: 'center', customRender: function (text) { return text || '--' } },
  200. { title: '客户名称', dataIndex: 'data4', width: 220, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  201. { title: '客户级别', dataIndex: 'data5', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  202. { title: '直接绑定客户级别', dataIndex: 'data6', width: 200, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  203. { title: '间接绑定客户级别', dataIndex: 'data7', width: 200, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  204. { title: '开单日期', dataIndex: 'data8', width: 160, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  205. { title: '销售日期', dataIndex: 'data9', width: 160, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  206. { title: '品牌', dataIndex: 'data10', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  207. { title: '二级类别', dataIndex: 'data11', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  208. { title: '产品名称', dataIndex: 'data12', width: 120, align: 'center', ellipsis: true, customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  209. { title: '产品编码', dataIndex: 'data13', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  210. { title: '单位', dataIndex: 'data14', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  211. { title: '产品批次', dataIndex: 'data15', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  212. { title: '销售数量', dataIndex: 'data16', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  213. { title: '成本价', dataIndex: 'data17', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  214. { title: '实售价', dataIndex: 'data18', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  215. { title: '开单价', dataIndex: 'data19', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  216. { title: '市级价', dataIndex: 'data20', width: 140, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  217. { title: '直接差价', dataIndex: 'data21', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  218. { title: '间接差价', dataIndex: 'data22', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  219. { title: '操作员', dataIndex: 'data23', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
  220. ],
  221. // 加载数据方法 必须为 Promise 对象
  222. loadData: parameter => {
  223. this.disabled = true
  224. // return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
  225. // const data = res.data
  226. // const no = (data.pageNo - 1) * data.pageSize
  227. // for (var i = 0; i < data.list.length; i++) {
  228. // data.list[i].no = no + i + 1
  229. // }
  230. // this.disabled = false
  231. // return data
  232. // })
  233. const _this = this
  234. return new Promise(function (resolve, reject) {
  235. const data = {
  236. pageNo: 1,
  237. pageSize: 10,
  238. list: reportData.salesDetailsList,
  239. count: 10
  240. }
  241. for (var i = 0; i < data.list.length; i++) {
  242. data.list[i].no = i + 1
  243. }
  244. _this.disabled = false
  245. resolve(data)
  246. })
  247. },
  248. allocateTypeList: [], // 调拨类型
  249. openModal: false // 新增编辑 弹框
  250. }
  251. },
  252. methods: {
  253. handleFooterShow (currentPageData) {
  254. console.log(currentPageData, '[=currentPageData]')
  255. },
  256. // 创建时间 change
  257. dateChange (date) {
  258. this.queryParam.time = date
  259. this.queryParam.beginDate = date[0] || ''
  260. this.queryParam.endDate = date[1] || ''
  261. },
  262. // 选择盘点日期
  263. onChange (e) {
  264. console.log(e)
  265. // this.checkVal
  266. },
  267. // 重置
  268. resetSearchForm () {
  269. this.queryParam.time = [
  270. getDate.getCurrMonthDays().starttime,
  271. getDate.getCurrMonthDays().endtime
  272. ]
  273. this.$refs.rangeDate.resetDate(this.queryParam.time)
  274. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  275. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  276. this.queryParam.targetName = ''
  277. this.queryParam.allocateTypeSn = undefined
  278. this.queryParam.state = undefined
  279. this.queryParam.allocateNo = ''
  280. this.$refs.table.refresh(true)
  281. }
  282. },
  283. activated () {
  284. // 如果是新页签打开,则重置当前页面
  285. if (this.$store.state.app.isNewTab) {
  286. this.resetSearchForm()
  287. }
  288. },
  289. beforeRouteEnter (to, from, next) {
  290. next(vm => {})
  291. }
  292. }
  293. </script>