index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <script>
  2. import test from "@/components/form-test/index.vue";
  3. import query from "@/components/query/index.vue";
  4. import byTable from "@/components/by-table/index.js";
  5. import addAfterSales from "./addAfterSales.vue";
  6. import * as API from "@/api/order-management/afterSales/index.js";
  7. // import { customerList } from "@/api/product-material/customer/index.js";
  8. export default {
  9. components: {
  10. test,
  11. byTable,
  12. query,
  13. addAfterSales,
  14. },
  15. data() {
  16. return {
  17. afterSalesTypeList: [],
  18. orderStatusList: [],
  19. afterSalesStatusList: [],
  20. customerSelectList: [],
  21. btnForm: {
  22. otherButton: {
  23. list: [
  24. {
  25. name: "tiann",
  26. methodsText: "add",
  27. type: "primary",
  28. add: () => {
  29. this.handleAdd();
  30. },
  31. },
  32. ],
  33. },
  34. },
  35. queryParams: {
  36. pageNum: 1,
  37. pageSize: 10,
  38. keyword: "",
  39. type: "",
  40. afterSalesStatus: "",
  41. },
  42. selectConfig: [
  43. {
  44. label: "售后类型",
  45. prop: "type",
  46. data: [],
  47. },
  48. {
  49. label: "状态",
  50. prop: "afterSalesStatus",
  51. data: [],
  52. },
  53. ],
  54. tableList: [],
  55. total: 0,
  56. loading: false,
  57. titleText: "",
  58. open: false,
  59. form: {
  60. id: "",
  61. type: "",
  62. remark: "",
  63. },
  64. isAdd: false,
  65. openOne: false,
  66. };
  67. },
  68. created() {
  69. const businessDictData = JSON.parse(
  70. window.localStorage.getItem("businessDict")
  71. );
  72. this.afterSalesTypeList = businessDictData.find(
  73. (item) => item.code === "afterSalesType"
  74. ).children;
  75. this.selectConfig[0].data = this.afterSalesTypeList.map((item) => ({
  76. label: item.dictValue,
  77. value: item.dictKey,
  78. }));
  79. this.orderStatusList = businessDictData.find(
  80. (item) => item.code === "orderStatus"
  81. ).children;
  82. this.afterSalesStatusList = businessDictData.find(
  83. (item) => item.code === "afterSalesStatus"
  84. ).children;
  85. this.selectConfig[1].data = this.afterSalesStatusList.map((item) => ({
  86. label: item.dictValue,
  87. value: item.dictKey,
  88. }));
  89. // customerList({ pageNum: 1, pageSize: 999 }).then((res) => {
  90. // this.customerSelectList = res.data.data.records;
  91. // });
  92. API.customerSelectData().then((res) => {
  93. this.customerSelectList = res.data.data;
  94. });
  95. this.getList();
  96. },
  97. methods: {
  98. getList() {
  99. this.loading = true;
  100. API.afterSalesList(this.queryParams).then(
  101. (res) => {
  102. this.tableList = res.data.data.records;
  103. this.total = res.data.data.total;
  104. this.loading = false;
  105. },
  106. (err) => {
  107. console.log("afterSalesList: " + err);
  108. this.loading = false;
  109. }
  110. );
  111. },
  112. handleQuery() {
  113. this.getList();
  114. },
  115. handleAdd() {
  116. this.titleText = "添加售后记录";
  117. this.isAdd = true;
  118. this.form = {
  119. id: "",
  120. type: "",
  121. remark: "",
  122. productList: [],
  123. };
  124. this.open = true;
  125. },
  126. handleCancel() {
  127. this.open = false;
  128. },
  129. handleFollow(row) {
  130. this.titleText = "跟进";
  131. this.isAdd = false;
  132. this.form = {
  133. customerInfoId: row.customerInfoId,
  134. id: row.code,
  135. type: String(row.type),
  136. remarkOne: row.remark,
  137. orderInfoId: row.id,
  138. afterSalesStatus: "",
  139. remark: "",
  140. };
  141. this.open = true;
  142. },
  143. handleSubmit() {
  144. if (this.isAdd) {
  145. API.afterSalesAdd(this.form).then(
  146. () => {
  147. this.msgSuccess("添加成功");
  148. this.$refs.addAfterSales.loading = false;
  149. this.open = false;
  150. this.getList();
  151. },
  152. (err) => {
  153. console.log("afterSalesAdd: " + err);
  154. this.$refs.addAfterSales.loading = false;
  155. }
  156. );
  157. } else {
  158. delete this.form.customerInfoId;
  159. delete this.form.remarkOne;
  160. delete this.form.id;
  161. delete this.form.type;
  162. API.afterSalesFollow(this.form).then(
  163. () => {
  164. this.msgSuccess("操作成功");
  165. this.$refs.addAfterSales.loading = false;
  166. this.open = false;
  167. this.getList();
  168. },
  169. (err) => {
  170. console.log("afterSalesFollow: " + err);
  171. this.$refs.addAfterSales.loading = false;
  172. }
  173. );
  174. }
  175. },
  176. showAddress(row) {
  177. return (
  178. <div>
  179. {row.countryName} , {row.provinceName} , {row.cityName}
  180. </div>
  181. );
  182. },
  183. lookRecords() {
  184. this.openOne = true;
  185. },
  186. },
  187. };
  188. </script>
  189. <template>
  190. <div class="box-card">
  191. <el-card class="header">
  192. <el-button type="primary" size="mini" @click="handleAdd">
  193. 添加售后记录
  194. </el-button>
  195. </el-card>
  196. <el-card class="body-main">
  197. <query
  198. :selectConfig="selectConfig"
  199. :req="queryParams"
  200. :isShowMore="true"
  201. @handleQuery="handleQuery"
  202. @handleMore="
  203. () => {
  204. queryDialog = true;
  205. }
  206. "
  207. ></query>
  208. <el-table :data="tableList" v-loading="loading">
  209. <el-table-column
  210. label="售后类型"
  211. align="left"
  212. :formatter="(row) => dictDataEcho(row.type, afterSalesTypeList)"
  213. />
  214. <!-- <el-table-column label="订单编号" align="left" prop="code">
  215. <template slot-scope="scope">
  216. <div class="show_underline">
  217. {{ scope.row.code }}
  218. </div>
  219. </template>
  220. </el-table-column> -->
  221. <el-table-column label="客户名称" align="left" prop="customerName" />
  222. <el-table-column label="售货原因" align="left" prop="" />
  223. <!-- <el-table-column
  224. label="订单金额"
  225. align="left"
  226. prop="amountMoney"
  227. width="140"
  228. />
  229. <el-table-column
  230. label="收件城市"
  231. align="left"
  232. width="150"
  233. :formatter="showAddress"
  234. />
  235. <el-table-column label="详细地址" align="left" prop="detailedAddress" />
  236. <el-table-column
  237. label="下单时间"
  238. align="left"
  239. prop="orderTime"
  240. width="150"
  241. />
  242. <el-table-column
  243. label="登记时间"
  244. align="left"
  245. prop="createTime"
  246. width="150"
  247. /> -->
  248. <el-table-column
  249. label="状态"
  250. align="left"
  251. :formatter="
  252. (row) => dictDataEcho(row.afterSalesStatus, afterSalesStatusList)
  253. "
  254. />
  255. <!-- <el-table-column
  256. label="订单状态"
  257. align="left"
  258. width="120"
  259. :formatter="(row) => dictDataEcho(row.status, orderStatusList)"
  260. /> -->
  261. <el-table-column label="操作" align="center" width="160">
  262. <template slot-scope="scope">
  263. <el-button type="text" @click="lookRecords(scope.row)"
  264. >跟进记录
  265. </el-button>
  266. <el-button type="text" @click="handleFollow(scope.row)"
  267. >跟进
  268. </el-button>
  269. </template>
  270. </el-table-column>
  271. </el-table>
  272. <pagination
  273. v-show="total > 0"
  274. :total="total"
  275. :page.sync="queryParams.pageNum"
  276. :limit.sync="queryParams.pageSize"
  277. @pagination="getList"
  278. />
  279. </el-card>
  280. <el-dialog
  281. :title="titleText"
  282. :visible.sync="open"
  283. v-if="open"
  284. width="30%"
  285. top="60px"
  286. >
  287. <add-after-sales
  288. :form="form"
  289. :isAdd="isAdd"
  290. :customerSelectList="customerSelectList"
  291. :afterSalesTypeList="afterSalesTypeList"
  292. :afterSalesStatusList="afterSalesStatusList"
  293. @submit="handleSubmit"
  294. @cancel="handleCancel"
  295. ref="addAfterSales"
  296. ></add-after-sales>
  297. </el-dialog>
  298. <el-dialog
  299. title="跟进记录"
  300. :visible.sync="openOne"
  301. v-if="openOne"
  302. width="30%"
  303. top="100px"
  304. >
  305. <div v-for="item in 3" :key="item" class="record-item">
  306. <div class="head">
  307. <span class="time"> 跟进时间:{{}} </span>
  308. <span class="name"> 张三 </span>
  309. </div>
  310. <div class="body">跟进记录</div>
  311. </div>
  312. </el-dialog>
  313. </div>
  314. </template>
  315. <style lang="scss" scoped>
  316. .box-card {
  317. height: calc(100vh - 110px);
  318. overflow-y: auto;
  319. display: flex;
  320. flex-direction: column;
  321. .header {
  322. // height: 100px;
  323. margin-bottom: 10px;
  324. box-sizing: border-box;
  325. }
  326. .body-main {
  327. flex: 1;
  328. overflow-y: auto;
  329. }
  330. }
  331. .record-item {
  332. margin-bottom: 20px;
  333. .head {
  334. margin-bottom: 10px;
  335. display: flex;
  336. span {
  337. font-size: 12px;
  338. color: #c3bdbd;
  339. }
  340. .time {
  341. flex: 1;
  342. }
  343. .name {
  344. width: 50px;
  345. }
  346. }
  347. .body {
  348. color: #000;
  349. font-size: 14px;
  350. }
  351. }
  352. </style>