Commit 8a6c0bca authored by 黄奎's avatar 黄奎

11

parent 839cd538
...@@ -443,7 +443,7 @@ ...@@ -443,7 +443,7 @@
</view> </view>
<view style="display: flex; margin-top: -2px"> <view style="display: flex; margin-top: -2px">
<button class="jz_OrderReNow" @click="goPay()" :disabled="submit" :loading="submit"> <button class="jz_OrderReNow" @click="goPay()" :disabled="submit" :loading="submit">
立即支付 立即预定
</button> </button>
</view> </view>
</view> </view>
......
<style> <style>
.jz_SureOrder { .jz_SureOrder {
position: relative; position: relative;
} }
.jz_SureTop { .jz_SureTop {
...@@ -329,660 +329,559 @@ ...@@ -329,660 +329,559 @@
} }
</style> </style>
<template> <template>
<view class="jz_Reserve" v-if="orderData"> <view class="jz_Reserve" v-if="orderData">
<view class="jz_ReserTop"> <view class="jz_ReserTop">
<view class="flex" style="margin-bottom: 30rpx"> <view class="flex" style="margin-bottom: 30rpx">
<u-icon <u-icon customPrefix="iconfont" name="icondaizhifu-" size="52" color="#DFBE6E" v-if="orderStatus.code == 0"></u-icon>
customPrefix="iconfont" <u-icon customPrefix="iconfont" name="iconquxiao" size="52" color="#f26c6c" v-if="orderStatus.code == -1"></u-icon>
name="icondaizhifu-" <u-icon customPrefix="iconfont" name="iconshenhezhong" size="52" color="#86d9a5" v-if="orderStatus.code == -2"></u-icon>
size="52" <u-icon customPrefix="iconfont" name="iconzhengchang" size="52" color="#111" v-if="orderStatus.code == 1"></u-icon>
color="#DFBE6E" <text style="
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; margin-left: 26rpx;
font-size: 40rpx; font-size: 40rpx;
font-weight: 600; font-weight: 600;
color: #111; color: #111;
" ">
> {{ orderStatus.text }}
{{ orderStatus.text }} </text>
</text> </view>
</view> <view style="margin-bottom: 30rpx" v-if="
<view
style="margin-bottom: 30rpx"
v-if="
orderData.model.RejectRemark && orderData.model.RejectRemark != '' orderData.model.RejectRemark && orderData.model.RejectRemark != ''
" ">
> <u-alert-tips type="error" title="订单取消失败" :description="orderData.model.RejectRemark"></u-alert-tips>
<u-alert-tips </view>
type="error" <view class="o-timer flex">
title="订单取消失败" <view class="time-item">{{ getDate(orderData.model.StartDate) }}
:description="orderData.model.RejectRemark" {{ getWeek(orderData.model.StartDate) }}</view>
></u-alert-tips> <view class="time-split">
</view> <view>{{ orderData.model.DayNum }}</view>
<view class="o-timer flex"> </view>
<view class="time-item" <view class="time-item" style="font-size: 26rpx; font-weight: 500; flex: 1">
>{{ getDate(orderData.model.StartDate) }} <text v-if="orderData.model.ManNum > 0">{{ orderData.model.ManNum }}成人</text>
{{ getWeek(orderData.model.StartDate) }}</view <text v-if="orderData.model.ChirdNum > 0">{{ orderData.model.ChirdNum }}儿童</text>
> <text v-if="orderData.model.BabyNum > 0">{{ orderData.model.BabyNum }}婴儿</text>
<view class="time-split"> </view>
<view>{{ orderData.model.DayNum }}</view> <view class="update">
</view> <!-- <text style="margin-right: 8rpx;">修改</text>
<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" /> --> <u-icon name="arrow" size="20" /> -->
</view> </view>
</view> </view>
<view class="jz_ReserTitle"> <view class="jz_ReserTitle">
{{ orderData.model.Title }} {{ orderData.model.Title }}
</view> </view>
<view class="jz_ReserIn" style="margin: 33rpx 0 18rpx 0"> <view class="jz_ReserIn" style="margin: 33rpx 0 18rpx 0">
<!-- {{currentPriceInfo.startCityName}}出发 {{currentPriceInfo.startDate}} --> <!-- {{currentPriceInfo.startCityName}}出发 {{currentPriceInfo.startDate}} -->
{{ orderData.model.LtName }} {{ orderData.model.LtName }}
</view> </view>
<view class="big-title" v-if="orderData.model.StartCityName"> <view class="big-title" v-if="orderData.model.StartCityName">
<text>{{ orderData.model.StartCityName }}出发</text> <text>{{ orderData.model.StartCityName }}出发</text>
</view> </view>
<view class="jz_ReseQue"> <view class="jz_ReseQue">
<img <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zuanshi.png" />即时确认:本产品付款后可快速确认,放心期待您的旅行
src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zuanshi.png" </view>
/>即时确认:本产品付款后可快速确认,放心期待您的旅行 </view>
</view>
</view>
<view class="jz_form"> <view class="jz_form">
<view class="form-items"> <view class="form-items">
<view class="label">订单编号</view> <view class="label">订单编号</view>
<view class="jz_SureVal"> <view class="jz_SureVal">
{{ orderData.model.OrderId }} {{ orderData.model.OrderId }}
</view> </view>
</view> </view>
<view class="form-items"> <view class="form-items">
<view class="label">下单日期</view> <view class="label">下单日期</view>
<view class="jz_SureVal"> <view class="jz_SureVal">
{{ orderData.model.CreateDate.replace("T", " ") }} {{ orderData.model.CreateDate.replace("T", " ") }}
</view> </view>
</view> </view>
<view class="form-items"> <view class="form-items">
<view class="label">下单日期</view> <view class="label">下单日期</view>
<view class="jz_SureVal"> <view class="jz_SureVal">
{{ orderData.model.CreateDate.replace("T", " ") }} {{ orderData.model.CreateDate.replace("T", " ") }}
</view> </view>
</view> </view>
</view> </view>
<view class="empty-block"></view> <view class="empty-block"></view>
<view <view class="jz_form jz_MyGuestList" v-for="(subItem, subIndex) in orderData.model.GuestList" :key="subIndex">
class="jz_form jz_MyGuestList" <view style="margin: 10rpx 0 20rpx 0"> 游客{{ subIndex + 1 }} </view>
v-for="(subItem, subIndex) in orderData.model.GuestList" <view class="form-items">
:key="subIndex" <view class="label">游客姓名</view>
> <view class="jz_SureVal">{{ subItem.SurName }}{{ subItem.Name }}</view>
<view style="margin: 10rpx 0 20rpx 0"> 游客{{ subIndex + 1 }} </view> </view>
<view class="form-items"> <view class="form-items">
<view class="label">游客姓名</view> <view class="label">联系电话</view>
<view class="jz_SureVal">{{ subItem.SurName }}{{ subItem.Name }}</view> <view class="jz_SureVal">{{ subItem.MobilePhone }}</view>
</view> </view>
<view class="form-items"> <view class="form-items">
<view class="label">联系电话</view> <view class="label">身份证</view>
<view class="jz_SureVal">{{ subItem.MobilePhone }}</view> <view class="jz_SureVal">{{ subItem.IdCard }}</view>
</view> </view>
<view class="form-items"> <view class="form-items">
<view class="label">身份证</view> <view class="label">学生</view>
<view class="jz_SureVal">{{ subItem.IdCard }}</view> <view class="jz_SureVal">
</view> {{ subItem.IsHightSchool == 1 ? "是" : "否" }}
<view class="form-items"> </view>
<view class="label">学生</view> </view>
<view class="jz_SureVal"> </view>
{{ subItem.IsHightSchool == 1 ? "是" : "否" }} <view class="empty-block"></view>
</view> <view class="jz_form" v-if="orderData.model.Remarks">
</view> <view class="form-items" style="border-bottom: 0">
</view> <view class="label">备注</view>
<view class="empty-block"></view> <view class="jz_SureVal">{{ orderData.model.Remarks }}</view>
<view class="jz_form" v-if="orderData.model.Remarks"> </view>
<view class="form-items" style="border-bottom: 0"> </view>
<view class="label">备注</view> <view class="empty-block"></view>
<view class="jz_SureVal">{{ orderData.model.Remarks }}</view> <view style="padding: 50rpx 40rpx">
</view> <view class="big-title">
</view> <text>费用明细</text>
<view class="empty-block"></view> </view>
<view style="padding: 50rpx 40rpx"> <view class="jz_form" style="margin: 40rpx 0; padding: 0">
<view class="big-title"> <view class="form-items">
<text>费用明细</text> <view class="label"> 在线支付 </view>
</view> <view class="val f14 regular" style="text-align: right">
<view class="jz_form" style="margin: 40rpx 0; padding: 0"> <text style="margin-right: 30rpx">{{ orderData.model.GuestNum }}</text>
<view class="form-items"> <text class="red">{{ orderData.model.PreferPrice }}</text>
<view class="label"> 在线支付 </view> </view>
<view class="val f14 regular" style="text-align: right"> </view>
<text style="margin-right: 30rpx" <view class="form-items" style="border-bottom: none">
>{{ orderData.model.GuestNum }}</text <view class="label"> 明细 </view>
> </view>
<text class="red">{{ orderData.model.PreferPrice }}</text> <view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index">
</view> <view style="flex: 1">
</view> <text style="margin-right: 30rpx">成人</text>
<view class="form-items" style="border-bottom: none"> </view>
<view class="label"> 明细 </view> <view style="text-align: right">{{ orderData.model.ManNum }}人 × ¥{{
</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 orderData.model.Unit_Price
}}</view }}</view>
> </view>
</view> <view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if="orderData.model.ChirdNeedBedNum > 0">
<view <view style="flex: 1">
class="flex f12 grey" <text style="margin-right: 30rpx">儿童(占床)</text>
style="margin-bottom: 40rpx" </view>
:key="index" <view style="text-align: right">{{ orderData.model.ChirdNeedBedNum }}人 × ¥{{
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.model.Unit_Price +
(orderData.modelPrice.ChildNeedPrice (orderData.modelPrice.ChildNeedPrice
? orderData.modelPrice.ChildNeedPrice ? orderData.modelPrice.ChildNeedPrice
: 0) : 0)
}}</view }}</view>
> </view>
</view> <view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if="orderData.model.ChirdNum - orderData.model.ChirdNeedBedNum > 0">
<view <view style="flex: 1">
class="flex f12 grey" <text style="margin-right: 30rpx">儿童(不占床)</text>
style="margin-bottom: 40rpx" </view>
:key="index" <view style="text-align: right">{{ orderData.model.ChirdNum - orderData.model.ChirdNeedBedNum }}
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.model.Unit_Price -
(orderData.modelPrice.ChildNoNeedPrice (orderData.modelPrice.ChildNoNeedPrice
? orderData.modelPrice.ChildNoNeedPrice ? orderData.modelPrice.ChildNoNeedPrice
: 0) : 0)
}}</view }}</view>
> </view>
</view> <view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if="orderData.model.BabyNum > 0">
<view <view style="flex: 1">
class="flex f12 grey" <text style="margin-right: 30rpx">婴儿</text>
style="margin-bottom: 40rpx" </view>
:key="index" <view style="text-align: right">
v-if="orderData.model.BabyNum > 0" {{ orderData.model.BabyNum }}人 × ¥{{
>
<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
? orderData.modelPrice.BabyPrice ? orderData.modelPrice.BabyPrice
: 0 : 0
}}</view }}</view>
> </view>
</view> <view class="flex f12 grey" style="margin-bottom: 40rpx" :key="index" v-if="
<view
class="flex f12 grey"
style="margin-bottom: 40rpx"
:key="index"
v-if="
orderData.model.ChirdNum > 0 && orderData.model.ChirdNum > 0 &&
orderData.modelPrice.BabyChargePrice && orderData.modelPrice.BabyChargePrice &&
orderData.modelPrice.BabyChargePrice > 0 orderData.modelPrice.BabyChargePrice > 0
" ">
> <view style="flex: 1">
<view style="flex: 1"> <text style="margin-right: 30rpx">儿童(附加费)</text>
<text style="margin-right: 30rpx">儿童(附加费)</text> </view>
</view> <view style="text-align: right">
<view style="text-align: right"> {{ orderData.model.ChirdNum }}人 × ¥{{
{{ orderData.model.ChirdNum }}人 × ¥{{
orderData.modelPrice.BabyChargePrice orderData.modelPrice.BabyChargePrice
}}</view }}</view>
> </view>
</view> </view>
</view> </view>
</view> <view class="empty-block"></view>
<view class="empty-block"></view> <view style="padding: 50rpx 40rpx" v-if="Refund > 0 && orderStatus.code == -1">
<view <view class="big-title">
style="padding: 50rpx 40rpx" <text>取消订单</text>
v-if="Refund > 0 && orderStatus.code == -1" </view>
> <view class="jz_form" style="margin: 40rpx 0; padding: 0">
<view class="big-title"> <view class="form-items">
<text>取消订单</text> <view class="label"> 已退款总额 </view>
</view> <view class="val f14 regular" style="text-align: right">
<view class="jz_form" style="margin: 40rpx 0; padding: 0"> <text style="margin-right: 30rpx">{{ orderData.model.GuestNum }}</text>
<view class="form-items"> <text class="red">{{ orderData.model.PreferPrice }}</text>
<view class="label"> 已退款总额 </view> </view>
<view class="val f14 regular" style="text-align: right"> </view>
<text style="margin-right: 30rpx" </view>
>{{ orderData.model.GuestNum }}</text </view>
> <view class="jz_orderbox flex">
<text class="red">{{ orderData.model.PreferPrice }}</text> <view style="display: flex" v-if="showPayBtn">
</view> <view class="jz_OrderReNow" @click="goCancel" style="background: #fff; color: #111; border: 1px solid #111">
</view> <text v-if="!submitCancel">取消</text>
</view> <u-loading v-if="submitCancel" size="32" color="#111"></u-loading>
</view> </view>
<view class="jz_orderbox flex"> <!-- 返回上一页 -->
<view style="display: flex" v-if="showPayBtn"> <!-- <view
<view
class="jz_OrderReNow"
@click="goCancel"
style="background: #fff; color: #111; border: 1px solid #111"
>
<text v-if="!submitCancel">取消</text>
<u-loading v-if="submitCancel" size="32" color="#111"></u-loading>
</view>
<!-- 返回上一页 -->
<!-- <view
class="jz_OrderReNow" class="jz_OrderReNow"
@click="goback" @click="goback"
style="background: #fff; color: #111; border: 1px solid #111" style="background: #fff; color: #111; border: 1px solid #111"
v-if="!showPayBtn" v-if="!showPayBtn"
>关闭 >关闭
</view> --> </view> -->
</view> </view>
<view style="display: flex; margin-left: 30rpx"> <view style="display: flex; margin-left: 30rpx">
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<button <!-- <button class="jz_OrderReNow" @click="goFukuan" v-if="showPayBtn" :disabled="submit">
class="jz_OrderReNow" 立即支付
@click="goFukuan" </button> -->
v-if="showPayBtn" <!-- #endif -->
:disabled="submit" <!-- #ifdef MP-ALIPAY -->
> <!-- <button class="jz_OrderReNow" @click="goZhifuAli" v-if="showPayBtn" :disabled="submit">
立即支付 立即支付
</button> </button> -->
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-ALIPAY --> </view>
<button </view>
class="jz_OrderReNow" <!-- #ifdef MP-ALIPAY -->
@click="goZhifuAli" <subscribe-msg />
v-if="showPayBtn" <!-- #endif -->
:disabled="submit" </view>
>
立即支付
</button>
<!-- #endif -->
</view>
</view>
<!-- #ifdef MP-ALIPAY -->
<subscribe-msg />
<!-- #endif -->
</view>
</template> </template>
<script> <script>
</script> </script>
<script> <script>
export default { export default {
components: {}, components: {},
data() { data() {
return { return {
pageTitle: "订单详情", pageTitle: "订单详情",
msg: { msg: {
pageIndex: 1, pageIndex: 1,
pageSize: 15, pageSize: 15,
MiniAppUserId: 0, MiniAppUserId: 0,
}, },
orderData: null, orderData: null,
orderStatus: {}, orderStatus: {},
submit: false, submit: false,
submitCancel: false, submitCancel: false,
showPayBtn: true, showPayBtn: true,
}; };
}, },
created() {}, created() {},
onLoad(option) { onLoad(option) {
if (option.orderData) { if (option.orderData) {
this.orderData = JSON.parse(decodeURIComponent(option.orderData)); this.orderData = JSON.parse(decodeURIComponent(option.orderData));
} else if (option.orderId) { } else if (option.orderId) {
this.initOrderInfo(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) => {
try{
let orderInfo = JSON.parse(res.data);
console.log(orderInfo);
this.goPay(orderInfo);
}catch(e){
uni.showToast({
title:'无法正常拉取微信支付,你可以稍后重试或联系销售人员线下转款',
icon:'none'
})
setTimeout(()=>{
this.submit = false;
}, 2000);
} }
},
} methods: {
); goback() {
}, uni.navigateBack({
goPay(orderInfo) { delta: 1,
let that = this; });
uni.requestPayment({ },
provider: "wxpay", goCancel() {
timeStamp: orderInfo.timeStamp, if (this.submit || this.submitCancel) return;
nonceStr: orderInfo.nonceStr, //未付款-调用后台取消
package: orderInfo.package, if (this.orderData.model.OrderState == 2) {
signType: orderInfo.signType, this.apipost(
paySign: orderInfo.sign, "sellorder_post_B2BRemoveOrder", {
success: function (res) { ID: this.orderData.model.OrderId,
console.log("success", res); },
uni.showToast({ (res) => {
title: "支付成功", if (res.resultCode == 1) {
}); uni.showToast({
that.submit = false; title: "操作成功",
//todo icon: "success",
that.initOrderInfo(that.orderData.model.OrderId); });
}, uni.navigateTo({
fail: function (err) { url: "/pages/jiuzhai/jz_MyOrder",
console.log("fail:", err); });
uni.showToast({ }
title: "支付失败", },
icon: "none", (err) => {}
}); );
that.submit = false; } else {
that.initOrderInfo(that.orderData.model.OrderId); let msg = {
}, OrderId: this.orderData.model.OrderId,
}); UserId: uni.getStorageSync("mall_UserInfo").UserId,
}, };
// #endif //已付款取消申请
// #ifdef MP-ALIPAY this.apipost(
//支付宝支付 "sellorder_post_AppletUserCancelOrder",
goZhifuAli() { msg,
this.submit = true; (res) => {
let that = this; if (res.resultCode == 1) {
uni.showLoading({ uni.showToast({
title: "支付中", title: "操作成功",
}); icon: "success",
let url = "/api/WeChatPay/GetTravlePayInfo"; });
let GoodsName = this.orderData.model.Title; uni.navigateTo({
this.request2( url: "/pages/jiuzhai/jz_MyOrder",
{ });
url: url, } else {}
data: { },
OrderId: this.orderData.model.OrderId, null
GoodsName: GoodsName, );
OrderPayType: 2, }
OpenId: uni.getStorageSync("mall_UserInfo").OpenId, },
}, getWeek(date) {
}, var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
(res) => { var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
if (res.data) { return "周" + week;
this.$utils.SubscribeMsgAli(() => { },
that.goPayAli(res.data); getDate(date) {
}); if (date) {
} else { let arr = date.split("-");
uni.hideLoading(); return arr[1] + "月" + arr[2] + "日";
uni.showToast({ }
title: "获取交易号失败", },
duration: 2000, initOrderInfo(orderId) {
}); let msg = {
} ID: orderId,
} IsGetGuest: 1,
); };
}, this.apipost(
goPayAli(tradeNO) { "sellorder_post_GetOrderEntity",
let that = this; msg,
my.tradePay({ (res) => {
tradeNO: tradeNO, if (res.resultCode == 1) {
success: function (res) { this.orderData = res.data;
console.log("success", res); this.formatStatus(
const list = ["9000"]; this.orderData.model.OrderState,
if (list.includes(res.resultCode)) { this.orderData.model.IsChargeLossOrders,
let obj = { this.orderData.model.IsApplyForCancel
TradeNo: tradeNO, );
OrderNo: that.orderData.model.OrderNo, } else {
OrderId: that.orderData.model.OrderId, this.orderData = {
preferPrice: that.orderData.model.PreferPrice, result: -1,
}; };
that.payAliCallback(obj); }
} else { console.log(res);
uni.hideLoading(); },
uni.showToast({ (e) => {}
title: "支付失败", );
icon: "none", },
}); formatStatus(status, loss, isCancel) {
} loss = loss ? loss : -1;
}, //1、已申请;!=1未申请
fail: function (err) { if (loss == 1 || status == 4) {
console.log("fail:", err); this.orderStatus.code = -1;
uni.hideLoading(); this.orderStatus.text = "已取消";
uni.showToast({ this.showPayBtn = false;
title: "支付失败", } else if (status == 2 && isCancel != 1) {
icon: "none", this.orderStatus.code = 0;
}); this.orderStatus.text = "待付款";
that.submit = false; this.showPayBtn = true;
that.initOrderInfo(that.orderData.model.OrderId); } else if (status == 2 && isCancel == 1) {
}, this.orderStatus.code = -2;
}); this.orderStatus.text = "审核中";
}, this.showPayBtn = false;
payAliCallback(obj) { } else if (status == 1) {
let that = this; this.orderStatus.code = 1;
this.request2( this.orderStatus.text = "正常";
{ this.showPayBtn = false;
url: "/api/AliPay/ALiPayCallBackDmcNotify", }
data: { },
OrderNo: obj.OrderNo, // #ifdef MP-WEIXIN
OrderId: obj.OrderId, goFukuan() {
UserId: uni.getStorageSync("mall_UserInfo").UserId, if (this.submit || this.submitCancel) return;
TradeNo: obj.TradeNo, var that = this;
ProjectType: 2, var tempData = uni.getStorageSync("basedata");
PreferPrice: obj.preferPrice, var tempObj = [];
}, if (tempData && tempData.mall && tempData.mall.wechatmessage) {
}, tempObj = tempData.mall.wechatmessage;
(res) => { }
that.submit = false;
uni.redirectTo({ var tmplIds = [];
url: if (tempObj && tempObj.length > 0) {
"/pages/jiuzhai/paysuccess?PreferPrice=" + tempObj.forEach((x) => {
obj.preferPrice + if (x.Name == "下单成功提醒" || x.Name == "订单取消提醒") {
"&isFrom=1", tmplIds.push(x.MessageId);
}); }
uni.hideLoading(); });
}, }
(err) => { uni.requestSubscribeMessage({
console.log("err", err); tmplIds: tmplIds,
uni.hideLoading(); complete(res) {
that.submit = false; that.goZhifu();
uni.showToast({ },
title: "支付失败", });
icon: "none", },
}); //支付
that.initOrderInfo(that.orderData.model.OrderId); goZhifu() {
} this.submit = true;
); let url = "/api/WeChatPay/GetTravlePayInfo";
}, let GoodsName = this.orderData.model.Title;
// #endif 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) => {
try {
let orderInfo = JSON.parse(res.data);
console.log(orderInfo);
this.goPay(orderInfo);
} catch (e) {
uni.showToast({
title: '无法正常拉取微信支付,你可以稍后重试或联系销售人员线下转款',
icon: 'none'
})
setTimeout(() => {
this.submit = false;
}, 2000);
}
}
);
},
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 = ["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> </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