inquiryPay.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <view class="content">
  3. <view class="cont">
  4. <view class="other-info">
  5. <view class="title">付款详情</view>
  6. <view class="item">
  7. <view class="left">
  8. <text class="label">订单号:</text>
  9. </view>
  10. <view class="right">
  11. <text class="text" v-if="order!=null">{{order.orderSn}}</text>
  12. </view>
  13. </view>
  14. <view class="item">
  15. <view class="left">
  16. <text class="label">订单类型:</text>
  17. </view>
  18. <view class="right">
  19. <text class="text" >
  20. <text >{{$getDictLabelName(inquiryTypeOptions,order.inquiryType)}}</text>
  21. <text >-{{$getDictLabelName(orderTypeOptions,order.orderType)}}</text>
  22. </text>
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="left">
  27. <text class="label">订单金额:</text>
  28. </view>
  29. <view class="right">
  30. <text class="text">{{order.money.toFixed(2)}}</text>
  31. </view>
  32. </view>
  33. <view class="item" v-if="order!=null&&(order.userCouponId==null||order.userCouponId==0)" @click.stop="openCoupon()">
  34. <view class="left">
  35. <text class="label">优惠券:</text>
  36. </view>
  37. <view class="right">
  38. <text class="text">{{couponText}}</text>
  39. <image v-if="userCouponId!=0" @click.stop="delCoupon()" class="ic-close" src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/images/close.png"></image>
  40. <image class="ic-back" src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/images/arrow_gray.png"></image>
  41. </view>
  42. </view>
  43. <view class="item" v-if="order.userCouponId==null||order.userCouponId==0">
  44. <view class="left">
  45. <text class="label">优惠金额:</text>
  46. </view>
  47. <view class="right">
  48. <text class="text">{{discountMoney.toFixed(2)}}</text>
  49. </view>
  50. </view>
  51. <view class="item">
  52. <view class="left">
  53. <text class="label">支付金额:</text>
  54. </view>
  55. <view class="right">
  56. <text class="text">{{payMoney.toFixed(2)}}</text>
  57. </view>
  58. </view>
  59. <u-popup :closeable="true" :show="couponShow" :round="10" mode="bottom" @close="close" @open="open">
  60. <view class="coupon">
  61. <view class="coupon-box" v-if="coupons.length>0" >
  62. <view @click="couponSelect(item)" class="coupon-item" v-for="(item) in coupons">
  63. <view class="left" >
  64. <image v-if="item.status==0" src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/imagesNew/004bcf24fc7641dea9f3247fa8d59ea2.png" mode="widthFix"></image>
  65. <image v-if="item.status!=0" src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/imagesNew/3ce37842579c48e2b8e50e547adbfeb6.png" mode="widthFix"></image>
  66. <view style="z-index: 999;">
  67. ¥<span class="num">{{item.price.toFixed(2)}}</span>
  68. </view>
  69. <view class="pic-num" >满{{item.minPrice.toFixed(2)}}元可用</view>
  70. </view>
  71. <view class="right">
  72. <view class="title">
  73. {{item.title}}
  74. </view>
  75. <view class="btns">
  76. <view v-if="item.status==0||item.status==2" >{{item.limitTime}} 到期</view>
  77. <view v-if="item.status==1">使用时间 {{item.useTime}}</view>
  78. <view class="bnt gray" v-if="item.status==1" >已使用</view>
  79. <view class="bnt gray" v-if="item.status==2" >已过期</view>
  80. <view class="btn" v-if="item.status==0" >使用</view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="empty" v-if="coupons.length==0">
  86. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/imagesNew/cf4a86b913a04341bb44e34bb4d37aa2.png"></image>
  87. </view>
  88. </view>
  89. </u-popup>
  90. </view>
  91. </view>
  92. <view class="btn-box">
  93. <view class="btn" @click="payOrder()">支付{{payMoney.toFixed(2)}}元</view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. import {getMyEnableCouponList} from '@/api/user.js'
  99. import {getDictByKey} from '@/api/common.js'
  100. import {pay,getInquiryOrderById,compute} from '@/api/inquiryOrder.js'
  101. export default {
  102. data() {
  103. return {
  104. order:null,
  105. orderId:null,
  106. orderTypeOptions:[],
  107. inquiryTypeOptions:[],
  108. couponText:"请选择优惠券",
  109. userCouponId:0,
  110. coupons:[],
  111. couponShow:false,
  112. payMoney:0,
  113. discountMoney:0
  114. }
  115. },
  116. onLoad(options) {
  117. if(options.scene) {
  118. const scene = decodeURIComponent(options.scene);
  119. this.orderId= scene.split("orderId=")[1];
  120. } else {
  121. this.orderId=options.orderId;
  122. }
  123. },
  124. onShow() {
  125. this.getDictByKey("sys_inquiry_order_type");
  126. this.getDictByKey("sys_inquiry_type");
  127. this.getInquiryOrderById();
  128. this.getMyEnableCouponList();
  129. },
  130. //发送给朋友
  131. // onShareAppMessage(res) {
  132. // var that=this;
  133. // if(this.$isLogin()){
  134. // return {
  135. // title: "订单支付",
  136. // path: '/pages_order/inquiryPay?orderId='+that.orderId,
  137. // imageUrl: 'https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/imagesNew/logo.jpg' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  138. // }
  139. // }
  140. // },
  141. methods: {
  142. couponSelect(item){
  143. this.couponShow = false;
  144. //计算金额
  145. this.userCouponId=item.id;
  146. console.log(item)
  147. this.couponText=item.price+"元优惠券"
  148. this.compute()
  149. },
  150. open() {
  151. },
  152. close() {
  153. this.couponShow = false
  154. },
  155. openCoupon(){
  156. this.couponShow=true;
  157. },
  158. delCoupon(){
  159. this.userCouponId=0;
  160. this.couponText="请选择优惠券"
  161. this.compute()
  162. },
  163. compute(){
  164. var data={
  165. orderId:this.orderId,
  166. userCouponId:this.userCouponId,
  167. appId:getApp().globalData.appId
  168. }
  169. console.log(data)
  170. compute(data).then(
  171. res => {
  172. if(res.code==200){
  173. this.payMoney=res.data.payMoney;
  174. this.discountMoney=res.data.discountMoney;
  175. }
  176. else{
  177. this.userCouponId=0;
  178. this.couponText="请选择优惠券"
  179. uni.showToast({
  180. icon:'none',
  181. title: res.msg,
  182. });
  183. this.$reLoginCheck(res.msg)
  184. }
  185. },
  186. err => {
  187. }
  188. );
  189. },
  190. getMyEnableCouponList(){
  191. var data={couponType:3,orderId:this.orderId}
  192. getMyEnableCouponList(data).then(
  193. res => {
  194. if(res.code==200){
  195. this.coupons=res.data;
  196. }
  197. },
  198. err => {
  199. }
  200. );
  201. },
  202. getDictByKey(key){
  203. var data={key:key}
  204. getDictByKey(data).then(
  205. res => {
  206. if(res.code==200){
  207. if(key=="sys_inquiry_order_type"){
  208. this.orderTypeOptions=res.data;
  209. }
  210. if(key=="sys_inquiry_type"){
  211. this.inquiryTypeOptions=res.data;
  212. }
  213. }
  214. },
  215. err => {
  216. }
  217. );
  218. },
  219. getInquiryOrderById(){
  220. var data = {orderId:this.orderId};
  221. var that=this;
  222. uni.showLoading();
  223. getInquiryOrderById(data).then(
  224. res => {
  225. if(res.code==200){
  226. uni.hideLoading();
  227. that.order=res.data;
  228. this.compute();
  229. }else{
  230. uni.showToast({
  231. icon:'none',
  232. title: res.msg,
  233. });
  234. }
  235. },
  236. rej => {}
  237. );
  238. },
  239. payOrder(){
  240. var data = {
  241. orderId:this.order.orderId,
  242. userCouponId:this.userCouponId,
  243. appId:getApp().globalData.appId
  244. };
  245. var that=this;
  246. uni.showLoading();
  247. pay(data).then(
  248. res => {
  249. if(res.code==200){
  250. uni.redirectTo({
  251. url:"./inquiryPayment?orderId="+this.orderId
  252. })
  253. }else{
  254. uni.showToast({
  255. icon:'none',
  256. title: res.msg,
  257. });
  258. this.$reLoginCheck(res.msg)
  259. }
  260. },
  261. rej => {}
  262. );
  263. }
  264. }
  265. }
  266. </script>
  267. <style lang="scss">
  268. page{
  269. background: #f6f6f6;
  270. }
  271. </style>
  272. <style scoped lang="scss">
  273. .content{
  274. position: relative;
  275. .cont{
  276. position: relative;
  277. padding: 0rpx 20rpx 160rpx;
  278. z-index: 999;
  279. width: 100%;
  280. display: flex;
  281. flex-direction: column;
  282. }
  283. .other-info{
  284. margin-top: 20upx;
  285. background-color: #fff;
  286. border-radius: 20upx;
  287. overflow: hidden;
  288. padding: 0 30upx;
  289. .title{
  290. height: 80upx;
  291. line-height: 80upx;
  292. font-size: 30upx;
  293. color: #000;
  294. font-weight: bold;
  295. border-bottom: 2upx solid #eeeeee;
  296. }
  297. .item{
  298. height: 80upx;
  299. display: flex;
  300. align-items: center;
  301. justify-content: space-between;
  302. &:last-child{
  303. border-bottom: none;
  304. }
  305. .left{
  306. flex: 1;
  307. display: flex;
  308. align-items: center;
  309. .label{
  310. min-width: 140rpx;
  311. font-size: 28upx;
  312. color: #000;
  313. }
  314. .text{
  315. font-size: 28upx;
  316. color: #1b1b1b;
  317. }
  318. }
  319. .right{
  320. display: flex;
  321. align-items: center;
  322. justify-content: flex-end;
  323. .text{
  324. font-size: 28upx;
  325. color: #1b1b1b;
  326. }
  327. .ic-close{
  328. margin-left: 10rpx;
  329. width: 30rpx;
  330. height:30rpx;
  331. }
  332. .ic-back{
  333. margin-left: 10rpx;
  334. width: 15rpx;
  335. height:30rpx;
  336. }
  337. }
  338. .item-btn{
  339. max-width: 200rpx;
  340. padding: 0rpx 15rpx;
  341. height: 48upx;
  342. border-radius: 24upx;
  343. line-height: 48upx;
  344. font-size: 24upx;
  345. color: #000;
  346. border: 1upx solid #d8d8d8;
  347. display: flex;
  348. align-items: center;
  349. justify-content: center;
  350. }
  351. }
  352. }
  353. .btn-box{
  354. height: 140upx;
  355. z-index: 9999;
  356. width: 100%;
  357. padding: 0rpx 30upx;
  358. position: fixed;
  359. bottom: 0;
  360. left: 0;
  361. box-sizing: border-box;
  362. background-color: #ffffff;
  363. display: flex;
  364. align-items: center;
  365. justify-content: center;
  366. .btn{
  367. width: 100%;
  368. height: 88upx;
  369. line-height: 88upx;
  370. text-align: center;
  371. font-size: 34upx;
  372. font-family: PingFang SC;
  373. font-weight: 400;
  374. color: #FFFFFF;
  375. background: #078C9D;
  376. border-radius: 10upx;
  377. }
  378. }
  379. }
  380. .coupon{
  381. height: 100%;
  382. .empty{
  383. display: flex;
  384. align-items: center;
  385. justify-content: center;
  386. height: 650rpx;
  387. width: 100%;
  388. image{
  389. width: 280rpx;
  390. height: 200rpx;
  391. }
  392. }
  393. }
  394. .coupon-box{
  395. overflow-y: auto;
  396. padding: 80rpx 20rpx 80rpx;
  397. height: 650rpx;
  398. width: 100%;
  399. display: flex;
  400. flex-direction: column;
  401. align-items: flex-start;
  402. justify-content: flex-start;
  403. box-sizing: border-box;
  404. .coupon-item{
  405. width: 100%;
  406. display: flex;
  407. align-items: center;
  408. justify-content: flex-start;
  409. margin-bottom: 16rpx;
  410. height:170rpx;
  411. &:last-child{
  412. margin-bottom: 0rpx;
  413. }
  414. .left{
  415. color: #fff;
  416. font-size: 36rpx;
  417. font-weight: bold;
  418. text-align: center;
  419. display: flex;
  420. flex-direction: column;
  421. align-items: center;
  422. justify-content: center;
  423. position: relative;
  424. width: 230rpx;
  425. image{
  426. position: absolute;
  427. width: 230rpx;
  428. height:170rpx;
  429. color: #fff;
  430. }
  431. .num{
  432. font-size: 40rpx;
  433. }
  434. .pic-num{
  435. font-size: 20rpx;
  436. z-index: 99;
  437. }
  438. }
  439. .right{
  440. display: flex;
  441. flex-direction: column;
  442. align-items: flex-start;
  443. justify-content: flex-start;
  444. height:170rpx;
  445. width: calc(100% - 230rpx);
  446. padding: 0 17rpx 0 24rpx;
  447. background-color: #fff;
  448. box-sizing: border-box;
  449. .title{
  450. width: 100%;
  451. font-size: 0.3 * 100rpx;
  452. color: #282828;
  453. height: 0.93 * 100rpx;
  454. line-height: 0.93 * 100rpx;
  455. border-bottom: 1px solid #f0f0f0;
  456. }
  457. .btns{
  458. display: flex;
  459. align-items: center;
  460. justify-content: space-between;
  461. width: 100%;
  462. font-size: 0.2 * 100rpx;
  463. color: #999;
  464. height: 0.76 * 100rpx;
  465. .btn{
  466. width: 1.36 * 100rpx;
  467. height: 0.44 * 100rpx;
  468. border-radius: 0.22 * 100rpx;
  469. font-size: 0.22 * 100rpx;
  470. color: #fff;
  471. text-align: center;
  472. line-height: 0.44 * 100rpx;
  473. background-color: #078C9D;
  474. .gray{
  475. background-color: #ccc;
  476. }
  477. }
  478. }
  479. }
  480. }
  481. }
  482. </style>