Browse Source

feat: 2.4.1

master
jiannibang 3 years ago
parent
commit
4e30d9a80d
  1. 15
      src/js/helpers/data-helper.js
  2. 21
      src/pages/Coupons/CouponList/CouponList.js
  3. 30
      src/pages/Coupons/CouponList/CouponList.scss
  4. BIN
      src/pages/Coupons/CouponList/ordBg.png
  5. BIN
      src/pages/Coupons/CouponList/plaBg.png
  6. BIN
      src/pages/Coupons/CouponList/silBg.png
  7. 25
      src/pages/Coupons/Coupons.js
  8. 44
      src/pages/Coupons/Coupons.scss
  9. BIN
      src/pages/Coupons/ordBg.png
  10. BIN
      src/pages/Coupons/plaBg.png
  11. BIN
      src/pages/Coupons/silBg.png
  12. 1
      src/pages/Index/Index.js

15
src/js/helpers/data-helper.js

@ -2,11 +2,11 @@ import axios from "axios";
import icons from "./image-helper"; import icons from "./image-helper";
let mallInfos = new Map(); let mallInfos = new Map();
// dev // dev
export const code = "project-k5chc3vt0vkodjbmhl8rua";
export const baseUrl = "https://iot-dev.123.1000my.com";
// export const code = "project-k5chc3vt0vkodjbmhl8rua";
// export const baseUrl = "https://iot-dev.123.1000my.com";
// test // test
// export const code = "project-skcn0gk6yb2xutkcsmjtra";
// export const baseUrl = "https://project-iot.test.1000my.com";
export const code = "project-skcn0gk6yb2xutkcsmjtra";
export const baseUrl = "https://project-iot.test.1000my.com";
export const post = async (url = "", data = {}) => { export const post = async (url = "", data = {}) => {
const response = await fetch(baseUrl + url, { const response = await fetch(baseUrl + url, {
method: "POST", method: "POST",
@ -72,7 +72,7 @@ const getMallInfo = async ({ memberID }) => {
activities, activities,
pois, pois,
menu, menu,
shopCouponMap,
{ shopCouponMap, userLevel },
] = await Promise.all([ ] = await Promise.all([
(async () => { (async () => {
try { try {
@ -161,7 +161,7 @@ const getMallInfo = async ({ memberID }) => {
(async () => { (async () => {
try { try {
const { const {
data: { shopDetailShowCoupon },
data: { shopDetailShowCoupon, level: userLevel },
} = await post(`/api/ar/v1/applet/MiniproBasicData`, { } = await post(`/api/ar/v1/applet/MiniproBasicData`, {
memberID, memberID,
}); });
@ -169,7 +169,7 @@ const getMallInfo = async ({ memberID }) => {
(acc, nxt) => ({ ...acc, [nxt]: true }), (acc, nxt) => ({ ...acc, [nxt]: true }),
{} {}
); );
return shopCouponMap;
return { shopCouponMap, userLevel };
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return {}; return {};
@ -250,6 +250,7 @@ const getMallInfo = async ({ memberID }) => {
}, []), }, []),
poiMap, poiMap,
menu, menu,
userLevel,
}); });
const mallInfo = { mall, shopInfo, images }; const mallInfo = { mall, shopInfo, images };
mallInfos.set(mall.code, mallInfo); mallInfos.set(mall.code, mallInfo);

21
src/pages/Coupons/CouponList/CouponList.js

@ -111,6 +111,7 @@ const CouponList = ({ memberID }) => {
width: (window.innerWidth / 375) * 64, width: (window.innerWidth / 375) * 64,
height: (window.innerWidth / 375) * 64, height: (window.innerWidth / 375) * 64,
}} }}
alt="券图"
></img> ></img>
) : ( ) : (
<Qrcode <Qrcode
@ -125,6 +126,16 @@ const CouponList = ({ memberID }) => {
使用期限<div className="sep"></div> 使用期限<div className="sep"></div>
{coupon.beginTime}{coupon.endTime} {coupon.beginTime}{coupon.endTime}
</div> </div>
<div
className={
"level " +
(coupon.level === "白银"
? "sil"
: coupon.level === "铂金"
? "pla"
: "")
}
></div>
</div> </div>
))} ))}
@ -157,6 +168,16 @@ const CouponList = ({ memberID }) => {
<div className="value">{modalCoupon.couponRules}</div> <div className="value">{modalCoupon.couponRules}</div>
</> </>
)} )}
<div
className={
"level " +
(modalCoupon.level === "白银"
? "sil"
: modalCoupon.level === "铂金"
? "pla"
: "")
}
></div>
</div> </div>
</Modal> </Modal>
)} )}

