otherPaymentOrderRemain.vue 7.4 KB

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