index.vue 14 KB

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