index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="primary" size="mini" @click.stop="newAdd()">新建销售单
  10. </el-button>
  11. </template>
  12. <template slot="corpIdSearch">
  13. <crop-select v-model="search.corpId" corpType="KH"></crop-select>
  14. </template>
  15. <template slot-scope="{ row, index }" slot="corpId">
  16. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.corpsName }}
  17. </span>
  18. </template>
  19. <template slot="businesDateSearch">
  20. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  21. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']"
  22. :picker-options="pickerOptions">
  23. </el-date-picker>
  24. </template>
  25. <template slot-scope="{ row, index }" slot="menu">
  26. <!-- <el-tooltip class="item" effect="dark" content="新建销售订单" placement="top">
  27. <i class="tradingIcon icon-add" />
  28. </el-tooltip> -->
  29. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  30. <i class="tradingIcon icon-del" v-if="row.confirmStatus == 0" @click.stop="rowDel(row, index)" />
  31. </el-tooltip>
  32. <!-- <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  33. <i class="tradingIcon icon-edit" />
  34. </el-tooltip>
  35. <el-tooltip class="item" effect="dark" content="收款" placement="top">
  36. <i class="tradingIcon icon-proceeds" />
  37. </el-tooltip>
  38. <el-tooltip class="item" effect="dark" content="发货" placement="top">
  39. <i class="tradingIcon icon-deliver" />
  40. </el-tooltip>
  41. <el-tooltip class="item" effect="dark" content="对账" placement="top">
  42. <i class="tradingIcon icon-reconciliation" />
  43. </el-tooltip> -->
  44. <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
  45. 查看
  46. </el-button>
  47. <el-button type="text" size="small" @click.stop="rowDel(row, index)">
  48. 删除
  49. </el-button> -->
  50. </template>
  51. </avue-crud>
  52. </basic-container>
  53. <details-page v-if="!show" @goBack="goBack()" :detailData="detailData" />
  54. </div>
  55. </template>
  56. <script>
  57. import detailsPage from "./detailsPage";
  58. import { option } from "./js/optionList";
  59. import { getList, getCorpsAll, gainUser, getCorpType, orderRemove } from "@/api/basicData/salesOrder";
  60. export default {
  61. name: "index",
  62. data() {
  63. return {
  64. src: '',
  65. show: true,
  66. loading: false,
  67. search: {},
  68. detailData: {},
  69. dataList: [],
  70. selectionList: [],
  71. page: {
  72. pageSize: 20,
  73. currentPage: 1,
  74. total: 0,
  75. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  76. },
  77. option: {},
  78. pickerOptions: {
  79. shortcuts: [
  80. {
  81. text: '当天',
  82. onClick(picker) {
  83. const date = new Date();
  84. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
  85. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  86. picker.$emit('pick', [start, end]);
  87. }
  88. },
  89. {
  90. text: '昨天',
  91. onClick(picker) {
  92. const date = new Date();
  93. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 0, 0, 0);
  94. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1, 23, 59, 59);
  95. picker.$emit('pick', [start, end]);
  96. }
  97. }, {
  98. text: '当月',
  99. onClick(picker) {
  100. const date = new Date();
  101. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  102. const end = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59);
  103. picker.$emit('pick', [start, end]);
  104. }
  105. }, {
  106. text: '当季',
  107. onClick(picker) {
  108. const date = new Date();
  109. const start = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3, 1, 0, 0, 0);
  110. const end = new Date(date.getFullYear(), parseInt(date.getMonth() / 3) * 3 + 3, 0, 23, 59, 59);
  111. picker.$emit('pick', [start, end]);
  112. }
  113. }, {
  114. text: '当年',
  115. onClick(picker) {
  116. const date = new Date();
  117. const start = new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0);
  118. const end = new Date(date.getFullYear() + 1, 0, 0, 23, 59, 59);
  119. picker.$emit('pick', [start, end]);
  120. }
  121. }, {
  122. text: '最近一周',
  123. onClick(picker) {
  124. const date = new Date();
  125. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7, 0, 0, 0);
  126. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  127. picker.$emit('pick', [start, end]);
  128. }
  129. }, {
  130. text: '最近二周',
  131. onClick(picker) {
  132. const date = new Date();
  133. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 2, 0, 0, 0);
  134. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  135. picker.$emit('pick', [start, end]);
  136. }
  137. }, {
  138. text: '最近三周',
  139. onClick(picker) {
  140. const date = new Date();
  141. const start = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7 * 3, 0, 0, 0);
  142. const end = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
  143. picker.$emit('pick', [start, end]);
  144. }
  145. }]
  146. },
  147. };
  148. },
  149. components: {
  150. detailsPage
  151. },
  152. async created() {
  153. this.option = await this.getColumnData(this.getColumnName(211), option);
  154. this.option.height = window.innerHeight - 210;
  155. this.getAllWorkDicts()
  156. },
  157. activated() {
  158. this.$refs.crud.refreshTable();
  159. if (!this.$store.getters.pjxsStatus && !this.show) {
  160. this.show = true;
  161. }
  162. if (this.$route.query.orderId) {
  163. setTimeout(() => {
  164. this.editOpen({ id: this.$route.query.orderId }, 1);
  165. }, 100);
  166. }
  167. },
  168. methods: {
  169. getAllWorkDicts() {
  170. gainUser().then(res => {
  171. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  172. })
  173. getCorpType({ corpType: 'KH' }).then(res => {
  174. this.findObject(this.option.column, "corpType").dicData = res.data.data
  175. });
  176. this.$refs.crud.init();
  177. },
  178. searchCriteriaSwitch(type) {
  179. if (type) {
  180. this.option.height = this.option.height - 138;
  181. } else {
  182. this.option.height = this.option.height + 138;
  183. }
  184. this.$refs.crud.getTableHeight();
  185. },
  186. cellStyle() {
  187. return "padding:0;height:40px;";
  188. },
  189. //点击搜索按钮触发
  190. searchChange(params, done) {
  191. this.page.currentPage = 1;
  192. this.onLoad(this.page, params);
  193. done();
  194. },
  195. refreshChange() {
  196. this.onLoad(this.page, this.search);
  197. },
  198. newAdd() {
  199. this.show = false;
  200. this.$store.commit("IN_PJXS_STATUS");
  201. },
  202. onLoad(page, params = {}) {
  203. let data = this.deepClone(Object.assign(params, this.search));
  204. data.billType = 'XS';
  205. data.tradeType = 'YPJ';
  206. if (data.businesDate) {
  207. data.orderStartDate = data.businesDate[0];
  208. data.orderEndDate = data.businesDate[1];
  209. }
  210. delete data.businesDate
  211. this.loading = true;
  212. getList(
  213. page.currentPage,
  214. page.pageSize,
  215. data
  216. )
  217. .then(res => {
  218. this.dataList = res.data.data.records ? res.data.data.records : [];
  219. this.page.total = res.data.data.total;
  220. })
  221. .finally(() => {
  222. this.loading = false;
  223. });
  224. },
  225. editOpen(row, status) {
  226. this.detailData = {
  227. id: row.id,
  228. status: status
  229. };
  230. this.show = false;
  231. this.$store.commit("IN_PJXS_STATUS");
  232. },
  233. currentChange(val) {
  234. this.page.currentPage = val;
  235. },
  236. sizeChange(val) {
  237. this.page.currentPage = 1;
  238. this.page.pageSize = val;
  239. },
  240. rowDel(row, index, done) {
  241. this.$confirm("确定删除数据?", {
  242. confirmButtonText: "确定",
  243. cancelButtonText: "取消",
  244. type: "warning"
  245. }).then(() => {
  246. orderRemove(row.id).then(res => {
  247. if (res.data.code == 200) {
  248. this.$message({
  249. type: "success",
  250. message: "删除成功!"
  251. });
  252. this.onLoad(this.page, this.search);
  253. }
  254. });
  255. });
  256. },
  257. async saveColumn() {
  258. const inSave = await this.saveColumnData(
  259. this.getColumnName(211),
  260. this.option
  261. );
  262. if (inSave) {
  263. this.$nextTick(() => {
  264. this.$refs.crud.doLayout();
  265. });
  266. this.$message.success("保存成功");
  267. //关闭窗口
  268. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  269. }
  270. },
  271. async resetColumn() {
  272. this.option = option;
  273. const inSave = await this.delColumnData(this.getColumnName(211), option);
  274. if (inSave) {
  275. this.$nextTick(() => {
  276. this.$refs.crud.doLayout();
  277. });
  278. this.getAllWorkDicts()
  279. this.$message.success("重置成功");
  280. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  281. }
  282. },
  283. //返回列表
  284. goBack() {
  285. if (this.$route.query.orderId) {
  286. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  287. this.$router.push({
  288. path: "/salesOrder/index"
  289. });
  290. }
  291. this.detailData = this.$options.data().detailData;
  292. this.show = true;
  293. this.onLoad(this.page, this.search);
  294. this.$store.commit("OUT_PJXS_STATUS");
  295. },
  296. }
  297. }
  298. </script>
  299. <style lang="scss" scoped>
  300. .page-crad ::v-deep .basic-container__card {
  301. height: 94.2vh;
  302. }
  303. .stat-td {
  304. text-align: center;
  305. position: relative;
  306. }
  307. .stat-img {
  308. width: 95%;
  309. height: 100px;
  310. }
  311. .stat-tip {
  312. position: absolute;
  313. left: 15px;
  314. top: 5px;
  315. .money {
  316. color: #fff;
  317. font-size: 28px;
  318. text-align: left;
  319. font-weight: 600;
  320. }
  321. .title {
  322. color: #fff;
  323. font-size: 14px;
  324. text-align: left;
  325. margin-top: 5px;
  326. margin-bottom: 0px;
  327. }
  328. }
  329. </style>