Authored by TaoHuang

fix

import createAPI from 'utils/create-api';
export default function addCouponList(Vue, CouponList) {
createAPI(Vue, CouponList, ['closeAction', 'payAction'], true);
createAPI(Vue, CouponList, ['closeAction', 'payAction', 'itemClickAction'], true);
}
... ...
... ... @@ -7,7 +7,7 @@
</div>
<slot name="content">
<div class="pay-list-wrapper">
<div class="pay-list-item" v-for="item in data" :key="item.coupon_code">
<div class="pay-list-item" v-for="item in data" :key="item.coupon_code" @click="onItemClick(item)">
<div class="pay-info">
<div class="price">{{item.coupon_value_str}}</div>
<div class="price-desc">{{item.use_rule_str}}</div>
... ... @@ -65,6 +65,9 @@ export default {
},
pay() {
this.$emit('payAction');
},
onItemClick(item) {
this.$emit('itemClickAction', item);
}
}
};
... ...
... ... @@ -5,10 +5,12 @@
<AddressInfo :data="address" class="order-item" :show-tip="false"></AddressInfo>
<ProductInfo :data="orderDetail.good" class="product-info order-item"></ProductInfo>
<Coupon class="order-item" :data="orderDetail.recommendedCouponInfo" @click="onCouponClick"></Coupon>
<Promotion class="order-item" :data="orderDetail.promotionTips"></Promotion>
<BuyerFeeInfo :data="orderDetail.promotionFormulaList" class="order-item"></BuyerFeeInfo>
<div class="tip2 order-item">{{orderDetail.specialTips}}</div>
<div class="tip order-item" v-html="replaceBr(orderDetail.damagesDesc)"></div>
<OrderInfo class="order-item" :pay-way="orderDetail.paymentWay" :delivery-way="orderDetail.deliveryWay"></OrderInfo>
<OrderInfo class="order-item" :pay-way="orderDetail.paymentWay"
:delivery-way="orderDetail.deliveryWay"></OrderInfo>
</div>
<OrderFooter class="footer" :amount="orderDetail.amount"></OrderFooter>
... ... @@ -24,6 +26,7 @@ import BuyerFeeInfo from './components/confirm/buyer-fee';
import OrderInfo from './components/confirm/order-info';
import OrderFooter from './components/confirm/buyer-order-footer';
import Coupon from './components/confirm/coupon';
import Promotion from './components/confirm/promotion';
import { Types, UserType } from 'store/order/order-confirm';
import { get } from 'lodash';
... ... @@ -44,7 +47,8 @@ export default {
BuyerFeeInfo,
OrderInfo,
OrderFooter,
Coupon
Coupon,
Promotion
},
async mounted() {
this.fetchUserStatus();
... ... @@ -72,9 +76,17 @@ export default {
return str ? str.replace(/\n/g, '<br />') : '';
},
onCouponClick() {
let vm = this;
this.$createOrderCouponList({
data: this.orderDetail.couponList
data: this.orderDetail.couponList,
onItemClickAction(item) {
vm.onCouponItemClick(item);
}
}).show();
},
onCouponItemClick(item) {
console.log(item);
}
}
};
... ...
<template>
<div class="coupon-wrapper" @click="onClick">
<div class="title">促销<span class="desc">{{data.desc}}</span></div>
<div><span class="red">{{data.coupon_amount_str}}</span><i class="iconfont iconright"></i></div>
</div>
</template>
<script>
export default {
name: 'OrderPromotion',
props: {
data: {
type: Object,
default() {
return {};
}
}
},
methods: {
onClick() {
this.$emit('click');
}
}
};
</script>
<style lang="scss" scoped>
.coupon-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
}
.title {
font-size: 32px;
display: flex;
align-items: center;
}
.desc {
font-size: 24px;
color: #3f3f3f;
margin-left: 10px;
}
.red {
color: #d0021b;
font-size: 28px;
margin-right: 10px;
}
</style>
... ...
... ... @@ -11,10 +11,10 @@
</template>
<script>
import { orderActionsMap } from "../../../../constants/order-constants";
import { createNamespacedHelpers } from "vuex";
import { orderActionsMap } from '../../../../constants/order-constants';
import { createNamespacedHelpers } from 'vuex';
const { mapActions } = createNamespacedHelpers("order/orderList");
const { mapActions } = createNamespacedHelpers('order/orderList');
export default {
props: {
... ... @@ -29,36 +29,41 @@ export default {
}
},
methods: {
...mapActions(["deleteOrder"]),
...mapActions(['deleteOrder']),
onAction(action) {
const { owner } = this.$route.params;
switch (action.name) {
case orderActionsMap.DEL_ORDER.name:
case orderActionsMap.DEL_ORDER.name: {
this.$createDialog({
type: "confirm",
content: "确认删除订单?",
onConfirm: async () => {
type: 'confirm',
content: '确认删除订单?',
onConfirm: async() => {
const isOk = await this.deleteOrder({
orderCode: this.order.code,
owner
});
const txt = isOk ? "删除成功" : "删除失败";
this.$createToast({ txt, type: "txt" }).show();
const txt = isOk ? '删除成功' : '删除失败';
this.$createToast({ txt, type: 'txt' }).show();
}
}).show();
break;
case orderActionsMap.BUY_AGAIN.name:
console.log("------------------", this.$router.push);
}
case orderActionsMap.BUY_AGAIN.name: {
console.log('------------------', this.$router.push);
break;
case orderActionsMap.SOLD_AGAIN.name:
}
case orderActionsMap.SOLD_AGAIN.name: {
const { productId, storageId } = this.order.goodsInfo;
this.$router.push({
path: "/xianyu/order/sellconfirm.html",
path: '/xianyu/order/sellconfirm.html',
query: { productId, storageId }
});
break;
}
}
},
createDialog(options) {
const {
... ... @@ -72,44 +77,45 @@ export default {
this.$createDialog(config, createElement => {
return [
createElement(
"a",
'a',
{
class: {
"cube-dialog-btn border-top-1px action-confirm": true
'cube-dialog-btn border-top-1px action-confirm': true
},
slot: "btns",
slot: 'btns',
on: {
click: () => {
console.log("--------btn------");
console.log('--------btn------');
}
}
},
confirmBtn.text
),
createElement(
"a",
'a',
{
class: {
"cube-dialog-btn border-top-1px action-cancel": true
'cube-dialog-btn border-top-1px action-cancel': true
},
slot: "btns"
slot: 'btns'
},
cancelBtn.text
),
createElement(
"p",
'p',
{
class: {
"action-dialog-content": true
'action-dialog-content': true
},
slot: "content"
slot: 'content'
},
content
)
];
}).show();
},
onActionConfirm() {}
onActionConfirm() {
}
}
};
</script>
... ...
... ... @@ -68,7 +68,6 @@ export default {
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: this.storageId
};
}
})
... ... @@ -85,7 +84,7 @@ export default {
address_id: this.address.address_id,
num: this.num,
price: this.price,
storage_id: this.productDetail.storageId,
storage_id: this.storageId,
}).then(result => {
if (result.error) {
this.error = result.error;
... ... @@ -117,7 +116,7 @@ export default {
address_id: this.address.address_id,
num: 1,
price: this.price,
storage_id: this.productDetail.storageId,
storage_id: this.storageId,
});
if (orderResult.code !== 200) {
... ...