doum
12 小时以前 c261cb7ff2e4cfce233d02c6aca9e8f85e8ba1ba
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
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
<template>
  <GlobalWindow
      :title="title"
      width="100%"
      :visible.sync="visible"
  >
    <div style="display: block;">
      <div class="platgroup_tabs">
        <div class="tab" :class="{ active: activeGroup === item.id }" @click="groupClick(item)"
             v-for="(item, i) in groupList" :key="i">
          {{ item.name }}
        </div>
      </div>
    </div>
    <template v-if="activeGroup ==0">
      <div style="display: block;">
        <div class="header">
          <div  class="header-b">基本信息</div>
          <div v-if="info.status !=1" class="header-green">正常</div>
          <div v-if="info.status ==1" class="header-red">禁用</div>
        </div>
        <div class="info-item">
          <div class="info-item-a">经销商名称:<span>{{info.name || ''}}</span><span class="blue header-blue">{{ info.saleType == 1?'自由采购':'平台铺货'}}</span></div>
          <div class="info-item-a">门店ID:<span>{{info.code || ''}}</span></div>
          <div class="info-item-a">登录账号:<span>{{info.username || ''}}</span></div>
        </div>
        <div class="info-item">
          <div class="info-item-a">所属地区:<span>{{info.bigAreaName || ''}}</span></div>
          <div class="info-item-a">省市区:<span v-if="info.areas">{{(info.areas.provinceName||'') + (info.areas.cityName||'') + (info.areas.name||'')}}</span></div>
          <div class="info-item-a">详细地址:<span>{{info.addr || ''}}</span></div>
        </div>
        <div class="info-item">
          <div class="info-item-a">联系人:<span>{{info.realname || ''}}</span></div>
          <div class="info-item-a">手机号:<span>{{info.phone || ''}}</span></div>
          <div class="info-item-a">创建时间:<span>{{info.createDate || ''}}</span></div>
        </div>
        <div class="info-item">
          <div class="info-item-a">定位信息:<span>经度:{{info.longitude  || '-'}} 维度:{{info.latitude|| '-'}}</span></div>
          <div class="info-item-a">营业时间:<span>{{info.startTime || ''}}</span></div>
          <div class="info-item-a"></div>
        </div>
        <div class="info-item">
          <div class="info-item-a">门头图:
            <div> <el-image v-if="info.imgurlfull" style="margin-left: 100px; width: 100px; height: 100px; border-radius: 2px;" :src="info.imgurlfull" :preview-src-list="[info.imgurlfull]"></el-image></div>
          </div>
          <div class="info-item-a"></div>
          <div class="info-item-a"></div>
        </div>
        <div class="info-item"></div>
      </div>
      <div style="display: block">
        <div class="header">
          <div  class="header-b">资质信息</div>
        </div>
        <div class="info-item">
          <div class="info-item-a">法人姓名:<span>{{info.legalPersonName || ''}}</span></div>
          <div class="info-item-a">联系电话:<span>{{info.legalPersonPhone || ''}}</span></div>
          <div class="info-item-a"></div>
        </div>
        <div class="info-item">
          <div class="info-item-a"> 身份证:
            <div style="display: inline-block;width: 300px;margin-left: 100px;">
              <el-image v-if="info.idcardImg" style="width: 100px; height: 100px; border-radius: 2px;display: inline-block;"
                        :src="info.imgFullUrl +info.idcardImg"
                        :preview-src-list="[info.imgFullUrl +info.idcardImg]"></el-image>
              <el-image v-if="info.idcardImgBack" style="margin-left:10px;width: 100px; height: 100px; border-radius: 2px;display: inline-block;"
                        :src="info.imgFullUrl +info.idcardImgBack"
                        :preview-src-list="[info.imgFullUrl +info.idcardImgBack]"></el-image>
            </div>
          </div>
          <div class="info-item-a">营业执照:
            <div  style="display: inline-block;width: 300px;margin-left: 100px;">
              <el-image v-if="info.businessImg" style="width: 100px; height: 100px; border-radius: 2px;"
                        :src="info.imgFullUrl +info.businessImg"
                        :preview-src-list="[info.imgFullUrl +info.businessImg]"></el-image>
            </div>
          </div>
          <div class="info-item-a"></div>
        </div>
        <div class="info-item"></div>
      </div>
      <div style="display: block;margin-bottom: 50px;">
        <div class="header">
          <div  class="header-b">销售模式变更记录</div>
        </div>
        <TableLayout >
          <!-- 表格和分页 -->
          <template v-slot:table-wrap>
            <el-table
                v-loading="isWorking.search0"
                :data="tableData0.list"
                stripe
                border
            >
              <el-table-column prop="type" label="变更类型" fixed align="center" min-width="150px">销售模式</el-table-column>
              <el-table-column prop="beforeInfo" label="变更前" fixed align="center" min-width="150px">  </el-table-column>
              <el-table-column prop="afterInfo" label="变更后" fixed align="center" min-width="150px">  </el-table-column>
              <el-table-column prop="remark" label="备注" align="center" min-width="300px"></el-table-column>
              <el-table-column prop="createName" label="操作人" align="center" min-width="100px"></el-table-column>
              <el-table-column prop="createDate" label="操作时间" align="center" min-width="150px"></el-table-column>
            </el-table>
            <pagination
                @size-change="handleSizeChange0"
                @current-change="handlePageChange0"
                :pagination="tableData0.pagination"
            >
            </pagination>
          </template>
        </TableLayout>
      </div>
    </template>
    <template v-else-if="activeGroup == 1">
      <div style="display: block;">
        <el-form ref="searchForm1"   :model="searchForm1"    style="display: block;" >
          <el-form-item label="" prop="code" style="display: inline-block;margin-right: 30px;">
            <el-input v-model="searchForm1.code" placeholder="请输入订单号" @keypress.enter.native="handlePageChange1(1)"></el-input>
          </el-form-item>
          <el-form-item label="" prop="goodsName" style="display: inline-block;margin-right: 30px;">
            <el-input v-model="searchForm1.goodsName" placeholder="请输入商品名称/编码" @keypress.enter.native="handlePageChange1(1)"></el-input>
          </el-form-item>
          <el-form-item label="" prop="status" style="display: inline-block;margin-right: 30px;">
            <!-- 0正常 1禁用 -->
            <el-select     v-model="searchForm1.status"  placeholder="请选择订单状态"  @change="handlePageChange1(1)"  >
              <el-option  :key="0" :value="0"  label="待支付"  ></el-option>
              <el-option   :key="1" :value="1" label="待发货/待自提"  ></el-option>
              <el-option   :key="2" :value="2" label="待收货"  ></el-option>
              <el-option   :key="3" :value="3" label="交易完成"  ></el-option>
              <el-option   :key="4" :value="4" label="已关闭"  ></el-option>
            </el-select>
          </el-form-item>
          <div class="date-style" style="display: inline-block;font-size: 14px;margin-right: 20px;">订单时间:
            <el-form-item label="" prop="starttime" style="display: inline-block" >
              <el-date-picker
                  style="width: 160px; "
                  v-model="searchForm1.starttime"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  format="yyyy-MM-dd HH:mm:ss"
                  range-separator="至"
                  placeholder="开始时间"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="" label-width="10px" prop="endtime" style="display: inline-block"  >
              <el-date-picker
                  style="width: 160px; "
                  v-model="searchForm1.endtime"
                  type="datetime"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  format="yyyy-MM-dd HH:mm:ss"
                  range-separator="至"
                  placeholder="截止时间"
              ></el-date-picker>
            </el-form-item>
          </div>
          <section style="display: inline">
            <el-button type="primary" @click="handlePageChange1(1)">搜索</el-button>
            <el-button @click="reset1(1)">重置</el-button>
          </section>
        </el-form>
      </div>
      <div style="display: block;margin-bottom: 50px;">
        <TableLayout >
          <!-- 表格和分页 -->
          <template v-slot:table-wrap>
            <div style="float: left; margin-bottom: 20px;width:50%;">
              <div class="info-item">
                <div class="info-item-a">订单数:<span>{{totalData.orderCount || 0}}</span></div>
                <div class="info-item-a">商品数量:<span>{{totalData.goodsNum || 0}}</span></div>
                <div class="info-item-a">商品总价:<span>¥{{totalData.orderMoneyCount || 0}}</span></div>
              </div>
            </div>
            <el-table
                v-loading="isWorking.search2"
                :data="tableData1.list"
                stripe
                border
            >
              <el-table-column prop="code" label="订单编号"   align="center" min-width="120px" show-overflow-tooltip>  </el-table-column>
              <el-table-column prop="details" label="商品信息"   align="center" min-width="250px" show-overflow-tooltip>
                <template slot-scope="{row}">
                  <div v-if="row.goodsorderDetailList && row.goodsorderDetailList.length"  style="width: 220px">
                      <div v-for="(item) in row.goodsorderDetailList" style="display: flex">
                        <div style="flex: 1">【{{item.name}}】</div><div style="flex: 1">销售价:{{item.price||0}} 数量:{{item.goodsNum||0}}</div>
                      </div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column prop="price" label="商品总价(元)" align="center" min-width="100px">
                <template slot-scope="{row}">
                   {{(row.totalPrice || 0) - (row.mailPrice||0)}}
                </template>
              </el-table-column>
              <el-table-column prop="mailPrice" label="运费(元)" align="center" min-width="100px"></el-table-column>
              <el-table-column prop="totalPrice" label="订单总价(元)" align="center" min-width="100px"></el-table-column>
              <el-table-column prop="couponPrice" label="优惠金额(元)" align="center" min-width="100px">
                <template slot-scope="{row}">
                  {{(row.couponPrice || 0) + (row.integral||0)}}
                </template>
              </el-table-column>
              <el-table-column prop="price" label="实付价格(元)" align="center" min-width="200px"></el-table-column>
              <el-table-column prop="shopSettlement" label="应结算金额(元)" align="center" min-width="150px"></el-table-column>
              <el-table-column prop="returnMemberIntegral" label="返用户积分" align="center" min-width="150px"></el-table-column>
              <el-table-column prop="returnCustomerIntegral" label="返经销商积分" align="center" min-width="150px"></el-table-column>
              <el-table-column prop="payDate" label="支付时间" align="center" min-width="200px"></el-table-column>
              <el-table-column prop="receiveType"  label="取货方式" align="center" min-width="150px">
                <template slot-scope="{row}">
                  <span v-if="row.receiveType  === 0" class="green">配送</span>
                  <span v-else class="red">自提</span>
                </template>
              </el-table-column>
              <el-table-column prop="createDate" label="创建时间" align="center" min-width="200px"></el-table-column>
            </el-table>
            <pagination
                @size-change="handleSizeChange1"
                @current-change="handlePageChange1"
                :pagination="tableData1.pagination"
            >
            </pagination>
          </template>
        </TableLayout>
      </div>
    </template>
    <template v-else-if="activeGroup == 2">
      <div style="display: block;margin-bottom: 50px;">
        <div class="header">
          <div  class="header-b">积分明细</div>
          <div  class="header-btn">
            <el-button style="display: inline" type="primary" @click="changeIntegral">积分调整</el-button>
          </div>
        </div>
        <TableLayout >
          <!-- 表格和分页 -->
          <template v-slot:table-wrap>
            <div >
              <div style="float: left; margin-bottom: 20px;width:50%;">
                <div class="info-item">
                  <div class="info-item-a">现有积分:<span>{{info.integral || 0}}</span></div>
                  <div class="info-item-a">累计积分:<span>{{info.totalIntegral || 0}}</span></div>
                </div>
              </div>
              <div style="float: right; margin-bottom: 20px;">
                <el-select  v-model="searchForm2.type"  placeholder="全部"  clearable @change="handlePageChange2(1)" style="width: 120px;" >
                  <el-option  :key="0" :value="0"  label="获得"  ></el-option>
                  <el-option   :key="1" :value="1" label="扣除"  ></el-option>
                </el-select>
                <el-button @click="handlePageChange2(1)" type="点击刷新"  icon="el-icon-refresh"  style="margin-left: 10px;" ></el-button>
              </div>
            </div>
            <el-table
                v-loading="isWorking.search2"
                :data="tableData2.list"
                stripe
                border
            >
              <el-table-column prop="type"  label="获得/扣除" align="center" min-width="150px">
                <template slot-scope="{row}">
                  <span v-if="row.type==0" class="green">获得</span>
                  <span v-else class="red">扣除</span>
                </template>
              </el-table-column>
              <el-table-column prop="num" label="数量" fixed align="center" min-width="100px">  </el-table-column>
              <el-table-column prop="totalNum" label="余额" fixed align="center" min-width="100px">  </el-table-column>
              <el-table-column prop="strObjType" label="消费类型" align="center" min-width="100px"></el-table-column>
              <el-table-column prop="content" label="来源" align="center" min-width="150px" show-overflow-tooltip></el-table-column>
              <el-table-column prop="remark" label="备注" align="center" min-width="200px"></el-table-column>
              <el-table-column prop="orderCode" label="关联订单" align="center" min-width="150px"></el-table-column>
              <el-table-column prop="createDate" label="变动时间" align="center" min-width="200px"></el-table-column>
            </el-table>
            <pagination
                @size-change="handleSizeChange2"
                @current-change="handlePageChange2"
                :pagination="tableData2.pagination"
            >
            </pagination>
          </template>
        </TableLayout>
      </div>
    </template>
    <template  v-slot:footer>
      <el-button @click="visible=false">返回</el-button>
    </template>
    <OperaChangeShopRecordWindow ref="OperaChangeShopRecordWindow"/>
    <OperaChangeIntegralWindow ref="OperaChangeIntegralWindow" @success="successBiz"/>
  </GlobalWindow>
