diff --git a/src/js/helpers/data-helper.js b/src/js/helpers/data-helper.js index ff5b21e..60cf8fd 100644 --- a/src/js/helpers/data-helper.js +++ b/src/js/helpers/data-helper.js @@ -2,11 +2,11 @@ import axios from "axios"; import icons from "./image-helper"; let mallInfos = new Map(); // 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 -// 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 = {}) => { const response = await fetch(baseUrl + url, { method: "POST", @@ -72,7 +72,7 @@ const getMallInfo = async ({ memberID }) => { activities, pois, menu, - shopCouponMap, + { shopCouponMap, userLevel }, ] = await Promise.all([ (async () => { try { @@ -161,7 +161,7 @@ const getMallInfo = async ({ memberID }) => { (async () => { try { const { - data: { shopDetailShowCoupon }, + data: { shopDetailShowCoupon, level: userLevel }, } = await post(`/api/ar/v1/applet/MiniproBasicData`, { memberID, }); @@ -169,7 +169,7 @@ const getMallInfo = async ({ memberID }) => { (acc, nxt) => ({ ...acc, [nxt]: true }), {} ); - return shopCouponMap; + return { shopCouponMap, userLevel }; } catch (error) { console.error(error); return {}; @@ -250,6 +250,7 @@ const getMallInfo = async ({ memberID }) => { }, []), poiMap, menu, + userLevel, }); const mallInfo = { mall, shopInfo, images }; mallInfos.set(mall.code, mallInfo); diff --git a/src/pages/Coupons/CouponList/CouponList.js b/src/pages/Coupons/CouponList/CouponList.js index b493c8c..57bb648 100644 --- a/src/pages/Coupons/CouponList/CouponList.js +++ b/src/pages/Coupons/CouponList/CouponList.js @@ -111,6 +111,7 @@ const CouponList = ({ memberID }) => { width: (window.innerWidth / 375) * 64, height: (window.innerWidth / 375) * 64, }} + alt="券图" > ) : ( { 使用期限
{coupon.beginTime}至{coupon.endTime} +
))} @@ -157,6 +168,16 @@ const CouponList = ({ memberID }) => {
{modalCoupon.couponRules}
)} +
)} diff --git a/src/pages/Coupons/CouponList/CouponList.scss b/src/pages/Coupons/CouponList/CouponList.scss index c713a64..17f91f6 100644 --- a/src/pages/Coupons/CouponList/CouponList.scss +++ b/src/pages/Coupons/CouponList/CouponList.scss @@ -151,6 +151,21 @@ top: 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 { margin-top: 8px; @@ -264,5 +279,20 @@ overflow: hidden; 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); + } + } } } diff --git a/src/pages/Coupons/CouponList/ordBg.png b/src/pages/Coupons/CouponList/ordBg.png new file mode 100644 index 0000000..802501f Binary files /dev/null and b/src/pages/Coupons/CouponList/ordBg.png differ diff --git a/src/pages/Coupons/CouponList/plaBg.png b/src/pages/Coupons/CouponList/plaBg.png new file mode 100644 index 0000000..9115d91 Binary files /dev/null and b/src/pages/Coupons/CouponList/plaBg.png differ diff --git a/src/pages/Coupons/CouponList/silBg.png b/src/pages/Coupons/CouponList/silBg.png new file mode 100644 index 0000000..5a53614 Binary files /dev/null and b/src/pages/Coupons/CouponList/silBg.png differ diff --git a/src/pages/Coupons/Coupons.js b/src/pages/Coupons/Coupons.js index 3cff00b..e1194ae 100644 --- a/src/pages/Coupons/Coupons.js +++ b/src/pages/Coupons/Coupons.js @@ -6,7 +6,7 @@ import ShopTabs from "./ShopTabs/ShopTabs"; import CouponList from "./CouponList/CouponList"; import ShopManager from "./ShopManager/ShopManager"; -const Coupons = ({ show, memberID, isShop = false }) => { +const Coupons = ({ show, memberID, isShop = false, mall }) => { const isNotMember = !memberID; const [showCoupons, setShowCoupons] = useState(true); return ( @@ -35,6 +35,29 @@ const Coupons = ({ show, memberID, isShop = false }) => { ) : ( <> + {mall && ( +
+ {mall.userLevel}会员 +
+ {mall.userLevel === "铂金" + ? "Platinum" + : mall.userLevel === "白银" + ? "Silver" + : "Ordinary"}{" "} + Member +
+
欢迎加入会员!
+
+ )} {isShop && ( { show={showCoupon} memberID={memberID} isShop={isShop} + mall={mall} >
{!(start || end) && (