Authored by TaoHuang

add alipay api

... ... @@ -34,6 +34,11 @@ import YohoActionSheet from '../action-sheet';
import Check from './check2';
import YohoButton from '../button';
// 支付方式
const PAYMENTS = {
ALIPAY: 18,
};
export default {
name: 'OrderPayType',
props: {
... ... @@ -43,6 +48,10 @@ export default {
return {};
}
},
orderCode: {
type: [String, Number],
default: ''
},
price: {
type: [String, Number],
default: ''
... ... @@ -57,6 +66,9 @@ export default {
YohoActionSheet,
Check
},
data() {
return {};
},
methods: {
show() {
this.$refs.actionSheet.show();
... ... @@ -70,6 +82,13 @@ export default {
},
pay() {
this.$emit('payAction');
this.$router.push({
name: 'OrderPay',
query: {
order_code: this.orderCode,
payment: PAYMENTS.ALIPAY + '_platform'
}
});
}
}
};
... ...
... ... @@ -14,6 +14,15 @@ export default [
})
},
{
name: 'OrderPay',
path: '/xianyu/order/pay.html',
component: () => import(/* webpackChunkName: "order" */ './pay'),
props: (route) => ({
orderCode: route.query.order_code,
payment: route.query.payment
})
},
{
name: 'OrderBuyConfirm',
path: '/xianyu/order/buyerconfirm.html',
component: () => import(/* webpackChunkName: "order" */ './buyer-confirm'),
... ...
<template>
<div>
{{orderCode}}
{{payment}}
</div>
</template>
<script>
export default {
name: 'PayPage',
props: ['orderCode', 'payment']
};
</script>
<style lang="scss" scoped>
</style>
... ...
... ... @@ -2,7 +2,7 @@
<LayoutApp :show-back="true">
<div class="body">
<TitleComp txt="出售"></TitleComp>
<ProductInfo :data="{}" class="product-info"></ProductInfo>
<ProductInfo :data="productDetail" class="product-info"></ProductInfo>
<InputPrice @input="changePrice" :value="price" class="input-price" @on-blur="compute"></InputPrice>
<OrderMargin class="order-item order-margin" :data="fee"></OrderMargin>
<OrderFee class="order-item" :data="fee"></OrderFee>
... ... @@ -25,10 +25,11 @@ import OrderMargin from './components/confirm/order-margin';
import OrderFee from './components/confirm/order-fee';
import OrderAgree from './components/confirm/agree';
import { Types } from 'store/order/order-confirm';
import { get } from 'lodash';
import { createNamespacedHelpers } from 'vuex';
import { createNamespacedHelpers, mapState } from 'vuex';
const { mapState, mapActions, mapMutations } = createNamespacedHelpers('order/orderConfirm');
const { mapState: mapOrderState, mapActions: mapOrderAction, mapMutations: mapOrderMutations } = createNamespacedHelpers('order/orderConfirm');
const UserType = {
sell: 'sell',
... ... @@ -57,13 +58,29 @@ export default {
mounted() {
this.fetchUserStatus();
this.fetchOrderAddress({ tabType: UserType.sell });
this.$store.dispatch('product/getSelectedTradeProduct', {
productId: this.productId,
sizeId: this.sizeId,
tradeTypedId: this.tradeTypeId
});
},
computed: {
...mapState(['productDetail', 'address', 'fee', 'price', 'agree'])
...mapOrderState(['address', 'fee', 'price', 'agree']),
...mapState({
productDetail: state => {
return {
goodImg: get(state.product.selectedProductInfo, 'product.goods_list[0].image_list[0].image_url', ''),
colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''),
sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''),
goodPrice: get(state.product.selectedProductInfo, 'size.least_price', ''),
storageId: get(state.product.selectedProductInfo, 'size.storage_id', '')
};
}
})
},
methods: {
...mapActions(['fetchOrderAddress', 'fetchUserStatus', 'fetchOrderPrice', 'submitOrder', 'fetchPayList']),
...mapMutations([Types.CHANGE_PRICE, Types.CHANGE_AGREE]),
...mapOrderAction(['fetchOrderAddress', 'fetchUserStatus', 'fetchOrderPrice', 'submitOrder', 'fetchPayList']),
...mapOrderMutations([Types.CHANGE_PRICE, Types.CHANGE_AGREE]),
onClick() {
this.submit();
... ... @@ -73,7 +90,7 @@ export default {
address_id: this.address.address_id,
num: this.num,
price: this.price,
storage_id: 10000128,
storage_id: this.productDetail.storageId,
}).then(result => {
if (result.error) {
this.error = result.error;
... ... @@ -105,7 +122,7 @@ export default {
address_id: this.address.address_id,
num: 1,
price: this.price,
storage_id: 10000128,
storage_id: this.productDetail.storageId,
});
if (orderResult.code !== 200) {
... ... @@ -127,8 +144,16 @@ export default {
data: payListResult.data,
price: this.fee.earnestMoneyStr,
desc: '保证金',
orderCode,
onCloseAction() {
vm.onClose();
vm.$router.push({
name: 'orderDetail',
params: {
owner: UserType.sell,
code: orderCode
}
});
},
onPayAction() {
vm.onPay();
... ...
... ... @@ -12,8 +12,6 @@ export default function() {
return {
namespaced: true,
state: {
productDetail: {},
fetchProductDetail: false,
address: {},
fee: {
income: '',
... ...