home_list.vue 22 KB

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