Blame view

admin-web-master/src/views/couponmanagement/couponlist.vue 10.1 KB
084351b6   李宇   1
1
2
  <template>
      <div style="background-color:#f7f7f7;padding:10px 10px;">
8db25941   李宇   2
3
        <div class="couponPage" v-if="type == '1'">
084351b6   李宇   1
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
          <div>
            <div style="height:58px;line-height:58px;">
              <div style="color:#0006"> <span>优惠券管理</span>   <span style="padding:0 5px;">></span>  <span style="color:#000000e6">优惠券列表</span></div>
            </div>
              <!-- 搜索 -->
            <div class="formSearch">
              <!-- 搜索条件 -->
              <el-form :inline="true" :model="query" class="demo-form-inline">
                <el-form-item label="名称">
                  <el-input v-model="query.couponName" placeholder="请输入名称" />
                </el-form-item>
              </el-form>
              <div>
                <el-button style="background-color: #3F9B6A;color: #fff" @click="search">查询</el-button>
                <el-button  class="buttonHover"
                    style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" @click="clear">重置</el-button>
              </div>
            </div>
            <!-- 表格 -->
            <div class="tableBox">
              <el-table
                ref="multipleTable"
                :data="tableData"
a182f238   wesley88   1
27
              :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
084351b6   李宇   1
28
29
30
                tooltip-effect="light"
                
              > 
b1d468f9   李宇   1
31
              <el-table-column label="优惠券名称" >
084351b6   李宇   1
32
33
                  <template slot-scope="scope">{{ scope.row.couponName }}</template>
                </el-table-column>
b1d468f9   李宇   1
34
35
36
                <el-table-column label="资金池">
                  <template slot-scope="scope">{{ scope.row.cereFundsPool?scope.row.cereFundsPool.poolName:'' }}</template>
                </el-table-column>
084351b6   李宇   1
37
38
39
40
41
42
43
44
                <el-table-column label="类型">
                  <template slot-scope="scope">
                    <span v-if="scope.row.couponType == '1'">满减券</span>
                    <span v-else-if="scope.row.couponType == '2'">折扣券</span>
                  </template>
                </el-table-column>
                <el-table-column label="优惠内容">
                  <template slot-scope="scope">
93c8bac5   李宇   1
45
46
                    <span v-if="scope.row.couponType == '1'">满{{Number(scope.row.usageThreshold)/100 }}减{{Number(scope.row.discountContent)/100}}</span>
                    <span v-else-if="scope.row.couponType == '2'">{{scope.row.discountContent}}折 最高减{{Number(scope.row.maxDiscountAmount)/100}}</span>
084351b6   李宇   1
47
48
                  </template>
                </el-table-column>
b1d468f9   李宇   1
49
                <el-table-column label="金额" >
93c8bac5   李宇   1
50
                  <template slot-scope="scope">{{Number(scope.row.totalFunds)/100 }}</template>
b1d468f9   李宇   1
51
52
53
54
                </el-table-column>
                <el-table-column label="数量" >
                  <template slot-scope="scope">{{ scope.row.totalCoupons }}</template>
                </el-table-column>
084351b6   李宇   1
55
56
57
58
59
60
61
62
63
64
65
66
                <el-table-column label="操作" fixed="right">
                  <template slot-scope="scope">
                    <div class="btnList">
                      <div class="tableBtn greens" @click="xq(scope.row)">查看详情</div>
                      <!-- <div class="tableBtn greens"  @click="addcoupon(scope.row)">生成优惠券</div> -->
                    </div>
                  </template>
                </el-table-column>
              </el-table>
              <div style="display: flex;justify-content: space-between;" class="bom">
                <div style="font-size: 14px;">共  <span style="color: #3F9B6A;">{{total}}</span>  项数据</div>
                <el-pagination
8db25941   李宇   2
67
                  :current-page="query.pageNumber+1"
084351b6   李宇   1
68
69
70
71
72
73
74
75
76
77
78
79
80
                  :page-sizes="[10, 20, 50, 100]"
                  :page-size="10"
                  background
                  small
                  layout="prev, pager, next"
                  :total="total"
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange">
                </el-pagination>
              </div>
            </div>
          </div>
        </div>
8db25941   李宇   2
81
82
83
84
85
86
87
88
89
90
      <div class="couponPage" v-show="type == '3'">
        <div style="height:58px;line-height:58px;">
          <div style="color:#0006"> <span>优惠券管理</span> <span style="padding:0 5px;">></span> <span
              style="color:#000000e6">详情</span></div>
        </div>
        <allinfo ref="allinforef" :type="typeinfo" @changetypeinfo="changetypeinfo" />
        <div style="display: flex;">
          <el-button @click="changetype()"  class="buttonHover" style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;" >返回</el-button>
        </div>
      </div>
084351b6   李宇   1
91
92
93
94
95
96
97
      </div>
    </template>
    
    <script>
    import { getcereFundsPoolData,addcereFundsPool,delPool,editPool,batchGenerateCoupons}from '@/api/couponmanagement/couponlist.js'
    import router from '@/router';
    import coupon from './coupon.vue';
8db25941   李宇   2
98
    import allinfo from './allinfo.vue';
