完成添加剂列表,标准查询

This commit is contained in:
ivo 2023-02-01 21:46:42 +08:00
parent 6799c38291
commit e73c80c1a9
23 changed files with 553 additions and 64 deletions

View File

@ -31,7 +31,10 @@
"pages/usercenter/name-edit/index", "pages/usercenter/name-edit/index",
"pages/home/session/session", "pages/home/session/session",
"pages/home/additive/additive", "pages/home/additive/additive",
"pages/home/chemical/chemical" "pages/home/chemical/chemical",
"pages/additive/list/additive-list",
"pages/standard/list/index",
"pages/user/index"
], ],
"tabBar": { "tabBar": {
"custom": true, "custom": true,
@ -45,15 +48,15 @@
"text": "首页" "text": "首页"
}, },
{ {
"pagePath": "pages/goods/category/index", "pagePath": "pages/additive/list/additive-list",
"text": "分类" "text": "分类"
}, },
{ {
"pagePath": "pages/cart/index", "pagePath": "pages/standard/list/index",
"text": "购物车" "text": "标准"
}, },
{ {
"pagePath": "pages/usercenter/index", "pagePath": "pages/user/index",
"text": "我的" "text": "我的"
} }
] ]

View File

@ -5,17 +5,17 @@ export default [{
}, },
{ {
icon: 'sort', icon: 'sort',
text: '分类', text: '添加剂',
url: 'pages/goods/category/index', url: 'pages/additive/list/additive-list',
}, },
{ {
icon: 'cart', icon: 'wallet',
text: '购物车', text: '标准',
url: 'pages/cart/index', url: 'pages/standard/list/index',
}, },
{ {
icon: 'person', icon: 'person',
text: '个人中心', text: '个人中心',
url: 'pages/usercenter/index', url: 'pages/user/index',
}, },
]; ];

View File

@ -1,18 +1,8 @@
<t-tab-bar <t-tab-bar value="{{active}}" bindchange="onChange" split="{{false}}">
value="{{active}}" <t-tab-bar-item wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index">
bindchange="onChange" <view class="custom-tab-bar-wrapper">
split="{{false}}" <t-icon prefix="wr" name="{{item.icon}}" data-name="{{item.icon}}" size="48rpx" />
> <view class="text">{{ item.text }}</view>
<t-tab-bar-item </view>
wx:for="{{list}}" </t-tab-bar-item>
wx:for-item="item" </t-tab-bar>
wx:for-index="index"
wx:key="index"
>
<view class="custom-tab-bar-wrapper">
<t-icon prefix="wr" name="{{item.icon}}" size="48rpx" />
<view class="text">{{ item.text }}</view>
</view>
</t-tab-bar-item>
</t-tab-bar>

