store.vue 31.7 KB
Newer Older
xd's avatar
xd committed
1
<template>
xd's avatar
xd committed
2
  <div class="main">
3
    <div class="title">全部品牌( 共{{zcache.page.allItem}}个 )</div>
4
    <!-- 搜索区 -->
xd's avatar
xd committed
5 6
    <div class="searchs">
      <div class="buttons">
Z's avatar
Z committed
7
        <el-button class="button buttonlight" size="small" @click="addStore">添加品牌</el-button>
Z's avatar
Z committed
8
        <el-button class="button buttondark" size="small" @click="storeDelStoreArr">批量删除</el-button>
xd's avatar
xd committed
9 10
      </div>

11
      <el-form class="searchzone" :inline="true" :model="data.search" label-width="auto">
xd's avatar
xd committed
12 13 14
        <el-form-item label="关键词">
          <el-input
            size="small"
15
            v-model="zdata.searchPost.keywords"
xd's avatar
xd committed
16 17 18 19
            style="width:160px"
            placeholder="请输入关键词"
          />
        </el-form-item>
20 21 22 23 24 25
        <el-button
          class="button buttondark"
          size="small"
          @click="storeSearch"
          style="margin-top:4px;"
        >搜索</el-button>
xd's avatar
xd committed
26 27
      </el-form>
    </div>
28
    <!-- 列表区 -->
xd's avatar
xd committed
29 30 31 32 33
    <div class="lists">
      <el-table
        stripe
        class="list"
        ref="multipleTable"
34
        :data="list.main"
xd's avatar
xd committed
35
        tooltip-effect="dark"
36
        style="width: 100%"
xd's avatar
xd committed
37
        @selection-change="listPick"
xd's avatar
xd committed
38
        height="calc(100vh - 360px)"
xd's avatar
xd committed
39 40
      >
        <el-table-column type="selection" width="60"></el-table-column>
Z's avatar
Z committed
41 42 43 44 45 46
        <el-table-column prop="adminStall.name" label="品牌名称" align="center"></el-table-column>
        <el-table-column prop="adminStall.type" label="品牌类型" align="center" width="120"></el-table-column>
        <el-table-column prop="adminStall.principal" label="品牌负责人" align="center" width="120"></el-table-column>
        <el-table-column prop="shopName" label="所属柜组" align="center" width="120"></el-table-column>
        <el-table-column prop="adminStall.location" label="位置" align="center" width="120"></el-table-column>
        <el-table-column prop="adminStall.signNum" label="门牌号" align="center" width="120"></el-table-column>
xd's avatar
xd committed
47 48
        <el-table-column label="操作" align="center" fixed="right" width="200">
          <template slot-scope="scope">
Z's avatar
Z committed
49 50 51
            <el-button type="text" @click="storeGetStoreDetail(scope.row.adminStall.id)" class="btn">详情</el-button>
            <el-button type="text" @click="storeEditStore(scope.row.adminStall.id)" class="btn">编辑</el-button>
            <el-button type="text" @click="storeDelStore(scope.row.adminStall.id)" class="listButtonRed">删除</el-button>
xd's avatar
xd committed
52 53 54 55
          </template>
        </el-table-column>
      </el-table>
    </div>
Z's avatar
Z committed
56

xd's avatar
xd committed
57 58
    <div class="pages">
      <el-pagination
Z's avatar
Z committed
59
        @current-change="storePageIndexChange"
Z's avatar
Z committed
60 61
        :current-page="zcache.page.nowPage"
        :page-size="zcache.page.pageSize"
62
        layout="total, prev, pager, next, jumper"
Z's avatar
Z committed
63
        :total="zcache.page.allItem"
64
      ></el-pagination>
xd's avatar
xd committed
65
    </div>
Z's avatar
Z committed
66

xd's avatar
xd committed
67
    <add-store ref="addStore"></add-store>
68
    <store-detail ref="storeDetail"></store-detail>
Z's avatar
Z committed
69

70
    <!-- 对话框区 -->
Z's avatar
Z committed
71
    <div class="ztask-dialogs">
Z's avatar
Z committed
72
      <!-- New -->
Z's avatar
Z committed
73
      <el-dialog
