增加基本项目配置

This commit is contained in:
Gao xiaosong
2020-03-15 13:59:43 +08:00
commit 397082cdaf
1117 changed files with 105700 additions and 0 deletions
+172
View File
@@ -0,0 +1,172 @@
<template>
<div class="ChangePassword">
<div class="list">
<div class="item">
<input type="number" placeholder="填写手机号码" v-model="phone" />
</div>
<div class="item acea-row row-between-wrapper">
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button
class="code font-color-red"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
</div>
</div>
<div class="confirmBnt bg-color-red" @click="confirm">确认绑定</div>
</div>
</template>
<script>
import { mapGetters } from "vuex";
import sendVerifyCode from "@/mixins/SendVerifyCode";
import { required, alpha_num, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
import { registerVerify, bindingPhone } from "@/api/user";
export default {
name: "BindingPhone",
components: {},
props: {},
data: function() {
return {
captcha: "",
phone: "" //手机号
};
},
mixins: [sendVerifyCode],
computed: mapGetters(["userInfo"]),
mounted: function() {},
methods: {
async confirm() {
let that = this;
const { phone, captcha } = that;
try {
await that
.$validator({
phone: [
chs_phone(chs_phone.message("手机号码")),
alpha_num(alpha_num.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
})
.validate({ phone, captcha });
} catch (e) {
return validatorDefaultCatch(e);
}
bindingPhone({
phone: this.phone,
captcha: this.captcha
})
.then(res => {
if (res.data !== undefined && res.data.is_bind) {
that.$dialog.confirm({
mes: res.msg,
opts: [
{
txt: "确认绑定",
color: false,
callback: () => {
bindingPhone({
phone: this.phone,
captcha: this.captcha,
step: 1
})
.then(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
that.$yrouter.replace({
path: "/pages/user/PersonalData/main"
});
})
.catch(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
that.$yrouter.replace({
path: "/pages/user/PersonalData/main"
});
});
}
},
{
txt: "取消",
color: false,
callback: () => {
wx.showToast({
title: "已取消绑定",
icon: "none",
duration: 2000
});
that.$yrouter.replace({
path: "/pages/user/PersonalData/main"
});
}
}
]
});
} else {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
that.$yrouter.replace({ path: "/pages/user/PersonalData/main" });
}
})
.catch(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
},
async code() {
let that = this;
const { phone } = that;
try {
await that
.$validator({
phone: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
})
.validate({ phone });
} catch (e) {
return validatorDefaultCatch(e);
}
registerVerify({ phone: phone })
.then(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
that.sendCode();
})
.catch(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
}
}
};
</script>
<style lang="">
</style>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+149
View File
@@ -0,0 +1,149 @@
<template>
<div class="ChangePassword">
<div class="phone">
当前手机号:
<input type="text" v-model="phone" disabled />
</div>
<div class="list">
<div class="item">
<input type="password" placeholder="设置新密码" v-model="password" />
</div>
<div class="item">
<input type="password" placeholder="确认新密码" v-model="password2" />
</div>
<div class="item acea-row row-between-wrapper">
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button
class="code font-color-red"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
</div>
</div>
<div class="confirmBnt bg-color-red" @click="confirm">确认修改</div>
</div>
</template>
<style scoped>
.ChangePassword .phone input {
width: 2rem;
text-align: center;
}
</style>
<script>
// import { mapGetters } from "vuex";
import sendVerifyCode from "@/mixins/SendVerifyCode";
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
import { registerReset, registerVerify, getUserInfo } from "@/api/user";
export default {
name: "ChangePassword",
components: {},
props: {},
data: function() {
return {
password: "",
password2: "",
captcha: "",
phone: "", //隐藏几位数的手机号;
yphone: "" //手机号;
};
},
mixins: [sendVerifyCode],
// computed: mapGetters(["userInfo"]),
mounted: function() {
this.getUserInfo();
},
methods: {
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
that.yphone = res.data.phone;
let reg = /^(\d{3})\d*(\d{4})$/;
that.phone = that.yphone.replace(reg, "$1****$2");
});
},
async confirm() {
let that = this;
const { password, password2, captcha } = that;
try {
await that
.$validator({
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
})
.validate({ password, captcha });
} catch (e) {
return validatorDefaultCatch(e);
}
if (password !== password2) return wx.showToast({
title: '两次密码不一致',
icon: "none",
duration: 2000
});
registerReset({
account: that.yphone,
captcha: that.captcha,
password: that.password
})
.then(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
// that.$yrouter.push({ path: "/pages/user/Login/index" });
})
.catch(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
},
async code() {
let that = this;
const { yphone } = that;
try {
await that
.$validator({
yphone: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
})
.validate({ yphone });
} catch (e) {
return validatorDefaultCatch(e);
}
registerVerify({ phone: yphone })
.then(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
that.sendCode();
})
.catch(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+67
View File
@@ -0,0 +1,67 @@
<template>
<div class="CustomerList">
<div
class="item acea-row row-between-wrapper"
v-for="item in list"
:key="item.id"
@click="$yrouter.push({path:'/pages/user/CustomerService/index',query:{id:item.uid}})"
>
<div class="pictrue">
<img :src="item.avatar" />
</div>
<div class="text line1">{{ item.nickname }}</div>
</div>
</div>
</template>
<script>
import { serviceList } from "@/api/user";
export default {
name: "CustomerList",
data() {
return {
list: []
};
},
methods: {
getList() {
serviceList().then(res => {
this.list = res.data;
});
}
},
mounted() {
this.getList();
}
};
</script>
<style scoped>
.CustomerList {
margin-top: 0.13rem;
}
.CustomerList .item {
height: 1.38rem;
border-bottom: 1px solid #eee;
padding: 0 0.24rem;
background-color: #fff;
}
.CustomerList .item .pictrue {
width: 0.9rem;
height: 0.9rem;
border-radius: 50%;
border: 0.03rem solid #fff;
box-shadow: 0 0 0.1rem 0.05rem #f3f3f3;
-webkit-box-shadow: 0 0 0.1rem 0.05rem #f3f3f3;
-moz-box-shadow: 0 0 0.1rem 0.05rem #f3f3f3;
}
.CustomerList .item .pictrue img {
width: 100%;
height: 100%;
border-radius: 50%;
}
.CustomerList .item .text {
width: 5.82rem;
font-size: 0.32rem;
color: #000;
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+302
View File
@@ -0,0 +1,302 @@
<template>
<div class="register absolute">
<div class="shading">
<div class="pictrue acea-row row-center-wrapper">
<img src="@/assets/images/logo.png" />
</div>
</div>
<div class="whiteBg" v-if="formItem === 1">
<div class="title acea-row row-center-wrapper">
<div
class="item"
:class="current === index ? 'on' : ''"
v-for="(item, index) in navList"
@click="navTap(index)"
:key="index"
>
{{ item }}
</div>
</div>
<div class="list" :hidden="current !== 0">
<form @submit.prevent="submit">
<div class="item">
<div class="acea-row row-between-wrapper">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_"></use>
</svg>
<input
type="text"
placeholder="输入手机号码"
v-model="account"
required
/>
</div>
</div>
<div class="item">
<div class="acea-row row-between-wrapper">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_"></use>
</svg>
<input
type="password"
placeholder="填写登录密码"
v-model="password"
required
/>
</div>
</div>
</form>
</div>
<div class="list" :hidden="current !== 1">
<div class="item">
<div class="acea-row row-between-wrapper">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_"></use>
</svg>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="align-left">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1"></use>
</svg>
<input
type="text"
placeholder="填写验证码"
class="codeIput"
v-model="captcha"
/>
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>
{{ text }}
</button>
</div>
</div>
</div>
<div class="logon" @click="loginMobile" :hidden="current !== 1">登录</div>
<div class="logon" @click="submit" :hidden="current === 1">登录</div>
<div class="tip">
没有账号?
<span @click="formItem = 2" class="font-color-red">立即注册</span>
</div>
</div>
<div class="whiteBg" v-else>
<div class="title">注册账号</div>
<div class="list">
<div class="item">
<div>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_"></use>
</svg>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="align-left">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1"></use>
</svg>
<input
type="text"
placeholder="填写验证码"
class="codeIput"
v-model="captcha"
/>
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>
{{ text }}
</button>
</div>
</div>
<div class="item">
<div>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_"></use>
</svg>
<input
type="password"
placeholder="填写您的登录密码"
v-model="password"
/>
</div>
</div>
</div>
<div class="logon" @click="register">注册</div>
<div class="tip">
已有账号?
<span @click="formItem = 1" class="font-color-red">立即登录</span>
</div>
</div>
<div class="bottom"></div>
</div>
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import { login, loginMobile, registerVerify, register } from "@/api/user";
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
import dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
const BACK_URL = "login_back_url";
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function() {
return {
navList: ["账号登录"],
current: 0,
account: "",
password: "",
captcha: "",
formItem: 1,
type: "login"
};
},
methods: {
async loginMobile() {
var that = this;
const { account, captcha } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
})
.validate({ account, captcha });
} catch (e) {
return validatorDefaultCatch(e);
}
loginMobile({
phone: that.account,
captcha: that.captcha,
spread: cookie.get("spread")
})
.then(res => {
var data = res.data;
that.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
const backUrl = cookie.get(BACK_URL) || "/";
cookie.remove(BACK_URL);
that.$yrouter.replace({ path: backUrl });
})
.catch(res => {
that.$dialog.error(res.msg);
});
},
async register() {
var that = this;
const { account, captcha, password } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
})
.validate({ account, captcha, password });
} catch (e) {
return validatorDefaultCatch(e);
}
register({
account: that.account,
captcha: that.captcha,
password: that.password,
spread: cookie.get("spread")
})
.then(res => {
that.$dialog.success(res.msg);
that.formItem = 1;
})
.catch(res => {
that.$dialog.error(res.msg);
});
},
async code() {
var that = this;
const { account } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
})
.validate({ account });
} catch (e) {
return validatorDefaultCatch(e);
}
if (that.formItem == 2) that.type = "register";
await registerVerify({ phone: that.account, type: that.type })
.then(res => {
that.$dialog.success(res.msg);
that.sendCode();
})
.catch(res => {
that.$dialog.error(res.msg);
});
},
navTap: function(index) {
this.current = index;
},
async submit() {
console.log('spread:'+cookie.get("spread") )
const { account, password } = this;
try {
await this.$validator({
account: [
required(required.message("账号")),
attrs.range([5, 16], attrs.range.message("账号")),
alpha_num(alpha_num.message("账号"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
}).validate({ account, password });
} catch (e) {
return validatorDefaultCatch(e);
}
login({ username: account, password, spread: cookie.get("spread") })
.then(({ data }) => {
this.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
const backUrl = cookie.get(BACK_URL) || "/";
cookie.remove(BACK_URL);
this.$yrouter.replace({ path: backUrl });
})
.catch(e => {
this.$dialog.error(e.msg);
});
}
}
};
</script>
+246
View File
@@ -0,0 +1,246 @@
<template>
<div class="personal-data">
<div class="wrapper">
<div class="title">管理我的账号</div>
<div class="wrapList">
<div
class="item acea-row row-between-wrapper"
:class="item.uid === userInfo.uid ? 'on' : ''"
v-for="(item, switchUserInfoIndex) in switchUserInfo"
:key="switchUserInfoIndex"
>
<div class="picTxt acea-row row-between-wrapper">
<div class="pictrue">
<!-- <VueCoreImageUpload
class="btn btn-primary"
:crop="false"
compress="80"
@imageuploaded="imageuploaded"
:headers="headers"
:max-file-size="5242880"
:credentials="false"
inputAccept="image/*"
inputOfFile="file"
:url="url"
ref="upImg"
v-if="item.uid === userInfo.uid"
>
<div class="pictrue">
<img :src="item.avatar" />
</div>
</VueCoreImageUpload>-->
<!-- <div class="pictrue" v-else>
<img :src="item.avatar" />
</div>-->
<img
:src="$VUE_APP_RESOURCES_URL+'/images/alter.png'"
class="alter"
v-if="item.uid === userInfo.uid"
/>
</div>
<div class="text">
<div class="name line1">{{ item.nickname }}</div>
<div class="phone">绑定手机号{{ item.phone }}</div>
</div>
</div>
<div
class="currentBnt acea-row row-center-wrapper font-color-red"
v-if="item.uid === userInfo.uid"
>当前账号</div>
<div
class="bnt font-color-red acea-row row-center-wrapper"
v-else
@click="switchAccounts(index)"
>使用账号</div>
</div>
</div>
</div>
<div class="list">
<div class="item acea-row row-between-wrapper">
<div>昵称</div>
<div class="input">
<input type="text" v-model="userInfo.nickname" />
</div>
</div>
<div class="item acea-row row-between-wrapper">
<div>ID号</div>
<div class="input acea-row row-between-wrapper">
<input type="text" :value="userInfo.uid" disabled class="id" />
<span class="iconfont icon-suozi"></span>
</div>
</div>
<div class="item acea-row row-between-wrapper">
<div>手机号</div>
<div class="input">
<input type="text" v-if="userInfo.phone" v-model="userInfo.phone" />
<input type="text" v-else value="未绑定" disabled class="id" />
</div>
</div>
<!--<div v-if="!userInfo.phone">-->
<!--<div-->
<!--@click="$yrouter.push('/pages/user/BindingPhone/index')"-->
<!--class="item acea-row row-between-wrapper"-->
<!--&gt;-->
<!--<div>绑定手机号</div>-->
<!--<div class="input">-->
<!--点击绑定手机号<span class="iconfont icon-xiangyou"></span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="item acea-row row-between-wrapper" v-else-if="userInfo.phone">-->
<!--<div>手机号码</div>-->
<!--<div class="input acea-row row-between-wrapper">-->
<!--<div class="input acea-row row-between-wrapper">-->
<!--<input-->
<!--type="text"-->
<!--:value="userInfo.phone"-->
<!--disabled-->
<!--class="id"-->
<!--/><span class="iconfont icon-suozi"></span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div v-if="userInfo.phone && userInfo.user_type === 'h5'">-->
<!--<div-->
<!--@click="$yrouter.push('/pages/user/ChangePassword/index')"-->
<!--class="item acea-row row-between-wrapper"-->
<!--&gt;-->
<!--<div>密码</div>-->
<!--<div class="input">-->
<!--点击修改密码<span class="iconfont icon-xiangyou"></span>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
</div>
<!--<div class="modifyBnt bg-color-red" @click="submit">保存修改</div>-->
<!-- <div
class="logOut cart-color acea-row row-center-wrapper"
@click="logout"
v-if="!isWeixin"
>
退出登录
</div>-->
</div>
</template>
<script>
import { mapGetters } from "vuex";
import { trim, isWeixin } from "@/utils";
import { VUE_APP_API_URL } from "@/config";
import { postUserEdit, getLogout, switchH5Login, getUser } from "@/api/user";
import cookie from "@/utils/store/cookie";
import store from "@//store";
import dayjs from "dayjs";
export default {
name: "PersonalData",
components: {
// VueCoreImageUpload
},
data: function() {
return {
url: `${VUE_APP_API_URL}/upload/image`,
headers: {
Authorization: "Bearer " + this.$store.state.token
},
avatar: "",
isWeixin: false,
currentAccounts: 0,
switchUserInfo: [],
userIndex: 0
};
},
watch: {
$yroute(n) {
if (n.name === "PersonalData") this.$store.dispatch("USERINFO", true);
}
},
computed: mapGetters(["userInfo"]),
mounted: function() {
this.avatar = this.userInfo.avatar;
this.isWeixin = isWeixin();
this.getUserInfo();
},
methods: {
switchAccounts: function(index) {
let that = this;
this.userIndex = index;
let userInfo = this.switchUserInfo[this.userIndex];
if (this.switchUserInfo.length <= 1) return true;
if (userInfo === undefined)
return this.$dialog.toast({ mes: "切换的账号不存在" });
if (userInfo.user_type === "h5") {
switchH5Login()
.then(({ data }) => {
wx.hideLoading();
const expires_time = dayjs(data.expires_time);
store.commit("LOGIN", data.token, expires_time);
that.$emit("changeswitch", false);
location.reload();
})
.catch(err => {
wx.hideLoading();
return that.$dialog.toast({ mes: err });
});
} else {
cookie.set("loginType", "wechat", 60);
wx.hideLoading();
this.$store.commit("LOGOUT");
this.$emit("changeswitch", false);
}
},
getUserInfo: function() {
let that = this;
getUser().then(res => {
let switchUserInfo = res.data.switchUserInfo;
for (let i = 0; i < switchUserInfo.length; i++) {
if (switchUserInfo[i].uid == that.userInfo.uid) that.userIndex = i;
if (
!that.isWeixin &&
switchUserInfo[i].user_type != "h5" &&
switchUserInfo[i].phone === ""
)
switchUserInfo.splice(i, 1);
}
that.$set(this, "switchUserInfo", switchUserInfo);
});
},
imageuploaded(res) {
if (res.status !== 200)
return this.$dialog.error(res.msg || "上传图片失败");
if (this.switchUserInfo[this.userIndex] === undefined) return;
this.$set(this.switchUserInfo[this.userIndex], "avatar", res.data.url);
},
submit: function() {
let userInfo = this.switchUserInfo[this.userIndex];
postUserEdit({
nickname: trim(this.userInfo.nickname),
avatar: userInfo.avatar
}).then(
res => {
this.$store.dispatch("USERINFO", true);
this.$wx.showToast({ title: res.msg, icon: "none", duration: 2000 });
this.$yrouter.back();
},
error => {
this.$dialog.error(error.msg);
}
);
},
logout: function() {
this.$dialog.confirm({
mes: "确认退出登录?",
opts: () => {
getLogout()
.then(res => {
this.$store.commit("LOGOUT");
clearAuthStatus();
location.href = location.origin;
})
.catch(err => {});
}
});
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+239
View File
@@ -0,0 +1,239 @@
<template>
<div>
<div class="recharge">
<div class="nav acea-row row-around row-middle">
<div
class="item"
:class="active === navRechargeIndex ? 'on' : ''"
v-for="(item, navRechargeIndex) in navRecharge"
:key="navRechargeIndex"
@click="navRecharges(navRechargeIndex)"
>{{ item }}</div>
</div>
<div class="info-wrapper">
<div class="money">
<span></span>
<input type="number" placeholder="0.00" v-model="money" />
</div>
<div class="tips" v-if="!active">
提示当前余额为
<span>{{ now_money || 0 }}</span>
</div>
<div class="pay-btn bg-color-red" @click="recharge">{{ active ? "立即转入" : "立即充值" }}</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from "vuex";
import { weapppay } from "@/libs/wechat";
import { isWeixin } from "@/utils";
import { rechargeWechat } from "@/api/user";
import { add, sub } from "@/utils/bc";
export default {
name: "Recharge",
components: {},
props: {},
data: function() {
return {
navRecharge: ["账户充值"],
active: 0,
payType: ["weixin"],
from: isWeixin() ? "weixin" : "weixinh5",
money: "",
now_money: ""
};
},
computed: mapGetters(["userInfo"]),
mounted: function() {
this.now_money = this.userInfo.now_money;
},
methods: {
navRecharges: function(index) {
this.active = index;
},
recharge: function() {
let that = this,
price = Number(this.money);
if (that.active) {
if (price === 0) {
return that.$dialog.toast({ mes: "请输入您要转入的金额" });
} else if (price < 0.01) {
return that.$dialog.toast({ mes: "转入金额不能低于0.01" });
}
this.$dialog.confirm({
mes: "转入余额无法在转出,请确认转入",
title: "转入余额",
opts: [
{
txt: "确认",
color: false,
callback: () => {
rechargeWechat({ price: price, from: that.from, type: 1 })
.then(res => {
that.now_money = add(
price,
parseInt(that.userInfo.now_money)
);
that.userInfo.brokerage_price = sub(
that.userInfo.brokerage_price,
price
);
that.money = "";
return that.$dialog.toast({ mes: res.msg });
})
.catch(res => {
that.$dialog.toast({ mes: res.msg });
});
}
},
{
txt: "取消",
color: false,
callback: () => {
return that.$dialog.toast({ mes: "已取消" });
}
}
]
});
} else {
if (price === 0) {
return that.$dialog.toast({ mes: "请输入您要充值的金额" });
} else if (price < 0.01) {
return that.$dialog.toast({ mes: "充值金额不能低于0.01" });
}
rechargeWechat({ price: price, from: that.from })
.then(res => {
var data = res.data;
if (data.type == "weixinh5") {
location.replace(data.data.mweb_url);
this.$dialog.confirm({
mes: "充值余额",
opts: [
{
txt: "已充值",
color: false,
callback: () => {
that.$yrouter.replace({
path: "/user/account"
});
}
},
{
txt: "查看余额",
color: false,
callback: () => {
that.$yrouter.replace({
path: "/user/account"
});
}
}
]
});
} else {
weappPay(data.data)
.then(res => {
that.now_money = add(
price,
parseInt(that.userInfo.now_money)
);
that.$dialog.toast({ mes: "支付成功" });
})
.catch(function() {
that.$dialog.toast({ mes: "支付失败" });
});
}
})
.catch(res => {
that.$dialog.toast({ mes: res.msg });
});
}
}
}
};
</script>
<style scoped>
#iframe {
display: none;
}
.recharge {
width: 7.03rem;
padding: 0.5rem 0.63rem 0.45rem;
background-color: #fff;
margin: 0.2rem auto 0 auto;
border-radius: 0.1rem;
}
.recharge .nav {
height: 0.75rem;
line-height: 0.75rem;
padding: 0 1rem;
}
.recharge .nav .item {
font-size: 0.3rem;
color: #333;
}
.recharge .nav .item.on {
font-weight: bold;
border-bottom: 0.04rem solid #e83323;
}
.recharge .info-wrapper {
text-align: center;
}
.recharge .info-wrapper .money {
margin-top: 0.6rem;
padding-bottom: 0.2rem;
border-bottom: 1px dashed #ddd;
}
.recharge .info-wrapper .money span {
font-size: 0.56rem;
color: #333;
font-weight: bold;
}
.recharge .info-wrapper .money input {
display: inline-block;
width: 3rem;
font-size: 0.84rem;
text-align: center;
color: #282828;
font-weight: bold;
padding-right: 0.7rem;
}
.recharge .info-wrapper .money input::placeholder {
color: #ddd;
}
.recharge .info-wrapper .money input::-webkit-input-placeholder {
color: #ddd;
}
.recharge .info-wrapper .money input:-moz-placeholder {
color: #ddd;
}
.recharge .info-wrapper .money input::-moz-placeholder {
color: #ddd;
}
.recharge .info-wrapper .money input:-ms-input-placeholder {
color: #ddd;
}
.recharge .info-wrapper .tips {
font-size: 0.26rem;
color: #888;
margin: 0.25rem auto 0 auto;
line-height: 1.5;
padding: 0 0.3rem;
}
.recharge .info-wrapper .tips span {
color: #ef4a49;
}
.recharge .info-wrapper .pay-btn {
display: block;
width: 5.5rem;
height: 0.86rem;
margin: 0.5rem auto 0 auto;
line-height: 0.86rem;
text-align: center;
color: #fff;
border-radius: 0.5rem;
font-size: 0.3rem;
font-weight: bold;
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+68
View File
@@ -0,0 +1,68 @@
<template>
<div class="register absolute">
<div class="shading">
<div class="pictrue acea-row row-center-wrapper">
<img src="@/assets/images/logo.png" />
</div>
</div>
<div class="whiteBg">
<div class="title">注册账号</div>
<div class="list">
<div class="item">
<div>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_"></use>
</svg>
<input type="text" placeholder="输入手机号码" />
</div>
</div>
<div class="item">
<div class="align-left">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1"></use>
</svg>
<input type="text" placeholder="填写验证码" class="codeIput" />
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>
{{ text }}
</button>
</div>
</div>
<div class="item">
<div>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_"></use>
</svg>
<input type="text" placeholder="填写您的登录密码" />
</div>
</div>
</div>
<div class="logon">注册</div>
<div class="tip">
已有账号?
<span @click="$yrouter.push({ name: 'Login' })" class="font-color-red"
>立即登录</span
>
</div>
</div>
<div class="bottom"></div>
</div>
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
export default {
name: "Register",
mixins: [sendVerifyCode],
methods: {
code: function() {
this.sendCode();
}
}
};
</script>
+145
View File
@@ -0,0 +1,145 @@
<template>
<div class="register absolute">
<div class="shading">
<div class="pictrue acea-row row-center-wrapper">
<img src="@/assets/images/logo.png" />
</div>
</div>
<div class="whiteBg">
<div class="title">找回密码</div>
<div class="list">
<div class="item">
<div>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_"></use>
</svg>
<input type="text" placeholder="输入手机号码" v-model="account" />
</div>
</div>
<div class="item">
<div class="align-left">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1"></use>
</svg>
<input
type="text"
placeholder="填写验证码"
class="codeIput"
v-model="captcha"
/>
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>
{{ text }}
</button>
</div>
</div>
<div class="item">
<div>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_"></use>
</svg>
<input
type="password"
placeholder="填写您的登录密码"
v-model="password"
/>
</div>
</div>
</div>
<div class="logon" @click="registerReset">确认</div>
<div class="tip">
<span @click="$yrouter.push({ name: 'Login' })" class="font-color-red"
>立即登录</span
>
</div>
</div>
<div class="bottom"></div>
</div>
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import { registerVerify, registerReset } from "@/api/user";
import { validatorDefaultCatch } from "@/utils/dialog";
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
export default {
name: "RetrievePassword",
data: function() {
return {
account: "",
password: "",
captcha: ""
};
},
mixins: [sendVerifyCode],
methods: {
async registerReset() {
var that = this;
const { account, captcha, password } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
})
.validate({ account, captcha, password });
} catch (e) {
return validatorDefaultCatch(e);
}
registerReset({
account: that.account,
captcha: that.captcha,
password: that.password
})
.then(res => {
that.$dialog.success(res.msg).then(() => {
that.$yrouter.push({ name: "Login" });
});
})
.catch(res => {
that.$dialog.error(res.msg);
});
},
async code() {
var that = this;
const { account } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
})
.validate({ account });
} catch (e) {
return validatorDefaultCatch(e);
}
registerVerify({ phone: that.account })
.then(res => {
that.$dialog.success(res.msg);
that.sendCode();
})
.catch(res => {
that.$dialog.error(res.msg);
});
}
}
};
</script>
+319
View File
@@ -0,0 +1,319 @@
<template>
<div class="user">
<div class="header bg-color-red acea-row row-between-wrapper">
<div class="picTxt acea-row row-between-wrapper">
<div class="pictrue">
<img :src="userInfo.avatar" />
</div>
<div class="text">
<div class="acea-row row-middle">
<div class="name line1">{{ userInfo.nickname }}</div>
<div class="member acea-row row-middle" v-if="userInfo.vip">
<img :src="userInfo.vipIcon" />
{{ userInfo.vipName }}
</div>
</div>
<div
@click="$yrouter.push('/pages/user/PersonalData/index')"
class="id"
v-if="userInfo.phone"
>
ID{{ userInfo.uid || 0
}}
<span class="iconfont icon-bianji1"></span>
</div>
<button
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
class="binding"
v-else
>
<span>绑定手机号</span>
</button>
</div>
</div>
<span
class="iconfont icon-shezhi"
@click="$yrouter.push({ path: '/pages/user/PersonalData/index' })"
></span>
</div>
<div class="wrapper">
<div class="nav acea-row row-middle">
<div @click="$yrouter.push({ path: '/pages/user/UserAccount/index' })" class="item">
<div>我的余额</div>
<div class="num">{{ userInfo.nowMoney || 0 }}</div>
</div>
<div
@click="$yrouter.push('/pages/user/promotion/UserPromotion/index')"
class="item"
v-if="userInfo.isPromoter === 1 || userInfo.statu === 2"
>
<div>当前佣金</div>
<div class="num">{{ userInfo.brokeragePrice || 0 }}</div>
</div>
<div @click="$yrouter.push('/pages/user/signIn/Integral/index')" class="item" v-else>
<div>当前积分</div>
<div class="num">{{ userInfo.integral || 0 }}</div>
</div>
<div @click="$yrouter.push('/pages/user/coupon/UserCoupon/index')" class="item">
<div>优惠券</div>
<div class="num">{{ userInfo.couponCount || 0 }}</div>
</div>
</div>
<div class="myOrder">
<div class="title acea-row row-between-wrapper">
<div>我的订单</div>
<div @click="$yrouter.push('/pages/order/MyOrder/index')" class="allOrder">
全部订单
<span class="iconfont icon-jiantou"></span>
</div>
</div>
<div class="orderState acea-row row-middle">
<div
@click="$yrouter.push({ path: '/pages/order/MyOrder/index',query:{type:0}})"
class="item"
>
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL + '/images/dfk.png'" />
<span
class="order-status-num"
v-if="orderStatusNum.unpaidCount > 0"
>{{ orderStatusNum.unpaidCount }}</span>
</div>
<div>待付款</div>
</div>
<div
@click="$yrouter.push({ path: '/pages/order/MyOrder/index',query:{type:1} })"
class="item"
>
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/dfh.png'" />
<span
class="order-status-num"
v-if="orderStatusNum.unshippedCount > 0"
>{{ orderStatusNum.unshippedCount }}</span>
</div>
<div>待发货</div>
</div>
<div
@click="$yrouter.push({ path: '/pages/order/MyOrder/index',query:{type:2}})"
class="item"
>
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/dsh.png'" />
<span
class="order-status-num"
v-if="orderStatusNum.receivedCount > 0"
>{{ orderStatusNum.receivedCount }}</span>
</div>
<div>待收货</div>
</div>
<div
@click="$yrouter.push({ path: '/pages/order/MyOrder/index',query:{type:3} })"
class="item"
>
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/dpj.png'" />
<span
class="order-status-num"
v-if="orderStatusNum.evaluatedCount > 0"
>{{ orderStatusNum.evaluatedCount }}</span>
</div>
<div>待评价</div>
</div>
<div @click="$yrouter.push('/pages/order/ReturnList/index')" class="item">
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/sh.png'" />
<span
class="order-status-num"
v-if="orderStatusNum.refundCount > 0"
>{{ orderStatusNum.refundCount }}</span>
</div>
<div>售后/退款</div>
</div>
</div>
</div>
<div class="myService">
<div class="title acea-row row-middle">我的服务</div>
<div class="serviceList acea-row row-middle">
<template v-for="(item, MyMenusIndex) in MyMenus">
<div class="item" :key="MyMenusIndex" @click="goPages(MyMenusIndex)" v-if="item.url">
<div class="pictrue">
<img :src="item.pic" />
</div>
<div>{{ item.name }}</div>
</div>
</template>
<!--<div-->
<!--class="item"-->
<!--@click="changeswitch(true)"-->
<!--v-if="userInfo.phone && isWeixin"-->
<!--&gt;-->
<!--<div class="pictrue"><img :src="$VUE_APP_RESOURCES_URL+'/images/switch.png'" /></div>-->
<!--<div>账号切换</div>-->
<!--</div>-->
</div>
</div>
</div>
<p style="text-align: center;margin-top: 1rem">By@意象</p>
<div class="footer-line-height"></div>
<SwitchWindow
v-on:changeswitch="changeswitch"
:switchActive="switchActive"
:login_type="userInfo.login_type"
></SwitchWindow>
</div>
</template>
<script>
import { getUser, getMenuUser, bindingPhone } from "@/api/user";
import { isWeixin, VUE_APP_RESOURCES_URL } from "@/utils";
import SwitchWindow from "@/components/SwitchWindow";
import { mapGetters } from "vuex";
const NAME = "User";
export default {
name: NAME,
components: {
SwitchWindow
},
props: {},
data: function() {
return {
userInfo: {},
MyMenus: [],
orderStatusNum: {},
switchActive: false,
isWeixin: false
};
},
computed: mapGetters(["wxCode"]),
watch: {
$yroute(n) {
if (n.name === NAME) this.User();
}
},
mounted: function() {
console.log('这个是个人中心')
this.User();
this.MenuUser();
this.isWeixin = isWeixin();
},
methods: {
getPhoneNumber: function(e) {
console.log(e.mp.detail);
if (e.mp.detail.errMsg == "getPhoneNumber:ok") {
wx.showLoading({ title: "绑定中" });
wx.login({
success: loginRes => {
bindingPhone({
code: loginRes.code,
encryptedData: e.mp.detail.encryptedData,
iv: e.mp.detail.iv
})
.then(res => {
this.User();
wx.hideLoading();
wx.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
})
.catch(error => {
wx.showToast({
title: error.msg || error.response.data.msg,
icon: "none",
duration: 2000
});
});
}
});
} else {
wx.showToast({
title: "已拒绝授权",
icon: "none",
duration: 2000
});
}
},
changeswitch: function(data) {
this.switchActive = data;
},
User: function() {
let that = this;
getUser().then(res => {
that.userInfo = res.data;
that.orderStatusNum = res.data.orderStatusNum;
});
},
MenuUser: function() {
let that = this;
getMenuUser().then(res => {
that.MyMenus = res.data.routine_my_menus;
});
},
goPages: function(index) {
let url = this.MyMenus[index].wxapp_url;
if (
url === "/pages/user/promotion/UserPromotion/main" &&
this.userInfo.statu === 1
) {
if (!this.userInfo.isPromoter)
return this.$dialog.toast({ mes: "您还没有推广权限!!" });
}
if (
url === "/pages/orderAdmin/OrderIndex/main" &&
!this.userInfo.adminid
) {
return this.$dialog.toast({ mes: "您还不是管理员!!" });
}
this.$yrouter.push({ path: this.MyMenus[index].wxapp_url });
}
},
onShow() {
this.User();
this.MenuUser();
this.isWeixin = isWeixin();
}
};
</script>
<style>
.footer-line-height {
height: 1rem;
}
.order-status-num {
min-width: 0.33rem;
background-color: #fff;
color: #73cbb6;
border-radius: 15px;
position: absolute;
right: -0.14rem;
top: -0.15rem;
font-size: 0.2rem;
padding: 0 0.08rem;
border: 1px solid #73cbb6;
}
.pictrue {
position: relative;
}
.switch-h5 {
margin-left: 0.2rem;
}
.binding {
margin-top: 0.1rem;
display: inline-block;
padding: 0.05rem 0.2rem;
background-color: #ca1f10;
border-radius: 50px;
font-size: 0.22rem;
line-height: 1.5;
border: 1px solid #e8695e;
color: #ffffff;
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+93
View File
@@ -0,0 +1,93 @@
<template>
<div class="my-account">
<div class="wrapper">
<div class="header">
<div class="headerCon">
<div class="account acea-row row-top row-between">
<div class="assets">
<div>总资产()</div>
<div class="money">{{ now_money }}</div>
</div>
</div>
<div class="cumulative acea-row row-top">
<div class="item">
<div>累计消费()</div>
<div class="money">{{ orderStatusSum }}</div>
</div>
</div>
</div>
</div>
<div class="nav acea-row row-middle">
<div class="item" @click="$yrouter.push({path:'/pages/user/UserBill/index',query:{id:0}})">
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/record1.png'" />
</div>
<div>账单记录</div>
</div>
<div class="item" @click="$yrouter.push({path:'/pages/user/UserBill/index',query:{id:1}})">
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/record2.png'" />
</div>
<div>消费记录</div>
</div>
</div>
<div class="advert acea-row row-between-wrapper"></div>
</div>
<Recommend></Recommend>
</div>
</template>
<script>
import Recommend from "@/components/Recommend";
import { getActivityStatus, getBalance } from "@/api/user";
export default {
name: "UserAccount",
components: {
Recommend
},
props: {},
data: function() {
return {
now_money: 0,
orderStatusSum: 0,
recharge: 0,
activity: {
is_bargin: false,
is_pink: false,
is_seckill: false
}
};
},
mounted: function() {
this.getIndex();
this.getActivity();
},
methods: {
getIndex: function() {
let that = this;
getBalance().then(
res => {
that.now_money = res.data.now_money;
that.orderStatusSum = res.data.orderStatusSum;
that.recharge = res.data.recharge;
},
err => {
that.$dialog.message(err.msg);
}
);
},
getActivity: function() {
let that = this;
getActivityStatus().then(
res => {
that.activity.is_bargin = res.data.is_bargin;
that.activity.is_pink = res.data.is_pink;
that.activity.is_seckill = res.data.is_seckill;
},
error => {
that.$dialog.message(error.msg);
}
);
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+105
View File
@@ -0,0 +1,105 @@
<template>
<div class="bill-details" ref="container">
<div class="nav acea-row">
<div class="item" :class="types == 0 ? 'on' : ''" @click="changeTypes(0)">全部</div>
<div class="item" :class="types == 1 ? 'on' : ''" @click="changeTypes(1)">消费</div>
</div>
<div class="sign-record">
<div class="list">
<div class="item" v-for="(item, listIndex) in list" :key="listIndex">
<div class="data">{{ item.time }}</div>
<div class="listn" v-for="(val, key) in item.list" :key="key">
<div class="itemn acea-row row-between-wrapper">
<div>
<div class="name line1">{{ val.title }}</div>
<div>{{ val.add_time }}</div>
</div>
<div
class="num"
:class="val.pm == 0 ? 'font-color-red' : ''"
>{{ val.pm == 0 ? "-" : "+" }}{{ val.number }}</div>
</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loaded" :loading="loading"></Loading>
</div>
</template>
<script>
import { getCommissionInfo } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "UserBill",
components: {
Loading
},
props: {},
data: function() {
return {
types: "",
where: {
page: 1,
limit: 5
},
list: [],
loaded: false,
loading: false
};
},
watch: {
"$yroute.query.types": function(newVal) {
let that = this;
if (newVal != undefined) {
that.types = newVal;
that.list = [];
that.where.page = 1;
that.loaded = false;
that.loading = false;
that.getIndex();
}
},
types: function() {
this.getIndex();
}
},
mounted: function() {
let that = this;
that.types = that.$yroute.query.types;
that.getIndex();
},
onReachBottom() {
!that.loading && that.getIndex();
},
methods: {
code: function() {
this.sendCode();
},
changeTypes: function(val) {
if (val != this.types) {
this.types = val;
this.list = [];
this.where.page = 1;
this.loaded = false;
this.loading = false;
}
},
getIndex: function() {
let that = this;
if (that.loaded == true || that.loading == true) return;
that.loading = true;
getCommissionInfo(that.where, that.types).then(
res => {
that.loading = false;
that.loaded = res.data.length < that.where.limit;
that.where.page = that.where.page + 1;
that.list.push.apply(that.list, res.data);
},
error => {
that.$dialog.message(error.msg);
}
);
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+203
View File
@@ -0,0 +1,203 @@
<template>
<div class="member-center">
<div class="header">
<div class="slider-banner banner">
<swiper indicatorDots="true" @change="swiperChange">
<block v-for="(item, vipListIndex) in vipList" :key="vipListIndex">
<swiper-item>
<div class="swiper-slide" :style="{ backgroundImage: 'url(' + item.image + ')' }">
<!-- <img :src="item.icon" />-->
<div class="name">{{ item.name }}</div>
<div class="discount">
可享受商品折扣: {{ item.discount / 10 }}
<span class="iconfont icon-zhekou"></span>
</div>
<div class="nav acea-row" v-if="item.grade == grade">
<div class="item" v-for="(val, indexn) in vipComplete" :key="indexn">
<div class="num">{{ val.newNumber }}</div>
<div>{{ val.realName }}</div>
</div>
</div>
<div class="lock" v-if="item.grade > grade">
<span class="iconfont icon-quanxianguanlisuozi"></span>该会员等级尚未解锁
</div>
<div class="lock" v-if="item.grade < grade">
<span class="iconfont icon-xuanzhong1"></span>已解锁更高等级
</div>
</div>
</swiper-item>
</block>
</swiper>
</div>
</div>
<div class="wrapper">
<div class="title acea-row row-between-wrapper">
<div>
<span class="iconfont icon-jingyanzhi"></span>会员升级要求
</div>
<div class="num">
<span class="current">{{ taskCount }}</span>
/{{ vipRequire.length }}
</div>
</div>
<div class="list">
<div class="item" v-for="(item, vipCompleteIndex) in vipComplete" :key="vipCompleteIndex">
<div class="top acea-row row-between-wrapper">
<div class="name">
{{ item.name
}}
<span
class="iconfont icon-wenti"
v-if="item.illustrate"
@click="showGrow(item)"
></span>
</div>
<div>{{ item.finish ? "已满足条件" : "未满足条件" }}</div>
</div>
<div class="cu-progress">
<div class="bg-red" :style="{ width: item.speed + '%' }"></div>
</div>
<div class="experience acea-row row-between-wrapper">
<div>{{ item.taskTypeTitle }}</div>
<div>
<span class="num">{{ item.newNumber }}</span>
/{{ item.number }}
</div>
</div>
</div>
</div>
</div>
<Recommend></Recommend>
<div class="growthValue" :class="growthValue === false ? 'on' : ''">
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/value.jpg'" />
<span class="iconfont icon-guanbi3" @click="growthTap"></span>
</div>
<div class="conter">{{ illustrate }}</div>
</div>
<div class="mask" :hidden="growthValue" @click="growthTap"></div>
</div>
</template>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import Recommend from "@/components/Recommend";
import { getVipInfo, getVipTask, setDetection } from "@/api/user";
export default {
name: "Poster",
components: {
// swiper,
// swiperSlide,
Recommend
},
props: {},
data: function() {
return {
vipList: [], //等级列表
vipRequire: [], //等级要求
vipComplete: [], //完成情况
taskCount: 0, //任务数
grade: 0, //当前会员等级
swiperVip: {
speed: 1000,
effect: "coverflow",
slidesPerView: "auto",
centeredSlides: true,
// loop: true,
coverflowEffect: {
rotate: 0, // 旋转的角度
stretch: -20, // 拉伸 图片间左右的间距和密集度
depth: 100, // 深度 切换图片间上下的间距和密集度
modifier: 2, // 修正值 该值越大前面的效果越明显
slideShadows: false // 页面阴影效果
},
observer: true,
observeParents: true
},
loading: false,
growthValue: true,
illustrate: "",
activeIndex: 0
};
},
watch: {
vipList: function() {
let that = this;
if (that.vipList.length > 0) {
that.vipList.forEach(function(item, index) {
if (item.isClear === false) {
// that.swiper.slideTo(index);
that.activeIndex = index;
that.grade = item.grade;
}
});
}
}
},
computed: {
swiper() {
// return this.$refs.mySwiper.swiper;
}
},
mounted: function() {
let that = this;
setDetection();
that.getInfo();
// that.swiper.on("slideChange", function() {
// that.activeIndex = that.swiper.activeIndex;
// that.getTask();
// });
},
methods: {
swiperChange: function(e) {
let that = this;
that.activeIndex = e.mp.detail.current;
that.getTask();
},
growthTap: function() {
this.growthValue = true;
},
getInfo: function() {
let that = this;
getVipInfo().then(
res => {
that.vipList = res.data.list;
that.vipRequire = res.data.task.list;
that.vipComplete = res.data.task.task;
that.taskCount = res.data.task.reachCount;
},
err => {
that.$dialog.message(err.msg);
}
);
},
getTask: function() {
let that = this;
getVipTask(that.vipList[that.activeIndex].id).then(
res => {
that.vipRequire = res.data.list;
that.vipComplete = res.data.task;
that.taskCount = res.data.reach_count;
},
err => {
that.$dialog.message(err.msg);
}
);
},
showGrow: function(item) {
if (this.illustrate != item.illustrate) this.illustrate = item.illustrate;
this.growthValue = false;
}
}
};
</script>
<style>
.banner swiper {
height: 328rpx;
}
.swiper-slide {
margin: 0 auto;
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+158
View File
@@ -0,0 +1,158 @@
<template>
<div class="addAddress absolute">
<div class="list">
<div class="item acea-row row-between-wrapper">
<div class="name">姓名</div>
<input type="text" placeholder="请输入姓名" v-model="userAddress.realName" required />
</div>
<div class="item acea-row row-between-wrapper">
<div class="name">联系电话</div>
<input type="text" placeholder="请输入联系电话" v-model="userAddress.phone" required />
</div>
<div class="item acea-row row-between-wrapper">
<div class="name">所在地区</div>
<div class="picker acea-row row-between-wrapper select-value form-control">
<div class="address">
<div slot="right" @click.stop="show2 = true">{{ model2 || "请选择收货地址" }}</div>
<vant-popup :show="show2" position="bottom" @close="closeaArea">
<vant-area
:area-list="district"
columns-num="3"
:columns-placeholder="['请选择', '请选择', '请选择']"
title="请选择"
@confirm="result2"
/>
</vant-popup>
</div>
<div class="iconfont icon-dizhi font-color-red"></div>
</div>
</div>
<div class="item acea-row row-between-wrapper">
<div class="name">详细地址</div>
<input type="text" placeholder="请填写具体地址" v-model="userAddress.detail" required />
</div>
</div>
<div class="default acea-row row-middle">
<div class="select-btn">
<div class="checkbox-wrapper">
<checkbox-group @change="ChangeIsDefault">
<label class="well-check">
<checkbox value :checked="userAddress.isDefault ? true : false"></checkbox>
<span class="def">设置为默认地址</span>
</label>
</checkbox-group>
</div>
</div>
</div>
<div></div>
<div class="keepBnt bg-color-red" @click="submit">立即保存</div>
<div class="wechatAddress" v-if="isWechat && !id" @click="getAddress">导入微信地址</div>
</div>
</template>
<script type="text/babel">
// import { CitySelect } from "vue-ydui/dist/lib.rem/cityselect";
// import District from "@/utils/area";
import { getAddress, postAddress, district } from "@/api/user";
import attrs, { required, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
// import { openAddress } from "@/libs/wechat";
import { isWeixin } from "@/utils";
export default {
components: {
// CitySelect
},
data() {
return {
show2: false,
model2: "",
district: {},
id: 0,
userAddress: { isDefault: 0 },
address: {},
isWechat: isWeixin()
};
},
mounted: function() {
let id = this.$yroute.query.id;
this.id = id;
// document.title = !id ? "添加地址" : "修改地址";
this.getUserAddress();
district().then(res => {
this.district = res.data;
});
},
methods: {
getUserAddress: function() {
if (!this.id) return false;
let that = this;
getAddress(that.id).then(res => {
that.userAddress = res.data;
that.model2 =
res.data.province + " " + res.data.city + " " + res.data.district;
that.address.province = res.data.province;
that.address.city = res.data.city;
that.address.district = res.data.district;
});
},
getAddress() {},
async submit() {
let name = this.userAddress.realName,
phone = this.userAddress.phone,
model2 = this.model2,
detail = this.userAddress.detail,
isDefault = this.userAddress.isDefault;
try {
await this.$validator({
name: [
required(required.message("姓名")),
attrs.range([2, 16], attrs.range.message("姓名"))
],
phone: [
required(required.message("联系电话")),
chs_phone(chs_phone.message())
],
model2: [required("请选择地址")],
detail: [required(required.message("具体地址"))]
}).validate({ name, phone, model2, detail });
} catch (e) {
return validatorDefaultCatch(e);
}
try {
let that = this,
data = {
id: that.id,
real_name: name,
phone: phone,
address: this.address,
detail: detail,
is_default: isDefault,
post_code: ""
};
postAddress(data).then(function() {
if (that.id) that.$dialog.toast({ mes: "修改成功" });
else that.$dialog.toast({ mes: "添加成功" });
that.$yrouter.go(-1);
});
} catch (e) {
this.$dialog.error(e.msg);
}
},
ChangeIsDefault: function() {
this.userAddress.isDefault = !this.userAddress.isDefault;
},
closeaArea() {
this.show2 = false;
},
result2(ret) {
let values = ret.mp.detail.values;
this.closeaArea();
this.address.province = values[0].name || "";
this.address.city = values[1].name || "";
this.address.district = values[2].name || "";
this.model2 =
this.address.province + this.address.city + this.address.district;
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
@@ -0,0 +1,213 @@
<template>
<div
class="address-management"
:class="addressList.length < 1 && page > 1 ? 'on' : ''"
ref="container"
>
<div class="line" v-if="addressList.length > 0">
<img :src="$VUE_APP_RESOURCES_URL+'/images/line.jpg'" />
</div>
<div class="item" v-for="(item, addressListIndex) in addressList" :key="addressListIndex">
<div class="address">
<div class="consignee">
收货人{{ item.realName }}
<span class="phone">{{ item.phone }}</span>
</div>
<div>
收货地址{{ item.province }}{{ item.city }}{{ item.district
}}{{ item.detail }}
</div>
</div>
<div class="operation acea-row row-between-wrapper">
<div class="select-btn">
<div class="checkbox-wrapper">
<checkbox-group @change="radioChange(item.id)">
<label class="well-check">
<checkbox value :checked="item.isDefault||item.isDefault=='1' ? true : false"></checkbox>
<span class="default">设为默认</span>
</label>
</checkbox-group>
<!-- <label class="well-check">
<input
type="radio"
name="default"
value
:checked="item.isDefault ? true : false"
@click="radioChange(addressListIndex)"
/>
<i class="icon"></i>
<span class="default">设为默认</span>
</label>-->
</div>
</div>
<div class="acea-row row-middle">
<div @click="editAddress(addressListIndex)">
<span class="iconfont icon-bianji"></span>编辑
</div>
<div @click="delAddress(addressListIndex)">
<span class="iconfont icon-shanchu"></span>删除
</div>
</div>
</div>
</div>
<Loading :loaded="loadend" :loading="loading"></Loading>
<div class="noCommodity" v-if="addressList.length < 1 && page > 1">
<div class="noPictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/noAddress.png'" class="image" />
</div>
</div>
<div style="height:100rpx;"></div>
<div class="footer acea-row row-between-wrapper">
<div class="addressBnt bg-color-red" v-if="isWechat" @click="addAddress">
<span class="iconfont icon-tianjiadizhi"></span>添加新地址
</div>
<div class="addressBnt on bg-color-red" v-else @click="addAddress">
<span class="iconfont icon-tianjiadizhi"></span>添加新地址
</div>
<!--<div class="addressBnt wxbnt" v-if="isWechat" @click="getAddress">-->
<!--<span class="iconfont icon-weixin2"></span>导入微信地址-->
<!--</div>-->
</div>
</div>
</template>
<style scoped>
.address-management.on {
background-color: #fff;
height: 100vh;
}
</style>
<script type="text/babel">
import {
getAddressList,
getAddressRemove,
getAddressDefaultSet,
postAddress
} from "@/api/user";
import Loading from "@/components/Loading";
import { isWeixin } from "@/utils";
// import { openAddress } from "@/libs/wechat";
export default {
components: {
Loading
},
data() {
return {
page: 1,
limit: 20,
addressList: [],
loadTitle: "",
loading: false,
loadend: false,
isWechat: isWeixin()
};
},
mounted: function() {
this.AddressList();
},
onReachBottom() {
!this.loading && this.AddressList();
},
onShow:function(){
this.refresh();
},
methods: {
refresh: function() {
this.addressList = [];
this.page = 1;
this.loadend = false;
this.AddressList();
},
/**
* 获取地址列表
*
*/
AddressList: function() {
let that = this;
if (that.loading) return; //阻止下次请求(false可以进行请求);
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
that.loading = true;
getAddressList({ page: that.page, limit: that.limit }).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.addressList.push.apply(that.addressList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
},
/**
* 编辑地址
*/
editAddress: function(index) {
this.$yrouter.push({
path: "/pages/user/address/AddAddress/main",
query: { id: this.addressList[index].id }
});
},
/**
* 删除地址
*/
delAddress: function(index) {
let that = this;
let address = this.addressList[index];
let id = address.id;
getAddressRemove(id).then(function() {
that.$dialog.toast({
mes: "删除成功!",
callback: () => {
that.addressList.splice(index, 1);
that.$set(that, "addressList", that.addressList);
}
});
});
},
/**
* 设置默认地址
*/
radioChange: function(id) {
getAddressDefaultSet(id).then(res => {
this.refresh();
wx.showToast({ title: res.msg, icon: "none", duration: 2000 });
});
},
/**
* 新增地址
*/
addAddress: function() {
this.$yrouter.push({
path: "/pages/user/address/AddAddress/main"
});
},
getAddress() {
// openAddress().then(userInfo => {
// wx.showLoading({ title: "加载中" });
// postAddress({
// real_name: userInfo.userName,
// phone: userInfo.telNumber,
// address: {
// province: userInfo.provinceName,
// city: userInfo.cityName,
// district: userInfo.countryName
// },
// detail: userInfo.detailInfo,
// post_code: userInfo.postalCode,
// wx_export: 1
// })
// .then(() => {
// this.page = 1;
// this.loading = false;
// this.loadend = false;
// this.addressList = [];
// this.AddressList();
// wx.hideLoading();
// this.$dialog.toast({ mes: "添加成功" });
// })
// .catch(err => {
// wx.hideLoading();
// this.$dialog.error(err.msg || "添加失败");
// });
// });
}
}
};
</script>
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+93
View File
@@ -0,0 +1,93 @@
<template>
<div ref="container">
<div class="coupon-list" v-if="couponsList.length > 0">
<div
class="item acea-row row-center-wrapper"
v-for="(item, couponsListIndex) in couponsList"
:key="couponsListIndex"
>
<div class="money" :class="item.isUse ? 'moneyGray' : ''">
<span class="num">{{ item.couponPrice }}</span>
</div>
<div class="text">
<div class="condition line1">购物满{{ item.useMinPrice }}元可用</div>
<div class="data acea-row row-between-wrapper">
<div v-if="item.endTime !== 0">
<data-format-t :data="item.startTime"></data-format-t>-
<data-format-t :data="item.endTime"></data-format-t>
</div>
<div v-else>不限时</div>
<div class="bnt gray" v-if="item.isUse === true">已领取</div>
<div class="bnt gray" v-else-if="item.isUse === 2">已领完</div>
<div class="bnt bg-color-red" v-else @click="getCoupon(item.id, couponsListIndex)">立即领取</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loadend" :loading="loading"></Loading>
<!--暂无优惠券-->
<div class="noCommodity" v-if="couponsList.length === 0 && page > 1">
<div class="noPictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/noCoupon.png'" class="image" />
</div>
</div>
</div>
</template>
<script>
import { getCoupon, getCouponReceive } from "@/api/user";
import Loading from "@/components/Loading";
import DataFormatT from "@/components/DataFormatT";
export default {
name: "getCoupon",
components: {
Loading,
DataFormatT
},
props: {},
data: function() {
return {
page: 1,
limit: 10,
couponsList: [],
loading: false,
loadend: false
};
},
mounted: function() {
this.getUseCoupons();
},
onReachBottom() {
!this.loading && this.getUseCoupons();
},
methods: {
getCoupon: function(id, index) {
let that = this;
let list = that.couponsList;
getCouponReceive(id)
.then(function(res) {
list[index].isUse = true;
that.$dialog.toast({ mes: "领取成功" });
})
.catch(function(res) {
that.$dialog.toast({ mes: res.response.data.msg });
});
},
getUseCoupons: function() {
let that = this;
if (that.loading) return; //阻止下次请求(false可以进行请求);
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
that.loading = true;
let q = { page: that.page, limit: that.limit };
getCoupon(q).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.couponsList.push.apply(that.couponsList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+74
View File
@@ -0,0 +1,74 @@
<template>
<div ref="container">
<div class="coupon-list" v-if="couponsList.length > 0">
<div
class="item acea-row row-center-wrapper"
v-for="(item, couponsListIndex) in couponsList"
:key="couponsListIndex"
>
<div class="money" :class="item._type === 0 ? 'moneyGray' : ''">
<span class="num">{{ item.couponPrice }}</span>
</div>
<div class="text">
<div class="condition line1">{{ item.couponTitle }}</div>
<div class="data acea-row row-between-wrapper">
<div v-if="item.endTime === 0">不限时</div>
<div v-else><data-format-t :data="item.addTime"></data-format-t> - <data-format-t :data="item.endTime"></data-format-t></div>
<div class="bnt gray" v-if="item._type === 0">{{ item._msg }}</div>
<div class="bnt bg-color-red" v-else>{{ item._msg }}</div>
</div>
</div>
</div>
</div>
<!--暂无优惠券-->
<div
class="noCommodity"
v-if="couponsList.length === 0 && loading === true"
>
<div class="noPictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/noCoupon.png'" class="image" />
</div>
</div>
</div>
</template>
<script>
import { getCouponsUser } from "@/api/user";
import DataFormatT from "@/components/DataFormatT";
const NAME = "UserCoupon";
export default {
name: "UserCoupon",
components: {
DataFormatT
},
props: {},
data: function() {
return {
couponsList: [],
loading: false
};
},
watch: {
$yroute: function(n) {
var that = this;
if (n.name === NAME) {
that.getUseCoupons();
}
}
},
mounted: function() {
this.getUseCoupons();
},
methods: {
getUseCoupons: function() {
let that = this,
type = 0;
getCouponsUser(type).then(res => {
that.couponsList = res.data;
that.loading = true;
});
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+30
View File
@@ -0,0 +1,30 @@
<template>
<div class="cash-audit">
<div class="pictrue"><img :src="$VUE_APP_RESOURCES_URL+'/images/examine.png'" /></div>
<div class="tip">提现申请已提交等待人工审核</div>
<div class="time">{{ time }}</div>
<div
class="bnt bg-color-red"
@click="$yrouter.push({ path: '/pages/user/promotion/UserPromotion/index' })"
>
好的
</div>
</div>
</template>
<script>
export default {
name: "CashAudit",
components: {},
props: {},
data: function() {
return {
time: ""
};
},
mounted: function() {
let myData = new Date();
this.time = myData.toLocaleString();
},
methods: {}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+96
View File
@@ -0,0 +1,96 @@
<template>
<div class="commission-details" ref="container">
<div class="promoterHeader bg-color-red">
<div class="headerCon acea-row row-between-wrapper">
<div>
<div class="name">提现记录</div>
<div class="money">
<span class="num">{{ commission }}</span>
</div>
</div>
<div class="iconfont icon-jinbi1"></div>
</div>
</div>
<div class="sign-record" ref="content">
<div class="list">
<div class="item" v-for="(item, infoIndex) in info" :key="infoIndex">
<div class="data">{{ item.time }}</div>
<div class="listn" v-for="(val, indexn) in item.list" :key="indexn">
<div class="itemn acea-row row-between-wrapper">
<div>
<div class="name line1">{{ val.title }}</div>
<div>{{ val.addTime }}</div>
</div>
<div class="num" v-if="val.pm == 1">+{{ val.number }}</div>
<div class="num font-color-red" v-if="val.pm == 0">
-{{ val.number }}
</div>
</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loaded" :loading="loading"></Loading>
</div>
</template>
<script>
import { getCommissionInfo, getSpreadInfo } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "CashRecord",
components: {
Loading
},
props: {},
data: function() {
return {
info: [],
commission: 0,
where: {
page: 1,
limit: 3
},
types: 4,
loaded: false,
loading: false
};
},
mounted: function() {
this.getCommission();
this.getIndex();
},
onReachBottom() {
this.loading === false && this.getIndex();
},
methods: {
getIndex: function() {
let that = this;
if (that.loading == true || that.loaded == true) return;
that.loading = true;
getCommissionInfo(that.where, that.types).then(
res => {
that.loading = false;
that.loaded = res.data.length < that.where.limit;
that.where.page = that.where.page + 1;
that.info.push.apply(that.info, res.data);
},
error => {
that.$dialog.message(error.msg);
}
);
},
getCommission: function() {
let that = this;
getSpreadInfo().then(
res => {
that.commission = res.data.commissionCount;
},
error => {
this.$dialog.message(error.msg);
}
);
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
@@ -0,0 +1,96 @@
<template>
<div class="commission-details" ref="container">
<div class="promoterHeader bg-color-red">
<div class="headerCon acea-row row-between-wrapper">
<div>
<div class="name">佣金明细</div>
<div class="money">
<span class="num">{{ commission }}</span>
</div>
</div>
</div>
</div>
<div class="sign-record" ref="content">
<div class="list">
<div class="item" v-for="(item, infoIndex) in info" :key="infoIndex">
<div class="data">{{ item.time }}</div>
<div class="listn" v-for="(val, indexn) in item.list" :key="indexn">
<div class="itemn acea-row row-between-wrapper">
<div>
<div class="name line1">{{ val.title }}</div>
<div>{{ val.addTime }}</div>
</div>
<div class="num" v-if="val.pm == 1">+{{ val.number }}</div>
<div class="num font-color-red" v-if="val.pm == 0">
-{{ val.number }}
</div>
</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loaded" :loading="loading"></Loading>
</div>
</template>
<script>
import { getCommissionInfo, getSpreadInfo } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "CommissionDetails",
components: {
Loading
},
props: {},
data: function() {
return {
info: [],
commission: 0,
where: {
page: 1,
limit: 3
},
types: 3,
loaded: false,
loading: false
};
},
mounted: function() {
this.getCommission();
this.getIndex();
},
onReachBottom() {
this.loading === false && this.getIndex();
},
methods: {
getIndex: function() {
let that = this;
if (that.loading == true || that.loaded == true) return;
that.loading = true;
getCommissionInfo(that.where, that.types).then(
res => {
that.loading = false;
that.loaded = res.data.length < that.where.limit;
that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
that.where.page = that.where.page + 1;
that.info.push.apply(that.info, res.data);
},
error => {
that.$dialog.message(error.msg);
}
);
},
getCommission: function() {
let that = this;
getSpreadInfo().then(
res => {
that.commission = res.data.commissionCount;
},
error => {
this.$dialog.message(error.msg);
}
);
}
}
};
</script>
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+158
View File
@@ -0,0 +1,158 @@
<template>
<div class="distribution-posters">
<div class="slider-banner banner">
<swiper indicatorDots="true">
<block v-for="(item, infoIndex) in info" :key="infoIndex">
<swiper-item>
<img class="slide-image" :src="item.wap_poster" mode="widthFix" show-menu-by-longpress />
</swiper-item>
</block>
</swiper>
</div>
<div class="keep bg-color-red" @click="saveImg">保存海报</div>
</div>
</template>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import { getSpreadImg } from "@/api/user";
export default {
name: "Poster",
components: {
// swiper,
// swiperSlide
},
props: {},
data: function() {
return {
swiperPosters: {
speed: 1000,
effect: "coverflow",
slidesPerView: "auto",
centeredSlides: true,
coverflowEffect: {
rotate: 0, // 旋转的角度
stretch: -20, // 拉伸 图片间左右的间距和密集度
depth: 100, // 深度 切换图片间上下的间距和密集度
modifier: 3, // 修正值 该值越大前面的效果越明显
slideShadows: false // 页面阴影效果
},
observer: true,
observeParents: true
},
info: [],
activeIndex: 0
};
},
mounted: function() {
this.getIndex();
let that = this;
// this.swiper.on("slideChange", function() {
// that.activeIndex = that.swiper.activeIndex;
// });
},
computed: {
swiper() {
// return this.$refs.mySwiper.swiper;
}
},
methods: {
getIndex: function() {
let that = this;
getSpreadImg().then(
res => {
that.info = res.data;
},
err => {
that.$dialog.message(err.msg);
}
);
},
downloadIamge: function(imgsrc, name) {
// let image = new Image();
// image.setAttribute("crossOrigin", "anonymous");
// image.onload = function() {
// // let canvas = document.createElement("canvas");
// // canvas.width = image.width;
// // canvas.height = image.height;
// // let context = canvas.getContext("2d");
// // context.drawImage(image, 0, 0, image.width, image.height);
// // let url = canvas.toDataURL("image/png"); //得到图片的base64编码数据
// // let a = document.createElement("a"); // 生成一个a元素
// // let event = new MouseEvent("click"); // 创建一个单击事件
// // a.download = name || "photo"; // 设置图片名称
// // a.href = url; // 将生成的URL设置为a.href属性
// // a.dispatchEvent(event); // 触发a的单击事件
// };
// image.src = imgsrc;
var that = this;
this.isDown = true;
var downloadUrl = imgsrc;
if (!wx.saveImageToPhotosAlbum) {
wx.showModal({
title: "提示",
content:
"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
});
that.openDialogVisible = true;
return;
}
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.writePhotosAlbum" 这个 scope
wx.getSetting({
success(res) {
if (!res.authSetting["scope.writePhotosAlbum"]) {
that.openDialogVisible = true;
// 接口调用询问
wx.authorize({
scope: "scope.writePhotosAlbum",
success() {
that.downloadImage(downloadUrl);
},
fail() {
// 用户拒绝了授权
// 打开设置页面
wx.openSetting({
success: function(data) {},
fail: function(data) {}
});
}
});
} else {
that.downloadImage(downloadUrl);
}
},
fail(res) {
that.openDialogVisible = true;
}
});
},
saveImg: function() {
this.downloadIamge(
this.info[this.activeIndex].wap_poster,
"poster" + this.activeIndex
);
}
}
};
</script>
<style scoped>
.distribution-posters {
height: 100%;
}
.banenr {
height: 100%;
}
.banner swiper {
height: 100%;
}
.banner .slide-image {
width: 100%;
height: auto;
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+249
View File
@@ -0,0 +1,249 @@
<template>
<div class="promoter-list" ref="container">
<div class="header">
<div class="promoterHeader bg-color-red">
<div class="headerCon acea-row row-between-wrapper">
<div>
<div class="name">推广人数</div>
<div>
<span class="num">{{ first + second }}</span
>
</div>
</div>
</div>
</div>
<div class="nav acea-row row-around">
<div
class="item"
:class="screen.grade == 0 ? 'on' : ''"
@click="checkGrade(0)"
>
一级({{ first }})
</div>
<div
class="item"
:class="screen.grade == 1 ? 'on' : ''"
@click="checkGrade(1)"
>
二级({{ second }})
</div>
</div>
<div class="search acea-row row-between-wrapper">
<form @submit.prevent="submitForm">
<div class="input">
<input placeholder="点击搜索会员名称" v-model="screen.keyword" />
<span class="iconfont icon-guanbi"></span>
</div>
</form>
<div class="iconfont icon-sousuo2"></div>
</div>
</div>
<div class="list">
<div
class="sortNav acea-row row-middle"
:class="fixedState === true ? 'on' : ''"
>
<div class="sortItem" @click="sort('childCount')">
团队排序
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort1.png'" v-if="childCount == 1" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort2.png'" v-if="childCount == 2" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort3.png'" v-if="childCount == 3" />
</div>
<div class="sortItem" @click="sort('numberCount')">
金额排序
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort1.png'" v-if="numberCount == 1" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort2.png'" v-if="numberCount == 2" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort3.png'" v-if="numberCount == 3" />
</div>
<div class="sortItem" @click="sort('orderCount')">
订单排序
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort1.png'" v-if="orderCount == 1" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort2.png'" v-if="orderCount == 2" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/sort3.png'" v-if="orderCount == 3" />
</div>
</div>
<div :class="fixedState === true ? 'sortList' : ''">
<div
class="item acea-row row-between-wrapper"
v-for="(val, spreadListIndex) in spreadList"
:key="spreadListIndex"
>
<div class="picTxt acea-row row-between-wrapper">
<div class="pictrue"><img :src="val.avatar" /></div>
<div class="text">
<div class="name line1">{{ val.nickname }}</div>
<div>加入时间: {{ val.time }}</div>
</div>
</div>
<div class="right">
<div>
<span class="font-color-red">{{ val.childCount }}</span>
</div>
<div>{{ val.orderCount }} </div>
<div>{{ val.numberCount ? val.numberCount : 0 }} </div>
</div>
</div>
</div>
</div>
<Loading :loaded="loaded" :loading="loading"></Loading>
</div>
</template>
<script>
import { getSpreadUser } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "PromoterList",
components: {
Loading
},
props: {},
data: function() {
return {
fixedState: false,
screen: {
page: 1,
limit: 15,
grade: 0,
keyword: "",
sort: ""
},
childCount: 2,
numberCount: 2,
orderCount: 2,
loaded: false,
loading: false,
spreadList: [],
loadTitle: "",
first: "",
second: ""
};
},
mounted: function() {
this.getSpreadUsers();
},
onReachBottom() {
!this.loading && this.getSpreadUsers();
},
watch: {
"screen.sort": function() {
this.screen.page = 0;
this.loaded = false;
this.loading = false;
this.spreadList = [];
this.getSpreadUsers();
}
},
methods: {
handleScroll: function() {
// var scrollTop =
// document.documentElement.scrollTop || document.body.scrollTop;
// var offsetTop = document.querySelector(".header").clientHeight;
// if (scrollTop >= offsetTop) {
// this.fixedState = true;
// } else {
// this.fixedState = false;
// }
},
submitForm: function() {
this.screen.page = 0;
this.loaded = false;
this.loading = false;
this.spreadList = [];
this.getSpreadUsers();
},
getSpreadUsers: function() {
let that = this,
screen = that.screen;
if (that.loaded || that.loading) return;
that.loading = true;
getSpreadUser(screen).then(
res => {
that.loading = false;
that.spreadList.push.apply(that.spreadList, res.data.list);
that.loaded = res.data.list.length < that.screen.limit; //判断所有数据是否加载完成;
that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
that.screen.page = that.screen.page + 1;
that.first = res.data.total;
that.second = res.data.totalLevel;
},
error => {
that.$dialog.message(error.msg);
},
300
);
},
checkGrade: function(val) {
if (val == this.screen.grade) return;
else {
this.screen.page = 1;
this.screen.grade = val;
this.loading = false;
this.loaded = false;
this.spreadList = [];
this.getSpreadUsers();
}
},
sort: function(types) {
let that = this;
switch (types) {
case "childCount":
if (that.childCount == 2) {
that.childCount = 1;
that.orderCount = 2;
that.numberCount = 2;
that.screen.sort = "childCount DESC";
} else if (that.childCount == 1) {
that.childCount = 3;
that.orderCount = 2;
that.numberCount = 2;
that.screen.sort = "childCount ASC";
} else if (that.childCount == 3) {
that.childCount = 2;
that.orderCount = 2;
that.numberCount = 2;
that.screen.sort = "";
}
break;
case "numberCount":
if (that.numberCount == 2) {
that.numberCount = 1;
that.orderCount = 2;
that.childCount = 2;
that.screen.sort = "numberCount DESC";
} else if (that.numberCount == 1) {
that.numberCount = 3;
that.orderCount = 2;
that.childCount = 2;
that.screen.sort = "numberCount ASC";
} else if (that.numberCount == 3) {
that.numberCount = 2;
that.orderCount = 2;
that.childCount = 2;
that.screen.sort = "";
}
break;
case "orderCount":
if (that.orderCount == 2) {
that.orderCount = 1;
that.numberCount = 2;
that.childCount = 2;
that.screen.sort = "orderCount DESC";
} else if (that.orderCount == 1) {
that.orderCount = 3;
that.numberCount = 2;
that.childCount = 2;
that.screen.sort = "orderCount ASC";
} else if (that.orderCount == 3) {
that.orderCount = 2;
that.numberCount = 2;
that.childCount = 2;
that.screen.sort = "";
}
break;
default:
that.screen.sort = "";
}
}
}
};
</script>
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
@@ -0,0 +1,96 @@
<template>
<div class="promoter-order" ref="container">
<div class="promoterHeader bg-color-red">
<div class="headerCon acea-row row-between-wrapper">
<div>
<div class="name">累计推广订单</div>
<div>
<span class="num">{{ count }}</span
>
</div>
</div>
</div>
</div>
<div class="list">
<div class="item" v-for="(item, listIndex) in list" :key="listIndex">
<div class="title acea-row row-column row-center">
<div class="data">{{ item.time }}</div>
<div>本月累计推广订单{{ item.count ? item.count : 0 }}</div>
</div>
<div class="listn">
<div class="itenm" v-for="(val, indexn) in item.child" :key="indexn">
<div class="top acea-row row-between-wrapper">
<div class="pictxt acea-row row-between-wrapper">
<div class="pictrue">
<img :src="val.avatar" />
</div>
<div class="text line1">{{ val.nickname }}</div>
</div>
<div class="money">
返佣<span class="font-color-red"
>{{ val.number ? val.number : 0 }}</span
>
</div>
</div>
<div class="bottom">
<div><span class="name">订单号</span>{{ val.orderId }}</div>
<div><span class="name">下单时间</span>{{ val.time }}</div>
</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loaded" :loading="loading"></Loading>
</div>
</template>
<script>
import { getSpreadOrder } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "PromoterOrder",
components: {
Loading
},
props: {},
data: function() {
return {
list: [],
where: {
page: 1,
limit: 15
},
loaded: false,
loading: false,
loadTitle: "",
count: ""
};
},
mounted: function() {
this.getIndex();
},
onReachBottom() {
!this.loading && this.getIndex();
},
methods: {
getIndex: function() {
let there = this;
if (there.loaded == true || there.loading == true) return;
there.loading = true;
getSpreadOrder(there.where).then(
res => {
there.loading = false;
there.loaded = res.data.list.length < there.where.limit;
there.loadTitle = there.loaded ? "人家是有底线的" : "上拉加载更多";
there.where.page = there.where.page + 1;
there.list.push.apply(there.list, res.data.list);
there.count = res.data.count;
},
error => {
there.$dialog.message(error.msg);
},
300
);
}
}
};
</script>
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+188
View File
@@ -0,0 +1,188 @@
<template>
<div class="cash-withdrawal">
<div class="nav acea-row">
<div
v-for="(item, navListIndex) in navList"
class="item font-color-red"
@click="swichNav(navListIndex, item)"
:key="navListIndex"
>
<div
class="line bg-color-red"
:class="currentTab === navListIndex ? 'on' : ''"
></div>
<div
class="iconfont"
:class="item.icon + ' ' + (currentTab === navListIndex ? 'on' : '')"
></div>
<div>{{ item.name }}</div>
</div>
</div>
<div class="wrapper">
<div :hidden="currentTab !== 0" class="list">
<div class="item acea-row row-between-wrapper">
<div class="name">微信号</div>
<div class="input">
<input placeholder="请输入微信号" v-model="post.weixin" />
</div>
</div>
<div class="item acea-row row-between-wrapper">
<div class="name">提现</div>
<div class="input">
<input
:placeholder="'最低提现金额' + minPrice"
v-model="post.money"
/>
</div>
</div>
<div class="tip">当前可提现金额: {{ commissionCount }}</div>
<div class="bnt bg-color-red" @click="submitted">提现</div>
</div>
<div :hidden="currentTab !== 1" class="list">
<div class="item acea-row row-between-wrapper">
<div class="name">用户名</div>
<div class="input">
<input placeholder="请填写您的支付宝用户名" v-model="post.name" />
</div>
</div>
<div class="item acea-row row-between-wrapper">
<div class="name">账号</div>
<div class="input">
<input
placeholder="请填写您的支付宝账号"
v-model="post.alipay_code"
/>
</div>
</div>
<div class="item acea-row row-between-wrapper">
<div class="name">提现</div>
<div class="input">
<input
:placeholder="'最低提现金额' + minPrice"
v-model="post.money"
/>
</div>
</div>
<div class="tip">当前可提现金额: {{ commissionCount }}</div>
<div class="bnt bg-color-red" @click="submitted">提现</div>
</div>
</div>
</div>
</template>
<script>
import { getBank, postCashInfo } from "@/api/user";
import { required } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
export default {
name: "UserCash",
components: {},
props: {},
data: function() {
return {
navList: [
{ name: "微信", type: "weixin", icon: "icon-weixin2" },
{ name: "支付宝", type: "alipay", icon: "icon-icon34" }
],
post: {
extract_type: "weixin",
alipay_code: "",
money: "",
name: "",
bankname: "",
cardnum: "",
weixin: ""
},
currentTab: 0,
minPrice: 0,
banks: [],
commissionCount: 0
};
},
mounted: function() {
this.getBank();
},
methods: {
swichNav: function(index, item) {
this.currentTab = index;
this.post.extract_type = item.type;
},
getBank: function() {
let that = this;
getBank().then(
res => {
that.banks = res.data.extractBank;
that.minPrice = res.data.minPrice;
that.commissionCount = res.data.commissionCount;
},
function(err) {
that.$dialog.message(err.msg);
}
);
},
async submitted() {
let bankname = this.post.bankname,
alipay_code = this.post.alipay_code,
money = this.post.money,
name = this.post.name,
cardnum = this.post.cardnum,
weixin = this.post.weixin,
that = this;
if (
parseFloat(money) > parseFloat(that.commissionCount) ||
parseFloat(that.commissionCount) == 0
)
return that.$dialog.message("余额不足");
if (parseFloat(money) < parseFloat(that.minPrice))
return that.$dialog.message("最低提现金额" + that.minPrice);
switch (that.post.extract_type) {
case "alipay":
try {
await this.$validator({
name: [required(required.message("支付宝用户名"))],
alipayCode: [required(required.message("支付宝账号"))],
money: [required(required.message("提现金额"))]
}).validate({ name, alipay_code, money });
let save = {
extractType: that.post.extract_type,
alipayCode: alipay_code,
name: name,
money: money
};
that.save(save);
} catch (e) {
return validatorDefaultCatch(e);
}
break;
case "weixin":
try {
await this.$validator({
weixin: [required(required.message("提现微信号"))],
money: [required(required.message("提现金额"))]
}).validate({ weixin, money });
let save = {
extractType: that.post.extract_type,
weixin: weixin,
money: money
};
that.save(save);
} catch (e) {
return validatorDefaultCatch(e);
}
break;
}
},
save: function(info) {
postCashInfo(info).then(
res => {
this.$dialog.message(res.msg);
this.router.push({ path: "/user/audit" });
},
error => {
this.$dialog.message(error.msg);
}
);
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
@@ -0,0 +1,97 @@
<template>
<div class="my-promotion">
<div class="header">
<div class="name acea-row row-center-wrapper">
<div>当前佣金</div>
<div class="record" @click="$yrouter.push('/pages/user/promotion/CashRecord/index')">
提现记录
<span class="iconfont icon-xiangyou"></span>
</div>
</div>
<div class="num">{{ Info.commissionCount }}</div>
<div class="profit acea-row row-between-wrapper">
<div class="item">
<div>昨日收益</div>
<div class="money">{{ Info.lastDayCount }}</div>
</div>
<div class="item">
<div>累积已提</div>
<div class="money">{{ Info.extractCount }}</div>
</div>
</div>
</div>
<div class="bnt bg-color-red" @click="toCash">立即提现</div>
<div class="list acea-row row-between-wrapper">
<div
class="item acea-row row-center-wrapper row-column"
@click="$yrouter.push('/pages/user/promotion/Poster/index')"
>
<span class="iconfont icon-erweima"></span>
<div>推广名片</div>
</div>
<div
class="item acea-row row-center-wrapper row-column"
@click="$yrouter.push('/pages/user/promotion/PromoterList/index')"
>
<span class="iconfont icon-tongji"></span>
<div>推广人统计</div>
</div>
<div
class="item acea-row row-center-wrapper row-column"
@click="$yrouter.push('/pages/user/promotion/CommissionDetails/index')"
>
<span class="iconfont icon-qiandai"></span>
<div>佣金明细</div>
</div>
<div
class="item acea-row row-center-wrapper row-column"
@click="$yrouter.push('/pages/user/promotion/PromoterOrder/index')"
>
<span class="iconfont icon-dingdan"></span>
<div>推广人订单</div>
</div>
</div>
</div>
</template>
<script>
import { getSpreadInfo } from "@/api/user";
export default {
name: "UserPromotion",
components: {},
props: {},
data: function() {
return {
Info: {
lastDayCount: 0,
extractCount: 0,
commissionCount: 0
}
};
},
mounted: function() {
this.getInfo();
},
methods: {
getInfo: function() {
let that = this;
getSpreadInfo().then(
res => {
that.Info = res.data;
},
function(err) {
that.$dialog.message(err.msg);
}
);
},
toCash: function() {
this.$yrouter.push({ path: "/pages/user/promotion/UserCash/main" });
}
}
};
</script>
<style>
</style>
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+152
View File
@@ -0,0 +1,152 @@
<template>
<div class="integral-details" ref="container">
<div class="header">
<div class="currentScore">当前积分</div>
<div>{{ info.integral }}</div>
<div class="line"></div>
<!--<div class="nav acea-row">-->
<!--<div class="item">-->
<!--<div class="num">{{ info.sum_integral }}</div>-->
<!--<div>累计积分</div>-->
<!--</div>-->
<!--<div class="item">-->
<!--<div class="num">{{ info.deduction_integral }}</div>-->
<!--<div>累计消费</div>-->
<!--</div>-->
<!--<div class="item">-->
<!--<div class="num">{{ info.today_integral }}</div>-->
<!--<div>今日获得</div>-->
<!--</div>-->
<!--</div>-->
</div>
<div class="wrapper">
<div class="nav acea-row">
<div
class="item acea-row row-center-wrapper"
:class="current === navListIndex ? 'on' : ''"
v-for="(item, navListIndex) in navList"
:key="navListIndex"
@click="nav(navListIndex)"
>
<span class="iconfont" :class="item.icon"></span>{{ item.name }}
</div>
</div>
<div class="list" :hidden="current !== 0">
<!--<div class="tip acea-row row-middle">-->
<!--<span class="iconfont icon-shuoming"></span-->
<!--&gt;提示积分数值的高低会直接影响您的会员等级-->
<!--</div>-->
<div
class="item acea-row row-between-wrapper"
v-for="(item, listIndex) in list"
:key="listIndex"
>
<div>
<div class="state">{{ item.title }}</div>
<div><data-format :data="item.addTime"></data-format></div>
</div>
<div class="num" v-if="item.pm == 1">+{{ item.number }}</div>
<div class="num font-color-red" v-if="item.pm == 0">
-{{ item.number }}
</div>
</div>
</div>
<!--<div class="list2" :hidden="current !== 1">-->
<!--<div class="item acea-row row-between-wrapper" @click="$yrouter.switchTab('/pages/home/index')">-->
<!--<div class="pictrue"><img :src="$VUE_APP_RESOURCES_URL+'/images/score.png'" /></div>-->
<!--<div class="name">购买商品可获得积分奖励</div>-->
<!--<div class="earn">赚积分</div>-->
<!--</div>-->
<!--<div-->
<!--class="item acea-row row-between-wrapper"-->
<!--@click="$yrouter.push('/pages/user/signIn/Sign/index')"-->
<!--&gt;-->
<!--<div class="pictrue"><img :src="$VUE_APP_RESOURCES_URL+'/images/score.png'" /></div>-->
<!--<div class="name">每日签到可获得积分奖励</div>-->
<!--<div class="earn">赚积分</div>-->
<!--</div>-->
<!--</div>-->
</div>
<Loading :loaded="loaded" :loading="loading"></Loading>
</div>
</template>
<script>
import { getIntegralList, postSignUser } from "@/api/user";
import Loading from "@/components/Loading";
import DataFormat from "@/components/DataFormat";
export default {
name: "Integral",
components: {
Loading,
DataFormat
},
props: {},
data: function() {
return {
navList: [
{ name: "分值明细", icon: "icon-mingxi" }
// { name: "分值提升", icon: "icon-tishengfenzhi" }
],
current: 0,
where: {
page: 1,
limit: 15
},
data: {
sign: 1,
integral: 1,
all: 1
},
list: [],
info: [],
loaded: false,
loading: false
};
},
mounted: function() {
this.getIntegral();
this.getInfo();
},
onReachBottom() {
!this.loading && this.getInfo();
},
methods: {
nav: function(index) {
this.current = index;
},
getInfo: function() {
let that = this;
if (that.loaded == true || that.loading == true) return;
that.loading = true;
getIntegralList(that.where).then(
res => {
that.loading = false;
that.loaded = res.data.length < that.where.limit;
that.loadTitle = that.loaded ? "人家是有底线的" : "上拉加载更多";
that.where.page = that.where.page + 1;
that.list.push.apply(that.list, res.data);
},
err => {
that.$dialog.message(err.msg);
}
);
},
getIntegral: function() {
let that = this;
postSignUser(that.data).then(
res => {
that.info = res.data;
},
err => {
that.$dialog.message(err.msg);
}
);
}
}
};
</script>
<style>
.list{
}
</style>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+205
View File
@@ -0,0 +1,205 @@
<template>
<div class="sign">
<div class="header bg-color-red">
<div class="headerCon acea-row row-between-wrapper">
<div class="left acea-row row-between-wrapper">
<div class="pictrue">
<img :src="userInfo.avatar" />
</div>
<div class="text">
<div class="line1">{{ userInfo.nickname }}</div>
<div class="integral acea-row">
<span>积分: {{ userInfo.integral }}</span>
</div>
</div>
</div>
<div
@click="$yrouter.push('/pages/user/signIn/SignRecord/index')"
class="right acea-row row-middle"
>
<div class="iconfont icon-caidan"></div>
<div>明细</div>
</div>
</div>
</div>
<div class="wrapper">
<div class="list acea-row row-between-wrapper">
<div
class="item"
v-for="(item, signSystemListIndex) in signSystemList"
:key="signSystemListIndex"
>
<div
:class="signSystemListIndex + 1 === signSystemList.length ? 'rewardTxt' : ''"
>{{ item.day }}</div>
<div
class="venus"
:class="
(signSystemListIndex + 1 === signSystemList.length ? 'reward' : '') +
' ' +
(sign_index >= signSystemListIndex + 1 ? 'venusSelect' : '')
"
></div>
<div
class="num"
:class="sign_index >= signSystemListIndex + 1 ? 'on' : ''"
>+{{ item.signNum }}</div>
</div>
</div>
<!--加在 but on 为已签到-->
<div
class="but bg-color-red"
:class="userInfo.is_day_sgin ? 'on' : ''"
@click="goSign"
>{{ userInfo.isDaySign ? "已签到" : "立即签到" }}</div>
<div class="lock"></div>
</div>
<div class="wrapper wrapper2">
<div class="tip">已累计签到</div>
<div class="list2 acea-row row-center row-bottom">
<div
class="item"
v-for="(item, signCountIndex) in signCount"
:key="signCountIndex"
>{{ item || 0 }}</div>
<div class="data"></div>
</div>
<div class="tip2">据说连续签到第{{ day }}天可获得超额积分一定要坚持签到哦~~~</div>
<div class="list3">
<div
class="item acea-row row-between-wrapper"
v-for="(item, signListIndex) in signList"
:key="signListIndex"
>
<div>
<div class="name line1">{{ item.title }}</div>
<div class="data">{{ item.addTime }}</div>
</div>
<div class="num font-color-red">+{{ item.number }}</div>
</div>
<div
@click="$yrouter.push('/pages/user/signIn/SignRecord/index')"
class="Loads acea-row row-center-wrapper"
v-if="signList.length > 0"
>
点击加载更多
<div class="iconfont icon-xiangyou acea-row row-center-wrapper"></div>
</div>
</div>
</div>
<div class="signTip acea-row row-center-wrapper" :class="active === true ? 'on' : ''">
<div class="signTipLight loadingpic">
<img :src="$VUE_APP_RESOURCES_URL+'/images/light.png'" />
</div>
<div class="signTipCon">
<div class="state">签到成功</div>
<div class="integral">获得{{ integral }}积分</div>
<div class="signTipBnt" @click="close">好的</div>
</div>
</div>
<div class="mask" @touchmove.prevent :hidden="active === false"></div>
</div>
</template>
<style scoped>
.Loads .iconfont {
font-size: 0.25rem;
margin: 0.02rem 0 0 0.1rem;
}
</style>
<script>
import {
postSignUser,
getSignConfig,
postSignIntegral,
getSignList
} from "@/api/user";
import { add } from "@/utils/bc";
export default {
name: "Sign",
components: {},
props: {},
data: function() {
return {
userInfo: {},
integral: 0,
signCount: [],
sign_index: 0,
signSystemList: [],
signList: [],
page: 1,
limit: 3,
active: false,
day: ""
};
},
mounted: function() {
this.signUser();
this.signConfig();
this.getSignList();
},
methods: {
// js给数字补0num:需要补0的数字,length:长度(补到多少位);
PrefixInteger: function(num, length) {
return (Array(length).join("0") + num).slice(-length).split("");
},
//数字转中文
Rp: function(n) {
var cnum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
var s = "";
n = "" + n; // 数字转为字符串
for (var i = 0; i < n.length; i++) {
s += cnum[parseInt(n.charAt(i))];
}
return s;
},
// 获取用户信息
signUser: function() {
let that = this;
postSignUser({ sign: 1 }).then(res => {
res.data.integral = parseInt(res.data.integral);
var sumSginDay = res.data.sumSignDay;
that.userInfo = res.data;
that.signCount = that.PrefixInteger(sumSginDay, 4);
that.sign_index = parseInt(res.data.signNum);
});
},
// 签到配置
signConfig: function() {
let that = this;
getSignConfig().then(res => {
that.signSystemList = res.data;
that.day = that.Rp(that.signSystemList.length);
});
},
// 用户签到
goSign: function() {
let that = this,
sumSginDay = that.userInfo.sumSignDay;
if (that.userInfo.is_day_sgin)
return that.$dialog.toast({ mes: "您今日已签到!" });
postSignIntegral().then(res => {
that.active = true;
that.integral = res.data.integral;
let sign_index = parseInt(that.sign_index + 1);
that.sign_index =
sign_index > that.signSystemList.length ? 1 : sign_index;
that.signCount = that.PrefixInteger(sumSginDay + 1, 4);
that.userInfo.is_day_sgin = true;
that.userInfo.integral = add(that.userInfo.integral, res.data.integral);
that.getSignList();
});
},
// 获取签到列表;
getSignList: function() {
let that = this;
getSignList(that.page, that.limit).then(res => {
that.signList = res.data;
});
},
close: function() {
this.active = false;
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
+65
View File
@@ -0,0 +1,65 @@
<template>
<div class="sign-record" ref="container">
<div class="list">
<div class="item" v-for="(item, signListIndex) in signList" :key="signListIndex">
<div class="data">{{ item.time }}</div>
<div class="listn">
<div
class="itemn acea-row row-between-wrapper"
v-for="(itemn, indexn) in item.list"
:key="indexn"
>
<div>
<div class="name line1">{{ itemn.title }}</div>
<div>{{ itemn.addTime }}</div>
</div>
<div class="num font-color-red">+{{ itemn.number }}</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loadend" :loading="loading"></Loading>
</div>
</template>
<script>
import { getSignMonth } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "SignRecord",
components: {
Loading
},
props: {},
data: function() {
return {
page: 1,
limit: 3,
signList: [],
loading: false,
loadend: false,
active: false
};
},
mounted: function() {
this.signListTap();
},
onReachBottom() {
!this.loading && this.signListTap();
},
methods: {
signListTap: function() {
let that = this;
if (that.loading) return; //阻止下次请求(false可以进行请求);
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
that.loading = true;
getSignMonth(that.page, that.limit).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.signList.push.apply(that.signList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
}
}
};
</script>
+5
View File
@@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()