displace_list copy.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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="85px" size="mini" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="12" :lg="6">
  9. <el-form-item label="订单号" prop="orderNum">
  10. <el-input v-model="screenForm.orderNum" placeholder="请输入订单号"></el-input>
  11. </el-form-item>
  12. </el-col>
  13. <el-col :xs="24" :sm="12" :lg="6">
  14. <el-form-item label="原订单号" prop="originOrderNo">
  15. <el-input v-model="screenForm.originOrderNo" placeholder="请输入原订单号"></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :xs="24" :sm="12" :lg="6">
  19. <el-form-item label="经销商名称" prop="customerKeyword">
  20. <el-input v-model="screenForm.customerKeyword" placeholder="请输入经销商名称"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :xs="24" :sm="12" :lg="6">
  24. <el-form-item label="产品名称" prop="productName">
  25. <el-input v-model="screenForm.productName" placeholder="请输入产品名称"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :xs="24" :sm="12" :lg="6">
  29. <el-form-item label="订单日期" prop="date">
  30. <el-date-picker
  31. v-model="screenForm.date"
  32. type="datetimerange"
  33. :default-time="['00:00:00','23:59:59']"
  34. range-separator="至"
  35. style="width: 100%"
  36. value-format="yyyy-MM-dd HH:mm:ss"
  37. start-placeholder="开始日期"
  38. end-placeholder="结束日期"
  39. >
  40. </el-date-picker>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :xs="24" :sm="12" :lg="6">
  44. <el-form-item label="申请人" prop="createName">
  45. <el-input v-model="screenForm.createName" placeholder="请输入申请人"></el-input>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :xs="24" :sm="12" :lg="6">
  49. <el-form-item label="审核人" prop="confirmName">
  50. <el-input v-model="screenForm.confirmName" 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="orderType">
  55. <el-select v-model="screenForm.orderType" placeholder="选择订单类型" style="width: 100%">
  56. <el-option label="全部" value="" />
  57. <el-option
  58. v-for="item in orderType"
  59. :key="item.val"
  60. :label="item.label"
  61. :value="item.val"
  62. ></el-option>
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  67. <el-form-item label="">
  68. <el-button @click="resetScreenForm">清空</el-button>
  69. <el-button type="primary" @click="submitScreenForm">搜索</el-button>
  70. </el-form-item>
  71. </el-col>
  72. </el-row>
  73. </el-form>
  74. </div>
  75. <div class="mymain-container">
  76. <div class="btn-group clearfix">
  77. <div class="fl">
  78. <el-button size="mini" type="primary" icon="el-icon-plus" @click="toForm()">新增</el-button>
  79. </div>
  80. <div class="fr">
  81. <ExportButton :exUrl="'admin/user/mch/export'" :exParams="exParams" />
  82. </div>
  83. </div>
  84. <div class="table">
  85. <el-table
  86. v-loading="listLoading"
  87. :data="dataList"
  88. element-loading-text="Loading"
  89. border
  90. fit
  91. highlight-current-row
  92. stripe
  93. >
  94. <el-table-column align="left" label="订单号" prop="displaceOrderId" min-width="160" show-overflow-tooltip>
  95. <template slot-scope="scope">
  96. <CopyButton :copyText="scope.row.displaceOrderId" />
  97. <span>{{ scope.row.displaceOrderId }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. align="left"
  102. label="订单日期"
  103. prop="orderDate"
  104. min-width="160"
  105. show-overflow-tooltip
  106. ></el-table-column>
  107. <el-table-column align="left" label="原订单号" prop="orderNo" min-width="160" show-overflow-tooltip>
  108. <template slot-scope="scope">
  109. <CopyButton :copyText="scope.row.orderNo" />
  110. <span>{{ scope.row.orderNo }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="left" label="订单类型" min-width="160" show-overflow-tooltip>
  114. <template slot-scope="{ row }">
  115. {{ findOrderType(row.orderType) }}
  116. </template>
  117. </el-table-column>
  118. <el-table-column
  119. align="left"
  120. label="经销商编码"
  121. prop="customerNumber"
  122. min-width="100"
  123. show-overflow-tooltip
  124. >
  125. <template slot-scope="scope">
  126. <CopyButton :copyText="scope.row.customerNumber" />
  127. <span>{{ scope.row.customerNumber }}</span>
  128. </template>
  129. </el-table-column>
  130. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
  131. <template slot-scope="scope">
  132. <CopyButton :copyText="scope.row.customerName" />
  133. <span>{{ scope.row.customerName }}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column align="left" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip>
  137. <template slot-scope="scope">
  138. <CopyButton :copyText="scope.row.materialNumber" />
  139. <span>{{ scope.row.materialNumber }}</span>
  140. </template>
  141. </el-table-column>
  142. <el-table-column
  143. align="left"
  144. label="产品编码"
  145. prop="materialOldNumber"
  146. min-width="140"
  147. show-overflow-tooltip
  148. >
  149. <template slot-scope="scope">
  150. <CopyButton :copyText="scope.row.materialOldNumber" />
  151. <span>{{ scope.row.materialOldNumber }}</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  155. <template slot-scope="scope">
  156. <CopyButton :copyText="scope.row.materialName" />
  157. <span>{{ scope.row.materialName }}</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  161. <template slot-scope="scope">
  162. <CopyButton :copyText="scope.row.specification" />
  163. <span>{{ scope.row.specification }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. align="left"
  168. label="业务员"
  169. prop="serviceName"
  170. min-width="100"
  171. show-overflow-tooltip
  172. ></el-table-column>
  173. <el-table-column
  174. align="left"
  175. label="申请人"
  176. prop="createName"
  177. min-width="100"
  178. show-overflow-tooltip
  179. ></el-table-column>
  180. <el-table-column
  181. align="left"
  182. label="申请日期"
  183. prop="createTime"
  184. min-width="160"
  185. show-overflow-tooltip
  186. ></el-table-column>
  187. <el-table-column
  188. align="left"
  189. label="审核人"
  190. prop="confirmName"
  191. min-width="100"
  192. show-overflow-tooltip
  193. ></el-table-column>
  194. <el-table-column
  195. align="left"
  196. label="审核日期"
  197. prop="confirmTime"
  198. min-width="160"
  199. show-overflow-tooltip
  200. ></el-table-column>
  201. <el-table-column align="left" label="审核状态" min-width="100" show-overflow-tooltip>
  202. <template slot-scope="{ row }">
  203. {{ findExamineStatus(row.examineStatus) }}
  204. </template>
  205. </el-table-column>
  206. <el-table-column align="center" label="操作" width="160" fixed="right">
  207. <template slot-scope="scope">
  208. <el-popconfirm
  209. style="margin-right: 10px"
  210. title="确定撤回吗?"
  211. @onConfirm="handleWithdraw(scope.row.displaceOrderId)"
  212. v-if="scope.row.examineStatus === 'WAIT'"
  213. >
  214. <el-button slot="reference" type="text">撤回</el-button>
  215. </el-popconfirm>
  216. <el-button type="text" @click="toForm(scope.row)" v-if="scope.row.examineStatus === 'SAVE'"
  217. >编辑</el-button
  218. >
  219. <el-button type="text" @click="toExamine(scope.row)" v-if="scope.row.examineStatus === 'WAIT'"
  220. >审批</el-button
  221. >
  222. <el-button type="text" @click="toReturn(scope.row)" v-if="scope.row.examineStatus === 'OK'"
  223. >退订</el-button
  224. >
  225. <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
  226. <el-popconfirm
  227. style="margin-left: 10px"
  228. title="确定提审吗?"
  229. @onConfirm="handleSubmit(scope.row.displaceOrderId)"
  230. v-if="scope.row.examineStatus === 'SAVE'"
  231. >
  232. <el-button slot="reference" type="text">提审</el-button>
  233. </el-popconfirm>
  234. <el-popconfirm
  235. style="margin-left: 10px"
  236. title="确定删除吗?"
  237. @onConfirm="handleDelete(scope.row.displaceOrderId)"
  238. >
  239. <el-button slot="reference" type="text">删除</el-button>
  240. </el-popconfirm>
  241. </template>
  242. </el-table-column>
  243. </el-table>
  244. </div>
  245. </div>
  246. <div class="pagination clearfix">
  247. <div class="fr">
  248. <el-pagination
  249. @size-change="handleSizeChange"
  250. @current-change="handleCurrentChange"
  251. :current-page="currentPage"
  252. :page-sizes="[10, 20, 30, 50]"
  253. :page-size="10"
  254. layout="total, sizes, prev, pager, next, jumper"
  255. :total="listTotal"
  256. >
  257. </el-pagination>
  258. </div>
  259. </div>
  260. </div>
  261. <DisplaceDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  262. <DisplaceForm :listItem="queryItem" v-if="isShowForm" @backListFormDetail="backList" />
  263. <DisplaceExamine :listItem="queryItem" v-if="isShowExamine" @backListFormDetail="backList" />
  264. <DisplaceReturn :listItem="queryItem" v-if="isShowReturn" @backListFormDetail="backList" />
  265. </div>
  266. </template>
  267. <script>
  268. import { deleteOrder, getList, revokeOrder, submitData } from '@/api/supply/displace'
  269. import DisplaceDetail from '@/views/supply/displace/components/displace_detail'
  270. import DisplaceForm from '@/views/supply/displace/components/displace_form'
  271. import DisplaceExamine from '@/views/supply/displace/components/displace_examine'
  272. import DisplaceReturn from '@/views/supply/displace/components/displace_return'
  273. export default {
  274. components: {
  275. DisplaceDetail,
  276. DisplaceForm,
  277. DisplaceExamine,
  278. DisplaceReturn
  279. },
  280. data() {
  281. return {
  282. currentPage: 1, // 当前页码
  283. pageSize: 10, // 每页数量
  284. listTotal: 0, // 列表总数
  285. dataList: null, // 列表数据
  286. listLoading: false, // 列表加载loading
  287. screenForm: {
  288. // 筛选表单数据
  289. orderNum: '',
  290. originOrderNo: '',
  291. customerKeyword: '',
  292. productName: '',
  293. date: '',
  294. createName: '',
  295. confirmName: '',
  296. orderType: ''
  297. },
  298. queryItem: {},
  299. isShowDetail: false,
  300. isShowForm: false,
  301. isShowExamine: false,
  302. isShowReturn: false,
  303. orderType: [
  304. { label: '商用工程', val: 'TRADE' },
  305. { label: '家用工程', val: 'HOME' },
  306. { label: '零售订单', val: 'RETAIL' },
  307. { label: '销售政策单', val: 'RETAIL_POLICY' }
  308. ],
  309. examineStatus: [
  310. { label: '保存', val: 'SAVE' },
  311. { label: '待审核', val: 'WAIT' },
  312. { label: '通过', val: 'OK' },
  313. { label: '不通过', val: 'FAIL' },
  314. { label: '关闭', val: 'CLOSE' }
  315. ]
  316. }
  317. },
  318. computed: {
  319. exParams() {
  320. return {
  321. retreatOrderNo: this.screenForm.orderNum,
  322. customerKeyword: this.screenForm.jxsNum,
  323. productName: this.screenForm.chName,
  324. specification: this.screenForm.model,
  325. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  326. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  327. status: 1 // 1:退货单,2:电商退货单
  328. }
  329. }
  330. },
  331. created() {
  332. this.getList()
  333. },
  334. methods: {
  335. // 查询按钮权限
  336. checkBtnRole(value) {
  337. // let btnRole = this.$route.meta.roles;
  338. // if(!btnRole) {return true}
  339. // let index = btnRole.indexOf(value);
  340. // return index >= 0;
  341. return true
  342. },
  343. // 查询列表
  344. getList() {
  345. this.listLoading = true
  346. let params = {
  347. pageNum: this.currentPage,
  348. pageSize: this.pageSize,
  349. displaceOrderId: this.screenForm.orderNum,
  350. originOrderNo: this.screenForm.originOrderNo,
  351. customerKeyword: this.screenForm.customerKeyword,
  352. productName: this.screenForm.productName,
  353. createName: this.screenForm.createName,
  354. confirmName: this.screenForm.confirmName,
  355. orderType: this.screenForm.orderType,
  356. startOrderTime: this.screenForm.date ? this.screenForm.date[0] : '',
  357. endOrderTime: this.screenForm.date ? this.screenForm.date[1] : ''
  358. }
  359. getList(params).then(res => {
  360. this.dataList = res.data.records
  361. this.listTotal = res.data.total
  362. this.listLoading = false
  363. })
  364. },
  365. // 提交筛选表单
  366. submitScreenForm() {
  367. this.currentPage = 1
  368. this.getList()
  369. },
  370. // 重置筛选表单
  371. resetScreenForm() {
  372. this.$refs.screenForm.resetFields()
  373. this.currentPage = 1
  374. this.getList()
  375. },
  376. // 更改每页数量
  377. handleSizeChange(val) {
  378. this.pageSize = val
  379. this.currentPage = 1
  380. this.getList()
  381. },
  382. // 更改当前页
  383. handleCurrentChange(val) {
  384. this.currentPage = val
  385. this.getList()
  386. },
  387. // 进入表单
  388. toForm(item) {
  389. this.queryItem = item
  390. this.isShowForm = true
  391. },
  392. // 进入审批
  393. toExamine(item) {
  394. this.queryItem = item
  395. this.isShowExamine = true
  396. },
  397. // 进入详情
  398. toDetail(item) {
  399. this.queryItem = item
  400. this.isShowDetail = true
  401. },
  402. // 进入退订
  403. toReturn(item) {
  404. this.queryItem = item
  405. this.isShowReturn = true
  406. },
  407. backList() {
  408. this.queryItem = {}
  409. this.isShowDetail = false
  410. this.isShowForm = false
  411. this.isShowExamine = false
  412. this.isShowReturn = false
  413. },
  414. handleSubmit(id) {
  415. submitData({ id }).then(res => {
  416. this.$successMsg()
  417. this.getList()
  418. })
  419. },
  420. // 撤回
  421. handleWithdraw(id) {
  422. revokeOrder({ id }).then(res => {
  423. this.$successMsg()
  424. this.getList()
  425. })
  426. },
  427. // 删除
  428. handleDelete(id) {
  429. deleteOrder({ ids: id }).then(res => {
  430. this.$successMsg()
  431. this.getList()
  432. })
  433. },
  434. // 批量删除
  435. batchDelete() {
  436. this.$confirm('此操作将永久删除, 是否继续?', '提示', {
  437. confirmButtonText: '确定',
  438. cancelButtonText: '取消',
  439. type: 'warning'
  440. })
  441. .then(() => {
  442. let ids = this.multipleSelection.map(item => {
  443. return item.parentId
  444. })
  445. deleteOrder({ ids: ids.join(',') }).then(res => {
  446. this.$successMsg()
  447. this.getList()
  448. })
  449. })
  450. .catch(() => {})
  451. },
  452. findOrderType(val) {
  453. const obj = this.orderType.find(value => value.val === val)
  454. return obj ? obj.label : ''
  455. },
  456. findExamineStatus(val) {
  457. const obj = this.examineStatus.find(value => value.val === val)
  458. return obj ? obj.label : ''
  459. }
  460. }
  461. }
  462. </script>
  463. <style lang="scss" scoped></style>