|
@@ -1,31 +1,34 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div class="store-list">
|
|
|
- <div class="store-list-item" :class=" index == 0 ? 'active' : '' " v-for="(item, index) in storeList" :key="index">{{ item.name }}</div>
|
|
|
+ <div class="store-list-item" @click="curIdx = index" :class=" index === curIdx ? 'active' : '' " v-for="(item, index) in storeList" :key="index">{{ item.name }}</div>
|
|
|
</div>
|
|
|
<div class="take-out-list">
|
|
|
- <div class="item">
|
|
|
+ <div class="item" v-for="(v,index) in takeOutList" :key="index">
|
|
|
<div class="item-top">
|
|
|
- <div class="name">美团外卖</div>
|
|
|
- <div class="top-right">
|
|
|
+ <div class="top-left">
|
|
|
+ <img :src="v.logo" alt="" class="top-left-img">
|
|
|
+ <div class="name">{{v.name}}</div>
|
|
|
+ </div>
|
|
|
+ <!-- <div class="top-right">
|
|
|
<span>开启后自动接单</span>
|
|
|
<el-switch />
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
<div class="item-bottom">
|
|
|
<div class="left">
|
|
|
<div class="l-l">
|
|
|
- <img src="../../../static/image/alipay.png" class="l-l-img" />
|
|
|
+ <img :src="v.pcLogo" class="l-l-img" />
|
|
|
</div>
|
|
|
<div class="take-out-name">
|
|
|
- <div>店铺名称:一点点</div>
|
|
|
- <div>店铺ID:2222222</div>
|
|
|
- <div>配送门店:一点点</div>
|
|
|
+ <div>店铺名称:{{v.shopName}}</div>
|
|
|
+ <div>店铺ID:{{v.waimaiId}}</div>
|
|
|
+ <div>配送门店:{{v.thirdShopName}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="right">
|
|
|
- <el-button type="primary" size="small" class="right-btn">去绑定</el-button>
|
|
|
- <el-button size="small">解 绑</el-button>
|
|
|
+ <el-button v-if="!v.bindStatus" v-loading.fullscreen.lock="fullscreenLoading" element-loading-text="关闭窗口后再操作!" type="primary" size="small" class="right-btn" @click="goBind(v)">去绑定</el-button>
|
|
|
+ <el-button v-else @click="release(v)" size="small">解 绑</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -34,126 +37,222 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- storeList: [
|
|
|
- { id: 1, name: '门店名称-1' },
|
|
|
- { id: 2, name: '门店名称-2' },
|
|
|
- { id: 3, name: '门店名称-3' },
|
|
|
- { id: 4, name: '门店名称-4' },
|
|
|
- { id: 5, name: '门店名称-5' },
|
|
|
- { id: 6, name: '门店名称-6' },
|
|
|
- { id: 7, name: '门店名称-7' }
|
|
|
- ]
|
|
|
+import { setInterval } from "timers";
|
|
|
+import {
|
|
|
+ getShopList,
|
|
|
+ getBindTakeOutList,
|
|
|
+ getTakeOutList,
|
|
|
+ bindTakeOut,
|
|
|
+ deleteTakeOut,
|
|
|
+ releaseTakeOut,
|
|
|
+ setTakeOut,
|
|
|
+} from "../../api/shop";
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ storeList: [],
|
|
|
+ takeOutList: [],
|
|
|
+ curIdx: -1,
|
|
|
+ jumpUrl: null,
|
|
|
+ fullscreenLoading: false,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ curIdx(newVal, oldVal) {
|
|
|
+ this.getBindTakeOutList(newVal);
|
|
|
+ },
|
|
|
+ jumpUrl(newVal, oldVal) {
|
|
|
+ if (this.jumpUrl) {
|
|
|
+ this.fullscreenLoading = true;
|
|
|
+ let newWindowWidth = 800,
|
|
|
+ newWindowHeight = 500,
|
|
|
+ left = (window.screen.width - newWindowWidth) / 2,
|
|
|
+ top = (window.screen.height - newWindowHeight) / 2 - 100;
|
|
|
+ let features = `width=${newWindowWidth},height=${newWindowHeight},left=${left},top=${top}`;
|
|
|
+ let windowOpen = window.open(newVal, "name", features);
|
|
|
+ let loop = window.setInterval(() => {
|
|
|
+ console.log("windowOpen.closed", windowOpen.closed);
|
|
|
+ if (windowOpen.closed) {
|
|
|
+ this.jumpUrl = null;
|
|
|
+ this.fullscreenLoading = false;
|
|
|
+ window.clearInterval(loop);
|
|
|
+ this.getBindTakeOutList(this.curIdx);
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ getShopList().then((res) => {
|
|
|
+ this.storeList = res.data;
|
|
|
+ this.curIdx = 0;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getBindTakeOutList(index) {
|
|
|
+ getBindTakeOutList({ shopId: this.storeList[index].id }).then((res) => {
|
|
|
+ this.takeOutList = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ goBind(v) {
|
|
|
+ let params = {
|
|
|
+ shopId: this.storeList[this.curIdx].id,
|
|
|
+ waimaiId: v.waimaiId,
|
|
|
+ isNew: 1,
|
|
|
+ };
|
|
|
+ bindTakeOut(params).then((res) => {
|
|
|
+ this.jumpUrl = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ release(v) {
|
|
|
+ this.$confirm("解绑后将无法同步店铺订单,确认要解绑吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ releaseTakeOut({ id: v.id }).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ if (res.data) {
|
|
|
+ this.jumpUrl = res.data;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "成功解绑!",
|
|
|
+ });
|
|
|
+ this.getBindTakeOutList(this.curIdx);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "err",
|
|
|
+ message: res.msg,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: "info",
|
|
|
+ message: "已取消解绑!",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .store-list {
|
|
|
- display: flex;
|
|
|
- flex-wrap: nowrap;
|
|
|
- width: 100%;
|
|
|
- white-space: nowrap;
|
|
|
- overflow-x: auto;
|
|
|
- padding-bottom: 10px;
|
|
|
- &-item {
|
|
|
- padding: 8px 27px;
|
|
|
- background-color: #fff;
|
|
|
- font-size: 14px;
|
|
|
- font-family: PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- color: #B1B1B1;
|
|
|
- box-sizing: border-box;
|
|
|
- border: 1px solid #eee;
|
|
|
- border-radius: 17px;
|
|
|
- cursor: pointer;
|
|
|
- margin-right: 10px;
|
|
|
- &.active {
|
|
|
- color: #017E61;
|
|
|
- }
|
|
|
+.store-list {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ width: 100%;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow-x: auto;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ &-item {
|
|
|
+ padding: 8px 27px;
|
|
|
+ background-color: #fff;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #b1b1b1;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border: 1px solid #eee;
|
|
|
+ border-radius: 17px;
|
|
|
+ cursor: pointer;
|
|
|
+ margin-right: 10px;
|
|
|
+ &.active {
|
|
|
+ color: #017e61;
|
|
|
}
|
|
|
}
|
|
|
- .store-list::-webkit-scrollbar {
|
|
|
- height: 6px;
|
|
|
- }
|
|
|
- .store-list::-webkit-scrollbar-track {
|
|
|
- background-color: #eee;
|
|
|
- /*border-radius: 5px;
|
|
|
+}
|
|
|
+.store-list::-webkit-scrollbar {
|
|
|
+ height: 6px;
|
|
|
+}
|
|
|
+.store-list::-webkit-scrollbar-track {
|
|
|
+ background-color: #eee;
|
|
|
+ /*border-radius: 5px;
|
|
|
-webkit-border-radius: 5px;
|
|
|
-moz-border-radius: 5px;*/
|
|
|
- }
|
|
|
- .store-list::-webkit-scrollbar-thumb {
|
|
|
- background-color: #999;
|
|
|
- border-radius: 6px;
|
|
|
- -webkit-border-radius: 6px;
|
|
|
- -moz-border-radius: 6px;
|
|
|
- }
|
|
|
+}
|
|
|
+.store-list::-webkit-scrollbar-thumb {
|
|
|
+ background-color: #999;
|
|
|
+ border-radius: 6px;
|
|
|
+ -webkit-border-radius: 6px;
|
|
|
+ -moz-border-radius: 6px;
|
|
|
+}
|
|
|
|
|
|
- .take-out-list {
|
|
|
- .item {
|
|
|
- background-color: #fff;
|
|
|
- .item-top {
|
|
|
+.take-out-list {
|
|
|
+ .item {
|
|
|
+ background-color: #fff;
|
|
|
+ .item-top {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 20px 18px;
|
|
|
+ align-items: center;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+ .top-left {
|
|
|
display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 20px 18px;
|
|
|
align-items: center;
|
|
|
- border-bottom: 1px solid #eee;
|
|
|
+ .top-left-img {
|
|
|
+ width: 30px;
|
|
|
+ height: 30px;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
.name {
|
|
|
font-size: 16px;
|
|
|
font-family: PingFang SC;
|
|
|
font-weight: bold;
|
|
|
- color: #FFA608;
|
|
|
+ color: #ffa608;
|
|
|
}
|
|
|
- .top-right {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- span {
|
|
|
- font-size: 14px;
|
|
|
- font-family: PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- color: #B1B1B1;
|
|
|
- margin-right: 12px;
|
|
|
- }
|
|
|
+ }
|
|
|
+ .top-right {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ span {
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #b1b1b1;
|
|
|
+ margin-right: 12px;
|
|
|
}
|
|
|
}
|
|
|
- .item-bottom {
|
|
|
+ }
|
|
|
+ .item-bottom {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 25px 18px;
|
|
|
+ align-items: center;
|
|
|
+ .left {
|
|
|
display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 25px 18px;
|
|
|
align-items: center;
|
|
|
- .left {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- .l-l {
|
|
|
- width: 160px;
|
|
|
- height: 50px;
|
|
|
- font-size: 0;
|
|
|
- .l-l-img {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- }
|
|
|
- .take-out-name {
|
|
|
- font-size: 13px;
|
|
|
- font-family: PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- color: #333333;
|
|
|
- line-height: 20px;
|
|
|
- margin-left: 30px;
|
|
|
+ .l-l {
|
|
|
+ width: 160px;
|
|
|
+ height: 50px;
|
|
|
+ font-size: 0;
|
|
|
+ .l-l-img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
}
|
|
|
- .right {
|
|
|
- .right-btn {
|
|
|
- background-color: #FC7200;
|
|
|
- border: none;
|
|
|
- }
|
|
|
+ .take-out-name {
|
|
|
+ font-size: 13px;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #333333;
|
|
|
+ line-height: 20px;
|
|
|
+ margin-left: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .right {
|
|
|
+ .right-btn {
|
|
|
+ background-color: #fc7200;
|
|
|
+ border: #fc7200;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
</style>
|