commerce_list.vue 19 KB

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