index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. <template>
  2. <div class="zxDiffOrder pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <ex-table
  7. v-loading="loading"
  8. :table="table"
  9. :data="tableData"
  10. :columns="columns"
  11. :page="pageInfo"
  12. :size="size"
  13. @page-curr-change="handlePageChange"
  14. @page-size-change="handleSizeChange"
  15. @screen-reset="
  16. pageInfo.curr = 1;
  17. parmValue.page = 1;
  18. searchList();
  19. "
  20. @screen-submit="
  21. pageInfo.curr = 1;
  22. parmValue.page = 1;
  23. searchList();
  24. "
  25. >
  26. <template #table-header="{}">
  27. <div style="width: 100%">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="24">
  30. <!--
  31. <el-col :span="4" style="width: 400px;">
  32. <search-customer
  33. :value="customerCode"
  34. :size="searchSize"
  35. :placeholder="'购买方公司名称'"
  36. @searchChange="customerChange"
  37. />
  38. </el-col>
  39. <el-col :span="4" style="width: 410px; padding: 0 0 0 10px">
  40. <search-customer
  41. :value="customerCode"
  42. :size="searchSize"
  43. :placeholder="'购买方公司名称'"
  44. @searchChange="customerChange"
  45. />
  46. </el-col> -->
  47. <!-- <el-col :span="4" style="width: 140px">
  48. <el-select
  49. :size="searchSize"
  50. v-model="parmValue.status"
  51. filterable
  52. clearable
  53. placeholder="竞价类型"
  54. style="width: 100%"
  55. @change="
  56. pageInfo.curr = 1;
  57. parmValue.page = 1;
  58. searchList();
  59. "
  60. >
  61. <el-option
  62. v-for="item in statusList"
  63. :key="'status' + item"
  64. :label="iteme"
  65. :value="item"
  66. />
  67. </el-select>
  68. </el-col> -->
  69. <el-col :span="6" style="width: 293px;">
  70. <period-date-picker
  71. :start="parmValue.start"
  72. :end="parmValue.end"
  73. :type="1"
  74. :width="'135px'"
  75. :size="searchSize"
  76. @timeReturned="timeReturned($event)"
  77. />
  78. </el-col>
  79. <el-col :span="4" style="width: 300px; padding: 0 0 0 10px">
  80. <el-input
  81. placeholder="订单编号"
  82. v-model="parmValue.orderCode"
  83. :size="searchSize"
  84. :maxlength="40"
  85. @blur="
  86. pageInfo.curr = 1;
  87. parmValue.page = 1;
  88. searchList();
  89. "
  90. >
  91. <el-button
  92. slot="append"
  93. icon="el-icon-search"
  94. @click="
  95. pageInfo.curr = 1;
  96. parmValue.page = 1;
  97. searchList();
  98. "
  99. ></el-button>
  100. </el-input>
  101. </el-col>
  102. <el-col :span="3" style="width: 66px; float: right">
  103. <el-button
  104. :size="searchSize"
  105. type="primary"
  106. style="float: right; margin-left: 5px"
  107. @click="searchList"
  108. >
  109. 刷新
  110. </el-button>
  111. </el-col>
  112. <el-col :span="4" style="width: 66px; float: right">
  113. <el-button
  114. type="warning"
  115. class="fr"
  116. :size="searchSize"
  117. @click="restSearch"
  118. >
  119. 重置
  120. </el-button>
  121. </el-col>
  122. </el-col>
  123. </el-row>
  124. </div>
  125. </template>
  126. <template #status="{ scope }">
  127. <el-tag
  128. :size="tablebtnSize"
  129. :type="scope.row.status == '0' ? 'warning' : ''"
  130. v-text="
  131. (statusOptions.find((item) => item.id == scope.row.status) || {})
  132. .label || '--'
  133. "
  134. ></el-tag>
  135. </template>
  136. <template #operation="{ scope }">
  137. <el-tooltip
  138. v-if="powers.some((item) => item == '007')"
  139. effect="dark"
  140. content="详情"
  141. placement="top"
  142. >
  143. <i
  144. class="el-icon-view tb-icon"
  145. @click="getRouter('zxDiffOrderDetail', scope.row.id )"
  146. ></i>
  147. </el-tooltip>
  148. </template>
  149. </ex-table>
  150. </div>
  151. <div v-else>
  152. <no-auth></no-auth>
  153. </div>
  154. </div>
  155. </template>
  156. <script>
  157. import mixinPage from "@/mixins/elPaginationHandle";
  158. import resToken from "@/mixins/resToken";
  159. import asyncRequest from "@/apis/service/sellOut/zxDiffOrder";
  160. import { mapGetters } from "vuex";
  161. import { columns } from "./columns";
  162. export default {
  163. name: "zxDiffOrder",
  164. mixins: [mixinPage, resToken],
  165. computed: {
  166. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  167. powers() {
  168. let tran =
  169. this.$store.getters.btnList.find(
  170. (item) => item.menu_route == "zxDiffOrder"
  171. ) || {};
  172. if (tran && tran.action && tran.action.length > 0) {
  173. return tran.action;
  174. } else {
  175. return [];
  176. }
  177. },
  178. },
  179. data() {
  180. return {
  181. select: "1",
  182. input: "",
  183. addShowModel: false,
  184. addModelId: "",
  185. addIsDetail: false,
  186. customerCode: [],
  187. sitem: null,
  188. // 状态
  189. statusOptions: [
  190. { id: "1", label: "待业务部门审核" },
  191. { id: "2", label: "工差单审核完成" },
  192. ],
  193. statusList: [
  194. "样品竞价单",
  195. "线上竞价",
  196. "线上贵金属",
  197. "线下竞价",
  198. "线下贵金属",
  199. "赠品竞价单",
  200. "项目竞聘",
  201. ],
  202. loading: true,
  203. showModel: false,
  204. isDetail: false,
  205. modelId: 0,
  206. parmValue: {
  207. zxNo: "", // 竞价单编码
  208. khNo: "", // 客户编码
  209. cpName: "", //商品名称
  210. status: "", //竞价类型
  211. salesman: "", //申请人
  212. start: "",
  213. end: "",
  214. page: 1, // 页码
  215. size: 15, // 每页显示条数
  216. },
  217. tableData: [],
  218. passwordModel: false,
  219. passwordModelId: 0,
  220. isPasswordDetail: false,
  221. // 表格 - 数据
  222. tableData: [],
  223. // 表格 - 参数
  224. table: {
  225. stripe: true,
  226. border: true,
  227. _defaultHeader_: ["setcol"],
  228. },
  229. // 表格 - 分页
  230. pageInfo: {
  231. size: 15,
  232. curr: 1,
  233. total: 0,
  234. },
  235. // 表格 - 列参数
  236. columns: columns,
  237. };
  238. },
  239. mounted() {
  240. const { back } = this.$route.query;
  241. if (back) {
  242. this.parmValue = JSON.parse(back);
  243. console.log(this.parmValue)
  244. const {page,size}=this.parmValue;
  245. // this.parmValue.start = start || last_start;
  246. // this.parmValue.end = end || last_end;
  247. // if(this.parmValue.companyNo.length>0){
  248. // this.customerCode = [this.parmValue.companyNo] ;
  249. // }
  250. this.pageInfo= {
  251. size: size,
  252. curr: page,
  253. total: 0,
  254. }
  255. //多选条件
  256. this.select = this.parmValue.select;
  257. // this.sselect = this.parmValue.sselect;
  258. this.s_input = this.parmValue.s_input
  259. }else{
  260. this.select = "1";
  261. // this.sselect = "创建时间"
  262. }
  263. this.searchList();
  264. },
  265. methods: {
  266. getRouter(toRouter, queryId){
  267. if (toRouter && queryId) {
  268. let model = {
  269. id: queryId,
  270. // type: 'view',
  271. };
  272. //有多选框的条件
  273. this.parmValue.select = this.select ;
  274. // this.parmValue.sselect = this.sselect ;
  275. this.parmValue.s_input= this.s_input;
  276. //
  277. let routerModel = {
  278. options: JSON.parse(JSON.stringify(this.parmValue)),
  279. router: this.$route.path,
  280. };
  281. model.preModel = JSON.stringify(routerModel);
  282. this.routeGoto(toRouter, model);
  283. } else {
  284. this.$message.warning("暂未找到相关流程!");
  285. }
  286. },
  287. async timeReturned(e) {
  288. if (e.startTime !== "") {
  289. this.parmValue.start = e.startTime;
  290. } else {
  291. this.parmValue.start = "";
  292. }
  293. if (e.endTime !== "") {
  294. this.parmValue.end = e.endTime;
  295. } else {
  296. this.parmValue.end = "";
  297. }
  298. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  299. this.parmValue.page = 1;
  300. await this.searchList();
  301. }
  302. },
  303. restSearch() {
  304. // 表格 - 分页
  305. this.pageInfo = {
  306. size: 15,
  307. curr: 1,
  308. total: 0,
  309. };
  310. this.select = "1";
  311. this.input = "";
  312. this.customerCode = [];
  313. this.parmValue = {
  314. zxNo: "", // 竞价单编码
  315. khNo: "", // 客户编码
  316. cpName: "", //商品名称
  317. status: "", //竞价类型
  318. salesman: "", //申请人
  319. start: "",
  320. end: "",
  321. page: 1, // 页码
  322. size: 15, // 每页显示条数
  323. };
  324. this.searchList();
  325. },
  326. async customerChange(e) {
  327. if (e && e.id) {
  328. this.customerCode = [e.code];
  329. this.parmValue.khNo = e.code;
  330. } else {
  331. this.customerCode = [];
  332. this.parmValue.khNo = "";
  333. }
  334. this.parmValue.page = 1;
  335. await this.searchList();
  336. },
  337. openModal(id, isDetail) {
  338. this.showModel = true;
  339. this.modelId = id;
  340. this.isDetail = isDetail;
  341. },
  342. addModal(id, isDetail) {
  343. this.addShowModel = true;
  344. this.addModelId = id;
  345. this.addIsDetail = isDetail;
  346. },
  347. async deleteById(id, status) {
  348. await this.$confirm("确定要删除?", {
  349. confirmButtonText: "确定",
  350. cancelButtonText: "取消",
  351. type: "warning",
  352. })
  353. .then(async () => {
  354. const model = {
  355. id: id,
  356. // status: status === "1" ? "0" : "1",
  357. };
  358. const res = await asyncRequest.delete(model);
  359. if (res && res.code === 0) {
  360. this.$notify.success({
  361. title: "删除成功",
  362. message: "",
  363. });
  364. this.searchList();
  365. } else if (res && res.code >= 100 && res.code <= 104) {
  366. await this.logout();
  367. } else {
  368. this.$message.warning(res.message);
  369. }
  370. })
  371. .catch(() => {
  372. console.log("取消");
  373. });
  374. },
  375. async searchList() {
  376. if (
  377. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  378. (this.parmValue.start == "" && this.parmValue.end != "")
  379. ) {
  380. this.$message.warning("开始时间和结束时间不能为空");
  381. return;
  382. }
  383. this.loading = true;
  384. this.parmValue.zxNo = this.select === "1" ? this.input : ""; //竞价类型
  385. this.parmValue.salesman = this.select === "2" ? this.input : ""; //申请人
  386. this.parmValue.cpName = this.select === "3" ? this.input : ""; //商品名称
  387. const res = await asyncRequest.list(this.parmValue);
  388. if (res && res.code === 0 && res.data) {
  389. this.tableData = res.data.list;
  390. this.tableData.map((v) => {
  391. v.sale_price = this.setNum(v.sale_price);
  392. v.sale_fee = this.setNum(v.sale_fee);
  393. v.class_cat = "";
  394. if (v.can && v.can.length > 0) {
  395. v.can.forEach((x, i) => {
  396. v.class_cat += i === 0 ? x.name : "/" + x.name;
  397. });
  398. }
  399. return v;
  400. });
  401. this.pageInfo.total = Number(res.data.count);
  402. } else if (res && res.code >= 100 && res.code <= 104) {
  403. await this.logout();
  404. } else {
  405. this.tableData = [];
  406. this.pageInfo.total = 0;
  407. }
  408. this.loading = false;
  409. },
  410. },
  411. };
  412. </script>
  413. <style lang="scss" scoped>
  414. .zxDiffOrder {
  415. }
  416. </style>