xll 3 周之前
父节点
当前提交
ac11af1f47
共有 37 个文件被更改,包括 3306 次插入2705 次删除
  1. 12 1
      app.json
  2. 9 5
      common-page/pages/sharing/index.js
  3. 237 198
      nova-tourism/components/collect/index.js
  4. 93 92
      nova-tourism/components/collect/index.wxml
  5. 234 350
      nova-tourism/components/homestay/index.js
  6. 122 90
      nova-tourism/components/homestay/index.less
  7. 65 103
      nova-tourism/components/homestay/index.wxml
  8. 0 0
      nova-tourism/components/homestay/index.wxss
  9. 3 1
      nova-tourism/components/my/index.js
  10. 1 1
      nova-tourism/components/my/index.wxml
  11. 314 83
      nova-tourism/pages/collect/collect-detail/index.js
  12. 3 1
      nova-tourism/pages/collect/collect-detail/index.json
  13. 10 1
      nova-tourism/pages/collect/collect-detail/index.less
  14. 120 76
      nova-tourism/pages/collect/collect-detail/index.wxml
  15. 0 0
      nova-tourism/pages/collect/collect-detail/index.wxss
  16. 241 354
      nova-tourism/pages/homestay/homestay-detail/index.js
  17. 117 6
      nova-tourism/pages/homestay/homestay-detail/index.less
  18. 66 84
      nova-tourism/pages/homestay/homestay-detail/index.wxml
  19. 107 3
      nova-tourism/pages/homestay/homestay-detail/index.wxss
  20. 388 430
      nova-tourism/pages/homestay/homestay-order2/index.js
  21. 14 14
      nova-tourism/pages/homestay/homestay-order2/index.wxml
  22. 32 48
      nova-tourism/pages/index/index.js
  23. 160 160
      nova-tourism/pages/my/merchant/login/index.js
  24. 0 2
      nova-tourism/pages/my/merchant/login/index.wxml
  25. 10 2
      nova-tourism/pages/my/merchant/merchant-home/index.js
  26. 86 71
      nova-tourism/pages/my/merchant/merchant-home/index.wxml
  27. 92 0
      nova-tourism/pages/my/merchant/merchant-home/my-users/index.js
  28. 3 0
      nova-tourism/pages/my/merchant/merchant-home/my-users/index.json
  29. 17 0
      nova-tourism/pages/my/merchant/merchant-home/my-users/index.less
  30. 7 0
      nova-tourism/pages/my/merchant/merchant-home/my-users/index.wxml
  31. 14 0
      nova-tourism/pages/my/merchant/merchant-home/my-users/index.wxss
  32. 268 206
      nova-tourism/pages/my/my-order/index.js
  33. 196 128
      nova-tourism/pages/my/my-order/index.wxml
  34. 116 116
      nova-tourism/pages/my/my-order/order-detail/index.wxml
  35. 0 7
      nova-tourism/service/date.js
  36. 146 5
      nova-tourism/service/request.js
  37. 3 67
      project.private.config.json

+ 12 - 1
app.json

@@ -34,7 +34,18 @@
         "pages/my/my-order/order-detail/index",
         "pages/my/my-order/my-refund/index",
         "pages/my/my-order/my-refund/refund-detail/index",
