123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <template>
- <view class="container">
- <view class="success">
- <view v-if="isSuccess" class="result">
- <image class="icon" src='/static/pay/success.png'></image>
- <text class="text" v-if="message && message != undefined">{{ message }}</text>
- <text class="text" v-if="!message || message == undefined">恭喜,支付成功!</text>
- </view>
- <view v-if="!isSuccess" class="result">
- <image class="icon" src='/static/pay/fail.png'></image>
- <text class="text" v-if="message && message != undefined" style="color:#888888;">支付失败:{{ message }}</text>
- <text class="text" v-if="!message || message == undefined" style="color:#888888;">哎呀,支付失败啦~</text>
- </view>
- <view class="options">
- <view class="to-home" @click="toHome()"><text class="iconfont icon-home"></text>返回首页</view>
- <view class="to-order" @click="toOrderInfo()"><text class="iconfont icon-form"></text>查看订单</view>
- </view>
- </view>
- <block>
- <Goods ref="mescrollItem" :itemStyle="goodsStyle" :params="goodsParams"/>
- </block>
- </view>
- </template>
- <script>
- import Goods from '@/components/page/goods'
- import * as Api from '@/api/page'
- import * as OrderApi from '@/api/order'
- import * as MessageApi from '@/api/message'
- import MescrollCompMixin from "@/components/mescroll-uni/mixins/mescroll-comp.js"
- export default {
- mixins: [MescrollCompMixin],
- components: {
- Goods
- },
- data() {
- return {
- orderId: 0,
- orderInfo: null,
- isLoading: true,
- isSuccess: false,
- message: '',
- goodsStyle: {
- "background": "#F6F6F6",
- "display": "list",
- "column": 1,
- "show": ["goodsName", "goodsPrice", "linePrice", "sellingPoint", "goodsSales"]
- },
- goodsParams: {
- "source": "auto",
- "auto": {
- "category": 0,
- "goodsSort": "all",
- "showNum": 40
- }
- }
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- // 当前页面参数
- this.orderId = options.orderId ? options.orderId : 0;
- this.message = options.message ? options.message : '';
- this.getOrderDetail();
- },
- methods: {
- /**
- * 去首页
- * */
- toHome() {
- const app = this
- // #ifdef MP-WEIXIN
- MessageApi.getSubTemplate({keys: "orderCreated,deliverGoods"}).then(result => {
- const templateIds = result.data
- wx.requestSubscribeMessage({tmplIds: templateIds,
- success(res) {
- console.log("调用成功!")
- }, fail(res) {
- console.log("调用失败:", res)
- }, complete() {
- app.$navTo('pages/index/index')
- }
- })
- })
- // #endif
- // #ifndef MP-WEIXIN
- app.$navTo('pages/index/index')
- // #endif
- },
-
- /**
- * 去订单详情
- * */
- toOrderInfo() {
- const app = this
- // #ifdef MP-WEIXIN
- MessageApi.getSubTemplate({keys: "orderCreated,deliverGoods"}).then(result => {
- const templateIds = result.data
- wx.requestSubscribeMessage({tmplIds: templateIds,
- success(res) {
- console.log("调用成功!")
- }, fail(res) {
- console.log("调用失败:", res)
- }, complete() {
- app.$navTo('pages/order/detail?orderId=' + app.orderId)
- }
- })
- })
- // #endif
- // #ifndef MP-WEIXIN
- app.$navTo('pages/order/detail?orderId=' + app.orderId)
- // #endif
- },
- getOrderDetail() {
- const app = this
- app.isLoading = true
- const tableId = uni.getStorageSync("tableId") ? uni.getStorageSync("tableId") : 0;
- if (tableId <= 0) {
- OrderApi.detail(app.orderId)
- .then(result => {
- app.isSuccess = result.data.payStatus === 'B' ? true : false;
- app.isLoading = false;
- })
- } else {
- app.isSuccess = true;
- app.isLoading = false;
- uni.setStorageSync("tableId", 0);
- uni.setStorageSync("orderId", 0);
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .success {
- width: 100%;
- text-align: center;
- margin-top: 60rpx;
- margin-bottom: 80rpx;
- .result {
- font-size: 35rpx;
- text-align: center;
- padding: 10rpx;
- height: 70rpx;
- .icon {
- width: 55rpx;
- height: 55rpx;
- display: inline-block;
- box-sizing: border-box;
- vertical-align: middle;
- }
- .text {
- text-align: center;
- height: 100%;
- display: inline-block;
- box-sizing: border-box;
- vertical-align: middle;
- color: #00B83F;
- margin-left: 10rpx;
- font-weight: bold;
- }
- }
- .options {
- margin-top: 0rpx;
- text-align: center;
- display: flex;
- align-items: center;
- flex-direction:row;
- padding: 50rpx 100rpx 60rpx 100rpx;
- .to-home,.to-order {
- margin: 0 auto;
- font-size: 28rpx;
- height: 72rpx;
- line-height: 72rpx;
- text-align: center;
- color: #888;
- border-radius: 72rpx;
- width: 240rpx;
- background: #fff;
- border: solid 1rpx #888;
- float: left;
- }
- .iconfont {
- font-weight: bold;
- margin-right: 5rpx;
- }
- }
- }
- .attention {
- width: 100%;
- text-align: center;
- margin-top: 14rpx;
- }
- </style>
|