|
|
@@ -10,7 +10,7 @@
|
|
|
<view class="contentBox">
|
|
|
<view class="remainingTime">
|
|
|
{{ orderStatus }}
|
|
|
- <text v-if="countdownText != '00:00'">{{ countdownText }}</text>
|
|
|
+ <text v-if="orderInfo.orderStatus == 0 && countdownText != '00:00'">{{ countdownText }}</text>
|
|
|
</view>
|
|
|
<view class="content" v-if="orderInfo">
|
|
|
<view class="addressBox">
|
|
|
@@ -33,21 +33,27 @@
|
|
|
<view class="productPrice">
|
|
|
<view style="display:flex;">
|
|
|
<view>
|
|
|
- <image style="width: 120rpx;height: 120rpx;" src="@/static/points/closeIcon.png"
|
|
|
- mode="">
|
|
|
+ <image style="width: 120rpx;height: 120rpx;"
|
|
|
+ :src="$globalData.publicUrl + orderInfo.skuImage" mode="">
|
|
|
</image>
|
|
|
</view>
|
|
|
<view
|
|
|
style="margin-left: 24rpx;display: flex;flex-direction: column;justify-content: space-between;">
|
|
|
- <view class="productName">广誉源会员定制玻璃杯 </view>
|
|
|
- <view class="spec">已选:大号,白色 </view>
|
|
|
- <view class="price">实付价 ¥{{ orderInfo.payAmount }}元+{{ orderInfo.pointsUsed }}积分 </view>
|
|
|
+ <view class="productName">{{ orderInfo.productName }} </view>
|
|
|
+ <view class="spec">已选:{{ skuSpecFun(orderInfo.skuSpec) }} </view>
|
|
|
+ <view class="price">{{ orderInfo.paymentType == 1 ? orderInfo.pointsUsed + '积分' :
|
|
|
+ orderInfo.paymentType == 2 ? '¥' + orderInfo.payAmount + '元' :
|
|
|
+ orderInfo.paymentType == 3 ? '¥' + orderInfo.payAmount + '元' + '+' +
|
|
|
+ orderInfo.pointsUsed + '积分' : null }}</view>
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="productPrice1">
|
|
|
<view class="text">商品金额</view>
|
|
|
- <view class="price">¥10 +1000积分</view>
|
|
|
+ <view class="price">{{ orderInfo.paymentType == 1 ? orderInfo.pointsUsed + '积分' :
|
|
|
+ orderInfo.paymentType == 2 ? '¥' + orderInfo.payAmount + '元' :
|
|
|
+ orderInfo.paymentType == 3 ? '¥' + orderInfo.payAmount + '元' + '+' +
|
|
|
+ orderInfo.pointsUsed + '积分' : null }}</view>
|
|
|
</view>
|
|
|
<view class="shippingFee">
|
|
|
<view class="text">运费</view>
|
|
|
@@ -56,7 +62,9 @@
|
|
|
<view style="height: 2rpx;background-color: #f0f0f0;margin-top: 20rpx;"> </view>
|
|
|
<view class="total">
|
|
|
<text class="text">合计:</text>
|
|
|
- <text class="price">¥ {{ orderInfo.totalAmount }}</text>
|
|
|
+ <text class="price">¥ {{
|
|
|
+ (orderInfo.payAmount + (orderInfo.freightAmount > 0 ? orderInfo.freightAmount : 0))
|
|
|
+ }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="weiChect">
|
|
|
@@ -159,18 +167,19 @@
|
|
|
|
|
|
</view>
|
|
|
|
|
|
+</template>
|
|
|
|
|
|
+<script>
|
|
|
|
|
|
+import { getPointOrderInfo,productOrderCancel, productOrderPay} from '@/api/pointOrder'
|
|
|
+import { getInfo, } from '@/api/index.js';
|
|
|
|
|
|
+//paymentType 商品的付款类型 付款类型(1:积分 2:金额 3:积分+金额)
|
|
|
|
|
|
-</template>
|
|
|
+//订单状态(0:待付款 1:待发货 2:待收货 3:已收货 4:售后中 11:取消订单)
|
|
|
+
|
|
|
+//售后状态(0:待审核 1:退款完成 2:等待用户寄回 3:等待商家收货 4:等待商家寄出 5:订单完成 6:取消售后)
|
|
|
|
|
|
-<script>
|
|
|
-import { productOrderCancel, productOrderPay } from '@/api/points'
|
|
|
-import { getPointOrderInfo } from '@/api/pointOrder'
|
|
|
-import {
|
|
|
- getInfo, payoff, pay, getSignature,
|
|
|
-} from '@/api/index.js';
|
|
|
export default {
|
|
|
components: {},
|
|
|
data() {
|
|
|
@@ -210,35 +219,41 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ //规则组装
|
|
|
+ skuSpecFun(skuSpec) {
|
|
|
+ if (!skuSpec) return ''
|
|
|
+ return JSON.parse(skuSpec).map(e => e.specValue).join(',')
|
|
|
+
|
|
|
+ },
|
|
|
//获取订单详情
|
|
|
async getOrderInfo() {
|
|
|
const res = await getPointOrderInfo({
|
|
|
orderNo: this.orderNo,
|
|
|
openId: uni.getStorageSync('wx_copenid')
|
|
|
})
|
|
|
- this.orderCountdownFun()
|
|
|
this.orderInfo = res.data.data
|
|
|
- },
|
|
|
- //订单倒计时
|
|
|
- orderCountdownFun() {
|
|
|
- let remain = 10;
|
|
|
- if (remain > 0) {
|
|
|
+ if (this.orderInfo.remainSeconds > 0 && this.orderInfo.orderStatus == 0) {
|
|
|
+ this.orderCountdownFun(this.orderInfo.remainSeconds)
|
|
|
this.orderStatus = '剩余时间'
|
|
|
this.title = '待支付'
|
|
|
- } else {
|
|
|
+ } else if (this.orderInfo.remainSeconds < 0 && this.orderInfo.orderStatus == 0) {
|
|
|
this.orderStatus = '超时未支付'
|
|
|
this.title = '订单取消'
|
|
|
- this.cancelOrderShowPopup = false
|
|
|
- return
|
|
|
+ } else if (this.orderInfo.orderStatus == 11) {
|
|
|
+ this.orderStatus = '您已取消支付'
|
|
|
+ this.title = '订单取消'
|
|
|
}
|
|
|
|
|
|
+ },
|
|
|
+ //订单倒计时
|
|
|
+ orderCountdownFun(remain) {
|
|
|
this.timer = setInterval(() => {
|
|
|
remain--;
|
|
|
this.countdownText = this.formatTime(remain);
|
|
|
if (remain <= 0) {
|
|
|
clearInterval(this.timer);
|
|
|
this.orderStatus = '超时未支付'
|
|
|
- this.title = '订单取消'
|
|
|
+ this.title = '订单取消'
|
|
|
this.cancelOrderShowPopup = false
|
|
|
}
|
|
|
}, 1000);
|
|
|
@@ -253,22 +268,6 @@ export default {
|
|
|
|
|
|
//去付款
|
|
|
goPay() {
|
|
|
- let params = {}
|
|
|
- params.openId = uni.getStorageSync('wx_copenid');//用户openId
|
|
|
- params.addressId = this.orderInfo.addressId;//地址ID
|
|
|
- params.productId = this.orderInfo.id;
|
|
|
- //params.name = this.params.name;
|
|
|
- //params.productMainImage = this.params.productMainImage;
|
|
|
- //params.skuId = this.selectedObj.index; //选中的SKU ID
|
|
|
- //params.specNameValueLis = this.selectedObj.specNameValueList; // SKU列表(规格组合明细)
|
|
|
- params.quantity = 1; //购买数量
|
|
|
- params.payType = this.orderInfo.payType;//支付方式:1微信支付 2账户余额
|
|
|
- params.freightAmount = this.orderInfo.freightAmount; //运费
|
|
|
- params.totalAmount = this.orderInfo.totalAmount;// 总金额
|
|
|
- params.payAmount = this.orderInfo.payAmount;// 支付金额
|
|
|
- params.pointsUsed = this.orderInfo.pointsUsed;// 使用的积分
|
|
|
- params.buyerRemark = this.orderInfo.buyerRemark;//买家备注信息
|
|
|
- console.log(params, 'params')
|
|
|
if (this.orderInfo.payType == 1) {
|
|
|
//微信支付
|
|
|
this.weixinPay(params)
|
|
|
@@ -279,60 +278,59 @@ export default {
|
|
|
|
|
|
},
|
|
|
//微信支付
|
|
|
- weixinPay(params) {
|
|
|
- productOrderCreate(params).then(res => {
|
|
|
+ weixinPay() {
|
|
|
+ productOrderPay({
|
|
|
+ orderNo: this.orderInfo.orderNo, //订单编号
|
|
|
+ payType: this.orderInfo.payType, //支付方式:1微信支付 2:余额支付
|
|
|
+ totalPrice: this.orderInfo.totalAmount //订单总金额,单位:元
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res, '8888888')
|
|
|
return
|
|
|
- productOrderPay().then(res => {
|
|
|
+ this.wxconfig = res.data
|
|
|
+ wx.config({
|
|
|
+ beta: true,
|
|
|
+ debug: false,
|
|
|
+ appId: this.wxconfig.appId, // 公众号ID
|
|
|
+ // appId: uni.getAppBaseInfo().host.appId, // 公众号ID
|
|
|
+ timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
|
|
|
+ nonceStr: this.wxconfig.nonceStr, // 随机串
|
|
|
+ signature: this.wxconfig.sign, // 微信签名方式
|
|
|
+ jsApiList: ['getBrandWCPayRequest']
|
|
|
+ });
|
|
|
+ var vm = this
|
|
|
+ wx.invoke('getBrandWCPayRequest',
|
|
|
+ // 下面参数内容都是后台返回的
|
|
|
+ {
|
|
|
+ 'appId': payConfig.appid, // 公众号名称,由商户传入
|
|
|
+ 'timeStamp': payConfig.timeStamp, // 时间戳
|
|
|
+ 'nonceStr': payConfig.nonceStr, // 随机串
|
|
|
+ 'package': payConfig.package, // 预支付id
|
|
|
+ 'signType': payConfig.signType, // 微信签名方式
|
|
|
+ 'paySign': payConfig.paySign, // 微信签名
|
|
|
+ },
|
|
|
+ function (res) {
|
|
|
+ // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
|
+
|
|
|
+ // JSON.stringify(res);
|
|
|
+ if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/points/productDetails/paymentSuccessful'
|
|
|
+ });
|
|
|
+ } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
+ uni.showToast({
|
|
|
+ title: '已取消支付',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/points/productDetails/pendingPayment'
|
|
|
+ });
|
|
|
|
|
|
- })
|
|
|
|
|
|
- })
|
|
|
- return
|
|
|
- let url = 'https://test.baoxianzhanggui.com/fragrance/'
|
|
|
- payoff(params).then(res => {
|
|
|
- let payConfig = JSON.parse(res.data.data)
|
|
|
- getSignature(url).then(res => {
|
|
|
- this.wxconfig = res.data
|
|
|
- wx.config({
|
|
|
- beta: true,
|
|
|
- debug: false,
|
|
|
- appId: this.wxconfig.appId, // 公众号ID
|
|
|
- // appId: uni.getAppBaseInfo().host.appId, // 公众号ID
|
|
|
- timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
|
|
|
- nonceStr: this.wxconfig.nonceStr, // 随机串
|
|
|
- signature: this.wxconfig.sign, // 微信签名方式
|
|
|
- jsApiList: ['getBrandWCPayRequest']
|
|
|
- });
|
|
|
- var vm = this
|
|
|
- wx.invoke('getBrandWCPayRequest',
|
|
|
- // 下面参数内容都是后台返回的
|
|
|
- {
|
|
|
- 'appId': payConfig.appid, // 公众号名称,由商户传入
|
|
|
- 'timeStamp': payConfig.timeStamp, // 时间戳
|
|
|
- 'nonceStr': payConfig.nonceStr, // 随机串
|
|
|
- 'package': payConfig.package, // 预支付id
|
|
|
- 'signType': payConfig.signType, // 微信签名方式
|
|
|
- 'paySign': payConfig.paySign, // 微信签名
|
|
|
- },
|
|
|
- function (res) {
|
|
|
- // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
|
|
|
-
|
|
|
- // JSON.stringify(res);
|
|
|
- if (res.err_msg == "get_brand_wcpay_request:ok") {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/points/productDetails/paymentSuccessful'
|
|
|
- });
|
|
|
- } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
|
|
|
- uni.showToast({
|
|
|
- title: '已取消支付',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- } else {
|
|
|
- alert('付款失败');
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ alert('付款失败');
|
|
|
}
|
|
|
- )
|
|
|
- })
|
|
|
+ }
|
|
|
+ )
|
|
|
})
|
|
|
},
|
|
|
//账号余额支付
|
|
|
@@ -350,22 +348,12 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- productOrderCreate(params).then(res => {
|
|
|
- return
|
|
|
- productOrderPay().then(res => {
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
- })
|
|
|
- return
|
|
|
- var data = {
|
|
|
- cId: this.details.cId,
|
|
|
- payType: this.selectedPayment,
|
|
|
- couponReceiveId: this.couponReceiveId,
|
|
|
- preferential: this.preferential, //优惠金额
|
|
|
- totalPrice: this.totalPrice, //总金额
|
|
|
- }
|
|
|
- payoff(data).then(res => {
|
|
|
+ productOrderPay({
|
|
|
+ orderNo: this.orderInfo.orderNo, //订单编号
|
|
|
+ payType: this.orderInfo.payType, //支付方式:1微信支付 2:余额支付
|
|
|
+ totalPrice: this.orderInfo.totalAmount //订单总金额,单位:元
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res, '8888888')
|
|
|
if (res.data.code == 200) {
|
|
|
uni.navigateTo({
|
|
|
url: '/points/productDetails/paymentSuccessful'
|
|
|
@@ -397,6 +385,7 @@ export default {
|
|
|
}
|
|
|
productOrderCancel(params).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
|
+ clearInterval(this.timer);
|
|
|
this.cancelOrderShowPopup = false
|
|
|
this.title = '订单取消'
|
|
|
this.orderStatus = '您已取消支付'
|