inquiryPay.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/close.png"></image>
  40. <image class="ic-back" src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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. this.$reLoginCheck(res.msg)
  178. }
  179. },
  180. err => {
  181. }
  182. );
  183. },
  184. getMyEnableCouponList(){
  185. var data={couponType:3,orderId:this.orderId}
  186. getMyEnableCouponList(data).then(
  187. res => {
  188. if(res.code==200){
  189. this.coupons=res.data;
  190. }
  191. },
  192. err => {
  193. }
  194. );
  195. },
  196. getDictByKey(key){
  197. var data={key:key}
  198. getDictByKey(data).then(
  199. res => {
  200. if(res.code==200){
  201. if(key=="sys_inquiry_order_type"){
  202. this.orderTypeOptions=res.data;
  203. }
  204. if(key=="sys_inquiry_type"){
  205. this.inquiryTypeOptions=res.data;
  206. }
  207. }
  208. },
  209. err => {
  210. }
  211. );
  212. },
  213. getInquiryOrderById(){
  214. var data = {orderId:this.orderId};
  215. var that=this;
  216. uni.showLoading();
  217. getInquiryOrderById(data).then(
  218. res => {
  219. if(res.code==200){
  220. uni.hideLoading();
  221. that.order=res.data;
  222. this.compute();
  223. }else{
  224. uni.showToast({
  225. icon:'none',
  226. title: res.msg,
  227. });
  228. }
  229. },
  230. rej => {}
  231. );
  232. },
  233. payOrder(){
  234. var data = {
  235. orderId:this.order.orderId,
  236. userCouponId:this.userCouponId
  237. };
  238. var that=this;
  239. uni.showLoading();
  240. pay(data).then(
  241. res => {
  242. if(res.code==200){
  243. uni.redirectTo({
  244. url:"./inquiryPayment?orderId="+this.orderId
  245. })
  246. }else{
  247. uni.showToast({
  248. icon:'none',
  249. title: res.msg,
  250. });
  251. this.$reLoginCheck(res.msg)
  252. }
  253. },
  254. rej => {}
  255. );
  256. }
  257. }
  258. }
  259. </script>
  260. <style lang="scss">
  261. page{
  262. background: #f6f6f6;
  263. }
  264. </style>
  265. <style scoped lang="scss">
  266. .content{
  267. position: relative;
  268. .cont{
  269. position: relative;
  270. padding: 0rpx 20rpx 160rpx;
  271. z-index: 999;
  272. width: 100%;
  273. display: flex;
  274. flex-direction: column;
  275. }
  276. .other-info{
  277. margin-top: 20upx;
  278. background-color: #fff;
  279. border-radius: 20upx;
  280. overflow: hidden;
  281. padding: 0 30upx;
  282. .title{
  283. height: 80upx;
  284. line-height: 80upx;
  285. font-size: 30upx;
  286. color: #000;
  287. font-weight: bold;
  288. border-bottom: 2upx solid #eeeeee;
  289. }
  290. .item{
  291. height: 80upx;
  292. display: flex;
  293. align-items: center;
  294. justify-content: space-between;
  295. &:last-child{
  296. border-bottom: none;
  297. }
  298. .left{
  299. flex: 1;
  300. display: flex;
  301. align-items: center;
  302. .label{
  303. min-width: 140rpx;
  304. font-size: 28upx;
  305. color: #000;
  306. }
  307. .text{
  308. font-size: 28upx;
  309. color: #1b1b1b;
  310. }
  311. }
  312. .right{
  313. display: flex;
  314. align-items: center;
  315. justify-content: flex-end;
  316. .text{
  317. font-size: 28upx;
  318. color: #1b1b1b;
  319. }
  320. .ic-close{
  321. margin-left: 10rpx;
  322. width: 30rpx;
  323. height:30rpx;
  324. }
  325. .ic-back{
  326. margin-left: 10rpx;
  327. width: 15rpx;
  328. height:30rpx;
  329. }
  330. }
  331. .item-btn{
  332. max-width: 200rpx;
  333. padding: 0rpx 15rpx;
  334. height: 48upx;
  335. border-radius: 24upx;
  336. line-height: 48upx;
  337. font-size: 24upx;
  338. color: #000;
  339. border: 1upx solid #d8d8d8;
  340. display: flex;
  341. align-items: center;
  342. justify-content: center;
  343. }
  344. }
  345. }
  346. .btn-box{
  347. height: 140upx;
  348. z-index: 9999;
  349. width: 100%;
  350. padding: 0rpx 30upx;
  351. position: fixed;
  352. bottom: 0;
  353. left: 0;
  354. box-sizing: border-box;
  355. background-color: #ffffff;
  356. display: flex;
  357. align-items: center;
  358. justify-content: center;
  359. .btn{
  360. width: 100%;
  361. height: 88upx;
  362. line-height: 88upx;
  363. text-align: center;
  364. font-size: 34upx;
  365. font-family: PingFang SC;
  366. font-weight: 400;
  367. color: #FFFFFF;
  368. background: #C39A58;
  369. border-radius: 10upx;
  370. }
  371. }
  372. }
  373. .coupon{
  374. height: 100%;
  375. .empty{
  376. display: flex;
  377. align-items: center;
  378. justify-content: center;
  379. height: 650rpx;
  380. width: 100%;
  381. image{
  382. width: 280rpx;
  383. height: 200rpx;
  384. }
  385. }
  386. }
  387. .coupon-box{
  388. overflow-y: auto;
  389. padding: 80rpx 20rpx 80rpx;
  390. height: 650rpx;
  391. width: 100%;
  392. display: flex;
  393. flex-direction: column;
  394. align-items: flex-start;
  395. justify-content: flex-start;
  396. box-sizing: border-box;
  397. .coupon-item{
  398. width: 100%;
  399. display: flex;
  400. align-items: center;
  401. justify-content: flex-start;
  402. margin-bottom: 16rpx;
  403. height:170rpx;
  404. &:last-child{
  405. margin-bottom: 0rpx;
  406. }
  407. .left{
  408. color: #fff;
  409. font-size: 36rpx;
  410. font-weight: bold;
  411. text-align: center;
  412. display: flex;
  413. flex-direction: column;
  414. align-items: center;
  415. justify-content: center;
  416. position: relative;
  417. width: 230rpx;
  418. image{
  419. position: absolute;
  420. width: 230rpx;
  421. height:170rpx;
  422. color: #fff;
  423. }
  424. .num{
  425. font-size: 40rpx;
  426. }
  427. .pic-num{
  428. font-size: 20rpx;
  429. z-index: 99;
  430. }
  431. }
  432. .right{
  433. display: flex;
  434. flex-direction: column;
  435. align-items: flex-start;
  436. justify-content: flex-start;
  437. height:170rpx;
  438. width: calc(100% - 230rpx);
  439. padding: 0 17rpx 0 24rpx;
  440. background-color: #fff;
  441. box-sizing: border-box;
  442. .title{
  443. width: 100%;
  444. font-size: 0.3 * 100rpx;
  445. color: #282828;
  446. height: 0.93 * 100rpx;
  447. line-height: 0.93 * 100rpx;
  448. border-bottom: 1px solid #f0f0f0;
  449. }
  450. .btns{
  451. display: flex;
  452. align-items: center;
  453. justify-content: space-between;
  454. width: 100%;
  455. font-size: 0.2 * 100rpx;
  456. color: #999;
  457. height: 0.76 * 100rpx;
  458. .btn{
  459. width: 1.36 * 100rpx;
  460. height: 0.44 * 100rpx;
  461. border-radius: 0.22 * 100rpx;
  462. font-size: 0.22 * 100rpx;
  463. color: #fff;
  464. text-align: center;
  465. line-height: 0.44 * 100rpx;
  466. background-color: #C39A58;
  467. .gray{
  468. background-color: #ccc;
  469. }
  470. }
  471. }
  472. }
  473. }
  474. }
  475. </style>