otherPaymentOrder.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. wx.navigateToMiniProgram({
  121. appId: 'wx1b63de1096c46cde', // 收银台小程序 AppId 固定值
  122. path: '/pages/pay/pay', // 收银台小程序 固定路径
  123. extraData: {
  124. orderNo: result.orderNo,
  125. orderAmt: result.orderAmt,
  126. platMerCstNo: result.platMerCstNo,
  127. platMerCstName: result.platMerCstName,
  128. businessCstNo: result.businessCstNo,
  129. licenseCode: result.licenseCode,
  130. },
  131. envVersion: 'release', // 开发版 develop,体验版 trial,正式环境传 release
  132. success(res) {
  133. uni.showLoading({
  134. title:"查询支付结果中..."
  135. })
  136. setTimeout(()=>{
  137. uni.navigateTo({
  138. url: '/pages_user/user/storeOrderDetail?id='+this.order.id
  139. })
  140. },4000)
  141. console.log(res)
  142. // 接口调用成功的回调函数
  143. },
  144. fail(res) {
  145. // 接口调用失败的回调函数
  146. }
  147. })
  148. // uni.requestPayment({
  149. // provider: 'wxpay',
  150. // timeStamp: result.timeStamp,
  151. // nonceStr: result.nonceStr,
  152. // package: result.package,
  153. // signType: result.signType,
  154. // paySign: result.paySign,
  155. // success: function(res) {
  156. // uni.hideLoading();
  157. // uni.redirectTo({
  158. // url:"otherPaySuccess"
  159. // })
  160. // },
  161. // fail: function(err) {
  162. // uni.showToast({
  163. // icon:'none',
  164. // title:'fail:' + JSON.stringify(err),
  165. // });
  166. // console.log('fail:' + JSON.stringify(err));
  167. // uni.hideLoading();
  168. // }
  169. // });
  170. // uni.requestPayment({
  171. // provider: 'wxpay',
  172. // timeStamp: res.result.timeStamp,
  173. // nonceStr: res.result.nonceStr,
  174. // package: res.result.packageValue,
  175. // signType: res.result.signType,
  176. // paySign: res.result.paySign,
  177. // success: function(res) {
  178. // uni.hideLoading();
  179. // uni.redirectTo({
  180. // url:"otherPaySuccess"
  181. // })
  182. // },
  183. // fail: function(err) {
  184. // uni.showToast({
  185. // icon:'none',
  186. // title:'fail:' + JSON.stringify(err),
  187. // });
  188. // console.log('fail:' + JSON.stringify(err));
  189. // uni.hideLoading();
  190. // }
  191. // });
  192. }else{
  193. uni.showToast({
  194. icon:'none',
  195. title: res.msg,
  196. });
  197. }
  198. },
  199. rej => {}
  200. );
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss">
  206. page{
  207. height: 100%;
  208. }
  209. .content{
  210. height: 100%;
  211. display: flex;
  212. flex-direction: column;
  213. justify-content: space-between;
  214. .inner{
  215. padding: 20upx;
  216. .time-price{
  217. box-sizing: border-box;
  218. padding: 50upx 0upx;
  219. background: #FFFFFF;
  220. border-radius: 16upx;
  221. display: flex;
  222. flex-direction: column;
  223. align-items: center;
  224. .time{
  225. font-size: 32upx;
  226. font-family: PingFang SC;
  227. font-weight: 500;
  228. color: #222222;
  229. line-height: 1;
  230. text-align: center;
  231. }
  232. .desc{
  233. margin: 30upx 0upx 15upx;
  234. font-size: 26upx;
  235. font-family: PingFang SC;
  236. color: #999999;
  237. line-height: 1;
  238. text-align: center;
  239. }
  240. .price-box{
  241. display: flex;
  242. align-items: flex-end;
  243. margin-top: 28upx;
  244. .unit{
  245. font-size: 32upx;
  246. font-family: PingFang SC;
  247. font-weight: bold;
  248. color: #FF6633;
  249. line-height: 1.3;
  250. margin-right: 10upx;
  251. }
  252. .num{
  253. font-size: 56upx;
  254. font-family: PingFang SC;
  255. font-weight: bold;
  256. color: #FF6633;
  257. line-height: 1;
  258. }
  259. }
  260. }
  261. .pay-type{
  262. box-sizing: border-box;
  263. background: #FFFFFF;
  264. border-radius: 16upx;
  265. margin-top: 20upx;
  266. padding: 40upx 30upx;
  267. display: flex;
  268. flex-direction: column;
  269. justify-content: space-between;
  270. .title{
  271. font-size: 28upx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. color: #999999;
  275. line-height: 1;
  276. margin-bottom: 10upx;
  277. }
  278. .item{
  279. padding: 15upx 0upx;
  280. display: flex;
  281. align-items: center;
  282. justify-content: space-between;
  283. .left{
  284. display: flex;
  285. align-items: center;
  286. image{
  287. width: 44upx;
  288. height: 44upx;
  289. margin-right: 20upx;
  290. }
  291. .text{
  292. font-size: 30upx;
  293. font-family: PingFang SC;
  294. font-weight: bold;
  295. color: #222222;
  296. line-height: 1;
  297. }
  298. }
  299. }
  300. }
  301. .order-info{
  302. margin-top: 20upx;
  303. background: #FFFFFF;
  304. border-radius: 16upx;
  305. padding: 40upx 30upx;
  306. .title{
  307. font-size: 30upx;
  308. font-family: PingFang SC;
  309. font-weight: bold;
  310. color: #222222;
  311. line-height: 1;
  312. }
  313. .item{
  314. margin-top: 40upx;
  315. display: flex;
  316. align-items: center;
  317. justify-content: space-between;
  318. .label{
  319. font-size: 26upx;
  320. font-family: PingFang SC;
  321. font-weight: 500;
  322. color: #666666;
  323. line-height: 1;
  324. }
  325. .text{
  326. font-size: 26upx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #222222;
  330. line-height: 32upx;
  331. }
  332. .cont-text{
  333. font-size: 26upx;
  334. font-family: PingFang SC;
  335. font-weight: 500;
  336. color: #666666;
  337. .bold{
  338. color: #111111;
  339. }
  340. }
  341. .sn-box{
  342. display: flex;
  343. align-items: center;
  344. .copy-btn{
  345. width: 58upx;
  346. height: 32upx;
  347. line-height: 32upx;
  348. text-align: center;
  349. font-size: 22upx;
  350. font-family: PingFang SC;
  351. font-weight: 500;
  352. color: #222222;
  353. background: #F5F5F5;
  354. border-radius: 4upx;
  355. margin-left: 24upx;
  356. }
  357. }
  358. }
  359. .line{
  360. width: 100%;
  361. height: 1px;
  362. background: #F0F0F0;
  363. margin-top: 30upx;
  364. }
  365. }
  366. }
  367. .btn-box{
  368. height: 121upx;
  369. background: #FFFFFF;
  370. display: flex;
  371. align-items: center;
  372. justify-content: center;
  373. flex-direction: column;
  374. .btn{
  375. width: 91.73%;
  376. height: 88upx;
  377. line-height: 88upx;
  378. font-size: 30upx;
  379. font-family: PingFang SC;
  380. font-weight: bold;
  381. color: #FFFFFF;
  382. text-align: center;
  383. background: #2BC7B9;
  384. border-radius: 44upx;
  385. margin-bottom: 10rpx;
  386. }
  387. }
  388. }
  389. </style>