<template>
  <view class="container">
<!--    <cu-custom bgColor="bg-white" :isBack="false">-->
<!--      <block slot="content">-->
<!--        订单详情-->
<!--      </block>-->
<!--    </cu-custom>-->

<!--    <view class="cu-bar fixed padding flex align-center" :style="[{height:CustomBar + 'rpx'}]" style="background-color: #EDEDED ;">-->
<!--      <view class="action" @tap="backPage" >-->
<!--        <text class="cuIcon-close" style="color: #666666;"></text>-->
<!--      </view>-->
<!--      <view class="content" style="font-weight: bold;">-->
<!--        订单详情-->
<!--      </view>-->
<!--      <view  class="cuIcon-more" style="font-size: 40rpx;">-->
<!--      </view>-->
<!--    </view>-->
    <view style="overflow: hidden">
<!--      <view  style="height: 50px;">-->

<!--      </view>-->
      <view style="padding: 15px;margin-bottom: 50px;">
        <view @click="show = true">
          <text style="font-size: 14px;color:#999999;padding-right: 10px;">
            订单状态
          </text>
          <text v-if="orderInfo.orderState == '001'" style="font-size: 18px;font-weight:bold;padding-left: 5px;">
            待服务
          </text>
		  <text v-if="orderInfo.orderState == '099'" style="font-size: 18px;font-weight:bold;padding-left: 5px;">
		    未支付已取消
		  </text>
		  <text v-if="orderInfo.orderState == '000'" style="font-size: 18px;font-weight:bold;padding-left: 5px;">
		    待支付
		  </text>
          <text v-if="orderInfo.orderState == '002'" style="font-size: 18px;font-weight:bold;padding-left: 5px;">
            服务中
          </text>
          <text v-if="orderInfo.orderState == '003' || orderInfo.orderState == '004' || orderInfo.orderState == '007'" style="font-size: 18px;font-weight:bold;padding-left: 5px;">
            已完成
          </text>
          <text v-if="orderInfo.orderState == '005' || orderInfo.orderState == '006' " style="font-size: 18px;font-weight:bold;padding-left: 5px;">
            退款
          </text>
          <text style="font-size: 14px;padding-left: 10px;">
            <img style="width: 11px;" src="../../static/common/jiantou.png"/>
          </text>
        </view>
        <text  @click="changeOrderStateCheck('002',orderInfo)" v-if="orderInfo.orderState == '001'" style="color: #FFFFFF; padding: 7px 20px;border-radius: 4px;vertical-align: middle;background: #3B94E7;margin-top: -25px;float: right;">
          开始服务
        </text>
        <text  @click="changeOrderStateCheck('003',orderInfo)" v-if="orderInfo.orderState == '002'&& orderInfo.orderType == '001'" style="color: #f8f8f8; padding: 7px 20px;border-radius: 4px;vertical-align: middle;background: rgb(252, 96, 53);margin-top: -25px;float: right;">
          服务完成
        </text>
		<text  @click="changeOrderStateCheck('003',orderInfo)" v-if="orderInfo.orderState == '002' && orderInfo.orderType == '002' && orderInfo.maintenanceAmount >0 && orderInfo.addPayStatus =='1' " style="color: #f8f8f8; padding: 7px 20px;border-radius: 4px;vertical-align: middle;background: rgb(252, 96, 53);margin-top: -25px;float: right;">
		  服务完成
		</text>
		<text v-if="orderInfo.orderState == '002' && orderInfo.orderType == '002'&& orderInfo.addPayStatus ==null "  >
		    <text @click="changeOrderMaintenanceCheck(orderInfo)"
		        style="margin-left:10rpx;margin-right: 20rpx ;background: white;color: #3B94E7;padding: 7rpx 20rpx;border-radius: 4px;vertical-align: middle;border: 1px solid #3B94E7;float: right;margin-top: -25px;">
			配件费
		    </text>
		  <text @click="changeOrderStateCheck('003',orderInfo)"
		      style="color: #f8f8f8; padding: 7rpx 20rpx;border-radius: 4px;vertical-align: middle;background: rgb(252, 96, 53);margin-top: -25px;float: right;">
		    服务完成
		  </text>
		</text>
		<text  v-if="orderInfo.orderState == '002' && orderInfo.orderType == '002' && orderInfo.maintenanceAmount >0 && orderInfo.addPayStatus =='0' " style="font-size: 36rpx;float:right;color: #FC6035;margin-top: -25px;float: right;">
		  待支付
		</text>

        <view v-if="orderInfo.orderState == '005' || orderInfo.orderState == '006'"  style="overflow: hidden;background: #FFFFFF;margin-top:10px;padding:10px;line-height: 25px;">
          <text v-if="orderInfo.orderState == '005'" style="font-size: 15px;color:#111111;padding-right: 15px;font-weight:bold;">
            已申请平台介入退款，等待处理！<br/>
          </text>
          <text  v-if="orderInfo.orderState == '006'" style="font-size: 14px;color:#111111;padding-right: 15px;font-weight:bold;">
            退款金额 &nbsp; &nbsp;{{orderInfo.refundMoney}} 元<br/>
          </text>
          <text style="font-size: 14px;color:#999999;padding-right: 15px;">
            退款原因 &nbsp; &nbsp;{{orderInfo.refundReason}}
          </text>
        </view>
        <view style="height: 40px;margin-top:15px;background: #FDF6E3;padding:10px;">
          <text style="font-size: 14px;color:#666666;padding-right: 15px;">
            上门时间
          </text>
          <text style="font-size: 14px;float:right;">
			    <!-- {{ $u.timeFormat(orderInfo.appointmentStartTime, 'yyyy年mm月dd日')  }} -->
              {{$timefilter('年月日',orderInfo.appointmentStartTime)}}
            <text style="color:#3B94E7;margin-left: 10px;font-weight:bold;">{{ orderInfo.appointmentStartTime | timeFormat }}</text>
          </text>
        </view>
        <view style="background: #FFFFFF;padding:10px;display: flex;">
          <view style="margin: 12px 5px 0px 3px;">
            <img style="width: 40px;" src="../../static/common/dingwei.png"/>
          </view>
          <view style="margin: 10px 0px 0px 5px;width: 75%;">
            <text style="font-weight:bold;font-size:15px;line-height:25px;" @click="contact(orderInfo.phone)">{{ orderInfo.custName | nameFormat}} {{ orderInfo.phone | phoneFormat }}</text>
            <br/>
            <text style="font-size:14px;color:#666666;word-break: break-all;">{{ orderInfo.address }}{{ orderInfo.detailed }}</text>
          </view>
        </view>

        <view style="overflow: hidden;background: #FFFFFF;margin-top:10px;padding:10px;">
          <text style="font-size: 14px;color:#666666;padding-right: 15px;">
            订单编号
          </text>
          <text style="font-size: 14px;float:right;">
            <span >{{orderInfo.orderIndex}}</span>
            <text @tap="handleCopy(orderInfo.orderIndex)"
                style="padding: 3px 8px;color: rgb(102, 102, 102); margin-left: 10px;border: 1px solid rgb(204, 204, 204);border-radius: 4px;">
              复制
            </text>
          </text>
          <hr style="width:0.5px;width: 100%;margin: 10px auto;border-color:#eeeeee30;"/>
          <text style="font-size: 14px;color:#666666;padding:0 0 10px 0;">
            {{ orderInfo.name }}
          </text>
          <hr style="width:0.5px;width: 100%;margin: 10px auto;border-color:#eeeeee30;"/>
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
            服务类别
          </text>
          <text style="font-size: 14px;float:right;font-weight:bold;line-height: 25px;">
            {{ orderInfo.categoryName }}
          </text>

          <hr style="width:0.5px;width: 100%;margin: 10px auto;border-color:#eeeeee30;"/>
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
            数量
          </text>
          <text style="font-size: 14px;float:right;font-weight:bold;line-height: 25px;">
            {{ orderInfo.goodsCounts }}{{ orderInfo.unit }}
          </text>

          <hr style="width:0.5px;width: 100%;margin: 10px auto;border-color:#eeeeee30;" v-if="userInfo.orderTotalAmountShow=='1'"/>
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;"  v-if="userInfo.orderTotalAmountShow=='1'">
            单价
          </text>
          <text style="font-size: 14px;float:right;font-weight:bold;line-height: 25px;" v-if="userInfo.orderTotalAmountShow=='1'">
            {{ orderInfo.price }}元/{{ orderInfo.unit }}
          </text>

          <hr style="width:0.5px;width: 100%;margin: 10px auto;border-color:#eeeeee30;" v-if="userInfo.orderTotalAmountShow=='1'"/>
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;" v-if="userInfo.orderTotalAmountShow=='1'">
            订单金额
          </text>
          <text style="font-size: 14px;float:right;color:#FF1414;font-weight:bold; line-height: 25px;" v-if="userInfo.orderTotalAmountShow=='1'">
            ¥ {{ orderInfo.orderAmount }}
          </text>
        </view>

        <view style="overflow: hidden;background: #FFFFFF;margin-top:10px;padding:10px;" v-if="orderInfo.couponAmount != undefined && orderInfo.couponAmount != null && orderInfo.couponAmount != '' && orderInfo.couponAmount>0
            && orderInfo.beanAmount != undefined && orderInfo.beanAmount != null && orderInfo.beanAmount != '' && orderInfo.beanAmount>0
          ">>
          <view v-if="orderInfo.couponAmount != undefined && orderInfo.couponAmount != null && orderInfo.couponAmount != '' && orderInfo.couponAmount>0">
            <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
              优惠券
            </text>
            <text style="font-size: 14px;float:right;color:#FF1414;font-weight:bold; line-height: 25px;">
              - ¥{{ orderInfo.couponAmount }}
            </text>
            <hr style="width:0.5px;width: 90%;margin: 10px auto;border-color:#eeeeee30;"/>
          </view>
          <view v-if="orderInfo.beanAmount != undefined && orderInfo.beanAmount != null && orderInfo.beanAmount != '' && orderInfo.beanAmount>0">
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
            优金豆
          </text>
          <text style="font-size: 14px;float:right;color:#FF1414;font-weight:bold; line-height: 25px;">
            - ¥{{ orderInfo.beanAmount }}
          </text>
          </view>
        </view>

        <view style="padding: 10px;"  v-if="orderInfo.addPayStatus==1 && orderInfo.orderType=='001' && orderInfo.addCounts>0">
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
            追加服务
          </text>
        </view>
		<view style="padding: 10px;display: flex;justify-content: space-between;"  v-if="orderInfo.maintenanceAmount>0 && orderInfo.orderType=='002'">
		  <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
		    维修/配件费
		  </text>
		  	<text @click="checkCancel"
			 v-if="orderInfo.addPayStatus !==1"
			 style="border:1rpx solid rgb(252, 96, 53);padding: 2rpx 14rpx;color:rgb(252, 96, 53);border-radius: 30rpx;font-size: 14px" >取消收费</text>
		</view>
        <view style="overflow: hidden;background: #FFFFFF;padding:10px;" v-if="orderInfo.addPayStatus==1 && orderInfo.orderType=='001' && orderInfo.addCounts>0">
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
            追加数量
          </text>
          <text style="font-size: 14px;float:right;font-weight:bold; line-height: 25px;">
            {{ orderInfo.addCounts }}{{ orderInfo.unit }}
          </text>
          <hr style="width:0.5px;width: 90%;margin: 10px auto;border-color:#eeeeee30;" v-if="userInfo.orderTotalAmountShow=='1'"/>
          <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;" v-if="userInfo.orderTotalAmountShow=='1'">
            金额
          </text>
          <text style="font-size: 14px;float:right;color:#FF1414;font-weight:bold; line-height: 25px;" v-if="userInfo.orderTotalAmountShow=='1'"> 
            ¥ {{ orderInfo.addAmount }}
          </text>
        </view>
		<view style="overflow: hidden;background: #FFFFFF;padding:10px;" v-if="orderInfo.maintenanceAmount>0 && orderInfo.orderType=='002'">
		  <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;">
		    维修/配件费说明
		  </text>
		  <text style="font-size: 14px;float:right;font-weight:bold; line-height: 25px;word-break:break-all">
		    {{ orderInfo.maintenanceRemark }}
		  </text>
		  <hr style="width:0.5px;width: 90%;margin: 10px auto;border-color:#eeeeee30;" v-if="userInfo.orderTotalAmountShow=='1'"/>
		  <text style="font-size: 14px;color:#666666;padding-right: 15px;line-height: 25px;" v-if="userInfo.orderTotalAmountShow=='1'">
		    维修配件费金额
		  </text>
		  <text style="font-size: 14px;float:right;color:#FF1414;font-weight:bold; line-height: 25px;" v-if="userInfo.orderTotalAmountShow=='1'">
		    ¥ {{ orderInfo.maintenanceAmount }}
		  </text>
		</view>
      </view>
    </view>

    <view style="overflow: hidden;text-align: center; vertical-align: middle;line-height: 50px; bottom: 0px;display: flex;justify-content: space-between;
    width: 100%;position: fixed">
      <view  style=";font-size: 14px;background: white;height: 55px;width: 100%;" v-if="userInfo.orderTotalAmountShow=='1'">订单实付 <text style="font-size: 14px;padding-left:15px;color:#FF1414;font-weight:bold; line-height: 17px;"> ¥ {{ orderInfo.totalAmount }}</text></view>
      <view class="rightHr" v-if="userInfo.orderTotalAmountShow=='1'"></view>
      <view style="background: white;height: 55px;width: 100%;" >服务数量 <text style="font-size: 14px;padding-left:15px;font-weight:bold; line-height: 17px;"> {{ orderInfo.goodsCounts }}{{ orderInfo.unit }}</text></view>
    </view>

    <view>
      <u-popup v-model="show" mode="bottom">
        <view style="padding:15px;">
          <text style="font-size: 17px;font-weight:bold;padding-left: 5px;">
            订单跟踪
          </text>
          <hr style="width:0.5px;width: 100%;margin: 10px auto;border-color:#eeeeee30;"/>
