上传代码
This commit is contained in:
76
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.js
vendored
Normal file
76
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.js
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"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");
|
||||
(_easycom_uni_rate2 + _easycom_uni_icons2)();
|
||||
}
|
||||
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";
|
||||
if (!Math) {
|
||||
(_easycom_uni_rate + _easycom_uni_icons)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "fruits",
|
||||
setup(__props) {
|
||||
const historyList = common_vendor.ref([]);
|
||||
const filteredHistoryList = common_vendor.computed(() => {
|
||||
return historyList.value.filter((item) => item.categoryId === "3");
|
||||
});
|
||||
const fetchHistoryData = async () => {
|
||||
try {
|
||||
const res = await common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/business/list",
|
||||
method: "POST"
|
||||
});
|
||||
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.id);
|
||||
common_vendor.index.setStorageSync("Mybusiness", item);
|
||||
common_vendor.index.setStorageSync("businessItem", item.id);
|
||||
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}`
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.f(filteredHistoryList.value, (item, index, i0) => {
|
||||
return {
|
||||
a: item.businessAvatar,
|
||||
b: common_vendor.t(item.businessName),
|
||||
c: "4c1ae724-0-" + i0,
|
||||
d: common_vendor.p({
|
||||
readonly: true,
|
||||
value: item.level,
|
||||
size: "12px"
|
||||
}),
|
||||
e: "4c1ae724-1-" + i0,
|
||||
f: index,
|
||||
g: common_vendor.o(($event) => handleDonate(item), index)
|
||||
};
|
||||
}),
|
||||
b: common_vendor.p({
|
||||
type: "paperplane-filled",
|
||||
color: "#e99e44"
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
wx.createPage(_sfc_main);
|
9
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.json
vendored
Normal file
9
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.json
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"navigationBarTitleText": "第三餐厅",
|
||||
"navigationBarBackgroundColor": "#4095e5",
|
||||
"enablePullDownRefresh": false,
|
||||
"usingComponents": {
|
||||
"uni-rate": "../../uni_modules/uni-rate/components/uni-rate/uni-rate",
|
||||
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons"
|
||||
}
|
||||
}
|
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.wxml
vendored
Normal file
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.wxml
vendored
Normal file
@ -0,0 +1 @@
|
||||
<view class="container"><view class="history-list"><view wx:for="{{a}}" wx:for-item="item" wx:key="f" class="history-item" bindtap="{{item.g}}"><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 wx:if="{{item.d}}" u-i="{{item.c}}" bind:__l="__l" u-p="{{item.d}}"/></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 wx:if="{{b}}" u-i="{{item.e}}" bind:__l="__l" u-p="{{b}}"></uni-icons> 支持自取 </view></view></view></view></view>
|
83
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.wxss
vendored
Normal file
83
uniapp04/unpackage/dist/dev/mp-weixin/pages/fruits/fruits.wxss
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.history-list {
|
||||
width: 100%;
|
||||
}
|
||||
.history-item {
|
||||
padding: 10px 0px 10px 5px;
|
||||
display: flex;
|
||||
margin-bottom: 20rpx;
|
||||
border: 1px solid #999;
|
||||
background-color: #fff;
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user