酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

276 lines
5.3 KiB

8 months ago
  1. <template>
  2. <uv-popup ref="popup"
  3. :round="30"
  4. @change="$refs.couponPopup.close()"
  5. bgColor="#f7f7f7">
  6. <view class="content">
  7. <!-- 地址 -->
  8. <view class="address" @click="openAddress">
  9. <image src="/static/image/address/selectIcon.png" mode=""></image>
  10. <view class="">
  11. {{ address.name }}
  12. </view>
  13. <view class="">
  14. {{ address.addressDetail }}
  15. </view>
  16. <view class="icon">
  17. <uv-icon size="30rpx" name="arrow-right"></uv-icon>
  18. </view>
  19. </view>
  20. <!-- 优惠劵 -->
  21. <view style="padding: 0 20rpx;
  22. background-color: #fff;">
  23. <uv-cell
  24. icon="coupon"
  25. title="优惠劵"
  26. iconStyle="font-size: 34rpx;"
  27. rightIconStyle="font-size: 34rpx;"
  28. :value="couponText"
  29. @click="$refs.couponPopup.open('bottom')"
  30. isLink>
  31. </uv-cell>
  32. </view>
  33. <!-- 费用明细 -->
  34. <view class="expense-detail">
  35. <view class="title">
  36. 费用明细
  37. </view>
  38. <view class="detail" v-if="price">
  39. <view>
  40. 应付款{{ price }}
  41. </view>
  42. <view v-if="depositPrice">
  43. 押金{{ depositPrice }}
  44. </view>
  45. <view v-if="washPrice">
  46. 水洗费{{ washPrice }}
  47. </view>
  48. <view v-if="rentPrice">
  49. 租金{{ rentPrice }}
  50. </view>
  51. <view v-if="coupon.price">
  52. 优惠-{{ coupon.price }}
  53. </view>
  54. <view v-if="coupon.price">
  55. 实付款{{ price - coupon.price }}
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 提交按钮 -->
  60. <view class="submit-btn">
  61. <view class="r" @click="orderPay">
  62. {{ submiitTitle }}
  63. </view>
  64. </view>
  65. </view>
  66. <uv-popup ref="couponPopup"
  67. :round="30">
  68. <couponList
  69. ref="couponList"
  70. height="60vh"
  71. :depositPrice="depositPrice"
  72. :washPrice="washPrice"
  73. :rentPrice="rentPrice"
  74. :useType="0"
  75. @select="selectCoupon" />
  76. </uv-popup>
  77. <uv-popup ref="addressPopup" :round="30">
  78. <addressList ref="addressList" height="60vh" @select="selectAddress" />
  79. </uv-popup>
  80. </uv-popup>
  81. </template>
  82. <script>
  83. import addressList from '@/components/address/addressList.vue'
  84. import couponList from './couponList.vue'
  85. export default {
  86. components: {
  87. addressList,
  88. couponList,
  89. },
  90. props: {
  91. submiitTitle: {
  92. default: '立即租赁',
  93. type: String,
  94. },
  95. price : {//总金额
  96. default : 0
  97. },
  98. depositPrice: {//押金
  99. default: 0
  100. },
  101. washPrice: {//水洗费
  102. default: 0
  103. },
  104. rentPrice: {//租金
  105. default: 0
  106. },
  107. },
  108. data() {
  109. return {
  110. address: {
  111. name: '请选择联系人',
  112. addressDetail: '',
  113. },
  114. addressTotal: 0,
  115. coupon : {
  116. price : 0,
  117. },
  118. couponText : '请选择',
  119. }
  120. },
  121. methods: {
  122. // 打开
  123. open() {
  124. this.$refs.popup.open('bottom')
  125. this.$refs.couponList.getData()
  126. this.$refs.couponPopup.close()
  127. // 获取地址列表
  128. this.$refs.addressList.getAddressList().then(res => {
  129. this.addressTotal = res.total
  130. if (this.addressTotal != 0) {
  131. this.address = res.records[0]
  132. }
  133. })
  134. },
  135. // 选择优惠劵
  136. selectCoupon(e){
  137. this.couponText = e.couponName
  138. this.coupon = e
  139. this.$refs.couponPopup.close()
  140. },
  141. // 关闭
  142. close() {
  143. this.$refs.popup.close()
  144. },
  145. // 打开选择地址
  146. openAddress() {
  147. if (this.addressTotal == 0) {
  148. this.$refs.popup.close()
  149. return uni.navigateTo({
  150. url: '/pages_order/mine/address?type=back'
  151. })
  152. }
  153. this.$refs.addressPopup.open('bottom')
  154. },
  155. // 选择地址
  156. selectAddress(e) {
  157. this.address = e
  158. this.$refs.addressPopup.close()
  159. },
  160. // 选择规格
  161. selectUnit(item, index) {
  162. this.unit = item
  163. this.unitIndex = index
  164. },
  165. addCart() {
  166. this.$api('cartAdd', {
  167. id: this.detail.id,
  168. skuId: this.unit.id,
  169. }, res => {
  170. if (res.code == 200) {
  171. uni.showToast({
  172. title: '添加成功',
  173. });
  174. this.$refs.popup.close()
  175. }
  176. })
  177. },
  178. orderPay() {
  179. this.$emit('submit', {
  180. addressId : this.address.id,
  181. couponId : this.coupon.id
  182. })
  183. },
  184. }
  185. }
  186. </script>
  187. <style scoped lang="scss">
  188. .content {
  189. max-height: 80vh;
  190. overflow: hidden;
  191. overflow-y: auto;
  192. padding-top: 30rpx;
  193. .address {
  194. display: flex;
  195. padding: 20rpx;
  196. background-color: #fff;
  197. margin-bottom: 20rpx;
  198. image {
  199. width: 30rpx;
  200. height: 30rpx;
  201. margin: 20rpx;
  202. }
  203. view {
  204. margin: 20rpx;
  205. overflow: hidden; //超出的文本隐藏
  206. text-overflow: ellipsis; //溢出用省略号显示
  207. white-space: nowrap; //溢出不换行
  208. }
  209. .icon {
  210. margin-left: auto;
  211. }
  212. }
  213. .expense-detail {
  214. padding: 30rpx;
  215. background-color: #fff;
  216. font-size: 28rpx;
  217. .title {
  218. font-weight: 600;
  219. }
  220. .detail {
  221. background-color: #F6F6F6;
  222. color: #717171;
  223. margin: 10rpx 0;
  224. padding: 10rpx 20rpx;
  225. line-height: 50rpx;
  226. }
  227. }
  228. .submit-btn {
  229. width: 600rpx;
  230. height: 80rpx;
  231. color: #fff;
  232. border-radius: 40rpx;
  233. font-size: 28rpx;
  234. margin: 20rpx auto;
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. border: 1rpx solid $uni-color;
  239. overflow: hidden;
  240. .l {
  241. flex: 1;
  242. display: flex;
  243. justify-content: center;
  244. align-items: center;
  245. color: $uni-color;
  246. }
  247. .r {
  248. background: $uni-color;
  249. flex: 1;
  250. height: 100%;
  251. display: flex;
  252. justify-content: center;
  253. align-items: center;
  254. }
  255. }
  256. }
  257. </style>