payResult.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="container">
  3. <view class="pay-result-top">
  4. <image src="/static/images/new/icon-success.png" alt="" class="pay-success"></image>
  5. <view class="result-text" v-if="type == '2'">预约成功</view>
  6. <view class="result-text" v-else>支付成功</view>
  7. <view class="result-tip" v-if="type == '2'">专属管家将尽快与您联系</view>
  8. <view class="result-tip" v-else>支付:¥{{ payAmount }}</view>
  9. </view>
  10. <!-- 商品图片 -->
  11. <view class="pay-img-wrapper">
  12. <image :src="imgUrl"></image>
  13. </view>
  14. <view class="service-tips sub-color" v-if="appType == 1">已完成预约,如有特殊情况需调整服务日期,我们客服团队将第一时间与您联系。</view>
  15. <view class="service-tips sub-color" v-if="appType == 0">已付款,请尽快完成预约!</view>
  16. <view class="common-btn-wrapper">
  17. <van-button block round @tap.native="goOrder" color="#d77958" v-if="appType ==1">查看订单</van-button>
  18. <van-button block round @tap.native="goAppoint" color="#d77958" v-if="appType ==0">立即预约</van-button>
  19. <van-button block round @tap.native="goIndex" color="#f6f5f5" custom-style class="fanhui">返回首页</van-button>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. var util = require('../../../utils/util.js');
  25. var api = require('../../../config/api.js');
  26. var app = getApp();
  27. export default {
  28. data() {
  29. return {
  30. imgUrl: '',
  31. type: '',
  32. status: false,
  33. orderId: 0,
  34. payAmount: '',
  35. appointShow: false,
  36. appType: null
  37. };
  38. },
  39. onLoad: function(options) {
  40. // 页面初始化 options为页面跳转所带来的参数
  41. this.setData({
  42. orderId: options.orderId,
  43. payAmount: options.actualPrice,
  44. type: app.globalData.infoGoods.type,
  45. appType: uni.getStorageSync('appType'),
  46. imgUrl: app.globalData.infoGoods.type == '2' ?
  47. 'https://jzmall.lifejingzhi.com/file/jzmall/weixin/new/icon-jpjzs.png' : app.globalData
  48. .infoGoods.picUrl
  49. });
  50. },
  51. onReady: function() {},
  52. onShow: function() {
  53. // 页面显示
  54. },
  55. onHide: function() {
  56. // 页面隐藏
  57. },
  58. onUnload: function() {
  59. // 页面关闭
  60. },
  61. methods: {
  62. goIndex() {
  63. uni.navigateTo({
  64. url: '/pages/index/index'
  65. });
  66. },
  67. goOrder() {
  68. uni.redirectTo({
  69. url: '/pages/ucenter/order/order'
  70. });
  71. },
  72. payOrder() {
  73. let that = this;
  74. util.request(
  75. api.OrderPrepay, {
  76. orderId: that.orderId
  77. },
  78. 'POST'
  79. ).then(function(res) {
  80. if (res.errno === 0) {
  81. const payParam = res.data;
  82. console.log('支付过程开始');
  83. uni.requestPayment({
  84. timeStamp: payParam.timeStamp,
  85. nonceStr: payParam.nonceStr,
  86. package: payParam.packageValue,
  87. signType: payParam.signType,
  88. paySign: payParam.paySign,
  89. success: function(res) {
  90. console.log('支付过程成功');
  91. that.setData({
  92. status: true
  93. });
  94. },
  95. fail: function(res) {
  96. console.log('支付过程失败');
  97. util.showErrorToast('支付失败');
  98. },
  99. complete: function(res) {
  100. console.log('支付过程结束');
  101. }
  102. });
  103. }
  104. });
  105. },
  106. goAppoint() {
  107. uni.navigateTo({
  108. url: '/pages/ucenter/appointOrder/appointOrder?orderId=' + this.orderId
  109. });
  110. }
  111. }
  112. };
  113. </script>
  114. <style>
  115. page {
  116. min-height: 100%;
  117. width: 100%;
  118. }
  119. .container {
  120. height: 100%;
  121. }
  122. .pay-result-top {
  123. background: url('https://mall.zhaijieshi.cc/file/wx-huawang/bj2.png') no-repeat center;
  124. background-size: 100% 100%;
  125. width: 750rpx;
  126. height: 516rpx;
  127. padding: 32rpx 0 0;
  128. display: flex;
  129. flex-direction: column;
  130. justify-content: top;
  131. align-items: center;
  132. color: #fff;
  133. }
  134. .pay-img-wrapper {
  135. width: 324rpx;
  136. height: 324rpx;
  137. border-radius: 324rpx;
  138. padding: 10rpx;
  139. margin: 0 auto;
  140. margin-top: -158rpx;
  141. margin-bottom: 50rpx;
  142. background: #f5f5f5;
  143. }
  144. .pay-img-wrapper image {
  145. width: 304rpx;
  146. height: 304rpx;
  147. border-radius: 304rpx;
  148. }
  149. .pay-result .msg {
  150. text-align: center;
  151. margin: 100rpx auto;
  152. color: #2bab25;
  153. font-size: 36rpx;
  154. }
  155. .pay-result .btns {
  156. display: flex;
  157. align-items: center;
  158. justify-content: center;
  159. }
  160. .pay-result .btn {
  161. text-align: center;
  162. height: 80rpx;
  163. margin: 0 20rpx;
  164. width: 200rpx;
  165. line-height: 78rpx;
  166. border: 1px solid #868686;
  167. color: #000;
  168. border-radius: 5rpx;
  169. }
  170. .pay-result .error .msg {
  171. color: #b4282d;
  172. margin-bottom: 60rpx;
  173. }
  174. .pay-result .error .tips {
  175. color: #7f7f7f;
  176. margin-bottom: 70rpx;
  177. }
  178. .pay-result .error .tips .p {
  179. font-size: 24rpx;
  180. line-height: 42rpx;
  181. text-align: center;
  182. }
  183. .pay-result .error .tips .p {
  184. line-height: 42rpx;
  185. text-align: center;
  186. }
  187. .pay-result-top image {
  188. width: 110rpx;
  189. height: 110rpx;
  190. }
  191. .result-text {
  192. margin: 50rpx 0 20rpx;
  193. font-size: 34rpx;
  194. font-weight: bold;
  195. }
  196. .service-tips {
  197. font-size: 22rpx;
  198. padding: 0 30rpx 0;
  199. text-align: center;
  200. }
  201. .common-btn-wrapper {
  202. margin-top: 300rpx;
  203. }
  204. .appoint-wrapper {
  205. height: 100%;
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. }
  210. .appoint-block {
  211. background: url('https://jzmall.lifejingzhi.com/file/jzmall/weixin/appoint-dia.png') no-repeat center;
  212. background-size: 100% 100%;
  213. width: 576rpx;
  214. height: 524rpx;
  215. padding-top: 248rpx;
  216. display: flex;
  217. flex-direction: column;
  218. align-items: center;
  219. }
  220. .appoint-block .pay-title {
  221. height: 30rpx;
  222. font-size: 30rpx;
  223. line-height: 30rpx;
  224. color: #333;
  225. }
  226. .appoint-block .appoint-tips {
  227. height: 26rpx;
  228. font-size: 26rpx;
  229. line-height: 26rpx;
  230. margin: 32rpx 0 70rpx;
  231. }
  232. .appoint-btn {
  233. width: 458rpx;
  234. height: 80rpx;
  235. line-height: 80rpx;
  236. border-radius: 80rpx;
  237. text-align: center;
  238. color: #fff;
  239. background: #d77958;
  240. }
  241. .fanhui .van-button__text {
  242. color: #999 !important;
  243. }
  244. </style>