integralOrderPay.vue 12 KB

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