index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. <template>
  2. <div class="terrace pagePadding">
  3. <ex-table
  4. v-loading="loading"
  5. v-if="powers.some((i) => i == '001')"
  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 10px 80px">
  27. <period-date-picker
  28. :type="1"
  29. :width="'135px'"
  30. :size="searchSize"
  31. :start="parmValue.start"
  32. :end="parmValue.end"
  33. @timeReturned="handleTime"
  34. />
  35. <el-col :span="4" style="width: 373px; margin-left: 15px">
  36. <el-input
  37. size="mini"
  38. v-model="value"
  39. @blur="
  40. pageInfo.curr = 1;
  41. parmValue.page = 1;
  42. searchList();
  43. "
  44. >
  45. <el-select
  46. v-model="select"
  47. style="width: 125px"
  48. slot="prepend"
  49. placeholder="关键字类型"
  50. @change="
  51. pageInfo.curr = 1;
  52. parmValue.page = 1;
  53. searchList();
  54. "
  55. >
  56. <el-option
  57. v-for="key in Object.keys(mapSelectValue2Query)"
  58. :label="mapSelectValue2Query[key]"
  59. :value="key"
  60. :key="key"
  61. ></el-option>
  62. </el-select>
  63. </el-input>
  64. </el-col>
  65. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  66. <el-button type="primary" :size="searchSize" @click="searchList"
  67. >刷新</el-button
  68. >
  69. </el-col>
  70. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
  71. <el-button type="warning" :size="searchSize" @click="restSearch"
  72. >重置</el-button
  73. >
  74. </el-col>
  75. <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px" v-if="powers.includes('003') && !isSupertube">
  76. <el-button type="primary" :size="searchSize" @click="openModal({}, '003')"
  77. >添加</el-button
  78. >
  79. </el-col>
  80. </el-row>
  81. <el-row>
  82. <el-col :span="6" style="margin-right: 15px">
  83. <search-customer
  84. size="mini"
  85. :value="parmValue.customer_code"
  86. :names="customerName"
  87. @searchChange="handleCustomerChange"
  88. placeholder="购买方公司"
  89. />
  90. </el-col>
  91. <el-col :span="3" style="margin-left: 10px">
  92. <el-input
  93. v-model="parmValue.lower_price"
  94. size="mini"
  95. placeholder="最小销售价"
  96. @blur="
  97. pageInfo.curr = 1;
  98. parmValue.page = 1;
  99. searchList();
  100. "
  101. />
  102. </el-col>
  103. <el-col :span="3" style="margin-left: 10px">
  104. <el-input
  105. v-model="parmValue.upper_price"
  106. size="mini"
  107. placeholder="最大销售价"
  108. @blur="
  109. pageInfo.curr = 1;
  110. parmValue.page = 1;
  111. searchList();
  112. "
  113. />
  114. </el-col>
  115. </el-row>
  116. </div>
  117. </template>
  118. <template #status="{ scope }">
  119. <el-tag
  120. :size="tablebtnSize"
  121. :type="scope.row.status + '' == '0' ? 'warning' : ''"
  122. v-text="
  123. (statusOptions.find((item) => item.id == scope.row.status + '') || {})
  124. .label || '--'
  125. "
  126. ></el-tag>
  127. </template>
  128. <template #order_type="{ scope }">
  129. <el-tag
  130. :size="tablebtnSize"
  131. v-text="
  132. (xs_order_type_options.find((item) => item.id == scope.row.order_type) || {})
  133. .label || '--'
  134. "
  135. ></el-tag>
  136. </template>
  137. <template #order_source="{ scope }">
  138. <el-tag
  139. :size="tablebtnSize"
  140. v-text="
  141. (
  142. xs_order_source_options.find((item) => item.id == scope.row.order_source) ||
  143. {}
  144. ).label || '--'
  145. "
  146. ></el-tag>
  147. </template>
  148. <template #operation="{ scope }">
  149. <el-tooltip
  150. v-if="powers.some((i) => i == '007')"
  151. effect="dark"
  152. content="详情"
  153. placement="top"
  154. >
  155. <i class="el-icon-view tb-icon" @click="openModal(scope.row, '007')"></i>
  156. </el-tooltip>
  157. <el-tooltip
  158. v-if="powers.some((i) => i == '005') && !isSupertube"
  159. effect="dark"
  160. content="修改"
  161. placement="top"
  162. >
  163. <i class="el-icon-edit tb-icon" @click="openModal(scope.row, '005')"></i>
  164. </el-tooltip>
  165. </template>
  166. </ex-table>
  167. <no-auth v-else></no-auth>
  168. <!-- 弹窗 新增/修改 -->
  169. <add-edit
  170. :id="modelId"
  171. :show-model="showModel"
  172. :sitem="sitem"
  173. @refresh="searchList"
  174. @cancel="showModel = false"
  175. />
  176. </div>
  177. </template>
  178. <script>
  179. import asyncRequest from "@/apis/service/netOrderEntry/netOrderEnter";
  180. import { statusList } from "@/assets/js/statusList";
  181. import mixinPage from "@/mixins/elPaginationHandle";
  182. import roleLevel from "@/assets/js/roleLevel";
  183. import resToken from "@/mixins/resToken";
  184. import { mapGetters } from "vuex";
  185. import addEdit from "./addEdit";
  186. import { xs_order_type_options, xs_order_source_options } from "@/assets/js/statusList";
  187. import companyHelper from "@/mixins/companyHelper";
  188. export default {
  189. name: "netOrderEnter",
  190. mixins: [mixinPage, resToken, companyHelper],
  191. components: {
  192. addEdit,
  193. },
  194. computed: {
  195. //组件SIZE设置
  196. ...mapGetters(["tablebtnSize", "searchSize", "size", "isSupertube"]),
  197. powers() {
  198. const { btnList } = this.$store.getters;
  199. const tran = btnList.find((i) => i.menu_route == "netOrderEnter") || {};
  200. const { action } = tran ?? {};
  201. return action ?? [];
  202. },
  203. },
  204. data() {
  205. const mapSelectValue2Query = {
  206. orderCode: "销售订单编号",
  207. cgdNo: "采购单编号",
  208. // sale_name: "销售员",
  209. // cgd_sale: "采购员"
  210. };
  211. return {
  212. xs_order_type_options,
  213. xs_order_source_options,
  214. statusList: statusList,
  215. roleLevel: roleLevel,
  216. loading: true,
  217. showModel: false,
  218. modelId: "000",
  219. select: "orderCode",
  220. sitem: {},
  221. customerName: "",
  222. mapSelectValue2Query,
  223. value: "",
  224. parmValue: {
  225. page: 1, // 页码
  226. size: 15, // 每页显示条数
  227. start: "",
  228. end: "",
  229. customer_code: "",
  230. supplierNo: "",
  231. lower_price: "",
  232. upper_price: "",
  233. },
  234. // 表格 - 数据
  235. tableData: [],
  236. // 表格 - 参数
  237. table: {
  238. stripe: true,
  239. border: true,
  240. _defaultHeader_: ["setcol"],
  241. },
  242. statusOptions: [
  243. { id: "0", label: "待发货" },
  244. { id: "1", label: "待发货完成" },
  245. { id: "2", label: "发货已完成" },
  246. { id: "3", label: "订单已取消" },
  247. ],
  248. // 表格 - 分页
  249. pageInfo: {
  250. size: 15,
  251. curr: 1,
  252. total: 0,
  253. },
  254. columns: [
  255. {
  256. prop: "orderCode",
  257. label: "订单编号",
  258. width: "155px",
  259. },
  260. {
  261. prop: "cgdNo",
  262. label: "采购单编号",
  263. width: "155px",
  264. },
  265. {
  266. prop: "good_name",
  267. label: "商品名称",
  268. width: "150",
  269. },
  270. // {
  271. // prop: 'good_class',
  272. // label: '商品分类',
  273. // width: '120'
  274. // },
  275. {
  276. prop: "good_num",
  277. label: "商品数量",
  278. },
  279. {
  280. prop: "sale_price",
  281. label: "销售单价",
  282. },
  283. {
  284. prop: "total_price",
  285. label: "总价",
  286. },
  287. {
  288. prop: "status",
  289. label: "订单状态",
  290. _slot_: "status",
  291. width: "120px",
  292. },
  293. {
  294. prop: "order_source",
  295. label: "订单来源",
  296. _slot_: "order_source",
  297. width: "90px",
  298. },
  299. {
  300. prop: "order_type",
  301. label: "商品类型",
  302. _slot_: "order_type",
  303. width: "90px",
  304. },
  305. // {
  306. // prop: 'useage',
  307. // label: '订单用途',
  308. // width: '100px'
  309. // },
  310. {
  311. prop: "customer_code",
  312. label: "客户公司编码",
  313. width: "155px",
  314. },
  315. {
  316. prop: "customerName",
  317. label: "企业客户名称",
  318. width: "125px",
  319. },
  320. {
  321. prop: "supplierName",
  322. label: "销售方公司",
  323. width: "125px",
  324. },
  325. {
  326. prop: "company_name",
  327. label: "订单创建人部门",
  328. minWidth: "120px",
  329. },
  330. {
  331. prop: "apply_name",
  332. label: "订单创建人",
  333. width: "85px",
  334. },
  335. {
  336. prop: "cgder",
  337. label: "供应商负责人",
  338. width: "95",
  339. },
  340. {
  341. prop: "good_creater",
  342. label: "商品创建人",
  343. width: "85px",
  344. },
  345. {
  346. prop: "addtime",
  347. label: "创建时间",
  348. width: "145px",
  349. },
  350. {
  351. prop: "",
  352. label: "操作",
  353. fixed: "right",
  354. _noset_: true,
  355. width: "80px",
  356. _slot_: "operation",
  357. },
  358. ],
  359. };
  360. },
  361. mounted() {
  362. this.searchList();
  363. },
  364. methods: {
  365. restSearch() {
  366. // 表格 - 分页
  367. this.pageInfo = {
  368. size: 15,
  369. curr: 1,
  370. total: 0,
  371. };
  372. this.parmValue = {
  373. page: 1, // 页码
  374. size: 15, // 每页显示条数
  375. start: "",
  376. end: "",
  377. customer_code: "",
  378. supplierNo: "",
  379. };
  380. this.value = "";
  381. this.searchList();
  382. },
  383. // 新建/编辑/详情
  384. openModal(row, type) {
  385. if(type === '003' && !this.currentCompany){
  386. this.$message.warning('请选择一家业务公司')
  387. return
  388. }
  389. // const { status } = row;
  390. // if (type === "005" && status === "1") {
  391. // this.$message.warning("禁用后,才可以修改!");
  392. // return;
  393. // }
  394. this.sitem = row;
  395. this.modelId = type;
  396. this.showModel = true;
  397. },
  398. // 时间
  399. async handleTime(e) {
  400. this.parmValue.start = e.startTime || "";
  401. this.parmValue.end = e.endTime || "";
  402. if (
  403. (this.parmValue.start !== "" && this.parmValue.end !== "") ||
  404. (this.parmValue.start === "" && this.parmValue.end === "")
  405. ) {
  406. this.pageInfo.curr = 1;
  407. this.parmValue.page = 1;
  408. await this.searchList();
  409. }
  410. },
  411. handleCustomerChange(e) {
  412. this.parmValue.customer_code = e.code ? [e.code] : "";
  413. this.customerName = e.label;
  414. this.searchList();
  415. },
  416. handleSupplierChange(e) {
  417. this.parmValue.supplierNo = e.code ? [e.code] : "";
  418. this.searchList();
  419. },
  420. /**
  421. * 启用/禁用
  422. * @param {String} id id
  423. * @param {String} status 0-禁用 1-启用
  424. */
  425. async changeStatus(id, status) {
  426. await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
  427. confirmButtonText: "确定",
  428. cancelButtonText: "取消",
  429. type: "warning",
  430. })
  431. .then(async () => {
  432. this.loading = true;
  433. const model = {
  434. id: id,
  435. status: status === "1" ? "0" : "1",
  436. };
  437. const res = await asyncRequest.status(model);
  438. if (res && res.code === 0) {
  439. this.loading = false;
  440. this.$notify.success({
  441. title: "状态修改成功!",
  442. message: "",
  443. });
  444. await this.searchList();
  445. } else if (res && res.code >= 100 && res.code <= 104) {
  446. await this.logout();
  447. } else {
  448. this.loading = false;
  449. this.$message.warning(res.message);
  450. }
  451. })
  452. .catch(() => {
  453. console.log("取消");
  454. });
  455. },
  456. // 刷新表格
  457. async searchList() {
  458. const vm = this;
  459. if (
  460. (vm.parmValue.start !== "" && vm.parmValue.end === "") ||
  461. (vm.parmValue.start == "" && vm.parmValue.end != "")
  462. ) {
  463. vm.$message.warning("开始时间和结束时间不能为空");
  464. return;
  465. }
  466. vm.loading = true;
  467. const res = await asyncRequest.list({
  468. ...vm.parmValue,
  469. ...(vm.value ? { [vm.select]: vm.value } : {}),
  470. ...(vm.parmValue.customer_code
  471. ? { customer_code: vm.parmValue.customer_code[0] }
  472. : {}),
  473. ...(vm.parmValue.supplierNo ? { supplierNo: vm.parmValue.supplierNo[0] } : {}),
  474. });
  475. if (res && res.code === 0 && res.data) {
  476. vm.tableData = res.data.list;
  477. vm.pageInfo.total = Number(res.data.count);
  478. } else if (res && res.code >= 100 && res.code <= 104) {
  479. await vm.logout();
  480. } else {
  481. vm.tableData = [];
  482. vm.pageInfo.total = 0;
  483. }
  484. vm.loading = false;
  485. },
  486. },
  487. };
  488. </script>
  489. <style lang="scss" scoped></style>