Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1bfe601787dbe1ff216fbb5ed025ae3b54864add.svn-base 23KB

5 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <template>
  2. <div class="app-container">
  3. <div style="margin-bottom:10px">
  4. <el-button type="success" @click="addBtn">新增</el-button>
  5. <el-button type="success" @click="importBtn">导入</el-button>
  6. <el-button type="success" @click="exportTempBtn">模版下载</el-button>
  7. </div>
  8. <!--搜索-->
  9. <el-form class="mt_15" ref="form" inline size="small">
  10. <el-form-item label="店铺">
  11. <el-input v-model="searchParm.shop" clearable placeholder='店铺'></el-input>
  12. </el-form-item>
  13. <el-form-item label="订单ID">
  14. <el-input v-model="searchParm.orderId" clearable placeholder='订单ID'></el-input>
  15. </el-form-item>
  16. <el-form-item label="公司">
  17. <el-select v-model="searchParm.companyId" placeholder="请选择">
  18. <el-option v-for="item in companys" :key="item.name" :label="item.name" :value="item.id"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="平台">
  22. <el-select v-model="searchParm.platformId" placeholder="请选择">
  23. <el-option
  24. v-for="item in platformList"
  25. :key="item.id"
  26. :label="item.name"
  27. :value="item.id"
  28. ></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="类型">
  32. <el-select v-model="searchParm.status" placeholder="请选择">
  33. <el-option
  34. v-for="item in typeList"
  35. :key="item.name"
  36. :label="item.name"
  37. :value="item.id">
  38. </el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="状态">
  42. <el-select v-model="searchParm.status" placeholder="请选择">
  43. <el-option
  44. v-for="item in statusList"
  45. :key="item.name"
  46. :label="item.name"
  47. :value="item.id">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-date-picker
  52. v-model="searchTime"
  53. type="daterange"
  54. range-separator=":"
  55. start-placeholder="开始日期"
  56. end-placeholder="结束日期"
  57. style="width:270px"
  58. ></el-date-picker>
  59. <el-form-item>
  60. <el-button type="primary" @click="goSearch">搜索</el-button>
  61. <el-button type="warning" @click="resetForm">重置</el-button>
  62. </el-form-item>
  63. </el-form>
  64. <!--表格渲染-->
  65. <el-table ref="table" border size="small" :data="list" :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
  66. <el-table-column label="序号" type="index" width="50" />
  67. <el-table-column label="平台名称" prop="platformName" />
  68. <el-table-column label="公司名称" prop="companyName" />
  69. <el-table-column label="总金额" prop="amount" />
  70. <el-table-column label="店铺名称" prop="shop" />
  71. <el-table-column label="订单ID" prop="orderId" />
  72. <el-table-column label="评论" prop="comment" :formatter="commentSub"/>
  73. <el-table-column label="状态" prop="status" align="center">
  74. <template slot-scope="scope">
  75. {{ scope.row.status | getStatus}}
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="创建时间" prop="createdAt" />
  79. <el-table-column label="修改时间" prop="updatedAt" />
  80. <el-table-column label="操作" width="300">
  81. <template slot-scope="scope">
  82. <el-button type="info" @click="getBtnById(scope.row.id)">查看</el-button>
  83. <el-button type="warning" @click="editById(scope.row)">评论</el-button>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <!--分页-->
  88. <div class="mt_15">
  89. <el-pagination
  90. @size-change="handleSizeChange"
  91. @current-change="handleCurrentChange"
  92. :current-page="searchParm.page"
  93. :page-sizes="[10, 20, 30, 40, 50]"
  94. :page-size="searchParm.pageSize"
  95. layout="total, sizes, prev, pager, next, jumper"
  96. :total="total">
  97. </el-pagination>
  98. </div>
  99. <!--新增弹窗-->
  100. <el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%">
  101. <div class="dialog-content">
  102. <el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="130px">
  103. <el-form-item label="公司" prop="companyId">
  104. <el-select v-model="addParm.companyId" placeholder="请选择">
  105. <el-option
  106. v-for="item in companys"
  107. :key="item.name"
  108. :label="item.name"
  109. :value="item.id"
  110. ></el-option>
  111. </el-select>
  112. </el-form-item>
  113. <el-form-item label="平台" prop="platformId">
  114. <el-select v-model="addParm.platformId" placeholder="请选择">
  115. <el-option
  116. v-for="item in platformList"
  117. :key="item.name"
  118. :label="item.name"
  119. :value="item.id"
  120. ></el-option>
  121. </el-select>
  122. </el-form-item>
  123. <el-form-item label="总金额" prop="amount">
  124. <el-input v-model="addParm.amount" clearable></el-input>
  125. </el-form-item>
  126. <el-form-item label="状态描述" prop="paymentResults">
  127. <el-input v-model="addParm.paymentResults" clearable></el-input>
  128. </el-form-item>
  129. <el-form-item label="购买数量" prop="pricesNumber">
  130. <el-input v-model="addParm.pricesNumber" clearable></el-input>
  131. </el-form-item>
  132. <el-form-item label="商品名称" prop="shopName">
  133. <el-input v-model="addParm.shopName" clearable></el-input>
  134. </el-form-item>
  135. <el-form-item label="时间" prop="orderDate">
  136. <el-input v-model="addParm.orderDate" clearable></el-input>
  137. </el-form-item>
  138. <el-form-item label="店铺名称" prop="shop">
  139. <el-input v-model="addParm.shop" clearable></el-input>
  140. </el-form-item>
  141. <el-form-item label="订单id" prop="orderId">
  142. <el-input v-model="addParm.orderId" clearable></el-input>
  143. </el-form-item>
  144. <el-form-item label="评论" prop="comment">
  145. <el-input v-model="addParm.comment" clearable></el-input>
  146. </el-form-item>
  147. <el-input v-model="addParm.paths" type="hidden" clearable></el-input>
  148. <el-upload
  149. class="upload-demo"
  150. :data = "updateFileType"
  151. :action="uploadFileImgUrl"
  152. :on-preview="handlePreview"
  153. :headers="uploadHeaders"
  154. :on-remove="handleRemove"
  155. :on-success="uploadImgSuccess"
  156. :file-list="fileList"
  157. list-type="picture">
  158. <el-button size="small" type="primary">点击上传</el-button>
  159. <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
  160. </el-upload>
  161. </el-form>
  162. </div>
  163. <span slot="footer">
  164. <el-button type="info" @click="dialogAddVisible=flase">取消</el-button>
  165. <el-button type="primary" @click="sureAdd">确认</el-button>
  166. </span>
  167. </el-dialog>
  168. <!--评论弹窗-->
  169. <el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%">
  170. <div class="dialog-content">
  171. <el-form ref="ruleForm" size="small" :model="editParm" :rules="rules" label-width="130px">
  172. <el-form-item label="评论" prop="accountcommentName">
  173. <el-input v-model="editParm.comment" clearable></el-input>
  174. </el-form-item>
  175. </el-form>
  176. <el-input v-model="editParm.paths" type="hidden" clearable></el-input>
  177. <el-upload
  178. class="upload-demo"
  179. :data = "updateFileType"
  180. :action="uploadFileImgUrl"
  181. :on-preview="handlePreview"
  182. :headers="uploadHeaders"
  183. :on-remove="handleRemove"
  184. :on-success="uploadImgSuccess"
  185. :file-list="fileList"
  186. list-type="picture">
  187. <el-button size="small" type="primary">点击上传</el-button>
  188. <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
  189. </el-upload>
  190. </div>
  191. <span slot="footer">
  192. <el-button type="info" @click="dialogEditVisible=false">取消</el-button>
  193. <el-button type="primary" @click="sureEdit">确认</el-button>
  194. </span>
  195. </el-dialog>
  196. <!--详情弹窗-->
  197. <el-dialog :visible.sync="dialogDetailVisible" :title="dialogDetailTitle" center width="45%">
  198. <div class="dialog-content">
  199. <el-form ref="form" size="small" label-width="130px">
  200. <el-form-item label="公司" prop="companyId">
  201. <el-select v-model="detailParm.companyId" disabled>
  202. <el-option
  203. v-for="item in companys"
  204. :key="item.name"
  205. :label="item.name"
  206. :value="item.id"
  207. ></el-option>
  208. </el-select>
  209. </el-form-item>
  210. <el-form-item label="平台" prop="platformId">
  211. <el-select v-model="detailParm.platformId" disabled>
  212. <el-option
  213. v-for="item in platformList"
  214. :key="item.name"
  215. :label="item.name"
  216. :value="item.id"
  217. ></el-option>
  218. </el-select>
  219. </el-form-item>
  220. </el-form-item>
  221. <el-form-item label="总金额" prop="amount">
  222. <el-input v-model="detailParm.amount" disabled></el-input>
  223. </el-form-item>
  224. <el-form-item label="店铺名称" prop="shop">
  225. <el-input v-model="detailParm.shop" disabled></el-input>
  226. </el-form-item>
  227. <el-form-item label="商品名称" prop="shopName">
  228. <el-input v-model="detailParm.shopName" disabled></el-input>
  229. </el-form-item>
  230. <el-form-item label="订单id" prop="orderId">
  231. <el-input v-model="detailParm.orderId" disabled></el-input>
  232. </el-form-item>
  233. <el-form-item label="评论" prop="comment">
  234. <el-input v-model="detailParm.comment" disabled></el-input>
  235. </el-form-item>
  236. <el-form-item label="时间" prop="orderDate">
  237. <el-input v-model="detailParm.orderDate" disabled></el-input>
  238. </el-form-item>
  239. <el-upload
  240. class="upload-demo"
  241. :data = "updateFileType"
  242. :action="uploadFileImgUrl"
  243. :on-preview="handlePreview"
  244. :headers="uploadHeaders"
  245. :on-remove="handleRemove"
  246. :on-success="uploadImgSuccess"
  247. :file-list="fileList"
  248. list-type="picture">
  249. </el-upload>
  250. </el-form>
  251. </div>
  252. </el-dialog>
  253. <!--订单信息导入 importBtn-->
  254. <el-dialog :visible.sync="dialogImportVisible" :title="dialogImportTitle" center width="23%">
  255. <div class="dialog-content">
  256. <el-upload
  257. class="upload-demo"
  258. drag
  259. ref="upload"
  260. :action="uploadFileUrl"
  261. :headers="uploadHeaders"
  262. :show-file-list = "false"
  263. :on-success="uploadSuccess"
  264. :before-upload="beforeAvatarUpload"
  265. multiple>
  266. <i class="el-icon-upload"></i>
  267. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  268. <div class="el-upload__tip" slot="tip">只能上传xlsl文件,且不超过10M</div>
  269. </el-upload>
  270. </div>
  271. </el-dialog>
  272. </div>
  273. </template>
  274. <script>
  275. import { add, getDetailById, commentFun, getList } from '@/api/group/clickOrder';
  276. import { getAll } from "@/api/group/company";
  277. export default {
  278. filters: {
  279. getStatus: function (value) {
  280. // 状态 1.待执行 2.执行中 3.执行成功 4.执行失败
  281. if(value == 1) {
  282. return '待执行';
  283. } else if (value == 2) {
  284. return '执行中';
  285. } else if (value == 3) {
  286. return '执行成功';
  287. } else if(value == 4) {
  288. return '执行失败';
  289. } else {
  290. return '执行失败';
  291. }
  292. }
  293. },
  294. // 数据
  295. data() {
  296. return {
  297. searchParm: {
  298. page: 1,
  299. pageSize: 10,
  300. sort:'created_at',
  301. order:'desc',
  302. accountName:null,
  303. robotClientUuid:null,
  304. sTime: null,
  305. eTime: null,
  306. shop: null,
  307. orderId: null,
  308. platformId: null,
  309. companyId: null,
  310. type: null,
  311. status: null
  312. },
  313. total:0,
  314. list: [],
  315. fileList:[],
  316. platformList: [
  317. {
  318. id: 1,
  319. name: "敦煌"
  320. },
  321. {
  322. id: 2,
  323. name: "速卖通"
  324. },
  325. {
  326. id: 3,
  327. name: "马帮"
  328. }
  329. ],
  330. typeList: [
  331. {
  332. id: 1,
  333. name: "导入"
  334. },
  335. {
  336. id: 2,
  337. name: "刷单"
  338. }
  339. ],
  340. statusList: [
  341. {
  342. id: 1,
  343. name: "待执行"
  344. },
  345. {
  346. id: 2,
  347. name: "执行中"
  348. },
  349. {
  350. id: 3,
  351. name: "执行成功"
  352. },
  353. {
  354. id: 4,
  355. name: "执行失败"
  356. }
  357. ],
  358. uploadHeaders:{ Authorization: this.$store.getters.token },
  359. dialogAddVisible: false,
  360. dialogAddTitle: '新增',
  361. dialogDetailVisible: false,
  362. dialogDetailTitle: '详情',
  363. dialogEditVisible: false,
  364. dialogEditTitle: '修改',
  365. dialogImportVisible: false,
  366. dialogImportTitle:'导入',
  367. searchTime: "",
  368. updateFileType: {type: 12},
  369. uploadFileImgUrl: process.env.VUE_APP_BASE_API + '/api/file/uploadFile',
  370. uploadFileUrl: process.env.VUE_APP_BASE_API + '/api/clickOrder/import',
  371. tempUrl: process.env.VUE_APP_BASE_API + '/api/clickOrder/exportTemp',
  372. fileImages:{
  373. name: null,
  374. url: null
  375. },
  376. addParm: {
  377. id:null,
  378. platformId:null,
  379. companyId:null,
  380. paymentResults:null,
  381. pricesNumber:null,
  382. shopName:null,
  383. orderDate:null,
  384. amount:null,
  385. shop:null,
  386. orderId:null,
  387. comment:null,
  388. paths: []
  389. },
  390. detailParm: {
  391. id:null,
  392. platformId:null,
  393. companyId:null,
  394. amount:null,
  395. shop:null,
  396. shopName: null,
  397. orderDate: null,
  398. orderId:null,
  399. comment:null,
  400. paths:[]
  401. },
  402. editParm: {
  403. id:null,
  404. comment:null,
  405. paths:[]
  406. },
  407. ruleForm:{
  408. platformId:null,
  409. companyId:null,
  410. account:null,
  411. pwd:null,
  412. amount:null,
  413. shop:null,
  414. orderId:null,
  415. comment:null,
  416. },
  417. companys: [],
  418. rules: {
  419. platformId: [
  420. { required: true, message: '请输入平台', trigger: 'blur' }
  421. ],
  422. companyId: [
  423. { required: true, message: '请输入公司', trigger: 'blur' }
  424. ],
  425. account: [
  426. { required: true, message: '请输入账号', trigger: 'blur' }
  427. ],
  428. pwd: [
  429. { required: true, message: '请输入密码', trigger: 'blur' }
  430. ],
  431. amount: [
  432. { required: true, message: '请输入总金额', trigger: 'blur' }
  433. ],
  434. shop: [
  435. { required: true, message: '请输入店铺名称', trigger: 'blur' }
  436. ],
  437. orderId: [
  438. { required: true, message: '请输入订单ID', trigger: 'blur' }
  439. ],
  440. comment: [
  441. { required: true, message: '请输入评论', trigger: 'blur' }
  442. ]
  443. },
  444. }
  445. },
  446. // 调用
  447. created() {
  448. this.goSearch();
  449. this.fileList = [];
  450. },
  451. //方法
  452. methods: {
  453. // 图片上传
  454. handleRemove(file, fileList) {
  455. console.log("======fileList=======");
  456. console.log(file);
  457. console.log(fileList);
  458. // 剔除 -这里先这样吧。硬编码
  459. this.editParm.paths = [];
  460. for (let i = 0; i < fileList.length; i++) {
  461. console.log("for--- " + i);
  462. const imgUrl = fileList[i].url;
  463. console.log(imgUrl);
  464. if (imgUrl.includes("/file/")) {
  465. imgUrl = imgUrl.substring(imgUrl.lastIndexOf("\/file\/") + 5, imgUrl.length);
  466. console.log("包含file")
  467. }
  468. console.log(imgUrl);
  469. console.log("====1====")
  470. this.editParm.paths.push(imgUrl);
  471. console.log("====2====")
  472. }
  473. console.log("this.editParm.paths:" + this.editParm.paths);
  474. },
  475. handlePreview(file) {
  476. console.log("======handlePreview=======");
  477. console.log(file);
  478. },
  479. uploadImgSuccess(res, file) {
  480. if(res.code==200) {
  481. // this.addParm.path =res.data.list[0].path;
  482. const index = res.data.list[0].path.lastIndexOf("\/");
  483. this.fileImages.name = res.data.list[0].path.substring(index + 1, res.data.list[0].path.length);
  484. this.fileImages.url = process.env.VUE_APP_BASE_API + "/file" + res.data.list[0].path;
  485. console.log("this.fileImages.url:" + this.fileImages.url);
  486. console.log("====uploadImgSuccess====");
  487. console.log(this.fileList);
  488. console.log(this.editParm.paths);
  489. if (this.dialogEditVisible) {
  490. // if (this.editParm.paths != "undefined" && this.editParm.paths != null && this.editParm.paths != " " && this.editParm.paths != "null" && this.editParm.paths != "NULL") {
  491. // this.editParm.paths = this.editParm.paths + ";" + res.data.list[0].path;
  492. // } else {
  493. // this.editParm.paths = res.data.list[0].path;
  494. // }
  495. for (let i = 0; i < this.editParm.paths.length; i++) {
  496. console.log("for--- " + i);
  497. const imgUrl = this.editParm.paths[i].url;
  498. console.log(imgUrl);
  499. if (imgUrl.includes("/file/")) {
  500. imgUrl = imgUrl.substring(imgUrl.lastIndexOf("\/file\/") + 5, imgUrl.length);
  501. }
  502. console.log("包含file")
  503. }
  504. console.log("this.editParm.paths====1:" + this.editParm.paths);
  505. this.editParm.paths.push(res.data.list[0].path)
  506. console.log("res.data.list[0].path==:" + res.data.list[0].path);
  507. console.log("this.editParm.paths====2:" + this.editParm.paths);
  508. }
  509. if (this.dialogAddVisible) {
  510. // if (this.addParm.paths != "undefined" && this.addParm.paths != null && this.addParm.paths != " " && this.addParm.paths != "null" && this.addParm.paths != "NULL") {
  511. // this.addParm.paths = this.addParm.paths + ";" + res.data.list[0].path;
  512. // } else {
  513. // this.addParm.paths = res.data.list[0].path;
  514. // }
  515. this.addParm.paths.push(res.data.list[0].path)
  516. // console.log(this.addParm.paths);
  517. console.log("this.addParm.paths:" + this.addParm.paths);
  518. }
  519. }
  520. },
  521. //重置
  522. resetForm() {
  523. this.searchParm.shop = null;
  524. this.searchParm.orderId = null;
  525. this.searchParm.platformId = null;
  526. this.searchParm.companyId = null;
  527. this.searchParm.type = null;
  528. this.searchParm.status = null;
  529. this.searchTime = "";
  530. this.goSearch();
  531. },
  532. // 获取所有公司信息
  533. getCompanyAll() {
  534. getAll()
  535. .then(res => {
  536. this.companys = res.data;
  537. if (res.code == 200) {
  538. console.log(this.companys);
  539. }
  540. })
  541. .catch(() => {});
  542. },
  543. // 评论截取
  544. commentSub(row, column) {
  545. if (row['comment'] != "undefined" && row['comment'] != null && row['comment'] != "" && row['comment'] != "null" && row['comment'] != "NULL") {
  546. return row['comment'].slice(0,3) + "...";
  547. }
  548. },
  549. // 查询
  550. goSearch() {
  551. this.searchParm.sTime = this.searchTime[0];
  552. this.searchParm.eTime = this.searchTime[1];
  553. this.searchParm.page=1
  554. this.getCompanyAll();
  555. this.getDataList()
  556. },
  557. //导入成功
  558. uploadSuccess(res, file) {
  559. this.dialogImportVisible = false;
  560. if(res.code==200) {
  561. console.log("********date:"+res.data)
  562. if(res.data == true) {
  563. this.$message.success('导入成功!');
  564. }
  565. else{
  566. window.location.href = res.data;
  567. this.$message.error('导入失败!');
  568. }
  569. }
  570. this.goSearch();
  571. },
  572. beforeAvatarUpload(file) {
  573. console.log(file);
  574. const isLt10M = file.size / 1024 / 1024 <10;
  575. if (!isLt10M) {
  576. this.$message.error('上传Excel文件大小不能超过 10MB!');
  577. }
  578. return isLt10M;
  579. },
  580. // 导入
  581. importBtn() {
  582. this.dialogImportVisible = true
  583. },
  584. //机器人模板
  585. exportTempBtn() {
  586. console.log(this.tempUrl)
  587. window.location.href = this.tempUrl;
  588. },
  589. // 新增
  590. addBtn(){
  591. this.addParm = {
  592. id:null,
  593. platformId:null,
  594. companyId:null,
  595. account:null,
  596. pwd:null,
  597. amount:null,
  598. shop:null,
  599. orderId:null,
  600. comment:null,
  601. paths: []
  602. }
  603. this.fileList = []
  604. this.dialogAddTitle='新增'
  605. this.dialogAddVisible = true
  606. },
  607. // 修改
  608. editById(data){
  609. this.fileList = [];
  610. this.editParm.paths = [];
  611. this.editParm.comment = null;
  612. getDetailById({id: data.id}).then(res => {
  613. if(res.code==200) {
  614. this.editParm.id = res.data.id;
  615. this.editParm.comment = res.data.comment;
  616. if (res.data.paths != "undefined" && res.data.paths != null && res.data.paths != "" &&res.data.paths != "null" && res.data.paths != "NULL") {
  617. this.editParm.paths = res.data.paths.split(',');
  618. }
  619. if (this.editParm.paths != "undefined" && this.editParm.paths != null && this.editParm.paths != "" && this.editParm.paths != "null" && this.editParm.paths != "NULL") {
  620. this.editParm.paths = res.data.paths.split(',');
  621. this.fileList = res.data.paths.split(',').map(val => {
  622. // return {url:"http://localhost:8008/file" + val}
  623. return {name: val.substring(val.lastIndexOf("\/") + 1, val.length), url: val}
  624. console.log("url:" + val);
  625. })
  626. console.log(this.fileList)
  627. }
  628. this.dialogEditVisible = true
  629. this.$refs.ruleForm.clearValidate()
  630. }
  631. }).catch(err => {
  632. console.log(err)
  633. })
  634. },
  635. // 确认修改
  636. sureEdit(){
  637. this.editParm.paths = this.editParm.paths.toString()
  638. commentFun(this.editParm).then(res => {
  639. if(res.code==200) {
  640. console.log(res)
  641. this.dialogEditVisible = false
  642. this.$message.success('修改成功!')
  643. this.getDataList()
  644. }
  645. }).catch(err => {
  646. console.log(err)
  647. })
  648. },
  649. // 确认新增
  650. sureAdd(){
  651. this.addParm.paths = this.addParm.paths.toString()
  652. console.log(this.addParm)
  653. add(this.addParm).then(res => {
  654. if(res.code==200) {
  655. this.dialogAddVisible = false
  656. this.$message.success('新增成功!')
  657. this.getDataList()
  658. }
  659. }).catch(err => {
  660. console.log(err)
  661. })
  662. },
  663. // 查看根据id
  664. getBtnById(id){
  665. getDetailById({id}).then(res => {
  666. if(res.code==200) {
  667. this.detailParm.id = res.data.id;
  668. this.detailParm.platformId = res.data.platformId;
  669. this.detailParm.companyId = res.data.companyId;
  670. this.detailParm.amount = res.data.amount;
  671. this.detailParm.shop = res.data.shop;
  672. this.detailParm.orderId = res.data.orderId;
  673. this.detailParm.comment = res.data.comment;
  674. this.detailParm.shopName = res.data.shopName;
  675. this.detailParm.orderDate = res.data.orderDate;
  676. this.detailParm.paths = res.data.paths;
  677. this.fileList = [];
  678. if (res.data.paths != "undefined" && res.data.paths != null && res.data.paths != "" &&res.data.paths != "null" && res.data.paths != "NULL") {
  679. this.detailParm.paths = res.data.paths.split(',');
  680. }
  681. if (this.detailParm.paths != "undefined" && this.detailParm.paths != null && this.detailParm.paths != "" && this.detailParm.paths != "null" && this.detailParm.paths != "NULL") {
  682. this.detailParm.paths = res.data.paths.split(',')
  683. this.fileList = res.data.paths.split(',').map(val => {
  684. // return {url:"http://localhost:8008/file" + val}
  685. return {name: val.substring(val.lastIndexOf("\/") + 1, val.length), url: val}
  686. })
  687. console.log(this.fileList)
  688. }
  689. this.dialogDetailVisible = true;
  690. this.$refs.ruleForm.clearValidate();
  691. }
  692. }).catch(err => {
  693. console.log(err)
  694. })
  695. },
  696. // 分页获取表格数据
  697. getDataList(){
  698. getList(this.searchParm).then(res => {
  699. console.log(res)
  700. if(res.code==200) {
  701. console.log(res)
  702. this.list = res.data.list;
  703. this.total = res.data.total;
  704. }
  705. }).catch(err => {
  706. console.log(err)
  707. })
  708. },
  709. // 分页
  710. handleSizeChange(val) {
  711. console.log(`每页 ${val} 条`);
  712. this.searchParm.pageSize = val;
  713. this.getDataList();
  714. },
  715. handleCurrentChange(val) {
  716. console.log(`当前页: ${val}`);
  717. this.searchParm.page = val;
  718. this.getDataList();
  719. }
  720. }
  721. }
  722. </script>
  723. <style rel="stylesheet/scss" lang="scss" scoped>
  724. </style>