otherPaymentOrder.vue 7.2 KB

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