|
|
<template> <view> <view id="store-success" v-if="init"> <!-- <view class="pay-status pay-error mx-1px-bottom" wx:if="{{!isOK}}"> 支付失败 </view>--> <view v-if="!isOK"> <view class="pay-status pay-error"> 支付失败 </view> <view class="pay-txt"> 如已支付成功,请联系客服 </view> </view> <view v-if="isOK"> <view class="pay-status pay-ok"> 支付成功 </view> <view class="pay-txt"> 支付成功,查看订单详情 </view> </view> <view class="button-box"> <view class="btn left-btn" @tap="queryOrderType" v-if="!isOK && errCount == 1">重新查询</view> <view class="btn rigth-box"> <view v-if="info.order.type==10" @tap="jump">查看拼团</view> <view v-else @tap="jump">查看订单</view> </view> </view> <block v-if="isOK"> <view class="order-info"> <view class="order-money mx-1px-bottom"> <view class="left"> 付款金额 </view> <view class="right"> ¥{{info.order.total_yuan}} </view> </view> <view class="info-list"> <view class="order-item"> <view class="item-left"> 订单编号 </view> <view class="item-right"> {{info.order.order_no}} </view> </view> <view class="order-item"> <view class="item-left"> 订单时间 </view> <view class="item-right"> {{info.order.submit_time}} </view> </view> <view class="order-item"> <view class="item-left"> 订单状态 </view> <view class="item-right"> 支付成功 </view> </view> <view class="order-item"> <view class="item-left"> 消耗积分 </view> <view class="item-right"> {{info.pointInfo.pointUsed}}积分 </view> </view> <view class="order-item"> <view class="item-left"> 获得积分 </view> <view class="item-right"> {{info.pointInfo.pointAdded}}积分 </view> </view> <view class="order-item"> <view class="item-left"> 当前积分 </view> <view class="item-right"> {{info.pointInfo.pointTotal}}积分 </view> </view> </view> </view> </block> <!-- <view class="button-box"> <button type="primary" style="background: {{config.mainColor}}" type="primary" bindtap="jump" wx:if="{{info.order.type==10}}">查看拼团详情</button> <button type="primary" style="background: {{config.mainColor}}" type="primary" bindtap="jump" wx:else>查看订单详情</button> <!–<button type="default">查看积分</button>–> </view>--> </view> </view>
</template><script>import {pageLogin, getUrl,config,is} from '@/common/js/utils.js';
export default { data() { return { info: {}, order_no: '', isOK: true, config: '', errCount: 0, formId: '', accountInfo: '', init:false }; },
onLoad(e) {
var gbConfig = this.$cookieStorage.get('globalConfig') || ''; this.config = gbConfig; this. order_no = e.order_no; this.amount = e.amount; this.channel = e.channel; this.formId = e.formId || '';
if (!e.order_no) { wx.showModal({ content: '订单参数错误', showCancel: false }); return; }
wx.showLoading(); pageLogin(getUrl(), () => { setTimeout(() => { this.queryOrderType(e.order_no); }, 500); }); },
components: {}, props: {}, methods: { jump() { if (this.info.order && this.info.order.type == 10) { wx.redirectTo({ url: '/pages/store/collage/collage?multi_groupon_item_id=' + this.info.order.multiGroupon.multi_groupon_items_id }); } else { wx.redirectTo({ url: '/pages/order/detail/detail?no=' + this.order_no, fail: err => { wx.showModal({ content: '错误,返回首页后重试', showCancel: false }); } }); } },
queryOrderType(no) { wx.showLoading(); var token = this.$cookieStorage.get('user_token'); this.$http.post({ api: 'api/shopping/order/paid', header: { Authorization: token }, data: { order_no: this.order_no, amount: this.amount, channel: this.channel, form_id: this.formId } }).then(res => { if (res.statusCode == 200) { wx.hideLoading(); res = res.data;
if (res && res.status && res.data.order && res.data.order.pay_status) { this.info = res.data; this.isOK = true; } else { this.isOK = false; wx.showModal({ content: res.message || "订单支付失败", showCancel: false, success: res => { if (res.confirm && this.errCount == 2) { wx.switchTab({ url: '/pages/user/personal/personal' }); } } }); }
this.errCount = this.errCount + 1; this.init = true; } else { this.isOK = false; this.init = true; this.errCount = this.errCount + 1
wx.hideLoading(); wx.showModal({ content: "订单支付失败", showCancel: false, success: res => { if (res.confirm && this.errCount == 2) { wx.switchTab({ url: '/pages/user/personal/personal' }); } } }); } }).catch(rej => { wx.hideLoading(); this.isOK = false; this.init = true; this.errCount = this.errCount + 1 wx.showModal({ content: "订单支付失败", showCancel: false, success: res => { if (res.confirm && this.errCount == 2) { wx.switchTab({ url: '/pages/user/personal/personal' }); } } }); }); },
setData: function (obj) { let that = this; let keys = []; let val, data; Object.keys(obj).forEach(function (key) { keys = key.split('.'); val = obj[key]; data = that.$data; keys.forEach(function (key2, index) { if (index + 1 == keys.length) { that.$set(data, key2, val); } else { if (!data[key2]) { that.$set(data, key2, {}); } }
data = data[key2]; }); }); } }, computed: {}, watch: {}};</script><style rel="stylesheet/less" lang="less"> @import "success";</style>
|