otherPaymentOrder.vue 7.4 KB

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