mayf
2024-08-23 8db1014ad0c02e88609ef3e46a0236f40820ed1d
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<template>
  <el-bus-crud ref="crud" v-bind="tableConfig">
    <template #table="{ list }">
      <template v-if="list && list.length > 0">
        <after-sale-table :list="list" @detail="onDetail" @handle="onHandle" />
      </template>
      <el-bus-empty v-else />
    </template>
  </el-bus-crud>
</template>
 
<script>
import AfterSaleTable from '@/components/order/after-sale-table'
export default {
  components: {
    AfterSaleTable,
  },
  data() {
    return {
      tableConfig: {
        url: 'flower/api/sales/list',
        hasNew: false,
        hasEdit: false,
        hasDelete: false,
        hasExport: true,
        exportUrl: 'flower/api/sales/list/export',
        exportText: '售后导出',
        searchFormAttrs: {
          labelWidth: 'auto',
        },
        beforeRequest: (params) => {
          const searchForm = this.$refs.crud?.$refs?.searchForm
          if (searchForm) {
            const statusComp = searchForm.getComponentById('status')
            if (statusComp) {
              // 组件内部不会修改这个prop直接修改可忽略警告
              statusComp.extraQuery = { ...params, status: '' }
              statusComp.getOtherOptions()
            }
          }
        },
        searchForm: [
          {
            type: 'row',
            id: 'row',
            items: [
              {
                label: '售后状态:',
                id: 'status',
                type: 'bus-radio',
                el: {
                  hasAll: true,
                  otherInterfaceUri: 'flower/api/sales/status/count',
                  childType: 'el-radio-button',
                  filterOptions: (list) => {
                    return list.map((item) => {
                      return {
                        ...item,
                        label: `${item.label}(${item.orderCount})`,
                      }
                    })
                  },
                  // code: 'ORDER_SALES_STATUS',
                },
                default: '',
                span: 24,
                searchImmediately: true,
                on: {
                  optionsChange: (e, updateForm, { currentComp }) => {
                    if (Array.isArray(e[0]) && e[0].length > 0) {
                      const totalCount = e[0].reduce((total, current) => {
                        return (total += current.orderCount)
                      }, 0)
                      // 组件内部不会修改这个prop直接修改可忽略警告
                      currentComp.props = {
                        allLabel: `不限(${totalCount})`,
                      }
                    }
                  },
                },
              },
              { label: '商品名称:', id: 'flowerName', type: 'input' },
              { label: '订单号:', id: 'orderNo', type: 'input' },
              { label: '售后单号:', id: 'salesNo', type: 'input' },
              { label: '收货人姓名:', id: 'customer', type: 'input' },
              { label: '收货人电话:', id: 'customerTel', type: 'input' },
              { label: '供应商:', id: 'supplierName', type: 'input' },
              {
                label: '下单时间:',
                id: 'orderStartDateStr',
                component: 'el-bus-date-range',
                commonFormat: true,
                commonFormatProps: ['orderStartDateStr', 'orderEndDateStr'],
                customClass: 'in-bus-form',
              },
              {
                label: '售后时间:',
                id: 'salesStartDateStr',
                component: 'el-bus-date-range',
                commonFormat: true,
                commonFormatProps: ['salesStartDateStr', 'salesEndDateStr'],
                customClass: 'in-bus-form',
              },
            ],
          },
        ],
        form: [
          {
            type: 'row',
            items: [
              { label: '商品名称:', id: 'flowerName', type: 'input' },
              { label: '合伙人加价(元):', id: 'markupPartner', type: 'input' },
              { label: '商品价格(元):', id: 'price', type: 'input' },
              { label: '供应商价格(元):', id: 'supplierPrice', type: 'input' },
              { label: '商品数量:', id: 'flowerNum', type: 'input' },
              { label: '申请售后数量:', id: 'num', type: 'input' },
            ],
          },
        ],
        extraDialogs: [
          {
            title: '售后处理',
            readonly: true,
            confirmText: '通过',
            cancelText: '不通过',
            confirmButtonAttrs: {
              type: 'success',
            },
            cancelButtonAttrs: {
              type: 'danger',
            },
            dialogAttrs: {
              width: '70%',
            },
            form: [
              {
                type: 'row',
                items: [
                  {
                    label: '供应商(元):',
                    id: 'feeSupplier',
                    type: 'input-number',
                    el: { min: 0, precision: 2, controls: false },
                  },
                  {
                    label: '平台(元):',
                    id: 'feePlatform',
                    type: 'input-number',
                    el: { min: 0, precision: 2, controls: false },
                  },
                  {
                    label: '合伙人(元):',
                    id: 'feePartner',
                    type: 'input-number',
                    el: { min: 0, precision: 2, controls: false },
                  },
                  {
                    label: '打包(元):',
                    id: 'feePlatformPack',
                    type: 'input-number',
                    el: { min: 0, precision: 2, controls: false },
                  },
                  {
                    label: '质检(元):',
                    id: 'feePlatformCheck',
                    type: 'input-number',
                    el: { min: 0, precision: 2, controls: false },
                  },
                  {
                    label: '物流(元):',
                    id: 'feePlatformTransport',
                    type: 'input-number',
                    el: { min: 0, precision: 2, controls: false },
                  },
                  {
                    label: '申请理由:',
                    id: 'reason',
                    type: 'input',
                    el: {
                      type: 'textarea',
                    },
                    readonly: true,
                    span: 24,
                  },
                  {
                    label: '平台回复:',
                    id: 'remarks',
                    type: 'input',
                    el: {
                      type: 'textarea',
                      rows: 6,
                    },
                    rules: {
                      required: true,
                      message: '请输入平台回复',
                      trigger: 'blur',
                    },
                    span: 24,
                  },
                ],
              },
            ],
            atConfirm: async (val) => {
              const { code } = await this.$elBusHttp.request(
                'flower/api/sales/audit/agree',
                { method: 'post', data: val }
              )
              if (code === 0) {
                this.$message.success('操作成功')
              } else {
                return false
              }
            },
            atCancel: async (val) => {
              const { code } = await this.$elBusHttp.request(
                'flower/api/sales/audit/reject',
                {
                  method: 'post',
                  data: {
                    id: val.id,
                    remarks: val.remarks,
                  },
                }
              )
              if (code === 0) {
                this.$message.success('操作成功')
              } else {
                return false
              }
            },
          },
        ],
      },
    }
  },
  head() {
    return {
      title: '售后理赔',
    }
  },
  methods: {
    onDetail(item) {
      this.$router.push(`${this.$route.path}/view/${item.id}`)
    },
    onHandle(item) {
      this.$refs.crud.$refs.extraDialog[0].show(item)
    },
  },
}
</script>
 
<style lang="scss" scoped></style>