index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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="consigneePhone">
  26. <el-input
  27. v-model="queryParams.consigneePhone"
  28. placeholder="请输入手机号"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="退款类型" prop="serviceType">
  35. <el-select v-model="queryParams.serviceType" 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="orderCode" />
  127. <el-table-column label="会员手机号" align="center" prop="userPhone" />
  128. <el-table-column label="退款金额" align="center" prop="refundAmount" />
  129. <el-table-column label="退款类型" align="center" prop="serviceType" >
  130. <template slot-scope="scope">
  131. <div prop="serviceType" v-for="(item, index) in serviceTypeOptions" v-if="scope.row.serviceType==item.dictValue">{{item.dictLabel}}</div>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="申请原因" align="center" prop="reasons" />
  135. <el-table-column label="说明" align="center" prop="explains" />
  136. <el-table-column label="状态" align="center" prop="status" >
  137. <template slot-scope="scope">
  138. <div prop="status" v-for="(item, index) in statusOptions" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</div>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="售后状态" align="center" prop="salesStatus" >
  142. <template slot-scope="scope">
  143. <div prop="status" v-for="(item, index) in salesStatusOptions" v-if="scope.row.salesStatus==item.dictValue">{{item.dictLabel}}</div>
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="订单状态" align="center" prop="orderStatus" >
  147. <template slot-scope="scope">
  148. <div prop="status" v-for="(item, index) in orderStatusOptions" v-if="scope.row.orderStatus==item.dictValue">{{item.dictLabel}}</div>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="物流状态" align="center" prop="deliveryStatus" >
  152. <template slot-scope="scope">
  153. <el-tag prop="status" v-for="(item, index) in deliveryStatusOptions" v-if="scope.row.deliveryStatus==item.dictValue">{{item.dictLabel}}</el-tag>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="物流单号" align="center" prop="deliveryId" />
  157. <el-table-column label="客户退回物流单号" align="center" prop="deliverySn" />
  158. <el-table-column label="客户退货物流名称" align="center" prop="deliveryName" />
  159. <el-table-column label="提交时间" align="center" prop="createTime" />
  160. <el-table-column label="操作" align="center" fixed="right" width="100px" class-name="small-padding fixed-width">
  161. <template slot-scope="scope">
  162. <el-button
  163. size="mini"
  164. type="text"
  165. @click="handleShow(scope.row)"
  166. v-hasPermi="['store:storeAfterSales:query']"
  167. >查看</el-button>
  168. </template>
  169. </el-table-column>
  170. </el-table>
  171. <pagination
  172. v-show="total>0"
  173. :total="total"
  174. :page.sync="queryParams.pageNum"
  175. :limit.sync="queryParams.pageSize"
  176. @pagination="getList"
  177. />
  178. <el-drawer
  179. size="75%"
  180. :title="title" :visible.sync="open"
  181. >
  182. <product-after-sales-order ref="afterSalesOrder" />
  183. </el-drawer>
  184. </div>
  185. </template>
  186. <script>
  187. import { listLiveAfterSales, getLiveAfterSales, delLiveAfterSales, addLiveAfterSales, updateLiveAfterSales, exportLiveAfterSales } from "@/api/live/liveAfterSales";
  188. import {getCompanyList} from "@/api/company/company";
  189. import Treeselect from "@riophae/vue-treeselect";
  190. import {treeselect} from "@/api/company/companyDept";
  191. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  192. import productAfterSalesOrder from "../components/productAfterSalesOrder";
  193. export default {
  194. name: "LiveAfterSales",
  195. components: {productAfterSalesOrder, Treeselect},
  196. data() {
  197. return {
  198. dateRange:[],
  199. // 遮罩层
  200. loading: true,
  201. // 导出遮罩层
  202. exportLoading: false,
  203. // 选中数组
  204. ids: [],
  205. // 非单个禁用
  206. single: true,
  207. // 非多个禁用
  208. multiple: true,
  209. // 显示搜索条件
  210. showSearch: true,
  211. // 总条数
  212. total: 0,
  213. // 售后记录表格数据
  214. liveAfterSalesList: [],
  215. // 弹出层标题
  216. title: "",
  217. // 是否显示弹出层
  218. open: false,
  219. // 查询参数
  220. queryParams: {
  221. pageNum: 1,
  222. pageSize: 10,
  223. orderCode: null,
  224. refundAmount: null,
  225. serviceType: null,
  226. reasons: null,
  227. explains: null,
  228. explainImg: null,
  229. shipperCode: null,
  230. deliverySn: null,
  231. deliveryName: null,
  232. status: null,
  233. salesStatus: null,
  234. isDel: null,
  235. userId: null,
  236. consignee: null,
  237. phoneNumber: null,
  238. address: null
  239. },
  240. // 表单参数
  241. form: {},
  242. // 表单校验
  243. rules: {
  244. },
  245. orderStatusOptions:[],
  246. deliveryStatusOptions:[],
  247. serviceTypeOptions:[],
  248. salesStatusOptions:[],
  249. statusOptions:[],
  250. deptOptions:[],
  251. };
  252. },
  253. watch: {
  254. // 根据名称筛选部门树
  255. deptName(val) {
  256. this.$refs.tree.filter(val);
  257. },
  258. },
  259. created() {
  260. this.getTreeselect();
  261. this.getDicts("store_after_sales_sales_status").then((response) => {
  262. this.salesStatusOptions = response.data;
  263. });
  264. this.getDicts("store_after_sales_status").then((response) => {
  265. this.statusOptions = response.data;
  266. });
  267. this.getDicts("store_after_sales_service_type").then((response) => {
  268. this.serviceTypeOptions = response.data;
  269. });
  270. this.getDicts("store_order_delivery_status").then((response) => {
  271. this.deliveryStatusOptions = response.data;
  272. });
  273. this.getDicts("store_order_status").then((response) => {
  274. this.orderStatusOptions = response.data;
  275. });
  276. this.getList();
  277. },
  278. methods: {
  279. handleShow(row){
  280. this.title="售后订单"
  281. this.open=true;
  282. setTimeout(() => {
  283. this.$refs.afterSalesOrder.getLiveAfterSales(row.id);
  284. }, 200);
  285. },
  286. /** 查询售后记录列表 */
  287. getList() {
  288. this.loading = true;
  289. listLiveAfterSales(this.queryParams).then(response => {
  290. this.liveAfterSalesList = response.rows;
  291. this.total = response.total;
  292. this.loading = false;
  293. });
  294. },
  295. // 取消按钮
  296. cancel() {
  297. this.open = false;
  298. this.reset();
  299. },
  300. // 表单重置
  301. reset() {
  302. this.form = {
  303. id: null,
  304. liveId: null,
  305. storeId: null,
  306. orderId: null,
  307. refundAmount: null,
  308. refundType: null,
  309. reasons: null,
  310. explains: null,
  311. explainImg: null,
  312. deliveryCode: null,
  313. deliverySn: null,
  314. deliveryName: null,
  315. status: 0,
  316. salesStatus: 0,
  317. orderStatus: 0,
  318. createTime: null,
  319. isDel: null,
  320. userId: null,
  321. consignee: null,
  322. phoneNumber: null,
  323. address: null,
  324. companyId: null,
  325. companyUserId: null,
  326. deptId: null
  327. };
  328. this.resetForm("form");
  329. },
  330. /** 搜索按钮操作 */
  331. handleQuery() {
  332. this.queryParams.pageNum = 1;
  333. this.getList();
  334. },
  335. /** 重置按钮操作 */
  336. resetQuery() {
  337. this.resetForm("queryForm");
  338. this.handleQuery();
  339. },
  340. // 多选框选中数据
  341. handleSelectionChange(selection) {
  342. this.ids = selection.map(item => item.id)
  343. this.single = selection.length!==1
  344. this.multiple = !selection.length
  345. },
  346. /** 新增按钮操作 */
  347. handleAdd() {
  348. this.reset();
  349. this.open = true;
  350. this.title = "添加售后记录";
  351. },
  352. /** 修改按钮操作 */
  353. handleUpdate(row) {
  354. this.reset();
  355. const id = row.id || this.ids
  356. getLiveAfterSales(id).then(response => {
  357. this.form = response.data;
  358. this.open = true;
  359. this.title = "修改售后记录";
  360. });
  361. },
  362. /** 提交按钮 */
  363. submitForm() {
  364. this.$refs["form"].validate(valid => {
  365. if (valid) {
  366. if (this.form.id != null) {
  367. updateLiveAfterSales(this.form).then(response => {
  368. this.msgSuccess("修改成功");
  369. this.open = false;
  370. this.getList();
  371. });
  372. } else {
  373. addLiveAfterSales(this.form).then(response => {
  374. this.msgSuccess("新增成功");
  375. this.open = false;
  376. this.getList();
  377. });
  378. }
  379. }
  380. });
  381. },
  382. /** 删除按钮操作 */
  383. handleDelete(row) {
  384. const ids = row.id || this.ids;
  385. this.$confirm('是否确认删除售后记录编号为"' + ids + '"的数据项?', "警告", {
  386. confirmButtonText: "确定",
  387. cancelButtonText: "取消",
  388. type: "warning"
  389. }).then(function() {
  390. return delLiveAfterSales(ids);
  391. }).then(() => {
  392. this.getList();
  393. this.msgSuccess("删除成功");
  394. }).catch(() => {});
  395. },
  396. /** 导出按钮操作 */
  397. handleExport() {
  398. const queryParams = this.queryParams;
  399. this.$confirm('是否确认导出所有售后记录数据项?', "警告", {
  400. confirmButtonText: "确定",
  401. cancelButtonText: "取消",
  402. type: "warning"
  403. }).then(() => {
  404. this.exportLoading = true;
  405. return exportLiveAfterSales(queryParams);
  406. }).then(response => {
  407. this.download(response.msg);
  408. this.exportLoading = false;
  409. }).catch(() => {
  410. this.exportLoading = false;
  411. });
  412. },
  413. getTreeselect() {
  414. var param={companyId:this.companyId}
  415. treeselect(param).then((response) => {
  416. this.deptOptions = response.data;
  417. console.log(this.deptOptions)
  418. if(response.data!=null&&response.data.length>0){
  419. //this.queryParams.deptId=response.data[0].id;
  420. }
  421. });
  422. },
  423. companyChange(val){
  424. console.log(val);
  425. this.companyId=val;
  426. this.getTreeselect();
  427. },
  428. currDeptChange(val){
  429. console.log(val)
  430. this.queryParams.deptId=val;
  431. this.getList();
  432. },
  433. }
  434. };
  435. </script>