Authored by TaoHuang

add some api

... ... @@ -35,11 +35,7 @@ export default {
},
methods: {
onBack() {
if (this.yoho.homePage) {
this.$yoho.finishPage({});
} else {
this.$router.go(-1);
}
this.$router.go(-1);
}
}
};
... ...
<template>
<div class="fee-detail">
<div class="item">
<div>平台用费:<i class="iconfont iconquestion icon-class"></i></div>
<div>平台用费:<i class="iconfont iconquestion icon-class" @click="onClick"></i></div>
<div>-¥10.00</div>
</div>
<div class="item">
... ... @@ -12,12 +12,26 @@
<div class="total-fee">实际收入:</div>
<div class="fee">¥0.00</div>
</div>
<cube-dialog ref="dialog" ></cube-dialog>
</div>
</template>
<script>
export default {
name: 'OrderFee'
name: 'OrderFee',
data() {
return {
confirmBtn: {
}
}
},
methods: {
onClick() {
this.$refs.dialog.show();
}
}
};
</script>
... ...
<template>
<div>
<div class="tip">需支付保证金:<span class="red">¥0</span><i class="iconfont iconquestion icon-class"></i></div>
<div class="tip">需支付保证金:<span class="red">¥0</span><i class="iconfont iconquestion icon-class" @click="onClick"></i></div>
<div class="tip2">所有商品必须为国内现货,且承诺36小时内发货,交易成功后将自动退还保证金</div>
</div>
</template>
<script>
export default {
name: 'OrderFee'
name: 'OrderFee',
methods: {
onClick() {
}
}
};
</script>
... ...
... ... @@ -2,11 +2,11 @@
<LayoutApp :show-back="true">
<div class="body">
<TitleComp txt="出售"></TitleComp>
<ProductInfo :data="orderDetail.goodsInfo" class="product-info"></ProductInfo>
<ProductInfo :data="{}" class="product-info"></ProductInfo>
<InputPrice class="input-price"></InputPrice>
<OrderMargin class="order-item order-margin"></OrderMargin>
<OrderFee class="order-item"></OrderFee>
<AddressInfo :data="orderDetail.userAddress" class="order-item"></AddressInfo>
<AddressInfo :data="address" class="order-item"></AddressInfo>
<OrderAgree v-model="agree" class="order-item"></OrderAgree>
</div>
<YohoButton :txt="txt" class="footer" @click="onClick"></YohoButton>
... ... @@ -26,6 +26,11 @@ import OrderAgree from './components/confirm/agree';
import { createNamespacedHelpers } from 'vuex';
const { mapState, mapActions } = createNamespacedHelpers('order/orderConfirm');
const UserType = {
sell: 'sell',
buy: 'buy'
}
export default {
name: 'OrderConfirm',
props: {
... ... @@ -50,14 +55,15 @@ export default {
};
},
mounted() {
this.fetchOrderDetail({orderCode: this.orderCode})
this.fetchOrderAddress({tabType: UserType.sell});
},
computed: {
...mapState(['orderDetail'])
...mapState(['orderDetail', 'address'])
},
methods: {
...mapActions(['fetchOrderDetail']),
...mapActions(['fetchOrderAddress']),
onClick() {
this.$createOrderPayType().show();
}
}
};
... ...
import { get, find } from 'lodash';
export const Types = {
FETCH_ORDER_DETAIL_REQUEST: 'FETCH_ORDER_DETAIL_REQUEST',
FETCH_ORDER_DETAIL_FAIL: 'FETCH_ORDER_DETAIL_FAIL',
FETCH_ORDER_DETAIL_SUCCESS: 'FETCH_ORDER_DETAIL_SUCCESS'
FETCH_ORDER_DETAIL_SUCCESS: 'FETCH_ORDER_DETAIL_SUCCESS',
FETCH_ORDER_ADDRESS: 'FETCH_ORDER_ADDRESS'
};
export default function() {
... ... @@ -9,7 +12,9 @@ export default function() {
namespaced: true,
state: {
orderDetail: {},
fetchOrderDetail: false
fetchOrderDetail: false,
detail: {},
address: {}
},
mutations: {
[Types.FETCH_ORDER_DETAIL_REQUEST](state) {
... ... @@ -21,6 +26,9 @@ export default function() {
},
[Types.FETCH_ORDER_DETAIL_FAIL](state) {
state.fetchOrderDetail = false;
},
[Types.FETCH_ORDER_ADDRESS](state, data) {
state.address = data;
}
},
actions: {
... ... @@ -38,7 +46,23 @@ export default function() {
}
commit(Types.FETCH_ORDER_DETAIL_SUCCESS, result.data);
},
async fetchOrderAddress({ commit }, payload) {
const orderCount = await this.$api.get('/api/order/confirm/count', payload);
if (get(orderCount, 'data.cnt', 0)) {
const addressInfo = await this.$api.get('/api/order/confirm/address');
const address = find(get(addressInfo, 'data', []), { is_default: 'Y' });
commit(Types.FETCH_ORDER_ADDRESS, address);
}
},
async fetchOrderPrice({ commit }, payload) {
}
},
getters: {},
};
... ...
/**
* param 仅为参数校验使用
*/
module.exports = {};
module.exports = {
// 订单数量
'/api/order/confirm/count': {
ufo: true,
auth: true,
api: 'ufo.order.getAllCnt',
},
// 地址列表
'/api/order/confirm/address': {
auth: true,
api: 'app.address.gethidden',
},
// 计算订单价格
'/api/order/confirm/compute': {
auth: true,
api: 'ufo.sellerOrder.computePublishPrd',
},
};
... ...