<template>
  <!-- 订单详情 -->
  <div class="order-detail wrapper_1200">
    <div class="header bag-f">
      <nuxt-link to="/">首页></nuxt-link>
      <nuxt-link :to="{ path: '/user', query: { type: 0 } }">个人中心></nuxt-link>
      <span>订单详情</span>
    </div>
    <div class="section process bag-f" v-if="orderData._status._type >= 0">
      <div
        class="section-hd"
        v-if="orderData._status._type === 0 || orderData._status._type === 9"
      >订单状态：待付款</div>
      <div class="section-hd" v-if="orderData._status._type === 1">订单状态：待发货</div>
      <div class="section-hd" v-if="orderData._status._type === 2">订单状态：待收货</div>
      <div class="section-hd" v-if="orderData._status._type === 3">订单状态：待评价</div>
      <div class="section-hd" v-if="orderData._status._type === 4">订单状态：已完成</div>
      <div class="section-hd" v-if="orderData._status._type === 5">订单状态：待核销</div>
      <div class="section-bd">
        <ul class>
          <li
            :class="{
              past:
                orderData._status._type > 0 && orderData._status._type !=9,
              now:
                orderData._status._type === 0 || orderData._status._type === 9,
            }"
          >
            <div class="line"></div>
            <div class="iconfont icon-xuanzhong11"></div>
            <div class="iconfont icon-fukuan">
              <div class="arrow"></div>
            </div>
            <div class="info">
              <div>待付款</div>
              <div>{{ orderData.order_log.create }}</div>
            </div>
          </li>
          <li
            v-if="orderData.shipping_type!=4"
            :class="{
              past:
                orderData._status._type > 1 && orderData._status._type !=9 && orderData._status._type !=5,
              now:
                orderData._status._type === 1 || orderData._status._type === 5,
            }"
          >
            <div class="line"></div>
            <div
              :class="[
                'iconfont',
                orderData._status._type > 0 && orderData._status._type !=9
                  ? 'icon-xuanzhong11'
                  : 'icon-weixuan',
              ]"
            ></div>
            <div class="iconfont icon-peihuo">
              <div class="arrow"></div>
            </div>
            <div class="info">
              <div>{{(orderData.shipping_type==1 || orderData.shipping_type==3) ? '待发货':'待核销'}}</div>
              <div>{{ orderData.order_log.pay }}</div>
            </div>
          </li>
          <li
            v-if="orderData.shipping_type === 1 || orderData.shipping_type === 3"
            :class="{
              past:
                orderData._status._type > 2 && orderData._status._type !=9 && orderData._status._type !==5,
              now:
                orderData._status._type === 2,
            }"
          >
            <div class="line"></div>
            <div
              :class="[
                'iconfont',
                orderData._status._type > 1 && orderData._status._type !==9 && orderData._status._type !==5
                  ? 'icon-xuanzhong11'
                  : 'icon-weixuan',
              ]"
            ></div>
            <div class="iconfont icon-fahuo">
              <div class="arrow"></div>
            </div>
            <div class="info">
              <div>待收货</div>
              <div>{{ orderData.order_log.delivery }}</div>
            </div>
          </li>
          <li
            :class="{
              past:
                orderData._status._type > 3 && orderData._status._type !==9 && orderData._status._type !==5,
              now:
                orderData._status._type === 3,
            }"
          >
            <div class="line"></div>
            <div
              :class="[
                'iconfont',
                orderData._status._type > 2 && orderData._status._type !==9 && orderData._status._type !==5
                  ? 'icon-xuanzhong11'
                  : 'icon-weixuan',
              ]"
            ></div>
            <div class="iconfont icon-pingjia1">
              <div class="arrow"></div>
            </div>
            <div class="info">
              <div>待评价</div>
              <div>{{ orderData.order_log.take }}</div>
            </div>
          </li>
          <li
            :class="{
              past:
                orderData._status._type > 4 && orderData._status._type !==9 && orderData._status._type !==5,
              now:
                orderData._status._type === 4,
            }"
          >
            <div
              :class="[
                'iconfont',
                orderData._status._type > 3 && orderData._status._type !==9 && orderData._status._type !==5
                  ? 'icon-xuanzhong11'
                  : 'icon-weixuan',
              ]"
            ></div>
            <div class="iconfont icon-wancheng"></div>
            <div class="info">
              <div>已完成</div>
              <div>{{ orderData.order_log.complete }}</div>
            </div>
          </li>
        </ul>
      </div>
    </div>
    <div v-if="orderData.refund_status != 0" class="section reject bag-f">
      <div
        class="iconfont icon-shenqingzhong"
        v-if="orderData.refund_type==1 ||orderData.refund_type==2"
      ></div>
      <div class="iconfont icon-yijujue" v-if="orderData.refund_type==3"></div>
      <div class="iconfont icon-daituihuo1" v-if="orderData.refund_type==4"></div>
      <div class="iconfont icon-tuikuanzhong" v-if="orderData.refund_type==5"></div>
      <div class="iconfont icon-yituikuan" v-if="orderData.refund_type==6"></div>
      <div class="section-hd">{{ orderData._status._msg }}</div>
      <div class="section-bd">
        <ul>
          <li class="acea-row row-middle">
            <!--            {{orderData.refund_type>2?'时间':'申请时间'}}：-->
            {{ orderData.add_time_y
            }}
            <span class="time">{{ orderData.add_time_h }}</span>
          </li>
        </ul>
      </div>
    </div>
    <div class="section bag-f" v-if="[4,5].includes(orderData.refund_type)">
      <div class="section-hd">
        <div class="refund-msg-user">
          <span class="name">{{orderData._status.refund_name}}</span>
          <span>{{orderData._status.refund_phone}}</span>
          <span class="refund-tip">
            <span class="iconfont icon-zhuyi-copy"></span>请按以上退货信息将商品退回
          </span>
        </div>
        <div class="refund-address">{{orderData._status.refund_address}}</div>
      </div>
      <div class="lines">
        <img src="../assets/images/line.png" />
      </div>
    </div>
    <div
      v-if="orderData.refund_status != 0 && orderData.refund_type==3"
      class="section reason bag-f"
    >
      <div class="section-hd">
        <span class="iconfont icon-tuikuantishi"></span>商家拒绝退款
      </div>
      <div class="section-bd">
        <ul>
          <li class="acea-row">
            <div>拒绝原因：</div>
            <div>{{ orderData.refuse_reason }}</div>
          </li>
        </ul>
      </div>
    </div>
    <div class="section bag-f">
      <div class="section-hd">订单信息</div>
      <div class="section-bd">
        <ul>
          <li class="acea-row row-middle">
            <div>订单编号：</div>
            <div>{{ orderData.order_id }}</div>
          </li>
          <li class="acea-row row-middle">
            <div>订单日期：</div>
            <div>{{ orderData.add_time_y }}</div>
          </li>
          <li class="acea-row row-middle">
            <div>支付状态：</div>
            <div>{{ orderData.paid === 0 ? "未支付" : "已支付" }}</div>
          </li>
          <li class="acea-row row-middle">
            <div>支付方式：</div>
            <div>{{ orderData._status._payType }}</div>
          </li>
          <li v-if="orderData.mark" class="acea-row">
            <div>买家留言：</div>
            <div>{{ orderData.mark }}</div>
          </li>
          <li class="acea-row row-middle">
            <div>订单金额：</div>
            <div class="money">￥{{ orderData.pay_price }}</div>
          </li>
        </ul>
      </div>
    </div>
    <!-- 自定义留言 -->
    <div
      class="section bag-f"
      v-if="orderData.custom_form && orderData.custom_form.length && isShow"
    >
      <div class="section-hd">留言信息</div>
      <div class="section-bd">
        <ul>
          <li
            class="acea-row"
            v-for="(item,index) in orderData.custom_form"
            :key="index"
            v-if="item.value"
          >
            <div class="customForm line1">{{item.title}}：</div>
            <div v-if="item.label == 'img'" class="acea-row">
              <div v-for="(img,index) in item.value" :key="index" class="pictrue">
                <img :src="img" />
              </div>
            </div>
            <div v-else>{{ item.value }}</div>
          </li>
        </ul>
      </div>
    </div>
    <div class="section bag-f" v-if="orderData.product_type==0">
      <div class="section-hd">收货信息</div>
      <div class="section-bd">
        <ul>
          <li class="acea-row row-middle">
            <div>收货人：</div>
            <div>{{ orderData.real_name }}</div>
          </li>
          <li class="acea-row row-middle">
            <div>联系电话：</div>
            <div>{{ orderData.user_phone }}</div>
          </li>
          <li class="acea-row">
            <div>收货地址：</div>
            <div>{{ orderData.user_address }}</div>
          </li>
        </ul>
      </div>
    </div>
    <div
      v-if="orderData._status._type > 1 && orderData._status._type < 4"
      class="section order-number bag-f"
    >
      <div class="section-bd" v-if="orderData.delivery_type === 'express'">
        <ul>
          <li class="acea-row row-middle">
            <div>快递单号：</div>
            <div>{{ orderData.delivery_id }}</div>
            <nuxt-link
              :to="{
                path: '/logistics',
                query: { orderId: orderData.order_id },
              }"
            >
              查看物流
              <span class="iconfont icon-you-miaosha"></span>
            </nuxt-link>
          </li>
        </ul>
      </div>
      <div class="section-bd" v-else-if="orderData.delivery_type === 'send'">
        <ul>
          <li class="acea-row row-middle">
            <div>配送方式：</div>
            <div>送货</div>
          </li>
          <li class="acea-row row-middle">
            <div>配送人：</div>
            <div>{{ orderData.delivery_name || "" }}</div>
          </li>
          <li class="acea-row">
            <div>联系电话：</div>
            <div>{{ orderData.delivery_id || "" }}</div>
          </li>
        </ul>
      </div>
      <div
        class="section-bd"
        v-else-if="orderData.delivery_type === 'fictitious' && orderData.product_type!=1"
      >
        <ul>
          <li class="acea-row row-middle">
            <div>虚拟发货：</div>
            <div>已发货，请注意查收</div>
          </li>
          <li class="acea-row row-middle" v-if="orderData.fictitious_content">
            <div>虚拟备注：</div>
            <div>{{orderData.fictitious_content}}</div>
          </li>
        </ul>
      </div>
      <div class="section-bd" v-if="orderData.virtual_info && orderData.product_type==1">
        <ul>
          <li class="acea-row row-middle">
            <div>卡密发货：</div>
            <div>{{orderData.virtual_info}}</div>
          </li>
        </ul>
      </div>
    </div>
    <div class="section bag-f" v-for="(sp, index) in orderData.split" :key="index">
      <div class="section-hd">包裹信息{{ index + 1 }}</div>
      <div class="section-bd">
        <ul class="goods">
          <li v-for="(item, indexs) in sp.cartInfo" :key="indexs" class="acea-row row-middle">
            <div>
              <img :src="item.productInfo.attrInfo.image || item.productInfo.image" />
            </div>
            <div>
              <div>{{ item.productInfo.store_name }}</div>
              <div class="info" v-if="item.productInfo.attrInfo">
                {{ item.productInfo.attrInfo.suk }}
                <span class="cart-num">x{{ item.cart_num }}</span>
              </div>
              <div>
                <span class="money">
                  ￥{{
                  item.productInfo.attrInfo
                  ? item.productInfo.attrInfo.price
                  : item.productInfo.price
                  }}
                </span>
                <del>
                  ￥{{
                  item.productInfo.attrInfo
                  ? item.productInfo.attrInfo.ot_price
                  : item.productInfo.ot_price
                  }}
                </del>
              </div>
            </div>
            <!-- 拆单 -->
            <div class="split_btn">
              <el-button
                type="info"
                size="mini"
                v-if="orderData._status._type === 3 && item.is_reply"
              >已评价</el-button>
              <el-button
                type="primary"
                size="mini"
                v-else-if="orderData._status._type === 3 && !item.is_reply"
                @click="goEvaluate(item)"
              >评价</el-button>
              <el-button
                v-if="
                  indexs === sp.cartInfo.length - 1 && sp.refund_status === 0
                "
                type="primary"
                size="mini"
                @click.stop="jumpPath(1, sp.order_id)"
              >申请退货</el-button>
              <el-button
                v-if="sp.delivery_type === 'express' && sp._status._type === 2"
                type="primary"
                size="mini"
                @click.stop="jumpPath(2, sp.order_id)"
              >查看物流</el-button>
              <el-button
                v-if="sp._status._type === 2"
                type="primary"
                size="mini"
                @click.stop="confirmOrder(sp.order_id)"
              >确认收货</el-button>
              <el-button type="primary" size="mini" @click.stop="jumpCon(sp.order_id)">查看子订单</el-button>
              <el-button
                type="primary"
                v-if="sp.refund_type == 4"
                size="mini"
                @click.stop="refundInput(sp.id)"
              >填写退货物流</el-button>
            </div>
            <div
              v-if="sp._status._type < 0"
              class="iconfont"
              :class="
                sp._status._type === -1 ? 'icon-tuikuanzhong' : 'icon-yituikuan'
              "
            ></div>
          </li>
        </ul>
      </div>
    </div>
    <div class="section bag-f">
      <div class="section-hd" v-if="orderData.cartInfo.length">商品信息</div>
      <div class="section-bd">
        <ul class="goods" v-if="orderData.cartInfo.length">
          <li
            v-for="item in cartObj"
            :key="item.product_id"
            class="acea-row row-middle"
            @click.stop="goDetail(item.product_id)"
          >
            <div>
              <img :src="item.productInfo.attrInfo.image || item.productInfo.image" />
            </div>
            <div class="txtCon">
              <div class="name">{{ item.productInfo.store_name }}</div>
              <div class="info" v-if="item.productInfo.attrInfo">{{ item.productInfo.attrInfo.suk }}</div>
              <div class="acea-row row-middle">
                <span class="money">
                  ￥{{
                  item.productInfo.attrInfo
                  ? item.productInfo.attrInfo.price
                  : item.productInfo.price
                  }}
                </span>
                <div class="posBnt acea-row row-middle">
                  <div
                    class="writeOff"
                    v-if="[1,2,3,5].includes(orderData._status._type) && (orderData.shipping_type === 2 || orderData.delivery_type === 'send')"
                  >
                    <span class="on" v-if="item.is_writeoff">已核销</span>
                    <span
                      class="on"
                      v-if="!item.is_writeoff && item.surplus_num<item.cart_num"
                    >已核销{{parseInt(item.cart_num)-parseInt(item.surplus_num)}}件</span>
                    <span
                      v-if="!item.is_writeoff && parseInt(item.surplus_num) === parseInt(item.cart_num)"
                    >未核销</span>
                  </div>
                  <span
                    class="refund"
                    v-if="item.refund_num && orderData._status._type !== -2"
                  >{{item.refund_num}}件退款中</span>
                </div>
                <!--                <del-->
                <!--              >￥{{-->
                <!--                item.productInfo.attrInfo-->
                <!--                ? item.productInfo.attrInfo.ot_price-->
                <!--                : item.productInfo.ot_price-->
                <!--                }}</del-->
                <!--              >-->
              </div>
              <span class="cart-num">x{{ item.cart_num }}</span>
            </div>
            <div class="evaluate_btn">
              <el-button
                size="mini"
                v-if="orderData.refund_status === 0 && item.refund_num !==item.cart_num && orderData.paid && item.is_support_refund"
                @click.stop="openRefund(item)"
              >申请退款</el-button>
              <el-button
                type="info"
                size="mini"
                v-if="orderData._status._type === 3 && item.is_reply === 1"
              >已评价</el-button>
              <el-button
                type="primary"
                size="mini"
                v-if="orderData._status._type === 3 && item.is_reply === 0"
                @click.stop="goEvaluate(item)"
              >评价</el-button>
            </div>
            <!-- 主单 -->
            <!--<div class="split_btn">-->
            <!--<el-button-->
            <!--v-if="orderData.cartInfo.length > 1"-->
            <!--type="primary"-->
            <!--size="mini"-->
            <!--@click.stop="jumpPath(1, orderData.order_id, item.id)"-->
            <!--&gt;申请退货</el-button-->
            <!--&gt;-->
            <!--<el-button-->
            <!--v-if="item.delivery_type === 'express'"-->
            <!--type="primary"-->
            <!--size="mini"-->
            <!--@click.stop="jumpPath(0, orderData.order_id)"-->
            <!--&gt;查看物流</el-button-->
            <!--&gt;-->
            <!--&lt;!&ndash; <el-button-->
            <!--type="primary"-->
            <!--size="mini"-->
            <!--@click="confirmOrder(item.orderId)"-->
            <!--&gt;确认收货</el-button-->
            <!--&gt; &ndash;&gt;-->
            <!--</div>-->
          </li>
        </ul>
        <div class="giveGoods acea-row">
          <div class="item acea-row row-middle" v-for="(item,index) in giftObj" :key="index">
            <div class="pictrue">
              <img :src="item.productInfo.attrInfo.image" />
            </div>
            <div class="text line2">
              <span class="lable">赠品</span>
              {{item.productInfo.store_name}}
            </div>
          </div>
          <div
            class="item acea-row row-middle"
            v-for="(item,index) in orderData.give_coupon"
            :key="index"
            v-if="orderData.give_coupon.length"
          >
            <div class="pictrue">
              <img src="../assets/images/coupon.png" />
            </div>
            <div class="text line2">
              <span class="lable">赠品</span>
              {{item.coupon_title}}
            </div>
          </div>
          <div class="item acea-row row-middle" v-if="orderData.give_integral>0">
            <div class="pictrue">
              <img src="../assets/images/integral.png" />
            </div>
            <div class="text line2">
              <span class="lable">赠品</span>
              {{orderData.give_integral}}积分
            </div>
          </div>
        </div>
        <ul
          v-if="orderData.pay_postage > 0 || orderData.vip_true_price != '0.00' || orderData.coupon_id || parseFloat(orderData.deduction_price) > 0"
        >
          <li class="acea-row row-middle coupon" v-if="orderData.pay_postage > 0">
            <div>运费：</div>
            <div>￥{{parseFloat(orderData.pay_postage).toFixed(2)}}</div>
          </li>
          <li class="acea-row row-middle coupon" v-if="orderData.vip_true_price != '0.00'">
            <div>会员折扣：</div>
            <div>-￥{{ orderData.vip_true_price }}</div>
          </li>
          <li v-if="orderData.coupon_id" class="acea-row row-middle coupon">
            <div>优惠券抵扣：</div>
            <div>
              <span>-￥{{ orderData.coupon_price }}</span>
            </div>
          </li>
          <li class="acea-row row-middle coupon" v-if="parseFloat(orderData.deduction_price) > 0">
            <div>积分抵扣：</div>
            <div>-￥{{ orderData.deduction_price }}</div>
          </li>
          <li
            class="acea-row row-middle coupon"
            v-for="(item,index) in orderData.promotions_detail"
            :key="index"
            v-if="parseFloat(item.promotions_price)"
          >
            <div>{{item.title}}：</div>
            <div>-￥{{parseFloat(item.promotions_price).toFixed(2)}}</div>
          </li>
        </ul>
        <ul class="total">
          <li class="acea-row row-middle row-between">
            <div>
              共{{ goodsNum }}件商品，订单总金额为：
              <span class="money">
                ￥
                <b>{{ orderData.pay_price }}</b>
              </span>
            </div>
            <div class="footerState acea-row row-middle">
              <nuxt-link
                :to="{
                  path: '/refund',
                  query: { orderId: orderData.order_id,id: orderData.id},
                }"
                v-if="
                  orderData.is_apply_refund && orderData.refund_status === 0 && cartObj.length>1
                "
                class="orderBnt"
              >批量退款</nuxt-link>
              <div
                class="orderBnt"
                v-if="orderData._status._type === 0 || orderData._status._type === 9"
                @click.stop="cancelOrder"
              >取消订单</div>
              <div
                class="orderBnt"
                v-if="orderData._status._type === 4 && !orderData.split.length || orderData._status._type === -2"
                @click="delOrder"
              >删除订单</div>

              <div
                class="orderBnt"
                v-if="[1,2,4].includes(orderData.refund_type) && !orderData.is_cancel"
                @click="cancelRefundOrder"
              >取消申请</div>
              <div
                class="orderBnt"
                :class="(orderData._status._type === 1 || [1,2,6].includes(orderData.refund_type))?'on':''"
                @click="chatShow"
              >联系客服</div>
              <div
                class="orderBnt"
                :class="{
                  on: orderData.paid === 0,
                }"
                v-if="orderData.paid === 0"
                @click="goPay"
              >立即付款</div>
              <div
                class="orderBnt"
                :class="{
                  on: orderData._status._type === 2,
                }"
                v-if="orderData._status._type === 2 && !orderData.split.length"
                @click="confirmOrder(orderData.order_id)"
              >确认收货</div>
              <div
                class="orderBnt on"
                v-if="
                  orderData._status._type === 3 || orderData._status._type === 4
                "
                @click="goOrderConfirm"
              >再次购买</div>
              <div
                class="orderBnt on"
                v-if="orderData.refund_type == 4"
                @click.stop="refundInput(orderData.order_id)"
              >填写退货信息</div>
              <nuxt-link
                class="orderBnt on"
                v-if="orderData.refund_type == 5"
                :to="{
                path: '/logistics',
                query: { orderId: orderData.order_id,type:'refund' },
              }"
              >查看退货物流</nuxt-link>
            </div>
          </li>
        </ul>
      </div>
    </div>
    <chat-room
      v-show="chatOptions.show"
      :chat-options="chatOptions"
      @chat-close="chatClose"
      @socket-open="socketOpen"
      @socket-error="socketError"
    ></chat-room>
    <el-dialog title="退货物流单号" :visible.sync="refund_close" width="30%">
      <el-input v-model="express_num" placeholder="请输入单号"></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button @click="refund_close = false">取 消</el-button>
        <el-button type="primary" @click="refundSubmit">提 交</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>

