nsales_list.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
  171. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip>
  172. <template slot-scope="scope">
  173. <CopyButton :copyText="scope.row.materialCode" />
  174. <span>{{scope.row.materialCode}}</span>
  175. </template>
  176. </el-table-column>
  177. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="140" show-overflow-tooltip>
  178. <template slot-scope="scope">
  179. <CopyButton :copyText="scope.row.materialOldNumber" />
  180. <span>{{scope.row.materialOldNumber}}</span>
  181. </template>
  182. </el-table-column>
  183. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip>
  184. <template slot-scope="scope">
  185. <CopyButton :copyText="scope.row.materialName" />
  186. <span>{{scope.row.materialName}}</span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip>
  190. <template slot-scope="scope">
  191. <CopyButton :copyText="scope.row.specification" />
  192. <span>{{scope.row.specification}}</span>
  193. </template>
  194. </el-table-column>
  195. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  196. <el-table-column align="right" label="数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
  197. <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  198. <template slot-scope="scope">
  199. {{ scope.row.price | numToFixed }}
  200. </template>
  201. </el-table-column>
  202. <el-table-column align="right" label="订单金额" prop="payAmount" min-width="100" show-overflow-tooltip>
  203. <template slot-scope="scope">
  204. {{ scope.row.payAmount | numToFixed }}
  205. </template>
  206. </el-table-column>
  207. <el-table-column align="left" label="订单备注" prop="headerRemark" min-width="160" show-overflow-tooltip></el-table-column>
  208. <el-table-column align="left" label="发货申请备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  209. <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip></el-table-column>
  210. <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>
  211. <el-table-column align="left" label="表头业务员" prop="k3ServiceName" min-width="100" show-overflow-tooltip></el-table-column>
  212. <!-- <el-table-column align="center" label="操作" width="120" fixed="right">-->
  213. <!-- <template slot-scope="scope">-->
  214. <!-- <el-button type="text" @click="toDetail(scope.row)">详情</el-button>-->
  215. <!--&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;-->
  216. <!--&lt;!&ndash; <el-popconfirm&ndash;&gt;-->
  217. <!--&lt;!&ndash; style="margin-left: 10px;"&ndash;&gt;-->
  218. <!--&lt;!&ndash; title="确定弃审吗?"&ndash;&gt;-->
  219. <!--&lt;!&ndash; @onConfirm="handleAbandon(scope.row.id)"&ndash;&gt;-->
  220. <!--&lt;!&ndash; v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'OK'" >&ndash;&gt;-->
  221. <!--&lt;!&ndash; <el-button slot="reference" type="text">弃审</el-button>&ndash;&gt;-->
  222. <!--&lt;!&ndash; </el-popconfirm>&ndash;&gt;-->
  223. <!-- </template>-->
  224. <!-- </el-table-column>-->
  225. </el-table>
  226. </div>
  227. </div>
  228. <div class="pagination clearfix">
  229. <div class="fr">
  230. <el-pagination
  231. @size-change="handleSizeChange"
  232. @current-change="handleCurrentChange"
  233. :current-page="currentPage"
  234. :page-sizes="[10, 20, 30, 50]"
  235. :page-size="10"
  236. layout="total, sizes, prev, pager, next, jumper"
  237. :total="listTotal">
  238. </el-pagination>
  239. </div>
  240. </div>
  241. </div>
  242. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" />
  243. <SalesDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  244. <SalesExamine :listItem="queryItem" v-if="isShowExamine" @backListFormExamine="backList" />
  245. <SalesReturnForm :listItem="queryItem" v-if="isShowReturnForm" @backListFormDetail="backList" />
  246. </div>
  247. </template>
  248. <script>
  249. import { abandonData, examineBatch, examineJudge, getList } from '@/api/supply/sales'
  250. import SalesDetail from '@/views/supply/sales/components/sales_detail'
  251. import SalesExamine from '@/views/supply/sales/components/sales_examine'
  252. import SalesReturnForm from '@/views/supply/sales/components/sales_return_form'
  253. import ExamineDialog from '@/components/Common/examine-dialog'
  254. let that
  255. export default {
  256. components: {
  257. SalesDetail,
  258. SalesExamine,
  259. SalesReturnForm,
  260. ExamineDialog,
  261. },
  262. filters: {
  263. statusFilter(val) {
  264. let obj = that.statusList.find(o => o.value == val);
  265. return obj ? obj.label : ''
  266. },
  267. billStatusFilter(val) {
  268. const MAP = {
  269. 1: '已开票',
  270. 0: '未开票',
  271. }
  272. return MAP[val];
  273. }
  274. },
  275. data() {
  276. return {
  277. currentPage: 1, // 当前页码
  278. pageSize: 10, // 每页数量
  279. listTotal: 0, // 列表总数
  280. dataList: null, // 列表数据
  281. listLoading: false, // 列表加载loading
  282. screenForm: { // 筛选表单数据
  283. orderNum: '',
  284. jxsName: '',
  285. jxsNum: '',
  286. chName: '',
  287. chNum: '',
  288. model: '',
  289. warehouse: '',
  290. date: '',
  291. status: '',
  292. approval:'',
  293. mainOrderId: '',
  294. id:''
  295. },
  296. statusList: [
  297. { label: '已保存', value: 'SAVE' },
  298. { label: '待审核', value: 'WAIT' },
  299. { label: '审核通过', value: 'OK' },
  300. // { label: '审核驳回', value: 'FAIL' },,
  301. ],
  302. queryItem: {},
  303. isShowDetail: false,
  304. isShowExamine: false,
  305. isShowReturnForm: false,
  306. value1: "",
  307. choiceDate: "",
  308. multipleSelection: [],
  309. isShowExamineDialog: false,
  310. examineForm: {
  311. status: '',
  312. remark: '',
  313. },
  314. setDisabled: {
  315. disabledDate: (time) => {
  316. if (this.choiceDate) {
  317. const res = 13 * 24 * 3600 * 1000;
  318. const minTime = this.choiceDate - res;
  319. const maxTime = this.choiceDate + res;
  320. return time.getTime() < minTime || time.getTime() > maxTime;
  321. }
  322. },
  323. onPick: ({ maxDate, minDate }) => {
  324. this.choiceDate = minDate.getTime();
  325. if (maxDate) this.choiceDate = "";
  326. },
  327. },
  328. }
  329. },
  330. computed: {
  331. exParams() {
  332. return {
  333. examineStatus: this.screenForm.status,
  334. orderNo: this.screenForm.orderNum,
  335. customerName: this.screenForm.jxsName,
  336. customerNumber: this.screenForm.jxsNum,
  337. materialName: this.screenForm.chName,
  338. materialNumber: this.screenForm.chNum,
  339. specification: this.screenForm.model,
  340. correspondName: this.screenForm.warehouse,
  341. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  342. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  343. approvalStartTime: this.screenForm.approval ? this.screenForm.approval[0] : "",
  344. approvalEndTime: this.screenForm.approval ? this.screenForm.approval[1] : "",
  345. mainOrderId: this.screenForm.mainOrderId,
  346. id:this.screenForm.id
  347. }
  348. },
  349. },
  350. beforeCreate() {
  351. that = this;
  352. },
  353. created() {
  354. this.getList();
  355. },
  356. methods: {
  357. // 查询列表
  358. getList() {
  359. this.listLoading = true;
  360. let params = {
  361. pageNum: this.currentPage,
  362. pageSize: this.pageSize,
  363. examineStatus: this.screenForm.status,
  364. orderNo: this.screenForm.orderNum,
  365. customerName: this.screenForm.jxsName,
  366. customerNumber: this.screenForm.jxsNum,
  367. materialName: this.screenForm.chName,
  368. materialNumber: this.screenForm.chNum,
  369. specification: this.screenForm.model,
  370. correspondName: this.screenForm.warehouse,
  371. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  372. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  373. approvalStartTime: this.screenForm.approval ? this.screenForm.approval[0] : "",
  374. approvalEndTime: this.screenForm.approval ? this.screenForm.approval[1] : "",
  375. mainOrderId: this.screenForm.mainOrderId,
  376. id:this.screenForm.id
  377. };
  378. getList(params).then((res) => {
  379. res.data.records.forEach(item => {
  380. item.sums1 = ['refundableQty'];
  381. item.sums2 = ['price', 'payAmount'];
  382. })
  383. this.dataList = res.data.records;
  384. this.listTotal = res.data.total;
  385. this.listLoading = false;
  386. })
  387. },
  388. updateReceipt() {
  389. if (!this.value1) {
  390. this.$errorMsg('请选择时间')
  391. return
  392. }
  393. updateReceipt({
  394. startTime:this.value1[0],
  395. endTime:this.value1[1]
  396. }).then(res=>{
  397. this.getList();
  398. this.$successMsg("已更新");
  399. this.value1 = ''
  400. })
  401. },
  402. // 提交筛选表单
  403. submitScreenForm() {
  404. this.currentPage = 1;
  405. this.getList();
  406. },
  407. // 重置筛选表单
  408. resetScreenForm() {
  409. this.$refs.screenForm.resetFields();
  410. this.currentPage = 1;
  411. this.getList();
  412. },
  413. // 更改每页数量
  414. handleSizeChange(val) {
  415. this.pageSize = val;
  416. this.currentPage = 1;
  417. this.getList();
  418. },
  419. // 更改当前页
  420. handleCurrentChange(val) {
  421. this.currentPage = val;
  422. this.getList();
  423. },
  424. // 判断是否可以审批
  425. async examineJudge(item) {
  426. // 获取页面模版
  427. const result = await new Promise((resolve, reject)=>{
  428. examineJudge({id: item.id}).then(res => {
  429. resolve(res.code == 200);
  430. }).catch(res => {
  431. resolve(0);
  432. })
  433. })
  434. return result;
  435. },
  436. // 进入表单
  437. toReturnForm(item) {
  438. this.queryItem = item;
  439. this.isShowReturnForm = true;
  440. },
  441. // 进入详情
  442. toDetail(item) {
  443. this.queryItem = item;
  444. this.isShowDetail = true;
  445. },
  446. // 进入审批
  447. async toExamine(item) {
  448. const canExamine = await this.examineJudge(item);
  449. if(!canExamine) {
  450. return false;
  451. }
  452. this.queryItem = item;
  453. this.isShowExamine = true;
  454. },
  455. backList() {
  456. this.queryItem = {};
  457. this.isShowDetail = false;
  458. this.isShowExamine = false;
  459. this.isShowReturnForm = false;
  460. },
  461. handleSelectionChange(val) {
  462. this.multipleSelection = val;
  463. },
  464. // 打开 批量审批
  465. batchExamine() {
  466. this.isShowExamineDialog = true;
  467. },
  468. // 提交 批量审批
  469. submitExamineForm() {
  470. let ids = this.multipleSelection.map(item => {
  471. return item.id;
  472. });
  473. examineBatch({
  474. ids: ids.join(','),
  475. examineStatus: this.examineForm.status,
  476. approvalRemark: this.examineForm.remark,
  477. }).then(res => {
  478. this.isShowExamineDialog = false;
  479. this.getList();
  480. this.$successMsg('修改成功');
  481. })
  482. },
  483. // 弃审
  484. handleAbandon(id) {
  485. abandonData({id}).then(res => {
  486. this.$successMsg();
  487. this.getList();
  488. })
  489. },
  490. }
  491. }
  492. </script>
  493. <style lang="scss" scoped>
  494. </style>