Showing
6 changed files
with
106 additions
and
34 deletions
1 | import createAPI from 'utils/create-api'; | 1 | import createAPI from 'utils/create-api'; |
2 | 2 | ||
3 | export default function addCouponList(Vue, CouponList) { | 3 | export default function addCouponList(Vue, CouponList) { |
4 | - createAPI(Vue, CouponList, ['closeAction', 'payAction'], true); | 4 | + createAPI(Vue, CouponList, ['closeAction', 'payAction', 'itemClickAction'], true); |
5 | } | 5 | } |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | </div> | 7 | </div> |
8 | <slot name="content"> | 8 | <slot name="content"> |
9 | <div class="pay-list-wrapper"> | 9 | <div class="pay-list-wrapper"> |
10 | - <div class="pay-list-item" v-for="item in data" :key="item.coupon_code"> | 10 | + <div class="pay-list-item" v-for="item in data" :key="item.coupon_code" @click="onItemClick(item)"> |
11 | <div class="pay-info"> | 11 | <div class="pay-info"> |
12 | <div class="price">{{item.coupon_value_str}}</div> | 12 | <div class="price">{{item.coupon_value_str}}</div> |
13 | <div class="price-desc">{{item.use_rule_str}}</div> | 13 | <div class="price-desc">{{item.use_rule_str}}</div> |
@@ -65,6 +65,9 @@ export default { | @@ -65,6 +65,9 @@ export default { | ||
65 | }, | 65 | }, |
66 | pay() { | 66 | pay() { |
67 | this.$emit('payAction'); | 67 | this.$emit('payAction'); |
68 | + }, | ||
69 | + onItemClick(item) { | ||
70 | + this.$emit('itemClickAction', item); | ||
68 | } | 71 | } |
69 | } | 72 | } |
70 | }; | 73 | }; |
@@ -5,10 +5,12 @@ | @@ -5,10 +5,12 @@ | ||
5 | <AddressInfo :data="address" class="order-item" :show-tip="false"></AddressInfo> | 5 | <AddressInfo :data="address" class="order-item" :show-tip="false"></AddressInfo> |
6 | <ProductInfo :data="orderDetail.good" class="product-info order-item"></ProductInfo> | 6 | <ProductInfo :data="orderDetail.good" class="product-info order-item"></ProductInfo> |
7 | <Coupon class="order-item" :data="orderDetail.recommendedCouponInfo" @click="onCouponClick"></Coupon> | 7 | <Coupon class="order-item" :data="orderDetail.recommendedCouponInfo" @click="onCouponClick"></Coupon> |
8 | + <Promotion class="order-item" :data="orderDetail.promotionTips"></Promotion> | ||
8 | <BuyerFeeInfo :data="orderDetail.promotionFormulaList" class="order-item"></BuyerFeeInfo> | 9 | <BuyerFeeInfo :data="orderDetail.promotionFormulaList" class="order-item"></BuyerFeeInfo> |
9 | <div class="tip2 order-item">{{orderDetail.specialTips}}</div> | 10 | <div class="tip2 order-item">{{orderDetail.specialTips}}</div> |
10 | <div class="tip order-item" v-html="replaceBr(orderDetail.damagesDesc)"></div> | 11 | <div class="tip order-item" v-html="replaceBr(orderDetail.damagesDesc)"></div> |
11 | - <OrderInfo class="order-item" :pay-way="orderDetail.paymentWay" :delivery-way="orderDetail.deliveryWay"></OrderInfo> | 12 | + <OrderInfo class="order-item" :pay-way="orderDetail.paymentWay" |
13 | + :delivery-way="orderDetail.deliveryWay"></OrderInfo> | ||
12 | </div> | 14 | </div> |
13 | 15 | ||
14 | <OrderFooter class="footer" :amount="orderDetail.amount"></OrderFooter> | 16 | <OrderFooter class="footer" :amount="orderDetail.amount"></OrderFooter> |
@@ -24,6 +26,7 @@ import BuyerFeeInfo from './components/confirm/buyer-fee'; | @@ -24,6 +26,7 @@ import BuyerFeeInfo from './components/confirm/buyer-fee'; | ||
24 | import OrderInfo from './components/confirm/order-info'; | 26 | import OrderInfo from './components/confirm/order-info'; |
25 | import OrderFooter from './components/confirm/buyer-order-footer'; | 27 | import OrderFooter from './components/confirm/buyer-order-footer'; |
26 | import Coupon from './components/confirm/coupon'; | 28 | import Coupon from './components/confirm/coupon'; |
29 | +import Promotion from './components/confirm/promotion'; | ||
27 | import { Types, UserType } from 'store/order/order-confirm'; | 30 | import { Types, UserType } from 'store/order/order-confirm'; |
28 | import { get } from 'lodash'; | 31 | import { get } from 'lodash'; |
29 | 32 | ||
@@ -44,7 +47,8 @@ export default { | @@ -44,7 +47,8 @@ export default { | ||
44 | BuyerFeeInfo, | 47 | BuyerFeeInfo, |
45 | OrderInfo, | 48 | OrderInfo, |
46 | OrderFooter, | 49 | OrderFooter, |
47 | - Coupon | 50 | + Coupon, |
51 | + Promotion | ||
48 | }, | 52 | }, |
49 | async mounted() { | 53 | async mounted() { |
50 | this.fetchUserStatus(); | 54 | this.fetchUserStatus(); |
@@ -72,9 +76,17 @@ export default { | @@ -72,9 +76,17 @@ export default { | ||
72 | return str ? str.replace(/\n/g, '<br />') : ''; | 76 | return str ? str.replace(/\n/g, '<br />') : ''; |
73 | }, | 77 | }, |
74 | onCouponClick() { | 78 | onCouponClick() { |
79 | + let vm = this; | ||
80 | + | ||
75 | this.$createOrderCouponList({ | 81 | this.$createOrderCouponList({ |
76 | - data: this.orderDetail.couponList | 82 | + data: this.orderDetail.couponList, |
83 | + onItemClickAction(item) { | ||
84 | + vm.onCouponItemClick(item); | ||
85 | + } | ||
77 | }).show(); | 86 | }).show(); |
87 | + }, | ||
88 | + onCouponItemClick(item) { | ||
89 | + console.log(item); | ||
78 | } | 90 | } |
79 | } | 91 | } |
80 | }; | 92 | }; |
1 | +<template> | ||
2 | +<div class="coupon-wrapper" @click="onClick"> | ||
3 | + <div class="title">促销<span class="desc">{{data.desc}}</span></div> | ||
4 | + <div><span class="red">{{data.coupon_amount_str}}</span><i class="iconfont iconright"></i></div> | ||
5 | +</div> | ||
6 | +</template> | ||
7 | + | ||
8 | +<script> | ||
9 | +export default { | ||
10 | + name: 'OrderPromotion', | ||
11 | + props: { | ||
12 | + data: { | ||
13 | + type: Object, | ||
14 | + default() { | ||
15 | + return {}; | ||
16 | + } | ||
17 | + } | ||
18 | + }, | ||
19 | + methods: { | ||
20 | + onClick() { | ||
21 | + this.$emit('click'); | ||
22 | + } | ||
23 | + } | ||
24 | +}; | ||
25 | +</script> | ||
26 | + | ||
27 | +<style lang="scss" scoped> | ||
28 | +.coupon-wrapper { | ||
29 | + display: flex; | ||
30 | + justify-content: space-between; | ||
31 | + align-items: center; | ||
32 | +} | ||
33 | + | ||
34 | +.title { | ||
35 | + font-size: 32px; | ||
36 | + display: flex; | ||
37 | + align-items: center; | ||
38 | +} | ||
39 | + | ||
40 | +.desc { | ||
41 | + font-size: 24px; | ||
42 | + color: #3f3f3f; | ||
43 | + margin-left: 10px; | ||
44 | +} | ||
45 | + | ||
46 | +.red { | ||
47 | + color: #d0021b; | ||
48 | + font-size: 28px; | ||
49 | + margin-right: 10px; | ||
50 | +} | ||
51 | + | ||
52 | +</style> |
@@ -11,10 +11,10 @@ | @@ -11,10 +11,10 @@ | ||
11 | </template> | 11 | </template> |
12 | 12 | ||
13 | <script> | 13 | <script> |
14 | -import { orderActionsMap } from "../../../../constants/order-constants"; | ||
15 | -import { createNamespacedHelpers } from "vuex"; | 14 | +import { orderActionsMap } from '../../../../constants/order-constants'; |
15 | +import { createNamespacedHelpers } from 'vuex'; | ||
16 | 16 | ||
17 | -const { mapActions } = createNamespacedHelpers("order/orderList"); | 17 | +const { mapActions } = createNamespacedHelpers('order/orderList'); |
18 | 18 | ||
19 | export default { | 19 | export default { |
20 | props: { | 20 | props: { |
@@ -29,35 +29,40 @@ export default { | @@ -29,35 +29,40 @@ export default { | ||
29 | } | 29 | } |
30 | }, | 30 | }, |
31 | methods: { | 31 | methods: { |
32 | - ...mapActions(["deleteOrder"]), | 32 | + ...mapActions(['deleteOrder']), |
33 | onAction(action) { | 33 | onAction(action) { |
34 | const { owner } = this.$route.params; | 34 | const { owner } = this.$route.params; |
35 | 35 | ||
36 | switch (action.name) { | 36 | switch (action.name) { |
37 | - case orderActionsMap.DEL_ORDER.name: | 37 | + case orderActionsMap.DEL_ORDER.name: { |
38 | this.$createDialog({ | 38 | this.$createDialog({ |
39 | - type: "confirm", | ||
40 | - content: "确认删除订单?", | ||
41 | - onConfirm: async () => { | 39 | + type: 'confirm', |
40 | + content: '确认删除订单?', | ||
41 | + onConfirm: async() => { | ||
42 | const isOk = await this.deleteOrder({ | 42 | const isOk = await this.deleteOrder({ |
43 | orderCode: this.order.code, | 43 | orderCode: this.order.code, |
44 | owner | 44 | owner |
45 | }); | 45 | }); |
46 | - const txt = isOk ? "删除成功" : "删除失败"; | ||
47 | - this.$createToast({ txt, type: "txt" }).show(); | 46 | + const txt = isOk ? '删除成功' : '删除失败'; |
47 | + | ||
48 | + this.$createToast({ txt, type: 'txt' }).show(); | ||
48 | } | 49 | } |
49 | }).show(); | 50 | }).show(); |
50 | break; | 51 | break; |
51 | - case orderActionsMap.BUY_AGAIN.name: | ||
52 | - console.log("------------------", this.$router.push); | 52 | + } |
53 | + case orderActionsMap.BUY_AGAIN.name: { | ||
54 | + console.log('------------------', this.$router.push); | ||
53 | break; | 55 | break; |
54 | - case orderActionsMap.SOLD_AGAIN.name: | 56 | + } |
57 | + case orderActionsMap.SOLD_AGAIN.name: { | ||
55 | const { productId, storageId } = this.order.goodsInfo; | 58 | const { productId, storageId } = this.order.goodsInfo; |
59 | + | ||
56 | this.$router.push({ | 60 | this.$router.push({ |
57 | - path: "/xianyu/order/sellconfirm.html", | 61 | + path: '/xianyu/order/sellconfirm.html', |
58 | query: { productId, storageId } | 62 | query: { productId, storageId } |
59 | }); | 63 | }); |
60 | break; | 64 | break; |
65 | + } | ||
61 | } | 66 | } |
62 | }, | 67 | }, |
63 | createDialog(options) { | 68 | createDialog(options) { |
@@ -72,44 +77,45 @@ export default { | @@ -72,44 +77,45 @@ export default { | ||
72 | this.$createDialog(config, createElement => { | 77 | this.$createDialog(config, createElement => { |
73 | return [ | 78 | return [ |
74 | createElement( | 79 | createElement( |
75 | - "a", | 80 | + 'a', |
76 | { | 81 | { |
77 | class: { | 82 | class: { |
78 | - "cube-dialog-btn border-top-1px action-confirm": true | 83 | + 'cube-dialog-btn border-top-1px action-confirm': true |
79 | }, | 84 | }, |
80 | - slot: "btns", | 85 | + slot: 'btns', |
81 | on: { | 86 | on: { |
82 | click: () => { | 87 | click: () => { |
83 | - console.log("--------btn------"); | 88 | + console.log('--------btn------'); |
84 | } | 89 | } |
85 | } | 90 | } |
86 | }, | 91 | }, |
87 | confirmBtn.text | 92 | confirmBtn.text |
88 | ), | 93 | ), |
89 | createElement( | 94 | createElement( |
90 | - "a", | 95 | + 'a', |
91 | { | 96 | { |
92 | class: { | 97 | class: { |
93 | - "cube-dialog-btn border-top-1px action-cancel": true | 98 | + 'cube-dialog-btn border-top-1px action-cancel': true |
94 | }, | 99 | }, |
95 | - slot: "btns" | 100 | + slot: 'btns' |
96 | }, | 101 | }, |
97 | cancelBtn.text | 102 | cancelBtn.text |
98 | ), | 103 | ), |
99 | createElement( | 104 | createElement( |
100 | - "p", | 105 | + 'p', |
101 | { | 106 | { |
102 | class: { | 107 | class: { |
103 | - "action-dialog-content": true | 108 | + 'action-dialog-content': true |
104 | }, | 109 | }, |
105 | - slot: "content" | 110 | + slot: 'content' |
106 | }, | 111 | }, |
107 | content | 112 | content |
108 | ) | 113 | ) |
109 | ]; | 114 | ]; |
110 | }).show(); | 115 | }).show(); |
111 | }, | 116 | }, |
112 | - onActionConfirm() {} | 117 | + onActionConfirm() { |
118 | + } | ||
113 | } | 119 | } |
114 | }; | 120 | }; |
115 | </script> | 121 | </script> |
@@ -156,4 +162,4 @@ export default { | @@ -156,4 +162,4 @@ export default { | ||
156 | margin-right: 0; | 162 | margin-right: 0; |
157 | } | 163 | } |
158 | } | 164 | } |
159 | -</style> | ||
165 | +</style> |
@@ -68,7 +68,6 @@ export default { | @@ -68,7 +68,6 @@ export default { | ||
68 | colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''), | 68 | colorName: get(state.product.selectedProductInfo, 'product.goods_list[0].color_name', ''), |
69 | sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''), | 69 | sizeName: get(state.product.selectedProductInfo, 'size.size_name', ''), |
70 | goodPrice: get(state.product.selectedProductInfo, 'size.least_price', ''), | 70 | goodPrice: get(state.product.selectedProductInfo, 'size.least_price', ''), |
71 | - storageId: this.storageId | ||
72 | }; | 71 | }; |
73 | } | 72 | } |
74 | }) | 73 | }) |
@@ -85,7 +84,7 @@ export default { | @@ -85,7 +84,7 @@ export default { | ||
85 | address_id: this.address.address_id, | 84 | address_id: this.address.address_id, |
86 | num: this.num, | 85 | num: this.num, |
87 | price: this.price, | 86 | price: this.price, |
88 | - storage_id: this.productDetail.storageId, | 87 | + storage_id: this.storageId, |
89 | }).then(result => { | 88 | }).then(result => { |
90 | if (result.error) { | 89 | if (result.error) { |
91 | this.error = result.error; | 90 | this.error = result.error; |
@@ -117,7 +116,7 @@ export default { | @@ -117,7 +116,7 @@ export default { | ||
117 | address_id: this.address.address_id, | 116 | address_id: this.address.address_id, |
118 | num: 1, | 117 | num: 1, |
119 | price: this.price, | 118 | price: this.price, |
120 | - storage_id: this.productDetail.storageId, | 119 | + storage_id: this.storageId, |
121 | }); | 120 | }); |
122 | 121 | ||
123 | if (orderResult.code !== 200) { | 122 | if (orderResult.code !== 200) { |
-
Please register or login to post a comment