integralOrderPay.vue 12 KB

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