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

393 lines
8.0 KiB

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