inquiryPay.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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="../static/images/close.png"></image>
  40. <image class="ic-back" src="../static/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://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/004bcf24fc7641dea9f3247fa8d59ea2.png" mode="widthFix"></image>
  65. <image v-if="item.status!=0" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/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://cos.his.cdwjyyh.com/fs/20240423/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. this.orderId=options.orderId;
  118. },
  119. onShow() {
  120. this.getDictByKey("sys_inquiry_order_type");
  121. this.getDictByKey("sys_inquiry_type");
  122. this.getInquiryOrderById();
  123. this.getMyEnableCouponList();
  124. },
  125. //发送给朋友
  126. // onShareAppMessage(res) {
  127. // var that=this;
  128. // if(this.$isLogin()){
  129. // return {
  130. // title: "订单支付",
  131. // path: '/pages_order/inquiryPay?orderId='+that.orderId,
  132. // imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  133. // }
  134. // }
  135. // },
  136. methods: {
  137. couponSelect(item){
  138. this.couponShow = false;
  139. //计算金额
  140. this.userCouponId=item.id;
  141. console.log(item)
  142. this.couponText=item.price+"元优惠券"
  143. this.compute()
  144. },
  145. open() {
  146. },
  147. close() {
  148. this.couponShow = false
  149. },
  150. openCoupon(){
  151. this.couponShow=true;
  152. },
  153. delCoupon(){
  154. this.userCouponId=0;
  155. this.couponText="请选择优惠券"
  156. this.compute()
  157. },
  158. compute(){
  159. var data={
  160. orderId:this.orderId,
  161. userCouponId:this.userCouponId
  162. }
  163. console.log(data)
  164. compute(data).then(
  165. res => {
  166. if(res.code==200){
  167. this.payMoney=res.data.payMoney;
  168. this.discountMoney=res.data.discountMoney;
  169. }
  170. else{
  171. this.userCouponId=0;
  172. this.couponText="请选择优惠券"
  173. uni.showToast({
  174. icon:'none',
  175. title: res.msg,
  176. });
  177. }
  178. },
  179. err => {
  180. }
  181. );
  182. },
  183. getMyEnableCouponList(){
  184. var data={couponType:3}
  185. getMyEnableCouponList(data).then(
  186. res => {
  187. if(res.code==200){
  188. this.coupons=res.data;
  189. }
  190. },
  191. err => {
  192. }
  193. );
  194. },
  195. getDictByKey(key){
  196. var data={key:key}
  197. getDictByKey(data).then(
  198. res => {
  199. if(res.code==200){
  200. if(key=="sys_inquiry_order_type"){
  201. this.orderTypeOptions=res.data;
  202. }
  203. if(key=="sys_inquiry_type"){
  204. this.inquiryTypeOptions=res.data;
  205. }
  206. }
  207. },
  208. err => {
  209. }
  210. );
  211. },
  212. getInquiryOrderById(){
  213. var data = {orderId:this.orderId};
  214. var that=this;
  215. uni.showLoading();
  216. getInquiryOrderById(data).then(
  217. res => {
  218. if(res.code==200){
  219. uni.hideLoading();
  220. that.order=res.data;
  221. this.compute();
  222. }else{
  223. uni.showToast({
  224. icon:'none',
  225. title: res.msg,
  226. });
  227. }
  228. },
  229. rej => {}
  230. );
  231. },
  232. payOrder(){
  233. var data = {
  234. orderId:this.order.orderId,
  235. userCouponId:this.userCouponId
  236. };
  237. var that=this;
  238. uni.showLoading();
  239. pay(data).then(
  240. res => {
  241. if(res.code==200){
  242. uni.redirectTo({
  243. url:"./inquiryPayment?orderId="+this.orderId
  244. })
  245. }else{
  246. uni.showToast({
  247. icon:'none',
  248. title: res.msg,
  249. });
  250. }
  251. },
  252. rej => {}
  253. );
  254. }
  255. }
  256. }
  257. </script>
  258. <style lang="scss">
  259. page{
  260. background: #f6f6f6;
  261. }
  262. </style>
  263. <style scoped lang="scss">
  264. .content{
  265. position: relative;
  266. .cont{
  267. position: relative;
  268. padding: 0rpx 20rpx 160rpx;
  269. z-index: 999;
  270. width: 100%;
  271. display: flex;
  272. flex-direction: column;
  273. }
  274. .other-info{
  275. margin-top: 20upx;
  276. background-color: #fff;
  277. border-radius: 20upx;
  278. overflow: hidden;
  279. padding: 0 30upx;
  280. .title{
  281. height: 80upx;
  282. line-height: 80upx;
  283. font-size: 30upx;
  284. color: #000;
  285. font-weight: bold;
  286. border-bottom: 2upx solid #eeeeee;
  287. }
  288. .item{
  289. height: 80upx;
  290. display: flex;
  291. align-items: center;
  292. justify-content: space-between;
  293. &:last-child{
  294. border-bottom: none;
  295. }
  296. .left{
  297. flex: 1;
  298. display: flex;
  299. align-items: center;
  300. .label{
  301. min-width: 140rpx;
  302. font-size: 28upx;
  303. color: #000;
  304. }
  305. .text{
  306. font-size: 28upx;
  307. color: #1b1b1b;
  308. }
  309. }
  310. .right{
  311. display: flex;
  312. align-items: center;
  313. justify-content: flex-end;
  314. .text{
  315. font-size: 28upx;
  316. color: #1b1b1b;
  317. }
  318. .ic-close{
  319. margin-left: 10rpx;
  320. width: 30rpx;
  321. height:30rpx;
  322. }
  323. .ic-back{
  324. margin-left: 10rpx;
  325. width: 15rpx;
  326. height:30rpx;
  327. }
  328. }
  329. .item-btn{
  330. max-width: 200rpx;
  331. padding: 0rpx 15rpx;
  332. height: 48upx;
  333. border-radius: 24upx;
  334. line-height: 48upx;
  335. font-size: 24upx;
  336. color: #000;
  337. border: 1upx solid #d8d8d8;
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. }
  342. }
  343. }
  344. .btn-box{
  345. height: 140upx;
  346. z-index: 9999;
  347. width: 100%;
  348. padding: 0rpx 30upx;
  349. position: fixed;
  350. bottom: 0;
  351. left: 0;
  352. box-sizing: border-box;
  353. background-color: #ffffff;
  354. display: flex;
  355. align-items: center;
  356. justify-content: center;
  357. .btn{
  358. width: 100%;
  359. height: 88upx;
  360. line-height: 88upx;
  361. text-align: center;
  362. font-size: 34upx;
  363. font-family: PingFang SC;
  364. font-weight: 400;
  365. color: #FFFFFF;
  366. background: #C39A58;
  367. border-radius: 10upx;
  368. }
  369. }
  370. }
  371. .coupon{
  372. height: 100%;
  373. .empty{
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. height: 650rpx;
  378. width: 100%;
  379. image{
  380. width: 280rpx;
  381. height: 200rpx;
  382. }
  383. }
  384. }
  385. .coupon-box{
  386. overflow-y: auto;
  387. padding: 80rpx 20rpx 80rpx;
  388. height: 650rpx;
  389. width: 100%;
  390. display: flex;
  391. flex-direction: column;
  392. align-items: flex-start;
  393. justify-content: flex-start;
  394. box-sizing: border-box;
  395. .coupon-item{
  396. width: 100%;
  397. display: flex;
  398. align-items: center;
  399. justify-content: flex-start;
  400. margin-bottom: 16rpx;
  401. height:170rpx;
  402. &:last-child{
  403. margin-bottom: 0rpx;
  404. }
  405. .left{
  406. color: #fff;
  407. font-size: 36rpx;
  408. font-weight: bold;
  409. text-align: center;
  410. display: flex;
  411. flex-direction: column;
  412. align-items: center;
  413. justify-content: center;
  414. position: relative;
  415. width: 230rpx;
  416. image{
  417. position: absolute;
  418. width: 230rpx;
  419. height:170rpx;
  420. color: #fff;
  421. }
  422. .num{
  423. font-size: 40rpx;
  424. }
  425. .pic-num{
  426. font-size: 20rpx;
  427. z-index: 99;
  428. }
  429. }
  430. .right{
  431. display: flex;
  432. flex-direction: column;
  433. align-items: flex-start;
  434. justify-content: flex-start;
  435. height:170rpx;
  436. width: calc(100% - 230rpx);
  437. padding: 0 17rpx 0 24rpx;
  438. background-color: #fff;
  439. box-sizing: border-box;
  440. .title{
  441. width: 100%;
  442. font-size: 0.3 * 100rpx;
  443. color: #282828;
  444. height: 0.93 * 100rpx;
  445. line-height: 0.93 * 100rpx;
  446. border-bottom: 1px solid #f0f0f0;
  447. }
  448. .btns{
  449. display: flex;
  450. align-items: center;
  451. justify-content: space-between;
  452. width: 100%;
  453. font-size: 0.2 * 100rpx;
  454. color: #999;
  455. height: 0.76 * 100rpx;
  456. .btn{
  457. width: 1.36 * 100rpx;
  458. height: 0.44 * 100rpx;
  459. border-radius: 0.22 * 100rpx;
  460. font-size: 0.22 * 100rpx;
  461. color: #fff;
  462. text-align: center;
  463. line-height: 0.44 * 100rpx;
  464. background-color: #C39A58;
  465. .gray{
  466. background-color: #ccc;
  467. }
  468. }
  469. }
  470. }
  471. }
  472. }
  473. </style>