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

316 lines
5.7 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
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. addressTotal : 0,
  113. }
  114. },
  115. methods: {
  116. // 打开
  117. open(){
  118. this.$refs.popup.open('bottom')
  119. if(!this.unit.id){
  120. this.selectUnit(this.detail.hotelGoodsSkuList[0], 0)
  121. }
  122. // 获取地址列表
  123. this.$refs.addressList.getAddressList().then(res => {
  124. this.addressTotal = res.total
  125. if(this.addressTotal != 0){
  126. this.address = res.records[0]
  127. }
  128. })
  129. },
  130. // 关闭
  131. close(){
  132. this.$refs.popup.close()
  133. },
  134. // 打开选择地址
  135. openAddress(){
  136. if (this.addressTotal == 0) {
  137. return uni.navigateTo({
  138. url: '/pages_order/mine/address'
  139. })
  140. }
  141. this.$refs.addressPopup.open('bottom')
  142. },
  143. // 选择地址
  144. selectAddress(e){
  145. this.address = e
  146. this.$refs.addressPopup.close()
  147. },
  148. // 选择规格
  149. selectUnit(item, index){
  150. this.unit = item
  151. this.unitIndex = index
  152. },
  153. addCart(){
  154. this.$api('cartAdd', {
  155. id : this.detail.id,
  156. skuId : this.unit.id,
  157. }, res => {
  158. if(res.code == 200){
  159. uni.showToast({
  160. title: '添加成功',
  161. });
  162. this.$refs.popup.close()
  163. }
  164. })
  165. },
  166. }
  167. }
  168. </script>
  169. <style scoped lang="scss">
  170. .content{
  171. max-height: 80vh;
  172. overflow: hidden;
  173. overflow-y: auto;
  174. .address{
  175. display: flex;
  176. padding: 20rpx;
  177. background-color: #fff;
  178. image{
  179. width: 30rpx;
  180. height: 30rpx;
  181. margin: 20rpx;
  182. }
  183. view{
  184. margin: 20rpx;
  185. overflow:hidden; //超出的文本隐藏
  186. text-overflow:ellipsis; //溢出用省略号显示
  187. white-space:nowrap; //溢出不换行
  188. }
  189. .icon{
  190. margin-left: auto;
  191. }
  192. }
  193. .submit-info{
  194. background-color: #fff;
  195. padding: 30rpx;
  196. margin-top: 20rpx;
  197. .title{
  198. font-size: 30rpx;
  199. padding: 10rpx;
  200. font-weight: 600;
  201. }
  202. .box{
  203. display: flex;
  204. margin-top: 10rpx;
  205. .image{
  206. width: 200rpx;
  207. height: 200rpx;
  208. border-radius: 20rpx;
  209. margin-right: 20rpx;
  210. }
  211. .info{
  212. flex: 1;
  213. .unit{
  214. font-size: 24rpx;
  215. padding: 10rpx 20rpx;
  216. color: #717171;
  217. display: flex;
  218. align-items: center;
  219. }
  220. .price{
  221. color: $uni-color;
  222. font-size: 28rpx;
  223. padding: 10rpx 20rpx;
  224. text{
  225. font-size: 36rpx;
  226. font-weight: 900;
  227. }
  228. }
  229. }
  230. }
  231. }
  232. .submit-unit{
  233. padding: 30rpx;
  234. background-color: #fff;
  235. .title{
  236. font-size: 28rpx;
  237. font-weight: 600;
  238. }
  239. .list{
  240. display: flex;
  241. flex-wrap: wrap;
  242. font-size: 22rpx;
  243. .act{
  244. color: $uni-color;
  245. border: 1px solid $uni-color;
  246. background-color: #F9E7DE;
  247. }
  248. view{
  249. border-radius: 15rpx;
  250. width: 320rpx;
  251. background-color: #F3F3F3;
  252. border: 1px solid #F3F3F3;
  253. margin: 10rpx;
  254. display: flex;
  255. justify-content: center;
  256. padding: 15rpx 0;
  257. }
  258. }
  259. }
  260. .expense-detail{
  261. padding: 30rpx;
  262. background-color: #fff;
  263. font-size: 28rpx;
  264. .title{
  265. font-weight: 600;
  266. }
  267. .detail{
  268. background-color: #F6F6F6;
  269. color: #717171;
  270. margin: 10rpx 0;
  271. padding: 10rpx 20rpx;
  272. }
  273. }
  274. .submit-btn{
  275. width: 600rpx;
  276. height: 80rpx;
  277. color: #fff;
  278. border-radius: 40rpx;
  279. font-size: 28rpx;
  280. margin: 20rpx auto;
  281. display: flex;
  282. justify-content: center;
  283. align-items: center;
  284. border: 1rpx solid $uni-color;
  285. overflow: hidden;
  286. .l{
  287. flex: 1;
  288. display: flex;
  289. justify-content: center;
  290. align-items: center;
  291. color: $uni-color;
  292. }
  293. .r{
  294. background: $uni-color;
  295. flex: 1;
  296. height: 100%;
  297. display: flex;
  298. justify-content: center;
  299. align-items: center;
  300. }
  301. }
  302. }
  303. </style>