index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <div class="zixunOrder pagePadding">
  3. <div v-if="powers.some((i) => i == '001')">
  4. <ex-table
  5. v-loading="loading"
  6. :table="table"
  7. :data="tableData"
  8. :columns="columns"
  9. :page="pageInfo"
  10. :size="size"
  11. @page-curr-change="handlePageChange"
  12. @page-size-change="handleSizeChange"
  13. @screen-reset="
  14. pageInfo.curr = 1;
  15. parmValue.page = 1;
  16. searchList();
  17. "
  18. @screen-submit="
  19. pageInfo.curr = 1;
  20. parmValue.page = 1;
  21. searchList();
  22. "
  23. >
  24. <template #table-header="{}">
  25. <div style="width: 100%">
  26. <el-row style="padding: 0 0 0 80px">
  27. <el-col :span="4" style="width: 130px">
  28. <el-select
  29. :size="searchSize"
  30. v-model="parmValue.status"
  31. clearable
  32. placeholder="状态"
  33. @change="
  34. pageInfo.curr = 1;
  35. parmValue.page = 1;
  36. searchList();
  37. "
  38. >
  39. <el-option
  40. v-for="item in options"
  41. :key="item.id"
  42. :label="item.label"
  43. :value="item.id"
  44. >
  45. </el-option>
  46. </el-select>
  47. </el-col>
  48. <el-col :span="4" style="width: 380px; padding: 0px 0 0 10px">
  49. <search-customer
  50. :value="parmValue.khNo"
  51. :size="searchSize"
  52. :placeholder="'企业客户'"
  53. @searchChange="customerChange"
  54. :names="parmValue.khName"
  55. :is-detail="true"
  56. />
  57. </el-col>
  58. <el-col :span="3" style="width: 66px; float: right">
  59. <el-button
  60. :size="searchSize"
  61. type="primary"
  62. style="float: right; margin-left: 5px"
  63. @click="searchList"
  64. >
  65. 刷新
  66. </el-button>
  67. </el-col>
  68. <el-col :span="4" class="fr" style="width: 66px">
  69. <el-button
  70. type="warning"
  71. class="fr"
  72. :size="searchSize"
  73. @click="restSearch"
  74. >
  75. 重置
  76. </el-button>
  77. </el-col>
  78. </el-row>
  79. <el-row style="padding-top: 10px">
  80. <el-col :span="4" style="width: 291px">
  81. <period-date-picker
  82. :start="parmValue.start"
  83. :end="parmValue.end"
  84. :width="'134px'"
  85. :size="searchSize"
  86. @timeReturned="handleTime"
  87. />
  88. </el-col>
  89. <el-col :span="4" style="width: 420px; padding: 0 0 0 10px">
  90. <el-input
  91. clearable
  92. :size="searchSize"
  93. placeholder="关键字"
  94. v-model="s_input"
  95. maxlength="40"
  96. @blur="
  97. pageInfo.curr = 1;
  98. parmValue.page = 1;
  99. searchList();
  100. "
  101. class="input-with-select"
  102. >
  103. <el-select
  104. style="width: 140px"
  105. v-model="select"
  106. slot="prepend"
  107. placeholder="关键字类型"
  108. >
  109. <el-option label="竞价单编号" value="1" />
  110. <el-option label="商品名称" value="2" />
  111. <el-option label="申请人" value="3" />
  112. <el-option label="申请人部门" value="4" />
  113. </el-select>
  114. </el-input>
  115. </el-col>
  116. <el-col
  117. :span="3"
  118. class="fr"
  119. style="width: 66px; padding: 0 0 0 10px"
  120. v-if="powers.some((i) => i == '003') && !isSupertube"
  121. >
  122. <el-button
  123. :size="searchSize"
  124. type="success"
  125. style="float: right"
  126. @click="handleCreate"
  127. >
  128. 添加
  129. </el-button>
  130. </el-col>
  131. </el-row>
  132. </div>
  133. </template>
  134. <template #good_img="{ scope }">
  135. <div
  136. v-if="scope.row.good_img"
  137. style="width: 20px; height: 20px"
  138. class="hover"
  139. v-viewer
  140. >
  141. <img
  142. :src="scope.row.good_img"
  143. style="display: inline-block; width: 100%; height: 100%"
  144. alt=""
  145. />
  146. </div>
  147. </template>
  148. <template #status="{ scope }">
  149. <el-tag
  150. :size="tablebtnSize"
  151. :type="
  152. String(scope.row.status) === '5'
  153. ? ''
  154. : String(scope.row.status) === '6' || String(scope.row.status) === '7'
  155. ? 'info'
  156. : 'warning'
  157. "
  158. v-text="
  159. (options.find((item) => item.id === String(scope.row.status)) || {})
  160. .label || '--'
  161. "
  162. ></el-tag>
  163. </template>
  164. <template #is_project="{ scope }">
  165. <el-tag
  166. :size="'mini'"
  167. :type="String(scope.row.is_project) === '1' ? 'success' : ''"
  168. >{{
  169. String(scope.row.is_project) === "0"
  170. ? "非项目竞价单"
  171. : String(scope.row.is_project) === "1"
  172. ? "项目竞价单"
  173. : "--"
  174. }}</el-tag
  175. >
  176. </template>
  177. <template #operation="{ scope }">
  178. <el-tooltip
  179. v-if="powers.some((i) => i == '007')"
  180. effect="dark"
  181. content="详情"
  182. placement="top"
  183. >
  184. <i
  185. class="el-icon-view tb-icon"
  186. @click="getRouter('zixunOrderDetail', scope.row.infoNo)"
  187. ></i>
  188. </el-tooltip>
  189. <el-tooltip
  190. effect="dark"
  191. content="复制"
  192. placement="top"
  193. v-if="
  194. powers.some((i) => i == '010') &&
  195. String(scope.row.is_project) === '0' &&
  196. String(scope.row.status) !== '0' &&
  197. !isSupertube
  198. "
  199. >
  200. <i
  201. class="el-icon-document-copy tb-icon"
  202. @click="getRouterEdit('zixunOrderDetail', scope.row.infoNo)"
  203. ></i>
  204. </el-tooltip>
  205. <!-- <el-tooltip
  206. effect="dark"
  207. content="编辑"
  208. placement="top"
  209. v-if="
  210. powers.some((i) => i == '005') &&
  211. String(scope.row.status) === '0' &&
  212. !isSupertube
  213. "
  214. >
  215. <i
  216. class="el-icon-edit tb-icon"
  217. @click="getRouterEdit('zixunOrderDetail', scope.row.infoNo)"
  218. ></i>
  219. </el-tooltip> -->
  220. </template>
  221. </ex-table>
  222. </div>
  223. <div v-else>
  224. <no-auth></no-auth>
  225. </div>
  226. </div>
  227. </template>
  228. <script>
  229. import mixinPage from "@/mixins/elPaginationHandle";
  230. import resToken from "@/mixins/resToken";
  231. import companyHelper from "@/mixins/companyHelper";
  232. import { statusList } from "@/assets/js/statusList";
  233. import asyncRequest from "@/apis/service/sellOut/zixunOrder";
  234. import { listCol, options } from "./columns";
  235. import { mapGetters } from "vuex";
  236. export default {
  237. name: "zixunOrder",
  238. mixins: [mixinPage, resToken, companyHelper],
  239. computed: {
  240. ...mapGetters(["tablebtnSize", "searchSize", "size", "isSupertube"]),
  241. powers() {
  242. const { btnList } = this.$store.getters;
  243. const tran = btnList.find((i) => i.menu_route == "zixunOrder") || {};
  244. const { action } = tran ?? {};
  245. console.log(action)
  246. return action ?? [];
  247. },
  248. },
  249. data() {
  250. return {
  251. select: "1",
  252. s_input: "",
  253. options,
  254. post_ownOptions: [
  255. { id: "1", label: "客户承担" },
  256. { id: "2", label: "公司承担" },
  257. { id: "3", label: "供应商承担" },
  258. ],
  259. sitem: null,
  260. // 状态
  261. statusOptions: [
  262. { id: "0", label: "待审核" },
  263. { id: "1", label: "待物流反馈" },
  264. { id: "3", label: "待退货" },
  265. { id: "4", label: "已退货" },
  266. { id: "5", label: "待客户验收" },
  267. ],
  268. statusList: statusList,
  269. loading: true,
  270. showModel: false,
  271. isDetail: false,
  272. modelId: 0,
  273. parmValue: {
  274. khName: "",
  275. khNo: [],
  276. zxNo: "",
  277. salesman: "",
  278. customerName: "",
  279. cpName: "",
  280. status: "", //售后申请单处理状态
  281. start: "",
  282. end: "",
  283. page: 1, // 页码
  284. size: 15, // 每页显示条数
  285. company_name: "",
  286. },
  287. // 表格 - 数据
  288. tableData: [],
  289. // 表格 - 参数
  290. table: {
  291. stripe: true,
  292. border: true,
  293. _defaultHeader_: ["setcol"],
  294. },
  295. // 表格 - 分页
  296. pageInfo: {
  297. size: 15,
  298. curr: 1,
  299. total: 0,
  300. },
  301. // 表格 - 列参数
  302. columns: listCol,
  303. };
  304. },
  305. mounted() {
  306. const { back } = this.$route.query;
  307. if (back) {
  308. this.parmValue = JSON.parse(back);
  309. const { page, size } = this.parmValue;
  310. if (this.parmValue.khNo.length > 0) {
  311. this.customerCode = [this.parmValue.khNo];
  312. }
  313. this.pageInfo = {
  314. size: size,
  315. curr: page,
  316. total: 0,
  317. };
  318. //多选条件
  319. this.select = this.parmValue.select;
  320. // this.sselect = this.parmValue.sselect;
  321. this.s_input = this.parmValue.s_input;
  322. } else {
  323. this.select = "1";
  324. // this.sselect = "创建时间"
  325. }
  326. this.searchList();
  327. },
  328. methods: {
  329. handleCreate() {
  330. if (!this.currentIsBusinessCompany()) return;
  331. this.routeGoto("zixunOrderDetail", { id: "add", type: "add" });
  332. },
  333. getRouter(toRouter, queryId) {
  334. if (toRouter && queryId) {
  335. let model = {
  336. id: queryId,
  337. type: "view",
  338. };
  339. //有多选框的条件
  340. this.parmValue.select = this.select;
  341. this.parmValue.s_input = this.s_input;
  342. let routerModel = {
  343. options: JSON.parse(JSON.stringify(this.parmValue)),
  344. router: this.$route.path,
  345. };
  346. model.preModel = JSON.stringify(routerModel);
  347. this.routeGoto(toRouter, model);
  348. } else {
  349. this.$message.warning("暂未找到相关流程!");
  350. }
  351. },
  352. getRouterEdit(toRouter, queryId) {
  353. if (toRouter && queryId) {
  354. let model = {
  355. id: queryId,
  356. type: "copy-edit",
  357. };
  358. //有多选框的条件
  359. this.parmValue.select = this.select;
  360. this.parmValue.s_input = this.s_input;
  361. let routerModel = {
  362. options: JSON.parse(JSON.stringify(this.parmValue)),
  363. router: this.$route.path,
  364. };
  365. model.preModel = JSON.stringify(routerModel);
  366. this.routeGoto(toRouter, model);
  367. } else {
  368. this.$message.warning("暂未找到相关流程!");
  369. }
  370. },
  371. restSearch() {
  372. this.select = "1";
  373. this.s_input = "";
  374. this.parmValue = {
  375. khNo: [],
  376. zxNo: "",
  377. salesman: "",
  378. cpName: "",
  379. status: "", //售后申请单处理状态
  380. start: "",
  381. end: "",
  382. page: 1, // 页码
  383. size: 15, // 每页显示条数
  384. company_name: "",
  385. };
  386. // 表格 - 分页
  387. this.pageInfo = {
  388. size: 15,
  389. curr: 1,
  390. total: 0,
  391. };
  392. this.searchList();
  393. },
  394. openModal(id, isDetail, sitem) {
  395. this.showModel = true;
  396. this.modelId = id;
  397. this.isDetail = isDetail;
  398. this.sitem = sitem;
  399. },
  400. // 列表搜索
  401. async searchList() {
  402. if (
  403. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  404. (this.parmValue.start == "" && this.parmValue.end != "")
  405. ) {
  406. this.$message.warning("开始时间和结束时间不能为空");
  407. return;
  408. }
  409. this.loading = true;
  410. let model = JSON.parse(JSON.stringify(this.parmValue));
  411. model.khNo = model.khNo.length > 0 ? model.khNo[model.khNo.length - 1] : "";
  412. model.zxNo = this.select === "1" ? this.s_input : "";
  413. model.cpName = this.select === "2" ? this.s_input : "";
  414. model.salesman = this.select === "3" ? this.s_input : "";
  415. model.company_name = this.select === "4" ? this.s_input : "";
  416. const res = await asyncRequest.list({
  417. ...model,
  418. needRela: true,
  419. });
  420. if (res && res.code === 0 && res.data) {
  421. this.tableData = res.data.list;
  422. this.pageInfo.total = Number(res.data.count);
  423. } else if (res && res.code >= 100 && res.code <= 104) {
  424. await this.logout();
  425. } else {
  426. this.tableData = [];
  427. this.pageInfo.total = 0;
  428. }
  429. this.loading = false;
  430. },
  431. // 时间选择事件
  432. async handleTime(e) {
  433. if (e.startTime !== "") {
  434. this.parmValue.start = e.startTime;
  435. } else {
  436. this.parmValue.start = "";
  437. }
  438. if (e.endTime !== "") {
  439. this.parmValue.end = e.endTime;
  440. } else {
  441. this.parmValue.end = "";
  442. }
  443. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  444. this.pageInfo.curr = 1;
  445. this.parmValue.page = 1;
  446. await this.searchList();
  447. }
  448. },
  449. async customerChange(e) {
  450. const { code } = e;
  451. this.parmValue.khNo = code ? [code] : [];
  452. this.parmValue.khName = e.label;
  453. // this.parmValue.supplierName = e.label;
  454. this.pageInfo.curr = 1;
  455. this.parmValue.page = 1;
  456. await this.searchList();
  457. },
  458. async order_copy(infoNo) {
  459. if (this.loading) {
  460. return;
  461. }
  462. await this.$confirm(`确定要复制该竞价单?`, {
  463. confirmButtonText: "确定",
  464. cancelButtonText: "取消",
  465. type: "warning",
  466. })
  467. .then(async () => {
  468. this.loading = true;
  469. const model = {
  470. infoNo,
  471. };
  472. const { code, message } = await asyncRequest.copy(model);
  473. if (code === 0) {
  474. this.loading = false;
  475. this.$notify.success({
  476. title: "复制竞价单成功!",
  477. message: "",
  478. });
  479. await this.searchList();
  480. } else if (code >= 100 && code <= 104) {
  481. await this.logout();
  482. } else {
  483. this.loading = false;
  484. this.$message.warning(message);
  485. }
  486. })
  487. .catch(() => {
  488. console.log("取消");
  489. });
  490. },
  491. },
  492. };
  493. </script>
  494. <style lang="scss" scoped>
  495. .zixunOrder {
  496. }
  497. </style>