<!--
 * @Descripttion: 
 * @version: 
 * @Author: 王三华
 * @Date: 2023-10-18 09:55:36
-->
<template>
  <view class="content">
    <view class="kuang">
      <view>
        <view class="mtn">{{'会员编号'}}: {{ memberCode }}</view>
        <view class="mtn">{{ '会员姓名' }}: {{ memberName}}</view>
        <view>{{'订单编号'}}: {{ order }}</view>
      </view>
    </view>
    <view class="kuang"
          v-for="(item,index) in backCodeList.orderItemsExtList"
          :key="index">
      <view class="kuang_i">
        <view class="flex_i">
          <view>{{ '产品名称' }}</view>
          <view>{{ item.productName }}</view>
        </view>
        <view class="flex_i">
          <view>{{ '产品数量' }}</view>
          <view>{{ item.quantity }}</view>
        </view>
        <view class="flex_i">
          <view>订单价格(￥)</view>
          <view>{{ item.price |toThousandthAndKeepDecimal}}</view>
        </view>
        <view class="flex_i">
          <view>{{ '产品业绩' }}({{ isLocalSymbol() }})</view>
          <view>{{ item.achievement |toThousandthAndKeepDecimal}}</view>
        </view>
        <view class="flex_i">
          <view>{{ '产品业绩' }}(BV)</view>
          <view>{{ item.assAchievement |toThousandthAndKeepDecimal}}</view>
        </view>
      </view>
    </view>
    <view class="kuang">
      <u--textarea v-model="returnRemark"
                   placeholder="请输入备注"></u--textarea>
    </view>

    <view class="zhan"></view>
    <view class="table_a">
      <view class="table_f">
        <u-button size="small"
                  @click="toBack"
                  :text="'取消'"></u-button>
        <u-button size="small"
                  @click="saveBackkProduct(0)"
                  color="rgba(72, 178, 253, 1)"
                  v-hasButtons="['orderReturnQr']"
                  :text="'确认'"></u-button>
      </view>
    </view>
  </view>
</template>

<script>
import * as api from '@/api/information'
import { isLocals, isLocalSymbol } from '@/util/numberToCurrency'
export default {
  data() {
    return {
      changeIndex: 0,
      methodsIndex: 0,
      order: '',
      backCodeList: [],
      returnRemark: '',
      memberCode: '',
      memberName: '',
    }
  },
  onLoad(options) {
    this.order = options.order
    this.methodsIndex = options.index
    this.backOrder()
  },
  methods: {
    isLocalSymbol,
    backOrder() {
      api
        .returnDataMerge({
          orderCode: this.order,
        })
        .then((res) => {
          this.backCodeList = res.data[0]
          this.memberCode = res.data[0].memberCode
          this.memberName = res.data[0].memberName
        })
    },
    toBack() {
      uni.navigateBack({ delta: 1 })
    },
    // 撤销订单确认
    saveBackkProduct(index) {
      api.checkHassign(233).then((res) => {
        if (res.code == 200) {
          uni.navigateTo({
            url:
              '/pages/information/refundOrder/onlineSign?data=' +
              JSON.stringify([this.backCodeList]) +
              '&index=233',
          })
        }
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.content {
  background: #f9f9f9;
  // padding: 20rpx;
  min-height: 94vh;
  padding: 20rpx 0;
}
.kuang {
  margin: 20rpx;
  background: #fff;
  border-radius: 10px 10px 10px 10px;
  padding: 30rpx;
  font-size: 13px;
  font-family: PingFang SC-Regular, PingFang SC;
  font-weight: 400;
  color: #333333;
}
.mtn {
  margin-bottom: 10rpx;
}
.kuang_i {
  display: flex;
  flex-wrap: wrap;
  margin-top: 20rpx;
}
.flex_i {
  width: 50%;
  font-size: 12px;
  font-family: PingFang HK-Medium, PingFang HK;
  font-weight: 500;
  color: #999999;
  :nth-child(1) {
    margin-bottom: 10rpx;
  }
  :nth-child(2) {
    font-size: 13px;
    font-family: PingFang HK-Medium, PingFang HK;
    font-weight: 500;
    color: #333333;
    margin-bottom: 20rpx;
  }
}
.zhan {
  height: 100px;
}
.table_a {
  position: fixed;
  width: 100%;
  bottom: 0;
  background: #fff;
  padding: 20rpx 0 40px 0;
}
.table_f {
  display: flex;

  uni-button {
    margin: 20rpx 10rpx;
  }
}
</style>