import ChatRoom from "@/components/ChatRoom";
import appChat from "@/mixins/appChat";
export default {
  auth: "guest",
  components: { ChatRoom },
  mixins: [appChat],
  data() {
    return {
      isShow: 0,
      orderData: {},
      goodsNum: 0,
      refund_close: false,
      express_num: "",
      refund_id: 0,
      orderId: 0,
      isReturen: "",
      cartObj: [],
      giftObj: []
    };
  },
  // async asyncData({ app, query }) {
  //   const { data } = await app.$axios.get(`${query.isReturen?'/order/refund/detail/':'/order/detail/'}${query.orderId}`).catch((err)=>{
  //     Message.error(err);
  //     if(query.isReturen){
  //      return app.router.replace({
  //         path: "/user/refundList",
  //         query: { type: 2 },
  //       });
  //     }else {
  //       return app.router.replace({
  //         path: "/user/orderList",
  //         query: { types: 1 },
  //       });
  //     }
  //   });
  //   return {
  //     orderData: data,
  //     orderId: query.orderId,
  //     isReturen: query.isReturen
  //   };
  // },
  fetch({ store }) {
    store.commit("isHeader", true);
    store.commit("isFooter", true);
  },
  head() {
    return {
      title: "订单详情-" + this.$store.state.titleCon
    };
  },
  // created() {
  //   let that = this,cartObj = [],giftObj = [],num = 0;
  //   that.orderData.cartInfo.forEach((item, index) => {
  //     num += item.cart_num;
  // 		if(item.is_gift == 1){
  // 			giftObj.push(item)
  // 		}else{
  // 			cartObj.push(item)
  // 		}
  //   });
  // 	that.giftObj = giftObj;
  // 	that.cartObj = cartObj;
  //   that.goodsNum = that.orderData.total_num;
  // 	if(that.orderData.custom_form && that.orderData.custom_form.length){
  // 		that.orderData.custom_form.forEach((item)=>{
  // 			if(item.value){
  // 				return this.isShow = 1
  // 			}
  // 		})
  // 	}
  //   // that.goodsNum = num;
  // },
  watchQuery: ["orderId"],
  methods: {
    goDetail: function(id) {
      this.$router.push({ path: `/goods_detail/${id}` });
    },
    cancelRefundOrder() {
      let that = this;
      this.$confirm("您确认放弃此次申请吗？", "提示").then(res => {
        that.$axios
          .post(`/order/refund/cancel/${that.orderData.order_id}`)
          .then(data => {
            this.$message.success("操作成功");
            that.$router.replace({
              path: "/user/refundList",
              query: { type: 2 }
            });
          })
          .catch(err => {
            this.$message.error(err.msg);
          });
      });
    },
    // 获取订单信息
    getOrderInfo() {
      this.$axios
        .get(
          `${this.isReturen ? "/order/refund/detail/" : "/order/detail/"}${
            this.orderData.order_id
          }`
        )
        .then(res => {
          this.orderData = res.data;
        })
        .catch(err => {
          this.$message.error(err.msg);
          if (this.isReturen) {
            this.$router.replace({
              path: "/user/refundList",
              query: { type: 2 }
            });
          } else {
            this.$router.replace({
              path: "/user/orderList",
              query: { types: 1 }
            });
          }
        });
    },
    //单个申请退款
    openRefund: function(item) {
      let data = {
        orderId: this.orderId,
        id: this.orderData.id,
        cartIds: item.id
      };
      this.$router.push({
        path: "/refund",
        query: data
      });
    },
    // 填写退货物流
    refundSubmit() {
      if (!this.express_num.trim()) {
        return this.$message.error("请输入物流单号");
      }
      this.$axios
        .post(`/order/refund/express`, {
          express_id: this.express_num,
          id: this.refund_id
        })
        .then(res => {
          this.$message.success(res.msg);
          this.refund_close = false;
        })
        .catch(err => {
          this.$message.error(err.msg);
          this.refund_close = false;
        });
    },
    jumpCon(orderId) {
      this.$router.push({
        path: "/order_detail",
        query: { orderId }
      });
    },
    // 取消订单
    cancelOrder() {
      let that = this;
      this.$confirm("确定取消该订单吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(res => {
        that.$axios
          .post("/order/cancel", {
            id: that.orderData.order_id
          })
          .then(data => {
            this.$message.success(data.msg);
            that.$router.replace({
              path: "/user/orderList",
              query: { types: 1 }
            });
          });
      });
    },
    //去支付
    goPay() {
      this.$router.push({
        path: "/payment",
        query: { result: this.orderData.order_id }
      });
    },
    //确认收货
    confirmOrder(id) {
      let that = this;
      this.$confirm("为保障权益，请收到货确认无误后，再确认收货", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(res => {
        that.$axios
          .post("/order/take", {
            uni: id
          })
          .then(data => {
            this.$message.success("操作成功");
            that.getOrderInfo();
          });
      });
    },
    //删除订单
    delOrder() {
      let that = this;
      this.$confirm("确定删除该订单吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(res => {
        if (that.isReturen) {
          that.$axios
            .get("/order/refund/del/" + that.orderData.order_id)
            .then(data => {
              this.$message.success("删除成功");
              that.$router.replace({
                path: "/user/refundList",
                query: { type: 2 }
              });
            });
        } else {
          that.$axios
            .post("/order/del", {
              uni: that.orderData.order_id
            })
            .then(data => {
              this.$message.success("删除成功");
              that.$router.replace({
                path: "/user/orderList",
                query: { types: 1 }
              });
            });
        }
      });
    },
    //  再次购买
    goOrderConfirm() {
      let that = this;
      that.$axios
        .post("/order/again", {
          uni: that.orderData.order_id
        })
        .then(res => {
          that.$router.replace({
            path: "/order_confirm",
            query: { new: 1, cartId: res.data.cateId }
          });
        })
        .catch(err => {
          that.$message.error(err);
        });
    },
    //  去评价
    goEvaluate(item) {
      this.$router.push({
        path: "/evaluation",
        query: {
          unique: item.unique
        }
      });
    },
    jumpPath(type, id, cartId) {
      //orderId: type == 1 ? this.orderData.order_id : id,
      this.$router.push({
        path: type == 1 ? "/refund" : "/logistics",
        query: {
          orderId: id,
          cart_id: cartId
        }
      });
    },
    refundInput(id) {
      this.$router.push({
        path: "/refund_goods",
        query: {
          orderId: id
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.giveGoods {
  border-top: 1px solid #efefef;
  padding-left: 22px;
  .item {
    height: 76px;
    margin-right: 40px;
    .pictrue {
      width: 44px !important;
      height: 44px !important;
      border-radius: 4px;
      margin-right: 6px !important;
      img {
        width: 100%;
        height: 100%;
        border-radius: 4px;
      }
    }
    .text {
      font-size: 14rpx;
      width: 160px;
      .lable {
        font-size: 12px;
        color: #e93323;
        border: 1px solid #e93323;
        padding: 0 2px;
        border-radius: 2px;
        display: inline-block;
        margin-right: 4px;
      }
    }
  }
}
.order-detail {
  .header {
    height: 60px;
    line-height: 60px;
    color: #999999;
    background-color: unset;
    padding: 0 10px;

    .home {
      color: #282828;
    }
  }
  .bag-f {
    background-color: #ffffff;
    margin: 10px 0;
    &.order-number {
      li {
        div {
          &:nth-child(2) {
            flex: none;
          }
        }

        a {
          margin-left: 30px;
          font-size: 16px;
          color: #236fe9;

          .iconfont {
            font-size: 12px;
            position: unset;
            color: #236fe9;
          }
        }
      }
    }

    ~ div {
      margin-top: 14px;
    }

    > div {
      ~ div {
        border-top: 1px dashed #cecece;
      }
    }

    &.process {
      margin-top: 0;
      div {
        border-top: none;

        &.section-hd {
          padding: 26px 22px 0;
        }

        ul {
          padding: 27px 0 94px;

          &::after {
            content: "";
            display: block;
            height: 0;
            clear: both;
            visibility: hidden;
          }
        }

        li {
          position: relative;
          float: left;
          margin-top: 0;
          margin-left: 222px;

          &:first-child {
            margin-left: 111px;
          }

          .line {
            position: absolute;
            top: 50%;
            left: 16px;
            width: 226px;
            height: 4px;
            background: #c7c7c7;
            transform: translateY(-50%);
          }

          .iconfont {
            position: relative;
            width: auto;
            font-size: 18px;
            line-height: 1;
            color: #c7c7c7;
            top: 0px;
            + .iconfont {
              position: absolute;
              top: 50%;
              left: 50%;
              display: none;
              width: 40px;
              height: 40px;
              border: 4px solid #e93323;
              border-radius: 50%;
              background: #ffffff;
              transform: translate(-50%, -50%);
              font-size: 20px;
              line-height: 32px;
              text-align: center;
              color: #e93323;
            }
          }

          .arrow {
            position: absolute;
            top: 50%;
            left: 100%;
            display: none;
            width: 80px;
            height: 16px;
            background: #e93323;
            transform: translateY(-50%);

            &::after {
              content: "";
              position: absolute;
              top: 0;
              left: 100%;
              border-width: 8px;
              border-style: solid;
              border-color: transparent transparent transparent #e93323;
            }
          }

          .info {
            position: absolute;
            top: 42px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 14px;
            text-align: center;
            color: #9a9a9a;
            width: 100px;

            div {
              &:first-child {
                margin-bottom: 4px;
                font-size: 16px;
                color: #282828;
              }
            }
          }

          &.past {
            .line {
              background: rgba(233, 51, 35, 0.6);
            }

            .iconfont {
              color: #e93323;
            }
          }

          &.now {
            .info {
              div {
                &:first-child {
                  color: #e93323;
                }
              }
            }

            .iconfont {
              + .iconfont {
                display: block;
              }
            }

            .arrow {
              display: block;
            }
          }
        }
      }
    }

    &.reject {
      position: relative;
      padding: 30px 22px;
      background: #666666;
      overflow: hidden;
      margin-top: 0;

      .iconfont {
        position: absolute;
        top: -20px;
        right: 28px;
        font-size: 112px;
        color: #818181;
      }

      div {
        border-top: none;

        &.section-hd {
          padding: 0;
          font-weight: bold;
          color: #ffffff;
        }

        ul {
          padding: 0;
          margin-top: 8px;
          font-size: 14px;
          color: #ffffff;
        }
      }
    }

    &.reason {
      padding: 26px 22px;

      div {
        border-top: none;

        &.section-hd {
          padding: 0;
          .iconfont {
            margin-right: 8px;
          }
        }

        ul {
          padding: 0;
          margin-top: 15px;
          color: #7e7e7e;
        }
      }
    }
  }

  .section-hd {
    padding: 18px 22px;
    font-size: 18px;
    color: #282828;
    .refund-msg-user {
      font-size: 16px;
      color: #282828;
      .name {
        margin-right: 10px;
      }
      .refund-tip {
        font-size: 12px;
        color: #e93323;
        margin-left: 15px;
        .iconfont {
          font-size: 14px;
          margin-right: 3px;
          display: inline-block;
          vertical-align: middle;
        }
      }
    }
    .refund-address {
      font-size: 14px;
      color: #999999;
      margin-top: 7px;
    }
  }

  .section-bd {
    position: relative;
    .pictrue {
      width: 120px;
      height: 120px;
      margin-right: 10px;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .iconfont {
      position: absolute;
      top: -20px;
      right: 0px;
      font-size: 70px;
      color: rgb(247, 30, 30);
    }
    ul {
      padding: 22px;
      font-size: 16px;
      color: #282828;

      ~ ul {
        border-top: 1px dashed #cecece;
      }
    }

    li {
      .time {
        margin-left: 10px;
      }
      ~ li {
        margin-top: 20px;
      }

      > div {
        &:first-child {
          width: 80px;
        }
      }

      &.coupon {
        span {
          ~ span {
            margin-left: 18px;
          }
        }
        > div {
          &:first-child {
            width: 100px;
          }
        }
      }
    }

    .money {
      color: #e93323;

      b {
        font-weight: normal;
        font-size: 22px;
      }
    }

    .goods {
      width: 100%;

      .info {
        font-size: 12px;
        color: #aaa;
        margin-top: 4px;
      }

      .txtCon {
        width: 500px;
        position: relative;

        .posBnt {
          font-size: 12px;
          margin-left: 10px;
          margin-top: 5px;
          .writeOff {
            color: #1890ff;
            .on {
              color: #999;
            }
          }
          .refund {
            color: #e93323;
            margin-left: 11px;
          }
        }

        .money {
          color: #333;
          margin-top: 5px;
          font-size: 14px;
        }

        .name {
          width: 400px;
        }

        .cart-num {
          font-size: 14px;
          position: absolute;
          right: 0;
          top: 50%;
          transform: translateY(-50%);
          color: #999999;
        }
      }

      li {
        position: relative;
        ~ li {
          margin-top: 22px;
        }

        > div {
          &:nth-child(1) {
            width: 86px;
            height: 86px;
            overflow: hidden;

            img {
              display: block;
              width: 100%;
              height: 100%;
            }
          }

          &:nth-child(2) {
            margin-left: 26px;

            > div {
              &:first-child {
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;
                overflow: hidden;
              }

              &:last-child {
                margin-top: 10px;

                del {
                  margin-left: 12px;
                  font-size: 14px;
                  color: #919191;
                }
              }
            }
          }

          &:nth-child(3) {
            font-size: 14px;
            color: #b1b1b1;
          }
        }
      }
    }

    .total {
      padding: 28px 22px;

      .footerState {
        cursor: pointer;
      }

      .service {
        width: 114px;
        height: 40px;
        margin-left: 18px;
        background: #e93323;
        color: #fff;
        font-size: 16px;
        text-align: center;
        line-height: 40px;
        cursor: pointer;
      }

      div {
        &:first-child {
          width: auto;
        }

        &:last-child {
          flex: none;

          div {
            padding-right: 30px;
            padding-left: 30px;

            ~ div {
              border-left: 1px solid #cecece;
            }
          }

          .orderBnt {
            width: 114px;
            height: 40px;
            padding: 0;
            border: 1px solid #999999;
            border-radius: 2px;
            background: none;
            outline: none;
            font-size: 16px;
            line-height: 40px;
            text-align: center;
            color: #282828;

            ~ .orderBnt {
              margin-left: 18px;
            }

            &.on {
              border-color: #e93323;
              background: #e93323;
              color: #ffffff;
            }
          }
        }
      }
    }
  }
}
.evaluate_btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
.split_btn {
  position: absolute;
  right: 0;
  bottom: 0px;
  a {
    color: #fff;
  }
}
</style>
