This commit is contained in:
quantulr
2023-09-01 17:14:27 +08:00
parent a09291a1c8
commit cf3e2db09d
27 changed files with 308 additions and 330 deletions

View File

@ -18,3 +18,8 @@ export const getInfo = (token?: string) =>
Authorization: token ? `Bearer ${token}` : undefined, Authorization: token ? `Bearer ${token}` : undefined,
}, },
}); });
export const getProfile = () =>
httpClient.request({
url: "/system/user/profile",
});

View File

@ -6,19 +6,19 @@
"pages/stock/stock", "pages/stock/stock",
"pages/add-stock/add-stock" "pages/add-stock/add-stock"
], ],
"entryPagePath": "pages/stock/stock",
"tabBar": { "tabBar": {
"selectedColor": "#0052d9", "selectedColor": "#0052d9",
"list": [{ "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", "pagePath": "pages/stock/stock",
"text": "库存", "text": "库存",
"iconPath": "assets/tab-icons/stock.png", "iconPath": "assets/tab-icons/stock.png",
"selectedIconPath": "assets/tab-icons/stock_selected.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", "pagePath": "pages/login/login",
@ -32,7 +32,8 @@
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#f6f6f6", "navigationBarBackgroundColor": "#f6f6f6",
"navigationBarTitleText": "口袋九章", "navigationBarTitleText": "口袋九章",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black",
"navigationStyle": "custom"
}, },
"usingComponents": { "usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell", "t-cell": "tdesign-miniprogram/cell/cell",
@ -42,7 +43,8 @@
"t-button": "tdesign-miniprogram/button/button", "t-button": "tdesign-miniprogram/button/button",
"t-message": "tdesign-miniprogram/message/message", "t-message": "tdesign-miniprogram/message/message",
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel", "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", "lazyCodeLoading": "requiredComponents",
"sitemapLocation": "sitemap.json" "sitemapLocation": "sitemap.json"

View File

@ -1,4 +0,0 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -1 +0,0 @@
/* components/infinite-scroll/index.wxss */

View File

@ -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", {}, {});
// });
},
},
});

View File

@ -1,5 +0,0 @@
<!--components/infinite-scroll/index.wxml-->
<view>
<slot></slot>
<view class="load-more">load more</view>
</view>

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"t-loading": "tdesign-miniprogram/loading/loading"
}
}

View 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;
}
}
}

View 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: {},
});

View 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>

View File

