index.vue 13 KB

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