otherPaymentOrder.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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. var result=JSON.parse(res.result);
  120. uni.requestPayment({
  121. provider: 'wxpay',
  122. timeStamp: result.timeStamp,
  123. nonceStr: result.nonceStr,
  124. package: result.package,
  125. signType: result.signType,
  126. paySign: result.paySign,
  127. success: function(res) {
  128. uni.hideLoading();
  129. uni.redirectTo({
  130. url:"otherPaySuccess"
  131. })
  132. },
  133. fail: function(err) {
  134. uni.showToast({
  135. icon:'none',
  136. title:'fail:' + JSON.stringify(err),
  137. });
  138. console.log('fail:' + JSON.stringify(err));
  139. uni.hideLoading();
  140. }
  141. });
  142. // uni.requestPayment({
  143. // provider: 'wxpay',
  144. // timeStamp: res.result.timeStamp,
  145. // nonceStr: res.result.nonceStr,
  146. // package: res.result.packageValue,
  147. // signType: res.result.signType,
  148. // paySign: res.result.paySign,
  149. // success: function(res) {
  150. // uni.hideLoading();
  151. // uni.redirectTo({
  152. // url:"otherPaySuccess"
  153. // })
  154. // },
  155. // fail: function(err) {
  156. // uni.showToast({
  157. // icon:'none',
  158. // title:'fail:' + JSON.stringify(err),
  159. // });
  160. // console.log('fail:' + JSON.stringify(err));
  161. // uni.hideLoading();
  162. // }
  163. // });
  164. }else{
  165. uni.showToast({
  166. icon:'none',
  167. title: res.msg,
  168. });
  169. }
  170. },
  171. rej => {}
  172. );
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss">
  178. page{
  179. height: 100%;
  180. }
  181. .content{
  182. height: 100%;
  183. display: flex;
  184. flex-direction: column;
  185. justify-content: space-between;
  186. .inner{
  187. padding: 20upx;
  188. .time-price{
  189. box-sizing: border-box;
  190. padding: 50upx 0upx;
  191. background: #FFFFFF;
  192. border-radius: 16upx;
  193. display: flex;
  194. flex-direction: column;
  195. align-items: center;
  196. .time{
  197. font-size: 32upx;
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. color: #222222;
  201. line-height: 1;
  202. text-align: center;
  203. }
  204. .desc{
  205. margin: 30upx 0upx 15upx;
  206. font-size: 26upx;
  207. font-family: PingFang SC;
  208. color: #999999;
  209. line-height: 1;
  210. text-align: center;
  211. }
  212. .price-box{
  213. display: flex;
  214. align-items: flex-end;
  215. margin-top: 28upx;
  216. .unit{
  217. font-size: 32upx;
  218. font-family: PingFang SC;
  219. font-weight: bold;
  220. color: #FF6633;
  221. line-height: 1.3;
  222. margin-right: 10upx;
  223. }
  224. .num{
  225. font-size: 56upx;
  226. font-family: PingFang SC;
  227. font-weight: bold;
  228. color: #FF6633;
  229. line-height: 1;
  230. }
  231. }
  232. }
  233. .pay-type{
  234. box-sizing: border-box;
  235. background: #FFFFFF;
  236. border-radius: 16upx;
  237. margin-top: 20upx;
  238. padding: 40upx 30upx;
  239. display: flex;
  240. flex-direction: column;
  241. justify-content: space-between;
  242. .title{
  243. font-size: 28upx;
  244. font-family: PingFang SC;
  245. font-weight: 500;
  246. color: #999999;
  247. line-height: 1;
  248. margin-bottom: 10upx;
  249. }
  250. .item{
  251. padding: 15upx 0upx;
  252. display: flex;
  253. align-items: center;
  254. justify-content: space-between;
  255. .left{
  256. display: flex;
  257. align-items: center;
  258. image{
  259. width: 44upx;
  260. height: 44upx;
  261. margin-right: 20upx;
  262. }
  263. .text{
  264. font-size: 30upx;
  265. font-family: PingFang SC;
  266. font-weight: bold;
  267. color: #222222;
  268. line-height: 1;
  269. }
  270. }
  271. }
  272. }
  273. .order-info{
  274. margin-top: 20upx;
  275. background: #FFFFFF;
  276. border-radius: 16upx;
  277. padding: 40upx 30upx;
  278. .title{
  279. font-size: 30upx;
  280. font-family: PingFang SC;
  281. font-weight: bold;
  282. color: #222222;
  283. line-height: 1;
  284. }
  285. .item{
  286. margin-top: 40upx;
  287. display: flex;
  288. align-items: center;
  289. justify-content: space-between;
  290. .label{
  291. font-size: 26upx;
  292. font-family: PingFang SC;
  293. font-weight: 500;
  294. color: #666666;
  295. line-height: 1;
  296. }
  297. .text{
  298. font-size: 26upx;
  299. font-family: PingFang SC;
  300. font-weight: 500;
  301. color: #222222;
  302. line-height: 32upx;
  303. }
  304. .cont-text{
  305. font-size: 26upx;
  306. font-family: PingFang SC;
  307. font-weight: 500;
  308. color: #666666;
  309. .bold{
  310. color: #111111;
  311. }
  312. }
  313. .sn-box{
  314. display: flex;
  315. align-items: center;
  316. .copy-btn{
  317. width: 58upx;
  318. height: 32upx;
  319. line-height: 32upx;
  320. text-align: center;
  321. font-size: 22upx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #222222;
  325. background: #F5F5F5;
  326. border-radius: 4upx;
  327. margin-left: 24upx;
  328. }
  329. }
  330. }
  331. .line{
  332. width: 100%;
  333. height: 1px;
  334. background: #F0F0F0;
  335. margin-top: 30upx;
  336. }
  337. }
  338. }
  339. .btn-box{
  340. height: 121upx;
  341. background: #FFFFFF;
  342. display: flex;
  343. align-items: center;
  344. justify-content: center;
  345. flex-direction: column;
  346. .btn{
  347. width: 91.73%;
  348. height: 88upx;
  349. line-height: 88upx;
  350. font-size: 30upx;
  351. font-family: PingFang SC;
  352. font-weight: bold;
  353. color: #FFFFFF;
  354. text-align: center;
  355. background: #2BC7B9;
  356. border-radius: 44upx;
  357. margin-bottom: 10rpx;
  358. }
  359. }
  360. }
  361. </style>