index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <div class="sellOutOrder pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '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="4" style="width: 291px">
  30. <period-date-picker
  31. :type="1"
  32. :start="parmValue.start"
  33. :end="parmValue.end"
  34. :width="'134px'"
  35. :size="searchSize"
  36. @timeReturned="handleTime"
  37. />
  38. </el-col>
  39. <el-col :span="4" style="width: 320px; padding: 0px 0 0 10px">
  40. <search-customer
  41. :value="customerCode"
  42. :size="searchSize"
  43. :placeholder="'客户公司名称'"
  44. @searchChange="customerChange"
  45. />
  46. </el-col>
  47. <el-col :span="3" style="width: 66px; float: right">
  48. <el-button
  49. :size="searchSize"
  50. type="primary"
  51. style="float: right; margin-left: 5px"
  52. @click="searchList"
  53. >
  54. 刷新
  55. </el-button>
  56. </el-col>
  57. </el-row>
  58. <el-row style="padding-top: 10px">
  59. <el-col :span="4" style="width: 150px">
  60. <el-select
  61. :size="searchSize"
  62. v-model="parmValue.status"
  63. filterable
  64. clearable
  65. placeholder="发货申请单状态"
  66. style="width: 100%"
  67. @change="
  68. pageInfo.curr = 1;
  69. parmValue.page = 1;
  70. searchList();
  71. "
  72. >
  73. <el-option
  74. v-for="item in statusOptions"
  75. :key="'status' + item.id"
  76. :label="item.label"
  77. :value="item.id"
  78. />
  79. </el-select>
  80. </el-col>
  81. <el-col :span="4" style="width: 500px; padding: 0 0 0 10px">
  82. <el-input
  83. clearable
  84. :size="searchSize"
  85. placeholder="关键字"
  86. v-model="s_input"
  87. maxlength="40"
  88. class="input-with-select"
  89. >
  90. <el-select
  91. style="width: 140px"
  92. v-model="select"
  93. slot="prepend"
  94. placeholder="请选择"
  95. >
  96. <el-option label="销售订单编号" value="orderCode" />
  97. <el-option label="发货申请单编号" value="outCode" />
  98. <!-- <el-option label="供应商编号" value="supplierNo" /> -->
  99. <el-option label="商品编号" value="good_code" />
  100. <el-option label="商品名称" value="good_name" />
  101. <el-option label="申请人" value="apply_name" />
  102. </el-select>
  103. <el-button
  104. slot="append"
  105. icon="el-icon-search"
  106. @click="
  107. pageInfo.curr = 1;
  108. parmValue.page = 1;
  109. handleValue();
  110. "
  111. ></el-button>
  112. </el-input>
  113. </el-col>
  114. <el-col :span="4" style="width: 66px" class="fr">
  115. <el-button
  116. type="warning"
  117. class="fr"
  118. :size="searchSize"
  119. @click="restSearch"
  120. >
  121. 重置
  122. </el-button>
  123. </el-col>
  124. </el-row>
  125. </div>
  126. </template>
  127. <template #status="{ scope }">
  128. <el-tag
  129. :size="tablebtnSize"
  130. :type="scope.row.status == '0' ? 'warning' : ''"
  131. v-text="
  132. (statusOptions.find((item) => item.id == scope.row.status) || {})
  133. .label || '--'
  134. "
  135. ></el-tag>
  136. </template>
  137. <template #order_type="{ scope }">
  138. <el-tag
  139. :size="'mini'"
  140. v-text="
  141. (
  142. order_type_options.find(
  143. (item) => item.id == scope.row.order_type
  144. ) || {}
  145. ).label || '--'
  146. "
  147. ></el-tag>
  148. </template>
  149. <template #operation="{ scope }">
  150. <el-tooltip
  151. v-if="powers.some((item) => item == '007')"
  152. effect="dark"
  153. content="详情"
  154. placement="top"
  155. >
  156. <i
  157. class="el-icon-view tb-icon"
  158. @click="
  159. routeGoto('sellOutOrderDetail', { id: scope.row.outCode })
  160. "
  161. ></i>
  162. </el-tooltip>
  163. </template>
  164. </ex-table>
  165. <add-edit
  166. :id="modelId"
  167. :sitem="sitem"
  168. :show-model="showModel"
  169. :is-detail="isDetail"
  170. @refresh="searchList"
  171. @cancel="showModel = false"
  172. />
  173. </div>
  174. <div v-else>
  175. <no-auth></no-auth>
  176. </div>
  177. </div>
  178. </template>
  179. <script>
  180. import mixinPage from "@/mixins/elPaginationHandle";
  181. import resToken from "@/mixins/resToken";
  182. import asyncRequest from "@/apis/service/sellOut/sellOutOrder";
  183. import addEdit from "./components/addEdit.vue";
  184. import { columns } from "./columns";
  185. import { mapGetters } from "vuex";
  186. export default {
  187. name: "sellOutOrder",
  188. mixins: [mixinPage, resToken],
  189. components: {
  190. addEdit,
  191. },
  192. computed: {
  193. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  194. powers() {
  195. let tran =
  196. this.$store.getters.btnList.find(
  197. (item) => item.menu_route == "sellOutOrder"
  198. ) || {};
  199. if (tran && tran.action && tran.action.length > 0) {
  200. return tran.action;
  201. } else {
  202. return [];
  203. }
  204. },
  205. },
  206. data() {
  207. return {
  208. select: "orderCode",
  209. s_input: "",
  210. customerCode: [], //客户公司code
  211. order_type_options: [
  212. { id: "1", label: "线上商品销售" },
  213. { id: "2", label: "项目线上商品销售" },
  214. { id: "3", label: "咨询单销售" },
  215. { id: "4", label: "项目咨询单销售" },
  216. ],
  217. // post_ownOptions: [
  218. // { id: "1", label: "客户承担" },
  219. // { id: "2", label: "公司承担" },
  220. // { id: "3", label: "供应商承担" },
  221. // ],
  222. sitem: null,
  223. // 状态
  224. statusOptions: [
  225. { id: "0", label: "待发货" },
  226. { id: "1", label: "待库管发货" },
  227. { id: "2", label: "待收货" },
  228. { id: "3", label: "已收货" },
  229. { id: "4", label: "已全部退货" },
  230. ],
  231. loading: true,
  232. showModel: false,
  233. isDetail: false,
  234. modelId: 0,
  235. parmValue: {
  236. order_type: "",
  237. orderCode: "",
  238. apply_name: "", //申请人名称
  239. start: "",
  240. end: "",
  241. // supplierNo: "",
  242. companyNo: "",
  243. good_code: "",
  244. good_name: "",
  245. outCode: "",
  246. status: "",
  247. page: 1, // 页码
  248. size: 15, // 每页显示条数
  249. },
  250. // 表格 - 数据
  251. tableData: [],
  252. // 表格 - 参数
  253. table: {
  254. stripe: true,
  255. border: true,
  256. _defaultHeader_: ["setcol"],
  257. },
  258. // 表格 - 分页
  259. pageInfo: {
  260. size: 15,
  261. curr: 1,
  262. total: 0,
  263. },
  264. // 表格 - 列参数
  265. columns: columns,
  266. };
  267. },
  268. mounted() {
  269. this.searchList();
  270. },
  271. methods: {
  272. restSearch() {
  273. this.customerCode = [];
  274. this.select = "orderCode";
  275. this.s_input = "";
  276. this.parmValue = {
  277. order_type: "1",
  278. orderCode: "",
  279. apply_name: "", //申请人名称
  280. start: "",
  281. end: "",
  282. // supplierNo: "",
  283. companyNo: "",
  284. good_code: "",
  285. good_name: "",
  286. outCode: "",
  287. status: "",
  288. page: 1, // 页码
  289. size: 15, // 每页显示条数
  290. };
  291. // 表格 - 分页
  292. this.pageInfo = {
  293. size: 15,
  294. curr: 1,
  295. total: 0,
  296. };
  297. this.searchList();
  298. },
  299. openModal(id, isDetail, sitem) {
  300. this.showModel = true;
  301. this.modelId = id;
  302. this.isDetail = isDetail;
  303. this.sitem = sitem;
  304. },
  305. async deleteById(id, status) {
  306. await this.$confirm("确定要删除?", {
  307. confirmButtonText: "确定",
  308. cancelButtonText: "取消",
  309. type: "warning",
  310. })
  311. .then(async () => {
  312. const model = {
  313. id: id,
  314. status: status === "1" ? "0" : "1",
  315. };
  316. const res = await asyncRequest.status(model);
  317. if (res && res.code === 0) {
  318. this.$notify.success({
  319. title: "删除成功",
  320. message: "",
  321. });
  322. this.searchList();
  323. } else if (res && res.code >= 100 && res.code <= 104) {
  324. await this.logout();
  325. } else {
  326. this.$message.warning(res.message);
  327. }
  328. })
  329. .catch(() => {
  330. console.log("取消");
  331. });
  332. },
  333. // 列表搜索
  334. async searchList() {
  335. if (
  336. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  337. (this.parmValue.start === "" && this.parmValue.end !== "")
  338. ) {
  339. this.$message.warning("时间区间不完整!");
  340. return;
  341. }
  342. this.loading = true;
  343. let model = JSON.parse(JSON.stringify(this.parmValue));
  344. const res = await asyncRequest.list(model);
  345. if (res && res.code === 0 && res.data) {
  346. this.tableData = res.data.list;
  347. this.pageInfo.total = Number(res.data.count);
  348. this.tableData.forEach((v) => {
  349. v.good_class = "";
  350. if (v.can && v.can.length > 0) {
  351. v.can.forEach((x, i) => {
  352. v.good_class += i === 0 ? x.name : "/" + x.name;
  353. });
  354. }
  355. });
  356. } else if (res && res.code >= 100 && res.code <= 104) {
  357. await this.logout();
  358. } else {
  359. this.tableData = [];
  360. this.pageInfo.total = 0;
  361. }
  362. this.loading = false;
  363. },
  364. async statusConfirm(id, status) {
  365. let str = status === "1" ? "禁用" : "启用";
  366. await this.$confirm("确定要改为" + str + "?", {
  367. confirmButtonText: "确定",
  368. cancelButtonText: "取消",
  369. type: "warning",
  370. })
  371. .then(async () => {
  372. this.loading = true;
  373. const model = {
  374. id: id,
  375. status: status === "1" ? "0" : "1",
  376. };
  377. const res = await asyncRequest.status(model);
  378. if (res && res.code === 0) {
  379. this.loading = false;
  380. this.$notify.success({
  381. title: "状态修改成功!",
  382. message: "",
  383. });
  384. await this.searchList();
  385. } else if (res && res.code >= 100 && res.code <= 104) {
  386. await this.logout();
  387. } else {
  388. this.$message.warning(res.message);
  389. }
  390. })
  391. .catch(() => {
  392. console.log("取消");
  393. });
  394. },
  395. // 时间选择事件
  396. async handleTime(e) {
  397. if (e.startTime !== "") {
  398. this.parmValue.start = e.startTime;
  399. } else {
  400. this.parmValue.start = "";
  401. }
  402. if (e.endTime !== "") {
  403. this.parmValue.end = e.endTime;
  404. } else {
  405. this.parmValue.end = "";
  406. }
  407. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  408. this.pageInfo.curr = 1;
  409. this.parmValue.page = 1;
  410. await this.searchList();
  411. }
  412. },
  413. async customerChange(e) {
  414. if (e && e.id) {
  415. this.customerCode = [e.code];
  416. this.parmValue.companyNo = e.code;
  417. } else {
  418. this.customerCode = [];
  419. this.parmValue.companyNo = "";
  420. }
  421. this.pageInfo.curr = 1;
  422. this.parmValue.page = 1;
  423. await this.searchList();
  424. },
  425. async handleValue() {
  426. this.parmValue.orderCode =
  427. this.select === "orderCode" ? this.s_input : "";
  428. this.parmValue.outCode = this.select === "outCode" ? this.s_input : "";
  429. // this.parmValue.supplierNo =
  430. // this.select === "supplierNo" ? this.s_input : "";
  431. this.parmValue.good_code =
  432. this.select === "good_code" ? this.s_input : "";
  433. this.parmValue.good_name =
  434. this.select === "good_name" ? this.s_input : "";
  435. this.parmValue.apply_name =
  436. this.select === "apply_name" ? this.s_input : "";
  437. await this.searchList();
  438. },
  439. },
  440. };
  441. </script>
  442. <style lang="scss" scoped>
  443. .zxoutOrder {
  444. }
  445. </style>