index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <template>
  2. <div class="right">
  3. <div class="showTitle">
  4. <el-icon>
  5. <document />
  6. </el-icon>
  7. <h2>我的订单</h2>
  8. </div>
  9. <div id="topNav">
  10. <h2 @click="orderChoose($event, '全部')">全部</h2>
  11. <h2 @click="orderChoose($event, '未支付')">未支付</h2>
  12. <h2 @click="orderChoose($event, '服务中')">服务中</h2>
  13. <h2 @click="orderChoose($event, '已完成')">已完成</h2>
  14. <h2 @click="orderChoose($event, '已取消')">已取消</h2>
  15. </div>
  16. <hr id="hr1" />
  17. <div id="choseMsg" class="statusMsg" v-for="item in this.list" :key="item.id">
  18. <div id="topContent">
  19. <label>订单号:</label>
  20. <label class="orderId">{{ item.id }}</label>
  21. <label>创建时间:</label>
  22. <label class="orderId">{{ item.createTime }}</label>
  23. <img id="statusImg" src="../../img/status.png" />
  24. <label id="statusSpan">{{ item.status }}</label>
  25. </div>
  26. <hr class="hr tophr" />
  27. <span>家政人员:</span>
  28. <input disabled v-model="item.serverName" class="theIn" type="text" />
  29. <span class="rightSpan">分类范围:</span>
  30. <input disabled v-model="item.categoryName" class="theIn" type="text" />
  31. <br />
  32. <span>联系方式:</span>
  33. <input disabled v-model="item.serverPhone" class="theIn" type="text" />
  34. <span class="rightSpan">聘请类别:</span>
  35. <input disabled v-model="item.serverType" class="theIn" type="text" />
  36. <br />
  37. <span id="totalPrice" class="rightSpan">总价:</span>
  38. <input disabled v-model="item.totalPrice" class="theIn" type="text" />
  39. <span class="rightSpan">服务时间</span>
  40. <input disabled v-model="item.serverTime" class="theIn" type="text" />
  41. <br />
  42. <span id="note">备注:</span>
  43. <textarea disabled v-model="item.treatment"></textarea>
  44. <div v-if="item.status == this.unpaid">
  45. <hr class="hr" />
  46. <input class="firstBotton" type="button" @click="convertMsg($event, item)" value="去支付" />
  47. <input class="secondBotton" type="button" @click="convertMsg($event, item)" value="取消订单" />
  48. </div>
  49. <div v-if="item.status == this.serving">
  50. <hr class="hr" />
  51. <input class="threeBotton" type="button" @click="convertMsg($event, item)" value="服务完成" />
  52. </div>
  53. <div v-if="item.status == this.finished">
  54. <el-input v-if="compare(item.comment)" class="commentInput" v-model="item.comment" disabled="true"></el-input>
  55. <el-input v-else class="commentInput" v-model="queryList.content" placeholder="请输入评价"></el-input>
  56. <input class="commentButton" v-if="compare(item.comment)" type="button" value="已完成" />
  57. <input class="commentButton" v-else type="button" @click="addComment(item.id)" value="发表评价" />
  58. </div>
  59. </div>
  60. <nav v-if="this.getTotal * 1" style="text-align: -webkit-center">
  61. <el-pagination :page-size="this.getCurrentPageSize" style="width: max-content" :current-page="this.getCurrentPage"
  62. @current-change="handleCurrentChange" layout="prev, pager, next" :total="this.getTotal * 1" />
  63. </nav>
  64. <div v-if="!(this.getTotal * 1)">
  65. <img id="noImg" src="./img/noContent.png" />
  66. <h4>没有订单信息....</h4>
  67. </div>
  68. </div>
  69. <div class="clear"></div>
  70. </template>
  71. <script>
  72. import {
  73. getBossOrder,
  74. cancelOrderById,
  75. Comment,
  76. finishOrder,
  77. toPay,
  78. } from "@/api";
  79. import {
  80. Menu as IconMenu,
  81. ArrowDownBold,
  82. ArrowUpBold,
  83. } from "@element-plus/icons-vue";
  84. import { mapMutations,mapGetters } from 'vuex'
  85. import popmessage from "@/components/tip/index.js";
  86. export default {
  87. name: "MyOrder",
  88. data() {
  89. return {
  90. queryList: {
  91. orderId: '',
  92. userId: '',
  93. content: ''
  94. },
  95. commentList: [],
  96. vaule1: '',
  97. unpaid: "未支付",
  98. serving: "服务中",
  99. finished: "已完成",
  100. list: [],
  101. };
  102. },
  103. computed: {
  104. ...mapGetters("OrderStore", ['getCurrentPageSize', 'getCurrentPage', 'getStatus', 'getTotal'])
  105. },
  106. methods: {
  107. ...mapMutations("OrderStore", ['changePageNum', 'setTotal', 'setStatus']),
  108. //筛选订单
  109. orderChoose(e, s) {
  110. for (
  111. let index = 0;
  112. index < e.currentTarget.parentNode.children.length;
  113. index++
  114. ) {
  115. e.currentTarget.parentNode.children[index].style.color = "black";
  116. }
  117. e.currentTarget.style.color = "#409eff";
  118. this.setStatus(s)
  119. this.init()
  120. },
  121. addComment(id) {
  122. // 实现评论接口
  123. let params = {
  124. orderId: id,
  125. userId: this.queryList.userId,
  126. content: this.queryList.content
  127. }
  128. Comment(params).then(res => {
  129. if (res.data.code === 200) {
  130. popmessage({ type: "success", str: "发表成功" });
  131. this.init()
  132. }
  133. })
  134. this.queryList.orderId = ''
  135. },
  136. // 查看是否有评价字段
  137. compare(comment) {
  138. if (comment !== undefined) {
  139. return true
  140. } else {
  141. return false
  142. }
  143. },
  144. // 确定订单状态
  145. convertMsg(e, list) {
  146. this.queryList.orderId = list.id
  147. let msg = e.currentTarget.value
  148. if (msg === '去支付') {
  149. // 跳转支付页面
  150. let parmas = {
  151. orderId: list.id
  152. }
  153. toPay(parmas).then(response => {
  154. if (response.data.code === 200) {
  155. const payNo = response.data.data
  156. const url =
  157. "http://jzuserweb.aiyangniu.net/user/pay/requestPay?payNo=" +
  158. payNo;
  159. window.open(url);
  160. this.$router.go(0)
  161. }
  162. })
  163. } else if (msg === '取消订单') {
  164. let params = {
  165. orderId: list.id
  166. }
  167. cancelOrderById(params).then(res => {
  168. if (res.data.code === 200) {
  169. popmessage({ type: "success", str: "取消成功" });
  170. this.init()
  171. } else if (res.data.code === 611) {
  172. popmessage({ type: "error", str: "取消失败,请联系管理员" });
  173. }
  174. })
  175. } else if (msg === '服务完成') {
  176. let params = {
  177. orderId: this.queryList.orderId
  178. }
  179. finishOrder(params).then(response => {
  180. if (response.data.code === 200) {
  181. popmessage({ type: "success", str: "完成服务" });
  182. this.init()
  183. }
  184. })
  185. }
  186. },
  187. ...mapMutations("PerCent", ["convertIndex"]),
  188. handleCurrentChange(val) {
  189. this.changePageNum(val)
  190. this.init()
  191. },
  192. init() {
  193. const parmas = {
  194. orderStatus: this.getStatus,
  195. pageNum: this.getCurrentPage,
  196. pageSize: this.getCurrentPageSize,
  197. };
  198. getBossOrder(parmas).then((response) => {
  199. if (response.data.code === 200) {
  200. this.list = response.data.data.rows;
  201. this.setTotal(parseInt(response.data.data.total))
  202. this.queryList.userId = response.data.data.rows[0].userId
  203. }
  204. });
  205. }
  206. },
  207. created() {
  208. this.init()
  209. },
  210. components: {
  211. IconMenu,
  212. ArrowUpBold,
  213. ArrowDownBold,
  214. },
  215. };
  216. </script>
  217. <style scoped>
  218. .commentInput[disabled]{
  219. font-size: 30dp;
  220. font-weight: bold;
  221. color: black;
  222. }
  223. .right {
  224. width: 59rem;
  225. background-color: rgb(255, 255, 255);
  226. /* top: 1rem; */
  227. /* left: 24rem; */
  228. border: 1px solid gray;
  229. border-radius: 10px;
  230. display: inline-block;
  231. margin: 0;
  232. margin-left: 25rem;
  233. float: left;
  234. margin-top: -43.5rem;
  235. }
  236. .showTitle {
  237. position: relative;
  238. width: 100%;
  239. height: 3rem;
  240. border-bottom: 1px solid rgb(165, 162, 162);
  241. box-sizing: border-box;
  242. text-align: start;
  243. padding-left: 2rem;
  244. }
  245. .showTitle h2 {
  246. display: inline-block;
  247. font-size: 1.3rem;
  248. text-align: left;
  249. }
  250. #topNav {
  251. text-align: left;
  252. }
  253. #hr1 {
  254. border-width: 0.15rem;
  255. }
  256. #topNav h2 {
  257. display: inline-block;
  258. font-size: 1.2rem;
  259. font-weight: 400;
  260. padding: 0;
  261. margin: 0;
  262. margin-left: 2rem;
  263. margin-top: 1rem;
  264. margin-bottom: 1rem;
  265. cursor: pointer;
  266. }
  267. #topNav :first-child {
  268. color: #409eff;
  269. }
  270. #serveArea {
  271. margin-bottom: 2rem;
  272. }
  273. #tipsMsg {
  274. transition: all 0.4s ease;
  275. display: none;
  276. height: auto;
  277. padding-left: 2rem;
  278. padding-bottom: 1rem;
  279. padding-top: 1.5rem;
  280. }
  281. #arrow {
  282. padding-left: 46rem !important;
  283. }
  284. /* 填写信息样式
  285. */
  286. #choseMsg {
  287. width: 90%;
  288. border: 1px solid rgb(112, 110, 110);
  289. border-radius: 2rem;
  290. text-align: start;
  291. margin: 0 auto;
  292. margin-top: 2rem;
  293. padding-left: 2.5rem;
  294. margin-bottom: 1rem;
  295. }
  296. #choseMsg span {
  297. display: inline-block;
  298. font-size: 1.2rem;
  299. font-weight: 400;
  300. padding-right: 1rem;
  301. margin-top: 1rem;
  302. }
  303. #choseMsg select {
  304. width: 7rem;
  305. height: 1.7em;
  306. font-size: 1rem;
  307. margin-top: 1rem;
  308. margin-right: 3rem;
  309. }
  310. #choseMsg .theIn {
  311. width: 17rem;
  312. height: 1.6rem;
  313. border: none;
  314. font-size: 1.1rem;
  315. }
  316. #choseMsg input {
  317. height: 1rem;
  318. margin-top: 1rem;
  319. }
  320. #emType {
  321. margin-left: 5.5rem;
  322. }
  323. #contact {
  324. margin-left: 2rem;
  325. }
  326. #residence {
  327. margin-bottom: 1rem;
  328. }
  329. #salaryIn {
  330. width: 3rem;
  331. margin-left: -1rem;
  332. margin-right: 0.5rem;
  333. }
  334. #salary {
  335. margin-left: 4.4rem;
  336. }
  337. /*
  338. 我的状态 */
  339. #myStatus {
  340. padding: 0;
  341. margin: 0;
  342. text-align: start;
  343. margin-top: 2rem;
  344. }
  345. #myStatus #statusTitle {
  346. margin-left: 3rem;
  347. font-size: 1.2rem;
  348. font-weight: 700;
  349. }
  350. #statusRight {
  351. display: inline-block;
  352. height: 3rem;
  353. width: auto;
  354. overflow: hidden;
  355. background-color: aqua;
  356. margin: 0 auto;
  357. margin-bottom: 0;
  358. margin-left: 9rem;
  359. }
  360. #statusRight img {}
  361. #msgStatus {
  362. margin-left: 1rem;
  363. font-weight: 600;
  364. }
  365. #private {
  366. margin-left: 42rem;
  367. font-weight: 500;
  368. display: inline-block;
  369. padding-right: 1rem;
  370. margin-bottom: 2rem;
  371. }
  372. ::v-deep .el-cascader .el-input {
  373. display: flex;
  374. cursor: pointer;
  375. border: 1px solid black;
  376. }
  377. ::v-deep .el-input__wrapper {
  378. display: inline-flex;
  379. flex-grow: 1;
  380. align-items: center;
  381. justify-content: center;
  382. padding: 1px 11px;
  383. background-color: var(--el-input-bg-color, var(--el-fill-color-blank));
  384. background-image: none;
  385. border-radius: 0;
  386. transition: var(--el-transition-box-shadow);
  387. box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
  388. }
  389. #areaStyle {
  390. width: 15rem;
  391. margin-left: 0.1rem;
  392. height: 1.3rem !important;
  393. vertical-align: inherit;
  394. }
  395. ::v-deep .el-input__wrapper {
  396. display: inline-flex;
  397. flex-grow: 1;
  398. align-items: center;
  399. justify-content: center;
  400. padding: 1px 11px;
  401. background-image: none;
  402. border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
  403. transition: var(--el-transition-box-shadow);
  404. }
  405. #topContent {
  406. margin: 0;
  407. padding: 0;
  408. text-align: left;
  409. }
  410. #topContent label {
  411. font-size: 1.1rem;
  412. margin-top: 1rem;
  413. }
  414. .hr {
  415. position: absolute;
  416. left: 29rem;
  417. width: 55rem;
  418. }
  419. /* 备注 */
  420. textarea {
  421. resize: none;
  422. width: 82%;
  423. height: 4rem;
  424. border: none;
  425. /* outline: none; */
  426. color: rgb(63, 62, 62);
  427. font-size: 0.8rem;
  428. font-weight: bold;
  429. margin-top: -1rem;
  430. /* border: none; */
  431. margin-left: 6.3rem;
  432. margin-bottom: 1rem;
  433. }
  434. /* 状态图片 */
  435. #statusImg {
  436. margin: 0;
  437. padding: 0;
  438. width: 3%;
  439. height: auto;
  440. }
  441. /* 订单头部 */
  442. .orderId {
  443. width: 18rem;
  444. text-align: left;
  445. padding: 0.2rem;
  446. display: inline-block;
  447. }
  448. /* 雇主 */
  449. #employer {
  450. margin-right: 2.2rem;
  451. }
  452. .rightSpan {
  453. margin-left: 3.5rem;
  454. text-align: start;
  455. }
  456. /*
  457. 总价 */
  458. #totalPrice {
  459. margin-right: 2.5rem;
  460. margin-left: 0rem;
  461. }
  462. /* 备注 */
  463. #note {
  464. position: relative;
  465. top: 0.1rem;
  466. left: 0.2rem;
  467. }
  468. #statusSpan {
  469. vertical-align: text-bottom;
  470. margin-left: 0.3rem;
  471. }
  472. /* 按钮 */
  473. .firstBotton {
  474. margin-left: 38rem;
  475. }
  476. input[type="button"] {
  477. margin-top: 0.2rem;
  478. background-color: #409eff;
  479. width: 6rem;
  480. height: 2rem !important;
  481. border-radius: 1rem;
  482. display: inline-block;
  483. right: 2rem;
  484. border: none;
  485. margin-right: 1rem;
  486. color: white;
  487. letter-spacing: 0.1rem;
  488. cursor: pointer;
  489. margin-bottom: 0.7rem;
  490. font-weight: 500;
  491. }
  492. .secondBotton {
  493. background-color: white !important;
  494. border: 1px solid black !important;
  495. color: black !important;
  496. }
  497. .threeBotton {
  498. margin-left: 45rem !important;
  499. }
  500. .commentButton {
  501. margin-left: 45rem;
  502. }
  503. .refund {
  504. margin-left: 45rem;
  505. }
  506. .tophr {
  507. margin-bottom: 1rem;
  508. }
  509. /* 缺省页 */
  510. #noImg {
  511. width: 25rem;
  512. }
  513. /*
  514. 清除浮动 */
  515. .clear {
  516. clear: both;
  517. }
  518. /* 分页按钮 */
  519. #pagination {
  520. margin-bottom: 1rem;
  521. }
  522. </style>