otherPaymentOrderRemain.vue 7.6 KB

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