fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
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
<template>
    <div>
         <list-condition-template ref="table" :tableData="tableData" :isShowPage="false" @page-info-change="handlePageInfoChange">
             <template slot="operationSection">
                 <el-button size="mini" type="success" @click="addItem">新增审核渠道</el-button>
             </template>
            <template slot="columns">
                <el-table-column  label="审核渠道">
                  <template slot-scope="scope">
                    {{getLabel(orderSourceArr,scope.row.orderSource)}}
                  </template>
                </el-table-column>
                <el-table-column  label="是否开启订单审核" width="160">
                  <template slot-scope="scope">
                    {{scope.row.configParams.orderReview ==="1" ?'是': '否' }}
                  </template>
                </el-table-column>
                <el-table-column  label="审核类型/推送类型" width="180">
                  <template slot-scope="scope">
                    <span v-if="scope.row.configParams.orderReview === '1'">{{scope.row.configParams.otherOrderControReview ==="0" ?'审核所有订单': '审核符合条件订单' }}</span>
                    <span v-else>{{scope.row.configParams.delayPushTime ? '定时推送' : '实时推送'}}</span>
                  </template>
                </el-table-column>
                <el-table-column  label="未发货订单自动退款" width="180">
                  <template slot-scope="scope">
                    <span v-if="scope.row.orderSource.includes('WLY')">
                      {{scope.row.configParams.deliveryRefundReview ==="0" ?'是': '否' }}
                    </span>
                    <span v-else>-</span>
                  </template>
                </el-table-column>
                <el-table-column  label="修改人" prop="updatorName" width="120">
                </el-table-column>
                <el-table-column  label="修改时间" prop="updateTime" width="180">
                </el-table-column>
                <el-table-column  label="操作" :width="`${2 * $store.getters.colSize}px`">
                    <template slot-scope="scope">
                      <wly-btn type="primary" @click="editInfo(scope.row)">编辑</wly-btn>
                      <wly-btn type="danger" @click="deleteItem(scope.row)" >删除</wly-btn>
                    </template>
                </el-table-column>
            </template>
         </list-condition-template>
    </div>
</template>
<script>
import orderAuditConfigApi from '@/api/orderAuditConfig'
import { getArrayLable } from '@/utils/getArrayLable'
import orderSourceArr from '@/utils/constant/orderSourceArr'
 
export default {
  data () {
    return {
      tableData: [],
      orderSourceArr
    }
  },
  /*
     * 数据变化后刷新列表
   */
  activated () {
    this.queryList(this.$refs.table.getPageInfo())
  },
  methods: {
    /**
     * 获取数组的label
     */
    getLabel (array, id) {
      let str = ''
      id.split(',').forEach((item, index, arr) => {
        const endTag = arr.length !== index + 1 ? ',' : ''
        str += getArrayLable(array, item) + endTag
      })
      return str
    },
    // 删除
    deleteItem (row) {
      this.$confirm('删除后该审核策略将不在生效,确认要删除吗', '删除', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        try {
          const res = await orderAuditConfigApi.deleteItem({ id: row.id })
          if (res.code === '0') {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.$refs.table.changeCondition() // 查询列表
          }
        } catch (error) {
        }
      })
    },
    /**
       * '分页信息改变时查询列表
       */
    handlePageInfoChange (pageInfo) {
      this.queryList(pageInfo)
    },
    /**
     * 点击查询按钮
     */
    queryData () {
      this.$refs.table.changeCondition()
    },
    /**
     * 编辑
     */
    editInfo (row) {
      this.$router.push({
        name: 'auditConfigEdit',
        query: { id: row.id }
      })
    },
    /**
     * 查询列表
     */
    queryList () {
      orderAuditConfigApi.getList().then(res => {
        this.tableData = res.data
      })
    },
    /**
       * 跳转到新增页面
       */
    addItem () {
      this.$router.push({ name: 'auditConfigAdd' })
    }
  }
}
</script>