Commit 2c22a0d0 authored by zhengke's avatar zhengke

修改

parent 3bbb9234
...@@ -559,6 +559,12 @@ ...@@ -559,6 +559,12 @@
"path": "allorderdetails" //统一订单详情 "path": "allorderdetails" //统一订单详情
}, { }, {
"path": "paysuccess" //支付成功页面 "path": "paysuccess" //支付成功页面
},{
"path":"jz_Activity" //活动
},{
"path":"jz_ActivityList" //活动列表
},{
"path":"jz_ActiveInfo" //活动详情
}] }]
}, },
......
<style>
.jz_SureOrder {
position: relative;
}
.jz_SureTop {
width: 100%;
box-shadow: 0px 2px 15px 0px rgba(76, 76, 76, 0.13);
background-color: #fff;
border-bottom-left-radius: 60rpx;
border-bottom-right-radius: 60rpx;
padding: 40rpx;
}
.jz_SureDfk {
color: #111111;
font-size: 40rpx;
font-weight: bold;
margin-left: 26rpx;
}
.jz_SureContent {
width: 90%;
margin: auto;
min-height: 100px;
}
.jz_SureCommodity {
padding: 30rpx 0;
display: flex;
border-bottom: 1px solid #e6e6e6;
}
.jzSureMoney {
color: #333333;
font-weight: bold;
font-size: 20rpx;
}
.jz_SuOrder_img {
width: 100rpx;
height: 100rpx;
border-radius: 20rpx;
overflow: hidden;
flex-shrink: 0;
}
.jz_SuOrder_img img {
width: 100%;
height: 100%;
}
.jz_OrderNum {
color: #8f8f90;
font-size: 24rpx;
margin-right: 50rpx;
}
.jz_GoodName {
color: #333333;
font-size: 28rpx;
width: 70%;
margin-left: 15px;
font-weight: bold;
}
.jz_OrderBold {
color: #08090e;
font-weight: bold;
}
.jz_PayDiv {
position: absolute;
width: 90%;
margin: auto;
bottom: 30rpx;
display: flex;
justify-content: space-between;
}
.jz_CancleBtn {
width: 310rpx;
height: 80rpx;
border: 1px solid #111111;
border-radius: 16rpx;
color: #111111;
font-weight: bold;
text-align: center;
line-height: 80rpx;
font-size: 28rpx;
}
.jz_Reserve {
padding-bottom: 120rpx;
}
.jz_ReserTop {
width: 100%;
min-height: 300rpx;
box-shadow: 0px 2px 15px 0px rgba(76, 76, 76, 0.13);
background-color: #fff;
border-bottom-left-radius: 60rpx;
border-bottom-right-radius: 60rpx;
padding: 40rpx;
}
.jz_ReserTitle {
color: #111111;
font-weight: 600;
font-size: 36rpx;
}
.jz_ReserIn {
color: #111;
font-size: 24rpx;
font-weight: 500;
}
.jz_ReseQue {
color: #dfbe6e;
font-size: 24rpx;
padding-top: 30rpx;
border-top: 1px solid #e7e7e7;
margin-top: 20px;
}
.jz_ReseQue img {
width: 16px;
height: 14px;
position: relative;
top: 2px;
margin-right: 5px;
}
.jz_ReseOrder {
padding: 40rpx;
}
.jz_ReDix {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.jz_RedixTitle {
width: 90px;
flex-shrink: 0;
}
/* .jz_OrderDiv {
position: fixed;
width: 90%;
height: 100rpx;
background-color: #fff;
margin: auto;
bottom: 20px;
padding: 20rpx;
left: 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0px 10px 30px 0px rgba(36, 36, 36, 0.2);
border-radius: 16px;
z-index: 999;
} */
.jz_orderbox {
position: fixed;
background-color: #fff;
bottom: 0;
width: 100vw;
left: 0;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0px 0rpx 50rpx 0px rgba(76, 76, 76, 0.13);
z-index: 99;
justify-content: flex-end;
padding: 20rpx 30rpx;
}
.jz_OrderDiv {
width: 90%;
height: 100rpx;
background-color: #fff;
margin: auto;
padding: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0px 10rpx 30rpx 0px rgba(36, 36, 36, 0.2);
border-radius: 16px;
z-index: 999;
}
.jz_OrderReNow {
width: 170rpx;
height: 80rpx;
background-color: #111111;
text-align: center;
line-height: 80rpx;
color: #fff;
font-weight: 600;
font-size: 28rpx;
border-radius: 16rpx;
}
.jz_form {
margin-top: 60rpx;
padding: 0 45rpx;
}
.jz_form .form-items {
margin-bottom: 30rpx;
display: flex;
align-items: center;
padding-bottom: 30rpx;
border-bottom: 1px solid #f5f5f5;
font-size: 28px;
font-weight: 500;
}
.jz_form .form-items .label {
font-size: 28rpx;
font-weight: 600;
margin-right: 60rpx;
flex-shrink: 0;
}
.jz_form .form-items .val {
flex: 1;
}
.jz_ReserTop .o-timer {
height: 100rpx;
background: #ecf1f4;
border-radius: 20rpx;
padding: 0 40rpx;
margin-bottom: 30rpx;
}
.jz_ReserTop .o-timer .time-item {
font-size: 32rpx;
font-weight: 800;
}
/* .jz_ReserTop .o-timer .time-item:last-child{
text-align: right;
} */
.jz_ReserTop .o-timer .time-split {
font-size: 24rpx;
font-weight: 400;
text-align: center;
margin: 0 20rpx;
}
.jz_ReserTop .o-timer .update {
font-size: 24rpx;
font-weight: 400;
text-align: right;
color: #000;
display: flex;
align-items: center;
}
.jz_Reserve .flex {
display: flex;
align-items: center;
}
.jz_Reserve .big-title {
position: relative;
}
.jz_Reserve .big-title::before {
display: block;
width: 71rpx;
height: 12rpx;
background: #dfbe6e;
border-radius: 4rpx;
content: " ";
position: absolute;
left: 0;
bottom: 6rpx;
z-index: 1;
}
.jz_Reserve .big-title text {
font-size: 34rpx;
font-weight: bold;
color: #1f1f1f;
position: relative;
z-index: 2;
}
.jz_Reserve .empty-block {
height: 20rpx;
background: #ecf1f4;
}
.jz_form .form-items .val text {
border: none;
padding: 0;
margin: 0;
outline: none;
height: 38rpx;
line-height: 38rpx;
font-size: 28rpx;
font-weight: 500;
width: 100%;
}
.jz_Reserve .grey {
color: #6e6e6e !important;
}
.jz_Reserve .f12 {
font-size: 24rpx !important;
}
.jz_Reserve .f11 {
font-size: 22rpx !important;
}
.jz_Reserve .f14 {
font-size: 28rpx !important;
}
.jz_Reserve .regular {
font-weight: 500 !important;
}
.jz_Reserve .sheshi {
margin-top: 50rpx;
}
.jz_Reserve .sheshi .she-title {
font-size: 28rpx;
font-weight: 800;
}
.jz_Reserve .sheshi .she-content {
margin-top: 24rpx;
}
.jz_Reserve .sheshi .she-content text {
font-size: 24rpx;
font-weight: 500;
color: #4a4a4a;
line-height: 40rpx;
margin-right: 24rpx;
}
.jz_Reserve .jz_SureVal {
flex: 1;
font-size: 28rpx;
font-weight: 500;
width: 100%;
}
.jz_MyGuestList .label {
width: 115rpx;
}
.jz_MyGuestList {
margin-top: 40rpx;
}
</style>
<template>
<view class="jz_Reserve" v-if="orderData">
<view class="jz_ReserTop">
<view class="flex" style="margin-bottom: 30rpx">
<u-icon
customPrefix="iconfont"
name="icondaizhifu-"
size="52"
color="#DFBE6E"
v-if="orderStatus.code == 0"
></u-icon>
<u-icon
customPrefix="iconfont"
name="iconquxiao"
size="52"
color="#f26c6c"
v-if="orderStatus.code == -1"
></u-icon>
<u-icon
customPrefix="iconfont"
name="iconshenhezhong"
size="52"
color="#86d9a5"
v-if="orderStatus.code == -2"
></u-icon>
<u-icon
customPrefix="iconfont"
name="iconzhengchang"
size="52"
color="#111"
v-if="orderStatus.code == 1"
></u-icon>
<text
style="
margin-left: 26rpx;
font-size: 40rpx;
font-weight: 600;
color: #111;
"
>
{{ orderStatus.text }}
</text>
</view>
<view
style="margin-bottom: 30rpx"
v-if="
orderData.model.RejectRemark && orderData.model.RejectRemark != ''
"
>
<u-alert-tips
type="error"
title="订单取消失败"
:description="orderData.model.RejectRemark"
></u-alert-tips>
</view>
<view class="o-timer flex">
<view class="time-item"
>{{ getDate(orderData.model.StartDate) }}
{{ getWeek(orderData.model.StartDate) }}</view
>
<view class="time-split">
<view>{{ orderData.model.DayNum }}</view>
</view>
<view
class="time-item"
style="font-size: 26rpx; font-weight: 500; flex: 1"
>
<text v-if="orderData.model.ManNum > 0"
>{{ orderData.model.ManNum }}成人</text
>
<text v-if="orderData.model.ChirdNum > 0"
>{{ orderData.model.ChirdNum }}儿童</text
>
<text v-if="orderData.model.BabyNum > 0"
>{{ orderData.model.BabyNum }}婴儿</text
>
</view>
<view class="update">
<!-- <text style="margin-right: 8rpx;">修改</text>
<u-icon name="arrow" size="20" /> -->
</view>
</view>
<view class="jz_ReserTitle">
{{ orderData.model.Title }}
</view>
<view class="jz_ReserIn" style="margin: 33rpx 0 18rpx 0">
<!-- {{currentPriceInfo.startCityName}}出发 {{currentPriceInfo.startDate}} -->
{{ orderData.model.LtName }}
</view>
<view class="big-title" v-if="orderData.model.StartCityName">
<text>{{ orderData.model.StartCityName }}出发</text>
</view>
<view class="jz_ReseQue">
<img
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zuanshi.png"
/>即时确认:本产品付款后可快速确认,放心期待您的旅行
</view>
</view>
<view class="jz_form">
<view class="form-items">
<view class="label">订单编号</view>
<view class="jz_SureVal">
{{ orderData.model.OrderId }}
</view>
</view>
<view class="form-items">
<view class="label">下单日期</view>
<view class="jz_SureVal">
{{ orderData.model.CreateDate.replace("T", " ") }}
</view>
</view>
<view class="form-items">
<view class="label">下单日期</view>
<view class="jz_SureVal">
{{ orderData.model.CreateDate.replace("T", " ") }}
</view>
</view>
</view>
<view class="empty-block"></view>
<view
class="jz_form jz_MyGuestList"
v-for="(subItem, subIndex) in orderData.model.GuestList"
:key="subIndex"
>
<view style="margin: 10rpx 0 20rpx 0"> 游客{{ subIndex + 1 }} </view>
<view class="form-items">
<view class="label">游客姓名</view>
<view class="jz_SureVal">{{ subItem.SurName }}{{ subItem.Name }}</view>
</view>
<view class="form-items">
<view class="label">联系电话</view>
<view class="jz_SureVal">{{ subItem.MobilePhone }}</view>
</view>
<view class="form-items">
<view class="label">身份证</view>
<view class="jz_SureVal">{{ subItem.IdCard }}</view>
</view>
<view class="form-items">
<view class="label">学生</view>
<view class="jz_SureVal">
{{ subItem.IsHightSchool == 1 ? "是" : "否" }}
</view>
</view>
</view>
<view class="empty-block"></view>
<view class="jz_form" v-if="orderData.model.Remarks">
<view class="form-items" style="border-bottom: 0">
<view class="label">备注</view>
<view class="jz_SureVal">{{ orderData.model.Remarks }}</view>
</view>
</view>
<view class="empty-block"></view>
<view style="padding: 50rpx 40rpx">
<view class="big-title">
<text>费用明细</text>
</view>
<view class="jz_form" style="margin: 40rpx 0; padding: 0">
<view class="form-items">
<view class="label"> 在线支付 </view>
<view class="val f14 regular" style="text-align: right">
<text style="margin-right: 30rpx"
>{{ orderData.model.GuestNum }}</text
>
<text class="red">{{ orderData.model.PreferPrice }}</text>
</view>
</view>
<view class="form-items" style="border-bottom: none">
<view class="label"> 明细 </view>
</view>
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index">
<view style="flex: 1">
<text style="margin-right: 30rpx">成人</text>
</view>
<view style="text-align: right"
>{{ orderData.model.ManNum }}人 × ¥{{
orderData.model.Unit_Price
}}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="orderData.model.ChirdNeedBedNum > 0"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">儿童(占床)</text>
</view>
<view style="text-align: right"
>{{ orderData.model.ChirdNeedBedNum }}人 × ¥{{
orderData.model.Unit_Price +
(orderData.modelPrice.ChildNeedPrice
? orderData.modelPrice.ChildNeedPrice
: 0)
}}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="orderData.model.ChirdNum - orderData.model.ChirdNeedBedNum > 0"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">儿童(不占床)</text>
</view>
<view style="text-align: right"
>{{ orderData.model.ChirdNum - orderData.model.ChirdNeedBedNum }}
× ¥{{
orderData.model.Unit_Price -
(orderData.modelPrice.ChildNoNeedPrice
? orderData.modelPrice.ChildNoNeedPrice
: 0)
}}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="orderData.model.BabyNum > 0"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">婴儿</text>
</view>
<view style="text-align: right">
{{ orderData.model.BabyNum }}人 × ¥{{
orderData.modelPrice.BabyPrice
? orderData.modelPrice.BabyPrice
: 0
}}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="
orderData.model.ChirdNum > 0 &&
orderData.modelPrice.BabyChargePrice &&
orderData.modelPrice.BabyChargePrice > 0
"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">儿童(附加费)</text>
</view>
<view style="text-align: right">
{{ orderData.model.ChirdNum }}人 × ¥{{
orderData.modelPrice.BabyChargePrice
}}</view
>
</view>
</view>
</view>
<view class="empty-block"></view>
<view
style="padding: 50rpx 40rpx"
v-if="Refund > 0 && orderStatus.code == -1"
>
<view class="big-title">
<text>取消订单</text>
</view>
<view class="jz_form" style="margin: 40rpx 0; padding: 0">
<view class="form-items">
<view class="label"> 已退款总额 </view>
<view class="val f14 regular" style="text-align: right">
<text style="margin-right: 30rpx"
>{{ orderData.model.GuestNum }}</text
>
<text class="red">{{ orderData.model.PreferPrice }}</text>
</view>
</view>
</view>
</view>
<view class="jz_orderbox flex">
<view style="display: flex">
<view
class="jz_OrderReNow"
@click="goCancel"
style="background: #fff; color: #111; border: 1px solid #111"
v-if="showPayBtn"
>
<text v-if="!submitCancel">取消</text>
<u-loading v-if="submitCancel" size="32" color="#111"></u-loading>
</view>
<!-- 返回上一页 -->
<view
class="jz_OrderReNow"
@click="goback"
style="background: #fff; color: #111; border: 1px solid #111"
v-if="!showPayBtn"
>关闭
</view>
</view>
<view style="display: flex; margin-left: 30rpx">
<!-- #ifdef MP-WEIXIN -->
<button
class="jz_OrderReNow"
@click="goFukuan"
v-if="showPayBtn"
:disabled="submit"
>
立即支付
</button>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button
class="jz_OrderReNow"
@click="goZhifuAli"
v-if="showPayBtn"
:disabled="submit"
>
立即支付
</button>
<!-- #endif -->
</view>
</view>
<!-- #ifdef MP-ALIPAY -->
<subscribe-msg />
<!-- #endif -->
</view>
</template>
<script>
</script>
<script>
export default {
components: {},
data() {
return {
pageTitle: "订单详情",
msg: {
pageIndex: 1,
pageSize: 15,
MiniAppUserId: 0,
},
orderData: null,
orderStatus: {},
submit: false,
submitCancel: false,
showPayBtn: true,
};
},
created() {},
onLoad(option) {
if (option.orderData) {
this.orderData = JSON.parse(decodeURIComponent(option.orderData));
} else if (option.orderId) {
this.initOrderInfo(option.orderId);
}
},
methods: {
goback() {
uni.navigateBack({
delta: 1,
});
},
goCancel() {
if (this.submit || this.submitCancel) return;
//未付款-调用后台取消
if (this.orderData.model.OrderState == 2) {
this.apipost(
"sellorder_post_B2BRemoveOrder",
{
ID: this.orderData.model.OrderId,
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
uni.navigateTo({
url: "/pages/jiuzhai/jz_MyOrder",
});
}
},
(err) => {}
);
} else {
let msg = {
OrderId: this.orderData.model.OrderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
};
//已付款取消申请
this.apipost(
"sellorder_post_AppletUserCancelOrder",
msg,
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
uni.navigateTo({
url: "/pages/jiuzhai/jz_MyOrder",
});
} else {
}
},
null
);
}
},
getWeek(date) {
var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
return "周" + week;
},
getDate(date) {
if (date) {
let arr = date.split("-");
return arr[1] + "月" + arr[2] + "日";
}
},
initOrderInfo(orderId) {
let msg = {
ID: orderId,
IsGetGuest: 1,
};
this.apipost(
"sellorder_post_GetOrderEntity",
msg,
(res) => {
if (res.resultCode == 1) {
this.orderData = res.data;
this.formatStatus(
this.orderData.model.OrderState,
this.orderData.model.IsChargeLossOrders,
this.orderData.model.IsApplyForCancel
);
} else {
this.orderData = {
result: -1,
};
}
console.log(res);
},
(e) => {}
);
},
formatStatus(status, loss, isCancel) {
loss = loss ? loss : -1;
//1、已申请;!=1未申请
if (loss == 1 || status == 4) {
this.orderStatus.code = -1;
this.orderStatus.text = "已取消";
this.showPayBtn = false;
} else if (status == 2 && isCancel != 1) {
this.orderStatus.code = 0;
this.orderStatus.text = "待付款";
this.showPayBtn = true;
} else if (status == 2 && isCancel == 1) {
this.orderStatus.code = -2;
this.orderStatus.text = "审核中";
this.showPayBtn = false;
} else if (status == 1) {
this.orderStatus.code = 1;
this.orderStatus.text = "正常";
this.showPayBtn = false;
}
},
// #ifdef MP-WEIXIN
goFukuan() {
if (this.submit || this.submitCancel) return;
var that = this;
var tempObj = uni.getStorageSync("basedata")?.mall?.wechatmessage ?? [];
var tmplIds = [];
if (tempObj && tempObj.length > 0) {
tempObj.forEach((x) => {
if (x.Name == "下单成功提醒" || x.Name == "订单取消提醒") {
tmplIds.push(x.MessageId);
}
});
}
uni.requestSubscribeMessage({
tmplIds: tmplIds,
complete(res) {
that.goZhifu();
},
});
},
//支付
goZhifu() {
this.submit = true;
let url = "/api/WeChatPay/GetTravlePayInfo";
let GoodsName = this.orderData.model.Title;
GoodsName = GoodsName.slice(0, 10);
this.request2(
{
url: url,
data: {
OrderId: this.orderData.model.OrderId,
GoodsName: GoodsName,
OrderPayType: 1,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
let orderInfo = JSON.parse(res.data);
console.log(orderInfo);
this.goPay(orderInfo);
}
);
},
goPay(orderInfo) {
let that = this;
uni.requestPayment({
provider: "wxpay",
timeStamp: orderInfo.timeStamp,
nonceStr: orderInfo.nonceStr,
package: orderInfo.package,
signType: orderInfo.signType,
paySign: orderInfo.sign,
success: function (res) {
console.log("success", res);
uni.showToast({
title: "支付成功",
});
that.submit = false;
//todo
that.initOrderInfo(that.orderData.model.OrderId);
},
fail: function (err) {
console.log("fail:", err);
uni.showToast({
title: "支付失败",
icon: "none",
});
that.submit = false;
that.initOrderInfo(that.orderData.model.OrderId);
},
});
},
// #endif
// #ifdef MP-ALIPAY
//支付宝支付
goZhifuAli() {
this.submit = true;
let that = this;
uni.showLoading({
title: "支付中",
});
let url = "/api/WeChatPay/GetTravlePayInfo";
let GoodsName = this.orderData.model.Title;
this.request2(
{
url: url,
data: {
OrderId: this.orderData.model.OrderId,
GoodsName: GoodsName,
OrderPayType: 2,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
if (res.data) {
this.$utils.SubscribeMsgAli(() => {
that.goPayAli(res.data);
});
} else {
uni.hideLoading();
uni.showToast({
title: "获取交易号失败",
duration: 2000,
});
}
}
);
},
goPayAli(tradeNO) {
let that = this;
my.tradePay({
tradeNO: tradeNO,
success: function (res) {
console.log("success", res);
const list = ["8000", "9000"];
if (list.includes(res.resultCode)) {
let obj = {
TradeNo: tradeNO,
OrderNo: that.orderData.model.OrderNo,
OrderId: that.orderData.model.OrderId,
preferPrice: that.orderData.model.PreferPrice,
};
that.payAliCallback(obj);
} else {
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
}
},
fail: function (err) {
console.log("fail:", err);
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
that.submit = false;
that.initOrderInfo(that.orderData.model.OrderId);
},
});
},
payAliCallback(obj) {
let that = this;
this.request2(
{
url: "/api/AliPay/ALiPayCallBackDmcNotify",
data: {
OrderNo: obj.OrderNo,
OrderId: obj.OrderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
TradeNo: obj.TradeNo,
ProjectType: 2,
PreferPrice: obj.preferPrice,
},
},
(res) => {
that.submit = false;
uni.redirectTo({
url:
"/pages/jiuzhai/paysuccess?PreferPrice=" +
obj.preferPrice +
"&isFrom=1",
});
uni.hideLoading();
},
(err) => {
console.log("err", err);
uni.hideLoading();
that.submit = false;
uni.showToast({
title: "支付失败",
icon: "none",
});
that.initOrderInfo(that.orderData.model.OrderId);
}
);
},
// #endif
},
};
</script>
<style>
.jz_Reserve {
padding-bottom: 180rpx;
background-color: #fff;
}
.jz_ReserTop {
width: 100%;
min-height: 300rpx;
box-shadow: 0px 2px 15px 0px rgba(76, 76, 76, 0.13);
background-color: #fff;
border-bottom-left-radius: 60rpx;
border-bottom-right-radius: 60rpx;
padding: 40rpx;
}
.jz_ReserTitle {
color: #111111;
font-weight: 600;
font-size: 36rpx;
}
.jz_ReserIn {
color: #111;
font-size: 24rpx;
font-weight: 500;
}
.jz_ReseQue {
color: #dfbe6e;
font-size: 24rpx;
padding-top: 30rpx;
border-top: 1px solid #e7e7e7;
margin-top: 20px;
}
.jz_ReseQue img {
width: 16px;
height: 14px;
position: relative;
top: 2px;
margin-right: 5px;
}
.jz_ReseOrder {
padding: 40rpx;
}
.jz_ReDix {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.jz_RedixTitle {
width: 90px;
flex-shrink: 0;
}
/* .jz_OrderDiv {
position: fixed;
width: 90%;
height: 100rpx;
background-color: #fff;
margin: auto;
bottom: 20px;
padding: 20rpx;
left: 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0px 10px 30px 0px rgba(36, 36, 36, 0.2);
border-radius: 16px;
z-index: 999;
} */
.jz_orderbox {
height: 160rpx;
position: fixed;
background-color: #fff;
bottom: 0;
width: 100vw;
left: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 99;
}
.jz_OrderDiv {
width: 90%;
height: 100rpx;
background-color: #fff;
margin: auto;
padding: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0px 10rpx 30rpx 0px rgba(36, 36, 36, 0.2);
border-radius: 16px;
z-index: 999;
}
.jz_OrderReNow {
/* #ifdef MP-ALIPAY */
width: 150rpx;
/* #endif */
height: 80rpx;
background-color: #111111;
text-align: center;
line-height: 80rpx;
color: #fff;
font-weight: 600;
font-size: 28rpx;
border-radius: 16rpx;
}
.jz_form {
margin-top: 60rpx;
padding: 0 45rpx;
}
.jz_form .form-items {
margin-bottom: 20rpx;
display: flex;
align-items: center;
padding-bottom: 20rpx;
border-bottom: 1px solid #f5f5f5;
font-size: 28px;
font-weight: 500;
}
.jz_form .form-items:last-child {
border-bottom: none;
}
.jz_form .form-items .label {
font-size: 28rpx;
font-weight: 600;
margin-right: 60rpx;
flex-shrink: 0;
width: 115rpx;
}
.jz_form .form-items .val {
flex: 1;
}
.jz_ReserTop .o-timer {
height: 100rpx;
background: #ecf1f4;
border-radius: 20rpx;
padding: 0 40rpx;
margin-bottom: 30rpx;
}
.jz_ReserTop .o-timer .time-item {
font-size: 32rpx;
font-weight: 800;
}
/* .jz_ReserTop .o-timer .time-item:last-child{
text-align: right;
} */
.jz_ReserTop .o-timer .time-split {
font-size: 24rpx;
font-weight: 400;
text-align: center;
margin: 0 20rpx;
}
.jz_ReserTop .o-timer .update {
font-size: 24rpx;
font-weight: 400;
text-align: right;
color: #000;
display: flex;
align-items: center;
}
.jz_Reserve .flex {
display: flex;
align-items: center;
}
.jz_Reserve .big-title {
position: relative;
}
.jz_Reserve .big-title::before {
display: block;
width: 71rpx;
height: 12rpx;
background: #dfbe6e;
border-radius: 4rpx;
content: " ";
position: absolute;
left: 0;
bottom: 6rpx;
z-index: 1;
}
.jz_Reserve .big-title text {
font-size: 34rpx;
font-weight: bold;
color: #1f1f1f;
position: relative;
z-index: 2;
}
.jz_Reserve .empty-block {
height: 20rpx;
background: #ecf1f4;
}
.jz_form .form-items .val input {
border: none;
padding: 0;
margin: 0;
outline: none;
height: 38rpx;
line-height: 38rpx;
font-size: 28rpx;
font-weight: 500;
width: 100%;
}
.jz_Reserve .grey {
color: #6e6e6e !important;
}
.jz_Reserve .f12 {
font-size: 24rpx !important;
}
.jz_Reserve .f11 {
font-size: 22rpx !important;
}
.jz_Reserve .f14 {
font-size: 28rpx !important;
}
.jz_Reserve .regular {
font-weight: 500 !important;
}
.jz_Reserve .sheshi {
margin-top: 50rpx;
}
.jz_Reserve .sheshi .she-title {
font-size: 28rpx;
font-weight: 800;
}
.jz_Reserve .sheshi .she-content {
margin-top: 24rpx;
}
.jz_Reserve .sheshi .she-content text {
font-size: 24rpx;
font-weight: 500;
color: #4a4a4a;
line-height: 40rpx;
margin-right: 24rpx;
}
.jz_GuestList {
box-shadow: 0px 2px 15px 0px rgba(76, 76, 76, 0.13);
padding: 20rpx;
margin: 25rpx;
border-radius: 25rpx;
}
.jz_GuestList .form-items:last-child {
margin-bottom: 0;
padding-bottom: 0;
}
.jz_TextArea {
height: 50px;
margin-bottom: 10px;
width: auto;
border: 1px solid #dfddd8;
border-radius: 4px;
margin: 25rpx;
padding: 20rpx;
}
</style>
<template>
<view class="jz_Reserve">
<view class="jz_ReserTop">
<view class="o-timer flex">
<view class="time-item"
>{{ getDate(currentPriceInfo.startDate) }}
{{ getWeek(currentPriceInfo.startDate) }}</view
>
<view class="time-split">
<view>{{ currentPriceInfo.dayNum }}</view>
</view>
<view
class="time-item"
style="font-size: 26rpx; font-weight: 500; flex: 1"
>
<text v-if="orderMsg.ManNum > 0">{{ orderMsg.ManNum }}成人</text>
<text v-if="orderMsg.ChirdNoBedNum + orderMsg.ChirdNeedBedNum > 0"
>{{ orderMsg.ChirdNoBedNum + orderMsg.ChirdNeedBedNum }}儿童</text
>
<text v-if="orderMsg.BabyNum > 0">{{ orderMsg.BabyNum }}婴儿</text>
</view>
<view class="update" @click="updateUser">
<text style="margin-right: 8rpx">修改</text>
<u-icon name="arrow" size="20" />
</view>
</view>
<view class="jz_ReserTitle">
{{ currentPriceInfo.title }}
</view>
<view class="jz_ReserIn" style="margin: 33rpx 0 18rpx 0">
<!-- {{currentPriceInfo.startCityName}}出发 {{currentPriceInfo.startDate}} -->
{{ ltName }}
</view>
<view class="big-title">
<text>{{ startCityName }}出发</text>
</view>
<view class="jz_ReseQue">
<img
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zuanshi.png"
/>即时确认:本产品付款后可快速确认,放心期待您的旅行
</view>
</view>
<view
class="jz_form jz_GuestList"
v-for="(subItem, subIndex) in GuestList"
:key="subIndex"
>
<view style="margin: 10rpx 0 15rpx 0"> 游客{{ subIndex + 1 }} </view>
<view class="form-items">
<view class="label">游客姓名</view>
<view class="val">
<input
type="text"
:key="subIndex"
v-model="subItem.SurName"
placeholder="请输入游客姓名"
/>
</view>
</view>
<view class="form-items">
<view class="label">联系电话</view>
<view class="val">
<input
type="number"
v-model="subItem.MobilePhone"
placeholder="请输入联系电话"
/>
</view>
</view>
<view class="form-items">
<view class="label">身份证</view>
<view class="val">
<input
type="number"
v-model="subItem.IdCard"
placeholder="请输入身份证号"
/>
</view>
</view>
<view class="form-items" style="margin-top: -5px">
<view class="label">学生</view>
<view class="val">
<!-- <checkbox-group @change="changecheckbox($event, subIndex, subItem)">
<checkbox
:value="subItem.IsHightSchool"
:checked="subItem.IsHightSchool"
/>
</checkbox-group> -->
<u-switch
v-model="subItem.IsHightSchool"
size="30"
active-value="1"
inactive-value="2"
></u-switch>
</view>
</view>
</view>
<view>
<textarea
class="jz_TextArea"
placeholder="请输入备注信息"
v-model="Remarks"
/>
</view>
<view class="empty-block"></view>
<!-- <view class="jz_ReseOrder">
<view class="jz_ReDix">
<view class="jz_RedixTitle">成人:</view>
<u-number-box v-model="orderMsg.ManNum" :input-width="300" :input-height="60" @change="changeMan()"></u-number-box>
</view>
<view class="jz_ReDix">
<view class="jz_RedixTitle">儿童不占床:</view>
<u-number-box v-model="orderMsg.ChirdNoBedNum" :input-width="300" :input-height="60" @change="changeChirdNoBedNum()"></u-number-box>
</view>
<view class="jz_ReDix">
<view class="jz_RedixTitle">儿童占床:</view>
<u-number-box v-model="orderMsg.ChirdNeedBedNum" :input-width="300" :input-height="60" @change="changeChirdNeedBedNum()"></u-number-box>
</view>
<view class="jz_ReDix">
<view class="jz_RedixTitle">婴儿:</view>
<u-number-box v-model="orderMsg.BabyNum" :input-width="300" :input-height="60" @change="changeBabyNum()"></u-number-box>
</view>
</view> -->
<view style="padding: 50rpx 40rpx">
<view class="big-title">
<text>费用明细</text>
</view>
<view class="jz_form" style="margin: 40rpx 0; padding: 0">
<view class="form-items">
<view class="label"> 在线支付 </view>
<view class="val f14 regular" style="text-align: right">
<text style="margin-right: 30rpx">{{ total }}</text>
<text class="red">{{ price }}</text>
</view>
</view>
<view class="form-items" style="border-bottom: none">
<view class="label"> 明细 </view>
</view>
<view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index">
<view style="flex: 1">
<text style="margin-right: 30rpx">成人</text>
</view>
<view style="text-align: right"
>{{ orderMsg.ManNum }}人 × ¥{{ currentPriceInfo.b2CPrice }}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="orderMsg.ChirdNeedBedNum > 0"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">儿童(占床)</text>
</view>
<view style="text-align: right"
>{{ orderMsg.ChirdNeedBedNum }}人 × ¥{{
($utils.getretailer()
? currentPriceInfo.b2BPrice
: currentPriceInfo.b2CPrice) +
(currentPriceInfo.childNeedPrice
? currentPriceInfo.childNeedPrice
: 0)
}}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="orderMsg.ChirdNoBedNum > 0"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">儿童(不占床)</text>
</view>
<view style="text-align: right"
>{{ orderMsg.ChirdNoBedNum }}人 × ¥{{
($utils.getretailer()
? currentPriceInfo.b2BPrice
: currentPriceInfo.b2CPrice) -
(currentPriceInfo.childNoNeedPrice
? currentPriceInfo.childNoNeedPrice
: 0)
}}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="orderMsg.BabyNum > 0"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">婴儿</text>
</view>
<view style="text-align: right">
{{ orderMsg.BabyNum }}人 × ¥{{
currentPriceInfo.babyPrice ? currentPriceInfo.babyPrice : 0
}}</view
>
</view>
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="
orderMsg.ChirdNum > 0 &&
currentPriceInfo.babyChargePrice &&
currentPriceInfo.babyChargePrice > 0
"
>
<view style="flex: 1">
<text style="margin-right: 30rpx">儿童(附加费)</text>
</view>
<view style="text-align: right">
{{ orderMsg.ChirdNum }}人 × ¥{{
currentPriceInfo.babyChargePrice
}}</view
>
</view>
</view>
</view>
<view class="empty-block"></view>
<view style="padding: 50rpx 40rpx" v-if="tips != ''">
<view class="big-title">
<text>重要提醒</text>
</view>
<view class="sheshi">
<view class="she-content">
<text>{{ tips }}</text>
</view>
</view>
</view>
<view class="jz_orderbox">
<view class="jz_OrderDiv">
<view style="color: #ff3166; font-weight: bold">
<text style="font-size: 22rpx">¥</text>
<text style="font-size: 40rpx; margin: 0 20rpx 0 5rpx">{{
price
}}</text>
<text style="color: #6e6e6e; font-size: 24rpx"
>共计{{ total }}</text
>
</view>
<view style="display: flex; margin-top: -2px">
<button
class="jz_OrderReNow"
@click="goPay()"
:disabled="submit"
:loading="submit"
>
立即支付
</button>
</view>
</view>
</view>
<!-- #ifdef MP-ALIPAY -->
<subscribe-msg />
<!-- #endif -->
</view>
</template>
<script>
export default {
components: {},
data() {
return {
submit: false,
pageTitle: "订单填写",
orderMsg: {
ManNum: 0, //成人
ChirdNoBedNum: 0, //儿童不占床
ChirdNeedBedNum: 0, //儿童占床
BabyNum: 0, //婴儿
ChirdNum: 0, //儿童数量
},
price: 0,
currentPriceInfo: {},
total: 0,
YSeatNum: 0,
ESeatNum: 0,
FSeatNum: 0,
sumSeat: 0,
userInfo: {},
ltName: "",
tips: "",
contactMobile: "",
contactName: "",
orderInfo: {},
orderData: "",
Remarks: "", //备注
GuestList: [],
startCityName:''
};
},
created() {
uni.setNavigationBarTitle({
title: "订单支付预览",
});
},
onLoad(option) {
// if (option.seat) {
// this.currentPriceInfo = JSON.parse(
// decodeURIComponent(option.currentPriceInfo)
// );
// this.calcMoney();
// }
console.log(option,'option');
if (option.tcid) {
this.getDetails(option.tcid);
}
},
methods: {
changecheckbox(e, index, item) {
if (item.IsHightSchool) {
let newObj = JSON.parse(JSON.stringify(item));
newObj.IsHightSchool = false;
this.$set(this.GuestList, index, newObj);
} else {
let newObj = JSON.parse(JSON.stringify(item));
newObj.IsHightSchool = true;
this.$set(this.GuestList, index, newObj);
}
},
//获取详情
getDetails(id) {
this.apipost(
"b2b_get_GetB2BTravelInfoNoDesV1",
{ tcid: id },
(res) => {
console.log(res,'数据');
if (res.resultCode == 1) {
this.tips = res.data.feature.importantTipText;
this.ltName = res.data.ltName;
this.currentPriceInfo = res.data.currentPriceInfo;
this.startCityName = res.data.startCityName;
}
},
null
);
},
updateUser() {
uni.navigateBack({
delta: 1,
});
},
getWeek(date) {
var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
return "周" + week;
},
getDate(date) {
if (date) {
let arr = date.split("-");
return arr[1] + "月" + arr[2] + "日";
}
},
//改变成人
changeMan(e) {
this.orderMsg.ManNum = e.value;
this.calcMoney();
},
//改变儿童不占床
changeChirdNoBedNum(e) {
this.orderMsg.ChirdNoBedNum = e.value;
this.calcMoney();
},
//改变儿童占床
changeChirdNeedBedNum(e) {
this.orderMsg.ChirdNeedBedNum = e.value;
this.calcMoney();
},
//改变婴儿
changeBabyNum(e) {
this.orderMsg.BabyNum = e.value;
this.calcMoney();
},
//计算价格
calcMoney() {
var price = 0;
// if (this.$utils.getretailer()) {
// price = this.currentPriceInfo.b2BPrice;
// } else {
// price = this.currentPriceInfo.b2CPrice;
// }
price = this.currentPriceInfo.b2CPrice;
this.orderMsg.ChirdNum =
parseInt(this.orderMsg.ChirdNoBedNum) +
parseInt(this.orderMsg.ChirdNeedBedNum);
//计算总人数
this.total =
parseInt(this.orderMsg.ManNum) + parseInt(this.orderMsg.ChirdNum);
this.sumSeat = this.total;
let money = price * this.orderMsg.ManNum;
money += price * this.orderMsg.ChirdNum;
money +=
(this.currentPriceInfo.babyChargePrice
? this.currentPriceInfo.babyChargePrice
: 0) * this.orderMsg.ChirdNum;
money +=
(this.currentPriceInfo.babyPrice
? this.currentPriceInfo.babyPrice
: 0) * this.orderMsg.BabyNum;
money +=
(this.currentPriceInfo.childNeedPrice
? this.currentPriceInfo.childNeedPrice
: 0) * this.orderMsg.ChirdNeedBedNum;
if (this.orderMsg.ChirdNoBedNum > 0) {
money -=
(this.currentPriceInfo.childNoNeedPrice
? this.currentPriceInfo.childNoNeedPrice
: 0) * this.orderMsg.ChirdNoBedNum;
}
this.price = money;
//根据总人数 生成旅客信息
for (var i = 0; i < this.total; i++) {
let obj = {
Id: 0,
SurName: "", //姓
Name: "", //名
IdCard: "", //身份证
MobilePhone: "", //联系电话
IsHightSchool: false, //是否高校学生1 是 2否
};
this.GuestList.push(obj);
}
},
//去支付
goPay() {
for (var i = 0; i < this.GuestList.length; i++) {
if (this.GuestList[i].SurName == "") {
uni.showToast({
title: `请输入游客${i + 1}的姓名`,
icon: "none",
});
return;
}
if (this.GuestList[i].IdCard == "") {
uni.showToast({
title: `请输入游客${i + 1}的身份证`,
icon: "none",
});
return;
}
if (this.GuestList[i].MobilePhone == "") {
uni.showToast({
title: `请输入游客${i + 1}的联系电话`,
icon: "none",
});
return;
}
}
this.submit = true;
this.userInfo = uni.getStorageSync("mall_UserInfo");
this.basedataObj = uni.getStorageSync("basedata").mall;
var CustomerId = this.basedataObj.virtualB2BCustomerId;
let newobj = JSON.parse(JSON.stringify(this.GuestList));
newobj.forEach((x) => {
if (x.IsHightSchool) {
x.IsHightSchool = 1;
} else {
x.IsHightSchool = 2;
}
});
var ContactName = this.contactName;
var ContactMobile = this.contactMobile;
var CustomerType = 4;
var price = this.currentPriceInfo.b2CPrice;
let msg = {
OrderId: 0,
TCID: this.currentPriceInfo.tcid,
CustomerType: CustomerType,
GroupType: 6,
ContactName: ContactName,
ContactMobile: ContactMobile,
CustomerId: CustomerId,
DepartureCityId: 262,
IsIntermodal: 2,
Unit_Price: price,
TC_Price: price,
ManNum: this.orderMsg.ManNum,
ChirdNum: this.orderMsg.ChirdNum,
ChirdNeedBedNum: this.orderMsg.ChirdNeedBedNum,
BabyNum: this.orderMsg.BabyNum,
OldPeopleNum: 0,
SingleRoomNum: 0,
PreferPrice: this.price,
YSeatNum: this.total,
ESeatNum: 0,
FSeatNum: 0,
Commission: 0, //todo 提成
ClientSource: 2,
BrandId: 0,
TradeWay: 0,
PlatformOrder: "",
GuestNum:
parseInt(this.orderMsg.ManNum) +
parseInt(this.orderMsg.ChirdNum) +
parseInt(this.orderMsg.BabyNum),
IsChildrenTour: this.currentPriceInfo.isSupportChildren,
IsBirdDiscount: this.zaoniao > 0 ? 1 : 2,
PredictRoomNum: 1,
BigRoomNum: 0,
TripleRoomNum: 0,
TradeDate: this.currentPriceInfo.startDate,
CostType: 0,
MinOrderPrice: 0,
Remarks: "",
VisaNum: this.orderMsg.ManNum + this.orderMsg.ChirdNum,
SafeNum: this.orderMsg.ManNum + this.orderMsg.ChirdNum,
AirticketNum: 0,
ReturnArriveCityId: 262,
IsReturnIntermodal: 2,
GoCityTime: "",
BackCityTime: "",
ScenicRefundArr: [],
CommissionSharePeople: 0,
CommissionShareMoney: 0,
// #ifdef MP-WEIXIN
OrderSource: 5,
// #endif
// #ifdef MP-ALIPAY
OrderSource: 6,
// #endif
MiniAppUserId: this.userInfo.UserId,
Remarks: this.Remarks, //备注
GuestList: newobj,
};
this.apipost(
"sellorder_post_SetOrderInfoForB2B",
msg,
(res) => {
if (res.resultCode == 1) {
let data = res.data;
data.CoverImg = this.currentPriceInfo.CoverImg;
let myData = JSON.stringify(data);
this.orderData = encodeURIComponent(myData);
// #ifdef MP-WEIXIN
this.queren(data.OrderId);
// #endif
// #ifdef MP-ALIPAY
this.querenAli(data);
// #endif
} else {
}
this.submit = false;
},
(e) => {
this.submit = false;
}
);
},
// #ifdef MP-WEIXIN
//微信支付
queren(OrderId) {
let url = "/api/WeChatPay/GetTravlePayInfo";
let GoodsName = this.currentPriceInfo.title;
GoodsName = GoodsName.slice(0, 10);
this.request2(
{
url: url,
data: {
OrderId: OrderId,
GoodsName: GoodsName,
OrderPayType: 1,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
this.orderInfo = JSON.parse(res.data);
// this.Pay(OrderId);
this.subscribeMsg(OrderId);
}
);
},
subscribeMsg(OrderId) {
const that = this;
let tempObj = uni.getStorageSync("basedata")?.mall?.wechatmessage ?? [];
let tmplIds = [];
if (tempObj && tempObj.length > 0) {
tempObj.forEach((x) => {
if (x.Name == "下单成功提醒" || x.Name == "订单取消提醒") {
tmplIds.push(x.MessageId);
}
});
}
uni.requestSubscribeMessage({
tmplIds: tmplIds,
complete(res) {
that.Pay(OrderId);
},
});
},
Pay(OrderId) {
let that = this;
uni.requestPayment({
provider: "wxpay",
timeStamp: this.orderInfo.timeStamp,
nonceStr: this.orderInfo.nonceStr,
package: this.orderInfo.package,
signType: this.orderInfo.signType,
paySign: this.orderInfo.sign,
success: function (res) {
console.log("success", res);
uni.showToast({
title: "支付成功",
});
setTimeout(() => {
uni.redirectTo({
url:
"/pages/jiuzhai/paysuccess?PreferPrice=" +
this.price +
"&isFrom=1",
});
}, 100);
},
fail: function (err) {
console.log("fail:", err);
uni.showToast({
title: "支付失败",
icon: "none",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/jz_SureOrder?orderId=" + OrderId,
});
}, 100);
},
});
},
// #endif
// #ifdef MP-ALIPAY
//支付宝支付
querenAli(data) {
let that = this;
uni.showLoading({
title: "支付中",
});
let url = "/api/WeChatPay/GetTravlePayInfo";
let GoodsName = this.currentPriceInfo.title;
this.request2(
{
url: url,
data: {
OrderId: data.OrderId,
GoodsName: GoodsName,
OrderPayType: 2,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
this.orderInfo = JSON.parse(res.data);
if (res.data) {
that.$utils.SubscribeMsgAli(() => {
that.PayAli(res.data, data);
});
} else {
uni.hideLoading();
uni.showToast({
title: "获取交易号失败",
duration: 2000,
});
}
}
);
},
PayAli(tradeNO, data) {
let that = this;
my.tradePay({
tradeNO: tradeNO,
success: function (res) {
console.log("success", res);
const list = ["8000", "9000"];
if (list.includes(res.resultCode)) {
let cbObj = {
TradeNo: tradeNO,
OrderNo: data.OrderNo,
OrderId: data.OrderId,
preferPrice: data.PreferPrice,
};
that.payAliCallback(cbObj);
} else {
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/jz_MyOrder",
});
}, 1000);
}
},
fail: function (err) {
console.log("fail:", err);
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/jz_MyOrder",
});
}, 1000);
},
});
},
payAliCallback(obj) {
this.request2(
{
url: "/api/AliPay/ALiPayCallBackDmcNotify",
data: {
OrderNo: obj.OrderNo,
OrderId: obj.OrderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
TradeNo: obj.TradeNo,
ProjectType: 2,
PreferPrice: obj.preferPrice,
},
},
(res) => {
console.log("cb", res);
this.submit = false;
uni.redirectTo({
url:
"/pages/jiuzhai/paysuccess?PreferPrice=" +
obj.preferPrice +
"&isFrom=1",
});
uni.hideLoading();
},
(err) => {
this.submit = false;
console.log("cb2", err);
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
setTimeout(() => {
uni.redirectTo({
url: "/pages/jiuzhai/jz_MyOrder",
});
}, 1000);
}
);
},
// #endif
},
};
</script>
<style>
.jz_MyOrder {
height: 100vh;
background-color: #ecf1f4;
}
.jz_OrderList {
width: 100%;
min-height: 334rpx;
background-color: #fff;
border-radius: 20px;
padding: 30px;
margin-bottom: 15px;
position: relative;
}
.jz_OrderList:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.jz_OrderTop {
display: flex;
align-items: center;
position: relative;
padding-bottom: 27rpx;
border-bottom: 1px solid #e6e6e6;
}
.jz_Oleft {
color: #111111;
font-size: 32rpx;
font-weight: bold;
width: 70%;
height: 40rpx;
overflow: hidden;
}
.jz-Oright {
color: #111111;
font-size: 24rpx;
position: absolute;
right: 0;
}
.jz_MyOrder_img {
width: 100rpx;
height: 100rpx;
margin-top: 20px;
border-radius: 20rpx;
overflow: hidden;
}
.jz_MyOrder_img img {
width: 100%;
height: 100%;
}
.jz_XiaDan {
margin-left: 25rpx;
color: #333333;
font-size: 24rpx;
margin-top: 20px;
}
.jz_Zailai {
background-color: #111111;
border-radius: 16px;
width: 150rpx;
height: 60rpx;
text-align: center;
color: #fff;
line-height: 60rpx;
font-size: 24rpx;
}
.isShowAll {
height: auto;
}
.jz_BtnContent {
margin-top: 15px;
right: 40rpx;
bottom: 20rpx;
display: flex;
justify-content: flex-end;
}
</style>
<template>
<view class="jz_MyOrder">
<u-tabs
:list="list"
:is-scroll="false"
:current="current"
:active-color="mainColor"
:show-bar="showBar"
@change="change"
bar-height="4"
height="100"
></u-tabs>
<u-empty v-if="dataList.length == 0" text="暂无数据" mode="data"></u-empty>
<template v-else>
<view
class="jz_MyOrderMain"
style="height: calc(100vh - 44px); overflow: hidden"
>
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
@scrolltolower="lower"
:style="{ height: '100%' }"
>
<view
class="jz_OrderList"
v-for="(item, index) in dataList"
:key="index"
@click="goOrderDetail(item)"
>
<view class="jz_OrderTop">
<view class="jz_Oleft" :class="{ isShowAll: !item.isShowHalf }">
{{ item.title }}
</view>
<view style="margin-left: 10px">
<u-icon
name="arrow-down"
@click.native.stop="getShow(item)"
v-if="item.isShowHalf"
color="#2979ff"
size="28"
></u-icon>
<u-icon
name="arrow-up"
@click.native.stop="getShow(item)"
v-else
color="#2979ff"
size="28"
></u-icon>
</view>
<view class="jz-Oright">
{{
item.orderStateName == "占位" ? "待付款" : item.orderStateName
}}
</view>
</view>
<view style="display: flex">
<view class="jz_MyOrder_img">
<img
mode="aspectFill"
:src="getFirstImg(item.imgCover)"
alt=""
/>
</view>
<view class="jz_XiaDan">
<view>下单时间:{{ item.createDate }}</view>
<view style="margin-top: 22rpx"
>付款总额:¥{{ item.preferPrice }}</view
>
</view>
</view>
<view
v-if="item.isApplyForCancel == 1"
style="color: red; font-size: 24rpx; margin-left: 122rpx"
>订单取消,正在确认中!</view
>
<view class="jz_BtnContent">
<view
class="jz_Zailai"
style="margin-right: 10rpx"
@click.stop="gojz_List"
>再来一单</view
>
<!-- #ifdef MP-WEIXIN -->
<!-- <view
v-if="item.orderState == 2"
class="jz_Zailai"
style="width: 110rpx; margin-right: 10rpx"
@click.stop="goZhifu(item)"
>付款</view
> -->
<button
v-if="item.orderState == 2"
class="jz_Zailai"
@click.stop="goZhifu(item)"
style="width: 110rpx; margin-right: 10rpx; margin-left: 0rpx"
>
付款
</button>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<view
v-if="item.orderState == 2"
class="jz_Zailai"
style="width: 110rpx; margin-right: 10rpx"
@click.stop="goZhifuAli(item)"
>付款</view
>
<!-- #endif -->
<view
v-if="item.isApplyForCancel != 1 && item.orderState != 4"
class="jz_Zailai"
style="width: 110rpx"
@click.stop="goCancel(item)"
>取消</view
>
</view>
</view>
</scroll-view>
</view>
</template>
<!-- #ifdef MP-ALIPAY -->
<subscribe-msg />
<!-- #endif -->
</view>
</template>
<script>
export default {
components: {},
data() {
return {
pageTitle: "线路订单",
msg: {
pageIndex: 1,
pageSize: 15,
MiniAppUserId: 0,
orderState: -1,
},
mainColor: "",
list: [
{
name: "全部",
Id: -1,
},
{
name: "待付款",
Id: 2,
},
{
name: "已完成",
Id: 1,
},
{
name: "已取消",
Id: 4,
},
],
current: 0,
dataList: [],
page_count: 0,
loadText: {
loadmore: "轻轻上拉,加载更多",
loading: "努力加载中",
nomore: "没有更多了",
},
status: "加载中",
price: 0,
showBar: true,
};
},
created() {
console.log(260, uni.getStorageSync("mall_UserInfo").OpenId);
// #ifdef MP-ALIPAY
this.showBar = false;
// #endif
this.getOrderInfo();
},
onLoad(option) {
this.current = option.status || 0;
this.mainColor = this.$uiConfig.mainColor;
let currentPages = getCurrentPages();
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
pages.forEach((x) => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
methods: {
goOrderDetail(item) {
console.log(item);
uni.redirectTo({
url: "/pages/jiuzhai/jz_SureOrder?orderId=" + item.orderId,
});
},
change(i) {
this.current = i;
this.msg.orderState = this.list[i].Id;
this.research();
},
//获取第一张图
getFirstImg(obj) {
if (obj) {
let objArr = JSON.parse(obj);
return objArr[0].Url;
}
},
getShow(item) {
item.isShowHalf = !item.isShowHalf;
this.$forceUpdate();
},
//跳转
gojz_List() {
uni.navigateTo({
url: "/pages/jiuzhai/jz_Line",
});
},
lower(e) {
if (this.msg.pageIndex < this.page_count) {
this.msg.pageIndex++;
this.status = "loading";
this.getOrderInfo();
} else {
this.status = "nomore";
}
},
research() {
this.msg.pageIndex = 1;
this.getOrderInfo(1);
},
getOrderInfo(type) {
uni.showLoading({
title: "加载中",
icon: "none",
});
if (type == 1) {
this.dataList = [];
}
this.userInfo = uni.getStorageSync("mall_UserInfo");
this.msg.MiniAppUserId = this.userInfo.UserId;
this.apipost(
"sellorder_post_GetMiniAppTravelOrderList",
this.msg,
(res) => {
uni.hideLoading();
if (res.resultCode == 1) {
console.log(res, "数据");
if (type == 1) {
this.dataList = res.data.pageData;
} else {
this.dataList = this.dataList.concat(res.data.pageData);
}
this.dataList.forEach((x) => {
x.isShowHalf = true;
});
this.page_count = res.data.pageCount;
} else {
}
},
null
);
},
//取消订单
goCancel(item) {
//未付款-调用后台取消
if (
(item.paymentTime == null || item.paymentTime == "") &&
item.orderState == 2
) {
this.apipost(
"sellorder_post_B2BRemoveOrder",
{
ID: item.orderId,
},
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
this.research();
}
},
(err) => {}
);
} else {
let msg = {
OrderId: item.orderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
};
//已付款取消申请
this.apipost(
"sellorder_post_AppletUserCancelOrder",
msg,
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
this.research();
} else {
}
},
null
);
}
},
//付款
// #ifdef MP-WEIXIN
goZhifu(item) {
console.log(item, "item");
let url = "/api/WeChatPay/GetTravlePayInfo";
let GoodsName = item.title;
GoodsName = GoodsName.slice(0, 10);
this.price = item.preferPrice;
this.request2(
{
url: url,
data: {
OrderId: item.orderId,
GoodsName: GoodsName,
OrderPayType: 1,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
let orderInfo = JSON.parse(res.data);
// this.goPay(orderInfo);
this.subscribeMsg(orderInfo);
}
);
},
subscribeMsg(orderInfo) {
const that = this;
let tempObj = uni.getStorageSync("basedata")?.mall?.wechatmessage ?? [];
let tmplIds = [];
if (tempObj && tempObj.length > 0) {
tempObj.forEach((x) => {
if (x.Name == "下单成功提醒" || x.Name == "订单取消提醒") {
tmplIds.push(x.MessageId);
}
});
}
uni.requestSubscribeMessage({
tmplIds: tmplIds,
complete(res) {
that.goPay(orderInfo);
},
});
},
goPay(orderInfo) {
let that = this;
uni.requestPayment({
provider: "wxpay",
timeStamp: orderInfo.timeStamp,
nonceStr: orderInfo.nonceStr,
package: orderInfo.package,
signType: orderInfo.signType,
paySign: orderInfo.sign,
success: function (res) {
console.log("success", res);
uni.showToast({
title: "支付成功",
});
//todo
uni.redirectTo({
url:
"/pages/jiuzhai/paysuccess?PreferPrice=" +
that.price +
"&isFrom=1",
});
},
fail: function (err) {
console.log("fail:", err);
uni.showToast({
title: "支付失败",
});
},
});
},
// #endif
// #ifdef MP-ALIPAY
goZhifuAli(item) {
let that = this;
uni.showLoading({
title: "支付中",
});
console.log(item, "item");
let url = "/api/WeChatPay/GetTravlePayInfo";
this.price = item.preferPrice;
this.request2(
{
url: url,
data: {
OrderId: item.orderId,
GoodsName: item.title,
OrderPayType: 2,
OpenId: uni.getStorageSync("mall_UserInfo").OpenId,
},
},
(res) => {
if (res.data) {
this.$utils.SubscribeMsgAli(() => {
console.log(477, that.goPayAli);
that.goPayAli(res.data, item);
});
} else {
uni.hideLoading();
uni.showToast({
title: "获取交易号失败",
duration: 2000,
});
}
}
);
},
goPayAli(tradeNO, item) {
let that = this;
my.tradePay({
tradeNO: tradeNO,
success: function (res) {
console.log("success", res);
const list = ["8000", "9000"];
if (list.includes(res.resultCode)) {
let obj = {
TradeNo: tradeNO,
OrderNo: item.orderNo,
OrderId: item.orderId,
preferPrice: item.preferPrice,
};
that.payAliCallback(obj);
} else {
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
}
},
fail: function (err) {
console.log("fail:", err);
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
},
});
},
payAliCallback(obj) {
this.request2(
{
url: "/api/AliPay/ALiPayCallBackDmcNotify",
data: {
OrderNo: obj.OrderNo,
OrderId: obj.OrderId,
UserId: uni.getStorageSync("mall_UserInfo").UserId,
TradeNo: obj.TradeNo,
ProjectType: 2,
PreferPrice: obj.preferPrice,
},
},
(res) => {
console.log("cb", res);
uni.redirectTo({
url:
"/pages/jiuzhai/paysuccess?PreferPrice=" +
obj.preferPrice +
"&isFrom=1",
});
uni.hideLoading();
},
(err) => {
console.log("cb2", err);
uni.hideLoading();
uni.showToast({
title: "支付失败",
icon: "none",
});
}
);
},
// #endif
},
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment