hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<template>
  <div class="finance-del">
    <v-header
      title="线下奖励支出明细"
    ></v-header>
 
    <div class="total-nav">
      <div class="lie">
        <p>今日实际支出</p>
        <p class="num">¥{{Overview.dayTotal || '0.00'}}</p>
      </div>
        <div class="lie">
        <p>本月实际支出</p>
        <p class="num">¥{{Overview.monthTotal || '0.00'}}</p>
      </div>
        <div class="lie">
        <p>累计实际支出</p>
        <p class="num">¥{{Overview.total || '0.00'}}</p>
      </div>
    </div>
 
    <el-form :inline="true"  class="demo-form-inline">
      <el-form-item label="关键字" style="width: 350px" >
        <el-input style="width:280px" size="small" v-model="bar.keyWord" placeholder="请输入姓名、账号等关键词进行查找"></el-input>
      </el-form-item>
      <el-form-item label="金额排序">
        <el-radio-group v-model="bar.sort" size="medium">
          <el-radio-button label="1">升序</el-radio-button>
          <el-radio-button label="2">降序</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <div class="block">
          <span class="demonstration">支出时间</span>
          <el-date-picker
            v-model="bar.time"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        </div>
      </el-form-item>
      <el-form-item>
        <el-button size="small" type="primary" @click="onSearch">查询</el-button>
        <el-button @click="Reset" size="small">重置</el-button>
      </el-form-item>
    </el-form>
 
    <div class="add">
      <button class="m_btn bgc_primary" @click="exports()">导出</button>
    </div>
 
    <div
      class="Tips"
      v-show="Change"
    >
      <i
        style="color: #409EFF"
        class="el-icon-info"
      ></i>
      <div class="Tips-cont">已选择<span>{{ids.length}}</span>项</div>
      <el-button
        type="text"
        @click="cancel"
      >取消</el-button>
    </div>
 
    <div class="tab">
      <v-tool-table
        :trs="trs"
        :tds="tds"
        first
      >
      <template v-slot:first-th>
        <div>
          <el-checkbox @change="cheAll" v-model="alls"></el-checkbox>
        </div>
      </template>
      <template v-slot:first-td="item">
        <div>
          <el-checkbox @change="change" v-model="item.scope.che"></el-checkbox>
        </div>
      </template>
        <template v-slot:btn="{scope}">
          <div class="table_flex">
            <span @click="exports(scope.id)">导出</span>
          </div>
        </template>
      </v-tool-table>
    </div>
    <v-tool-page
      :item="paged"
      @on-page="onPage"
    ></v-tool-page>
    <div class="total-num">当前页总计:<span class="num">¥{{totalSumAll || 0}}</span> 合计:<span class="num">¥{{totalNum || 0}} </span></div>
  </div>
</template>
<script>
export default {
  props: [],
  components: {},
  data() {
    return {
      bar: {
        keyWord:'',
        sort:"",
        time:'',
      },
      os: {},
      trs: [
        { text: "支出金额(元)", val: "amount" },
        { text: "支出用户", val: "userName" },
        { text: "支出账号", val: "phone" },
        { text: "支出时间", val: "createAt" },
        { text: "备注", val: "createAt" },
        { text: "操作人", val: "operationUserName" },
        { text: "操作", val: "btn" ,slot:"btn"},
      ],
      tds: [],
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      search: {},
      Overview:{},
      totalNum:'',
      Change:false,
      ids:[], //选中的id集合
      alls: false, //全选状态
    };
  },
 
  computed:{
    totalSumAll(){
      let totalSumAlls = 0;
      this.tds.map((item) => {totalSumAlls += item.amount})
      return totalSumAlls
    },
  },
 
  mounted() {
    this.getstatistics();
    this.totalNumber();  
  },
 
  methods: {
    onSearch(v) {
      this.paged.page = 1;
      this.init();
    },
 
    Reset() {
      this.bar.keyWord = '',
      this.bar.sort = '',
      this.bar.time = ''
    },
 
    // 分页点击
    onPage(v) {
      if (v.page === this.paged.page && v.page && !v.reset) {
        return 0;
      }
      this.paged.page = v.page;
      this.paged.limit = v.limit;
      this.init();
    },
 
    init() {
      let v = {
        keyWord:this.bar.keyWord,
        sort:this.bar.sort,
        endTime:this.bar.time ? this.$$moment(this.bar.time[1]).format('YYYY-MM-DD HH:mm:ss') :'',
        startTime:this.bar.time ? this.$$moment(this.bar.time[0]).format('YYYY-MM-DD HH:mm:ss') :'',
        changeType:"2"
      }
      this.$api.post("user/wallet/trade/page", v, (e) => {
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = (e.records || []).map((v) => {
        this.$set(v, 'che', false)
          return v;
        });
      });
    },
 
    cancel() {
      //取消
      this.Change = false;
      this.alls = false
      this.tds.map(item=>{
        item.che = false
      })
    },
 
    getstatistics() {
      let v = {
        changeType:"2"
      }
      this.$api.post("user/wallet/trade/user/statistics", v, (e) => {
        this.Overview = e;
      });
    },
 
    totalNumber() {
      let v = {
        changeType:"2"
      }
      this.$api.post("user/wallet/trade/user/total", v, (e) => {
        this.totalNum = e;
      });
    },
 
      //导出
    exports(v) {
 
      if(!this.ids.length) {
        demo.toast("请勾选需要下载的内容");
        return  
      }
      
      let t = this
      let params = {
        tradeIds:t.ids,
        keyWord:this.bar.keyWord,
        sort:this.bar.sort,
        endTime:this.bar.time[1],
        startTime:this.bar.time[0],
        changeType:"2",
        pageSize:this.paged.limit,
        pageNum:this.paged.page
 
      }
      this.$api.post("user/wallet/trade/export", params, (e) => {
        window.location.href = e;
      });
    },
 
    cheAll () {
      this.Change = !this.Change
      //全选
      this.tds.map(item => {
        item.che = this.alls
      })
      this.change()
    },
 
    change () {
      //单个选择
      this.ids = []
      this.tds.map(item => {
        if (item.che) {
          this.ids.push(item.id)
        } else {
          this.alls = false
        }
      })
    },
 
  },
 
};
</script>
<style scoped lang="less">
.finance-del {
  overflow: scroll;
}
.add {
  text-align: right;
  }
.total-nav {
    height: 50px;
    padding-bottom: 18px;
  .lie {
    float: left;
    margin-right: 40px;
    p {
      line-height: 25px;
    }
    .num {
      font-weight: 700;
    }
  }
}
.bgc_primary {
  margin-bottom: 15px;
}
.total-num{
  padding-bottom: 30px;
  .num {
    font-size:16px;
    font-weight: 700;
    color: #F56C6C;
    margin-right: 60px;
  }
}
.Tips {
    margin: 10px 0;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    background: #e6f7ff;
    border: #bae7ff 1px solid;
    border-radius: 6px;
    height: 40px;
    padding: 0 20px;
  }
  .Tips-cont {
    padding: 0 10px;
    font-size: 16px;
    color: #606266;
  }
  .Tips-cont > span {
    padding: 0 4px;
    color: #409eff;
    font-weight: 600;
  }
</style>