<!--          <view  style="overflow: hidden;background: #FFFFFF;margin-top:10px;padding:10px;">-->
<!--            <text style="font-size: 15px;color:#666666;padding-right: 15px;">-->
<!--              提交订单-->
<!--            </text>-->
<!--            <text style="font-size: 14px;margin-right:10px;float:right;">-->
<!--              {{ orderInfo.createTime }}-->
<!--            </text>-->
<!--          </view>-->
          <view v-for="item in orderInfo.orderRecordList" style="overflow: hidden;background: #FFFFFF;margin-top:10px;padding:10px;">
<!--            <text style="font-size: 15px;color:#666666;padding-right: 15px;">-->
<!--              {{ item.operateInfo }}-->
<!--            </text>-->
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '000'">提交订单</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '099'">未支付取消订单</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '001'">支付成功</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.preState == '001' && item.nowState == '002'">开始服务</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.preState == '002' && item.nowState == '002' && orderInfo.orderType == '001' ">追加服务</text>
			<text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.preState == '002' && item.nowState == '002' && orderInfo.orderType == '002' ">{{item.operateInfo}}</text>
			<text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '003' && item.preState != '005'">完成服务</text>
			<text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '003' && item.preState == '005'">顾客取消平台退款</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '004' && item.preState != '005'">确认完成</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '004' && item.preState == '005'">顾客取消平台退款</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.preState != '005' && item.nowState == '006'">商家已退款</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '005'">顾客申请平台退款</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.preState == '005' && item.nowState == '006'">平台已退款</text>
            <text style="font-size: 15px;color:#666666;padding-right: 15px;" v-if="item.nowState == '007'">平台拒绝退款</text>
            <text style="font-size: 14px;margin-right:10px;float:right;">
              {{ item.createTime  | dataNewFormat}}
            </text>
          </view>
        </view>
      </u-popup>
    </view>
	<view>
		<u-popup border-radius="20" v-model="maintenanceShow" mode="bottom" :safe-area-inset-bottom="true">
			<view class="flex align-center justify-end" style="padding: 38rpx 54rpx; color: #111111;">
				<span class="font-34 text-bold">收取维修/配件费</span>
				<view style="width:30rpx;height:30rpx; margin-left: 228rpx;"  @tap="maintenanceShow=false">
					<image src="../../static/common/close.png" style="width:30rpx;height:30rpx; "></image>
				</view>

			</view>


			<view class="flex justify-between align-center" style=" padding: 14rpx 0; margin: 0 25rpx; ">
				
				<view style="font-size: 30rpx;font-weight: bold;color: #111111;">
					<image src="../../static/publish/required-icon.png"  style="width: 20rpx;height: 20rpx;" mode=""></image>收取金额</view>
				<view class="flex justify-end align-center">
					<view style="width: 350rpx; text-align: right;">
						<input v-model="orderParam.maintenanceAmount" style="text-align: right;" placeholder="请输入收取的维修/配件费金额" type="digit"
								placeholder-style="text-align: right; font-size: 26rpx;font-weight: 500;color: #C0C0C0;"></input>
					</view>
					<view style="font-size: 30rpx;font-weight: 500;color: #111111; text-align: right; width: 50rpx;">元</view>
				</view>
			</view>
			<view style="width: 700rpx; margin: 10rpx 25rpx; ">
				<view style="font-size: 30rpx;font-weight: bold;color: #111111;display: flex;">
					<view class=""style="width: 22rpx;height: 22rpx;">
						
					</view>
					费用说明</view>
				<u-input v-model="orderParam.maintenanceRemark" :type="inputArea.type" :border="inputArea.border" :height="inputArea.height" :auto-height="inputArea.autoHeight" :borderColor="inputArea.borderColor" :placeholder="inputArea.placeholder"
						 style="padding: 20rpx 30rpx;margin-top: 10rpx; background-color: #FAFAFA; font-size: 30rpx;"/>
			</view>

			<view style="padding: 30rpx 70rpx;" @click="saveReply">
				<view class="select_time_sure">提交</view>
			</view>

		</u-popup>
	</view>
	<u-toast ref="uToast" />
  </view>
