home_list.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  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="remark" min-width="160" show-overflow-tooltip></el-table-column>
  196. <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>
  197. <el-table-column align="left" label="制表人" prop="createBy" min-width="100" show-overflow-tooltip></el-table-column>
  198. <el-table-column align="left" label="制表日期" prop="createTime" min-width="160" show-overflow-tooltip></el-table-column>
  199. <el-table-column align="left" label="审核人" prop="confirmBy" min-width="100" show-overflow-tooltip></el-table-column>
  200. <el-table-column align="left" label="审核日期" prop="confirmTime" min-width="160" show-overflow-tooltip></el-table-column>
  201. <el-table-column align="center" label="操作" width="220" fixed="right">
  202. <template slot-scope="scope">
  203. <el-popconfirm
  204. style="margin-right: 10px;"
  205. title="确定申请吗?"
  206. @onConfirm="handleSubmit(scope.row.parentId)"
  207. v-if="scope.row.examineStatus === 'SAVE'" >
  208. <el-button slot="reference" type="text">申请</el-button>
  209. </el-popconfirm>
  210. <el-popconfirm
  211. style="margin-right: 10px;"
  212. title="确定撤回吗?"
  213. @onConfirm="handleWithdraw(scope.row.parentId)"
  214. v-if="scope.row.examineStatus === 'WAIT'" >
  215. <el-button slot="reference" type="text">撤回</el-button>
  216. </el-popconfirm>
  217. <el-popconfirm
  218. style="margin-right: 10px;"
  219. title="确定弃审吗?"
  220. @onConfirm="handleAbandon(scope.row.parentId)"
  221. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  222. <el-button slot="reference" type="text">弃审</el-button>
  223. </el-popconfirm>
  224. <el-button
  225. type="text"
  226. @click="toForm(scope.row)"
  227. v-if="$checkBtnRole('edit', $route.meta.roles) && (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL')">
  228. 编辑
  229. </el-button>
  230. <el-button
  231. type="text"
  232. @click="toExamine(scope.row)"
  233. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">
  234. 审批
  235. </el-button>
  236. <el-button
  237. type="text"
  238. @click="toReturn(scope.row)"
  239. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus !== 'FAIL'">
  240. 退订
  241. </el-button>
  242. <el-button
  243. type="text"
  244. @click="toDetail(scope.row)">
  245. 详情
  246. </el-button>
  247. <el-popconfirm
  248. style="margin-left: 10px;"
  249. title="确定删除吗?"
  250. @onConfirm="handleDelete(scope.row.parentId)"
  251. v-if="$checkBtnRole('del', $route.meta.roles) && scope.row.examineStatus !== 'OK'">
  252. <el-button slot="reference" type="text" style="color: #f56c6c;">删除</el-button>
  253. </el-popconfirm>
  254. </template>
  255. </el-table-column>
  256. </el-table>
  257. </div>
  258. </div>
  259. <div class="pagination clearfix">
  260. <div class="fr">
  261. <el-pagination
  262. @size-change="handleSizeChange"
  263. @current-change="handleCurrentChange"
  264. :current-page="currentPage"
  265. :page-sizes="[10, 20, 30, 50, 500]"
  266. :page-size="10"
  267. layout="total, sizes, prev, pager, next, jumper"
  268. :total="listTotal">
  269. </el-pagination>
  270. </div>
  271. </div>
  272. </div>
  273. <EditDateDialog :isShow.sync="isShowEditDateDialog" :dateForm.sync="dateForm" />
  274. <HomeDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  275. <HomeForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  276. <HomeExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  277. <HomeReturn :listItem="queryItem" v-if="isShowReturn" @backListFormDetail="backList" />
  278. </div>
  279. </template>
  280. <script>
  281. import { getOrderList, applyHome, withdrawHome, deleteHome, editDateHome, abandonHome } from "@/api/supply/engin";
  282. import { getSalesmanList } from '@/api/common'
  283. import HomeDetail from "@/views/supply/engin/components/home_detail";
  284. import HomeForm from "@/views/supply/engin/components/home_form";
  285. import HomeExamine from "@/views/supply/engin/components/home_examine";
  286. import HomeReturn from "@/views/supply/engin/components/home_return";
  287. import EditDateDialog from "@/components/Common/edit-date-dialog";
  288. let that
  289. export default {
  290. components: {
  291. HomeDetail,
  292. HomeForm,
  293. HomeExamine,
  294. HomeReturn,
  295. EditDateDialog,
  296. },
  297. filters: {
  298. statusFilter(val) {
  299. let obj = that.statusList.find(o => o.value == val);
  300. return obj ? obj.label : ''
  301. },
  302. typeFilter(val) {
  303. const MAP = {
  304. TRADE: '商用',
  305. HOME: '家用',
  306. }
  307. return MAP[val];
  308. }
  309. },
  310. data() {
  311. return {
  312. currentPage: 1, // 当前页码
  313. pageSize: 10, // 每页数量
  314. listTotal: 0, // 列表总数
  315. dataList: null, // 列表数据
  316. listLoading: false, // 列表加载loading
  317. screenForm: { // 筛选表单数据
  318. status: [],
  319. orderNum: '',
  320. enginNum: '',
  321. loginNum: '',
  322. enginName: '',
  323. date: '',
  324. saleType: '',
  325. createMan: '',
  326. examineMan: '',
  327. salesMan: '',
  328. },
  329. statusList: [
  330. { label: '已保存', value: 'SAVE' },
  331. { label: '待审核', value: 'WAIT' },
  332. { label: '审核通过', value: 'OK' },
  333. { label: '审核驳回', value: 'FAIL' },
  334. { label: '已关闭', value: 'CLOSE' },
  335. ],
  336. salesmanList: [],
  337. multipleSelection: [],
  338. queryItem: {},
  339. isShowDetail: false,
  340. isShowForm: false,
  341. isShowExamine: false,
  342. isShowReturn: false,
  343. editId: null,
  344. isShowEditDateDialog: false,
  345. dateForm: {
  346. date: '',
  347. },
  348. }
  349. },
  350. computed: {
  351. exParams() {
  352. let ids = this.multipleSelection.map(item => {
  353. return item.enginOrderNo;
  354. });
  355. return {
  356. examineStatus: this.screenForm.status.join(','),
  357. enginOrderNo: (ids && ids.length) ? ids.join(',') : this.screenForm.orderNum,
  358. refProjectNo: this.screenForm.enginNum,
  359. refEnginRecordNo: this.screenForm.loginNum,
  360. refProjectName: this.screenForm.enginName,
  361. startCreateTime: this.screenForm.date ? this.screenForm.date[0] : '',
  362. endCreateTime: this.screenForm.date ? this.screenForm.date[1] : '',
  363. saleTypeId: this.screenForm.saleType,
  364. createName: this.screenForm.createMan,
  365. confirmName: this.screenForm.examineMan,
  366. serviceId: this.screenForm.salesMan,
  367. enginOrderType: 'HOME', // TRADE=商用 HOME=家用
  368. }
  369. },
  370. },
  371. beforeCreate() {
  372. that = this;
  373. },
  374. created() {
  375. this.getSalesmanList();
  376. this.getList();
  377. },
  378. methods: {
  379. // 获取业务员列表
  380. getSalesmanList() {
  381. getSalesmanList({
  382. pageNum: 1,
  383. pageSize: -1,
  384. isCustomer: 0,
  385. status: true,
  386. }).then(res => {
  387. this.salesmanList = res.data.records;
  388. })
  389. },
  390. // 查询列表
  391. getList() {
  392. this.listLoading = true;
  393. let params = {
  394. pageNum: this.currentPage,
  395. pageSize: this.pageSize,
  396. examineStatus: this.screenForm.status.join(','),
  397. enginOrderNo: this.screenForm.orderNum,
  398. refProjectNo: this.screenForm.enginNum,
  399. refEnginRecordNo: this.screenForm.loginNum,
  400. refProjectName: this.screenForm.enginName,
  401. startCreateTime: this.screenForm.date ? this.screenForm.date[0] : '',
  402. endCreateTime: this.screenForm.date ? this.screenForm.date[1] : '',
  403. saleTypeId: this.screenForm.saleType,
  404. createName: this.screenForm.createMan,
  405. confirmName: this.screenForm.examineMan,
  406. serviceId: this.screenForm.salesMan,
  407. enginOrderType: 'HOME', // TRADE=商用 HOME=家用
  408. };
  409. getOrderList(params).then((res) => {
  410. res.data.records.forEach(item => {
  411. item.sums1 = ['qty', 'directTransferQty', 'hasSendQty'];
  412. item.sums2 = ['price', 'payAmount', 'discAmount'];
  413. })
  414. this.dataList = res.data.records;
  415. this.listTotal = res.data.total;
  416. this.listLoading = false;
  417. })
  418. },
  419. // 提交筛选表单
  420. submitScreenForm() {
  421. this.currentPage = 1;
  422. this.getList();
  423. },
  424. // 重置筛选表单
  425. resetScreenForm() {
  426. this.$refs.screenForm.resetFields();
  427. this.currentPage = 1;
  428. this.getList();
  429. },
  430. // 更改每页数量
  431. handleSizeChange(val) {
  432. this.pageSize = val;
  433. this.currentPage = 1;
  434. this.getList();
  435. },
  436. // 更改当前页
  437. handleCurrentChange(val) {
  438. this.currentPage = val;
  439. this.getList();
  440. },
  441. // 进入表单
  442. toForm(item) {
  443. this.queryItem = item;
  444. this.isShowForm = true;
  445. },
  446. // 进入审批
  447. toExamine(item) {
  448. this.queryItem = item;
  449. this.isShowExamine = true;
  450. },
  451. // 进入详情
  452. toDetail(item) {
  453. this.queryItem = item;
  454. this.isShowDetail = true;
  455. },
  456. // 进入退订
  457. toReturn(item) {
  458. if(item.refundableQty <= 0) {
  459. return this.$errorMsg('可退数量为0');
  460. }
  461. this.queryItem = item;
  462. this.isShowReturn = true;
  463. },
  464. backList() {
  465. this.queryItem = {};
  466. this.isShowDetail = false;
  467. this.isShowForm = false;
  468. this.isShowExamine = false;
  469. this.isShowReturn = false;
  470. },
  471. // 申请
  472. handleSubmit(id) {
  473. applyHome({id}).then(res => {
  474. this.$successMsg();
  475. this.getList();
  476. })
  477. },
  478. // 撤回
  479. handleWithdraw(id) {
  480. withdrawHome({id}).then(res => {
  481. this.$successMsg();
  482. this.getList();
  483. })
  484. },
  485. // 弃审
  486. handleAbandon(id) {
  487. abandonHome({id}).then(res => {
  488. this.$successMsg();
  489. this.getList();
  490. })
  491. },
  492. // 删除
  493. handleDelete(id) {
  494. deleteHome({ids: id}).then(res => {
  495. this.$successMsg();
  496. this.getList();
  497. })
  498. },
  499. // 批量删除
  500. batchDelete() {
  501. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  502. confirmButtonText: '确定',
  503. cancelButtonText: '取消',
  504. type: 'warning'
  505. }).then(() => {
  506. let ids = this.multipleSelection.map(item => {
  507. return item.parentId;
  508. });
  509. deleteHome({ids: ids.join(',')}).then(res => {
  510. this.$successMsg();
  511. this.getList();
  512. })
  513. }).catch(() => {});
  514. },
  515. handleSelectionChange(val) {
  516. this.multipleSelection = val;
  517. },
  518. // 打开 修改订单日期
  519. editDate(item) {
  520. this.editId = item.parentId;
  521. this.dateForm.date = item.orderDate.slice(0, 10);
  522. this.isShowEditDateDialog = true;
  523. },
  524. // 提交 修改订单日期
  525. submitDateForm() {
  526. editDateHome({
  527. enginOrderId: this.editId,
  528. orderDate: this.dateForm.date + ' 00:00:00',
  529. }).then(res => {
  530. this.isShowEditDateDialog = false;
  531. this.getList();
  532. this.$successMsg('修改成功');
  533. })
  534. },
  535. }
  536. }
  537. </script>
  538. <style lang="scss" scoped>
  539. </style>