-        "pages/my/my-wallet/loose-change/index"
+        "pages/my/my-wallet/loose-change/index",
+        "pages/my/merchant/merchant-home/my-users/index"
+      ]
+    },
+    {
+      "root": "common-page",
+      "name": "common",
+      "pages": [
+        "pages/info/ucenter/address/index",
+        "pages/info/ucenter/address-detail/index",
+        "pages/address/index",
+        "pages/sharing/index"
       ]
     },
     {

+ 9 - 5
common-page/pages/sharing/index.js

@@ -21,9 +21,10 @@ Page({
       cColor,
       bColor,
       noBind,
-      route //扫码携带路径
+      route, //扫码携带路径
+      uid
     } = options
-    let userId = Parse.User.current().id
+    let userId =  uid||wx.getStorageSync('merchant')?.objectId||Parse.User.current().id
     let imgUrl = await this.loadPoster() || 'https://file-cloud.fmode.cn/L3xHgXbTHJ/20230814/vod1h4054437092.png'
     this.setData({
       imgUrl,
@@ -31,7 +32,7 @@ Page({
       sx,
       sy,
       noBind,
-      route
+      route,uid
     });
     const _this = this
     let qrCodeUrl = `https://pwa.fmode.cn/gomini/${path}/?invite=${userId}`;
@@ -221,7 +222,8 @@ Page({
     })
   },
   onCopy() {
-    let id = Parse.User.current().id;
+    let {uid}=this.data
+    let id = uid||wx.getStorageSync('merchant')?.objectId||Parse.User.current().id
     let url = 'https://server.fmode.cn/api/wxapp/wechat/urlLink'
     let query = `invite=${id}`
     if(this.data.noBind) {
@@ -325,7 +327,9 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
-    let uid = Parse.User.current().id
+    let {uid}=this.data
+
+    uid = uid||wx.getStorageSync('merchant')?.objectId||Parse.User.current().id
     let path = `index?invite=${uid}`
     if(this.data.noBind) {
       path = 'index'

+ 237 - 198
nova-tourism/components/collect/index.js

@@ -1,209 +1,248 @@
 // nova-tourism/components/collect/index.js
 let Parse = getApp().Parse;
 const company = getApp().globalData.company
-Component({
-    /**
-     * 组件的属性列表
-     */
-    properties: {
+const uid = Parse.User.current()?.id
+const req = require('../../../utils/request')
 
+Component({
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    taps: [{
+        url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/r1kr6b044821198.png',
+        tex: '望仙礼遇',
+      },
+      {
+        url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/r1on6t044840728.png',
+        tex: '妆造旅拍',
+      },
+      {
+        url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/v16vb1044858389.png',
+        tex: '望仙果蔬',
+      },
+      {
+        url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/dm2ol9044926231.png',
+        tex: '房务服务',
+      },
+      {
+        url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241231/1pglm9032750560.png',
+        tex: '商学院',
+      },
+    ],
+    imageUrls: ['https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg',
+      'https://c-ssl.dtstatic.com/uploads/blog/201409/27/20140927230814_4QfVC.thumb.1000_0.jpeg',
+      'https://ts1.cn.mm.bing.net/th/id/R-C.37f4077f8eaca918401b84b4ee23af7c?rik=7HYWC88a9q4sZw&riu=http%3a%2f%2fpic.616pic.com%2fphotoone%2f00%2f06%2f03%2f618e27ad7ce8e1124.jpg&ehk=jkc6iZWAg%2bAEjAk6%2br0VAAy1lfffqslT6n%2fMWl293Yc%3d&risl=&pid=ImgRaw&r=0'
+    ],
+
+    date_start: '',
+    date_end: '',
+    start: '',
+    end: '',
+    istoday: true,
+    daysBetween: 1,
+    currentTab: 0, // 云上风物/我的收藏
+    banner:[],//热门推荐
+    giftBanner:[],//望仙礼遇-轮播图
+    gift:[],//望仙礼遇-商品
+  },
+  lifetimes: {
+    detached: function () {},
+    attached: async function () {
+      this.gethomestar()
+      this.getcurrentdate()
+      this.refersh()
     },
-
-    /**
-     * 组件的初始数据
-     */
-    data: {
-        statusBarHeight: 0,
-        screenHeight: 0,
-        customHeight: 0,
-        bottomNavHeight: 0,
-        contentHeight: 0,
-
-
-
-        taps: [{
-                url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/r1kr6b044821198.png',
-                tex: '望仙礼遇',
-            },
-            {
-                url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/r1on6t044840728.png',
-                tex: '妆造旅拍',
-            },
-            {
-                url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/v16vb1044858389.png',
-                tex: '望仙果蔬',
-            },
-            {
-                url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/dm2ol9044926231.png',
-                tex: '房务服务',
-            },
-            {
-                url: 'https://file-cloud.fmode.cn/EbxZUK5lBI/20241231/1pglm9032750560.png',
-                tex: '商学院',
-            },
-        ],
-        imageUrls: ['https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg',
-            'https://c-ssl.dtstatic.com/uploads/blog/201409/27/20140927230814_4QfVC.thumb.1000_0.jpeg',
-            'https://ts1.cn.mm.bing.net/th/id/R-C.37f4077f8eaca918401b84b4ee23af7c?rik=7HYWC88a9q4sZw&riu=http%3a%2f%2fpic.616pic.com%2fphotoone%2f00%2f06%2f03%2f618e27ad7ce8e1124.jpg&ehk=jkc6iZWAg%2bAEjAk6%2br0VAAy1lfffqslT6n%2fMWl293Yc%3d&risl=&pid=ImgRaw&r=0'
-        ],
-
-        date_start: '',
-        date_end: '',
-        start: '',
-        end: '',
-        istoday: true,
-        daysBetween: 1,
-        currentTab: 0
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    refersh(){
+      this.getBanner()
+      this.getGiftBanner()
+      this.getGift()
     },
-    lifetimes: {
-        detached: function () {},
-        attached: async function () {
-            const systemInfo = wx.getSystemInfoSync();
-            const statusBarHeight = systemInfo.statusBarHeight || 0;
-            const screenHeight = systemInfo.screenHeight || 0;
-            const custom = wx.getMenuButtonBoundingClientRect();
-            const customHeight = custom.height + 10 + 2 || 0;
-            const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
-            const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
-            this.setData({
-                statusBarHeight,
-                screenHeight,
-                customHeight,
-                bottomNavHeight,
-                contentHeight
-            });
-            this.gethomestar()
-            this.getcurrentdate()
-        },
+    /**切换 云上风物/我的收藏 */
+    switchTab(e) {
+      const index = e.currentTarget.dataset.index;
+      this.setData({
+        currentTab: index
+      });
     },
-
-    /**
-     * 组件的方法列表
-     */
-    methods: {
-        switchTab (e) {
-            const index = e.currentTarget.dataset.index;
-            this.setData({
-              currentTab: index
-            });
-            console.log(this.data.currentTab);
-          },
-        //获取收藏店铺消息
-        async gethomestar() {
-            const currentUser = Parse.User.current();
-            console.log(currentUser);
-            let ShopStore = new Parse.Query('DramaShopCollect');
-            ShopStore.equalTo('company', company);
-            ShopStore.equalTo('user', currentUser.id);
-            ShopStore.equalTo('isCollect', 'true');
-            ShopStore.notEqualTo('isDeleted', "true");
-            ShopStore.include('homestayStore');
-            let store = await ShopStore.find();
-            let storeList = store.map(item => item.toJSON());
-            this.setData({
-                storeList
-            });
-
-            console.log('123', this.data.storeList);
-        },
-        //点击取消
-        async cancle(e) {
-            const object = e.currentTarget.dataset.id
-            const currentUser = Parse.User.current();
-            let Collect = new Parse.Query('DramaShopCollect');
-            Collect.equalTo('company', company);
-            Collect.equalTo('user', currentUser.id);
-            Collect.equalTo('isCollect', true);
-            Collect.equalTo('homestayStore', object);
-            Collect.notEqualTo('isDeleted', "true");
-            let collect = await Collect.first();
-
-            await this.changeiscollect(object)
-            if (collect) {
-                collect.set('isCollect', false)
-                try {
-                    let saveDate = await collect.save();
-                    console.log(saveDate);
-                    console.log("取消成功");
-                } catch (error) {
-                    console.error("保存数据时出现错误:", error);
-                }
-            }
-        },
-        // 点击收藏后把storeList中对应的isCollect变成true
-        changeiscollect(objectId) {
-            // 创建一个新的 storeList 数组,以确保视图更新
-            const updatedStoreList = this.data.storeList.map(item => {
-                if (item.homestayStore.objectId === objectId) {
-                    return {
-                        ...item,
-                        isCollect: !item.isCollect // 切换 iscollect 的值
-                    };
-                }
-                return item; // 返回未修改的项
-            });
-
-            // 更新 storeList
-            this.setData({
-                storeList: updatedStoreList
-            });
-
-            console.log('修改成功', objectId);
-        },
-        //转换日期
-        formatDate(date) {
-            date = new Date(date);
-            return `${date.getMonth() + 1}月${date.getDate()}日`;
-        },
-        //获取今日明日日期
-        getcurrentdate() {
-            const today = new Date();
-            const tomorrow = new Date();
-            tomorrow.setDate(today.getDate() + 1);
-
-            this.setData({
-                date_start: this.formatDate(today),
-                date_end: this.formatDate(tomorrow),
-                start: today,
-                end: tomorrow
-            });
-            console.log(this.data.start, this.data.end);
-        },
-        //去收藏商铺
-        gourl(e) {
-            const url = e.currentTarget.dataset.url;
-            const id = e.currentTarget.dataset.id;
-
-            // 构造要传递的信息
-            const info = {
-                objectId: id,
-                date_start: this.data.date_start,
-                date_end: this.data.date_end,
-                daysBetween: this.data.daysBetween,
-                istoday: this.data.istoday,
-                start: this.data.start,
-                end: this.data.end
-            };
-
-            // 将信息转为查询字符串
-            const queryString = Object.keys(info)
-                .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(info[key])}`)
-                .join('&');
-
-            // 使用查询字符串跳转
-            wx.navigateTo({
-                url: `${url}?${queryString}`,
-            });
-        },
-
-        //去商品详细
-        gourl2(e){
-            wx.navigateTo({
-                url: `../../pages/collect/collect-detail/index`,
-            });
+/**获取热门推荐 */
+async getBanner(){
+  let query = new Parse.Query('Banner')
+  query.equalTo('company',company)
+  query.notEqualTo('isDeleted',true)
+  query.equalTo('isEnabled',true)
+  query.equalTo('type','season')
+  query.include('shopGoods')
+  let d = await query.find()
+  let banner = []
+  banner=d?.map(item=>{
+    let obj = {}
+    obj.image = item?.get('image')||item?.get('shopGoods')?.get('image')
+    obj.url = item?.get('url')||`/nova-tourism/pages/collect/collect-detail/index?gid=${item?.get('shopGoods')?.id}`
+    return obj
+  })
+  this.setData({banner})
+},
+/**获取望仙礼遇-轮播图 */
+async getGiftBanner(){
+  let sql = `SELECT good."objectId",good."image"
+  FROM "ShopGoods" good
+  WHERE good."company" = 'EbxZUK5lBI'
+  AND good."isDeleted" IS NOT TRUE
+  AND good."status" IS TRUE
+  ORDER BY COALESCE(good."isRecom", FALSE) DESC,
+  CASE WHEN good."top"= 0 THEN 1 ELSE 0 END,
+  good."top" ASC
+  LIMIT 8`
+  let giftBanner = await req.customSQL(sql)||[]
+  this.setData({giftBanner})
+  console.log(giftBanner)
+},
+/** 获取望仙礼遇-商品*/
+async getGift(){
+  let sql = `SELECT good."objectId",good."name",good."price",good."image"
+  FROM "ShopGoods" good
+  WHERE good."company" = '${company}'
+  AND good."isDeleted" IS NOT TRUE
+  AND good."status" IS TRUE
+  ORDER BY COALESCE(good."isHome", FALSE) DESC,
+  CASE WHEN good."top"= 0 THEN 1 ELSE 0 END,
+  good."top" ASC,good."createdAt"
+  LIMIT 4`
+  let gift = await req.customSQL(sql)||[]
+  console.log(gift)
+  this.setData({gift})
+},
+
+
+
+
+    //获取收藏店铺消息
+    async gethomestar() {
+      const currentUser = Parse.User.current();
+      console.log(currentUser);
+      let ShopStore = new Parse.Query('DramaShopCollect');
+      ShopStore.equalTo('company', company);
+      ShopStore.equalTo('user', currentUser.id);
+      ShopStore.equalTo('isCollect', 'true');
+      ShopStore.notEqualTo('isDeleted', "true");
+      ShopStore.include('homestayStore');
+      let store = await ShopStore.find();
+      let storeList = store.map(item => item.toJSON());
+      this.setData({
+        storeList
+      });
+
+      console.log('123', this.data.storeList);
+    },
+    //点击取消
+    async cancle(e) {
+      const object = e.currentTarget.dataset.id
+      const currentUser = Parse.User.current();
+      let Collect = new Parse.Query('DramaShopCollect');
+      Collect.equalTo('company', company);
+      Collect.equalTo('user', currentUser.id);
+      Collect.equalTo('isCollect', true);
+      Collect.equalTo('homestayStore', object);
+      Collect.notEqualTo('isDeleted', "true");
+      let collect = await Collect.first();
+
+      await this.changeiscollect(object)
+      if (collect) {
+        collect.set('isCollect', false)
+        try {
+          let saveDate = await collect.save();
+          console.log(saveDate);
+          console.log("取消成功");
+        } catch (error) {
+          console.error("保存数据时出现错误:", error);
+        }
+      }
+    },
+    // 点击收藏后把storeList中对应的isCollect变成true
+    changeiscollect(objectId) {
+      // 创建一个新的 storeList 数组,以确保视图更新
+      const updatedStoreList = this.data.storeList.map(item => {
+        if (item.homestayStore.objectId === objectId) {
+          return {
+            ...item,
+            isCollect: !item.isCollect // 切换 iscollect 的值
+          };
         }
+        return item; // 返回未修改的项
+      });
 
+      // 更新 storeList
+      this.setData({
+        storeList: updatedStoreList
+      });
 
-    }
+      console.log('修改成功', objectId);
+    },
+    //转换日期
+    formatDate(date) {
+      date = new Date(date);
+      return `${date.getMonth() + 1}月${date.getDate()}日`;
+    },
+    //获取今日明日日期
+    getcurrentdate() {
+      const today = new Date();
+      const tomorrow = new Date();
+      tomorrow.setDate(today.getDate() + 1);
+
+      this.setData({
+        date_start: this.formatDate(today),
+        date_end: this.formatDate(tomorrow),
+        start: today,
+        end: tomorrow
+      });
+      console.log(this.data.start, this.data.end);
+    },
+    //去收藏商铺
+    gourl(e) {
+      const url = e.currentTarget.dataset.url;
+      const id = e.currentTarget.dataset.id;
+
+      // 构造要传递的信息
+      const info = {
+        objectId: id,
+        date_start: this.data.date_start,
+        date_end: this.data.date_end,
+        daysBetween: this.data.daysBetween,
+        istoday: this.data.istoday,
+        start: this.data.start,
+        end: this.data.end
+      };
+
+      // 将信息转为查询字符串
+      const queryString = Object.keys(info)
+        .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(info[key])}`)
+        .join('&');
+
+      // 使用查询字符串跳转
+      wx.navigateTo({
+        url: `${url}?${queryString}`,
+      });
+    },
+    /** 跳转*/
+    tourl(e) {
+      const url = e.currentTarget.dataset.url
+      wx.navigateTo({
+        url: `${url}` // 目标页面的路径
+      });
+    },
+  }
 })

+ 93 - 92
nova-tourism/components/collect/index.wxml

@@ -1,109 +1,110 @@
 <!--nova-tourism/components/collect/index.wxml-->
 <nav type="title" background-color="#ffffff" frontColor="#000000" title="云上望仙" />
-<view class="all" style="height: {{contentHeight}}rpx;">
-    <image class="img2" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/jc17lo114657420.jpg"></image>
-    <view class="tab-bar">
-        <view style="margin-left: 66rpx;" class="tab-item {{currentTab == 0? 'active' : ''}}" bindtap="switchTab" data-index="0">
-            云上风物
-        </view>
-        <view style="margin-left: 44rpx;" class="tab-item {{currentTab == 1? 'active' : ''}}" bindtap="switchTab" data-index="1">
-            我的收藏
-        </view>
+<view class="all">
+  <image class="img2" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/jc17lo114657420.jpg"></image>
+  <view class="tab-bar">
+    <view style="margin-left: 66rpx;" class="tab-item {{currentTab == 0? 'active' : ''}}" bindtap="switchTab" data-index="0">
+      云上风物
     </view>
-    <view wx:if="{{currentTab == 0}}">
-        <view class="box">
-            <view class="taps">
-                <block wx:for="{{taps}}">
-                    <view class="tap">
-                        <image src="{{item.url}}"></image>
-                        <view class="tap-tex">{{item.tex}}</view>
-                    </view>
-                </block>
-            </view>
-            <view class="box-tex">热门推荐</view>
-            <view class="picturebox">
-                <swiper autoplay="{{true}}" indicator-dots='{{true}}' indicator-color='#D9D9D9' indicator-active-color='#F8DA7F' interval="{{3000}}" circular duration="{{500}}" class="img" bindchange="onSwiperChange">
-                    <block wx:for="{{imageUrls}}" wx:key="index" wx:for-item="img">
-                        <swiper-item class="img">
-                            <image src="{{img}}" mode="aspectFill"></image>
-                        </swiper-item>
-                    </block>
-                </swiper>
-            </view>
+    <view style="margin-left: 44rpx;" class="tab-item {{currentTab == 1? 'active' : ''}}" bindtap="switchTab" data-index="1">
+      我的收藏
+    </view>
+  </view>
+  <view wx:if="{{currentTab == 0}}">
+    <view class="box">
+      <view class="taps">
+        <block wx:for="{{taps}}" wx:key="index">
+          <view class="tap">
+            <image src="{{item.url}}"></image>
+            <view class="tap-tex">{{item.tex}}</view>
+          </view>
+        </block>
+      </view>
+      <view class="box-tex">热门推荐</view>
+      <view class="picturebox">
+        <swiper autoplay="{{true}}" indicator-dots='{{true}}' indicator-color='#D9D9D9' indicator-active-color='#F8DA7F' interval="{{5000}}" circular duration="{{500}}" class="img">
+          <block wx:for="{{banner}}" wx:key="index" wx:for-item="ban">
+            <swiper-item class="img">
+              <image src="{{ban.image}}" data-url="{{ban.url}}" bind:tap="tourl" mode="aspectFill"></image>
+            </swiper-item>
+          </block>
+        </swiper>
+      </view>
 
-            <view class="wangbox">
-                <view class="wang">望仙礼遇</view>
-                <view class="wang2">望日w望月w来望仙w</view>
-            </view>
-            <view class="picturebox2" >
-                <swiper autoplay="{{true}}" indicator-dots='{{true}}' indicator-color='#D9D9D9' indicator-active-color='#F8DA7F' interval="{{3000}}" circular duration="{{500}}" class="img" bindchange="onSwiperChange">
-                    <block wx:for="{{imageUrls}}" wx:key="index" wx:for-item="img">
-                        <swiper-item class="img" >
-                            <image style="border-radius: 10rpx;" src="{{img}}"  mode="aspectFill"></image>
-                        </swiper-item>
-                    </block>
-                </swiper>
-            </view>
+      <view class="wangbox">
+        <view class="wang">望仙礼遇</view>
+        <view class="wang2">望日w望月w来望仙w</view>
+      </view>
+      <view class="picturebox2">
+        <swiper autoplay="{{true}}" indicator-dots='{{true}}' indicator-color='#D9D9D9' indicator-active-color='#F8DA7F' interval="{{5000}}" circular duration="{{500}}" class="img">
+          <block wx:for="{{giftBanner}}" wx:key="index" wx:for-item="gifban">
+            <swiper-item class="img">
+              <image style="border-radius: 10rpx;" src="{{gifban.image}}" mode="aspectFill"></image>
+            </swiper-item>
+          </block>
+        </swiper>
+      </view>
 
-            <view class="wang-cardbox">
-                <block wx:for="{{4}}">
-                    <view class="wang-card" bindtap="gourl2">
-                        <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/1ni1pl050800435.png"></image>
-                        <view class="wang-catex">粉黛胖挑主人杯(无礼盒)·手做</view>
-                        <view class="wang-numbox">
-                            <view class="wang-num">
-                                <view class="wang-num1">¥</view>
-                                <view class="wang-num2">19900</view>
-                            </view>
-                            <view class="wang-submit">购买</view>
-                        </view>
-                    </view>
-                </block>
+      <view class="wang-cardbox">
+        <block wx:for="{{gift}}" wx:key="index">
+          <view class="wang-card" data-url="/nova-tourism/pages/collect/collect-detail/index?gid={{item.objectId}}" bindtap="tourl">
+            <image src="{{item.image||'https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg'}}" mode="aspectFill"></image>
+            <view class="wang-catex">{{item.name}}</view>
+            <view class="wang-numbox">
+              <view class="wang-num">
+                <view class="wang-num1">¥</view>
+                <view class="wang-num2">{{item.price||0}}</view>
+              </view>
+              <view class="wang-submit">购买</view>
             </view>
+          </view>
+        </block>
+      </view>
 
-            <view class="more">
-                <view class="more-tex">查看更多 ></view>
-            </view>
+      <view class="more">
+        <view class="more-tex">查看更多 ></view>
+      </view>
 
-            <view class="wangbox">
-                <view class="wang">妆造旅拍</view>
-            </view>
+      <view class="wangbox">
+        <view class="wang">妆造旅拍</view>
+      </view>
 
 
-        </view>
     </view>
-    <view wx:if="{{currentTab == 1}}">
-        <!-- 卡片 -->
-        <view class="Legendary-Information" wx:if="{{storeList.length!=0}}">
-            <block wx:for="{{storeList}}" wx:if="{{item.isCollect&&item.homestayStore.isShow}}">
-                <view class="cardbox">
-                    <image class="pic" src="{{item.homestayStore.cover}}" data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl"></image>
-                    <view class="textobx">
-                        <view class="title" data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                            <view class="til">{{item.homestayStore.storeName}}</view>
-                            <image class="collect" wx:if="{{!item.isCollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/2gcp1e030048570.png?imageView2/1/w/200/h/200"></image>
-                            <image class="collect" wx:if="{{item.isCollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/8mp9uj030058190.png?imageView2/1/w/200/h/200"></image>
-                        </view>
+  </view>
+  <view wx:if="{{currentTab == 1}}">
+    <!-- 卡片 -->
+    <view class="Legendary-Information" wx:if="{{storeList.length!=0}}">
+      <block wx:for="{{storeList}}" wx:if="{{item.isCollect&&item.homestayStore.isShow}}">
+        <view class="cardbox">
+          <image class="pic" src="{{item.homestayStore.cover}}" data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl"></image>
+          <view class="textobx">
+            <view class="title" data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
+              <view class="til">{{item.homestayStore.storeName}}</view>
+              <image class="collect" wx:if="{{!item.isCollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/2gcp1e030048570.png?imageView2/1/w/200/h/200"></image>
+              <image class="collect" wx:if="{{item.isCollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/8mp9uj030058190.png?imageView2/1/w/200/h/200"></image>
+            </view>
 
-                        <view class="miaosu"  data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                            {{item.homestayStore.desc}}
-                        </view>
+            <view class="miaosu" data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
+              {{item.homestayStore.desc}}
+            </view>
 
-                        <view class="bottom">
-                            <view class="qian" data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                                ¥
-                                <view class="numbox">
-                                    {{item.homestayStore.perCapita}}
-                                </view>
-                            </view>
-                            <view class="soucang" wx:if="{{!item.isCollect}}" data-id="{{item.homestayStore.objectId}}" bindtap="submit">收藏</view>
-                            <view class="soucang" wx:if="{{item.isCollect}}" data-id="{{item.homestayStore.objectId}}" bindtap="cancle">取消</view>
-                        </view>
-                    </view>
+            <view class="bottom">
+              <view class="qian" data-id="{{item.homestayStore.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
+                ¥
+                <view class="numbox">
+                  {{item.homestayStore.perCapita}}
                 </view>
-            </block>
+              </view>
+              <view class="soucang" wx:if="{{!item.isCollect}}" data-id="{{item.homestayStore.objectId}}" bindtap="submit">收藏</view>
+              <view class="soucang" wx:if="{{item.isCollect}}" data-id="{{item.homestayStore.objectId}}" bindtap="cancle">取消</view>
+            </view>
+          </view>
         </view>
-        <van-empty wx:if="{{storeList.length==0}}" image="network" description="暂无收藏" />
+      </block>
     </view>
+    <van-empty wx:if="{{storeList.length==0}}" image="network" description="暂无收藏" />
+  </view>
 
-</view>
+</view>
+<view style="height: 200rpx;"></view>

+ 234 - 350
nova-tourism/components/homestay/index.js

@@ -1,365 +1,249 @@
 let Parse = getApp().Parse;
 const company = getApp().globalData.company
+const uid = Parse.User.current()?.id
+
 const {
-    getStores
+  getStores
 } = require(".././../service/request")
+let sev = require('../../service/request')
+const dateF = require('../../../utils/date')
 Component({
-    /**
-     * 组件的属性列表
-     */
-    properties: {},
+  /**
+   * 组件的属性列表
+   */
+  properties: {},
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    statusBarHeight: 0,
+    screenHeight: 0,
+    customHeight: 0,
+    bottomNavHeight: 0,
+    contentHeight: 0,
+    topheight: 0,
+
+
+
+    date_start: '',
+    date_end: '',
+    date_start1: '',
+    date_end1: '',
+    istoday: true,
+    daysBetween: 1,
+    show: false,
+    //店铺数据
+    storeList: [],
+    oddList: [], //单数列-两列布局用到
+    evenList: [], //双数列-两列布局用到
+    //价格
+    price: 211,
+
+    value: '', //搜索
+    valueTimeout: null, //搜索框计时器
+    start: '',
+    end: '',
+
+    //触底加载
+    loadedItems: 0,
+    pageSize: 5,
+    noMoreItems: false,
+    specDateMap: {}, //今日-明日 日期对应
+    showRoom: [], //首页推荐店铺
+  },
+  lifetimes: {
+    detached: function () {},
+    attached: async function () {
+      const systemInfo = wx.getSystemInfoSync();
+      const statusBarHeight = systemInfo.statusBarHeight || 0;
+      const screenHeight = systemInfo.screenHeight || 0;
+      const custom = wx.getMenuButtonBoundingClientRect();
+      const customHeight = custom.height + 10 + 2 || 0;
+      const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
+
+      const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+      const topheight = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth
+      this.setData({
+        statusBarHeight,
+        screenHeight,
+        customHeight,
+        bottomNavHeight,
+        contentHeight,
+        topheight
+      });
+      this.getcurrentdate();
+      this.getShopStore()
+      this.getShowRoom()
+    },
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    /** 初始日期-今日明日*/
+    getcurrentdate() {
+      const today = new Date();
+      const tomorrow = new Date();
+      tomorrow.setDate(today.getDate() + 1);
+      let date_start = this.formatDate(today)
+      let date_end = this.formatDate(tomorrow)
+      let specDateMap = {}
+      specDateMap[date_start] = '今天'
+      specDateMap[date_end] = '明天'
+      this.setData({
+        date_start,
+        date_end,
+        specDateMap,
+        start: today,
+        end: tomorrow
+      });
+    },
 
-    /**
-     * 组件的初始数据
-     */
-    data: {
-        statusBarHeight: 0,
-        screenHeight: 0,
-        customHeight: 0,
-        bottomNavHeight: 0,
-        contentHeight: 0,
-        topheight:0,
+    /**日历-开*/
+    onDisplay() {
+      this.setData({
+        show: true
+      });
+    },
+    /**日历-关*/
+    onClose() {
+      this.setData({
+        show: false
+      });
+    },
 
-        date_start: '',
-        date_end: '',
-        date_start1: '',
-        date_end1: '',
-        istoday: true,
-        daysBetween: 1,
+    /** 选好日期点击完成后*/
+    async onConfirm(event) {
+      const [start, end] = event.detail;
+      const daysBetween = sev.getDays(start, end); // 计算天数差
+      this.setData({
         show: false,
-        //店铺数据
-        storeList: [],
-        //价格
-        price: 211,
-        //搜索
-        value: '',
-        start: '',
-        end: '',
-
-        //触底加载
-        loadedItems: 0,
-        pageSize: 5,
-        noMoreItems: false,
-        scrollTop:0
+        start,
+        end,
+        date_start: `${this.formatDate(start)}`,
+        date_end: `${this.formatDate(end)}`,
+        daysBetween
+      });
     },
-    lifetimes: {
-        detached: function () {},
-        attached: async function () {
-            const systemInfo = wx.getSystemInfoSync();
-            const statusBarHeight = systemInfo.statusBarHeight || 0;
-            const screenHeight = systemInfo.screenHeight || 0;
-            const custom = wx.getMenuButtonBoundingClientRect();
-            const customHeight = custom.height + 10 + 2 || 0;
-            const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
-            const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
-            const topheight = (statusBarHeight + customHeight )* 750 / systemInfo.windowWidth
-            this.setData({
-                statusBarHeight,
-                screenHeight,
-                customHeight,
-                bottomNavHeight,
-                contentHeight,
-                topheight
-            });
-            console.log(topheight);
-            this.getcurrentdate();
-            this.gethomestar()
-        },
+    /**获取店铺 */
+    async getShopStore() {
+      let {
+        value,
+        storeList,
+        oddList,
+        evenList
+      } = this.data
+      let d = await sev.getStores({
+        val: value || '',
+        uid: uid,
+        skip: storeList?.length || 0,
+        limit: 8
+      })
+      let odd = d?.filter((item, index) => index % 2 != 0) || []
+      let even = d?.filter((item, index) => index % 2 == 0) || []
+      oddList = [...oddList, ...odd]
+      evenList = [...evenList, ...even]
+      storeList = [...(evenList || []), ...(oddList || [])]
+      console.log(storeList)
+      this.setData({
+        storeList,
+        oddList,
+        evenList
+      })
+    },
+    /**获取首页推荐 */
+    async getShowRoom() {
+      let d = await sev.getStores({
+        uid: uid,
+        skip: 0,
+        limit: 3,
+        isShow: true
+      })
+      this.setData({
+        showRoom: d || []
+      })
+    },
+    /**关键字搜索 */
+    changeValue() {
+      let {
+        valueTimeout
+      } = this.data
+      clearTimeout(valueTimeout)
+      let that = this
+      valueTimeout = setTimeout(() => {
+        that.setData({
+          storeList: [],
+          oddList: [],
+          evenList: []
+        })
+        that.getShopStore()
+      }, 2000);
+      this.setData({
+        valueTimeout
+      })
     },
-    /**
-     * 组件的方法列表
-     */
-    methods: {
-        //获取今日明日日期
-        getcurrentdate() {
-            const today = new Date();
-            const tomorrow = new Date();
-            tomorrow.setDate(today.getDate() + 1);
-
-            this.setData({
-                date_start: this.formatDate(today),
-                date_end: this.formatDate(tomorrow),
-                date_start1: this.formatDate(today),
-                date_end1: this.formatDate(tomorrow),
-                start: today,
-                end: tomorrow
-            });
-            console.log(this.data.start, this.data.end);
-        },
-        // 计算两个日期之间的天数
-        calculateDaysBetween(startDate, endDate) {
-            const start = new Date(startDate);
-            const end = new Date(endDate);
-            const timeDifference = end - start; // 计算时间差(毫秒)
-            const daysDifference = timeDifference / (1000 * 3600 * 24); // 转换为天数
-            return daysDifference; // 返回天数差
-        },
-        //开日历
-        onDisplay() {
-            this.setData({
-                show: true
-            });
-        },
-        //关日历
-        onClose() {
-            this.setData({
-                show: false
-            });
-        },
-        //转换日期
-        formatDate(date) {
-            date = new Date(date);
-            return `${date.getMonth() + 1}月${date.getDate()}日`;
-        },
-        //选好日期点击完成后
-        async onConfirm(event) {
-            const [start, end] = event.detail;
-            const daysBetween = this.calculateDaysBetween(start, end); // 计算天数差
-            this.setData({
-                show: false,
-                start,
-                end,
-                date_start: `${this.formatDate(start)} `,
-                date_end: `${this.formatDate(end)}`,
-                daysBetween
-            });
-            if (this.data.date_start.trim() == this.data.date_start1.trim() && this.data.date_end.trim() == this.data.date_end1.trim()) {
-                this.setData({
-                    istoday: true
-                })
-                console.log(this.data.istoday);
-            } else {
-                this.setData({
-                    istoday: false
-                })
-                console.log(this.data.istoday);
-            }
-            console.log(`入住日期: ${this.data.date_start}, 离店日期: ${this.data.date_end}, 天数差: ${daysBetween}天`);
-        },
-        gourl(e) {
-            const url = e.currentTarget.dataset.url;
-            const id = e.currentTarget.dataset.id;
-
-            // 构造要传递的信息
-            const info = {
-                objectId: id,
-                date_start: this.data.date_start,
-                date_end: this.data.date_end,
-                daysBetween: this.data.daysBetween,
-                istoday: this.data.istoday,
-                start: this.data.start,
-                end: this.data.end
-            };
-
-            // 将信息转为查询字符串
-            const queryString = Object.keys(info)
-                .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(info[key])}`)
-                .join('&');
-
-            // 使用查询字符串跳转
-            wx.navigateTo({
-                url: `${url}?${queryString}`,
-            });
-        },
-        //获取店铺消息
-        async gethomestar() {
-            let _data = await getStores({
-                val: this.data.value,
-                uid: Parse.User.current().id,
-                skip: this.data.loadedItems,
-                limit: this.data.pageSize
-            });
-            // let ShopStore = new Parse.Query('ShopStore');
-            // ShopStore.equalTo('company', company);
-            // ShopStore.equalTo('type', "stay");
-            // ShopStore.equalTo('isShow', true);
-            // ShopStore.notEqualTo('isDeleted', "true");
-            // ShopStore.limit(this.data.pageSize);
-            // ShopStore.skip(this.data.loadedItems);
-            // let store = await ShopStore.find();
-
-            // let storeListPromises = store.map(async item => {
-            //     let storeItem = item.toJSON();
-            //     // 为每一项添加价格属性
-            //     storeItem.price = storeItem.perCapita * this.data.daysBetween;
-            //     storeItem.iscollect = await this.iscollect(storeItem.objectId); // 等待iscollect的结果
-            //     return storeItem;
-            // });
-
-            // let storeList = await Promise.all(storeListPromises); // 等待所有的Promise完成
-
-            // 合并新加载的商店和已存在的商店列表
-            // let updatedStoreList = this.data.storeList.concat(storeList);
-
-            if (_data.length < this.data.pageSize) {
-                this.setData({
-                    noMoreItems: true
-                });
-            } else {
-                this.setData({
-                    noMoreItems: false
-                });
-            }
-
-            this.setData({
-                storeList: this.data.storeList.concat(_data),
-                loadedItems: this.data.loadedItems + _data.length,
-            });
-
-            console.log('店铺数据=====>', this.data.storeList);
-        },
-        //点击收藏
-        async submit(e) {
-            const object = e.currentTarget.dataset.id
-            console.log(object);
-            const currentUser = Parse.User.current();
-            let Collect = new Parse.Query('DramaShopCollect');
-            Collect.equalTo('company', company);
-            Collect.equalTo('user', currentUser.id);
-            Collect.equalTo('homestayStore', object);
-            Collect.notEqualTo('isDeleted', "true");
-            let collect = await Collect.first();
-
-            await this.changeiscollect(object)
-
-            if (collect) {
-                collect.set('isCollect', true)
-                try {
-                    let saveDate = await collect.save();
-                    console.log(saveDate);
-                    console.log("收藏成功1");
-                } catch (error) {
-                    console.error("保存数据时出现错误:", error);
-                }
-            } else {
-                //user
-                const currentUser = Parse.User.current();
-                let userquery2 = new Parse.Query('_User');
-                userquery2.equalTo('company', company);
-                userquery2.equalTo('objectId', currentUser.id);
-                userquery2.notEqualTo('isDeleted', true)
-                let user2 = await userquery2.first();
-                //店铺
-                let Collect3 = new Parse.Query('ShopStore');
-                Collect3.equalTo('company', company);
-                Collect3.equalTo('objectId', object);
-                Collect3.notEqualTo('isDeleted', "true");
-                let collect3 = await Collect3.first();
-
-                let companyPointer = Parse.Object.extend('Company').createWithoutData(company);
-                let Comment = new Parse.Object('DramaShopCollect');
-                Comment.set('company', companyPointer);
-                Comment.set('homestayStore', collect3.toPointer());
-                Comment.set('user', user2.toPointer());
-                Comment.set('isCollect', true);
-                try {
-                    let saveDate2 = await Comment.save();
-                    console.log(saveDate2);
-                    console.log("收藏成功");
-                } catch (error) {
-                    console.error("保存数据时出现错误:", error);
-                }
-            }
-
-        },
-        // 点击收藏后把storeList中对应的isCollect变成true
-        changeiscollect(objectId) {
-            // 创建一个新的 storeList 数组,以确保视图更新
-            const updatedStoreList = this.data.storeList.map(item => {
-                if (item.objectId === objectId) {
-                    return {
-                        ...item,
-                        iscollect: !item.iscollect // 切换 iscollect 的值
-                    };
-                }
-                return item; // 返回未修改的项
-            });
 
-            // 更新 storeList
-            this.setData({
-                storeList: updatedStoreList
-            });
 
-            console.log('修改成功', objectId);
-        },
-        //点击取消
-        async cancle(e) {
-            const object = e.currentTarget.dataset.id
-            const currentUser = Parse.User.current();
-            let Collect = new Parse.Query('DramaShopCollect');
-            Collect.equalTo('company', company);
-            Collect.equalTo('user', currentUser.id);
-            Collect.equalTo('isCollect', true);
-            Collect.equalTo('homestayStore', object);
-            Collect.notEqualTo('isDeleted', "true");
-            let collect = await Collect.first();
+    toStore(e) {
+      let {store_id} = e.currentTarget.dataset
+      let {start,end}=this.data
+      let url = `/nova-tourism/pages/homestay/homestay-detail/index?store_id=${store_id}&start=${dateF.formatTime("YYYY-mm-dd", start)}&end=${dateF.formatTime("YYYY-mm-dd", end)}`
+      console.log(url)
+      wx.navigateTo({
+        url: url,
+      })
+    },
 
-            await this.changeiscollect(object)
-            if (collect) {
-                collect.set('isCollect', false)
-                try {
-                    let saveDate = await collect.save();
-                    console.log(saveDate);
-                    console.log("取消成功");
-                } catch (error) {
-                    console.error("保存数据时出现错误:", error);
-                }
-            }
-        },
+    /**收藏/取消收藏 */
+    async collect(e) {
+      let {
+        storeList
+      } = this.data
+      let index = e.currentTarget.dataset.index
+      let store = storeList[index]
+      let query = new Parse.Query('DramaShopCollect');
+      query.equalTo('company', company);
+      query.equalTo('user', uid);
+      query.equalTo('homestayStore', store?.objectId);
+      query.notEqualTo('isDeleted', "true");
+      let collect = await query.first();
+      if (!collect?.id) {
+        let DramaShopCollect = Parse.Object.extend('DramaShopCollect')
+        collect = new DramaShopCollect()
+        collect.set('company', {
+          __type: 'Pointer',
+          className: 'Company',
+          objectId: company
+        });
+        collect.set('homestayStore', {
+          __type: 'Pointer',
+          className: 'ShopStore',
+          objectId: store?.objectId
+        });
+        collect.set('user', {
+          __type: 'Pointer',
+          className: '_User',
+          objectId: uid
+        });
+        collect.set('isCollect', true);
+      }
+      collect.set('isCollect', !(store.iscollect || false))
+      await collect.save()
+      storeList[index].iscollect = !(storeList[index].iscollect || false)
+      this.setData({
+        storeList
+      })
+    },
+    /**搜索框距顶部距离 */
+    onScroll(event) {
+      this.setData({scrollTop: event.detail.scrollTop,})
+    },
 
-        //搜索功能
-        search(e) {
-            const value = e.detail.value;
-            console.log(this.data.value);
-            this.getRooms(value)
-        },
-        //清零后
-        change(e) {
-            const value = e.detail.value;
-            if (!value) {
-                console.log('运行');
-                this.clear()
-            }
-        },
-        clear() {
-            this.setData({
-                loadedItems: 0,
-                noMoreItems: false,
-                storeList: [],
-                value:''
-            })
-            this.gethomestar()
-        },
-        // 搜索函数
-        async getRooms(value) {
-            // 确保 value 不为空
-            if (!value) {
-                console.log('搜索值为空');
-                return; // 如果没有输入值,直接返回
-            }
-            this.setData({
-                loadedItems: 0,
-                noMoreItems: false,
-                storeList: []
-            })
-            this.gethomestar()
-        },
-        //触底加载
-        async loadMoreData() {
-            if (!this.data.noMoreItems) {
-                await this.gethomestar()
-            }
-        },
-        onScroll(event) {
-            wx.createSelectorQuery()
-              .select('#scroller')
-              .boundingClientRect((res) => {
-                this.setData({
-                  scrollTop: event.detail.scrollTop,
-                });
-              })
-              .exec();
-          },
-    }
+    /** 转换日期 MM月dd日*/
+    formatDate(date) {
+      date = new Date(date);
+      return `${date.getMonth() + 1}月${date.getDate()}日`;
+    },
+  }
 });

+ 122 - 90
nova-tourism/components/homestay/index.less

@@ -1,19 +1,21 @@
-
 /* nova-caipu/pages/new-app/index.wxss */
-.all{
+.all {
     width: 100vw;
     height: 100vh;
     color: #382E2E;
-    position:relative;
-    font-family: "Microsoft JhengHei", "PingFang SC", "Helvetica Neue", sans-serif; 
+    position: relative;
+    font-family: "Microsoft JhengHei", "PingFang SC", "Helvetica Neue", sans-serif;
     font-weight: 400;
-    .picturebox{
+
+    .picturebox {
         width: 100%;
         height: 442rpx;
-        .img{
+
+        .img {
             width: 100%;
             height: 442rpx;
-            image{
+
+            image {
                 width: 100%;
                 height: 100%;
 
@@ -21,14 +23,16 @@
         }
 
     }
-    .Inforbox{
+
+    .Inforbox {
         width: 100%;
         display: flex;
         justify-content: center;
         align-items: center;
         margin-top: -62rpx;
         z-index: 100;
-        .infobox{
+
+        .infobox {
             width: 686rpx;
             height: 222rpx;
             background-color: white;
@@ -37,44 +41,50 @@
             flex-direction: column;
             align-items: center;
             border-radius: 20rpx;
-           
+
             z-index: 100;
             border: solid #e5e5e5 2rpx;
-            box-shadow: 0 2rpx 4rpx rgba(0,0,0,0.2);
-            .seach{
+            box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
+
+            .seach {
                 width: 80%;
                 height: 96rpx;
                 background-color: white;
                 display: flex;
                 justify-content: center;
                 align-items: center;
-    
-                .input{
+
+                .input {
                     width: 358rpx;
                     height: 60rpx;
                     margin-left: 31rpx;
+                    font-size: 26rpx;
                 }
             }
-            .datebox{
+
+            .datebox {
                 width: 90%;
                 height: 132rpx;
                 display: flex;
                 align-items: center;
                 font-size: 32rpx;
                 border-top: solid #e5e5e5 2rpx;
-                .today{
+
+                .today {
                     font-size: 28rpx;
                     color: #707070;
                     margin-left: 10rpx;
                     display: flex;
                     justify-content: flex-end;
                 }
-                .start{
+
+                .start {
                     display: flex;
                     justify-content: flex-end;
                     color: #000000;
                 }
-                .day{
+
+                .day {
                     display: flex;
                     justify-content: center;
                     align-items: center;
@@ -85,129 +95,149 @@
                     font-size: 22rpx;
                     color: black;
                 }
-                .end{
+
+                .end {
                     margin-left: auto;
                     color: #000000;
                 }
             }
-            
+
         }
     }
 
 
-    .Legendary-Information{
-        width: 100%;
-        background-color: white;
-        overflow-y: hidden;
-        padding-left: 3%;
-        padding-right: 3%;
-        padding-bottom: 40rpx;
-        display: flex;
-        justify-content: center;
-        flex-wrap: wrap; /* 允许换行 */
-        gap: 10rpx; /* 设置间距 */
-        margin-top: 12rpx;
-        .container {
-            display: flex; /* 使用 Flexbox 布局 */
-            flex-direction: column; /* 垂直排列 */
-            width: 346rpx; /* 计算宽度,考虑间距 */
-            margin-bottom: 20rpx; /* 设置底部间距 */
-            .picbox {
-                height: 274rpx;
-                width: 330rpx; /* 根据需要调整宽度 */
-                background-image: url('https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/01atf5032703958.png?imageView2/1/w/200/h/200');
-                margin-bottom: 18rpx;
-                break-inside: avoid;
-                float: left;
-                background-size: cover; /* 使背景图按比例缩放,覆盖整个盒子 */
-                background-position: center; /* 背景图位置居中 */
-                .pic-2{
-                    width: 100%;
-                    height: 56rpx;
+    .Legendary-Information {
+        width: 686rpx;
+        margin: auto;
+        margin-top: 20rpx;
+        column-count: 2;
+        .picbox {
+            margin-bottom: 20rpx;
+            float: left;
+            height: 274rpx;
+            width: 330rpx;
+            background-image: url('https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/01atf5032703958.png');
+            break-inside: avoid;
+            float: left;
+            background-size: cover;
+            /* 使背景图按比例缩放,覆盖整个盒子 */
+            background-position: center;
+
+            .pic {
+                width: 100%;
+                height: 66rpx;
+                padding-left: 126rpx;
+                padding-right: 10rpx;
+                margin-top: 6rpx;
+
+                .pic-1tex {
+                    font-size: 26rpx;
+                    overflow: hidden;
+                    text-overflow: ellipsis;
+                    white-space: nowrap;
                 }
-                .pic-1{
-                    width: 100%;
-                    height: 66rpx;
-                    padding-left: 126rpx;
-                    margin-top: 6rpx;
-                    .pic-1tex{
-                        font-size: 28rpx;
-                    }
-                    .pic-1tex2{
-                        font-size: 14rpx;
-                    }
+
+                .pic-1tex2 {
+                    font-size: 14rpx;
                 }
             }
+        }
+
+        .container {
+            overflow: auto;
+            float: left;
+            height: 400rpx;
+            flex-shrink: 0;
+            width: 330rpx;
+            display: flex;
+            flex-direction: column;
+            margin-bottom: 20rpx;
+
             .cardbox {
-                width:100%; /* 计算宽度,考虑间距 */
-                background-color: #F9F9F9;
-                box-sizing: border-box; /* 确保内边距和边框包含在宽度内 */
-                margin-bottom: 10rpx; /* 设置卡片底部间距 */
-                // width: 49%; /* 确保卡片宽度为100% */
+                width: 100%;
+                background-color:whitesmoke;
+                margin-bottom: 10rpx;
                 height: 398rpx;
-                background-color: #F9F9F9;
                 display: flex;
                 align-items: center;
                 flex-direction: column;
-                // float: left;
-                .pic{
-                    width: 336rpx;
+
+                .pic {
+                    width: 330rpx;
                     height: 198rpx;
                     border-radius: 10rpx;
                 }
-                .textobx{
+
+                .textobx {
                     width: 302rpx;
                     height: 152rpx;
                     margin-bottom: 20rpx;
-                    // padding-top: 6rpx;
-                    .title{
+                    .title {
                         width: 100%;
                         height: 50rpx;
                         margin-top: 4rpx;
                         display: flex;
                         align-items: center;
-                        .til{
+
+                        .til {
                             font-size: 28rpx;
                             font-weight: 700;
                             color: #000000;
+
+                            overflow: hidden;
+                            text-overflow: ellipsis;
+                            white-space: nowrap;
+
                         }
-                        .collect{
+
+                        .collect {
                             width: 46rpx;
                             height: 46rpx;
                             margin-left: auto;
                         }
                     }
-                    .miaosu{
+
+                    .miaosu {
                         width: 284rpx;
-                        height: 70rpx; /* 设置固定高度 */
+                        height: 70rpx;
+                        /* 设置固定高度 */
                         font-size: 26rpx;
                         font-weight: 400;
-                        overflow: hidden; /* 隐藏超出部分 */
-                        display: -webkit-box; /* 使用弹性盒子布局 */
-                        -webkit-box-orient: vertical; /* 垂直排列 */
-                        -webkit-line-clamp: 2; /* 限制显示的行数,这里设置为3行 */
-                        text-overflow: ellipsis; /* 超出部分显示省略号 */
+                        overflow: hidden;
+                        /* 隐藏超出部分 */
+                        display: -webkit-box;
+                        /* 使用弹性盒子布局 */
+                        -webkit-box-orient: vertical;
+                        /* 垂直排列 */
+                        -webkit-line-clamp: 2;
+                        /* 限制显示的行数,这里设置为3行 */
+                        text-overflow: ellipsis;
+                        /* 超出部分显示省略号 */
                     }
-                    .miaosu2{
+
+                    .miaosu2 {
                         width: 100%;
                         height: 80rpx;
                     }
-                    .bottom{
+
+                    .bottom {
                         width: 100%;
                         height: 46rpx;
                         margin-top: 4rpx;
                         display: flex;
-                        
-                        .qian{
+
+                        .qian {
                             font-size: 28;
                             font-weight: 400;
                             color: #C5262C;
                             display: flex;
-                            .numbox{
+
+                            .numbox {
                                 margin-left: 6rpx;
                             }
                         }
-                        .soucang{
+
+                        .soucang {
                             width: 118rpx;
                             height: 46rpx;
                             font-size: 24rpx;
@@ -227,16 +257,18 @@
 
 
     }
-    .bottom2{
+
+    .bottom2 {
         width: 100%;
         font-size: 26rpx;
         margin-bottom: 40rpx;
         display: flex;
         align-items: center;
         justify-content: center;
-        
+
     }
-     .Legendary-Information2{
+
+    .Legendary-Information2 {
         margin-top: 204rpx;
         width: 100%;
         background-color: white;

+ 65 - 103
nova-tourism/components/homestay/index.wxml

@@ -1,110 +1,72 @@
 <nav type="title" background-color="#ffffff" frontColor="#000000" title="云上望仙" />
-<scroll-view class="all"  id="scroller" bindscroll="onScroll" scroll-y="true" bindscrolltolower="loadMoreData" style="height: {{contentHeight}}rpx;">
-    <view class="picturebox">
-        <view class="img">
-            <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/jc17lo114657420.jpg"></image>
-        </view>
+<scroll-view bindscroll="onScroll" class="all" id="scroller" scroll-y="true" bindscrolltolower="getShopStore" style="height: {{contentHeight}}rpx;">
+  <view class="picturebox">
+    <view class="img">
+      <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/jc17lo114657420.jpg"></image>
     </view>
+  </view>
 
-    <!-- 日期 -->
-    <view class="Inforbox" style="{{scrollTop > 162 ? 'position: fixed; top: ' + topheight + 'rpx;margin-top: 0rpx;' : ''}}">
-        <view class="infobox" >
-            <view class="seach">
-                <!-- <van-search input-class='a' shape="round" model:value="{{ value }}" placeholder="请输入地点/门店名称/关键词" bind:search="search" bind:change="change" bind:clear='clear' /> -->
-                <van-icon name="search" size='40rpx' />
-                <input class="input" bindinput='change' bindconfirm='search' model:value='{{value}}' type="text" placeholder="搜索地点/门店名称/关键词" placeholder-style="font-size: 26rpx;" />
-            </view>
-            <view class="datebox" bindtap="onDisplay">
-                <view class="start">{{date_start}}</view>
-                <view class="today" wx:if="{{istoday}}">今天</view>
-                <view class="day">共{{daysBetween}}晚</view>
-                <view class="end">{{date_end}}</view>
-                <view class="today" wx:if="{{istoday}}">明天</view>
-            </view>
-            <van-calendar show="{{ show }}" show-confirm="{{ true }}" confirm-text="完成" confirm-disabled-text='完成' type="range" bind:close="onClose" bind:confirm="onConfirm" color='#46a9a4' position='top' />
-        </view>
+  <!-- 日期 -->
+  <view class="Inforbox" style="{{scrollTop > 162 ? 'position: fixed; top: ' + topheight + 'rpx;margin-top: 0rpx;' : ''}}">
+    <view class="infobox">
+      <view class="seach">
+        <van-icon name="search" size='40rpx' />
+        <input class="input" bindinput='changeValue' model:value='{{value}}' type="text" placeholder="搜索 地点/门店名称 关键词" placeholder-style="font-size: 26rpx;" />
+      </view>
+      <view class="datebox" bindtap="onDisplay">
+        <view class="start">{{date_start}}</view>
+        <view class="today">{{specDateMap[date_start]}}</view>
+        <view class="day">共{{daysBetween}}晚</view>
+        <view class="end">{{date_end}}</view>
+        <view class="today">{{specDateMap[date_end]}}</view>
+      </view>
+      <van-calendar show="{{ show }}" show-confirm="{{ true }}" confirm-text="完成" confirm-disabled-text='完成' type="range" bind:close="onClose" bind:confirm="onConfirm" color='#46a9a4' position='top' />
     </view>
-    <!-- 卡片 -->
-    <view class="Legendary-Information" wx:if="{{storeList.length!=0}}">
-        <block>
-            <view class="container">
-                <block wx:for="{{storeList}}" wx:if="{{(index+1)%2==0}}">
-                    <block wx:if="{{index == 3}}">
-                        <view class="picbox">
-                            <view class="pic-2"></view>
-
-                                <view class="pic-1">
-                                    <view class="pic-1tex">望仙乡</view>
-                                    <view class="pic-1tex2">50%用户选择</view>
-                                </view>
-                                <view class="pic-1">
-                                    <view class="pic-1tex">方村</view>
-                                    <view class="pic-1tex2">50%用户选择</view>
-                                </view>
-                                <!-- <view class="pic-1">
-                                    <view class="pic-1tex">方村</view>
-                                    <view class="pic-1tex2">35%用户选择</view>
-                                </view> -->
-    
-                        </view>
-                    </block>
-                    <view class="cardbox">
-                        <image class="pic" src="{{item.cover}}" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl"></image>
-                        <view class="textobx">
-                            <view class="title" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                                <view class="til">{{item.storeName}}</view>
-                                <image class="collect" wx:if="{{!item.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/2gcp1e030048570.png?imageView2/1/w/200/h/200"></image>
-                                <image class="collect" wx:if="{{item.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/8mp9uj030058190.png?imageView2/1/w/200/h/200"></image>
-                            </view>
-
-                            <view class="miaosu" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                                {{item.desc}}
-                            </view>
-                            <view class="bottom">
-                                <view class="qian" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                                    ¥<view class="numbox">{{item.minPrice*daysBetween}}</view>
-                                </view>
-                                <view class="soucang" wx:if="{{!item.iscollect}}" data-id="{{item.objectId}}" bindtap="submit">收藏</view>
-                                <view class="soucang" wx:if="{{item.iscollect}}" data-id="{{item.objectId}}" bindtap="cancle">取消</view>
-                            </view>
-                        </view>
-                    </view>
-                </block>
-
+  </view>
+  <!-- 卡片 -->
+  <view class="Legendary-Information" wx:if="{{storeList.length!=0}}">
+    <block wx:for="{{storeList}}" wx:key="item">
+      <block wx:if="{{index==1&&showRoom.length==3}}">
+        <view class="picbox">
+          <view style="margin-top: 60rpx;">
+            <block wx:for="{{showRoom}}" wx:for-item="showItem" wx:key="showItem" >
+              <view class="pic" data-store_id="{{showItem.objectId}}" bindtap="toStore">
+                <view class="pic-1tex">{{showItem.storeName}}</view>
+                <view class="pic-1tex2">50%用户选择</view>
+              </view>
+            </block>
+          </view>
+        </view>
+      </block>
+      <view class="container">
+        <view class="cardbox">
+          <image class="pic" mode="aspectFill" src="{{item.cover}}" data-store_id="{{item.objectId}}" bindtap="toStore"></image>
+          <view class="textobx">
+            <view class="title" data-store_id="{{item.objectId}}" bindtap="toStore">
+              <view class="til">{{item.storeName}}</view>
+              <image class="collect" wx:if="{{!item.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/2gcp1e030048570.png?imageView2/1/w/200/h/200"></image>
+              <image class="collect" wx:if="{{item.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/8mp9uj030058190.png?imageView2/1/w/200/h/200"></image>
             </view>
-            <view class="container">
-                <block wx:for="{{storeList}}" wx:if="{{(index+1)%2==1}}">
-                    <view class="cardbox">
-                        <image class="pic" src="{{item.cover}}" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl"></image>
-                        <view class="textobx">
-                            <view class="title" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                                <view class="til">{{item.storeName}}</view>
-                                <image class="collect" wx:if="{{!item.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/2gcp1e030048570.png?imageView2/1/w/200/h/200"></image>
-                                <image class="collect" wx:if="{{item.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/8mp9uj030058190.png?imageView2/1/w/200/h/200"></image>
-                            </view>
-
-                            <view class="miaosu" wx:if="{{item.desc}}" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                                {{item.desc}}
-                            </view>
-                            <view class="bottom">
-                                <view class="qian" data-id="{{item.objectId}}" data-url="../../pages/homestay/homestay-detail/index" bindtap="gourl">
-                                    ¥<view class="numbox">{{item.minPrice*daysBetween}}</view>
-                                </view>
-                                <view class="soucang" wx:if="{{!item.iscollect}}" data-id="{{item.objectId}}" bindtap="submit">收藏</view>
-                                <view class="soucang" wx:if="{{item.iscollect}}" data-id="{{item.objectId}}" bindtap="cancle">取消</view>
-                            </view>
-                        </view>
-                    </view>
-                </block>
-
+            <view class="miaosu" wx:if="{{item.desc}}" data-store_id="{{item.objectId}}" bindtap="toStore">
+              {{item.desc}}
             </view>
-        </block>
-    </view>
-    <view class="bottom2" wx:if="{{noMoreItems}}">没有更多民宿了...</view>
-    <!-- 无搜索内容 -->
-    <view class="Legendary-Information2" wx:if="{{storeList.length==0}}">
-        <van-empty wx:if="{{storeList.length==0}}" image="network" description="暂无该店铺" />
-    </view>
-
-
+            <view class="bottom">
+              <view class="qian" data-store_id="{{item.objectId}}" bindtap="toStore">
+                ¥<view class="numbox">{{item.minPrice*daysBetween||0}}</view>
+              </view>
+              <view class="soucang" data-index="{{index}}" bindtap="collect">{{item.iscollect?'取消':'收藏'}}</view>
+            </view>
+          </view>
+        </view>
+      </view>
+    </block>
+    <block wx:if="{{storeList.length%2!=0}}">
+      <view class="container" style="background:url('https://file-cloud.fmode.cn/EbxZUK5lBI/20250313/9l2529104740741.jpg') no-repeat;background-size:100% 100%;"></view>
+    </block>
+  </view>
+  <view class="bottom2" wx:if="{{noMoreItems}}">没有更多民宿了...</view>
+  <!-- 无搜索内容 -->
+  <view class="Legendary-Information2" wx:if="{{storeList.length==0}}">
+    <van-empty wx:if="{{storeList.length==0}}" image="network" description="暂无该店铺" />
+  </view>
 </scroll-view>

文件差异内容过多而无法显示
+ 0 - 0
nova-tourism/components/homestay/index.wxss


+ 3 - 1
nova-tourism/components/my/index.js

@@ -19,6 +19,7 @@ Component({
         bottomNavHeight: 0,
         contentHeight: 0,
 
+        uid:null,
         User1List:[],
     },
     lifetimes: {
@@ -37,7 +38,8 @@ Component({
                 screenHeight,
                 customHeight,
                 bottomNavHeight,
-                contentHeight
+                contentHeight,
+                uid:Parse.User.current()?.id
             });
             this.getname()
         },

+ 1 - 1
nova-tourism/components/my/index.wxml

@@ -45,7 +45,7 @@
 
 
     </view>
-    <view class="tuiguangbox">
+    <view class="tuiguangbox" data-url="/common-page/pages/sharing/index?path=yswx&uid={{uid}}" bindtap="gourl">
         <view class="tuibox">
             <view class="tui-title">推广中心</view>
             <view class="tuiguang-tex">成为推广达人,获取佣金返利</view>

+ 314 - 83
nova-tourism/pages/collect/collect-detail/index.js

@@ -1,89 +1,320 @@
 // nova-tourism/pages/collect/collect-detail/index.js
+let Parse = getApp().Parse;
+const company = getApp().globalData.company
+const uid = Parse.User.current()?.id
+let sev = require('../../../service/request')
 Page({
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        statusBarHeight: 0,
-        screenHeight: 0,
-        customHeight: 0,
-        bottomNavHeight: 0,
-        contentHeight: 0,
-
-        imageUrls: ['https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg',
-        'https://c-ssl.dtstatic.com/uploads/blog/201409/27/20140927230814_4QfVC.thumb.1000_0.jpeg',
-        'https://ts1.cn.mm.bing.net/th/id/R-C.37f4077f8eaca918401b84b4ee23af7c?rik=7HYWC88a9q4sZw&riu=http%3a%2f%2fpic.616pic.com%2fphotoone%2f00%2f06%2f03%2f618e27ad7ce8e1124.jpg&ehk=jkc6iZWAg%2bAEjAk6%2br0VAAy1lfffqslT6n%2fMWl293Yc%3d&risl=&pid=ImgRaw&r=0'
-        ],
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
-        const systemInfo = wx.getSystemInfoSync();
-        const statusBarHeight = systemInfo.statusBarHeight || 0;
-        const screenHeight = systemInfo.screenHeight || 0;
-        const custom = wx.getMenuButtonBoundingClientRect();
-        const customHeight = custom.height + 10 + 2 || 0;
-        const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
-        const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
-        this.setData({
-            statusBarHeight,
-            screenHeight,
-            customHeight,
-            bottomNavHeight,
-            contentHeight
-        });
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    statusBarHeight: 0,
+    screenHeight: 0,
+    customHeight: 0,
+    bottomNavHeight: 0,
+    contentHeight: 0,
 
+    imageUrls: ['https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg',
+      'https://c-ssl.dtstatic.com/uploads/blog/201409/27/20140927230814_4QfVC.thumb.1000_0.jpeg',
+      'https://ts1.cn.mm.bing.net/th/id/R-C.37f4077f8eaca918401b84b4ee23af7c?rik=7HYWC88a9q4sZw&riu=http%3a%2f%2fpic.616pic.com%2fphotoone%2f00%2f06%2f03%2f618e27ad7ce8e1124.jpg&ehk=jkc6iZWAg%2bAEjAk6%2br0VAAy1lfffqslT6n%2fMWl293Yc%3d&risl=&pid=ImgRaw&r=0'
+    ],
+    gid: null, //商品id
+    good: null, //商品详情
+    spec: null, //商品规格
+    checkSpec: null, //选中的规格
+    totalPrice: 0, //订单总价
+    specBox: false, //规格弹框
+    address: null, //收货地址
+    tradeNo: null, //订单编号
+    order: null, //当前订单-parse
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    const systemInfo = wx.getSystemInfoSync();
+    const statusBarHeight = systemInfo.statusBarHeight || 0;
+    const screenHeight = systemInfo.screenHeight || 0;
+    const custom = wx.getMenuButtonBoundingClientRect();
+    const customHeight = custom.height + 10 + 2 || 0;
+    const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
+    const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+    this.setData({
+      statusBarHeight,
+      screenHeight,
+      customHeight,
+      bottomNavHeight,
+      contentHeight
+    });
+    this.setData({
+      gid: options?.gid
+    })
+    this.refersh()
+  },
+
+  async refersh() {
+    this.getGood()
+  },
+  /**获取商品 */
+  async getGood() {
+    let {
+      gid
+    } = this.data
+    let query = new Parse.Query('ShopGoods')
+    let d = await query.get(gid)
+    let good = d?.toJSON()
+    console.log(good)
+    let spec = good?.specMap?.specList.map(item => {
+      let price = good.specMap[item][0].price
+      let subName = price || good.price
+      let obj = {
+        name: item,
+        subname: `售价¥${subName}`,
+        color: 'gray',
+        price: subName
+      }
+      return obj
+    })
+    let checkSpec = {}
+    if (spec?.length) {
+      checkSpec = spec[0]
+      spec[0].color = 'red'
+    }
+    let totalPrice = checkSpec.price || good.price
+    this.setData({
+      good,
+      spec,
+      checkSpec,
+      totalPrice
+    })
+  },
+  /** 打开规格弹框*/
+  openSpec() {
+    let {spec} = this.data
+    console.log(spec,'‘hhh')
+    if(spec?.length<=0)return
+    this.setData({
+      specBox: true
+    })
+  },
+  /**关闭规格弹框 */
+  closeSpec() {
+    this.setData({
+      specBox: false
+    })
+  },
+  /**选择规格 */
+  getCheckSpec(e) {
+    let {
+      spec,
+      checkSpec,
+      totalPrice
+    } = this.data
+    checkSpec = e.detail
+    spec = spec.map(item => {
+      item.color = 'gray'
+      if (item.name == checkSpec.name) {
+        item.color = 'red'
+        totalPrice = item.price
+      }
+      return item
+    })
+    this.setData({
+      spec,
+      checkSpec,
+      totalPrice
+    })
+  },
+  /** 跳转*/
+  tourl(e) {
+    const url = e.currentTarget.dataset.url
+    wx.navigateTo({
+      url: `${url}` // 目标页面的路径
+    });
+  },
+  /** 判断是否可创建订单*/
+  judgeOrder() {
+    let {
+      address
+    } = this.data
+    if (!address?.objectId) {
+      wx.showToast({
+        title: '请确认收货地址',
+        icon: 'none',
+      });
+      return false
+    }
+    return true
+  },
+  /**创建订单 */
+  async submitOrder() {
+    let isPass = this.judgeOrder()
+    if (!isPass) return
+    let {
+      good,
+      totalPrice,
+      checkSpec,
+      address,
+      order,
+      tradeNo
+    } = this.data
+    let o = order
+    if (!order?.id) {
+      let now = new Date()
+      tradeNo = "C" +
+        String(now.getFullYear()) +
+        (now.getMonth() + 1) +
+        now.getDate() +
+        now.getHours() +
+        now.getMinutes() +
+        now.getSeconds() +
+        Math.random().toString().slice(-6);
+      let Order = Parse.Object.extend("Order");
+      o = new Order()
+      o.set("company", {
+        __type: 'Pointer',
+        className: 'Company',
+        objectId: company
+      })
+      o.set("user", {
+        __type: 'Pointer',
+        className: '_User',
+        objectId: uid
+      })
+      o.set("orderNum", tradeNo);
+      o.set('status', '100') //待支付
+      o.set('type', 'scenery')
+      o.set("targetObject", [{
+        "__type": "Pointer",
+        "className": "ShopGoods",
+        "objectId": good?.objectId
+      }])
+    }
+    o.set("totalPrice", totalPrice || 0);
+    o.set("address", {
+      __type: 'Pointer',
+      className: 'ShopAddress',
+      objectId: address?.objectId
+    });
+    o.set("info", {
+      name: address?.name,
+      mobile: address?.mobile,
+      address: address?.full_region + address?.address
+    });
+    let specMap = {}
+    specMap[good?.objectId] = {
+      count: 1,
+      price: good.price,
+      spec: checkSpec.name
     }
+    o.set("specMap", specMap);
+    try {
+      // order = await o.save()
+      this.setData({
+        tradeNo,
+        order:o,
+        showPay: true,
+      })
+      // wx.showToast({
+      //   title: '已创建订单',
+      //   icon: 'none'
+      // })
+    } catch (error) {
+      wx.showToast({
+        title: '出错了请检查后重试',
+        icon: 'error'
+      })
+    }
+  },
+  /**支付回调 */
+  async acceptResult(e) {
+    let {
+      order
+    } = this.data
+    let {
+      params
+    } = e.detail
+    if (params == 'ok') {
+      wx.showLoading({
+        title: '加载中',
+      })
+      order.set('status', '200')
+      order.set('payType', 'wx')
+      order.set('isPay', true)
+      try {
+        await order.save()
+        setTimeout(() => {
+          wx.hideLoading()
+          wx.redirectTo({
+            url: '/nova-tourism/pages/my/my-order/index?active=0',
+          })
+        }, 1000);
+      } catch (error) {
+        wx.showToast({
+          title: '保存订单出错,请联系客服核对订单',
+          icon: 'none'
+        })
+      }
+    } else {
+      wx.showToast({
+        title: '支付失败',
+        icon: 'none'
+      })
+    }
+  },
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  async onShow() {
+    let address = await sev.getAddress()
+    console.log(address)
+    this.setData({
+      address
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 3 - 1
nova-tourism/pages/collect/collect-detail/index.json

@@ -1,5 +1,7 @@
 {
   "usingComponents": {
-    "van-icon": "@vant/weapp/icon/index"
+    "van-icon": "@vant/weapp/icon/index",
+    "van-action-sheet": "@vant/weapp/action-sheet/index"
+
   }
 }

+ 10 - 1
nova-tourism/pages/collect/collect-detail/index.less

@@ -169,7 +169,6 @@
                     margin-bottom: 60rpx;
                     image{
                         width: 100%;
-                        height: 760rpx;
                     }
                 }
             }
@@ -203,6 +202,16 @@
                     display: flex;
                     justify-content: flex-end;
                 }
+                .qrBox{
+                    display: flex;
+                    justify-content: space-between;
+                    align-items: center;
+
+                    image{
+                        width: 150rpx;
+                        margin:40rpx 10rpx;
+                    }
+                }
             }
     
         }

+ 120 - 76
nova-tourism/pages/collect/collect-detail/index.wxml

@@ -1,84 +1,128 @@
 <!--nova-tourism/pages/collect/collect-detail/index.wxml-->
 <nav type="back" background-color="#ffffff" frontColor="#000000" title="商品详细" />
-<view class="bax" style="height: {{contentHeight}}rpx;" >
-    <view class="all" style="height: {{contentHeight}}rpx;">
-        <!-- 轮播图 -->
-        <view class="picturebox">
-            <swiper autoplay="{{true}}" indicator-dots='{{true}}' indicator-color='#D9D9D9' indicator-active-color='#F8DA7F' interval="{{3000}}" circular duration="{{500}}" class="img" bindchange="onSwiperChange">
-                <block wx:for="{{imageUrls}}" wx:key="index" wx:for-item="img">
-                    <swiper-item class="img">
-                        <image src="{{img}}" mode="aspectFill"></image>
-                    </swiper-item>
-                </block>
-            </swiper>
+<view class="bax" style="height: {{contentHeight}}rpx;">
+  <view class="all" style="height: {{contentHeight}}rpx;">
+    <!-- 轮播图 -->
+    <view class="picturebox">
+      <swiper autoplay="{{true}}" indicator-dots='{{true}}' indicator-color='#D9D9D9' indicator-active-color='#F8DA7F' interval="{{3000}}" circular duration="{{500}}" class="img">
+        <block wx:for="{{good.images}}" wx:key="index" wx:for-item="img">
+          <swiper-item class="img">
+            <image src="{{img}}" mode="aspectFill"></image>
+          </swiper-item>
+        </block>
+      </swiper>
+    </view>
+    <view class="box">
+      <view class="infobox">
+        <view class="title">{{good.name}}</view>
+        <view class="lebalbox">
+          <block wx:for="{{good.tag}}" wx:key="index">
+            <view class="lebal">{{item}}</view>
+          </block>
         </view>
-        <view class="box">
-            <view class="infobox">
-                <view class="title">粉黛胖挑主人杯(无礼盒)·手做 粉黛胖挑主人杯(无礼盒)·手做</view>
-                <view class="lebalbox">
-                    <block wx:for="{{2}}">
-                        <view class="lebal">热销好物</view>
-                    </block>
-                </view>
-                <view class="carbox">
-                    <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/62pr1k034930486.png"></image>
-                    <view class="car-tex">48小时内发货</view>
-                </view>
-                <view class="carbox2">
-                    <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/1st61g035044073.png"></image>
-                    <view class="car-tex">紫色经典款</view>
-                    <van-icon name="arrow" size='15' color='#727783' style="margin-left: auto;" />
-                </view>
-                <view class="carbox3">
-                    <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/2bp2t7035055633.png"></image>
-                    <view class="carbox3-tex">
-                        <view class="carbox3-tex1">陶瓷工艺</view>
-                        <view class="carbox3-tex2">直径5cm高7cm</view>
-                    </view>
-                </view>
-                <view class="carbox4">
-                    <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/j2sn43035105148.png"></image>
-                    <view class="car-tex">确认收货地址</view>
-                    <van-icon name="arrow" size='15' color='#727783' style="margin-left: auto;" />
-                </view>
-            </view>
-            <view class="tipbox">
-                <view class="dinggou">
-                    <view class="dinggou-title">订购须知</view>
-                    <view class="dinggou-tex">1.订购须知订购须知订购须知订购须知订购须知订购须知订购须知订购须知订购须知订购须知订购须知</view>
-                </view>
-                <view class="picbox">
-                    <block wx:for="{{1}}">
-                        <image src="https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg"  mode="aspectFill"></image>
-                    </block>
-                </view>
-                <view class="dinggou">
-                    <view class="dinggou-title">售后须知</view>
-                    <view class="dinggou-tex">1.售后须知售后须知售后须知售后须知售后须知售后须知售后须知售后须知</view>
-                </view>
-            </view>
-            <view class="tipbox2">
-                <view class="dinggou">
-                    <view class="dinggou-title">关于云上望仙</view>
-                    <view class="dinggou-tex">1.关于云上望仙关于云上望仙关于云上望仙关于云上望仙关于云上望仙关于云上望仙关于云上望仙</view>
-                </view>
-                <image src="https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg" mode="aspectFill"></image>
-                <view>log</view>
-                <view class="tip2-tex">公众号 抖音号 小红书</view>
-            </view>
+        <view class="carbox">
+          <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/62pr1k034930486.png"></image>
+          <view class="car-tex">48小时内发货</view>
         </view>
-    </view>
-
-    <!-- 按钮 -->
-    <view class="paybox">
-        <view class="pay1">
-            <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/rpl9a1024145457.png"></image>
-            <view class="pay1-tex">首页</view>
+        <block wx:if="{{!spec}}">
+          <view class="carbox2">
+            <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/1st61g035044073.png"></image>
+            <view class="car-tex">暂无其他规格</view>
+            <van-icon name="arrow" size='15' color='#727783' style="margin-left: auto;" />
+          </view>
+        </block>
+        <view wx:else class="carbox2" bind:tap="openSpec">
+          <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/1st61g035044073.png"></image>
+          <view class="car-tex">{{checkSpec.name}}</view>
+          <van-icon name="arrow" size='15' color='#727783' style="margin-left: auto;" />
+        </view>
+        <view class="carbox3">
+          <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/2bp2t7035055633.png"></image>
+          <view class="carbox3-tex">
+            <view class="carbox3-tex1">{{good.colors[0]}}</view>
+            <block wx:for="{{good.colors}}" wx:key="index">
+              <block wx:if="{{index>0}}">
+                <view class="carbox3-tex2">{{item}}</view>
+              </block>
+            </block>
+            <block wx:if="{{!good.colors.length}}">
+              <view class="car-tex">暂无商品简介</view>
+            </block>
+          </view>
+        </view>
+        <view class="carbox4" data-url="/common-page/pages/address/index?type=1&activeColor=#3498ff" bind:tap="tourl">
+          <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/j2sn43035105148.png"></image>
+          <view class="car-tex">{{(address.full_region+address.address)||'确认收货地址'}}</view>
+          <van-icon name="arrow" size='15' color='#727783' style="margin-left: auto;" />
+        </view>
+      </view>
+      <view class="tipbox">
+        <view class="dinggou">
+          <view class="dinggou-title">订购须知</view>
+          <block wx:for="{{good.order_notice}}" wx:key="index">
+            <view class="dinggou-tex">{{index+1}}.{{item}}</view>
+          </block>
         </view>
-        <view class="pay2">
-            <view class="pay2-tex">优惠100</view>
-            <view class="pay2-tex2">实付款¥19899.00</view>
+        <block wx:if="{{good.order_images.length}}">
+          <view class="picbox">
+            <block wx:for="{{good.order_images}}" wx:key="index">
+              <image src="{{item}}" mode="widthFix"></image>
+            </block>
+          </view>
+        </block>
+        <block wx:if="{{good.order_images.length<=0&&good.order_notice<=0}}">
+          <view class="dinggou">
+            <view class="dinggou-tex">暂无</view>
+          </view>
+        </block>
+        <view class="dinggou">
+          <view class="dinggou-title">售后须知</view>
+          <block wx:for="{{good.aftersales_notice}}" wx:key="index">
+            <view class="dinggou-tex">{{index+1}}.{{item}}</view>
+          </block>
+          <block wx:if="{{good.aftersales_notice.length<=0}}">
+            <view class="dinggou-tex">暂无</view>
+          </block>
         </view>
+      </view>
+      <view class="tipbox2">
+        <view class="dinggou">
+          <view class="dinggou-title">关于云上望仙</view>
+          <block wx:for="{{good.about}}" wx:key="index">
+            <view class="dinggou-tex">{{index+1}}.{{item}}</view>
+          </block>
+        </view>
+        <view class="qrBox">
+          <view class="logo">
+            <image src="{{good.about_qr[0]}}" mode="widthFix" />
+          </view>
+          <view class="qr">
+            <block wx:for="{{good.about_qr}}" wx:key="index">
+              <image wx:if="{{index>0}}" src="{{item}}" mode="widthFix" />
+            </block>
+          </view>
+        </view>
+        <!-- <image src="https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg" mode="aspectFill"></image>
+        <view>log</view>
+        <view class="tip2-tex">公众号 抖音号 小红书</view> -->
+      </view>
+    </view>
+  </view>
+
+  <!-- 按钮 -->
+  <view class="paybox">
+    <view class="pay1">
+      <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241230/rpl9a1024145457.png"></image>
+      <view class="pay1-tex">首页</view>
+    </view>
+    <view class="pay2" bind:tap="submitOrder">
+      <view class="pay2-tex">优惠0</view>
+      <view class="pay2-tex2">实付款¥{{totalPrice}}</view>
     </view>
+  </view>
+
+</view>
+<!-- 选择商品规格 -->
+<van-action-sheet show="{{ specBox }}" actions="{{spec}}" bind:close="closeSpec" description="选择商品规格" bind:select="getCheckSpec"></van-action-sheet>
 
-</view>
+<payment style="z-index: 99999;" show="{{showPay}}" tradeNo="{{tradeNo}}" price="{{totalPrice}}" bind:payResult='acceptResult' showType="all" />

文件差异内容过多而无法显示
+ 0 - 0
nova-tourism/pages/collect/collect-detail/index.wxss


+ 241 - 354
nova-tourism/pages/homestay/homestay-detail/index.js

@@ -2,6 +2,11 @@
 let Parse = getApp().Parse;
 const company = getApp().globalData.company
 import dateServ from '../../../service/date';
+const dateF = require("../../../../utils/date")
+let sev = require("../../../service/request")
+const uid = Parse.User.current()?.id
+const req = require('../../../../utils/request')
+
 Page({
 
   /**
@@ -17,7 +22,7 @@ Page({
     //  轮播图数组
     imageUrls: [],
     index: 1,
-    roomIndex:1,
+    roomIndex: 1,
     //
     decodedDateStart: '',
     decodedDateEnd: '',
@@ -42,12 +47,21 @@ Page({
     date_end1: '',
     showRoom: false, //显示房间详情
     chickRoom: null, //选中的房间
+    specDateMap: {}, //特殊日期标识-今天/明天
+    gift: [], //望仙礼遇-商品
+
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    const today = new Date();
+    const tomorrow = new Date();
+    tomorrow.setDate(today.getDate() + 1);
+    let specDateMap = {}
+    specDateMap[dateF.formatTime('mm月dd日', today)] = '今天'
+    specDateMap[dateF.formatTime('mm月dd日', tomorrow)] = '明天'
     // 计算
     const systemInfo = wx.getSystemInfoSync();
     const statusBarHeight = systemInfo.statusBarHeight || 0;
@@ -55,14 +69,12 @@ Page({
     const custom = wx.getMenuButtonBoundingClientRect();
     const customHeight = custom.height + 10 + 2 || 0;
     const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
     const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
     if (bottomNavHeight) {
       const padding_bottom = bottomNavHeight * 750 / systemInfo.windowWidth
       this.setData({
         bottomNavHeight: padding_bottom
       })
-      console.log(this.data.bottomNavHeight);
     } else {
       this.setData({
         bottomNavHeight: 40
@@ -77,33 +89,187 @@ Page({
     });
 
     const {
-      objectId,
-      date_start,
-      date_end,
-      daysBetween,
-      istoday,
+      store_id,
       start,
       end,
     } = options;
-    console.log(options);
-    // 解码接收到的参数
-    const decodedDateStart = decodeURIComponent(date_start);
-    const decodedDateEnd = decodeURIComponent(date_end);
-    const Start = decodeURIComponent(start);
-    const End = decodeURIComponent(end);
+    let startDate = new Date(`${start} 12:00:00`)
+    let endDate = new Date(`${end} 14:00:00`)
     this.setData({
-      decodedDateStart,
-      decodedDateEnd,
-      objectId,
-      daysBetween,
-      istoday,
-      start: Start,
-      end: End,
+      decodedDateStart: dateF.formatTime('mm月dd日', startDate),
+      decodedDateEnd: dateF.formatTime('mm月dd日', endDate),
+      objectId: store_id,
+      daysBetween: sev.getDays(startDate, endDate),
+      start: startDate,
+      end: endDate,
+      specDateMap
     })
-    console.log('istoday', this.data.istoday);
-    this.hanshu()
+    console.log(this.data.start, this.data.end);
+    // this.hanshu()
+    this.refersh()
   },
 
+  async refersh() {
+    this.getShopStore()
+    this.getRoom()
+    this.getGift()
+  },
+  /**获取当前店铺 */
+  async getShopStore() {
+    let {
+      objectId
+    } = this.data
+    let query = new Parse.Query('ShopStore')
+    let d = await query.get(objectId)
+    let shopStore = d?.toJSON()
+    let cQuery = new Parse.Query('DramaShopCollect')
+    cQuery.equalTo('company', company)
+    cQuery.equalTo('user', uid)
+    cQuery.equalTo('homestayStore', objectId)
+    cQuery.equalTo('isCollect', 'true')
+    cQuery.notEqualTo('isDeleted', "true")
+    let count = await cQuery.count()
+    shopStore.iscollect = count
+    console.log(shopStore)
+    let longitude = shopStore?.location?.longitude || 0
+    let latitude = shopStore?.location?.latitude || 0
+    this.setData({
+      shopStore,
+      longitude,
+      latitude,
+      markers: [{
+        id: 1,
+        longitude,
+        latitude,
+        iconPath: 'https://file-cloud.fmode.cn/13WZ0W7u3l/20240724/7ebg0k104325941.png?imageView2/1/w/200/h/200', /// 自定义标记图标
+        width: 20,
+        height: 20,
+      }]
+    })
+  },
+  /**获取店铺房间 */
+  async getRoom() {
+    let {
+      objectId
+    } = this.data
+    let query = new Parse.Query('ShopRoom');
+    query.equalTo('company', company);
+    query.equalTo('shop', objectId);
+    query.equalTo('isEnabled', 'true');
+    query.notEqualTo('isDeleted', 'true');
+    query.ascending('index')
+    let d = await query.find();
+    let roomList = d?.map(item => item?.toJSON())
+    await this.setData({
+      roomList
+    })
+    this.judRoom()
+  },
+  /**打开地图 */
+  callMap() {
+    let {
+      shopStore,
+      latitude,
+      longitude,
+    } = this.data
+    wx.openLocation({
+      name: shopStore?.storeName || '',
+      latitude,
+      longitude,
+      scale: 18
+    })
+  },
+  /** 开日历*/
+  openCalendar() {
+    this.setData({
+      show: true
+    });
+  },
+  /** 关日历*/
+  closeCalendar() {
+    this.setData({
+      show: false
+    });
+  },
+  /** 选好日期点击完成后*/
+  async onConfirm(event) {
+    const [start, end] = event.detail;
+    let daysBetween = sev.getDays(start, end)
+    await this.setData({
+      start: new Date(start.setHours(12, 0, 0)),
+      end: new Date(end.setHours(14, 0, 0)),
+      decodedDateStart: dateF.formatTime('mm月dd日', start),
+      decodedDateEnd: dateF.formatTime('mm月dd日', end),
+      daysBetween
+    });
+    this.judRoom()
+    this.closeCalendar()
+  },
+  /**遍历房间判断当前时段房间状态 */
+  async judRoom() {
+    let {
+      start,
+      end,
+      roomList
+    } = this.data
+    for (let i in roomList) {
+      let item = roomList[i]
+      /**是否空闲-true(可预约),false(不可预约) */
+      let isFree = await sev.isFree({
+        from: start,
+        to: end
+      }, item.objectId)
+      roomList[i].isFree = isFree
+    }
+    this.setData({
+      roomList
+    })
+  },
+  /** 点击预定*/
+  navigate(e) {
+    const {
+      index
+    } = e.currentTarget.dataset;
+    let {
+      start,
+      end,
+      roomList
+    } = this.data
+    console.log(roomList, roomList[index])
+    if (!roomList[index].isFree) {
+      wx.showToast({
+        title: '时段内房间被预约',
+        icon: 'none'
+      })
+      return
+    }
+    let date_start = dateF.formatTime("YYYY-mm-dd", start)
+    let date_end = dateF.formatTime("YYYY-mm-dd", end)
+    wx.navigateTo({
+      url: `../homestay-order2/index?objectId=${roomList[index].objectId}&date_start=${date_start}&date_end=${date_end}`
+    })
+  },
+  /** 点击预定*/
+  navigatePopup() {
+    let {
+      start,
+      end,
+      chickRoom
+    } = this.data
+    if (!chickRoom.isFree) {
+      wx.showToast({
+        title: '时段内房间被预约',
+        icon: 'none'
+      })
+      return
+    }
+    let date_start = dateF.formatTime("YYYY-mm-dd", start)
+    let date_end = dateF.formatTime("YYYY-mm-dd", end)
+    wx.navigateTo({
+      url: `../homestay-order2/index?objectId=${chickRoom.objectId}&date_start=${date_start}&date_end=${date_end}`
+    })
+  },
+  /**房间弹框-开 */
   showRoom(e) {
     let {
       roomList
@@ -117,20 +283,56 @@ Page({
       showRoom: true
     });
   },
-
+  /**房间弹框-关 */
   onCloseRoom() {
     this.setData({
       showRoom: false
     });
   },
-  async hanshu() {
-    await this.gethomestay()
-    await this.getroom()
-    //   await this.getpic()
-    await this.getcurrentdate()
+  /**拨打电话 */
+  phone() {
+    let phone = this.data.storeList[0].mobile
+    console.log(phone);
+    wx.makePhoneCall({
+      phoneNumber: phone
+    })
+  },
+  /** 获取望仙礼遇-商品*/
+  async getGift() {
+    let {
+      objectId
+    } = this.data
+    let sql = `SELECT good."objectId",good."name",good."price",good."image"
+  FROM "ShopGoods" good
+  WHERE good."company" = '${company}'
+  AND good."isDeleted" IS NOT TRUE
+  AND good."status" IS TRUE
+  AND good."shopStore"='${objectId}'
+  ORDER BY COALESCE(good."isHome", FALSE) DESC,
+  CASE WHEN good."top"= 0 THEN 1 ELSE 0 END,
+  good."top" ASC,good."createdAt"
+  LIMIT 4`
+    let gift = await req.customSQL(sql) || []
+    console.log(gift)
+    this.setData({
+      gift
+    })
   },
 
 
+
+
+
+
+
+  /** 跳转*/
+  tourl(e) {
+    const url = e.currentTarget.dataset.url
+    wx.navigateTo({
+      url: `${url}` // 目标页面的路径
+    });
+  },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -142,7 +344,12 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    let {
+      roomList
+    } = this.data
+    if (roomList?.length) {
+      this.judRoom()
+    }
   },
 
   /**
@@ -186,331 +393,11 @@ Page({
       index: currentIndex + 1
     })
   },
-    //随轮播图变化而变化
-    onRoomChange: function (event) {
-      const currentIndex = event.detail.current; // 获取当前索引
-      this.setData({
-        roomIndex: currentIndex + 1
-      })
-    },
-  //获取名宿信息
-  async gethomestay() {
-    let ShopStore = new Parse.Query('ShopStore');
-    ShopStore.equalTo('company', company);
-    ShopStore.equalTo('type', "stay");
-    ShopStore.equalTo('objectId', this.data.objectId);
-    ShopStore.notEqualTo('isDeleted', "true");
-    ShopStore.include('location');
-
-    let store = await ShopStore.find();
-    let storeListPromises = store.map(async item => {
-      let storeItem = item.toJSON();
-      storeItem.iscollect = await this.iscollect(storeItem.objectId); // 等待iscollect的结果
-      return storeItem;
-    });
-
-    let storeList = await Promise.all(storeListPromises); // 等待所有的Promise完成
-
-    this.setData({
-      storeList
-    });
-    this.setData({
-      imageUrls: storeList[0].image
-    })
-    this.Getlocation()
-    console.log(this.data.storeList);
-  },
-  //获取房间信息
-  async getroom() {
-    let room = new Parse.Query('ShopRoom');
-    room.equalTo('company', company);
-    room.equalTo('shop', this.data.objectId);
-    room.equalTo('isEnabled', 'true');
-    room.include('benefitMap');
-    room.notEqualTo('isDeleted', 'true');
-
-    let room2 = await room.find();
-    // 使用 Promise.all 来处理异步操作
-    let roomList = await Promise.all(room2.map(async item => {
-      let roomItem = item.toJSON();
-      let count = await this.checkOrderCount(roomItem.objectId, this.data.start, this.data.end);
-      console.log(count, roomItem.total);
-      roomItem.isroom = count < roomItem.total; // 简化判断
-      return roomItem;
-    }));
-    // 对 roomList 进行排序
-    roomList.sort(this.compareFunction);
-
-    this.setData({
-      roomList
-    });
-    console.log('房间', this.data.roomList);
-  },
-  //排序
-  compareFunction(a, b) {
-    // 先比较 isroom 的值
-    if (a.isroom !== b.isroom) {
-      return a.isroom ? -1 : 1;
-    }
-    // 如果 isroom 相同,再比较 index 是否有值
-    const hasIndexA = a.index !== undefined;
-    const hasIndexB = b.index !== undefined;
-    if (hasIndexA !== hasIndexB) {
-      return hasIndexA ? -1 : 1;
-    }
-    // 如果 index 都有值或者都没值,按 index 大小排序(都没值时顺序其实不变)
-    return (a.index || 0) - (b.index || 0);
-  },
-  async checkOrderCount(roomId, start, end) {
-    const startTime = new Date(start);
-    const endTime = new Date(end);
-    let startTime2 = dateServ.changeDateTime(startTime, '14:00:00')
-    let endTime2 = dateServ.changeDateTime(endTime, '12:00:00')
-    let Order = new Parse.Query("RoomOrder")
-    Order.equalTo("room", roomId)
-    Order.equalTo("company", company)
-    Order.exists("status")
-    Order.notContainedIn('status', [400, 601, 700, 800, 103])
-    Order.lessThan("startTime", endTime2);
-    Order.greaterThan("endTime", startTime2);
-    Order.select("startTime", "endTime")
-    let count = await Order.count()
-    return count
-  },
-  //收藏功能
-  async iscollect(object) {
-    const currentUser = Parse.User.current();
-    let Collect = new Parse.Query('DramaShopCollect');
-    Collect.equalTo('company', company);
-    Collect.equalTo('user', currentUser.id);
-    Collect.equalTo('homestayStore', object);
-    Collect.equalTo('isCollect', 'true');
-    Collect.notEqualTo('isDeleted', "true");
-    let collect = await Collect.first();
-    if (collect) {
-      return true
-    } else {
-      return false
-    }
-  },
-  //获取轮播图
-  // async getpic() {
-  //     let Banner = new Parse.Query('Banner');
-  //     Banner.equalTo('company', company);
-  //     Banner.equalTo('store', this.data.objectId);
-  //     Banner.equalTo('isEnabled', 'true');
-  //     Banner.notEqualTo('isDeleted', 'true');
-  //     Banner.select('image');
-
-  //     let Banner2 = await Banner.find();
-
-  //     // 提取 image 属性并存储到 imageUrls 中
-  //     let imageUrls = Banner2.map(item => item.get('image')); // 使用 get() 方法获取 image 属性
-
-  //     this.setData({
-  //         imageUrls // 将提取的 imageUrls 存储到组件状态中
-  //     });
-
-  //     console.log(this.data.imageUrls); // 输出 imageUrls
-  // },
-
-
-  //获取当前位置信息
-  Getlocation() {
-    // 假设 this.storeList[0].location 是一个 Parse.GeoPoint 对象
-    if (this.data.storeList[0].location) {
-      const storeLocation = this.data.storeList[0].location;
-      console.log('地址存在');
-      // 从 GeoPoint 对象中获取经纬度
-      const latitude = storeLocation.latitude; // 纬度
-      const longitude = storeLocation.longitude; // 经度
-
-      console.log('获取到的经纬度:', latitude, longitude); // 添加日志
-
-      // 调用 API 解析地址
-      wx.request({
-        url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=sHZTomd7grslfP7sPKB8tRgT49FK9TEu&output=json&coordtype=gcj02&location=' + latitude + ',' + longitude,
-        data: {},
-        header: {
-          'Content-Type': 'application/json'
-        },
-        success: (ops) => { // 使用箭头函数
-          console.log(ops);
-          const address = ops.data.result.formatted_address;
-          this.setData({
-            address: address,
-            latitude: latitude, // 保证 latitude 被设置
-            longitude: longitude, // 保证 longitude 被设置
-            markers: [{ // 设置 markers
-              id: 1,
-              latitude: latitude,
-              longitude: longitude,
-              iconPath: 'https://file-cloud.fmode.cn/13WZ0W7u3l/20240724/7ebg0k104325941.png?imageView2/1/w/200/h/200', // 自定义标记图标
-              width: 20,
-              height: 20,
-              // callout: {
-              //     content: this.data.storeList[0].storeName, // 可以显示解析出的地址
-              //     color: '#ffffff',
-              //     bgColor: '#7F56B2',
-              //     padding: 4,
-              //     fontSize: 8,
-              //     borderRadius: 3,
-              //     display: 'ALWAYS'
-              // }
-            }]
-          });
-          // console.log(this.data.address);
-        },
-        fail: function (resq) {
-          wx.showModal({
-            title: '信息提示',
-            content: '请求失败',
-            showCancel: false,
-            confirmColor: '#f37938'
-          });
-        },
-        complete: function () {}
-      });
-    }
-
-  },
-  //点击预定
-  navigate(e) {
-    const objectId = e.currentTarget.dataset.id;
-    // let currentUser = Parse.User.current()
-    // currentUser = currentUser.toJSON()
-    // console.log(currentUser, currentUser.idcard);
-
-    // if (currentUser.idcard) {
-    //     // 构造要传递的信息
-    //     const info = {
-    //         objectId: objectId,
-    //         date_start: this.data.start,
-    //         date_end: this.data.end,
-    //     };
-    //     // console.log('info',info);
-
-    //     // 将信息转为查询字符串
-    //     var queryString = Object.keys(info)
-    //         .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(info[key])}`)
-    //         .join('&');
-    //     console.log(queryString);
-    //     wx.navigateTo({
-    //         url: `../homestay-order/index?${queryString}`
-    //     })
-    // } else {
-    // wx.showToast({
-    //     title: '请先进行实名认证',
-    //     icon: 'none'
-    // })
-    //实名
-    // wx.navigateTo({
-    //     url: `/common-page/pages/info/cauth/cauth?themeColor=#FFE300`
-    // })
-
-    // 构造要传递的信息
-    const info = {
-      objectId: objectId,
-      date_start: this.data.start,
-      date_end: this.data.end,
-    };
-    console.log('info', info);
-
-    // 将信息转为查询字符串
-    var queryString = Object.keys(info)
-      .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(info[key])}`)
-      .join('&');
-    console.log(queryString);
-    wx.navigateTo({
-      url: `../homestay-order2/index?${queryString}`
-    })
-    // }
-
-  },
-
-
-  //获取今日明日日期
-  getcurrentdate() {
-    const today = new Date();
-    const tomorrow = new Date();
-    tomorrow.setDate(today.getDate() + 1);
-
-    this.setData({
-      date_start1: this.formatDate(today),
-      date_end1: this.formatDate(tomorrow),
-    });
-    console.log(this.data.start, this.data.end);
-  },
-  //转换日期
-  formatDate(date) {
-    date = new Date(date);
-    return `${date.getMonth() + 1}月${date.getDate()}日`;
-  },
-  // 计算两个日期之间的天数
-  calculateDaysBetween(startDate, endDate) {
-    const start = new Date(startDate);
-    const end = new Date(endDate);
-    const timeDifference = end - start; // 计算时间差(毫秒)
-    const daysDifference = timeDifference / (1000 * 3600 * 24); // 转换为天数
-    return daysDifference; // 返回天数差
-  },
-  //开日历
-  onDisplay() {
-    this.setData({
-      show: true
-    });
-  },
-  //关日历
-  onClose() {
-    this.setData({
-      show: false
-    });
-  },
-  //选好日期点击完成后
-  onConfirm(event) {
-    const [start, end] = event.detail;
-    const daysBetween = this.calculateDaysBetween(start, end); // 计算天数差
+  //随轮播图变化而变化
+  onRoomChange: function (event) {
+    const currentIndex = event.detail.current; // 获取当前索引
     this.setData({
-      show: false,
-      start,
-      end,
-      decodedDateStartart: `${this.formatDate(start)} `,
-      decodedDateEnd: `${this.formatDate(end)}`,
-      daysBetween
-    });
-    if (this.data.decodedDateStartart.trim() == this.data.date_start1.trim() && this.data.decodedDateEnd.trim() == this.data.date_end1.trim()) {
-      this.setData({
-        istoday: 'true'
-      })
-      console.log(this.data.istoday);
-    } else {
-      this.setData({
-        istoday: 'false'
-      })
-      console.log(this.data.istoday);
-    }
-    this.getroom()
-    console.log(`入住日期: ${this.data.decodedDateStartart}, 离店日期: ${this.data.decodedDateEnd}, 天数差: ${daysBetween}天`);
-  },
-  //拨打电话
-  phone() {
-    let phone = this.data.storeList[0].mobile
-    console.log(phone);
-    wx.makePhoneCall({
-      phoneNumber: phone
+      roomIndex: currentIndex + 1
     })
   },
-  callMap() {
-    if (this.data.storeList[0].location) {
-      const latitude = this.data.storeList[0].location.latitude
-      const longitude = this.data.storeList[0].location.longitude
-      wx.openLocation({
-        name: this.data.storeList[0].storeName,
-        latitude,
-        longitude,
-        scale: 18
-      })
-    }
-
-  }
 })

+ 117 - 6
nova-tourism/pages/homestay/homestay-detail/index.less

@@ -6,7 +6,7 @@
     position: relative;
     overflow-y: scroll;
     color: #382E2E;
-    font-family: "Microsoft JhengHei", "PingFang SC", "Helvetica Neue", sans-serif;
+
     font-weight: 400;
 
     .picturebox {
@@ -275,24 +275,130 @@
                 }
 
                 .submit {
-                    width: 86rpx;
-                    height: 86rpx;
+                    // width: 86rpx;
+                    // height: 86rpx;
                     display: flex;
                     justify-content: center;
                     align-items: center;
                     font-size: 48rpx;
+                    padding: 15rpx 26rpx;
                     background-color: #1A1A1A;
                     color: white;
                     font-weight: 700;
                     margin-left: 20rpx;
                 }
             }
+
+            .close {
+                position: absolute;
+                top: 0;
+                left: 0;
+                width: 100%;
+                height: 334rpx;
+                border: solid #e5e5e5 2rpx;
+                background: rgba(255, 255, 255, 0.541);
+                border-radius: 30rpx;
+
+            }
+        }
+        .wangbox{
+            width: 100%;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            flex-direction: column;
+            margin-top: 60rpx;
+            margin-bottom: 28rpx;
+            .wang{
+                width: 206rpx;
+                height: 46rpx;
+                font-size: 32rpx;
+                color: #67806A;
+                background-image: url(https://file-cloud.fmode.cn/EbxZUK5lBI/20241126/dm1jj2032446503.png?imageView2/1/w/200/h/200);
+                background-position: center; /* 背景图片居中 */
+                // background-size: cover; /* 背景图片覆盖整个元素 */
+                background-repeat: no-repeat; /* 不重复背景图片 */
+                display: flex;
+                justify-content: center;
+                align-items: center;
+            }
+            .wang2{
+                font-size: 24rpx;
+                color: #969696;
+            }
+        }
+        .wang-cardbox{
+            margin-top: 40rpx;
+            width: 100%;
+            background-color: white;
+            overflow-y: hidden;
+            padding-bottom: 40rpx;
+            column-count: 2; /* 设置列数 */
+            column-gap: 16rpx; /* 设置列间距 */
+            .wang-card{
+                break-inside: avoid; /* 防止卡片在列之间断裂 */
+                margin-bottom: 20rpx; /* 设置卡片底部间距 */
+                width: 100%; /* 确保卡片宽度为100% */
+                
+                image{
+                    width: 100%;
+                    height: 204rpx;
+                    border-radius: 10rpx;
+                }
+                .wang-catex{
+                    font-size: 26rpx;
+                    font-weight: 400;
+                    height: 76rpx;
+                }
+                .wang-numbox{
+                    width: 100%;
+                    display: flex;
+                    align-items: center;
+                    .wang-num{
+                        display: flex;
+                        justify-content: flex-end;
+                        align-items: flex-end;
+                        color: #C5262Ced;
+                        font-size: 30rpx;
+                        .wang-num1{
+                            font-size: 32rpx;
+                        }
+                        .wang-num2{
+                            font-size: 40rpx;
+                        }
+                    }
+                    .wang-submit{
+                        width: 102rpx;
+                        height: 48rpx;
+                        font-size: 28rpx;
+                        color: white;
+                        background-color: #F8DA7F;
+                        border-radius: 15rpx;
+                        display: flex;
+                        justify-content: center;
+                        align-items: center;
+                        margin-left: auto;
+                    }
+                }
+            }
+        }
+        .more{
+            width: 100%;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            .more-tex{
+                font-size: 28rpx;
+                color: #969696;
+            }
         }
     }
+
 }
 
 .roomBox {
     background: whitesmoke;
+
     .titleBox {
         width: 100%;
         border-radius: 20rpx 20rpx 0 0;
@@ -355,10 +461,12 @@
     .tagBox {
         padding: 30rpx;
         background: white;
+
         .title {
             font-size: 30rpx;
             font-weight: bold;
         }
+
         .tags {
             font-size: 24rpx;
             color: black;
@@ -366,6 +474,7 @@
             display: flex;
             flex-wrap: wrap;
             padding-left: 50rpx;
+
             .tag {
                 width: 50%;
                 height: 53rpx;
@@ -418,21 +527,23 @@
             display: flex;
             align-items: center;
             justify-content: space-around;
-            >view{
+
+            >view {
                 display: flex;
                 align-items: center;
                 justify-content: space-around;
+
                 image {
                     width: 47rpx;
                     height: 48rpx;
                     margin-right: 20rpx;
                 }
-    
+
                 text {
                     font-size: 26rpx;
                 }
             }
-        
+
         }
 
         .pay {

+ 66 - 84
nova-tourism/pages/homestay/homestay-detail/index.wxml

@@ -1,10 +1,10 @@
 <!--nova-tourism/pages/homestay/homestay-detail/index.wxml-->
-<nav type="back" background-color="#ffffff" frontColor="#000000" title="{{storeList[0].storeName}}" />
+<nav type="back" background-color="#ffffff" frontColor="#000000" title="{{shopStore.storeName}}" />
 <view class="all" scroll-y="true" bindscroll="onScroll" style="height: {{contentHeight}}rpx;padding-bottom: {{bottomNavHeight}}rpx;">
   <!-- 轮播图 -->
   <view class="picturebox">
     <swiper autoplay="{{true}}" interval="{{3000}}" circular duration="{{500}}" class="img" bindchange="onSwiperChange">
-      <block wx:for="{{imageUrls}}" wx:key="index" wx:for-item="img">
+      <block wx:for="{{shopStore.image}}" wx:key="index" wx:for-item="img">
         <swiper-item class="img">
           <image src="{{img}}" mode="aspectFill"></image>
         </swiper-item>
@@ -16,17 +16,17 @@
   <view class="card">
     <view class="Legendary-Information">
       <view class="info-name">
-        <view class="name-tex">{{storeList[0].storeName}}</view>
-        <image class="name-pic" wx:if="{{!storeList[0].iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/2gcp1e030048570.png"></image>
-        <image class="name-pic" wx:if="{{storeList[0].iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/8mp9uj030058190.png?imageView2/1/w/200/h/200"></image>
+        <view class="name-tex">{{shopStore.storeName}}</view>
+        <image class="name-pic" wx:if="{{!shopStore.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/2gcp1e030048570.png"></image>
+        <image class="name-pic" wx:if="{{shopStore.iscollect}}" src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241121/8mp9uj030058190.png?imageView2/1/w/200/h/200"></image>
       </view>
-      <view class="info-intr">{{storeList[0].desc}}</view>
+      <view class="info-intr">{{shopStore.desc}}</view>
       <view class="info-intr2" bindtap="callMap">
-        <van-icon size='36rpx' name="location-o" /> {{storeList[0].storeAddress}}
+        <van-icon size='36rpx' name="location-o" /> {{shopStore.storeAddress||'暂未上传店铺地址'}}
       </view>
       <view class="info-map">
         <view class="map">
-          <map class="map" enable-zoom="ture" enable-scroll="true" id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="14" markers="{{markers}}"></map>
+          <map class="map" enable-zoom="ture" enable-scroll="true" id="map" longitude="{{longitude||0}}" latitude="{{latitude||0}}" scale="14" markers="{{markers}}"></map>
         </view>
         <view class="info-call" bindtap="phone">
           <image src="https://file-cloud.fmode.cn/EbxZUK5lBI/20241212/e9muh5104028782.png"></image>
@@ -36,22 +36,21 @@
     </view>
     <view class="roomcard">
       <van-sticky z-index='99' offset-top="{{statusBarHeight+customHeight-5}}">
-        <view class="timebox" bindtap="onDisplay">
+        <view class="timebox" bindtap="openCalendar">
           <view class="time">
-            <view class="time-tex" wx:if="{{istoday=='true'}}">今天</view>
+            <view class="time-tex">{{specDateMap[decodedDateStart]}}</view>
             <view class="time-time">{{decodedDateStart}}</view>
           </view>
           <van-icon name="minus" size='30rpx' custom-style='font-weight: 600;margin-bottom: 4rpx;margin-right: 6rpx;' />
           <view class="time">
-            <view class="time-tex" wx:if="{{istoday=='true'}}">明天</view>
+            <view class="time-tex">{{specDateMap[decodedDateEnd]}}</view>
             <view class="time-time">{{decodedDateEnd}}</view>
           </view>
           <view class="time_tex2">共{{daysBetween}}晚</view>
         </view>
-        <van-calendar show="{{ show }}" show-confirm="{{ true }}" confirm-text="完成" confirm-disabled-text='完成' type="range" bind:close="onClose" bind:confirm="onConfirm" color='#46a9a4' position='bottom' />
       </van-sticky>
       <block wx:for="{{roomList}}" wx:key="index">
-        <view class="room-card" wx:if="{{item.isroom}}">
+        <view class="room-card">
           <view class="room-card1" data-index="{{index}}" bind:tap="showRoom">
             <image src="{{item.images[0]}}" mode="aspectFill"></image>
             <view class="room-card-textbox">
@@ -73,53 +72,53 @@
                     {{item.benefitMap.gift}}
                   </view>
                 </block>
-
               </view>
             </view>
           </view>
           <view class="room-card2">
             <view class="price">¥{{item.price*daysBetween}}</view>
-            <view class="submit" data-id="{{item.objectId}}" bindtap="navigate">订</view>
+            <block wx:if="{{item.isFree}}">
+              <view class="submit" data-index="{{index}}" bindtap="navigate">订</view>
+            </block>
+            <block wx:else>
+              <view class="submit">时段无房</view>
+            </block>
           </view>
+          <block wx:if="{{!item.isFree}}">
+            <view class="close" data-index="{{index}}" bind:tap="showRoom"></view>
+          </block>
         </view>
-        <!-- 无房 -->
-        <view class="room-card" style="opacity: 0.5;" wx:if="{{!item.isroom}}">
-          <view class="room-card1">
-            <image src="{{item.images[0]}}" mode="aspectFill"></image>
-            <view class="room-card-textbox">
-              <view class="room-card-textbox-titlebox">
-                <view class="room-card-textbox-title">{{item.name}}</view>
-                <van-icon name="arrow" custom-style='margin-top: 8rpx;' />
-              </view>
-              <view class="room-card-textbox-info">
-                <block wx:for="{{item.tags}}" wx:for-item="tag">
-                  {{tag}}
-                </block>
-              </view>
-              <view class="room-card-textbox-label">
-                <block>
-                  <view class="room-card-textbox-label2" wx:if="{{item.benefitMap.discount.length>0}}">
-                    {{item.benefitMap.discount}}
-                  </view>
-                  <view class="room-card-textbox-label2" wx:if="{{item.benefitMap.gift.length>0}}">
-                    {{item.benefitMap.gift}}
-                  </view>
-                </block>
+      </block>
 
+      <view class="wangbox">
+        <view class="wang">望仙礼遇</view>
+        <view class="wang2">望日w望月w来望仙w</view>
+      </view>
+      <view class="wang-cardbox">
+        <block wx:for="{{gift}}" wx:key="index">
+          <view class="wang-card" data-url="/nova-tourism/pages/collect/collect-detail/index?gid={{item.objectId}}" bindtap="tourl">
+            <image src="{{item.image||'https://img95.699pic.com/photo/60072/5330.jpg_wh860.jpg'}}" mode="aspectFill"></image>
+            <view class="wang-catex">{{item.name}}</view>
+            <view class="wang-numbox">
+              <view class="wang-num">
+                <view class="wang-num1">¥</view>
+                <view class="wang-num2">{{item.price||0}}</view>
               </view>
+              <view class="wang-submit">购买</view>
             </view>
           </view>
-          <view class="room-card2">
-            <view class="no">时段无房</view>
-          </view>
-        </view>
-      </block>
+        </block>
+      </view>
+      <view class="more">
+        <view class="more-tex">查看更多 ></view>
+      </view>
+
 
     </view>
   </view>
-
 </view>
 
+<van-calendar show="{{ show }}" show-confirm="{{ true }}" confirm-text="完成" confirm-disabled-text='完成' type="range" bind:close="closeCalendar" bind:confirm="onConfirm" color='#46a9a4' position='bottom' />
 
 <van-popup custom-style="height: 80vh;" round position="bottom" style="z-index: 999;" show="{{ showRoom }}" bind:close="onCloseRoom">
   <view class="roomBox">
@@ -137,57 +136,40 @@
     </view>
     <block wx:if="{{chickRoom.images.length}}">
       <view class="picturebox">
-      <swiper autoplay="{{true}}" interval="{{3000}}" circular duration="{{500}}" class="img" bindchange="onRoomChange">
-        <block wx:for="{{chickRoom.images}}" wx:key="index" wx:for-item="img">
-          <swiper-item class="img">
-            <image src="{{img}}" mode="aspectFill"></image>
-          </swiper-item>
-        </block>
-      </swiper>
-      <view class="numberbox">{{roomIndex}}/{{chickRoom.images.length}}</view>
-    </view>
+        <swiper autoplay="{{true}}" interval="{{3000}}" circular duration="{{500}}" class="img" bindchange="onRoomChange">
+          <block wx:for="{{chickRoom.images}}" wx:key="index" wx:for-item="img">
+            <swiper-item class="img">
+              <image src="{{img}}" mode="aspectFill"></image>
+            </swiper-item>
+          </block>
+        </swiper>
+        <view class="numberbox">{{roomIndex}}/{{chickRoom.images.length}}</view>
+      </view>
     </block>
-   
+
     <view class="tagBox">
       <view class="title">{{chickRoom.name}}</view>
       <view class="tags">
-      <block wx:for="{{chickRoom.tags}}" wx:key="index" wx:for-item="tag">
-        <view class="tag">{{tag}}</view>
-      </block>
+        <block wx:for="{{chickRoom.tags}}" wx:key="index" wx:for-item="tag">
+          <view class="tag">{{tag}}</view>
+        </block>
       </view>
     </view>
-    <view class="serverBox tagBox">
-      <view class="title">服务设施</view>
-      <view class="tags">
-        <view class="tag2">免费停车位</view>
-        <view class="tag2">行李寄存 </view>
-        <view class="tag2">前台接待</view>
-        <view class="tag2">床品1客1换</view>
-        <view class="tag2">免费接站</view>
-        <view class="tag2">团建会议</view>
-        <view class="tag2">提供餐食</view>
-        <view class="tag2"></view>
-        <view class="tag2"></view>
-        <view class="tag2">热水</view>
-        <view class="tag2">独立卫浴</view>
-        <view class="tag2">电吹风</view>
-        <view class="tag2">洗浴用品</view>
-        <view class="tag2">牙具</view>
-        <view class="tag2">投影设备</view>
-        <view class="tag2">卡拉OK</view>
-        <view class="tag2">麻将机</view>
-        <view class="tag2">桌角防护</view>
-        <view class="tag2">壁炉</view>
-        <view class="tag2">智能马桶</view>
-        <view class="tag2">智能窗帘</view>
+    <block wx:if="{{chickRoom.service.length}}">
+      <view class="serverBox tagBox">
+        <view class="title">服务设施</view>
+        <view class="tags">
+          <view class="tag2" wx:for="{{chickRoom.service}}" wx:for-item="sev" wx:key="index">{{sev}}</view>
+        </view>
       </view>
-    </view>
+    </block>
+
     <view class="ruleBox tagBox">
       <view class="title">预定须知</view>
       <view class="sub_title">以下规则由房东制定,请仔细阅读并遵守</view>
       <view class="list">
         <view class="key">入离</view>
-        <view class="value">12:00后入住,12:00前退房</view>
+        <view class="value">{{chickRoom.open_time||'12:00后入住,12:00前退房'}}</view>
       </view>
       <view class="list">
         <view class="key">发票</view>
@@ -213,7 +195,7 @@
         </view>
 
       </view>
-      <view class="pay">
+      <view class="pay" bindtap="navigatePopup">
         <text>优惠0 实付¥{{chickRoom.price||0}}</text>
       </view>
     </view>

+ 107 - 3
nova-tourism/pages/homestay/homestay-detail/index.wxss

@@ -6,7 +6,6 @@
   position: relative;
   overflow-y: scroll;
   color: #382E2E;
-  font-family: "Microsoft JhengHei", "PingFang SC", "Helvetica Neue", sans-serif;
   font-weight: 400;
 }
 .all .picturebox {
@@ -241,17 +240,122 @@
   align-items: center;
 }
 .all .roomcard .room-card .room-card2 .submit {
-  width: 86rpx;
-  height: 86rpx;
   display: flex;
   justify-content: center;
   align-items: center;
   font-size: 48rpx;
+  padding: 15rpx 26rpx;
   background-color: #1A1A1A;
   color: white;
   font-weight: 700;
   margin-left: 20rpx;
 }
+.all .roomcard .room-card .close {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 334rpx;
+  border: solid #e5e5e5 2rpx;
+  background: rgba(255, 255, 255, 0.541);
+  border-radius: 30rpx;
+}
+.all .roomcard .wangbox {
+  width: 100%;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+  margin-top: 60rpx;
+  margin-bottom: 28rpx;
+}
+.all .roomcard .wangbox .wang {
+  width: 206rpx;
+  height: 46rpx;
+  font-size: 32rpx;
+  color: #67806A;
+  background-image: url(https://file-cloud.fmode.cn/EbxZUK5lBI/20241126/dm1jj2032446503.png?imageView2/1/w/200/h/200);
+  background-position: center;
+  /* 背景图片居中 */
+  background-repeat: no-repeat;
+  /* 不重复背景图片 */
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.all .roomcard .wangbox .wang2 {
+  font-size: 24rpx;
+  color: #969696;
+}
+.all .roomcard .wang-cardbox {
+  margin-top: 40rpx;
+  width: 100%;
+  background-color: white;
+  overflow-y: hidden;
+  padding-bottom: 40rpx;
+  column-count: 2;
+  /* 设置列数 */
+  column-gap: 16rpx;
+  /* 设置列间距 */
+}
+.all .roomcard .wang-cardbox .wang-card {
+  break-inside: avoid;
+  /* 防止卡片在列之间断裂 */
+  margin-bottom: 20rpx;
+  /* 设置卡片底部间距 */
+  width: 100%;
+  /* 确保卡片宽度为100% */
+}
+.all .roomcard .wang-cardbox .wang-card image {
+  width: 100%;
+  height: 204rpx;
+  border-radius: 10rpx;
+}
+.all .roomcard .wang-cardbox .wang-card .wang-catex {
+  font-size: 26rpx;
+  font-weight: 400;
+  height: 76rpx;
+}
+.all .roomcard .wang-cardbox .wang-card .wang-numbox {
+  width: 100%;
+  display: flex;
+  align-items: center;
+}
+.all .roomcard .wang-cardbox .wang-card .wang-numbox .wang-num {
+  display: flex;
+  justify-content: flex-end;
+  align-items: flex-end;
+  color: #C5262Ced;
+  font-size: 30rpx;
+}
+.all .roomcard .wang-cardbox .wang-card .wang-numbox .wang-num .wang-num1 {
+  font-size: 32rpx;
+}
+.all .roomcard .wang-cardbox .wang-card .wang-numbox .wang-num .wang-num2 {
+  font-size: 40rpx;
+}
+.all .roomcard .wang-cardbox .wang-card .wang-numbox .wang-submit {
+  width: 102rpx;
+  height: 48rpx;
+  font-size: 28rpx;
+  color: white;
+  background-color: #F8DA7F;
+  border-radius: 15rpx;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  margin-left: auto;
+}
+.all .roomcard .more {
+  width: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.all .roomcard .more .more-tex {
+  font-size: 28rpx;
+  color: #969696;
+}
 .roomBox {
   background: whitesmoke;
 }

+ 388 - 430
nova-tourism/pages/homestay/homestay-order2/index.js

@@ -1,440 +1,398 @@
 // nova-tourism/pages/homestay/homestay-order2/index.js
 let Parse = getApp().Parse;
 const company = getApp().globalData.company
-import dataSource from '../../../service/data';
 import dateServ from '../../../service/date';
-const rechText = require('../../../../utils/rech-text')
-Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        //屏幕高度
-        statusBarHeight: 0, // 状态栏高度
-        screenHeight: 0, // 屏幕高度
-        customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
-        bottomNavHeight: 0, // 底部导航栏高度
-        contentHeight: 0, // 可用内容高度
-
-        room: {},
-        startTime: null, // 入住开始时间
-        endTime: null, // 入住结束时间
-        roomId: null,
-        count: 1, // 入住几晚
-        date: '', //入住区间
-        date2: '',
-        name: '',
-        mobile: '',
-        activeOrder: null, //创建的订单
-        tradeNo: null, //订单号
-        showPayment: false, //显示支付组件
-        //显示日历选择
-        show:false,
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
-        const systemInfo = wx.getSystemInfoSync();
-        const statusBarHeight = systemInfo.statusBarHeight || 0;
-        const screenHeight = systemInfo.screenHeight || 0;
-        const custom = wx.getMenuButtonBoundingClientRect();
-        const customHeight = custom.height + 10 + 2 || 0;
-        const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
-        const contentHeight = (screenHeight - bottomNavHeight -5- statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
-
-        this.setData({
-            contentHeight
-        });
-
-        const {
-            objectId,
-            date_start,
-            date_end,
-        } = options;
-        const date_start1 = decodeURIComponent(date_start);
-        const date_end1 = decodeURIComponent(date_end);
-        this.setData({
-            startTime: date_start1,
-            endTime: date_end1,
-            roomId: objectId
-
-        })
-        console.log('123', date_start1, date_end1);
-        this.getroom()
-        this.getdate()
-    },
-    //计算用户选择的入住和离店日期,并生成相应的日期范围和价格信息。
-    getdate() {
-        // let {
-        //     startTime,
-        //     endTime
-        // } = this.formatTimeArea(this.data.start, this.data.end)
-        // console.log('开始时间', this.data.start, '结束时间', this.data.end);
-        // console.log('开始时间', startTime, '结束时间', endTime);
-        var dataAll = dateServ.getDayAll(this.data.startTime, this.data.endTime);
-        dataAll.pop(); // 最后一天为退房,不算在内
-        console.log('dataAll', dataAll);
-        // console.log(this.formatDate(startTime), this.formatDate(endTime))
-        let dateStr = this.formatDate(this.data.startTime) + '-' + this.formatDate(this.data.endTime)
-        console.log('dateStr', dateStr)
-        this.setData({
-            // showDate: false,
-            date: `${this.formatDate(this.data.startTime)} - ${this.formatDate(this.data.endTime)}`,
-            date2: `${this.formatDate2(this.data.startTime,this.data.endTime)}`,
-            // priceInfoArr: dataAll,
-            count: dataAll.length
-        })
-
-        console.log('天数', this.data.count);
-    },
-    //修改时间格式
-    formatDate(date) {
-        date = new Date(date);
-
-        // 获取当前日期
-        const today = new Date();
-
-        // 格式化日期为 "月/日"
-        const month = date.getMonth() + 1; // 月份从0开始,所以要加1
-        const day = date.getDate();
-
-        // 获取星期几
-        const weekDays = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
-        const weekDay = weekDays[date.getDay()]; // 获取星期几的中文
-
-        // 判断是今天还是明天
-        let dateDescription = '';
-        if (date.toDateString() === today.toDateString()) {
-            dateDescription = '今天';
-        } else if (date.toDateString() === new Date(today.getTime() + 86400000).toDateString()) {
-            dateDescription = '明天';
-        } else {
-            dateDescription = weekDay; // 其他情况返回星期几
-        }
-
-        // 返回格式化的字符串
-        return `${month}月${day}日 ${dateDescription}`;
-    },
-    formatDate2(date1, date2) {
-        date1 = new Date(date1);
-        date2 = new Date(date2);
-
-        // 获取年份、月份和日期
-        const year1 = date1.getFullYear();
-        const month1 = date1.getMonth() + 1; // 月份从0开始,所以要加1
-        const day1 = date1.getDate();
-
-        const year2 = date2.getFullYear();
-        const month2 = date2.getMonth() + 1; // 月份从0开始,所以要加1
-        const day2 = date2.getDate();
-
-        // 返回格式化的字符串
-        return `${year1}年${month1}月${day1}日入住 - ${year2}年${month2}月${day2}日离店`;
-    },
-    //获取房间信息
-    async getroom() {
-        let room = new Parse.Query('ShopRoom');
-        room.equalTo('company', company);
-        room.equalTo('objectId', this.data.roomId);
-        room.equalTo('isEnabled', 'true');
-        room.include('shop');
-        room.notEqualTo('isDeleted', 'true');
-
-        let room2 = await room.find();
-        let roomList = room2.map(item => item.toJSON());
-        this.setData({
-            room: roomList[0]
-        })
-        console.log('房间', this.data.room);
-    },
-    //计算选择日期的房间数量
-    async checkOrderCount() {
-        //   start1  end1   现在选择
-        //   start2  end2     已有订单时间
-        //   start1 < start2              end1 < end2
-        //   start1 > start2              end1 > end2
-        //   start1 = start2              end1 = end2
-        const startTime = new Date(this.data.startTime);
-        const endTime = new Date(this.data.endTime);
-        const startTime2 = dateServ.changeDateTime(startTime, '14:00:00')
-        const endTime2 = dateServ.changeDateTime(endTime, '12:00:00')
-        let Order = new Parse.Query("RoomOrder")
-        Order.equalTo("room", this.data.roomId)
-        Order.equalTo("company", company)
-        Order.exists("status")
-        Order.notContainedIn('status', [400, 601, 700,800,103])
-        Order.lessThan("startTime", endTime2);
-        Order.greaterThan("endTime", startTime2); 
-        Order.select("startTime", "endTime")
-        let count = await Order.count()
-        console.log('count', count);
-        return count
-    },
-    //生成订单号
-    getTradeNo() {
-        let now = new Date()
-        let tradeNo = "C" +
-            String(now.getFullYear()) +
-            (now.getMonth() + 1) +
-            now.getDate() +
-            now.getHours() +
-            now.getMinutes() +
-            now.getSeconds() +
-            Math.random().toString().slice(-6); //生成六位随机数
-        return tradeNo
-    },
-    //   创建待支付订单
-    async setOrder(tradeNo) {
-        const startTime = new Date(this.data.startTime);
-        const endTime = new Date(this.data.endTime);
-        const startTime2 = dateServ.changeDateTime(startTime, '14:00:00')
-        const endTime2 = dateServ.changeDateTime(endTime, '12:00:00')
-        let currentUser = Parse.User.current()
-        let Order = Parse.Object.extend("RoomOrder");
-        let order = new Order()
-        try {
-            // order.set("details", this.data.room.details);
-            order.set("user", {
-                __type: 'Pointer',
-                className: '_User',
-                objectId: currentUser.id
-            });
-            order.set("orderNum", tradeNo);
-            order.set("room", {
-                __type: 'Pointer',
-                className: 'ShopRoom',
-                objectId: this.data.roomId
-            });
-            console.log(this.data.startTime, endTime);
-            order.set("startTime", startTime2);
-            order.set("endTime", endTime2);
-            order.set("merber", 1);
-            order.set("price", this.data.count * this.data.room.price);
-            order.set("shopStore", {
-                __type: 'Pointer',
-                className: 'ShopStore',
-                objectId: this.data.room.shop.objectId
-            });
-            order.set("company", {
-                __type: 'Pointer',
-                className: 'Company',
-                objectId: company
-            })
-            order.set("name", this.data.name);
-            order.set("mobile", this.data.mobile);
-            // order.set("merber", this.data.peopleNum);
-            order = await order.save()
-        } catch (error) {
-            console.log(error);
-            wx.showToast({
-                title: error.errMsg,
-                icon: 'none'
-            })
-        }
-        return order
-    },
-    //获取住客姓名
-    getname(e) {
-        this.setData({
-            name: e.detail.value
-        })
-        console.log(this.data.name);
-    },
-    //获取住客电话
-    getmobile(e) {
-        const mobileNumber = e.detail.value; // 假设手机号是通过 e.detail.value 传递的
-        console.log(mobileNumber);
+const dateF = require("../../../../utils/date")
+const real = require("../../../../utils/real")
+const uid = Parse.User.current()?.id
+const sev = require('../../../service/request')
 
-        // 正则表达式:匹配中国大陆手机号
-        const mobilePattern = /^1[3-9]\d{9}$/;
+Page({
 
-        // 验证手机号格式
-        if (mobilePattern.test(mobileNumber)) {
-            this.setData({
-                mobile: mobileNumber
-            })
-            console.log("手机号格式正确");
-            // 这里可以执行其他操作,比如保存手机号或进行下一步操作
-        } else {
-            
-            wx.showToast({
-                title: '手机号格式不正确',
-                icon: 'none',
-            })
-            console.log("手机号格式不正确");
-            // 这里可以提示用户手机号格式不正确
-        }
-    },
-    //点击支付
-    async submit() {
-        // if (!this.data.startTime || !this.data.endTime) {
-        //     wx.showToast({
-        //         title: '请选择入住时间',
-        //         icon: 'none',
-        //     })
-        //     return
-        // }
-        if (this.data.name.length == 0 || this.data.mobile.length == 0) {
-            wx.showToast({
-                title: '请输入住人信息',
-                icon: 'none',
-            })
-            return
-        }
-        let count = await this.checkOrderCount()
-        if (count >= this.data.room.total) {
-            console.log(count);
-            wx.showToast({
-                title: '当前日期,已无剩余房间,请重新选择',
-                icon: 'none',
-            })
-            return
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    room: {},
+    startTime: null, // 入住开始时间
+    endTime: null, // 入住结束时间
+    roomId: null,
+    count: 1, // 入住几晚
+    date: '', //入住区间
+    date02: '', //入住区间-页面显示
+    name: '', //住客姓名
+    mobile: '', //联系电话
+    activeOrder: null, //创建的订单
+    tradeNo: null, //订单号
+    showPayment: false, //显示支付组件
+    //显示日历选择
+    show: false,
+    order: null, //创建的订单-parse类型
+    formatter: null, //标记被占用日期
+    scope: null, //日历范围-今日至180天之后
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    const {
+      objectId,
+      date_start,
+      date_end,
+    } = options;
+    console.log(date_start,
+      date_end, )
+    let minDate = new Date()
+    let maxDate = new Date()
+    maxDate.setDate(maxDate.getDate() + 180)
+    let scope = {
+      minDate: minDate.getTime(),
+      maxDate: maxDate.getTime()
+    }
+    this.setData({
+      startTime: date_start,
+      endTime: date_end,
+      roomId: objectId,
+      scope
+    })
+    this.refersh()
+  },
+  async refersh() {
+    await this.getroom()
+    this.getdate()
+
+  },
+  /** 获取房间信息*/
+  async getroom() {
+    let {
+      startTime,
+      endTime
+    } = this.data
+    let room = new Parse.Query('ShopRoom');
+    room.include('shop','shop.user');
+    let d = await room.get(this.data.roomId)
+    let timeList = ['12:00', '14:00']
+    if (d?.get('open_time')) {
+      timeList = d?.get('open_time').split("-");
+    }
+    console.log(d.toJSON())
+    startTime = new Date(startTime + ' ' + timeList[0])
+    endTime = new Date(endTime + ' ' + timeList[1])
+
+    await this.setData({
+      room: d.toJSON(),
+      startTime,
+      endTime
+    })
+  },
+  /** 用户入住离店日期,并生成日期范围和价格信息。*/
+  async getdate() {
+    let {
+      startTime,
+      endTime
+    } = this.data
+    var dataAll = dateServ.getDayAll(startTime, endTime);
+    dataAll.pop()
+    await this.setData({
+      date02: `${dateF.formatTime('mm月dd日 入住',startTime)} - ${dateF.formatTime('mm月dd日 离店',endTime)}`,
+      date: `${this.formatDate(startTime)} - ${this.formatDate(endTime)}`,
+      count: dataAll.length
+    })
+    this.getTotalPrice()
+  },
+
+  /** 开日历*/
+  async onDisplay() {
+    let {
+      roomId
+    } = this.data
+    let list = await sev.getRoomOccupiaDate(roomId)
+    // console.log(list)
+    let formatter = (day) => {
+      let year = day.date.getFullYear()
+      let month = day.date.getMonth()
+      let date = day.date.getDate()
+      let isSame = list.findIndex(item=>item.year==year && item.month==month && item.date==date)
+      if(isSame!=-1){
+        day.topInfo = '被预定'
+      }
+      return day
+    }
+    this.setData({
+      formatter,
+      show: true
+    });
+  },
+  /** 关日历*/
+  onClose() {
+    this.setData({
+      show: false
+    });
+  },
+  /** 选好日期点击完成后*/
+  async onConfirm(event) {
+    const [start, end] = event.detail;
+    start.setHours(12, 0, 0);
+    end.setHours(14, 0, 0);
+    let {roomId}=this.data
+    let isFree = await sev.isFree({from:start,to:end},roomId)
+    console.log(isFree)
+    if(!isFree){
+      await this.onDisplay()
+      wx.showToast({
+        title: '时间段内存在被预定日期,请重新选择',
+        icon:'none'
+      })
+    }else{
+      await this.setData({
+        show: false,
+        startTime: start,
+        endTime: end,
+      });
+      this.getdate()
+    }
+  },
+
+  /** 判断是否可创建订单*/
+  judgeOrder() {
+    let {
+      room,
+      name,
+      mobile
+    } = this.data
+    console.log(name, mobile)
+    if (!name || !mobile) {
+      wx.showToast({
+        title: '住客姓名或联系电话为空',
+        icon: 'none',
+      });
+      return false
+    }
+    if (!real.isPoneAvailable(mobile)) {
+      wx.showToast({
+        title: '手机号有误',
+        icon: 'none',
+      });
+      return false
+    }
+    return true
+  },
+
+  /**创建订单 */
+  async submitOrder() {
+    let {
+      room,
+      name,
+      mobile,
+      startTime,
+      endTime,
+      totalPrice,
+      order,
+      tradeNo
+    } = this.data
+    console.log(startTime,
+      endTime, )
+    let isPass = this.judgeOrder()
+    if (!isPass) return
+    this.getTotalPrice()
+
+    let o = order
+    if (!order?.id) {
+      let now = new Date()
+      tradeNo = "C" +
+        String(now.getFullYear()) +
+        (now.getMonth() + 1) +
+        now.getDate() +
+        now.getHours() +
+        now.getMinutes() +
+        now.getSeconds() +
+        Math.random().toString().slice(-6);
+      let Order = Parse.Object.extend("RoomOrder");
+      o = new Order()
+      o.set("company", {
+        __type: 'Pointer',
+        className: 'Company',
+        objectId: company
+      })
+      o.set("user", {
+        __type: 'Pointer',
+        className: '_User',
+        objectId: uid
+      })
+      o.set("room", {
+        __type: 'Pointer',
+        className: 'ShopRoom',
+        objectId: room?.objectId
+      })
+      o.set("shopStore", {
+        __type: 'Pointer',
+        className: 'ShopStore',
+        objectId: room?.shop?.objectId
+      })
+      o.set("orderNum", tradeNo);
+      o.set("merber", room?.merber || 0);
+      o.set('status', 105) //未支付
+    }
+    o.set("name", name);
+    o.set("mobile", mobile);
+    o.set("startTime", startTime);
+    o.set("endTime", endTime);
+    o.set("price", totalPrice || 0);
+    try {
+      order = await o.save()
+      this.setData({
+        tradeNo,
+        order: o,
+        showPayment: true,
+      })
+      wx.showToast({
+        title: '已创建订单',
+        icon: 'none'
+      })
+    } catch (error) {
+      wx.showToast({
+        title: '出错了请检查后重试',
+        icon: 'error'
+      })
+    }
+  },
+
+  /**支付回调 */
+  async acceptResult(e) {
+    let {
+      order,room
+    } = this.data
+    let {
+      params
+    } = e.detail
+    if (params == 'ok') {
+      wx.showLoading({
+        title: '加载中',
+      })
+      order.set('status', 100)
+      order.set('isPay', true)
+      try {
+        await order.save()
+        let userParse = Parse.User.current()
+        if(!userParse?.get('invite')){
+          userParse.set('invite',{__type:'Pointer',className:'_User',objectId:room.shop?.user?.objectId})
+          await userParse.save()
         }
-        let tradeNo = this.getTradeNo() //生成订单编号
-        let order = await this.setOrder(tradeNo) //生成订单
-        if (order) {
-            this.setData({
-                activeOrder: order,
-                tradeNo,
-                showPayment: true, //展示支付组件
-            })
-        }
-    },
-    //  返回首页
-    getback() {
-        wx.navigateTo({
-            url: '../../../pages/index/index',
-        });
-    },
-    //支付反馈
-    async acceptResult(e) {
-        let {
-            activeOrder
-        } = this.data
-        let that = this
-        let {
-            params,
-            no
-        } = e.detail;
-        that.setData({
-            showPayment: false
-        })
-        try {
-            if (params == "ok") {
-                activeOrder.set("status", 100)
-                activeOrder.set("isPay", true)
-                await activeOrder.save()
-                wx.showToast({
-                    title: '支付成功',
-                    icon: 'none',
-                    duration: 1500,
-                    mask: false,
-                });
-                wx.navigateBack({
-                    delta: 1,
-                })
-                // this.formSubmit()
-            } else {
-                wx.showToast({
-                    title: '支付失败,取消订单',
-                    icon: 'none',
-                    duration: 1500,
-                    mask: false,
-                });
-            }
-        } catch (error) {
-            console.log(error)
-            wx.showToast({
-                title: "支付失败",
-                icon: "error",
-                duration: 1500,
-            });
-            wx.hideLoading()
-        }
-    },
-    //发送短信
-    formSubmit() {
-        wx.request({
-            url: 'https://server.fmode.cn/api/apig/message',
-            method: "post", //请求方式
-            data: { mobile: this.data.room.shop.mobile, company: company, }, //templateId:id,
-            success(res) {
-                console.log(res);
-            }
+        setTimeout(() => {
+          wx.hideLoading()
+          wx.redirectTo({
+            url: '/nova-tourism/pages/my/my-order/index?active=0',
+          })
+        }, 1000);
+      } catch (error) {
+        wx.showToast({
+          title: '保存订单出错,请联系客服核对订单',
+          icon: 'none'
         })
-    },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
+      }
+    } else {
+      wx.showToast({
+        title: '支付失败',
+        icon: 'none'
+      })
+    }
+  },
+
+  /**计算总价 */
+  getTotalPrice() {
+    let {
+      room,
+      count
+    } = this.data
+    let totalPrice = parseFloat(room?.price) * parseFloat(count)
+    this.setData({
+      totalPrice: parseFloat(totalPrice.toFixed(2) || 0) || 0
+    })
+  },
+  /**获取日期格式 */
+  formatDate(date) {
+    date = new Date(date);
+    const today = new Date();
+    const month = date.getMonth() + 1;
+    const day = date.getDate();
+    const weekDays = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
+    const weekDay = weekDays[date.getDay()];
+    let dateDescription = '';
+    if (date.toDateString() === today.toDateString()) {
+      dateDescription = '今天';
+    } else if (date.toDateString() === new Date(today.getTime() + 86400000).toDateString()) {
+      dateDescription = '明天';
+    } else {
+      dateDescription = weekDay;
+    }
+    return `${month}月${day}日 ${dateDescription}`;
+  },
+  /** 发送短信*/
+  formSubmit() {
+    wx.request({
+      url: 'https://server.fmode.cn/api/apig/message',
+      method: "post", //请求方式
+      data: {
+        company: 'EbxZUK5lBI',
+        mobile: '15279240198',
+        templateId: '28754',
+        apiName: 'message',
+      },
+      success(res) {
+        console.log(res);
+      }
+    })
+  },
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  },
 
-    },
-    //开日历
-    onDisplay() {
-        this.setData({
-            show: true
-        });
-    },
-    //关日历
-    onClose() {
-        this.setData({
-            show: false
-        });
-    },
-    //选好日期点击完成后
-    onConfirm(event) {
-        const [start, end] = event.detail;
-        this.setData({
-            show: false,
-            startTime:start,
-            endTime:end,
-        });
-        this.getdate()
-    },
 })

+ 14 - 14
nova-tourism/pages/homestay/homestay-order2/index.wxml

@@ -1,28 +1,26 @@
 <!--nova-tourism/pages/homestay/homestay-order2/index.wxml-->
 <nav type="back" background-color="#ffffff" frontColor="#000000" title="{{room.shop.storeName}}" />
-<view class="all" style="height: {{contentHeight}}rpx;">
+<view class="all" >
     <view class="timebox" bindtap="onDisplay">
         <view class="time1">{{date}}</view>
         <view>{{count}}晚</view>
     </view>
-    <van-calendar show="{{ show }}" show-confirm="{{ true }}" confirm-text="完成" confirm-disabled-text='完成' type="range" bind:close="onClose" bind:confirm="onConfirm" color='#46a9a4' position='bottom' />
+    <van-calendar formatter="{{ formatter }}" show="{{ show }}" show-confirm="{{ true }}" confirm-text="完成" confirm-disabled-text='完成' type="range" bind:close="onClose" bind:confirm="onConfirm" color='#46a9a4' position='bottom' min-date="{{scope.minDate}}"  max-date="{{scope.maxDate}}"/>
 
     <view class="roombox">
         <image src="{{room.images[0]}}"></image>
         <view class="room">
             <view class="room-name">{{room.name}}</view>
             <view class="room-tag">
-                <block wx:for="{{room.tags}}">
+                <block wx:for="{{room.tags}}" wx:key="index">
                     {{item}}
                 </block>
             </view>
-            <view class="room-text">{{date2}}</view>
+            <view class="room-text">{{date02}}</view>
         </view>
     </view>
     <van-divider customStyle="margin-top: 28rpx;margin-bottom:14rpx; border-color:'#B1B1B1' " />
     <van-cell-group>
-        <!-- <van-field  label-class='lable' placeholder-style='font-weight: 500;' custom-style='padding-top:0rpx;padding-bottom:0rpx;' input-class='input' value="{{ name }}" required label="住客姓名" placeholder="请输入姓名" custom-style='padding-top:0rpx;padding-bottom:0rpx' bind:change='getname' border="{{ false }}" />
-        <van-field label-class='lable' placeholder-style='font-weight: 500;'  custom-style='padding-top:0rpx;padding-bottom:0rpx;' input-class='input' value="{{ mobile }}" error-message="{{error_message}}" required label="联系电话" placeholder="请输入电话" border="{{ false }}" bind:blur='getmobile' /> -->
         <view class="inputbox">
             <view class="inputbox2">
                 <view class="in-tex">住客姓名
@@ -35,7 +33,7 @@
                     <view class="red">*</view>
                     +86
                 </view>
-                <input model:value="{{ mobile }}" bindblur='getmobile' class="input" type="text"  placeholder-style="font-weight:500" placeholder="请输入联系电话" />
+                <input model:value="{{ mobile }}"  class="input" type="text"  placeholder-style="font-weight:500" placeholder="请输入联系电话" />
             </view>
         </view>
     </van-cell-group>
@@ -43,7 +41,7 @@
     <view class="benefitbox">
         <view class="benefitbox1">本单可享</view>
         <view class="benefitbox2">
-            <view class="benefitbox2-text">优惠</view>
+            <view class="benefitbox2-text">优惠</view>
             <view class="benefitbox2-text2">
                 减¥0
                 <van-icon name="arrow" size='30rpx' color="gray" />
@@ -61,7 +59,7 @@
                 减¥0
             </view>
         </view>
-    </view>
+    </view> 
     <van-divider customStyle="margin: 20rpx;border-color:'#D9D9D9' " />
     <view class="benefitbox2">
         <view class="benefitbox2-text">发票</view>
@@ -70,14 +68,16 @@
         </view>
     </view>
 
-
 </view>
 <view class="subbox">
     <view class="subbox1" bindtap="getback">首页</view>
-    <view class="subbox2" bindtap="submit">
-        <!-- <view class="subbox2_1">优惠0</view> -->
-        <view class="subbox2_2">实付款¥{{count*room.price}}</view>
+    <view class="subbox2" bindtap="submitOrder">
+        <view class="subbox2_2">实付款¥{{totalPrice}}</view>
     </view>
+    <!-- <view class="subbox2" bindtap="submit">
+        <view class="subbox2_1">优惠0</view>
+        <view class="subbox2_2">实付款¥{{count*room.price}}</view>
+    </view> -->
 </view>
 <!-- 支付组件 -->
-<payment style="z-index: 99999;" id='payMent' show="{{showPayment}}" tradeNo="{{tradeNo}}" price="{{count*room.price}}" bind:payResult='acceptResult' showType="all" />
+<payment style="z-index: 99999;" id='payMent' show="{{showPayment}}" tradeNo="{{tradeNo}}" price="{{totalPrice}}" bind:payResult='acceptResult' showType="all" />

+ 32 - 48
nova-tourism/pages/index/index.js

@@ -36,41 +36,6 @@ Page({
     let str = decodeURIComponent(q);
     let obj = this.getParaName(str)
     console.log(obj);
-    // if ((obj && obj.invite) || invite) {
-    //   wx.setStorageSync("invite", obj && obj.invite || invite);
-    //   let user = Parse.User.current()
-    //   if (user && user.id) {
-    //     invite = wx.getStorageSync("invite")
-    //     console.log('invite=====>', invite);
-    //     let query = new Parse.Query("_User")
-    //     query.include("invite")
-    //     let res = await query.get(user.id)
-    //     let userJSON = res.toJSON()
-
-    //     //查询邀请人user
-    //     let queryUserInvite = new Parse.Query("_User")
-    //     queryUserInvite.equalTo('objectId',invite)
-    //     let result = await queryUserInvite.first()
-    //     if (result && result.id && result.get('invite')?.id == res.id) {
-    //       console.log('邀请人不能是自己的下级')
-    //     }
-    //     // 用户没有邀请人, 并且邀请人不是自己
-    //     else if (!userJSON.invite && userJSON.objectId != invite && !userJSON.agentLevel) {
-    //       console.log('上下级绑定成功');
-    //       user.set('invite', {
-    //         __type: "Pointer",
-    //         className: "_User",
-    //         objectId: invite
-    //       })
-    //       user.set('agent', {
-    //         __type: "Pointer",
-    //         className: "_User",
-    //         objectId: invite
-    //       })
-    //     }
-    //     await res.save()
-    //   }
-    // }
     if(path){
       wx.navigateTo({
         url: path,
@@ -123,7 +88,26 @@ Page({
     })
     return obj
   },
-
+  async agentParent(){
+    if(!Parse.User.current()?.id) return
+    wx.request({
+      url: 'https://server.fmode.cn/api/user/agent/parent',
+      data: {
+        uid: Parse.User.current()?.id
+      },
+      header: {
+        'content-type': 'application/json'
+      },
+      method: 'POST',
+      dataType: 'json',
+      responseType: 'text',
+      success: (result) => {
+        console.log(result);
+      },
+      fail: () => {},
+      complete: () => {}
+    });
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -135,6 +119,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    this.agentParent()
     this.getRenew()
     let {
       active
@@ -145,25 +130,24 @@ Page({
     }
     switch (active) {
       case 0:
-        // componentPage.refresh()
         break;
       case 1:
-        componentPage.setData({
-          scate: []
-        })
-        componentPage.refresh()
+        // componentPage.setData({
+        //   scate: []
+        // })
+        // componentPage.refresh()
 
         break;
       case 2:
-        componentPage.setData({
-          allCheck: false,
-          cartList: [],
-          totalPrice: 0.00,
-        })
-        componentPage.getShopcart()
+        // componentPage.setData({
+        //   allCheck: false,
+        //   cartList: [],
+        //   totalPrice: 0.00,
+        // })
+        // componentPage.getShopcart()
         break;
       case 3:
-        componentPage.refresh()
+        // componentPage.refresh()
         break;
     }
   },

+ 160 - 160
nova-tourism/pages/my/merchant/login/index.js

@@ -2,171 +2,171 @@ const Parse = getApp().Parse;
 const app = getApp();
 const company = getApp().globalData.company
 Page({
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        username: "",
-        password: "",
-        confirmPassword: "",
-        code: "",
-        rightCode: "",
-        pageType: "login", //register,login ,forget
-        time: 60000,
-        waitStatus: false,
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    username: "",
+    password: "",
+    confirmPassword: "",
+    code: "",
+    rightCode: "",
+    pageType: "login", //register,login ,forget
+    time: 60000,
+    waitStatus: false,
 
-    },
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      activeColor: getApp().globalData.activeColor || '#229293'
+    })
+  },
+  onClick(e) {
+    let {
+      type,
+      key,
+      value
+    } = e.currentTarget.dataset;
+    switch (type) {
+      case "register":
         this.setData({
-            activeColor: getApp().globalData.activeColor || '#229293'
-          })
-    },
-    onClick(e) {
-        let {
-            type,
-            key,
-            value
-        } = e.currentTarget.dataset;
-        switch (type) {
-            case "register":
-                this.setData({
-                    [key]: value,
-                });
-                break;
-            case "forget":
-                this.setData({
-                    [key]: value,
-                });
-                break;
-            case "login":
-                this.setData({
-                    [key]: value,
-                });
-                break;
-        }
-    },
+          [key]: value,
+        });
+        break;
+      case "forget":
+        this.setData({
+          [key]: value,
+        });
+        break;
+      case "login":
+        this.setData({
+          [key]: value,
+        });
+        break;
+    }
+  },
 
-    /* 用户登录 */
-    async userLogin() {
-        if (this.data.username.trim() == '' || this.data.password.trim() == "") {
-            wx.showToast({
-                icon: "none",
-                title: "请填写用户名/密码",
-            });
-            return;
+  /* 用户登录 */
+  async userLogin() {
+    if (this.data.username.trim() == '' || this.data.password.trim() == "") {
+      wx.showToast({
+        icon: "none",
+        title: "请填写用户名/密码",
+      });
+      return;
+    }
+    wx.request({
+      url: "https://server.fmode.cn/api/auth/store_user",
+      method: "post", //请求方式
+      data: {
+        username: this.data.username,
+        password: this.data.password,
+        company: company,
+      },
+      success(res) {
+        console.log(res)
+        if (res && res.data && res.data.code == 200) {
+          // wx.showToast({
+          //     icon: "none",
+          //     title: "登录成功,页面跳转中",
+          // });
+          let store = res.data.data.store
+          let merchant = res.data.data.merchant
+          wx.setStorageSync('merchant', merchant)
+          wx.setStorageSync('store', store)
+          wx.reLaunch({
+            url: `/nova-tourism/pages/my/merchant/merchant-home/index?type=${store.type}`,
+          });
+        } else {
+          wx.showToast({
+            icon: "none",
+            title: res.data.mess
+          });
         }
-        wx.request({
-            url: "https://server.fmode.cn/api/auth/store_user",
-            method: "post", //请求方式
-            data: {
-                username: this.data.username,
-                password: this.data.password,
-                company: company,
-            },
-            success(res) {
-                console.log(res)
-                if(res && res.data &&  res.data.code == 200) {
-                    // wx.showToast({
-                    //     icon: "none",
-                    //     title: "登录成功,页面跳转中",
-                    // });
-                    let store = res.data.data.store
-                    let merchant = res.data.data.merchant
-                    wx.setStorageSync('merchant', merchant)
-                    wx.setStorageSync('store', store)
-                    wx.reLaunch({
-                        url: `/nova-tourism/pages/my/merchant/merchant-home/index?type=${store.type}`,
-                    });
-                }else {
-                    wx.showToast({
-                        icon: "none",
-                        title: res.data.mess
-                    });
-                }
-            },
-            fail(error) {
-                wx.showToast({
-                    icon: "none",
-                    title: error.data.mess
-                });
-                return
-            }
-        })
-        // let User = new Parse.Query('User')
-        // User.equalTo('username', this.data.username)
-        // User.equalTo('company', company)
-        // let user = await User.first()
-        // if (user && user.id) {
-        //     let store = await this.checkAdmin(user)
-        //     if (!store) {
-        //         wx.showToast({
-        //             icon: "none",
-        //             title: "非商户用户,登录失败",
-        //         });
-        //         return
-        //     }
-        //     wx.showToast({
-        //         icon: "none",
-        //         title: "登录成功,页面跳转中",
-        //     });
-        //     wx.setStorageSync('merchant', user)
-        //     wx.setStorageSync('store', store)
-        //     wx.reLaunch({
-        //         url: `/nova-tourism/pages/my/merchant/merchant-home/index?type=${store.type}`,
-        //     });
-        // } else {
-        //     wx.showToast({
-        //         title: "该商户不存在",
-        //         icon: "none",
-        //     });
-        // }
+      },
+      fail(error) {
+        wx.showToast({
+          icon: "none",
+          title: error.data.mess
+        });
+        return
+      }
+    })
+    // let User = new Parse.Query('User')
+    // User.equalTo('username', this.data.username)
+    // User.equalTo('company', company)
+    // let user = await User.first()
+    // if (user && user.id) {
+    //     let store = await this.checkAdmin(user)
+    //     if (!store) {
+    //         wx.showToast({
+    //             icon: "none",
+    //             title: "非商户用户,登录失败",
+    //         });
+    //         return
+    //     }
+    //     wx.showToast({
+    //         icon: "none",
+    //         title: "登录成功,页面跳转中",
+    //     });
+    //     wx.setStorageSync('merchant', user)
+    //     wx.setStorageSync('store', store)
+    //     wx.reLaunch({
+    //         url: `/nova-tourism/pages/my/merchant/merchant-home/index?type=${store.type}`,
+    //     });
+    // } else {
+    //     wx.showToast({
+    //         title: "该商户不存在",
+    //         icon: "none",
+    //     });
+    // }
 
-    },
-    async checkAdmin(user) {
-        let ShopStore = new Parse.Query('ShopStore')
-        ShopStore.notEqualTo('isDeleted', "true")
-        ShopStore.equalTo('user', user.id)
-        ShopStore.equalTo('company', company)
-        let store = await ShopStore.first()
-        if (store && store.id) {
-            return store
-        }
-        return false
-    },
+  },
+  async checkAdmin(user) {
+    let ShopStore = new Parse.Query('ShopStore')
+    ShopStore.notEqualTo('isDeleted', "true")
+    ShopStore.equalTo('user', user.id)
+    ShopStore.equalTo('company', company)
+    let store = await ShopStore.first()
+    if (store && store.id) {
+      return store
+    }
+    return false
+  },
 
-    inputChange(event) {
-        if (event.currentTarget.dataset.type == "username") {
-            this.setData({
-                username: event.detail.value,
-            });
-            return;
-        }
-        if (event.currentTarget.dataset.type == "password") {
-            this.setData({
-                password: event.detail.value,
-            });
-            return;
-        }
-        if (event.currentTarget.dataset.type == "code") {
-            this.setData({
-                code: event.detail.value,
-            });
-            return;
-        }
-        if (event.currentTarget.dataset.type == "confirmPassword") {
-            this.setData({
-                confirmPassword: event.detail.value,
-            });
-            return;
-        }
-    },
+  inputChange(event) {
+    if (event.currentTarget.dataset.type == "username") {
+      this.setData({
+        username: event.detail.value,
+      });
+      return;
+    }
+    if (event.currentTarget.dataset.type == "password") {
+      this.setData({
+        password: event.detail.value,
+      });
+      return;
+    }
+    if (event.currentTarget.dataset.type == "code") {
+      this.setData({
+        code: event.detail.value,
+      });
+      return;
+    }
+    if (event.currentTarget.dataset.type == "confirmPassword") {
+      this.setData({
+        confirmPassword: event.detail.value,
+      });
+      return;
+    }
+  },
 
-    async goBack() {
-        wx.navigateBack({
-            delta: 1,
-        });
-    },
+  async goBack() {
+    wx.navigateBack({
+      delta: 1,
+    });
+  },
 })

+ 0 - 2
nova-tourism/pages/my/merchant/login/index.wxml

@@ -8,7 +8,5 @@
 					<input  placeholder="密码"  style="border: 2rpx #f1f1f1 solid;" password model:value="{{password}}"   />
 				</view>
 				<view class='text' class='btn-login' bindtap='userLogin' style="{{activeColor}}">登录</view>
-				
 		</block>
-
 </view>

+ 10 - 2
nova-tourism/pages/my/merchant/merchant-home/index.js

@@ -3,6 +3,7 @@ const company = getApp().globalData.company
 const util = require('../../../../../utils/util.js')
 const dateF = require('../../../../../utils/date')
 const req = require('../../../../../utils/request')
+let uid = Parse.User.current()?.id
 Page({
 
     /**
@@ -16,13 +17,15 @@ Page({
         todayCount: 0,
         totalPrice: 0,
         todayPrice: 0,
-        withdraw: 0
+        withdraw: 0,
+        uid:null,
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+      this.setData({uid:wx.getStorageSync('merchant')?.objectId||uid})
         console.log(options)
         var TIME = util.formatTime(new Date()); //当前时间
         console.log(TIME);
@@ -287,7 +290,12 @@ Page({
         })
     },
 
-
+    gourl(e) {
+      const url = e.currentTarget.dataset.url;
+      wx.navigateTo({
+          url: `${url}`,
+      });
+  },
 
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 86 - 71
nova-tourism/pages/my/merchant/merchant-home/index.wxml

@@ -1,51 +1,51 @@
 <nav type="back" url="/nova-tourism/pages/index/index?active=4" background-color="#46a9a4" title="商户端" />
 <view class="box" style="color: #382E2E;">
-    <view class="store">
-        <image class="store-img" src="{{store.cover}}" />
-        <view class="store-box">
-            <view class="store-name">{{store.storeName}}</view>
-            <!-- <view class="store-score">
+  <view class="store">
+    <image class="store-img" src="{{store.cover}}" />
+    <view class="store-box">
+      <view class="store-name">{{store.storeName}}</view>
+      <!-- <view class="store-score">
                 <van-rate readonly value="{{ store.score }}" size="{{ 15 }}" color="#fd863a" allow-half />
                 {{store.score}}
             </view> -->
-            <view class="draw_box" style="margin-top: 10rpx;">
-                <view class="withdraw" bindtap="toWithdraw">
-                    提现
-                </view>
-                <view>
-                    可提现 {{earnings}} 元
-                </view>
+      <view class="draw_box" style="margin-top: 10rpx;">
+        <view class="withdraw" bindtap="toWithdraw">
+          提现
+        </view>
+        <view>
+          可提现 {{earnings}} 元
+        </view>
 
-            </view>
+      </view>
 
 
-        </view>
     </view>
-    <view class="business">
-        <view class="business-x">
-            <view class="order-number">
-                <view class="order-title">总订单数</view>
-                <view class="order-titles">{{totalCount}}</view>
-            </view>
-            <view class="order-today">
-                <view class="order-title">今日订单数</view>
-                <view class="order-titles">{{todayCount}}</view>
-            </view>
-        </view>
-        <view class="business-y">
-            <view class="order-number">
-                <view class="order-title">总营业额</view>
-                <view class="order-titles">{{totalPrice}}</view>
-            </view>
-            <view class="order-today">
-                <view class="order-title">今日营业额</view>
-                <view class="order-titles">{{todayPrice}}</view>
-            </view>
-        </view>
+  </view>
+  <view class="business">
+    <view class="business-x">
+      <view class="order-number">
+        <view class="order-title">总订单数</view>
+        <view class="order-titles">{{totalCount}}</view>
+      </view>
+      <view class="order-today">
+        <view class="order-title">今日订单数</view>
+        <view class="order-titles">{{todayCount}}</view>
+      </view>
+    </view>
+    <view class="business-y">
+      <view class="order-number">
+        <view class="order-title">总营业额</view>
+        <view class="order-titles">{{totalPrice}}</view>
+      </view>
+      <view class="order-today">
+        <view class="order-title">今日营业额</view>
+        <view class="order-titles">{{todayPrice}}</view>
+      </view>
     </view>
+  </view>
 
-    <view class="management">
-        <!-- <block wx:if="{{store.type=='catering'}}">
+  <view class="management">
+    <!-- <block wx:if="{{store.type=='catering'}}">
             <view class="box-title" bindtap="orderlist">
                 <view class="box-details">
                     <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/dkdoeo112500451.png" size="20"/>
@@ -54,16 +54,16 @@
                 <van-icon name="arrow" />
             </view>
         </block> -->
-        <block wx:if="{{store.type=='stay'}}">
-            <view class="box-title" bindtap="order2list">
-                <view class="box-details">
-                    <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/dkdoeo112500451.png" size="20"/>
-                    <view class="name">订单管理</view>
-                </view>
-                <van-icon name="arrow" />
-            </view>
-        </block>
-        <!-- <block wx:if="{{store.type=='shop'}}">
+    <block wx:if="{{store.type=='stay'}}">
+      <view class="box-title" bindtap="order2list">
+        <view class="box-details">
+          <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/dkdoeo112500451.png" size="20" />
+          <view class="name">订单管理</view>
+        </view>
+        <van-icon name="arrow" />
+      </view>
+    </block>
+    <!-- <block wx:if="{{store.type=='shop'}}">
             <view class="box-title" bindtap="order3list">
                 <view class="box-details">
                     <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/dkdoeo112500451.png" size="20"/>
@@ -72,14 +72,14 @@
                 <van-icon name="arrow" />
             </view>
         </block> -->
-        <view class="box-title" bindtap="account">
-            <view class="box-details">
-                <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/vbg148112459179.png" size="20"/>
-                <view class="name">账户管理</view>
-            </view>
-            <van-icon name="arrow" />
-        </view>
-        <!-- <view class="box-title" bindtap="comments"wx:if="{{store.type!='shop'}}">
+    <view class="box-title" bindtap="account">
+      <view class="box-details">
+        <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/vbg148112459179.png" size="20" />
+        <view class="name">账户管理</view>
+      </view>
+      <van-icon name="arrow" />
+    </view>
+    <!-- <view class="box-title" bindtap="comments"wx:if="{{store.type!='shop'}}">
             <view class="box-details">
                 <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/eb7p71112500348.png" size="20"/>
                 <view class="name">评价管理</view>
@@ -87,7 +87,7 @@
             <van-icon name="arrow" />
         </view> -->
 
-        <!-- <block wx:if="{{store.type=='catering'}}">
+    <!-- <block wx:if="{{store.type=='catering'}}">
             <view class="box-title" bindtap="package">
                 <view class="box-details">
                     <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/mujk1h112500264.png" size="20"/>
@@ -118,34 +118,49 @@
             </view>
 
         </block> -->
-        <block wx:if="{{store.type=='stay'}}">
+    <block wx:if="{{store.type=='stay'}}">
+      <view class="box-title" bindtap="roommanage">
+        <view class="box-details">
+          <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/7d11hf112459718.png" size="20" />
+          <view class="name">房型管理</view>
+        </view>
+        <van-icon name="arrow" />
+      </view>
+    </block>
+
+    <view class="box-title" data-url="/nova-tourism/pages/my/merchant/merchant-home/my-users/index" bindtap="gourl">
+      <view class="box-details">
+        <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/vbg148112459179.png" size="20" />
+        <view class="name">本店用户</view>
+      </view>
+      <van-icon name="arrow" />
+    </view>
+    <view class="box-title" data-url="/common-page/pages/sharing/index?path=yswx&uid={{uid}}" bindtap="gourl">
+      <view class="box-details">
+        <van-icon name="https://file-cloud.fmode.cn/EbxZUK5lBI/20241211/i18ml9095731989.png" size="20" />
+        <view class="name">推广本店</view>
+      </view>
+      <van-icon name="arrow" />
+    </view>
    
-            <view class="box-title" bindtap="roommanage">
-                <view class="box-details">
-                    <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/7d11hf112459718.png" size="20"/>
-                    <view class="name">房型管理</view>
-                </view>
-                <van-icon name="arrow" />
-            </view>
-        </block>
-        <block wx:if="{{store.type=='shop'}}">
-            <!-- <view class="box-title">商品管理</view> -->
-            <!-- <view class="box-title" bindtap="goods">
+    <block wx:if="{{store.type=='shop'}}">
+      <!-- <view class="box-title">商品管理</view> -->
+      <!-- <view class="box-title" bindtap="goods">
                 <view class="box-details">
                     <van-icon name="https://file-cloud.fmode.cn/sHNeVwSaAg/20230705/l1hdoe112459997.png" size="20"/>
                     <view class="name">商品管理</view>
                 </view>
                 <van-icon name="arrow" />
             </view> -->
-            <!-- <view class="box-title" bindtap="category">
+      <!-- <view class="box-title" bindtap="category">
                 <view class="box-details">
                     <van-icon name="gift-o" />
                     <view>类型管理</view>
                 </view>
                 <van-icon name="arrow" />
             </view> -->
-        </block>
-    </view>
+    </block>
+  </view>
 </view>
 <view class="bommon" bind:tap="codeVerify" style="color: #382E2E;">扫码核销</view>
 <view class="bommon" bind:tap="logout" style="color: #382E2E;">退出登录</view>

+ 92 - 0
nova-tourism/pages/my/merchant/merchant-home/my-users/index.js

@@ -0,0 +1,92 @@
+// nova-tourism/pages/my/merchant/merchant-home/my-users/index.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    users: [], //用户列表
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.agentParent()
+  },
+  async agentParent() {
+    if (!wx.getStorageSync('merchant')?.objectId) return
+    let that = this
+    let {users} = this.data
+    wx.request({
+      url: 'https://server.fmode.cn/api/user/agent/children',
+      data: {
+        uid: wx.getStorageSync('merchant')?.objectId,
+        limit:50,
+        skip:users?.length||0
+      },
+      header: {
+        'content-type': 'application/json'
+      },
+      method: 'POST',
+      dataType: 'json',
+      responseType: 'text',
+      success: (result) => {
+        console.log(result);
+        that.setData({
+          users:[...users,...(result?.data?.data||[])]
+        })
+      },
+      fail: () => {},
+      complete: () => {}
+    });
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+    this.agentParent()
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
nova-tourism/pages/my/merchant/merchant-home/my-users/index.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 17 - 0
nova-tourism/pages/my/merchant/merchant-home/my-users/index.less

@@ -0,0 +1,17 @@
+.ul{
+    .li{
+        display: flex;
+        align-items: center;
+        padding: 20rpx;
+        border-bottom: 1rpx solid rgb(226, 226, 226);
+        image{
+            width: 120rpx;
+            height: 120rpx;
+            border-radius: 100%;
+        }
+        view{
+            margin: 0 20rpx;
+        }
+    
+    }
+}

+ 7 - 0
nova-tourism/pages/my/merchant/merchant-home/my-users/index.wxml

@@ -0,0 +1,7 @@
+<nav type="back" background-color="#46a9a4" title="本店用户" />
+<view class="ul">
+  <view class="li" wx:for="{{users}}" wx:key="index">
+    <image src="{{item.avatar}}" mode="" />
+    <view>{{item.nickname||'微信用户'}}</view>
+  </view>
+</view>

+ 14 - 0
nova-tourism/pages/my/merchant/merchant-home/my-users/index.wxss

@@ -0,0 +1,14 @@
+.ul .li {
+  display: flex;
+  align-items: center;
+  padding: 20rpx;
+  border-bottom: 1rpx solid #e2e2e2;
+}
+.ul .li image {
+  width: 120rpx;
+  height: 120rpx;
+  border-radius: 100%;
+}
+.ul .li view {
+  margin: 0 20rpx;
+}

+ 268 - 206
nova-tourism/pages/my/my-order/index.js

@@ -1,233 +1,295 @@
 // nova-tourism/pages/my/my-order/index.js
 let Parse = getApp().Parse;
 const company = getApp().globalData.company
+const uid = Parse.User.current()?.id
+const dateF = require("../../../../utils/date")
+const req = require('../../../../utils/request')
+
 Page({
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        statusBarHeight: 0,
-        screenHeight: 0,
-        customHeight: 0,
-        bottomNavHeight: 0,
-        contentHeight: 0,
-
-
-        currentTab:0,
-
-        option: [{
-                text: '民宿订单',
-                value: '民宿'
-            },
-            {
-                text: '物品订单',
-                value: '物品'
-            },
-        ],
-        value: '民宿',
-        roomList: [],
-
-        show: false,
-        showid:null,
-    },
-    onClose() {
-        this.setData({
-            show: false,
-        }); // 关闭弹窗并重置标志位
-    },
-    ONShow(e) {
-        const id =e.currentTarget.dataset.item.objectId
-        this.setData({
-            showid:id,
-            show: true,
-        }); // 设置弹窗显示
-        console.log(this.data.showid);
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    currentTab: 0, //订单状态-页面(处理中0,进行中1,已完成2)
+    roomList: [],
+    show: false,
+    showid: null,
+    roomTabMap: {
+      0: "(100,500,601,602)", //已支付,申请退款,退款审核通过,退款已驳回
+      1: "(200,102,104)", //已入住,申请退房,退房被驳回
+      2: "(400,700,800,103)", //已退房,退款成功,已完成,退房成功
     },
-    //订单完成
-    async ordercom(e){
-        console.log(e.currentTarget.dataset.item.objectId);
-        let objectId = e.currentTarget.dataset.item.objectId
-        let newOrder = new Parse.Query('RoomOrder');
-        newOrder.equalTo('company', company);
-        newOrder.equalTo('objectId', objectId);
-        newOrder.notEqualTo('isDeleted', true);
-        let order = await newOrder.first();
-        console.log(order);
-        order.set('status',102)
-        try{
-            let saveDate = await order.save();
-            console.log('保存成功');
-            this.setData({
-                showid:null
-            })
-            this.getRoomOrder()
-        }catch (error) {
-            console.error("保存数据时出现错误:", error);
-        }
+    goodTabMap: {
+      0: "('200','500','601','602')", //已支付,申请退款,退款审核通过,退款已驳回
+      1: "('300')", //已发货
+      2: "('400','700','800')", //已收货,退款成功,订单完成
     },
+    order: [], //订单列表
+  },
+  onClose() {
+    this.setData({
+      show: false,
+    }); // 关闭弹窗并重置标志位
+  },
+  ONShow(e) {
+    const id = e.currentTarget.dataset.item.objectId
+    this.setData({
+      showid: id,
+      show: true,
+    }); // 设置弹窗显示
+    console.log(this.data.showid);
+  },
+  //订单完成
+  async ordercom(e) {
+    console.log(e.currentTarget.dataset.item.objectId);
+    let objectId = e.currentTarget.dataset.item.objectId
+    let newOrder = new Parse.Query('RoomOrder');
+    newOrder.equalTo('company', company);
+    newOrder.equalTo('objectId', objectId);
+    newOrder.notEqualTo('isDeleted', true);
+    let order = await newOrder.first();
+    console.log(order);
+    order.set('status', 102)
+    try {
+      let saveDate = await order.save();
+      console.log('保存成功');
+      this.setData({
+        showid: null
+      })
+      this.getRoomOrder()
+    } catch (error) {
+      console.error("保存数据时出现错误:", error);
+    }
+  },
 
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad: function (options) {
-        this.setData({
-            currentTab: Number(options.active)
-        })
-
-        const systemInfo = wx.getSystemInfoSync();
-        const statusBarHeight = systemInfo.statusBarHeight || 0;
-        const screenHeight = systemInfo.screenHeight || 0;
-        const custom = wx.getMenuButtonBoundingClientRect();
-        const customHeight = custom.height + 10 + 2 || 0;
-        const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
-        const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
-        this.setData({
-            statusBarHeight,
-            screenHeight,
-            customHeight,
-            bottomNavHeight,
-            contentHeight
-        });
-        this.getRoomOrder()
-    },
-    switchTab (e) {
-        const index = e.currentTarget.dataset.index;
-        this.setData({
-          currentTab: index,
-        });
-        if (this.data.value == '民宿') {
-            this.getRoomOrder()
-        } else {
-
-        }
-        console.log(this.data.currentTab, this.data.value);
-      },
-    //改变民宿或物品
-    change(e) {
-        console.log(this.data.value);
-        this.setData({
-            currentTab: 0
-        })
-        if (this.data.value == '民宿') {
-            this.getRoomOrder()
-        } else {
-
-        }
-    },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      currentTab: Number(options.active)
+    })
+    // this.getRoomOrder()
+    this.refersh()
+  },
+  async refersh() {
+    this.getOrder()
 
-    formatDate2(date1, date2) {
-        date1 = new Date(date1);
-        date2 = new Date(date2);
+  },
+  /**获取订单 */
+  async getOrder() {
+    let {
+      order,
+      currentTab,
+      roomTabMap,
+      goodTabMap
+    } = this.data
+    let rosql = `AND ro."status" IN ${roomTabMap[currentTab]}`
+    let gosql = `AND o."status" IN ${goodTabMap[currentTab]}`
+    let sql = `WITH "order" AS(
+    SELECT t1."objectId",t1."createdAt",t1."startTime",t1."endTime",t1."status",t1."totalPrice",sg."name",'order' AS "table",sg."image",sg."tag"::jsonb AS "tags",(t1."spec"::jsonb->'spec')::text AS "spec"
+    FROM (
+      SELECT o."objectId",o."createdAt",o."status"::text,o."totalPrice"::text,o."startTime",o."endTime",
+      jsonb_array_elements(o."targetObject")::json->>'objectId' AS "gid",spec.value AS "spec"
+      FROM "Order" o,
+      jsonb_each(o."specMap") AS spec (key, value)
+      WHERE o."company"='${company}'
+      AND o."isDeleted" IS NOT TRUE
+      AND o."user"='${uid}'
+      AND o."type"='scenery'
+      ${gosql}
+      AND o."isPay" IS TRUE
+    )t1
+    LEFT JOIN "ShopGoods" sg ON sg."objectId" = t1."gid"
+  ),
+  "room_order" AS(
+    SELECT ro."objectId",ro."createdAt",ro."startTime",ro."endTime",
+    ro."status"::text,ro."price"::text AS "totalPrice",r."name",store."storeName" AS "table",
+    r."images"->> 0 AS "image",r."tags"::jsonb AS "tags",''::text AS "spec"
+    FROM "RoomOrder" ro
+    LEFT JOIN "ShopRoom" r ON r."objectId"=ro."room" 
+    LEFT JOIN "ShopStore" store ON store."objectId"=r."shop"
+    WHERE ro."company"='${company}'
+    AND ro."isDeleted" IS NOT TRUE
+    AND ro."user"='${uid}'
+    AND ro."isPay" IS TRUE
+    ${rosql}
+  ),
+  "tog" AS (
+    SELECT * FROM "order"
+    UNION ALL
+    SELECT * FROM "room_order"
+  )
+  SELECT * FROM "tog" 
+  ORDER BY "tog"."createdAt" DESC 
+  LIMIT 20 OFFSET ${order?.length||0}`
+    // console.log(sql)
+    let d = await req.customSQL(sql) || []
+    d?.map(item => {
+      if (item.startTime && item.endTime) {
+        item.fromto = `${dateF.formatTime('YYYY年mm月dd日',item.startTime)}入住 - ${dateF.formatTime('YYYY年mm月dd日',item.endTime)}离店`
+      }
+      return item
+    })
+    console.log(d)
+    this.setData({
+      order: [...order, ...(d || [])]
+    })
+  },
+  /**切换状态 */
+  async switchTab(e) {
+    const index = e.currentTarget.dataset.index;
+    await this.setData({
+      currentTab: index,
+      order:[]
+    });
+   this.getOrder()
+  },
 
-        // 获取年份、月份和日期
-        const year1 = date1.getFullYear();
-        const month1 = date1.getMonth() + 1; // 月份从0开始,所以要加1
-        const day1 = date1.getDate();
 
-        const year2 = date2.getFullYear();
-        const month2 = date2.getMonth() + 1; // 月份从0开始,所以要加1
-        const day2 = date2.getDate();
 
-        // 返回格式化的字符串
-        return `${year1}年${month1}月${day1}日入住 - ${year2}年${month2}月${day2}日离店`;
-    },
-    async getRoomOrder() {
-        let Order = new Parse.Query('RoomOrder');
-        Order.equalTo('company', company);
-        Order.include('room');
-        Order.equalTo('user', Parse.User.current().id);
-        Order.include('shopStore');
-        if (this.data.currentTab == 0) {
-            Order.equalTo('status', 100)
-        }
-        if (this.data.currentTab == 1) {
-            Order.equalTo('status', 200);
-        }
-        if (this.data.currentTab == 2) {
-            Order.equalTo('status', 800);
-        }
-        // 添加排序条件
-        Order.descending('updatedAt');
-        let room = await Order.find();
-        let roomList = room.map(async item => {
-            let roomItme = item.toJSON();
-            roomItme.tiem = await this.formatDate2(roomItme.startTime.iso, roomItme.endTime.iso)
-            return roomItme
-        });
-        let roomList2 = await Promise.all(roomList);
-        this.setData({
-            roomList: roomList2
-        })
-        console.log(this.data.roomList);
-    },
-    gourl(e) {
-        const url = e.currentTarget.dataset.url;
-        const id = e.currentTarget.dataset.id;
-
-        // 构造要传递的信息
-        const info = {
-            objectId: id,
-            value:this.data.value
-        };
-
-        // 将信息转为查询字符串
-        const queryString = Object.keys(info)
-            .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(info[key])}`)
-            .join('&');
-
-        // 使用查询字符串跳转
-        wx.navigateTo({
-            url: `${url}?${queryString}`,
-        });
-    },
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () {
 
-    },
 
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
 
-    },
 
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide: function () {
 
-    },
 
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload: function () {
 
-    },
 
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh: function () {
 
-    },
 
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom: function () {
+  //改变民宿或物品
+  change(e) {
+    console.log(this.data.value);
+    this.setData({
+      currentTab: 0
+    })
+    if (this.data.value == '民宿') {
+      this.getRoomOrder()
+    } else {
 
-    },
+    }
+  },
+
+  formatDate2(date1, date2) {
+    date1 = new Date(date1);
+    date2 = new Date(date2);
+
+    // 获取年份、月份和日期
+    const year1 = date1.getFullYear();
+    const month1 = date1.getMonth() + 1; // 月份从0开始,所以要加1
+    const day1 = date1.getDate();
 
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage: function () {
+    const year2 = date2.getFullYear();
+    const month2 = date2.getMonth() + 1; // 月份从0开始,所以要加1
+    const day2 = date2.getDate();
 
+    // 返回格式化的字符串
+    return `${year1}年${month1}月${day1}日入住 - ${year2}年${month2}月${day2}日离店`;
+  },
+
+  async getRoomOrder() {
+    let Order = new Parse.Query('RoomOrder');
+    Order.equalTo('company', company);
+    Order.include('room');
+    Order.equalTo('user', Parse.User.current().id);
+    Order.include('shopStore');
+    if (this.data.currentTab == 0) {
+      Order.equalTo('status', 100)
+    }
+    if (this.data.currentTab == 1) {
+      Order.equalTo('status', 200);
+    }
+    if (this.data.currentTab == 2) {
+      Order.equalTo('status', 800);
     }
+    // 添加排序条件
+    Order.descending('updatedAt');
+    let room = await Order.find();
+    let roomList = room.map(async item => {
+      let roomItme = item.toJSON();
+      roomItme.tiem = await this.formatDate2(roomItme.startTime.iso, roomItme.endTime.iso)
+      return roomItme
+    });
+    let roomList2 = await Promise.all(roomList);
+    this.setData({
+      roomList: roomList2
+    })
+    console.log(this.data.roomList);
+  },
+  tourl(e){
+    let url = e.currentTarget.dataset.url
+    wx.navigateTo({
+      url: `${url}`,
+    });
+  },
+  gourl(e) {
+    const url = e.currentTarget.dataset.url;
+    const id = e.currentTarget.dataset.id;
+
+    // 构造要传递的信息
+    const info = {
+      objectId: id,
+      value: this.data.value
+    };
+
+    // 将信息转为查询字符串
+    const queryString = Object.keys(info)
+      .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(info[key])}`)
+      .join('&');
+
+    // 使用查询字符串跳转
+    wx.navigateTo({
+      url: `${url}?${queryString}`,
+    });
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    this.getOrder()
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
 })

+ 196 - 128
nova-tourism/pages/my/my-order/index.wxml

@@ -1,105 +1,162 @@
 <!--nova-tourism/pages/my/my-order/index.wxml-->
 <nav type="back" background-color="#ffffff" frontColor="#000000" title="我的订单" />
-<view class="all" style="height: {{contentHeight}}rpx;">
-    <view class="tabbos">
-        <view class="tabs">
-            <van-dropdown-menu active-color='#B2CEB9'>
-                <van-dropdown-item bind:change='change' model:value="{{ value }}" options="{{ option }}" />
-            </van-dropdown-menu>
-        </view>
+<view class="all">
+  <view class="tab-bar">
+    <view style="margin-left: 56rpx;" class="tab-item {{currentTab == 0? 'active' : ''}}" bindtap="switchTab" data-index="0">
+      处理中
+    </view>
+    <view style="margin-left: 60rpx;" class="tab-item {{currentTab == 1? 'active' : ''}}" bindtap="switchTab" data-index="1">
+      进行中
     </view>
+    <view style="margin-left: 60rpx;" class="tab-item {{currentTab == 2? 'active' : ''}}" bindtap="switchTab" data-index="2">
+      已完成
+    </view>
+  </view>
 
-    <view class="tab-bar">
-        <view style="margin-left: 56rpx;" class="tab-item {{currentTab == 0? 'active' : ''}}" bindtap="switchTab" data-index="0">
-            处理中
-        </view>
-        <view style="margin-left: 60rpx;" class="tab-item {{currentTab == 1? 'active' : ''}}" bindtap="switchTab" data-index="1">
-            进行中
+  <view>
+    <block wx:for="{{order}}" wx:key="index">
+    <!-- 民宿 -->
+      <block wx:if="{{item.table!='order'}}">
+        <view class="cardbox">
+          <view class="title">{{item.table||''}}
+            <!-- <view style="margin-left: auto;">已完成</view> -->
+          </view>
+          <view class="roombox">
+            <image src="{{item.image||'https://file-cloud.fmode.cn/EbxZUK5lBI/20250228/j4pbsl030249178.jpg?imageView2/1/w/200/h/200'}}"></image>
+            <view class="room">
+              <view class="room-name">{{item.name||''}}</view>
+              <view class="room-tag">
+                <block wx:for="{{item.tags}}" wx:for-item="tag" wx:key="index">
+                  {{tag}}
+                </block>
+              </view>
+              <view class="room-text">{{item.fromto||''}}</view>
+            </view>
+          </view>
+          <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
+          <view class="pricebox">
+            <view class="price">实付款¥{{item.totalPrice||0}}</view>
+          </view>
+          <view class="sumbitbox">
+            <view class="sumbit" bindtap="ONShow" data-item="{{item}}">申请退房</view>
+            <view wx:if="{{currentTab==0||currentTab==2}}" class="sumbit" style="margin-left: 15rpx;" bindtap="tourl" data-url="{{'/nova-tourism/pages/my/my-order/order-detail/index?value=民宿&objectId='+item.objectId}}" >订单详情</view>
+            <view wx:if="{{currentTab==1}}" class="sumbit" style="margin-left: 15rpx;" bindtap="tourl" data-url="{{'/nova-tourism/pages/my/my-order/order-detail/index?value=民宿&objectId='+item.objectId}}" >变更订单</view>
+          </view>
+          <van-dialog wx:if="{{showid==item.objectId}}" message='仅支持线下退款,确定退房吗?' data-item="{{item}}" show="{{ show }}"  show-cancel-button bind:cancel="onClose" bind:confirm="ordercom">
+          </van-dialog>
         </view>
-        <view style="margin-left: 60rpx;" class="tab-item {{currentTab == 2? 'active' : ''}}" bindtap="switchTab" data-index="2">
-            已完成
+      </block>
+      <!-- 礼物 -->
+      <block wx:else>
+        <view class="cardbox">
+          <view class="title">望仙礼遇</view>
+          <view class="roombox">
+            <image src="{{item.image||'https://file-cloud.fmode.cn//tmp/mqHkA2qV3Q8nca3dc59bad49de6e5ae57afa81d78ae8.jpeg?imageView2/1/w/200/h/200'}}"></image>
+            <view class="room">
+              <view class="room-name">{{item.name||''}}</view>
+              <view class="room-text2">{{item.spec||''}}</view>
+            </view>
+          </view>
+          <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
+          <view class="pricebox">
+          <block wx:for="{{item.tags}}" wx:for-item="tag" wx:key="index">
+            <view class="ciri">{{tag}}</view>
+          </block>
+            <view class="price">实付款¥{{item.totalPrice}}</view>
+          </view>
+          <view class="sumbitbox">
+            <view wx:if="{{currentTab==0||currentTab==2}}" class="sumbit" bindtap="tourl" data-url="{{'/nova-tourism/pages/my/my-order/order-detail/index?value=物品&objectId='+item.objectId}}" >订单详细</view>
+            <view wx:if="{{currentTab==1}}" class="sumbit" bindtap="tourl" data-url="{{'/nova-tourism/pages/my/my-order/order-detail/index?value=物品&objectId='+item.objectId}}">查看物流</view>
+          </view>
         </view>
-    </view>
-    <view wx:if="{{currentTab == 0}}">
-        <block wx:if="{{value=='民宿'}}" wx:for="{{roomList}}">
-            <view class="cardbox">
-                <view class="title">{{item.shopStore.storeName}}
-                    <view wx:if="{{item.status==100}}" style="margin-left: auto;">已支付</view>
-                </view>
-                <view class="roombox">
-                    <image src="{{item.room.images[0]}}"></image>
-                    <view class="room">
-                        <view class="room-name">{{item.room.name}}</view>
-                        <view class="room-tag">
-                            <block wx:for="{{item.room.tags}}">
-                                {{item}}
-                            </block>
-                        </view>
-                        <view class="room-text">{{item.tiem}}</view>
-                    </view>
-                </view>
-                <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
-                <view class="pricebox">
-                    <view class="price">实付款¥{{item.price}}</view>
-                </view>
-                <view class="sumbitbox">
-                    <view wx:if="{{item.status==100}}" class="sumbit" bindtap="ONShow" data-item="{{item}}">申请退房</view>
-                    <view class="sumbit" style="margin-left: 15rpx;" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">订单详细</view>
+      </block>
+    </block>
+  </view>
 
-                </view>
-                <van-dialog wx:if="{{showid==item.objectId}}" message='仅支持线下退款,确定退房吗?' data-item="{{item}}" show="{{ show }}" show-cancel-button bind:cancel="onClose" bind:confirm="ordercom">
-                </van-dialog>
-            </view>
-        </block>
-        <!-- <block wx:if="{{value=='物品'}}" wx:for="{{3}}">
-            <view class="cardbox">
-                <view class="title">望仙礼遇</view>
-                <view class="roombox">
-                    <image src="https://file-cloud.fmode.cn//tmp/mqHkA2qV3Q8nca3dc59bad49de6e5ae57afa81d78ae8.jpeg?imageView2/1/w/200/h/200"></image>
-                    <view class="room">
-                        <view class="room-name">房间描述房间描述</view>
-                        <view class="room-text2">紫色经典款</view>
-                    </view>
-                </view>
-                <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
-                <view class="pricebox">
-                    <view class="ciri">望仙次日达</view>
-                    <view class="price">实付款¥19999.99</view>
-                </view>
-                <view class="sumbitbox">
-                    <view class="sumbit" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">订单详细</view>
-                </view>
+
+
+
+
+  <view wx:if="{{currentTab == 0}}">
+    <block wx:if="{{value=='民宿'}}" wx:for="{{roomList}}" wx:key="index">
+      <view class="cardbox">
+        <view class="title">{{item.shopStore.storeName}}
+          <view wx:if="{{item.status==100}}" style="margin-left: auto;">已支付</view>
+        </view>
+        <view class="roombox">
+          <image src="{{item.room.images[0]}}"></image>
+          <view class="room">
+            <view class="room-name">{{item.room.name}}</view>
+            <view class="room-tag">
+              <block wx:for="{{item.room.tags}}" wx:key="index">
+                {{item}}
+              </block>
             </view>
-        </block> -->
-        <van-empty wx:if="{{value=='民宿'&&roomList.length==0}}" description="暂无订单" />
-        <van-empty wx:if="{{value=='物品'}}" description="暂无订单" />
-    </view>
-    <view wx:if="{{currentTab == 1}}">
-        <block wx:if="{{value=='民宿'}}" wx:for="{{roomList}}">
-            <view class="cardbox">
-                <view class="title">{{item.shopStore.storeName}}</view>
-                <view class="roombox">
-                    <image src="{{item.room.images[0]}}"></image>
-                    <view class="room">
-                        <view class="room-name">{{item.room.name}}</view>
-                        <view class="room-tag">
-                            <block wx:for="{{item.room.tags}}">
-                                {{item}}
-                            </block>
-                        </view>
-                        <view class="room-text">{{item.tiem}}</view>
-                    </view>
-                </view>
-                <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
-                <view class="pricebox">
-                    <view class="price">实付款¥{{item.price}}</view>
-                </view>
-                <view class="sumbitbox">
-                    <view class="sumbit" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">变更订单</view>
-                </view>
+            <view class="room-text">{{item.tiem}}</view>
+          </view>
+        </view>
+        <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
+        <view class="pricebox">
+          <view class="price">实付款¥{{item.price}}</view>
+        </view>
+        <view class="sumbitbox">
+          <view wx:if="{{item.status==100}}" class="sumbit" bindtap="ONShow" data-item="{{item}}">申请退房</view>
+          <view class="sumbit" style="margin-left: 15rpx;" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">订单详细</view>
+
+        </view>
+        <van-dialog wx:if="{{showid==item.objectId}}" message='仅支持线下退款,确定退房吗?' data-item="{{item}}" show="{{ show }}" show-cancel-button bind:cancel="onClose" bind:confirm="ordercom">
+        </van-dialog>
+      </view>
+    </block>
+    <block wx:if="{{value=='物品'}}" wx:for="{{3}}" wx:key="index">
+      <view class="cardbox">
+        <view class="title">望仙礼遇</view>
+        <view class="roombox">
+          <image src="https://file-cloud.fmode.cn//tmp/mqHkA2qV3Q8nca3dc59bad49de6e5ae57afa81d78ae8.jpeg?imageView2/1/w/200/h/200"></image>
+          <view class="room">
+            <view class="room-name">房间描述房间描述</view>
+            <view class="room-text2">紫色经典款</view>
+          </view>
+        </view>
+        <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
+        <view class="pricebox">
+          <view class="ciri">望仙次日达</view>
+          <view class="price">实付款¥19999.99</view>
+        </view>
+        <view class="sumbitbox">
+          <view class="sumbit" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">订单详细</view>
+        </view>
+      </view>
+    </block>
+    <van-empty wx:if="{{value=='民宿'&&roomList.length==0}}" description="暂无订单" />
+    <van-empty wx:if="{{value=='物品'}}" description="暂无订单" />
+  </view>
+  <view wx:if="{{currentTab == 1}}">
+    <block wx:if="{{value=='民宿'}}" wx:for="{{roomList}}" wx:key="index">
+      <view class="cardbox">
+        <view class="title">{{item.shopStore.storeName}}</view>
+        <view class="roombox">
+          <image src="{{item.room.images[0]}}"></image>
+          <view class="room">
+            <view class="room-name">{{item.room.name}}</view>
+            <view class="room-tag">
+              <block wx:for="{{item.room.tags}}" wx:key="index">
+                {{item}}
+              </block>
             </view>
-        </block>
-        <!-- <block wx:if="{{value=='物品'}}" wx:for="{{3}}">
+            <view class="room-text">{{item.tiem}}</view>
+          </view>
+        </view>
+        <van-divider customStyle="margin: 20rpx;border-color:'#B1B1B1' " />
+        <view class="pricebox">
+          <view class="price">实付款¥{{item.price}}</view>
+        </view>
+        <view class="sumbitbox">
+          <view class="sumbit" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">变更订单</view>
+        </view>
+      </view>
+    </block>
+    <!-- <block wx:if="{{value=='物品'}}" wx:for="{{3}}">
                 <view class="cardbox">
                     <view class="title">望仙礼遇</view>
                     <view class="roombox">
@@ -119,37 +176,37 @@
                     </view>
                 </view>
             </block> -->
-        <van-empty wx:if="{{value=='民宿'&&roomList.length==0}}" description="暂无订单" />
-        <van-empty wx:if="{{value=='物品'}}" description="暂无订单" />
-    </view>
-    <view wx:if="{{currentTab == 2}}">
-        <block wx:if="{{value=='民宿'}}" wx:for="{{roomList}}">
-            <view class="cardbox">
-                <view class="title">{{item.shopStore.storeName}}
-                    <view wx:if="{{item.status==800}}" style="margin-left: auto;">已完成</view>
-                </view>
-                <view class="roombox">
-                    <image src="{{item.room.images[0]}}"></image>
-                    <view class="room">
-                        <view class="room-name">{{item.room.name}}</view>
-                        <view class="room-tag">
-                            <block wx:for="{{item.room.tags}}">
-                                {{item}}
-                            </block>
-                        </view>
-                        <view class="room-text">{{item.tiem}}</view>
-                    </view>
-                </view>
-                <van-divider customStyle="margin-top: 20rpx;margin-bottom:22rpx border-color:'#D9D9D9' " />
-                <view class="pricebox">
-                    <view class="price">实付款¥{{item.price}}</view>
-                </view>
-                <view class="sumbitbox">
-                    <view class="sumbit" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">订单详细</view>
-                </view>
+    <van-empty wx:if="{{value=='民宿'&&roomList.length==0}}" description="暂无订单" />
+    <van-empty wx:if="{{value=='物品'}}" description="暂无订单" />
+  </view>
+  <view wx:if="{{currentTab == 2}}">
+    <block wx:if="{{value=='民宿'}}" wx:for="{{roomList}}" wx:key="index">
+      <view class="cardbox">
+        <view class="title">{{item.shopStore.storeName}}
+          <view wx:if="{{item.status==800}}" style="margin-left: auto;">已完成</view>
+        </view>
+        <view class="roombox">
+          <image src="{{item.room.images[0]}}"></image>
+          <view class="room">
+            <view class="room-name">{{item.room.name}}</view>
+            <view class="room-tag">
+              <block wx:for="{{item.room.tags}}" wx:key="index">
+                {{item}}
+              </block>
             </view>
-        </block>
-        <!-- <block wx:if="{{value=='物品'}}" wx:for="{{3}}">
+            <view class="room-text">{{item.tiem}}</view>
+          </view>
+        </view>
+        <van-divider customStyle="margin-top: 20rpx;margin-bottom:22rpx border-color:'#D9D9D9' " />
+        <view class="pricebox">
+          <view class="price">实付款¥{{item.price}}</view>
+        </view>
+        <view class="sumbitbox">
+          <view class="sumbit" bindtap="gourl" data-url="../my-order/order-detail/index" data-id="{{item.objectId}}">订单详细</view>
+        </view>
+      </view>
+    </block>
+    <!-- <block wx:if="{{value=='物品'}}" wx:for="{{3}}">
                 <view class="cardbox">
                     <view class="title">望仙礼遇</view>
                     <view class="roombox">
@@ -169,11 +226,22 @@
                     </view>
                 </view>
             </block> -->
-        <van-empty wx:if="{{value=='民宿'&&roomList.length==0}}" description="暂无订单" />
-        <van-empty wx:if="{{value=='物品'}}" description="暂无订单" />
-    </view>
-    <!-- 望仙礼遇 -->
-    <!-- <view class="box">
+    <van-empty wx:if="{{value=='民宿'&&roomList.length==0}}" description="暂无订单" />
+    <van-empty wx:if="{{value=='物品'}}" description="暂无订单" />
+  </view>
+
+
+
+
+
+
+
+
+
+
+  
+  <!-- 望仙礼遇 -->
+  <!-- <view class="box">
         <view class="wangbox">
             <view class="wang">望仙礼遇</view>
         </view>

+ 116 - 116
nova-tourism/pages/my/my-order/order-detail/index.wxml

@@ -1,132 +1,132 @@
 <!--nova-tourism/pages/my/my-order/order-detail/index.wxml-->
 <nav type="back" background-color="#ffffff" frontColor="#000000" title="订单详细" />
 <view class="all" style="height: {{contentHeight}}rpx;">
-    <view class="title" wx:if="{{roomList.status==100}}">订单处理中</view>
-    <view class="title" wx:if="{{roomList.status==200}}">订单进行中</view>
-    <view class="title" wx:if="{{roomList.status==800}}">订单已完成</view>
-    <view class="cardbox">
-        <block wx:if="{{value=='民宿'}}">
-            <view class="title2">{{roomList.shopStore.storeName}}</view>
-            <view class="roombox">
-                <image src="{{roomList.room.images[0]}}"></image>
-                <view class="room">
-                    <view class="room-name">{{roomList.room.name}}</view>
-                    <view class="room-tag">
-                        <block wx:for="{{roomList.room.tags}}">
-                            {{item}}
-                        </block>
-                    </view>
-                    <view class="room-text">{{roomList.tiem}}</view>
-                </view>
-            </view>
+  <view class="title" wx:if="{{roomList.status==100}}">订单处理中</view>
+  <view class="title" wx:if="{{roomList.status==200}}">订单进行中</view>
+  <view class="title" wx:if="{{roomList.status==800}}">订单已完成</view>
+  <view class="cardbox">
+    <block wx:if="{{value=='民宿'}}">
+      <view class="title2">{{roomList.shopStore.storeName}}</view>
+      <view class="roombox">
+        <image src="{{roomList.room.images[0]}}"></image>
+        <view class="room">
+          <view class="room-name">{{roomList.room.name}}</view>
+          <view class="room-tag">
+            <block wx:for="{{roomList.room.tags}}">
+              {{item}}
+            </block>
+          </view>
+          <view class="room-text">{{roomList.tiem}}</view>
+        </view>
+      </view>
 
-            <view class="textbox">
-                <view class="text1">
-                    <view class="tex1">实付款</view>
-                    <view class="tex2">¥{{roomList.price}}</view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">订单编号</view>
-                    <view class="tex3">
-                        <view class="tex3-1">{{roomList.orderNum}} |</view>
-                        <view class="tex3-2" bindtap="copyOrderNum">复制</view>
-                    </view>
-                </view>
-                <!-- <view class="text1">
+      <view class="textbox">
+        <view class="text1">
+          <view class="tex1">实付款</view>
+          <view class="tex2">¥{{roomList.price}}</view>
+        </view>
+        <view class="text1">
+          <view class="tex1">订单编号</view>
+          <view class="tex3">
+            <view class="tex3-1">{{roomList.orderNum}} |</view>
+            <view class="tex3-2" bindtap="copyOrderNum">复制</view>
+          </view>
+        </view>
+        <!-- <view class="text1">
                     <view class="tex1">付款时间</view>
                     <view class="tex3">
                         2024-12-03 12:05:43
                     </view>
                 </view> -->
-                <view class="text1">
-                    <view class="tex1">入住时间</view>
-                    <view class="tex3">
-                        {{roomList.startTime}}
-                    </view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">离店时间</view>
-                    <view class="tex3">
-                        {{roomList.endTime}}
-                    </view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">申请开票</view>
-                    <view class="tex3">
-                        本订单由商家开具,无法显示开票
-                    </view>
-                </view>
-                <view class="sumbitbox" wx:if="{{roomList.status==200}}">
-                    <view class="sumbit" bindtap="gourl">我要续住</view>
-                </view>
-            </view>
-        </block>
+        <view class="text1">
+          <view class="tex1">入住时间</view>
+          <view class="tex3">
+            {{roomList.startTime}}
+          </view>
+        </view>
+        <view class="text1">
+          <view class="tex1">离店时间</view>
+          <view class="tex3">
+            {{roomList.endTime}}
+          </view>
+        </view>
+        <view class="text1">
+          <view class="tex1">申请开票</view>
+          <view class="tex3">
+            本订单由商家开具,无法显示开票
+          </view>
+        </view>
+        <view class="sumbitbox" wx:if="{{roomList.status==200}}">
+          <view class="sumbit" bindtap="gourl">我要续住</view>
+        </view>
+      </view>
+    </block>
 
-        <block wx:if="{{value=='物品'}}">
-            <view class="title2">{{item.shopStore.storeName}}</view>
-            <view class="roombox">
-                <image src="{{roomList.room.images[0]}}"></image>
-                <view class="room">
-                    <view class="room-name">{{roomList.room.name}}</view>
-                    <view class="room-tag">
-                        <block wx:for="{{roomList.room.tags}}">
-                            {{item}}
-                        </block>
-                    </view>
-                    <view class="room-text">{{roomList.tiem}}</view>
-                </view>
-            </view>
-            <view class="textbox">
-                <view class="text1">
-                    <view class="tex1">实付款</view>
-                    <view class="tex2">¥1999.99</view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">订单编号</view>
-                    <view class="tex3">
-                        <view class="tex3-1">4150502930640735137 |</view>
-                        <view class="tex3-2">复制</view>
-                    </view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">付款时间</view>
-                    <view class="tex3">
-                        2024-12-03 12:05:43
-                    </view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">发货时间</view>
-                    <view class="tex3">
-                        2024-12-03 12:05:43
-                    </view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">物流单号</view>
-                    <view class="tex3">
-                        <view class="tex3-1">4150502930640735137 |</view>
-                        <view class="tex3-2">复制</view>
-                    </view>
-                </view>
-                <view class="text1">
-                    <view class="tex1">申请开票</view>
-                    <view class="tex3">
-                        本订单由商家开具,无法显示开票
-                    </view>
-                </view>
-                <view class="text2">
-                    <view class="tex1">收货地址</view>
-                    <view class="tex4">
-                        发货地址发货地址发货地址发货地址发货地址发货地址
-                    </view>
-                </view>
+    <block wx:if="{{value=='物品'}}">
+      <view class="title2">{{item.shopStore.storeName}}</view>
+      <view class="roombox">
+        <image src="{{roomList.room.images[0]}}"></image>
+        <view class="room">
+          <view class="room-name">{{roomList.room.name}}</view>
+          <view class="room-tag">
+            <block wx:for="{{roomList.room.tags}}">
+              {{item}}
+            </block>
+          </view>
+          <view class="room-text">{{roomList.tiem}}</view>
+        </view>
+      </view>
+      <view class="textbox">
+        <view class="text1">
+          <view class="tex1">实付款</view>
+          <view class="tex2">¥1999.99</view>
+        </view>
+        <view class="text1">
+          <view class="tex1">订单编号</view>
+          <view class="tex3">
+            <view class="tex3-1">4150502930640735137 |</view>
+            <view class="tex3-2">复制</view>
+          </view>
+        </view>
+        <view class="text1">
+          <view class="tex1">付款时间</view>
+          <view class="tex3">
+            2024-12-03 12:05:43
+          </view>
+        </view>
+        <view class="text1">
+          <view class="tex1">发货时间</view>
+          <view class="tex3">
+            2024-12-03 12:05:43
+          </view>
+        </view>
+        <view class="text1">
+          <view class="tex1">物流单号</view>
+          <view class="tex3">
+            <view class="tex3-1">4150502930640735137 |</view>
+            <view class="tex3-2">复制</view>
+          </view>
+        </view>
+        <view class="text1">
+          <view class="tex1">申请开票</view>
+          <view class="tex3">
+            本订单由商家开具,无法显示开票
+          </view>
+        </view>
+        <view class="text2">
+          <view class="tex1">收货地址</view>
+          <view class="tex4">
+            发货地址发货地址发货地址发货地址发货地址发货地址
+          </view>
+        </view>
 
-            </view>
-        </block>
+      </view>
+    </block>
 
-    </view>
+  </view>
 
-    <!-- 望仙礼遇 -->
-    <!-- <view class="box">
+  <!-- 望仙礼遇 -->
+  <!-- <view class="box">
         <view class="wang-cardbox">
             <block wx:for="{{4}}">
                 <view class="wang-card" bindtap="gourl2">

+ 0 - 7
nova-tourism/service/date.js

@@ -18,21 +18,14 @@ export default {
     getDayAll(starDay, endDay) {
         var arr = [];
         var dates = [];
-        // 设置两个日期UTC时间
         var db = new Date(starDay);
         var de = new Date(endDay);
-
-        // 获取两个日期GTM时间
         var s = db.getTime() - 24 * 60 * 60 * 1000;
         var d = de.getTime() - 24 * 60 * 60 * 1000;
-
-        // 获取到两个日期之间的每一天的毫秒数
         for (var i = s; i <= d;) {
             i = i + 24 * 60 * 60 * 1000;
             arr.push(parseInt(i))
         }
-
-        // 获取每一天的时间  YY-MM-DD
         for (var j in arr) {
             var time = new Date(arr[j]);
             var year = time.getFullYear(time);

+ 146 - 5
nova-tourism/service/request.js

@@ -1,13 +1,18 @@
 const req = require('../../utils/request')
-// let Parse = getApp().Parse;
 const company = getApp().globalData.company
+const dateF = require("../../utils/date")
+const Parse = getApp().Parse;
+const uid = Parse.User.current()?.id
+
+
 
 async function getStores(params) {
   let {
     val,
     uid,
     skip,
-    limit
+    limit,
+    isShow
   } = params
   let wh1 = val ? `AND (store."storeName" LIKE '%` + val + "%'" + 'OR store."storeAddress" LIKE ' + "'%" + val + "%')" : ``
   let sql = `SELECT * ,
@@ -28,14 +33,150 @@ async function getStores(params) {
   FROM "ShopStore" store
   WHERE "company" = '${company}'
   AND "type" = 'stay'
-  AND "isShow" = 'true'
+  AND "isVerified" IS TRUE
   AND "isDeleted" IS NOT TRUE
   ${wh1}
-  ORDER BY "iscollect"
+  ${isShow?`ORDER BY "isShow" DESC,"iscollect","index"`:`ORDER BY "iscollect","isShow" DESC,"index"`} 
   OFFSET ${skip ?? 0} LIMIT ${limit ?? 10}`
+  // console.log(sql)
   let res = await req.customSQL(sql);
   return res
 }
+/**获取收货地址 */
+async function getAddress() {
+  let address = null
+  let query = new Parse.Query("ShopAddress")
+  let addressId = wx.getStorageSync('addressId')
+  if (addressId) {
+    query.equalTo('objectId', addressId)
+  } else {
+    let user = Parse.User.current();
+    query.equalTo("user", user.id);
+    query.descending("is_default")
+  }
+  let res = await query.first()
+  if (res?.id) {
+    address = res?.toJSON() || null
+  }
+  return address
+}
+
+/**
+ * 获取当前房间被占用日期
+ * @param {*} rid 房间id
+ */
+async function getRoomOccupiaDate(rid) {
+  let query = new Parse.Query('RoomOrder')
+  query.equalTo('company', company)
+  query.notEqualTo('isDeleted', true)
+  query.equalTo('isPay', true)
+  query.equalTo('room',rid)
+  query.containedIn('status', [100, 200, 300, 500, 602, 102, 104])
+  query.greaterThan('endTime', new Date(new Date().setHours(14, 1, 0))) //查询订单结束时间大于今天14点01的订单
+  query.limit(180)
+  let d = await query.find()
+  let dList = []
+  for (let i in d) {
+    let item = d[i]
+    let list = getDateList(item?.get('startTime'), item?.get('endTime'))
+    dList = [...dList, ...list]
+  }
+  return dList
+}
+/**返回两个时间之中的 年-月-日 */
+function getDateList(startTime, endTime) {
+  startTime.setHours(0, 0, 0, 0);
+  endTime.setHours(0, 0, 0, 0);
+  let diff = endTime - startTime;
+  let diffDate = Math.ceil(diff / (1000 * 60 * 60 * 24));
+  let list = []
+  for (let i = 0; i < diffDate; i++) {
+    let current = new Date(startTime)
+    current.setDate(startTime.getDate() + i)
+    list.push({
+      year: current.getFullYear(),
+      month: current.getMonth(),
+      date: current.getDate()
+    })
+  }
+  return list
+}
+/**
+ * 判断当前时间段内该房间是否空闲
+ * @param {*} fromto 时间段{from,to}
+ * @param {*} rid 房间id
+ */
+async function isFree(fromto, rid) {
+  let {
+    from,
+    to
+  } = fromto
+  let endObj = {
+    start: new Date(from),
+    end: new Date(to),
+  }
+  let startObj = {
+    start: new Date(from),
+    end: new Date(to),
+  }
+  let middleObj = {
+    start: new Date(from),
+    end: new Date(to),
+  }
+
+  endObj.start.setHours(14, 1, 0);
+  endObj.end.setHours(14, 1, 0);
+  startObj.start.setHours(11, 59, 0);
+  startObj.end.setHours(13, 59, 0);
+  startObj.end.setDate(endObj.end.getDate()-1)
+  middleObj.start.setHours(11, 59, 0)
+  middleObj.end.setHours(13, 59, 0)
+
+  let query = new Parse.Query('RoomOrder')
+  query.equalTo('company', company)
+  query.notEqualTo('isDeleted', true)
+  query.equalTo('isPay', true)
+  query.containedIn('status', [100, 200, 300, 500, 602, 102, 104])
+  query.equalTo('room',rid)
+  //订单结束时间在范围内
+  let endQuery = new Parse.Query('RoomOrder')
+  endQuery.greaterThan('endTime', endObj.start)
+  endQuery.lessThan('endTime', endObj.end)
+  //订单开始时间在范围内
+  let startQuery = new Parse.Query('RoomOrder')
+  startQuery.greaterThanOrEqualTo('startTime', startObj.start)
+  startQuery.lessThanOrEqualTo('startTime', startObj.end)
+  //所选时间包含在订单时间之内
+  let middleQuery = new Parse.Query('RoomOrder')
+  middleQuery.lessThanOrEqualTo('startTime', middleObj.start)
+  middleQuery.greaterThanOrEqualTo('endTime',middleObj.end)
+
+  //查询fromto之间进行的订单
+  let mainQuery = Parse.Query.and(
+    query,Parse.Query.or(endQuery, startQuery,middleQuery)
+  )
+  
+  let c = await mainQuery.count()
+  if (c && c > 0) {
+    return false
+  } else {
+    return true
+  }
+}
+
+/**获取两个date的间隔天数 */
+function getDays(date1, date2) {
+  const d1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
+  const d2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
+  const timeDiff = Math.abs(d2.getTime() - d1.getTime()); //绝对值
+  const daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24)); //向上取整
+  return daysDiff;
+}
+
 module.exports = {
-  getStores
+  getStores,
+  getAddress,
+  isFree,
+  getRoomOccupiaDate,
+  getDays
 };

+ 3 - 67
project.private.config.json

@@ -1,73 +1,9 @@
 {
   "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
   "setting": {
-    "compileHotReLoad": false
-  },
-  "condition": {
-    "miniprogram": {
-      "list": [
-        {
-          "name": "民宿详细",
-          "pathName": "nova-tourism/pages/homestay/homestay-detail/index",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "卡卷包",
-          "pathName": "nova-tourism/pages/my/my-card/index",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "商品详细",
-          "pathName": "nova-tourism/pages/collect/collect-detail/index",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "商户端首页",
-          "pathName": "nova-tourism/pages/my/merchant/merchant-home/index",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "我的订单",
-          "pathName": "nova-tourism/pages/my/my-order/index",
-          "query": "active=0",
-          "scene": null
-        },
-        {
-          "name": "退款售后",
-          "pathName": "nova-tourism/pages/my/my-order/my-refund/index",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "退款详细",
-          "pathName": "nova-tourism/pages/my/my-order/my-refund/refund-detail/index",
-          "query": "",
-          "scene": null
-        },
-        {
-          "name": "民宿订单",
-          "pathName": "nova-tourism/pages/homestay/homestay-order2/index",
-          "query": "objectId=vhyskK4oxw&date_start=Fri%2520Dec%252013%25202024%252016%253A28%253A58%2520GMT%252B0800%2520(%25E4%25B8%25AD%25E5%259B%25BD%25E6%25A0%2587%25E5%2587%2586%25E6%2597%25B6%25E9%2597%25B4)&date_end=Sat%2520Dec%252014%25202024%252016%253A28%253A58%2520GMT%252B0800%2520(%25E4%25B8%25AD%25E5%259B%25BD%25E6%25A0%2587%25E5%2587%2586%25E6%2597%25B6%25E9%2597%25B4)",
-          "scene": null
-        },
-        {
-          "name": "民宿订单",
-          "pathName": "nova-tourism/pages/homestay/homestay-order2/index",
-          "query": "objectId=vhyskK4oxw&date_start=Fri%2520Dec%252013%25202024%252016%253A28%253A58%2520GMT%252B0800%2520(%25E4%25B8%25AD%25E5%259B%25BD%25E6%25A0%2587%25E5%2587%2586%25E6%2597%25B6%25E9%2597%25B4)&date_end=Sat%2520Dec%252014%25202024%252016%253A28%253A58%2520GMT%252B0800%2520(%25E4%25B8%25AD%25E5%259B%25BD%25E6%25A0%2587%25E5%2587%2586%25E6%2597%25B6%25E9%2597%25B4)",
-          "scene": null
-        },
-        {
-          "name": "物品详细",
-          "pathName": "nova-tourism/pages/collect/collect-detail/index",
-          "query": "",
-          "scene": null
-        }
-      ]
-    }
+    "compileHotReLoad": false,
+    "urlCheck": true
   },
+  "condition": {},
   "projectname": "nova-wapp"
 }

部分文件因为文件数量过多而无法显示