index.vue 15 KB

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