Z's avatar
Z committed
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
        title="新建品牌"
        :visible.sync="zcache.status.newDialog"
        width="65%"
        :before-close="dialogNewClose"
      >
        <div class="dialogMain">
          <!-- <el-form :model="zdata.post" label-width="auto" ref="addStore" :rules="zrule"> -->
          <el-form
            :model="zdata.newPost"
            label-width="auto"
            ref="newStore"
            style="border: 0px solid red;"
          >
            <!-- <el-form :model="zdata.post" label-width="auto" ref="createForm" :rules="rules"> -->
            <el-form-item label="品牌名称:" prop="storeName">
              <el-input
                size="small"
                v-model="zdata.newPost.storeName"
                style="width:240px;"
                placeholder="请输入品牌名称"
              />
            </el-form-item>

            <el-form-item label="品牌类型:" prop="storeType">
              <el-select
                size="small"
                v-model="zdata.newPost.storeTypeId"
                placeholder="请选择品牌类型"
                style="width:240px"
              >
                <el-option
                  v-for="item in zlist.storeType"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item label="品牌负责人:" prop="people">
              <el-select
                size="small"
                v-model="zdata.newPost.storeBossId"
                placeholder="请选择品牌负责人"
                style="width:240px"
Z's avatar
Z committed
119
                @change="ztestman"
Z's avatar
Z committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
              >
                <el-option
                  v-for="item in zlist.unGroupMan"
                  :key="item.id"
                  :label="item.userName"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item label="所属柜组:" prop="counter">
              <el-select
                size="small"
                v-model="zdata.newPost.storeFromBarId"
                placeholder="请选择所属柜组"
                style="width:240px"
              >
                <el-option
Z's avatar
Z committed
138
                  v-for="item in zlist.bar"
Z's avatar
Z committed
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
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item label="门牌号:" prop="number">
              <el-input
                size="small"
                v-model="zdata.newPost.storeDoorCode"
                style="width:240px"
                placeholder="请输入门牌号"
              />
            </el-form-item>

            <el-form-item label="位置:" prop="area">
              <el-input
                size="small"
                v-model="zdata.newPost.storeAddress"
                style="width:240px"
                placeholder="请输入位置"
              />
            </el-form-item>
          </el-form>
        </div>

        <span slot="footer" class="dialog-footer">
          <el-button size="small" @click="dialogNewCancel">取 消</el-button>
          <!-- <el-button type="primary" @click="addStoreSubmit('createForm')" size="small">确 定</el-button> -->
          <el-button type="primary" @click="dialogNewSubmit" size="small">确 定</el-button>
        </span>
      </el-dialog>

      <!-- See -->
      <el-dialog
        title="品牌详情"
Z's avatar
Z committed
176 177 178 179 180 181 182 183
        :visible.sync="zcache.status.seeDialog"
        width="50%"
        :before-close="dialogSeeClose"
      >
        <div class="dialogMain">
          <el-form :model="zdata.see" label-width="120px">
            <el-row>
              <el-col :span="24">
Z's avatar
Z committed
184
                <el-form-item label="品牌名称:">
Z's avatar
Z committed
185 186 187 188
                  <el-input
                    :disabled="true"
                    v-model="zdata.see.storeName"
                    autocomplete="off"
Z's avatar
Z committed
189
                    placeholder="品牌名称缺失"
Z's avatar
Z committed
190 191 192 193 194 195
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
Z's avatar
Z committed
196
                <el-form-item label="品牌类型:">
Z's avatar
Z committed
197 198 199 200
                  <el-input
                    :disabled="true"
                    v-model="zdata.see.storeType"
                    autocomplete="off"
Z's avatar
Z committed
201
                    placeholder="品牌类型为空"
Z's avatar
Z committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="所属柜组:">
                  <el-input
                    :disabled="true"
                    v-model="zdata.see.storeFromBar"
                    autocomplete="off"
                    placeholder="柜组信息未知"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
Z's avatar
Z committed
220
                <el-form-item label="品牌负责人:">
Z's avatar
Z committed
221 222 223 224
                  <el-input
                    :disabled="true"
                    v-model="zdata.see.storeBossName"
                    autocomplete="off"
Z's avatar
Z committed
225
                    placeholder="品牌负责人未知"
Z's avatar
Z committed
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
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="门牌号:">
                  <el-input
                    :disabled="true"
                    v-model="zdata.see.storeDoorId"
                    autocomplete="off"
                    placeholder="门牌号未知"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="位置:">
                  <el-input
                    :disabled="true"
                    v-model="zdata.see.storeAddress"
                    autocomplete="off"
                    placeholder="位置未知"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
