paymentOrder.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view class="time-price">
  5. <text class="time">订单金额</text>
  6. <view class="price-box">
  7. <text class="unit">¥</text>
  8. <text class="num">{{order.payMoney}}</text>
  9. </view>
  10. </view>
  11. <!-- 支付方式 -->
  12. <view class="pay-type">
  13. <view class="title">支付方式</view>
  14. <view class="item">
  15. <view class="left">
  16. <image src="../../static/images/wecha_pay.png" mode=""></image>
  17. <text class="text">微信支付</text>
  18. </view>
  19. <label>
  20. <checkbox disabled value="" :checked="wxPay" />
  21. </label>
  22. </view>
  23. </view>
  24. <!-- 订单详情查看 -->
  25. <view class="order-info">
  26. <view class="title">订单信息</view>
  27. <view class="item">
  28. <text class="label">订单编号</text>
  29. <view class="sn-box">
  30. <text class="text">{{order.orderSn}}</text>
  31. <view class="copy-btn" @click="copyOrderSn(order.orderSn)">复制</view>
  32. </view>
  33. </view>
  34. <view class="item">
  35. <text class="label">下单时间</text>
  36. <text class="text">{{order.createTime}}</text>
  37. </view>
  38. <view class="item">
  39. <text class="label">支付方式</text>
  40. <text class="text">微信支付</text>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="btn-box">
  45. <view class="btn" @click="payOrder()">去支付</view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import {pay,getDoctorOrderDetail} from '@/api/doctorOrder.js'
  51. export default {
  52. data() {
  53. return {
  54. payLimitTime:null,
  55. order:null,
  56. // 默认选中微信支付
  57. wxPay: true,
  58. }
  59. },
  60. onLoad(option) {
  61. this.orderId=JSON.parse(option.orderId);
  62. this.getDoctorOrderDetail();
  63. },
  64. methods: {
  65. copyOrderSn(text) {
  66. // 复制方法
  67. uni.setClipboardData({
  68. data:text,
  69. success:()=>{
  70. uni.showToast({
  71. title:'内容已成功复制到剪切板',
  72. icon:'none'
  73. })
  74. }
  75. });
  76. },
  77. getDoctorOrderDetail(){
  78. var data = {orderId:this.orderId};
  79. var that=this;
  80. uni.showLoading();
  81. getDoctorOrderDetail(data).then(
  82. res => {
  83. if(res.code==200){
  84. console.log(res);
  85. uni.hideLoading();
  86. that.order=res.order;
  87. }else{
  88. uni.showToast({
  89. icon:'none',
  90. title: res.msg,
  91. });
  92. }
  93. },
  94. rej => {}
  95. );
  96. },
  97. payOrder(){
  98. var data = {orderId:this.order.orderId};
  99. var that=this;
  100. uni.showLoading();
  101. pay(data).then(
  102. res => {
  103. if(res.code==200){
  104. uni.requestPayment({
  105. provider: 'wxpay',
  106. timeStamp: res.result.timeStamp,
  107. nonceStr: res.result.nonceStr,
  108. package: res.result.packageValue,
  109. signType: res.result.signType,
  110. paySign: res.result.paySign,
  111. success: function(res) {
  112. uni.hideLoading();
  113. uni.redirectTo({
  114. url: './doctorOrderIM?orderId='+that.order.orderId
  115. })
  116. },
  117. fail: function(err) {
  118. console.log('fail:' + JSON.stringify(err));
  119. uni.hideLoading();
  120. }
  121. });
  122. }else{
  123. uni.showToast({
  124. icon:'none',
  125. title: res.msg,
  126. });
  127. }
  128. },
  129. rej => {}
  130. );
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss">
  136. page{
  137. height: 100%;
  138. }
  139. .content{
  140. height: 100%;
  141. display: flex;
  142. flex-direction: column;
  143. justify-content: space-between;
  144. .inner{
  145. padding: 20upx;
  146. .time-price{
  147. box-sizing: border-box;
  148. height: 200upx;
  149. background: #FFFFFF;
  150. border-radius: 16upx;
  151. display: flex;
  152. flex-direction: column;
  153. align-items: center;
  154. padding-top: 50upx;
  155. .time{
  156. font-size: 26upx;
  157. font-family: PingFang SC;
  158. font-weight: 500;
  159. color: #999999;
  160. line-height: 1;
  161. text-align: center;
  162. }
  163. .price-box{
  164. display: flex;
  165. align-items: flex-end;
  166. margin-top: 28upx;
  167. .unit{
  168. font-size: 32upx;
  169. font-family: PingFang SC;
  170. font-weight: bold;
  171. color: #FF6633;
  172. line-height: 1.3;
  173. margin-right: 10upx;
  174. }
  175. .num{
  176. font-size: 56upx;
  177. font-family: PingFang SC;
  178. font-weight: bold;
  179. color: #FF6633;
  180. line-height: 1;
  181. }
  182. }
  183. }
  184. .pay-type{
  185. box-sizing: border-box;
  186. height: 192upx;
  187. background: #FFFFFF;
  188. border-radius: 16upx;
  189. margin-top: 20upx;
  190. padding: 40upx 30upx;
  191. display: flex;
  192. flex-direction: column;
  193. justify-content: space-between;
  194. .title{
  195. font-size: 28upx;
  196. font-family: PingFang SC;
  197. font-weight: 500;
  198. color: #999999;
  199. line-height: 1;
  200. }
  201. .item{
  202. display: flex;
  203. align-items: center;
  204. justify-content: space-between;
  205. .left{
  206. display: flex;
  207. align-items: center;
  208. image{
  209. width: 44upx;
  210. height: 44upx;
  211. margin-right: 20upx;
  212. }
  213. .text{
  214. font-size: 30upx;
  215. font-family: PingFang SC;
  216. font-weight: bold;
  217. color: #222222;
  218. line-height: 1;
  219. }
  220. }
  221. }
  222. }
  223. .order-info{
  224. margin-top: 20upx;
  225. background: #FFFFFF;
  226. border-radius: 16upx;
  227. padding: 40upx 30upx;
  228. .title{
  229. font-size: 30upx;
  230. font-family: PingFang SC;
  231. font-weight: bold;
  232. color: #222222;
  233. line-height: 1;
  234. }
  235. .item{
  236. margin-top: 40upx;
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-between;
  240. .label{
  241. font-size: 26upx;
  242. font-family: PingFang SC;
  243. font-weight: 500;
  244. color: #666666;
  245. line-height: 1;
  246. }
  247. .text{
  248. font-size: 26upx;
  249. font-family: PingFang SC;
  250. font-weight: 500;
  251. color: #222222;
  252. line-height: 32upx;
  253. }
  254. .cont-text{
  255. font-size: 26upx;
  256. font-family: PingFang SC;
  257. font-weight: 500;
  258. color: #666666;
  259. .bold{
  260. color: #111111;
  261. }
  262. }
  263. .sn-box{
  264. display: flex;
  265. align-items: center;
  266. .copy-btn{
  267. width: 58upx;
  268. height: 32upx;
  269. line-height: 32upx;
  270. text-align: center;
  271. font-size: 22upx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. color: #222222;
  275. background: #F5F5F5;
  276. border-radius: 4upx;
  277. margin-left: 24upx;
  278. }
  279. }
  280. }
  281. .line{
  282. width: 100%;
  283. height: 1px;
  284. background: #F0F0F0;
  285. margin-top: 30upx;
  286. }
  287. }
  288. }
  289. .btn-box{
  290. height: 121upx;
  291. background: #FFFFFF;
  292. display: flex;
  293. align-items: center;
  294. justify-content: center;
  295. .btn{
  296. width: 91.73%;
  297. height: 88upx;
  298. line-height: 88upx;
  299. font-size: 30upx;
  300. font-family: PingFang SC;
  301. font-weight: bold;
  302. color: #FFFFFF;
  303. text-align: center;
  304. background: #018C39;
  305. border-radius: 44upx;
  306. }
  307. }
  308. }
  309. </style>