yshop3.1正式发布

This commit is contained in:
xuwenbo
2020-09-14 21:01:28 +08:00
parent 5800da20d2
commit 8a85f44ff6
74 changed files with 9959 additions and 4639 deletions
+230 -217
View File
@@ -1,19 +1,9 @@
<template>
<view class="register absolute">
<view class="shading">
<view class="pictrue acea-row row-center-wrapper">
<image src="@/static/images/logo.png" />
</view>
</view>
<view class="whiteBg" v-if="formItem === 1">
<view class="title acea-row row-center-wrapper">
<view
class="item"
:class="current === index ? 'on' : ''"
v-for="(item, index) in navList"
@click="navTap(index)"
:key="index"
>{{ item }}</view>
<view class="title acea-row row-between-wrapper">
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
@click="navTap(index)" :key="index">{{ item }}</view>
</view>
<view class="list" :hidden="current !== 0">
<form @submit.prevent="submit">
@@ -50,12 +40,8 @@
<use xlink:href="#icon-code_1" />
</svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
</view>
</view>
@@ -67,7 +53,9 @@
</view>
</view>
<view class="whiteBg" v-else>
<view class="title">注册账号</view>
<view class="title acea-row row-between-wrapper">
<view class="item on">注册账号</view>
</view>
<view class="list">
<view class="item">
<view>
@@ -83,12 +71,8 @@
<use xlink:href="#icon-code_1" />
</svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
</view>
<view class="item">
@@ -99,6 +83,7 @@
<input type="password" placeholder="填写您的登录密码" v-model="password" />
</view>
</view>
<!-- #ifndef H5 -->
<view class="item">
<view>
<!-- <svg class="icon" aria-hidden="true">
@@ -107,6 +92,8 @@
<input type="text" placeholder="输入邀请码" v-model="inviteCode" />
</view>
</view>
<!-- #endif -->
</view>
<view class="logon" @click="register">注册</view>
<view class="tip">
@@ -114,216 +101,242 @@
<text @click="formItem = 1" class="font-color-red">立即登录</text>
</view>
</view>
<view class="bottom"></view>
</view>
</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";
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";
import { handleGetUserInfo } from "@/utils";
import {
handleGetUserInfo
} from "@/utils";
const BACK_URL = "login_back_url";
const BACK_URL = "login_back_url";
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function() {
return {
navList: ["账号登录"],
current: 0,
account: "",
password: "",
captcha: "",
inviteCode: "",
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));
handleGetUserInfo();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
});
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function () {
return {
navList: ["账号登录"],
current: 0,
account: "",
password: "",
captcha: "",
inviteCode: "",
formItem: 1,
type: "login"
};
},
async register() {
var that = this;
const { account, captcha, password } = that;
try {
await that
.$validator({
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));
handleGetUserInfo();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
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,
inviteCode: that.inviteCode,
spread: cookie.get("spread")
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.formItem = 1;
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
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 => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.sendCode();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
navTap: function (index) {
this.current = index;
},
async submit() {
const {
account,
password
} = this;
try {
await this.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
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({
}).validate({
account,
captcha,
password
});
} catch (e) {
return validatorDefaultCatch(e);
}
register({
account: that.account,
captcha: that.captcha,
password: that.password,
inviteCode: that.inviteCode,
spread: cookie.get("spread")
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.formItem = 1;
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
});
},
async code() {
var that = this;
const { account } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
} catch (e) {
return validatorDefaultCatch(e);
}
login({
username: account,
password,
spread: cookie.get("spread")
})
.validate({
account
});
} catch (e) {
return validatorDefaultCatch(e);
}
if (that.formItem == 2) that.type = "register";
await registerVerify({
phone: that.account,
type: that.type
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.sendCode();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
});
},
navTap: function(index) {
this.current = index;
},
async submit() {
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);
}
.then(({
data
}) => {
this.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
// let replace=this.$yroute.query.replace
// if(replace){
login({
username: account,
password,
spread: cookie.get("spread")
})
.then(({ data }) => {
this.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
// let replace=this.$yroute.query.replace
// if(replace){
// }
// this.$yrouter.replace({
// path: this.$yroute.query.replace || '/pages/home/index'
// });
})
.catch(err => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
// }
// this.$yrouter.replace({
// path: this.$yroute.query.replace || '/pages/home/index'
// });
})
.catch(err => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
});
}
}
}
};
};
</script>
+10 -7
View File
@@ -43,20 +43,23 @@
<input type="text" v-else value="未绑定" disabled class="id" />
</view>
</view>
<!-- <view class="item acea-row row-between-wrapper" @click="goChangePassword()">
<view>密码</view>
<view class="input acea-row row-between-wrapper">
<text>点击修改密码</text>
<text class="iconfont icon-suozi"></text>
<!--
<view class="item acea-row row-between-wrapper" @click="goChangePassword()">
<view>密码</view>
<view class="input acea-row row-between-wrapper">
<text>点击修改密码</text>
<text class="iconfont icon-suozi"></text>
</view>
</view>
</view>-->
-->
</view>
<view class="modifyBnt bg-color-red" @click="submit">保存修改</view>
<!-- #ifndef MP-WEIXIN -->
<view
class="logOut cart-color acea-row row-center-wrapper"
@click="logout"
v-if="$deviceType!='routine'"
>退出登录</view>
<!-- #endif -->
</view>
</template>
<script>
+323 -288
View File
@@ -15,23 +15,16 @@
</view>
<view class="info-wrapper">
<view class="picList acea-row row-between mt-20">
<view
class="pic-box pic-box-color acea-row row-center-wrapper row-column"
:class="activePic === index ? 'pic-box-color-active' : ''"
v-for="(item, index) in picList"
:key="index"
@click="picCharge(index, item)"
>
<view class="pic-box pic-box-color acea-row row-center-wrapper row-column"
:class="activePic === index ? 'pic-box-color-active' : ''" v-for="(item, index) in picList" :key="index"
@click="picCharge(index, item)">
<view class="pic-number-pic">
<text>
{{ item.value.price }}
<text class="pic-number"></text>
</text>
</view>
<view
class="pic-number"
v-if="item.value.give_price > 0"
>赠送{{ item.value.give_price }} </view>
<view class="pic-number" v-if="item.value.give_price > 0">赠送{{ item.value.give_price }} </view>
</view>
<!-- <view
class="pic-box pic-box-color acea-row row-center-wrapper"
@@ -52,293 +45,335 @@
</view>
</template>
<script>
import { mapGetters } from "vuex";
import { weappPay } from "@/libs/wechat";
import { rechargeWechat, getRechargeApi } from "@/api/user";
import { add, sub } from "@/utils/bc";
import {
mapGetters
} from "vuex";
import {
weappPay
} from "@/libs/wechat";
import {
rechargeWechat,
getRechargeApi
} from "@/api/user";
import {
add,
sub
} from "@/utils/bc";
import {
subscribeMessage
} from "@/libs/order";
export default {
name: "Recharge",
components: {},
props: {},
data: function () {
return {
active: 0,
from: this.$deviceType,
money: "",
now_money: "",
picList: [],
activePic: 0,
numberPic: "",
paid_price: "",
rechar_id: 0,
};
},
computed: mapGetters(["userInfo"]),
mounted: function () {
this.now_money = this.userInfo.nowMoney;
this.getRecharge();
},
methods: {
/**
* 充值额度选择
*/
getRecharge() {
getRechargeApi()
.then((res) => {
this.picList = res.data.recharge_price_ways || [];
if (this.picList[0]) {
this.rechar_id = this.picList[0].id;
this.paid_price = this.picList[0].value.price;
this.numberPic = this.picList[0].value.give_price;
}
})
.catch((res) => {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000,
});
});
export default {
name: "Recharge",
components: {},
props: {},
data: function () {
return {
active: 0,
from: this.$deviceType,
money: "",
now_money: "",
picList: [],
activePic: 0,
numberPic: "",
paid_price: "",
rechar_id: 0,
};
},
/**
* 选择金额
*/
picCharge(idx, item) {
this.activePic = idx;
if (idx == this.picList.length) {
this.rechar_id = 0;
this.paid_price = "";
this.numberPic = "";
} else {
this.money = "";
this.rechar_id = item.id;
this.paid_price = item.value.give_price;
this.numberPic = item.value.price;
}
computed: mapGetters(["userInfo"]),
mounted: function () {
this.now_money = this.userInfo.nowMoney;
this.getRecharge();
},
recharge: function () {
let that = this,
price = Number(this.money);
if (this.picList.length == this.activePic && price === 0) {
uni.showToast({
title: "请输入您要充值的金额",
icon: "none",
duration: 2000,
});
return;
} else if (this.picList.length == this.activePic && price < 0.01) {
uni.showToast({
title: "充值金额不能低于0.01",
icon: "none",
duration: 2000,
});
return;
} else if (this.picList.length == this.activePic && price > 99999) {
uni.showToast({
title: "充值金额不能大于99999",
icon: "none",
duration: 2000,
});
return;
}
let prices = "",
paid_price = "";
if (price) {
prices = price;
paid_price = 0;
} else {
prices = that.numberPic;
paid_price = that.paid_price;
}
rechargeWechat({
price: prices,
from: that.from,
paid_price: paid_price,
rechar_id: that.rechar_id,
})
.then((res) => {
console.log(res);
var data = res.data.data;
weappPay(res.data.data)
.then(() => {
prices = add(prices, paid_price);
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
uni.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
this.$yrouter.back();
})
.finally((res) => {
//if(typeof(res) == "undefined") return
uni.showToast({
title: res,
icon: "none",
duration: 2000,
});
})
.catch(function () {
uni.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
methods: {
/**
* 充值额度选择
*/
getRecharge() {
getRechargeApi()
.then((res) => {
this.picList = res.data.recharge_price_ways || [];
if (this.picList[0]) {
this.rechar_id = this.picList[0].id;
this.paid_price = this.picList[0].value.price;
this.numberPic = this.picList[0].value.give_price;
}
})
.catch((res) => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000,
});
})
.catch((err) => {
console.log(err);
});
},
/**
* 选择金额
*/
picCharge(idx, item) {
this.activePic = idx;
if (idx == this.picList.length) {
this.rechar_id = 0;
this.paid_price = "";
this.numberPic = "";
} else {
this.money = "";
this.rechar_id = item.id;
this.paid_price = item.value.give_price;
this.numberPic = item.value.price;
}
},
recharge: function () {
let that = this,
price = Number(this.money);
if (this.picList.length == this.activePic && price === 0) {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
title: "请输入您要充值的金额",
icon: "none",
duration: 2000,
});
});
return;
} else if (this.picList.length == this.activePic && price < 0.01) {
uni.showToast({
title: "充值金额不能低于0.01",
icon: "none",
duration: 2000,
});
return;
} else if (this.picList.length == this.activePic && price > 99999) {
uni.showToast({
title: "充值金额不能大于99999",
icon: "none",
duration: 2000,
});
return;
}
let prices = "",
paid_price = "";
if (price) {
prices = price;
paid_price = 0;
} else {
prices = that.numberPic;
paid_price = that.paid_price;
}
rechargeWechat({
price: prices,
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType,
paid_price: paid_price,
rechar_id: that.rechar_id,
})
.then((res) => {
console.log(res);
var data = res.data.data;
weappPay(res.data.data)
.then(() => {
prices = add(prices, paid_price);
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
uni.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
this.$yrouter.back();
})
.finally((res) => {
//if(typeof(res) == "undefined") return
uni.showToast({
title: res,
icon: "none",
duration: 2000,
});
})
.catch(function () {
uni.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
});
})
.catch((err) => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000,
});
});
},
},
},
};
};
</script>
<style scoped lang="less">
#iframe {
display: none;
}
.pic-box-color-active {
background-color: #eb3729 !important;
color: #fff !important;
}
.picList {
margin-bottom: 0.3 * 100rpx;
margin-top: 0.3 * 100rpx;
}
.font-color {
color: #e83323;
}
.recharge {
border-radius: 0.1 * 100rpx;
width: 100%;
background-color: #fff;
margin: 0.2 * 100rpx auto 0 auto;
padding: 0.3 * 100rpx;
border-top-right-radius: 0.39 * 100rpx;
border-top-left-radius: 0.39 * 100rpx;
margin-top: -0.45 * 100rpx;
box-sizing: border-box;
}
.recharge .nav {
height: 0.75 * 100rpx;
line-height: 0.75 * 100rpx;
padding: 0 1 * 100rpx;
}
.recharge .nav .item {
font-size: 0.3 * 100rpx;
color: #333;
}
.recharge .nav .item.on {
font-weight: bold;
border-bottom: 0.04 * 100rpx solid #e83323;
}
.recharge .info-wrapper {
}
.recharge .info-wrapper .money {
margin-top: 0.6 * 100rpx;
padding-bottom: 0.2 * 100rpx;
border-bottom: 1px dashed #ddd;
text-align: center;
}
.recharge .info-wrapper .money span {
font-size: 0.56 * 100rpx;
color: #333;
font-weight: bold;
}
.recharge .info-wrapper .money input {
display: inline-block;
width: 3 * 100rpx;
font-size: 0.84 * 100rpx;
text-align: center;
color: #282828;
font-weight: bold;
padding-right: 0.7 * 100rpx;
}
.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;
}
.tip {
font-size: 0.28 * 100rpx;
color: #333333;
font-weight: 800;
margin-bottom: 0.14 * 100rpx;
}
.recharge .info-wrapper .tips span {
color: #ef4a49;
}
.recharge .info-wrapper .pay-btn {
display: block;
width: 100%;
height: 0.86 * 100rpx;
margin: 0.5 * 100rpx auto 0 auto;
line-height: 0.86 * 100rpx;
text-align: center;
color: #fff;
border-radius: 0.5 * 100rpx;
font-size: 0.3 * 100rpx;
font-weight: bold;
}
.payment-top {
width: 100%;
height: 3.5 * 100rpx;
background-color: #eb3729;
}
.payment-top .name {
font-size: 0.26 * 100rpx;
color: rgba(255, 255, 255, 0.8);
margin-top: -0.38 * 100rpx;
margin-bottom: 0.3 * 100rpx;
}
.payment-top .pic {
font-size: 0.32 * 100rpx;
color: #fff;
}
.payment-top .pic-font {
font-size: 0.78 * 100rpx;
color: #fff;
}
.picList .pic-box {
width: 32%;
height: auto;
border-radius: 0.2 * 100rpx;
margin-top: 0.21 * 100rpx;
padding: 0.2 * 100rpx 0;
}
.pic-box-color {
background-color: #f4f4f4;
color: #656565;
}
.pic-number {
font-size: 0.22 * 100rpx;
}
.pic-number-pic {
font-size: 0.38 * 100rpx;
margin-right: 0.1 * 100rpx;
text-align: center;
}
.pic-box-money {
width: 100%;
display: block;
}
#iframe {
display: none;
}
.pic-box-color-active {
background-color: #eb3729 !important;
color: #fff !important;
}
.picList {
margin-bottom: 0.3 * 100rpx;
margin-top: 0.3 * 100rpx;
}
.font-color {
color: #e83323;
}
.recharge {
border-radius: 0.1 * 100rpx;
width: 100%;
background-color: #fff;
margin: 0.2 * 100rpx auto 0 auto;
padding: 0.3 * 100rpx;
border-top-right-radius: 0.39 * 100rpx;
border-top-left-radius: 0.39 * 100rpx;
margin-top: -0.45 * 100rpx;
box-sizing: border-box;
}
.recharge .nav {
height: 0.75 * 100rpx;
line-height: 0.75 * 100rpx;
padding: 0 1 * 100rpx;
}
.recharge .nav .item {
font-size: 0.3 * 100rpx;
color: #333;
}
.recharge .nav .item.on {
font-weight: bold;
border-bottom: 0.04 * 100rpx solid #e83323;
}
.recharge .info-wrapper {}
.recharge .info-wrapper .money {
margin-top: 0.6 * 100rpx;
padding-bottom: 0.2 * 100rpx;
border-bottom: 1px dashed #ddd;
text-align: center;
}
.recharge .info-wrapper .money span {
font-size: 0.56 * 100rpx;
color: #333;
font-weight: bold;
}
.recharge .info-wrapper .money input {
display: inline-block;
width: 3 * 100rpx;
font-size: 0.84 * 100rpx;
text-align: center;
color: #282828;
font-weight: bold;
padding-right: 0.7 * 100rpx;
}
.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;
}
.tip {
font-size: 0.28 * 100rpx;
color: #333333;
font-weight: 800;
margin-bottom: 0.14 * 100rpx;
}
.recharge .info-wrapper .tips span {
color: #ef4a49;
}
.recharge .info-wrapper .pay-btn {
display: block;
width: 100%;
height: 0.86 * 100rpx;
margin: 0.5 * 100rpx auto 0 auto;
line-height: 0.86 * 100rpx;
text-align: center;
color: #fff;
border-radius: 0.5 * 100rpx;
font-size: 0.3 * 100rpx;
font-weight: bold;
}
.payment-top {
width: 100%;
height: 3.5 * 100rpx;
background-color: #eb3729;
}
.payment-top .name {
font-size: 0.26 * 100rpx;
color: rgba(255, 255, 255, 0.8);
margin-top: -0.38 * 100rpx;
margin-bottom: 0.3 * 100rpx;
}
.payment-top .pic {
font-size: 0.32 * 100rpx;
color: #fff;
}
.payment-top .pic-font {
font-size: 0.78 * 100rpx;
color: #fff;
}
.picList .pic-box {
width: 32%;
height: auto;
border-radius: 0.2 * 100rpx;
margin-top: 0.21 * 100rpx;
padding: 0.2 * 100rpx 0;
}
.pic-box-color {
background-color: #f4f4f4;
color: #656565;
}
.pic-number {
font-size: 0.22 * 100rpx;
}
.pic-number-pic {
font-size: 0.38 * 100rpx;
margin-right: 0.1 * 100rpx;
text-align: center;
}
.pic-box-money {
width: 100%;
display: block;
}
</style>
+264 -258
View File
@@ -18,14 +18,17 @@
<text>ID{{ userInfo.uid || 0}}</text>
<text class="iconfont icon-bianji1"></text>
</view>
<button
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
class="binding"
v-else
>
<!-- #ifdef MP-WEIXIN -->
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else>
<text>绑定手机号</text>
</button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button class="binding" @click="goBindPhone()" v-else>
<text>绑定手机号</text>
</button>
<!-- #endif -->
</view>
</view>
<text class="iconfont icon-shezhi" @click="goPersonalData()"></text>
@@ -36,11 +39,7 @@
<text>我的余额</text>
<text class="num">{{ userInfo.nowMoney || 0 }}</text>
</view>
<view
@click="goUserPromotion()"
class="item"
v-if="userInfo.isPromoter === 1 || userInfo.statu === 2"
>
<view @click="goUserPromotion()" class="item" v-if="userInfo.isPromoter === 1 || userInfo.statu === 2">
<text>当前佣金</text>
<text class="num">{{ userInfo.brokeragePrice || 0 }}</text>
</view>
@@ -65,50 +64,40 @@
<view @click="goMyOrder(0)" class="item">
<view class="pictrue">
<image src="@/static/images/dfk.png" />
<text
class="order-status-num"
v-if="userInfo.orderStatusNum.unpaidCount > 0"
>{{ userInfo.orderStatusNum.unpaidCount }}</text>
<text class="order-status-num"
v-if="userInfo.orderStatusNum.unpaidCount > 0">{{ userInfo.orderStatusNum.unpaidCount }}</text>
</view>
<view>待付款</view>
</view>
<view @click="goMyOrder(1)" class="item">
<view class="pictrue">
<image src="@/static/images/dfh.png" />
<text
class="order-status-num"
v-if="userInfo.orderStatusNum.unshippedCount > 0"
>{{ userInfo.orderStatusNum.unshippedCount }}</text>
<text class="order-status-num"
v-if="userInfo.orderStatusNum.unshippedCount > 0">{{ userInfo.orderStatusNum.unshippedCount }}</text>
</view>
<view>待发货</view>
</view>
<view @click="goMyOrder(2)" class="item">
<view class="pictrue">
<image src="@/static/images/dsh.png" />
<text
class="order-status-num"
v-if="userInfo.orderStatusNum.receivedCount > 0"
>{{ userInfo.orderStatusNum.receivedCount }}</text>
<text class="order-status-num"
v-if="userInfo.orderStatusNum.receivedCount > 0">{{ userInfo.orderStatusNum.receivedCount }}</text>
</view>
<text>待收货</text>
</view>
<view @click="goMyOrder(3)" class="item">
<view class="pictrue">
<image src="@/static/images/dpj.png" />
<text
class="order-status-num"
v-if="userInfo.orderStatusNum.evaluatedCount > 0"
>{{ userInfo.orderStatusNum.evaluatedCount }}</text>
<text class="order-status-num"
v-if="userInfo.orderStatusNum.evaluatedCount > 0">{{ userInfo.orderStatusNum.evaluatedCount }}</text>
</view>
<text>待评价</text>
</view>
<view @click="goReturnList()" class="item">
<view class="pictrue">
<image src="@/static/images/sh.png" />
<text
class="order-status-num"
v-if="userInfo.orderStatusNum.refundCount > 0"
>{{ userInfo.orderStatusNum.refundCount }}</text>
<text class="order-status-num"
v-if="userInfo.orderStatusNum.refundCount > 0">{{ userInfo.orderStatusNum.refundCount }}</text>
</view>
<text>售后/退款</text>
</view>
@@ -144,262 +133,279 @@
:login_type="userInfo.login_type"
></SwitchWindow>-->
</view>
<Authorization v-if="!$store.getters.token" />
<Authorization v-else />
</view>
</template>
<script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
import { getUserInfo, getMenuUser, bindingPhone } from "@/api/user";
import { isWeixin, VUE_APP_RESOURCES_URL } from "@/utils";
import SwitchWindow from "@/components/SwitchWindow";
import Authorization from "@/pages/authorization/index";
import {
mapState,
mapGetters,
mapMutations,
mapActions
} from "vuex";
import {
getUserInfo,
getMenuUser,
bindingPhone
} from "@/api/user";
import {
isWeixin,
VUE_APP_RESOURCES_URL
} from "@/utils";
import SwitchWindow from "@/components/SwitchWindow";
import Authorization from "@/pages/authorization/index";
const NAME = "User";
const NAME = "User";
export default {
name: NAME,
components: {
SwitchWindow,
Authorization
},
props: {},
data: function() {
return {
MyMenus: [],
switchActive: false,
isWeixin: false
};
},
computed: mapGetters(["userInfo"]),
methods: {
...mapMutations(["updateAuthorizationPage"]),
goReturnList() {
this.$yrouter.push("/pages/order/ReturnList/index");
export default {
name: NAME,
components: {
SwitchWindow,
Authorization
},
goMyOrder(type) {
this.$yrouter.push({
path: "/pages/order/MyOrder/index",
query: {
type
}
});
props: {},
data: function () {
return {
MyMenus: [],
switchActive: false,
isWeixin: false
};
},
goUserCoupon() {
this.$yrouter.push("/pages/user/coupon/UserCoupon/index");
},
goIntegral() {
this.$yrouter.push("/pages/user/signIn/Integral/index");
},
goUserPromotion() {
this.$yrouter.push("/pages/user/promotion/UserPromotion/index");
},
goUserAccount() {
this.$yrouter.push({
path: "/pages/user/UserAccount/index"
});
},
goPersonalData() {
this.$yrouter.push("/pages/user/PersonalData/index");
},
getPhoneNumber: function(e) {
let thit = this;
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定
if (e.mp.detail.errMsg == "getPhoneNumber:ok") {
uni.showLoading({
title: "绑定中"
});
// 获取当前环境的服务商
uni.getProvider({
service: "oauth",
success: function(res) {
// 此处可以排除h5
if (res.provider) {
uni.login({
success: loginRes => {
bindingPhone({
code: loginRes.code,
encryptedData: e.mp.detail.encryptedData,
iv: e.mp.detail.iv
})
.then(res => {
console.log(res);
// this.User();
thit.$store.dispatch("userInfo", true);
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
})
.catch(error => {
uni.hideLoading();
thit.$store.dispatch("userInfo", true);
console.log(error);
uni.showToast({
title:
error.msg ||
error.response.data.msg ||
error.response.data.message,
icon: "none",
duration: 2000
});
});
},
fail() {
reject("绑定失败");
}
});
}
},
fail() {
reject("获取环境服务商失败");
computed: mapGetters(["userInfo"]),
methods: {
...mapMutations(["updateAuthorizationPage"]),
goReturnList() {
this.$yrouter.push("/pages/order/ReturnList/index");
},
goMyOrder(type) {
this.$yrouter.push({
path: "/pages/order/MyOrder/index",
query: {
type
}
});
} else {
uni.showToast({
title: "已拒绝授权",
icon: "none",
duration: 2000
},
goBindPhone() {
this.$yrouter.push({
path: "/pages/user/BindingPhone/index",
});
}
},
changeswitch: function(data) {
this.switchActive = data;
},
User: function() {
let that = this;
getUserInfo().then(res => {
that.user = res.data;
that.orderStatusNum = res.data.orderStatusNum;
});
},
MenuUser: function() {
let that = this;
getMenuUser()
.then(res => {
uni.hideLoading();
that.MyMenus = res.data.routine_my_menus;
})
.catch(error => {
uni.hideLoading();
console.log(error);
},
goUserCoupon() {
this.$yrouter.push("/pages/user/coupon/UserCoupon/index");
},
goIntegral() {
this.$yrouter.push("/pages/user/signIn/Integral/index");
},
goUserPromotion() {
this.$yrouter.push("/pages/user/promotion/UserPromotion/index");
},
goUserAccount() {
this.$yrouter.push({
path: "/pages/user/UserAccount/index"
});
},
goPages: function(index) {
let url = this.MyMenus[index].uniapp_url;
if (
url === "/pages/user/promotion/UserPromotion/index" &&
this.userInfo.statu === 1
) {
if (!this.userInfo.isPromoter) {
},
goPersonalData() {
this.$yrouter.push("/pages/user/PersonalData/index");
},
getPhoneNumber: function (e) {
let thit = this;
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定
if (e.mp.detail.errMsg == "getPhoneNumber:ok") {
uni.showLoading({
title: "绑定中"
});
// 获取当前环境的服务商
uni.getProvider({
service: "oauth",
success: function (res) {
// 此处可以排除h5
if (res.provider) {
uni.login({
success: loginRes => {
bindingPhone({
code: loginRes.code,
encryptedData: e.mp.detail.encryptedData,
iv: e.mp.detail.iv
})
.then(res => {
console.log(res);
// this.User();
thit.$store.dispatch("userInfo", true);
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
})
.catch(error => {
uni.hideLoading();
thit.$store.dispatch("userInfo", true);
console.log(error);
uni.showToast({
title: error.msg ||
error.response.data.msg ||
error.response.data.message,
icon: "none",
duration: 2000
});
});
},
fail() {
reject("绑定失败");
}
});
}
},
fail() {
reject("获取环境服务商失败");
}
});
} else {
uni.showToast({
title: "您还没有推广权限!!",
title: "已拒绝授权",
icon: "none",
duration: 2000
});
}
},
changeswitch: function (data) {
this.switchActive = data;
},
User: function () {
let that = this;
getUserInfo().then(res => {
that.user = res.data;
that.orderStatusNum = res.data.orderStatusNum;
});
},
MenuUser: function () {
let that = this;
getMenuUser()
.then(res => {
uni.hideLoading();
that.MyMenus = res.data.routine_my_menus;
})
.catch(error => {
uni.hideLoading();
console.log(error);
});
},
goPages: function (index) {
let url = this.MyMenus[index].uniapp_url;
if (
url === "/pages/user/promotion/UserPromotion/index" &&
this.userInfo.statu === 1
) {
if (!this.userInfo.isPromoter) {
uni.showToast({
title: "您还没有推广权限!!",
icon: "none",
duration: 2000
});
return;
}
}
if (
url === "/pages/orderAdmin/OrderIndex/index" &&
!this.userInfo.adminid
) {
uni.showToast({
title: "您还不是管理员!!",
icon: "none",
duration: 2000
});
return;
}
console.log(this.userInfo)
if (url === "/pages/orderAdmin/OrderCancellation/index" && !this.userInfo.checkStatus) {
uni.showToast({
title: "您没有核销权限,请后台店员设置!!",
icon: "none",
duration: 2000
});
return;
}
}
if (
url === "/pages/orderAdmin/OrderIndex/index" &&
!this.userInfo.adminid
) {
uni.showToast({
title: "您还不是管理员!!",
icon: "none",
duration: 2000
this.$yrouter.push({
path: this.MyMenus[index].uniapp_url
});
return;
}
console.log(this.userInfo)
if (url === "/pages/orderAdmin/OrderCancellation/index" && !this.userInfo.checkStatus) {
uni.showToast({
title: "您没有核销权限,请后台店员设置!!",
icon: "none",
duration: 2000
},
goPages2: function () {
this.$yrouter.push({
path: "/pages/orderAdmin/OrderCancellation/index"
});
return;
}
this.$yrouter.push({
path: this.MyMenus[index].uniapp_url
});
},
goPages2: function() {
this.$yrouter.push({
path: "/pages/orderAdmin/OrderCancellation/index"
});
watch: {
userInfo() {
this.MenuUser();
}
},
onShow() {
if (this.$store.getters.token) {
//
uni.showLoading({
title: "加载中"
});
this.$store.dispatch("getUser", true);
this.MenuUser();
this.isWeixin = isWeixin();
}
},
onHide() {
console.log("离开用户中心");
this.updateAuthorizationPage(false);
}
},
watch: {
userInfo() {
this.MenuUser();
}
},
onShow() {
if (this.$store.getters.token) {
//
uni.showLoading({
title: "加载中"
});
this.$store.dispatch("getUser", true);
this.MenuUser();
this.isWeixin = isWeixin();
}
},
onHide() {
console.log("离开用户中心");
this.updateAuthorizationPage(false);
}
};
};
</script>
<style lang="less">
.footer-line-height {
height: 1 * 100rpx;
}
.footer-line-height {
height: 1 * 100rpx;
}
.order-status-num {
min-width: 0.33 * 100rpx;
background-color: #fff;
color: #eb3729;
border-radius: 15px;
position: absolute;
right: -0.14 * 100rpx;
top: -0.15 * 100rpx;
font-size: 0.2 * 100rpx;
padding: 0 0.08 * 100rpx;
border: 1px solid #eb3729;
}
.order-status-num {
min-width: 0.33 * 100rpx;
background-color: #fff;
color: #eb3729;
border-radius: 15px;
position: absolute;
right: -0.14 * 100rpx;
top: -0.15 * 100rpx;
font-size: 0.2 * 100rpx;
padding: 0 0.08 * 100rpx;
border: 1px solid #eb3729;
}
.pictrue {
position: relative;
}
.pictrue {
position: relative;
}
.switch-h5 {
margin-left: 0.2 * 100rpx;
}
.switch-h5 {
margin-left: 0.2 * 100rpx;
}
.binding {
margin-top: 0.1 * 100rpx;
display: inline-block;
padding: 0.05 * 100rpx 0.2 * 100rpx;
background-color: #ca1f10;
border-radius: 50px;
font-size: 0.22 * 100rpx;
line-height: 1.5;
border: 1px solid #e8695e;
color: #ffffff;
}
.binding {
margin-top: 0.1 * 100rpx;
display: inline-block;
padding: 0.05 * 100rpx 0.2 * 100rpx;
background-color: #ca1f10;
border-radius: 50px;
font-size: 0.22 * 100rpx;
line-height: 1.5;
border: 1px solid #e8695e;
color: #ffffff;
}
.by {
text-align: center;
padding: 30rpx 0;
}
.by-text {
text-align: center;
font-size: 24rpx;
}
.by {
text-align: center;
padding: 30rpx 0;
}
.by-text {
text-align: center;
font-size: 24rpx;
}
</style>
+5 -3
View File
@@ -8,7 +8,7 @@
<view>总资产()</view>
<view class="money">{{ now_money }}</view>
</view>
<!-- <navigator url="/pages/user/Recharge/index" class="recharge font-color-red">充值</navigator> -->
<navigator url="/pages/user/Recharge/index" class="recharge font-color-red" v-if="is_hide=='0'">充值</navigator>
</view>
<view class="cumulative acea-row row-top">
<view class="item">
@@ -31,12 +31,12 @@
</view>
<view>消费记录</view>
</view>
<!-- <view class="item" @click="goUserBill(2)">
<view class="item" @click="goUserBill(2)" v-if="is_hide=='0'">
<view class="pictrue">
<image src="@/static/images/record3.png" />
</view>
<view>充值记录</view>
</view> -->
</view>
</view>
<view class="advert acea-row row-between-wrapper"></view>
</view>
@@ -54,6 +54,7 @@ export default {
props: {},
data: function() {
return {
is_hide: "1",
now_money: 0,
orderStatusSum: 0,
recharge: 0,
@@ -82,6 +83,7 @@ export default {
that.now_money = res.data.now_money;
that.orderStatusSum = res.data.orderStatusSum;
that.recharge = res.data.recharge;
this.is_hide = res.data.is_hide;
},
err => {
uni.showToast({
+12 -13
View File
@@ -13,12 +13,7 @@
<view class="name">所在地区</view>
<view class="picker acea-row row-between-wrapper select-value form-control">
<view class="address">
<CitySelect
ref="cityselect"
:defaultValue="addressText"
@callback="result"
:items="district"
></CitySelect>
<CitySelect ref="cityselect" :defaultValue="addressText" @callback="result" :items="district"></CitySelect>
</view>
<view class="iconfont icon-dizhi font-color-red"></view>
</view>
@@ -47,7 +42,7 @@
</template>
<script type="text/babel">
import CitySelect from "@/components/CitySelect";
import CitySelect from "@/components/CitySelect";
import { getAddress, postAddress, getCity } from "@/api/user";
import attrs, { required, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
@@ -89,7 +84,11 @@ export default {
that.ready = true;
})
.catch(err => {
that.$dialog.error(err.msg);
uni.showToast({
title: err.msg,
icon: "none",
duration: 2000,
});
});
},
getUserAddress: function() {
@@ -194,10 +193,10 @@ export default {
</script>
<style lang="less">
.address {
text {
width: 100%;
display: block;
.address {
text {
width: 100%;
display: block;
}
}
}
</style>
+125 -130
View File
@@ -4,12 +4,7 @@
<swiper indicatorDots="true">
<block v-for="(item, infoIndex) in info" :key="infoIndex">
<swiper-item>
<image
class="slide-image"
:src="item.wap_poster"
mode="widthFix"
show-menu-by-longpress
/>
<image class="slide-image" :src="item.wap_poster" mode="widthFix" show-menu-by-longpress />
</swiper-item>
</block>
</swiper>
@@ -18,143 +13,143 @@
</view>
</template>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import { getSpreadImg } from "@/api/user";
// 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 // 页面阴影效果
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
},
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() {
info: [],
activeIndex: 0
};
},
mounted: function () {
this.getIndex();
let that = this;
let from = {};
if (this.$deviceType == "app") {
from.from = "app";
}
getSpreadImg(from).then(
res => {
that.info = res.data;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
}
);
// this.swiper.on("slideChange", function() {
// that.activeIndex = that.swiper.activeIndex;
// });
},
downloadIamge: function(imgsrc, name) {
var that = this;
this.isDown = true;
var downloadUrl = imgsrc;
if (!wx.saveImageToPhotosAlbum) {
uni.showModal({
title: "提示",
content:
"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
});
that.openDialogVisible = true;
return;
computed: {
swiper() {
// return this.$refs.mySwiper.swiper;
}
// 可以通过 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) {}
});
}
},
methods: {
getIndex: function () {
let that = this;
getSpreadImg({
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
}).then(
res => {
that.info = res.data;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
} else {
that.downloadImage(downloadUrl);
}
},
fail(res) {
);
},
downloadIamge: function (imgsrc, name) {
var that = this;
this.isDown = true;
var downloadUrl = imgsrc;
if (!wx.saveImageToPhotosAlbum) {
uni.showModal({
title: "提示",
content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
});
that.openDialogVisible = true;
return;
}
});
},
saveImg: function() {
this.downloadIamge(
this.info[this.activeIndex].wap_poster,
"poster" + this.activeIndex
);
// 可以通过 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 lang="less">
page {
height: 100%;
}
.distribution-posters {
height: 100%;
}
<style lang="less">
page {
height: 100%;
}
.banenr {
height: 100%;
}
.distribution-posters {
height: 100%;
}
.banner swiper {
height: 100%;
}
.banenr {
height: 100%;
}
.banner .slide-image {
width: 100%;
height: auto;
}
.banner swiper {
height: 100%;
}
.banner .slide-image {
width: 100%;
height: auto;
}
</style>
+195 -152
View File
@@ -1,17 +1,20 @@
<template>
<view class="cash-withdrawal">
<view class="nav acea-row">
<view
v-for="(item, navListIndex) in navList"
class="item font-color-red"
@click="swichNav(navListIndex, item)"
:key="navListIndex"
>
<!-- <view class="nav acea-row">
<view v-for="(item, navListIndex) in navList" class="item font-color-red" @click="swichNav(navListIndex, item)"
:key="navListIndex">
<view class="line bg-color-red" :class="currentTab === navListIndex ? 'on' : ''"></view>
<view class="iconfont" :class="item.icon + ' ' + (currentTab === navListIndex ? 'on' : '')"></view>
<view>{{ item.name }}</view>
</view>
</view>
</view> -->
<div class="pos-order-list">
<view class="nav acea-row row-around row-middle">
<view v-for="(item, navListIndex) in navList" class="item" :class="currentTab === navListIndex ? 'on' : ''"
@click="swichNav(navListIndex, item)" :key="navListIndex">{{item.name}}</view>
</view>
</div>
<view class="wrapper">
<view :hidden="currentTab !== 0" class="list">
<view class="item acea-row row-between-wrapper">
@@ -55,158 +58,198 @@
</view>
</template>
<script>
import { getBank, postCashInfo } from "@/api/user";
import { required } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
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: ""
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) {
console.log(item);
this.currentTab = index;
this.post.extract_type = item.type;
},
currentTab: 0,
minPrice: 0,
banks: [],
commissionCount: 0
};
},
mounted: function() {
this.getBank();
},
methods: {
swichNav: function(index, item) {
console.log(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) {
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) {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
);
},
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;
// console.log(parseFloat(money))
if (
parseFloat(money) > parseFloat(that.commissionCount) ||
parseFloat(that.commissionCount) == 0
) {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
title: "余额不足",
icon: "none",
duration: 2000
});
return
}
);
},
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;
// console.log(parseFloat(money))
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);
//console.log(that.post.extract_type)
switch (that.post.extract_type) {
case "alipay":
// if (!name) {
// uni.showToast({
// title: "请输入支付宝用户名",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!alipay_code) {
// uni.showToast({
// title: "请输入支付宝账号",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!money) {
// uni.showToast({
// title: "请输入提现金额",
// icon: "none",
// duration: 2000
// });
// return;
// }
try {
await this.$validator({
name: [required(required.message("支付宝用户名"))],
alipay_code: [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);
if (parseFloat(money) < parseFloat(that.minPrice)) {
uni.showToast({
title: "最低提现金额" + that.minPrice,
icon: "none",
duration: 2000
});
return
}
//console.log(that.post.extract_type)
switch (that.post.extract_type) {
case "alipay":
// if (!name) {
// uni.showToast({
// title: "请输入支付宝用户名",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!alipay_code) {
// uni.showToast({
// title: "请输入支付宝账号",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!money) {
// uni.showToast({
// title: "请输入提现金额",
// icon: "none",
// duration: 2000
// });
// return;
// }
try {
await this.$validator({
name: [required(required.message("支付宝用户名"))],
alipay_code: [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 => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
this.$yrouter.push({
path: "/pages/user/promotion/CashAudit/index"
});
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
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 => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
this.router.push({ path: "/user/audit" });
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
}
);
}
}
};
};
</script>
<style lang="less">
.cash-withdrawal .pos-order-list .nav .item.on {
color: #eb3729
}
</style>
@@ -20,7 +20,6 @@
</view>
</view>
</view>
<!-- <view class="bnt bg-color-red" @click="toCash">立即提现</view> -->
<view class="list acea-row row-between-wrapper">
<view class="item acea-row row-center-wrapper row-column" @click="goPoster()">
<text class="iconfont icon-erweima"></text>