<template>
    <div>
      <Button @click="showDetailBtn()" style='margin-top: -6px;' size='small' type="fcdefault">详情</Button>
      <Button style='margin-top: -6px;' type="fcdefault" size='small' v-if="this.$parent.params.data.ORDERSTATUS.refobjval==1 && showAudioPower" @click="auditorder">审核</Button> 
      <!-- type="fcdefault"  -->
      <Drawer title="" width="1240" :closable="false" v-model="value1" v-if="showDetail"> 
        <!-- v-if="showDetail" -->
        <OrderManagementEditorDialog :type="type" :OrderIdFromList="this.$parent.params.data.ID.val" @closeOrderDetail="closeOrderDetail"></OrderManagementEditorDialog>   
        <!-- params.ID -->
      </Drawer>
    </div>
  </template>
  <script>
    const R3 = window.R3;
    const { network, urlSearchParams, store } = R3;
    import OrderManagementEditorDialog from '../customizedPage/OrderManagementEditor'; 
    export default {
        data () {
            return {
                showDetail: false,
                value1: false,
                // pageMsgId:'1242616',
                showAudioPower: false,
                type: 'list',
            }
        },
        components: {
            OrderManagementEditorDialog,
        },
        created() {
          this.showAudioPower = localStorage.getItem('showAudioPower') == 'false'?false:true;
          console.log(this.showAudioPower)
        },
        methods: {
          closeOrderDetail() {
            this.value1 = false;
            // this.showDetail = false;
          },
          showDetailBtn() {
            this.value1 = true;
            this.showDetail = true;
          },
          
          // 审核按钮
          auditorder() {
            this.$Modal.fcWarning({
                title: '提示',
                mask: true,
                showCancel: true,
                content: '是否确认审核',
                onOk:()=>{
                  let data = {
                    orderids: [this.$parent.params.data.ID.val],
                    ismerge: true
                  };
                  network.post('/p/cs/auditorder', data).then((res)=>{
                    if (res.data.code == 0) {
                      this.$Message.success('操作成功');
                      document.querySelector('#refresh').click(); // 标准列表刷新按钮
                    } else if (res.data.code == 10) {
                      // document.querySelector('#refresh').click(); // 标准列表刷新按钮
                      let msg = res.data.message;
                      let mergeIds = res.data.data.mergeIds;
                      let refresh = this.searchClickData;
                      this.$R3Dialog({
                        dialogComponentName: 'BatchAudit', // 自定义的弹框组件
                        title: '审核', // 弹框标题
                        footerHide: true,
                        externalOptions: {
                          massage: msg,
                          mergeIds,
                          type: 'list',
                          refresh
                        }
                      }, () => {
                      });
                    }
                  })
                }
            })
          },
        }
    }
  </script>
  