zhaojs
2023-09-15 39e2103e28830337c3be4dbd3dc7ad0a829ee78b
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<template>
  <page-header-wrapper
    :breadcrumb="false"
  >
    <a-card :bordered="false">
      <div class="table-page-search-wrapper" style="background-color: #fff;">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="8" :sm="24">
              <a-form-item label="退款单号">
                <a-input v-model="queryParam.tid" placeholder="请输入有赞退款号查询"/>
              </a-form-item>
            </a-col>
            <a-col :md="8" :sm="24">
              <a-form-item>
                <a-button type="primary" @click="onSearch">查询</a-button>
              </a-form-item>
            </a-col>
          </a-row>
        </a-form>
      </div>
 
      <a-table
        rowKey="id"
        ref="table"
        size="default"
        :pagination="pagination"
        :columns="columns"
        :data-source="data"
        :scroll="{ x: 2200 }"
        :loading="loading"
      >
        <template slot="tradedetail" slot-scope="text, record">
          <a @click="getRefundDetail(record)">{{ record.refundId }}</a>
        </template>
        <template slot="alitradestatus" slot-scope="text, record">
          {{ getAliStatus(record) }}
        </template>
        <template slot="refundstatus" slot-scope="text, record">
          {{ getRefundStatus(record) }}
        </template>
        <template slot="action" slot-scope="text, record">
          <a @click="backReturn(record)">回传退货单</a>
          <!---| <a @click="refuseRefund(record)">拒绝退款</a>-->
        </template>
      </a-table>
    </a-card>
 
  </page-header-wrapper>
</template>
 
  <script>
  import { ref } from 'vue'
 
  import { GetRefundList, GetRefundDetailUrl, ReturnGoods } from '@/api/refundapi'
  import GoodAddressForm from './modules/GoodAddressForm'
  const columns = [
  {
    title: '有赞退款单',
    dataIndex: 'refundId',
    fixed: 'left',
    scopedSlots: { customRender: 'tradedetail' }
  },
  {
    title: '退款类型',
    width: '100px',
    dataIndex: 'refundType',
    ellipsis: true,
    customRender: (text) => text == 'REFUND_ONLY' ? '仅退款' : '退货退款'
  },
  {
    title: '1688订单',
    dataIndex: 'aliTid',
    customRender: (text) => text == null ? '未创建1688订单' : text
  },
  {
    title: '有赞子订单',
    dataIndex: 'yzOid'
  },
  {
    title: '有赞主订单',
    dataIndex: 'yzTid'
  },
  {
    title: '退款金额',
    dataIndex: 'refundedFee'
  },
  {
    title: '有赞退款状态',
    dataIndex: 'yzRefundStaus',
    ellipsis: true,
    scopedSlots: { customRender: 'refundstatus' }
  },
  {
    title: '退款原因',
    dataIndex: 'refundReasonDesc'
  },
  {
    title: '1688订单状态',
    dataIndex: 'aliTradeStatus',
    ellipsis: true,
    scopedSlots: { customRender: 'alitradestatus' }
  },
 
  {
    title: '备注',
    dataIndex: 'memo'
  },
  {
    title: '操作',
    dataIndex: 'action',
    fixed: 'right',
    scopedSlots: { customRender: 'action' }
  }
]
  export default {
    name: 'Backreturn',
    components: {
      GoodAddressForm
  },
    data () {
      return {
        queryParam: {},
        columns,
        loading: false,
        data: [],
        pagination: {
          current: 1,
          pageSize: 10,
          total: 0,
          pageSizeOptions: ['10', '20'],
          onChange: this.onPageChange,
         onShowSizeChange: this.onPageChange
        }
      }
    },
    setup () {
 
    },
    created () {
      this.onSearch()
    },
    methods: {
      onPageChange (current, size) {
              this.pagination.current = current
              this.pagination.pageSize = size
              this.onSearch()
        },
      onSearch () {
        this.loading = true
        var parameter = {
          PageNo: this.pagination.current,
          PageSize: this.pagination.pageSize,
          YzRefundStatus: 'REFUND_WAIT_SELLER_CONFIRM_GOODS',
          RelationType: 3
        }
        GetRefundList(parameter).then(res => {
         this.data = res.result.data
          this.pagination.total = res.result.totalCount
        }).finally(() => {
            this.loading = false
         })
      },
      // 回传退货单
      backReturn (record) {
        this.loading = true
        const parameter = {
            RefundId: record.refundId
        }
        ReturnGoods(parameter).then(res => {
            if (res.result) {
                this.$message.success(`操作成功!`)
                this.pagination.current = 1
                this.onSearch()
            }
        }).finally(() => {
            this.loading = false
        })
      },
       // 获取1688订单状态
       getAliStatus (record) {
        switch (record.aliTradeStatus) {
          case 'waitbuyerpay':
            return '等待买家付款'
          case 'waitsellersend':
            return '等待卖家发货'
          case 'waitbuyerreceive':
            return '等待买家收货'
            case 'confirm_goods':
            return '已收货'
            case 'success':
            return '交易成功'
            case 'cancel':
            return '交易取消'
            case 'terminated':
            return '交易终止'
        default:
            return '未知状态'
        }
      },
      // 获取退款状态
      getRefundStatus (record) {
        switch (record.yzRefundStaus) {
          case 'REFUND_WAIT_SELLER_AGREE':
            return '买家已经申请退款,等待卖家同意'
          case 'REFUND_SELLER_REFUSE_BUYER':
            return '卖家拒绝退款'
          case 'REFUND_WAIT_BUYER_RETURN_GOODS':
            return '卖家已经同意退货,等待买家退货'
            case 'REFUND_WAIT_SELLER_CONFIRM_GOODS':
            return '买家已经退货,等待卖家确认收货'
            case 'REFUND_SELLER_REFUSE_RETURN_GOODS':
            return '卖家未收到货,拒绝退款'
            case 'REFUND_CLOSED':
            return '退款关闭'
            case 'REFUND_SUCCESS':
            return '退款成功'
        }
      },
      // 跳转退款详情
      getRefundDetail (record) {
        const parameter = {
          RefundId: record.refundId,
          TradeId: record.yzTid
        }
        GetRefundDetailUrl(parameter).then(res => {
          window.open(res.result, '_blank')
        })
      }
    }
  }
  </script>