Authored by baoss

Merge branch 'develop' of git.yoho.cn:fe/xianyu-ufo-app-web into develop

... ... @@ -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,35 +45,26 @@
></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
class="radio"
:label="{text: '设为默认地址', value: 'Y'}"
:label="{text: '设为默认地址', value: true}"
style="flex: 0 1 100%;"
checked="model.tagType === 'Y'"
checked="model.defaultType"
v-model="model.defaultType"
></Radio>
<div v-if="isUpdate" class="del-address" @click="delAddress">删除地址</div>
... ... @@ -81,7 +72,14 @@
<div :class="submitClass" @touchend="onSubmit">确定</div>
</div>
<AddressAct v-show="isShowPop" @popHidden="popHidden" @modifyAddressAct="modifyAddressAct"></AddressAct>
<AddressAct
v-show="isShowPop"
:areaId="model.areaCode"
:areaTitle="model.receiverArea"
@popHidden="popHidden"
@modifyAddressAct="modifyAddressAct"
></AddressAct>
</LayoutApp>
</template>
... ... @@ -91,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(
... ... @@ -104,7 +103,8 @@ export default {
CInput: Input,
FormItem,
Radio,
AddressAct
AddressAct,
RadioGroup
},
data() {
return {
... ... @@ -118,7 +118,7 @@ export default {
receiverArea: "",
receiverAddress: "",
tagType: "",
defaultType: "N"
defaultType: false
}
};
},
... ... @@ -152,18 +152,13 @@ export default {
async onSubmit() {
let that = this;
let data = this.validator();
if (!data) {
return;
}
this.toast = this.$createToast({
type: "loading",
txt: "正在提交中",
mask: true
}).show();
let result = {};
if (this.isUpdate) {
... ... @@ -173,11 +168,13 @@ export default {
result = await this.addUserAddress(data);
}
await this.sleep(1000);
this.toast && this.toast.hide();
if (result && result.code === 200) {
this.$createToast({
type: "txt",
txt: result.message.split(".").join("")
}).show();
await this.sleep(1000);
this.$router.go(-1);
} else {
this.$createToast({
... ... @@ -187,13 +184,6 @@ export default {
}).show();
}
},
sleep(n) {
return new Promise(resolve => {
setTimeout(() => {
resolve();
}, n);
});
},
validator() {
let info = this.model;
let username = info.receiverName.replace(/(^\s+)|(\s+$)/g, "");
... ... @@ -209,9 +199,18 @@ export default {
return false;
}
let reg = this.isUpdate
? /^[0123456789*]{1,30}$/
: /^[0123456789]{1,30}$/;
if (!info.receiverMobile) {
this.showToast("手机号不能为空");
return false;
} else {
if (!reg.test(info.receiverMobile)) {
this.showToast("手机号码输入不正确");
return;
}
}
if (!info.areaCode || !info.receiverArea) {
... ... @@ -230,16 +229,27 @@ export default {
area_code: info.areaCode,
area: info.receiverArea,
address: info.receiverAddress,
is_default: info.defaultType,
is_default: info.defaultType ? "Y" : "N",
tag_code: info.tagType
};
},
showToast(tip) {
this.toast = this.$createToast({
type: "error",
txt: tip,
mask: true
}).show();
async delAddress() {
const result = await this.deleteUserAddress(this.model.addressId);
if (result && result.code === 200) {
this.$createToast({
type: "txt",
txt: result.message.split(".").join("")
}).show();
await this.sleep(1000);
this.$router.go(-1);
} else {
this.$createToast({
type: "error",
txt: result.message,
mask: true
}).show();
}
},
chooseArea() {
this.isShowPop = true;
... ... @@ -255,19 +265,21 @@ export default {
that.model.receiverArea = info.area;
}
},
async delAddress() {
const result = await this.deleteUserAddress(this.model.addressId);
if (result && result.code === 200) {
this.$router.go(-1);
} else {
this.$createToast({
type: "error",
txt: result.message,
mask: true
}).show();
}
showToast(tip) {
this.$createToast({
type: "txt",
txt: tip
}).show();
},
sleep(n) {
return new Promise(resolve => {
setTimeout(() => {
resolve();
}, n);
});
}
},
mounted() {
this.fetchAddressTags();
... ... @@ -284,7 +296,7 @@ export default {
that.model.receiverArea = item.area;
that.model.receiverAddress = item.address;
that.model.tagType = item.tag_code;
that.model.defaultType = item.is_default;
that.model.defaultType = item.is_default === "Y" ? true : false;
}
}
}
... ... @@ -305,6 +317,7 @@ export default {
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 80px;
.del-address {
width: 150px;
... ... @@ -353,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;
... ... @@ -364,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;
}
}
... ...
... ... @@ -79,6 +79,25 @@ const { mapState, mapMutations, mapActions } = createNamespacedHelpers(
"address/address"
);
export default {
props: {
areaTitle: {
type: String,
default() {
return "";
}
},
areaId: {
type: String,
default() {
return "";
}
}
},
watch: {
areaTitle: function(newVal, oldVal) {
newVal && this.handleAreaTitle();
}
},
data() {
return {
supportChangeProvince: true, // 是否支持修改省
... ... @@ -125,6 +144,63 @@ export default {
methods: {
...mapMutations({}),
...mapActions(["fetchAddressProvinces"]),
/* 处理父组件传递的区域 */
async handleAreaTitle() {
let areaId = this.areaId;
let areaCaption = this.areaTitle;
let returnTitle = this.returnTitle();
if (returnTitle.length > 0) {
return;
}
let arrList = areaCaption.trim().split(" ");
if (!areaId) {
areaId = 0;
}
this.province.id = areaId.substring(0, 2);
this.province.allTitle = arrList[0];
this.province.title = this.titleHandle(arrList[0]);
const provinceResult = await this.fetchAddressProvinces(0);
this.provinces = provinceResult.data;
this.city.id = areaId.substring(0, 4);
this.city.allTitle = arrList[1];
this.city.title = this.titleHandle(arrList[1]);
const cityResult = await this.fetchAddressProvinces(
areaId.substring(0, 2)
);
this.citys = cityResult.data;
this.area.id = areaId.substring(0, 6);
this.area.allTitle = arrList[2];
this.area.title = this.titleHandle(arrList[2]);
const areaResult = await this.fetchAddressProvinces(
areaId.substring(0, 4)
);
this.areas = areaResult.data;
this.street.id = areaId;
this.street.allTitle = arrList[3];
this.street.title = this.titleHandle(arrList[3]);
this.street.showList = this.street.titleActive = true;
this.province.showList = this.city.showList = this.area.showList = false;
this.province.titleActive = this.city.titleActive = this.area.titleActive = false;
this.common.titleActive = false;
this.area.titleActive = true;
//根据前6位请求显示列表
const result = await this.fetchAddressProvinces(areaId.substring(0, 6));
this.streets = result.data;
},
/* 返回标题处理 */
returnTitle() {
let getTitle = "";
... ... @@ -141,8 +217,8 @@ export default {
this.city.allTitle + this.area.allTitle + this.street.allTitle;
}
if (getTitle.length > 11) {
returnTitle = getTitle.substr(0, 5) + "..." + getTitle.substr(-5);
if (getTitle.length > 18) {
returnTitle = getTitle.substr(0, 8) + "..." + getTitle.substr(-8);
} else {
returnTitle = getTitle;
}
... ... @@ -152,7 +228,7 @@ export default {
/* 标题长度处理 */
titleHandle(caption) {
if (caption.length > 3) {
if (caption && caption.length > 3) {
return caption.substring(0, 3) + "...";
} else {
return caption;
... ... @@ -218,7 +294,7 @@ export default {
let resultData = result.data;
//length小于1时弹窗消失并传数据给上层
if (resultData.length < 1) {
if (resultData && resultData.length < 1) {
let returnTitle = this.returnTitle();
this.$emit("popHidden");
... ... @@ -248,7 +324,7 @@ export default {
/* 关闭地址选择组件 */
closeAddBox() {
this.$emit("hidden");
this.$emit("popHidden");
},
/* 点击地址标题时的处理 */
... ...
... ... @@ -24,7 +24,6 @@
</slot>
</div>
</div>
<div class="add-btn" :data-add="1" @click="toEditorPage">添加地址</div>
</CubeScroll>
</template>
... ... @@ -66,6 +65,18 @@ export default {
let isAdd = !!parseInt(event.currentTarget.dataset.add);
let item = event.currentTarget.dataset.item || {};
if (isAdd) {
if (this.list.length >= 5) {
this.toast = this.$createToast({
type: "error",
txt: "地址不能超过5个",
mask: true
}).show();
return;
}
}
this.$router.push({
name: "addressEdit",
params: {
... ...
<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
}
}
... ...
... ... @@ -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+H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wejSlE/R1HyM6GVkJxBgR92ycOWnmqGK+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+boBYHhSnQ5HEfxpbk6nmdd5fpcl4sWyHO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J1ktWNyfbbTXuTkWVVN5Z73H1b7A3eil8ax+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" />
... ...
... ... @@ -10,7 +10,7 @@ export default {
commit
}) {
const result = await this.$api.get('/api/address/gethidden', {
uid: '500031912',
uid: '500031912'
});
if (result.code === 200) {
... ... @@ -25,7 +25,7 @@ export default {
commit
}) {
const result = await this.$api.get('/api/address/getTags', {
uid: '500031912',
uid: '500031912'
});
if (result.code === 200) {
... ... @@ -53,34 +53,20 @@ export default {
return result;
},
// 设置默认地址, post请求
async setDefaultAddress({
commit
}) {
const result = await this.$api.post('/api/address/setDefaultAddress');
if (result.code === 200) {
commit(Types.SET_DEFAULT_ADDRESS);
}
return result || {};
},
// 添加、更新、删除地址,post请求
async addUserAddress({
commit
}, data) {
const result = await this.$api.post(
'/api/address/addAddress', {
uid: '500031912',
address: data.address,
area_code: data.area_code,
consignee: data.consignee,
mobile: data.mobile,
tag_code: data.tag_code,
is_default: data.is_default,
debug: 'XYZ'
});
const result = await this.$api.post('/api/address/addAddress', {
uid: '500031912',
address: data.address,
area_code: data.area_code,
consignee: data.consignee,
mobile: data.mobile,
tag_code: data.tag_code,
is_default: data.is_default,
debug: 'XYZ'
});
return result || {};
},
... ... @@ -114,4 +100,17 @@ export default {
return result || {};
},
// 设置默认地址, post请求 ---- 暂时用不到这个
async setDefaultAddress({
commit
}) {
const result = await this.$api.post('/api/address/setDefaultAddress');
if (result.code === 200) {
commit(Types.SET_DEFAULT_ADDRESS);
}
return result || {};
},
};
... ...
... ... @@ -7,11 +7,7 @@ export default function () {
state: {
addressList: [],
addressTags: [],
provincesList: [],
addStatus: -1,
updateStatus: -1,
delStatus: -1,
setDefaultStatus: -1
provincesList: []
},
actions,
mutations,
... ...
... ... @@ -15,10 +15,5 @@ export default {
list
}) {
state.provincesList = list;
},
[Types.ADD_USER_ADDRESS_INFO](state, {
status,
}) {
state.addStatus = status;
},
}
};
... ...
export const FETCH_USER_ADDRESS_LIST = 'FETCH_USER_ADDRESS_LIST';
export const FETCH_ADDRESS_TAGS = 'FETCH_ADDRESS_TAGS';
export const ADD_USER_ADDRESS_INFO = 'ADD_USER_ADDRESS_INFO';
export const UPDATE_USER_ADDRESS_INFO = 'UPDATE_USER_ADDRESS_INFO';
export const DELETE_USER_ADDRESS_INFO = 'DELETE_USER_ADDRESS_INFO';
export const FETCH_ADDRESS_PROVINCES = 'FETCH_ADDRESS_PROVINCES';
export const ADD_USER_ADDRESSINFO_SUCCESS = 'ADD_USER_ADDRESSINFO_SUCCESS';
export const UPDATE_USER_ADDRESSINFO_SUCCESS = 'UPDATE_USER_ADDRESSINFO_SUCCESS';
export const DELETE_USER_ADDRESSINFO_SUCCESS = 'DELETE_USER_ADDRESSINFO_SUCCESS';
export const SET_DEFAULT_ADDRESS = 'SET_DEFAULT_ADDRESS';
... ...
... ... @@ -14,7 +14,7 @@ export default function() {
page_total: 0, // 总共多少页
total: 0, // 总共多少条
scrollnavList: [], // 导航菜单
// scrollnavidList: [], // 导航菜单id
// scrollnavidList: [], // 导航菜单
},
},
mutations: {
... ...
... ... @@ -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
};
... ...