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

596 lines
12 KiB

9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
7 months ago
8 months ago
9 months ago
7 months ago
9 months ago
8 months ago
7 months ago
9 months ago
7 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
7 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
6 months ago
8 months ago
8 months ago
9 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
7 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
7 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
7 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
7 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 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
8 months ago
9 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
6 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
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
6 months ago
8 months ago
9 months ago
8 months ago
9 months ago
6 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
9 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
8 months ago
  1. <template>
  2. <uv-popup ref="popup" :round="30"
  3. @change="$refs.couponPopup.close()"
  4. bgColor="#f7f7f7">
  5. <view class="content">
  6. <!-- 地址 -->
  7. <view class="address" @click="openAddress">
  8. <image src="/static/image/address/selectIcon.png" mode=""></image>
  9. <view class="">
  10. {{ address.name }}
  11. </view>
  12. <view class="">
  13. {{ address.addressDetail }}
  14. </view>
  15. <view class="icon">
  16. <uv-icon size="30rpx" name="arrow-right"></uv-icon>
  17. </view>
  18. </view>
  19. <!-- 是否有桌布 -->
  20. <!-- <view class="submit-unit"
  21. style="margin-top: 20rpx;">
  22. <view class="title">
  23. 您有{{ detail.categoryName }}
  24. </view>
  25. <view class="list">
  26. <view :class="{act : typeIndex == index}" v-for="(item, index) in type"
  27. @click="typeIndex = index" :key="index">
  28. {{ item }}{{ detail.categoryName }}
  29. </view>
  30. </view>
  31. </view> -->
  32. <!-- 我要购买租赁 -->
  33. <!-- <view class="submit-unit"
  34. style="margin-top: 20rpx;">
  35. <view class="list">
  36. <view :class="{act : buyIndex == index}"
  37. v-for="(item, index) in buyType"
  38. @click="buyIndex = index"
  39. :key="index">
  40. {{ item }}
  41. </view>
  42. </view>
  43. </view> -->
  44. <view class="payInfoMessage"
  45. v-if="buyIndex == 0">
  46. <view style="font-weight: 900;">
  47. 下单说明
  48. </view>
  49. <view class="">
  50. 租金从物品确认收货开始计算{{ configList.depositPrice }}/
  51. </view>
  52. <view class="">
  53. 押金将按照面积计算每平方厘米1
  54. </view>
  55. </view>
  56. <!-- 商品信息和数量 -->
  57. <view v-if="typeIndex == 0">
  58. <view class="submit-info">
  59. <view class="title">
  60. {{ detail.categoryName }}租赁
  61. </view>
  62. <view class="box">
  63. <image class="image" :src="unit.pic" mode=""></image>
  64. <view class="info">
  65. <view class="price">
  66. 租金<text>{{ unit.price }}</text>/
  67. </view>
  68. <view class="price"
  69. style="font-size: 22rpx;">
  70. 押金<text
  71. style="font-size: 22rpx;">{{ detail.depositPrice }}</text>
  72. </view>
  73. <view class="unit">
  74. 请选择规格
  75. </view>
  76. <view class="">
  77. <uv-number-box
  78. @change="valChange"
  79. v-model="num"></uv-number-box>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <!-- 规格 -->
  85. <view class="submit-unit">
  86. <view class="title">
  87. 规格选择
  88. </view>
  89. <view class="list">
  90. <view :class="{act : unitIndex == index}" v-for="(item, index) in detail.hotelGoodsSkuList"
  91. @click="selectUnit(item, index)" :key="index">
  92. {{ item.title }}
  93. <text v-if="item.colour">,{{ item.colour }}</text>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 优惠劵 -->
  98. <!-- <view style="padding: 0 20rpx;">
  99. <uv-cell
  100. icon="coupon"
  101. title="优惠劵"
  102. iconStyle="font-size: 34rpx;"
  103. rightIconStyle="font-size: 34rpx;"
  104. :value="couponText"
  105. @click="$refs.couponPopup.open('bottom')"
  106. isLink>
  107. </uv-cell>
  108. </view> -->
  109. <!-- 费用明细 -->
  110. <view class="expense-detail">
  111. <view class="title">
  112. 费用明细
  113. </view>
  114. <view class="detail" v-if="detail.depositPrice">
  115. <view>
  116. 应付款{{ price }}
  117. </view>
  118. <view>
  119. <view class="">
  120. 押金{{ detail.depositPrice }}
  121. </view>
  122. <view class="">
  123. x{{ num }}
  124. </view>
  125. </view>
  126. <view v-if="coupon.couponCondition <= price
  127. && coupon.couponFlag">
  128. 优惠-{{ coupon.couponPrice }}
  129. </view>
  130. <view v-if="coupon.couponCondition <= price
  131. && coupon.couponFlag">
  132. 实付款{{ (price - coupon.couponPrice).toFixed(2) }}
  133. </view>
  134. </view>
  135. <uv-cell
  136. icon="coupon"
  137. title="押金优惠"
  138. v-if="coupon.couponFlag"
  139. iconStyle="font-size: 34rpx;"
  140. rightIconStyle="font-size: 34rpx;">
  141. <template #value>
  142. <view class="coupon">
  143. {{ coupon.couponCondition }}立减{{ coupon.couponPrice }}
  144. </view>
  145. </template>
  146. </uv-cell>
  147. </view>
  148. </view>
  149. <addLeaseForm :categoryId="detail.categoryId" ref="addLeaseForm" v-if="typeIndex == 1"/>
  150. <!-- 提交按钮 -->
  151. <view class="submit">
  152. <view class="submit-btn">
  153. <view class="l" @click="addCart" v-if="typeIndex == 0">
  154. 加入租赁车
  155. </view>
  156. <view class="r" @click="orderPay">
  157. {{ submiitTitle }}
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. <uv-popup ref="couponPopup" :round="30">
  163. <couponList
  164. ref="couponList"
  165. height="60vh"
  166. :depositPrice="price"
  167. @select="selectCoupon" />
  168. </uv-popup>
  169. <uv-popup ref="addressPopup" :round="30">
  170. <addressList ref="addressList" height="60vh" @select="selectAddress" />
  171. </uv-popup>
  172. </uv-popup>
  173. </template>
  174. <script>
  175. import addressList from '@/components/address/addressList.vue'
  176. import couponList from '@/components/user/couponList.vue'
  177. import addLeaseForm from './addLeaseForm.vue'
  178. import { mapState } from 'vuex'
  179. export default {
  180. components: {
  181. addressList,
  182. couponList,
  183. addLeaseForm,
  184. },
  185. props: {
  186. submiitTitle: {
  187. default: '立即下单',
  188. type: String,
  189. },
  190. detail: {
  191. default: {}
  192. },
  193. },
  194. computed : {
  195. ...mapState(['configList']),
  196. price(){
  197. return (this.detail.depositPrice * this.num).toFixed(2)
  198. },
  199. },
  200. data() {
  201. return {
  202. unitIndex: 0,
  203. address: {
  204. name: '请选择联系人',
  205. addressDetail: '',
  206. },
  207. num: 1,
  208. unit: {},
  209. addressTotal: 0,
  210. coupon : {
  211. price : 0,
  212. },
  213. couponText : '请选择',
  214. typeIndex : 0,//是否有桌布
  215. type : ['没有', '我有'],//是否有桌布
  216. buyIndex : 0,//是否有桌布
  217. buyType : ['我要租赁', '我要购买'],//是否购买
  218. }
  219. },
  220. methods: {
  221. // 打开
  222. open() {
  223. this.$refs.popup.open('bottom')
  224. // this.$refs.couponList.getData()
  225. this.confCoupon()
  226. if (!this.unit.id) {
  227. this.selectUnit(this.detail.hotelGoodsSkuList[0], 0)
  228. }
  229. // 获取地址列表
  230. this.$refs.addressList.getAddressList().then(res => {
  231. this.addressTotal = res.total
  232. if (this.addressTotal != 0) {
  233. this.address = res.records[0]
  234. }
  235. })
  236. },
  237. confCoupon(){
  238. this.$api('confCoupon', res => {
  239. if(res.code == 200){
  240. this.coupon = res.result
  241. }
  242. })
  243. },
  244. valChange(){
  245. // this.coupon = {
  246. // price : 0,
  247. // }
  248. // this.couponText = '请选择'
  249. },
  250. // 选择优惠劵
  251. selectCoupon(e){
  252. this.couponText = e.couponName
  253. this.coupon = e
  254. this.$refs.couponPopup.close()
  255. },
  256. // 关闭
  257. close() {
  258. this.$refs.popup.close()
  259. },
  260. // 打开选择地址
  261. openAddress() {
  262. if (this.addressTotal == 0) {
  263. this.$refs.popup.close()
  264. return uni.navigateTo({
  265. url: '/pages_order/mine/address?type=back'
  266. })
  267. }
  268. this.$refs.addressPopup.open('bottom')
  269. },
  270. // 选择地址
  271. selectAddress(e) {
  272. this.address = e
  273. this.$refs.addressPopup.close()
  274. },
  275. // 选择规格
  276. selectUnit(item, index) {
  277. this.unit = item
  278. this.unitIndex = index
  279. },
  280. addCart() {
  281. this.$api('cartAdd', {
  282. id: this.detail.id,
  283. skuId: this.unit.id,
  284. num : this.num,
  285. }, res => {
  286. if (res.code == 200) {
  287. uni.showToast({
  288. title: '添加成功',
  289. });
  290. this.$refs.popup.close()
  291. }
  292. })
  293. },
  294. // 添加我的物品
  295. submitAddLease() {
  296. if(!this.address.id){
  297. return uni.showToast({
  298. title: '请选择地址'
  299. })
  300. }
  301. this.$refs.addLeaseForm.submit(form => {
  302. form.addressId = this.address.id, //地址id
  303. this.$api('tablecloth', form, res => {
  304. if (res.code == 200) {
  305. uni.redirectTo({
  306. url: '/pages_order/order/createWash?id=1'
  307. })
  308. }
  309. })
  310. })
  311. },
  312. orderPay() {
  313. // 添加我的物品
  314. if(this.typeIndex == 1){
  315. return this.submitAddLease()
  316. }
  317. // 租赁物品
  318. let data = [
  319. {
  320. id: this.detail.id, //商品id
  321. skuId: this.unit.id, //规格id
  322. addressId: this.address.id, //地址id
  323. sku: this.unit.title, //规格
  324. num: this.num,
  325. }
  326. ]
  327. if(this.unit.colour){
  328. data[0].sku = data[0].sku + ',' + this.unit.colour
  329. }
  330. if (this.$utils.verificationAll(data[0], {
  331. skuId: '请选择规格',
  332. addressId: '请选择地址',
  333. })) {
  334. return
  335. }
  336. this.$api('orderCreate', {req:JSON.stringify(data)}, res => {
  337. if (res.code == 200) {
  338. let form = {
  339. id: res.result.id,
  340. }
  341. if(this.coupon.id){
  342. form.couponId = this.coupon.id
  343. }
  344. this.$api('orderPay', form, res => {
  345. if (res.code == 200) {
  346. uni.requestPayment({
  347. provider: 'wxpay', // 服务提提供商
  348. timeStamp: res.result.timeStamp, // 时间戳
  349. nonceStr: res.result.nonceStr, // 随机字符串
  350. package: res.result.packageValue,
  351. signType: res.result.signType, // 签名算法
  352. paySign: res.result.paySign, // 签名
  353. success: function(res) {
  354. // console.log('支付成功', res);
  355. uni.redirectTo({
  356. url: '/pages/index/order'
  357. })
  358. },
  359. fail: function(err) {
  360. console.log('支付失败', err);
  361. uni.redirectTo({
  362. url:'/pages/index/order'
  363. })
  364. // self.$refs.confirmationPopup.close()
  365. uni.showToast({
  366. icon: 'none',
  367. title: "支付失败"
  368. })
  369. }
  370. });
  371. }
  372. })
  373. }
  374. })
  375. },
  376. }
  377. }
  378. </script>
  379. <style scoped lang="scss">
  380. .content {
  381. max-height: 70vh;
  382. overflow: hidden;
  383. overflow-y: auto;
  384. padding-bottom: 120rpx;
  385. .address {
  386. display: flex;
  387. padding: 20rpx;
  388. background-color: #fff;
  389. image {
  390. width: 30rpx;
  391. height: 30rpx;
  392. margin: 20rpx;
  393. }
  394. view {
  395. margin: 20rpx;
  396. overflow: hidden; //超出的文本隐藏
  397. text-overflow: ellipsis; //溢出用省略号显示
  398. white-space: nowrap; //溢出不换行
  399. }
  400. .icon {
  401. margin-left: auto;
  402. }
  403. }
  404. .payInfoMessage{
  405. line-height: 50rpx;
  406. background-color: #fff;
  407. padding: 20rpx;
  408. margin: 10rpx 0;
  409. font-size: 26rpx;
  410. }
  411. .submit-info {
  412. background-color: #fff;
  413. padding: 30rpx;
  414. margin-top: 20rpx;
  415. .title {
  416. font-size: 30rpx;
  417. padding: 10rpx;
  418. font-weight: 600;
  419. }
  420. .box {
  421. display: flex;
  422. margin-top: 10rpx;
  423. .image {
  424. width: 200rpx;
  425. height: 200rpx;
  426. border-radius: 20rpx;
  427. margin-right: 20rpx;
  428. }
  429. .info {
  430. flex: 1;
  431. .unit {
  432. font-size: 24rpx;
  433. padding: 10rpx 20rpx;
  434. color: #717171;
  435. display: flex;
  436. align-items: center;
  437. }
  438. .price {
  439. color: $uni-color;
  440. font-size: 28rpx;
  441. padding: 10rpx 20rpx;
  442. text {
  443. font-size: 36rpx;
  444. font-weight: 900;
  445. }
  446. }
  447. }
  448. }
  449. }
  450. .submit-unit {
  451. padding: 30rpx;
  452. background-color: #fff;
  453. .title {
  454. font-size: 28rpx;
  455. font-weight: 600;
  456. }
  457. .list {
  458. display: flex;
  459. flex-wrap: wrap;
  460. font-size: 22rpx;
  461. .act {
  462. color: $uni-color;
  463. border: 1px solid $uni-color;
  464. background-color: #F9E7DE;
  465. }
  466. view {
  467. border-radius: 15rpx;
  468. width: 320rpx;
  469. background-color: #F3F3F3;
  470. border: 1px solid #F3F3F3;
  471. margin: 10rpx;
  472. display: flex;
  473. justify-content: center;
  474. padding: 15rpx 0;
  475. }
  476. }
  477. }
  478. .expense-detail {
  479. padding: 30rpx;
  480. background-color: #fff;
  481. font-size: 28rpx;
  482. .title {
  483. font-weight: 600;
  484. }
  485. .detail {
  486. background-color: #F6F6F6;
  487. color: #717171;
  488. margin: 10rpx 0;
  489. padding: 10rpx 20rpx;
  490. line-height: 50rpx;
  491. view{
  492. display: flex;
  493. justify-content: space-between;
  494. }
  495. }
  496. .coupon{
  497. text-align: center;
  498. color: #5c5;
  499. }
  500. }
  501. .submit{
  502. background-color: #fff;
  503. position: fixed;
  504. left: 0;
  505. bottom: 0;
  506. padding-bottom: env(safe-area-inset-bottom);
  507. width: 100%;
  508. .submit-btn {
  509. width: 600rpx;
  510. height: 80rpx;
  511. color: #fff;
  512. border-radius: 40rpx;
  513. font-size: 28rpx;
  514. margin: 20rpx auto;
  515. display: flex;
  516. justify-content: center;
  517. align-items: center;
  518. border: 1rpx solid $uni-color;
  519. overflow: hidden;
  520. .l {
  521. flex: 1;
  522. display: flex;
  523. justify-content: center;
  524. align-items: center;
  525. color: $uni-color;
  526. }
  527. .r {
  528. background: $uni-color;
  529. flex: 1;
  530. height: 100%;
  531. display: flex;
  532. justify-content: center;
  533. align-items: center;
  534. }
  535. }
  536. }
  537. }
  538. </style>