Authored by y.huang

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

... ... @@ -56,6 +56,12 @@ export default {
desc: {
type: String,
default: ''
},
extra: {
type: Object,
default() {
return {};
}
}
},
components: {
... ... @@ -76,7 +82,7 @@ export default {
async mounted() {
},
methods: {
...mapOrderAction(['fetchPayList']),
...mapOrderAction(['payAction']),
show() {
this.$refs.actionSheet.show();
},
... ... @@ -90,11 +96,37 @@ export default {
pay() {
this.$emit('confirmAction');
const toast = this.$createToast({
txt: '正在调起支付宝'
}).show();
this.payAction({
orderCode: this.orderCode
}).then((result) => {
toast.hide();
this.onSuccess(result);
}).catch((result) => {
toast.hide();
this.onError(result);
});
},
onError(result) {
this.$emit('on-pay-error');
this.$createToast({
txt: result.message,
time: 1500,
type: 'txt'
}).show();
},
onSuccess(result) {
this.hide();
this.$emit('on-pay-success');
this.$router.push({
name: 'OrderPay',
query: {
order_code: this.orderCode,
payment: PAYMENTS.ALIPAY + '_platform'
orderCode: this.orderCode,
payParams: result.data.payParams
}
});
}
... ...
... ... @@ -52,8 +52,15 @@ 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`;
cookie.set('third_backurl', location.href, {
domain: '.yohobuy.com',
path: '/'
});
console.log(location.href)
setTimeout(() => {
location.href = loginUrl || `${location.origin}/xianyu/passport/login/taobao`;
}, 100);
return;
}
}
... ...
... ... @@ -107,7 +107,7 @@ export default {
}
},
activated() {
this.selectedAddressId = this.$route.query.addressId;
this.selectedAddressId = this.$route.query.address_id;
this.fetchUserAddressList();
},
beforeRouteEnter(to, from, next) {
... ...
... ... @@ -61,7 +61,15 @@ export default {
storageId: this.storageId
});
await this.fetchPayment({ skup: this.productDetail.skup });
const payInfo = await this.fetchPayment({ skup: this.productDetail.skup });
if (payInfo?.code !== 200) {
this.$createToast({
time: 2000,
txt: payInfo.message,
type: 'txt'
}).show();
}
if (this.address.address_id) {
await this.compute();
... ... @@ -154,37 +162,31 @@ export default {
await this.compute();
const { data: { orderCode, message } } = await this.buyPayAction({
const result = await this.buyPayAction({
skup: this.productDetail.skup,
addressId: this.address.address_id,
couponCode: get(this.orderDetail, 'recommendedCouponInfo.coupon_code', ''),
promotionId: get(this.orderDetail, 'promotionTips.promotionIds', '')
});
if (!orderCode) {
if (!result?.data?.orderCode) {
this.$createToast({
time: 1500,
txt: message,
txt: result?.message,
type: 'txt'
}).show();
return;
}
this.$createOrderPayType({
orderCode,
orderCode: result.data.orderCode,
price: this.orderDetail.amount,
desc: '金额',
onCloseAction() {
vm.onClose(orderCode);
vm.onClose(result.data.orderCode);
},
onPayAction() {
vm.onPay();
}
}).show();
},
onPay() {
console.log('ok');
},
onClose(orderCode) {
this.$router.push({
name: 'orderDetail',
... ... @@ -199,8 +201,6 @@ export default {
</script>
<style lang="scss" scoped>
@import '~statics/scss/variable.scss';
.footer {
position: absolute;
bottom: 0;
... ...
... ... @@ -36,7 +36,10 @@ export default {
methods: {
onClick() {
this.$router.push({
name: 'address'
name: 'address',
query: {
address_id: this.data.address_id
}
});
}
}
... ...
... ... @@ -87,6 +87,8 @@ export default {
this.canScan = true;
}
this.$yoho.auth();
this.fetchAppraiseAddressChangeNotice({orderCode: this.orderCode}).then(res => {
let isChanged = get(res, 'data.isChanged');
let isForceShow = get(res, 'data.isForceShow');
... ...
... ... @@ -17,8 +17,8 @@ export default [
path: '/xianyu/order/pay.html',
component: () => import(/* webpackChunkName: "order" */ './pay'),
props: route => ({
orderCode: route.query.order_code,
payment: route.query.payment,
orderCode: route.query.orderCode,
payParams: route.query.payParams,
}),
},
{
... ...
<template>
<div>
{{orderCode}}
{{payment}}
{{orderCode}} <====>
{{payParams}}
</div>
</template>
<script>
const ALIPAY_DOMAIN = 'https://mapi.alipay.com/gateway.do';
export default {
name: 'PayPage',
props: ['orderCode', 'payment'],
props: ['orderCode', 'payParams'],
mounted() {
},
methods: {
if (this.payParams) {
const url = ALIPAY_DOMAIN + '?' + encodeURIComponent(this.payParams);
}
console.log(url);
}
},
methods: {}
};
</script>
... ...
... ... @@ -128,33 +128,24 @@ export default {
return;
}
const { orderCode } = orderResult.data;
this.orderPay = this.$createOrderPayType({
price: this.fee.earnestMoneyStr,
desc: '保证金',
orderCode,
orderCode: orderResult.data.orderCode,
onCloseAction() {
vm.onClose();
vm.$router.push({
name: 'orderDetail',
params: {
owner: UserType.sell,
code: orderCode
}
});
},
onPayAction() {
vm.onPay();
vm.onClose(orderResult.data.orderCode);
}
}).show();
},
onClose() {
console.log('close');
onClose(orderCode) {
this.$router.push({
name: 'orderDetail',
params: {
owner: UserType.sell,
code: orderCode
}
});
},
onPay() {
console.log('pay');
}
}
};
</script>
... ...
... ... @@ -18,5 +18,8 @@ export default {
},
[Types.SET_USER_ADDRESS_INFO](state, addressInfo) {
state.addressInfo = addressInfo || {};
// 修改根状态
this.state.order.orderConfirm.address = addressInfo;
}
};
... ...
... ... @@ -117,9 +117,13 @@ export default function() {
}
},
actions: {
async fetchOrderAddress({ commit }, payload) {
async fetchOrderAddress({ commit, state }, payload) {
const orderCount = await this.$api.get('/api/order/confirm/count', payload);
if (state.address?.address_id) {
return;
}
if (get(orderCount, 'data.cnt', 0)) {
const addressInfo = await this.$api.get('/api/order/confirm/address');
... ... @@ -143,8 +147,8 @@ export default function() {
},
async fetchUserStatus() {
const alipayStatus = await this.$api.get('/api/order/alipay/status');
const userStatus = await this.$api.get('/api/order/user/status');
// const alipayStatus = await this.$api.get('/api/order/alipay/status');
// const userStatus = await this.$api.get('/api/order/user/status');
},
async submitOrder({ commit }, payload) {
... ... @@ -159,10 +163,12 @@ export default function() {
const orderInfo = await this.$api.post('/api/order/confirm/buypayment', { skup, api_version: 1 });
if (orderInfo.code !== 200) {
return;
return orderInfo;
}
commit(Types.FETCH_ORDER_BUY_ORDER, orderInfo.data);
return orderInfo;
},
async computeOrder({ commit }, { skup, couponCode, addressId, promotionId }) {
... ... @@ -193,6 +199,19 @@ export default function() {
});
return order;
},
async payAction(ctx, { orderCode }) {
const payResult = await this.$api.post('/api/order/pay', {
orderCode,
payment: 2
});
if (payResult.code !== 200) {
return Promise.reject(payResult);
}
return payResult;
}
},
getters: {},
... ...
module.exports = {
'/api/ufo/invite/friendList': {
ufo: true,
api: 'ufo.invite.code',
params: {},
},
'/api/ufo/invite/recordDetailList': {
ufo: true,
api: 'ufo.invite.getInviteSettlementItemList',
params: {},
},
'/api/yoho/resource': {
service: true,
api: 'operations/api/v5/resource/get',
params: {
content_code: { type: String },
},
},
'/api/union/inviteList': {
api: 'app.union.shareOrder.queryInviteYohoList',
params: {
page: { type: Number },
size: { type: Number },
},
},
'/api/union/queryUnion': {
api: 'app.union.shareOrder.queryUnionTypeByUid',
params: {},
},
// 获取调价商品及尺码信息
'/api/ufo/seller/entryGoodsSizeList': {
auth: true,
... ... @@ -322,6 +293,15 @@ module.exports = {
params: {},
},
// 支付下单
'/api/order/pay': {
ufo: true,
auth: true,
path: 'payment',
api: 'ufo.order.pay',
params: {}
},
// 订单物流信息
'/api/order/express': {
ufo: true,
... ...
const _ = require('lodash');
const url = require('url');
const uuid = require('uuid');
const passport = require('passport');
const TaobaoStrategy = require('./passport-taobao');
... ... @@ -150,7 +149,7 @@ const login = {
if (result.code === 200) {
if (_.get(result, 'data.is_bind') === 'N') {
redirectUrl = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
redirectUrl = req.cookies.third_backurl ? 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) {
... ... @@ -160,7 +159,7 @@ const login = {
req,
res
}).finally(() => {
let refer = req.cookies.third_backurl ? url.parse(req.cookies.third_backurl) : homePage;
let refer = req.cookies.third_backurl ? req.cookies.third_backurl : homePage;
return res.redirect(refer);
});
... ...