integralOrderPay.vue 12 KB

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