xll преди 2 дни
родител
ревизия
02b7b57272

+ 3 - 3
nova-tourism/components/homestay/index.js

@@ -138,10 +138,10 @@ Component({
         val: value || '',
         uid: uid,
         skip: storeList?.length || 0,
-        limit: 8
+        limit: 10
       })
-      let odd = d?.filter((item, index) => index % 2 != 0) || []
-      let even = d?.filter((item, index) => index % 2 == 0) || []
+      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 || [])]

+ 7 - 1
nova-tourism/pages/collect/collect-detail/index.js

@@ -607,7 +607,13 @@ Page({
       })
     }
   },
-
+/**预览图片 */
+preview(e){
+  let {
+    list,index
+  } = e.currentTarget.dataset
+  sev.previewImgs(list,index)
+},
   /** 跳转*/
   tourl(e) {
     const url = e.currentTarget.dataset.url

+ 2 - 2
nova-tourism/pages/collect/collect-detail/index.wxml

@@ -5,9 +5,9 @@
     <!-- 轮播图 -->
     <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">
+        <block wx:for="{{good.images}}" wx:for-index="img_index" wx:key="index" wx:for-item="img">
           <swiper-item class="img">
-            <image src="{{img}}" mode="aspectFill"></image>
+            <image data-list="{{good.images}}" data-index="{{img_index}}" bind:tap="preview" src="{{img}}" mode="aspectFill"></image>
           </swiper-item>
         </block>
       </swiper>

+ 1 - 1
nova-tourism/pages/collect/good-list/index.js

@@ -84,7 +84,7 @@ Page({
     CASE WHEN good."top"= 0 THEN 1 ELSE 0 END,
     good."top" ASC
     LIMIT 20 OFFSET ${goodList?.length||0}`
-    console.log(sql)
+    // console.log(sql)
     let list = await req.customSQL(sql)||[]
     console.log(list)
     this.setData({

+ 7 - 2
nova-tourism/pages/homestay/homestay-detail/index.js

@@ -322,8 +322,13 @@ Page({
 
 
 
-
-
+/**预览图片 */
+preview(e){
+  let {
+    list,index
+  } = e.currentTarget.dataset
+  sev.previewImgs(list,index)
+},
   /** 跳转*/
   tourl(e) {
     const url = e.currentTarget.dataset.url

+ 4 - 4
nova-tourism/pages/homestay/homestay-detail/index.wxml

@@ -4,9 +4,9 @@
   <!-- 轮播图 -->
   <view class="picturebox">
     <swiper autoplay="{{true}}" interval="{{3000}}" circular duration="{{500}}" class="img" bindchange="onSwiperChange">
-      <block wx:for="{{shopStore.image}}" wx:key="index" wx:for-item="img">
+      <block wx:for="{{shopStore.image}}" wx:key="img_index" wx:for-index="img_index" wx:for-item="img">
         <swiper-item class="img">
-          <image src="{{img}}" mode="aspectFill"></image>
+          <image data-list="{{shopStore.image}}" data-index="{{img_index}}" bind:tap="preview" src="{{img}}" mode="aspectFill"></image>
         </swiper-item>
       </block>
     </swiper>
@@ -113,9 +113,9 @@
     <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">
+          <block wx:for="{{chickRoom.images}}" wx:for-index="img_index" wx:key="img_index" wx:for-item="img">
             <swiper-item class="img">
-              <image src="{{img}}" mode="aspectFill"></image>
+              <image data-list="{{chickRoom.images}}" data-index="{{img_index}}" bind:tap="preview" src="{{img}}" mode="aspectFill"></image>
             </swiper-item>
           </block>
         </swiper>

+ 27 - 12
nova-tourism/pages/my/merchant/merchant-home/index.js

@@ -77,19 +77,33 @@ Page({
     let store_uid = wx.getStorageSync('merchant')?.objectId
     if (!store_uid) return
     let sql = `WITH t1 AS(--当前商户所绑定的用户
-    SELECT u."objectId" FROM "_User" u 
-    LEFT JOIN "ShopStore" s ON s."objectId" = u."store" 
-    WHERE s."user" = '${store_uid}'--当前店长uid
-  )
-  SELECT SUM((spec.value::json->>'invite-1')::FLOAT)
-  FROM "RoomOrder" o,
-  jsonb_each(o."incomeMap") AS spec (key, value)
-  WHERE o."company"='${company}'
-  AND o."isDeleted" IS NOT TRUE
-  AND o."isPay" IS TRUE
-  AND o."user" IN (SELECT "objectId" FROM t1)`
+      SELECT u."objectId" FROM "_User" u 
+      LEFT JOIN "ShopStore" s ON s."objectId" = u."store" 
+      WHERE s."user" = '${store_uid}'--当前店长uid
+    ),
+  room_o AS (
+    SELECT SUM((spec.value::json->>'invite-1')::FLOAT)
+    FROM "RoomOrder" o,
+    jsonb_each(o."incomeMap") AS spec (key, value)
+    WHERE o."company"='${company}'
+    AND o."isDeleted" IS NOT TRUE
+    AND o."isPay" IS TRUE
+    AND o."user" IN (SELECT "objectId" FROM t1)
+  ),
+  order_o AS (
+    SELECT SUM((spec.value::json->>'invite-1')::FLOAT)
+    FROM "Order" o,
+    jsonb_each(o."incomeMap") AS spec (key, value)
+    WHERE o."company"='${company}'
+    AND o."isDeleted" IS NOT TRUE
+    AND o."isPay" IS TRUE
+    AND o."user" IN (SELECT "objectId" FROM t1)
+  ),
+  sum_t2 AS (SELECT * FROM room_o UNION ALL SELECT * FROM order_o)
+  SELECT SUM(sum_t2."sum") FROM sum_t2`
     let data = await req.customSQL(sql)
-    console.log(data)
+    // console.log(sql)
+    // console.log(data)
     let profit = data[0]?.sum || 0
     await this.setData({
       profit
@@ -168,6 +182,7 @@ Page({
     let gift_sql = `select count("objectId") as "count", sum("totalPrice") as "totalPrice"  from "Order"
     where "company" = '${company}' and "store" = '${id}' and "isPay" = true and "createdAt" > '${time}' and "isDeleted" is not true
     group by "store"`
+    // console.log(gift_sql)
     let gift_data = await req.customSQL(gift_sql)
     let todayCount = parseFloat(data[0]?.count || 0) + parseFloat(gift_data[0]?.count || 0)
     let todayPrice = ((parseFloat(data[0]?.totalPrice || 0) * 1000) + (parseFloat(gift_data[0]?.totalPrice || 0) * 1000)) / 1000

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

@@ -36,10 +36,11 @@ async function getStores(params) {
   AND "isVerified" IS TRUE
   AND "isDeleted" IS NOT TRUE
   ${wh1}
-  ${isShow?`ORDER BY "isShow" DESC,"iscollect","index"`:`ORDER BY "iscollect","isShow" DESC,"index"`} 
-  OFFSET ${skip ?? 0} LIMIT ${limit ?? 10}`
+  ${isShow?`ORDER BY "isShow" DESC,"iscollect","index",store."createdAt" ASC`:`ORDER BY "iscollect","isShow" DESC,"index",store."createdAt" ASC`} 
+  OFFSET ${skip || 0} LIMIT ${limit || 10}`
   // console.log(sql)
   let res = await req.customSQL(sql);
+  // console.log(res)
   return res
 }
 /**获取收货地址 */
@@ -198,12 +199,22 @@ async function bindShop(uid, shop_id) {
     },
   });
 }
-
-
+/**
+ * 图片预览
+ * @param {*} urls urls
+ * @param {*} index 下标默认0
+ */
+async function previewImgs(urls,index){
+  // console.log(urls,index)
+  wx.previewImage({
+    current: urls[parseInt(index)||0],
+    urls: urls
+  });
+}
 module.exports = {
   getStores,
   getAddress,
   isFree,
   getRoomOccupiaDate,
-  getDays,bindShop
+  getDays,bindShop,previewImgs
 };

+ 1 - 20
project.private.config.json

@@ -4,25 +4,6 @@
     "compileHotReLoad": false,
     "urlCheck": true
   },
-  "condition": {
-    "miniprogram": {
-      "list": [
-        {
-          "name": "nova-tourism/pages/my/merchant/merchant-home/gift-order/index",
-          "pathName": "nova-tourism/pages/my/merchant/merchant-home/gift-order/index",
-          "query": "storeId=wMpDxcTLBL",
-          "launchMode": "default",
-          "scene": null
-        },
-        {
-          "name": "nova-tourism/pages/my/merchant/merchant-home/index",
-          "pathName": "nova-tourism/pages/my/merchant/merchant-home/index",
-          "query": "type=stay",
-          "launchMode": "default",
-          "scene": null
-        }
-      ]
-    }
-  },
+  "condition": {},
   "projectname": "nova-wapp"
 }