Blame view

admin-web-master/src/views/online/QRCode/index.vue 9.33 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
  <template>
    <div style="background-color:#f7f7f7;padding:10px 10px;">
      <div class="zhuti">
        <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>
          <!-- 表格 -->
          <div class="tableBox">
60d9bf40   杨鑫   '1'
11
            <el-table ref="multipleTable" :data="tableData"
3f535f30   杨鑫   '初始'
12
              :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
60d9bf40   杨鑫   '1'
13
14
              tooltip-effect="dark">
              <el-table-column label="店铺名称" min-width="220">
3f535f30   杨鑫   '初始'
15
16
                <template slot-scope="scope">{{ scope.row.shopName }}</template>
              </el-table-column>
60d9bf40   杨鑫   '1'
17
18
19
              <el-table-column prop="shopCode" label="店铺编码" min-width="200" />
              <el-table-column prop="chargePersonName" label="负责人" min-width="200" />
              <el-table-column prop="chargePersonPhone" label="联系电话" min-width="200" />
3f535f30   杨鑫   '初始'
20
21
22
23
24
25
              <el-table-column label="合同状态" width="120">
                <template slot-scope="scope">
                  <span v-if="scope.row.contractState === 0">无效</span>
                  <span v-if="scope.row.contractState === 1">有效</span>
                </template>
              </el-table-column>
60d9bf40   杨鑫   '1'
26
              <el-table-column prop="createTime" label="创建时间" min-width="200" />
726bc80b   杨鑫   最新
27
              <el-table-column label="操作" fixed="right" min-width="150">
3f535f30   杨鑫   '初始'
28
                <template slot-scope="scope">
60d9bf40   杨鑫   '1'
29
                  <div class="tableBtn greens" @click="seeMore(scope.row)">
3f535f30   杨鑫   '初始'
30
31
32
33
34
35
36
                    商户静态二维码
                  </div>
                  <!--  <a href="http://116.169.61.30:32019/2023-zfjr/20241101/1730452040529-merchantQrCode.png" class="tableBtn greens" target="_blank">商户静态二维码</a> -->
                </template>
              </el-table-column>
            </el-table>
            <div class="fenye">
726bc80b   杨鑫   最新
37
  			  <div>共{{total}}条</div>
60d9bf40   杨鑫   '1'
38
              <el-pagination :current-page="currentPage" background small :page-sizes="[10, 20, 50, 100]" :page-size="10"
726bc80b   杨鑫   最新
39
                layout=" prev, pager, next" :total="total" @size-change="handleSizeChange"
60d9bf40   杨鑫   '1'
40
                @current-change="handleCurrentChange" />
3f535f30   杨鑫   '初始'
41
42
43
44
            </div>
          </div>
        </div>
      </div>
60d9bf40   杨鑫   '1'
45
      <el-dialog :visible.sync="showQF" custom-class='tongyong_css' style="padding: 0;" width="45%" center
3f535f30   杨鑫   '初始'
46
47
48
49
        :close-on-click-modal="false" :show-close="false">
        <div style="padding:20px;">
          <div style="font-size: 14px;padding-bottom: 20px;color: #000;">商户静态二维码</div>
          <div style="padding:20px;">
60d9bf40   杨鑫   '1'
50
            <!-- <img :src="qfUrl" alt="" style="height:330px;width:50%"> -->
726bc80b   杨鑫   最新
51
            <img src="../../../assets/images/Code.png" alt="" style="height:330px;">
3f535f30   杨鑫   '初始'
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
          </div>
          <!-- <div>
            <el-tabs v-model="xiangTabs">
              <el-tab-pane label="微信" name="first">
                <div style="width: 100%">
                <img src="" alt="">
                </div>
              </el-tab-pane>
              <el-tab-pane label="支付宝" name="second">
                <div style="width: 100%">
  <img src="" alt="">
  
  
                </div>
              </el-tab-pane>
              <el-tab-pane label="聚合" name="there">
                <div style="width: 100%">
  
  <img src="" alt="">
  
                </div>
              </el-tab-pane>
              <el-tab-pane label="其他" name="four">
                <div style="width: 100%">
  <img src="" alt="">
  
                </div>
              </el-tab-pane>
            </el-tabs>
          </div> -->
  
          <div style="padding-top:20px;display:flex;justify-content: flex-end;">
            <el-button class="buttonHover" style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;"
              @click="showQF =false">返回</el-button>