@ -17,7 +17,7 @@
.value { .value {
color: #0052d9; color: #0052d9;
font-size: larger; font-size: larger;
font-weight: bold; // font-weight: bold;
} }
.title { .title {
margin-top: 6rpx; margin-top: 6rpx;

View File

@ -2,8 +2,9 @@
<wxs module="number" src="../../utils/number.wxs" /> <wxs module="number" src="../../utils/number.wxs" />
<view class="statistcs-card"> <view class="statistcs-card">
<view wx:for="{{statisticsData}}" wx:key="key" wx:for-item="value" class="statistcs-item"> <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:if="{{value.type=='money'}}">{{number.formatAmount(value.value)}}万元</view> -->
<view class="value" wx:else="">{{value.value}}</view>
<view class="value">{{value.value}}</view>
<view class="title">{{value.label}}</view> <view class="title">{{value.label}}</view>
</view> </view>
</view> </view>

View File

@ -1,4 +1,7 @@
/* pages/add-affairs/add-affairs.wxss */ /* pages/add-affairs/add-affairs.wxss */
.t-navbar__content {
--td-navbar-bg-color: rgba(0, 0, 0, 0);
}
.add-affairs { .add-affairs {
padding-top: 32rpx; padding-top: 32rpx;
.add-affairs-form { .add-affairs-form {

View File

@ -3,6 +3,9 @@
<wxs module="times" src="../../utils/time.wxs" /> <wxs module="times" src="../../utils/time.wxs" />
<wxs module="dict" src="../../utils/dict.wxs" /> <wxs module="dict" src="../../utils/dict.wxs" />
<wxs module="utils" src="../../utils/utils.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">
<view class="add-affairs-form"> <view class="add-affairs-form">
<t-input label="事项" bind:change="onChange" data-field="event" value="{{form.event}}" align="right" placeholder="请输入事项"></t-input> <t-input label="事项" bind:change="onChange" data-field="event" value="{{form.event}}" align="right" placeholder="请输入事项"></t-input>

View File

@ -1,4 +1,7 @@
/* pages/add-stock/add-stock.wxss */ /* pages/add-stock/add-stock.wxss */
.t-navbar__content {
--td-navbar-bg-color: rgba(0, 0, 0, 0);
}
.add-stock { .add-stock {
padding: 32rpx 0; padding: 32rpx 0;
.add-stock-form { .add-stock-form {

View File

@ -2,6 +2,9 @@
<wxs module="dict" src="../../utils/dict.wxs" /> <wxs module="dict" src="../../utils/dict.wxs" />
<wxs module="times" src="../../utils/time.wxs" /> <wxs module="times" src="../../utils/time.wxs" />
<t-message id="t-message" /> <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">
<view class="add-stock-form"> <view class="add-stock-form">
<t-cell title="产品" note="{{dict.getDictLabel(form.productId, productOptions)}}" data-picker-key="productPickerVisible" bind:click="showPicker" arrow /> <t-cell title="产品" note="{{dict.getDictLabel(form.productId, productOptions)}}" data-picker-key="productPickerVisible" bind:click="showPicker" arrow />

View File

@ -3,7 +3,8 @@
"t-fab": "tdesign-miniprogram/fab/fab", "t-fab": "tdesign-miniprogram/fab/fab",
"t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell", "t-swipe-cell": "tdesign-miniprogram/swipe-cell/swipe-cell",
"statistics-card": "/components/statistics-card", "statistics-card": "/components/statistics-card",
"t-dialog": "tdesign-miniprogram/dialog/dialog" "t-dialog": "tdesign-miniprogram/dialog/dialog",
"load-more": "/components/load-more"
}, },
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }

View File

@ -3,6 +3,9 @@ page {
padding: 32rpx 0; padding: 32rpx 0;
background-color: #f6f6f6; background-color: #f6f6f6;
} }
.t-navbar__content {
--td-navbar-bg-color: rgba(0, 0, 0, 0);
}
.home-page { .home-page {
.t-fab { .t-fab {
z-index: 99; z-index: 99;
@ -92,16 +95,16 @@ page {
} }
.finance-list { .finance-list {
.left-icon { .left-icon {
width: 48rpx; width: 72rpx;
height: 48rpx; height: 72rpx;
border-radius: 50%; border-radius: 50%;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: #fff; color: #fff;
font-size: larger;
} }
.btn-wrapper { .btn-wrapper {
// height: 100%;
.btn { .btn {
display: inline-flex; display: inline-flex;
justify-content: center; justify-content: center;

View File

@ -13,6 +13,7 @@ Page({
*/ */
data: { data: {
showConfirmDelete: false, showConfirmDelete: false,
loadStatus: 1,
permissions: [], permissions: [],
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -47,6 +48,7 @@ Page({
async getList() { async getList() {
this.setData({ this.setData({
loading: true, loading: true,
loadStatus: 0,
}); });
const { queryParams } = this.data; const { queryParams } = this.data;
try { try {
@ -60,6 +62,7 @@ Page({
} }
this.setData({ this.setData({
completed, completed,
loadStatus: completed ? 3 : 1,
total: resp.total, total: resp.total,
list: resp.rows, list: resp.rows,
}); });
@ -69,6 +72,9 @@ Page({
}); });
} }
} catch (e) { } catch (e) {
this.setData({
loadStatus: 2,
});
console.log(e); console.log(e);
} }
this.setData({ this.setData({

View File

@ -3,6 +3,9 @@
<wxs module="times" src="../../utils/time.wxs" /> <wxs module="times" src="../../utils/time.wxs" />
<wxs module="dict" src="../../utils/dict.wxs" /> <wxs module="dict" src="../../utils/dict.wxs" />
<wxs module="utils" src="../../utils/utils.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"> <view class="home-page">
<t-fab wx:if="{{utils.hasPermission('finance:detail:add', permissions)}}" class="float-button" icon="add" aria-label="增加" bind:click="handleAddAffairs" /> <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}}" /> <statistics-card statistics-data="{{statistics}}" />
@ -22,47 +25,8 @@
</view> </view>
</t-swipe-cell> </t-swipe-cell>
</t-cell-group> </t-cell-group>
<load-more status="{{loadStatus}}" />
</view> </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"> <view wx:else class="to-login">
<t-button icon="login" theme="primary" bind:tap="toLogin">前往登录</t-button> <t-button icon="login" theme="primary" bind:tap="toLogin">前往登录</t-button>
</view> </view>

View File

@ -24,7 +24,9 @@
z-index: -1; z-index: -1;
} }
.avatar_login { .avatar_login {
margin-left: 64rpx; position: absolute;
left: 64rpx;
bottom: 140rpx;
display: flex; display: flex;
align-items: center; align-items: center;

View File

@ -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"; import { setToken } from "../../utils/settings";
// pages/login/login.ts // pages/login/login.ts
@ -9,6 +10,7 @@ Page({
data: { data: {
authToken: null, authToken: null,
user: null, user: null,
profile: null,
}, },
loginWithWeChat(e: any) { loginWithWeChat(e: any) {
@ -21,10 +23,8 @@ Page({
setToken(response.token); setToken(response.token);
getInfo(response.token).then((resp: any) => { getInfo(response.token).then((resp: any) => {
getApp().globalData.permissions = resp.permissions; getApp().globalData.permissions = resp.permissions;
this.setData({
user: resp.user,
});
}); });
this.loadProfile();
}); });
}, },
handleLogout() { handleLogout() {
@ -34,6 +34,28 @@ Page({
getApp().globalData.permissions = undefined; getApp().globalData.permissions = undefined;
setToken(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, authToken,
}); });
if (authToken) { if (authToken) {
getInfo(authToken).then((resp: any) => { this.loadProfile();
const { user } = resp;
this.setData({
user,
});
});
} }
}, },

View File

@ -6,9 +6,9 @@
<view class="login-container"> <view class="login-container">
<t-image class="login-bg" width="100%" height="100%" src="/assets/login_bg.jpg" /> <t-image class="login-bg" width="100%" height="100%" src="/assets/login_bg.jpg" />
<view class="avatar_login"> <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> <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>
<view class="vip-card"> <view class="vip-card">
<text>中科九章管理层</text> <text>中科九章管理层</text>

View File

@ -1,8 +1,9 @@
{ {
"usingComponents": { "usingComponents": {
"t-fab": "tdesign-miniprogram/fab/fab", "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 "enablePullDownRefresh": true
} }

View File

@ -5,92 +5,47 @@
page { page {
padding-top: 32rpx; padding-top: 32rpx;
} }
.stock-stick { .t-navbar__content {
--td-navbar-bg-color: rgba(0, 0, 0, 0);
}
.stock-tabs {
margin: 16rpx 32rpx 0; margin: 16rpx 32rpx 0;
.stock-tabs { border-radius: 18rpx;
border-radius: 18rpx; overflow: hidden;
overflow: hidden; }
} .stock-stick {
// TODO:
} }
.stock-list { .stock-list {
padding: 16rpx 0 32rpx; padding: 16rpx 0 32rpx;
.scroll-container { .scroll-container {
// height: calc(100vh - 96rpx - 64rpx - 64rpx); .description {
.grid { view {
margin: 0 32rpx; display: flex;
display: grid; align-items: center;
grid-template-columns: repeat(2, minmax(0, 1fr)); }
gap: 32rpx; .spec {
.card { .divider {
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), margin: 0 8rpx;
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;
} }
.close-button { }
position: absolute; .date {
top: -24rpx; text {
right: -24rpx; margin-left: 12rpx;
}
.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;
}
}
}
} }
} }
} }
.description {
// font-size: small;
}
.note.storage {
color: #38a169;
}
.note.in {
color: #38a169;
}
.note.out {
color: #dd6b20;
}
} }
} }

View File

@ -10,6 +10,9 @@ Page({
data: { data: {
permissions: [], permissions: [],
authToken: undefined, authToken: undefined,
storageLoadingStatus: 1,
inLoadingStatus: 1,
outLoadingStatus: 1,
stockType: 0, // 库存类型 stockType: 0, // 库存类型
// 统计数据 // 统计数据
statisticsData: { statisticsData: {
@ -47,6 +50,16 @@ Page({
storageCompleted: false, storageCompleted: false,
inStockCompleted: false, inStockCompleted: false,
outStockCompleted: false, outStockCompleted: false,
types: [
{
label: "入库",
value: "1",
},
{
label: "出库",
value: "2",
},
],
}, },
onTabsChange(e: any) { onTabsChange(e: any) {
const { value: stockType } = e.detail; const { value: stockType } = e.detail;
@ -91,11 +104,13 @@ Page({
if (stockType == 1) { if (stockType == 1) {
this.setData({ this.setData({
inStockLoading: true, inStockLoading: true,
inLoadingStatus: 0,
}); });
query = inStockQuery; query = inStockQuery;
} else if (stockType == 2) { } else if (stockType == 2) {
this.setData({ this.setData({
outStockLoading: true, outStockLoading: true,
outLoadingStatus: 0,
}); });
query = outStockQuery; query = outStockQuery;
} else { } else {
@ -117,6 +132,7 @@ Page({
this.setData({ this.setData({
inStockCompleted: completed, inStockCompleted: completed,
inLoadingStatus: completed ? 3 : 1,
// @ts-ignore // @ts-ignore
inStockList: [ inStockList: [
...this.data.inStockList, ...this.data.inStockList,
@ -147,6 +163,7 @@ Page({
} }
this.setData({ this.setData({
outStockCompleted: completed, outStockCompleted: completed,
outLoadingStatus: completed ? 3 : 1,
// @ts-ignore // @ts-ignore
outStockList: [ outStockList: [
...this.data.outStockList, ...this.data.outStockList,
@ -170,46 +187,77 @@ Page({
} }
} }
} catch (error) { } catch (error) {
if (stockType == 1) {
this.setData({
inLoadingStatus: 2,
});
} else if (stockType == 2) {
this.setData({
outLoadingStatus: 2,
});
}
console.log(error); console.log(error);
} }
if (this.data.stockType == 1) { if (stockType == 1) {
this.setData({ this.setData({
inStockLoading: false, inStockLoading: false,
}); });
} else if (this.data.stockType == 2) { } else if (stockType == 2) {
this.setData({ this.setData({
outStockLoading: false, outStockLoading: false,
}); });
} }
}, },
/** /**
* 获取库存列表 * 获取库存列表
*/ */
async getStorageList() { async getStorageList() {
this.setData({ this.setData({
storageLoading: false, storageLoading: true,
storageLoadingStatus: 0,
}); });
const { storageQuery } = this.data; const { storageQuery } = this.data;
try { try {
const resp: any = await storageList(storageQuery); const resp: any = await storageList(storageQuery);
let completed = false; let completed = false;
if ( if (
Math.ceil(resp.total / storageQuery.pageSize) == storageQuery.pageNum Math.ceil(resp.total / storageQuery.pageSize) == storageQuery.pageNum
) { ) {
completed = true; 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({ this.setData({
// @ts-ignore // @ts-ignore
storageList: [...this.data.storageList, ...resp.rows], storageList: [...this.data.storageList, ...rows],
storageCompleted: completed, storageCompleted: completed,
storageLoadingStatus: completed ? 3 : 1,
}); });
if (!completed) { if (!completed) {
this.setData({ this.setData({
[`storageQuery.pageNum`]: storageQuery.pageNum + 1, [`storageQuery.pageNum`]: storageQuery.pageNum + 1,
}); });
} }
} catch (error) {} } catch (error) {
this.setData({
storageLoadingStatus: 2,
});
}
this.setData({ this.setData({
storageLoading: false, storageLoading: false,
}); });

View File

@ -3,144 +3,105 @@
<t-message id="t-message" /> <t-message id="t-message" />
<wxs module="times" src="../../utils/time.wxs" /> <wxs module="times" src="../../utils/time.wxs" />
<wxs module="utils" src="../../utils/utils.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}}" /> <statistics-card statistics-data="{{statisticsData}}" />
<t-sticky class="stock-stick"> <view class="stock-tabs">
<view class="stock-tabs"> <t-tabs defaultValue="{{0}}" value="{{stockType}}" bind:change="onTabsChange" theme="tag">
<t-tabs defaultValue="{{0}}" value="{{stockType}}" bind:change="onTabsChange" theme="tag"> <t-tab-panel label="库存" value="{{0}}" />
<t-tab-panel label="库" value="{{0}}" /> <t-tab-panel label="库" value="{{1}}" />
<t-tab-panel label="库" value="{{1}}" /> <t-tab-panel label="库" value="{{2}}" />
<t-tab-panel label="出库" value="{{2}}" /> </t-tabs>
</t-tabs> </view>
</view>
</t-sticky>
<view class="stock-list"> <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> <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 hidden="{{stockType!=0}}" class="scroll-container">
<view class="grid"> <t-cell-group theme="card">
<view wx:for="{{storageList}}" wx:key="specId" class="card"> <t-swipe-cell wx:for="{{storageList}}" wx:key="specId">
<view class="fields"> <t-cell data-spec-id="{{item.specId}}" hover>
<view class="field"> <view class="left-icon" slot="left-icon">
<view class="indicator"></view> <t-image src="{{item.specPics[0]}}" shape="round" error="slot" width="120rpx" height="120rpx">
<view class="content"> <t-icon name="image-error" slot="error" />
<text class="title">产品</text> </t-image>
<text class="value">{{item.productName}}</text> </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> </view>
<view class="field"> <view slot="note" class="note storage">
<view class="indicator"></view> {{item.stock}}
<view class="content">
<text class="title">型号</text>
<text class="value">{{item.modelName}}</text>
</view>
</view> </view>
<view class="field"> </t-cell>
<view class="indicator"></view> </t-swipe-cell>
<view class="content"> </t-cell-group>
<text class="title">规格</text> <load-more status="{{storageLoadingStatus}}" />
<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>
</view> </view>
<view hidden="{{stockType!=1}}" class="scroll-container"> <view hidden="{{stockType!=1}}" class="scroll-container">
<view class="grid"> <t-cell-group theme="card">
<view wx:for="{{inStockList}}" wx:key="logId" class="card"> <t-swipe-cell wx:for="{{inStockList}}" wx:key="logId">
<t-image class="prove-pic" mode="aspectFill" error="slot" src="{{item.provePic[0]}}"> <t-cell data-spec-id="{{item.specId}}" hover>
<t-icon name="image-error" slot="error" /> <view class="left-icon" slot="left-icon">
</t-image> <t-image src="{{item.provePic[0]}}" shape="round" error="slot" width="120rpx" height="120rpx">
<view class="fields"> <t-icon name="image-error" slot="error" />
<view class="field"> </t-image>
<view class="indicator"></view> </view>
<view class="content"> <view slot="title" class="title">
<text class="title">产品</text> <view>{{item.productName}}</view>
<text class="value">{{item.productName}}</text> </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> </view>
<view class="field"> <view slot="note" class="note in">
<view class="indicator"></view> {{item.total}}
<view class="content">
<text class="title">型号</text>
<text class="value">{{item.modelName}}</text>
</view>
</view> </view>
<view class="field"> </t-cell>
<view class="indicator"></view> </t-swipe-cell>
<view class="content"> </t-cell-group>
<text class="title">规格</text> <load-more status="{{inLoadingStatus}}" />
<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>
</view> </view>
<view hidden="{{stockType!=2}}" class="scroll-container"> <view hidden="{{stockType!=2}}" class="scroll-container">
<view class="grid"> <t-cell-group theme="card">
<view wx:for="{{outStockList}}" wx:key="logId" class="card"> <t-swipe-cell wx:for="{{outStockList}}" wx:key="logId">
<t-image class="prove-pic" mode="aspectFill" error="slot" src="{{item.provePic[0]}}"> <t-cell data-spec-id="{{item.specId}}" hover>
<t-icon name="image-error" slot="error" width="100rpx" height="100rpx" /> <view class="left-icon" slot="left-icon">
</t-image> <t-image src="{{item.provePic[0]}}" shape="round" error="slot" width="120rpx" height="120rpx">
<view class="fields"> <t-icon name="image-error" slot="error" />
<view class="field"> </t-image>
<view class="indicator"></view> </view>
<view class="content"> <view slot="title" class="title">
<text class="title">产品</text> <view>{{item.productName}}</view>
<text class="value">{{item.productName}}</text> </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> </view>
<view class="field"> <view slot="note" class="note out">
<view class="indicator"></view> {{item.total}}
<view class="content">
<text class="title">型号</text>
<text class="value">{{item.modelName}}</text>
</view>
</view> </view>
<view class="field"> </t-cell>
<view class="indicator"></view> </t-swipe-cell>
<view class="content"> </t-cell-group>
<text class="title">规格</text> <load-more status="{{outLoadingStatus}}" />
<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>
</view> </view>
</view> </view>