index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <template>
  2. <div class="app-container live-page">
  3. <div class="live-page__header">
  4. <h2 class="live-page__title">直播售后</h2>
  5. </div>
  6. <div class="live-panel" v-show="showSearch">
  7. <el-form class="live-search-form" :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
  8. <el-form-item label="所属部门" prop="deptId">
  9. <treeselect style="width:220px;" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
  10. </el-form-item>
  11. <el-form-item label="订单单号" prop="orderCode">
  12. <el-input
  13. v-model="queryParams.orderCode"
  14. placeholder="请输入订单单号"
  15. clearable
  16. size="small"
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="员工姓名" prop="companyUserNickName">
  21. <el-input
  22. v-model="queryParams.companyUserNickName"
  23. placeholder="请输入员工姓名"
  24. clearable
  25. size="small"
  26. @keyup.enter.native="handleQuery"
  27. />
  28. </el-form-item>
  29. <el-form-item label="会员手机" prop="userPhone">
  30. <el-input
  31. v-model="queryParams.userPhone"
  32. placeholder="请输入手机号"
  33. clearable
  34. size="small"
  35. @keyup.enter.native="handleQuery"
  36. />
  37. </el-form-item>
  38. <el-form-item label="退款类型" prop="refundType">
  39. <el-select v-model="queryParams.refundType" placeholder="请选择退款类型" clearable size="small" >
  40. <el-option
  41. v-for="item in serviceTypeOptions"
  42. :key="item.dictValue"
  43. :label="item.dictLabel"
  44. :value="item.dictValue"
  45. />
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item label="审核状态" prop="status">
  49. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small" >
  50. <el-option
  51. v-for="item in statusOptions"
  52. :key="item.dictValue"
  53. :label="item.dictLabel"
  54. :value="item.dictValue"
  55. />
  56. </el-select>
  57. </el-form-item>
  58. <el-form-item label="售后状态" prop="salesStatus">
  59. <el-select v-model="queryParams.salesStatus" placeholder="请选择状态" clearable size="small" >
  60. <el-option
  61. v-for="item in salesStatusOptions"
  62. :key="item.dictValue"
  63. :label="item.dictLabel"
  64. :value="item.dictValue"
  65. />
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item label="订单状态" prop="orderStatus">
  69. <el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable size="small" >
  70. <el-option
  71. v-for="item in orderStatusOptions"
  72. :key="item.dictValue"
  73. :label="item.dictLabel"
  74. :value="item.dictValue"
  75. />
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item style="margin-left: 20px;">
  79. <el-button type="text" :icon="isCollapsed ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" @click="upDown">{{ isCollapsed ? '展开' : '收起' }} </el-button>
  80. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  81. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  82. </el-form-item>
  83. <div v-if="!isCollapsed">
  84. <el-form-item label="客户退回" prop="searchKey">
  85. <div class="filter-combobox">
  86. <el-select
  87. slot="prepend"
  88. v-model="searchType"
  89. placeholder="请选择"
  90. clearable
  91. @change="handleTypeChange"
  92. style="width: 105px"
  93. >
  94. <el-option label="物流状态" value="deliveryStatus" />
  95. <el-option label="物流单号" value="deliverySn" />
  96. </el-select>
  97. <el-select v-if="searchType=='deliveryStatus'" style="flex: 1;"
  98. v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
  99. <el-option
  100. v-for="item in deliveryStatusOptions"
  101. :key="item.dictValue"
  102. :label="item.dictLabel"
  103. :value="item.dictValue"
  104. />
  105. </el-select>
  106. <el-input
  107. v-if="searchType=='deliverySn'|| searchType==''" style="flex: 1;"
  108. v-model.trim="searchKey"
  109. :placeholder="searchType=='deliverySn'?'物流/退回物流单号':''"
  110. clearable
  111. size="small"
  112. @keyup.enter.native="handleQuery"
  113. @clear="handleQuery"
  114. >
  115. </el-input>
  116. </div>
  117. </el-form-item>
  118. <!-- <el-form-item label="客户退回物流状态" prop="deliveryStatus">
  119. <el-select v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
  120. <el-option
  121. v-for="item in deliveryStatusOptions"
  122. :key="item.dictValue"
  123. :label="item.dictLabel"
  124. :value="item.dictValue"
  125. />
  126. </el-select>
  127. </el-form-item>
  128. <el-form-item label="客户退回物流单号" prop="deliverySn">
  129. <el-input
  130. v-model="queryParams.deliverySn"
  131. placeholder="物流/退回物流单号"
  132. clearable
  133. size="small"
  134. @keyup.enter.native="handleQuery"/>
  135. </el-form-item> -->
  136. <el-form-item label="提交时间" prop="createTime">
  137. <el-date-picker
  138. style="width:205.4px"
  139. clearable size="small"
  140. v-model="dateRange"
  141. type="daterange"
  142. value-format="yyyy-MM-dd"
  143. @change="handlePayTimeChange"
  144. start-placeholder="开始日期"
  145. end-placeholder="结束日期">
  146. </el-date-picker>
  147. </el-form-item>
  148. </div>
  149. </el-form>
  150. </div>
  151. <div class="live-panel live-panel--table">
  152. <el-row :gutter="10" class="mb8">
  153. <el-col :span="1.5">
  154. <el-button
  155. type="warning"
  156. icon="el-icon-download"
  157. size="mini"
  158. :disabled="exportLoading"
  159. @click="handleExport"
  160. v-hasPermi="['live:liveAfteraSales:export']"
  161. >导出</el-button>
  162. </el-col>
  163. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  164. </el-row>
  165. <el-table border v-loading="loading" :data="liveAfterSalesList" @selection-change="handleSelectionChange">
  166. <el-table-column type="selection" width="55" align="center" />
  167. <el-table-column label="ID" align="center" prop="id" />
  168. <el-table-column label="所属公司" align="center" prop="companyName" />
  169. <el-table-column label="所属员工" align="center" prop="companyUserNickName" />
  170. <el-table-column label="购买用户" align="center" prop="userName" />
  171. <el-table-column label="订单单号" align="center" prop="orderCode" />
  172. <el-table-column label="会员手机号" align="center" prop="userPhone" />
  173. <el-table-column label="退款金额" align="center" prop="refundAmount" />
  174. <el-table-column label="退款类型" align="center" prop="refundType" >
  175. <template slot-scope="scope">
  176. <dict-tag :options="serviceTypeOptions" :value="scope.row.refundType"/>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="申请原因" align="center" prop="reasons" />
  180. <el-table-column label="说明" align="center" prop="explains" />
  181. <el-table-column label="状态" align="center" prop="status" >
  182. <template slot-scope="scope">
  183. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  184. </template>
  185. </el-table-column>
  186. <el-table-column label="售后状态" align="center" prop="salesStatus" >
  187. <template slot-scope="scope">
  188. <dict-tag :options="salesStatusOptions" :value="scope.row.salesStatus"/>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="订单状态" align="center" prop="orderStatus" >
  192. <template slot-scope="scope">
  193. <dict-tag :options="orderStatusOptions" :value="scope.row.orderStatus"/>
  194. </template>
  195. </el-table-column>
  196. <el-table-column label="物流状态" align="center" prop="deliveryStatus" >
  197. <template slot-scope="scope">
  198. <span class="live-muted" v-for="(item, index) in deliveryStatusOptions" v-if="scope.row.deliveryStatus==item.dictValue" :key="index">{{item.dictLabel}}</span>
  199. </template>
  200. </el-table-column>
  201. <el-table-column label="物流单号" align="center" prop="deliveryId" />
  202. <el-table-column label="客户退回物流单号" align="center" prop="deliverySn" />
  203. <el-table-column label="客户退货物流名称" align="center" prop="deliveryName" />
  204. <el-table-column label="提交时间" align="center" prop="createTime" />
  205. <el-table-column label="操作" align="center" fixed="right" width="100px" class-name="small-padding fixed-width">
  206. <template slot-scope="scope">
  207. <el-button
  208. size="mini"
  209. type="text"
  210. @click="handleShow(scope.row)"
  211. v-hasPermi="['live:liveAfteraSales:query']"
  212. >查看</el-button>
  213. </template>
  214. </el-table-column>
  215. </el-table>
  216. <pagination
  217. v-show="total>0"
  218. :total="total"
  219. :page.sync="queryParams.pageNum"
  220. :limit.sync="queryParams.pageSize"
  221. @pagination="getList"
  222. />
  223. </div>
  224. <el-drawer
  225. size="75%"
  226. :title="title" :visible.sync="open"
  227. >
  228. <product-after-sales-order ref="afterSalesOrder" />
  229. </el-drawer>
  230. </div>
  231. </template>
  232. <script>
  233. import { listLiveAfterSales, getLiveAfterSales, delLiveAfterSales, addLiveAfterSales, updateLiveAfterSales, exportLiveAfterSales } from "@/api/live/liveAfterSales";
  234. import {getCompanyList} from "@/api/company/company";
  235. import Treeselect from "@riophae/vue-treeselect";
  236. import {treeselect} from "@/api/company/companyDept";
  237. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  238. import productAfterSalesOrder from "../components/productAfterSalesOrder";
  239. export default {
  240. name: "LiveAfterSales",
  241. components: {productAfterSalesOrder, Treeselect},
  242. data() {
  243. return {
  244. searchType:'',
  245. searchKey:'',
  246. isCollapsed:false,
  247. dateRange:[],
  248. // 遮罩层
  249. loading: true,
  250. // 导出遮罩层
  251. exportLoading: false,
  252. // 选中数组
  253. ids: [],
  254. // 非单个禁用
  255. single: true,
  256. // 非多个禁用
  257. multiple: true,
  258. // 显示搜索条件
  259. showSearch: true,
  260. // 总条数
  261. total: 0,
  262. // 售后记录表格数据
  263. liveAfterSalesList: [],
  264. // 弹出层标题
  265. title: "",
  266. // 是否显示弹出层
  267. open: false,
  268. // 查询参数
  269. queryParams: {
  270. pageNum: 1,
  271. pageSize: 10,
  272. orderCode: null,
  273. refundType: null, // 退款类型,替代serviceType
  274. reasons: null,
  275. explains: null,
  276. explainImg: null,
  277. deliveryCode: null,
  278. deliverySn: null,
  279. deliveryName: null,
  280. status: null,
  281. salesStatus: null, // 售后状态
  282. orderStatus: null, // 订单状态
  283. isDel: null,
  284. userId: null,
  285. consignee: null,
  286. phoneNumber: null, // 之前是consigneePhone,改成phoneNumber
  287. address: null,
  288. companyId: null,
  289. companyUserId: null,
  290. deptId: null,
  291. companyUserNickName: null, // 新增员工姓名
  292. deliveryStatus: null, // 物流状态,确认是否接口支持
  293. createTimeBegin: null, // 创建时间起
  294. createTimeEnd: null, // 创建时间止
  295. userPhone: null
  296. },
  297. // 表单参数
  298. form: {},
  299. // 表单校验
  300. rules: {
  301. },
  302. orderStatusOptions:[],
  303. deliveryStatusOptions:[],
  304. serviceTypeOptions:[],
  305. salesStatusOptions:[],
  306. statusOptions:[],
  307. deptOptions:[],
  308. };
  309. },
  310. watch: {
  311. // 根据名称筛选部门树
  312. deptName(val) {
  313. this.$refs.tree.filter(val);
  314. },
  315. },
  316. created() {
  317. this.getTreeselect();
  318. this.getDicts("store_after_sales_sales_status").then((response) => {
  319. this.salesStatusOptions = response.data;
  320. });
  321. this.getDicts("store_after_sales_status").then((response) => {
  322. this.statusOptions = response.data;
  323. });
  324. this.getDicts("store_after_sales_service_type").then((response) => {
  325. this.serviceTypeOptions = response.data;
  326. });
  327. this.getDicts("store_order_delivery_status").then((response) => {
  328. this.deliveryStatusOptions = response.data;
  329. });
  330. this.getDicts("sys_live_order_status").then((response) => {
  331. this.orderStatusOptions = response.data;
  332. });
  333. this.getList();
  334. },
  335. methods: {
  336. // 支付时间范围选择变化处理
  337. handlePayTimeChange(value) {
  338. if (value && value.length === 2) {
  339. // 提取日期部分(yyyy-MM-dd),mapper会在SQL中拼接时间部分
  340. this.queryParams.beginTime = value[0].substring(0, 10);
  341. this.queryParams.endTime = value[1].substring(0, 10);
  342. } else {
  343. this.queryParams.beginTime = null;
  344. this.queryParams.endTime = null;
  345. }
  346. },
  347. handleShow(row){
  348. this.title="售后订单"
  349. this.open=true;
  350. setTimeout(() => {
  351. this.$refs.afterSalesOrder.getLiveAfterSales(row.id);
  352. }, 200);
  353. },
  354. /** 查询售后记录列表 */
  355. getList() {
  356. this.loading = true;
  357. // 处理日期范围
  358. // const params = this.addDateRange(this.queryParams, this.dateRange);
  359. listLiveAfterSales(this.queryParams).then(response => {
  360. this.liveAfterSalesList = response.rows;
  361. this.total = response.total;
  362. this.loading = false;
  363. });
  364. },
  365. // 取消按钮
  366. cancel() {
  367. this.open = false;
  368. this.reset();
  369. },
  370. // 表单重置
  371. reset() {
  372. this.form = {
  373. id: null,
  374. liveId: null,
  375. storeId: null,
  376. orderId: null,
  377. refundAmount: null,
  378. refundType: null,
  379. reasons: null,
  380. explains: null,
  381. explainImg: null,
  382. deliveryCode: null,
  383. deliverySn: null,
  384. deliveryName: null,
  385. status: 0,
  386. salesStatus: 0,
  387. orderStatus: 0,
  388. createTime: null,
  389. isDel: null,
  390. userId: null,
  391. consignee: null,
  392. phoneNumber: null,
  393. address: null,
  394. companyId: null,
  395. companyUserId: null,
  396. deptId: null
  397. };
  398. this.resetForm("form");
  399. },
  400. upDown() {
  401. this.isCollapsed = !this.isCollapsed;
  402. },
  403. handleTypeChange(newType){
  404. this.searchKey='';
  405. this.searchType=newType
  406. },
  407. /** 搜索按钮操作 */
  408. handleQuery() {
  409. // 处理物流单号搜索
  410. if(this.searchKey!=='' && this.searchType=='deliverySn'){
  411. this.queryParams.deliverySn = this.searchKey;
  412. } else if(this.searchType=='deliverySn') {
  413. this.queryParams.deliverySn = null;
  414. }
  415. // 处理物流状态搜索
  416. if(this.searchType=='deliveryStatus' && this.queryParams.deliveryStatus) {
  417. // deliveryStatus已经在queryParams中,不需要额外处理
  418. }
  419. this.queryParams.pageNum = 1;
  420. this.getList();
  421. },
  422. /** 重置按钮操作 */
  423. resetQuery() {
  424. this.searchKey = '';
  425. this.searchType = '';
  426. this.dateRange = [];
  427. // 重置搜索相关的参数
  428. if(this.queryParams.deliverySn) {
  429. this.queryParams.deliverySn = null;
  430. }
  431. if(this.queryParams.deliveryStatus) {
  432. this.queryParams.deliveryStatus = null;
  433. }
  434. this.queryParams.beginTime = null;
  435. this.queryParams.endTime = null;
  436. this.resetForm("queryForm");
  437. this.handleQuery();
  438. },
  439. // 多选框选中数据
  440. handleSelectionChange(selection) {
  441. this.ids = selection.map(item => item.id)
  442. this.single = selection.length!==1
  443. this.multiple = !selection.length
  444. },
  445. /** 新增按钮操作 */
  446. handleAdd() {
  447. this.reset();
  448. this.open = true;
  449. this.title = "添加售后记录";
  450. },
  451. /** 修改按钮操作 */
  452. handleUpdate(row) {
  453. this.reset();
  454. const id = row.id || this.ids
  455. getLiveAfterSales(id).then(response => {
  456. this.form = response.data;
  457. this.open = true;
  458. this.title = "修改售后记录";
  459. });
  460. },
  461. /** 提交按钮 */
  462. submitForm() {
  463. this.$refs["form"].validate(valid => {
  464. if (valid) {
  465. if (this.form.id != null) {
  466. updateLiveAfterSales(this.form).then(response => {
  467. this.msgSuccess("修改成功");
  468. this.open = false;
  469. this.getList();
  470. });
  471. } else {
  472. addLiveAfterSales(this.form).then(response => {
  473. this.msgSuccess("新增成功");
  474. this.open = false;
  475. this.getList();
  476. });
  477. }
  478. }
  479. });
  480. },
  481. /** 删除按钮操作 */
  482. handleDelete(row) {
  483. const ids = row.id || this.ids;
  484. this.$confirm('是否确认删除售后记录编号为"' + ids + '"的数据项?', "警告", {
  485. confirmButtonText: "确定",
  486. cancelButtonText: "取消",
  487. type: "warning"
  488. }).then(function() {
  489. return delLiveAfterSales(ids);
  490. }).then(() => {
  491. this.getList();
  492. this.msgSuccess("删除成功");
  493. }).catch(() => {});
  494. },
  495. /** 导出按钮操作 */
  496. handleExport() {
  497. // 处理日期范围和搜索条件
  498. const queryParams = this.queryParams;
  499. // 确保导出时包含所有搜索条件
  500. if(this.searchKey!=='' && this.searchType=='deliverySn'){
  501. queryParams.deliverySn = this.searchKey;
  502. }
  503. this.$confirm('是否确认导出所有售后记录数据项?', "警告", {
  504. confirmButtonText: "确定",
  505. cancelButtonText: "取消",
  506. type: "warning"
  507. }).then(() => {
  508. this.exportLoading = true;
  509. return exportLiveAfterSales(queryParams);
  510. }).then(response => {
  511. this.download(response.msg);
  512. this.exportLoading = false;
  513. }).catch(() => {
  514. this.exportLoading = false;
  515. });
  516. },
  517. getTreeselect() {
  518. var param={companyId:this.companyId}
  519. treeselect(param).then((response) => {
  520. this.deptOptions = response.data;
  521. console.log(this.deptOptions)
  522. if(response.data!=null&&response.data.length>0){
  523. //this.queryParams.deptId=response.data[0].id;
  524. }
  525. });
  526. },
  527. companyChange(val){
  528. console.log(val);
  529. this.companyId=val;
  530. this.getTreeselect();
  531. },
  532. currDeptChange(val){
  533. console.log(val)
  534. this.queryParams.deptId=val;
  535. this.getList();
  536. },
  537. }
  538. };
  539. </script>
  540. <style scoped>
  541. .filter-combobox {
  542. display: flex;
  543. align-items: flex-start;
  544. width: 100%;
  545. }
  546. .filter-combobox ::v-deep .el-input--medium .el-input__inner{
  547. height: 32px !important;
  548. line-height: 32px;
  549. }
  550. .filter-combobox ::v-deep.el-input__icon{
  551. height: 32px !important;
  552. line-height: 32px;
  553. }
  554. ::v-deep .vue-treeselect__control{
  555. height: 30px !important;
  556. line-height: 30px;
  557. }
  558. ::v-deep .vue-treeselect__placeholder{
  559. line-height: 32px;
  560. }
  561. </style>