paymentOrderRemain.vue 9.0 KB

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