index.vue 9.2 KB

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