nsales_list.vue 19 KB

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