Commit 5fdc149f authored by xd's avatar xd

首页加入Loadind未测试

parent 21d3670f
<template>
<div class="main">
<van-loading size="80px" color="#1989fa" class="ld" v-if="overlayShow">加载中...</van-loading>
<van-overlay :show="overlayShow" />
<div class="main-manInfos">
<div class="manInfo-logos">
<img class="logos-logo" :src="test.manInfo.logoUrl" />
......@@ -224,10 +226,12 @@ export default {
userInfoResOld: "",
userInfoResNew: ""
},
flag: 1
flag: 1,
overlayShow: false
};
},
created() {
this.overlayShow = true
this.checkNowMenuBar();
if (sessionStorage.getItem("userId")) {
if (sessionStorage.getItem("avatar")) {
......@@ -554,23 +558,33 @@ export default {
},
getUserFromId(id) {
let userName = id;
getUserInfoByUserId({ userName })
.then(res => {
sessionStorage.setItem("oyStallCode", res.data[0].oyStallCode);
this.oyStallCode = res.data[0].oyStallCode;
this.getStore();
this.getFans();
this.getAllFans();
this.getNewFans();
this.getAllNewFans();
})
.catch(err => {});
getUserInfoByUserId({ userName }).then(res => {
sessionStorage.setItem("oyStallCode", res.data[0].oyStallCode)
this.oyStallCode = res.data[0].oyStallCode;
this.getStore()
this.getFans()
this.getAllFans()
this.getNewFans()
this.getAllNewFans()
this.overlayShow = false
})
.catch(err => {})
}
}
};
</script>
<style scoped>
.ld >>> .van-loading__text {
color: #fff;
}
.ld {
z-index: 1000;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
.testCube {
width: 60px;
height: 10px;
......
......@@ -7,7 +7,7 @@
:show-close="false"
:close-on-click-modal="false"
>
<el-form :model="addForm" label-width="auto" ref="addStore" :rules="rules" >
<el-form :model="addForm" label-width="auto" ref="addStore" :rules="rules" v-loading="formLoading" element-loading-text="加载中">
<el-form-item label="部门名称:" prop="label">
<el-input
size="small"
......@@ -27,13 +27,7 @@
style="width: 50%;"
/>
</el-form-item>
<el-form-item label="是否设置详细信息:">
<el-radio-group v-model="detail" @change="handleDetailChange">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="门店Id:" prop="oyStallCode" v-if="detail == 1">
<el-form-item label="门店Id:" prop="oyStallCode">
<el-input
size="small"
v-model="addForm.oyStallCode"
......@@ -41,7 +35,7 @@
style="width: 50%;"
/>
</el-form-item>
<el-form-item label="门店会员id:" prop="oyStallMemberId" v-if="detail == 1">
<el-form-item label="门店会员id:" prop="oyStallMemberId" >
<el-input
size="small"
v-model="addForm.oyStallMemberId"
......@@ -49,7 +43,7 @@
style="width: 50%;"
/>
</el-form-item>
<el-form-item label="设置主管:" prop="clerkId" v-if="detail == 1">
<el-form-item label="设置主管:" prop="clerkId" >
<el-cascader :props="props" v-model="deptId" :disabled="ifDisabled" :options="parentDeptList" :show-all-levels="false" filterable style="width: 30%;margin-right:15px;" @change="handleParentChange" ></el-cascader>
<el-select v-model="addForm.clerkId" filterable multiple placeholder="请选择" style="width: 30%;" clearble>
<el-option
......@@ -107,7 +101,7 @@ export default {
group_name: "",
shop_code: "",
showTree: false,
formLoading: false,
params: {
d_name: "",
d_parentId: "",
......@@ -136,7 +130,7 @@ export default {
{ max: 50, message: "长度在50个字符以内", trigger: "blur" }
],
parentId: [{ required: true, message: "请选择上级部门", trigger: "change" }],
oyStallCode: [{ validator: idNumber, trigger: "blur" }]
oyStallCode: [{ required: true, validator: idNumber, trigger: "blur" }]
},
deptOption: {
value: 'id',
......@@ -181,7 +175,9 @@ export default {
}
},
created() {
this.formLoading = true
this.getOrgTree()
this.getDeptList()
},
methods: {
handleDpetChange(val) {
......@@ -190,21 +186,13 @@ export default {
getOrgTree() {
getOrgTree().then(res => {
this.orgTree = [res.data.organizations]
this.formLoading = false
});
},
handleDetailChange(val) {
this.deptId = ''
this.addForm.clerkId = []
this.peopleList = []
if(val == 1) {
this.getDeptList()
}
},
handleParentChange(val) {
this.addForm.clerkId = []
if(this.detail == 1) {
this.getGroupMember(val)
}
this.getGroupMember(val)
},
getDeptList() {
getWxAllDeptList()
......@@ -233,7 +221,7 @@ export default {
this.$emit("handleAddFinish")
}
}else {
this.$message.error(res.data)
this.$message.error(res.errorMsg)
}
})
......
......@@ -5,10 +5,10 @@
:visible.sync="editDialog"
width="58%"
:show-close="false"
:close-on-click-modal="false"
:close-on-click-modal="false"
>
<el-form :model="addForm" label-width="auto" ref="addStore" :rules="rules" >
<el-form-item label="部门名称:" prop="label">
<el-form :model="addForm" label-width="auto" ref="addStore" :rules="rules" v-loading="formLoading" element-loading-text="数据加载中">
<el-form-item label="部门名称:" prop="label" >
<el-input
size="small"
v-model="addForm.label"
......@@ -27,21 +27,16 @@
style="width: 50%;"
/>
</el-form-item>
<el-form-item label="是否设置详细信息:">
<el-radio-group v-model="detail" @change="handleDetailChange">
<el-radio :label="1"></el-radio>
<el-radio :label="2"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="门店Id:" prop="oyStallCode" v-if="detail == 1">
<el-form-item label="门店Id:" prop="oyStallCode" >
<el-input
size="small"
v-model="addForm.oyStallCode"
placeholder="请输入门店Id"
style="width: 50%;"
disabled
/>
</el-form-item>
<el-form-item label="门店会员id:" prop="oyStallMemberId" v-if="detail == 1">
<el-form-item label="门店会员id:" prop="oyStallMemberId" >
<el-input
size="small"
v-model="addForm.oyStallMemberId"
......@@ -49,7 +44,7 @@
style="width: 50%;"
/>
</el-form-item>
<el-form-item label="设置主管:" prop="clerkId" v-if="detail == 1">
<el-form-item label="设置主管:" prop="clerkId" >
<el-cascader :props="props" v-model="deptId" :options="parentDeptList" :disabled="ifDisabled" :show-all-levels="false" filterable style="width: 30%;margin-right:15px;" @change="handleParentChange" ></el-cascader>
<el-select v-model="addForm.clerkId" filterable multiple placeholder="请选择" style="width: 30%;" clearble>
<el-option
......@@ -139,7 +134,7 @@ export default {
{ max: 50, message: "长度在50个字符以内", trigger: "blur" },
],
parentId: [{ required: true, message: "请选择上级部门", trigger: "change" }],
oyStallCode: [{ validator: idNumber, trigger: "blur" }]
oyStallCode: [{ required: true, validator: idNumber, trigger: "blur" }]
},
deptOption: {
value: 'id',
......@@ -162,6 +157,7 @@ export default {
}
},
ifDisabled: false,
formLoading: false,
props: {
value: 'id',
children: 'children',
......@@ -190,13 +186,11 @@ export default {
},
methods: {
getDetail() {
this.formLoading = true
getDeptDetail({id:this.groupId}).then(res=> {
console.log(res,"详情")
this.addForm.clerkId = clerkId
this.addForm = res.data.organization
if(this.addForm.oyStallCode !== '' || this.addForm.oyStallMemberId !== '' || this.addForm.clerkId !== []) {
this.detail = 1
}
const clerkId = []
res.data.supervisors.forEach(item => {
clerkId.push(item.id)
......@@ -207,35 +201,28 @@ export default {
const deptId = ''
this.deptId = res.data.supervisors[0].departmentId
this.getGroupMember(this.deptId)
})
},
handleDpetChange(val) {
console.log(val,'val')
},
getOrgTree() {
getOrgTree().then(res => {
this.orgTree = [res.data.organizations]
});
},
handleDetailChange(val) {
this.deptId = ''
this.addForm.clerkId = []
this.peopleList = []
if(val == 1) {
this.getDeptList()
}
getOrgTree().then(res => {
this.orgTree = [res.data.organizations]
})
},
handleParentChange(val) {
this.addForm.clerkId = []
if(this.detail == 1) {
this.getGroupMember(val)
}
this.getGroupMember(val)
},
getDeptList() {
getWxAllDeptList()
.then(res => {
console.log(res,'全部部门')
this.parentDeptList = res.data
this.formLoading = false
})
.catch(err => {
console.log(err)
......
......@@ -230,16 +230,17 @@ export default {
}
},
getGroupMember(page,ctPage) {
this.tableLoading = true
this.page.currentPage = ctPage
this.type = this.sType = 3
let params = {
pageNum: page,
id: this.groupId
};
getGroupById(params).then(res => {
this.tableData = res.data.pageInfo.list;
this.page.total = this.totalNumber = Number(res.data.pageInfo.total);
this.tableLoading = false
});
},
getStoreMember(page,ctPage) {
......
<template>
<div class="main">
<div class="contents">
<div class="zListActive">
<div class="inputs">
<div class="button" @click="zReadySetVoucherList">ReLoad</div>
</div>
</div>
<div v-for="item of zlist.voucher" :key="item.coupon_id" >
<div class="content">
<div class="content-imgs">
<img class="imgs-img" :src="zcache.defaultImgUrl" alt />
</div>
<div class="content-infos">
<div class="infos-mains">
<div class="mains">
<div class="main-usedPercent">活动ID:{{item.action_id}}</div>
<div class="main-money">{{item.coupon_title}}</div>
</div>
<div class="buttons">
<button class="button-send" @click="zVoucherPick(item.action_id, item.coupon_id)">推送</button>
</div>
</div>
<div class="infos-tips">
<div class="tip-shareMan">优惠券ID:{{item.coupon_id}}</div>
<!-- <div class="tip-commision">佣金:¥ {{item.commision}}</div> -->
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
// import { ApiTestCfPost, ApiTestEaPost } from "@/api/test/main";
import { ApiEaPost, ApiEaActiveList } from "@/api/test/test";
import { configWx, getUserInfo } from "@/utils/aCommon";
// import * as APISidebarEA from "@/api/sidebar/ea";
import { getVoucherList, getVoucherWxUrl } from "@/api/sidebar/ea";
import { getUserInfoByUserId } from "@/api/sidebar/voucher";
import Vue from "vue";
import { Field } from "vant";
const zlog = console.log.bind(console);
Vue.use(Field);
export default {
name: "discountIndex",
data() {
return {
zcache: {
storeId: 1,
userId: "",
unionId: "",
userInfo: "",
defaultImgUrl: "/mainSale/2.png",
now: {
activeId: "",
voucherId: "",
}
},
zlist: {
voucher: [],
voucherUrl: ""
},
test: {
list: {
main: [
{
imgUrl: "/mainSale/test-city.png",
usedPercent: "10",
money: "100",
shareMan: "Alice",
commision: "11"
},
{
imgUrl: "/mainSale/test-city.png",
usedPercent: "20",
money: "200",
shareMan: "Bob",
commision: "22"
}
]
}
},
dis: {}
};
},
created() {
if(this.$route.params.userId) {
this.zcache.userId = this.$route.params.userId;
}else {
this.zcache.userId = sessionStorage.getItem("userId")
}
this.zReadyGetUserFromId();
this.getAgentAuth();
// this.zReadySetVoucherList()
},
mounted() {
},
methods: {
// 测试-获取预授权码
zTestPreAuthCode() {
const basicInfo = {
head: "https://open.weixin.qq.com/connect/oauth2/authorize?",
// appId: "wwd1cdbca7b8b2b6c4",
appId: "ww4df265003b43fa0d",
redirectUrI: encodeURIComponent("oysales.oywanhao.com"),
responseType: "code",
scope: "snsapi_base",
state: "ztest",
tail: "#wechat_redirect"
};
let url =
basicInfo.head +
"appid=" +
basicInfo.appId +
"&redirect_uri=" +
basicInfo.redirectUrI +
"&response_type=" +
basicInfo.responseType +
"&scope=" +
basicInfo.scope +
"&state=" +
basicInfo.state +
basicInfo.tail;
zlog("%c--->zTestPreAuthCode: Url =", "background: orange", url);
// window.location.href = url
},
zReadyGetUserFromId() {
let postData = {
userName: this.zcache.userId
}
getUserInfoByUserId(postData)
.then(res => {
// alert(`--->userInfoFromId: res = ${JSON.stringify(res.data)}`);
// this.zcache.userInfo = String(res.data[0].departmentId);
if(res.data[0].oyStallCode == '') {
alert('您当前没有绑定店铺')
}else {
this.zcache.storeId = res.data[0].oyStallCode
// this.zcache.storeId = Number(res.data[0].stall);
this.zReadySetVoucherList()
}
})
.catch(err => {})
},
// 获取优惠券列表
zReadySetVoucherList() {
this.zReadyDelVoucherList();
const postData = {
appCode: "0696", // j接口编码
mdid: this.zcache.storeId
}
getVoucherList(postData).then(res => {
if(res.result.coupons.length == 0) {
alert('当前店铺暂无优惠券可发放')
}else {
this.zVoucherSet(res.result.coupons)
}
})
.catch(err => {
})
},
zReadyDelVoucherList() {
this.zVoucherDel()
this.zVoucherUrlDel()
},
zVoucherPick(inActiveId, inVoucherId) {
this.zcache.now.activeId = String(inActiveId)
this.zcache.now.voucherId = String(inVoucherId)
this.zVoucherUrlDel()
const postData = {
appCode: "0697",
action_id: Number(inActiveId),
coupon_id: Number(inVoucherId)
}
getVoucherWxUrl(postData).then(res => {
this.zVoucherUrlSet(res.result.link)
});
},
zpick(inMsgType, inUrl) {
switch (inMsgType) {
case "text":
wx.invoke(
"sendChatMessage",
{
msgtype: "text", //消息类型,必填
text: {
content: inUrl
}
},
function(res) {
if (res.err_msg == "sendChatMessage:ok") {
// alert("--->discount.vue: zpick: text 分享成功!")
} else if (res.err_msg != "sendChatMessage:ok") {
// alert('分享失败')
}
}
);
break;
case "h5":
// alert(`--->discount.vue: zpick: H5: IN.`);
// alert('zpick')
wx.invoke(
"sendChatMessage",
{
msgtype: "news", //消息类型,必填
news: {
link: `http://oysales.oywanhao.com/qrCode?Url=${inUrl}&activeId=${this.zcache.now.activeId}&voucherId=${this.zcache.now.voucherId}&unionId=1234`, //H5消息页面url 必填
title: "领取优惠券", //H5消息标题
desc: inUrl, //H5消息摘要
imgUrl: inUrl //H5消息封面图片URL
}
},
function(res) {
// alert('sendChatMessage')
if (res.err_msg == "sendChatMessage:ok") {
// alert("--->discount.vue: zpick: h5 分享成功!")
} else if (res.err_msg != "sendChatMessage:ok") {
// alert(`--->discount.vue: zpick: h5 分享失败.`)
// alert(
// `--->discount.vue: zpick: h5 分享失败: res =${res.err_msg}`
// );
}
}
);
break;
default:
break;
}
},
zVoucherSet(inArray) {
// alert('zVoucherSet')
this.zlist.voucher = inArray;
},
zVoucherDel() {
this.zlist.voucher = [];
},
zVoucherUrlSet(inData) {
this.zlist.voucherUrl = String(inData);
this.zpick('h5', String(inData))
},
zVoucherUrlDel() {
this.zlist.voucherUrl = "";
},
testEaPost() {
let postData = {
appCode: "0696",
mdid: 1
};
ApiEaActiveList(postData).then(res => {
// console.log(res);
});
},
buttonSingleMarketingClick() {
// this.$router.push("");
},
buttonMainMarketingClick() {
this.$router.push("MainSale");
}
}
};
</script>
<style scoped>
.main {
background-color: white;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: start;
}
.tops {
border: 2px solid lightblue;
width: 100%;
height: 100px;
}
.contents {
/* border: 2px solid lightpink; */
width: 100%;
height: 100%;
padding: 16px;
padding-bottom: 40px;
}
.content {
border: 0px solid orange;
height: 100px;
width: 100%;
padding: 4px 0px;
margin-bottom: 16px;
border-radius: 4px;
box-shadow: 0px 2px 4px 0px rgb(187, 187, 187);
display: flex;
flex-direction: row;
justify-content: start;
}
.content-imgs {
/* border: 1px solid pink; */
width: 20%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: start;
align-items: center;
}
.imgs-img {
width: 50px;
height: 50px;
margin-top: 10px;
border-radius: 50%;
object-fit: cover;
}
.content-infos {
/* border: 1px solid orange; */
width: 80%;
height: 100%;
}
.infos-mains {
height: 70%;
width: 100%;
/* border: 1px solid green; */
display: flex;
flex-direction: row;
justify-content: start;
}
.mains {
/* border: 1px solid red; */
width: 70%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.main-usedPercent {
font-size: 14px;
color: grey;
}
.main-money {
/* border: 1px solid lightgreen; */
/* font-size: 24px; */
font-size: 20px;
}
.buttons {
/* border: 1px solid darkorange; */
/* background-color: bisque; */
width: 30%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.button-send {
border: 0px solid blue;
height: 40px;
width: 60px;
border-radius: 4px;
background-color: rgba(68, 93, 251, 1);
color: white;
font-size: 16px;
}
.infos-tips {
height: 30%;
width: 100%;
/* border: 1px solid red; */
border-top: 1px dashed gray;
padding-top: 6px;
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
}
.tip-shareMan {
/* border: 1px solid orange; */
width: 70%;
height: 100%;
font-size: 14px;
line-height: 16px;
color: rgb(150, 150, 150);
}
.tip-commision {
/* border: 1px solid green; */
width: 30%;
height: 100%;
font-size: 14px;
line-height: 16px;
color: rgb(150, 150, 150);
}
.menus {
border-top: 1px solid rgb(194, 194, 194);
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
height: 50px;
background-color: white;
display: flex;
flex-direction: row;
justify-content: start;
align-items: center;
}
.menu {
/* border: 1px solid red; */
height: 50px;
/* width: 120px; */
width: 50%;
line-height: 50px;
text-align: center;
font-size: 14px;
color: black;
}
.activeMenu {
color: lightcoral;
}
.zListActive {
/*border: 1px solid limegreen;*/
width: 100%;
height: auto;
margin-bottom: 16px;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
.zListActive > .inputs {
/*border: 1px solid dodgerblue;*/
width: 100%;
height: auto;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.zListActive > .inputs > .input {
/*border-bottom: 2px solid red;*/
border-color: dodgerblue;
border-radius: 4px;
width: 70%;
height: 40px;
font-size: 16px;
}
.zListActive > .inputs > .button {
border: 1px solid dodgerblue;
border-radius: 4px;
width: 40%;
height: 40px;
font-size: 14px;
line-height: 36px;
text-align: center;
}
.zListActive > .lists {
/*border: 1px solid red;*/
width: 100%;
height: auto;
margin-top: 8px;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
.zListActive > .lists > .item {
border: 1px solid red;
width: 100%;
height: 100px;
margin-bottom: 16px;
padding: 4px 4px;
border-radius: 4px;
box-shadow: 0px 2px 4px 0px rgb(187, 187, 187);
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: flex-start;
font-size: 14px;
}
.zListActive > .lists > .voucherUrl {
border: 1px solid orange;
width: 100%;
height: 100px;
margin-bottom: 16px;
padding: 4px 4px;
border-radius: 4px;
box-shadow: 0px 2px 4px 0px rgb(187, 187, 187);
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
font-size: 14px;
/* text-wrap: none; */
}
</style>
......@@ -97,51 +97,18 @@ export default {
this.getAgentAuth();
// this.zReadySetVoucherList()
},
mounted() {
},
methods: {
// 测试-获取预授权码
zTestPreAuthCode() {
const basicInfo = {
head: "https://open.weixin.qq.com/connect/oauth2/authorize?",
// appId: "wwd1cdbca7b8b2b6c4",
appId: "ww4df265003b43fa0d",
redirectUrI: encodeURIComponent("oysales.oywanhao.com"),
responseType: "code",
scope: "snsapi_base",
state: "ztest",
tail: "#wechat_redirect"
};
let url =
basicInfo.head +
"appid=" +
basicInfo.appId +
"&redirect_uri=" +
basicInfo.redirectUrI +
"&response_type=" +
basicInfo.responseType +
"&scope=" +
basicInfo.scope +
"&state=" +
basicInfo.state +
basicInfo.tail;
zlog("%c--->zTestPreAuthCode: Url =", "background: orange", url);
// window.location.href = url
},
zReadyGetUserFromId() {
let postData = {
userName: this.zcache.userId
}
getUserInfoByUserId(postData)
.then(res => {
// alert(`--->userInfoFromId: res = ${JSON.stringify(res.data)}`);
// this.zcache.userInfo = String(res.data[0].departmentId);
if(res.data[0].oyStallCode == '') {
if(res.data.length == 0) {
alert('您当前没有绑定店铺')
}else {
this.zcache.storeId = res.data[0].oyStallCode
// this.zcache.storeId = Number(res.data[0].stall);
this.zReadySetVoucherList()
}
})
......@@ -155,11 +122,15 @@ export default {
mdid: this.zcache.storeId
}
getVoucherList(postData).then(res => {
if(res.result.coupons.length == 0) {
alert('当前店铺暂无优惠券可发放')
}else {
this.zVoucherSet(res.result.coupons)
}
if(res.errCode == 0) {
if(res.result.coupons.length != 0) {
}
else {
this.zVoucherSet(res.result.coupons)
}
}
})
.catch(err => {
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment