paymentOrder.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. uni.hideLoading();
  85. that.order=res.order;
  86. }else{
  87. uni.showToast({
  88. icon:'none',
  89. title: res.msg,
  90. });
  91. }
  92. },
  93. rej => {}
  94. );
  95. },
  96. payOrder(){
  97. var data = {orderId:this.order.orderId};
  98. var that=this;
  99. uni.showLoading();
  100. pay(data).then(
  101. res => {
  102. if(res.code==200){
  103. uni.requestPayment({
  104. provider: 'wxpay',
  105. timeStamp: res.result.timeStamp,
  106. nonceStr: res.result.nonceStr,
  107. package: res.result.packageValue,
  108. signType: res.result.signType,
  109. paySign: res.result.paySign,
  110. success: function(res) {
  111. uni.hideLoading();
  112. uni.redirectTo({
  113. url: './doctorOrderIM?orderId='+that.order.orderId
  114. })
  115. },
  116. fail: function(err) {
  117. console.log('fail:' + JSON.stringify(err));
  118. uni.hideLoading();
  119. }
  120. });
  121. }else{
  122. uni.showToast({
  123. icon:'none',
  124. title: res.msg,
  125. });
  126. }
  127. },
  128. rej => {}
  129. );
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="scss">
  135. page{
  136. height: 100%;
  137. }
  138. .content{
  139. height: 100%;
  140. display: flex;
  141. flex-direction: column;
  142. justify-content: space-between;
  143. .inner{
  144. padding: 20upx;
  145. .time-price{
  146. box-sizing: border-box;
  147. height: 200upx;
  148. background: #FFFFFF;
  149. border-radius: 16upx;
  150. display: flex;
  151. flex-direction: column;
  152. align-items: center;
  153. padding-top: 50upx;
  154. .time{
  155. font-size: 26upx;
  156. font-family: PingFang SC;
  157. font-weight: 500;
  158. color: #999999;
  159. line-height: 1;
  160. text-align: center;
  161. }
  162. .price-box{
  163. display: flex;
  164. align-items: flex-end;
  165. margin-top: 28upx;
  166. .unit{
  167. font-size: 32upx;
  168. font-family: PingFang SC;
  169. font-weight: bold;
  170. color: #FF6633;
  171. line-height: 1.3;
  172. margin-right: 10upx;
  173. }
  174. .num{
  175. font-size: 56upx;
  176. font-family: PingFang SC;
  177. font-weight: bold;
  178. color: #FF6633;
  179. line-height: 1;
  180. }
  181. }
  182. }
  183. .pay-type{
  184. box-sizing: border-box;
  185. height: 192upx;
  186. background: #FFFFFF;
  187. border-radius: 16upx;
  188. margin-top: 20upx;
  189. padding: 40upx 30upx;
  190. display: flex;
  191. flex-direction: column;
  192. justify-content: space-between;
  193. .title{
  194. font-size: 28upx;
  195. font-family: PingFang SC;
  196. font-weight: 500;
  197. color: #999999;
  198. line-height: 1;
  199. }
  200. .item{
  201. display: flex;
  202. align-items: center;
  203. justify-content: space-between;
  204. .left{
  205. display: flex;
  206. align-items: center;
  207. image{
  208. width: 44upx;
  209. height: 44upx;
  210. margin-right: 20upx;
  211. }
  212. .text{
  213. font-size: 30upx;
  214. font-family: PingFang SC;
  215. font-weight: bold;
  216. color: #222222;
  217. line-height: 1;
  218. }
  219. }
  220. }
  221. }
  222. .order-info{
  223. margin-top: 20upx;
  224. background: #FFFFFF;
  225. border-radius: 16upx;
  226. padding: 40upx 30upx;
  227. .title{
  228. font-size: 30upx;
  229. font-family: PingFang SC;
  230. font-weight: bold;
  231. color: #222222;
  232. line-height: 1;
  233. }
  234. .item{
  235. margin-top: 40upx;
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-between;
  239. .label{
  240. font-size: 26upx;
  241. font-family: PingFang SC;
  242. font-weight: 500;
  243. color: #666666;
  244. line-height: 1;
  245. }
  246. .text{
  247. font-size: 26upx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #222222;
  251. line-height: 32upx;
  252. }
  253. .cont-text{
  254. font-size: 26upx;
  255. font-family: PingFang SC;
  256. font-weight: 500;
  257. color: #666666;
  258. .bold{
  259. color: #111111;
  260. }
  261. }
  262. .sn-box{
  263. display: flex;
  264. align-items: center;
  265. .copy-btn{
  266. width: 58upx;
  267. height: 32upx;
  268. line-height: 32upx;
  269. text-align: center;
  270. font-size: 22upx;
  271. font-family: PingFang SC;
  272. font-weight: 500;
  273. color: #222222;
  274. background: #F5F5F5;
  275. border-radius: 4upx;
  276. margin-left: 24upx;
  277. }
  278. }
  279. }
  280. .line{
  281. width: 100%;
  282. height: 1px;
  283. background: #F0F0F0;
  284. margin-top: 30upx;
  285. }
  286. }
  287. }
  288. .btn-box{
  289. height: 121upx;
  290. background: #FFFFFF;
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. .btn{
  295. width: 91.73%;
  296. height: 88upx;
  297. line-height: 88upx;
  298. font-size: 30upx;
  299. font-family: PingFang SC;
  300. font-weight: bold;
  301. color: #FFFFFF;
  302. text-align: center;
  303. background: #018C39;
  304. border-radius: 44upx;
  305. }
  306. }
  307. }
  308. </style>