You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

155 lines
5.0 KiB

"use strict";
const common_vendor = require("../../common/vendor.js");
const config_host = require("../../config/host.js");
const api_user = require("../../api/user.js");
require("../../utils/request.js");
require("../../utils/functions.js");
require("../../utils/log.js");
require("../../utils/qqmap-wx-jssdk.min.js");
const HeaderNav = () => "../../components/HeaderNav/Index.js";
const FooterNav = () => "../../components/FooterNav/Index.js";
const RightNav = () => "../../components/RightNav/Index.js";
const MzButton = () => "../../components/MzButton/Index.js";
const _sfc_main = {
components: {
HeaderNav,
FooterNav,
RightNav,
MzButton
},
data() {
return {
title: "Hello",
loading: true,
staticImage: {
screenActiveImg: config_host.imghost + "/static/image/order-screen-active.png",
orderCardBackground: config_host.imghost + "/static/image/order-card-background.png",
wallpaperBgImage: config_host.imghost + "/static/image/background.png",
couponsBackground: config_host.imghost + "/static/image/coupons-bg.png",
couponsGrayBackground: config_host.imghost + "/static/image/coupons-gray-bg.png",
couponsGQ: config_host.imghost + "/static/image/coupons-gq.png"
},
indexBanner: [{
image: config_host.imghost + "/static/image/banner.png",
url: ""
}],
user: {
avatar: config_host.imghost + "/static/image/banner.png",
nickname: "清晨的风",
coupons: 221,
id: 88685
},
isTop: false,
pagePadding: 100,
petImage: config_host.imghost + "/static/image/pet_avatar1.jpeg",
couponsList: [{
price: "57",
title: "满0.11减57元优惠券",
cause: "满0.11使用",
time: "有效期至2023.08.09",
is_timeout: false
}, {
price: "58",
title: "满0.02减58元优惠券",
cause: "满0.02使用",
time: "有效期至2023.08.01",
is_timeout: true
}, {
price: "580",
title: "满0.01减580元优惠券",
cause: "满0.01使用",
time: "有效期至2023.08.02",
is_timeout: false
}]
};
},
onLoad() {
},
methods: {
navTo(url) {
common_vendor.index.navigateTo({
url
});
},
getCouponsList(page = 1) {
api_user.userCoupons({
page
}).then((res) => {
this.couponsList = res.data.map((row) => {
return {
price: parseFloat(row.deduction),
title: row.title,
time: "有效期至 " + row.end_time,
cause: "满" + parseFloat(row.min_price) + "使用",
is_timeout: row.status == 2
};
});
});
}
},
onPageScroll(res) {
if (res.scrollTop <= 20) {
common_vendor.index.$emit("isTop", true);
} else {
common_vendor.index.$emit("isTop", false);
}
},
created() {
},
mounted() {
this.getCouponsList();
}
};
if (!Array) {
const _component_HeaderNav = common_vendor.resolveComponent("HeaderNav");
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
const _component_MzButton = common_vendor.resolveComponent("MzButton");
(_component_HeaderNav + _easycom_u_icon2 + _component_MzButton)();
}
const _easycom_u_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
if (!Math) {
_easycom_u_icon();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
title: "优惠在这",
["is-back"]: true
}),
b: common_vendor.o(($event) => $options.navTo("/pages/Card/index")),
c: common_vendor.f($data.couponsList, (item, k0, i0) => {
return {
a: common_vendor.t(item.price),
b: common_vendor.t(item.cause),
c: common_vendor.t(item.title),
d: common_vendor.t(item.time),
e: item.is_timeout,
f: "75fb6c0b-1-" + i0,
g: "75fb6c0b-2-" + i0,
h: common_vendor.p({
title: "立即使用",
["button-width"]: "145rpx",
["button-color"]: item.is_timeout ? "#CACACA" : "#4DC3B8",
["font-color"]: "#fff",
["font-size"]: "26rpx",
["is-background"]: false,
["padding-tb"]: "2rpx",
["btn-style"]: {
boxShadow: item.is_timeout ? "2rpx -5rpx 0rpx 0rpx rgba(199,199,199,0.35)" : "2rpx -5rpx 0rpx 0rpx rgba(77,195,184,0.35)"
}
}),
i: "url(" + (item.is_timeout ? $data.staticImage.couponsGrayBackground : $data.staticImage.couponsBackground) + ")"
};
}),
d: $data.staticImage.couponsGQ,
e: common_vendor.p({
size: "24rpx",
color: "#999999",
name: "arrow-right"
}),
f: "url(" + $data.staticImage.wallpaperBgImage + ")"
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/phpstudy_pro/WEB/pet_uni/pages/UserCoupons/index.vue"]]);
_sfc_main.__runtimeHooks = 1;
wx.createPage(MiniProgramPage);