</template>

<script>


export default {
  filters: {
    nameFormat(item) {
      console.log(item)
      if (item == null || item == undefined || item == '') {
        return '';
      }
      let str = item;
      if (str.length == 2) {
        str = str.toString().replace(/^([^\x00-\xff])([^\x00-\xff]{0,})([^\x00-\xff])/g, '$1*')
      } else if (str.length == 3) {
        str = str.toString().replace(/^([^\x00-\xff])([^\x00-\xff]{0,})([^\x00-\xff])/g, '$1*$3')
      } else if (str.length == 4) {
        str = str.toString().replace(/^([^\x00-\xff])([^\x00-\xff]{0,2})([^\x00-\xff])/g, '$1**$3')
      } else if (str.length > 4) {
        str = str.toString().replace(/^([^\x00-\xff])([^\x00-\xff]{0,3})([^\x00-\xff])/g, '$1***$3')
      } else {
      }
      // str = str.toString().replace(/^([^\x00-\xff])([^\x00-\xff]{1,3})([^\x00-\xff])/g , '$1**$3')
      return str;
    },
    numFilter(value) {
      let realVal = Number(value).toFixed(1)
      return realVal
    },
    phoneFormat(value) {
      if (value == null || value == undefined || value == '') {
        return '';
      }
      return value.substr(0, 3) + '****' + value.substr(7)
    },
    dataFormat(time) {
      if (time == null || time == undefined || time == '') {
        return '';
      }
	  return new Date(time).getTime()
      // return time.substring(0, 10).replaceAll('-', '月').replace('月', '年') + '日';
    },
    dataNewFormat(time) {
      if (time == null || time == undefined || time == '') {
        return '';
      }
      return time.substring(0, 16);
    },
    timeFormat(time) {
      if (time == null || time == undefined || time == '') {
        return '';
      }
      return time.substring(11, 16);
    },
  },
  data() {
    return {
		userInfo:{},
      active:1,
      show:false,
      orderId:'',
      orderInfo:{},
	  orderParam:{
		maintenanceAmount:'',
		maintenanceRemark:"",
	 },
	 maintenanceShow:false,
	 editOrderId:'',
	 inputArea: {
	 	value: '',
	 	type: 'textarea',
	 	border: true,
	 	height: 100,
	 	autoHeight: true,
	 	borderColor: '#E3E3E3',
	 	placeholder: '请输入说明'
	 },
    };
  },
  onLoad(option) {
    this.orderId = option.id;
	this.userInfo=uni.getStorageSync('userInfo')
  },
  created() {
    this.getDetail();
  },
  methods: {
	// 取消收费
	checkCancel() {
		const param={
			orderId:this.orderId
		}
		uni.showModal({
			title: '提示',
			content: '您确定要取消吗？',
			success: async (res) => {
				if (res.confirm) {
					this.$u.api.cancelMaintenanceServer(param).then(res => {
						if (res.code === 200) {
							console.log(res)
							this.$api.msg('取消成功')
							setTimeout(()=>{
								this.getDetail();
							},500)

						}
					});
				}
			}
		})

	},
    backPage(){
      uni.reLaunch({
        url: '../index/index'
      });
    },
    changeOrderState(value, item,location) {
      var that = this;
      let params = {
        orderState: value,
        orderId: item.orderId,
      };
      if(value == '002'){
        params.serviceLongitude=location.longitude;
        params.serviceLatitude=location.latitude;
        params.appointmentStartTime=item.appointmentStartTime;
      }
      this.$u.api.changeOrderState(params).then(res => {
        if (res.code === 200) {
          that.$u.toast("操作成功");
          that.getDetail();
        }else {
          that.$u.toast(res.msg);
        }
      });
    },
    changeOrderStateCheck(value, item) {
      var that = this;
      uni.showModal({
        title: value=='002'?'开始服务':'服务完成',
        content: value=='002'?'是否确认开始服务':'是否确认服务完成',
        confirmText: '确认',
        success: function(res) {
          if (res.confirm) {
            if(value == '002') {
              uni.getLocation({
                type: 'wgs84',
                geocode: true,//设置该参数为true可直接获取经纬度及城市信息
                success: function (res) {
                  console.log('当前位置的经度：' + res.longitude);
                  console.log('当前位置的纬度：' + res.latitude);
                  that.changeOrderState(value, item,res)
                },
                fail: function () {
                  uni.showToast({
                    title: '获取地址失败，将导致部分功能不可用',
                    icon: 'none'
                  });
                }
              });
            }else if(value == '003'){
              that.changeOrderState(value, item);
            }
          } else if (res.cancel) {

          }
        }
      });
    },
    contact(value){
      uni.makePhoneCall({
        // 手机号
        phoneNumber: value,
        // 成功回调
        success: (res) => {
          console.log('调用成功!')
        },
        // 失败回调
        fail: (res) => {
          console.log('调用失败!')
        }
      });
    },
    copy(data){
      let url = data;
      let oInput = document.createElement('input');
      oInput.value = url;
      document.body.appendChild(oInput);
      oInput.select(); // 选择对象;
      console.log(oInput.value)
      document.execCommand("Copy"); // 执行浏览器复制命令
      uni.showToast({ //提示
        title: '复制成功'
      })
      oInput.remove()
    },
    handleCopy(obj){
      this.copyData = obj
      this.copy(this.copyData)
      // alert("已复制好，可贴粘。");
      // uni.setClipboardData({
      //   data: value,
      //   success: () => { //复制成功的回调函数
      //     uni.showToast({ //提示
      //       title: '复制成功'
      //     })
      //     uni.hideToast();
      //   }
      // });
      // uni.showModal({
      //   title: '复制链接',
      //   content: value,
      //   confirmText: '复制',
      //   success: function(res) {
      //     if (res.confirm) {
      //       uni.setClipboardData({
      //         data: value,
      //         success: () => { //复制成功的回调函数
      //           uni.showToast({ //提示
      //             title: '复制成功'
      //           })
      //         }
      //       });
      //       console.log('用户点击确定');
      //     } else if (res.cancel) {
      //       console.log('用户点击取消');
      //     }
      //   }
      // });
    },
    //详情
    getDetail() {
      uni.showLoading({
        title: '加载中...'
      });
      this.$u.api.getOrderInfo({orderId: this.orderId})
          .then(res => {
            if(res.code === 200) {
              this.orderInfo = res.data;
            }
            uni.hideLoading();
          });
    },
	//配件费
	changeOrderMaintenanceCheck(item){
		this.editOrderId = item.orderId
		this.orderParam ={}
		this.maintenanceShow = true;
	},
	//提交收取配件费

	saveReply(){
		this.orderParam.orderId = this.editOrderId;
		console.log("提交维修配件费")
		console.log(this.orderParam)

		if (this.orderParam.maintenanceAmount == null || this.orderParam.maintenanceAmount== '') {
			this.$refs.uToast.show({
				title:'请输入收取金额',	
			})	 
			return
		}
		if (this.orderParam.maintenanceAmount <0.01) {
			this.$refs.uToast.show({
				title:'单价金额太小，请重新输入',	
			})	 
			return
		}
		var that = this;
		that.$u.api.maintenanceServer(that.orderParam).then(res => {
			if (res.code === 200) {
				that.$api.msg("发布收取维修配件费成功")
				//刷新页面
				 that.getDetail();
				that.maintenanceShow = false;
				that.editOrderId ='';
			}else{
				that.$api.msg(res.msg)
				that.maintenanceShow = false;
				that.editOrderId ='';
			}
		}).catch(err =>{
		  console.log(err)
		})

	}
  },
};
</script>

<style lang="scss" scoped>
.type-list-item{
  font-size:26px;
  font-weight:400;
  width:100px;
  height:23px;
  color:rgba(0,0,0,1);
  text-align: center;
  position: relative;
}
.rightHr{
  height: 20px;
  content: '';
  position: absolute;
  right: 51%;
  width: 1px;
  background-color: #CCCCCC;
  bottom: 18px;
}
.select_time_sure {
		background: #fc6035;
		box-shadow: 0rpx 5rpx 14rpx 0rpx #eb4553;
		border-radius: 50rpx;
		color: #ffffff;
		font-size: 32rpx;
		font-weight: 400;
		text-align: center;
		padding-top: 29rpx;
		padding-bottom: 29rpx;
	}
</style>
