多租户商城-客户PC端
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.

727 lines
20 KiB

3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
  1. <template>
  2. <div class="orderList">
  3. <div class="head">
  4. <div style="flex: 9; padding-left: 20px">
  5. <span style="flex: 5">{{ $t('common.beautiproduct') }}</span>
  6. <span style="flex: 2">单价</span>
  7. <span style="flex: 2">数量</span>
  8. </div>
  9. <div style="flex: 8; padding-right: 20px">
  10. <span style="flex: 1">实付款</span>
  11. <span style="flex: 1">收货人</span>
  12. <span style="flex: 1">状态</span>
  13. <span style="flex: 1">操作</span>
  14. </div>
  15. </div>
  16. <div v-if="flag">
  17. <div class="content" v-for="(item, index) in orderList" :key="index">
  18. <div class="top">
  19. <div class="left">
  20. <span class="shopName" @click="toStore(item.shopId)"
  21. ><img :src="item.shopLogo" alt="" />{{ item.shopName }}</span
  22. >
  23. <span class="time">{{ item.createTime }}</span>
  24. <span class="orderCode">订单号{{ item.orderFormid }}</span>
  25. </div>
  26. <div class="right">
  27. <div @click="$emit('isDelete', item.orderId)">
  28. <icon-svg
  29. v-if="item.state == 5"
  30. style="font-size: 24px; cursor: pointer;" icon-class="del"
  31. />
  32. </div>
  33. </div>
  34. </div>
  35. <div class="productBox">
  36. <div class="product">
  37. <div class="left fs13">
  38. <div
  39. class="box"
  40. v-for="(items, indexs) in item.skus"
  41. :key="indexs"
  42. >
  43. <div
  44. class="desc cur-poi"
  45. @click="toProductDetail(item.shopId, items)"
  46. >
  47. <img :src="items.image" alt="" />
  48. <div>
  49. <p class="name">{{ items.productName }}</p>
  50. <p class="size font-color-999">
  51. <span v-for="(val, idx) in items.values" :key="idx">{{
  52. val
  53. }}</span>
  54. </p>
  55. </div>
  56. </div>
  57. <div class="price">¥{{ items.price }}</div>
  58. <div class="num">
  59. <p class="fs14">{{ items.number }}</p>
  60. <!-- <p v-if="items.afterState === 1" class="fs14" style="color: #c83732;">
  61. (售后审核中)
  62. </p>
  63. <p v-if="items.afterState === 2" class="fs14" style="color: #c83732;">
  64. (退款中)
  65. </p>
  66. <p v-if="items.afterState === 3" class="fs14" style="color: #c83732;">
  67. (退货中)
  68. </p>
  69. <p v-if="items.afterState === 4" class="fs14" style="color: #c83732;">
  70. (退款成功)
  71. </p>
  72. <p v-if="items.afterState === 5" class="fs14" style="color: #c83732;">
  73. (退款失败)
  74. </p>
  75. <p v-if="items.afterState === 6" class="fs14" style="color: #c83732;">
  76. (审核不通过)
  77. </p>
  78. <p v-if="items.afterState === 7" class="fs14" style="color: #c83732;">
  79. (售后评审中)
  80. </p>
  81. <p v-if="items.afterState === 8" class="fs14" style="color: #c83732;">
  82. (退货完成拒绝退款)
  83. </p>
  84. <p v-if="items.afterState === 10" class="fs14" style="color: #c83732;">
  85. (售后审核通过)
  86. </p> -->
  87. </div>
  88. </div>
  89. </div>
  90. <div
  91. class="right"
  92. :class="item.skus.length > 1 ? 'right_line' : ''"
  93. >
  94. <div class="actualPay">
  95. <div>
  96. <p class="fs13 mar-bot-5">
  97. ¥{{ (item.orderPrice - item.discountPrice).toFixed(2) }}
  98. </p>
  99. <p class="fs13 colorRed">(含运费¥{{ item.logisticsPrice }})</p>
  100. </div>
  101. </div>
  102. <div class="consignee">{{ item.receiveName }}</div>
  103. <div class="status">
  104. <div>
  105. <p
  106. class="fs13 mar-bot-5 colorRed"
  107. v-if="item.state == 1"
  108. >
  109. 待付款
  110. </p>
  111. <div v-if="item.state == 1">
  112. <p class="time fs12 mar-bot-10 font-color-999 flex-items">
  113. <img
  114. style="width: 13px; height: 13px; margin-right: 5px"
  115. src="../../../static/image/alarm_clock@2x.png"
  116. alt=""
  117. />
  118. 剩余时间{{ item.time | formatMinutes }}
  119. </p>
  120. </div>
  121. <p
  122. class="fs13 mar-bot-5 colorGlod"
  123. v-if="item.state == 2"
  124. >
  125. 待发货
  126. </p>
  127. <p
  128. class="fs13 mar-bot-5 colorGlod"
  129. v-if="item.state == 3"
  130. >
  131. 待收货
  132. </p>
  133. <p
  134. class="fs13 mar-bot-5 font-color-999"
  135. v-if="item.state == 4"
  136. >
  137. 已完成
  138. </p>
  139. <p
  140. class="fs13 mar-bot-5 font-color-999"
  141. v-if="item.state == 5"
  142. >
  143. 已关闭
  144. </p>
  145. <p
  146. class="fs13 mar-bot-5 colorRed"
  147. v-if="item.state == 6"
  148. >
  149. 待成团
  150. </p>
  151. <p class="fs13 cur-poi" @click="toOrderDetail(item.orderId)">
  152. 订单详情
  153. </p>
  154. </div>
  155. </div>
  156. <div class="operate">
  157. <div class="btnContainer">
  158. <el-button
  159. class="btn btnBlack"
  160. size="small"
  161. v-if="
  162. item.state == 1 ||
  163. (item.paymentState == 0 && item.state == 6)
  164. "
  165. @click="getUrl(item.orderId)"
  166. v-throttle
  167. >去付款</el-button>
  168. <el-button
  169. class="btn btnBlack"
  170. size="small"
  171. v-if="item.state == 2"
  172. @click="remind(item.orderId)"
  173. v-throttle
  174. >提醒发货</el-button>
  175. <el-button
  176. class="btn btnBlack"
  177. size="small"
  178. v-if="item.state == 3 && item.ifAfter == 1"
  179. @click="$emit('isConfirm', item.orderId)"
  180. v-throttle
  181. >确认收货</el-button>
  182. <el-button
  183. class="btn btnBlack"
  184. size="small"
  185. v-if="item.state == 4 || item.state == 5"
  186. @click="buyAgain(item)"
  187. v-throttle
  188. >再次购买</el-button>
  189. <p
  190. class="btn"
  191. @click="$emit('isCancel', item.orderId)"
  192. v-if="item.state == 1 || item.state == 6"
  193. v-throttle
  194. >
  195. 取消订单
  196. </p>
  197. <p
  198. class="btn"
  199. @click="toAfterSale(item)"
  200. v-if="item.state == 2 && !item.afterState"
  201. v-throttle
  202. >
  203. 退货/退款
  204. </p>
  205. <p
  206. class="btn"
  207. @click="$emit('isRefund', item)"
  208. v-if="
  209. ((item.state == 3 && item.ifAfter)
  210. || (item.state == 4 && item.ifAfter))
  211. && !item.afterState
  212. "
  213. v-throttle
  214. >
  215. 退货/退款
  216. </p>
  217. <p
  218. class="btn"
  219. v-if="item.state == 4 && item.ifNotComment === 1"
  220. @click="toEvaluate(item)"
  221. v-throttle
  222. >
  223. 评价
  224. </p>
  225. <p
  226. class="btn"
  227. v-if="item.state == 3"
  228. @click="toOrderDetail(item.orderId)"
  229. v-throttle
  230. >
  231. 查看物流
  232. </p>
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. <el-pagination
  240. :current-page="page"
  241. :page-size="5"
  242. @current-change="handleCurrentChange"
  243. background
  244. layout="prev, pager, next"
  245. :total="total"
  246. ></el-pagination>
  247. </div>
  248. <div class="noorder" v-else>
  249. <icon-svg
  250. style="width: 240px; height: 240px; margin-bottom: 20px"
  251. icon-class="user-order-nodata"
  252. />
  253. <p class="fs20 font-color-999">你还没有订单哦</p>
  254. <router-link to="/">
  255. <el-button>去首页看看</el-button>
  256. </router-link>
  257. </div>
  258. <el-dialog
  259. class="weChat"
  260. title="微信支付"
  261. :visible.sync="weChatDialog"
  262. :before-close="handleClose"
  263. width="300px"
  264. >
  265. <div class="qCode">
  266. <div class="wechatTitle">
  267. <div class="tips">
  268. <p>请使用微信扫一扫</p>
  269. <p>扫描二维码支付</p>
  270. </div>
  271. <div>{{ payInfo.money }}</div>
  272. </div>
  273. <img class="code" :src="payInfo.url" alt="">
  274. </div>
  275. </el-dialog>
  276. </div>
  277. </template>
  278. <script>
  279. import { mapMutations } from 'vuex'
  280. import {
  281. buyItAgain,
  282. checkOrderResult,
  283. orderPayCode
  284. } from '@/api/user/order.js'
  285. import {
  286. getCartList
  287. } from '@/api/user/cart.js'
  288. export default {
  289. props: ['orderList', 'total', 'page', 'flag'],
  290. data () {
  291. return {
  292. payInfo: {},
  293. weChatDialog: false,
  294. chatTimer: '',
  295. endTime: '',
  296. endTime1: ''
  297. }
  298. },
  299. filters: {
  300. formatMinutes: function (value) {
  301. let minutes = Math.floor((value % (1000 * 60 * 60)) / (1000 * 60))
  302. if (minutes < 10) {
  303. return '0' + minutes
  304. } else {
  305. return minutes
  306. }
  307. }
  308. },
  309. methods: {
  310. ...mapMutations({
  311. setCartNumber: 'SET_CARTNUMBER',
  312. setShoppingCart: 'SET_SHOPPINGCART'
  313. }),
  314. // 跳转到商品详情
  315. toProductDetail (id, item) {
  316. let data = {
  317. shopId: id,
  318. productId: item.productId,
  319. skuId: item.skuId
  320. }
  321. this.$router.push({
  322. path: '/productDetail',
  323. query: {
  324. proData: JSON.stringify(data)
  325. }
  326. })
  327. },
  328. // 分页器跳转
  329. handleCurrentChange (val) {
  330. this.$emit('handleCurrentChange', val)
  331. },
  332. // 提醒发货
  333. remind (id) {
  334. this.$message({
  335. message: '已提醒卖家发货',
  336. type: 'success'
  337. })
  338. },
  339. // 跳转到店铺
  340. toStore (id) {
  341. this.$router.push({
  342. path: '/store',
  343. query: {
  344. shopId: id
  345. }
  346. })
  347. },
  348. // 跳转到订单详情
  349. toOrderDetail (id) {
  350. this.$router.push({
  351. path: '/orderDetail',
  352. query: {
  353. orderId: id
  354. }
  355. })
  356. },
  357. // 再次购买
  358. async buyAgain (item) {
  359. if (item.shopDiscountId !== 0 || item.shopGroupWorkId !== 0 || item.shopSeckillId !== 0) {
  360. this.$message.warning('活动商品无法再次购买')
  361. return
  362. }
  363. const response = await buyItAgain({ orderId: item.orderId })
  364. const res = response.data
  365. if (res.code === '200') {
  366. this.$router.push('/shopping-trolley')
  367. } else {
  368. this.$message({
  369. message: res.message,
  370. type: 'warning'
  371. })
  372. }
  373. },
  374. // 跳转到评价
  375. toEvaluate (data) {
  376. console.log(data)
  377. this.$router.push({
  378. path: '/evaluate',
  379. query: {
  380. product: JSON.stringify(data)
  381. }
  382. })
  383. },
  384. // 申请售后
  385. toAfterSale (item) {
  386. this.$router.push({
  387. path: '/afterSale',
  388. query: {
  389. orderData: JSON.stringify(item),
  390. state: 1
  391. }
  392. })
  393. },
  394. // 去支付
  395. checkPay (data) {
  396. setTimeout(() => {
  397. checkOrderResult({
  398. collageId: data.collageId,
  399. money: data.money,
  400. orderId: data.orderId,
  401. type: 2
  402. }).then(response => {
  403. const res = response.data
  404. if (res.code === '200') {
  405. if (res.data.code === 'SUCCESS') {
  406. this.$message.success('支付成功!')
  407. clearInterval(this.chatTimer)
  408. this.getTrolleyList()
  409. this.weChatDialog = false
  410. this.toOrderDetail(data.orderId)
  411. }
  412. } else {
  413. clearInterval(this.chatTimer)
  414. this.$message.error(res.message)
  415. this.weChatDialog = false
  416. }
  417. })
  418. }, 0)
  419. },
  420. // 购物车列表
  421. async getTrolleyList () {
  422. const response = await getCartList()
  423. const res = response.data
  424. let cartNumber = 0
  425. if (res.data.length) {
  426. res.data.forEach((j) => {
  427. cartNumber = cartNumber + j.skus.length
  428. })
  429. }
  430. this.setShoppingCart(res.data)
  431. this.setCartNumber(cartNumber)
  432. },
  433. // 去支付
  434. async getUrl (id) {
  435. const response = await orderPayCode({ orderId: id })
  436. const res = response.data
  437. if (res.code === '200') {
  438. this.payInfo = res.data
  439. this.weChatDialog = true
  440. this.chatTimer = setInterval(() => {
  441. this.checkPay(res.data)
  442. }, 3000)
  443. } else {
  444. this.$message.error(res.message)
  445. }
  446. },
  447. handleClose () {
  448. this.$confirm('确认取消支付?')
  449. .then((_) => {
  450. clearInterval(this.chatTimer)
  451. this.weChatDialog = false
  452. })
  453. .catch((_) => {})
  454. }
  455. }
  456. }
  457. </script>
  458. <style lang="scss" scoped>
  459. .orderList {
  460. width: 100%;
  461. .colorRed{
  462. color: #C83732;
  463. }
  464. .colorGlod{
  465. color: #C5AA7B;
  466. }
  467. .noorder {
  468. width: 100%;
  469. text-align: center;
  470. padding: 100px 0;
  471. p {
  472. margin-bottom: 20px;
  473. }
  474. .el-button {
  475. width: 200px;
  476. height: 50px;
  477. padding: 0;
  478. background-color: $mainColor;
  479. color: $mainBtnFontColor;
  480. font-size: 14px;
  481. font-family: Microsoft YaHei;
  482. border-radius: 0;
  483. }
  484. }
  485. .head {
  486. box-sizing: border-box;
  487. width: 100%;
  488. height: 50px;
  489. // background-color: #F1F2F7;
  490. background: #ffffff;
  491. border: 2px solid #f3f4f5;
  492. display: flex;
  493. align-items: center;
  494. text-align: center;
  495. margin-bottom: 10px;
  496. div {
  497. display: flex;
  498. }
  499. }
  500. .content {
  501. width: 100%;
  502. margin-bottom: 20px;
  503. border: 1px solid #e5e5e5;
  504. // border-bottom: 0;
  505. box-sizing: border-box;
  506. &:hover{
  507. border-color: $mainColor;
  508. .top{
  509. background-color: $mainColor;
  510. }
  511. }
  512. .top {
  513. width: 100%;
  514. font-size: 13px;
  515. height: 40px;
  516. color: #fff;
  517. background-color: #333333;
  518. display: flex;
  519. justify-content: space-between;
  520. align-items: center;
  521. .left {
  522. flex: 15;
  523. height: 100%;
  524. display: flex;
  525. align-items: center;
  526. .shopName {
  527. display: inline-block;
  528. margin-left: 20px;
  529. min-width: 150px;
  530. cursor: pointer;
  531. overflow: hidden;
  532. white-space: nowrap;
  533. text-overflow: ellipsis;
  534. img {
  535. width: 16px;
  536. height: 16px;
  537. vertical-align: middle;
  538. margin-right: 5px;
  539. }
  540. }
  541. .time {
  542. margin-right: 60px;
  543. }
  544. }
  545. .right {
  546. flex: 2;
  547. display: flex;
  548. align-items: center;
  549. justify-content: center;
  550. // padding-right: 20px;
  551. }
  552. }
  553. .productBox {
  554. width: 100%;
  555. box-sizing: border-box;
  556. .product {
  557. width: 100%;
  558. display: flex;
  559. .left {
  560. flex: 9;
  561. .box {
  562. padding: 20px 0 20px 20px;
  563. display: flex;
  564. border-bottom: 1px solid #e5e5e5;
  565. .desc {
  566. flex: 5;
  567. display: flex;
  568. img {
  569. width: 100px;
  570. height: 100px;
  571. margin-right: 10px;
  572. }
  573. div {
  574. width: 100%;
  575. margin-bottom: 10px;
  576. display: flex;
  577. flex-direction: column;
  578. justify-content: space-between;
  579. .name {
  580. font-size: 14px;
  581. overflow: hidden;
  582. white-space: nowrap;
  583. text-overflow: ellipsis;
  584. }
  585. .size {
  586. font-size: 13px;
  587. span {
  588. margin-right: 10px;
  589. }
  590. span:last-child {
  591. margin-right: 0;
  592. }
  593. }
  594. }
  595. }
  596. .price,
  597. .num {
  598. flex: 2;
  599. display: flex;
  600. flex-direction: column;
  601. align-items: center;
  602. justify-content: center;
  603. }
  604. }
  605. }
  606. .right {
  607. flex: 8;
  608. display: flex;
  609. border-bottom: 1px solid #e5e5e5;
  610. .actualPay,
  611. .consignee,
  612. .status{
  613. flex: 1;
  614. display: flex;
  615. justify-content: center;
  616. align-items: center;
  617. div {
  618. text-align: center;
  619. .el-button {
  620. border: 1px solid $mainColor;
  621. color: $mainColor;
  622. border-radius: 0;
  623. }
  624. }
  625. }
  626. .operate{
  627. flex: 1;
  628. .btnContainer{
  629. height: 100%;
  630. display: flex;
  631. flex-direction: column;
  632. align-items: center;
  633. justify-content: center;
  634. .btn{
  635. width: 70px;
  636. height: 30px;
  637. margin: 2px;
  638. padding: 0;
  639. line-height: 30px;
  640. text-align: center;
  641. color: $mainColor;
  642. border: 1px solid #F3F4F5;
  643. font-size: 12px;
  644. font-family: Microsoft YaHei;
  645. cursor: pointer;
  646. }
  647. .btnBlack{
  648. color: #FFEBC4 !important;
  649. background: #333333;
  650. box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.16);
  651. }
  652. }
  653. }
  654. }
  655. .right_line {
  656. border-left: 1px solid #e5e5e5;
  657. }
  658. }
  659. }
  660. }
  661. >>> .el-pagination {
  662. margin-top: 40px;
  663. text-align: right;
  664. .el-pager {
  665. li:not(.disabled):hover {
  666. color: $mainColor;
  667. }
  668. li:not(.disabled).active {
  669. background-color: $mainColor;
  670. }
  671. li:not(.disabled).active:hover {
  672. color: #f4f4f5;
  673. }
  674. }
  675. }
  676. .qCode {
  677. .wechatTitle{
  678. width: 280px;
  679. margin: auto;
  680. padding: 10px 15px;
  681. color: #333;
  682. border: 2px solid #F3F4F5;
  683. display: flex;
  684. justify-content: space-around;
  685. align-items: center;
  686. .tips{
  687. flex: 1;
  688. }
  689. }
  690. .code{
  691. width: 280px;
  692. height: 280px;
  693. display: block;
  694. margin: 10px auto;
  695. border: 2px solid #F3F4F5;
  696. }
  697. }
  698. .weChat {
  699. >>> .el-dialog__body {
  700. background: #ffffff;
  701. }
  702. }
  703. >>> .el-dialog {
  704. width: 33% !important;
  705. .el-dialog__body {
  706. background: #f8f8f8;
  707. }
  708. .el-dialog__header {
  709. text-align: center;
  710. }
  711. .el-dialog__footer {
  712. text-align: center;
  713. .dialog-footer {
  714. text-align: center;
  715. button {
  716. height: 45px;
  717. width: 160px;
  718. }
  719. }
  720. }
  721. }
  722. }
  723. </style>