Z's avatar
Z committed
254 255 256 257
            <el-row>
              <el-col :span="24">
                <el-form-item label="店员:">
                  <el-table class="list" :data="zdata.see.storeManList" tooltip-effect="dark">
Z's avatar
Z committed
258
                    <el-table-column type="index" width="50" align="center"></el-table-column>
Z's avatar
Z committed
259 260 261
                    <el-table-column prop="userName" label="品牌名称" align="center"></el-table-column>
                    <el-table-column prop="userId" label="品牌类型" align="center"></el-table-column>
                    <el-table-column prop="mobile" label="品牌类型" align="center"></el-table-column>
Z's avatar
Z committed
262 263 264 265
                  </el-table>
                </el-form-item>
              </el-col>
            </el-row>
Z's avatar
Z committed
266 267
          </el-form>
        </div>
268

Z's avatar
Z committed
269 270 271 272 273
        <span slot="footer" class="dialog-footer">
          <el-button size="small" @click="dialogSeeClose">关 闭</el-button>
          <!-- <el-button size="small" type="primary" @click="dialogSeeSubmitSend('seeForm')">任务下发</el-button> -->
        </span>
      </el-dialog>
274

Z's avatar
Z committed
275
      <!-- Edit -->
276
      <el-dialog
Z's avatar
Z committed
277
        title="编辑品牌"
278 279 280 281 282 283 284 285 286 287 288 289 290
        :visible.sync="zcache.status.editDialog"
        width="65%"
        :before-close="dialogEditClose"
      >
        <div class="dialogMain">
          <!-- <el-form :model="zdata.post" label-width="auto" ref="addStore" :rules="zrule"> -->
          <el-form
            :model="zdata.editPost"
            label-width="auto"
            ref="editStore"
            style="border: 0px solid red;"
          >
            <!-- <el-form :model="zdata.post" label-width="auto" ref="createForm" :rules="rules"> -->
Z's avatar
Z committed
291
            <el-form-item label="品牌名称:" prop="storeName">
292 293 294 295
              <el-input
                size="small"
                v-model="zdata.editPost.storeName"
                style="width:240px;"
Z's avatar
Z committed
296
                placeholder="请输入品牌名称"
297 298 299
              />
            </el-form-item>

Z's avatar
Z committed
300
            <el-form-item label="品牌类型:" prop="storeType">
301 302 303
              <el-select
                size="small"
                v-model="zdata.editPost.storeTypeId"
Z's avatar
Z committed
304
                placeholder="请选择品牌类型"
305 306 307 308 309 310 311 312 313 314 315
                style="width:240px"
              >
                <el-option
                  v-for="item in zlist.storeType"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>

Z's avatar
Z committed
316
            <el-form-item label="品牌负责人:" prop="people">
317 318 319
              <el-select
                size="small"
                v-model="zdata.editPost.storeBossId"
Z's avatar
Z committed
320
                placeholder="请选择品牌负责人"
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
                style="width:240px"
              >
                <el-option
                  v-for="item in zlist.unGroupMan"
                  :key="item.id"
                  :label="item.userName"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item label="所属柜组:" prop="counter">
              <el-select
                size="small"
                v-model="zdata.editPost.storeFromBarId"
                placeholder="请选择所属柜组"
                style="width:240px"
              >
                <el-option
                  v-for="item in zlist.storeFromBarId"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>
            </el-form-item>

            <el-form-item label="门牌号:" prop="number">
              <el-input
                size="small"
                v-model="zdata.editPost.storeDoorCode"
                style="width:240px"
                placeholder="请输入门牌号"
              />
            </el-form-item>

            <el-form-item label="位置:" prop="area">
              <el-input
                size="small"
                v-model="zdata.editPost.storeAddress"
                style="width:240px"
                placeholder="请输入位置"
              />
            </el-form-item>
          </el-form>
        </div>

        <span slot="footer" class="dialog-footer">
          <el-button size="small" @click="dialogEditCancel">取 消</el-button>
          <!-- <el-button type="primary" @click="addStoreSubmit('createForm')" size="small">确 定</el-button> -->
          <el-button type="primary" @click="dialogEditSubmit" size="small">确 定</el-button>
        </span>
      </el-dialog>
Z's avatar
Z committed
374
    </div>
xd's avatar
xd committed
375 376 377
  </div>
