index.vue 15 KB

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