Authored by gs1866

Merge remote-tracking branch 'origin/develop' into develop

Showing 40 changed files with 719 additions and 265 deletions
... ... @@ -26,6 +26,11 @@ export default {
bounces: false,
clearCacheWhenDestroy: false
});
// queryString中携带bind_code,则弹出绑定弹框
if (this.$route.query.bind_code) {
this.$createThirdBind().show();
}
},
watch: {
'yoho.context.needLogin': function(newVal) {
... ...
... ... @@ -18,7 +18,7 @@ const errHandle = (error) => {
});
};
const request = (options, store) => {
sign(options);
// sign(options);
return axios(options).then((res) => {
return res.data;
... ...
... ... @@ -4,7 +4,7 @@
<div class="under-row">
<i class="iconfont iconphone2"></i>
<div class="select-block">
<CubeSelect class="area-code-select" v-model="code" :options="options"></CubeSelect>
<CubeSelect class="area-code-select" v-model="code" :options="options" :title="selectTitle"></CubeSelect>
</div>
<CubeInput class="bind-input" v-model="phone" placeholder="请输入手机号"></CubeInput>
</div>
... ... @@ -14,7 +14,7 @@
<CubeButton class="send-sms-btn" :disabled="!!sendBtnText" @click="sendSMS">{{sendBtnText || '获取验证码'}}</CubeButton>
</div>
<div class="submit-row">
<CubeButton class="bind-btn">登录</CubeButton>
<CubeButton class="bind-btn" @click="bindSubmit">登录</CubeButton>
</div>
</div>
</div>
... ... @@ -23,6 +23,45 @@
<script>
import { Button, Input, Select } from 'cube-ui';
import { mapActions, mapState } from 'vuex';
const areaList = [{
value: '+61',
name: '澳大利亚'
}, {
value: '+82',
text: '韩国'
}, {
value: '+1',
text: '加拿大'
}, {
value: '+60',
text: '马来西亚'
}, {
value: '+1',
text: '美国'
}, {
value: '+81',
text: '日本'
}, {
value: '+65',
text: '新加坡'
}, {
value: '+44',
text: '英国'
}, {
value: '+86',
text: '中国'
}, {
value: '+853',
text: '中国澳门'
}, {
value: '+886',
text: '中国台湾'
}, {
value: '+852',
text: '中国香港'
}];
export default {
name: 'ThirdBind',
... ... @@ -30,16 +69,29 @@ export default {
return {
showBind: false,
code: '+86',
options: ['+86', '+8700', '+88'],
options: areaList,
selectTitle: '选择国家和地区',
phone: '',
smsCode: '',
sendBtnText: ''
}
},
methods: {
...mapActions(['sendBindSms', 'submitThirdBind']),
show() {
this.bindCode = this.$route.query.bind_code;
this.showBind = true;
},
close() {
this.showBind = false;
},
toast(msg, time = 2000) {
this.$createToast && this.$createToast({
txt: msg,
type: 'txt',
time
}).show();
},
sendSMS() {
let total = 60;
let timer = setInterval(() => {
... ... @@ -47,10 +99,32 @@ export default {
this.sendBtnText = '重新获取 ' + total;
} else {
this.sendBtnText = '';
clearInterval(timer)
clearInterval(timer);
}
}, 1000);
this.sendBtnText = '重新获取 ' + total;
this.sendBindSms({
mobile: this.phone,
bindCode: this.bindCode
});
},
bindSubmit() {
if (this.phone && this.smsCode) {
this.submitThirdBind({
mobile: this.phone,
code: this.smsCode,
bindCode: this.bindCode
}).then(res => {
if (res.code === 200) {
this.close();
} else {
this.toast(res.message);
}
});
} else {
this.toast(this.phone ? '请输入短信验证码' : '请输入手机号');
}
}
},
components: {
... ... @@ -101,7 +175,7 @@ export default {
}
.select-block {
width: 130px;
min-width: 130px;
position: relative;
margin-right: 10px;
... ...
<template>
<div class="layout">
<LayoutHeader class="layout-header" :title="title" :opacity="opacity" :show-back="showBack"></LayoutHeader>
<slot name="header">
<LayoutHeader class="layout-header" :title="title" :opacity="opacity" :show-back="showBack"></LayoutHeader>
</slot>
<div class="layout-context" :class="{fixscroll: this.fixscroll}">
<slot></slot>
</div>
... ...
import createAPI from 'utils/create-api';
export default function addPayType(Vue, PayType) {
createAPI(Vue, PayType, [], true);
createAPI(Vue, PayType, ['closeAction', 'payAction'], true);
}
... ...
<template>
<i :class="getClass"></i>
</template>
<script>
export default {
name: 'YohoCheck',
props: {
value: {
type: Boolean,
default: true
}
},
data() {
return {
val: this.value
};
},
computed: {
getClass() {
return {
iconfont: true,
icon_size: true,
iconweixuanyuanquan: !this.val,
iconxuanzhongduigou: this.val,
icon_color: this.val
};
}
},
watch: {
value(newVal) {
this.val = newVal;
}
},
methods: {
onClick() {
this.val = !this.val;
this.$emit('input', this.val);
},
}
};
</script>
<style lang="scss" scoped>
.icon_size {
font-size: 24px;
}
.icon_color {
color: black;
}
</style>
... ...
<template>
<YohoActionSheet ref="actionSheet">
<div class="pay-type-wrapper"></div>
<div class="pay-type-wrapper">
<div class="header">
<div class="title">选择支付方式</div>
<span><i class="iconfont iconweibiao45133 close" @click="close"></i></span>
</div>
<slot name="price">
<div class="price-info">
<div class="desc">{{desc}}</div>
<div class="price">{{price }}</div>
</div>
</slot>
<slot name="content">
<div class="pay-list-wrapper">
<div class="pay-list-item" v-for="item in data.pay_list" :key="item.payment_id">
<div class="pay-info">
<span class="alipay"></span>
<span>{{item.pay_name}}</span>
</div>
<Check class="check"></Check>
</div>
</div>
</slot>
<div name="footer" class="footer">
<YohoButton txt="确定支付" @click="pay"></YohoButton>
</div>
</div>
</YohoActionSheet>
</template>
<script>
import YohoActionSheet from '../action-sheet';
import Check from './check2';
import YohoButton from '../button';
export default {
name: 'OrderPayType',
props: {
data: {
type: Object,
default() {
return {};
}
},
price: {
type: [String, Number],
default: ''
},
desc: {
type: String,
default: ''
}
},
components: {
YohoActionSheet
YohoButton,
YohoActionSheet,
Check
},
methods: {
show() {
this.$refs.actionSheet.show();
},
close() {
this.$emit('closeAction');
},
pay() {
this.$emit('payAction');
}
}
};
... ... @@ -22,7 +73,84 @@ export default {
<style lang="scss" scoped>
.pay-type-wrapper {
height: 700px;
height: 714px;
background: white;
position: relative;
}
.header {
display: flex;
justify-content: space-between;
padding: 40px;
}
.title {
font-weight: bold;
font-size: 32px;
color: #222;
}
.close {
font-size: 32px;
}
.pay-list-wrapper {
padding: 40px;
}
.pay-list-item {
height: 140px;
font-size: 28px;
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
}
.check {
font-size: 40px;
}
.alipay {
display: inline-block;
width: 60px;
height: 60px;
margin-right: 20px;
background: url(~statics/image/order/alipay@3x.png) no-repeat;
background-size: cover;
}
.pay-info {
display: flex;
justify-content: space-between;
align-items: center;
}
.footer {
position: absolute;
bottom: 0;
padding: 40px;
width: 100%;
box-sizing: border-box;
}
.price-info {
margin-top: 40px;
margin-bottom: 60px;
}
.price {
font-size: 56px;
color: #d0021b;
text-align: center;
font-weight: bolder;
}
.desc {
text-align: center;
font-size: 24px;
color: #999;
}
</style>
... ...
const config = {
development: {
axiosBaseUrl: 'http://m.yohobuy.com:6001/xianyu',
axiosBaseUrl: 'http://m.yohobuy.com/xianyu',
axiosResponseType: 'json',
reportUrl: '//badjs.yoho.cn/apm/yas2.gif',
},
... ...
... ... @@ -7,6 +7,7 @@ import {createApi} from 'create-api';
import {Style, Toast, Dialog, DatePicker, ImagePreview} from 'cube-ui'; //eslint-disable-line
import {get} from 'lodash';
import Lazy from 'vue-lazyload';
import cookie from 'yoho-cookie';
import yoho from 'common/yoho';
import OrderPayType from 'components/order-pay-type';
import Bind from 'components/bind';
... ... @@ -47,6 +48,7 @@ yoho.auth = async(loginUrl) => {
if (user && user.uid) {
return user;
} else {
cookie.set('third_backurl', location.href);
location.href = loginUrl || `${location.origin}/xianyu/passport/login/taobao`;
return;
}
... ...
... ... @@ -45,28 +45,19 @@
></CInput>
</FormItem>
<label
ref="labelTags"
class="wrapper-tag"
action="radio_submit"
method="get"
accept-charset="utf-8"
>
<div class="wrapper-tag">
<p class="tag-text">设置标签:</p>
<div v-for="(tag, index) in addressTags" :key="index">
<label class="label-text">
<input
type="radio"
checked="tag.code === model.tagType"
name="tag"
:value="tag.code"
class="label-tag"
<RadioGroup class="wrapper-radio">
<div v-for="(tag, index) in addressTags" :key="index">
<Radio
:label="{text: `${tag.name}`, value: `${tag.code}`}"
v-model="model.tagType"
/>
{{tag.name}}
</label>
</div>
</label>
checked="tag.code === model.tagType"
class="tag-radio"
></Radio>
</div>
</RadioGroup>
</div>
<div class="wrapper-del">
<Radio
... ... @@ -98,6 +89,7 @@ import Input from "./components/input";
import FormItem from "./components/form-item";
import Radio from "./components/radio";
import AddressAct from "./components/address-act";
import RadioGroup from "./components/radio-group";
import { createNamespacedHelpers } from "vuex";
const { mapState, mapMutations, mapActions } = createNamespacedHelpers(
... ... @@ -111,7 +103,8 @@ export default {
CInput: Input,
FormItem,
Radio,
AddressAct
AddressAct,
RadioGroup
},
data() {
return {
... ... @@ -159,6 +152,7 @@ export default {
async onSubmit() {
let that = this;
let data = this.validator();
if (!data) {
... ... @@ -177,7 +171,7 @@ export default {
if (result && result.code === 200) {
this.$createToast({
type: "txt",
txt: result.message
txt: result.message.split(".").join("")
}).show();
await this.sleep(1000);
... ... @@ -239,32 +233,12 @@ export default {
tag_code: info.tagType
};
},
showToast(tip) {
this.$createToast({
type: "txt",
txt: tip
}).show();
},
chooseArea() {
this.isShowPop = true;
},
popHidden() {
let that = this;
that.isShowPop = false;
},
modifyAddressAct(info) {
if (info) {
let that = this;
that.model.areaCode = info.code;
that.model.receiverArea = info.area;
}
},
async delAddress() {
const result = await this.deleteUserAddress(this.model.addressId);
if (result && result.code === 200) {
this.$createToast({
type: "txt",
txt: result.message
txt: result.message.split(".").join("")
}).show();
await this.sleep(1000);
... ... @@ -277,6 +251,26 @@ export default {
}).show();
}
},
chooseArea() {
this.isShowPop = true;
},
popHidden() {
let that = this;
that.isShowPop = false;
},
modifyAddressAct(info) {
if (info) {
let that = this;
that.model.areaCode = info.code;
that.model.receiverArea = info.area;
}
},
showToast(tip) {
this.$createToast({
type: "txt",
txt: tip
}).show();
},
sleep(n) {
return new Promise(resolve => {
setTimeout(() => {
... ... @@ -323,6 +317,7 @@ export default {
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 80px;
.del-address {
width: 150px;
... ... @@ -371,10 +366,11 @@ export default {
}
.wrapper-tag {
display: flex;
flex-direction: row;
margin: 30px 0;
align-items: center;
.wrapper-radio {
margin: 30px 0 20px;
}
.tag-text {
font-size: 36px;
... ... @@ -382,16 +378,8 @@ export default {
font-weight: bold;
}
.label-text {
margin-left: 20px;
font-size: 30px;
color: #444444;
line-height: 44px;
}
.label-tag {
display: inline-block;
vertical-align: middle;
.tag-radio {
margin-right: 30px;
}
}
... ...
<template>
<div class="radio-group">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'Radio-Group',
props: {
value: {
type: [String, Number]
}
},
data() {
return {
labelList: []
};
},
methods: {
getLabels() {
return this.$children.forEach(i => i.$options.name === 'Radio');
},
updateLabel() {
}
}
};
</script>
<style lang="scss" scoped>
.radio-group {
display: flex;
}
</style>
... ...
... ... @@ -105,7 +105,7 @@ export default {
height: 55px;
font-size: 28px;
line-height: 55px;
margin-left: 20px;
margin-left: 10px;
color: #999;
&.active {
... ...
<template>
<div class="ScrollNav">
<ScrollNavBar :current="current" :labels="labels" @change="changeHandler">
<span slot-scope="props" @click="changeHandler(props.index)">
<span slot-scope="props">
{{props.txt}}
<!-- <span :ref="`getindex${current}`" v-show="false">{{props.index}}</span> -->
<!-- <span :ref="`getindex${props.index}`" v-hide></span> -->
<span :ref="`getindex${props.txt}`" v-show="false">{{props.index}}</span>
</span>
</ScrollNavBar>
</div>
... ... @@ -48,8 +51,13 @@ export default {
...mapState(['channelList','scrollnavidList']),
},
methods: {
changeHandler(index) {
console.log(this.channelList.scrollnavList[index]); // value
changeHandler(cur) {
// console.log(this.$refs[`getindex${this.current}`]);
// console.log(cur);
console.log(this.$refs[`getindex${cur}`].innerText);
// console.log(this.$refs.getindex);
// console.log(cur);
// console.log(this.channelList.scrollnavList[index]); // value
// console.log(this.channelList.scrollnavidList[index]); // id
}
}
... ...
<template>
<div class="progress-box">
<!-- 绘制圆环背景 -->
<canvas class="progress-bg" id="canvasProgressbg" />
<!-- 绘制加载中圆弧 -->
<canvas class="progress-canvas" id="canvasProgress" />
</div>
</template>
<script>
import incomeItem from './incomeItem'
export default {
name: 'income-detail',
props: {
data: {
type: Array,
default: []
}
},
data() {
return {
};
},
methods: {
/**
* 画progress底部背景
*/
drawProgressbg: function (summary) {
var c=document.getElementById("canvasProgressbg");
var cxt=c.getContext("2d");
// 设置圆环的宽度
ctx.setLineWidth(28 * radio);
// 设置圆环的颜色
let strokeColor = '#E0E0E0'
if (summary && summary.totalIncome > 0) {
strokeColor = '#65AB85';
}
ctx.setStrokeStyle(strokeColor);
// 设置圆环端点的形状
ctx.setLineCap('round')
//开始一个新的路径
ctx.beginPath();
//设置一个原点(110,110),半径为100的圆的路径到当前路径
console.log("起始点:" + Math.PI)
ctx.arc(120 * radio, 120 * radio, 100 * radio, 0, 2 * Math.PI, false);
//对当前路径进行描边
ctx.stroke();
//开始绘制
ctx.draw();
},
/**
* 画progress进度
*/
drawCircle: function (step) {
// 使用 wx.createContext 获取绘图上下文 context
var context = wx.createCanvasContext('canvasProgress');
// 设置圆环的宽度
context.setLineWidth(28 * radio);
// 设置圆环的颜色
let strokeColor = '#002B47'
// if (this.data.summary.totalIncome <= 0){
// strokeColor = '#E0E0E0';
// }
context.setStrokeStyle(strokeColor);
// 设置圆环端点的形状
context.setLineCap('round')
//开始一个新的路径
context.beginPath();
//参数step 为绘制的圆环周长,从0到2为一周 。 -Math.PI / 2 将起始角设在12点钟位置 ,结束角 通过改变 step 的值确定
context.arc(120 * radio, 120 * radio, 100 * radio, -Math.PI / 2, step * Math.PI - Math.PI / 2, false);
//对当前路径进行描边
context.stroke();
//开始绘制
context.draw()
},
/**
* 开始progress
*/
startProgress: function (summary) {
// 设置倒计时 定时器 每100毫秒执行一次,计数器count+1 ,耗时6秒绘一圈
if (summary && summary.totalIncome > 0) {
// this.countTimer = setInterval(() => {
// if (this.data.count <= 60) {
/* 绘制彩色圆环进度条
注意此处 传参 step 取值范围是0到2,
所以 计数器 最大值 60 对应 2 做处理,计数器count=60的时候step=2
*/
this.drawCircle(summary.goodsIncome / (summary.totalIncome / 2))
// if()
// this.data.count++;
// }
// else {
// clearInterval(this.countTimer);
// this.startProgress();
// }
// }, 100)
}
},
},
components: {
incomeItem
}
};
</script>
<style lang="scss" scoped>
.total-income {
font-size: 36px;
padding: 15px;
border-bottom: solid 1px #eee;
}
.no-data {
color: #ccc;
font-weight: bold;
text-align: center;
font-size: 42px;
padding: 100px 0;
}
</style>
<template>
<div class="progress-box">
<!-- 绘制圆环背景 -->
<canvas ref="canvasProgressbg" class="progress-bg" id="canvasProgressbg" width="280" height="280" />
<!-- 绘制加载中圆弧 -->
<canvas ref ="canvasProgress" class="progress-canvas" id="canvasProgress" width="280" height="280" />
</div>
</template>
<script>
import {mapState} from 'vuex';
export default {
name: 'income-circle',
props: {
data: {
type: Object,
default: {}
}
},
data() {
return {
};
},
computed: {
...mapState({
radio: (state) => {
return (state.yoho.window.clientWidth/750).toFixed(2);
},
// summary:(state) => {
// return {
// goodsIncome: state.home.mine.assetData.goodsIncome,
// totalIncome: state.home.mine.assetData.totalIncome,
// compensateIncome: state.home.mine.assetData.compensateIncome
// }
// },
})
},
mounted() {
// console.log(typeof this.data.compensateIncome)
let summary = {}
// console.log(this.goodsIncome)
// console.log(summary)
// console.log('---------')
// console.log(this.data)
summary.compensateIncome = '299.26';
summary.goodsIncome = '955.78';
summary.totalIncome = '1255.04';
this.drawProgressbg(summary);
this.startProgress(summary);
},
methods: {
// 画progress底部背景
drawProgressbg: function (summary) {
var c=document.getElementById("canvasProgressbg");
var ctx=c.getContext("2d");
ctx.lineWidth= 28 ;
let strokeStyle = '#E0E0E0'
if (summary && summary.totalIncome > 0) {
strokeStyle = '#65AB85';
}
ctx.strokeStyle=strokeStyle;
ctx.lineCap='round'
ctx.beginPath();
//设置一个原点(110,110),半径为100的圆的路径到当前路径
console.log("起始点:" + Math.PI)
ctx.arc(120, 120, 100, 0, 2 * Math.PI, false);
ctx.stroke();
//开始绘制
// ctx.draw();
},
// 画progress进度
drawCircle: function (step) {
var c=document.getElementById("canvasProgress");
var context=c.getContext("2d");
context.lineWidth=28;
let strokeColor = '#002B47'
context.strokeStyle=strokeColor;
context.lineCap='round';
context.beginPath();
//参数step 为绘制的圆环周长,从0到2为一周 。 -Math.PI / 2 将起始角设在12点钟位置 ,结束角 通过改变 step 的值确定
context.arc(120, 120, 100, -Math.PI / 2, step * Math.PI - Math.PI / 2, false);
context.stroke();
//开始绘制
// context.draw()
},
// 开始progress
startProgress: function (summary) {
if (summary && summary.totalIncome > 0) {
this.drawCircle(summary.goodsIncome / (summary.totalIncome / 2))
}
},
}
};
</script>
<style lang="scss" scoped>
.progress-box {
position: absolute;
top: 50px;
right: 50px;
width: 280px;
height: 280px;
}
.progress-bg {
position: absolute;
width: 100%;
height: 100%;
}
.progress-canvas {
position: absolute;
width: 100%;
height: 100%;
}
</style>
... ...
... ... @@ -15,8 +15,6 @@ export default {
methods: {
},
};
</script>
... ...
<template>
<div>
<p class="income-title">我的收入</p>
<div class="income-header">
<p class="total-income">收入: {{data.totalIncome}}</p>
<div class="income">
... ... @@ -12,10 +14,12 @@
<span class="income-num">{{data.compensateIncome}}</span>
</div>
</div>
<incomeCircle :data="data"></incomeCircle>
</div>
</template>
<script>
import incomeCircle from './incomeCircle';
export default {
name: 'income-header',
props: {
... ... @@ -29,12 +33,21 @@ export default {
};
},
components: {
incomeCircle
}
};
</script>
<style lang="scss" scoped>
.income-header-wrapper {
position: relative;
}
.income-title {
font-size: 60px;
color: #000;
margin-top: 20px;
}
.income-header {
margin: 50px 0;
}
... ...
... ... @@ -31,8 +31,6 @@ export default {
};
},
};
</script>
... ... @@ -42,8 +40,6 @@ export default {
flex-direction: column;
justify-content: space-between;
border-bottom: solid 1px #E0E0E0;
/* background: #ee00dd; */
/* position: fixed; */
}
.assets-record-info-detail-view {
... ... @@ -74,7 +70,6 @@ export default {
.assets-record-image-style {
width: 48px;
height: 48px;
/* background: #00ff */
}
.assets-record-code-txt {
font-family: PingFang-SC-Regular;
... ...
... ... @@ -32,15 +32,10 @@ export default {
default: 0
}
},
methods: {
},
components: {
Style,
Loading
}
};
</script>
... ...
... ... @@ -7,7 +7,7 @@
:options="options"
@pulling-down="onPullingDown"
@pulling-up="onPullingUp">
<h1>我的收入</h1>
<incomeHeader :data="incomeSum"></incomeHeader>
<incomeDetail :data="incomeData">
<template v-for="(item,index) in incomeData.list">
... ... @@ -52,26 +52,19 @@ export default {
},
mounted() {
this.fetchAssets(true).then(data => {
console.log(data)
})
this.fetchAssets(true)
},
methods: {
...mapActions(['fetchAssets']),
onPullingDown() {
this.fetchAssets(true).then(data => {
console.log(data)
})
this.fetchAssets(true)
},
onPullingUp() {
if(!this.incomeData.endReached) {
this.fetchAssets(false).then(data => {
console.log(data)
})
this.fetchAssets(false)
} else {
this.$refs.scroll.forceUpdate()
}
}
},
components: {
... ... @@ -92,8 +85,5 @@ export default {
background-color: white;
padding: 0 40px;
color: #999;
h1 {
color: #000;
}
}
</style>
... ...
... ... @@ -66,16 +66,14 @@ export default {
...mapState(['productDetail', 'address', 'fee', 'price', 'agree'])
},
methods: {
...mapActions(['fetchOrderAddress', 'fetchUserStatus', 'fetchOrderPrice']),
...mapActions(['fetchOrderAddress', 'fetchUserStatus', 'fetchOrderPrice', 'submitOrder', 'fetchPayList']),
...mapMutations([Types.CHANGE_PRICE, Types.CHANGE_AGREE]),
onClick() {
if (!this.error) {
this.$createOrderPayType().show();
}
this.submit();
},
compute() {
this.fetchOrderPrice({
return this.fetchOrderPrice({
address_id: this.address.address_id,
num: 1,
price: this.price,
... ... @@ -89,6 +87,7 @@ export default {
type: 'txt'
}).show();
}
this.error = false;
});
},
changePrice(val) {
... ... @@ -97,10 +96,40 @@ export default {
changeAgree(val) {
this[Types.CHANGE_AGREE](val);
},
submit() {
this.compute().then(result => {
async submit() {
await this.compute();
if (this.error) {
return;
}
const orderResult = await this.submitOrder({
address_id: this.address.address_id,
num: 1,
price: this.price,
storage_id: 10000128,
});
if (orderResult.code !== 200) {
this.$createToast({
time: 1500,
txt: '创建订单失败',
type: 'txt'
}).show();
return;
}
const { orderCode } = orderResult.data;
const payListResult = await this.fetchPayList({
order_code: orderCode
});
this.$createOrderPayType({
data: payListResult.data,
price: this.fee.earnestMoneyStr,
desc: '保证金'
}).show();
}
}
};
... ...
... ... @@ -14,7 +14,6 @@ export default {
beforeRouteUpdate(to, from, next) {
},
mounted() {
this.$createThirdBind().show();
// this.$yoho.authRealName();
},
methods: {
... ...
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1569489962737'); /* IE9 */
src: url('iconfont.eot?t=1569489962737#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAiIAAsAAAAAEKgAAAg5AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCFPgqQYI08ATYCJANMCygABCAFhG0HgU8bEw4jkizWKLJ/FuRk8Smp3mJFbLlQPCvOkwuCJjSuVOFA6r4m3O/neIBf99+5c+fNE39bKrFt+7sJjAAildg2MUElOymU91ZMmuFpm/+OA4Nql2fHKq1Faq9POBAD+CfOIT9ga/y/CSOTRRTCShcZP80BzxnAweR+/tdcnWEWosk1pGRCpMR/N/s67qNidQ0PeSHdEJUQeR2vHiqhUWLGQjx7nwkB6wzC4QRUjDJDGF6wcCUnKY4Dmu3avnU9p0KCdIpPULJkkU3TveFvBaXkQnIGcNG9ffgIZoYSiULEj7RUMn+TuQ+cPhfLswrWOb6+NLTsETEDaYu9ima8BDGgGY5UYm1TtzFCi/1Gtb4zoRARpkrT4v5gxD6LPjJ4nuf0nQimaL01TwfHbQtGGGWM0I77Rx6JKJMqqStqKwgqqspqOhqaWoQMSI05vKvs0HdSAgl9Z4FIX8BlQyoEl4KGAFuGRoCrg04FVwRNA9cGbQFXAL0PgcBgnECFgbdAlYGPQJmBSKDG4AjXAT0DrgF6FlwT9Bw6aIGu2WQSppKsA+JunB12aQWJIOFerghS4S6SguT0w9q1WijXGw27mxG1dHS3W67VRsGj5cpjOjMzKhN5zBaLyVenUtkRtdmS7Pbk4eFEqzVfogQv5pVttgRySUtBk7ZR35xKaRCsG9gDyfFGDWTQ85NMZI+XaNRmQSadINk8Txk3waDXKNZcRPIprHGue6ehwiaT3sAlUA0GrZFHIxiNBWYBTDObdSbU9iDJ/jB5+H6i9V4aBSKvPkfWWxMoNeejG/p4TeB4q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+BcdG0mIQYWtQ4DYkQFQUmf5ONukZFsUfZOs6VlgrlmCrDyaPk8Ouj7jrgiY2aN9C/SQA2nK+pguFTH5UWF2Hef3NGQucHpInEkUtG6wwfOzo2vHPE6tyfmyitkY8R5gnL4Cq9SbBl4BvNmXRlCrT/LHfA2W4pd9EB7Xx9vdqRddz8518EpzNTN+8B66I2hAjk94BD+XHkB+N+eA5AfEzwdqHykVgDu8c+lPyIkfKBKErnAgDsQMVA3hVL4OWJ72CcC6O+2yI76ny1sQLW+pvjY1jm8EAqGv7yFgMHP/xydT1j5m8nys/gnLfddX4sP9dmYD3lSgh4ZgD+4DKL432yTUMTS+ymfWyqpEzFYQXLtlVPVzRSS799VBE5QM5yOkaJDc1t+G9lvCww4Wg8ijEHD5TCISCwgCICZXCYE1jhL3brKg4cDEqdATDNNgRCmDoCCej2IxgOZxERDiOBJHzPoQM8AhxIlhQ4u6TwCjJyJI6hKkyMpKkRmUghl8hkFdk3j8OkuVkoTqbGckkYniNTyJHQoJBxdSwmx/B1rJGzURqmUkkQCa7IRmKSVbCsLAWixBUZmEgVlI4q5fTgYElnzSCRIhuQRcJhUCoTWgyRRh1RRkRBTjKxCrny+nEwUrmyoPAp/Q4iJsHgcshsR4QKEjKHOpbI5+p3X9rm2EgqjIrSJBDVFaeQDRFDaZgsUaGAUMYXyoARUQmSvkSZ0nTBNJ5kXhK0fZZ9+xM334D8DvUugiQrqqYbpmU7rudjYePghlR2TfZGyFWSxIo8uZwkC0TFYqefcrEc1VVblpiFSVQkXCZNVzlXFULJyqzcnMBsmdzsmaxG5fnpmFyajToo0xVyLIyYhooyHZdvhWM5OTRROlaIuF6MSdDcLBWJktl6ktysLMLyTBKK44o8AAAA') format('woff2'),
url('iconfont.woff?t=1569489962737') format('woff'),
url('iconfont.ttf?t=1569489962737') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1569489962737#iconfont') format('svg'); /* iOS 4.1- */
src: url('iconfont.eot?t=1569575909056'); /* IE9 */
src: url('iconfont.eot?t=1569575909056#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAlwAAsAAAAAEmwAAAkhAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCFeAqTJI9IATYCJANYCy4ABCAFhG0HggIbmA9RlGtSTPZFgd1GbDniHuHQIg8EU2af2bZ5PlODLoPHTf9eXkJZKBWoSWZWNyidWJlpWgKlBgtQmaqwL2rtzNg3o1sCgAfivvb+fexSx3WgZWnax8ajyELZhJp/N40f0Zraerq1D6n7nAsLrLBK1OFkEpUfePu1sAxnPcDfKvDv11q9O9RCci+ZEClx/2Jf3sI9VKzSGEqBkHYRlcRQAt4YplMqJWUgwLzqJCsklVNohdfhZCAAeCSgH4jRNGQU1GChOKFDvd0mQp1JBVvjRKBOUhl2ZKeRdeCgZpYzHwFYG3w9eYo0ogYYcBTqVCPeyi0o2eQPP6HzFAqTovmYP142gIUWQAH0A8AuFJ8x9wFoxPoFgjc1Z+EFsNQ9/XQxG6taoQ6oI+qEOqPOqZuqpJ5rNVqHtqW90r78VzYWtbzWYtak3fBp7AQP7B0cWZyYnB2XUKSQqPSlWCozP65/8RqtWmc1jJMgRVSrGgKvD1Y2FgeFAVhBEVAOV4QKUAIMgCpgBNQDE6ASmAHFwCwoBeZAGbAJmgEJ7jLgnAAC/moCaPhrR62EDlANbIE64BVoBXwCDcBn0Ah8oZcJ1t4OV9wIfxHRP5TyHWQnQq0PZEQUiTgjL0QsY2la5wBrbl6en9WylUPzwtpQPxVbl137xtICa0GaU0BxQV9YoDbOySmKNmQZVxQim8UgdNoMDUlaXZZRm09iM1SaERdENtDTOy0kXNIk4JgyXBBapRhPHQOBLidcbapLUI4hHUXMstMaJd1Ka29XZDpAmurc2XZ9gQzbvbfjC0h01+4eA1W/S+boBYHhSnQ5HEfxpbk6nmdd5fpcl4sWyHOa6jjXYab0he1L0qWeb8+V4KkNWcUVjcie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il8ax+dVNwgqpx9u0lpbJVYXRcwfhdZcrm01TVSJvxUi2QVPfVuDvjiVlZPfT0zvI4TZdnRDAAAAA==') format('woff2'),
url('iconfont.woff?t=1569575909056') format('woff'),
url('iconfont.ttf?t=1569575909056') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('iconfont.svg?t=1569575909056#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
... ... @@ -27,10 +27,22 @@
content: "\e609";
}
.iconweibiao45133:before {
content: "\e63c";
}
.iconi-add:before {
content: "\e618";
}
.iconweixuanyuanquan:before {
content: "\e651";
}
.iconxuanzhongduigou:before {
content: "\e652";
}
.iconquestion:before {
content: "\e6ab";
}
... ...
... ... @@ -29,9 +29,18 @@ Created by iconfont
<glyph glyph-name="downn" unicode="&#58889;" d="M930.25 472.573l-251.701-241.674c-18.573-17.814-48.693-17.814-67.19 0-18.573 17.814-18.573 46.718 0 64.529l251.664 241.674c18.573 17.814 48.653 17.814 67.227 0 18.535-17.814 18.535-46.717 0-64.529zM426.847 537.102l251.701-241.674c18.535-17.814 18.535-46.717 0-64.529-18.573-17.814-48.693-17.814-67.189 0l-251.739 241.674c-18.535 17.814-18.535 46.718 0 64.529 18.573 17.814 48.654 17.814 67.227 0z" horiz-adv-x="1821" />
<glyph glyph-name="weibiao45133" unicode="&#58940;" d="M505.173333 479.573334 122.88 868.693334c-27.306667 27.306667-68.266667 27.306667-102.4 0l0 0c-27.306667-27.306667-27.306667-68.266667 0-102.4L409.6 384l-389.12-389.12c-27.306667-27.306667-27.306667-68.266667 0-102.4l0 0c27.306667-27.306667 68.266667-27.306667 102.4 0l389.12 389.12 389.12-389.12c27.306667-27.306667 68.266667-27.306667 102.4 0l0 0c27.306667 27.306667 27.306667 68.266667 0 102.4L607.573333 384l389.12 389.12c27.306667 27.306667 27.306667 68.266667 0 102.4l0 0c-27.306667 27.306667-68.266667 27.306667-102.4 0L505.173333 479.573334 505.173333 479.573334z" horiz-adv-x="1024" />
<glyph glyph-name="i-add" unicode="&#58904;" d="M910.509 405.585h-378.843v376.925c0 11.2-9.427 20.281-20.626 20.281s-20.626-9.080-20.626-20.281v-376.925h-376.925c-11.2 0-20.281-9.426-20.281-20.626s9.080-20.626 20.281-20.626h376.925v-378.844c0-11.199 9.427-20.281 20.626-20.281s20.626 9.081 20.626 20.281v378.844h378.843c11.199 0 20.281 9.426 20.281 20.626s-9.081 20.626-20.281 20.626z" horiz-adv-x="1024" />
<glyph glyph-name="weixuanyuanquan" unicode="&#58961;" d="M527.864828 849.463104c-246.966765 0-447.169459-200.203718-447.169459-447.168436 0-246.963695 200.203718-447.167412 447.169459-447.167412 246.962671 0 447.166389 200.204741 447.166389 447.167412C975.03224 649.259386 774.827499 849.463104 527.864828 849.463104zM527.863804-16.61005c-231.355205 0-418.905742 187.550537-418.905742 418.905742 0 231.354182 187.549513 418.904719 418.905742 418.904719 231.355205 0 418.903695-187.549513 418.903695-418.904719C946.768523 170.940486 759.21901-16.61005 527.863804-16.61005z" horiz-adv-x="1024" />
<glyph glyph-name="xuanzhongduigou" unicode="&#58962;" d="M528.544303 849.464127c-247.186775 0-447.601294-200.38996-447.601294-447.601294 0-247.211335 200.415542-447.601294 447.601294-447.601294 247.194962 0 447.601294 200.38996 447.601294 447.601294C976.146621 649.075191 775.740288 849.464127 528.544303 849.464127M789.830191 523.099035 483.425709 225.9698c-5.210675-5.053086-11.95938-7.569396-18.690688-7.569396-6.880711 0-13.752212 2.622734-18.99768 7.867178L326.355371 345.650577c-10.500145 10.490935-10.500145 29.53364 0 40.024575 10.489912 10.490935 27.476795 12.537548 37.96773 2.046612l100.691283-100.676957 287.437501 278.719956c10.629081 10.29753 27.607778 8.024767 37.97387-2.641153C800.734542 552.476109 800.489972 533.433404 789.830191 523.099035" horiz-adv-x="1024" />
<glyph glyph-name="question" unicode="&#59051;" d="M512-128C229.216-128 0 101.248 0 384 0 666.784 229.216 896 512 896 794.752 896 1024 666.784 1024 384 1024 101.248 794.752-128 512-128ZM473.28 69.248 551.328 69.248 551.328 148.512 473.28 148.512 473.28 69.248ZM655.008 652.384C618.88 684.16 571.584 700 512.96 700 457.696 700 412.064 683.84 376.096 651.552 340.16 619.264 319.808 575.616 315.072 520.608L396.288 520.608C407.968 598.464 445.568 620.608 512.224 620.608 546.368 620.608 575.584 626.88 596.672 605.856 617.792 584.864 628.352 558.144 628.352 525.696 628.352 509.088 624.448 493.312 616.704 478.528 608.896 463.712 588.96 442.464 556.896 414.848 524.8 387.232 502.816 361.184 490.88 336.768 478.944 312.384 472.832 279.232 472.832 226.784L551.616 226.784C551.616 266.56 550.176 289.696 557.952 306.784 565.728 323.808 586.688 346.752 620.832 375.52 655.008 404.288 678.272 430.496 690.624 454.208 702.944 477.888 709.152 503.552 709.152 531.2 709.152 580.288 691.104 620.704 655.008 652.384Z" horiz-adv-x="1024" />
... ...
... ... @@ -14,7 +14,7 @@ export default function() {
page_total: 0, // 总共多少页
total: 0, // 总共多少条
scrollnavList: [], // 导航菜单
// scrollnavidList: [], // 导航菜单id
// scrollnavidList: [], // 导航菜单
},
},
mutations: {
... ...
... ... @@ -122,7 +122,6 @@ export default function() {
state.assetData = Object.assign({}, state.assetData, assetData);
},
assetFetching(state, {isFetching}) {
console.log(isFetching)
state.assetData.isFetching = isFetching;
},
... ... @@ -193,8 +192,6 @@ export default function() {
},
async fetchAssets({ commit, state }, isRefresh) {
console.log('----------------');
console.log(isRefresh);
let {isFetching, endReached, currentPage, list, pageSize} = state.assetData;
if (isFetching || (!isRefresh && endReached)) {
... ... @@ -212,11 +209,12 @@ export default function() {
let newList = [...oldList, ...assetData.list];
assetData.list = newList;
console.log(assetData)
if (typeof assetData.totalIncome !== 'undefined') {
commit('addAssets', assetData);
}
}
return result.data.page;
return result.data;
},
},
};
... ...
... ... @@ -69,12 +69,20 @@ export default function() {
}
commit(Types.FETCH_ORDER_FEE, order.data);
return {};
return order.data;
},
async fetchUserStatus() {
const alipayStatus = await this.$api.get('/api/order/alipay/status');
const userStatus = await this.$api.get('/api/order/user/status');
},
async submitOrder({ commit }, payload) {
return this.$api.post('/api/order/presubmit', payload);
},
async fetchPayList({ commit }, payload) {
return this.$api.post('/api/order/paytype', payload);
}
},
getters: {},
... ...
... ... @@ -149,6 +149,19 @@ export default function(mergeState = {}) {
backImageUrl
});
},
sendBindSms({ commit }, { mobile, bindCode }) {
return this.$api.post('/passport/bind/sms/send', {
mobile,
bindCode
});
},
submitThirdBind({ commit }, { mobile, code, bindCode }) {
return this.$api.post('/passport/bind/third', {
mobile,
code,
bindCode
});
},
reportError(params, {error}) {
this.$reportError(error);
},
... ...
... ... @@ -69,6 +69,20 @@ module.exports = {
api: 'ufo.user.aliPayAccountQuery',
},
// 下订单
'/api/order/presubmit': {
auth: true,
ufo: true,
api: 'ufo.sellerOrder.publishPrd',
},
// 支付方式
'/api/order/paytype': {
auth: true,
ufo: true,
api: 'ufo.payment.findPayListDetail',
},
// 订单物流信息
'/api/order/express': {
ufo: true,
... ...
... ... @@ -12,6 +12,8 @@ router.post('/xianyu/upload/idcard', multipartMiddleware, upload.uploadIdCard);
router.get('/xianyu/passport/login/taobao', passport.login.taobaoLogin);
router.get('/xianyu/passport/callback/taobao', passport.login.taobaoCallback);
router.post('/xianyu/passport/bind/sms/send', passport.bind.sendSms);
router.post('/xianyu/passport/bind/third', passport.bind.bindByCode);
app.use(router);
... ...
const _ = require('lodash');
const moment = require('moment');
const crypto = global.yoho.crypto;
const log = global.yoho.logger;
... ... @@ -39,7 +40,7 @@ const dynamicDecrypt = (str) => {
let decryptInfo = {};
try {
let decryptStr = crypto.decrypt(getDailyKey(), `${str}`);
let decryptStr = _.trim(crypto.decrypt(getDailyKey(), `${str}`));
let decryptArr = decryptStr.split(connectSymbol);
decryptInfo.val = decryptArr[0];
... ...
... ... @@ -35,7 +35,7 @@ function signMD5(params, clientSecret) {
*/
function Strategy(options, verify) {
options = options || {};
options.authorizationURL = options.authorizationURL || 'https://oauth.taobao.com/authorize';
options.authorizationURL = options.authorizationURL || 'https://oauth.taobao.com/authorize?view=wap';
options.tokenURL = options.tokenURL || 'https://oauth.taobao.com/token';
options.scopeSeparator = options.scopeSeparator || ',';
options.customHeaders = options.customHeaders || {};
... ...
... ... @@ -13,7 +13,7 @@ const crypto = global.yoho.crypto;
const config = global.yoho.config;
const loginPage = `${config.siteUrl}/signin.html`;
const bindPage = `/xianyu/passport/bind`;
const homePage = `${config.siteUrl}/xianyu/channel`;
// taobao 登录
passport.use('taobao', new TaobaoStrategy({
... ... @@ -25,7 +25,7 @@ passport.use('taobao', new TaobaoStrategy({
done(null, profile);
}));
class signModel extends global.yoho.BaseModel {
class passportModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
... ... @@ -41,10 +41,7 @@ class signModel extends global.yoho.BaseModel {
param.business_line = businessLine;
}
return this.get({ data: param }).then(res => {
console.log(res);
return res;
});
return this.get({ data: param });
}
syncUserSession({uid, sessionKey, req, res}) {
let userId = {
... ... @@ -106,10 +103,30 @@ class signModel extends global.yoho.BaseModel {
});
});
}
sendTaobaoBindCode(mobile) {
return this.post({
data: {
method: 'app.bind.sendCodeByTB',
source_type: 'taobao',
mobile
}
});
}
bindTaobaoAccountByCode({ mobile, code, openId }) {
return this.post({
data: {
method: 'app.bind.bindTBByCode',
source_type: 'taobao',
mobile,
code,
open_id: openId
}
});
}
};
const login = {
taobaoLogin: (req, res, next) => {
taobaoLogin(req, res, next) {
req.session.authState = uuid.v4();
return passport.authenticate('taobao', {
... ... @@ -117,14 +134,14 @@ const login = {
failWithError: true
})(req, res, next);
},
taobaoCallback: (req, res, next) => {
taobaoCallback(req, res, next) {
passport.authenticate('taobao', (err, user) => {
if (err || !user) {
log.error(`taobao authenticate error : ${JSON.stringify(err)}`);
return res.redirect(loginPage);
}
const model = req.ctx(signModel);
console.log(user);
const model = req.ctx(passportModel);
return model.signinByOpenID({
openId: user.open_uid,
... ... @@ -134,11 +151,9 @@ const login = {
if (result.code === 200) {
if (_.get(result, 'data.is_bind') === 'N') {
redirectUrl = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : '/xianyu/passport/bind';
if (redirectUrl.indexOf('?')) {
redirectUrl += '&bind_code' + crypto.dynamicEncryption(user.open_uid);
}
redirectUrl = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
redirectUrl += redirectUrl.indexOf('?') > 0 ? '&' : '?';
redirectUrl += 'bind_code=' + encodeURIComponent(aes.dynamicEncryption(`taobao::${user.open_uid}`));
} else if (+_.get(result, 'data.uid') > 0) {
return model.syncUserSession({
uid: result.data.uid,
... ... @@ -146,7 +161,7 @@ const login = {
req,
res
}).finally(() => {
let refer = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : '';
let refer = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
return res.redirect(refer);
});
... ... @@ -157,8 +172,74 @@ const login = {
})
})(req, res, next);
}
};
const bind = {
getBindThirdInfo(bindCode) {
let info = aes.dynamicDecrypt(bindCode);
let bindInfo = {
timestamp: info.timestamp
};
if (info.val) {
let splitArr = info.val.split('::');
bindInfo.type = splitArr[0];
bindInfo.openId = splitArr[1];
}
return bindInfo;
},
sendSms(req, res, next) {
let { mobile, bindCode } = req.body || {};
console.log(this)
let info = bind.getBindThirdInfo(bindCode);
if (info.type === 'taobao') {
req.ctx(passportModel).sendTaobaoBindCode(mobile).then(res.json).catch(next);
} else {
res.json({
code: 200,
message: `${info.type || ''} not found`
});
}
},
bindByCode(req, res, next) {
let { mobile, code, bindCode } = req.body || {};
let info = bind.getBindThirdInfo(bindCode);
if (info.type === 'taobao') {
const model = req.ctx(passportModel);
model.bindTaobaoAccountByCode({
mobile,
code,
openId: info.openId
}).then(result => {
if (_.get(result, 'data.is_bind') === 'Y') {
model.syncUserSession({
uid: result.data.uid,
sessionKey: result.data.session_key,
req,
res
}).finally(() => {
delete result.data;
res.json(result);
});
} else {
res.json(result);
}
}).catch(next);
} else {
res.json({
code: 400,
message: '登录失败请稍后重试'
});
}
}
}
module.exports = {
login
login,
bind
};
... ...