index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <div class="zxDiffOrder pagePadding">
  3. <div
  4. v-if=" powers.some((i) => i == '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="customer_code"
  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="customer_code"
  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="margin-left: 10px">
  80. <search-customer
  81. :value="customerCode"
  82. :size="searchSize"
  83. :placeholder="'企业客户'"
  84. @searchChange="customerChange"
  85. :names="parmValue.supplierName"
  86. :is-detail="true"
  87. />
  88. </el-col>
  89. <el-col :span="3" style="width: 66px; float: right">
  90. <el-button
  91. :size="searchSize"
  92. type="primary"
  93. style="float: right; margin-left: 5px"
  94. @click="searchList"
  95. >
  96. 刷新
  97. </el-button>
  98. </el-col>
  99. <el-col :span="4" style="width: 66px; float: right">
  100. <el-button
  101. type="warning"
  102. class="fr"
  103. :size="searchSize"
  104. @click="restSearch"
  105. >
  106. 重置
  107. </el-button>
  108. </el-col>
  109. </el-col>
  110. </el-row>
  111. <el-row style="margin-top: 10px">
  112. <el-col :span="4" style="width: 150px;">
  113. <el-select
  114. :size="searchSize"
  115. v-model="parmValue.order_source"
  116. filterable
  117. clearable
  118. placeholder="订单来源"
  119. style="width: 100%"
  120. @change="
  121. pageInfo.curr = 1;
  122. parmValue.page = 1;
  123. searchList();
  124. "
  125. >
  126. <el-option
  127. v-for="item in xs_order_source_options"
  128. :key="'orderstatus' + item.id"
  129. :label="item.label"
  130. :value="item.id"
  131. />
  132. </el-select>
  133. </el-col>
  134. <!-- { id: "0", name: "非库存品" },
  135. { id: "1", name: "库存品" }, -->
  136. <el-col :span="4" style="width:150px;margin-left:10px">
  137. <el-select
  138. v-model="parmValue.is_stock"
  139. placeholder="商品类型" size="mini"
  140. clearable
  141. @change="
  142. pageInfo.curr = 1;
  143. parmValue.page = 1;
  144. searchList();"
  145. @close="
  146. pageInfo.curr = 1;
  147. parmValue.page = 1;
  148. searchList();"
  149. >
  150. <el-option
  151. v-for="item in is_stock"
  152. :key="'orderstatus' + item.id"
  153. :label="item.name"
  154. :value="item.id"
  155. />
  156. </el-select>
  157. </el-col>
  158. <el-col :span="4">
  159. <search-supplier
  160. :size="'mini'"
  161. style="margin-left: 10px"
  162. :value="supplierNo"
  163. :disabled="false"
  164. :placeholder="'供应商名称'"
  165. :names="''"
  166. :isDetail="false"
  167. :noDisabled="true"
  168. @searchChange="supplierChange"
  169. />
  170. </el-col>
  171. </el-row>
  172. <el-row style="margin-top:10px">
  173. <el-col :span="4" style="width: 300px">
  174. <el-input
  175. placeholder="订单编号"
  176. v-model="parmValue.orderCode"
  177. :size="searchSize"
  178. :maxlength="40"
  179. @blur="
  180. pageInfo.curr = 1;
  181. parmValue.page = 1;
  182. searchList();
  183. "
  184. >
  185. <el-button
  186. slot="append"
  187. icon="el-icon-search"
  188. @click="
  189. pageInfo.curr = 1;
  190. parmValue.page = 1;
  191. searchList();
  192. "
  193. ></el-button>
  194. </el-input>
  195. </el-col>
  196. </el-row>
  197. </div>
  198. </template>
  199. <template #status="{ scope }">
  200. <el-tag
  201. :size="tablebtnSize"
  202. :type="scope.row.status == '0' ? 'warning' : ''"
  203. v-text="
  204. (statusOptions.find((item) => item.id == scope.row.status) || {})
  205. .label || '--'
  206. "
  207. ></el-tag>
  208. </template>
  209. <template #order_source="{ scope }">
  210. <el-tag
  211. :size="tablebtnSize"
  212. v-text="
  213. (
  214. xs_order_source_options.find(
  215. (item) => item.id == scope.row.order_source
  216. ) || {}
  217. ).label || '--'
  218. "
  219. ></el-tag>
  220. </template>
  221. <template #order_type="{ scope }">
  222. <el-tag
  223. :size="tablebtnSize"
  224. v-text="
  225. (
  226. is_stock.find(
  227. (item) => item.id == scope.row.is_stock
  228. ) || {}
  229. ).name || '--'
  230. "
  231. ></el-tag>
  232. </template>
  233. <template #operation="{ scope }">
  234. <el-tooltip
  235. v-if="powers.some((i) => i == '007')"
  236. effect="dark"
  237. content="详情"
  238. placement="top"
  239. >
  240. <i
  241. class="el-icon-view tb-icon"
  242. @click="getRouter('zxDiffOrderDetail', scope.row.id )"
  243. ></i>
  244. </el-tooltip>
  245. </template>
  246. </ex-table>
  247. </div>
  248. <div v-else>
  249. <no-auth></no-auth>
  250. </div>
  251. </div>
  252. </template>
  253. <script>
  254. import mixinPage from "@/mixins/elPaginationHandle";
  255. import resToken from "@/mixins/resToken";
  256. import asyncRequest from "@/apis/service/sellOut/zxDiffOrder";
  257. import companyHelper from "@/mixins/companyHelper";
  258. import { mapGetters } from "vuex";
  259. import { columns } from "./columns";
  260. import { xs_order_source_options , xs_order_type_options} from "@/assets/js/statusList";
  261. export default {
  262. name: "zxDiffOrder",
  263. mixins: [mixinPage, resToken, companyHelper],
  264. computed: {
  265. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  266. powers() {
  267. const tran =
  268. this.$store.getters.btnList.find(
  269. (item) => item.menu_route == "zxDiffOrder"
  270. ) || {};
  271. const { action } = tran ?? {};
  272. return action ?? [];
  273. },
  274. },
  275. data() {
  276. return {
  277. supplierNo:"",
  278. xs_order_source_options,
  279. xs_order_type_options,
  280. select: "1",
  281. input: "",
  282. addShowModel: false,
  283. addModelId: "",
  284. addIsDetail: false,
  285. customerCode: [],
  286. sitem: null,
  287. // 状态
  288. statusOptions: [
  289. { id: "1", label: "待业务部门审核" },
  290. { id: "2", label: "工差单审核完成" },
  291. ],
  292. statusList: [
  293. "样品竞价单",
  294. "线上竞价",
  295. "线上贵金属",
  296. "线下竞价",
  297. "线下贵金属",
  298. "赠品竞价单",
  299. "项目竞聘",
  300. ],
  301. is_stock: [
  302. { id: "0", name: "非库存品" },
  303. { id: "1", name: "库存品" },
  304. ],
  305. loading: true,
  306. showModel: false,
  307. isDetail: false,
  308. modelId: 0,
  309. parmValue: {
  310. is_stock: "",
  311. order_source: "",
  312. zxNo: "", // 竞价单编码
  313. customer_code: "", // 客户编码
  314. cpName: "", //商品名称
  315. status: "", //竞价类型
  316. salesman: "", //申请人
  317. start: "",
  318. end: "",
  319. page: 1, // 页码
  320. size: 15, // 每页显示条数
  321. },
  322. tableData: [],
  323. passwordModel: false,
  324. passwordModelId: 0,
  325. isPasswordDetail: false,
  326. // 表格 - 数据
  327. tableData: [],
  328. // 表格 - 参数
  329. table: {
  330. stripe: true,
  331. border: true,
  332. _defaultHeader_: ["setcol"],
  333. },
  334. // 表格 - 分页
  335. pageInfo: {
  336. size: 15,
  337. curr: 1,
  338. total: 0,
  339. },
  340. // 表格 - 列参数
  341. columns: columns,
  342. };
  343. },
  344. mounted() {
  345. const { back } = this.$route.query;
  346. if (back) {
  347. this.parmValue = JSON.parse(back);
  348. console.log(this.parmValue)
  349. const {page,size}=this.parmValue;
  350. // this.parmValue.start = start || last_start;
  351. // this.parmValue.end = end || last_end;
  352. // if(this.parmValue.companyNo.length>0){
  353. // this.customerCode = [this.parmValue.companyNo] ;
  354. // }
  355. this.pageInfo= {
  356. size: size,
  357. curr: page,
  358. total: 0,
  359. }
  360. //多选条件
  361. this.select = this.parmValue.select;
  362. // this.sselect = this.parmValue.sselect;
  363. this.s_input = this.parmValue.s_input
  364. }else{
  365. this.select = "1";
  366. // this.sselect = "创建时间"
  367. }
  368. this.searchList();
  369. },
  370. methods: {
  371. async supplierChange(e) {
  372. const { code, label } = e;
  373. this.supplierNo = code ? [code] : [];
  374. this.searchList()
  375. },
  376. getRouter(toRouter, queryId){
  377. if (toRouter && queryId) {
  378. let model = {
  379. id: queryId,
  380. // type: 'view',
  381. };
  382. //有多选框的条件
  383. this.parmValue.select = this.select ;
  384. // this.parmValue.sselect = this.sselect ;
  385. this.parmValue.s_input= this.s_input;
  386. //
  387. let routerModel = {
  388. options: JSON.parse(JSON.stringify(this.parmValue)),
  389. router: this.$route.path,
  390. };
  391. model.preModel = JSON.stringify(routerModel);
  392. this.routeGoto(toRouter, model);
  393. } else {
  394. this.$message.warning("暂未找到相关流程!");
  395. }
  396. },
  397. async timeReturned(e) {
  398. if (e.startTime !== "") {
  399. this.parmValue.start = e.startTime;
  400. } else {
  401. this.parmValue.start = "";
  402. }
  403. if (e.endTime !== "") {
  404. this.parmValue.end = e.endTime;
  405. } else {
  406. this.parmValue.end = "";
  407. }
  408. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  409. this.parmValue.page = 1;
  410. await this.searchList();
  411. }
  412. },
  413. restSearch() {
  414. // 表格 - 分页
  415. this.pageInfo = {
  416. size: 15,
  417. curr: 1,
  418. total: 0,
  419. };
  420. this.select = "1";
  421. this.input = "";
  422. this.customerCode = [];
  423. this.parmValue = {
  424. zxNo: "", // 竞价单编码
  425. customer_code: "", // 客户编码
  426. cpName: "", //商品名称
  427. status: "", //竞价类型
  428. salesman: "", //申请人
  429. start: "",
  430. end: "",
  431. page: 1, // 页码
  432. size: 15, // 每页显示条数
  433. };
  434. this.searchList();
  435. },
  436. async customerChange(e) {
  437. if (e && e.id) {
  438. this.customerCode = [e.code];
  439. this.parmValue.customer_code = e.code;
  440. } else {
  441. this.customerCode = [];
  442. this.parmValue.customer_code = "";
  443. }
  444. this.parmValue.page = 1;
  445. await this.searchList();
  446. },
  447. openModal(id, isDetail) {
  448. this.showModel = true;
  449. this.modelId = id;
  450. this.isDetail = isDetail;
  451. },
  452. addModal(id, isDetail) {
  453. this.addShowModel = true;
  454. this.addModelId = id;
  455. this.addIsDetail = isDetail;
  456. },
  457. async deleteById(id, status) {
  458. await this.$confirm("确定要删除?", {
  459. confirmButtonText: "确定",
  460. cancelButtonText: "取消",
  461. type: "warning",
  462. })
  463. .then(async () => {
  464. const model = {
  465. id: id,
  466. // status: status === "1" ? "0" : "1",
  467. };
  468. const res = await asyncRequest.delete(model);
  469. if (res && res.code === 0) {
  470. this.$notify.success({
  471. title: "删除成功",
  472. message: "",
  473. });
  474. this.searchList();
  475. } else if (res && res.code >= 100 && res.code <= 104) {
  476. await this.logout();
  477. } else {
  478. this.$message.warning(res.message);
  479. }
  480. })
  481. .catch(() => {
  482. console.log("取消");
  483. });
  484. },
  485. async searchList() {
  486. if (
  487. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  488. (this.parmValue.start == "" && this.parmValue.end != "")
  489. ) {
  490. this.$message.warning("开始时间和结束时间不能为空");
  491. return;
  492. }
  493. this.loading = true;
  494. this.parmValue.zxNo = this.select === "1" ? this.input : ""; //竞价类型
  495. this.parmValue.salesman = this.select === "2" ? this.input : ""; //申请人
  496. this.parmValue.cpName = this.select === "3" ? this.input : ""; //商品名称
  497. const res = await asyncRequest.list({
  498. ...this.parmValue,
  499. supplierNo:Array.isArray(this.supplierNo) ? this.supplierNo[0] : this.supplierNo,
  500. needRela: true
  501. });
  502. if (res && res.code === 0 && res.data) {
  503. this.tableData = res.data.list;
  504. this.tableData.map((v) => {
  505. v.sale_price = this.setNum(v.sale_price);
  506. v.sale_fee = this.setNum(v.sale_fee);
  507. v.class_cat = "";
  508. if (v.can && v.can.length > 0) {
  509. v.can.forEach((x, i) => {
  510. v.class_cat += i === 0 ? x.name : "/" + x.name;
  511. });
  512. }
  513. return v;
  514. });
  515. this.pageInfo.total = Number(res.data.count);
  516. } else if (res && res.code >= 100 && res.code <= 104) {
  517. await this.logout();
  518. } else {
  519. this.tableData = [];
  520. this.pageInfo.total = 0;
  521. }
  522. this.loading = false;
  523. },
  524. },
  525. };
  526. </script>
  527. <style lang="scss" scoped>
  528. .zxDiffOrder {
  529. }
  530. </style>