checkout.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="container">
  3. <!-- 收货地址选择 -->
  4. <yd-address-select :address="address"></yd-address-select>
  5. <!-- 订单商品信息 -->
  6. <view class="checkout-goods">
  7. <yd-order-goods :goods-list="checkoutList"></yd-order-goods>
  8. </view>
  9. <view class="freight-coupon-box">
  10. <vidw class="box-row">
  11. <view class="title">运费</view>
  12. <yd-text-price class="freight-fee" size="15" :price="freightAmount"></yd-text-price>
  13. </vidw>
  14. <vidw class="box-row">
  15. <view class="coupon-wrap">
  16. <view class="coupon-title-tag">
  17. <view class="title">优惠券</view>
  18. <scroll-view class="coupon-tag-list" scroll-x="true">
  19. <view v-for="item in couponList" :key="item.couponId" class="coupon-tag-item">{{ item.couponTag }}</view>
  20. </scroll-view>
  21. </view>
  22. <yd-text-price class="coupon-fee" color="red" size="15" symbol="-¥" :price="couponAmount"></yd-text-price>
  23. </view>
  24. <u-icon name="arrow-right"></u-icon>
  25. </vidw>
  26. </view>
  27. <!-- 订单备注信息 -->
  28. <view class="user-remark-box">
  29. <view class="title">订单备注</view>
  30. <u--input maxlength="50" border="none" fontSize="14" v-model="remark" placeholder="如您需要请备注"></u--input>
  31. </view>
  32. <view class="cart-btn-container">
  33. <view class="order-total-wrap">
  34. <view class="order-total-info">
  35. <view class="info-text">合计:</view>
  36. <view>
  37. <yd-text-price color="red" size="15" intSize="20" :price="totalAmount"></yd-text-price>
  38. </view>
  39. </view>
  40. <view class="cart-btn-group">
  41. <u-button style="margin-left: 10px" class="main-btn" type="primary" shape="circle" size="small" text="提交订单" @click="handleSubmitOrder"></u-button>
  42. </view>
  43. </view>
  44. <u-safe-bottom customStyle="background: #ffffff"></u-safe-bottom>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import { checkoutCartProduct } from '../../api/order'
  50. export default {
  51. components: {},
  52. data() {
  53. return {
  54. checkedProduct: [],
  55. address: {
  56. name: '客户',
  57. mobile: '139****6563',
  58. area: 'XXX市XXX区',
  59. detail: 'XXX街道XXX小区XXX号楼XX-XXX'
  60. },
  61. checkoutList: [],
  62. couponList: [
  63. {
  64. couponId: 3,
  65. couponTag: '6元运费券'
  66. }
  67. ],
  68. totalAmount: 0,
  69. freightAmount: 6,
  70. couponAmount: 6,
  71. remark: ''
  72. }
  73. },
  74. onLoad(e) {
  75. const checkedProduct = e.checkedProduct
  76. if (checkedProduct) {
  77. this.checkedProduct = JSON.parse(checkedProduct)
  78. this.loadCheckoutProductData()
  79. } else {
  80. uni.$u.toast('请求参数错误')
  81. }
  82. },
  83. methods: {
  84. loadCheckoutProductData() {
  85. checkoutCartProduct(this.checkedProduct)
  86. .then(res => {
  87. this.checkoutList = res.data.checkoutList || []
  88. this.totalAmount = res.data.totalAmount || 0
  89. })
  90. .catch(err => {
  91. console.log(err)
  92. })
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .container {
  99. background-color: $custom-bg-color;
  100. height: 100vh;
  101. overflow-x: scroll;
  102. }
  103. .checkout-goods {
  104. background-color: #fff;
  105. margin-top: 20rpx;
  106. padding: 20rpx;
  107. border-radius: 20rpx;
  108. }
  109. .freight-coupon-box {
  110. background-color: #fff;
  111. margin-top: 20rpx;
  112. padding: 20rpx 30rpx;
  113. border-radius: 20rpx;
  114. .box-row {
  115. @include flex-space-between;
  116. padding: 10rpx 0;
  117. .coupon-wrap {
  118. @include flex-space-between;
  119. width: 670rpx;
  120. .coupon-title-tag {
  121. @include flex-left;
  122. .coupon-tag-list {
  123. @include flex-left;
  124. overflow-x: scroll;
  125. width: 360rpx;
  126. .coupon-tag-item {
  127. display: inline-block;
  128. font-size: 22rpx;
  129. color: red;
  130. border: 1rpx solid red;
  131. padding: 1px 6rpx;
  132. margin-right: 10rpx;
  133. border-radius: 5rpx;
  134. }
  135. }
  136. }
  137. }
  138. .title {
  139. font-weight: 700;
  140. font-size: 30rpx;
  141. color: #333;
  142. margin-right: 30rpx;
  143. }
  144. .freight-fee {
  145. margin-right: 50rpx;
  146. }
  147. .coupon-fee {
  148. margin-right: 20rpx;
  149. }
  150. }
  151. }
  152. .user-remark-box {
  153. @include flex-space-between;
  154. background-color: #fff;
  155. margin-top: 20rpx;
  156. padding: 30rpx;
  157. border-radius: 20rpx;
  158. .title {
  159. font-weight: 700;
  160. font-size: 30rpx;
  161. color: #333;
  162. margin-right: 30rpx;
  163. }
  164. }
  165. .cart-btn-container {
  166. position: fixed;
  167. bottom: 0;
  168. left: 0;
  169. .order-total-wrap {
  170. background: $custom-bg-color;
  171. border-top: $custom-border-style;
  172. width: 750rpx;
  173. @include flex-space-between();
  174. height: 100rpx;
  175. .order-total-info {
  176. @include flex-left;
  177. .info-text {
  178. margin-left: 20rpx;
  179. font-size: 26rpx;
  180. font-weight: bold;
  181. color: #666666;
  182. }
  183. }
  184. .cart-btn-group {
  185. @include flex-right();
  186. width: 360rpx;
  187. padding-right: 10px;
  188. .btn-gap {
  189. width: 20rpx;
  190. }
  191. }
  192. }
  193. }
  194. </style>