detail.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view>
  3. <view class="coupon-list" v-if="orderData">
  4. <view class="coupon-item">
  5. <view class="header">订单编号 {{orderData.order_id}}</view>
  6. <view class="body">
  7. <view class="info">
  8. <view class="name">{{orderData.product_name}}</view>
  9. <view class="desc">x {{orderData.count}}张</view>
  10. <view class="desc">有效期至{{orderData.expire_at}}</view>
  11. </view>
  12. <view class="right">
  13. <button class="btn" type="primary" @click="toDetail(orderData.order_id)" v-if="orderData.status==1">去使用</button>
  14. <button class="btn" type="default" @click="toView(orderData.order.order_sn)" v-if="orderData.status==2 && orderData.order">查看预约</button>
  15. </view>
  16. </view>
  17. <view class="state-img" v-if="orderData.status==1"><image src="/static/image/order-dot.png" mode="widthFix"></image></view>
  18. <view class="state-img" v-if="orderData.status==2"><image src="/static/image/fwz.png" mode="widthFix"></image></view>
  19. <view class="state-img" v-if="orderData.status==3"><image src="/static/image/end.png" mode="widthFix"></image></view>
  20. <view class="state-img" v-if="orderData.status==4"><image src="/static/image/ex.png" mode="widthFix"></image></view>
  21. </view>
  22. <navigator hover-class="none" url="/pages/user/license" class="tips">小程序资质亮照</navigator>
  23. </view>
  24. <view class="" v-else>
  25. <u-skeleton
  26. rows="3"
  27. title
  28. loading
  29. ></u-skeleton>
  30. </view>
  31. <view class="dialog-msg" v-if="msgDialog">
  32. <view class="mark"></view>
  33. <view class="msg-body">
  34. <view class="title">第三方服务声明<image src="/static/image/round_close.png" @click="msgDialog=false"></image></view>
  35. <view class="desc">本商品信息、交易以及售后服务由第三方提供,如由问题请联系在线客服或电话客服</view>
  36. </view>
  37. </view>
  38. <view class="kf-service" @click="toService"><image src="/static/image/kefu.png"></image></view>
  39. </view>
  40. </template>
  41. <script>
  42. var app;
  43. import * as Api from "@/static/api/home.js";
  44. export default {
  45. data() {
  46. return {
  47. order:"",
  48. msgDialog:false,
  49. orderData:null,
  50. option:{}
  51. }
  52. },
  53. onLoad(option) {
  54. app = this;
  55. app.option = option;
  56. app.getData();
  57. },
  58. methods: {
  59. toView(orderSn){
  60. if (!orderSn) return ;
  61. uni.navigateTo({
  62. url:"/pages/order/info?order="+orderSn
  63. })
  64. },
  65. toService(){
  66. if (!app.orderData.store.service_mobile) return false;
  67. uni.makePhoneCall({
  68. phoneNumber:app.orderData.store.service_mobile,
  69. fail() {
  70. app.$dialog.showSuccess("联系失败")
  71. }
  72. })
  73. },
  74. toDetail(order){
  75. uni.navigateTo({
  76. url:"/pages/order/store?type=1&order="+order
  77. })
  78. },
  79. getData(){
  80. uni.login({
  81. success(lres){
  82. app.option.auth = lres.code
  83. Api.detail(app.option).then((res)=>{
  84. uni.hideLoading();
  85. if (res.code == 0) {
  86. return app.$dialog.showSuccess(res.msg);
  87. }
  88. uni.setStorageSync("user_data", res.data.user)
  89. uni.setStorageSync("user_token", res.data.user.access_token)
  90. app.orderData = res.data.order;
  91. app.msgDialog = true;
  92. setTimeout(function(){
  93. app.msgDialog = false;
  94. },3000)
  95. })
  96. },fail(res){
  97. app.$dialog.showSuccess("登录失败,请重启小程序")
  98. }
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style>
  105. page{background-color: #f8f8f8;}
  106. .kf-service{
  107. position: fixed;
  108. right: 20upx;
  109. bottom: 20%;
  110. background-color: #fff;
  111. width: 80upx;
  112. height: 80upx;
  113. border-radius: 80upx;
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. }
  118. .kf-service image{
  119. width: 60upx;
  120. height: 60upx;
  121. vertical-align: middle;
  122. }
  123. .dialog-msg .mark{position: fixed;top: 0;left: 0;right: 0;bottom: 0;z-index: 90;background-color: rgba(0, 0,0, 0.3);}
  124. .dialog-msg .msg-body{position: fixed;background-color: #fff;z-index: 99;left: 5%;right: 5%;top: 50%;transform: translateY(-50%);border-radius: 10upx;padding: 40upx;}
  125. .dialog-msg .msg-body .title{text-align: center;line-height: 48upx;color: #333;font-weight: bold;margin-bottom: 20upx;position: relative;padding: 20upx 0;}
  126. .dialog-msg .msg-body .title image{width: 60upx;height: 60upx;position: absolute;top: 0;right: 0;}
  127. .dialog-msg .msg-body .desc{line-height: 48upx;color: #666;font-weight: bold;font-size: 26upx;}
  128. .coupon-item{background-color: #fff;border-radius: 10upx;width: calc(100% - 40upx);margin: 20upx auto;border: 2upx solid #fff;border-radius: 10upx;position: relative;}
  129. .coupon-item .state-img{position: absolute;right: 0;top: 0;}
  130. .coupon-item .state-img image{width: 100upx;height: 100upx;}
  131. .coupon-item .header{padding: 20upx;font-size: 28upx;color: #333;line-height: 48upx;border-bottom: 2upx solid #f8f8f8;}
  132. .coupon-item .footer{padding: 20upx;border-top: 2upx solid #f8f8f8;display: flex;justify-content: space-between;}
  133. .coupon-item .footer .state{flex: 1;}
  134. .coupon-item .footer .btn{width: 50%;font-size: 28upx;}
  135. .coupon-item .body{display: flex;align-items: center;margin: 20upx 0;justify-content: space-between;}
  136. .coupon-item .img image{width: 160upx;height: 160upx;}
  137. .coupon-item .info{padding: 0 20upx;}
  138. .coupon-item .btn{font-size: 28upx;margin-right: 20upx;}
  139. .coupon-item .name{font-size: 32upx;color: #333;line-height: 46upx;}
  140. .coupon-item .desc{color: #666;font-size: 28upx;line-height: 48upx;}
  141. .tips{text-align: center;line-height: 80upx;color: #666;font-size: 28upx;}
  142. </style>