Blame view

store-pc/src/components/RefundListDialog.vue 13 KB
ad197adf   “wangming”   完成了基本的门店PC的设计
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
  <template>
    <el-dialog
      :visible.sync="visibleProxy"
      :show-close="false"
      width="90%"
      :close-on-click-modal="false"
      custom-class="refund-list-dialog"
      append-to-body
    >
      <div class="dialog-inner">
        <div class="dialog-header">
          <div class="dialog-title">退卡记录</div>
          <span class="dialog-close" @click="visibleProxy = false"><i class="el-icon-close"></i></span>
        </div>
  
        <div class="dialog-search">
          <el-form @submit.native.prevent :inline="true" size="small">
            <el-form-item label="会员">
              <el-select v-model="query.hy" filterable remote reserve-keyword clearable placeholder="搜索会员" :remote-method="searchMember" :loading="memberLoading" style="width:200px">
                <el-option v-for="m in memberOptions" :key="m.value" :label="m.label" :value="m.value" />
              </el-select>
            </el-form-item>
            <template v-if="showAll">
              <el-form-item label="退卡时间">
                <el-date-picker v-model="query.tksj" type="daterange" value-format="timestamp" format="yyyy-MM-dd" start-placeholder="开始" end-placeholder="结束" style="width:220px" />
              </el-form-item>
              <el-form-item label="健康师">
                <el-select v-model="query.jksId" placeholder="健康师" clearable filterable style="width:150px">
                  <el-option v-for="h in jksOptions" :key="h.id" :label="h.fullName" :value="h.id" />
                </el-select>
              </el-form-item>
              <el-form-item label="科技老师">
                <el-select v-model="query.kjblsId" placeholder="科技老师" clearable filterable style="width:150px">
                  <el-option v-for="t in kjbOptions" :key="t.id" :label="t.fullName" :value="t.id" />
                </el-select>
              </el-form-item>
              <el-form-item label="是否作废">
                <el-select v-model="query.isEffective" placeholder="请选择" clearable style="width:100px">
                  <el-option label="正常" value="1" /><el-option label="作废" value="-1" />
                </el-select>
              </el-form-item>
            </template>
            <el-form-item>
              <el-button type="primary" @click="search">查询</el-button>
              <el-button @click="reset">重置</el-button>
              <el-button type="text" @click="showAll = !showAll">
                {{ showAll ? '收起' : '展开' }} <i :class="showAll ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
              </el-button>
            </el-form-item>
          </el-form>
        </div>
  
        <div class="dialog-content">
20099e65   “wangming”   1111
54
          <el-table v-loading="loading" :data="list" border size="small" :header-cell-style="{ background:'#f8fafc', color:'#64748b', fontWeight:600 }">
ad197adf   “wangming”   完成了基本的门店PC的设计
55
56
57
58
            <el-table-column type="expand" width="50">
              <template slot-scope="{ row }">
                <div class="expand-box" v-if="row.lqHytkMxList && row.lqHytkMxList.length">
                  <div class="expand-title"><i class="el-icon-goods"></i> 退卡明细</div>
20099e65   “wangming”   1111
59
                  <el-table :data="row.lqHytkMxList" border size="mini" :header-cell-style="{ background:'#f0f4f8', color:'#64748b', fontWeight:500 }">
ad197adf   “wangming”   完成了基本的门店PC的设计
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
                    <el-table-column prop="pxmc" label="项目名称" width="180" />
                    <el-table-column label="项目价格" width="120" align="right">
                      <template slot-scope="s">¥{{ formatMoney(s.row.pxjg) }}</template>
                    </el-table-column>
                    <el-table-column prop="projectNumber" label="次数" width="80" align="right" />
                    <el-table-column label="退款金额" width="120" align="right">
                      <template slot-scope="s"><span style="color:#F56C6C;font-weight:600">¥{{ formatMoney(s.row.tkje) }}</span></template>
                    </el-table-column>
                    <el-table-column label="总价" width="120" align="right">
                      <template slot-scope="s">¥{{ formatMoney(s.row.totalPrice) }}</template>
                    </el-table-column>
                    <el-table-column label="来源" width="100">
                      <template slot-scope="s"><el-tag size="mini" type="info">{{ s.row.sourceType || '-' }}</el-tag></template>
                    </el-table-column>
                    <el-table-column label="是否有效" width="90" align="center">
                      <template slot-scope="s">{{ s.row.isEffective == 1 ? '有效' : '无效' }}</template>
                    </el-table-column>
                  </el-table>
                </div>
                <div v-else class="expand-empty"><i class="el-icon-info"></i> 暂无退卡明细</div>
              </template>
            </el-table-column>
            <el-table-column prop="mdmc" label="门店名称" show-overflow-tooltip />
            <el-table-column prop="hymc" label="会员姓名" />
            <el-table-column prop="hyPhone" label="手机号" width="120" />
            <el-table-column label="退款金额" width="110" align="right">
              <template slot-scope="{ row }"><span style="color:#409EFF;font-weight:600">{{ row.tkje || '-' }}</span></template>
            </el-table-column>
            <el-table-column label="实际退款金额" width="130" align="right">
              <template slot-scope="{ row }"><span style="color:#F56C6C;font-weight:600">{{ row.actualRefundAmount || '-' }}</span></template>
            </el-table-column>
            <el-table-column label="退卡时间" width="110">
              <template slot-scope="{ row }">{{ formatDate(row.tksj) }}</template>
            </el-table-column>
            <el-table-column label="是否作废" width="90" align="center">