</template>
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaChangeShopRecordWindow from '@/components/business/OperaChangeShopRecordWindow'
import OperaChangeIntegralWindow from '@/components/business/OperaChangeIntegralWindow'
import { shopDetail as detail } from '@/api/business/shop'
import { fetchList as actionList } from '@/api/business/userAction'
import { fetchList as integralList } from '@/api/business/integral'
import { fetchShopList as orderList } from '@/api/business/goodsorder'
export default {
  name: 'OperaShopInfoWindow',
  extends: BaseTable,
  components: { GlobalWindow, TableLayout, Pagination, OperaChangeShopRecordWindow, OperaChangeIntegralWindow },
  data () {
    return {
      title: '',
      visible: false,
      tabelHeight: null,
      activeGroup: -1,
      groupList: [{ id: 0, name: '基本信息' }, { id: 1, name: '销售信息' }, { id: 2, name: '积分信息' }],
      info: {},
      // 搜索
      searchForm1: {
        distributionShopId: '',
        goodsName: null,
        code: null,
        status: null,
        starttime: null,
        endtime: null
      },
      searchForm2: {
        memberId: '',
        userType: 1,
        type: null
      },
      isWorking: {
        search0: false,
        search1: false,
        search2: false
      },
      tableData0: {
        // 已选中的数据
        selectedRows: [],
        // 排序的字段
        sorts: [],
        // 当前页数据
        list: [],
        // 分页
        pagination: {
          pageIndex: 1,
          pageSize: 10,
          total: 0
        }
      },
      totalData: {},
      tableData1: {
        // 已选中的数据
        selectedRows: [],
        // 排序的字段
        sorts: [],
        // 当前页数据
        list: [],
        // 分页
        pagination: {
          pageIndex: 1,
          pageSize: 10,
          total: 0
        }
      },
      tableData2: {
        // 已选中的数据
        selectedRows: [],
        // 排序的字段
        sorts: [],
        // 当前页数据
        list: [],
        // 分页
        pagination: {
          pageIndex: 1,
          pageSize: 10,
          total: 0
        }
      }
    }
  },
 
  created () {
    this.config({
      module: '用户信息表',
      api: '/business/integral',
      'field.id': 'id',
      'field.main': 'id'
    })
  },
  methods: {
    groupClick (item) {
      this.activeGroup = item.id
      if (this.activeGroup === 2) {
        this.handlePageChange2(1)
      } else if (this.activeGroup === 1) {
        this.handlePageChange1(1)
      } else {
        this.handlePageChange0(1)
      }
    },
    successBiz () {
      this.handlePageChange2(1)
      this.loadInfo()
      this.$emit('success')
    },
    loadInfo () {
      detail(this.info.id).then(res => {
        this.info = res || this.info
      })
    },
    showChangeRecord () {
      if (this.info) {
        this.$refs.OperaChangeShopRecordWindow.open('客户经销商变更记录', this.info)
      }
    },
    changeIntegral () {
      if (this.info) {
        this.$refs.OperaChangeIntegralWindow.open('经销商积分调整', this.info, 1)
      }
    },
    open (title, info) {
      this.title = title
      this.visible = true
      this.info = info
      this.activeGroup = 0
      this.searchForm1.distributionShopId = info.id
      this.searchForm2.memberId = info.id
      this.tableData0.list = []
      this.tableData1.list = []
      this.tableData2.list = []
      if (this.info.imgurl) {
        this.info.imgurlfull = this.info.imgFullUrl + this.info.imgurl
      }
      this.handlePageChange0(1)
      this.totalData = {}
    },
    reset1 () {
      this.$refs.searchForm1.resetFields()
      this.handlePageChange1(1)
    },
    handleSizeChange0 (pageSize) {
      this.tableData0.pagination.pageSize = pageSize
      this.search0()
    },
    // 页码变更处理
    handlePageChange0 (pageIndex) {
      this.tableData0.pagination.pageIndex = pageIndex || this.tableData0.pagination.pageIndex
      this.isWorking.search0 = true
      actionList({
        page: this.tableData0.pagination.pageIndex,
        capacity: this.tableData0.pagination.pageSize,
        model: { type: 1, memberId: this.info.id }, // 销售模式变更
        sorts: this.tableData0.sorts
      })
        .then(data => {
          this.tableData0.list = data.records
          this.tableData0.pagination.total = data.total
        })
        .catch(e => {
          this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search0 = false
        })
    },
    handleSizeChange1 (pageSize) {
      this.tableData1.pagination.pageSize = pageSize
      this.handleSizeChange1()
    },
    // 页码变更处理
    handlePageChange1 (pageIndex) {
      this.tableData1.pagination.pageIndex = pageIndex || this.tableData1.pagination.pageIndex
      this.isWorking.search1 = true
      orderList({
        page: this.tableData1.pagination.pageIndex,
        capacity: this.tableData1.pagination.pageSize,
        model: this.searchForm1, // 销售模式变更
        sorts: this.tableData1.sorts
      })
        .then(data => {
          this.tableData1.list = data.records
          this.tableData1.pagination.total = data.total
          if (this.tableData1.pagination.pageIndex === 1) {
            this.totalData = data.countData || {}
          }
        })
        .catch(e => {
          this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search1 = false
        })
    },
    handleSizeChange2 (pageSize) {
      this.tableData2.pagination.pageSize = pageSize
      this.handleSizeChange2()
    },
    // 页码变更处理
    handlePageChange2 (pageIndex) {
      this.tableData2.pagination.pageIndex = pageIndex || this.tableData2.pagination.pageIndex
      this.isWorking.search2 = true
      integralList({
        page: this.tableData2.pagination.pageIndex,
        capacity: this.tableData2.pagination.pageSize,
        model: this.searchForm2, // 销售模式变更
        sorts: this.tableData2.sorts
      })
        .then(data => {
          this.tableData2.list = data.records
          this.tableData2.pagination.total = data.total
        })
        .catch(e => {
          this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search2 = false
        })
    }
  }
}
</script>
<style lang="scss"  scoped>
.platgroup_tabs {
  flex: 1;
  display: flex;
  border-bottom: 1px solid #dfe2e8;
  margin-bottom: 30px;
  .tab {
    color: #666666;
    margin-right: 40px;
    cursor: pointer;
    padding-bottom: 10px;
    border-bottom: 2px solid #fff;
  }
 
  .active {
    font-weight: 500;
    font-size: 15px;
    color: #216EEE;
    border-bottom: 2px solid #216EEE;
  }
}
.table-pagination{
  position: fixed !important;
  bottom: 50px;
}
.header-b{
  display: inline-block;
  font-size: 16px;
  font-weight: bold;
}
.header-green{
  display: inline-block;
  font-size: 12px;
  border: 1px solid green;
  padding: 2px 10px;
  margin-left: 20px;
  color: green;
  border-radius: 5px ;
}
.header-red{
  display: inline-block;
  font-size: 12px;
  border: 1px solid red;
  padding: 2px 10px;
  margin-left: 20px;
  color: red;
  border-radius: 5px ;
}
.header-blue{
  display: inline-block;
  font-size: 12px;
  border: 1px solid #216EEE;
  padding: 2px 10px;
  margin-left: 20px;
  color: #216EEE;
  border-radius: 5px ;
}
.header-btn{
  display: inline-block;
  border: none;
  padding: 2px 10px;
  margin-left: 20px;
}
.info-item{
  display: flex;
  width: 100%;
  margin: 15px;
}
.info-item-a{
  flex: 1;
  font-size: 14px;
 
}
.info-item-a span{
  font-weight: 600;
}
.info-item-a  .btn{
  font-size: 12px !important;
  cursor: pointer !important;
}
</style>