BIN
images/standard.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
images/weixin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -0,0 +1,111 @@
// pages/additive/list/additive-list.js
import {
sessionAdditiveList
} from '../../../services/api/additive';
Page({
/**
* 页面的初始数据
*/
data: {
searchValue: "",
addtiveList: [],
page: {
num: 1,
size: 20,
total: 0
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getAddtiveList();
},
getAddtiveList() {
console.log(this.data.searchValue);
const params = {
pageNumber: this.data.page.num,
pageSize: this.data.page.size
}
if (this.data.searchValue) {
params['search'] = this.data.searchValue
}
sessionAdditiveList(params).then(respose => {
this.setData({
addtiveList: respose.content.contentList,
"page.total": respose.content.total
})
})
},
doSearch(e) {
console.log(e);
const value = e.detail.value;
this.setData({
"page.num": 1,
"searchValue": value
})
this.getAddtiveList();
},
onGoAdditive(event) {
const additiveId = event.currentTarget.dataset.additive;
wx.navigateTo({
url: `/pages/home/additive/additive?additiveId=${additiveId}`,
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getTabBar().init();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,12 @@
{
"navigationBarTitleText": "添加剂",
"onReachBottomDistance": 10,
"backgroundTextStyle": "light",
"usingComponents": {
"t-sticky": "tdesign-miniprogram/sticky/sticky",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-tag": "tdesign-miniprogram/tag/tag",
"t-search": "tdesign-miniprogram/search/search"
}
}

View File

@ -0,0 +1,17 @@
<!--pages/additive/list/additive-list.wxml-->
<view class="main">
<t-sticky>
<t-search t-class="t-search" t-class-input-container="t-class__input-container" t-class-left="t-search__left-icon" t-class-input="t-search__input" leftIcon="" rightIcon="" placeholder="请输入添加剂信息" bind:submit="doSearch" value="{{searchValue}}">
<t-icon slot="left-icon" prefix="wr" name="search" size="40rpx" color="#bbb" />
</t-search>
</t-sticky>
<view class="list-view">
<t-cell wx:for="{{addtiveList}}" wx:key="index" wx:for-item="item" hover arrow data-additive="{{item.id}}" bindtap="onGoAdditive">
<view slot="title">
<view>{{item.name}}</view>
<view class="addtive-enname">{{item.enName}}</view>
<view class="addtive-enname">{{item.function}}</view>
</view>
</t-cell>
</view>
</view>

View File

@ -0,0 +1,21 @@
/* pages/additive/list/additive-list.wxss */
.main {
padding: 10px;
}
.list-view {
margin-bottom: 80px;
}
.addtive-enname {
font-size: 0.875rem;
line-height: 1.25rem;
color: rgb(150, 150, 150);
margin-top: 5px;
margin-bottom: 5px;
white-space: nowrap;
overflow: hidden;
width: 250px;
text-overflow: clip;
}

View File

@ -59,6 +59,7 @@ Page({
init() { init() {
this.loadHomePage(); this.loadHomePage();
isLogin()
}, },
loadHomePage() { loadHomePage() {
@ -170,9 +171,6 @@ Page({
// 上传图片 // 上传图片
uploadPicture() { uploadPicture() {
if (!isLogin()) {
return
}
wx.chooseMedia({ wx.chooseMedia({
count: 1, count: 1,
mediaType: ['image'], mediaType: ['image'],

View File

@ -11,7 +11,7 @@
<!-- <t-button bindtap="textButton"></t-button> --> <!-- <t-button bindtap="textButton"></t-button> -->
<t-image t-class="searich_btn" shape="round" mode="heightFix" src="/images/search.jpg" bind:tap="uploadPicture" /> <t-image t-class="searich_btn" shape="round" mode="heightFix" src="/images/search.jpg" bind:tap="uploadPicture" />
</view> </view>
<view class="home-page-ad"></view> <!-- <view class="home-page-ad"></view> -->
<t-dialog visible="{{loadingDialog}}" cancel-btn="取消操作" bind:cancel="onCloseDialog"> <t-dialog visible="{{loadingDialog}}" cancel-btn="取消操作" bind:cancel="onCloseDialog">
<view slot="content"> <view slot="content">
<t-loading t-class="dialog-content" theme="circular" size="200rpx" class="large" /> <t-loading t-class="dialog-content" theme="circular" size="200rpx" class="large" />

View File

@ -55,7 +55,7 @@ Page({
} }
}) })
sessionAdditiveQuery({ sessionAdditiveQuery({
id: this.sessionId id: this.data.sessionId
}).then(respose => { }).then(respose => {
this.setData({ this.setData({
additives: respose.content.additives additives: respose.content.additives

View File

@ -0,0 +1,109 @@
// pages/standard/list/index.js
import {
sessionStandardList
} from '../../../services/api/standard';
Page({
/**
* 页面的初始数据
*/
data: {
searchValue: "",
standardList: [],
page: {
num: 1,
size: 20,
total: 0
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getStandardList();
},
doSearch(e) {
const value = e.detail.value;
this.setData({
"page.num": 1,
"searchValue": value
})
this.getStandardList();
},
doSearchClear(e) {
this.setData({
"searchValue": '',
"standardList": []
})
},
getStandardList() {
const params = {
pageNumber: this.data.page.num,
pageSize: this.data.page.size
}
if (this.data.searchValue) {
params['search'] = this.data.searchValue
sessionStandardList(params).then(respose => {
this.setData({
standardList: respose.content.contentList,
"page.total": respose.content.total
})
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getTabBar().init();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,8 @@
{
"usingComponents": {
"t-search": "tdesign-miniprogram/search/search",
"t-tag": "tdesign-miniprogram/tag/tag",
"t-check-tag": "tdesign-miniprogram/tag/check-tag",
"t-image": "tdesign-miniprogram/image/image"
}
}

View File

@ -0,0 +1,20 @@
<!--pages/standard/list/index.wxml-->
<view class="main">
<view wx:if="{{standardList.length == 0}}" class="top-empty"></view>
<view class="search-view">
<t-search t-class="search" placeholder="搜索标准" shape="round" bind:submit="doSearch" bind:clear="doSearchClear" value="{{searchValue}}" />
</view>
<view wx:if="{{standardList.length == 0}}" class="standard-image">
<t-image shape="round" mode="heightFix" src="/images/standard.jpg" bind:tap="uploadPicture" />
</view>
<view class="list-view">
<view class="standard-item" wx:for="{{standardList}}" wx:key="index" wx:for-item="item">
<view class="standard-name">{{item.name}}</view>
<view class="standard-code">{{item.code}}</view>
<view class="standard-bottom">
<view class="standard-public">{{item.public}}</view>
<t-tag variant="light" theme="{{item.status == 3 ? 'warning' : 'success'}}">{{item.status == 3 ? '过期' : '有效'}}</t-tag>
</view>
</view>
</view>
</view>

View File

@ -0,0 +1,64 @@
/* pages/standard/list/index.wxss */
.main {
padding: 10px;
}
.top-empty {
width: 100%;
height: 150px;
}
.search-view {
display: flex;
justify-content: center;
}
.search {
width: 250px;
}
.standard-image {
padding-top: 30px;
display: flex;
justify-content: center;
}
.list-view {
margin: 10px;
margin-top: 20px;
margin-bottom: 80px;
}
.standard-item {
--tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
border-style: solid;
border-width: 2px;
border-color: rgba(230, 230, 230, 0.719);
margin: 10px;
padding: 10px;
border-radius: 0.5rem;
}
.standard-name {
font-weight: 600;
}
.standard-code {
margin-top: 5px;
margin-left: 10px;
margin-bottom: 5px;
color: rgb(150, 150, 150);
}
.standard-bottom {
display: flex;
justify-content: space-between;
align-items: center;
}
.standard-public {
font-size: 0.875rem;
line-height: 1.25rem;
}

73
pages/user/index.js Normal file
View File

@ -0,0 +1,73 @@
// pages/user/index.js
import {
isLogin
} from '../../services/permission/login';
Page({
/**
* 页面的初始数据
*/
data: {
loginStatus: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
loginStatus: isLogin()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.getTabBar().init();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

6
pages/user/index.json Normal file
View File

@ -0,0 +1,6 @@
{
"usingComponents": {
"t-image": "/components/webp-image/index",
"t-avatar": "tdesign-miniprogram/avatar/avatar"
}
}

9
pages/user/index.wxml Normal file
View File

@ -0,0 +1,9 @@
<!--pages/user/index.wxml-->
<view class="user-center-card">
<view class="searich_btn">
<t-avatar image="/images/weixin.png" class="user-center-card__header__avatar" />
<view class="user-center-card__header__name">{{ loginStatus ? '微信用户' :'请登录'}}</view>
</view>
</view>
<view></view>

40
pages/user/index.wxss Normal file
View File

@ -0,0 +1,40 @@
/* pages/user/index.wxss */
.user-center-card {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 480rpx;
background-image: url('https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png');
background-size: cover;
background-repeat: no-repeat;
padding: 0 24rpx;
}
.searich_btn {
margin-top: 192rpx;
margin-bottom: 48rpx;
height: 96rpx;
line-height: 48rpx;
display: flex;
justify-content: flex-start;
align-items: center;
color: #333;
position: relative;
}
.user-center-card__header__avatar {
width: 96rpx;
height: 96rpx;
border-radius: 48rpx;
overflow: hidden;
}
.user-center-card__header__name {
font-size: 36rpx;
line-height: 48rpx;
color: #333;
font-weight: bold;
margin-left: 24rpx;
margin-right: 16rpx;
}

View File

@ -1,17 +1,9 @@
<t-user-center-card <t-user-center-card userInfo="{{userInfo}}" isPhoneHide="{{true}}" name-class="custom-name-class" phone-class="custom-phone-class" avatar-class="custome-avatar-class" currAuthStep="{{currAuthStep}}" bind:gotoUserEditPage="gotoUserEditPage" />
userInfo="{{userInfo}}"
isPhoneHide="{{true}}"
name-class="custom-name-class"
phone-class="custom-phone-class"
avatar-class="custome-avatar-class"
currAuthStep="{{currAuthStep}}"
bind:gotoUserEditPage="gotoUserEditPage"
/>
<view class="content-wrapper"> <view class="content-wrapper">
<view class='order-group-wrapper'> <!-- <view class='order-group-wrapper'>
<t-order-group orderTagInfos="{{orderTagInfos}}" bind:onClickTop="jumpAllOrder" bind:onClickItem="jumpNav" /> <t-order-group orderTagInfos="{{orderTagInfos}}" bind:onClickTop="jumpAllOrder" bind:onClickItem="jumpNav" />
</view> </view> -->
<view wx:for="{{menuData}}" wx:key="item" class="cell-box"> <!-- <view wx:for="{{menuData}}" wx:key="item" class="cell-box">
<t-cell-group> <t-cell-group>
<t-cell <t-cell
wx:for="{{item}}" wx:for="{{item}}"
@ -31,23 +23,17 @@
<t-icon name="{{xitem.icon}}" size="48rpx" slot="note" /> <t-icon name="{{xitem.icon}}" size="48rpx" slot="note" />
</t-cell> </t-cell>
</t-cell-group> </t-cell-group>
</view> </view> -->
</view> </view>
<view class="footer__version" wx:if="{{versionNo !== ''}}">当前版本 {{versionNo}}</view> <view class="footer__version" wx:if="{{versionNo !== ''}}">当前版本 {{versionNo}}</view>
<t-popup <t-popup visible="{{showMakePhone}}" placement="bottom" bind:visible-change="closeMakePhone" data-index="2">
visible="{{showMakePhone}}" <view class="popup-content">
placement="bottom" <view class="popup-title border-bottom-1px" wx:if="{{customerServiceInfo.serviceTimeDuration}}">
bind:visible-change="closeMakePhone" 服务时间: {{customerServiceInfo.serviceTimeDuration}}
data-index="2" </view>
> <view class="popup-phone {{showKefu ? 'border-bottom-1px' : ''}}" bind:tap="call">电话客服</view>
<view class="popup-content"> <button class="popup-phone border-bottom-1px online" open-type="contact" wx:if="{{showKefu}}">在线客服</button>
<view class="popup-title border-bottom-1px" wx:if="{{customerServiceInfo.serviceTimeDuration}}"> <view class="popup-close" bind:tap="closeMakePhone">取消</view>
服务时间: {{customerServiceInfo.serviceTimeDuration}} </view>
</view>
<view class="popup-phone {{showKefu ? 'border-bottom-1px' : ''}}" bind:tap="call">电话客服</view>
<button class="popup-phone border-bottom-1px online" open-type="contact" wx:if="{{showKefu}}">在线客服</button>
<view class="popup-close" bind:tap="closeMakePhone">取消</view>
</view>
</t-popup> </t-popup>
<t-toast id="t-toast" /> <t-toast id="t-toast" />

11
services/api/additive.js Normal file
View File

@ -0,0 +1,11 @@
import {
request
} from './request'
export function sessionAdditiveList(params) {
return request({
path: '/additive/list',
params: params,
method: 'GET'
});
}

11
services/api/standard.js Normal file
View File

@ -0,0 +1,11 @@
import {
request
} from './request'
export function sessionStandardList(params) {
return request({
path: '/standard/list',
params: params,
method: 'GET'
});
}