sales_list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowExamine && !isShowReturnForm">
  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="24" :lg="24">
  9. <el-form-item prop="orderNum" label-width="0">
  10. <el-radio-group v-model="screenForm.status" @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="mainOrderId">
  23. <el-input v-model="screenForm.mainOrderId" 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="jxsName">
  28. <el-input v-model="screenForm.jxsName" 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="jxsNum">
  33. <el-input v-model="screenForm.jxsNum" 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="chName">
  38. <el-input v-model="screenForm.chName" placeholder="请输入产品名称"></el-input>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :xs="24" :sm="12" :lg="6">
  42. <el-form-item label="产品编码" prop="chNum">
  43. <el-input v-model="screenForm.chNum" placeholder="请输入产品编码"></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :xs="24" :sm="12" :lg="6">
  47. <el-form-item label="规格型号" prop="model">
  48. <el-input v-model="screenForm.model" placeholder="请输入规格型号"></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :xs="24" :sm="12" :lg="6">
  52. <el-form-item label="仓库名称" prop="warehouse">
  53. <el-input v-model="screenForm.warehouse" placeholder="请输入仓库名称"></el-input>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :xs="24" :sm="12" :lg="6">
  57. <el-form-item label="发货日期" prop="date">
  58. <el-date-picker
  59. v-model="screenForm.date"
  60. type="datetimerange"
  61. range-separator="至"
  62. style="width: 100%;"
  63. value-format="yyyy-MM-dd HH:mm:ss"
  64. start-placeholder="开始日期"
  65. end-placeholder="结束日期">
  66. </el-date-picker>
  67. </el-form-item>
  68. </el-col>
  69. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  70. <el-form-item label="">
  71. <el-button @click="resetScreenForm">清空</el-button>
  72. <el-button type="primary" @click="submitScreenForm">搜索</el-button>
  73. </el-form-item>
  74. </el-col>
  75. </el-row>
  76. </el-form>
  77. </div>
  78. <div class="mymain-container">
  79. <div class="btn-group clearfix">
  80. <div class="fl">
  81. <el-button size="mini" type="primary" icon="el-icon-plus" @click="toReturnForm()" v-if="$checkBtnRole('add', $route.meta.roles)">退货申请</el-button>
  82. <el-button size="mini" type="warning" icon="el-icon-finished" @click="batchExamine" :disabled="multipleSelection.length < 1" v-if="$checkBtnRole('examine', $route.meta.roles)">批量审批</el-button>
  83. </div>
  84. <div class="fr">
  85. <ExportButton :exUrl="'sale/order/export'" :exParams="exParams" />
  86. </div>
  87. </div>
  88. <div class="table">
  89. <el-table
  90. v-loading="listLoading"
  91. :data="dataList"
  92. element-loading-text="Loading"
  93. border
  94. fit
  95. highlight-current-row
  96. stripe
  97. @selection-change="handleSelectionChange"
  98. show-summary
  99. :summary-method="$getSummaries">
  100. <el-table-column align="center" type="selection" width="55"></el-table-column>
  101. <el-table-column align="left" label="状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  102. <template slot-scope="scope">
  103. {{scope.row.examineStatus | statusFilter}}
  104. </template>
  105. </el-table-column>
  106. <el-table-column align="left" label="开票状态" prop="billStatus" min-width="100" show-overflow-tooltip>
  107. <template slot-scope="scope">
  108. {{scope.row.billStatus | billStatusFilter}}
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="left" label="出库单号" prop="id" min-width="110" show-overflow-tooltip>
  112. <template slot-scope="scope">
  113. <CopyButton :copyText="scope.row.id" />
  114. <span>{{scope.row.id}}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column align="left" label="发货单号" prop="orderNo" min-width="130" show-overflow-tooltip>
  118. <template slot-scope="scope">
  119. <CopyButton :copyText="scope.row.orderNo" />
  120. <span>{{scope.row.orderNo}}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="left" label="订单号" prop="orderNo" min-width="140" show-overflow-tooltip>
  124. <template slot-scope="scope">
  125. <CopyButton :copyText="scope.row.mainOrderId" />
  126. <span>{{scope.row.mainOrderId}}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column align="left" label="仓库" prop="correspondName" min-width="100" show-overflow-tooltip></el-table-column>
  130. <el-table-column align="left" label="经销商编码" prop="customerNumber" min-width="100" show-overflow-tooltip>
  131. <template slot-scope="scope">
  132. <CopyButton :copyText="scope.row.customerNumber" />
  133. <span>{{scope.row.customerNumber}}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column align="left" label="经销商名称" prop="customerName" min-width="250" show-overflow-tooltip>
  137. <template slot-scope="scope">
  138. <CopyButton :copyText="scope.row.customerName" />
  139. <span>{{scope.row.customerName}}</span>
  140. </template>
  141. </el-table-column>
  142. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
  143. <template slot-scope="scope">
  144. <CopyButton :copyText="scope.row.materialCode" />
  145. <span>{{scope.row.materialCode}}</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  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 align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  167. <el-table-column align="right" label="数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
  168. <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  169. <template slot-scope="scope">
  170. {{ scope.row.price | numToFixed }}
  171. </template>
  172. </el-table-column>
  173. <el-table-column align="right" label="订单金额" prop="payAmount" min-width="100" show-overflow-tooltip>
  174. <template slot-scope="scope">
  175. {{ scope.row.payAmount | numToFixed }}
  176. </template>
  177. </el-table-column>
  178. <el-table-column align="left" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  179. <el-table-column align="center" label="操作" width="120" fixed="right">
  180. <template slot-scope="scope">
  181. <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
  182. <el-button type="text" @click="toExamine(scope.row)" v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">审批</el-button>
  183. <el-popconfirm
  184. style="margin-left: 10px;"
  185. title="确定弃审吗?"
  186. @onConfirm="handleAbandon(scope.row.id)"
  187. v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >
  188. <el-button slot="reference" type="text">弃审</el-button>
  189. </el-popconfirm>
  190. </template>
  191. </el-table-column>
  192. </el-table>
  193. </div>
  194. </div>
  195. <div class="pagination clearfix">
  196. <div class="fr">
  197. <el-pagination
  198. @size-change="handleSizeChange"
  199. @current-change="handleCurrentChange"
  200. :current-page="currentPage"
  201. :page-sizes="[10, 20, 30, 50]"
  202. :page-size="10"
  203. layout="total, sizes, prev, pager, next, jumper"
  204. :total="listTotal">
  205. </el-pagination>
  206. </div>
  207. </div>
  208. </div>
  209. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" />
  210. <SalesDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  211. <SalesExamine :listItem="queryItem" v-if="isShowExamine" @backListFormExamine="backList" />
  212. <SalesReturnForm :listItem="queryItem" v-if="isShowReturnForm" @backListFormDetail="backList" />
  213. </div>
  214. </template>
  215. <script>
  216. import { getList, examineJudge, examineBatch, abandonData } from "@/api/supply/sales";
  217. import SalesDetail from "@/views/supply/sales/components/sales_detail";
  218. import SalesExamine from "@/views/supply/sales/components/sales_examine";
  219. import SalesReturnForm from "@/views/supply/sales/components/sales_return_form";
  220. import ExamineDialog from "@/components/Common/examine-dialog";
  221. let that
  222. export default {
  223. components: {
  224. SalesDetail,
  225. SalesExamine,
  226. SalesReturnForm,
  227. ExamineDialog,
  228. },
  229. filters: {
  230. statusFilter(val) {
  231. let obj = that.statusList.find(o => o.value == val);
  232. return obj ? obj.label : ''
  233. },
  234. billStatusFilter(val) {
  235. const MAP = {
  236. 1: '已开票',
  237. 0: '未开票',
  238. }
  239. return MAP[val];
  240. }
  241. },
  242. data() {
  243. return {
  244. currentPage: 1, // 当前页码
  245. pageSize: 10, // 每页数量
  246. listTotal: 0, // 列表总数
  247. dataList: null, // 列表数据
  248. listLoading: false, // 列表加载loading
  249. screenForm: { // 筛选表单数据
  250. orderNum: '',
  251. jxsName: '',
  252. jxsNum: '',
  253. chName: '',
  254. chNum: '',
  255. model: '',
  256. warehouse: '',
  257. date: '',
  258. status: '',
  259. mainOrderId: '',
  260. },
  261. statusList: [
  262. { label: '已保存', value: 'SAVE' },
  263. { label: '待审核', value: 'WAIT' },
  264. { label: '审核通过', value: 'OK' },
  265. { label: '审核驳回', value: 'FAIL' },
  266. ],
  267. queryItem: {},
  268. isShowDetail: false,
  269. isShowExamine: false,
  270. isShowReturnForm: false,
  271. multipleSelection: [],
  272. isShowExamineDialog: false,
  273. examineForm: {
  274. status: '',
  275. remark: '',
  276. },
  277. }
  278. },
  279. computed: {
  280. exParams() {
  281. return {
  282. examineStatus: this.screenForm.status,
  283. orderNo: this.screenForm.orderNum,
  284. customerName: this.screenForm.jxsName,
  285. customerNumber: this.screenForm.jxsNum,
  286. materialName: this.screenForm.chName,
  287. materialNumber: this.screenForm.chNum,
  288. specification: this.screenForm.model,
  289. correspondName: this.screenForm.warehouse,
  290. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  291. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  292. mainOrderId: this.screenForm.mainOrderId,
  293. }
  294. },
  295. },
  296. beforeCreate() {
  297. that = this;
  298. },
  299. created() {
  300. this.getList();
  301. },
  302. methods: {
  303. // 查询列表
  304. getList() {
  305. this.listLoading = true;
  306. let params = {
  307. pageNum: this.currentPage,
  308. pageSize: this.pageSize,
  309. examineStatus: this.screenForm.status,
  310. orderNo: this.screenForm.orderNum,
  311. customerName: this.screenForm.jxsName,
  312. customerNumber: this.screenForm.jxsNum,
  313. materialName: this.screenForm.chName,
  314. materialNumber: this.screenForm.chNum,
  315. specification: this.screenForm.model,
  316. correspondName: this.screenForm.warehouse,
  317. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  318. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  319. mainOrderId: this.screenForm.mainOrderId,
  320. };
  321. getList(params).then((res) => {
  322. res.data.records.forEach(item => {
  323. item.sums1 = ['refundableQty'];
  324. item.sums2 = ['price', 'payAmount'];
  325. })
  326. this.dataList = res.data.records;
  327. this.listTotal = res.data.total;
  328. this.listLoading = false;
  329. })
  330. },
  331. // 提交筛选表单
  332. submitScreenForm() {
  333. this.currentPage = 1;
  334. this.getList();
  335. },
  336. // 重置筛选表单
  337. resetScreenForm() {
  338. this.$refs.screenForm.resetFields();
  339. this.currentPage = 1;
  340. this.getList();
  341. },
  342. // 更改每页数量
  343. handleSizeChange(val) {
  344. this.pageSize = val;
  345. this.currentPage = 1;
  346. this.getList();
  347. },
  348. // 更改当前页
  349. handleCurrentChange(val) {
  350. this.currentPage = val;
  351. this.getList();
  352. },
  353. // 判断是否可以审批
  354. async examineJudge(item) {
  355. // 获取页面模版
  356. const result = await new Promise((resolve, reject)=>{
  357. examineJudge({id: item.id}).then(res => {
  358. resolve(res.code == 200);
  359. }).catch(res => {
  360. resolve(0);
  361. })
  362. })
  363. return result;
  364. },
  365. // 进入表单
  366. toReturnForm(item) {
  367. this.queryItem = item;
  368. this.isShowReturnForm = true;
  369. },
  370. // 进入详情
  371. toDetail(item) {
  372. this.queryItem = item;
  373. this.isShowDetail = true;
  374. },
  375. // 进入审批
  376. async toExamine(item) {
  377. const canExamine = await this.examineJudge(item);
  378. if(!canExamine) {
  379. return false;
  380. }
  381. this.queryItem = item;
  382. this.isShowExamine = true;
  383. },
  384. backList() {
  385. this.queryItem = {};
  386. this.isShowDetail = false;
  387. this.isShowExamine = false;
  388. this.isShowReturnForm = false;
  389. },
  390. handleSelectionChange(val) {
  391. this.multipleSelection = val;
  392. },
  393. // 打开 批量审批
  394. batchExamine() {
  395. this.isShowExamineDialog = true;
  396. },
  397. // 提交 批量审批
  398. submitExamineForm() {
  399. let ids = this.multipleSelection.map(item => {
  400. return item.id;
  401. });
  402. examineBatch({
  403. ids: ids.join(','),
  404. examineStatus: this.examineForm.status,
  405. approvalRemark: this.examineForm.remark,
  406. }).then(res => {
  407. this.isShowExamineDialog = false;
  408. this.getList();
  409. this.$successMsg('修改成功');
  410. })
  411. },
  412. // 弃审
  413. handleAbandon(id) {
  414. abandonData({id}).then(res => {
  415. this.$successMsg();
  416. this.getList();
  417. })
  418. },
  419. }
  420. }
  421. </script>
  422. <style lang="scss" scoped>
  423. </style>