30
src/pages/Coupons/CouponList/CouponList.scss

@ -151,6 +151,21 @@
top: 5.333vw; top: 5.333vw;
left: 5.333vw; left: 5.333vw;
} }
.level {
position: absolute;
width: 72px;
height: 24px;
top: 0;
right: 0;
background: center / cover no-repeat url(./ordBg.png);
border-radius: 0px 8px 0px 0;
&.sil {
background: center / cover no-repeat url(./silBg.png);
}
&.pla {
background: center / cover no-repeat url(./plaBg.png);
}
}
} }
.coupon + .coupon { .coupon + .coupon {
margin-top: 8px; margin-top: 8px;
@ -264,5 +279,20 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.level {
position: absolute;
width: 72px;
height: 24px;
top: 0;
right: 0;
background: center / cover no-repeat url(./ordBg.png);
border-radius: 0px 8px 0px 0;
&.sil {
background: center / cover no-repeat url(./silBg.png);
}
&.pla {
background: center / cover no-repeat url(./plaBg.png);
}
}
} }
} }

BIN
src/pages/Coupons/CouponList/ordBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
src/pages/Coupons/CouponList/plaBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
src/pages/Coupons/CouponList/silBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

25
src/pages/Coupons/Coupons.js

@ -6,7 +6,7 @@ import ShopTabs from "./ShopTabs/ShopTabs";
import CouponList from "./CouponList/CouponList"; import CouponList from "./CouponList/CouponList";
import ShopManager from "./ShopManager/ShopManager"; import ShopManager from "./ShopManager/ShopManager";
const Coupons = ({ show, memberID, isShop = false }) => {
const Coupons = ({ show, memberID, isShop = false, mall }) => {
const isNotMember = !memberID; const isNotMember = !memberID;
const [showCoupons, setShowCoupons] = useState(true); const [showCoupons, setShowCoupons] = useState(true);
return ( return (
@ -35,6 +35,29 @@ const Coupons = ({ show, memberID, isShop = false }) => {
</div> </div>
) : ( ) : (
<> <>
{mall && (
<div
className={
"member " +
(mall.userLevel === "铂金"
? "pla"
: mall.userLevel === "白银"
? "sil"
: "ord")
}
>
{mall.userLevel}会员
<div className="meta1">
{mall.userLevel === "铂金"
? "Platinum"
: mall.userLevel === "白银"
? "Silver"
: "Ordinary"}{" "}
Member
</div>
<div className="meta2">欢迎加入会员</div>
</div>
)}
{isShop && ( {isShop && (
<ShopTabs <ShopTabs
showCoupons={showCoupons} showCoupons={showCoupons}

44
src/pages/Coupons/Coupons.scss

@ -41,6 +41,50 @@
} }
} }
} }
.member {
position: relative;
width: calc(100vw - 20px);
height: 88px;
margin-top: 10px;
border-radius: 16px;
padding-top: 23px;
padding-left: 24px;
font-weight: 600;
font-size: 20px;
line-height: 25px;
.meta1 {
position: absolute;
top: 50px;
left: 24px;
font-weight: 600;
font-size: 10px;
line-height: 16px;
opacity: 0.6;
}
.meta2 {
position: absolute;
top: 29px;
right: 16px;
font-weight: 400;
font-size: 12px;
line-height: 16px;
}
&.ord {
background: center / cover no-repeat url(./ordBg.png);
box-shadow: 6px 11px 16px rgba(193, 141, 111, 0.3);
color: #733c2a;
}
&.sil {
background: center / cover no-repeat url(./silBg.png);
box-shadow: 6px 11px 16px rgba(143, 155, 168, 0.3);
color: #474e5a;
}
&.pla {
background: center / cover no-repeat url(./plaBg.png);
box-shadow: 6px 11px 16px rgba(208, 150, 62, 0.3);
color: #9a7003;
}
}
.shopTabs { .shopTabs {
display: flex; display: flex;
width: calc(100vw - 20px); width: calc(100vw - 20px);

BIN
src/pages/Coupons/ordBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
src/pages/Coupons/plaBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
src/pages/Coupons/silBg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

1
src/pages/Index/Index.js

@ -643,6 +643,7 @@ const Index = () => {
show={showCoupon} show={showCoupon}
memberID={memberID} memberID={memberID}
isShop={isShop} isShop={isShop}
mall={mall}
></Coupons> ></Coupons>
<div className={"hud " + (isTyping ? "bg" : "")}> <div className={"hud " + (isTyping ? "bg" : "")}>
{!(start || end) && ( {!(start || end) && (

Loading…
Cancel
Save