index.vue 21.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
<template>
  <div class="orderDetail">
    <div class="content">
        <div class="head">
            <router-link to="/orderAfterSale">
                <div class="mar-right-10">售后订单</div>
            </router-link>
            <div class='arrow'></div>
            <div class="mar-right-10" v-if="state==='2'">售后详情</div>
            <div class="mar-right-10" v-if="state==='1'">申请售后</div>
        </div>
        <div class="orderTitle">
            <p class="fs16 fw-blod" v-if="state==='2'">售后编号:{{orderData.afterFormid}}</p>
            <p class="fs16 fw-blod" v-if="state==='1'">订单号:{{orderData.orderFormid}}</p>
        </div>
        <div class="status">
            <div class="top">
                <div class="state text-align">
                    <p class="fs30 fw-blod" v-if="state==='1'">申请售后</p>
                    <p class="fs24 fw-blod" v-if="orderData.afterState===1">审核中</p>
                    <p class="fs24 fw-blod" v-if="orderData.afterState===2">退款中</p>
                    <p class="fs24 fw-blod" v-if="orderData.afterState===3">退货中</p>
                    <p class="fs24 fw-blod font-color-71B" v-if="orderData.afterState===4">退款成功</p>
                    <p class="fs24 fw-blod" v-if="orderData.afterState===5">退款失败<br><span class="font-color-999">(如有问题,请联系商家)</span></p>
                    <p class="fs24 fw-blod" v-if="orderData.afterState===6">审核不通过</p>
                    <p class="fs16 fw-blod" v-if="orderData.afterState===6">拒绝理由:{{orderData.reason}}</p>
                    <p class="fs24 fw-blod" v-if="orderData.afterState===7">评审中</p>
                    <p class="fs24 fw-blod font-color-999" v-if="orderData.afterState===8">退货完成,拒绝退款</p>
                    <p class="fs24 fw-blod font-color-999" v-if="orderData.afterState===9">已关闭</p>
                    <p class="fs24 fw-blod" v-if="orderData.afterState===10">审核通过</p>
                    <el-button plain
                      v-if="orderData.afterState===6 || orderData.afterState===8"
                      class="intervention mar-top-10"
                      @click="platform"
                    >申请平台介入</el-button>
                    <el-button plain
                      v-if="(orderData.afterState===1 && orderData.afterType===1)
                      || (orderData.afterState===6 && orderData.afterType===1)
                      || (orderData.afterState===10 && orderData.afterType===1)"
                      class="intervention mar-top-10"
                      @click="returnRefund"
                    >撤销申请</el-button>
                    <el-button plain
                      v-if="orderData.afterState===1 && orderData.afterType===2
                      || orderData.afterState===6 && orderData.afterType===2"
                      class="intervention mar-top-10"
                      @click="returnGoods"
                    >撤销退货</el-button>
                </div>
            </div>
            <div class="bottom">
                <AfterSaleState v-if="state==='1'" :state="''"></AfterSaleState>
                <AfterSaleState v-else :state="orderData.afterState"></AfterSaleState>
            </div>
        </div>
        <div class="desc">
            <div class="storeInfo">
                <p class="title">卖家信息</p>
                <div class="info">
                    <p>店铺名称:{{orderData.shopName}}</p>
                    <p>联系电话:{{orderData.chargePersonPhone || orderData.shopPhone}}</p>
                </div>
            </div>
            <div class="orderInfo">
                <p class="title">订单信息</p>
                <div class="info">
                    <p>订单号:{{orderData.orderFormid}}</p>
                    <p>支付渠道:{{orderData.paymentMode}}</p>
                    <p>交易号:{{orderData.transactionId}}</p>
                    <p>创建时间:{{orderData.createTime}}</p>
                    <p>付款时间:{{orderData.paymentTime}}</p>
                    <p v-if="orderData.receiveTime">成交时间:{{orderData.receiveTime}}</p>
                </div>
            </div>
            <div class="productInfo">
                <div class="top">
                    <p class="big"><span>宝贝</span></p>
                    <p>宝贝属性</p>
                    <p>状态</p>
                    <p>数量</p>
                    <p>单价</p>
                </div>
                <div class="bottom" v-for="(pro, idx) in orderData.skus" :key="idx">
                    <div class="big">
                        <img :src="pro.image" alt="">
                        <p>{{pro.productName}}</p>
                    </div>
                    <div style="flex-direction: column;">
                        <p v-for="(text, ins) in pro.values" :key="ins">{{text}}</p>
                    </div>
                    <div v-if="orderData.state==1 || orderData.orderState==1">待付款</div>
                    <div v-if="orderData.state==2 || orderData.orderState==2">待发货</div>
                    <div v-if="orderData.state==3 || orderData.orderState==3">待收货</div>
                    <div v-if="orderData.state==4 || orderData.orderState==4">已完成</div>
                    <div v-if="orderData.state==5 || orderData.orderState==5">已关闭</div>
                    <div>{{pro.number}}</div>
                    <div class="fs-bold" style="color: #C83732;">¥{{pro.price}}</div>
                </div>
            </div>
            <div class="returnPrice" v-if="orderData.afterState===4">
                <div>
                    <span class="mar-right-40">退款金额:</span>
                    <span style="color: #C83732;">¥{{orderData.price}}</span>
                </div>
            </div>
            <div class="apply" v-if="state==='1'">
                <div class="submitAS">
                    <div class="itemBox">
                        <div class="title">售后方式:</div>
                        <el-select
                        v-model="mode"
                        placeholder="请选择售后方式"
                        style="width:500px;"
                        >
                            <el-option
                            v-for="item in modes"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="itemBox">
                        <div class="title">货物状态:</div>
                        <el-select
                        v-model="goodsState"
                        placeholder="请选择货物状态"
                        style="width:500px;"
                        >
                            <el-option
                            v-for="item in goodsStatus"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="itemBox">
                        <div class="title">售后理由:</div>
                        <el-select
                        v-model="reason"
                        placeholder="请选择售后理由"
                        style="width:500px;"
                        >
                            <el-option
                            v-for="item in reasons"
                            :key="item"
                            :label="item"
                            :value="item">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="itemBox reason">
                        <div class="title">原因描述:</div>
                        <el-input
                            type="textarea"
                            :rows="6"
                            placeholder="输入申请退货原因描述"
                            v-model="textarea"
                            style="width:500px;">
                        </el-input>
                    </div>
                    <div class="itemBox upload">
                        <div class="title">上传凭证:</div>
                        <el-upload
                            :action="action"
                            list-type="picture-card"
                            :limit="3"
                            :on-success="handleSuccess"
                            :on-remove="handleRemove">
                            <i class="el-icon-camera"></i>
                            <span
                            style="
                                display: block;
                                height: 0px;
                                line-height: 0px;
                                margin-top: -30px;
                            ">最多上传3张</span>
                        </el-upload>
                    </div>
                    <div class="submit">
                        <el-button plain @click="submit" v-throttle>提交申请</el-button>
                    </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</template>
