sales_list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div class="app-container">
  3. <div v-show="!isShowDetail && !isShowExamine">
  4. <!-- 筛选条件 -->
  5. <div class="screen-container">
  6. <el-form ref="screenForm" :model="screenForm" label-width="90px" size="small" 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" size="medium" @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="jxsName">
  23. <el-input v-model="screenForm.jxsName" 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="jxsNum">
  28. <el-input v-model="screenForm.jxsNum" 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="chName">
  33. <el-input v-model="screenForm.chName" 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="chNum">
  38. <el-input v-model="screenForm.chNum" 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="model">
  43. <el-input v-model="screenForm.model" 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="warehouse">
  48. <el-input v-model="screenForm.warehouse" 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="date">
  53. <el-date-picker
  54. v-model="screenForm.date"
  55. type="datetimerange"
  56. range-separator="至"
  57. style="width: 100%;"
  58. value-format="yyyy-MM-dd HH:mm:ss"
  59. start-placeholder="开始日期"
  60. end-placeholder="结束日期">
  61. </el-date-picker>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  65. <el-form-item label="">
  66. <el-button size="small" @click="resetScreenForm">清空</el-button>
  67. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  68. </el-form-item>
  69. </el-col>
  70. </el-row>
  71. </el-form>
  72. </div>
  73. <div class="mymain-container">
  74. <div class="btn-group clearfix">
  75. <div class="fl">
  76. <el-button size="small" type="warning" icon="el-icon-close" @click="batchExamine" :disabled="multipleSelection.length < 1">批量审批</el-button>
  77. </div>
  78. <div class="fr">
  79. <ExportButton :exUrl="'sale/order/export'" :exParams="exParams" />
  80. </div>
  81. </div>
  82. <div class="table">
  83. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="handleSelectionChange">
  84. <el-table-column align="center" type="selection" width="55"></el-table-column>
  85. <el-table-column align="center" label="状态" prop="examineStatus" min-width="100" show-overflow-tooltip>
  86. <template slot-scope="scope">
  87. {{scope.row.examineStatus | statusFilter}}
  88. </template>
  89. </el-table-column>
  90. <el-table-column align="center" label="开票状态" prop="billStatus" min-width="100" show-overflow-tooltip>
  91. <template slot-scope="scope">
  92. {{scope.row.billStatus | billStatusFilter}}
  93. </template>
  94. </el-table-column>
  95. <el-table-column align="center" label="出库单号" prop="id" min-width="180" show-overflow-tooltip></el-table-column>
  96. <el-table-column align="center" label="发货单号" prop="orderNo" min-width="180" show-overflow-tooltip></el-table-column>
  97. <el-table-column align="center" label="仓库" prop="correspondName" min-width="120" show-overflow-tooltip></el-table-column>
  98. <el-table-column align="center" label="经销商" prop="customerName" min-width="160" show-overflow-tooltip></el-table-column>
  99. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  100. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  101. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  102. <el-table-column align="center" label="数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
  103. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
  104. <el-table-column align="center" label="订单金额" prop="payAmount" min-width="100" show-overflow-tooltip></el-table-column>
  105. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column>
  106. <el-table-column align="center" label="操作" width="120" fixed="right">
  107. <template slot-scope="scope">
  108. <el-button type="text" @click="toDetail(scope.row)">详情</el-button>
  109. <el-button type="text" @click="toExamine(scope.row)" v-if="$checkBtnRole('examine', $route.meta.roles) && scope.row.examineStatus === 'WAIT'">审批</el-button>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. </div>
  114. </div>
  115. <div class="pagination clearfix">
  116. <div class="fr">
  117. <el-pagination
  118. @size-change="handleSizeChange"
  119. @current-change="handleCurrentChange"
  120. :current-page="currentPage"
  121. :page-sizes="[10, 20, 30, 50]"
  122. :page-size="10"
  123. layout="total, sizes, prev, pager, next, jumper"
  124. :total="listTotal">
  125. </el-pagination>
  126. </div>
  127. </div>
  128. </div>
  129. <ExamineDialog :isShow.sync="isShowExamineDialog" :examineForm.sync="examineForm" />
  130. <SalesDetail :listItem="queryItem" v-if="isShowDetail" @backListFormDetail="backList" />
  131. <SalesExamine :listItem="queryItem" v-if="isShowExamine" @backListFormExamine="backList" />
  132. </div>
  133. </template>
  134. <script>
  135. import { getList, examineJudge, examineBatch } from "@/api/supply/sales";
  136. import SalesDetail from "@/views/supply/sales/components/sales_detail";
  137. import SalesExamine from "@/views/supply/sales/components/sales_examine";
  138. import ExamineDialog from "@/components/Common/examine-dialog";
  139. let that
  140. export default {
  141. components: {
  142. SalesDetail,
  143. SalesExamine,
  144. ExamineDialog,
  145. },
  146. filters: {
  147. statusFilter(val) {
  148. let obj = that.statusList.find(o => o.value == val);
  149. return obj ? obj.label : ''
  150. },
  151. billStatusFilter(val) {
  152. const MAP = {
  153. 1: '已开票',
  154. 0: '未开票',
  155. }
  156. return MAP[val];
  157. }
  158. },
  159. data() {
  160. return {
  161. currentPage: 1, // 当前页码
  162. pageSize: 10, // 每页数量
  163. listTotal: 0, // 列表总数
  164. dataList: null, // 列表数据
  165. listLoading: false, // 列表加载loading
  166. screenForm: { // 筛选表单数据
  167. orderNum: '',
  168. jxsName: '',
  169. jxsNum: '',
  170. chName: '',
  171. chNum: '',
  172. model: '',
  173. warehouse: '',
  174. date: '',
  175. status: '',
  176. },
  177. statusList: [
  178. { label: '已保存', value: 'SAVE' },
  179. { label: '待审核', value: 'WAIT' },
  180. { label: '审核通过', value: 'OK' },
  181. { label: '审核驳回', value: 'FAIL' },
  182. ],
  183. queryItem: {},
  184. isShowDetail: false,
  185. isShowExamine: false,
  186. multipleSelection: [],
  187. isShowExamineDialog: false,
  188. examineForm: {
  189. status: '',
  190. remark: '',
  191. }
  192. }
  193. },
  194. computed: {
  195. exParams() {
  196. return {
  197. examineStatus: this.screenForm.status,
  198. orderNo: this.screenForm.orderNum,
  199. customerName: this.screenForm.jxsName,
  200. customerNumber: this.screenForm.jxsNum,
  201. materialName: this.screenForm.chName,
  202. materialNumber: this.screenForm.chNum,
  203. specification: this.screenForm.model,
  204. correspondName: this.screenForm.warehouse,
  205. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  206. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  207. }
  208. },
  209. },
  210. beforeCreate() {
  211. that = this;
  212. },
  213. created() {
  214. this.getList();
  215. },
  216. methods: {
  217. // 查询列表
  218. getList() {
  219. this.listLoading = true;
  220. let params = {
  221. pageNum: this.currentPage,
  222. pageSize: this.pageSize,
  223. examineStatus: this.screenForm.status,
  224. orderNo: this.screenForm.orderNum,
  225. customerName: this.screenForm.jxsName,
  226. customerNumber: this.screenForm.jxsNum,
  227. materialName: this.screenForm.chName,
  228. materialNumber: this.screenForm.chNum,
  229. specification: this.screenForm.model,
  230. correspondName: this.screenForm.warehouse,
  231. startTime: this.screenForm.date ? this.screenForm.date[0] : '',
  232. endTime: this.screenForm.date ? this.screenForm.date[1] : '',
  233. };
  234. getList(params).then((res) => {
  235. this.dataList = res.data.records;
  236. this.listTotal = res.data.total;
  237. this.listLoading = false;
  238. })
  239. },
  240. // 提交筛选表单
  241. submitScreenForm() {
  242. this.currentPage = 1;
  243. this.getList();
  244. },
  245. // 重置筛选表单
  246. resetScreenForm() {
  247. this.$refs.screenForm.resetFields();
  248. this.currentPage = 1;
  249. this.getList();
  250. },
  251. // 更改每页数量
  252. handleSizeChange(val) {
  253. this.pageSize = val;
  254. this.currentPage = 1;
  255. this.getList();
  256. },
  257. // 更改当前页
  258. handleCurrentChange(val) {
  259. this.currentPage = val;
  260. this.getList();
  261. },
  262. // 判断是否可以审批
  263. async examineJudge(item) {
  264. // 获取页面模版
  265. const result = await new Promise((resolve, reject)=>{
  266. examineJudge({id: item.id}).then(res => {
  267. resolve(res.code == 200);
  268. }).catch(res => {
  269. resolve(0);
  270. })
  271. })
  272. return result;
  273. },
  274. // 进入详情
  275. toDetail(item) {
  276. this.queryItem = item;
  277. this.isShowDetail = true;
  278. },
  279. // 进入审批
  280. async toExamine(item) {
  281. const canExamine = await this.examineJudge(item);
  282. if(!canExamine) {
  283. return false;
  284. }
  285. this.queryItem = item;
  286. this.isShowExamine = true;
  287. },
  288. backList() {
  289. this.queryItem = {};
  290. this.isShowDetail = false;
  291. this.isShowExamine = false;
  292. },
  293. handleSelectionChange(val) {
  294. this.multipleSelection = val;
  295. },
  296. // 打开 批量审批
  297. batchExamine() {
  298. this.isShowExamineDialog = true;
  299. },
  300. // 提交 批量审批
  301. submitExamineForm() {
  302. let ids = this.multipleSelection.map(item => {
  303. return item.id;
  304. });
  305. examineBatch({
  306. ids: ids.join(','),
  307. examineStatus: this.examineForm.status,
  308. approvalRemark: this.examineForm.remark,
  309. }).then(res => {
  310. this.isShowEditDateDialog = false;
  311. this.getList();
  312. this.$successMsg('修改成功');
  313. })
  314. },
  315. }
  316. }
  317. </script>
  318. <style lang="scss" scoped>
  319. </style>