726bc80b   杨鑫   最新
86
87
           <el-button style="background-color: #3F9B6A;color: #fff;" @click="down">下载</el-button>
    <!--        <el-button style="background-color: #3F9B6A;color: #fff;" @click="down">导出</el-button>
60d9bf40   杨鑫   '1'
88
            <el-button style="background-color: #3F9B6A;color: #fff;" @click="down">保存</el-button> -->
3f535f30   杨鑫   '初始'
89
90
91
92
93
94
95
96
          </div>
        </div>
  
      </el-dialog>
    </div>
  </template>
  
  <script>
60d9bf40   杨鑫   '1'
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
    import {
      businessListGetAll,
      businessListSave,
      businessListGetById,
      businessListUpdate,
      businessListStart,
      delBusinessById
    } from '@/api/business'
    import {
      MerchantQRcode
    } from '../../../api/online.js'
    export default {
      name: 'atmosphereGl',
      data() {
        return {
          rules: {},
          currentPage: 1,
          total: 100,
          flag: false,
          pageSize: 10,
          ggXin: false,
          index: 1,
          tableData: [],
          formInline: {
            shopName: '', // 店铺名称
            shopCode: '', // 店铺编码
            chargePersonName: '', // 店铺负责人
            contractState: '', // 合同状态 1-有效 0-无效
            page: '1', // 当前页
            pageSize: '10' // 每页记录数
          },
          showQF: false,
          xiangTabs: 'first',
          qfUrl: ''
        }
3f535f30   杨鑫   '初始'
132
      },
60d9bf40   杨鑫   '1'
133
134
135
136
137
138
      computed: {},
      mounted() {
        this.getAll(this.formInline)
        // this.privacyTime = localStorage.getItem('privacyTime')
        // console.log(this.privacyTime)
        // this.getZiyuan()
3f535f30   杨鑫   '初始'
139
      },
60d9bf40   杨鑫   '1'
140
141
142
143
144
      methods: {
        async getAll(formInline) {
          const res = await businessListGetAll(formInline)
          this.total = res.data.total
          this.tableData = res.data.list
3f535f30   杨鑫   '初始'
145
  
60d9bf40   杨鑫   '1'
146
147
        },
        onSubmit() {
3f535f30   杨鑫   '初始'
148
  
60d9bf40   杨鑫   '1'
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
        },
        handleSizeChange() {
  
        },
        handleCurrentChange(val) {
          this.currentPage = val
          this.formInline.page = val
          this.getAll(this.formInline)
        },
        seeMore(item) {
          MerchantQRcode({
            appCode: 'ACDWL20240528003',
            id: '9E602E5977EC48DEA06D42C67F4C93F0'
          }).then(res => {
            this.qfUrl = res.data
          })
          this.showQF = true
        },
        down() {
          this.downloadImage(this.qfUrl, '二维码')
        },
        async downloadImage(imageUrl, filename) {
            const response = await fetch(imageUrl);
            if (!response.ok) {
              throw new Error(`图片未找到: ${response.statusText}`);
            }
            const blob = await response.blob();
            const url = window.URL.createObjectURL(blob);
            const a = document.createElement('a');
            a.href = url;
            a.download = filename;
            document.body.appendChild(a);
            a.click();
            a.remove();
            window.URL.revokeObjectURL(url);
        },
        // downloadImage(src, name) {
        //   // 参数src为图片地址,name为下载时图片的名称
        //   var image = new Image()
        //   // 解决跨域 Canvas 污染问题
        //   image.setAttribute("crossOrigin", "anonymous")
        //   image.onload = function() {
        //     var canvas = document.createElement("canvas")
        //     canvas.width = image.width
        //     canvas.height = image.height
  
        //     var context = canvas.getContext("2d")
        //     context.drawImage(image, 0, 0, image.width, image.height)
        //     var url = canvas.toDataURL("image/png")
  
        //     // 生成一个a元素
        //     var a = document.createElement("a")
        //     // 创建一个单击事件
        //     var event = new MouseEvent("click")
  
        //     // 将a的download属性设置为我们想要下载的图片名称,若name不存在则使用‘下载图片名称’作为默认名称
        //     a.download = name || "图片"
        //     // 将生成的URL设置为a.href属性
        //     a.href = url
  
        //     // 触发a的单击事件
        //     a.dispatchEvent(event)
        //   }
        //   image.src = src
        // },
      }
3f535f30   杨鑫   '初始'
215
    }