b5df6609   “wangming”   ```
95
              <template slot-scope="{ row }">{{ row.isEffective == 1 || row.isEffective == '1' ? '正常' : '作废' }}</template>
ad197adf   “wangming”   完成了基本的门店PC的设计
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
            </el-table-column>
            <el-table-column prop="bz" label="备注" show-overflow-tooltip />
            <el-table-column label="操作人" width="120" show-overflow-tooltip>
              <template slot-scope="{ row }">{{ row.czry || '-' }}</template>
            </el-table-column>
          </el-table>
        </div>
  
        <div class="dialog-footer">
          <el-pagination background layout="total, sizes, prev, pager, next, jumper" :total="total" :page-size.sync="listQuery.pageSize" :current-page.sync="listQuery.currentPage" :page-sizes="[10, 20, 50, 100]" @size-change="initData" @current-change="initData" />
        </div>
      </div>
    </el-dialog>
  </template>
  
  <script>
b5df6609   “wangming”   ```
112
113
114
115
116
  import { getHytkHytkList } from '@/api/lqHytkHytk'
  import { getKhxxList } from '@/api/lqKhxx'
  import { getStoreUserList } from '@/api/storeUser'
  import { buildTksjRange } from '@/utils/refundHelper'
  
ad197adf   “wangming”   完成了基本的门店PC的设计
117
118
  export default {
    name: 'RefundListDialog',
b5df6609   “wangming”   ```
119
120
121
122
    props: {
      visible: { type: Boolean, default: false },
      currentStoreId: { type: String, default: '' }
    },
ad197adf   “wangming”   完成了基本的门店PC的设计
123
124
    data() {
      return {
b5df6609   “wangming”   ```
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
        showAll: false,
        loading: false,
        memberLoading: false,
        memberOptions: [],
        jksOptions: [],
        kjbOptions: [],
        list: [],
        total: 0,
        query: {
          hy: undefined,
          tksj: undefined,
          jksId: undefined,
          kjblsId: undefined,
          isEffective: '1'
        },
ad197adf   “wangming”   完成了基本的门店PC的设计
140
141
142
143
        listQuery: { currentPage: 1, pageSize: 10, sort: 'desc', sidx: '' }
      }
    },
    computed: {
b5df6609   “wangming”   ```
144
145
146
147
148
149
150
      visibleProxy: {
        get() { return this.visible },
        set(v) { this.$emit('update:visible', v) }
      },
      storeId() {
        return this.currentStoreId || (this.$store.getters.storeInfo || {}).storeId || ''
      }
ad197adf   “wangming”   完成了基本的门店PC的设计
151
152
    },
    watch: {
b5df6609   “wangming”   ```
153
154
155
156
157
158
159
      visible(v) {
        if (v) {
          if (!this.memberOptions.length) this.searchMember('')
          this.loadStaff()
          this.initData()
        }
      }
ad197adf   “wangming”   完成了基本的门店PC的设计
160
161
162
163
164
165
166
    },
    methods: {
      formatDate(ts) {
        if (!ts) return '-'
        if (typeof ts === 'string' && ts.includes('-')) return ts.substring(0, 10)
        const d = new Date(typeof ts === 'number' ? ts : Number(ts))
        if (isNaN(d.getTime())) return '-'
b5df6609   “wangming”   ```
167
        return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
ad197adf   “wangming”   完成了基本的门店PC的设计
168
169
      },
      formatMoney(v) { return v != null ? Number(v).toFixed(2) : '0.00' },
b5df6609   “wangming”   ```
170
      async searchMember(kw) {
ad197adf   “wangming”   完成了基本的门店PC的设计
171
        this.memberLoading = true
b5df6609   “wangming”   ```
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
        try {
          const res = await getKhxxList({
            currentPage: 1,
            pageSize: 30,
            keyWord: (kw || '').trim()
          })
          const list = res.data?.list || []
          this.memberOptions = list.map(m => {
            const name = m.khmc || m.name || '无'
            const phone = m.sjh || m.mobile || ''
            return {
              value: m.id,
              label: phone ? `${name}(${phone})` : name
            }
          })
        } catch (e) {
          this.memberOptions = []
        } finally {
ad197adf   “wangming”   完成了基本的门店PC的设计
190
          this.memberLoading = false
b5df6609   “wangming”   ```
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
        }
      },
      async loadStaff() {
        const storeId = this.storeId
        if (!storeId) {
          this.jksOptions = []
          this.kjbOptions = []
          return
        }
        try {
          const [jksRes, kjbRes] = await Promise.all([
            getStoreUserList({ mdid: storeId, gw: '健康师', currentPage: 1, pageSize: 500 }),
            getStoreUserList({ mdid: storeId, gw: '科技老师', currentPage: 1, pageSize: 500 })
          ])
          const mapUser = u => ({
            id: u.id,
            fullName: u.realName || u.account || u.id
          })
          this.jksOptions = (jksRes.data?.list || []).map(mapUser)
          this.kjbOptions = (kjbRes.data?.list || []).map(mapUser)
        } catch (e) {
          this.jksOptions = []
          this.kjbOptions = []
        }
ad197adf   “wangming”   完成了基本的门店PC的设计
215
      },
b5df6609   “wangming”   ```
216
217
218
219
220
221
222
223
224
225
226
227
228
229
      buildListQuery() {
        const q = {
          ...this.listQuery,
          md: this.storeId,
          hy: this.query.hy,
          jksId: this.query.jksId,
          kjblsId: this.query.kjblsId
        }
        const tksj = buildTksjRange(this.query.tksj)
        if (tksj) q.tksj = tksj
        if (this.query.isEffective !== undefined && this.query.isEffective !== '') {
          q.isEffective = Number(this.query.isEffective) || this.query.isEffective
        }
        return q
ad197adf   “wangming”   完成了基本的门店PC的设计
230
      },
b5df6609   “wangming”   ```
231
232
233
234
235
236
      async initData() {
        if (!this.storeId) {
          this.list = []
          this.total = 0
          return
        }
ad197adf   “wangming”   完成了基本的门店PC的设计
237
        this.loading = true
b5df6609   “wangming”   ```
238
239
240
241
242
243
244
245
        try {
          const res = await getHytkHytkList(this.buildListQuery())
          this.list = res.data?.list || []
          this.total = res.data?.pagination?.total || 0
        } catch (e) {
          this.list = []
          this.total = 0
        } finally {
ad197adf   “wangming”   完成了基本的门店PC的设计
246
          this.loading = false
b5df6609   “wangming”   ```
247
        }
ad197adf   “wangming”   完成了基本的门店PC的设计
248
      },
