Feat:订单退款,礼品下单

This commit is contained in:
linxi
2025-10-21 17:51:40 +08:00
parent 64db7b8cd4
commit bf4861f088
7 changed files with 328 additions and 131 deletions
+16 -1
View File
@@ -63,4 +63,19 @@ export function getGiftCardResend(data) {
*/ */
export function getGiftCardSendBackground(data) { export function getGiftCardSendBackground(data) {
return request.get("giftCard/giftCardBackgroundImage", data); return request.get("giftCard/giftCardBackgroundImage", data);
} }
/**
* 创建团购礼品
* @param {*} data
*/
export function createGroupBuyGift(data) {
return request.post("/travel/giftCardOrder/confirm", data);
}
/**
* 旅居团购礼品卡订单创建
* @param {*} data
*/
export function createSojoumGroupBuyGift(key, data) {
return request.post("/travel/giftCardOrder/create/" + key, data);
}
+13 -2
View File
@@ -27,7 +27,7 @@ export function sojoumOrderRefund(params) {
* @returns * @returns
*/ */
export function sojoumOrderCheckInTime(params) { export function sojoumOrderCheckInTime(params) {
return request.put("/travel/travelGroupOrder/changeDate", params, { return request.post("/travel/travelGroupGiftCard/changeDate", params, {
login: true login: true
}) })
} }
@@ -43,4 +43,15 @@ export function sojoumOrderCalendar(params) {
return request.get("/travel/product/calendar", params, { return request.get("/travel/product/calendar", params, {
login: true login: true
}) })
} }
/**
* 旅居团购订单退款信息
* @param {*} params
* @returns
*/
export function sojoumOrderRefundInfo(params) {
return request.post("/travel/travelGroupOrder/refundInfo", params, {
login: true
})
}
+2 -4
View File
@@ -7,7 +7,6 @@
:maxRange="999" :maxRange="999"
:defaultDate="defaultDate" :defaultDate="defaultDate"
:minDate="minDate" :minDate="minDate"
:disabledDate="disabledDates"
color="#C52733" color="#C52733"
@confirm="handleDateChange" @confirm="handleDateChange"
@close="hideCalendar" @close="hideCalendar"
@@ -111,10 +110,9 @@ export default {
startDate: e[0], startDate: e[0],
endDate: e[e.length - 1] endDate: e[e.length - 1]
} }
// 如果选择的天数小于minDay,提示用户选择至少minDay天 if (e.length !== this.minDay) {
if (e.length < this.minDay) {
uni.showToast({ uni.showToast({
title: `请选择至少${this.minDay}天`, title: `团购天数必须为${this.minDay}天`,
icon: 'none' icon: 'none'
}) })
this.resetSelection() this.resetSelection()
+26 -45
View File
@@ -155,50 +155,7 @@ export default {
giftBg: '', giftBg: '',
id: '', id: '',
activePeriod: 0, activePeriod: 0,
detail: { detail: {},
title: '【正牌爆售】30天29晚臻享特色小院/庵食套餐',
price: 3888,
images: [
'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/hotel-1.jpg',
'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/hotel-2.jpg',
'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/hotel-3.jpg'
],
periods: [
{ batch: 1, range: '6/13-6/15' },
{ batch: 2, range: '6/16-6/18' },
{ batch: 3, range: '6/19-6/21' },
{ batch: 4, range: '6/22-6/24' }
],
combos: [
{ img: 'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/room-1.jpg', text: '温泉泡汤·双人早餐' },
{ img: 'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/room-2.jpg', text: '茶室体验·手作禅食' },
{ img: 'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/room-3.jpg', text: '山景露台·下午茶' },
{ img: 'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/room-4.jpg', text: '夜间电影·星空灯' },
{ img: 'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/room-5.jpg', text: '精品床品·加湿香氛' },
{ img: 'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/room-6.jpg', text: '小院烧烤·庭院篝火' }
],
highlights: [
'小院临海风光,步行可达观景台',
'馆内私厨,提供本地特色庵食',
'房间带露台,景观视野绝佳',
'每期限定名额,错峰享受更安静'
],
rules: [
'需至少提前3日预订,节假日价格略有浮动',
'不可与其他优惠同享;支持改期一次',
'如遇不可抗因素,支持无损退款',
'入住需持有效身份证件,遵守园区规定'
],
fees: [
{ name: '下单即赠惊喜', value: '免费' },
{ name: '入住加床', value: 'x' },
{ name: '儿童入园', value: 'x' }
],
gallery: [
'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/courtyard-1.jpg',
'https://cdn.jsdelivr.net/gh/trae-ai/assets-placeholder/courtyard-2.jpg'
]
},
calendar: [], calendar: [],
currentWeek: [], currentWeek: [],
rules: "", rules: "",
@@ -223,6 +180,12 @@ export default {
}) })
}, },
methods: { methods: {
toGift(){
uni.navigateTo({
// + '&couponId=' + coupId
url: '/pkg_user/views/gift/gift?cartId=' + this.id + '&isGroupBuy=1'
})
},
handleDateSelected(dateRange) { handleDateSelected(dateRange) {
console.log(dateRange, 'dateRange'); console.log(dateRange, 'dateRange');
@@ -300,7 +263,25 @@ export default {
}, },
contactService() { contactService() {
uni.showToast({ title: '已为您接入管家', icon: 'none' }) uni.showModal({
title: '商家电话',
content: this.detail.phone || '暂无电话',
confirmText: '立即拨打',
cancelText: '取消',
success: (res) => {
if (res.confirm && this.detail.phone) {
uni.makePhoneCall({
phoneNumber: this.detail.phone,
fail: () => {
uni.showToast({
title: '拨打电话失败',
icon: 'none'
})
}
})
}
}
})
}, },
bookNow() { bookNow() {
uni.navigateTo({ url: '/pkg_product/views/submitOrder?id=' + this.id + '&orderStartDate=' + this.rangeDate.startDate + '&orderEndDate=' + this.rangeDate.endDate }) uni.navigateTo({ url: '/pkg_product/views/submitOrder?id=' + this.id + '&orderStartDate=' + this.rangeDate.startDate + '&orderEndDate=' + this.rangeDate.endDate })
+157 -18
View File
@@ -2,7 +2,7 @@
<view class="order-details v12-px-3 v12-pt-3"> <view class="order-details v12-px-3 v12-pt-3">
<!-- 订单状态 --> <!-- 订单状态 -->
<view class="status-section"> <view class="status-section">
<view class="v12-font-32 v12-primary-text">{{orderInfo._status._title}}</view> <view class="v12-font-28 v12-font-bold v12-primary-text">{{orderInfo._status._title}}</view>
<view class="v12-font-24 v12-mt-3" style="color: #666;" v-if="orderInfo._status && ['1','2'].includes(orderInfo._status._type)"> <view class="v12-font-24 v12-mt-3" style="color: #666;" v-if="orderInfo._status && ['1','2'].includes(orderInfo._status._type)">
您已下单成功,请联系商家确认具体的入住时间 您已下单成功,请联系商家确认具体的入住时间
</view> </view>
@@ -27,8 +27,8 @@
<view class="v12-font-32 v12-font-bold more_t">{{orderInfo.travelGroupOrderInfo.travelGroupProduct.name}}</view> <view class="v12-font-32 v12-font-bold more_t">{{orderInfo.travelGroupOrderInfo.travelGroupProduct.name}}</view>
<view class="product-price"> <view class="product-price">
<text style="font-size: 28rpx; color: #A1A1A1;">实付:</text> <text style="font-size: 28rpx; color: #A1A1A1;">实付:</text>
<text class="v12-primary-text"> <text class="v12-primary-text v12-font-bold">
<text class="v12-font-28 v12-primary-text">¥</text> <text class="v12-font-26 v12-primary-text">¥</text>
<text class="v12-font-36 v12-primary-text">{{orderInfo.payPrice}}</text> <text class="v12-font-36 v12-primary-text">{{orderInfo.payPrice}}</text>
</text> </text>
</view> </view>
@@ -40,11 +40,34 @@
<view class="verify-title v12-font-28 v12-primary-text">核销码:{{orderInfo.verifyCode}}</view> <view class="verify-title v12-font-28 v12-primary-text">核销码:{{orderInfo.verifyCode}}</view>
<image class="qr-code" :src="orderInfo.verifyQrCode" mode="aspectFit"></image> <image class="qr-code" :src="orderInfo.verifyQrCode" mode="aspectFit"></image>
<view class="contact-buttons"> <view class="contact-buttons">
<button class="contact-btn merchant-phone" @click="contactMerchant('phone')">商家电话</button> <button class="contact-btn merchant-phone" @click="showPhoneDialog('phone')">商家电话</button>
<button class="contact-btn merchant-wechat" @click="contactMerchant('wechat')">商家微信</button> <button class="contact-btn merchant-wechat" @click="showPhoneDialog('wechat')">商家微信</button>
</view> </view>
</view> </view>
<!-- 商家电话弹窗 -->
<u-popup :show="showPhonePopup" mode="center" round="10" :safe-area-inset-bottom="false">
<view class="phone-popup">
<view class="phone-title">{{ title }}</view>
<view class="phone-number">{{ popContent || '暂无'}}</view>
<view class="phone-actions v12-align-center" v-if="title === '商家电话'">
<!-- <button class="action-btn cancel" @click="showPhonePopup = false">取消</button>
<button class="action-btn call" @click="makePhoneCall">立即拨打</button> -->
<view class="v12-font-28 v12-primary-text" @click="contactMerchant('phone')">立即拨打</view> | <view class="v12-font-28" @click="showPhonePopup = false">取消</view>
</view>
<view class="phone-actions v12-align-center" v-if="title === '商家微信'">
<!-- <button class="action-btn cancel" @click="showPhonePopup = false">取消</button>
<button class="action-btn call" @click="makePhoneCall">立即拨打</button> -->
<view class="v12-font-28 v12-primary-text" @click="contactMerchant('wechat')">立即复制</view> | <view class="v12-font-28" @click="showPhonePopup = false">取消</view>
</view>
<view class="phone-actions v12-align-center" v-if="title === '平台电话'" >
<!-- <button class="action-btn cancel" @click="showPhonePopup = false">取消</button>
<button class="action-btn call" @click="makePhoneCall">立即拨打</button> -->
<view v-if="title === '平台电话'" class="v12-font-28 v12-primary-text" @click="contactMerchant('phone')">立即拨打</view> | <view class="v12-font-28" @click="showPhonePopup = false">取消</view>
</view>
</view>
</u-popup>
<!-- 联系人信息 --> <!-- 联系人信息 -->
<view class="contact-section"> <view class="contact-section">
<view class="section-title v12-font-28 v12-font-bold">联系人信息</view> <view class="section-title v12-font-28 v12-font-bold">联系人信息</view>
@@ -90,13 +113,20 @@
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="bottom-buttons"> <view class="bottom-buttons">
<button class="btn customer-service" @click="contactCustomerService">平台客服</button> <button class="btn customer-service" @click="showPhoneDialog('phone')">平台客服</button>
<view class="v12-align-center"> <view class="v12-align-center" v-if="orderInfo._status && ['1','2'].includes(orderInfo._status._type)">
<button class="btn v12-primary-border v12-primary-text modify-time" @click="modifyStayTime">修改入住时间</button> <button class="btn v12-primary-border v12-primary-text modify-time" @click="modifyStayTime">修改入住时间</button>
<button class="btn v12-primary-border v12-primary-text refund" @click="applyRefund">申请退款</button> <button class="btn v12-primary-border v12-primary-text refund" @click="applyRefund">申请退款</button>
</view> </view>
<view class="v12-align-center" v-if="orderInfo._status && ['1','2'].includes(orderInfo._status._type)">
<button class="btn v12-dark-border v12-dark-text modify-time" @click="showPhoneDialog('phone')">联系商家</button>
</view>
</view> </view>
<Calendar ref="calendar" @dateSelected="handleDateSelected"></Calendar> <Calendar
ref="calendar"
:minDay="orderInfo.minBookingDays"
@dateSelected="handleDateSelected">
</Calendar>
</view> </view>
</template> </template>
@@ -110,10 +140,14 @@ export default {
data() { data() {
return { return {
key: '', key: '',
popContent: '',
title: '',
orderInfo: { orderInfo: {
travelGroupOrderInfo: {}, travelGroupOrderInfo: {},
_status: {} _status: {},
} merchantPhone: '' // 添加商家电话字段
},
showPhonePopup: false // 控制电话弹窗显示
} }
}, },
onLoad(otps) { onLoad(otps) {
@@ -121,11 +155,17 @@ export default {
this.getSojoumOrderDetail(); this.getSojoumOrderDetail();
}, },
methods: { methods: {
getDaysCount() {
// 根据开始日期和结束日期计算天数
const startDate = new Date(this.orderInfo.travelGroupOrderInfo.orderStartDate);
const endDate = new Date(this.orderInfo.travelGroupOrderInfo.orderEndDate);
const timeDiff = endDate - startDate;
const daysCount = Math.ceil(timeDiff / (1000 * 60 * 60 * 24));
return daysCount + 1;
},
handleDateSelected(dateRange) { handleDateSelected(dateRange) {
console.log('selectedRange', dateRange);
const params = { const params = {
orderId: this.orderInfo.travelGroupOrderInfo.travelGroupProduct.id, orderId: this.key,
orderStartDate: dateRange.startDate, orderStartDate: dateRange.startDate,
orderEndDate: dateRange.endDate orderEndDate: dateRange.endDate
} }
@@ -139,6 +179,7 @@ export default {
title: '入住时间修改成功', title: '入住时间修改成功',
icon: 'success' icon: 'success'
}) })
this.getSojoumOrderDetail();
} }
}).finally(() => { }).finally(() => {
uni.hideLoading(); uni.hideLoading();
@@ -169,6 +210,7 @@ export default {
const res = await fetchSojoumOrderDetail(params); const res = await fetchSojoumOrderDetail(params);
if (res.status === 200) { if (res.status === 200) {
this.orderInfo = res.data; this.orderInfo = res.data;
this.orderInfo.minBookingDays = this.getDaysCount();
uni.hideLoading(); uni.hideLoading();
} }
}, },
@@ -202,6 +244,8 @@ export default {
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: this.orderInfo.merPhone, phoneNumber: this.orderInfo.merPhone,
success: () => { success: () => {
console.log('///');
uni.showToast({ uni.showToast({
title: '正在拨打电话', title: '正在拨打电话',
icon: 'none' icon: 'none'
@@ -218,6 +262,7 @@ export default {
uni.setClipboardData({ uni.setClipboardData({
data: this.orderInfo.merWechat, data: this.orderInfo.merWechat,
success: () => { success: () => {
console.log('//微信号已复制/');
uni.showToast({ uni.showToast({
title: '微信号已复制', title: '微信号已复制',
icon: 'success' icon: 'success'
@@ -228,10 +273,21 @@ export default {
}, },
contactCustomerService() { contactCustomerService() {
// 这里可以添加跳转到客服页面或打开客服会话的逻辑 // 这里可以添加跳转到客服页面或打开客服会话的逻辑
uni.showToast({ uni.makePhoneCall({
title: '正在连接客服...', phoneNumber: this.orderInfo.merPhone,
icon: 'none' success: () => {
}) uni.showToast({
title: '正在拨打电话',
icon: 'none'
})
},
fail: () => {
uni.showToast({
title: '拨打失败',
icon: 'none'
})
}
})
}, },
modifyStayTime() { modifyStayTime() {
// 这里可以添加修改入住时间的逻辑,比如打开日期选择器 // 这里可以添加修改入住时间的逻辑,比如打开日期选择器
@@ -242,7 +298,42 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: '/pkg_product/views/sojoumOrderRefund?id=' + this.key url: '/pkg_product/views/sojoumOrderRefund?id=' + this.key
}) })
} },
// 显示电话弹窗
showPhoneDialog(type) {
if (!this.orderInfo.merPhone) {
uni.showToast({
title: '暂无商家电话',
icon: 'none'
});
return;
}
if (type === 'phone') {
this.title = '商家电话';
this.popContent = this.orderInfo.merPhone;
} else if (type === 'wechat') {
this.title = '商家微信';
this.popContent = this.orderInfo.merWechat;
}
this.showPhonePopup = true;
},
// 拨打电话
makePhoneCall() {
if (!this.orderInfo.merchantPhone) return;
uni.makePhoneCall({
phoneNumber: this.orderInfo.merchantPhone,
success: () => {
this.showPhonePopup = false;
},
fail: () => {
uni.showToast({
title: '拨号失败',
icon: 'none'
});
}
});
},
} }
} }
</script> </script>
@@ -325,6 +416,8 @@ export default {
padding: 0 40rpx; padding: 0 40rpx;
border-radius: 40rpx; border-radius: 40rpx;
font-size: 28rpx; font-size: 28rpx;
height: 60rpx;
line-height: 60rpx;
&.merchant-phone { &.merchant-phone {
background-color: #fff; background-color: #fff;
border: 2rpx solid #333; border: 2rpx solid #333;
@@ -405,4 +498,50 @@ export default {
} }
} }
} }
.phone-popup {
width: 400rpx;
background-color: #fff;
border-radius: 20rpx;
padding: 40rpx;
.phone-title {
font-size: 32rpx;
color: #333;
text-align: center;
margin-bottom: 30rpx;
font-weight: bold;
}
.phone-number {
font-size: 32rpx;
color: #333;
text-align: center;
margin-bottom: 40rpx;
}
.phone-actions {
display: flex;
justify-content: space-around;
gap: 20rpx;
.action-btn {
flex: 1;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 40rpx;
font-size: 28rpx;
&.cancel {
background-color: #f5f5f5;
color: #666;
}
&.call {
background-color: var(--v12-color-primary);
color: #fff;
}
}
}
}
</style> </style>
+43 -11
View File
@@ -55,12 +55,13 @@
</template> </template>
<script> <script>
import { sojoumOrderRefundInfo, sojoumOrderRefund } from '@/api/sojoumOrder.js'
export default { export default {
data() { data() {
return { return {
refundAmount: 3500.0, refundAmount: '',
orderAmount: 3888, orderAmount: '',
deductionAmount: 388.8, deductionAmount: '',
refundReasons: [ refundReasons: [
'行程变更', '行程变更',
'定错时间/地址', '定错时间/地址',
@@ -70,24 +71,55 @@ export default {
'其他' '其他'
], ],
selectedReason: '', selectedReason: '',
otherReason: '' otherReason: '',
key: ''
} }
}, },
onLoad(opts) {
this.key = opts.id
this.getRefundInfo(opts.id)
},
methods: { methods: {
getRefundInfo(id) {
sojoumOrderRefundInfo({
orderId: id
}).then(res => {
if (res.status === 200) {
this.refundAmount = res.data.refundPrice
this.orderAmount = res.data.payPrice
this.deductionAmount = res.data.penalty
}
})
},
selectReason(reason) { selectReason(reason) {
this.selectedReason = reason this.selectedReason = reason
}, },
submitRefund() { submitRefund() {
// TODO: 实现退款提交逻辑 // TODO: 实现退款提交逻辑
// orderId string 订单号
// refundReasonWap string 选择的退款原因
// refundReasonWapExplain string 退款原因说明(其他个人原因)
const refundData = { const refundData = {
amount: this.refundAmount, orderId: this.key,
reason: this.selectedReason, refundReasonWap: this.selectedReason,
otherReason: this.otherReason refundReasonWapExplain: this.otherReason
} }
console.log('提交退款申请:', refundData) uni.showLoading({
uni.showToast({ title: '加载中...',
title: '退款申请已提交', mask: true,
icon: 'success' })
sojoumOrderRefund(refundData).then(res => {
if (res.status === 200) {
uni.showToast({
title: '退款申请已提交',
icon: 'success'
})
uni.navigateBack({
url: '/pkg_product/views/sojoumOrderDetails?id=' + this.key
})
}
}).finally(() => {
uni.hideLoading();
}) })
} }
} }
+71 -50
View File
@@ -1,5 +1,5 @@
<template> <template>
<view class="gift-page" v-if="goodsInfo.productInfo && goodsInfo.productInfo.storeName"> <view class="gift-page" v-if="(goodsInfo.productInfo && goodsInfo.productInfo.storeName) || isGroupBuy">
<view class="top-card" v-if="!isPayOk "> <view class="top-card" v-if="!isPayOk ">
<view class="v12-justify-between v12-pa-2"> <view class="v12-justify-between v12-pa-2">
<view> <view>
@@ -19,41 +19,25 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="v12-px-2">
<view class="line"></view>
</view>
<view class="v12-pa-2 ">
<u-textarea
v-model="message"
placeholderClass="v12-font-28"
placeholder="礼笺轻启,礼藏心意"
maxlength="30"
border="none"
count
ref="textarea"
cols="30"
@input="messageChange"
rows="10"></u-textarea>
</view> -->
</view> </view>
<view class="gift-good-card"> <view class="gift-good-card">
<view class="v12-align-center v12-justify-start"> <view class="v12-align-center v12-justify-start">
<view> <view>
<image :src="goodsInfo.productInfo.image" mode="scaleToFill" class="cover-image"></image> <image :src="isGroupBuy ? goodsInfo.mainImage : goodsInfo.productInfo.image" mode="scaleToFill" class="cover-image"></image>
</view> </view>
<view class="v12-ml-2 info-wrap"> <view class="v12-ml-2 info-wrap">
<view class="v12-dark-text v12-font-bold v12-font-28 t-more"> <view class="v12-dark-text v12-font-bold v12-font-28 t-more">
{{ goodsInfo.productInfo.storeName }} {{ isGroupBuy ? goodsInfo.name : goodsInfo.productInfo.storeName }}
</view> </view>
<view class="gift-sku"> <view class="gift-sku" v-if="!isGroupBuy">
{{ goodsInfo.productInfo.attrInfo.sku }} {{ goodsInfo.productInfo.attrInfo.sku }}
</view> </view>
<view class="v12-justify-between"> <view class="v12-justify-between">
<view> <view>
<text class="v12-primary-text v12-font-bold v12-font-22">¥</text> <text class="v12-primary-text v12-font-bold v12-font-22">¥</text>
<text class="v12-primary-text v12-font-bold v12-font-30">{{ payPrice }}</text> <text class="v12-primary-text v12-font-bold v12-font-30">{{ isGroupBuy ? goodsInfo.price : payPrice }}</text>
</view> </view>
<view> <view v-if="!isGroupBuy">
<u-number-box <u-number-box
v-if="!isPayOk" v-if="!isPayOk"
v-model="goodsInfo.cartNum" v-model="goodsInfo.cartNum"
@@ -96,7 +80,7 @@
<u-switch v-model="canTransfer" activeColor="#c52733"></u-switch> <u-switch v-model="canTransfer" activeColor="#c52733"></u-switch>
</view> </view>
</view> </view>
<view class="swich-btn" v-if="!isPayOk"> <view class="swich-btn" v-if="!isPayOk && !isGroupBuy">
<view class="v12-font-28 v12-dark-text">打开盲盒模式,朋友签收前商品信息保密</view> <view class="v12-font-28 v12-dark-text">打开盲盒模式,朋友签收前商品信息保密</view>
<view> <view>
<u-switch v-model="isBlind" activeColor="#c52733"></u-switch> <u-switch v-model="isBlind" activeColor="#c52733"></u-switch>
@@ -109,10 +93,10 @@
<view class="v12-font-24 v12-dark-text">商品总价:</view> <view class="v12-font-24 v12-dark-text">商品总价:</view>
<view> <view>
<text class="v12-dark-text v12-font-22">¥</text> <text class="v12-dark-text v12-font-22">¥</text>
<text class="v12-dark-text v12-font-30">{{ computedResult.totalPrice }}</text> <text class="v12-dark-text v12-font-30">{{ isGroupBuy ? goodsInfo.price : computedResult.totalPrice }}</text>
</view> </view>
</view> </view>
<view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1"> <view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1" v-if="!isGroupBuy">
<view class="v12-font-24 v12-dark-text">平台折扣:</view> <view class="v12-font-24 v12-dark-text">平台折扣:</view>
<view> <view>
- -
@@ -120,7 +104,7 @@
<text class="v12-dark-text v12-font-30">{{ computedResult.discountPrice }}</text> <text class="v12-dark-text v12-font-30">{{ computedResult.discountPrice }}</text>
</view> </view>
</view> </view>
<view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1"> <view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1" v-if="!isGroupBuy">
<view class="v12-font-24 v12-dark-text v12-align-center"> <view class="v12-font-24 v12-dark-text v12-align-center">
<view class=""> <view class="">
优惠券: 优惠券:
@@ -142,7 +126,7 @@
<view class="v12-font-bold">合计:</view> <view class="v12-font-bold">合计:</view>
<view class=""> <view class="">
<text class="v12-primary-text v12-font-bold v12-font-22">¥</text> <text class="v12-primary-text v12-font-bold v12-font-22">¥</text>
<text class="v12-primary-text v12-font-bold v12-font-28">{{ computedResult.payPrice }}</text> <text class="v12-primary-text v12-font-bold v12-font-28">{{ isGroupBuy ? goodsInfo.price : computedResult.payPrice }}</text>
</view> </view>
</view> </view>
</view> </view>
@@ -177,7 +161,7 @@
ref='payPwdPop' ref='payPwdPop'
showMoney showMoney
v-if="isShowPayPwdPop" v-if="isShowPayPwdPop"
:money="payPrice" :money="isGroupBuy ? goodsInfo.price : payPrice"
:show="isShowPayPwdPop" :show="isShowPayPwdPop"
@close="isShowPayPwdPop = false" @close="isShowPayPwdPop = false"
@finish="pwdPopFinish" @finish="pwdPopFinish"
@@ -210,7 +194,14 @@
<script> <script>
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard' import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
import { getGiftCardSendOrderConfirm, getGiftCardSendOrder, getGiftCardSendOrderAmount, getGiftCardResend } from '@/api/gift' import {
getGiftCardSendOrderConfirm,
getGiftCardSendOrder,
getGiftCardSendOrderAmount,
getGiftCardResend,
createGroupBuyGift,
createSojoumGroupBuyGift
} from '@/api/gift'
import { weappPay } from "@/libs/wechat"; import { weappPay } from "@/libs/wechat";
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import giftTips from './components/giftTips.vue' import giftTips from './components/giftTips.vue'
@@ -263,7 +254,8 @@ export default {
}, },
couponTitle: '', couponTitle: '',
showPopup: false, showPopup: false,
blindImage: '' blindImage: '',
isGroupBuy: false,
} }
}, },
watch: { watch: {
@@ -275,9 +267,14 @@ export default {
}, },
onLoad(opts) { onLoad(opts) {
this.cartId = opts.cartId this.cartId = opts.cartId
this.isGroupBuy = opts.isGroupBuy === '1'
// this.couponId = opts.couponId || 0 // this.couponId = opts.couponId || 0
this.discount = opts.discount this.discount = opts.discount
this.getGift() if(this.isGroupBuy) {
this.getGroupBuyInfo()
} else {
this.getGift()
}
}, },
computed: { computed: {
...mapGetters(["userInfo"]), ...mapGetters(["userInfo"]),
@@ -406,6 +403,7 @@ export default {
showTips() { showTips() {
this.$refs.giftTips.showTips = true this.$refs.giftTips.showTips = true
}, },
getGift() { getGift() {
const params = { const params = {
cartId: this.cartId, cartId: this.cartId,
@@ -455,26 +453,35 @@ export default {
uni.showLoading({ uni.showLoading({
title: "生成订单中" title: "生成订单中"
}); });
const params = { const params = this.isGroupBuy ? {
orderKey: this.orderKey, key: this.orderKey,
from: 'routine', from: 'routine',
cartId: this.cartId, cartId: this.cartId,
couponId: this.couponId, templateId: this.templateId,
recipientsNum: this.goodsInfo.cartNum, message : this.message || '礼笺轻启,礼藏心意',
templateId: this.templateId, canTransfer: this.canTransfer ? 1 : 0,
message : this.message || '礼笺轻启,礼藏心意', payType: this.payType,
cover: this.selectedCover, } : {
canTransfer: this.canTransfer ? 1 : 0, orderKey: this.orderKey,
isBlind: this.isBlind ? 1 : 0, from: 'routine',
payType: this.payType, cartId: this.cartId,
seckillId: this.orderGroupInfo.seckill_id, couponId: this.couponId,
combinationId: this.orderGroupInfo.combination_id, recipientsNum: this.goodsInfo.cartNum,
bargainId: this.orderGroupInfo.bargain_id, templateId: this.templateId,
} message : this.message || '礼笺轻启,礼藏心意',
cover: this.selectedCover,
canTransfer: this.canTransfer ? 1 : 0,
isBlind: this.isBlind ? 1 : 0,
payType: this.payType,
seckillId: this.orderGroupInfo.seckill_id,
combinationId: this.orderGroupInfo.combination_id,
bargainId: this.orderGroupInfo.bargain_id,
}
if (this.payType == 'yue') { if (this.payType == 'yue') {
params.passwordPay = this.payPassword; params.passwordPay = this.payPassword;
} }
getGiftCardSendOrder(this.orderKey, params).then(res => { const apiFn = this.isGroupBuy ? createSojoumGroupBuyGift : getGiftCardSendOrder
apiFn(this.orderKey, params).then(res => {
uni.hideLoading(); uni.hideLoading();
const data = res.data; const data = res.data;
@@ -558,6 +565,22 @@ export default {
this.$refs.payPwdPop.clear();//清空支付密码 this.$refs.payPwdPop.clear();//清空支付密码
this.$refs.payPwdPop.close();//关闭支付密码弹窗 this.$refs.payPwdPop.close();//关闭支付密码弹窗
}); });
},
getGroupBuyInfo() {
const params = {
travelGroupProductId: this.cartId
}
createGroupBuyGift(params).then(res => {
if (res.status === 200) {
this.coverList = res.data.giftCardGiftNotice || []
this.orderKey = res.data.orderKey
this.goodsInfo = {
...res.data.travelGroupProduct,
}
this.giftNotice = res.data.giftCardGiftNotice
}
})
} }
} }
} }
@@ -693,7 +716,6 @@ export default {
} }
.price-wrap{ .price-wrap{
width: 100%; width: 100%;
height: 320rpx;
background: #fff; background: #fff;
border-radius: 20rpx; border-radius: 20rpx;
margin-top: 30rpx; margin-top: 30rpx;
@@ -702,7 +724,6 @@ export default {
} }
.act-box{ .act-box{
width: 710rpx; width: 710rpx;
height: 146rpx;
background: #fff; background: #fff;
border-radius: 30rpx; border-radius: 30rpx;
} }