nsales_list.vue 20 KB

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