commerce_list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowForm && !isShowExamine && !isShowReturn">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <el-form ref="screenForm" :model="screenForm" label-width="100px" size="small" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="24" :lg="24">
  9. <el-form-item prop="status" label-width="0">
  10. <el-radio-group v-model="screenForm.status" size="medium" @change="getList()">
  11. <el-radio-button label="">全部</el-radio-button>
  12. <el-radio-button v-for="(item, index) in statusList" :key="index" :label="item.value">{{item.label}}</el-radio-button>
  13. </el-radio-group>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :xs="24" :sm="12" :lg="6">
  17. <el-form-item label="工程订单号" prop="orderNum">
  18. <el-input v-model="screenForm.orderNum" placeholder="请输入工程订单号"></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="6">
  22. <el-form-item label="工程编码" prop="enginNum">
  23. <el-input v-model="screenForm.enginNum" placeholder="请输入工程编码"></el-input>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :xs="24" :sm="12" :lg="6">
  27. <el-form-item label="工程登录单号" prop="loginNum">
  28. <el-input v-model="screenForm.loginNum" placeholder="请输入工程登录单号"></el-input>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xs="24" :sm="12" :lg="6">
  32. <el-form-item label="工程名称" prop="enginName">
  33. <el-input v-model="screenForm.enginName" placeholder="请输入工程名称"></el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :xs="24" :sm="12" :lg="6">
  37. <el-form-item label="单据日期" prop="date">
  38. <el-date-picker
  39. v-model="screenForm.date"
  40. type="datetimerange"
  41. range-separator="至"
  42. style="width: 100%;"
  43. value-format="yyyy-MM-dd HH:mm:ss"
  44. start-placeholder="开始日期"
  45. end-placeholder="结束日期">
  46. </el-date-picker>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="6">
  50. <el-form-item label="销售类型" prop="saleType">
  51. <el-input v-model="screenForm.saleType" placeholder="请输入销售类型"></el-input>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :xs="24" :sm="12" :lg="6">
  55. <el-form-item label="制表人" prop="createMan">
  56. <el-input v-model="screenForm.createMan" placeholder="请输入制表人"></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="6">
  60. <el-form-item label="审核人" prop="examineMan">
  61. <el-input v-model="screenForm.examineMan" placeholder="请输入审核人"></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="12" :lg="6">
  65. <el-form-item label="业务员" prop="salesMan">
  66. <el-select v-model="screenForm.salesMan" placeholder="选择业务员" size="small" clearable filterable style="width: 100%">
  67. <el-option
  68. v-for="item in salesmanList"
  69. :key="item.adminUserId"
  70. :label="item.nickName"
  71. :value="item.adminUserId">
  72. </el-option>
  73. </el-select>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  77. <el-form-item label="">
  78. <el-button size="small" @click="resetScreenForm">清空</el-button>
  79. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  80. </el-form-item>
  81. </el-col>
  82. </el-row>
  83. </el-form>
  84. </div>
  85. <div class="mymain-container">
  86. <div class="btn-group clearfix">
  87. <div class="fl">
  88. <el-button size="small" type="primary" icon="el-icon-plus" @click="toForm()" v-if="$checkBtnRole('add', $route.meta.roles)">新增</el-button>
  89. <el-button size="small" type="danger" icon="el-icon-minus" :disabled="multipleSelection.length < 1" @click="batchDelete()" v-if="$checkBtnRole('del', $route.meta.roles)">批量删除</el-button>
  90. </div>
  91. <div class="fr">
  92. <ExportButton :exUrl="'engin-order/export'" :exParams="exParams" />
  93. </div>
  94. </div>
  95. <div class="table">
  96. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="handleSelectionChange">
  97. <el-table-column align="center" type="selection" width="55"></el-table-column>
  98. <el-table-column align="center" label="审核状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  99. <template slot-scope="scope">
  100. {{scope.row.examineStatus | statusFilter}}
  101. </template>
  102. </el-table-column>
  103. <el-table-column align="center" label="工程订单号" prop="enginOrderNo" min-width="200" show-overflow-tooltip></el-table-column>
  104. <el-table-column align="center" label="订单日期" prop="orderDate" min-width="120" show-overflow-tooltip>
  105. <template slot-scope="scope">
  106. <div>
  107. <span>{{scope.row.orderDate | dateToDayFilter}}</span>
  108. <el-button type="text" icon="el-icon-edit" style="padding: 0; margin-left: 6px" @click="editDate(scope.row)" v-if="$checkBtnRole('date', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'WAIT')" ></el-button>
  109. </div>
  110. </template>
  111. </el-table-column>
  112. <el-table-column align="center" label="工程编码" prop="refProjectNo" min-width="160" show-overflow-tooltip></el-table-column>
  113. <el-table-column align="center" label="工程登录单号" prop="refEnginRecordNo" min-width="200" show-overflow-tooltip></el-table-column>
  114. <el-table-column align="center" label="订单类型" prop="enginOrderType" min-width="160" show-overflow-tooltip>
  115. <template slot-scope="scope">
  116. {{scope.row.enginOrderType | typeFilter}}
  117. </template>
  118. </el-table-column>
  119. <el-table-column align="center" label="使用单位" prop="refUseUnit" min-width="160" show-overflow-tooltip></el-table-column>
  120. <el-table-column align="center" label="工程名称" prop="refProjectName" min-width="160" show-overflow-tooltip></el-table-column>
  121. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
  122. <el-table-column align="center" label="货品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  123. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  124. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  125. <el-table-column align="right" label="总数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
  126. <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100" show-overflow-tooltip>
  127. <template slot-scope="scope">
  128. {{scope.row.isDirectTransfer ? '是':'否'}}
  129. </template>
  130. </el-table-column>
  131. <el-table-column align="right" label="直调数量" prop="directTransferQty" min-width="100" show-overflow-tooltip></el-table-column>
  132. <el-table-column align="right" label="出库数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
  133. <el-table-column align="right" label="单价" prop="enginPrice" min-width="100" show-overflow-tooltip>
  134. <template slot-scope="scope">
  135. {{scope.row.price | numToFixed}}
  136. </template>
  137. </el-table-column>
  138. <el-table-column align="right" label="金额" prop="enginTotality" min-width="100" show-overflow-tooltip>
  139. <template slot-scope="scope">
  140. {{scope.row.payAmount | numToFixed}}
  141. </template>
  142. </el-table-column>
  143. <el-table-column align="center" label="返利钱包" prop="customerWalletName2" min-width="140" show-overflow-tooltip></el-table-column>
  144. <el-table-column align="right" label="使用返利金额" prop="rebateAmount" min-width="120" show-overflow-tooltip>
  145. <template slot-scope="scope">
  146. <div v-if="scope.row.examineStatus === 'OK'">{{scope.row.payRebateAmount | numToFixed}}</div>
  147. <div v-else>{{scope.row.rebateAmount | numToFixed}}</div>
  148. </template>
  149. </el-table-column>
  150. <el-table-column align="center" label="业务员" prop="aaa" min-width="160" show-overflow-tooltip></el-table-column>
  151. <el-table-column align="center" label="制表人" prop="createName" min-width="100" show-overflow-tooltip></el-table-column>
  152. <el-table-column align="center" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  153. <el-table-column align="center" label="审核人" prop="confirmName" min-width="100" show-overflow-tooltip></el-table-column>
  154. <el-table-column align="center" label="审核日期" prop="confirmTime" min-width="160" show-overflow-tooltip></el-table-column>
  155. <el-table-column align="center" label="操作" width="220" fixed="right">
  156. <template slot-scope="scope">
  157. <el-popconfirm
  158. style="margin-right: 10px;"
  159. title="确定申请吗?"
  160. @onConfirm="handleSubmit(scope.row.parentId)"
  161. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'SAVE'" >
  162. <el-button slot="reference" type="text">申请</el-button>
  163. </el-popconfirm>
  164. <el-popconfirm
  165. style="margin-right: 10px;"
  166. title="确定撤回吗?"
  167. @onConfirm="handleWithdraw(scope.row.parentId)"
  168. v-if="$checkBtnRole('apply', $route.meta.roles) && scope.row.examineStatus === 'WAIT'" >
  169. <el-button slot="reference" type="text">撤回</el-button>
  170. </el-popconfirm>
  171. <el-popconfirm
  172. style="margin-right: 10px;"
  173. title="确定弃审吗?"
  174. @onConfirm="handleAbandon(scope.row.parentId)"
  175. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  176. <el-button slot="reference" type="text">弃审</el-button>
  177. </el-popconfirm>
  178. <el-button
  179. type="text"
  180. @click="toForm(scope.row)"
  181. v-if="$checkBtnRole('edit', $route.meta.roles) && scope.row.examineStatus === 'SAVE'">
  182. 编辑
  183. </el-button>
  184. <el-button
  185. type="text"
  186. @click="toExamine(scope.row)"
  187. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  188. 审批
  189. </el-button>
  190. <el-button
  191. type="text"
  192. @click="toReturn(scope.row)"
  193. v-if="$checkBtnRole('examine', $route.meta.roles)">
  194. 退订
  195. </el-button>
  196. <el-button
  197. type="text"
  198. @click="toDetail(scope.row)">
  199. 详情
  200. </el-button>
  201. <el-popconfirm
  202. style="margin-left: 10px;"
  203. title="确定删除吗?"
  204. @onConfirm="handleDelete(scope.row.parentId)"
  205. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus !== 'OK'">
  206. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  207. </el-popconfirm>
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. </div>
  212. </div>
  213. <div class="pagination clearfix">
  214. <div class="fr">
  215. <el-pagination
  216. @size-change="handleSizeChange"
  217. @current-change="handleCurrentChange"
  218. :current-page="currentPage"
  219. :page-sizes="[10, 20, 30, 50]"
  220. :page-size="10"
  221. layout="total, sizes, prev, pager, next, jumper"
  222. :total="listTotal">
  223. </el-pagination>
  224. </div>
  225. </div>
  226. </div>
  227. <EditDateDialog :isShow.sync="isShowEditDateDialog" :dateForm.sync="dateForm" />
  228. <CommerceDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  229. <CommerceForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  230. <CommerceExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  231. <CommerceReturn :listItem="queryItem" v-if="isShowReturn" @backListFormDetail="backList" />
  232. </div>
  233. </template>
  234. <script>
  235. import { getOrderList, applyCom, withdrawCom, deleteCom, editDateCom, abandonCom } from "@/api/supply/engin";
  236. import { getSalesmanList } from '@/api/common'
  237. import CommerceDetail from "@/views/supply/engin/components/commerce_detail";
  238. import CommerceForm from "@/views/supply/engin/components/commerce_form";
  239. import CommerceExamine from "@/views/supply/engin/components/commerce_examine";
  240. import CommerceReturn from "@/views/supply/engin/components/commerce_return";
  241. import EditDateDialog from "@/components/Common/edit-date-dialog";
  242. let that
  243. export default {
  244. components: {
  245. CommerceDetail,
  246. CommerceForm,
  247. CommerceExamine,
  248. CommerceReturn,
  249. EditDateDialog,
  250. },
  251. filters: {
  252. statusFilter(val) {
  253. let obj = that.statusList.find(o => o.value == val);
  254. return obj ? obj.label : ''
  255. },
  256. typeFilter(val) {
  257. const MAP = {
  258. TRADE: '商用',
  259. HOME: '家用',
  260. }
  261. return MAP[val];
  262. }
  263. },
  264. data() {
  265. return {
  266. currentPage: 1, // 当前页码
  267. pageSize: 10, // 每页数量
  268. listTotal: 0, // 列表总数
  269. dataList: null, // 列表数据
  270. listLoading: false, // 列表加载loading
  271. screenForm: { // 筛选表单数据
  272. status: '',
  273. orderNum: '',
  274. enginNum: '',
  275. loginNum: '',
  276. enginName: '',
  277. date: '',
  278. saleType: '',
  279. createMan: '',
  280. examineMan: '',
  281. salesMan: '',
  282. },
  283. statusList: [
  284. { label: '已保存', value: 'SAVE' },
  285. { label: '待审核', value: 'WAIT' },
  286. { label: '审核通过', value: 'OK' },
  287. { label: '审核驳回', value: 'FAIL' },
  288. { label: '已关闭', value: 'CLOSE' },
  289. ],
  290. salesmanList: [],
  291. multipleSelection: [],
  292. queryItem: {},
  293. isShowDetail: false,
  294. isShowForm: false,
  295. isShowExamine: false,
  296. isShowReturn: false,
  297. editId: null,
  298. isShowEditDateDialog: false,
  299. dateForm: {
  300. date: '',
  301. },
  302. }
  303. },
  304. computed: {
  305. exParams() {
  306. return {
  307. examineStatus: this.screenForm.status,
  308. enginOrderNo: this.screenForm.orderNum,
  309. refProjectNo: this.screenForm.enginNum,
  310. refEnginRecordNo: this.screenForm.loginNum,
  311. refProjectName: this.screenForm.enginName,
  312. startCreateTime: this.screenForm.date ? this.screenForm.date[0] : '',
  313. endCreateTime: this.screenForm.date ? this.screenForm.date[1] : '',
  314. saleTypeId: this.screenForm.saleType,
  315. createName: this.screenForm.createMan,
  316. confirmName: this.screenForm.examineMan,
  317. serviceId: this.screenForm.salesMan,
  318. enginOrderType: 'TRADE', // TRADE=商用 HOME=家用
  319. }
  320. },
  321. },
  322. beforeCreate() {
  323. that = this;
  324. },
  325. created() {
  326. this.getSalesmanList();
  327. this.getList();
  328. },
  329. methods: {
  330. // 获取业务员列表
  331. getSalesmanList() {
  332. getSalesmanList({
  333. pageNum: 1,
  334. pageSize: -1,
  335. isCustomer: 0,
  336. status: true,
  337. }).then(res => {
  338. this.salesmanList = res.data.records;
  339. })
  340. },
  341. // 查询列表
  342. getList() {
  343. this.listLoading = true;
  344. let params = {
  345. pageNum: this.currentPage,
  346. pageSize: this.pageSize,
  347. examineStatus: this.screenForm.status,
  348. enginOrderNo: this.screenForm.orderNum,
  349. refProjectNo: this.screenForm.enginNum,
  350. refEnginRecordNo: this.screenForm.loginNum,
  351. refProjectName: this.screenForm.enginName,
  352. startCreateTime: this.screenForm.date ? this.screenForm.date[0] : '',
  353. endCreateTime: this.screenForm.date ? this.screenForm.date[1] : '',
  354. saleTypeId: this.screenForm.saleType,
  355. createName: this.screenForm.createMan,
  356. confirmName: this.screenForm.examineMan,
  357. serviceId: this.screenForm.salesMan,
  358. enginOrderType: 'TRADE', // TRADE=商用 HOME=家用
  359. };
  360. getOrderList(params).then((res) => {
  361. this.dataList = res.data.records;
  362. this.listTotal = res.data.total;
  363. this.listLoading = false;
  364. })
  365. },
  366. // 提交筛选表单
  367. submitScreenForm() {
  368. this.currentPage = 1;
  369. this.getList();
  370. },
  371. // 重置筛选表单
  372. resetScreenForm() {
  373. this.$refs.screenForm.resetFields();
  374. this.currentPage = 1;
  375. this.getList();
  376. },
  377. // 更改每页数量
  378. handleSizeChange(val) {
  379. this.pageSize = val;
  380. this.currentPage = 1;
  381. this.getList();
  382. },
  383. // 更改当前页
  384. handleCurrentChange(val) {
  385. this.currentPage = val;
  386. this.getList();
  387. },
  388. // 进入表单
  389. toForm(item) {
  390. this.queryItem = item;
  391. this.isShowForm = true;
  392. },
  393. // 进入审批
  394. toExamine(item) {
  395. this.queryItem = item;
  396. this.isShowExamine = true;
  397. },
  398. // 进入详情
  399. toDetail(item) {
  400. this.queryItem = item;
  401. this.isShowDetail = true;
  402. },
  403. // 进入退订
  404. toReturn(item) {
  405. this.queryItem = item;
  406. this.isShowReturn = true;
  407. },
  408. backList() {
  409. this.queryItem = {};
  410. this.isShowDetail = false;
  411. this.isShowForm = false;
  412. this.isShowExamine = false;
  413. this.isShowReturn = false;
  414. },
  415. // 申请
  416. handleSubmit(id) {
  417. applyCom({id}).then(res => {
  418. this.$successMsg();
  419. this.getList();
  420. })
  421. },
  422. // 撤回
  423. handleWithdraw(id) {
  424. withdrawCom({id}).then(res => {
  425. this.$successMsg();
  426. this.getList();
  427. })
  428. },
  429. // 弃审
  430. handleAbandon(id) {
  431. abandonCom({id}).then(res => {
  432. this.$successMsg();
  433. this.getList();
  434. })
  435. },
  436. // 删除
  437. handleDelete(id) {
  438. deleteCom({ids: id}).then(res => {
  439. this.$successMsg();
  440. this.getList();
  441. })
  442. },
  443. // 批量删除
  444. batchDelete() {
  445. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  446. confirmButtonText: '确定',
  447. cancelButtonText: '取消',
  448. type: 'warning'
  449. }).then(() => {
  450. let ids = this.multipleSelection.map(item => {
  451. return item.parentId;
  452. });
  453. deleteCom({ids: ids.join(',')}).then(res => {
  454. this.$successMsg();
  455. this.getList();
  456. })
  457. }).catch(() => {});
  458. },
  459. handleSelectionChange(val) {
  460. this.multipleSelection = val;
  461. },
  462. // 打开 修改订单日期
  463. editDate(item) {
  464. this.editId = item.parentId;
  465. this.dateForm.date = item.orderDate.slice(0, 10);
  466. this.isShowEditDateDialog = true;
  467. },
  468. // 提交 修改订单日期
  469. submitDateForm() {
  470. editDateCom({
  471. enginOrderId: this.editId,
  472. orderDate: this.dateForm.date + ' 00:00:00',
  473. }).then(res => {
  474. this.isShowEditDateDialog = false;
  475. this.getList();
  476. this.$successMsg('修改成功');
  477. })
  478. },
  479. }
  480. }
  481. </script>
  482. <style lang="scss" scoped>
  483. </style>