index.vue 16 KB

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