index.vue 13 KB

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