diff --git a/package.json b/package.json index 2566f28..55c8240 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "qmplaza", + "name": "qmgo", "version": "0.1.0", "private": true, "homepage": "./", @@ -29,7 +29,7 @@ }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build && coscmd config -a AKIDjS6at7fjTAVgggDNCrogRiZTSL304DPR -s FPPGCXr4xgZRLKDC8tZGp7HTZXlqx0gU -b lg-cjdqwkbo-1256266248 -r ap-shanghai && coscmd delete qmplaza -f && coscmd upload -r build qmplaza", + "build": "react-scripts build && coscmd config -a AKIDjS6at7fjTAVgggDNCrogRiZTSL304DPR -s FPPGCXr4xgZRLKDC8tZGp7HTZXlqx0gU -b lg-cjdqwkbo-1256266248 -r ap-shanghai && coscmd delete qmgo -f && coscmd upload -r build qmgo", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/src/components/DefaultPopup/DefaultPopup.js b/src/components/DefaultPopup/DefaultPopup.js index f2e481b..b3dc99d 100644 --- a/src/components/DefaultPopup/DefaultPopup.js +++ b/src/components/DefaultPopup/DefaultPopup.js @@ -201,7 +201,7 @@ const DefaultPopup = ({ setState(STATES.init); onClick(e); }} - wingHeight="calc(100vh - 400px)" + wingHeight="calc(100vh - 310px)" > )} diff --git a/src/components/HeadBar/HeadBar.scss b/src/components/HeadBar/HeadBar.scss index d0d6437..420bdd9 100644 --- a/src/components/HeadBar/HeadBar.scss +++ b/src/components/HeadBar/HeadBar.scss @@ -127,8 +127,8 @@ .label { display: inline-block; - flex: 0 0 20px; - text-align: center; + flex: 0 0 30px; + text-align: right; margin-left: 8px; font-style: normal; font-weight: bold; diff --git a/src/components/NavBottom/NavBottom.js b/src/components/NavBottom/NavBottom.js index 726f337..c16ec4a 100644 --- a/src/components/NavBottom/NavBottom.js +++ b/src/components/NavBottom/NavBottom.js @@ -107,16 +107,6 @@ const NavBottom = ({ }} /> )} -
{ - !paused && puaseOrResume(); - handleAR(end); - }} - > - - AR导航 -
{showNav ? (
setEnd()}> 导航动画
-
handleAR(shop)}> - AR实时导航 -
)} diff --git a/src/js/helpers/data-helper.js b/src/js/helpers/data-helper.js index 90ea32f..8738f7a 100644 --- a/src/js/helpers/data-helper.js +++ b/src/js/helpers/data-helper.js @@ -1,10 +1,10 @@ import axios from "axios"; import icons from "./image-helper"; let mallInfos = new Map(); -export const cdnUrl = "https://cdn.1000my.cn"; -export const code = "b4a45cf0-85ce-4123-99f0-e4ddce2731de"; -export const baseUrl = "https://test.ar.1000my.com"; -export const post = async (url = "", data = {}) => { + +export const code = "project-200"; +export const baseUrl = "https://project-iot.test.1000my.com"; +export const get = async (url = "", data = {}) => { const response = await fetch(baseUrl + url, { method: "POST", headers: { @@ -14,24 +14,12 @@ export const post = async (url = "", data = {}) => { }); return response.json(); }; -const getMallInfo = async ({ memberID }) => { - const { name, city, groundFloorOrder, floors, scale, offsetToNorth } = { - name: "千目广场", +const getMallInfo = async () => { + const { name, city, groundFloorOrder, scale, offsetToNorth } = { + name: "桥北万象", city: "南京", - groundFloorOrder: 1, + groundFloorOrder: 2, scale: 0.15, - floors: [ - { - name: "F1", - floorOrder: 0, - url: null, - }, - { - name: "F2", - floorOrder: 1, - url: true, - }, - ], offsetToNorth: 0, }; document.title = name; @@ -43,121 +31,74 @@ const getMallInfo = async ({ memberID }) => { groundFloorIndex: groundFloorOrder, needSpotLight: false, scale, - floors, isNew: true, cloud: "1000my", offsetToNorth, }; const config = { - mapDataUrl: `${cdnUrl}/test-projects/${code}/Aeditor/Aeditor.json?t=${new Date().getTime()}`, - shopInfoUrl: `${cdnUrl}/test-projects/${code}/QueryShopListForMap/QueryShopListForMap.json?t=${new Date().getTime()}`, + mapDataUrl: `${baseUrl}/api/guide/v1/web/getMallMapData/${code}/Aeditor`, + shopInfoUrl: `${baseUrl}/api/guide/v1/web/getMapInfo?projectCode=${code}`, }; - try { - const { - data: { mapUrl, shopUrl }, - } = await axios.get( - `${cdnUrl}/test-projects/${code}/config.json?t=${new Date().getTime()}` - ); - if (mapUrl) config.mapDataUrl = mapUrl; - if (shopUrl) config.shopInfoUrl = shopUrl; - } catch (error) { - console.log("获取config失败"); - } - - const [ - mapDataJSON, - serverShopInfo, - facs, - activities, - pois, - menu, - shopCouponMap, - ] = await Promise.all([ - (async () => { - try { - const { - data: { - data: { mapData: mapDataJSON }, - }, - } = await axios.get(config.mapDataUrl); - return mapDataJSON; - } catch (error) { - console.error(error); - return {}; - } - })(), - (async () => { - try { - const { - data: { data: serverShopInfo }, - } = await axios.get(config.shopInfoUrl); - return serverShopInfo; - } catch (error) { - console.error(error); - return {}; - } - })(), - (async () => { - try { - const { data: facs } = await post(`/Api/Cdn/FacilityInfo`); - return facs; - } catch (error) { - console.error(error); - return []; - } - })(), - (async () => { - try { - const { data: activities } = await post(`/Api/Operation/MallActList`, { - memberID, - }); - return activities; - } catch (error) { - console.error(error); - return []; - } - })(), - (async () => { - try { - const { data: pois } = await post(`/api/Operation/GetPoiList`); - return pois; - } catch (error) { - console.error(error); - return []; - } - })(), - (async () => { - try { - const { data: menu } = await post(`/Api/AppModule/MallAppModules`); - return menu; - } catch (error) { - console.error(error); - return []; - } - })(), - (async () => { - try { - const { - data: { shopDetailShowCoupon }, - } = await post(`/Api/Operation/MiniproBasicData`, { - memberID, - }); - const shopCouponMap = shopDetailShowCoupon.reduce( - (acc, nxt) => ({ ...acc, [nxt]: true }), - {} - ); - return shopCouponMap; - } catch (error) { - console.error(error); - return {}; - } - })(), - ]); + const [cdnUrl, mapDataJSON, [buildingList, serverShopInfo], facs] = + await Promise.all([ + (async () => { + try { + const { + data: { data: cdnUrl }, + } = await axios.get(`${baseUrl}/api/info/v1/web/getUploadUrl`); + return cdnUrl; + } catch (error) { + console.error(error); + return {}; + } + })(), + (async () => { + try { + const { + data: { + data: { mapData: mapDataJSON }, + }, + } = await axios.get(config.mapDataUrl); + return mapDataJSON; + } catch (error) { + console.error(error); + return {}; + } + })(), + (async () => { + try { + const { + data: { + data: { buildingList, shopList: serverShopInfo }, + }, + } = await axios.get(config.shopInfoUrl); + return [buildingList, serverShopInfo]; + } catch (error) { + console.error(error); + return {}; + } + })(), + (async () => { + try { + const { + data: { data: facs }, + } = await axios.get( + `${baseUrl}/api/guide/v1/web/getProjectUsedIconList?projectCode=${code}` + ); + return facs; + } catch (error) { + console.error(error); + return []; + } + })(), + ]); const mapData = JSON.parse(mapDataJSON)[0]; - mall.activities = activities; - mall.pois = pois; - const poiMap = pois.reduce((acc, nxt) => ({ ...acc, [nxt.code]: nxt }), {}); + mall.floors = buildingList[0].floorList.map(({ floor, floorOrder }) => ({ + name: floor, + floorOrder, + url: true, + })); mall.facilityTypeMap = facs.reduce( (acc, nxt) => ({ ...acc, @@ -165,11 +106,25 @@ const getMallInfo = async ({ memberID }) => { }), {} ); - const shopInfo = serverShopInfo; + const shopInfo = serverShopInfo + .filter(({ buildingOrder }) => buildingOrder === 0) + .map((iot) => ({ + ...iot, + name: iot.shopName, + houseNum: iot.houseNumber, + nameEn: iot.shopNameEn, + logoPath: cdnUrl + iot.logoUrl, + shopFormat: iot.industryFatherName, + })) + .reduce((acc, nxt) => { + if (!acc[nxt.floorOrder]) acc[nxt.floorOrder] = [nxt]; + else acc[nxt.floorOrder] = [...acc[nxt.floorOrder], nxt]; + return acc; + }, []) + .map((shopList, floorOrder) => ({ floorOrder, shopList })); + console.log(shopInfo); shopInfo.forEach(({ shopList }) => shopList.forEach((shop) => { - if (shopCouponMap[shop.code]) shop.hasCoupon = true; - else shop.hasCoupon = false; shop.initialsCn = shop.name .split(" ") .filter((t) => t) @@ -204,8 +159,6 @@ const getMallInfo = async ({ memberID }) => { acc[floorOrder] = [url, name]; return acc; }, new Array()), - poiMap, - menu, }); const mallInfo = { mall, shopInfo, images }; mallInfos.set(mall.code, mallInfo); diff --git a/src/pages/Activities/Activities.js b/src/pages/Activities/Activities.js deleted file mode 100644 index edde4a0..0000000 --- a/src/pages/Activities/Activities.js +++ /dev/null @@ -1,138 +0,0 @@ -import React, { useEffect, useState } from "react"; -import "./Activities.scss"; -import back from "./back.svg"; -import clock from "./clock.svg"; -import detail from "./detail.png"; -import { post } from "../../js/helpers/data-helper"; - -const Activities = ({ - initActivity, - setInitActivity, - onGo, - mall: { activities, pois }, - facilities, - memberID, -}) => { - const [activity, setActivity] = useState(null); - const [receiving, setReceiving] = useState(false); - const poiMap = pois.reduce((acc, nxt) => ({ ...acc, [nxt.code]: nxt }), {}); - const getFacByAct = (activity) => { - if (!activity) return null; - const poiCode = activity.poiList.find((code) => poiMap[code]); - const poi = poiCode ? poiMap[poiCode] : null; - if (!poi) return null; - const actFacs = facilities ? facilities["活动"] : []; - if (!actFacs) return null; - const actFac = actFacs.find(({ title }) => title === poi.name); - return actFac; - }; - - const reject = () => { - window.weui.toast("该活动即将上线,敬请期待!", { - className: "toast", - }); - }; - const receive = async (activity) => { - setReceiving(true); - try { - const { code, data, msg } = await post("/Api/Coupon/CouponReceive", { - activityCode: activity.code, - memberID, - }); - window.weui.toast(msg, { - className: "toast", - }); - if (code === "200") { - activity.isReceived = true; - } - } catch (error) { - console.warn(error); - } finally { - setReceiving(false); - } - }; - useEffect(() => { - if (initActivity) { - setActivity(initActivity); - setInitActivity(null); - } - }, [initActivity]); - - return ( -
-
活动
-
- {activities && - activities.map((act) => ( -
- -
-
setActivity(act)}> - 查看详情 -
-
{ - const fac = getFacByAct(act); - if (!fac) return reject(); - return onGo && onGo(fac); - }} - > - GO -
-
-
- ))} -
- {activity && ( -
- setActivity(null)} - src={back} - > - -
-
{activity.name}
-
- - {activity.beginTime.split(" ")[0]}至 - {activity.endTime.split(" ")[0]} -
-
-
活动介绍
- {activity.intro} -
{ - const fac = getFacByAct(activity); - if (!fac) return reject(); - return onGo && onGo(fac); - }} - > - 开始导航 -
- {activity.defaultAwardTitle && ( -
-
{activity.defaultAwardTitle}
-
活动奖励
-
- !activity.isReceived && !receiving && receive(activity) - } - className={`btn ${ - activity.isReceived || receiving ? "disabled" : "" - }`} - > - 领取奖励 -
-
- )} -
-
-
- )} -
- ); -}; -export default Activities; diff --git a/src/pages/Activities/Activities.scss b/src/pages/Activities/Activities.scss deleted file mode 100644 index 65d2aa0..0000000 --- a/src/pages/Activities/Activities.scss +++ /dev/null @@ -1,264 +0,0 @@ -.activities { - position: absolute; - left: 0; - right: 0; - top: 0; - bottom: 0; - display: flex; - flex-direction: column; - background: #f0f0f0; - - pointer-events: auto; - .header { - position: absolute; - height: 25px; - left: 24px; - top: 24px; - font-family: "PingFang SC"; - font-style: normal; - font-weight: 600; - font-size: 18px; - line-height: 25px; - display: flex; - align-items: center; - color: #353230; - } - .list-container { - position: absolute; - top: 64px; - left: 17px; - right: 17px; - bottom: 0; - overflow-x: hidden; - overflow-y: auto; - .card { - display: inline-flex; - flex-direction: column; - background: #ffffff; - border-radius: 10px; - overflow: hidden; - .card-header { - width: calc(100vw - 34px); - height: calc((100vw - 34px) / 321 * 180); - border-radius: 10px; - object-fit: cover; - } - .card-content { - display: flex; - height: 72px; - padding-left: 24px; - padding-right: 16px; - font-family: "PingFang SC"; - font-style: normal; - font-weight: 600; - font-size: 16px; - line-height: 22px; - color: #353230; - align-items: center; - justify-content: space-between; - .detail { - display: inline-flex; - align-items: center; - img { - width: 20px; - height: 20px; - margin-right: 8px; - } - } - .btn { - display: flex; - width: 80px; - height: 40px; - background: linear-gradient(180deg, #508af7 0%, #5ea5f9 100%); - box-shadow: 0px 6px 12px rgba(93, 172, 249, 0.2); - border-radius: 8px; - font-family: "HarmonyOS Sans SC"; - font-style: normal; - font-weight: 700; - font-size: 16px; - line-height: 19px; - text-align: right; - color: #ffffff; - justify-content: center; - align-items: center; - } - } - } - .card + .card { - margin-top: 16px; - } - } - .activity { - position: absolute; - top: 0; - bottom: -98px; - left: 0; - right: 0; - background: #f0f0f0; - z-index: 1; - border-radius: 18px; - .back { - position: absolute; - width: 40px; - height: 40px; - left: 16px; - top: 8px; - z-index: 2; - } - .r1 { - position: absolute; - top: 0; - left: 0; - right: 0; - height: 56vw; - width: 100vw; - z-index: 1; - border-radius: 10px 10px 0 0; - object-fit: cover; - } - .r2 { - position: absolute; - top: 192px; - left: 0; - right: 0; - bottom: 0; - z-index: 2; - background: linear-gradient( - 180.18deg, - #ffffff 17.3%, - rgba(255, 255, 255, 0) 99.84% - ); - border-radius: 16px 16px 0 0; - display: flex; - flex-direction: column; - .rr1 { - font-family: "PingFang SC"; - font-style: normal; - font-weight: 600; - font-size: 16px; - line-height: 22px; - margin-top: 16px; - margin-bottom: 8px; - color: #353230; - padding-left: 24px; - } - .rr2 { - display: inline-flex; - font-family: "PingFang SC"; - font-style: normal; - font-weight: 400; - font-size: 12px; - line-height: 17px; - color: #68655e; - align-items: center; - padding-left: 24px; - img { - width: 16px; - height: 16px; - margin-right: 8px; - } - } - .r3 { - position: absolute; - top: 97px; - left: 10px; - right: 10px; - bottom: 0; - font-family: "PingFang SC"; - font-style: normal; - font-weight: 400; - font-size: 14px; - line-height: 22px; - color: #9d988f; - overflow-x: hidden; - overflow-y: auto; - background: #f9f9fb; - border-radius: 16px 16px 0px 0px; - padding: 16px 14px; - .title { - font-family: "PingFang SC"; - font-style: normal; - font-weight: 600; - font-size: 14px; - line-height: 20px; - color: #353230; - margin-bottom: 4px; - } - } - .r4 { - display: flex; - position: absolute; - height: 56px; - left: 18px; - right: 18px; - bottom: 56px; - margin: auto; - background: linear-gradient(180deg, #508af7 0%, #5ea5f9 100%); - box-shadow: 0px 6px 12px rgba(93, 172, 249, 0.2); - border-radius: 16px; - font-family: "HarmonyOS Sans SC"; - font-style: normal; - font-weight: 600; - font-size: 16px; - line-height: 22px; - align-items: center; - justify-content: center; - color: #ffffff; - } - .r5 { - position: absolute; - bottom: 139px; - left: 14px; - right: 14px; - height: 80px; - background: rgba(255, 255, 255, 0.7); - box-shadow: 0px 12px 16px rgba(104, 110, 127, 0.08); - border-radius: 10px; - .t1 { - position: absolute; - top: 19px; - left: 20px; - font-weight: 600; - font-size: 17px; - line-height: 22px; - color: #437af7; - width: 174px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } - .meta { - position: absolute; - top: 45px; - left: 20px; - font-weight: 600; - font-size: 12px; - line-height: 16px; - color: #a1a5b3; - } - .btn { - position: absolute; - display: flex; - width: 80px; - height: 40px; - top: 19px; - right: 12px; - background: #ffffff; - box-shadow: 0px 12px 16px rgba(104, 110, 127, 0.08); - border-radius: 10px; - font-weight: 600; - font-size: 15px; - line-height: 20px; - color: #437af7; - justify-content: center; - align-items: center; - border: 1px solid rgba(80, 138, 247, 0.6); - &.disabled { - color: #a1a5b3; - border: 1px solid #a1a5b3; - } - } - } - } - } -} diff --git a/src/pages/Activities/back.svg b/src/pages/Activities/back.svg deleted file mode 100644 index 604f25a..0000000 --- a/src/pages/Activities/back.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/pages/Activities/clock.svg b/src/pages/Activities/clock.svg deleted file mode 100644 index 7a90929..0000000 --- a/src/pages/Activities/clock.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Activities/close.png b/src/pages/Activities/close.png deleted file mode 100644 index 6ab2b1f..0000000 Binary files a/src/pages/Activities/close.png and /dev/null differ diff --git a/src/pages/Activities/detail.png b/src/pages/Activities/detail.png deleted file mode 100644 index c5616b7..0000000 Binary files a/src/pages/Activities/detail.png and /dev/null differ diff --git a/src/pages/Coupons/ApplyModal/ApplyModal.js b/src/pages/Coupons/ApplyModal/ApplyModal.js deleted file mode 100644 index 1bc72cd..0000000 --- a/src/pages/Coupons/ApplyModal/ApplyModal.js +++ /dev/null @@ -1,102 +0,0 @@ -import "./ApplyModal.scss"; -import Modal from "react-modal"; -import { useState } from "react"; -import { post } from "../../../js/helpers/data-helper"; - -const ApplyModal = ({ onBack, memberID }) => { - const [title, setTitle] = useState(""); - const [totalCount, setTotalCount] = useState(""); - const [beginTime, setBeginTime] = useState(""); - const [endTime, setEndTime] = useState(""); - const [couponRules, setCouponRules] = useState(""); - const toast = (text) => - window.weui.toast(text, { - className: "toast", - }); - const submit = async () => { - if (!title) return toast("请输入礼券标题"); - if (!totalCount) return toast("请输入发放数量"); - if (!beginTime) return toast("请选择开始时间"); - if (!endTime) return toast("请选择结束时间"); - try { - const { code, msg } = await post("/api/coupon/ApplyCoupon", { - title, - totalCount, - beginTime, - endTime, - memberID, - couponRules, - }); - if (code === "200") { - toast("已提交申请,审核中!"); - onBack && onBack(); - } else { - toast(msg); - } - } catch (error) {} - }; - return ( - -
onBack && onBack()}>
-
申请发券
-
-
-
礼券标题
- setTitle(e.target.value)} - > -
-
-
发放数量
- setTotalCount(e.target.value)} - > -
-
-
使用期限
-
- setBeginTime(e.target.value)} - placeholder="请选择开始时间" - > -
- setEndTime(e.target.value)} - placeholder="请选择结束时间" - > -
-
-
-
礼券规则
- -
-
- 免费申请 -
-
-
- ); -}; -export default ApplyModal; diff --git a/src/pages/Coupons/ApplyModal/ApplyModal.scss b/src/pages/Coupons/ApplyModal/ApplyModal.scss deleted file mode 100644 index 14c7b80..0000000 --- a/src/pages/Coupons/ApplyModal/ApplyModal.scss +++ /dev/null @@ -1,118 +0,0 @@ -.ApplyModal { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - background: #f6f6f6; - overflow: hidden; - .back { - position: absolute; - top: 10px; - left: 10px; - width: 60px; - height: 60px; - background: center / cover no-repeat url(./back.svg); - } - .title { - position: absolute; - top: 28px; - right: 16px; - font-style: normal; - font-weight: 600; - font-size: 20px; - line-height: 25px; - color: #000000; - } - .content { - position: absolute; - top: 92px; - left: 10px; - right: 10px; - bottom: 34px; - background: #ffffff; - border-radius: 18px; - padding: 32px 24px; - .item { - height: 58px; - border-bottom: 1px solid rgba(218, 215, 209, 0.4); - .label { - font-weight: 600; - font-size: 17px; - line-height: 22px; - color: #353230; - margin-bottom: 8px; - } - .inputText { - font-weight: 400; - font-size: 15px; - line-height: 20px; - color: #68655e; - border: none; - outline: none; - opacity: 0.8; - &::placeholder { - color: #dad7d1; - } - } - .inputTextArea { - width: 100%; - background: #f9f9fb; - border-radius: 8px; - height: 152px; - padding: 16px; - border: none; - font-weight: 400; - font-size: 15px; - line-height: 20px; - outline: none; - color: #68655e; - &::placeholder { - color: #dad7d1; - } - } - .dates { - display: flex; - font-weight: 400; - font-size: 15px; - line-height: 20px; - color: #353230; - - input { - flex: 1; - font-weight: 400; - font-size: 15px; - line-height: 20px; - color: #68655e; - border: none; - outline: none; - opacity: 0.8; - overflow: hidden; - &::placeholder { - color: #dad7d1; - } - } - } - } - .item + .item { - margin-top: 24px; - } - .btn { - position: absolute; - left: 18px; - right: 18px; - bottom: 18px; - height: 56px; - background: linear-gradient(180deg, #508af7 0%, #5ea5f9 100%); - box-shadow: 0px 6px 12px rgba(93, 172, 249, 0.2); - border-radius: 10px; - font-weight: 600; - font-size: 16px; - line-height: 22px; - color: #ffffff; - display: flex; - align-items: center; - justify-content: center; - } - } -} diff --git a/src/pages/Coupons/ApplyModal/back.svg b/src/pages/Coupons/ApplyModal/back.svg deleted file mode 100644 index 3a2dcd6..0000000 --- a/src/pages/Coupons/ApplyModal/back.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/pages/Coupons/CouponList/CouponList.js b/src/pages/Coupons/CouponList/CouponList.js deleted file mode 100644 index 13e948d..0000000 --- a/src/pages/Coupons/CouponList/CouponList.js +++ /dev/null @@ -1,163 +0,0 @@ -import "./CouponList.scss"; -import { useState, useRef, useEffect, useCallback } from "react"; -import ListEnd from "../ListEnd/ListEnd"; -import noData from "./noData.png"; -import Qrcode from "../Qrcode/Qrcode"; -import Modal from "react-modal"; -import { post } from "../../../js/helpers/data-helper"; -import InfiniteScroll from "react-infinite-scroller"; - -const stateMap = { - 0: "未使用", - 1: "已使用", - 2: "已失效", -}; -const stateList = [0, 1, 2]; -const CouponList = ({ memberID }) => { - const [state, setState] = useState(stateList[0]); - const [list, setList] = useState([]); - const [nextPageIndex, setNextPageIndex] = useState(1); - const [loading, setLoading] = useState(false); - const hasMore = nextPageIndex !== null; - - const [modalCoupon, setModalCoupon] = useState(null); - const listRef = useRef(); - const showNoData = list !== null && list.length === 0; - const showListEnd = list !== null && list.length > 0; - const showCouponModal = !!modalCoupon; - - const loadMore = useCallback(async () => { - if (loading || nextPageIndex === null || !memberID) return; - setLoading(true); - try { - const { code, data, msg } = await post("/api/coupon/UserCouponList", { - paging: 1, - state, - pageIndex: nextPageIndex, - pageSize: 10, - memberID, - }); - if (code === "200") { - setList([...list, ...data.list]); - setNextPageIndex( - nextPageIndex + 1 > data.allPage ? null : nextPageIndex + 1 - ); - } else { - setNextPageIndex(null); - window.weui.toast(msg, { - className: "toast", - }); - } - } catch (error) { - setNextPageIndex(null); - } finally { - setLoading(false); - } - }, [list, loading, nextPageIndex]); - - useEffect(() => { - if (listRef.current) listRef.current.scrollTop = 0; - setNextPageIndex(1); - setList([]); - }, [state]); - - return ( -
-
- {stateList.map((item) => ( -
setState(item)} - > - {stateMap[item]} -
- ))} -
-
- listRef && listRef.current} - > - {showNoData && ( -
- -
-
{}}> - 参加AR -
- 活动,可领取优惠券! -
-
- )} - {list !== null && - list.map((coupon) => ( -
setModalCoupon(coupon)} - > - {coupon.logoUrl ? ( - - ) : ( - - )} -
{coupon.title}
-
{coupon.showNo}
-
- 使用期限
- {coupon.beginTime}至{coupon.endTime} -
-
- ))} - - {showListEnd && } -
-
- {showCouponModal && ( - -
setModalCoupon(null)}>
- -
-
{modalCoupon.title}
-
{modalCoupon.showNo}
-
使用期限
-
- {modalCoupon.beginTime}至{modalCoupon.endTime} -
- {modalCoupon.couponRules && ( - <> -
礼券规则
-
{modalCoupon.couponRules}
- - )} -
-
- )} -
- ); -}; -export default CouponList; diff --git a/src/pages/Coupons/CouponList/CouponList.scss b/src/pages/Coupons/CouponList/CouponList.scss deleted file mode 100644 index c713a64..0000000 --- a/src/pages/Coupons/CouponList/CouponList.scss +++ /dev/null @@ -1,268 +0,0 @@ -.CouponList { - flex: 1; - display: flex; - flex-direction: column; - background: linear-gradient( - 180deg, - #f2f2f2 0%, - rgba(249, 249, 249, 0) 20.18% - ); - border-radius: 18px 18px 0 0; - padding-top: 10px; - width: 100vw; - align-items: center; - overflow: hidden; - .CouponTabs { - display: flex; - flex: 0 0 56px; - width: calc(100vw - 20px); - background: #ffffff; - border-radius: 10px; - - .tab { - position: relative; - display: flex; - flex: 1; - font-weight: 400; - font-size: 15px; - line-height: 20px; - color: #9d988f; - justify-content: center; - align-items: center; - &.active { - color: #508af7; - &::before { - content: ""; - position: absolute; - bottom: 10px; - left: 0; - right: 0; - margin: auto; - width: 4px; - height: 4px; - background: #508af7; - border-radius: 50%; - } - &::after { - content: ""; - position: absolute; - width: 30px; - height: 6px; - bottom: 0; - left: 0; - right: 0; - margin: auto; - background: center / cover no-repeat url(./tri.svg); - } - } - } - } - .list-container { - flex: 1; - overflow-x: hidden; - overflow-y: scroll; - padding-top: 16px; - text-align: center; - scroll-behavior: smooth; - - &::-webkit-scrollbar { - display: none; - } - .coupon { - position: relative; - width: calc(100vw - 20px); - height: calc((100vw - 20px) / 355 * 134); - &.bg0 { - background: center / cover no-repeat url(./bg0.svg); - } - &.bg1 { - background: center / cover no-repeat url(./bg1.svg); - } - &.bg2 { - background: center / cover no-repeat url(./bg2.svg); - } - .logo { - position: absolute; - top: 5.333vw; - left: 5.333vw; - border-radius: 4px; - object-fit: cover; - } - .title { - position: absolute; - top: 8vw; - left: 27.733vw; - right: 2.667vw; - font-weight: 600; - font-size: 4.533vw; - line-height: 5.867vw; - color: #353230; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - text-align: left; - } - .meta { - position: absolute; - top: 14.933vw; - left: 27.733vw; - font-weight: 600; - font-size: 3.467vw; - line-height: 4.8vw; - color: #68655e; - opacity: 0.8; - } - .duration { - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 9.067vw; - font-weight: 400; - font-size: 3.2vw; - line-height: 4.267vw; - text-align: center; - color: #9d988f; - display: flex; - justify-content: center; - align-items: center; - .sep { - width: 0.267vw; - height: 2.667vw; - opacity: 0.3; - border-left: 0.267vw solid #68655e; - margin-left: 3.2vw; - margin-right: 3.2vw; - } - } - .time-left { - position: absolute; - height: 3.467vw; - top: 2.133vw; - right: 1.067vw; - font-weight: 600; - font-size: 2.933vw; - line-height: 3.467vw; - color: #c1a672; - opacity: 0.8; - } - .qrcode { - position: absolute; - top: 5.333vw; - left: 5.333vw; - } - } - .coupon + .coupon { - margin-top: 8px; - } - .noData { - display: flex; - flex-direction: column; - width: calc(100vw - 20px); - height: 396px; - border-radius: 18px; - background: #ffffff; - align-items: center; - .bg { - margin: auto; - width: 250px; - height: 250px; - margin-top: 16px; - } - .meta { - width: calc(100vw - 46px); - flex: 0 0 90px; - border-top: 1px solid #f5f5f5; - display: flex; - font-weight: 400; - font-size: 17px; - line-height: 22px; - color: #9d988f; - height: 90px; - justify-content: center; - align-items: center; - .btn { - color: #508af7; - } - } - } - } -} -.CouponModal { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - width: 326px; - height: 416px; - margin: auto; - background: #f9f9fb; - border-radius: 16px; - .close { - position: absolute; - top: 16px; - right: 16px; - width: 24px; - height: 24px; - background: center / cover no-repeat url(./close.svg); - } - .qrcode { - position: absolute; - top: 52px; - left: 0; - right: 0; - margin: auto; - } - .content { - position: absolute; - bottom: 8px; - left: 8px; - right: 8px; - background: #f3f4f8; - border-radius: 10px; - height: 192px; - display: flex; - justify-content: center; - align-items: flex-start; - flex-direction: column; - padding: 24px 16px 0 16px; - .title { - font-weight: 600; - font-size: 17px; - line-height: 22px; - color: #323337; - } - .coupon-code { - font-weight: 600; - font-size: 13px; - line-height: 18px; - color: #437af7; - opacity: 0.8; - margin-top: 4px; - padding-bottom: 8px; - border-bottom: 1px dashed #c9cbd1; - margin-bottom: 17px; - width: 100%; - } - .meta { - font-weight: 400; - font-size: 12px; - line-height: 16px; - color: #7a7e8d; - opacity: 0.8; - margin-bottom: 2px; - } - .value { - font-weight: 600; - font-size: 12px; - line-height: 16px; - color: #474a56; - opacity: 0.8; - margin-bottom: 8px; - min-height: 16px; - overflow: hidden; - text-overflow: ellipsis; - } - } -} diff --git a/src/pages/Coupons/CouponList/bg0.svg b/src/pages/Coupons/CouponList/bg0.svg deleted file mode 100644 index 113f3c2..0000000 --- a/src/pages/Coupons/CouponList/bg0.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/pages/Coupons/CouponList/bg1.svg b/src/pages/Coupons/CouponList/bg1.svg deleted file mode 100644 index 4a71ccd..0000000 --- a/src/pages/Coupons/CouponList/bg1.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/pages/Coupons/CouponList/bg2.svg b/src/pages/Coupons/CouponList/bg2.svg deleted file mode 100644 index dacd570..0000000 --- a/src/pages/Coupons/CouponList/bg2.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/pages/Coupons/CouponList/close.svg b/src/pages/Coupons/CouponList/close.svg deleted file mode 100644 index 579a117..0000000 --- a/src/pages/Coupons/CouponList/close.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Coupons/CouponList/noData.png b/src/pages/Coupons/CouponList/noData.png deleted file mode 100644 index 54ebaaf..0000000 Binary files a/src/pages/Coupons/CouponList/noData.png and /dev/null differ diff --git a/src/pages/Coupons/CouponList/tri.svg b/src/pages/Coupons/CouponList/tri.svg deleted file mode 100644 index 1e8fa71..0000000 --- a/src/pages/Coupons/CouponList/tri.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Coupons/Coupons.js b/src/pages/Coupons/Coupons.js deleted file mode 100644 index 3cff00b..0000000 --- a/src/pages/Coupons/Coupons.js +++ /dev/null @@ -1,55 +0,0 @@ -import "./Coupons.scss"; -import notMember from "./notMember.png"; -import Modal from "react-modal"; -import { useState } from "react"; -import ShopTabs from "./ShopTabs/ShopTabs"; -import CouponList from "./CouponList/CouponList"; -import ShopManager from "./ShopManager/ShopManager"; - -const Coupons = ({ show, memberID, isShop = false }) => { - const isNotMember = !memberID; - const [showCoupons, setShowCoupons] = useState(true); - return ( - - {isNotMember ? ( -
- -
-
{ - window.wx.miniProgram.redirectTo({ - url: `/pages/login/index`, - }); - }} - > - 注册/登录 -
- 后,可查看优惠卷 -
-
- ) : ( - <> - {isShop && ( - - )} - {(!isShop || (isShop && showCoupons)) && ( - - )} - {isShop && !showCoupons && ( - - )} - - )} -
- ); -}; -export default Coupons; diff --git a/src/pages/Coupons/Coupons.scss b/src/pages/Coupons/Coupons.scss deleted file mode 100644 index a97c912..0000000 --- a/src/pages/Coupons/Coupons.scss +++ /dev/null @@ -1,69 +0,0 @@ -.Coupons { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 98px; - z-index: 100000; - background: #f6f6f6; - pointer-events: auto; - display: flex; - flex-direction: column; - align-items: center; - .notMember { - display: flex; - flex-direction: column; - width: calc(100vw - 20px); - height: 396px; - border-radius: 18px; - background: #ffffff; - align-items: center; - .bg { - margin: auto; - width: 250px; - height: 250px; - margin-top: 16px; - } - .meta { - width: calc(100vw - 46px); - flex: 0 0 90px; - border-top: 1px solid #f5f5f5; - display: flex; - font-weight: 400; - font-size: 17px; - line-height: 22px; - color: #9d988f; - height: 90px; - justify-content: center; - align-items: center; - .btn { - color: #437af7; - } - } - } - .shopTabs { - display: flex; - width: calc(100vw - 20px); - height: 56px; - background: #ffffff; - border-radius: 12px; - padding: 4px; - .tab { - display: flex; - flex: 1; - height: 48px; - font-weight: 500; - font-size: 16px; - line-height: 22px; - color: #68655e; - justify-content: center; - align-items: center; - border-radius: 8px; - &.active { - color: #ffffff; - background: #daba7f; - box-shadow: 0px 6px 12px rgba(214, 154, 66, 0.3); - } - } - } -} diff --git a/src/pages/Coupons/ListEnd/ListEnd.js b/src/pages/Coupons/ListEnd/ListEnd.js deleted file mode 100644 index 3fc269a..0000000 --- a/src/pages/Coupons/ListEnd/ListEnd.js +++ /dev/null @@ -1,4 +0,0 @@ -import bg from "./bg.svg"; -import "./ListEnd.scss"; -const ListEnd = () => ; -export default ListEnd; diff --git a/src/pages/Coupons/ListEnd/ListEnd.scss b/src/pages/Coupons/ListEnd/ListEnd.scss deleted file mode 100644 index e1e9a19..0000000 --- a/src/pages/Coupons/ListEnd/ListEnd.scss +++ /dev/null @@ -1,5 +0,0 @@ -.ListEnd { - margin-top: 24px; - width: 62px; - height: 40px; -} diff --git a/src/pages/Coupons/ListEnd/bg.svg b/src/pages/Coupons/ListEnd/bg.svg deleted file mode 100644 index 86376a8..0000000 --- a/src/pages/Coupons/ListEnd/bg.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/pages/Coupons/Qrcode/Qrcode.js b/src/pages/Coupons/Qrcode/Qrcode.js deleted file mode 100644 index 30e4fd7..0000000 --- a/src/pages/Coupons/Qrcode/Qrcode.js +++ /dev/null @@ -1,25 +0,0 @@ -import QRCode from "qrcodejs2"; -import { useRef, useEffect } from "react"; -const Qrcode = ({ size, text, className }) => { - const ref = useRef(); - - useEffect(() => { - const domEl = ref.current; - domEl.innerHTML = ""; - new QRCode(domEl, { - width: size, - height: size, - text, - colorDark: "#000", - colorLight: "#fff", - }); - }, [ref]); - return ( -
- ); -}; -export default Qrcode; diff --git a/src/pages/Coupons/Qrcode/Qrcode.scss b/src/pages/Coupons/Qrcode/Qrcode.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/pages/Coupons/ScanModal/ScanModal.js b/src/pages/Coupons/ScanModal/ScanModal.js deleted file mode 100644 index 489fe46..0000000 --- a/src/pages/Coupons/ScanModal/ScanModal.js +++ /dev/null @@ -1,59 +0,0 @@ -import "./ScanModal.scss"; -import Modal from "react-modal"; -import { useState, useEffect } from "react"; -import { Html5Qrcode } from "html5-qrcode"; - -const ScanModal = ({ onBack, onCode }) => { - const [loaded, setLoaded] = useState(false); - - const toast = (text) => - window.weui.toast(text, { - className: "toast", - }); - - useEffect(() => { - if (loaded) { - const dom = document.getElementById("qrcode-scaner"); - const html5QrCode = new Html5Qrcode("qrcode-scaner"); - html5QrCode - .start( - { facingMode: "environment" }, - { fps: 10, qrbox: { width: 280, height: 280 } }, - (code) => { - html5QrCode.stop(); - onCode && onCode(code); - } - ) - .catch(() => { - toast("启动二维码扫描失败"); - onBack && onBack(); - }); - return () => { - html5QrCode.stop(); - }; - } - }, [loaded]); - return ( - setLoaded(true)} - isOpen - ariaHideApp={false} - className="ScanModal" - > -
-
-
-
-
onBack && onBack()}> - 手动输入券码 -
-
onBack && onBack()}>
-
- ); -}; -export default ScanModal; diff --git a/src/pages/Coupons/ScanModal/ScanModal.scss b/src/pages/Coupons/ScanModal/ScanModal.scss deleted file mode 100644 index d198a30..0000000 --- a/src/pages/Coupons/ScanModal/ScanModal.scss +++ /dev/null @@ -1,72 +0,0 @@ -.ScanModal { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - background: #353230; - overflow: hidden; - .back { - position: absolute; - bottom: 48px; - left: 0; - right: 0; - margin: auto; - width: 48px; - height: 48px; - background: center / cover no-repeat url(./close.svg); - } - .btn { - position: absolute; - height: 56px; - left: 29px; - right: 28px; - bottom: 130px; - background: #ffffff; - border-radius: 10px; - font-weight: 600; - font-size: 16px; - line-height: 22px; - color: #437af7; - display: flex; - justify-content: center; - align-items: center; - } - .border { - position: absolute; - top: 94px; - left: 0; - right: 0; - margin: auto; - width: 320px; - height: 320px; - background: center / cover no-repeat url(./border.svg); - overflow: hidden; - display: flex; - justify-content: center; - align-items: center; - @keyframes scaner { - 0% { - top: -74px; - } - 100% { - top: 320px; - } - } - .scaner { - position: absolute; - left: 0; - right: 0; - width: 320px; - height: 74px; - background: center / cover no-repeat url(./scaner.svg); - animation: 1s scaner infinite ease-in-out; - z-index: 2; - } - .container { - width: 280px; - height: 280px; - overflow: hidden; - } - } -} diff --git a/src/pages/Coupons/ScanModal/back.svg b/src/pages/Coupons/ScanModal/back.svg deleted file mode 100644 index 3a2dcd6..0000000 --- a/src/pages/Coupons/ScanModal/back.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/pages/Coupons/ScanModal/border.svg b/src/pages/Coupons/ScanModal/border.svg deleted file mode 100644 index 0533ee6..0000000 --- a/src/pages/Coupons/ScanModal/border.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Coupons/ScanModal/close.svg b/src/pages/Coupons/ScanModal/close.svg deleted file mode 100644 index 5a04b4a..0000000 --- a/src/pages/Coupons/ScanModal/close.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/pages/Coupons/ScanModal/scaner.svg b/src/pages/Coupons/ScanModal/scaner.svg deleted file mode 100644 index 0184e9b..0000000 --- a/src/pages/Coupons/ScanModal/scaner.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/pages/Coupons/ShopManager/ShopManager.js b/src/pages/Coupons/ShopManager/ShopManager.js deleted file mode 100644 index eb63e79..0000000 --- a/src/pages/Coupons/ShopManager/ShopManager.js +++ /dev/null @@ -1,130 +0,0 @@ -import "./ShopManager.scss"; -import noDataPic from "./noDataPic.png"; -import { post } from "../../../js/helpers/data-helper"; -import InfiniteScroll from "react-infinite-scroller"; -import { useState, useRef, useCallback } from "react"; -import ListEnd from "../ListEnd/ListEnd"; -import ApplyModal from "../ApplyModal/ApplyModal"; -import WriteOffModal from "../WriteOffModal/WriteOffModal"; - -const stateMap = { - 0: "待审核", - 1: "已发布", - 2: "已拒绝", -}; - -const ShopManager = ({ memberID }) => { - const [list, setList] = useState([]); - const [nextPageIndex, setNextPageIndex] = useState(1); - const [loading, setLoading] = useState(false); - - const [showApplyModal, setShowApplyModal] = useState(false); - const [showWriteOffModal, setShowWriteOffModal] = useState(false); - const listRef = useRef(); - const showNoData = !loading && list.length === 0; - const showListEnd = !loading && list.length > 0; - - const hasMore = nextPageIndex !== null; - - const loadMore = useCallback(async () => { - if (loading || nextPageIndex === null) return; - setLoading(true); - try { - const { code, data, msg } = await post("/api/coupon/ApplyedList", { - paging: 1, - pageIndex: nextPageIndex, - pageSize: 10, - memberID, - }); - if (code === "200") { - setList([...list, ...data.list]); - setNextPageIndex( - nextPageIndex + 1 > data.allPage ? null : nextPageIndex + 1 - ); - } else { - setNextPageIndex(null); - window.weui.toast(msg, { - className: "toast", - }); - } - } catch (error) { - setNextPageIndex(null); - } finally { - setLoading(false); - } - }, [list, loading, nextPageIndex]); - return ( -
-
-
setShowApplyModal(true)}> - 申请 -
-
setShowWriteOffModal(true)}> - 核销 -
-
- -
- listRef && listRef.current} - > - {showNoData && ( - <> - -
- 当前您还未发布礼券,请先申请,等待后台申请通过后,刷新页面显示 -
- - )} - {list !== null && - list.map((coupon) => ( -
-
-
礼券标题
-
{coupon.title}
-
-
-
发放数量
-
{coupon.totalCount}
-
- {coupon.state === 1 && ( -
-
已领取数
-
{coupon.received}
-
- )} -
-
使用期限
-
- {coupon.beginTime}至{coupon.endTime} -
-
-
{stateMap[coupon.state]}
-
- ))} - {showListEnd && } -
-
- {showApplyModal && ( - { - setShowApplyModal(false); - setList([]); - setNextPageIndex(1); - }} - memberID={memberID} - > - )} - {showWriteOffModal && ( - setShowWriteOffModal(false)} - memberID={memberID} - > - )} -
- ); -}; -export default ShopManager; diff --git a/src/pages/Coupons/ShopManager/ShopManager.scss b/src/pages/Coupons/ShopManager/ShopManager.scss deleted file mode 100644 index 145443b..0000000 --- a/src/pages/Coupons/ShopManager/ShopManager.scss +++ /dev/null @@ -1,132 +0,0 @@ -.ShopManager { - flex: 1; - display: flex; - flex-direction: column; - background: linear-gradient( - 180deg, - #f2f2f2 0%, - rgba(249, 249, 249, 0) 20.18% - ); - border-radius: 18px 18px 0 0; - padding-top: 10px; - width: 100vw; - align-items: center; - overflow: hidden; - .btns { - display: flex; - margin-bottom: 10px; - width: calc(100vw - 20px); - .btn { - display: flex; - flex: 1; - font-weight: 400; - font-size: 17px; - color: #353230; - height: 48px; - background: #ffffff; - border-radius: 10px; - justify-content: center; - align-items: center; - } - .btn + .btn { - margin-left: 9px; - } - } - .noDataPic { - margin-top: 64px; - width: 250px; - height: 250px; - } - .noDataText { - margin: 0 43px; - font-weight: 400; - font-size: 17px; - line-height: 22px; - text-align: center; - color: #68655e; - } - .list-container { - flex: 1; - overflow-x: hidden; - overflow-y: scroll; - padding-top: 16px; - text-align: center; - scroll-behavior: smooth; - - &::-webkit-scrollbar { - display: none; - } - .coupon { - position: relative; - width: calc(100vw - 20px); - border-radius: 16px; - overflow: hidden; - padding: 24px; - .row { - height: 50px; - border-bottom: 1px solid rgba(240, 240, 240, 0.4); - - .r1 { - font-weight: 400; - font-size: 15px; - line-height: 20px; - color: #9d988f; - text-align: left; - } - .r2 { - font-weight: 600; - font-size: 17px; - line-height: 22px; - color: #353230; - margin-top: 6px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - text-align: left; - } - } - .row + .row { - margin-top: 10px; - } - .status { - position: absolute; - width: 72px; - height: 32px; - top: 0; - right: 0; - display: flex; - font-weight: 600; - font-size: 13px; - line-height: 18px; - color: #ffffff; - border-radius: 0px 0px 0px 14px; - justify-content: center; - align-items: center; - } - &.status0 { - background: linear-gradient(241.87deg, #ffffff 2.89%, #fffbf8 97.29%); - .status { - background: linear-gradient(90deg, #ecd3a6 5.56%, #dbb979 100%); - box-shadow: 4px 6px 18px rgba(214, 162, 101, 0.3); - } - } - &.status1 { - background: linear-gradient(241.87deg, #ffffff 2.89%, #fefff8 97.29%); - .status { - background: linear-gradient(270.4deg, #71c956 0.27%, #7add83 87.87%); - box-shadow: 4px 6px 18px rgba(151, 214, 101, 0.3); - } - } - &.status2 { - background: linear-gradient(241.87deg, #ffffff 2.89%, #fffafa 97.29%); - .status { - background: linear-gradient(270deg, #e76464 3.47%, #ffa0a0 90.28%); - box-shadow: 4px 6px 18px rgba(214, 101, 122, 0.3); - } - } - } - .coupon + .coupon { - margin-top: 8px; - } - } -} diff --git a/src/pages/Coupons/ShopManager/noDataPic.png b/src/pages/Coupons/ShopManager/noDataPic.png deleted file mode 100644 index 3885857..0000000 Binary files a/src/pages/Coupons/ShopManager/noDataPic.png and /dev/null differ diff --git a/src/pages/Coupons/ShopTabs/ShopTabs.js b/src/pages/Coupons/ShopTabs/ShopTabs.js deleted file mode 100644 index 76ec4c5..0000000 --- a/src/pages/Coupons/ShopTabs/ShopTabs.js +++ /dev/null @@ -1,26 +0,0 @@ -import "./ShopTabs.scss"; -import card from "./card.svg"; -import cardActive from "./cardActive.svg"; -import ticket from "./ticket.svg"; -import ticketActive from "./ticketActive.svg"; -const ShopTabs = ({ showCoupons, setShowCoupons }) => { - return ( -
-
setShowCoupons(true)} - > - - 我的礼包 -
-
setShowCoupons(false)} - > - - 券管家 -
-
- ); -}; -export default ShopTabs; diff --git a/src/pages/Coupons/ShopTabs/ShopTabs.scss b/src/pages/Coupons/ShopTabs/ShopTabs.scss deleted file mode 100644 index 97e7fda..0000000 --- a/src/pages/Coupons/ShopTabs/ShopTabs.scss +++ /dev/null @@ -1,32 +0,0 @@ -.ShopTabs { - display: flex; - width: calc(100vw - 20px); - height: 56px; - background: #ffffff; - border-radius: 12px; - padding: 4px; - margin-bottom: 16px; - margin-top: 10px; - .tab { - display: flex; - flex: 1; - height: 48px; - font-weight: 500; - font-size: 16px; - line-height: 22px; - color: #68655e; - justify-content: center; - align-items: center; - border-radius: 8px; - img { - width: 20px; - height: 20px; - margin-right: 8px; - } - &.active { - color: #ffffff; - background: linear-gradient(180deg, #508af7 0%, #5ea5f9 100%); - box-shadow: 0px 6px 12px rgba(93, 172, 249, 0.2); - } - } -} diff --git a/src/pages/Coupons/ShopTabs/card.svg b/src/pages/Coupons/ShopTabs/card.svg deleted file mode 100644 index 3849560..0000000 --- a/src/pages/Coupons/ShopTabs/card.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Coupons/ShopTabs/cardActive.svg b/src/pages/Coupons/ShopTabs/cardActive.svg deleted file mode 100644 index 7d37ed3..0000000 --- a/src/pages/Coupons/ShopTabs/cardActive.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Coupons/ShopTabs/ticket.svg b/src/pages/Coupons/ShopTabs/ticket.svg deleted file mode 100644 index f808ff1..0000000 --- a/src/pages/Coupons/ShopTabs/ticket.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Coupons/ShopTabs/ticketActive.svg b/src/pages/Coupons/ShopTabs/ticketActive.svg deleted file mode 100644 index add8d1a..0000000 --- a/src/pages/Coupons/ShopTabs/ticketActive.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/pages/Coupons/WriteOffModal/WriteOffModal.js b/src/pages/Coupons/WriteOffModal/WriteOffModal.js deleted file mode 100644 index 87d37e1..0000000 --- a/src/pages/Coupons/WriteOffModal/WriteOffModal.js +++ /dev/null @@ -1,148 +0,0 @@ -import "./WriteOffModal.scss"; -import Modal from "react-modal"; -import { useState, useRef, useEffect, useCallback } from "react"; -import { post } from "../../../js/helpers/data-helper"; -import ScanModal from "../ScanModal/ScanModal"; -import InfiniteScroll from "react-infinite-scroller"; -import ListEnd from "../ListEnd/ListEnd"; - -const WriteOffModal = ({ onBack, memberID }) => { - const [orderNo, setOrderNo] = useState(""); - const [showScanModal, setShowScanModal] = useState(false); - const [list, setList] = useState([]); - const [nextPageIndex, setNextPageIndex] = useState(1); - const [loading, setLoading] = useState(false); - const hasMore = nextPageIndex !== null; - const [allCount, setAllCount] = useState(0); - const [month, setMonth] = useState(new Date().toJSON().slice(0, 7)); - const showListEnd = list !== null && list.length > 0; - const listRef = useRef(); - - const loadMore = useCallback(async () => { - if (loading || nextPageIndex === null) return; - setLoading(true); - try { - const { code, data, msg } = await post("/api/Coupon/WriteOffHis", { - paging: 1, - pageIndex: nextPageIndex, - pageSize: 10, - memberID, - month, - }); - if (code === "200") { - setList([...list, ...data.list]); - setNextPageIndex( - nextPageIndex + 1 > data.allPage ? null : nextPageIndex + 1 - ); - setAllCount(data.allCount); - } else { - setNextPageIndex(null); - window.weui.toast(msg, { - className: "toast", - }); - } - } catch (error) { - setNextPageIndex(null); - } finally { - setLoading(false); - } - }, [list, loading, nextPageIndex]); - - useEffect(() => { - if (listRef.current) listRef.current.scrollTop = 0; - setNextPageIndex(1); - setAllCount(0); - setList([]); - }, [month]); - - const toast = (text) => - window.weui.toast(text, { - className: "toast", - }); - const writeOff = async (orderNo) => { - try { - const { code, msg } = await post("/api/coupon/writeoffcoupon", { - orderNo, - memberID, - }); - if (code === "200") { - toast("核销成功"); - return true; - } else { - toast(msg); - return false; - } - } catch (error) { - return false; - } - }; - const submitFromBtn = async (orderNo) => { - const result = await writeOff(orderNo); - if (result) { - setOrderNo(""); - } - }; - const handleCode = async (orderNo) => { - await writeOff(orderNo); - setShowScanModal(false); - }; - return ( - -
onBack && onBack()}>
-
核销
-
-
- setOrderNo(e.target.value)} - > -
-
setShowScanModal(true)}>
- {!!orderNo && ( -
submitFromBtn(orderNo)}> - 确认核销 -
- )} -
-
已核销({allCount}张)
- setMonth(e.target.value)} - > -
-
- listRef && listRef.current} - > - {list !== null && - list.map((coupon) => ( -
-
-
礼券标题
-
{coupon.title}
-
-
-
核销时间
-
{coupon.writeOffTime}
-
-
- ))} - {showListEnd && } -
-
- {showScanModal && ( - setShowScanModal(false)} - onCode={handleCode} - > - )} -
- ); -}; -export default WriteOffModal; diff --git a/src/pages/Coupons/WriteOffModal/WriteOffModal.scss b/src/pages/Coupons/WriteOffModal/WriteOffModal.scss deleted file mode 100644 index 83d9035..0000000 --- a/src/pages/Coupons/WriteOffModal/WriteOffModal.scss +++ /dev/null @@ -1,162 +0,0 @@ -.WriteOffModal { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - background: #f6f6f6; - overflow: hidden; - .back { - position: absolute; - top: 10px; - left: 10px; - width: 60px; - height: 60px; - background: center / cover no-repeat url(./back.svg); - } - .title { - position: absolute; - top: 28px; - right: 16px; - font-style: normal; - font-weight: 600; - font-size: 20px; - line-height: 25px; - color: #000000; - } - .search { - position: absolute; - top: 94px; - left: 10px; - right: 108px; - background: #ffffff; - border-radius: 10px; - height: 60px; - overflow: hidden; - .icon { - position: absolute; - top: 14px; - left: 14px; - width: 47px; - height: 32px; - background: center / cover no-repeat url(./search.svg); - } - input { - position: absolute; - left: 75px; - right: 0; - top: 0; - bottom: 0; - margin: auto; - font-weight: 600; - font-size: 16px; - line-height: 22px; - border: none; - outline: none; - color: #353230; - &::placeholder { - color: #dad7d1; - } - } - } - .scan { - position: absolute; - top: 94px; - right: 16px; - width: 80px; - height: 60px; - background: center / cover no-repeat url(./scan.svg); - } - .btn { - position: absolute; - height: 56px; - left: 29px; - right: 28px; - bottom: 126px; - font-weight: 600; - font-size: 16px; - line-height: 22px; - text-align: center; - color: #ffffff; - background: linear-gradient(180deg, #508af7 0%, #5ea5f9 100%); - box-shadow: 0px 6px 12px rgba(93, 172, 249, 0.2); - border-radius: 10px; - display: flex; - justify-content: center; - align-items: center; - z-index: 1; - } - .bar { - position: absolute; - top: 178px; - left: 24px; - right: 24px; - height: 20px; - font-weight: 600; - font-size: 15px; - line-height: 20px; - color: #353230; - display: flex; - justify-content: space-between; - input { - outline: none; - border: none; - background: none; - } - &::after { - content: ""; - position: absolute; - left: -8px; - bottom: -8px; - right: -5px; - height: 1px; - background: #dad7d1; - opacity: 0.6; - } - } - .list-container { - position: absolute; - top: 206px; - bottom: 0px; - left: 10px; - right: 10px; - overflow-x: hidden; - overflow-y: scroll; - text-align: center; - &::-webkit-scrollbar { - display: none; - } - .coupon { - height: 170px; - background: #ffffff; - border-radius: 16px; - padding: 24px; - margin-top: 10px; - .block { - height: 54px; - border-bottom: 1px solid rgba(240, 240, 240, 0.4); - text-align: left; - .r1 { - font-weight: 400; - font-size: 15px; - line-height: 20px; - color: #9d988f; - } - .r2 { - font-style: normal; - font-weight: 600; - font-size: 17px; - line-height: 22px; - color: #353230; - margin-top: 6px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - } - .block + .block { - margin-top: 16px; - } - } - } -} diff --git a/src/pages/Coupons/WriteOffModal/back.svg b/src/pages/Coupons/WriteOffModal/back.svg deleted file mode 100644 index 3a2dcd6..0000000 --- a/src/pages/Coupons/WriteOffModal/back.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/pages/Coupons/WriteOffModal/scan.svg b/src/pages/Coupons/WriteOffModal/scan.svg deleted file mode 100644 index f1f6ac9..0000000 --- a/src/pages/Coupons/WriteOffModal/scan.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/pages/Coupons/WriteOffModal/search.svg b/src/pages/Coupons/WriteOffModal/search.svg deleted file mode 100644 index 6bb0074..0000000 --- a/src/pages/Coupons/WriteOffModal/search.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/pages/Coupons/notMember.png b/src/pages/Coupons/notMember.png deleted file mode 100644 index fe86524..0000000 Binary files a/src/pages/Coupons/notMember.png and /dev/null differ diff --git a/src/pages/Index/Index.js b/src/pages/Index/Index.js index 52c3063..b83f2f2 100644 --- a/src/pages/Index/Index.js +++ b/src/pages/Index/Index.js @@ -1,7 +1,7 @@ import React, { useState, useEffect, useReducer, useRef } from "react"; import Qmmap from "qmmap"; import { useHistory, useLocation } from "react-router-dom"; -import { getMallInfo, post } from "../../js/helpers/data-helper"; +import { getMallInfo } from "../../js/helpers/data-helper"; import "./Index.scss"; import Floors from "../../components/Floors/Floors"; import HeadBar from "../../components/HeadBar/HeadBar"; @@ -17,12 +17,6 @@ import DefaultPopup, { } from "../../components/DefaultPopup/DefaultPopup"; import More from "../../components/More/More"; import arpng from "./ar.png"; -import Car from "../Car/Car"; -import axios from "axios"; -import Activities from "../Activities/Activities"; -import Coupons from "../Coupons/Coupons"; -import TabMap from "./tabs/Tabs"; -import ShopCoupons from "../ShopCoupons/ShopCoupons"; export const MallCode = React.createContext(null); // const vConsole = new window.VConsole(); @@ -74,26 +68,7 @@ const Index = () => { const [ARshop, setARShop] = useState(null); const [isTyping, setIsTyping] = useState(null); const [showFindCar, setShowFindCar] = useState(false); - const [showActivities, setShowActivities] = useState(false); - const [showCoupon, setShowCoupon] = useState(false); - const [tab, setTab] = useState("地图"); - const [couponShop, setCouponShop] = useState(null); - const [initActivity, setInitActivity] = useState(null); - const showShopCoupons = !!couponShop; - const hasTab = mall && mall.menu.length > 1; - const setStatistics = mall - ? ({ userId, navType, pointType, objectCode, objectName, floorName }) => - axios.post(mall.baseUrl + "/Api/Statistics/AddGuideRecord", { - mallCode: mall.code, - userId, - navType, - pointType, - objectCode, - objectName, - floorName, - }) - : undefined; useEffect(() => { if (shop) { const e = shop.houseNum @@ -131,17 +106,6 @@ const Index = () => { } if (!endId) return; if (endId === "findcar") return setShowFindCar(true); - if (endId === "me") return setTab("我的"); - if (endId.startsWith && endId.startsWith("activities")) { - setTab("活动"); - if (endId === "activities") return; - else { - const code = endId.replace("activities", ""); - const activity = mall.activities.find((act) => act.code === code); - if (activity) setInitActivity(activity); - return; - } - } if (mall.mcShopIDHouseNumMap && mall.mcShopIDHouseNumMap[endId]) endId = mall.mcShopIDHouseNumMap[endId]; @@ -430,21 +394,12 @@ const Index = () => { const isShop = "intro" in end; const isP = end.isP; const isDevice = end.isDevice; - setStatistics({ - userId: openid, - navType: 2, - pointType: isShop || isDevice ? "1" : isP ? "3" : "2", - objectCode: isShop ? end.code : isP ? end.houseNum : end.Type, - objectName: end.name, - floorName: end.floorName || mall.floors[end.floorOrder][1], - }); } } }, [navigation]); useEffect(() => { if (mallInfo) { - setTab(mall.menu[0].name); loadMap(); } }, [mallInfo]); @@ -465,38 +420,11 @@ const Index = () => { } }, [map]); - useEffect(() => { - switch (tab) { - case "活动": - setShowFindCar(false); - setShowCoupon(false); - setShowActivities(true); - break; - case "地图": - setShowFindCar(false); - setShowCoupon(false); - setShowActivities(false); - break; - case "寻车": - setShowCoupon(false); - setShowActivities(false); - setShowFindCar(true); - break; - case "我的": - setShowActivities(false); - setShowFindCar(false); - setShowCoupon(true); - break; - default: - break; - } - }, [tab]); - return (
{ : "") } > - {showShopCoupons && ( - - setCouponShop(null)} - shop={couponShop} - > - - )} - {showActivities && ( - - setTab("地图")} - facilities={facilities} - onGo={(fac) => { - setTab("地图"); - map && map.focusFacilityById(fac.id); - }} - > - - )} - {showFindCar && mall && ( - - name === "寻车")?.specialType === 1 - } - plate={plate} - lots={mall.lots} - onBack={() => setTab("地图")} - onLot={(e) => { - setDoFocus(2); - map.focusPByHouseNum(e); - setTab("地图"); - }} - > - - )} - {showARPrompt && ( - - -
即将离开模拟导航 进入AR导航
-
是否要继续?
-
-
setShowARPrompt(false)}> - 取消 -
-
{ - if (openid && openid !== "null") { - const isShop = "intro" in ARshop; - const isP = ARshop.isP; - const isDevice = ARshop.isDevice; - setStatistics({ - userId: openid, - navType: 1, - pointType: isShop || isDevice ? "1" : isP ? "3" : "2", - objectCode: isShop - ? ARshop.code - : isP - ? ARshop.houseNum - : ARshop.Type, - objectName: ARshop.name, - floorName: - ARshop.floorName || mall.floors[ARshop.floorOrder][1], - }); - } - setShowARPrompt(false); - window.wx.miniProgram.redirectTo({ - url: `/pages/index/index?e=${ - ARshop.houseNum - ? ARshop.houseNum - : ARshop.isDevice - ? `${ARshop.floorOrder}_${ARshop.navPoint}_${ARshop.name}` - : encodeURIComponent(ARshop.id) - }&searchType=${searchType}`, - }); - }} - > - 确定 -
-
-
- )} {!online && ( { )} -
{!(start || end) && ( -
{ - const { msg } = await post("/Api/Operation/GetUserAward", { - memberID, - poiCode: "97be8faa6ab34e08864bf2b1c231e6ab", - }); - window.weui.toast(msg, { - className: "toast", - }); - }} - > +
图左 {mall && mall.city}
@@ -756,7 +547,6 @@ const Index = () => { defaultPopup={ showDefaultPopup && ( { sceneIndex={sceneIndex} setSceneIndex={setSceneIndex} isNavEnd={isNavEnd} - onActivity={() => { - setShowActivities(true); - }} mall={mall} hasCoupon={hasCoupon} > @@ -823,9 +610,6 @@ const Index = () => { setARShop(shop); setShowARPrompt(true); }} - onClickCoupon={() => { - setCouponShop(shop); - }} > {showNav && ( { 开始导航
)} - {mall && mall.menu.length > 1 && ( -
- {mall.menu.map(({ name, alias }) => { - const isActive = tab === name; - return ( -
setTab(name)} - > - - {alias || name} -
- ); - })} -
- )}
); diff --git a/src/pages/ShopCoupons/ShopCoupons.js b/src/pages/ShopCoupons/ShopCoupons.js deleted file mode 100644 index ecbc7b6..0000000 --- a/src/pages/ShopCoupons/ShopCoupons.js +++ /dev/null @@ -1,121 +0,0 @@ -import "./ShopCoupons.scss"; -import { useState, useEffect } from "react"; -import { post } from "../../js/helpers/data-helper"; - -const ShopCoupons = ({ onBack, shop, memberID }) => { - const [coupons, setCoupons] = useState([]); - const [receiving, setReceiving] = useState(false); - const getList = async () => { - try { - const { code, data, msg } = await post( - "/Api/Coupon/ShopDetailCouponList", - { - paging: 0, - memberID, - shopCode: shop.code, - } - ); - if (code !== "200") - window.weui.toast(msg, { - className: "toast", - }); - else setCoupons(data); - } catch (error) { - console.warn(error); - } - }; - useEffect(() => { - getList(); - }, []); - const receive = async (coupon) => { - setReceiving(true); - try { - const { code, data, msg } = await post("/Api/Coupon/ShopCouponReceive", { - couponCode: coupon.code, - memberID, - }); - window.weui.toast(msg, { - className: "toast", - }); - if (code === "200") { - getList(); - } - } catch (error) { - console.warn(error); - } finally { - setReceiving(false); - } - }; - return ( -
-
-
{ - onBack && onBack(); - }} - >
- {shop.name} -
-
- {coupons.map((coupon, i) => ( -
-
- -
-
-
-
{coupon.title}
-
= coupon.detailReceiveCount - ? "disabled" - : "") - } - onClick={() => { - if ( - coupon.detailReceived >= coupon.detailReceiveCount || - receiving - ) - return; - receive(coupon); - }} - > - {coupon.detailReceived >= coupon.detailReceiveCount - ? "已领取" - : "领券"} -
-
-
-
使用期限
-
- {coupon.beginTime}至{coupon.endTime} -
-
{ - coupon.isOpen = !coupon.isOpen; - setCoupons([...coupons]); - }} - > - 查看详情 -
-
-
- {!!coupon.isOpen && ( -
-
使用规则
-
{coupon.couponRules}
-
- )} -
-
- ))} -
-
- ); -}; -export default ShopCoupons; diff --git a/src/pages/ShopCoupons/ShopCoupons.scss b/src/pages/ShopCoupons/ShopCoupons.scss deleted file mode 100644 index bcf8d64..0000000 --- a/src/pages/ShopCoupons/ShopCoupons.scss +++ /dev/null @@ -1,144 +0,0 @@ -.ShopCoupons { - position: absolute; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - background: #f3f4f8; - display: flex; - flex-direction: column; - .header { - flex: 0 0 43px; - display: flex; - padding: 9px 16px 10px 18px; - justify-content: space-between; - font-weight: 600; - font-size: 20px; - line-height: 25px; - color: #323337; - white-space: nowrap; - align-items: center; - .back { - width: 24px; - height: 24px; - background: center / cover no-repeat url(./back.svg); - } - } - .list { - flex: 1; - overflow-x: hidden; - overflow-y: auto; - padding: 0 10px; - * { - display: flex; - } - .item { - background: #ffffff; - border: 1px solid #edeff3; - box-shadow: 2px 6px 8px rgba(104, 110, 127, 0.08); - border-radius: 18px; - padding: 16px; - .left { - flex: 0 0 40px; - .avatar { - width: 40px; - height: 40px; - padding: 5px; - border: 1px solid #edeff3; - box-shadow: 2px 6px 8px rgba(104, 110, 127, 0.08); - border-radius: 38px; - object-fit: cover; - } - } - .right { - flex: 1; - flex-direction: column; - .r1 { - padding-left: 10px; - height: 40px; - justify-content: space-between; - flex: 1; - align-items: center; - .content { - display: block; - width: calc(100vw - 192px); - font-size: 20px; - color: #323337; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - } - .btn { - flex: 0 0 90px; - width: 90px; - height: 38px; - background: linear-gradient(180deg, #508af7 0%, #5ea5f9 100%); - box-shadow: 0px 6px 12px rgba(93, 172, 249, 0.2); - border-radius: 10px; - align-items: center; - justify-content: center; - font-size: 14px; - color: #ffffff; - &.disabled { - background: #f3f4f8; - box-shadow: none; - color: #a1a5b3; - } - &:active { - opacity: 0.7; - } - } - } - .r2 { - margin-left: 10px; - margin-top: 18px; - border-top: 1px solid #edeff3; - padding-top: 6px; - font-size: 12px; - line-height: 18px; - color: #474a56; - flex-direction: column; - .desc { - margin-top: 10px; - font-size: 13px; - height: 18px; - color: #437af7; - align-items: center; - .icon { - margin-left: 2px; - width: 16px; - height: 16px; - background: center / cover no-repeat url(./arrow.svg); - transition: all 0.25s ease-in-out; - margin-left: 2px; - &.open { - transform: rotate(90deg); - } - } - } - } - .r3 { - flex-direction: column; - background: #f9f9fb; - border-radius: 8px; - padding: 10px; - .title { - font-size: 13px; - line-height: 18px; - color: #7a7e8d; - margin-bottom: 4px; - } - .content { - font-size: 12px; - line-height: 16px; - color: #a1a5b3; - opacity: 0.8; - } - } - } - } - .item + .item { - margin-top: 8px; - } - } -} diff --git a/src/pages/ShopCoupons/arrow.svg b/src/pages/ShopCoupons/arrow.svg deleted file mode 100644 index 3100163..0000000 --- a/src/pages/ShopCoupons/arrow.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/pages/ShopCoupons/back.svg b/src/pages/ShopCoupons/back.svg deleted file mode 100644 index b6e3bf7..0000000 --- a/src/pages/ShopCoupons/back.svg +++ /dev/null @@ -1,3 +0,0 @@ - - -