b5df6609   “wangming”   ```
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
      search() {
        this.listQuery.currentPage = 1
        this.initData()
      },
      reset() {
        this.query = {
          hy: undefined,
          tksj: undefined,
          jksId: undefined,
          kjblsId: undefined,
          isEffective: '1'
        }
        this.listQuery = { currentPage: 1, pageSize: 10, sort: 'desc', sidx: '' }
        this.initData()
      }
ad197adf   “wangming”   完成了基本的门店PC的设计
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
    }
  }
  </script>
  
  <style lang="scss" scoped>
  ::v-deep .refund-list-dialog { max-width: 1600px; margin-top: 3vh !important; border-radius: 20px; padding: 0; background: radial-gradient(circle at 0 0, rgba(255,255,255,0.96) 0, rgba(248,250,252,0.98) 40%, rgba(241,245,249,0.98) 100%); box-shadow: 0 24px 48px rgba(15,23,42,0.18), 0 0 0 1px rgba(255,255,255,0.9); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }
  ::v-deep .el-dialog__header { display: none; }
  ::v-deep .el-dialog__body { padding: 0; }
  .dialog-inner { display: flex; flex-direction: column; max-height: 92vh; }
  .dialog-header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; margin: 18px 22px 0; padding: 10px 14px; border-radius: 14px; background: rgba(219,234,254,0.96); }
  .dialog-title { font-size: 17px; font-weight: 600; color: #0f172a; }
  .dialog-close { cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 999px; color: #64748b; transition: all 0.15s; &:hover { background: rgba(0,0,0,0.06); color: #0f172a; } }
  .dialog-search { flex-shrink: 0; padding: 12px 22px 4px; }
  .dialog-content { flex: 1; min-height: 0; overflow: auto; padding: 0 22px; }
  .dialog-footer { flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end; padding: 10px 22px 14px; border-top: 1px solid rgba(229,231,235,0.6); }
  .expand-box { padding: 14px; background: #fafafa; border-radius: 8px; margin: 6px 0; .expand-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #303133; margin-bottom: 10px; i { color: #409EFF; } } }
b5df6609   “wangming”   ```
280
  .expand-empty { padding: 16px; text-align: center; color: #909399; font-size: 13px; i { margin-right: 4px; } }
ad197adf   “wangming”   完成了基本的门店PC的设计
281
282
283
284
285
286
287
  ::v-deep .refund-list-dialog .el-input__inner { border-radius: 999px; height: 32px; line-height: 32px; border-color: #e5e7eb; background-color: #f9fafb; &:focus { border-color: #2563eb; box-shadow: 0 0 0 1px rgba(37,99,235,0.18); } }
  ::v-deep .refund-list-dialog .el-button--primary { border-radius: 999px; background: #2563eb; border-color: #2563eb; box-shadow: 0 4px 10px rgba(37,99,235,0.35); }
  ::v-deep .refund-list-dialog .el-button--default { border-radius: 999px; }
  ::v-deep .refund-list-dialog .el-form-item { margin-bottom: 8px; }
  ::v-deep .refund-list-dialog .el-form-item__label { white-space: nowrap; }
  ::v-deep .refund-list-dialog .el-range-editor.el-input__inner { border-radius: 999px; }
  </style>