3f535f30   杨鑫   '初始'
216
217
  </script>
  
60d9bf40   杨鑫   '1'
218
219
  <style scoped>
    .zhuti {
3f535f30   杨鑫   '初始'
220
221
222
223
224
225
      padding: 0 20px 20px 20px;
      min-height: calc(100vh - 50px - 20px);
      background-color: #Fff;
      position: relative;
    }
  
60d9bf40   杨鑫   '1'
226
227
228
    /deep/ .el-form-item__content {
      line-height: 0;
    }
d64cd58f   wesley88   上传验收小程序
229
  
60d9bf40   杨鑫   '1'
230
231
232
233
    .tableBtn {
      display: inline-block;
      margin-right: 10px;
    }
3f535f30   杨鑫   '初始'
234
  
60d9bf40   杨鑫   '1'
235
236
237
238
239
240
    ::v-deep .formSearch {
      position: relative;
      margin-bottom: 20px;
      display: flex;
      width: 100%;
      height: 30px;
3f535f30   杨鑫   '初始'
241
      font-size: 14px;
60d9bf40   杨鑫   '1'
242
243
244
245
246
247
248
249
      justify-content: space-between;
  
      .el-form-item__label {
        line-height: 28px;
        font-size: 14px;
        color: #000;
        font-weight: 100;
      }
3f535f30   杨鑫   '初始'
250
    }
60d9bf40   杨鑫   '1'
251
252
253
254
255
256
257
258
259
  
    .greens {
      color: #3F9B6A;
    }
  
  
    .fenye {
      margin-top: 20px;
      display: flex;
726bc80b   杨鑫   最新
260
      justify-content: space-between;
60d9bf40   杨鑫   '1'
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
      position: relative;
    }
  
    /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
      background-color: #3F9B6A;
    }
  
    .el-row {
      margin-bottom: 20px;
    }
  
    :last-child {
      margin-bottom: 0;
    }
  
    .el-col {
      border-radius: 4px;
    }
  
    .bg-purple-dark {
      background: #99a9bf;
    }
  
    .bg-purple {
      background: #d3dce6;
    }
  
    .bg-purple-light {
      background: #e5e9f2;
    }
  
    .grid-content {
      border-radius: 4px;
      min-height: 36px;
    }
  
    .row-bg {
      padding: 10px 0;
      background-color: #f9fafc;
    }
  
    /deep/ .bg-purple[data-v-0e3fe4ec] {
      background: #fff;
      height: 50px;
    }
  
    /deep/ .el-form--label-top .el-form-item__label {
      padding: 0;
    }
  
    .demo-input-suffix {
      display: flex;
      margin-right: 20px;
    }
  
    .pagination {
      text-align: right;
      line-height: 20px;
    }
  
60d9bf40   杨鑫   '1'
321
  
3f535f30   杨鑫   '初始'
322
323
324
325
326
327
    ::v-deep .buttonHover:hover {
      color: #3f9b6a !important;
      border-color: #c5e1d2 !important;
      background-color: #ecf5f0 !important;
      outline: none;
    }
3f535f30   杨鑫   '初始'
328
  </style>