<script>
import AfterSaleState from '@/components/base/afterSaleState'
import {
  upload
} from '@/api/upload.js'
import {
  getOrderDetail
} from '@/api/user/order.js'
import {
  submitAfter,
  getAfterSaleDetail,
  returnRefund,
  returnGoods,
  getReasons,
    requestPlatform
} from '@/api/user/afterSale.js'
export default {
  components: {
    AfterSaleState
  },
  data () {
    return {
      state: 0,
      orderData: {},
      modes: [{
        value: 1,
        label: '仅退款'
      }, {
        value: 2,
        label: '退货退款'
      }],
      reasons: [],
      goodsStatus: [{
        value: 1,
        label: '已收到货'
      }, {
        value: 0,
        label: '未收到货'
      }],
      exp: '',
      mode: '',
      reason: '',
      goodsState: '',
      textarea: '',
      textarea1: '',
      text: '',
      dialogImageUrl: '',
      dialogVisible: false,
      disabled: false,
      skus: [],
      productPrice: 0,
      urls: [],
      orderId: '',
      afterId: '',
      afterSaleDetail: {},
      action: upload,
      image: []
    }
  },
  created () {
    this.state = this.$route.query.state
    if (this.$route.query.state === '2') {
      this.orderId = this.$route.query.orderId
      this.afterId = this.$route.query.afterId
    }
  },
  mounted () {
      if (this.state === '1') {
          this.getReasonSelect()
          this.getOrderDetail()
      } else if (this.state === '2' || this.state === '3') {
          this.getASDetail()
          // this.getExpressSelect()
      }
  },
  methods: {
      // 获取订单详情
      async getOrderDetail () {
        const rLoading = this.openLoading()
        const response = await getOrderDetail({
          orderId: JSON.parse(this.$route.query.orderData).orderId
        })
        const res = response.data
        if (res.code === '200') {
          this.orderData = res.data
          this.orderData.skus = JSON.parse(this.$route.query.orderData).skus
        } else {
          this.$message.warning(res.message)
        }
        rLoading.close()
      },
      // 获取售后订单详情
      async getASDetail () {
        const rLoading = this.openLoading()
        const response = await getAfterSaleDetail({
          afterId: this.afterId,
          orderId: this.orderId
        })
        const res = response.data
        if (res.code === '200') {
          this.orderData = res.data
          this.image = res.data.image.split(',')
        } else {
          this.$message.warning(res.message)
        }
        rLoading.close()
      },
      // 撤销申请
      async returnRefund () {
        const response = await returnRefund({
            afterId: this.orderData.afterId,
            orderId: this.orderData.orderId
        })
        const res = response.data
        if (res.code === '200') {
          this.$message.success('撤销申请成功')
          this.getASDetail()
        } else {
          this.$message.warning(res.message)
        }
      },
      // 撤销退货
      async returnGoods () {
        const response = await returnGoods({
          afterId: this.orderData.afterId,
          orderId: this.orderData.orderId
        })
        const res = response.data
        if (res.code === '200') {
            this.$message.success('撤销退货成功')
            this.getASDetail()
        } else {
          this.$message.warning(res.message)
        }
      },
      // 申请平台介入
      async platform () {
        const response = await requestPlatform({
            afterId: this.orderData.afterId,
            orderId: this.orderData.orderId,
            image: '',
            reason: ''
        })
        const res = response.data
        if (res.code === '200') {
            this.$message.success('申请平台介入成功')
            this.getASDetail()
        } else {
          this.$message(res.message)
        }
      },
      // 选择退款原因查询
      async getReasonSelect () {
        const response = await getReasons()
        const res = response.data
        if (res.code === '200') {
          this.reasons = res.data
        } else {
          this.$message.warning(res.message)
        }
      },
      // 申请售后
      async submit () {
        let errMsg = ''
        if (this.mode === '') {
          errMsg += ' 请选择售后方式 '
        }
        if (this.goodsState === '') {
          errMsg += ' 请选择货物状态 '
        }
        if (this.reason === '') {
          errMsg += ' 请选择售后理由 '
        }
        if (errMsg.length !== 0) {
          this.$message.warning(errMsg)
          return
        }
        this.productPrice = 0
        for (var i in this.orderData.skus) {
            this.skus[i] = {
              number: this.orderData.skus[i].number,
              skuId: this.orderData.skus[i].skuId
            }
            this.productPrice += this.orderData.skus[i].actualPrice
            if (parseInt(this.goodsState) === 0) {
              this.productPrice += this.orderData.skus[i].logisticsPrice
            }
        }
        const response = await submitAfter({
          afterType: this.mode,
          explain: this.textarea,
          goodsState: this.goodsState,
          image: this.urls.join(','),
          orderId: this.orderData.orderId,
          price: this.productPrice.toFixed(2),
          returnReason: this.reason,
          isAllSelect: 1,
          skus: this.skus
        })
        const res = response.data
        if (res.code === '200') {
          this.$message.success({
            message: '售后申请成功',
            type: 'success'
          })
          setTimeout(() => {
              this.$router.push('/orderAfterSale')
          }, 1000)
        } else {
          this.$message.warning(res.message)
        }
      },
      handleSuccess (res) {
          this.urls.push(res.data.url)
      },
      handleRemove (file, fileList) {
        this.urls = []
        for (var i in fileList) {
          this.urls.push(fileList[i].response.data.url)
        }
      }
  }
}
</script>
<style lang="scss">
.orderDetail{
  width: 100%;
  .content{
    width: 1250px;
    margin: 0 auto;
    .head {
      width: 100%;
      height: 50px;
      line-height: 50px;
      font-size: 16px;
      display: flex;
      align-items: center;
      .arrow {
        background-image: url('../../../static/image/xiangyou@2x.png');
        width: 5px;
        height: 10px;
        margin-right: 10px;
      }
    }
    .orderTitle{
      width: 100%;
      max-width: 1250px;
      height: 80px;
      margin: 20px 0;
      padding: 0 30px;
      font-size: 16px;
      font-family: Microsoft YaHei;
      color: #333333;
      background: #FAFAFA;
      display: flex;
      align-items: center;
    }
    .status{
      width: 100%;
      height: 325px;
      border: 1px solid #E5E5E5;
      box-sizing: border-box;
      padding: 15px;
      display: flex;
      flex-direction: column;
      margin-bottom: 20px;
      .top{
        flex: 1;
        display: flex;
        align-items: center;
        flex-direction: column;
        position: relative;
        color: $mainGlod;
        .state{
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%,-50%);
        }
        .cancel{
          width: 100px;
        }
        .intervention{
          border-color: $mainGlod;
          color: $mainGlod;
          margin-left: 0;
        }
        .intervention:hover{
          background-color: rgba($color: $mainGlod, $alpha: 0.3);
        }
        .box{
          display: flex;
          flex-direction: column;
          justify-content: center;
        }
      }
      .bottom{
        flex: 3;
        // padding: 20px;
        box-sizing: border-box;
      }
    }
    .desc{
      width: 100%;
      border: 1px solid #E5E5E5;
      margin-bottom: 140px;
      .storeInfo,.orderInfo{
        padding: 25px;
        border-bottom: 1px solid #E5E5E5;
        .title{
          font-size: 16px;
          margin-bottom: 25px;
        }
        .info{
          display: flex;
          margin-left: 75px;
          flex-wrap: wrap;
          p{
            line-height: 30px;
            width: 50%;
            font-size: 14px;
            margin-bottom: 10px;
          }
          .long{
            width: 100%;
          }
          .pic{
            margin-top: 10px;
            width: 100%;
            font-size: 14px;
            span{
              vertical-align: top;
              margin-right: 10px;
            }
            .el-image{
              img{
                margin-right: 10px;
              }
            }
          }
        }
      }
      .orderInfo{
        .info{
          p{
            width: 33.33%;
          }
        }
      }
      .productInfo{
        width: 100%;
        .top{
          height: 40px;
          width: 100%;
          color: #FFF;
          background-color: #333;
          display: flex;
          align-items: center;
          text-align: center;
          p{
            flex: 1;
            font-size: 12px;
          }
          .big{
            flex: 2;
            text-align: left;
            span{
              margin-left: 20px;
            }
          }
        }
        .bottom{
          width: 100%;
          padding: 20px 0;
          box-sizing: border-box;
          text-align: center;
          display: flex;
          border-bottom: 1px solid #E5E5E5;
          div{
            flex: 1;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            p{
              font-size: 14px;
              line-height: 20px;
            }
          }
          .big{
            text-align: left;
            flex: 2;
            display: flex;
            box-sizing: border-box;
            justify-content: flex-start;
            align-items: center;
            img{
              width: 80px;
              height: 80px;
              margin: 0 20px;
            }
            p{
              width: 50%;
            }
          }
        }
      }
      .settlement{
        width: 100%;
        display: flex;
        padding: 25px;
        box-sizing: border-box;
        justify-content: flex-end;
        .box{
          display: flex;
          .left{
            text-align: right;
            p{
              width: 250px;
              display: flex;
              justify-content: space-between;
              font-size: 20px;
              color: #666666;
              line-height: 30px;
            }
            .right{
              text-align: right;
              margin-left: 40px;
            }
          }
        }
      }
      .returnPrice{
        width: 100%;
        padding: 50px 50px;
        font-size: 20px;
        box-sizing: border-box;
        text-align: right;
        border-bottom: 1px solid #E5E5E5;
      }
      .apply{
        width: 100%;
        padding: 25px;
        box-sizing: border-box;
        .submitAS{
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          position: relative;
          .itemBox{
            width: 580px;
            display: flex;
            margin: 10px;
            .title{
              min-width: 80px;
              line-height: 40px;
              text-align: right;
            }
            >>> .el-input__icon{
              color: $mainGlod;
            }
          }
          .reason{
            position: relative;
          }
          .upload{
            display: flex;
            .title{
              line-height: 40px;
            }
            >>> .el-upload--picture-card{
              height: 140px;
              background-color: #FFF;
              display: flex;
              flex-direction: column;
              justify-content: center;
              align-items: center;
              i{
                font-size: 32px;
              }
              &:hover{
                i{
                color: $mainGlod;
                }
              }
            }
          }
          .submit{
            margin: 30px 0;
            .el-button{
            width: 200px;
            height: 50px;
            color: #FFF;
            background-color: #333333;
            border-radius: 0px;
            }
          }
          >>> .el-select-dropdown__item{
            &:hover{
              background: $mainGlod;
            }
          }
        }
      }
    }
  }
}
</style>