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

353 lines
7.2 KiB

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