paymentOrderRemain.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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="payOrder()">去支付</view>
  53. <view class="other-btn" >
  54. 亲友代付
  55. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {getUserInfo} from '@/api/user'
  62. import {payRemain,getStoreOrderById} from '@/api/storeOrder'
  63. export default {
  64. data() {
  65. return {
  66. payDelivery:0.00,
  67. order:null,
  68. user:null,
  69. orderId:null,
  70. }
  71. },
  72. onLoad(option) {
  73. this.orderId=JSON.parse(option.orderId);
  74. console.log(this.orderId)
  75. this.getStoreOrderById();
  76. this.getUserInfo();
  77. uni.showShareMenu({
  78. withShareTicket:true,
  79. //小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
  80. menus:["shareAppMessage"] //不设置默认发送给朋友
  81. })
  82. },
  83. //发送给朋友
  84. onShareAppMessage(res) {
  85. return {
  86. title: "帮TA支付",
  87. path: '/pages_user/user/otherPaymentOrderRemain?orderId='+this.orderId,
  88. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20241018/b810f26926904253ae46ea4e93b71dee.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  89. }
  90. },
  91. methods: {
  92. getUserInfo(){
  93. getUserInfo().then(
  94. res => {
  95. if(res.code==200){
  96. if(res.user!=null){
  97. this.user=res.user;
  98. }
  99. }else{
  100. uni.showToast({
  101. icon:'none',
  102. title: "请求失败",
  103. });
  104. }
  105. },
  106. rej => {}
  107. );
  108. },
  109. copyOrderSn(text) {
  110. // 复制方法
  111. uni.setClipboardData({
  112. data:text,
  113. success:()=>{
  114. uni.showToast({
  115. title:'内容已成功复制到剪切板',
  116. icon:'none'
  117. })
  118. }
  119. });
  120. },
  121. getStoreOrderById(){
  122. var data = {orderId:this.orderId};
  123. var that=this;
  124. uni.showLoading();
  125. getStoreOrderById(data).then(
  126. res => {
  127. if(res.code==200){
  128. console.log(res);
  129. uni.hideLoading();
  130. that.order=res.order;
  131. this.payDelivery=that.order.payDelivery;
  132. }else{
  133. uni.showToast({
  134. icon:'none',
  135. title: res.msg,
  136. });
  137. }
  138. },
  139. rej => {}
  140. );
  141. },
  142. payOrder(){
  143. var data = {orderId:this.order.id,payType:1};
  144. var that=this;
  145. uni.showLoading();
  146. payRemain(data).then(
  147. res => {
  148. if(res.code==200){
  149. console.log(res);
  150. uni.requestPayment({
  151. provider: 'wxpay',
  152. timeStamp: res.result.timeStamp,
  153. nonceStr: res.result.nonceStr,
  154. package: res.result.packageValue,
  155. signType: res.result.signType,
  156. paySign: res.result.paySign,
  157. success: function(res) {
  158. uni.hideLoading();
  159. uni.redirectTo({
  160. url:"success?order="+JSON.stringify(that.order)
  161. })
  162. },
  163. fail: function(err) {
  164. console.log('fail:' + JSON.stringify(err));
  165. uni.hideLoading();
  166. }
  167. });
  168. }else{
  169. uni.showToast({
  170. icon:'none',
  171. title: res.msg,
  172. });
  173. }
  174. },
  175. rej => {}
  176. );
  177. }
  178. }
  179. }
  180. </script>
  181. <style lang="scss">
  182. page{
  183. height: 100%;
  184. }
  185. .content{
  186. height: 100%;
  187. display: flex;
  188. flex-direction: column;
  189. justify-content: space-between;
  190. .inner{
  191. padding: 20upx;
  192. .time-price{
  193. box-sizing: border-box;
  194. padding: 50upx 0upx;
  195. background: #FFFFFF;
  196. border-radius: 16upx;
  197. display: flex;
  198. flex-direction: column;
  199. align-items: center;
  200. .time{
  201. font-size: 32upx;
  202. font-family: PingFang SC;
  203. font-weight: 500;
  204. color: #222222;
  205. line-height: 1;
  206. text-align: center;
  207. }
  208. .desc{
  209. margin: 30upx 0upx 15upx;
  210. font-size: 26upx;
  211. font-family: PingFang SC;
  212. color: #999999;
  213. line-height: 1;
  214. text-align: center;
  215. }
  216. .price-box{
  217. display: flex;
  218. align-items: flex-end;
  219. margin-top: 28upx;
  220. .unit{
  221. font-size: 32upx;
  222. font-family: PingFang SC;
  223. font-weight: bold;
  224. color: #FF6633;
  225. line-height: 1.3;
  226. margin-right: 10upx;
  227. }
  228. .num{
  229. font-size: 56upx;
  230. font-family: PingFang SC;
  231. font-weight: bold;
  232. color: #FF6633;
  233. line-height: 1;
  234. }
  235. }
  236. }
  237. .pay-type{
  238. box-sizing: border-box;
  239. background: #FFFFFF;
  240. border-radius: 16upx;
  241. margin-top: 20upx;
  242. padding: 40upx 30upx;
  243. display: flex;
  244. flex-direction: column;
  245. justify-content: space-between;
  246. .title{
  247. font-size: 28upx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #999999;
  251. line-height: 1;
  252. margin-bottom: 10upx;
  253. }
  254. .item{
  255. padding: 15upx 0upx;
  256. display: flex;
  257. align-items: center;
  258. justify-content: space-between;
  259. .left{
  260. display: flex;
  261. align-items: center;
  262. image{
  263. width: 44upx;
  264. height: 44upx;
  265. margin-right: 20upx;
  266. }
  267. .text{
  268. font-size: 30upx;
  269. font-family: PingFang SC;
  270. font-weight: bold;
  271. color: #222222;
  272. line-height: 1;
  273. }
  274. }
  275. }
  276. }
  277. .order-info{
  278. margin-top: 20upx;
  279. background: #FFFFFF;
  280. border-radius: 16upx;
  281. padding: 40upx 30upx;
  282. .title{
  283. font-size: 30upx;
  284. font-family: PingFang SC;
  285. font-weight: bold;
  286. color: #222222;
  287. line-height: 1;
  288. }
  289. .item{
  290. margin-top: 40upx;
  291. display: flex;
  292. align-items: center;
  293. justify-content: space-between;
  294. .label{
  295. font-size: 26upx;
  296. font-family: PingFang SC;
  297. font-weight: 500;
  298. color: #666666;
  299. line-height: 1;
  300. }
  301. .text{
  302. font-size: 26upx;
  303. font-family: PingFang SC;
  304. font-weight: 500;
  305. color: #222222;
  306. line-height: 32upx;
  307. }
  308. .cont-text{
  309. font-size: 26upx;
  310. font-family: PingFang SC;
  311. font-weight: 500;
  312. color: #666666;
  313. .bold{
  314. color: #111111;
  315. }
  316. }
  317. .sn-box{
  318. display: flex;
  319. align-items: center;
  320. .copy-btn{
  321. width: 58upx;
  322. height: 32upx;
  323. line-height: 32upx;
  324. text-align: center;
  325. font-size: 22upx;
  326. font-family: PingFang SC;
  327. font-weight: 500;
  328. color: #222222;
  329. background: #F5F5F5;
  330. border-radius: 4upx;
  331. margin-left: 24upx;
  332. }
  333. }
  334. }
  335. .line{
  336. width: 100%;
  337. height: 1px;
  338. background: #F0F0F0;
  339. margin-top: 30upx;
  340. }
  341. }
  342. }
  343. .btn-box{
  344. height: 242upx;
  345. background: #FFFFFF;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. flex-direction: column;
  350. .btn{
  351. width: 91.73%;
  352. height: 88upx;
  353. line-height: 88upx;
  354. font-size: 30upx;
  355. font-family: PingFang SC;
  356. font-weight: bold;
  357. color: #FFFFFF;
  358. text-align: center;
  359. background: #018C39;
  360. border-radius: 44upx;
  361. margin-bottom: 10rpx;
  362. }
  363. .other-btn{
  364. width: 91.73%;
  365. height: 88upx;
  366. line-height: 88upx;
  367. font-size: 30upx;
  368. font-family: PingFang SC;
  369. font-weight: bold;
  370. color: #018C39;
  371. border: 1rpx solid #018C39;
  372. text-align: center;
  373. background: #FFFFFF;
  374. border-radius: 44upx;
  375. margin-bottom: 10rpx;
  376. position: relative;
  377. .share{
  378. display: inline-block;
  379. position: absolute;
  380. top: 0;
  381. left: 0;
  382. width: 100%;
  383. height: 100%;
  384. opacity: 0;
  385. }
  386. }
  387. }
  388. }
  389. </style>