酒店桌布为微信小程序
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.

299 lines
5.9 KiB

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