policy_list.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. <template>
  2. <div class="app-container">
  3. <div
  4. v-show="!isShowDetail && !isShowForm && !isShowExamine && !isShowReturn"
  5. >
  6. <!-- 筛选条件 -->
  7. <div class="screen-container">
  8. <el-form
  9. ref="screenForm"
  10. :model="screenForm"
  11. label-width="100px"
  12. size="small"
  13. label-position="left"
  14. >
  15. <el-row :gutter="20">
  16. <el-col :xs="24" :sm="24" :lg="24">
  17. <el-form-item prop="status" label-width="0">
  18. <el-radio-group
  19. v-model="screenForm.status"
  20. size="medium"
  21. @change="getList()"
  22. >
  23. <el-radio-button label="">全部</el-radio-button>
  24. <el-radio-button
  25. v-for="(item, index) in statusList"
  26. :key="index"
  27. :label="item.value"
  28. >{{ item.label }}</el-radio-button>
  29. </el-radio-group>
  30. </el-form-item>
  31. </el-col>
  32. <el-col :xs="24" :sm="12" :lg="6">
  33. <el-form-item label="订单号" prop="orderNum">
  34. <el-input
  35. v-model="screenForm.orderNum"
  36. placeholder="请输入订单号"
  37. />
  38. </el-form-item>
  39. </el-col>
  40. <el-col :xs="24" :sm="12" :lg="6">
  41. <el-form-item label="销售政策编号" prop="policyCode">
  42. <el-input
  43. v-model="screenForm.policyCode"
  44. placeholder="请输入销售政策编号"
  45. />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :xs="24" :sm="12" :lg="6">
  49. <el-form-item label="销售政策说明" prop="policyRemark">
  50. <el-input
  51. v-model="screenForm.policyRemark"
  52. placeholder="请输入销售政策说明"
  53. />
  54. </el-form-item>
  55. </el-col>
  56. <el-col :xs="24" :sm="12" :lg="6">
  57. <el-form-item label="经销商" prop="jxsName">
  58. <el-input
  59. v-model="screenForm.jxsName"
  60. placeholder="请输入经销商"
  61. />
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="12" :lg="6">
  65. <el-form-item label="订单日期" prop="date">
  66. <!-- <el-date-picker
  67. v-model="screenForm.date"
  68. class="dateStyle"
  69. type="datetime"
  70. value-format="yyyy-MM-dd HH:mm:ss"
  71. placeholder="选择订单日期"
  72. >
  73. </el-date-picker> -->
  74. <el-date-picker
  75. v-model="screenForm.date"
  76. type="datetimerange"
  77. range-separator="至"
  78. style="width: 100%"
  79. value-format="yyyy-MM-dd HH:mm:ss"
  80. start-placeholder="开始日期"
  81. end-placeholder="结束日期"
  82. />
  83. </el-form-item>
  84. </el-col>
  85. <el-col :xs="24" :sm="12" :lg="6">
  86. <el-form-item label="制表人" prop="zbMan">
  87. <el-input
  88. v-model="screenForm.zbMan"
  89. placeholder="请输入制表人"
  90. />
  91. </el-form-item>
  92. </el-col>
  93. <el-col :xs="24" :sm="12" :lg="6">
  94. <el-form-item label="审核人" prop="shMan">
  95. <el-input
  96. v-model="screenForm.shMan"
  97. placeholder="请输入审核人"
  98. />
  99. </el-form-item>
  100. </el-col>
  101. <el-col :xs="24" :sm="12" :lg="6">
  102. <el-form-item label="业务员" prop="salesMan">
  103. <el-select v-model="screenForm.salesMan" placeholder="选择业务员" size="small" clearable filterable style="width: 100%">
  104. <el-option
  105. v-for="item in salesmanList"
  106. :key="item.adminUserId"
  107. :label="item.nickName"
  108. :value="item.adminUserId">
  109. </el-option>
  110. </el-select>
  111. </el-form-item>
  112. </el-col>
  113. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  114. <el-form-item label="">
  115. <el-button
  116. size="small"
  117. @click="resetScreenForm"
  118. >清空</el-button>
  119. <el-button
  120. size="small"
  121. type="primary"
  122. @click="submitScreenForm"
  123. >搜索</el-button>
  124. </el-form-item>
  125. </el-col>
  126. </el-row>
  127. </el-form>
  128. </div>
  129. <div class="mymain-container">
  130. <div class="btn-group clearfix">
  131. <div class="fl">
  132. <el-button
  133. v-if="$checkBtnRole('add', $route.meta.roles)"
  134. size="small"
  135. type="primary"
  136. icon="el-icon-plus"
  137. @click="toForm()"
  138. >新增</el-button>
  139. </div>
  140. <div class="fr">
  141. <ExportButton :ex-url="'retail/export'" :ex-params="exParams" />
  142. </div>
  143. </div>
  144. <div class="table">
  145. <el-table
  146. v-loading="listLoading"
  147. :data="dataList"
  148. element-loading-text="Loading"
  149. border
  150. fit
  151. highlight-current-row
  152. stripe
  153. show-summary
  154. :summary-method="$getSummaries"
  155. >
  156. <!-- <el-table-column
  157. align="center"
  158. label="提货进度"
  159. prop="thjd"
  160. min-width="180"
  161. show-overflow-tooltip
  162. >
  163. <template slot-scope="scope">
  164. <el-progress :percentage="scope.row.thjd || 0"></el-progress>
  165. </template>
  166. </el-table-column> -->
  167. <el-table-column
  168. align="center"
  169. label="订单号"
  170. prop="id"
  171. min-width="180"
  172. show-overflow-tooltip
  173. />
  174. <el-table-column
  175. align="center"
  176. label="订单日期"
  177. prop="theTime"
  178. min-width="150"
  179. show-overflow-tooltip
  180. >
  181. <template slot-scope="scope">
  182. <div>
  183. <span>{{ scope.row.theTime | dateToDayFilter }}</span>
  184. <el-button
  185. v-if="$checkBtnRole('date', $route.meta.roles)"
  186. type="text"
  187. icon="el-icon-edit"
  188. style="padding: 0; margin-left: 6px"
  189. @click="editDate(scope.row)"
  190. />
  191. </div>
  192. </template>
  193. </el-table-column>
  194. <el-table-column
  195. align="center"
  196. label="销售政策编号"
  197. prop="policyCode"
  198. min-width="100"
  199. show-overflow-tooltip
  200. />
  201. <el-table-column
  202. align="center"
  203. label="销售政策说明"
  204. prop="policyTitle"
  205. min-width="160"
  206. show-overflow-tooltip
  207. />
  208. <el-table-column
  209. align="center"
  210. label="经销商"
  211. prop="customerName"
  212. min-width="160"
  213. show-overflow-tooltip
  214. />
  215. <el-table-column
  216. align="center"
  217. label="物料编码"
  218. prop="materialCode"
  219. min-width="160"
  220. show-overflow-tooltip
  221. />
  222. <el-table-column
  223. align="center"
  224. label="产品名称"
  225. prop="materialName"
  226. min-width="160"
  227. show-overflow-tooltip
  228. />
  229. <el-table-column
  230. align="center"
  231. label="规格型号"
  232. prop="specification"
  233. min-width="160"
  234. show-overflow-tooltip
  235. />
  236. <el-table-column
  237. align="center"
  238. label="计量单位"
  239. prop="unit"
  240. min-width="100"
  241. show-overflow-tooltip
  242. />
  243. <el-table-column
  244. align="center"
  245. label="是否直调"
  246. prop="isDirectTransfer"
  247. min-width="100"
  248. show-overflow-tooltip
  249. >
  250. <template slot-scope="scope">
  251. {{ scope.row.isDirectTransfer ? "是" : "否" }}
  252. </template>
  253. </el-table-column>
  254. <el-table-column
  255. align="center"
  256. label="总数量"
  257. prop="qty"
  258. min-width="100"
  259. show-overflow-tooltip
  260. />
  261. <el-table-column
  262. align="center"
  263. label="单价"
  264. prop="price"
  265. min-width="100"
  266. show-overflow-tooltip
  267. >
  268. <template slot-scope="scope">
  269. {{ scope.row.price | numToFixed }}
  270. </template>
  271. </el-table-column>
  272. <el-table-column
  273. align="center"
  274. label="实付金额"
  275. sortable
  276. prop="payAmount"
  277. min-width="100"
  278. show-overflow-tooltip
  279. >
  280. <template slot-scope="scope">
  281. {{ scope.row.payAmount | numToFixed }}
  282. </template>
  283. </el-table-column>
  284. <el-table-column
  285. align="center"
  286. label="返利类型"
  287. prop="customerWalletName2"
  288. min-width="100"
  289. show-overflow-tooltip
  290. >
  291. <template slot-scope="scope">
  292. <el-tag
  293. v-if="scope.row.customerWalletName2"
  294. type="success"
  295. size="small"
  296. >
  297. {{ scope.row.customerWalletName2 }}
  298. </el-tag>
  299. </template>
  300. </el-table-column>
  301. <el-table-column
  302. align="center"
  303. label="返利金额"
  304. sortable
  305. prop="payRebateAmount"
  306. min-width="100"
  307. show-overflow-tooltip
  308. >
  309. <template slot-scope="scope">
  310. <div>{{ scope.row.rebateAmount | numToFixed }}</div>
  311. <div>(实际:{{ scope.row.payRebateAmount | numToFixed }})</div>
  312. </template>
  313. </el-table-column>
  314. <el-table-column
  315. align="center"
  316. label="格力折扣"
  317. sortable
  318. prop="totalDiscAmount"
  319. min-width="100"
  320. show-overflow-tooltip
  321. >
  322. <template slot-scope="scope">
  323. {{ scope.row.totalDiscAmount | numToFixed }}
  324. </template></el-table-column>
  325. <el-table-column
  326. align="center"
  327. label="直调数量"
  328. prop="directTransferQty"
  329. min-width="100"
  330. show-overflow-tooltip
  331. />
  332. <el-table-column
  333. align="center"
  334. label="出库数量"
  335. prop="hasSendQty"
  336. min-width="100"
  337. show-overflow-tooltip
  338. />
  339. <el-table-column
  340. align="center"
  341. label="业务员"
  342. prop="k3ServiceName"
  343. min-width="100"
  344. show-overflow-tooltip
  345. />
  346. <el-table-column
  347. align="center"
  348. label="制表人"
  349. prop="createName"
  350. min-width="100"
  351. show-overflow-tooltip
  352. />
  353. <el-table-column
  354. align="center"
  355. label="制表日期"
  356. prop="createTime"
  357. min-width="160"
  358. show-overflow-tooltip
  359. />
  360. <el-table-column
  361. align="center"
  362. label="审核人"
  363. prop="examineName"
  364. min-width="100"
  365. show-overflow-tooltip
  366. />
  367. <el-table-column
  368. align="center"
  369. label="审核日期"
  370. prop="examineTime"
  371. min-width="160"
  372. show-overflow-tooltip
  373. />
  374. <el-table-column
  375. align="center"
  376. label="审核状态"
  377. prop="examineStatus"
  378. min-width="100"
  379. show-overflow-tooltip
  380. >
  381. <template slot-scope="scope">
  382. {{ scope.row.examineStatus | statusFilter }}
  383. </template>
  384. </el-table-column>
  385. <el-table-column
  386. align="center"
  387. label="操作"
  388. width="220"
  389. fixed="right"
  390. >
  391. <template slot-scope="scope">
  392. <el-popconfirm
  393. v-if="scope.row.examineStatus === 'SAVE'"
  394. style="margin-right: 10px"
  395. title="确定提审?"
  396. @onConfirm="handleSubmit(scope.row.id)"
  397. >
  398. <el-button slot="reference" type="text">提审</el-button>
  399. </el-popconfirm>
  400. <el-button
  401. v-if="
  402. scope.row.examineStatus == 'WAIT' &&
  403. $checkBtnRole('examine', $route.meta.roles)
  404. "
  405. type="text"
  406. @click="toExamine(scope.row)"
  407. >审核</el-button>
  408. <el-popconfirm v-if="$checkBtnRole('delete', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" style="margin-left: 10px;" title="确定删除吗?" @onConfirm="handleDelete(scope.row.id)">
  409. <el-button slot="reference" type="text">删除</el-button>
  410. </el-popconfirm>
  411. <el-button
  412. v-if="
  413. scope.row.examineStatus === 'SAVE' &&
  414. $checkBtnRole('edit', $route.meta.roles)
  415. "
  416. type="text"
  417. @click="toForm(scope.row)"
  418. >编辑</el-button>
  419. <el-popconfirm v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" style="margin-left: 10px;" title="确定弃审吗?" @onConfirm="handleAbandon(scope.row.id)">
  420. <el-button slot="reference" type="text">弃审</el-button>
  421. </el-popconfirm>
  422. <el-popconfirm
  423. v-if="
  424. scope.row.examineStatus == 'WAIT' &&
  425. $checkBtnRole('apply', $route.meta.roles)
  426. "
  427. style="margin-left: 10px"
  428. title="确定撤回?"
  429. @onConfirm="handleCancel(scope.row.id)"
  430. >
  431. <el-button slot="reference" type="text">撤回</el-button>
  432. </el-popconfirm>
  433. <el-button
  434. style="margin-left: 10px"
  435. type="text"
  436. @click="toDetail(scope.row)"
  437. >详情</el-button>
  438. <el-button
  439. v-if="
  440. scope.row.examineStatus === 'OK' &&
  441. $checkBtnRole('examine', $route.meta.roles)
  442. "
  443. type="text"
  444. @click="toReturn(scope.row)"
  445. >退订</el-button>
  446. <el-popconfirm
  447. v-if="
  448. scope.row.examineStatus === 'SAVE' &&
  449. $checkBtnRole('examine', $route.meta.roles)
  450. "
  451. style="margin-left: 10px"
  452. title="确定关闭吗?"
  453. @onConfirm="handleClose(scope.row.id)"
  454. >
  455. <el-button slot="reference" type="text">关闭</el-button>
  456. </el-popconfirm>
  457. </template>
  458. </el-table-column>
  459. </el-table>
  460. </div>
  461. </div>
  462. <div class="pagination clearfix">
  463. <div class="fr">
  464. <el-pagination
  465. :current-page="currentPage"
  466. :page-sizes="[10, 20, 30, 50,500]"
  467. :page-size="10"
  468. layout="total, sizes, prev, pager, next, jumper"
  469. :total="listTotal"
  470. @size-change="handleSizeChange"
  471. @current-change="handleCurrentChange"
  472. />
  473. </div>
  474. </div>
  475. </div>
  476. <RetailDetail
  477. v-if="isShowDetail"
  478. :list-item="queryItem"
  479. @backListFormDetail="backList"
  480. />
  481. <RetailForm
  482. v-if="isShowForm"
  483. :list-item="queryItem"
  484. @backListFormDetail="backList"
  485. />
  486. <RetailExamine
  487. v-if="isShowExamine"
  488. :list-item="queryItem"
  489. @backListFormDetail="backList"
  490. />
  491. <RetailReturn
  492. v-if="isShowReturn"
  493. :list-item="queryItem"
  494. @backListFormDetail="backList"
  495. />
  496. <EditDateDialog
  497. :is-show.sync="isShowEditDateDialog"
  498. :date-form.sync="dateForm"
  499. />
  500. </div>
  501. </template>
  502. <script>
  503. import { abandonData, closeData, deleteList, editData, getList, submitCancel, submitData } from '@/api/supply/policy'
  504. import RetailDetail from './components/retail_detail'
  505. import RetailForm from './components/retail_form'
  506. import RetailExamine from './components/retail_examine'
  507. import RetailReturn from './components/retail_return'
  508. import EditDateDialog from '@/components/Common/edit-date-dialog'
  509. import { getSalesmanList } from '@/api/common'
  510. let that
  511. export default {
  512. components: {
  513. RetailDetail,
  514. RetailForm,
  515. RetailExamine,
  516. RetailReturn,
  517. EditDateDialog
  518. },
  519. filters: {
  520. statusFilter(val) {
  521. const obj = that.statusList.find((o) => o.value == val)
  522. return obj ? obj.label : ''
  523. }
  524. },
  525. data() {
  526. return {
  527. currentPage: 1, // 当前页码
  528. pageSize: 10, // 每页数量
  529. listTotal: 0, // 列表总数
  530. dataList: null, // 列表数据
  531. listLoading: false, // 列表加载loading
  532. screenForm: {
  533. // 筛选表单数据
  534. orderNum: '',
  535. policyCode: '',
  536. policyRemark: '',
  537. jxsName: '',
  538. date: '',
  539. zbMan: '',
  540. shMan: '',
  541. status: '',
  542. salesMan:''
  543. },
  544. statusList: [
  545. { label: '已保存', value: 'SAVE' },
  546. { label: '待审核', value: 'WAIT' },
  547. { label: '审核通过', value: 'OK' },
  548. { label: '审核驳回', value: 'FAIL' }
  549. ],
  550. queryItem: {},
  551. isShowDetail: false,
  552. isShowForm: false,
  553. isShowExamine: false,
  554. isShowReturn: false,
  555. isShowEditDateDialog: false,
  556. dateForm: {
  557. date: ''
  558. },
  559. salesmanList:[]
  560. }
  561. },
  562. computed: {
  563. exParams() {
  564. return {
  565. examineStatus: this.screenForm.status,
  566. id: this.screenForm.orderNum,
  567. policyCode: this.screenForm.policyCode,
  568. policyRemark: this.screenForm.policyRemark,
  569. customer: this.screenForm.jxsName,
  570. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  571. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  572. createBy: this.screenForm.zbMan,
  573. examineBy: this.screenForm.shMan,
  574. type: 2 // 1:普通零售单,2:政策零售单
  575. }
  576. }
  577. },
  578. beforeCreate() {
  579. that = this
  580. },
  581. created() {
  582. this.getList()
  583. this.getSalesmanList();
  584. },
  585. methods: {
  586. // 获取业务员列表
  587. getSalesmanList() {
  588. getSalesmanList({
  589. pageNum: 1,
  590. pageSize: -1,
  591. isCustomer: 0,
  592. status: true,
  593. }).then(res => {
  594. this.salesmanList = res.data.records;
  595. })
  596. },
  597. // 查询按钮权限
  598. checkBtnRole(value) {
  599. // let btnRole = this.$route.meta.roles;
  600. // if(!btnRole) {return true}
  601. // let index = btnRole.indexOf(value);
  602. // return index >= 0;
  603. return true
  604. },
  605. handleDelete(id) {
  606. deleteList({ id }).then(res => {
  607. this.$successMsg('删除成功')
  608. })
  609. },
  610. // 查询列表
  611. getList() {
  612. this.listLoading = true
  613. const params = {
  614. pageNum: this.currentPage,
  615. pageSize: this.pageSize,
  616. examineStatus: this.screenForm.status,
  617. id: this.screenForm.orderNum,
  618. policyCode: this.screenForm.policyCode,
  619. policyRemark: this.screenForm.policyRemark,
  620. customer: this.screenForm.jxsName,
  621. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  622. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  623. createBy: this.screenForm.zbMan,
  624. status: true,
  625. examineBy: this.screenForm.shMan,
  626. serviceId:this.screenForm.salesMan,
  627. type: 2 // 1:普通零售单,2:政策零售单
  628. }
  629. getList(params).then((res) => {
  630. res.data.records.forEach(item => {
  631. item.sums1 = ['qty', 'directTransferQty', 'hasSendQty', 'refundableQty'];
  632. item.sums2 = ['price', 'payAmount', 'rebateAmount', 'payRebateAmount', 'totalDiscAmount'];
  633. })
  634. this.dataList = res.data.records
  635. this.listTotal = res.data.total
  636. this.listLoading = false
  637. })
  638. },
  639. // 提交筛选表单
  640. submitScreenForm() {
  641. this.currentPage = 1
  642. this.getList()
  643. },
  644. // 重置筛选表单
  645. resetScreenForm() {
  646. this.$refs.screenForm.resetFields()
  647. this.currentPage = 1
  648. this.getList()
  649. },
  650. // 更改每页数量
  651. handleSizeChange(val) {
  652. this.pageSize = val
  653. this.currentPage = 1
  654. this.getList()
  655. },
  656. // 更改当前页
  657. handleCurrentChange(val) {
  658. this.currentPage = val
  659. this.getList()
  660. },
  661. // 进入表单
  662. toForm(item) {
  663. this.queryItem = item
  664. this.isShowForm = true
  665. },
  666. // 进入详情
  667. toDetail(item) {
  668. this.queryItem = item
  669. this.isShowDetail = true
  670. },
  671. // 进入审批
  672. toExamine(item) {
  673. this.queryItem = item
  674. this.isShowExamine = true
  675. },
  676. // 进入退订
  677. toReturn(item) {
  678. this.queryItem = item
  679. this.isShowReturn = true
  680. },
  681. // 弃审
  682. handleAbandon(id) {
  683. abandonData({ id }).then(res => {
  684. this.$successMsg()
  685. this.getList()
  686. })
  687. },
  688. backList() {
  689. this.queryItem = {}
  690. this.isShowDetail = false
  691. this.isShowForm = false
  692. this.isShowExamine = false
  693. this.isShowReturn = false
  694. },
  695. // 关闭
  696. handleClose(id) {
  697. closeData({ id }).then((res) => {
  698. this.$successMsg()
  699. this.getList()
  700. })
  701. },
  702. // 提审
  703. handleSubmit(id) {
  704. submitData({ id }).then((res) => {
  705. this.$successMsg()
  706. this.getList()
  707. })
  708. },
  709. // 撤回
  710. handleCancel(id) {
  711. submitCancel({ id }).then((res) => {
  712. this.$successMsg()
  713. this.getList()
  714. })
  715. },
  716. // 打开 修改订单日期
  717. editDate(item) {
  718. this.editId = item.id
  719. this.dateForm.date = item.theTime.slice(0, 10)
  720. this.isShowEditDateDialog = true
  721. },
  722. // 提交 修改订单日期
  723. submitDateForm() {
  724. editData({
  725. id: this.editId,
  726. theTime: this.dateForm.date + ' 00:00:00'
  727. }).then((res) => {
  728. this.isShowEditDateDialog = false
  729. this.getList()
  730. this.$successMsg('修改成功')
  731. })
  732. }
  733. }
  734. }
  735. </script>
  736. <style lang="scss" scoped></style>