Authored by yyq

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

... ... @@ -22,7 +22,7 @@
<div class="cube-dialog-content">
<slot name="content">
<div class="cube-dialog-content-def">
<div class="cube-dialog-content-def yoho-dialog-content-def">
<p v-html="content" v-if="content"></p>
</div>
</slot>
... ... @@ -155,7 +155,7 @@ export default {
maskClick(e) {
this.maskClosable && this.cancel(e);
},
confirm() {
confirm(e) {
if (this._confirmBtn.disabled) {
return;
}
... ... @@ -177,6 +177,12 @@ export default {
};
</script>
<style lang="scss">
.yoho-dialog-content-def {
color: #000;
}
</style>
<style lang="scss" scoped>
.confirm-dialog-btns-wrapper {
display: flex;
... ...
... ... @@ -139,4 +139,9 @@ export const orderActionsMap = {
name: 'DELIVER_GOODS',
text: '我要发货',
},
MODIFY_ADDRESS: {
code: 'modify_address',
name: 'MODIFY_ADDRESS',
text: '修改地址',
},
};
... ...
... ... @@ -14,7 +14,7 @@
<script>
import { createNamespacedHelpers } from "vuex";
import { ownType } from "../../../../../constants/order-constants";
import { ownType } from "constants/order-constants";
const { mapGetters, mapActions } = createNamespacedHelpers("home/mine");
... ... @@ -64,7 +64,7 @@ export default {
height: 80px;
top: 10px;
right: 0;
background: linear-gradient(#fff, #E0E0E0, #fff);
background: linear-gradient(#fff, #e0e0e0, #fff);
}
}
}
... ...
<template>
<div class="confirm-info-wrapper">
<p class="confrim-info" v-if="info.confirmDesc">{{ info.confirmDesc }}</p>
<div v-if="info.needPenalty || info.showPrice" class="price-info">
<p class="price-item">
<span>{{ info.orderPriceDesc }}</span>
<span>{{ info.orderPrice }}</span>
</p>
<p class="price-item">
<span>{{ info.penaltyDesc }}&nbsp;&nbsp;({{ info.penaltyRate }})</span>
<span class="penalty">{{ info.penaltyAmount }}</span>
</p>
<p class="price-item">
<span>{{ info.refundDesc }}</span>
<span>{{ info.refundAmount }}</span>
</p>
</div>
</div>
</template>
<script>
export default {
props: {
info: {
type: Object,
default: {}
}
}
};
</script>
<style lang="scss" scoped>
.confirm-info-wrapper {
display: flex;
padding: 0 40px;
color: #000;
font-size: 24px;
.confrim-info {
text-align: center;
flex: 1;
}
.price-info {
flex: 1;
.price-item {
display: flex;
justify-content: space-between;
.penalty {
color: #d0021b;
}
}
}
}
</style>
... ...
... ... @@ -11,10 +11,7 @@
</template>
<script>
import {
orderActionsMap,
ownType
} from "../../../../constants/order-constants";
import { orderActionsMap, ownType } from "constants/order-constants";
import { createNamespacedHelpers } from "vuex";
const { mapActions } = createNamespacedHelpers("order/orderList");
... ... @@ -40,14 +37,9 @@ export default {
]),
onActionHandler(action) {
const { owner = ownType.SELL } = this.$route.params;
const {
orderCode,
earnestMoney = 0,
realPrice = "",
priceInfo = {}
} = this.order;
const { orderCode, priceInfo = {}, goodsInfo = {} } = this.order;
const { productId, storageId, skup } = this.order.goodsInfo;
const { productId, storageId, skup } = goodsInfo;
switch (action.name) {
// 再次购买
... ... @@ -107,48 +99,6 @@ export default {
params: { skup, code: orderCode }
});
break;
// 确认收货
case orderActionsMap.CONFIRM_DELIVERY.name:
this.$createDialog({
type: "confirm",
onConfirm: async () => {
const isOk = await this.confirmReceipt({
orderCode,
owner
});
// const txt = isOk ? "收货成功" : "收货失败";
// this.$createToast({ txt, type: "txt" }).show();
}
});
break;
case orderActionsMap.PAY_EARNESTMONEY.name:
this.$createOrderPayType({
orderCode,
price: earnestMoney,
desc: "保证金",
extra: JSON.stringify({
forward: {
name: "InSaleOrderList"
}
})
}).show();
break;
// 订单列表和订单详情字段不一致
case orderActionsMap.NOW_BUY.name:
this.$createOrderPayType({
orderCode,
price: parseFloat(realPrice || priceInfo.realPayPrice || ""),
desc: "",
forward: {
name: "OrderList",
params: {
owner: "buy"
}
}
}).show();
break;
default:
this.$emit("on-action", action);
... ...
... ... @@ -75,7 +75,9 @@
<order-actions
class="detail-actions"
:order="orderDetail"
@on-action="action => onAction({ action, order: orderDetail })"
@on-action="
action => onBuyerOrderAction({ action, order: orderDetail })
"
/>
</div>
</div>
... ... @@ -93,19 +95,16 @@ import DetailFooter from "./components//detail-footer";
import OrderActions from "../components/order-actions";
import {
orderActionsMap,
ownType
} from "../../../../constants/order-constants";
import orderActionMixin from "./mixins/order-action";
const STORE_PATH = "order/orderDetail";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers(
"order/orderDetail"
STORE_PATH
);
const { mapActions: orderListMapActions } = createNamespacedHelpers(
"order/orderList"
);
export default {
mixins: [orderActionMixin],
components: {
AddressInfo,
OrderItemInfo,
... ... @@ -115,12 +114,8 @@ export default {
DetailFooter
},
asyncData({ store, router }) {
// store.dispatch("order/orderDetail/fetchOrderDetail", router.params);
return store.dispatch(`${STORE_PATH}/fetchOrderDetail`, router.params);
},
activated() {
this.fetchOrderDetail(this.$route.params);
},
mounted() {},
computed: {
...mapState(["orderDetail"]),
...mapGetters([
... ... @@ -131,70 +126,7 @@ export default {
])
},
methods: {
...mapActions(["fetchOrderDetail"]),
...orderListMapActions([
"deleteOrder",
"cancelTradeConfirmInfo",
"cancelTrade"
]),
async onAction({ action, order }) {
console.log("----------action---------", action);
const { owner = ownType.SELL } = this.$route.params;
const {
orderCode,
earnestMoney = 0,
realPrice = "",
priceInfo = {}
} = order;
const { productId, storageId, skup } = order.goodsInfo;
switch (action.name) {
// 删除订单
case orderActionsMap.DEL_ORDER.name:
this.$createConfirmDialog({
content: "确认删除订单?",
confirmBtn: { disabled: true, style: { color: "#D0021B" } },
cancelBtn: { active: true },
onConfirm: async () => {
const isOk = await this.deleteOrder({
orderCode,
owner
});
if (isOk) {
this.$router.back();
}
// const txt = isOk ? "删除成功" : "删除失败";
// this.$createToast({ txt, type: "txt" }).show();
}
}).show();
break;
case orderActionsMap.CANCEL_ORDER.name:
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner
});
this.$createConfirmDialog({
content: confirmInfo.confirmDesc,
confirmBtn: { text: "取消订单", style: { color: "#D0021B" } },
cancelBtn: { text: "保留订单", active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner
});
if (isOk) {
this.fetchOrderDetail(this.$route.params);
}
const txt = isOk ? "取消成功" : "取消失败";
this.$createToast({ txt, type: "txt" }).show();
}
}).show();
break;
default:
return;
}
}
...mapActions(["fetchOrderDetail"])
}
};
</script>
... ...
/* eslint-disable space-before-function-paren */
import { createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers('order/orderList');
import { orderActionsMap, ownType } from 'constants/order-constants';
import DialogConfirmInfo from '../../components/dialog-confirm-info';
export default {
data() {
return {
isMixin: true,
};
},
methods: {
...mapActions(['cancelTradeConfirmInfo', 'cancelTrade', 'deleteOrder']),
async onSellerOrderAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, earnestMoney } = order;
switch (action.name) {
case orderActionsMap.DEL_ORDER.name: {
this.deleteOrderConfirmDialog({ orderCode, owner });
break;
}
case orderActionsMap.NOT_SOLD.name: {
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner,
});
this.$createConfirmDialog(
{
confirmBtn: {
text: '不卖了',
style: { color: '#D0021B' },
},
cancelBtn: { text: '继续出售', active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner,
});
if (isOk) {
this.fetchOrderDetail(this.$route.params);
}
// const txt = isOk ? "取消成功" : "取消失败";
// this.$createToast({ txt, type: "txt" }).show();
},
},
createElement => {
return [
createElement(DialogConfirmInfo, {
props: { info: confirmInfo },
slot: 'content',
}),
];
},
).show();
break;
}
case orderActionsMap.PAY_EARNESTMONEY.name: {
this.$createOrderPayType({
orderCode,
price: earnestMoney,
desc: '保证金',
// 支付成功会跳route
extra: JSON.stringify({
back: {
name: 'sellOrderDetail',
params: { owner, orderCode },
},
}),
}).show();
break;
}
default:
return;
}
},
async onBuyerOrderAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, priceInfo = {} } = order;
switch (action.name) {
case orderActionsMap.DEL_ORDER.name: {
this.deleteOrderConfirmDialog({ orderCode, owner });
break;
}
case orderActionsMap.CANCEL_ORDER.name: {
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner,
});
this.$createConfirmDialog(
{
confirmBtn: { text: '取消订单', style: { color: '#D0021B' } },
cancelBtn: { text: '保留订单', active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner,
});
if (isOk) {
this.fetchOrderDetail(this.$route.params);
}
const txt = isOk ? '取消成功' : '取消失败';
this.$createToast({ txt, type: 'txt' }).show();
},
},
createElement => {
return [
createElement(DialogConfirmInfo, {
props: { info: confirmInfo },
slot: 'content',
}),
];
},
).show();
break;
}
case orderActionsMap.NOW_BUY.name: {
this.$createOrderPayType({
orderCode,
price: parseFloat(priceInfo.realPayPrice || ''),
desc: '',
extra: JSON.stringify({
back: {
name: 'buyOrderDetail',
params: {
owner,
orderCode,
},
},
}),
}).show();
break;
}
case orderActionsMap.CONFIRM_DELIVERY.name: {
this.$createConfirmDialog({
onConfirm: async () => {
const isOk = await this.confirmReceipt({
orderCode,
owner,
});
if (isOk) {
this.fetchOrderDetail(this.$route.params);
}
// const txt = isOk ? "收货成功" : "收货失败";
// this.$createToast({ txt, type: "txt" }).show();
},
});
break;
}
default:
return;
}
},
// 删除订单
deleteOrderConfirmDialog({ orderCode, owner }) {
this.$createConfirmDialog({
type: 'confirm',
content: '确认删除订单?',
confirmBtn: { style: { color: '#D0021B' } },
onConfirm: async () => {
const isOk = await this.deleteOrder({
orderCode,
owner,
});
if (isOk) {
this.$router.back();
}
// const txt = isOk ? "删除成功" : "删除失败";
// this.$createToast({ txt, type: "txt" }).show();
},
}).show();
},
},
};
... ...
... ... @@ -84,7 +84,9 @@
<order-actions
class="detail-actions"
:order="orderDetail"
@on-action="action => onAction({ action, order: orderDetail })"
@on-action="
action => onSellerOrderAction({ action, order: orderDetail })
"
/>
</div>
</div>
... ... @@ -102,19 +104,16 @@ import DetailFooter from "./components//detail-footer";
import OrderActions from "../components/order-actions";
import {
orderActionsMap,
ownType
} from "../../../../constants/order-constants";
import orderActionMixin from "./mixins/order-action";
const STORE_PATH = "order/orderDetail";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers(
"order/orderDetail"
STORE_PATH
);
const { mapActions: orderListMapActions } = createNamespacedHelpers(
"order/orderList"
);
export default {
mixins: [orderActionMixin],
components: {
AddressInfo,
OrderItemInfo,
... ... @@ -124,11 +123,7 @@ export default {
OrderActions
},
asyncData({ store, router }) {
// store.dispatch("order/orderDetail/fetchOrderDetail", router.params);
},
mounted() {},
activated() {
this.fetchOrderDetail(this.$route.params);
return store.dispatch(`${STORE_PATH}/fetchOrderDetail`, router.params);
},
computed: {
...mapState(["orderDetail"]),
... ... @@ -141,73 +136,7 @@ export default {
])
},
methods: {
...mapActions(["fetchOrderDetail"]),
...orderListMapActions([
"cancelTradeConfirmInfo",
"cancelTrade",
"deleteOrder"
]),
async onAction({ action, order }) {
console.log("----------action---------", action);
const { owner = ownType.SELL } = this.$route.params;
const {
orderCode,
earnestMoney = 0,
realPrice = "",
priceInfo = {}
} = order;
const { productId, storageId, skup } = order.goodsInfo;
switch (action.name) {
// 删除订单
case orderActionsMap.DEL_ORDER.name:
this.$createConfirmDialog({
type: "confirm",
content: "确认删除订单?",
confirmBtn: { style: { color: "#D0021B" } },
onConfirm: async () => {
const isOk = await this.deleteOrder({
orderCode,
owner
});
if (isOk) {
this.$router.back();
}
// const txt = isOk ? "删除成功" : "删除失败";
// this.$createToast({ txt, type: "txt" }).show();
}
}).show();
break;
case orderActionsMap.NOT_SOLD.name:
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner
});
this.$createConfirmDialog({
content: confirmInfo.confirmDesc,
confirmBtn: {
text: "不卖了",
style: { color: "#D0021B" }
},
cancelBtn: { text: "继续出售", active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner
});
if (isOk) {
this.fetchOrderDetail(this.$route.params);
}
// const txt = isOk ? "取消成功" : "取消失败";
// this.$createToast({ txt, type: "txt" }).show();
}
}).show();
break;
default:
return;
}
}
...mapActions(["fetchOrderDetail"])
}
};
</script>
... ...
... ... @@ -29,7 +29,7 @@
</template>
<script>
import { ownType } from "../../../../../constants/order-constants";
import { ownType } from "constants/order-constants";
import { routeNames as detailRouteNames } from "../../order-detail";
export default {
... ...
... ... @@ -26,7 +26,7 @@ import {
buyerOrderStatusList,
sellerOrderStatusList,
ownType
} from "../../../../../constants/order-constants";
} from "constants/order-constants";
import { createNamespacedHelpers } from "vuex";
... ...
... ... @@ -19,7 +19,7 @@
<order-actions
class="actions"
:order="order"
@on-action="action => onAction({ action, order })"
@on-action="action => onInsaleOrderAction({ action, order })"
/>
</div>
</li>
... ... @@ -41,30 +41,26 @@ import { createNamespacedHelpers } from "vuex";
import OrderListItem from "./components/order-item";
import OrderInfo from "./components/order-info.vue";
import OrderItemFooter from "./components/order-footer";
import { routeNames } from "../order-detail";
import EmptyList from "../../../components//ufo-no-item";
import EmptyList from "components//ufo-no-item";
import OrderActions from "../components/order-actions";
import CountDown from "../components/count-down";
import {
orderActionsMap,
ownType
} from "../../../../constants/order-constants";
import orderActionMixin from "./mixins/order-action";
const IN_SALE_STORE_PATH = "order/inSaleOrderList";
const {
mapActions,
mapState,
mapGetters,
mapMutations
} = createNamespacedHelpers("order/inSaleOrderList");
const { mapActions: orderListMapActions } = createNamespacedHelpers(
"order/orderList"
);
} = createNamespacedHelpers(IN_SALE_STORE_PATH);
export default {
// 订单操作
mixins: [orderActionMixin],
components: {
Scroll,
OrderListItem,
... ... @@ -89,69 +85,20 @@ export default {
// 获取订单数据
asyncData({ store, router }) {
// const { owner, status } = router.params;
// store.dispatch("order/orderList/fetchOrderList", { owner, status });
},
activated() {
this.resetData();
this.fetchData();
store.commit(`${IN_SALE_STORE_PATH}/resetData`);
return store.dispatch(
`${IN_SALE_STORE_PATH}/fetchEntryOrderList`,
router.params
);
},
methods: {
...mapActions(["fetchEntryOrderList", "fetchNotEntryOrderList"]),
...orderListMapActions(["cancelTradeConfirmInfo", "cancelTrade"]),
...mapMutations(["filterOrderList", "resetData"]),
fetchData() {
if (this.isFetchEntryOrder) {
this.fetchEntryOrderList();
} else {
this.fetchNotEntryOrderList();
}
},
async onAction({ action, order }) {
console.log("----------action---------", action);
const { owner = ownType.SELL } = this.$route.params;
const {
orderCode,
earnestMoney = 0,
realPrice = "",
priceInfo = {}
} = order;
const { productId, storageId, skup } = order.goodsInfo;
switch (action.name) {
case orderActionsMap.NOT_SOLD.name:
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner
});
this.$createConfirmDialog({
content: confirmInfo.confirmDesc,
confirmBtn: { text: "不卖了", style: { color: "#D0021B" } },
cancelBtn: { text: "继续出售", active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner
});
if (isOk) {
this.filterOrderList(orderCode);
}
// const txt = isOk ? "取消成功" : "取消失败";
// this.$createToast({ txt, type: "txt" }).show();
}
}).show();
break;
default:
return;
}
}
},
watch: {
isFetchEntryOrder(val) {
if (!val) {
this.fetchData();
}
}
}
};
... ...
/* eslint-disable space-before-function-paren */
import { orderActionsMap, ownType } from 'constants/order-constants';
import { createNamespacedHelpers } from 'vuex';
import DialogConfirmInfo from '../../components/dialog-confirm-info';
const { mapActions, mapMutations } = createNamespacedHelpers('order/orderList');
const { mapMutations: inSaleMapMutations } = createNamespacedHelpers(
'order/inSaleOrderList',
);
export default {
methods: {
...mapActions(['cancelTradeConfirmInfo', 'cancelTrade', 'deleteOrder']),
...mapMutations(['filterOrderList', 'resetData']),
...inSaleMapMutations(['filterInSaleOrderList']),
// 订单列表
async onAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, realPrice = '' } = order;
switch (action.name) {
case orderActionsMap.DEL_ORDER.name:
this.$createConfirmDialog({
content: '确认删除订单?',
confirmBtn: { style: { color: '#D0021B' } },
cancelBtn: { active: true },
onConfirm: async () => {
const isOk = await this.deleteOrder({
orderCode,
owner,
});
if (isOk) {
this.filterOrderList(orderCode);
}
const txt = isOk ? '删除成功' : '删除失败';
this.$createToast({ txt, type: 'txt' }).show();
},
}).show();
break;
case orderActionsMap.CANCEL_ORDER.name: {
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner,
});
this.$createConfirmDialog(
{
confirmBtn: { text: '取消订单', style: { color: '#D0021B' } },
cancelBtn: { text: '保留订单', active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner,
});
if (isOk) {
this.resetData();
this.fetchData(this.$route.params);
}
const txt = isOk ? '取消成功' : '取消失败';
this.$createToast({ txt, type: 'txt' }).show();
},
},
createElement => {
return [
createElement(DialogConfirmInfo, {
props: { info: confirmInfo },
slot: 'content',
}),
];
},
).show();
break;
}
case orderActionsMap.NOW_BUY.name: {
this.$createOrderPayType({
orderCode,
price: parseFloat(realPrice),
desc: '',
extra: JSON.stringify({
forward: {
name: 'OrderList',
params: {
owner: 'buy',
},
},
}),
}).show();
break;
}
case orderActionsMap.CONFIRM_DELIVERY.name: {
this.$createConfirmDialog({
onConfirm: async () => {
const isOk = await this.confirmReceipt({
orderCode,
owner,
});
if (isOk) {
this.resetData();
this.fetchData(this.$route.params);
}
// const txt = isOk ? "收货成功" : "收货失败";
// this.$createToast({ txt, type: "txt" }).show();
},
});
break;
}
default:
return;
}
},
// 出售中订单列表
async onInsaleOrderAction({ action, order }) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, earnestMoney = 0 } = order;
switch (action.name) {
case orderActionsMap.NOT_SOLD.name: {
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner,
});
this.$createConfirmDialog(
{
confirmBtn: { text: '不卖了', style: { color: '#D0021B' } },
cancelBtn: { text: '继续出售', active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner,
});
if (isOk) {
this.filterInSaleOrderList(orderCode);
}
// const txt = isOk ? "取消成功" : "取消失败";
// this.$createToast({ txt, type: "txt" }).show();
},
},
createElement => {
return [
createElement(DialogConfirmInfo, {
props: { info: confirmInfo },
slot: 'content',
}),
];
},
).show();
break;
}
case orderActionsMap.PAY_EARNESTMONEY.name: {
this.$createOrderPayType({
orderCode,
price: earnestMoney,
desc: '保证金',
// 支付成功会跳route
extra: JSON.stringify({
forward: {
name: 'InSaleOrderList',
},
}),
}).show();
break;
}
default:
return;
}
},
},
};
... ...
... ... @@ -3,7 +3,7 @@
<status-nav />
<div class="content-wrapper">
<scroll
@pulling-up="fetchMore"
@pulling-up="fetchData"
:options="options"
:data="orderList"
class="order-list-scroll-wrap"
... ... @@ -41,26 +41,25 @@
import { Scroll } from "cube-ui";
import { createNamespacedHelpers } from "vuex";
import {
orderActionsMap,
ownType
} from "../../../../constants/order-constants";
import OrderListItem from "./components/order-item";
import StatusNav from "./components/status-nav";
import OrderInfo from "./components/order-info.vue";
import OrderItemFooter from "./components/order-footer";
import EmptyList from "../../../components//ufo-no-item";
import EmptyList from "components//ufo-no-item";
import OrderActions from "../components/order-actions";
import CountDown from "../components/count-down";
const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
"order/orderList"
);
import orderActionMixin from "./mixins/order-action";
const STORE_PATH = "order/orderList";
const { mapActions, mapState } = createNamespacedHelpers(STORE_PATH);
export default {
// 订单操作
mixins: [orderActionMixin],
components: {
Scroll,
OrderListItem,
... ... @@ -81,97 +80,18 @@ export default {
},
// 获取订单数据
asyncData() {
// const { owner, status } = router.params;
// store.dispatch("order/orderList/fetchOrderList", { owner, status });
},
activated() {
this.resetData();
this.fetchData();
asyncData({ store, router }) {
store.commit(`${STORE_PATH}/resetData`);
return store.dispatch(`${STORE_PATH}/fetchOrderList`, router.params);
},
methods: {
...mapActions([
"fetchOrderList",
"cancelTradeConfirmInfo",
"cancelTrade",
"deleteOrder"
]),
...mapMutations(["setOrderStatus", "filterOrderList", "resetData"]),
fetchMore() {
this.fetchOrderList(this.$route.params);
},
...mapActions(["fetchOrderList"]),
fetchData() {
const { params } = this.$route;
const { status } = params;
if (status) {
this.setOrderStatus(status);
}
this.fetchOrderList(params);
},
async onAction({ action, order }) {
console.log("----------action---------", action);
const { owner = ownType.SELL } = this.$route.params;
const {
orderCode,
earnestMoney = 0,
realPrice = "",
priceInfo = {}
} = order;
const { productId, storageId, skup } = order.goodsInfo;
switch (action.name) {
// 删除订单
case orderActionsMap.DEL_ORDER.name:
this.$createConfirmDialog({
content: "确认删除订单?",
confirmBtn: { disabled: true, style: { color: "#D0021B" } },
cancelBtn: { active: true },
onConfirm: async () => {
const isOk = await this.deleteOrder({
orderCode,
owner
});
if (isOk) {
this.filterOrderList(orderCode);
}
const txt = isOk ? "删除成功" : "删除失败";
this.$createToast({ txt, type: "txt" }).show();
}
}).show();
break;
case orderActionsMap.CANCEL_ORDER.name:
const confirmInfo = await this.cancelTradeConfirmInfo({
orderCode,
owner
});
this.$createConfirmDialog({
content: confirmInfo.confirmDesc,
confirmBtn: { text: "取消订单", style: { color: "#D0021B" } },
cancelBtn: { text: "保留订单", active: true },
onConfirm: async () => {
const isOk = await this.cancelTrade({
orderCode,
owner
});
if (isOk) {
this.resetData();
this.fetchData(this.$route.params);
}
const txt = isOk ? "取消成功" : "取消失败";
this.$createToast({ txt, type: "txt" }).show();
}
}).show();
break;
}
this.fetchOrderList(this.$route.params);
}
},
watch: {
// routerHistory(v) {
// console.log("---------routerHistory---------", v);
// }
}
watch: {}
};
</script>
<style lang="scss" scoped>
... ...
... ... @@ -47,10 +47,12 @@
<script>
import { createNamespacedHelpers } from "vuex";
import TimeLine from "./components/time-line";
import { expressTypeEnum } from "../../../constants/logistics-constants";
import { expressTypeEnum } from "constants/logistics-constants";
const STORE_PATH = "order/logisticsInfo";
const { mapActions, mapState, mapGetters } = createNamespacedHelpers(
"order/logisticsInfo"
STORE_PATH
);
export default {
... ... @@ -90,8 +92,9 @@ export default {
].filter(item => !!item.title);
}
},
mounted() {
this.fetchLogisticInfo(this.$route.params);
asyncData({ store, router }) {
return store.dispatch(`${STORE_PATH}/fetchLogisticInfo`, router.params);
},
methods: {
...mapActions(["fetchLogisticInfo"])
... ...
... ... @@ -75,11 +75,10 @@ export default {
},
asyncData({store, router}) {
// 测试用orderId 10000064 10001026 10001266 10000072
return store.dispatch('order/priceChange/fetchProduct', {productId: router.params.orderId});
return store.dispatch('order/priceChange/fetchProduct', {productId: router.params.orderId, refresh: true});
},
mounted() {
this.modalLoad = true;
console.log(this.$route.params);
},
computed: {
...mapState(['productInfo', 'skcs']),
... ...
... ... @@ -2,7 +2,7 @@ import { parseAssetList, formatNumber } from '../../utils/mine-handler';
import { get, set } from 'lodash';
import { getImgUrl } from '../../common/utils';
import moment from 'moment';
import { sellerOrderStatus, ownType } from '../../../constants/order-constants';
import { sellerOrderStatus, ownType } from 'constants/order-constants';
// const uid = '600046428';
// const uid = '500031424';
... ... @@ -46,7 +46,7 @@ export default function() {
endTime: 0,
},
userWalletInfo: {
totalAmount: 0.00,
totalAmount: 0.0,
withdrawLimit: 0,
withdrawAmount: 0,
shareSettlementAmount: 0,
... ... @@ -128,22 +128,25 @@ export default function() {
name: 'coupon',
title: '我的优惠券',
num: state.couponNum,
page: 'Coupon'
page: 'Coupon',
},
service: {
name: 'service',
title: '我的客服',
page: 'service'
page: 'service',
},
resource2: { name: 'resource2', data: state.resource2 },
};
return tabList;
},
getYearMonth(state) {
let beginTime = moment(new Date(state.filterData.beginTime * 1000)).format('YYYY-MM');
let endTime = moment(new Date(state.filterData.endTime * 1000)).format('YYYY-MM');
let beginTime = moment(
new Date(state.filterData.beginTime * 1000),
).format('YYYY-MM');
let endTime = moment(new Date(state.filterData.endTime * 1000)).format(
'YYYY-MM',
);
let a = moment(endTime.split('-'));
let b = moment(beginTime.split('-'));
... ... @@ -225,7 +228,7 @@ export default function() {
}
});
},
addCouponSummary(state, {count}) {
addCouponSummary(state, { count }) {
state.couponNum = count;
},
addAssets(state, assetData) {
... ... @@ -236,7 +239,9 @@ export default function() {
},
addWallet(state, walletData) {
walletData.list.map(item => {
item.time = moment(new Date(item.createTime * 1000)).format('YYYY.MM.DD HH:mm');
item.time = moment(new Date(item.createTime * 1000)).format(
'YYYY.MM.DD HH:mm',
);
item.amount = Number(Math.abs(item.amount)).toFixed(2);
return item;
});
... ... @@ -326,9 +331,7 @@ export default function() {
}
},
async fetchSellerOrder({ commit }) {
const result = await this.$api.get(
'/api/ufo/mine/seller/orderSummary',
);
const result = await this.$api.get('/api/ufo/mine/seller/orderSummary');
if (result.code === 200) {
commit('addSellerOrder', { orderSumList: result.data });
... ... @@ -350,11 +353,11 @@ export default function() {
commit('addOrderSummary', { data: result.data });
}
},
async fetchCoupon({commit}) {
async fetchCoupon({ commit }) {
const result = await this.$api.get('/api/ufo/mine/coupon');
if (result.code === 200) {
commit('addCouponSummary', { count: result.data});
commit('addCouponSummary', { count: result.data });
}
},
async fetchAssets({ commit, state }, isRefresh) {
... ... @@ -395,7 +398,9 @@ export default function() {
{ isRefresh, tradeType = 0, startTime = 0, endTime = 0 },
) {
commit('changeWalletType', tradeType);
(startTime && endTime) && commit('changeWalletTime', { startTime, endTime });
startTime &&
endTime &&
commit('changeWalletTime', { startTime, endTime });
let {
isFetching,
endReached,
... ... @@ -428,7 +433,8 @@ export default function() {
let newList = [...oldList, ...data.list];
walletData.currentPage = data.page;
walletData.endReached = data.list.length === 0 || data.page === data.totalPage;
walletData.endReached =
data.list.length === 0 || data.page === data.totalPage;
walletData.list = newList;
commit('addWallet', walletData);
}
... ...
... ... @@ -48,7 +48,7 @@ export default function() {
state.notEntryOrder.pullUpload = false;
}
},
filterOrderList(state, orderCode) {
filterInSaleOrderList(state, orderCode) {
state.entryOrder.list = state.entryOrder.list.filter(
order => order.orderCode !== orderCode,
);
... ... @@ -82,7 +82,7 @@ export default function() {
},
},
actions: {
async fetchEntryOrderList({ commit, state: { entryOrder } }) {
async fetchEntryOrderList({ dispatch, commit, state: { entryOrder } }) {
const { page } = entryOrder;
const res = await this.$api.get('/api/ufo/seller/entryPrdList', {
page,
... ... @@ -92,7 +92,14 @@ export default function() {
});
if (res.code === 200) {
commit('setEntryOrder', res.data);
const { data } = res;
commit('setEntryOrder', data);
const { pagetotal } = data;
if (pagetotal === 0 || page > pagetotal) {
return dispatch('fetchNotEntryOrderList');
}
}
},
async fetchNotEntryOrderList({ commit, state: { notEntryOrder } }) {
... ...
... ... @@ -80,6 +80,7 @@ export default function() {
if (res.code === 200) {
commit('setOrderList', res.data);
commit('setOrderStatus', status);
}
},
... ...
{
"name": "xianyu-ufo-app-web",
"version": "0.0.2-beta-3",
"version": "0.0.2-beta-6",
"private": true,
"description": "Xianyu Project With Express",
"repository": {
... ... @@ -42,7 +42,7 @@
"connect-redis": "^3.4.0",
"cookie-parser": "^1.4.3",
"crypto-js": "^3.1.9-1",
"cube-ui": "^1.12.6",
"cube-ui": "^1.12.31",
"express": "^4.16.4",
"express-session": "^1.15.6",
"fastclick": "^1.0.6",
... ...
... ... @@ -35,7 +35,7 @@ declare module 'yoho' {
}
interface ICancelTradeConfirmInfo {
confirmDesc: string;
confirmDesc?: string;
needPenalty: boolean;
orderPrice: string;
orderPriceDesc: string;
... ...
... ... @@ -1844,10 +1844,10 @@ bcrypt-pbkdf@^1.0.0:
dependencies:
tweetnacl "^0.14.3"
better-scroll@^1.12.6:
version "1.13.2"
resolved "http://npm.yohops.com/better-scroll/-/better-scroll-1.13.2.tgz#31e6e088cf2d23ce48e52fad6cc59134ffeb2f56"
integrity sha1-MebgiM8tI85I5S+tbMWRNP/rL1Y=
better-scroll@~1.12.6:
version "1.12.6"
resolved "http://npm.yohops.com/better-scroll/-/better-scroll-1.12.6.tgz#7548860f8b8c08c87e5af062e1da6e2c68c98337"
integrity sha1-dUiGD4uMCMh+WvBi4dpuLGjJgzc=
dependencies:
babel-runtime "^6.0.0"
... ... @@ -3024,12 +3024,12 @@ cssstyle@^1.0.0:
dependencies:
cssom "0.3.x"
cube-ui@^1.12.6:
version "1.12.6"
resolved "http://npm.yohops.com/cube-ui/-/cube-ui-1.12.6.tgz#3beb6b2b628c4f3c1eb5d5ad69b85c61e0ef95c4"
integrity sha1-O+trK2KMTzwetdWtabhcYeDvlcQ=
cube-ui@^1.12.31:
version "1.12.31"
resolved "http://npm.yohops.com/cube-ui/-/cube-ui-1.12.31.tgz#f3a6801e0be5c56b4928d01f3c7acfd6253459d3"
integrity sha1-86aAHgvlxWtJKNAfPHrP1iU0WdM=
dependencies:
better-scroll "^1.12.6"
better-scroll "~1.12.6"
vue-create-api "^0.2.0"
currently-unhandled@^0.4.1:
... ... @@ -10700,9 +10700,9 @@ vue-awesome-swiper@^3.1.3:
swiper "^4.0.7"
vue-create-api@^0.2.0:
version "0.2.0"
resolved "http://npm.yohops.com/vue-create-api/-/vue-create-api-0.2.0.tgz#abeb70ff1af2fa3881f024754d49034a7951c6ef"
integrity sha1-q+tw/xry+jiB8CR1TUkDSnlRxu8=
version "0.2.2"
resolved "http://npm.yohops.com/vue-create-api/-/vue-create-api-0.2.2.tgz#60acb39f7e70932a432509293a1aa087404ec39e"
integrity sha1-YKyzn35wkypDJQkpOhqgh0BOw54=
vue-eslint-parser@^4.0.2:
version "4.0.3"
... ...