bugfix
This commit is contained in:
@ -18,3 +18,8 @@ export const getInfo = (token?: string) =>
|
||||
Authorization: token ? `Bearer ${token}` : undefined,
|
||||
},
|
||||
});
|
||||
|
||||
export const getProfile = () =>
|
||||
httpClient.request({
|
||||
url: "/system/user/profile",
|
||||
});
|
||||
|
@ -6,19 +6,19 @@
|
||||
"pages/stock/stock",
|
||||
"pages/add-stock/add-stock"
|
||||
],
|
||||
"entryPagePath": "pages/stock/stock",
|
||||
"tabBar": {
|
||||
"selectedColor": "#0052d9",
|
||||
"list": [{
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "财务",
|
||||
"iconPath": "assets/tab-icons/money-collect.png",
|
||||
"selectedIconPath": "assets/tab-icons/money-collect_selected.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/stock/stock",
|
||||
"text": "库存",
|
||||
"iconPath": "assets/tab-icons/stock.png",
|
||||
"selectedIconPath": "assets/tab-icons/stock_selected.png"
|
||||
}, {
|
||||
"pagePath": "pages/index/index",
|
||||
"text": "财务",
|
||||
"iconPath": "assets/tab-icons/money-collect.png",
|
||||
"selectedIconPath": "assets/tab-icons/money-collect_selected.png"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/login/login",
|
||||
@ -32,7 +32,8 @@
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#f6f6f6",
|
||||
"navigationBarTitleText": "口袋九章",
|
||||
"navigationBarTextStyle": "black"
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationStyle": "custom"
|
||||
},
|
||||
"usingComponents": {
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
@ -42,7 +43,8 @@
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-message": "tdesign-miniprogram/message/message",
|
||||
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar"
|
||||
},
|
||||
"lazyCodeLoading": "requiredComponents",
|
||||
"sitemapLocation": "sitemap.json"
|
||||
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
@ -1 +0,0 @@
|
||||
/* components/infinite-scroll/index.wxss */
|
@ -1,44 +0,0 @@
|
||||
// components/infinite-scroll/index.ts
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
//@ts-ignore
|
||||
this._observer = wx.createIntersectionObserver(this);
|
||||
//@ts-ignore
|
||||
this._observer
|
||||
// .createIntersectionObserver()
|
||||
.relativeToViewport({ bottom: 100 })
|
||||
.observe(".load-more", (res: any) => {
|
||||
console.log(res);
|
||||
res.intersectionRatio; // 相交区域占目标节点的布局区域的比例
|
||||
res.intersectionRect; // 相交区域
|
||||
res.intersectionRect.left; // 相交区域的左边界坐标
|
||||
res.intersectionRect.top; // 相交区域的上边界坐标
|
||||
res.intersectionRect.width; // 相交区域的宽度
|
||||
res.intersectionRect.height; // 相交区域的高度
|
||||
});
|
||||
// //@ts-ignore
|
||||
// this._observer = wx.createIntersectionObserver(this);
|
||||
|
||||
// //@ts-ignore
|
||||
// this._observer.relativeTo(".scroll-view").observe(".load-more", (res) => {
|
||||
// console.log("到底了");
|
||||
// this.triggerEvent("loadmore", {}, {});
|
||||
// });
|
||||
},
|
||||
},
|
||||
});
|
@ -1,5 +0,0 @@
|
||||
<!--components/infinite-scroll/index.wxml-->
|
||||
<view>
|
||||
<slot></slot>
|
||||
<view class="load-more">load more</view>
|
||||
</view>
|
6
miniprogram/components/load-more/index.json
Normal file
6
miniprogram/components/load-more/index.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-loading": "tdesign-miniprogram/loading/loading"
|
||||
}
|
||||
}
|
15
miniprogram/components/load-more/index.scss
Normal file
15
miniprogram/components/load-more/index.scss
Normal file
@ -0,0 +1,15 @@
|
||||
/* components/load-more/index.wxss */
|
||||
.load-more {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 12rpx 0;
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text {
|
||||
margin-left: 12rpx;
|
||||
font-size: small;
|
||||
}
|
||||
}
|
||||
}
|
21
miniprogram/components/load-more/index.ts
Normal file
21
miniprogram/components/load-more/index.ts
Normal file
@ -0,0 +1,21 @@
|
||||
// components/load-more/index.ts
|
||||
Component({
|
||||
/**
|
||||
* 组件的属性列表
|
||||
*/
|
||||
properties: {
|
||||
status: {
|
||||
type: Number, // 0 loading,1 success, 3 error, 4:completed
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 组件的初始数据
|
||||
*/
|
||||
data: {},
|
||||
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {},
|
||||
});
|
12
miniprogram/components/load-more/index.wxml
Normal file
12
miniprogram/components/load-more/index.wxml
Normal file
@ -0,0 +1,12 @@
|
||||
<!--components/load-more/index.wxml-->
|
||||
<view class="load-more">
|
||||
<t-loading wx:if="{{status==0}}" theme="circular" size="40rpx" text="加载中..." class="wrapper" />
|
||||
<view wx:elif="{{status==1}}" class="status success">
|
||||
</view>
|
||||
<view wx:elif="{{status==2}}" class="status error">
|
||||
<t-icon name="unhappy" color="#d54941" size="16" /><text>加载失败</text>
|
||||
</view>
|
||||
<view wx:elif="{{status==3}}" class="status completed">
|
||||
<t-icon name="thumb-up-2" color="#2ba471" size="16" /><text>没有更多</text>
|
||||
</view>
|
||||
</view>
|
@ -17,7 +17,7 @@
|
||||
.value {
|
||||
color: #0052d9;
|
||||
font-size: larger;
|
||||
font-weight: bold;
|
||||
// font-weight: bold;
|
||||
}
|
||||
.title {
|
||||
margin-top: 6rpx;
|
||||
|
@ -2,8 +2,9 @@
|
||||
<wxs module="number" src="../../utils/number.wxs" />
|
||||
<view class="statistcs-card">
|
||||
<view wx:for="{{statisticsData}}" wx:key="key" wx:for-item="value" class="statistcs-item">
|
||||
<view class="value" wx:if="{{value.type=='money'}}">{{number.formatAmount(value.value)}}万元</view>
|
||||
<view class="value" wx:else="">{{value.value}}</view>
|
||||
<!-- <view class="value" wx:if="{{value.type=='money'}}">{{number.formatAmount(value.value)}}万元</view> -->
|
||||
|
||||
<view class="value">{{value.value}}</view>
|
||||
<view class="title">{{value.label}}</view>
|
||||
</view>
|
||||
</view>
|
@ -1,4 +1,7 @@
|
||||
/* pages/add-affairs/add-affairs.wxss */
|
||||
.t-navbar__content {
|
||||
--td-navbar-bg-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.add-affairs {
|
||||
padding-top: 32rpx;
|
||||
.add-affairs-form {
|
||||
|
@ -3,6 +3,9 @@
|
||||
<wxs module="times" src="../../utils/time.wxs" />
|
||||
<wxs module="dict" src="../../utils/dict.wxs" />
|
||||
<wxs module="utils" src="../../utils/utils.wxs" />
|
||||
<view class="block">
|
||||
<t-navbar left-arrow title="添加事项" t-class="nav" t-class-title="nav-title" />
|
||||
</view>
|
||||
<view class="add-affairs">
|
||||
<view class="add-affairs-form">
|
||||
<t-input label="事项" bind:change="onChange" data-field="event" value="{{form.event}}" align="right" placeholder="请输入事项"></t-input>
|
||||
|
@ -1,4 +1,7 @@
|
||||
/* pages/add-stock/add-stock.wxss */
|
||||
.t-navbar__content {
|
||||
--td-navbar-bg-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.add-stock {
|
||||
padding: 32rpx 0;
|
||||
.add-stock-form {
|
||||
|
@ -2,6 +2,9 @@
|
||||
<wxs module="dict" src="../../utils/dict.wxs" />
|
||||
<wxs module="times" src="../../utils/time.wxs" />
|
||||
<t-message id="t-message" />
|
||||
<view class="block">
|
||||
<t-navbar left-arrow title="添加出入库记录" t-class="nav" t-class-title="nav-title" />
|
||||
</view>
|
||||
<view class="add-stock">
|
||||
<view class="add-stock-form">
|
||||
<t-cell title="产品" note="{{dict.getDictLabel(form.productId, productOptions)}}" data-picker-key="productPickerVisible" bind:click="showPicker" arrow />
|
||||
|
@ -3,7 +3,8 @@
|
||||
"t-fab": "tdesign-miniprogram/fab/fab",
|
||||
"t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell",
|
||||
"statistics-card": "/components/statistics-card",
|
||||
"t-dialog": "tdesign-miniprogram/dialog/dialog"
|
||||
"t-dialog": "tdesign-miniprogram/dialog/dialog",
|
||||
"load-more": "/components/load-more"
|
||||
},
|
||||
"enablePullDownRefresh": true
|
||||
}
|
@ -3,6 +3,9 @@ page {
|
||||
padding: 32rpx 0;
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
.t-navbar__content {
|
||||
--td-navbar-bg-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.home-page {
|
||||
.t-fab {
|
||||
z-index: 99;
|
||||
@ -92,16 +95,16 @@ page {
|
||||
}
|
||||
.finance-list {
|
||||
.left-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
font-size: larger;
|
||||
}
|
||||
.btn-wrapper {
|
||||
// height: 100%;
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
|
@ -13,6 +13,7 @@ Page({
|
||||
*/
|
||||
data: {
|
||||
showConfirmDelete: false,
|
||||
loadStatus: 1,
|
||||
permissions: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -47,6 +48,7 @@ Page({
|
||||
async getList() {
|
||||
this.setData({
|
||||
loading: true,
|
||||
loadStatus: 0,
|
||||
});
|
||||
const { queryParams } = this.data;
|
||||
try {
|
||||
@ -60,6 +62,7 @@ Page({
|
||||
}
|
||||
this.setData({
|
||||
completed,
|
||||
loadStatus: completed ? 3 : 1,
|
||||
total: resp.total,
|
||||
list: resp.rows,
|
||||
});
|
||||
@ -69,6 +72,9 @@ Page({
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
this.setData({
|
||||
loadStatus: 2,
|
||||
});
|
||||
console.log(e);
|
||||
}
|
||||
this.setData({
|
||||
|
@ -3,6 +3,9 @@
|
||||
<wxs module="times" src="../../utils/time.wxs" />
|
||||
<wxs module="dict" src="../../utils/dict.wxs" />
|
||||
<wxs module="utils" src="../../utils/utils.wxs" />
|
||||
<view class="block">
|
||||
<t-navbar title="财务管理" t-class="nav" t-class-title="nav-title" />
|
||||
</view>
|
||||
<view class="home-page">
|
||||
<t-fab wx:if="{{utils.hasPermission('finance:detail:add', permissions)}}" class="float-button" icon="add" aria-label="增加" bind:click="handleAddAffairs" />
|
||||
<statistics-card statistics-data="{{statistics}}" />
|
||||
@ -22,47 +25,8 @@
|
||||
</view>
|
||||
</t-swipe-cell>
|
||||
</t-cell-group>
|
||||
<load-more status="{{loadStatus}}" />
|
||||
</view>
|
||||
<!-- <view wx:if="{{authToken}}" class="list">
|
||||
<view wx:for="{{list}}" wx:key="account" data-finance-id="{{item.financeId}}" bind:longpress="handleLongTap" data-index="{{index}}" bind:tap="handleUpdateFinance" class="{{ index === deleteIndex ? 'card shake' : 'card' }}">
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">事项</text>
|
||||
<text class="value">{{item.event}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">类别</text>
|
||||
<text class="value">{{dict.getDictLabel(item.type, types)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">时间</text>
|
||||
<text class="value">{{times.formatDate(item.date) || "-"}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">对方账户</text>
|
||||
<text class="value">{{item.oppositeCompany}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">金额</text>
|
||||
<text class="value">{{item.amount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<t-icon wx:if="{{index === deleteIndex}}" name="close-circle-filled" color="red" size="56rpx" data-finance-id="{{item.financeId}}" data-index="{{index}}" catchtap="handleDeleteFinance" class="close-button"></t-icon>
|
||||
</view>
|
||||
</view> -->
|
||||
<view wx:else class="to-login">
|
||||
<t-button icon="login" theme="primary" bind:tap="toLogin">前往登录</t-button>
|
||||
</view>
|
||||
|
@ -24,7 +24,9 @@
|
||||
z-index: -1;
|
||||
}
|
||||
.avatar_login {
|
||||
margin-left: 64rpx;
|
||||
position: absolute;
|
||||
left: 64rpx;
|
||||
bottom: 140rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { getInfo, login } from "../../api/login";
|
||||
import { getInfo, getProfile, login } from "../../api/login";
|
||||
import httpClient from "../../utils/request";
|
||||
import { setToken } from "../../utils/settings";
|
||||
|
||||
// pages/login/login.ts
|
||||
@ -9,6 +10,7 @@ Page({
|
||||
data: {
|
||||
authToken: null,
|
||||
user: null,
|
||||
profile: null,
|
||||
},
|
||||
|
||||
loginWithWeChat(e: any) {
|
||||
@ -21,10 +23,8 @@ Page({
|
||||
setToken(response.token);
|
||||
getInfo(response.token).then((resp: any) => {
|
||||
getApp().globalData.permissions = resp.permissions;
|
||||
this.setData({
|
||||
user: resp.user,
|
||||
});
|
||||
});
|
||||
this.loadProfile();
|
||||
});
|
||||
},
|
||||
handleLogout() {
|
||||
@ -34,6 +34,28 @@ Page({
|
||||
getApp().globalData.permissions = undefined;
|
||||
setToken(undefined);
|
||||
},
|
||||
loadProfile() {
|
||||
getProfile().then((resp: any) => {
|
||||
const { data } = resp;
|
||||
let avatar;
|
||||
if (data.avatar) {
|
||||
if (
|
||||
data.avatar.startsWith("https://") ||
|
||||
data.avatar.startsWith("http://")
|
||||
) {
|
||||
avatar = data.avatar;
|
||||
} else {
|
||||
avatar = `${httpClient.baseUrl}${data.avatar}`;
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
profile: {
|
||||
...data,
|
||||
avatar,
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
@ -43,12 +65,7 @@ Page({
|
||||
authToken,
|
||||
});
|
||||
if (authToken) {
|
||||
getInfo(authToken).then((resp: any) => {
|
||||
const { user } = resp;
|
||||
this.setData({
|
||||
user,
|
||||
});
|
||||
});
|
||||
this.loadProfile();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
<view class="login-container">
|
||||
<t-image class="login-bg" width="100%" height="100%" src="/assets/login_bg.jpg" />
|
||||
<view class="avatar_login">
|
||||
<t-avatar icon="user" />
|
||||
<t-avatar icon="user" image="{{profile.avatar}}" />
|
||||
<t-button wx:if="{{!authToken}}" open-type="getPhoneNumber" bindgetphonenumber="loginWithWeChat" class="login-button" size="medium" theme="primary" variant="text">登录</t-button>
|
||||
<view class="nickname" wx:else>{{user.nickname}}</view>
|
||||
<view class="nickname" wx:else>{{profile.nickname}}</view>
|
||||
</view>
|
||||
<view class="vip-card">
|
||||
<text>中科九章管理层</text>
|
||||
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"t-fab": "tdesign-miniprogram/fab/fab",
|
||||
"t-sticky": "tdesign-miniprogram/sticky/sticky",
|
||||
"statistics-card": "/components/statistics-card"
|
||||
"statistics-card": "/components/statistics-card",
|
||||
"t-tag": "tdesign-miniprogram/tag/tag",
|
||||
"load-more": "/components/load-more"
|
||||
},
|
||||
"enablePullDownRefresh": true
|
||||
}
|
@ -5,92 +5,47 @@
|
||||
page {
|
||||
padding-top: 32rpx;
|
||||
}
|
||||
.stock-stick {
|
||||
.t-navbar__content {
|
||||
--td-navbar-bg-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
.stock-tabs {
|
||||
margin: 16rpx 32rpx 0;
|
||||
.stock-tabs {
|
||||
border-radius: 18rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
border-radius: 18rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.stock-stick {
|
||||
// TODO:
|
||||
}
|
||||
.stock-list {
|
||||
padding: 16rpx 0 32rpx;
|
||||
.scroll-container {
|
||||
// height: calc(100vh - 96rpx - 64rpx - 64rpx);
|
||||
.grid {
|
||||
margin: 0 32rpx;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 32rpx;
|
||||
.card {
|
||||
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1),
|
||||
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
||||
// position: relative;
|
||||
min-height: 300rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 18rpx;
|
||||
padding: 18rpx;
|
||||
.prove-pic {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
.description {
|
||||
view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.spec {
|
||||
.divider {
|
||||
margin: 0 8rpx;
|
||||
}
|
||||
.close-button {
|
||||
position: absolute;
|
||||
top: -24rpx;
|
||||
right: -24rpx;
|
||||
}
|
||||
.fields {
|
||||
margin-top: 12rpx;
|
||||
.field {
|
||||
margin-top: 12rpx;
|
||||
display: flex;
|
||||
.indicator {
|
||||
margin-top: 12rpx;
|
||||
height: 24rpx;
|
||||
width: 8rpx;
|
||||
background-color: #ea7e41;
|
||||
border-radius: 50rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.title {
|
||||
font-size: large;
|
||||
}
|
||||
.value {
|
||||
margin-top: 6rpx;
|
||||
font-size: small;
|
||||
}
|
||||
}
|
||||
|
||||
&:nth-of-type(1) {
|
||||
.indicator {
|
||||
background-color: #ea7e41;
|
||||
}
|
||||
}
|
||||
&:nth-of-type(2) {
|
||||
.indicator {
|
||||
background-color: #12b3a8;
|
||||
}
|
||||
}
|
||||
&:nth-of-type(3) {
|
||||
.indicator {
|
||||
background-color: #dc7d85;
|
||||
}
|
||||
}
|
||||
&:nth-of-type(4) {
|
||||
.indicator {
|
||||
background-color: #e0d2fd;
|
||||
}
|
||||
}
|
||||
&:nth-of-type(5) {
|
||||
.indicator {
|
||||
background-color: #dc7d85;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.date {
|
||||
text {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.description {
|
||||
// font-size: small;
|
||||
}
|
||||
.note.storage {
|
||||
color: #38a169;
|
||||
}
|
||||
.note.in {
|
||||
color: #38a169;
|
||||
}
|
||||
.note.out {
|
||||
color: #dd6b20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,9 @@ Page({
|
||||
data: {
|
||||
permissions: [],
|
||||
authToken: undefined,
|
||||
storageLoadingStatus: 1,
|
||||
inLoadingStatus: 1,
|
||||
outLoadingStatus: 1,
|
||||
stockType: 0, // 库存类型
|
||||
// 统计数据
|
||||
statisticsData: {
|
||||
@ -47,6 +50,16 @@ Page({
|
||||
storageCompleted: false,
|
||||
inStockCompleted: false,
|
||||
outStockCompleted: false,
|
||||
types: [
|
||||
{
|
||||
label: "入库",
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
label: "出库",
|
||||
value: "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
onTabsChange(e: any) {
|
||||
const { value: stockType } = e.detail;
|
||||
@ -91,11 +104,13 @@ Page({
|
||||
if (stockType == 1) {
|
||||
this.setData({
|
||||
inStockLoading: true,
|
||||
inLoadingStatus: 0,
|
||||
});
|
||||
query = inStockQuery;
|
||||
} else if (stockType == 2) {
|
||||
this.setData({
|
||||
outStockLoading: true,
|
||||
outLoadingStatus: 0,
|
||||
});
|
||||
query = outStockQuery;
|
||||
} else {
|
||||
@ -117,6 +132,7 @@ Page({
|
||||
|
||||
this.setData({
|
||||
inStockCompleted: completed,
|
||||
inLoadingStatus: completed ? 3 : 1,
|
||||
// @ts-ignore
|
||||
inStockList: [
|
||||
...this.data.inStockList,
|
||||
@ -147,6 +163,7 @@ Page({
|
||||
}
|
||||
this.setData({
|
||||
outStockCompleted: completed,
|
||||
outLoadingStatus: completed ? 3 : 1,
|
||||
// @ts-ignore
|
||||
outStockList: [
|
||||
...this.data.outStockList,
|
||||
@ -170,46 +187,77 @@ Page({
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (stockType == 1) {
|
||||
this.setData({
|
||||
inLoadingStatus: 2,
|
||||
});
|
||||
} else if (stockType == 2) {
|
||||
this.setData({
|
||||
outLoadingStatus: 2,
|
||||
});
|
||||
}
|
||||
console.log(error);
|
||||
}
|
||||
if (this.data.stockType == 1) {
|
||||
if (stockType == 1) {
|
||||
this.setData({
|
||||
inStockLoading: false,
|
||||
});
|
||||
} else if (this.data.stockType == 2) {
|
||||
} else if (stockType == 2) {
|
||||
this.setData({
|
||||
outStockLoading: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取库存列表
|
||||
*/
|
||||
async getStorageList() {
|
||||
this.setData({
|
||||
storageLoading: false,
|
||||
storageLoading: true,
|
||||
storageLoadingStatus: 0,
|
||||
});
|
||||
const { storageQuery } = this.data;
|
||||
try {
|
||||
const resp: any = await storageList(storageQuery);
|
||||
|
||||
let completed = false;
|
||||
if (
|
||||
Math.ceil(resp.total / storageQuery.pageSize) == storageQuery.pageNum
|
||||
) {
|
||||
completed = true;
|
||||
}
|
||||
const rows = resp.rows.map((el: any) => {
|
||||
const specUrls = el.specPic?.split(",") ?? [];
|
||||
const specPics = specUrls.map((pic: string) => {
|
||||
let url;
|
||||
if (pic.startsWith("https://") || pic.startsWith("http://")) {
|
||||
url = pic;
|
||||
} else {
|
||||
url = `${httpClient.baseUrl}${pic}`;
|
||||
}
|
||||
return url;
|
||||
});
|
||||
return {
|
||||
...el,
|
||||
specPics,
|
||||
};
|
||||
});
|
||||
this.setData({
|
||||
// @ts-ignore
|
||||
storageList: [...this.data.storageList, ...resp.rows],
|
||||
storageList: [...this.data.storageList, ...rows],
|
||||
storageCompleted: completed,
|
||||
storageLoadingStatus: completed ? 3 : 1,
|
||||
});
|
||||
if (!completed) {
|
||||
this.setData({
|
||||
[`storageQuery.pageNum`]: storageQuery.pageNum + 1,
|
||||
});
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
this.setData({
|
||||
storageLoadingStatus: 2,
|
||||
});
|
||||
}
|
||||
this.setData({
|
||||
storageLoading: false,
|
||||
});
|
||||
|
@ -3,144 +3,105 @@
|
||||
<t-message id="t-message" />
|
||||
<wxs module="times" src="../../utils/time.wxs" />
|
||||
<wxs module="utils" src="../../utils/utils.wxs" />
|
||||
<view class="block">
|
||||
<t-navbar title="库存管理" t-class="nav" t-class-title="nav-title" />
|
||||
</view>
|
||||
<statistics-card statistics-data="{{statisticsData}}" />
|
||||
<t-sticky class="stock-stick">
|
||||
<view class="stock-tabs">
|
||||
<t-tabs defaultValue="{{0}}" value="{{stockType}}" bind:change="onTabsChange" theme="tag">
|
||||
<t-tab-panel label="库存" value="{{0}}" />
|
||||
<t-tab-panel label="入库" value="{{1}}" />
|
||||
<t-tab-panel label="出库" value="{{2}}" />
|
||||
</t-tabs>
|
||||
</view>
|
||||
</t-sticky>
|
||||
<view class="stock-tabs">
|
||||
<t-tabs defaultValue="{{0}}" value="{{stockType}}" bind:change="onTabsChange" theme="tag">
|
||||
<t-tab-panel label="库存" value="{{0}}" />
|
||||
<t-tab-panel label="入库" value="{{1}}" />
|
||||
<t-tab-panel label="出库" value="{{2}}" />
|
||||
</t-tabs>
|
||||
</view>
|
||||
|
||||
<view class="stock-list">
|
||||
<t-fab wx:if="{{stockType > 0 && utils.hasPermission('product:product:add', permissions)}}" class="float-button" icon="add" aria-label="增加" bind:click="handleAddStock"></t-fab>
|
||||
<view hidden="{{stockType!=0}}" class="scroll-container">
|
||||
<view class="grid">
|
||||
<view wx:for="{{storageList}}" wx:key="specId" class="card">
|
||||
<view class="fields">
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">产品</text>
|
||||
<text class="value">{{item.productName}}</text>
|
||||
<t-cell-group theme="card">
|
||||
<t-swipe-cell wx:for="{{storageList}}" wx:key="specId">
|
||||
<t-cell data-spec-id="{{item.specId}}" hover>
|
||||
<view class="left-icon" slot="left-icon">
|
||||
<t-image src="{{item.specPics[0]}}" shape="round" error="slot" width="120rpx" height="120rpx">
|
||||
<t-icon name="image-error" slot="error" />
|
||||
</t-image>
|
||||
</view>
|
||||
<view slot="title" class="title">
|
||||
<view>{{item.productName}}</view>
|
||||
</view>
|
||||
<view slot="description" class="description">
|
||||
<view class="spec">
|
||||
<text>{{item.modelName}}</text>
|
||||
<view class="divider">|</view>
|
||||
<text>{{item.specName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">型号</text>
|
||||
<text class="value">{{item.modelName}}</text>
|
||||
</view>
|
||||
<view slot="note" class="note storage">
|
||||
{{item.stock}}
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">规格</text>
|
||||
<text class="value">{{item.specName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">库存</text>
|
||||
<text class="value">{{item.stock}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</t-cell>
|
||||
</t-swipe-cell>
|
||||
</t-cell-group>
|
||||
<load-more status="{{storageLoadingStatus}}" />
|
||||
</view>
|
||||
<view hidden="{{stockType!=1}}" class="scroll-container">
|
||||
<view class="grid">
|
||||
<view wx:for="{{inStockList}}" wx:key="logId" class="card">
|
||||
<t-image class="prove-pic" mode="aspectFill" error="slot" src="{{item.provePic[0]}}">
|
||||
<t-icon name="image-error" slot="error" />
|
||||
</t-image>
|
||||
<view class="fields">
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">产品</text>
|
||||
<text class="value">{{item.productName}}</text>
|
||||
<t-cell-group theme="card">
|
||||
<t-swipe-cell wx:for="{{inStockList}}" wx:key="logId">
|
||||
<t-cell data-spec-id="{{item.specId}}" hover>
|
||||
<view class="left-icon" slot="left-icon">
|
||||
<t-image src="{{item.provePic[0]}}" shape="round" error="slot" width="120rpx" height="120rpx">
|
||||
<t-icon name="image-error" slot="error" />
|
||||
</t-image>
|
||||
</view>
|
||||
<view slot="title" class="title">
|
||||
<view>{{item.productName}}</view>
|
||||
</view>
|
||||
<view slot="description" class="description">
|
||||
<view class="spec">
|
||||
<text>{{item.modelName}}</text>
|
||||
<view class="divider">|</view>
|
||||
<text>{{item.specName}}</text>
|
||||
</view>
|
||||
<view class="date">
|
||||
<t-tag theme="success" size="small">入库</t-tag> <text>{{times.formatDate(item.date) || ''}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">型号</text>
|
||||
<text class="value">{{item.modelName}}</text>
|
||||
</view>
|
||||
<view slot="note" class="note in">
|
||||
{{item.total}}
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">规格</text>
|
||||
<text class="value">{{item.specName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">数量</text>
|
||||
<text class="value">{{item.total}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">日期</text>
|
||||
<text class="value">{{times.formatDate(item.date) || "-"}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</t-cell>
|
||||
</t-swipe-cell>
|
||||
</t-cell-group>
|
||||
<load-more status="{{inLoadingStatus}}" />
|
||||
</view>
|
||||
<view hidden="{{stockType!=2}}" class="scroll-container">
|
||||
<view class="grid">
|
||||
<view wx:for="{{outStockList}}" wx:key="logId" class="card">
|
||||
<t-image class="prove-pic" mode="aspectFill" error="slot" src="{{item.provePic[0]}}">
|
||||
<t-icon name="image-error" slot="error" width="100rpx" height="100rpx" />
|
||||
</t-image>
|
||||
<view class="fields">
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">产品</text>
|
||||
<text class="value">{{item.productName}}</text>
|
||||
<t-cell-group theme="card">
|
||||
<t-swipe-cell wx:for="{{outStockList}}" wx:key="logId">
|
||||
<t-cell data-spec-id="{{item.specId}}" hover>
|
||||
<view class="left-icon" slot="left-icon">
|
||||
<t-image src="{{item.provePic[0]}}" shape="round" error="slot" width="120rpx" height="120rpx">
|
||||
<t-icon name="image-error" slot="error" />
|
||||
</t-image>
|
||||
</view>
|
||||
<view slot="title" class="title">
|
||||
<view>{{item.productName}}</view>
|
||||
</view>
|
||||
<view slot="description" class="description">
|
||||
<view class="spec">
|
||||
<text>{{item.modelName}}</text>
|
||||
<view class="divider">|</view>
|
||||
<text>{{item.specName}}</text>
|
||||
</view>
|
||||
<view class="date">
|
||||
<t-tag theme="warning" size="small">出库</t-tag> <text>{{times.formatDate(item.date) || ''}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">型号</text>
|
||||
<text class="value">{{item.modelName}}</text>
|
||||
</view>
|
||||
<view slot="note" class="note out">
|
||||
{{item.total}}
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">规格</text>
|
||||
<text class="value">{{item.specName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">数量</text>
|
||||
<text class="value">{{item.total}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="field">
|
||||
<view class="indicator"></view>
|
||||
<view class="content">
|
||||
<text class="title">日期</text>
|
||||
<text class="value">{{times.formatDate(item.date) || "-"}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</t-cell>
|
||||
</t-swipe-cell>
|
||||
</t-cell-group>
|
||||
<load-more status="{{outLoadingStatus}}" />
|
||||
</view>
|
||||
</view>
|
Reference in New Issue
Block a user