inquiryPay.vue 11 KB

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