084351b6   李宇   1
99
100
101
    export default {
      
      components:{
8db25941   李宇   2
102
        coupon,allinfo
084351b6   李宇   1
103
104
105
      },
      data () {
        return {
8db25941   李宇   2
106
          typeinfo:'2',
084351b6   李宇   1
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
          couponfrom:{
            usedMerchants:'1',
            couponName: '',
            remark: '',
            couponType: '1', // 默认值
            useCategory: '',
            maxDiscountAmount: null,
            usageThreshold: null,
            discountContent: null,
            isPointsRequired: '否', // 默认值
            pointsRequired: null,
            startTime: '',
            endTime: '',
            totalCoupons: null,
            totalFunds: null,
            createTime: ''
          },
          coupoobj:{},
          type:'1',
          query: {
            activityName: '', // 活动名称
            // 活动状态 0-报名未开始 1-报名进行中 2-活动待开始 3-活动进行中 4-活动已结束
            state: '',
8db25941   李宇   2
130
            pageNumber: 0,
084351b6   李宇   1
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
            pageSize: 10
          },
          total: 0,
          tableData: [],
          activityStatusSelect: [
            {
              index: 0,
              label: '未启用',
              value: 0
            },
            {
              index: 1,
              label: '启用中',
              value: 1
            },
            {
              index: 2,
              label: '已关闭',
              value: 2
            },
          ],
          activityVisible: false,
          editForm: false,
          activityDetailVisible: false,
          form: {
            couponName:'',
            contributor:'',
            totalAmount:null,
          }
        }
      },
      created () {
        this.getAll()
      },
      methods: {
8db25941   李宇   2
166
167
168
169
170
171
        changetype() {
          this.type = 1
        },
        changetypeinfo(e) {
          this.typeinfo = e
        },
084351b6   李宇   1
172
        xq(e) {
8db25941   李宇   2
173
174
          console.log(e )
          this.type = '3'
93c8bac5   李宇   1
175
          this.$refs.allinforef.int(e.id,e)
8db25941   李宇   2
176
177
178
179
180
181
182
          // // 跳转路由
          // router.push({
          //   path: '/other/coupon',
          //   query: {
          //     id: e.id
          //   }
          // })
084351b6   李宇   1
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
        },
        addcoupon(e) {
          let that = this
          console.error(e)
          let from = {
            "totalCoupons":e.totalCoupons,          //共多少张优惠券
            "id":e.id,     //优惠券id
            "fundPoolId":e.fundPoolId   //资金池id
          }
          // return
          batchGenerateCoupons(from).then(res=>{
            console.error(res)
            if(res.code == '200') {
              that.$message({
                message: '生成成功',
                type: 'success'
              });
              that.search()
            } else {
              that.$message({
                message: res.message,
                type: 'error'
              });
            }
          })
        },
        async getAll () {
          const res = await getcereFundsPoolData(this.query)
          console.error(res.data.content)
          this.tableData = res.data.content
8db25941   李宇   2
213
          this.total = res.data.totalElements
084351b6   李宇   1
214
215
216
217
218
219
        },
        handleSizeChange (val) {
          this.query.pageSize = val
          this.getAll()
        },
        handleCurrentChange (val) {
8db25941   李宇   2
220
          this.query.pageNumber = val-1
084351b6   李宇   1
221
222
223
224
          this.getAll()
        },
        search () {
          this.total = 1
8db25941   李宇   2
225
          this.query.pageNumber = 0
084351b6   李宇   1
226
227
228
229
230
231
232
          this.getAll()
        },
        // 重置
        clear () {
          this.query = {
            activityName: '',
            state: '',
8db25941   李宇   2
233
            pageNumber: 0,
084351b6   李宇   1
234
235
236
237
238
239
240
241
242
243
244
245
246
            pageSize: 10
          }
          this.getAll()
        },
  
      }
    }
    </script>
    
    <style scoped lang="scss">
      .el-table{
       height: calc(100vh - 280px);
      }
084351b6   李宇   1
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
      .el-form-item {
        margin-bottom: 0;
      }
      ::v-deep .el-dialog__header{
        border-bottom: 2px solid #eee;
        background-color: #fff;
      }
      ::v-deep .el-dialog__title {
        color: #303133;
      }
      .footer{
        font-size: 24px;
        .btn_list {
          display: flex;
          flex-direction: row-reverse;
          span {
            padding: 0;
            margin: 0;
            width: 100px;
            height:32px;
            line-height:32px;
            text-align: center;
            display: inline-block;
            font-size: 16px;
            border-radius: 4px;
            box-sizing: border-box;
            &:hover {
              cursor: pointer;
            }
            &:nth-child(1) {
              background: rgba(255, 255, 255, 1);
              order: 1px solid rgba(224, 229, 235, 1);
              
              border: 1px solid rgba(224, 229, 235, 1);
            }
            &:nth-child(2) {
              background: #3f9b6a;
              color: #fff;
              margin-right: 20px;
            }
          }
        }
      }
    .couponPage{
    
       padding: 0  20px 20px 20px;
       min-height: calc(100vh - 50px - 20px);
       background-color: #Fff;
    
    
      .tableBox{
        text-align: center;
        
        .fenye{
          // margin: 20px;
        }
      }
    }
    .couponDialogBox {
      max-height: 600px;
      overflow-y: auto;
    }
    .formSearch{
    
        display: flex;
        width: 100%;
        font-size: 14px;
        justify-content: space-between;
        padding-bottom: 10px;
        align-items: center;
    
    }
      .tableBtn {
        display: inline-block;
        margin-right: 10px;
      }
    
    .greens {
        color: #3F9B6A;
      }
      ::v-deep .buttonHover:hover{
        color:#3f9b6a !important;
        border-color: #c5e1d2 !important;
        background-color: #ecf5f0 !important;
        outline: none;
      }
      ::v-deep .el-pagination__total {
        position: absolute;
        left: 10px;
      }
      ::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active{
        background-color:#3f9b6a;
      }
    </style>