</template>
<script>
378 379
import AddStore from "./components/addStore";
import StoreDetail from "./components/storeDetail";
380 381 382
import {
  ApiStoreGetMainList,
  ApiStoreGetStoreDetail,
383 384
  ApiStoreDelStore,
  ApiStoreGetUnGroupManList,
Z's avatar
Z committed
385
  ApiStoreAddStore,
386 387 388
  ApiStoreEditStore,
  ApiStoreGetBarList,
  ApiStoreSearch
389
} from "@api/in/store";
Z's avatar
Z committed
390
import axios from "axios";
391
const zlog = console.log.bind(console);
392

xd's avatar
xd committed
393
export default {
xd's avatar
xd committed
394 395 396 397
  components: {
    AddStore,
    StoreDetail
  },
xd's avatar
xd committed
398 399
  data() {
    return {
400

401 402
      zcache: {
        status: {
Z's avatar
Z committed
403
          newDialog: false,
404
          seeDialog: false,
Z's avatar
Z committed
405 406 407 408 409 410 411
          editDialog: false,
          isSearch: false
        },
        page: {
          allItem: 0,
          pageSize: 10,
          nowPage: 1
Z's avatar
Z committed
412 413
        }
      },
414
      zdata: {
415 416 417
        searchPost: {
          keywords: ""
        },
Z's avatar
Z committed
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
        newPost: {
          storeName: "",
          storeTypeId: "",
          storeBossId: "",
          storeFromBarId: "",
          storeDoorCode: "",
          storeAddress: ""
        },
        newPostDefault: {
          storeName: "",
          storeTypeId: "",
          storeBossId: "",
          storeFromBarId: "",
          storeDoorCode: "",
          storeAddress: ""
        },
Z's avatar
Z committed
434
        see: {
435 436 437 438 439 440
          storeName: "storeName",
          storeType: "storeType",
          storeFromBar: "storeFromBar",
          storeBossName: "storeBossName",
          storeDoorId: "storeDoorId",
          storeAddress: "storeAddress",
Z's avatar
Z committed
441 442
          storeManList: [
            {
Z's avatar
Z committed
443 444 445
              userName: "Alice",
              userId: "wx0001",
              mobile: "110"
Z's avatar
Z committed
446 447
            },
            {
Z's avatar
Z committed
448 449 450
              userName: "Bob",
              userId: "wx0002",
              mobile: "120"
451
            }
Z's avatar
Z committed
452
          ]
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
        },
        edit: {},
        editPost: {
          id: "",
          storeName: "",
          storeTypeId: "",
          storeBossId: "",
          storeFromBarId: "",
          storeDoorCode: "",
          storeAddress: ""
        },
        editPostDefault: {
          id: "",
          storeName: "",
          storeTypeId: "",
          storeBossId: "",
          storeFromBarId: "",
          storeDoorCode: "",
          storeAddress: ""
Z's avatar
Z committed
472 473
        }
      },
Z's avatar
Z committed
474
      zlist: {
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
        listPick: [],
        storeType: [
          {
            id: "0",
            name: "普通"
          },
          {
            id: "1",
            name: "专柜"
          }
        ],
        storeBossId: [
          {
            id: "2001200138020920001",
            name: "王月云"
          },
          {
            id: "2001200138020930002",
            name: "李强"
          }
        ],
        storeFromBarId: [
          {
            id: "2001201134572130000",
            name: "柜组一号"
          },
          {
            id: "2001201135500920000",
            name: "柜组二号"
          }
        ],
506 507
        unGroupMan: [],
        bar: []
Z's avatar
Z committed
508
      },
509

510 511 512 513
      page: {
        currentPage: 1,
        size: 20,
        total: 100
xd's avatar
xd committed
514
      },
xd's avatar
xd committed
515
      list: {
516
        testMain: [
xd's avatar
xd committed
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
          {
            id: "1001",
            taskName: "2019年男装销售任务",
            taskType: "拉新",
            bar: "男装",
            taskContent: "任务内容任务内容任务内容...",
            sendDate: "2019/02/08"
          },
          {
            id: "1002",
            taskName: "2019年男装销售任务",
            taskType: "拉新",
            bar: "男装",
            taskContent: "任务内容任务内容任务内容...",
            sendDate: "2019/02/08"
          },
xd's avatar
xd committed
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
          {
            id: "1003",
            taskName: "2019年男装销售任务",
            taskType: "拉新",
            bar: "男装",
            taskContent: "任务内容任务内容任务内容...",
            sendDate: "2019/02/08"
          },
          {
            id: "1003",
            taskName: "2019年男装销售任务",
            taskType: "拉新",
            bar: "男装",
            taskContent: "任务内容任务内容任务内容...",
            sendDate: "2019/02/08"
          },
549
          {
xd's avatar
xd committed
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
            id: "1003",
            taskName: "2019年男装销售任务",
            taskType: "拉新",
            bar: "男装",
            taskContent: "任务内容任务内容任务内容...",
            sendDate: "2019/02/08"
          },
          {
            id: "1003",
            taskName: "2019年男装销售任务",
            taskType: "拉新",
            bar: "男装",
            taskContent: "任务内容任务内容任务内容...",
            sendDate: "2019/02/08"
          },
xd's avatar
xd committed
565 566 567 568 569 570 571 572 573
          {
            id: "1003",
            taskName: "2019年男装销售任务",
            taskType: "拉新",
            bar: "男装",
            taskContent: "任务内容任务内容任务内容...",
            sendDate: "2019/02/08"
          }
        ],
574
        main: [],
575
        man: [],
xd's avatar
xd committed
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
        search: {
          bar: [
            {
              id: "1",
              name: "全部"
            },
            {
              id: "2",
              name: "测试"
            }
          ],
          taskType: [
            {
              id: "1",
              name: "全部"
            },
            {
              id: "2",
              name: "测试"
            }
          ]
Z's avatar
Z committed
597 598
        },
        listPick: []
xd's avatar
xd committed
599
      },
600
      tableHeight: window.innerHeight * 0.5,
xd's avatar
xd committed
601 602 603 604 605 606 607 608 609 610
      data: {
        search: {
          bar: "",
          taskType: "",
          date: "",
          keys: ""
        },
        page: {
          nowPageNum: 4
        }
Z's avatar
Z committed
611 612
      },
      msgId: "",
613
      detailDialog: false
xd's avatar
xd committed
614 615
    };
  },
Z's avatar
Z committed
616 617 618
  watch: {
    // addStoreDialog() {
    addStoreDialog() {
Z's avatar
Z committed
619 620 621 622
      // if ((this.$refs.addStore.addStoreDialog = false)) {
      //   this.storeGetMainList();
      // }
      
Z's avatar
Z committed
623
    },
Z's avatar
Z committed
624 625 626
    "": {
      handler: function() {},
      deep: true
Z's avatar
Z committed
627 628
    }
  },
629 630 631 632 633
  // created() {
  //   this.storeGetMainList();
  //   zlog('--->Created!')
  // },
  mounted() {
Z's avatar
Z committed
634 635
    // this.storeGetMainList();
    this.storeSearch();
Z's avatar
Z committed
636
    this.storeReadyBarList()
637
    this.storeGetUnGroupManList();
638
  },
xd's avatar
xd committed
639
  methods: {
Z's avatar
Z committed
640 641 642 643 644 645 646 647 648
    storeReadyBarList(){
      ApiStoreGetBarList()
      .then(res => {
        this.zlist.bar = res.data
      })
      .catch(err => {

      })
    },
649 650 651 652 653 654 655 656 657
    storeGetUnGroupManList() {
      let postData = {};

      ApiStoreGetUnGroupManList(postData)
        .then(res => {
          this.zlist.unGroupMan = res.data;
        })
        .catch(err => {});
    },
658
    storeGetBarList() {},
659 660 661 662 663 664
    matchManIdAndManName(inId) {
      let manList = this.list.man;
      let manName = "未知";

      for (let i = 0; i < this.list.man.length; i++) {
        let item = manList[i];
Z's avatar
Z committed
665 666 667 668
        if (item != null && item.id != null) {
          if (item.id == inId) {
            manName = item.userName;
          }
669 670 671 672 673 674 675 676 677 678
        }
      }
      return manName;
    },
    transManIdToManName() {
      let mainList = this.list.main;
      let id = "";
      let name = "";

      for (let i = 0; i < mainList.length; i++) {
Z's avatar
Z committed
679
        if (
Z's avatar
Z committed
680 681
          this.list.main[i].adminStall.principal &&
          this.list.main[i].adminStall.principal != null
Z's avatar
Z committed
682
        ) {
Z's avatar
Z committed
683
          id = this.list.main[i].adminStall.principal;
Z's avatar
Z committed
684
          name = this.matchManIdAndManName(id);
Z's avatar
Z committed
685
          this.list.main[i].adminStall.principal = name;
Z's avatar
Z committed
686
        } else {
Z's avatar
Z committed
687
          this.list.main[i].adminStall.principal = "未知";
Z's avatar
Z committed
688
        }
689 690
      }
    },
691 692
    storeSearch() {
      if (this.zdata.searchPost.keywords == "") {
Z's avatar
Z committed
693 694
        this.zcache.status.isSearch = false;
        this.zcache.page.nowPage = 1;
695 696
        this.storeGetMainList();
      } else {
Z's avatar
Z committed
697 698 699 700 701
        this.zcache.status.isSearch = true;
        let postData = {
          keyWords: this.zdata.searchPost.keywords,
          pageNum: 1
        };
702 703
        ApiStoreSearch(postData)
          .then(res => {
Z's avatar
Z committed
704 705 706
            // let result = [];
            // result.push(res.data.stallInfo);
            // this.list.main = result;
Z's avatar
Z committed
707 708 709 710 711 712 713
            // this.list.main = res.data.list;
            this.list.main = res.data.pageInfo_adminStalls.list;
            this.zcache.page.allItem = Number(
              res.data.pageInfo_adminStalls.total
            );
            this.zcache.page.pageSize = res.data.pageInfo_adminStalls.pageSize;
            this.zcache.page.nowPage = res.data.pageInfo_adminStalls.pageNum;
714 715 716 717
          })
          .catch(err => {});
      }
    },
718
    storeGetMainList() {
719
      // zlog("--->In Get API!");
720
      let postData = {
Z's avatar
Z committed
721
        pageNum: this.zcache.page.nowPage
722
      };
723 724

      ApiStoreGetMainList(postData).then(res => {
Z's avatar
Z committed
725 726 727 728
        // this.list.main = res.data.pageInfo_adminStalls.list[0];
        // this.list.man = res.data.pageInfo_principals.list[0];
        this.list.main = res.data.pageInfo_adminStalls.list;
        this.list.man = res.data.adminStall_principals;
729
        this.transManIdToManName();
Z's avatar
Z committed
730

Z's avatar
Z committed
731 732 733
        this.zcache.page.allItem = Number(res.data.pageInfo_adminStalls.total);
        this.zcache.page.pageSize = res.data.pageInfo_adminStalls.pageSize;
        this.zcache.page.nowPage = res.data.pageInfo_adminStalls.pageNum;
734 735
      });
    },
Z's avatar
Z committed
736 737 738
    storePageIndexChange(inData) {
      console.log("--->page: inData =", inData);
      this.zcache.page.nowPage = inData;
Z's avatar
Z committed
739

Z's avatar
Z committed
740
      if (this.zcache.status.isSearch) {
Z's avatar
Z committed
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
        let postData = {
          keyWords: this.zdata.searchPost.keywords,
          pageNum: inData
        };
        ApiStoreSearch(postData)
          .then(res => {
            // let result = [];
            // result.push(res.data.stallInfo);
            // this.list.main = result;
            // this.list.main = res.data.list;
            this.list.main = res.data.pageInfo_adminStalls.list;
            this.zcache.page.allItem = Number(
              res.data.pageInfo_adminStalls.total
            );
            this.zcache.page.pageSize = res.data.pageInfo_adminStalls.pageSize;
            this.zcache.page.nowPage = res.data.pageInfo_adminStalls.pageNum;
          })
          .catch(err => {});
Z's avatar
Z committed
759 760 761
      } else {
        this.zcache.page.nowPage = inData;
        this.storeGetMainList();
Z's avatar
Z committed
762 763
      }
    },
764
    storeGetStoreDetail(inData) {
765 766
      let postData = {
        isDetail: true,
Z's avatar
Z committed
767 768
        stallId: inData
      };
769 770 771

      ApiStoreGetStoreDetail(postData)
        .then(res => {
Z's avatar
Z committed
772 773
          this.zdata.see.storeName = res.data.adminStall.name;
          this.zdata.see.storeType = res.data.adminStall.type;
Z's avatar
Z committed
774 775
          // this.zdata.see.storeFromBar = res.data.adminStall.shopId;
          this.zdata.see.storeFromBar = res.data.shopName;
Z's avatar
Z committed
776 777 778
          this.zdata.see.storeBossName = res.data.principal.userName;
          this.zdata.see.storeDoorId = res.data.adminStall.signNum;
          this.zdata.see.storeAddress = res.data.adminStall.location;
Z's avatar
Z committed
779
          this.zdata.see.storeManList = res.data.clerks_unselected;
780 781 782 783
        })
        .catch(err => {});

      this.zcache.status.seeDialog = true;
784
    },
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815
    storeEditStore(inData) {
      this.storeGetUnGroupManList();
      this.zdata.editPost.id = Number(inData);

      let postData = {
        isDetail: true,
        stallId: inData
      };

      ApiStoreGetStoreDetail(postData)
        .then(res => {
          this.zdata.edit = res;

          let timeStoreTypeId = "";
          if (res.data.adminStall.type == "普通") {
            timeStoreTypeId = "0";
          } else {
            timeStoreTypeId = "1";
          }

          this.zdata.editPost.storeName = res.data.adminStall.name;
          this.zdata.editPost.storeTypeId = timeStoreTypeId;
          this.zdata.editPost.storeBossId = res.data.adminStall.principal;
          this.zdata.editPost.storeFromBarId = res.data.adminStall.shopId;
          this.zdata.editPost.storeDoorCode = res.data.adminStall.signNum;
          this.zdata.editPost.storeAddress = res.data.adminStall.location;
        })
        .catch(err => {});

      this.zcache.status.editDialog = true;
    },
816
    storeDelStore(inData) {
Z's avatar
Z committed
817 818 819 820 821 822
      let delArr = [];
      delArr.push(String(inData));

      let postData = {
        stallIds: delArr
      };
823

Z's avatar
Z committed
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
      ApiStoreDelStore(postData)
        .then(res => {
          if (res.result == "success") {
            this.$message({
              message: "删除成功",
              type: "success"
            });
            this.storeGetMainList();
          } else {
            this.$message({
              message: "删除失败!",
              type: "error"
            });
          }
        })
        .catch(err => {
          this.$message({
            message: "删除失败!",
            type: "error"
          });
        });
    },
    listPick(inData) {
      this.zlist.listPick = inData;
    },
    storeDelStoreArr() {
      let delArr = this.zlist.listPick;
      let delIdsArr = [];
      for (let i = 0; i < delArr.length; i++) {
        delIdsArr.push(String(delArr[i].id));
      }
855
      let postData = {
Z's avatar
Z committed
856
        stallIds: delIdsArr
857
      };
Z's avatar
Z committed
858

Z's avatar
Z committed
859
      ApiStoreDelStore(postData)
Z's avatar
Z committed
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
        .then(res => {
          if (res.result == "success") {
            this.$message({
              message: "删除成功",
              type: "success"
            });
            this.storeGetMainList();
          } else {
            this.$message({
              message: "删除失败!",
              type: "error"
            });
          }
        })
        .catch(err => {
875
          this.$message({
Z's avatar
Z committed
876 877 878 879
            message: "删除失败!",
            type: "error"
          });
        });
880
    },
881

Z's avatar
Z committed
882 883 884 885 886
    ztestman(inData){
      console.log('--->ManList =', this.zlist.unGroupMan)
      console.log('--->PickId =', inData, ' type =', typeof(inData))
      // this.zdata.newPost.storeBossId = Number(inData)
    },
Z's avatar
Z committed
887 888 889 890 891 892 893 894 895 896 897 898 899
    dialogNewClose() {
      this.zcache.status.newDialog = false;
      this.zdata.newPost = JSON.parse(
        JSON.stringify(this.zdata.newPostDefault)
      );
    },
    dialogNewCancel() {
      this.zcache.status.newDialog = false;
      this.zdata.newPost = JSON.parse(
        JSON.stringify(this.zdata.newPostDefault)
      );
    },
    dialogNewSubmit() {
Z's avatar
Z committed
900
      // console.log('--->PostId =', this.zdata.newPost.storeBossId * 1)
Z's avatar
Z committed
901 902
      let postData = {
        name: this.zdata.newPost.storeName,
Z's avatar
Z committed
903 904 905
        // stallType: Number(this.zdata.newPost.storeTypeId),
        stallType: this.zdata.newPost.storeTypeId,
        principal: this.zdata.newPost.storeBossId,
Z's avatar
Z committed
906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
        shopId: this.zdata.newPost.storeFromBarId,
        signNum: this.zdata.newPost.storeDoorCode,
        location: this.zdata.newPost.storeAddress
      };

      console.log("--->postData =", postData);

      ApiStoreAddStore(postData)
        .then(res => {
          if (res.result == "success") {
            this.$message({
              message: "添加成功",
              type: "success"
            });

            this.zcache.status.newDialog = false;
            this.zdata.newPost = JSON.parse(
              JSON.stringify(this.zdata.newPostDefault)
            );
            this.storeSearch();
          }
        })
        .catch(err => {});
    },

931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952
    dialogEditClose() {
      this.zcache.status.editDialog = false;
      this.zdata.editPost = JSON.parse(
        JSON.stringify(this.zdata.editPostDefault)
      );
    },
    dialogEditCancel() {
      this.zcache.status.editDialog = false;
      this.zdata.editPost = JSON.parse(
        JSON.stringify(this.zdata.editPostDefault)
      );
    },
    dialogEditSubmit() {
      let postData = {
        stallId: Number(this.zdata.editPost.id),
        name: this.zdata.editPost.storeName,
        type: String(this.zdata.editPost.storeTypeId),
        principal: Number(this.zdata.editPost.storeBossId),
        shopId: Number(this.zdata.editPost.storeFromBarId),
        signNum: String(this.zdata.editPost.storeDoorCode),
        location: this.zdata.editPost.storeAddress
      };
Z's avatar
Z committed
953

954 955 956 957 958 959 960 961 962 963
      ApiStoreEditStore(postData)
        .then(res => {
          if (res.result == "success") {
            this.$message({
              message: "编辑成功",
              type: "success"
            });
            this.zdata.editPost = JSON.parse(
              JSON.stringify(this.zdata.editPostDefault)
            );
Z's avatar
Z committed
964
            this.zcache.status.editDialog = false;
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979
            this.storeGetMainList();
          } else {
            this.$message({
              message: "编辑失败!",
              type: "error"
            });
          }
        })
        .catch(err => {
          this.$message({
            message: "编辑失败!",
            type: "error"
          });
        });
    },
Z's avatar
Z committed
980

xd's avatar
xd committed
981 982 983 984 985 986 987
    testButtonClick() {},
    pagesSizeChange() {},
    pagesNowPageChange() {},
    setListsHeadStyle({ row, column, rowIndex, columnIndex }) {
      if (rowIndex === 0) {
        return "background-color: #0B0F32; border-right: 1px solid white;color: white;";
      } else {
988
        return "";
xd's avatar
xd committed
989
      }
xd's avatar
xd committed
990 991
    },
    addStore() {
Z's avatar
Z committed
992 993
      // this.$refs.addStore.addStoreDialog = true;
      this.zcache.status.newDialog = true;
xd's avatar
xd committed
994 995
    },
    handleDetail() {
996
      this.$refs.storeDetail.detailDialog = true;
xd's avatar
xd committed
997 998 999
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
Z's avatar
Z committed
1000 1001
    },

1002 1003 1004
    dialogSeeClose() {
      this.zcache.status.seeDialog = false;
    }
xd's avatar
xd committed
1005 1006
  }
};
xd's avatar
xd committed
1007
</script>
xd's avatar
xd committed
1008 1009
<style lang="scss" scoped>
.btn {
1010 1011 1012
  font-size: 14px;
  font-weight: bold;
  color: rgba(102, 102, 102, 1);
xd's avatar
xd committed
1013 1014
}
.main {
xd's avatar
xd committed
1015 1016 1017 1018
  position: relative;
  background-color: #fff;
  box-sizing: border-box;
  height: 100%;
xd's avatar
xd committed
1019 1020 1021 1022
  padding: 0px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
xd's avatar
xd committed
1023
  width: 100%;
xd's avatar
xd committed
1024
  box-shadow: 0px 2px 4px 0px #ddd;
xd's avatar
xd committed
1025
}
xd's avatar
xd committed
1026

xd's avatar
xd committed
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
.buttons {
  width: 266px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
}
.buttonlight {
  background-color: #e8e9fe;
  color: #4e59c7;
  border: 1px solid #4e59c7;
  box-sizing: border-box;
}
.buttondark {
  width: 88px;
  height: 32px;
  background-color: #4e59c7;
  color: #ffffff;
  border: 1px solid #4e59c7;
  box-sizing: border-box;
}
.searchzone {
  height: 40px;
  width: auto;
  min-width: 654px;
  text-align: right;
}
.lists {
  height: auto;
  min-height: 70%;
  width: 100%;
  margin-top: 20px;
}
.listButtonRed {
1060
  color: #d0021b;
xd's avatar
xd committed
1061
  font-weight: bold;
xd's avatar
xd committed
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078
}
.pages {
  height: 40px;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
}
.title {
  height: 48px;
  line-height: 48px;
  color: rgba(56, 56, 56, 1);
  border-bottom: 1px solid #f8f8f8;
  margin-bottom: 16px;
}
</style>