上传代码
This commit is contained in:
92
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.acss
vendored
Normal file
92
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.acss
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.history-list {
|
||||
width: 100%;
|
||||
}
|
||||
.history-item {
|
||||
width: 100%;
|
||||
padding: 10px 0px 10px 5px;
|
||||
display: flex;
|
||||
margin-bottom: 20rpx;
|
||||
border: 1px solid #999;
|
||||
background-color: #fff;
|
||||
border-radius: 15px;
|
||||
}
|
||||
.delete-button {
|
||||
background-color: #03c4ff;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 25px 20px;
|
||||
height: 90%;
|
||||
border-radius: 15px;
|
||||
}
|
||||
.history-img {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-right: 20rpx;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.history-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.history-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.history-description {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
.starSale {
|
||||
width: 120px;
|
||||
height: 15px;
|
||||
}
|
||||
.star {
|
||||
display: inline-block;
|
||||
line-height: 15px;
|
||||
}
|
||||
.history-sale {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
float: right;
|
||||
display: inline-block;
|
||||
line-height: 15px;
|
||||
}
|
||||
.startPoints {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
}
|
||||
.points {
|
||||
padding-left: 15px;
|
||||
font-size: 20rpx;
|
||||
line-height: 20px;
|
||||
color: #d41414;
|
||||
}
|
||||
.distance,
|
||||
.time {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
padding-left: 25px;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.history-start,
|
||||
.history-distance {
|
||||
font-size: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
.exchange {
|
||||
font-size: 24rpx;
|
||||
color: #e99e44;
|
||||
background-color: #f7dbb3;
|
||||
width: 75px;
|
||||
height: 20px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #e99e44;
|
||||
}
|
1
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.axml
vendored
Normal file
1
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.axml
vendored
Normal file
@ -0,0 +1 @@
|
||||
<button onTap="{{a}}">一键清空</button><view class="container"><view class="history-list"><uni-swipe-action u-s="{{['d']}}" u-i="4976a7da-0" onVI="__l"><uni-swipe-action-item a:for="{{b}}" a:for-item="item" a:key="g" u-s="{{['right','d']}}" u-i="{{item.h}}" onVI="__l"><view class="history-item" onTap="{{item.e}}"><image class="history-img" src="{{item.a}}"></image><view class="history-info"><text class="history-title">{{item.b}}</text><view class="starSale"><view class="star"><uni-rate u-i="{{item.c}}" onVI="__l" u-p="{{c||''}}"/></view><text class="history-sale">月售:234</text></view><view class="startPoints"><text class="history-start">起送:¥10</text><text class="points">用积分更优惠</text><text class="distance">2.3km</text><text class="time">30min</text></view><view class="exchange"><uni-icons u-i="{{item.d}}" onVI="__l" u-p="{{d||''}}"></uni-icons> 支持自取 </view></view></view><button class="delete-button" catchTap="{{item.f}}" slot="right">取消收藏</button></uni-swipe-action-item></uni-swipe-action></view></view>
|
127
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.js
vendored
Normal file
127
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.js
vendored
Normal file
@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const API_api = require("../../API/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_uni_rate2 = common_vendor.resolveComponent("uni-rate");
|
||||
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||
const _easycom_uni_swipe_action_item2 = common_vendor.resolveComponent("uni-swipe-action-item");
|
||||
const _easycom_uni_swipe_action2 = common_vendor.resolveComponent("uni-swipe-action");
|
||||
(_easycom_uni_rate2 + _easycom_uni_icons2 + _easycom_uni_swipe_action_item2 + _easycom_uni_swipe_action2)();
|
||||
}
|
||||
const _easycom_uni_rate = () => "../../uni_modules/uni-rate/components/uni-rate/uni-rate.js";
|
||||
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
||||
const _easycom_uni_swipe_action_item = () => "../../uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.js";
|
||||
const _easycom_uni_swipe_action = () => "../../uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.js";
|
||||
if (!Math) {
|
||||
(_easycom_uni_rate + _easycom_uni_icons + _easycom_uni_swipe_action_item + _easycom_uni_swipe_action)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "collect",
|
||||
setup(__props) {
|
||||
const historyList = common_vendor.ref([]);
|
||||
const fetchHistoryData = async () => {
|
||||
try {
|
||||
const res = await common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/collect/list",
|
||||
method: "POST",
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||||
}
|
||||
});
|
||||
if (res.data.code === 0) {
|
||||
console.log(res.data.data);
|
||||
historyList.value = res.data.data;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching data:", error);
|
||||
}
|
||||
};
|
||||
common_vendor.onMounted(() => {
|
||||
fetchHistoryData();
|
||||
});
|
||||
const handleDonate = (item) => {
|
||||
console.log(item);
|
||||
common_vendor.index.setStorageSync("Mybusiness", item);
|
||||
if (!item || !item.hasOwnProperty("id")) {
|
||||
console.error("The 'item' variable is undefined or missing the 'id' property.");
|
||||
return;
|
||||
}
|
||||
const merchantId = item.id;
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages/merchant/merchant?merchantId=${merchantId}`
|
||||
});
|
||||
};
|
||||
const clear = () => {
|
||||
common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/collect/delete/all",
|
||||
method: "POST",
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||||
},
|
||||
success(res) {
|
||||
console.log(res);
|
||||
console.log("成功啦");
|
||||
fetchHistoryData();
|
||||
},
|
||||
fail() {
|
||||
console.log("失败啦");
|
||||
}
|
||||
});
|
||||
};
|
||||
const onDelete = (item) => {
|
||||
console.log(item);
|
||||
console.log(item.business.id);
|
||||
const businessId = item.business.id;
|
||||
common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/collect/delete",
|
||||
method: "POST",
|
||||
data: { id: businessId },
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
"cookie": common_vendor.index.getStorageSync("cookie") || ""
|
||||
},
|
||||
success(res) {
|
||||
if (res.data.code === 0) {
|
||||
console.log("删除成功");
|
||||
fetchHistoryData();
|
||||
} else {
|
||||
console.error("删除失败:", res.data.message);
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
console.log("请求失败");
|
||||
}
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.o(clear),
|
||||
b: common_vendor.f(historyList.value, (item, index, i0) => {
|
||||
var _a, _b;
|
||||
return {
|
||||
a: (_a = item.business) == null ? void 0 : _a.businessAvatar,
|
||||
b: common_vendor.t((_b = item.business) == null ? void 0 : _b.businessName),
|
||||
c: "4976a7da-2-" + i0 + "," + ("4976a7da-1-" + i0),
|
||||
d: "4976a7da-3-" + i0 + "," + ("4976a7da-1-" + i0),
|
||||
e: common_vendor.o(($event) => handleDonate(item)),
|
||||
f: common_vendor.o(($event) => onDelete(item)),
|
||||
g: index,
|
||||
h: "4976a7da-1-" + i0 + ",4976a7da-0"
|
||||
};
|
||||
}),
|
||||
c: common_vendor.p({
|
||||
readonly: true,
|
||||
value: 4,
|
||||
size: "12px"
|
||||
}),
|
||||
d: common_vendor.p({
|
||||
type: "paperplane-filled",
|
||||
color: "#e99e44"
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
my.createPage(_sfc_main);
|
9
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.json
vendored
Normal file
9
uniapp04/unpackage/dist/dev/mp-alipay/pages/collect/collect.json
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"defaultTitle": "收藏列表",
|
||||
"usingComponents": {
|
||||
"uni-rate": "../../uni_modules/uni-rate/components/uni-rate/uni-rate",
|
||||
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons",
|
||||
"uni-swipe-action-item": "../../uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item",
|
||||
"uni-swipe-action": "../../uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user