index.vue 15 KB

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