integralOrderPay.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 收货人 -->
  5. <view class="address-box" v-if="address==null" @click="openAddress()">
  6. <view class="left">
  7. <view class="name-box">
  8. <text class="text name">添加收货地址</text>
  9. </view>
  10. </view>
  11. <view class="arrow-box">
  12. <image src="/static/images/arrow_gray.png" mode=""></image>
  13. </view>
  14. </view>
  15. <view class="address-box" v-if="address!=null" @click="openAddress()">
  16. <view class="left">
  17. <view class="name-box">
  18. <text class="text name">{{address.realName}}</text>
  19. <text class="text" v-if="address.phone!=null">{{address.phone}}</text>
  20. </view>
  21. <view class="address">
  22. {{address.address}}
  23. </view>
  24. </view>
  25. <view class="arrow-box">
  26. <image src="/static/images/arrow_gray.png" mode=""></image>
  27. </view>
  28. </view>
  29. <!-- 药品列表 -->
  30. <view class="goods-list">
  31. <view class="item">
  32. <view class="img-box">
  33. <image :src="item.imgUrl==''?'/static/images/drug.svg':item.imgUrl" mode="aspectFill"></image>
  34. </view>
  35. <view class="info-box">
  36. <view>
  37. <view class="name-box ellipsis2">
  38. {{item.goodsName}}
  39. </view>
  40. </view>
  41. <view class="price-num">
  42. <view class="price">
  43. <text class="unit">福币</text>
  44. <text class="num">{{item.integral}}</text>
  45. </view>
  46. <view class="num" >x1</view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="other-info">
  52. <view class="item">
  53. <view class="left">
  54. <text class="label">所需福币:</text>
  55. </view>
  56. <view class="right">
  57. <text class="text">{{item.integral}}</text>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="other-info">
  62. <view class="item">
  63. <view class="left">
  64. <text class="label">我的福币:</text>
  65. </view>
  66. <view class="right">
  67. <text class="text">{{integral}}</text>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- 底部按钮 -->
  73. <view class="btn-box">
  74. <view class="btn" v-if="item!=null" @click="payOrder()">立即兑换</view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import {getIntegralGoodsById,createOrder} from '@/api/integral.js'
  80. import {getUserInfo} from '@/api/user'
  81. export default {
  82. data() {
  83. return {
  84. addressId:null,
  85. address:null,
  86. orderId:null,
  87. order:null,
  88. item:null,
  89. integral: 0,
  90. }
  91. },
  92. onLoad(option) {
  93. this.goodsId=option.goodsId;
  94. var that=this;
  95. uni.$on('updateAddress', (e) => {
  96. that.addressId=e.addressId;
  97. that.address=e;
  98. that.address.address=e.province+e.city+e.district+e.detail
  99. })
  100. this.getIntegralGoodsById();
  101. this.getUserInfo();
  102. },
  103. methods: {
  104. getUserInfo(){
  105. getUserInfo().then(
  106. res => {
  107. if(res.code==200){
  108. if(res.user!=null){
  109. this.integral=res.user.integral;
  110. }
  111. }
  112. },
  113. rej => {}
  114. );
  115. },
  116. getIntegralGoodsById(){
  117. var data={goodsId:this.goodsId};
  118. console.log(data)
  119. getIntegralGoodsById(data).then(
  120. res => {
  121. if(res.code==200){
  122. this.item=res.data;
  123. }else{
  124. }
  125. },
  126. rej => {}
  127. );
  128. },
  129. openAddress(){
  130. uni.navigateTo({
  131. url: '/pages/user/address'
  132. })
  133. },
  134. payOrder(){
  135. if(this.addressId==null){
  136. uni.showToast({
  137. icon:'none',
  138. title: "请选择收货地址",
  139. });
  140. return;
  141. }
  142. var data = {
  143. goodsId:this.goodsId,
  144. addressId:this.addressId,
  145. };
  146. var that=this;
  147. uni.showLoading();
  148. createOrder(data).then(
  149. res => {
  150. if(res.code==200){
  151. uni.redirectTo({
  152. url:"./integralOrderPaySuccess?orderId="+res.order.orderId
  153. })
  154. }else{
  155. uni.showToast({
  156. icon:'none',
  157. title: res.msg,
  158. });
  159. }
  160. },
  161. rej => {}
  162. );
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss">
  168. .inner-box{
  169. padding: 20upx 20upx 140upx;
  170. .address-box{
  171. box-sizing: border-box;
  172. min-height: 171upx;
  173. background: #FFFFFF;
  174. border-radius: 16upx;
  175. background-image: url(/static/images/address_bg.png);
  176. background-repeat: no-repeat;
  177. background-size: 100% 30upx;
  178. background-position: left bottom;
  179. padding: 38upx 30upx 36upx;
  180. display: flex;
  181. align-items: center;
  182. justify-content: space-between;
  183. .left{
  184. width: 92%;
  185. .name-box{
  186. display: flex;
  187. align-items: center;
  188. .text{
  189. font-size: 32upx;
  190. font-family: PingFang SC;
  191. font-weight: bold;
  192. color: #111111;
  193. line-height: 1;
  194. &.name{
  195. margin-right: 30upx;
  196. }
  197. }
  198. }
  199. .address{
  200. font-size: 28upx;
  201. font-family: PingFang SC;
  202. font-weight: 500;
  203. color: #666666;
  204. line-height: 42upx;
  205. text-align:left;
  206. margin-top: 23upx;
  207. }
  208. }
  209. .arrow-box{
  210. width: 12upx;
  211. height: 23upx;
  212. display: flex;
  213. align-items: cenetr;
  214. justify-content: cenetr;
  215. image{
  216. width: 100%;
  217. height: 100%;
  218. }
  219. }
  220. }
  221. .goods-list{
  222. margin-top: 20upx;
  223. padding: 0 30upx;
  224. background-color: #FFFFFF;
  225. border-radius: 16upx;
  226. .item{
  227. padding: 30upx 0;
  228. border-bottom: 1px solid #EDEEEF;
  229. display: flex;
  230. align-items: center;
  231. .img-box{
  232. width: 160upx;
  233. height: 160upx;
  234. margin-right: 30upx;
  235. image{
  236. width: 100%;
  237. height: 100%;
  238. }
  239. }
  240. .info-box{
  241. width: calc(100% - 190upx);
  242. height: 160upx;
  243. display: flex;
  244. flex-direction: column;
  245. justify-content: space-between;
  246. .name-box{
  247. font-size: 28upx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. color: #111111;
  251. line-height: 40upx;
  252. .tag{
  253. display: inline-block;
  254. padding: 0 6upx;
  255. height: 30upx;
  256. background: linear-gradient(90deg, #2583EB 0%, #E0F5FF 100%);
  257. border-radius: 4upx;
  258. margin-right: 10upx;
  259. font-size: 22upx;
  260. font-family: PingFang SC;
  261. font-weight: bold;
  262. color: #FFFFFF;
  263. line-height: 30upx;
  264. float: left;
  265. margin-top: 7upx;
  266. }
  267. }
  268. .spec{
  269. margin-top: 10upx;
  270. font-size: 24upx;
  271. font-family: PingFang SC;
  272. font-weight: 500;
  273. color: #999999;
  274. line-height: 1;
  275. }
  276. .price-num{
  277. display: flex;
  278. align-items: center;
  279. justify-content: space-between;
  280. .price{
  281. display: flex;
  282. align-items: flex-end;
  283. .unit{
  284. font-size: 24upx;
  285. font-family: PingFang SC;
  286. font-weight: 500;
  287. color: #111111;
  288. line-height: 1.2;
  289. margin-right: 4upx;
  290. }
  291. .num{
  292. font-size: 32upx;
  293. font-family: PingFang SC;
  294. font-weight: 500;
  295. color: #111111;
  296. line-height: 1;
  297. }
  298. }
  299. .num{
  300. font-size: 24upx;
  301. font-family: PingFang SC;
  302. font-weight: 500;
  303. color: #999999;
  304. line-height: 1;
  305. }
  306. }
  307. }
  308. }
  309. .sub-total{
  310. height: 88upx;
  311. display: flex;
  312. align-items: center;
  313. justify-content: flex-end;
  314. .label{
  315. font-size: 24upx;
  316. font-family: PingFang SC;
  317. font-weight: 500;
  318. color: #999999;
  319. }
  320. .price{
  321. display: flex;
  322. align-items: flex-end;
  323. .unit{
  324. font-size: 24upx;
  325. font-family: PingFang SC;
  326. font-weight: 500;
  327. color: #FF6633;
  328. line-height: 1.2;
  329. margin-right: 4upx;
  330. }
  331. .num{
  332. font-size: 32upx;
  333. font-family: PingFang SC;
  334. font-weight: bold;
  335. color: #FF6633;
  336. line-height: 1;
  337. }
  338. }
  339. }
  340. }
  341. .other-info{
  342. margin-top: 20upx;
  343. background-color: #fff;
  344. border-radius: 20upx;
  345. overflow: hidden;
  346. padding: 0 30upx;
  347. .title{
  348. height: 80upx;
  349. line-height: 80upx;
  350. font-size: 30upx;
  351. color: #000;
  352. font-weight: bold;
  353. border-bottom: 2upx solid #eeeeee;
  354. }
  355. .item{
  356. height: 80upx;
  357. display: flex;
  358. align-items: center;
  359. justify-content: space-between;
  360. &:last-child{
  361. border-bottom: none;
  362. }
  363. .left{
  364. flex: 1;
  365. display: flex;
  366. align-items: center;
  367. .label{
  368. min-width: 140rpx;
  369. font-size: 28upx;
  370. color: #000;
  371. }
  372. .text{
  373. font-size: 28upx;
  374. color: #1b1b1b;
  375. }
  376. }
  377. .right{
  378. display: flex;
  379. align-items: center;
  380. justify-content: flex-end;
  381. .text{
  382. font-size: 28upx;
  383. color: #1b1b1b;
  384. }
  385. .ic-close{
  386. margin-left: 10rpx;
  387. width: 30rpx;
  388. height:30rpx;
  389. }
  390. .ic-back{
  391. margin-left: 10rpx;
  392. width: 15rpx;
  393. height:30rpx;
  394. }
  395. }
  396. .item-btn{
  397. max-width: 200rpx;
  398. padding: 0rpx 15rpx;
  399. height: 48upx;
  400. border-radius: 24upx;
  401. line-height: 48upx;
  402. font-size: 24upx;
  403. color: #000;
  404. border: 1upx solid #d8d8d8;
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. }
  409. }
  410. }
  411. .remarks{
  412. height: 88upx;
  413. padding: 0 30upx;
  414. background: #FFFFFF;
  415. border-radius: 16upx;
  416. margin-top: 20upx;
  417. display: flex;
  418. align-items: center;
  419. input{
  420. width: 100%;
  421. font-size: 28upx;
  422. font-family: PingFang SC;
  423. font-weight: 500;
  424. color: #000000;
  425. }
  426. .input{
  427. font-size: 28upx;
  428. font-family: PingFang SC;
  429. font-weight: 500;
  430. color: #999999;
  431. }
  432. }
  433. }
  434. .btn-box{
  435. height: 140upx;
  436. z-index: 9999;
  437. width: 100%;
  438. padding: 0rpx 30upx;
  439. position: fixed;
  440. bottom: 0;
  441. left: 0;
  442. box-sizing: border-box;
  443. background-color: #ffffff;
  444. display: flex;
  445. align-items: center;
  446. justify-content: center;
  447. .btn{
  448. width: 100%;
  449. height: 88upx;
  450. line-height: 88upx;
  451. text-align: center;
  452. font-size: 34upx;
  453. font-family: PingFang SC;
  454. font-weight: 400;
  455. color: #FFFFFF;
  456. background: #2583EB;
  457. border-radius: 10upx;
  458. }
  459. }
  460. .pay-type{
  461. box-sizing: border-box;
  462. height: 192upx;
  463. background: #FFFFFF;
  464. border-radius: 16upx;
  465. margin-top: 20upx;
  466. padding: 40upx 30upx;
  467. display: flex;
  468. flex-direction: column;
  469. justify-content: space-between;
  470. .title{
  471. font-size: 28upx;
  472. font-family: PingFang SC;
  473. font-weight: 500;
  474. color: #999999;
  475. line-height: 1;
  476. }
  477. .item{
  478. display: flex;
  479. align-items: center;
  480. justify-content: space-between;
  481. .left{
  482. display: flex;
  483. align-items: center;
  484. image{
  485. width: 44upx;
  486. height: 44upx;
  487. margin-right: 20upx;
  488. }
  489. .text{
  490. font-size: 30upx;
  491. font-family: PingFang SC;
  492. font-weight: bold;
  493. color: #222222;
  494. line-height: 1;
  495. }
  496. }
  497. }
  498. }
  499. .coupon{
  500. height: 100%;
  501. .empty{
  502. display: flex;
  503. align-items: center;
  504. justify-content: center;
  505. height: 650rpx;
  506. width: 100%;
  507. image{
  508. width: 280rpx;
  509. height: 200rpx;
  510. }
  511. }
  512. }
  513. .coupon-box{
  514. overflow-y: auto;
  515. padding: 80rpx 20rpx 80rpx;
  516. height: 650rpx;
  517. width: 100%;
  518. display: flex;
  519. flex-direction: column;
  520. align-items: flex-start;
  521. justify-content: flex-start;
  522. box-sizing: border-box;
  523. .coupon-item{
  524. width: 100%;
  525. display: flex;
  526. align-items: center;
  527. justify-content: flex-start;
  528. margin-bottom: 16rpx;
  529. height:170rpx;
  530. &:last-child{
  531. margin-bottom: 0rpx;
  532. }
  533. .left{
  534. color: #fff;
  535. font-size: 36rpx;
  536. font-weight: bold;
  537. text-align: center;
  538. display: flex;
  539. flex-direction: column;
  540. align-items: center;
  541. justify-content: center;
  542. position: relative;
  543. width: 230rpx;
  544. image{
  545. position: absolute;
  546. width: 230rpx;
  547. height:170rpx;
  548. color: #fff;
  549. }
  550. .num{
  551. font-size: 40rpx;
  552. }
  553. .pic-num{
  554. font-size: 20rpx;
  555. z-index: 99;
  556. }
  557. }
  558. .right{
  559. display: flex;
  560. flex-direction: column;
  561. align-items: flex-start;
  562. justify-content: flex-start;
  563. height:170rpx;
  564. width: calc(100% - 230rpx);
  565. padding: 0 17rpx 0 24rpx;
  566. background-color: #fff;
  567. box-sizing: border-box;
  568. .title{
  569. width: 100%;
  570. font-size: 0.3 * 100rpx;
  571. color: #282828;
  572. height: 0.93 * 100rpx;
  573. line-height: 0.93 * 100rpx;
  574. border-bottom: 1px solid #f0f0f0;
  575. }
  576. .btns{
  577. display: flex;
  578. align-items: center;
  579. justify-content: space-between;
  580. width: 100%;
  581. font-size: 0.2 * 100rpx;
  582. color: #999;
  583. height: 0.76 * 100rpx;
  584. .btn{
  585. width: 1.36 * 100rpx;
  586. height: 0.44 * 100rpx;
  587. border-radius: 0.22 * 100rpx;
  588. font-size: 0.22 * 100rpx;
  589. color: #fff;
  590. text-align: center;
  591. line-height: 0.44 * 100rpx;
  592. background-color: #2583EB;
  593. .gray{
  594. background-color: #ccc;
  595. }
  596. }
  597. }
  598. }
  599. }
  600. }
  601. </style>