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

310 lines
5.5 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. <template>
  2. <uv-popup ref="popup"
  3. :round="30"
  4. bgColor="#f7f7f7">
  5. <view class="content">
  6. <!-- 地址 -->
  7. <view class="address"
  8. @click="openAddress">
  9. <image src="../../static/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
  18. size="30rpx"
  19. name="arrow-right"></uv-icon>
  20. </view>
  21. </view>
  22. <!-- 商品信息和数量 -->
  23. <view class="submit-info">
  24. <view class="title">
  25. 桌布租赁
  26. </view>
  27. <view class="box">
  28. <image
  29. class="image"
  30. :src="unit.pic"
  31. mode=""></image>
  32. <view class="info">
  33. <view class="price">
  34. <text>{{ unit.depositPrice }}</text>
  35. </view>
  36. <view class="unit">
  37. 请选择规格
  38. </view>
  39. <view class="">
  40. <uv-number-box v-model="num"></uv-number-box>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 规格 -->
  46. <view class="submit-unit">
  47. <view class="title">
  48. 规格选择
  49. </view>
  50. <view class="list">
  51. <view :class="{act : unitIndex == index}"
  52. v-for="(item, index) in detail.hotelGoodsSkuList"
  53. @click="selectUnit(item, index)"
  54. :key="index">
  55. {{ item.title }}
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 费用明细 -->
  60. <view class="expense-detail">
  61. <view class="title">
  62. 费用明细
  63. </view>
  64. <view class="detail">
  65. 押金{{ unit.depositPrice }}
  66. </view>
  67. </view>
  68. <!-- 提交按钮 -->
  69. <view class="submit-btn">
  70. <view class="l"
  71. @click="addCart">
  72. 加入租赁车
  73. </view>
  74. <view class="r">
  75. {{ submiitTitle }}
  76. </view>
  77. </view>
  78. </view>
  79. <uv-popup ref="addressPopup" :round="30">
  80. <addressList
  81. ref="addressList"
  82. height="60vh"
  83. @select="selectAddress"
  84. />
  85. </uv-popup>
  86. </uv-popup>
  87. </template>
  88. <script>
  89. import addressList from '../address/addressList.vue'
  90. export default {
  91. components : {
  92. addressList,
  93. },
  94. props : {
  95. submiitTitle : {
  96. default : '立即租赁',
  97. type : String,
  98. },
  99. detail : {
  100. default : {}
  101. }
  102. },
  103. data() {
  104. return {
  105. unitIndex : 0,
  106. address : {
  107. name : '请选择联系人',
  108. addressDetail : '',
  109. },
  110. num : 1,
  111. unit : {},
  112. }
  113. },
  114. methods: {
  115. // 打开
  116. open(){
  117. this.$refs.popup.open('bottom')
  118. if(!this.unit.id){
  119. this.selectUnit(this.detail.hotelGoodsSkuList[0], 0)
  120. }
  121. },
  122. // 关闭
  123. close(){
  124. this.$refs.popup.close()
  125. },
  126. // 打开选择地址
  127. openAddress(){
  128. // 获取地址列表
  129. this.$refs.addressList.getAddressList().then(res => {
  130. if (res.total == 0) {
  131. return uni.navigateTo({
  132. url: '/pages_order/mine/address'
  133. })
  134. }
  135. this.$refs.addressPopup.open('bottom')
  136. })
  137. },
  138. // 选择地址
  139. selectAddress(e){
  140. this.address = e
  141. this.$refs.addressPopup.close()
  142. },
  143. // 选择规格
  144. selectUnit(item, index){
  145. this.unit = item
  146. this.unitIndex = index
  147. },
  148. addCart(){
  149. this.$api('cartAdd', {
  150. id : this.detail.id,
  151. skuId : this.unit.id,
  152. }, res => {
  153. if(res.code == 200){
  154. uni.showToast({
  155. title: '添加成功',
  156. });
  157. this.$refs.popup.close()
  158. }
  159. })
  160. },
  161. }
  162. }
  163. </script>
  164. <style scoped lang="scss">
  165. .content{
  166. max-height: 80vh;
  167. overflow: hidden;
  168. overflow-y: auto;
  169. .address{
  170. display: flex;
  171. padding: 20rpx;
  172. background-color: #fff;
  173. image{
  174. width: 30rpx;
  175. height: 30rpx;
  176. margin: 20rpx;
  177. }
  178. view{
  179. margin: 20rpx;
  180. overflow:hidden; //超出的文本隐藏
  181. text-overflow:ellipsis; //溢出用省略号显示
  182. white-space:nowrap; //溢出不换行
  183. }
  184. .icon{
  185. margin-left: auto;
  186. }
  187. }
  188. .submit-info{
  189. background-color: #fff;
  190. padding: 30rpx;
  191. margin-top: 20rpx;
  192. .title{
  193. font-size: 30rpx;
  194. padding: 10rpx;
  195. font-weight: 600;
  196. }
  197. .box{
  198. display: flex;
  199. margin-top: 10rpx;
  200. .image{
  201. width: 200rpx;
  202. height: 200rpx;
  203. border-radius: 20rpx;
  204. margin-right: 20rpx;
  205. }
  206. .info{
  207. flex: 1;
  208. .unit{
  209. font-size: 24rpx;
  210. padding: 10rpx 20rpx;
  211. color: #717171;
  212. display: flex;
  213. align-items: center;
  214. }
  215. .price{
  216. color: $uni-color;
  217. font-size: 28rpx;
  218. padding: 10rpx 20rpx;
  219. text{
  220. font-size: 36rpx;
  221. font-weight: 900;
  222. }
  223. }
  224. }
  225. }
  226. }
  227. .submit-unit{
  228. padding: 30rpx;
  229. background-color: #fff;
  230. .title{
  231. font-size: 28rpx;
  232. font-weight: 600;
  233. }
  234. .list{
  235. display: flex;
  236. flex-wrap: wrap;
  237. font-size: 22rpx;
  238. .act{
  239. color: $uni-color;
  240. border: 1px solid $uni-color;
  241. background-color: #F9E7DE;
  242. }
  243. view{
  244. border-radius: 15rpx;
  245. width: 320rpx;
  246. background-color: #F3F3F3;
  247. border: 1px solid #F3F3F3;
  248. margin: 10rpx;
  249. display: flex;
  250. justify-content: center;
  251. padding: 15rpx 0;
  252. }
  253. }
  254. }
  255. .expense-detail{
  256. padding: 30rpx;
  257. background-color: #fff;
  258. font-size: 28rpx;
  259. .title{
  260. font-weight: 600;
  261. }
  262. .detail{
  263. background-color: #F6F6F6;
  264. color: #717171;
  265. margin: 10rpx 0;
  266. padding: 10rpx 20rpx;
  267. }
  268. }
  269. .submit-btn{
  270. width: 600rpx;
  271. height: 80rpx;
  272. color: #fff;
  273. border-radius: 40rpx;
  274. font-size: 28rpx;
  275. margin: 20rpx auto;
  276. display: flex;
  277. justify-content: center;
  278. align-items: center;
  279. border: 1rpx solid $uni-color;
  280. overflow: hidden;
  281. .l{
  282. flex: 1;
  283. display: flex;
  284. justify-content: center;
  285. align-items: center;
  286. color: $uni-color;
  287. }
  288. .r{
  289. background: $uni-color;
  290. flex: 1;
  291. height: 100%;
  292. display: flex;
  293. justify-content: center;
  294. align-items: center;
  295. }
  296. }
  297. }
  298. </style>