添加组件及页面

This commit is contained in:
zhengw
2026-01-21 17:05:30 +08:00
parent a89e69c381
commit 7ff1a911dd
54 changed files with 1078 additions and 1009 deletions

30
.prettierrc Normal file
View File

@@ -0,0 +1,30 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all",
"arrowParens": "always",
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"overrides": [
{
"files": [ "*.wxss", "*.acss" ],
"options": {
"parser": "css"
}
},
{
"files": [ "*.wxml", "*.axml" ],
"options": {
"parser": "html"
}
},
{
"files": [ "*.wxs", "*.sjs" ],
"options": {
"parser": "babel"
}
}
]
}

36
.vscode/settings.json vendored
View File

@@ -1,20 +1,5 @@
{ {
"window.title": "普惠版小程序开发", "window.title": "普惠版小程序开发",
"[wxml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[wxss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.documentSelectors": [
// "**/*.wxml",
"**/*.wxss",
"**/*.wxs"
],
"files.associations": {
// "*.wxml": "html",
"*.wxss": "css"
},
"search.exclude": { "search.exclude": {
"**/node_modules": true, "**/node_modules": true,
"**/bower_components": true, "**/bower_components": true,
@@ -23,23 +8,6 @@
"**/miniprogram_npm": true, "**/miniprogram_npm": true,
"**/typings": true "**/typings": true
}, },
"wxmlConfig.onSaveFormat": true,
"wxmlConfig.format": {
"brace_style": "collapse",
"end_with_newline": false,
"indent_char": " ",
"indent_handlebars": false,
"indent_inner_html": false,
"indent_scripts": "keep",
"indent_size": 2,
"indent_with_tabs": false,
"max_preserve_newlines": 1,
"wrap_attributes_count": 4,
"unformatted": "['text']",
"disable_automatic_closing_labels": false,
"preserve_newlines": true,
"wrap_attributes": "force-expand-multiline"
},
"cSpell.words": [ "cSpell.words": [
"bindchange", "bindchange",
"binddragend", "binddragend",
@@ -58,5 +26,7 @@
"Sesskey", "Sesskey",
"showmenu", "showmenu",
"unionid" "unionid"
] ],
"wxml.format.maxPreserveNewLines": null,
"wxml.format.wrapLineLength": 100
} }

View File

@@ -5,7 +5,9 @@
"pages/my/my", "pages/my/my",
"pages/processEntry/processEntry", "pages/processEntry/processEntry",
"pages/produce/processManage/processManage", "pages/produce/processManage/processManage",
"pages/produce/processManageDetail/processManageDetail" "pages/produce/processManageDetail/processManageDetail",
"pages/orders/ordersList/ordersList",
"pages/orders/orderSort/orderSort"
], ],
"window": { "window": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
@@ -16,9 +18,10 @@
"lazyCodeLoading": "requiredComponents", "lazyCodeLoading": "requiredComponents",
"usingComponents": { "usingComponents": {
"page-plugin": "pages/components/page-plugin/page-plugin", "page-plugin": "pages/components/page-plugin/page-plugin",
"t-button": "tdesign-miniprogram/button/button" "t-button": "tdesign-miniprogram/button/button",
"t-empty": "tdesign-miniprogram/empty/empty"
}, },
"resolveAlias": { "resolveAlias": {
"@/*": "/*" "@/*": "/*"
} }
} }

View File

@@ -6,15 +6,9 @@ button.t-button {
view.t-input { view.t-input {
flex: none; flex: none;
padding: 12px; padding: 24rpx;
} }
view.t-popup__close { view.t-popup__close {
padding: 6px; padding: 12rpx;
} }
/*
page {
--td-button-small-height: 34px;
--td-button-small-height: 34px;
} */

View File

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 957 B

View File

@@ -1 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16z m-564 76v168H176V716h168z m84-408V140h168v168H428z m420 576H680V716h168v168z" fill="#0396FF"></path></svg> <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path d="M796.6 635.5V482.2H534.4v-93.7h200v-320h-450v320h200v93.7h-257v153.3h-155v320h360v-320h-155V532.2h469.1v103.3h-155v320h360v-320H796.6z m-462.2-517h350v220h-350v-220z m48 787h-260v-220h260v220z m519.2 0h-260v-220h260v220z" fill="#1296db"></path></svg>

Before

Width:  |  Height:  |  Size: 774 B

After

Width:  |  Height:  |  Size: 361 B

View File

@@ -0,0 +1 @@
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="64" height="64"><path d="M768 362.666667a21.333333 21.333333 0 0 1 21.333333 21.333333v387.648l61.418667-61.397333a21.333333 21.333333 0 0 1 30.165333 0l30.165334 30.165333a21.333333 21.333333 0 0 1 0 30.165333l-116.053334 116.053334a53.333333 53.333333 0 0 1-90.922666-34.218667L704 848.917333V384a21.333333 21.333333 0 0 1 21.333333-21.333333h42.666667zM554.666667 789.333333a21.333333 21.333333 0 0 1 21.333333 21.333334v42.666666a21.333333 21.333333 0 0 1-21.333333 21.333334H128a21.333333 21.333333 0 0 1-21.333333-21.333334v-42.666666a21.333333 21.333333 0 0 1 21.333333-21.333334h426.666667z m0-320a21.333333 21.333333 0 0 1 21.333333 21.333334v42.666666a21.333333 21.333333 0 0 1-21.333333 21.333334H128a21.333333 21.333333 0 0 1-21.333333-21.333334v-42.666666a21.333333 21.333333 0 0 1 21.333333-21.333334h426.666667zM896 149.333333a21.333333 21.333333 0 0 1 21.333333 21.333334v42.666666a21.333333 21.333333 0 0 1-21.333333 21.333334H128a21.333333 21.333333 0 0 1-21.333333-21.333334V170.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h768z" fill="#d81e06"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -16,9 +16,9 @@ Component({
}, },
lifetimes: { lifetimes: {
attached() { attached() {
setTimeout(() => { // setTimeout(() => {
this.getSlotHeight(); // this.getSlotHeight();
}, 100); // }, 100);
}, },
}, },
@@ -27,7 +27,7 @@ Component({
*/ */
data: { data: {
showMore: false, showMore: false,
showMoreBar: false, showMoreBar: true,
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
@@ -38,7 +38,7 @@ Component({
const query = wx.createSelectorQuery().in(this); const query = wx.createSelectorQuery().in(this);
// 2. 查询插槽容器节点 // 2. 查询插槽容器节点
query query
.select("#contentSlot") .select('#contentSlot')
.boundingClientRect((rect) => { .boundingClientRect((rect) => {
if (rect) { if (rect) {
const height = rect.height; // 获取节点高度单位px const height = rect.height; // 获取节点高度单位px
@@ -54,7 +54,7 @@ Component({
.exec(); // 执行查询 .exec(); // 执行查询
}, },
click(e: any) { click(e: any) {
this.triggerEvent("tap", e); this.triggerEvent('tap', e);
}, },
showMoreTap() { showMoreTap() {
this.setData({ this.setData({

View File

@@ -1,9 +1,13 @@
<view class="card_plugin {{className}}" style="border: 1rpx solid #ddd;margin-bottom: 12px;border-radius: 4px;{{customStyle}}" bind:tap="click"> <view class="card_plugin {{className}}"
<view class="header" style="border-bottom: 1rpx solid #ddd;padding: 8px 12px;font-weight: bold;{{headerStyle || ''}}"> style="border: 1rpx solid #ddd;margin-bottom: 24rpx;border-radius: 8rpx;{{customStyle}}"
bind:tap="click">
<view class="header"
style="border-bottom: 1rpx solid #ddd;padding: 16rpx 24rpx;font-weight: bold;{{headerStyle || ''}}">
<slot name="header" /> <slot name="header" />
</view> </view>
<view class="content" style="padding:8px 12px;{{contentStyle || ''}}"> <view class="content" style="padding:16rpx 24rpx;{{contentStyle || ''}}">
<view id="contentSlot" style="height: {{showMoreBar ? showMore ? 'auto' : 'calc(3em * 1.57)' : 'auto'}};overflow: hidden;"> <view id="contentSlot"
style="height: {{showMoreBar ? showMore ? 'auto' : 'calc(3em * 1.57)' : 'auto'}};overflow: hidden;">
<slot name="content" /> <slot name="content" />
</view> </view>
<view wx:if="{{showMoreBar}}" class="show-more" catch:tap="showMoreTap"> <view wx:if="{{showMoreBar}}" class="show-more" catch:tap="showMoreTap">
@@ -14,5 +18,4 @@
<view class="footer" style="{{footerStyle||''}}"> <view class="footer" style="{{footerStyle||''}}">
<slot name="footer" /> <slot name="footer" />
</view> </view>
</view> </view>

View File

@@ -26,7 +26,7 @@
<slot name="tbody" /> <slot name="tbody" />
</block> </block>
<block wx:else> <block wx:else>
<view wx:if="{{data.length == 0}}" class="tr" style="height: 32px" /> <view wx:if="{{data.length == 0}}" class="tr" style="height: 64rpx" />
<block wx:for="{{data}}" wx:key="index" wx:for-item="record"> <block wx:for="{{data}}" wx:key="index" wx:for-item="record">
<view class="tr"> <view class="tr">
<block wx:for="{{columns}}" wx:key="index"> <block wx:for="{{columns}}" wx:key="index">
@@ -37,5 +37,4 @@
</block> </block>
</view> </view>
</view> </view>
<view wx:if="{{!useTbodySlot && data.length == 0}}" class="empty-data">暂无数据</view> <view wx:if="{{!useTbodySlot && data.length == 0}}" class="empty-data">暂无数据</view>

View File

@@ -1,7 +1,7 @@
.table-box { .table-box {
border-left: 1px solid #ddd; border-left: 1rpx solid #ddd;
border-right: 1px solid #ddd; border-right: 1rpx solid #ddd;
border-bottom: 1px solid #ddd; border-bottom: 1rpx solid #ddd;
overflow: auto; overflow: auto;
} }
@@ -38,14 +38,14 @@
.th, .th,
.td { .td {
display: table-cell; display: table-cell;
border-bottom: 1px solid #ddd; border-bottom: 1rpx solid #ddd;
padding: 4px; padding: 8rpx;
border-right: 1px solid #ddd; border-right: 1rpx solid #ddd;
vertical-align: middle; vertical-align: middle;
} }
.tr .th { .tr .th {
border-top: 1px solid #ddd; border-top: 1rpx solid #ddd;
} }
.tr .th:last-child, .tr .th:last-child,
@@ -65,7 +65,7 @@
.empty-data { .empty-data {
text-align: center; text-align: center;
margin-top: -33px; margin-top: -66rpx;
line-height: 30px; line-height: 60rpx;
color: #999; color: #999;
} }

View File

@@ -1,4 +1,4 @@
<view style="min-height: 95vh;display: flex;justify-content: center;flex-direction: column;"> <view style="min-height: 90vh;display: flex;justify-content: center;flex-direction: column;">
<t-empty icon="info-circle-filled"> <t-empty icon="info-circle-filled">
<view slot="description" style="color: #000;"> <view slot="description" style="color: #000;">
<view>抱歉!您当前没有权限访问该页面</view> <view>抱歉!您当前没有权限访问该页面</view>
@@ -7,4 +7,4 @@
</view> </view>
<t-button theme="primary" slot="action" bind:tap="navIndex">前往首页</t-button> <t-button theme="primary" slot="action" bind:tap="navIndex">前往首页</t-button>
</t-empty> </t-empty>
</view> </view>

View File

@@ -1,6 +1,7 @@
import { base, defaultAvatarUrl } from "@/utils/config"; import { base, defaultAvatarUrl } from '@/utils/config';
import { Subscribe } from "@/utils/subscribe"; import { login } from '@/utils/https';
import { setStorage } from "@/utils/util"; import { Subscribe } from '@/utils/subscribe';
import { isArray, setStorage } from '@/utils/util';
// import { IStorage } from "@/utils/storage"; // import { IStorage } from "@/utils/storage";
// const app = getApp(); // const app = getApp();
@@ -13,6 +14,7 @@ Component({
loading: Boolean, loading: Boolean,
isAuth: null, isAuth: null,
customStyle: null, customStyle: null,
hasTabBar: null,
}, },
// attached() { // attached() {
@@ -35,24 +37,24 @@ Component({
appletName: base.appletName, appletName: base.appletName,
show: false, show: false,
companyList: [], companyList: [],
encryptedData: "", encryptedData: '',
iv: "", iv: '',
}, },
methods: { methods: {
handleLogin(e: any) { handleLogin(e: any) {
this.triggerEvent("handleLogin", e.detail); this.triggerEvent('handleLogin', e.detail);
}, },
getPhoneNumberToast() { getPhoneNumberToast() {
setStorage("isLogin", 1); setStorage('isLogin', 1);
Subscribe.set("isLogin", "zzzuz"); Subscribe.set('isLogin', 'zzzuz');
wx.showToast({ title: "请先勾选协议", icon: "none" }); wx.showToast({ title: '请先勾选协议', icon: 'none' });
}, },
changeAgreementCheck(event: any) { changeAgreementCheck(event: any) {
this.setData({ isAgree: event.detail.checked }); this.setData({ isAgree: event.detail.checked });
}, },
navAgreement(e: any) { navAgreement(e: any) {
wx.navigateTo({ wx.navigateTo({
url: "../agreement/agreement?type=" + e.target.dataset.type, url: '../agreement/agreement?type=' + e.target.dataset.type,
}); });
}, },
// getPhoneNumber(e) { // getPhoneNumber(e) {
@@ -64,23 +66,23 @@ Component({
this.data.iv = e.detail.iv; this.data.iv = e.detail.iv;
console.log(e); console.log(e);
// login(e.detail.encryptedData, e.detail.iv) login(e.detail.encryptedData, e.detail.iv)
// .then((res) => { .then((res) => {
// console.log(res); console.log(res);
// if (isArray(res.data)) { if (isArray(res.data)) {
// this.setData({ this.setData({
// companyList: res.data, companyList: res.data,
// show: true, show: true,
// }); });
// } else { } else {
// this.triggerEvent("handleLogin", true); this.triggerEvent('handleLogin', true);
// } }
// }) })
// .catch((err) => { .catch((err) => {
// this.triggerEvent("handleLogin", false); this.triggerEvent('handleLogin', false);
// }); });
} else { } else {
wx.showToast({ title: e.detail.errMsg, icon: "none" }); wx.showToast({ title: e.detail.errMsg, icon: 'none' });
} }
}, },
login2(e: any) { login2(e: any) {

View File

@@ -1,38 +1,43 @@
<block wx:if="{{isLogin}}"> <block wx:if="{{isLogin}}">
<view wx:if="{{isAuth}}" style="padding: 12px;padding-bottom: env(safe-area-inset-bottom);{{customStyle ||''}}"> <view wx:if="{{isAuth}}"
style="padding: 24rpx;padding-bottom: {{ hasTabBar == '1' ? 'calc(var(--td-tab-bar-height,80rpx) + env(safe-area-inset-bottom) + 32rpx)' :'env(safe-area-inset-bottom)'}};{{customStyle ||''}}">
<slot></slot> <slot></slot>
</view> </view>
<no-auth-plugin wx:else /> <no-auth-plugin wx:else />
</block> </block>
<block wx:else> <block wx:else>
<t-loading wx:if="{{loading}}" theme="spinner" fullscreen text="加载中..." layout="vertical" /> <t-loading wx:if="{{loading}}" theme="spinner" fullscreen text="加载中..." layout="vertical" />
<view wx:else style="padding: 0 16px;height: 100vh;justify-content: center;display: flex;flex-direction: column;"> <view wx:else
style="padding: 0 32rpx;height: 90vh;justify-content: center;display: flex;flex-direction: column;">
<view style="display: flex;justify-content: center;"> <view style="display: flex;justify-content: center;">
<view style="width: 80px;height: 80px;overflow: hidden;border-radius: 80px;"> <view style="width: 160rpx;height: 160rpx;overflow: hidden;border-radius: 160rpx;">
<image style="width: 100%;height: 100%;object-fit: cover;" src="{{avatarUrl}}" mode="cover" /> <image style="width: 100%;height: 100%;object-fit: cover;" src="{{avatarUrl}}"
mode="cover" />
</view> </view>
</view> </view>
<view style="padding: 20px 0"> <view style="padding: 40rpx 0">
<view>本小程序仅供{{appletName}}用户使用</view> <view>本小程序仅供{{appletName}}用户使用</view>
<view>申请获取以下权限</view> <view>申请获取以下权限</view>
<view>获取您的公开信息(昵称,头像等)</view> <view>获取您的公开信息(昵称,头像等)</view>
</view> </view>
<t-button wx:if="{{isAgree}}" block open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" theme="primary"> <t-button wx:if="{{isAgree}}" block open-type="getPhoneNumber"
bindgetphonenumber="getPhoneNumber" theme="primary">
一键登录 一键登录
</t-button> </t-button>
<t-button wx:else block type="primary" bindtap="getPhoneNumberToast"> <t-button wx:else block type="primary" bindtap="getPhoneNumberToast">
一键登录 一键登录
</t-button> </t-button>
<t-checkbox borderless style="padding: 0;margin: 1em 0;" value="{{isAgree}}" bind:change="changeAgreementCheck"> <t-checkbox borderless style="padding: 0;margin: 1em 0;" value="{{isAgree}}"
bind:change="changeAgreementCheck">
我已阅读并同意 我已阅读并同意
</t-checkbox> </t-checkbox>
<t-link theme="primary" bindtap="navAgreement" data-type="user" style="margin-bottom: 8px;"> <t-link theme="primary" bindtap="navAgreement" data-type="user" style="margin-bottom: 16rpx;">
《{{appletName}}平台用户服务协议》 《{{appletName}}平台用户服务协议》
</t-link> </t-link>
<t-link theme="primary" bindtap="navAgreement" data-type="privacy" style="margin-bottom: 8px;"> <t-link theme="primary" bindtap="navAgreement" data-type="privacy"
style="margin-bottom: 16rpx;">
《{{appletName}}隐私权政策》 《{{appletName}}隐私权政策》
</t-link> </t-link>
</view> </view>
</block> </block>

View File

@@ -1,42 +1,19 @@
<view class="box"> <view wx:if="{{total}}" class="box">
<view>共{{total}}条</view> <view>共{{total}}条</view>
<t-button <t-button size="small" disabled="{{curr_page == 1}}" bindtap="pageChange" data-page="prev"
size="small" icon="chevron-left" style="padding-left: 16rpx;padding-right: 16rpx" />
disabled="{{curr_page == 1}}"
bindtap="pageChange"
data-page="prev"
icon="chevron-left"
style="padding-left: 8px;padding-right: 8px"
/>
<block wx:for="{{pages}}" wx:key="index"> <block wx:for="{{pages}}" wx:key="index">
<t-button <t-button size="small" theme="{{curr_page == item ? 'primary': ''}}"
size="small" variant="{{curr_page == item ? 'outline': ''}}" bindtap="pageChange" data-page="{{item}}">
theme="{{curr_page == item ? 'primary': ''}}" {{item}}
variant="{{curr_page == item ? 'outline': ''}}"
bindtap="pageChange"
data-page="{{item}}"
>{{item}}
</t-button> </t-button>
</block> </block>
<t-button <t-button size="small" disabled="{{curr_page == totalPage}}" bindtap="pageChange" data-page="next"
size="small" icon="chevron-right" style="padding-left: 16rpx;padding-right: 16rpx" />
disabled="{{curr_page == totalPage}}" <t-button size="small" bindtap="pageSelect" style="padding-left: 16rpx;padding-right: 16rpx">跳转
bindtap="pageChange"
data-page="next"
icon="chevron-right"
style="padding-left: 8px;padding-right: 8px"
/>
<t-button size="small" bindtap="pageSelect" style="padding-left: 8px;padding-right: 8px">跳转
</t-button> </t-button>
<t-picker
title="选择页码"
visible="{{open}}"
value="{{[curr_page]}}"
cancelBtn="取消"
confirmBtn="确认"
bind:confirm="onConfirm"
>
<t-picker-item options="{{pickerPages}}" />
</t-picker>
</view> </view>
<t-picker title="选择页码" visible="{{open}}" value="{{[curr_page]}}" cancelBtn="取消" confirmBtn="确认"
bind:confirm="onConfirm">
<t-picker-item options="{{pickerPages}}" />
</t-picker>

View File

@@ -1,8 +1,8 @@
.box { .box {
display: flex; display: grid;
grid-template-columns: repeat(auto-fit, minmax(0, max-content));
column-gap: 16rpx;
row-gap: 16rpx;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-wrap: wrap;
column-gap: 8px;
row-gap: 8px;
} }

View File

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

View File

@@ -0,0 +1,24 @@
Component({
options: { multipleSlots: true },
/**
* 组件的属性列表
*/
properties: { label: null },
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
onChange(e: any) {
this.triggerEvent('change', { value: e.detail.value });
},
onClear() {
this.triggerEvent('change', { value: '' });
},
},
});

View File

@@ -0,0 +1 @@
<t-input label="{{label}}" bind:change="onChange" bind:clear="onClear" clearable />

View File

@@ -1,60 +1,29 @@
<view style="display: flex;align-items: center;margin-bottom: 12px;{{customStyle}}"> <view style="display: flex;align-items: center;margin-bottom: 24rpx;{{customStyle}}">
<view style="flex: 1;margin-right: {{hideMore ? 0 : '12px'}};"> <view style="flex: 1;margin-right: {{hideMore ? 0 : '24rpx'}};">
<block wx:if="{{useInputSlot}}"> <block wx:if="{{useInputSlot}}">
<slot name='input' /> <slot name='input' />
</block> </block>
<block wx:else> <block wx:else>
<t-input <t-input wx:if="{{!hideInput}}" placeholder="{{placeholder || '请输入关键字'}}" clearable borderless
wx:if="{{!hideInput}}" bindchange="change" value="{{value || ''}}" data-key="{{dataKey}}" confirm-type="search"
placeholder="{{placeholder || '请输入关键字'}}"
clearable
borderless
bindchange="change"
value="{{value || ''}}"
data-key="{{dataKey}}"
confirm-type="search"
bind:clear="clear" bind:clear="clear"
custom-style="background:#f5f5f5;min-height: var(--td-button-small-height,64rpx);height:var(--td-button-small-height,64rpx);padding: 0;" custom-style="background:#f5f5f5;min-height: var(--td-button-small-height,64rpx);height:var(--td-button-small-height,64rpx);padding: 0;"
size="small" size="small" t-class="aaaaaa">
t-class="aaaaaa" <t-button name="search" slot="prefix-icon" size="small" theme="primary" bindtap="scanCode"
> icon="scan" />
<t-button <t-button slot="suffix-icon" bindtap="search" icon="search" theme="primary" size="small" />
name="search"
slot="prefix-icon"
size="small"
theme="primary"
bindtap="scanCode"
icon="scan"
/>
<t-button
slot="suffix-icon"
bindtap="search"
icon="search"
theme="primary"
size="small"
/>
</t-input> </t-input>
</block> </block>
</view> </view>
<t-button <t-button wx:if="{{!hideMore}}" bindtap="showSearch" theme="primary" size="small">筛选
wx:if="{{!hideMore}}"
bindtap="showSearch"
theme="primary"
size="small"
>筛选
</t-button> </t-button>
</view> </view>
<popup-plugin visible="{{ show }}" bind:close="close" title="筛选条件"> <popup-plugin visible="{{ show }}" bind:close="close" title="筛选条件">
<slot name='content' /> <slot name='content' />
<slot wx:if="{{useFooterSlot}}" name="footer" /> <slot wx:if="{{useFooterSlot}}" name="footer" />
<view wx:else style="padding: 12px 0;display: flex;justify-content: center;position: sticky;bottom: 0;left: 0;background-color: #fff;z-index: 1;"> <view wx:else
<t-button style="padding: 24rpx 0;display: flex;justify-content: center;position: sticky;bottom: 0;left: 0;background-color: #fff;z-index: 1;">
bindtap="ok" <t-button bindtap="ok" style="min-width: 80px;" size="small" theme="primary">搜索
style="min-width: 80px;"
size="small"
theme="primary"
>搜索
</t-button> </t-button>
</view> </view>
</popup-plugin> </popup-plugin>

View File

@@ -1,44 +1,24 @@
<view style="display: contents" bindtap="click"> <view style="display: contents" bindtap="click">
<slot/> <slot />
</view> </view>
<popup-plugin visible="{{visible}}" bind:close="close" title="{{title}}"> <popup-plugin visible="{{visible}}" bind:close="close" title="{{title}}">
<view style="padding: 12px 0;"> <view style="padding: 24rpx 0;">
<t-radio-group <t-radio-group wx:if="{{mode == 'single'}}" bind:change="radioChange" allow-uncheck
wx:if="{{mode == 'single'}}" value="{{val}}" borderless>
bind:change="radioChange" <t-radio wx:for="{{options}}" wx:key="index" value="{{item.value}}"
allow-uncheck style="padding-bottom: 12rpx;padding-top: 12rpx;">{{item.label}}
value="{{val}}"
borderless
>
<t-radio
wx:for="{{options}}"
wx:key="index"
value="{{item.value}}"
style="padding-bottom: 6px;padding-top: 6px;"
>{{item.label}}
</t-radio> </t-radio>
</t-radio-group> </t-radio-group>
<t-checkbox-group <t-checkbox-group wx:else value="{{val}}" bind:change="checkboxChange" borderless>
wx:else <t-checkbox style="padding-bottom: 12rpx;padding-top: 12rpx;" wx:for="{{options}}"
value="{{val}}" icon="rectangle" wx:key="index" value="{{item.value}}">{{item.label}}
bind:change="checkboxChange"
borderless
>
<t-checkbox
style="padding-bottom: 6px;padding-top: 6px;"
wx:for="{{options}}"
icon="rectangle"
wx:key="index"
value="{{item.value}}"
>{{item.label}}
</t-checkbox> </t-checkbox>
</t-checkbox-group> </t-checkbox-group>
</view> </view>
<view class="footer" wx:if="{{ mode == 'multiple' }}"> <view class="footer" wx:if="{{ mode == 'multiple' }}">
<t-button size="small" theme="primary" bindtap="ok">确定</t-button> <t-button size="small" theme="primary" bindtap="ok">确定</t-button>
</view> </view>
</popup-plugin> </popup-plugin>

View File

@@ -6,5 +6,5 @@
bottom: 0; bottom: 0;
background: #fff; background: #fff;
z-index: 1; z-index: 1;
padding-top: 12px; padding-top: 24rpx;
} }

View File

@@ -1,5 +1,6 @@
<t-tab-bar t-class="t-tab-bar" value="{{active}}" bindchange="onChange" theme="normal" fixed="{{true}}" split="{{false}}"> <t-tab-bar custom-style="z-index: 9999" bordered value="{{active}}" bindchange="onChange"
theme="normal" fixed="{{true}}" split="{{false}}">
<t-tab-bar-item wx:for="{{list}}" wx:key="value" value="{{item.value}}" icon="{{item.icon}}"> <t-tab-bar-item wx:for="{{list}}" wx:key="value" value="{{item.value}}" icon="{{item.icon}}">
{{item.label}} {{item.label}}
</t-tab-bar-item> </t-tab-bar-item>
</t-tab-bar> </t-tab-bar>

View File

@@ -1,8 +1,6 @@
// pages/index/index.ts import { loginStatus, post } from '@/utils/https';
import { menuConfig } from '@/utils/menuConfig';
import { menuConfig } from "@/utils/menuConfig"; import { getDataSet, toArray, toObject } from '@/utils/util';
import { Subscribe } from "@/utils/subscribe";
import { getDataSet, toObject } from "@/utils/util";
// const app = getApp(); // const app = getApp();
// const Storage = app.Storage; // const Storage = app.Storage;
@@ -11,94 +9,50 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
isLogin: false,
loading: true,
BGColors: [ BGColors: [
"linear-gradient( 135deg, #FDEB71 10%, #F8D800 100%)", 'linear-gradient( 135deg, #FDEB71 10%, #F8D800 100%)',
"linear-gradient( 135deg, #ABDCFF 10%, #0396FF 100%)", 'linear-gradient( 135deg, #ABDCFF 10%, #0396FF 100%)',
"linear-gradient( 135deg, #FEB692 10%, #EA5455 100%)", 'linear-gradient( 135deg, #FEB692 10%, #EA5455 100%)',
"linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%)", 'linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%)',
"linear-gradient( 135deg, #90F7EC 10%, #32CCBC 100%)", 'linear-gradient( 135deg, #90F7EC 10%, #32CCBC 100%)',
"linear-gradient( 135deg, #FFF6B7 10%, #F6416C 100%)", 'linear-gradient( 135deg, #FFF6B7 10%, #F6416C 100%)',
"linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%)", 'linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%)',
"linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)", 'linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)',
"linear-gradient( 135deg, #F97794 10%, #623AA2 100%)", 'linear-gradient( 135deg, #F97794 10%, #623AA2 100%)',
"linear-gradient( 135deg, #FCCF31 10%, #F55555 100%)", 'linear-gradient( 135deg, #FCCF31 10%, #F55555 100%)',
"linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%)", 'linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%)',
"linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%)", 'linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%)',
"linear-gradient( 135deg, #5EFCE8 10%, #736EFE 100%)", 'linear-gradient( 135deg, #5EFCE8 10%, #736EFE 100%)',
"linear-gradient( 135deg, #FAD7A1 10%, #E96D71 100%)", 'linear-gradient( 135deg, #FAD7A1 10%, #E96D71 100%)',
"linear-gradient( 135deg, #FFD26F 10%, #3677FF 100%)", 'linear-gradient( 135deg, #FFD26F 10%, #3677FF 100%)',
"linear-gradient( 135deg, #A0FE65 10%, #FA016D 100%)", 'linear-gradient( 135deg, #A0FE65 10%, #FA016D 100%)',
"linear-gradient( 135deg, #FFDB01 10%, #0E197D 100%)", 'linear-gradient( 135deg, #FFDB01 10%, #0E197D 100%)',
"linear-gradient( 135deg, #FEC163 10%, #DE4313 100%)", 'linear-gradient( 135deg, #FEC163 10%, #DE4313 100%)',
"linear-gradient( 135deg, #92FFC0 10%, #002661 100%)", 'linear-gradient( 135deg, #92FFC0 10%, #002661 100%)',
"linear-gradient( 135deg, #EEAD92 10%, #6018DC 100%)", 'linear-gradient( 135deg, #EEAD92 10%, #6018DC 100%)',
"linear-gradient( 135deg, #F6CEEC 10%, #D939CD 100%)", 'linear-gradient( 135deg, #F6CEEC 10%, #D939CD 100%)',
"linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%)", 'linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%)',
"linear-gradient( 135deg, #F1CA74 10%, #A64DB6 100%)", 'linear-gradient( 135deg, #F1CA74 10%, #A64DB6 100%)',
"linear-gradient( 135deg, #E8D07A 10%, #5312D6 100%)", 'linear-gradient( 135deg, #E8D07A 10%, #5312D6 100%)',
"linear-gradient( 135deg, #EECE13 10%, #B210FF 100%)", 'linear-gradient( 135deg, #EECE13 10%, #B210FF 100%)',
"linear-gradient( 135deg, #79F1A4 10%, #0E5CAD 100%)", 'linear-gradient( 135deg, #79F1A4 10%, #0E5CAD 100%)',
],
params: {
curr_page: 1,
page_count: 20,
},
total: 100,
current1: ["checkbox1", "checkbox2"],
current2: "checkbox1",
options: [
{ label: "多选", value: "checkbox1" },
{ label: "多选", value: "checkbox2" },
{
label:
"多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行",
value: "checkbox3",
maxLabelRow: 2,
},
{
label: "多选",
value: "checkbox4",
content:
"描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息",
maxContentRow: 2,
},
{ label: "多选", value: "checkbox11" },
{ label: "多选", value: "checkbox21" },
{
label:
"多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行多选标题多行",
value: "checkbox31",
maxLabelRow: 2,
},
{
label: "多选",
value: "checkbox41",
content:
"描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息描述信息",
maxContentRow: 2,
},
], ],
block: [] as any[],
authInfo: {} as any, authInfo: {} as any,
menuList: [] as any, menuList: [] as any,
}, },
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
change() {
Subscribe.set("isLogin", "hello");
// wx.navigateTo({ url: "/pages/my/my" });
},
changePage(e: any) {
this.data.params.curr_page = e.detail.curr_page;
this.setData({ params: this.data.params });
},
changeSelect(e: any) {
console.log(e);
},
navToMy() {
wx.navigateTo({ url: "/pages/my/my" });
},
init() { init() {
this.data.authInfo = {}; this.data.authInfo = {};
const companyInfo = toObject(wx.getStorageSync("company_info")); const companyInfo = toObject(wx.getStorageSync('company_info'));
this.data.menuList.length = 0; this.data.menuList.length = 0;
menuConfig.forEach((el) => { menuConfig.forEach((el) => {
const children: any[] = []; const children: any[] = [];
@@ -115,22 +69,41 @@ Page({
}); });
} }
}); });
// this.getIndex(); this.getIndex();
this.setData({ this.setData({
authInfo: this.data.authInfo, authInfo: this.data.authInfo,
menuList: this.data.menuList, menuList: this.data.menuList,
hideTabKeys: companyInfo.staff_type == 3 ? ["2"] : [], hideTabKeys: companyInfo.staff_type == 3 ? ['2'] : [],
});
},
getIndex() {
post('Index/index', {}).then((res: any) => {
const block = toArray(res?.block);
if (block.length % 2 != 0) {
block.push({ value: '', name: '敬请期待', unit: '' });
}
this.setData({ block });
}); });
}, },
nav(e: any) { nav(e: any) {
const url = getDataSet(e).url; const data = getDataSet(e);
wx.navigateTo({ url }); wx.navigateTo({ url: data.url });
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad() {}, onLoad() {
this.setData({ loading: true });
loginStatus()
.then(() => {
this.setData({ isLogin: true, loading: false });
this.init();
})
.catch((err) => {
this.setData({ isLogin: false, loading: false });
console.log('调用登录状态请求失败', err);
});
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
@@ -142,7 +115,6 @@ Page({
*/ */
onShow() { onShow() {
wx.hideHomeButton(); wx.hideHomeButton();
this.init();
}, },
/** /**

View File

@@ -1,38 +1,32 @@
<page-plugin loading="{{true}}" isLogin="{{true}}" isAuth="{{true}}"> <page-plugin isAuth="{{true}}" loading="{{loading}}" is-login="{{isLogin}}"
<text>pages/index/index.wxml</text> bind:handleLogin="handleLogin" hasTabBar="1">
<t-button bind:tap="change">change</t-button> <view class="block-box">
<t-button bind:tap="navToMy">my</t-button> <block wx:for="{{block}}" wx:key="index">
<pagination-plugin <view class="block-item-box" style="background: {{BGColors[index]}};">
curr_page="{{params.curr_page}}" <view class="block-item-name">{{item.name}}</view>
total="{{total}}" <view class="block-item-value">
page_count="{{params.page_count}}" <text>{{item.value}}</text>
bind:change="changePage" <text>{{item.unit}}</text>
/>
<block wx:for="{{ menuList }}" wx:key="index" wx:for-item="item">
<view style="display: flex;align-items: center;">
<t-icon name="{{ item.icon }}" style="color: {{item.iconColor}};font-size: 1.2em;margin-right: 4px;" />
<text style="font-weight: bold;font-size: 1.1em;">{{ item.title }}</text>
</view>
<view style="display: flex;align-items: center;flex-wrap: wrap;">
<block wx:for="{{ item.children }}" wx:key="index" wx:for-item="child">
<view class="menu-item" bindtap="nav" data-url="{{ child.url }}">
<image class="nav-item-icon" src="/assets/icons/{{child.title}}.svg" mode="aspectFit" />
<view>{{ child.title }}</view>
</view> </view>
</block> </view>
</block>
</view>
<block wx:for="{{ menuList }}" wx:key="index" wx:for-item="item">
<view class="menu-box">
<view class="menu-title">
<t-icon name="{{ item.icon }}"
style="color: {{item.iconColor}};font-size: 1.2em;margin-right: 8rpx;" />
<text style="font-weight: bold;font-size: 1.1em;">{{ item.title }}</text>
</view>
<view class="menu-children-box">
<block wx:for="{{ item.children }}" wx:key="index" wx:for-item="child">
<view class="menu-item" bindtap="nav" data-url="{{ child.url }}">
<image class="nav-item-icon" src="/assets/icons/{{child.title}}.svg" mode="aspectFit" />
<view>{{ child.title }}</view>
</view>
</block>
</view>
</view> </view>
</block> </block>
</page-plugin> </page-plugin>
<tab-bar-plugin active="index" /> <tab-bar-plugin active="index" />
<select-plugin
mode="single"
value="{{current2}}"
options="{{options}}"
bind:change="changeSelect"
>
<view style="display: block;">下拉选择</view>
</select-plugin>
<search-popup>
<view slot="content">1111</view>
</search-popup>

View File

@@ -1,14 +1,34 @@
.container { page {
height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom)); background: #f5f5f5;
}
.menu-box {
background-color: #fff;
border-radius: 8rpx;
margin-bottom: 32rpx;
}
.menu-title {
display: flex;
align-items: center;
padding: 16rpx 24rpx;
border-bottom: 1rpx solid #ddd;
}
.menu-children-box {
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 16rpx;
} }
.menu-item { .menu-item {
display: inline-flex; display: inline-flex;
flex-direction: column; flex-direction: column;
width: clamp(80px, 25%, 120px); width: clamp(80rpx, 25%, 200rpx);
box-sizing: border-box; box-sizing: border-box;
padding: 8px; padding: 16rpx;
--width: calc((100vw - 16px - 24px) / 4 * 0.4); --width: calc((100vw - 32rpx - 48rpx - 16rpx) / 4 * 0.4);
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
@@ -23,3 +43,41 @@
display: inline-flex; display: inline-flex;
box-sizing: border-box; box-sizing: border-box;
} }
.block-box {
display: grid;
grid-template-columns: 1fr 1fr;
row-gap: 24rpx;
column-gap: 24rpx;
margin-bottom: 48rpx;
}
.block-item-box {
border-radius: 8rpx;
padding: 24rpx;
box-sizing: border-box;
}
.block-item-name {
font-size: 1.125em;
margin-bottom: 32rpx;
}
.block-item-value {
display: flex;
font-size: 1.4em;
font-weight: bold;
align-items: flex-end;
line-height: 1.2;
justify-content: flex-end;
}
.block-item-value text:first-child {
line-height: 1;
}
.block-item-value text:last-child {
font-weight: normal;
font-size: 0.75em;
color: #333;
}

View File

@@ -1,9 +1,8 @@
{ {
"usingComponents": { "usingComponents": {
"t-button": "tdesign-miniprogram/button/button", "tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin",
"search-popup": "/pages/components/search-popup/search-popup", "t-cell": "tdesign-miniprogram/cell/cell",
"card-plugin": "/pages/components/card-plugin/card-plugin", "t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
"t-input": "tdesign-miniprogram/input/input", "t-image": "tdesign-miniprogram/image/image"
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin"
} }
} }

View File

@@ -1,43 +1,80 @@
import { Subscribe } from "@/utils/subscribe"; import { base } from '@/utils/config';
import { setStorage } from "@/utils/util"; import { checkSesskey, loginStatus, post } from '@/utils/https';
import { getStorage, toObject } from '@/utils/util';
Page({ Page({
data: { data: {
columns: [ version: wx.getAccountInfoSync().miniProgram.version || '开发1.0',
{ title: "我的收藏", width: "100px", dataIndex: "name" }, isLogin: false,
{ title: "我的点赞", width: "200px", dataIndex: "count" }, host: base.apiHost,
{ title: "我的评论", width: "300px", dataIndex: "desc" }, user_info: {},
], company_info: {},
data: [ loading: true,
// { name: "张三", count: 1, desc: "11111" }, // staffType: StaffType,
// { name: "张三", count: 1, desc: "11111" }, company_list: [],
// { name: "张三", count: 1, desc: "11111" }, show: false,
// { name: "张三", count: 1, desc: "11111" }, hideTabKeys: [],
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
// { name: "张三", count: 1, desc: "11111" },
],
}, },
change() { init() {
setStorage("isLogin", 1); const companyInfo = toObject(getStorage('company_info'));
Subscribe.set("isLogin", "zzzuz"); this.setData({
// wx.navigateTo({ url: "/pages/my/my" }); user_info: toObject(getStorage('user_info')),
company_info: companyInfo,
});
}, },
searchChange(e: any) { searchChange(e: any) {
console.log(e); console.log(e);
}, },
ok() { // 腾讯文档
console.log("ok"); txDoc() {
return;
wx.navigateToMiniProgram({
appId: 'wxd45c635d754dbf59',
path:
`pages/detail/detail?url=` +
encodeURIComponent('https://docs.qq.com/aio/DS2NCRFFseG9Ma3Ja?p=7umJTJ6bznQtaBK2RSLmPD'),
});
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad() {}, onLoad() {
this.setData({ loading: true });
loginStatus()
.then(() => {
console.log('ssss');
this.setData({ isLogin: true, loading: false });
this.init();
})
.catch((err) => {
this.setData({ isLogin: false, loading: false });
console.log('调用登录状态请求失败', err);
});
},
loginOut() {
wx.showModal({
title: '确认退出?',
// content: '',
complete: (res: any) => {
if (res.confirm) {
post('Applet/loginOut').then((res: any) => {
this.setData({ isLogin: false });
checkSesskey({ showLoading: false, showError: false })
.then((res) => {})
.catch((err) => {
console.log('checkSesskey', err);
});
});
}
},
});
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@@ -1,20 +1,37 @@
<page-plugin> <page-plugin hasTabBar="1" isAuth="{{true}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<text>pages/my/my.wxml</text> <t-cell-group title="企业信息">
<t-button bind:tap="change">change</t-button> <t-cell title="{{company_info.company_name}}" use-label-slot>
<view style="padding: 12px;"> <view slot="image" style="margin-right: 12rpx;">
<t-image width="200rpx" height="200rpx" fit="cover"
<search-popup bind:ok="ok" bind:change="searchChange"> src="{{host}}{{company_info.company_logo}}" />
<view slot="content">11111</view>
</search-popup>
<card-plugin>
<view slot="header">11111</view>
<view slot="content">
<view style="height: 70px">11111</view>
</view> </view>
</card-plugin> <view slot="description">{{company_info.company_desc}}</view>
</view> </t-cell>
</t-cell-group>
<!-- <block wx:if="{{company_list.length> 1}}">
<t-cell-group>
<t-cell title="切换企业" bind:tap="showPopup" is-link />
</t-cell-group>
</block> -->
<t-cell-group title="账号信息">
<t-cell>
<view slot="image" style="margin-right: 12rpx;">
<t-image width="200rpx" height="200rpx" fit="cover" src="{{host}}{{user_info.logo}}" />
</view>
<view slot="title" style="display: flex;align-items: center;flex-wrap: wrap;">
<view style="margin-right: 16rpx;">{{user_info.login_name}}</view>
</view>
<view slot="description">
<view>{{user_info.nick_name}}</view>
<view>{{user_info.user_phone}}</view>
</view>
</t-cell>
</t-cell-group>
<t-cell title="退出登录" bind:tap="loginOut" hover bordered arrow />
<t-cell title="版本" note="{{version}}" hover bind:tap="txDoc" bordered arrow />
</page-plugin> </page-plugin>
<tab-bar-plugin active="my" /> <tab-bar-plugin active="my" />

View File

@@ -0,0 +1,6 @@
{
"usingComponents": {
"card-plugin": "/pages/components/card-plugin/card-plugin"
},
"navigationBarTitleText": "订单排序"
}

View File

@@ -0,0 +1,51 @@
Page({
/**
* 页面的初始数据
*/
data: {
list: [1, 2],
},
getList() {
// Orders/getLiteOrders
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,7 @@
<block wx:for="{{list}}" wx:key="index">
<card-plugin>
<view slot="header">{{item}}</view>
<view slot="content">{{item}}</view>
<view slot="footer">{{item}}</view>
</card-plugin>
</block>

View File

@@ -0,0 +1,6 @@
{
"usingComponents": {
"card-plugin": "/pages/components/card-plugin/card-plugin"
},
"navigationBarTitleText": "销售订单"
}

View File

@@ -0,0 +1,56 @@
Page({
/**
* 页面的初始数据
*/
data: {
list: [1, 2, 3],
params: {
curr_page: 1,
page_count: 20,
process_state: 200,
},
},
getList() {
// /Orders/list
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,7 @@
<block wx:for="{{list}}" wx:key="index">
<card-plugin>
<view slot="header">{{item}}</view>
<view slot="content">{{item}}</view>
<view slot="footer">{{item}}</view>
</card-plugin>
</block>

View File

@@ -1,10 +1,11 @@
{ {
"navigationBarTitleText": "流程录入", "navigationBarTitleText": "录入流程",
"usingComponents": { "usingComponents": {
"t-input": "tdesign-miniprogram/input/input", "t-input": "tdesign-miniprogram/input/input",
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
"t-icon": "tdesign-miniprogram/icon/icon", "t-icon": "tdesign-miniprogram/icon/icon",
"popup-plugin": "/pages/components/popup-plugin/popup-plugin", "popup-plugin": "/pages/components/popup-plugin/popup-plugin",
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin" "tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin"
} }
} }

View File

@@ -1,43 +1,36 @@
import { loginStatus, post } from "@/utils/https"; import { loginStatus, post } from '@/utils/https';
import { import { formatTime, getAuthInfo, getDataSet, isArray, toArray, toObject } from '@/utils/util';
formatTime, import { voiceRequest } from '@/utils/voiceUtil';
getAuthInfo,
getDataSet,
isArray,
toArray,
toObject,
} from "@/utils/util";
import { voiceRequest } from "@/utils/voiceUtil";
/** 拼接符号 */ /** 拼接符号 */
const ProcessCodeConcatSymbol = "&&"; const ProcessCodeConcatSymbol = '&&';
/** 撤回码标记 */ /** 撤回码标记 */
const RecallCodeMarking = "-"; const RecallCodeMarking = '-';
/** /**
* 解析流程码 * 解析流程码
* @param {string} value * @param {string} value
*/ */
const parseQrCode = (value: string) => { const parseQrCode = (value: string) => {
value = `${value || ""}`; value = `${value || ''}`;
const obj = { const obj = {
/** 工序码 */ /** 工序码 */
code: value, code: value,
/** 提成自定义字段 */ /** 提成自定义字段 */
key: "", key: '',
/** - => 撤回码 */ /** - => 撤回码 */
type: "", type: '',
}; };
if (value.includes(ProcessCodeConcatSymbol)) { if (value.includes(ProcessCodeConcatSymbol)) {
obj.code = value.substring(0, value.indexOf(ProcessCodeConcatSymbol)); obj.code = value.substring(0, value.indexOf(ProcessCodeConcatSymbol));
obj.key = value.substring( obj.key = value.substring(
value.indexOf(ProcessCodeConcatSymbol) + ProcessCodeConcatSymbol.length value.indexOf(ProcessCodeConcatSymbol) + ProcessCodeConcatSymbol.length,
); );
} }
if (obj.code.includes(RecallCodeMarking)) { if (obj.code.includes(RecallCodeMarking)) {
obj.type = RecallCodeMarking; obj.type = RecallCodeMarking;
obj.code = obj.code.replace(RecallCodeMarking, ""); obj.code = obj.code.replace(RecallCodeMarking, '');
} }
return obj; return obj;
@@ -48,10 +41,12 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
action: "end", action: 'end',
processCodeMsg: "", processCodeMsg: '',
rel_order_no: "", // rel_order_no: 'XSDD2026011500000190',
process_code: "", // process_code: 'jd',
rel_order_no: '',
process_code: '',
logsList: [] as any[], logsList: [] as any[],
show: false, show: false,
orders: [] as any[], orders: [] as any[],
@@ -63,49 +58,42 @@ Page({
hideTabKeys: [] as string[], hideTabKeys: [] as string[],
processItems: [] as any[], processItems: [] as any[],
backFlag: false, backFlag: false,
selectedProcessCode: "", selectedProcessCode: '',
result: "", result: '',
logType: "0", logType: '0',
/** 默认提成 */ rel_order_no_temp: '',
defaultBonus: true,
showDefaultBonus: false,
defaultBonusConfig: {},
defaultBonusConfigKeys: [] as string[],
rel_order_no_temp: "",
}, },
handleLogin(e: any) { handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) { if (e.detail) {
this.setData({ isLogin: true, authInfo: getAuthInfo() });
this.init(); this.init();
} else {
this.setData({ isLogin: false });
} }
}, },
backChange(e: any) { backChange(e: any) {
this.data.backFlag = e.detail; const checked = e.detail.checked;
this.setData({ backFlag: e.detail }); this.data.backFlag = checked;
wx.setStorageSync("processBackFlag", e.detail ? 1 : 0); this.setData({ backFlag: checked });
wx.setStorageSync('processBackFlag', checked ? 1 : 0);
if (this.data.selectedProcessCode) { if (this.data.selectedProcessCode) {
const { code, key } = parseQrCode(this.data.selectedProcessCode); const { code, key } = parseQrCode(this.data.selectedProcessCode);
this.data.selectedProcessCode = `${code}${ this.data.selectedProcessCode = `${code}${checked ? RecallCodeMarking : ''}`;
e.detail ? RecallCodeMarking : ""
}`;
if (key) { if (key) {
this.data.selectedProcessCode += `${ProcessCodeConcatSymbol}${key}`; this.data.selectedProcessCode += `${ProcessCodeConcatSymbol}${key}`;
} }
} }
wx.setStorageSync('selectedProcessCode', this.data.selectedProcessCode);
this.getProcessName(); this.getProcessName();
}, },
getProcessName() { getProcessName() {
if (this.data.selectedProcessCode) { if (this.data.selectedProcessCode) {
const { code, type } = parseQrCode(this.data.selectedProcessCode); const { code, type } = parseQrCode(this.data.selectedProcessCode);
for (const ell of this.data.processItems) { for (const ell of this.data.processItems) {
if (ell.code == code) { if (ell.process_code == code) {
this.setData({ this.setData({
processCodeMsg: `工序名称:${ell.name || ""}(${ell.code})`, processCodeMsg: `工序名称:${ell.process_name || ''}(${ell.process_code})`,
selectedProcessCode: this.data.selectedProcessCode, selectedProcessCode: this.data.selectedProcessCode,
process_code: this.data.selectedProcessCode, process_code: this.data.selectedProcessCode,
action: type ? "back" : "end", action: type ? 'back' : 'end',
}); });
break; break;
} }
@@ -113,19 +101,19 @@ Page({
} }
}, },
processItemTap(e: any) { processItemTap(e: any) {
this.data.selectedProcessCode = this.data.selectedProcessCode = e.currentTarget.dataset.code + (this.data.backFlag ? '-' : '');
e.currentTarget.dataset.code + (this.data.backFlag ? "-" : ""); wx.setStorageSync('selectedProcessCode', this.data.selectedProcessCode);
wx.setStorageSync("selectedProcessCode", this.data.selectedProcessCode);
this.setData({ this.setData({
selectedProcessCode: this.data.selectedProcessCode, selectedProcessCode: this.data.selectedProcessCode,
}); });
this.getProcessName(); this.getProcessName();
}, },
getExecProcess() { getExecProcess() {
post("Orders/getExecProcess1").then((res: any) => { post('CompanyProcessV2/getProcessByCode').then((res: any) => {
this.data.processItems = toArray(res.data); this.data.processItems = toArray(res.data);
if (this.data.processItems.length == 1) { if (this.data.processItems.length == 1) {
this.data.selectedProcessCode = this.data.processItems[0].code; this.data.selectedProcessCode = this.data.processItems[0].process_code;
this.getProcessName(); this.getProcessName();
} else { } else {
this.getProcessName(); this.getProcessName();
@@ -136,15 +124,16 @@ Page({
}); });
}, },
init() { init() {
const companyInfo = toObject(wx.getStorageSync("company_info")); const companyInfo = toObject(wx.getStorageSync('company_info'));
const code = wx.getStorageSync("selectedProcessCode") || ""; const code = wx.getStorageSync('selectedProcessCode') || '';
this.data.selectedProcessCode = code; this.data.selectedProcessCode = code;
this.data.process_code = code; this.data.process_code = code;
this.data.backFlag = wx.getStorageSync("processBackFlag") == 1; this.data.backFlag = wx.getStorageSync('processBackFlag') == 1;
const logType = wx.getStorageSync("processEntry_logType"); const logType = wx.getStorageSync('processEntry_logType');
this.setData({ this.setData({
hideTabKeys: companyInfo.staff_type == 3 ? ["2"] : [], authInfo: getAuthInfo(),
hideTabKeys: companyInfo.staff_type == 3 ? ['2'] : [],
backFlag: this.data.backFlag, backFlag: this.data.backFlag,
selectedProcessCode: code, selectedProcessCode: code,
process_code: code, process_code: code,
@@ -156,9 +145,10 @@ Page({
this.setData({ this.setData({
voice: event.detail, voice: event.detail,
}); });
wx.setStorageSync("processEntryVoice", `${event.detail}`); wx.setStorageSync('processEntryVoice', `${event.detail}`);
}, },
getVoice(msg: string, cacheVoice?: boolean) { getVoice(msg: string, cacheVoice?: boolean) {
return;
if (this.data.voice && msg) { if (this.data.voice && msg) {
voiceRequest(msg, cacheVoice); voiceRequest(msg, cacheVoice);
} }
@@ -166,18 +156,19 @@ Page({
onLogTypeChange(e: any) { onLogTypeChange(e: any) {
const data = getDataSet(e); const data = getDataSet(e);
this.setData({ logType: data.key }); this.setData({ logType: data.key });
wx.setStorageSync("processEntry_logType", data.key); wx.setStorageSync('processEntry_logType', data.key);
}, },
scanCode() { scanCode() {
this.data.isScanCode = true; this.data.isScanCode = true;
wx.scanCode({ wx.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
scanType: ["qrCode"], scanType: ['qrCode'],
success: (res) => { success: (res) => {
console.log(res); console.log(res);
const qrcode = res.result || ""; const qrcode = res.result || '';
if (qrcode) { if (qrcode) {
if (qrcode.startsWith("DD") || qrcode.startsWith("LC")) { if (qrcode.startsWith('XSDD')) {
if (this.data.process_code) { if (this.data.process_code) {
this.data.rel_order_no = qrcode; this.data.rel_order_no = qrcode;
this.setData({ this.setData({
@@ -185,16 +176,13 @@ Page({
}); });
this.processEnter(); this.processEnter();
} else { } else {
wx.showToast({ wx.showToast({ title: '请扫流程码', icon: 'none' });
title: "请扫流程码",
icon: "none",
});
} }
} else { } else {
const code = parseQrCode(qrcode); const code = parseQrCode(qrcode);
this.setData({ this.setData({
action: code.type == RecallCodeMarking ? "back" : "end", action: code.type == RecallCodeMarking ? 'back' : 'end',
rel_order_no: "", rel_order_no: '',
}); });
this.getProcess(qrcode); this.getProcess(qrcode);
} }
@@ -208,41 +196,32 @@ Page({
}, },
}); });
}, },
getProcess(real_code: any) { getProcess(process_code: any) {
const code = parseQrCode(real_code); const code = parseQrCode(process_code);
post("CompanyProcess/processChildList", { post('/CompanyProcessV2/getProcessByCode', {
curr_page: 1, curr_page: 1,
page_count: 1, page_count: 1,
real_code: code.code, process_code: code.code,
}) })
.then((res: any) => { .then((res: any) => {
const data = res.data; const data = res.data;
if (Array.isArray(res.data) && data.length) { if (Array.isArray(res.data) && data.length) {
this.setData({ this.setData({
processCodeMsg: `工序名称:${data[0].name || ""}(${real_code})`, processCodeMsg: `工序名称:${data[0].process_name || ''}(${process_code})`,
process_code: real_code, process_code: process_code,
selectedProcessCode: real_code, selectedProcessCode: process_code,
});
this.getVoice(`${data[0].name}工序`, true);
wx.showToast({
title: "请扫订单二维码",
icon: "none",
}); });
this.getVoice(`${data[0].process_name}工序`, true);
wx.showToast({ title: '请扫订单二维码', icon: 'none' });
} else { } else {
this.addMsg("未找到 " + real_code + " 工序"); this.addMsg('未找到 ' + process_code + ' 工序');
wx.showToast({ wx.showToast({ title: '未找到该工序', icon: 'error' });
title: "未找到该工序",
icon: "error",
});
this.getVoice(`未找到工序`, true); this.getVoice(`未找到工序`, true);
} }
}) })
.catch(() => { .catch(() => {
this.addMsg("未找到 " + real_code + " 工序"); this.addMsg('未找到 ' + process_code + ' 工序');
wx.showToast({ wx.showToast({ title: '未找到该工序', icon: 'error' });
title: "未找到该工序",
icon: "error",
});
}); });
}, },
processEnter() { processEnter() {
@@ -253,8 +232,12 @@ Page({
}, },
LCProcessEnter(e: any) { LCProcessEnter(e: any) {
const item = this.data.orders[e.currentTarget.dataset.index]; const item = this.data.orders[e.currentTarget.dataset.index];
this.data.rel_order_no_temp = item.rel_order_no; this.data.rel_order_no_temp = item.order_no;
this.setProcess(); this.setProcess({
info_process_id: JSON.stringify([item.info_process_id]),
action: this.data.action,
if_scan: 1,
});
}, },
setProcess(other?: any) { setProcess(other?: any) {
const code = parseQrCode(this.data.process_code); const code = parseQrCode(this.data.process_code);
@@ -262,42 +245,31 @@ Page({
if (code.key) { if (code.key) {
obj[this.data.rel_order_no_temp] = code.key; obj[this.data.rel_order_no_temp] = code.key;
} }
post("Orders/setProcess", { post(
param: JSON.stringify({ 'ProduceOrder/setProcessV2',
rel_order_no: this.data.rel_order_no_temp, other
process_code: code.code, ? other
action: this.data.action, : {
if_scan: 1, order_no: this.data.rel_order_no_temp,
same_process: this.data.rel_order_no_temp.startsWith("LC") process_code: code.code,
? 1 action: this.data.action,
: undefined, if_scan: 1,
// defaultBonus: getDefaultBonus() != "0", },
}), )
other: JSON.stringify({ ...other, ...obj }),
})
.then((res: any) => { .then((res: any) => {
if (res.bonus == 1) { if (isArray(res.data) && res.data.length) {
const data = toObject(res.data);
this.setData({
defaultBonusConfig: data,
defaultBonusConfigKeys: Object.keys(data),
showDefaultBonus: true,
});
} else if (isArray(res.data) && res.data.length) {
res.data.forEach((el: any) => { res.data.forEach((el: any) => {
el.product_info_str = toArray(el.product_info) el.product_info_str = toArray(el.product_info)
.map((ell) => { .map((ell) => {
return `${ell.room_name || "未命名"}(${ return `${ell.room_name || '未命名'}(${ell.goods_name || '未命名'})`;
ell.goods_name || "未命名"
})`;
}) })
.join(""); .join('');
el.sale_info_str = toArray(el.sale_info) el.sale_info_str = toArray(el.sale_info)
.map((ell) => { .map((ell) => {
return `${ell.goods_name}`; return `${ell.goods_name}`;
}) })
.join(""); .join('');
}); });
this.setData({ this.setData({
@@ -307,57 +279,42 @@ Page({
} else { } else {
this.addMsg(res.err_msg); this.addMsg(res.err_msg);
// this.getVoice(res.err_msg); // this.getVoice(res.err_msg);
this.getVoice("通过"); this.getVoice('通过');
this.setData({ this.setData({
show: false, show: false,
result: "success", result: 'success',
showDefaultBonus: false,
}); });
wx.showToast({ wx.showToast({
title: res.err_msg, title: res.err_msg,
icon: "none", icon: 'none',
}); });
} }
}) })
.catch((res: any) => { .catch((res: any) => {
this.addMsg(res.err_msg); this.addMsg(res.err_msg);
if (res.err_code == "244269") { if (res.err_code == '244269') {
this.setData({ this.setData({
result: "success", result: 'success',
}); });
wx.showToast({ wx.showToast({
title: res.err_msg, title: res.err_msg,
icon: "none", icon: 'none',
}); });
this.getVoice("通过"); this.getVoice('通过');
} else { } else {
this.setData({ this.setData({
result: "error", result: 'error',
}); });
this.getVoice(res.err_msg); this.getVoice(res.err_msg);
} }
}); });
}, },
onSelectBonus(e: any) {
const data = getDataSet(e);
this.setProcess({ [data.order_no]: data.key });
},
closeDefaultBonusHandle() {
this.setData({
showDefaultBonus: false,
});
},
// defaultBonusChange(e) {
// this.setData({
// defaultBonus: e.detail ? "1" : "0",
// });
// setDefaultBonus(e.detail ? "1" : "0");
// },
addMsg(msg: any) { addMsg(msg: any) {
const now = new Date(); const now = new Date();
this.data.logsList.unshift({ this.data.logsList.unshift({
date: formatTime(now).substring(5), date: formatTime(now).substring(5),
msg: msg || "", msg: msg || '',
}); });
if (this.data.logsList.length > 100) { if (this.data.logsList.length > 100) {
this.data.logsList.length = 100; this.data.logsList.length = 100;
@@ -381,20 +338,16 @@ Page({
onLoad(_options) { onLoad(_options) {
this.setData({ this.setData({
loading: true, loading: true,
voice: wx.getStorageSync("processEntryVoice") == "false" ? false : true, voice: wx.getStorageSync('processEntryVoice') == 'false' ? false : true,
}); });
loginStatus() loginStatus()
.then(() => { .then(() => {
this.setData({ this.setData({ isLogin: true, loading: false });
isLogin: true,
loading: false,
authInfo: getAuthInfo(),
});
this.init(); this.init();
}) })
.catch((err) => { .catch((err) => {
this.setData({ isLogin: false, loading: false }); this.setData({ isLogin: false, loading: false });
console.log("调用登录状态请求失败", err); console.log('调用登录状态请求失败', err);
}); });
}, },
@@ -408,11 +361,6 @@ Page({
*/ */
onShow() { onShow() {
wx.hideHomeButton(); wx.hideHomeButton();
this.setData({
// defaultBonus: getDefaultBonus() != "0",
});
// if (!this.data.isScanCode) {
// }
}, },
/** /**

View File

@@ -1,41 +1,41 @@
<page-plugin <page-plugin is-login="{{isLogin}}" is-auth="{{authInfo['SF_ERP_PRODUCT_PROCESS_ENTER']}}"
is-login="{{isLogin}}" loading="{{loading}}" bind:handleLogin="handleLogin" customStyle="padding: 0;" hasTabBar="1">
is-auth="{{authInfo['SF_ENTER_PROCESS']}}"
loading="{{loading}}"
bind:handleLogin="handleLogin"
customStyle="padding: 0;"
>
<view class="container"> <view class="container">
<view style="display: flex;padding: 12px 12px 4px 12px;"> <view style="display: flex;padding: 24rpx 24rpx 8rpx 24rpx;">
<view style="display: flex;flex-shrink: 0;flex-direction: column;margin-right: 12px;align-items: flex-end;"> <view
<view style="margin-bottom: 4px;font-weight: bold;">工序:</view> style="display: flex;flex-shrink: 0;flex-direction: column;margin-right: 24rpx;align-items: flex-end;">
<view style="margin-bottom: 8rpx;font-weight: bold;">工序:</view>
<view> <view>
<t-checkbox style="padding: 0;" value="{{ backFlag }}" bind:change="backChange">撤回</t-checkbox> <t-checkbox style="padding: 0;" checked="{{ backFlag }}" bind:change="backChange">撤回
</t-checkbox>
</view> </view>
</view> </view>
<view style="display: flex;flex-wrap: wrap;min-height: 44px;max-height: 88px;overflow: auto;flex: 1;"> <view
<view wx:if="{{processItems.length == 0}}" style="display: flex;justify-content: center;height: 100%;width: 100%;align-items: center;color: #999;">暂无工序 style="display: flex;flex-wrap: wrap;min-height: 44px;max-height: 88px;overflow: auto;flex: 1;">
<view wx:if="{{processItems.length == 0}}"
style="display: flex;justify-content: center;height: 100%;width: 100%;align-items: center;color: #999;">
暂无工序
</view> </view>
<block wx:for="{{processItems}}" wx:key="process_id"> <block wx:for="{{processItems}}" wx:key="process_id">
<view class="process-item {{item.code == selectedProcessCode || (item.code + '-') == selectedProcessCode ? 'active': ''}}" bind:tap="processItemTap" data-code="{{item.code}}">{{item.name}}</view> <view
class="process-item {{item.process_code == selectedProcessCode || (item.process_code + '-') == selectedProcessCode ? 'active': ''}}"
bind:tap="processItemTap" data-code="{{item.process_code}}">{{item.process_name}}</view>
</block> </block>
</view> </view>
</view> </view>
<t-input <t-input label="订单编号" value="{{rel_order_no}}" readonly placeholder="扫码流程编码, 订单编号" />
label="订单编号"
value="{{rel_order_no}}"
readonly
placeholder="扫码流程编码, 订单编号"
/>
<t-input label="流程编码" readonly value="{{process_code}}" /> <t-input label="流程编码" readonly value="{{process_code}}" />
<view wx:if="{{processCodeMsg}}" style="padding: 8px 12px 0 12px;color: {{action == 'end'? '#52c41a': '#ff4d4f'}};"> <view wx:if="{{processCodeMsg}}"
style="padding: 16rpx 24rpx 0 24rpx;color: {{action == 'end'? '#52c41a': '#ff4d4f'}};">
{{processCodeMsg}} {{processCodeMsg}}
</view> </view>
<view style="padding: 12px;padding-top: 0;"> <view style="padding: 24rpx;padding-top: 0;">
<view style="display: flex;justify-content: center;margin-top: 12px;align-items: center;column-gap: 16px;"> <view style="display: flex;justify-content: center;margin-top: 24rpx;align-items: center;">
<t-button theme="primary" bind:tap="scanCode" icon="qr">扫码</t-button> <t-button theme="primary" custom-style="margin-right: 32rpx" bind:tap="scanCode" icon="qr">
<t-button theme="primary" disabled="{{!(rel_order_no && process_code)}}" bind:tap="processEnter">流程录入</t-button> 扫码</t-button>
<t-button theme="primary" disabled="{{!(rel_order_no && process_code)}}"
bind:tap="processEnter">录入流程</t-button>
<!-- <view style="width: 16px;"></view> --> <!-- <view style="width: 16px;"></view> -->
<!-- <van-checkbox value="{{voice}}" bind:change="voiceChange">语音播报</van-checkbox> --> <!-- <van-checkbox value="{{voice}}" bind:change="voiceChange">语音播报</van-checkbox> -->
</view> </view>
@@ -45,24 +45,17 @@
<!-- <text>扫码记录</text> --> <!-- <text>扫码记录</text> -->
<text bind:tap="addMsg2">扫码结果</text> <text bind:tap="addMsg2">扫码结果</text>
<view> <view>
<t-button <t-button size="extra-small" theme="{{logType == '0' ? 'primary' :'default'}}"
size="extra-small" bind:tap="onLogTypeChange" data-key="0">图标
theme="{{logType == '0' ? 'primary' :'default'}}"
bind:tap="onLogTypeChange"
data-key="0"
>图标
</t-button> </t-button>
<t-button <t-button size="extra-small" theme="{{logType == '1' ? 'primary' :'default'}}"
size="extra-small" bind:tap="onLogTypeChange" data-key="1">记录
theme="{{logType == '1' ? 'primary' :'default'}}"
bind:tap="onLogTypeChange"
data-key="1"
>记录
</t-button> </t-button>
</view> </view>
<!-- <t-button size="extra-small" theme="primary" bind:tap="clearMsg">清空</t-button> --> <!-- <t-button size="extra-small" theme="primary" bind:tap="clearMsg">清空</t-button> -->
</view> </view>
<view wx:if="{{logType == 0}}" class="log-box" style="display: flex;justify-content: center;align-items: center;font-size: 65vw;"> <view wx:if="{{logType == 0}}" class="log-box"
style="display: flex;justify-content: center;align-items: center;font-size: 65vw;">
<!-- <view wx:for="{{logsList}}" wx:for-item="item" wx:key="date" style="font-size: 14px;word-break: break-all;margin-bottom: 8px;width: 100%;align-items: flex-start;"> <!-- <view wx:for="{{logsList}}" wx:for-item="item" wx:key="date" style="font-size: 14px;word-break: break-all;margin-bottom: 8px;width: 100%;align-items: flex-start;">
{{item.date}} {{item.date}}
{{item.msg}} {{item.msg}}
@@ -72,37 +65,45 @@
</view> </view>
<view wx:else class="log-box"> <view wx:else class="log-box">
<view <view wx:for="{{logsList}}" wx:for-item="item" wx:key="date"
wx:for="{{logsList}}" style="word-break: break-all;margin-bottom: 16rpx;width: 100%;align-items: flex-start;">
wx:for-item="item" <text style="color: #666;margin-right: 8rpx;">{{item.date}}</text>
wx:key="date"
style="word-break: break-all;margin-bottom: 8px;width: 100%;align-items: flex-start;"
>
<text style="color: #666;margin-right: 4px;">{{item.date}}</text>
{{item.msg}} {{item.msg}}
</view> </view>
</view> </view>
<popup-plugin visible="{{ show }}" bind:close="onClose" title="订单流程完成"> <popup-plugin visible="{{ show }}" bind:close="onClose" title="订单流程完成">
<!-- <view wx:for="{{orders}}" wx:key="rel_order_no" <view style="padding: 24rpx;">
style="border: 1rpx solid #ddd;border-radius: 4px;display: flex;flex-direction: column;margin-bottom: 12px;"> <view wx:for="{{orders}}" wx:key="rel_order_no"
<view style="padding: 8px;"> style="border: 1rpx solid #ddd;border-radius: 8rpx;display: flex;flex-direction: column;margin-bottom: 24rpx;">
<list-item label="流程单号" value="{{item.rel_order_no}}" /> <view style="padding: 16rpx;">
<list-item label="流程名称" value="{{item.p_process_name}}" /> <card-item-plugin label="销售单号" value="{{item.order_no}}" />
<list-item label="自定义名称" wx:if="{{item.process_custom_no}}" value="{{item.process_custom_no}}" /> <card-item-plugin label="自定义单号" value="{{item.custom_order_no}}" />
<list-item label="工序名称" value="{{item.c_process_name}}" /> <card-item-plugin label="流程名称" value="{{item.p_process_name}}" />
<list-item label="材料名称" wx:if="{{item.sale_info_str}}" value="{{item.sale_info_str}}" /> <card-item-plugin label="自定义名称" wx:if="{{item.process_custom_no}}"
<list-item wx:if="{{item.product_info_str}}" label="房柜名称" value="{{item.product_info_str}}" /> value="{{item.process_custom_no}}" />
<list-item label="状态" value="{{item.state== 2 ? '已完成' :''}}" /> <card-item-plugin label="工序名称" value="{{item.c_process_name}}" />
<card-item-plugin label="材料名称" wx:if="{{item.sale_info_str}}"
value="{{item.sale_info_str}}" />
<card-item-plugin wx:if="{{item.product_info_str}}" label="房柜名称"
value="{{item.product_info_str}}" />
<card-item-plugin label="产品名称" value="{{item.goods_name}}" />
</view>
<view
style="display: flex;border-top: 1rpx solid #ddd;padding: 16rpx;justify-content: center;">
<block wx:if="{{action == 'end'}}">
<t-button size='small' theme="primary" data-index="{{index}}"
bind:tap="LCProcessEnter">
完成</t-button>
</block>
<block wx:else>
<t-button size='small' theme="danger" data-index="{{index}}"
bind:tap="LCProcessEnter">
撤回
</t-button>
</block>
</view>
</view>
</view> </view>
<view style="display: flex;border-top: 1rpx solid #ddd;padding: 8px;justify-content: center;">
<block wx:if="{{action == 'end'}}">
<t-button size='small' type="primary" data-index="{{index}}" bind:tap="LCProcessEnter">完成</t-button>
</block>
<block wx:else>
<t-button size='small' type="danger" data-index="{{index}}" bind:tap="LCProcessEnter">撤回</t-button>
</block>
</view>
</view> -->
</popup-plugin> </popup-plugin>
<!-- <popup-plugin show="{{ showDefaultBonus }}" bind:close="closeDefaultBonusHandle" title="选择提成配置"> <!-- <popup-plugin show="{{ showDefaultBonus }}" bind:close="closeDefaultBonusHandle" title="选择提成配置">
@@ -129,5 +130,4 @@
</view> </view>
</page-plugin> </page-plugin>
<tab-bar-plugin active="scan" /> <tab-bar-plugin active="scan" />

View File

@@ -1,25 +1,25 @@
.log-header { .log-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 8px 12px; padding: 16rpx 24rpx;
border: 1rpx solid #ddd; border: 1rpx solid #ddd;
align-items: center; align-items: center;
margin-left: 12px; margin-left: 24rpx;
margin-right: 12px; margin-right: 24rpx;
} }
.log-box { .log-box {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
overflow: auto; overflow: auto;
padding: 12px 12px 12px 12px; padding: 24rpx;
border: 1rpx solid #ddd; border: 1rpx solid #ddd;
margin-left: 12px; margin-left: 24rpx;
margin-right: 12px; margin-right: 24rpx;
/* margin-bottom: calc(constant(safe-area-inset-bottom) + 12px); */ /* margin-bottom: calc(constant(safe-area-inset-bottom) + 12px); */
/*兼容 IOS<11.2*/ /*兼容 IOS<11.2*/
/* margin-bottom: calc(env(safe-area-inset-bottom) + 12px); */ /* margin-bottom: calc(env(safe-area-inset-bottom) + 12px); */
margin-bottom: 12px; margin-bottom: 24rpx;
border-top: none; border-top: none;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -28,18 +28,18 @@
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom)); height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom) - 32rpx);
} }
.process-item { .process-item {
height: 34px; height: 64rpx;
padding: 0 8px; padding: 0 16rpx;
border: 1rpx solid #ddd; border: 1rpx solid #ddd;
border-radius: 4px; border-radius: 8rpx;
display: flex; display: flex;
align-items: center; align-items: center;
margin-right: 8px; margin-right: 16rpx;
margin-bottom: 8px; margin-bottom: 16rpx;
} }
.process-item.active { .process-item.active {

View File

@@ -1,5 +1,5 @@
{ {
"usingComponents": {}, "usingComponents": { },
"navigationBarTitleText": "流程管理" "navigationBarTitleText": "流程管理"
} }

View File

@@ -1,177 +1,54 @@
import { getDataSet } from "@/utils/util"; import { loginStatus, post } from '@/utils/https';
import { getAuthInfo, getDataSet, toArray } from '@/utils/util';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
process: [ process: [] as any[],
{
p_process_name: "办公流程",
parent_process_id: 34,
child: [
{
process_name: "录单亲亲我",
process_id: 86,
parent_process_id: 34,
p_process_name: "办公流程",
num: 1,
tot_num: 1,
},
],
},
{
p_process_name: "车间流程",
parent_process_id: 36,
child: [
{
process_name: "接单",
process_id: 85,
parent_process_id: 36,
p_process_name: "车间流程",
num: 12,
tot_num: 12,
},
{
process_name: "测量",
process_id: 91,
parent_process_id: 36,
p_process_name: "车间流程",
num: 11,
tot_num: 12,
},
{
process_name: "报价",
process_id: 92,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "复尺",
process_id: 93,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "备料",
process_id: 94,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "拆单",
process_id: 95,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "跟单",
process_id: 96,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "排单",
process_id: 97,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "开料",
process_id: 98,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "封边",
process_id: 99,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "打孔",
process_id: 100,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "特殊加工",
process_id: 101,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "分拣",
process_id: 102,
parent_process_id: 36,
p_process_name: "车间流程",
num: 5,
tot_num: 6,
},
{
process_name: "包装",
process_id: 103,
parent_process_id: 36,
p_process_name: "车间流程",
num: 6,
tot_num: 7,
},
{
process_name: "入库",
process_id: 104,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
{
process_name: "出库",
process_id: 105,
parent_process_id: 36,
p_process_name: "车间流程",
num: 7,
tot_num: 8,
},
],
},
],
}, },
navDetail(e: any) { navDetail(e: any) {
const index = getDataSet(e).index.split(","); const index = getDataSet(e).index.split(',');
const pProcess = this.data.process[index[0]]; const pProcess = this.data.process[index[0]];
const cProcess = pProcess.child[index[1]]; const cProcess = pProcess.child[index[1]];
const { p_process_name, process_name, process_id } = cProcess; const { p_process_name, process_name, process_id } = cProcess;
const title = encodeURIComponent(`${p_process_name} - ${process_name}`); const title = encodeURIComponent(`${p_process_name} - ${process_name}`);
console.log(title);
wx.navigateTo({ wx.navigateTo({
url: `/pages/produce/processManageDetail/processManageDetail?process_id=${process_id}&title=${title}`, url: `/pages/produce/processManageDetail/processManageDetail?process_id=${process_id}&title=${title}`,
}); });
}, },
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
},
getList() {
post('CompanyProcessV2/getAllProcessNum').then((res: any) => {
this.setData({ process: toArray(res.data) });
});
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad() {}, onLoad() {
this.setData({ loading: true });
loginStatus()
.then(() => {
this.setData({ isLogin: true, loading: false });
this.init();
})
.catch((err) => {
this.setData({ isLogin: false, loading: false });
console.log('调用登录状态请求失败', err);
});
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
@@ -208,4 +85,3 @@ Page({
*/ */
onShareAppMessage() {}, onShareAppMessage() {},
}); });

View File

@@ -1,18 +1,16 @@
<block wx:for="{{ process }}" wx:key="parent_process_id"> <page-plugin hasTabBar="1" isAuth="{{authInfo['SF_ERP_PRODUCT_PROCESS_VIEW']}}"
<view class="process-box"> loading="{{loading}}" is-login="{{isLogin}}" bind:handleLogin="handleLogin">
<view class="p_process_name">{{ item.p_process_name }}</view> <block wx:for="{{ process }}" wx:key="parent_process_id">
<view class="process-child-box"> <view class="process-box">
<block <view class="p_process_name">{{ item.p_process_name }}</view>
wx:for="{{ item.child }}" <view class="process-child-box">
wx:key="process_id" <block wx:for="{{ item.child }}" wx:key="process_id" wx:for-item="child" wx:for-index="ci">
wx:for-item="child" <view class="process-child-item-box" bind:tap="navDetail" data-index="{{ index+','+ci }}">
wx:for-index="ci" {{ child.process_name }}
> <view class="process-child-item-num">{{ child.num }}</view>
<view class="process-child-item-box" bind:tap="navDetail" data-index="{{ index+','+ci }}">{{ child.process_name }} </view>
<view class="process-child-item-num">{{ child.num }}</view> </block>
</view> </view>
</block>
</view> </view>
</view> </block>
</block> </page-plugin>

View File

@@ -18,7 +18,6 @@
border: 1rpx solid #ddd; border: 1rpx solid #ddd;
padding: 16rpx; padding: 16rpx;
border-radius: 8rpx; border-radius: 8rpx;
} }
.process-child-item-num { .process-child-item-num {

View File

@@ -2,7 +2,11 @@
"usingComponents": { "usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup", "search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin", "card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin" "card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"t-dialog": "tdesign-miniprogram/dialog/dialog",
"t-input": "tdesign-miniprogram/input/input",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input"
}, },
"navigationBarTitleText": "流程管理详情" "navigationBarTitleText": "流程管理详情"
} }

View File

@@ -1,50 +1,117 @@
import { getDataSet } from "@/utils/util"; import { loginStatus, post } from '@/utils/https';
import { getAuthInfo, getDataSet, toArray, toastSuccess, toNumber } from '@/utils/util';
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
params: { curr_page: 1, page_count: 20, state: "1", process_id: "" }, params: { curr_page: 1, page_count: 20, state: '1', process_id: '' } as any,
list: [ list: [] as any[],
{ count: 0,
order_no: "XSDD2025112500000043", dialog: {
custom_name: "客户5", visible: false,
custom_address: "", content: '',
custom_phone: null, item: {} as any,
custom_order_no: "", action: '' as 'end' | 'back',
goods_name: "浴室柜", },
info_process_id: 163, },
produce_info_id: 62, handleLogin(e: any) {
process_code: "ld", this.setData({ isLogin: e.detail });
state: 1, if (e.detail) {
end_user_address: null, this.init();
end_user_name: null, }
end_user_phone: null, },
}, init() {
], this.setData({ authInfo: getAuthInfo() });
count: 1, this.getList();
},
searchChange(e: any) {
this.data.params.order_no = e.detail.value;
},
searchChange2(e: any) {
const key = getDataSet(e).key;
const val = `${e.detail.value || ''}`.trim();
console.log(e);
if (val) {
this.data.params[key] = val;
} else {
delete this.data.params[key];
}
},
searchOk() {
this.getList(1);
}, },
tabChange(e: any) { tabChange(e: any) {
const state = getDataSet(e).key; const state = getDataSet(e).key;
this.data.params.state = state; this.data.params.state = state;
this.page(); this.getList();
}, },
page(curr: number = 1) { paginationChange(e: any) {
this.getList(e.detail.curr_page);
},
getList(curr: number = 1) {
this.data.params.curr_page = curr; this.data.params.curr_page = curr;
this.setData({ params: this.data.params }); this.setData({ params: this.data.params });
post('CompanyProcessV2/processOrd', this.data.params).then((res: any) => {
const list = toArray(res.data);
if (list.length == 0 && this.data.params.curr_page > 1) {
this.getList(this.data.params.curr_page - 1);
}
this.setData({
count: toNumber(res.count),
list: list,
});
});
},
confirmDialog() {
post('ProduceOrder/setProcessV2', {
info_process_id: JSON.stringify([this.data.dialog.item.info_process_id]),
action: this.data.dialog.action,
}).then(() => {
this.closeDialog();
toastSuccess(this.data.dialog.action == 'end' ? '订单工序完成成功' : '订单工序撤回成功');
setTimeout(() => {
this.getList(this.data.params.curr_page);
}, 1500);
});
},
closeDialog() {
this.data.dialog.visible = false;
this.setData({ dialog: this.data.dialog });
},
onEndOrBack(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
this.setData({
dialog: {
visible: true,
content: `确认${data.action == 'end' ? '完成' : '撤回'} ${item.order_no} ?`,
action: data.action,
item,
},
});
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
// console.log(options); // console.log(options);
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: decodeURIComponent(options.title || ""), title: decodeURIComponent(options.title || ''),
}); });
this.data.params.process_id = `${options.process_id || ""}`; this.data.params.process_id = `${options.process_id || ''}`;
this.page(); this.setData({ loading: true });
loginStatus()
.then(() => {
this.setData({ isLogin: true, loading: false });
this.init();
})
.catch((err) => {
this.setData({ isLogin: false, loading: false });
console.log('调用登录状态请求失败', err);
});
}, },
/** /**
@@ -82,4 +149,3 @@ Page({
*/ */
onShareAppMessage() {}, onShareAppMessage() {},
}); });

View File

@@ -1,17 +1,49 @@
<search-popup placeholder="输入销售单号" /> <page-plugin isAuth="{{authInfo['SF_ERP_PRODUCT_PROCESS_VIEW']}}" loading="{{loading}}"
<view class="tabs"> is-login="{{isLogin}}" bind:handleLogin="handleLogin">
<view class="tabs-item {{ params.state == '1' ? 'active': '' }}" bind:tap="tabChange" data-key="1">待处理</view> <search-popup placeholder="输入销售单号" bind:change="searchChange" bind:ok="searchOk">
<view class="tabs-item {{ params.state == '2' ? 'active': '' }}" bind:tap="tabChange" data-key="2">已处理</view>
</view>
<block wx:for="{{ list }}" wx:key="info_process_id">
<card-plugin>
<view slot="header">{{ item.order_no }}</view>
<view slot="content"> <view slot="content">
<card-item-plugin label="订单编号" value="1哒哒哒哒哒哒多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多多" /> <search-input label="自定义单号" data-key="custom_order_no" bind:change="searchChange2" />
<card-item-plugin label="订单编号" value="111111" /> <search-input label="经销商名称" data-key="custom_name" bind:change="searchChange2" />
<card-item-plugin label="订单编号" value="111111" /> <search-input label="经销商手机" data-key="custom_phone" bind:change="searchChange2" />
<card-item-plugin label="订单编号" value="111111" /> <search-input label="经销商地址" data-key="custom_address" bind:change="searchChange2" />
<search-input label="客户名称" data-key="end_user_name" bind:change="searchChange2" />
<search-input label="客户手机" data-key="end_user_phone" bind:change="searchChange2" />
<search-input label="客户地址" data-key="end_user_address" bind:change="searchChange2" />
</view> </view>
</card-plugin>
</block>
</search-popup>
<view class="tabs">
<view class="tabs-item {{ params.state == '1' ? 'active': '' }}" bind:tap="tabChange"
data-key="1">待处理</view>
<view class="tabs-item {{ params.state == '2' ? 'active': '' }}" bind:tap="tabChange"
data-key="2">已处理</view>
</view>
<t-empty wx:if="{{list.length == 0}}" icon="info-circle-filled" description="暂无数据"
style="margin-bottom: 24rpx;" />
<block wx:for="{{ list }}" wx:key="info_process_id">
<card-plugin>
<view slot="header">{{ item.order_no }}</view>
<view slot="content">
<card-item-plugin label="自定义单号" value="{{item.custom_order_no}}" />
<card-item-plugin label="产品名称" value="{{item.goods_name}}" />
<card-item-plugin label="经销商名称" value="{{item.custom_name}}" />
<card-item-plugin label="经销商手机" value="{{item.custom_phone}}" />
<card-item-plugin label="经销商地址" value="{{item.custom_address}}" />
<card-item-plugin label="客户名称" value="{{item.end_user_name}}" />
<card-item-plugin label="客户手机" value="{{item.end_user_phone}}" />
<card-item-plugin label="客户地址" value="{{item.end_user_address}}" />
</view>
<view slot="footer" style="padding-bottom: 16rpx;">
<t-button size="small" theme="{{params.state == '1' ? 'primary' : 'danger'}}"
data-action="{{params.state == '1' ? 'end' : 'back'}}" bind:tap="onEndOrBack"
data-index="{{index}}">{{params.state == '1' ? '完成' : '撤回'}}
</t-button>
</view>
</card-plugin>
</block>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>
<t-dialog visible="{{dialog.visible}}" title="系统提示" content="{{dialog.content}}"
confirm-btn="{{{ content: '确定', theme: 'primary', variant: 'base'} }}" cancel-btn="取消"
bind:confirm="confirmDialog" bind:cancel="closeDialog" />

View File

@@ -2,39 +2,39 @@
* Global Config Files * Global Config Files
* Added By YangXB 2021.11.24 * Added By YangXB 2021.11.24
*/ */
export const servicePhone = "4000-5858-22"; export const servicePhone = '4000-5858-22';
export const colors = { export const colors = {
primary: "#0052d9", primary: '#0052d9',
success: "#2ba471", success: '#2ba471',
warning: "#e37318", warning: '#e37318',
danger: "#d54941", danger: '#d54941',
info: "#029cd4", info: '#029cd4',
gray: "#999999", gray: '#999999',
} as const; } as const;
export const defaultAvatarUrl = export const defaultAvatarUrl =
"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0"; 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0';
export const base = { export const base = {
appletName: "易宝赞普惠版", appletName: '易宝赞普惠版',
apiHost: apiHost:
wx.getAccountInfoSync().miniProgram.envVersion == "release" wx.getAccountInfoSync().miniProgram.envVersion == 'release'
? "https://ebaozan.com/api/" ? 'https://ebaozan.com/api/'
: "http://192.168.1.138:83/", : 'http://192.168.1.138:93/',
webViewBaseUrl: webViewBaseUrl:
wx.getAccountInfoSync().miniProgram.envVersion == "release" wx.getAccountInfoSync().miniProgram.envVersion == 'release'
? "https://ebaozan.com/" ? 'https://ebaozan.com/'
: "http://ebaozan.cf/", : 'http://ebaozan.cf/',
cookieKey: "OwCookie", cookieKey: 'OwCookie',
}; };
// 头文件 // 头文件
export const http = { export const http = {
header: { header: {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8", 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
"X-Requested-With": "XMLHttpRequest", 'X-Requested-With': 'XMLHttpRequest',
}, },
unLoginCode: 110000, unLoginCode: 110000,
}; };

View File

@@ -2,39 +2,29 @@
* 全局http工具集 * 全局http工具集
* YangXB 2021.11.24 * YangXB 2021.11.24
* */ * */
import { base, http } from "./config"; import { base, http } from './config';
import { import { getStorage, goIndexPage, isArray, setStorage, toastError } from './util';
getStorage,
goIndexPage,
isArray,
setStorage,
toastError,
} from "./util";
/** /**
* 请求 * 请求
*/ */
const request = ( const request = (url: string, options: any, config = { showLoading: true, showError: true }) => {
url: string,
options: any,
config = { showLoading: true, showError: true }
) => {
// 获取缓存cookie // 获取缓存cookie
const header: any = { ...http.header }; const header: any = { ...http.header };
const cookie = getStorage(base.cookieKey); const cookie = getStorage(base.cookieKey);
if (cookie && !header["Cookie"]) { if (cookie && !header['Cookie']) {
header["Cookie"] = cookie; header['Cookie'] = cookie;
} }
if (options["content-type"]) { if (options['content-type']) {
header["content-type"] = options["content-type"]; header['content-type'] = options['content-type'];
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (config.showLoading != false) { if (config.showLoading != false) {
wx.showLoading({ title: "加载中" }); wx.showLoading({ title: '加载中' });
} }
url = `${url}`.startsWith("http") ? url : urlAddBaseUrl(url); url = `${url}`.startsWith('http') ? url : urlAddBaseUrl(url);
wx.request({ wx.request({
url: url, url: url,
method: options.method, method: options.method,
@@ -46,32 +36,32 @@ const request = (
} }
// 写入缓存 // 写入缓存
if (!cookie) { if (!cookie) {
setStorage(base.cookieKey, request.header["Set-Cookie"]); setStorage(base.cookieKey, request.header['Set-Cookie']);
} }
if (request.data?.err_code === 0) { if (request.data?.err_code === 0) {
// //
resolve(request.data);
return;
} else { } else {
if (config.showError != false) { if (config.showError != false) {
wx.showToast({ wx.showToast({
title: request.data.err_msg, title: request.data.err_msg,
icon: "none", icon: 'none',
}); });
} }
if (request.data.err_code == 110000) { if (request.data.err_code == 110000) {
const pages = getCurrentPages(); const pages = getCurrentPages();
if ( if (
![ !['pages/index/index', 'pages/processEntry/processEntry', 'pages/my/my'].includes(
"pages/index/index", pages[pages.length - 1].route,
"pages/processEntry/processEntry", )
"pages/my/my",
].includes(pages[pages.length - 1].route)
) { ) {
goIndexPage(); goIndexPage();
} }
} }
} }
resolve(request.data); reject();
}, },
fail(error: any) { fail(error: any) {
if (config.showLoading != false) { if (config.showLoading != false) {
@@ -85,28 +75,28 @@ const request = (
// 封装get方法 // 封装get方法
export const get = (url: string, data = {}, config?: any): any => { export const get = (url: string, data = {}, config?: any): any => {
return request(url, { method: "GET", data }, config); return request(url, { method: 'GET', data }, config);
}; };
// 封装post方法 // 封装post方法
export const post = (url: string, data = {}, config?: any): any => { export const post = (url: string, data = {}, config?: any): any => {
return request(url, { method: "POST", data }, config); return request(url, { method: 'POST', data }, config);
}; };
export const wxLogin = (config?: any) => { export const wxLogin = (config?: any) => {
wx.login({ wx.login({
success: (res) => { success: (res) => {
post("Applet/code2Sess", { code: res.code, name: "ch" }, config) post('Applet/code2Sess', { code: res.code, name: 'ch' }, config)
.then((res: any) => { .then((res: any) => {
// 记录sessionKey // 记录sessionKey
setStorage("session", { setStorage('session', {
openid: res.openid, openid: res.openid,
unionid: res.unionid, unionid: res.unionid,
time: Date.now() + 1000 * 3600 * 24, // 缓存一天过期 time: Date.now() + 1000 * 3600 * 24, // 缓存一天过期
}); });
}) })
.catch((err: any) => { .catch((err: any) => {
toastError("服务失败:" + err.err_code); toastError('服务失败:' + err.err_code);
}); });
}, },
}); });
@@ -132,7 +122,7 @@ export const checkSession = () => {
// } // }
}, },
fail: () => { fail: () => {
console.log("checkSession失效"); console.log('checkSession失效');
// 已过期重新登录获取session_key // 已过期重新登录获取session_key
wxLogin(); wxLogin();
}, },
@@ -141,23 +131,23 @@ export const checkSession = () => {
export const loginStatus = () => { export const loginStatus = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
post("Applet/loginStatus", {}, { showLoading: false }) post('Applet/loginStatus', {}, { showLoading: false })
.then((res: any) => { .then((res: any) => {
setStorage("user_info", res.user_info); setStorage('user_info', res.user_info);
setStorage("company_info", res.company_info); setStorage('company_info', res.company_info);
setStorage("auth_info", res.auth_info); setStorage('auth_info', res.auth_info);
setStorage("session_id", res.session_id); setStorage('session_id', res.session_id);
resolve(res); resolve(res);
}) })
.catch((err: any) => { .catch((err: any) => {
login("", "", 4) login('', '', 4)
.then((res: any) => { .then((res: any) => {
if (isArray(res.data)) { if (isArray(res.data)) {
post("Applet/loginOut").then(() => { post('Applet/loginOut').then(() => {
checkSesskey({ showLoading: false, showError: false }) checkSesskey({ showLoading: false, showError: false })
.then(() => {}) .then(() => {})
.catch((err) => { .catch((err) => {
console.log("checkSesskey", err); console.log('checkSesskey', err);
}); });
}); });
reject(res); reject(res);
@@ -178,7 +168,7 @@ export const loginStatus = () => {
*/ */
export const checkSesskey = (config?: any) => { export const checkSesskey = (config?: any) => {
return new Promise<any>((resolve, reject) => { return new Promise<any>((resolve, reject) => {
post("Applet/checkSesskey", {}, config) post('Applet/checkSesskey', {}, config)
.then((res: any) => { .then((res: any) => {
resolve(res); resolve(res);
}) })
@@ -190,12 +180,7 @@ export const checkSesskey = (config?: any) => {
}; };
// 后端登录 // 后端登录
export const login = ( export const login = (encryptedData: any, iv: any, type?: any, company_id?: any) => {
encryptedData: any,
iv: any,
type: any,
company_id?: any
) => {
return new Promise<any>((resolve, reject) => { return new Promise<any>((resolve, reject) => {
const data: any = { type: 2, encryptedData, iv }; const data: any = { type: 2, encryptedData, iv };
@@ -203,14 +188,14 @@ export const login = (
data.companyID = company_id; data.companyID = company_id;
} }
post("Applet/login", type == 4 ? { type } : data) post('Applet/login', type == 4 ? { type } : data)
.then((res: any) => { .then((res: any) => {
if (isArray(res.data)) { if (isArray(res.data)) {
resolve(res); resolve(res);
} else { } else {
setStorage("user_info", res.user_info); setStorage('user_info', res.user_info);
setStorage("company_info", res.companys_info); setStorage('company_info', res.companys_info);
setStorage("auth_info", res.auth_info); setStorage('auth_info', res.auth_info);
loginStatus(); loginStatus();
resolve(res); resolve(res);
} }
@@ -242,19 +227,17 @@ export const login = (
export const makeURL = (url: string, redirect = false, openID = false) => { export const makeURL = (url: string, redirect = false, openID = false) => {
return ( return (
base.apiHost + base.apiHost +
(redirect ? "applet-wv?url=" : "") + (redirect ? 'applet-wv?url=' : '') +
encodeURIComponent( encodeURIComponent(url + (openID ? '?openID=' + wx.getStorageSync('session')['openid'] : '')) +
url + (openID ? "?openID=" + wx.getStorageSync("session")["openid"] : "") (redirect ? '&' : '?') +
) + 'cookie=' +
(redirect ? "&" : "?") +
"cookie=" +
encodeURI(wx.getStorageSync(base.cookieKey)) encodeURI(wx.getStorageSync(base.cookieKey))
); );
}; };
export const urlAddBaseUrl = (url: string) => { export const urlAddBaseUrl = (url: string) => {
if (typeof url == "string") { if (typeof url == 'string') {
if (url.startsWith("/")) { if (url.startsWith('/')) {
url = url.substring(1); url = url.substring(1);
} }
} }
@@ -262,8 +245,8 @@ export const urlAddBaseUrl = (url: string) => {
}; };
export const urlAddWebViewBaseUrl = (url: string) => { export const urlAddWebViewBaseUrl = (url: string) => {
if (typeof url == "string") { if (typeof url == 'string') {
if (url.startsWith("/")) { if (url.startsWith('/')) {
url = url.substring(1); url = url.substring(1);
} }
} }
@@ -276,10 +259,10 @@ export const formDataRequest = (url: string, formData: any, config?: any) => {
return request( return request(
url, url,
{ {
method: "POST", method: 'POST',
data: data.buffer, data: data.buffer,
"content-type": data.contentType, 'content-type': data.contentType,
}, },
config config,
); );
}; };

View File

@@ -1,21 +1,26 @@
/** 首页菜单 */ /** 首页菜单 */
const iconColor = "#0052D9"; const iconColor = '#0052D9';
export const menuConfig = [ export const menuConfig = [
{ {
title: "订单管理", title: '订单管理',
icon: "form", icon: 'form',
iconColor: iconColor, iconColor: iconColor,
children: [ children: [
{ {
title: "销售订单", title: '销售订单',
url: "/pages/orders/ordersList/ordersList", url: '/pages/orders/ordersList/ordersList',
auth: "SF_ERP_SALE_ORDERS_VIEW", auth: 'SF_ERP_SALE_ORDERS_VIEW',
},
{
title: '订单排序',
url: '/pages/orders/orderSort/orderSort',
auth: 'SF_ERP_SALE_ORDERS_VIEW',
}, },
], ],
}, },
{ {
title: "生产管理", title: '生产管理',
icon: "form", icon: 'tools',
iconColor: iconColor, iconColor: iconColor,
children: [ children: [
// { // {
@@ -24,14 +29,14 @@ export const menuConfig = [
// auth: "SF_ERP_PRODUCT_TASK_VIEW", // auth: "SF_ERP_PRODUCT_TASK_VIEW",
// }, // },
{ {
title: "流程管理", title: '流程管理',
url: "/pages/produce/processManage/processManage", url: '/pages/produce/processManage/processManage',
auth: "SF_ERP_PRODUCT_PROCESS_VIEW", auth: 'SF_ERP_PRODUCT_PROCESS_VIEW',
}, },
{ {
title: "流程录入", title: '录入流程',
url: "/pages/processEntry/processEntry", url: '/pages/processEntry/processEntry',
auth: "SF_ERP_PRODUCT_PROCESS_ENTER", auth: 'SF_ERP_PRODUCT_PROCESS_ENTER',
}, },
], ],
}, },

View File

@@ -1,4 +1,4 @@
import { http } from "./config"; import { http } from './config';
export const formatTime = (date: Date) => { export const formatTime = (date: Date) => {
const year = date.getFullYear(); const year = date.getFullYear();
@@ -8,13 +8,9 @@ export const formatTime = (date: Date) => {
const minute = date.getMinutes(); const minute = date.getMinutes();
const second = date.getSeconds(); const second = date.getSeconds();
return `${[year, month, day].map(formatNumber).join("-")} ${[ return `${[year, month, day].map(formatNumber).join('-')} ${[hour, minute, second]
hour,
minute,
second,
]
.map(formatNumber) .map(formatNumber)
.join(":")}`; .join(':')}`;
}; };
export const formatNumber = (n: number | string) => { export const formatNumber = (n: number | string) => {
@@ -23,11 +19,7 @@ export const formatNumber = (n: number | string) => {
}; };
// 对话框 // 对话框
export const showModal = ( export const showModal = (title: string, content: string, showCancel = false) => {
title: string,
content: string,
showCancel = false
) => {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
wx.showModal({ wx.showModal({
title, title,
@@ -56,7 +48,7 @@ export const toArray = (data: any): any[] => (isArray(data) ? data : []);
/** 判断数据是不是对象类型 */ /** 判断数据是不是对象类型 */
export const isObject = (data: any) => { export const isObject = (data: any) => {
return data && `${Object.prototype.toString.call(data)}`.includes("Object"); return data && `${Object.prototype.toString.call(data)}`.includes('Object');
}; };
export const toObject = (data: any) => (isObject(data) ? data : {}); export const toObject = (data: any) => (isObject(data) ? data : {});
@@ -66,15 +58,15 @@ export const reloadPage = () => {
let currentPage = pages[pages.length - 1]; //获取当前页面的对象 let currentPage = pages[pages.length - 1]; //获取当前页面的对象
let url = currentPage.route; //当前页面url let url = currentPage.route; //当前页面url
// 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。 // 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
wx.redirectTo({ url: "/" + url }); wx.redirectTo({ url: '/' + url });
}; };
/** 判断是json数据 */ /** 判断是json数据 */
export const isJson = (str: any) => { export const isJson = (str: any) => {
if (str && typeof str == "string") { if (str && typeof str == 'string') {
try { try {
const obj = JSON.parse(str); const obj = JSON.parse(str);
return obj && typeof obj == "object"; return obj && typeof obj == 'object';
} catch (_e) { } catch (_e) {
// //
} }
@@ -89,24 +81,16 @@ export const isJson = (str: any) => {
*/ */
export const jsonParse = (data: any): any[] | object | null => { export const jsonParse = (data: any): any[] | object | null => {
if (data) { if (data) {
if (typeof data == "string") { if (typeof data == 'string') {
try { try {
const obj = JSON.parse(data); const obj = JSON.parse(data);
if ( if (['Array', 'Object'].includes(Object.prototype.toString.call(obj).slice(8, -1))) {
["Array", "Object"].includes(
Object.prototype.toString.call(obj).slice(8, -1)
)
) {
return obj; return obj;
} }
} catch (e) { } catch (e) {
// //
} }
} else if ( } else if (['Array', 'Object'].includes(Object.prototype.toString.call(data).slice(8, -1))) {
["Array", "Object"].includes(
Object.prototype.toString.call(data).slice(8, -1)
)
) {
return data; return data;
} }
} }
@@ -142,10 +126,10 @@ export const formatToDecimals = (str: any, num: number = 2) => {
}; };
/** 获取权限 */ /** 获取权限 */
export const getAuthInfo = () => toObject(wx.getStorageSync("auth_info")); export const getAuthInfo = () => toObject(wx.getStorageSync('auth_info'));
export const goIndexPage = () => { export const goIndexPage = () => {
wx.navigateTo({ url: "/pages/index/index" }); wx.navigateTo({ url: '/pages/index/index' });
}; };
export const isImageFile = (path: string) => { export const isImageFile = (path: string) => {
@@ -161,12 +145,12 @@ export const scrollToTop = () => {
export const tabsConfigSet = (key: string, value: any) => { export const tabsConfigSet = (key: string, value: any) => {
const tabsConfig = toObject(tabsConfigGet()); const tabsConfig = toObject(tabsConfigGet());
tabsConfig[key] = value; tabsConfig[key] = value;
setStorage("tabsConfig", tabsConfig); setStorage('tabsConfig', tabsConfig);
}; };
/** 获取tabs配置 */ /** 获取tabs配置 */
export const tabsConfigGet = () => { export const tabsConfigGet = () => {
return getStorage("tabsConfig"); return getStorage('tabsConfig');
}; };
/** /**
@@ -175,28 +159,24 @@ export const tabsConfigGet = () => {
* @param {*} currentUrl 当前数据地址 * @param {*} currentUrl 当前数据地址
*/ */
export const mediaPreview = (imageUrls: any[], currentUrl: string) => { export const mediaPreview = (imageUrls: any[], currentUrl: string) => {
console.log("媒体图片预览方法"); console.log('媒体图片预览方法');
const lastLen = const lastLen =
`${currentUrl}`.indexOf("?") > -1 `${currentUrl}`.indexOf('?') > -1 ? `${currentUrl}`.indexOf('?') : `${currentUrl}`.length;
? `${currentUrl}`.indexOf("?")
: `${currentUrl}`.length;
const suffix: any = currentUrl const suffix: any = currentUrl
.substring(currentUrl.lastIndexOf(".") + 1, lastLen) .substring(currentUrl.lastIndexOf('.') + 1, lastLen)
.toLocaleLowerCase(); .toLocaleLowerCase();
if (isImageFile("." + suffix)) { if (isImageFile('.' + suffix)) {
wx.previewImage({ urls: imageUrls, current: currentUrl, showmenu: true }); wx.previewImage({ urls: imageUrls, current: currentUrl, showmenu: true });
} else if (["mp3", "mp4", "m4a"].includes(suffix)) { } else if (['mp3', 'mp4', 'm4a'].includes(suffix)) {
wx.previewMedia({ wx.previewMedia({
sources: [{ url: currentUrl, type: "video" }], sources: [{ url: currentUrl, type: 'video' }],
fail() { fail() {
wx.showToast({ title: "播放失败" }); wx.showToast({ title: '播放失败' });
}, },
}); });
} else if ( } else if (['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf'].includes(suffix)) {
["doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf"].includes(suffix)
) {
const downloadTask = wx.downloadFile({ const downloadTask = wx.downloadFile({
url: currentUrl, url: currentUrl,
header: http.header, header: http.header,
@@ -223,7 +203,7 @@ export const mediaPreview = (imageUrls: any[], currentUrl: string) => {
} }
}); });
} else { } else {
wx.showToast({ title: "请前往网页端下载查看" }); wx.showToast({ title: '请前往网页端下载查看' });
} }
}; };
@@ -232,29 +212,29 @@ export const mediaPreview = (imageUrls: any[], currentUrl: string) => {
* @param {*} option {filePath: '文件路径', name: 'files', url:'上传url',formData: {额外data},success: (data)=>{}, complete:()=>{},fail: ()=>{} } * @param {*} option {filePath: '文件路径', name: 'files', url:'上传url',formData: {额外data},success: (data)=>{}, complete:()=>{},fail: ()=>{} }
*/ */
export const uploadFile2 = (option: any) => { export const uploadFile2 = (option: any) => {
console.log("文件上传封装"); console.log('文件上传封装');
option = toObject(option); option = toObject(option);
option.name = option.name || "files"; option.name = option.name || 'files';
wx.showLoading({ title: "文件上传中..." }); wx.showLoading({ title: '文件上传中...' });
wx.uploadFile({ wx.uploadFile({
filePath: option.filePath, filePath: option.filePath,
name: option.name, name: option.name,
header: { header: {
...http.header, ...http.header,
cookie: "DFSESSID=" + wx.getStorageSync("session_id"), cookie: 'FREESESSID=' + wx.getStorageSync('session_id'),
}, },
formData: option.formData, formData: option.formData,
url: option.url, url: option.url,
success(res) { success(res) {
const resData = jsonParse(res.data); const resData = jsonParse(res.data);
wx.showToast({ title: "上传成功" }); wx.showToast({ title: '上传成功' });
if (option.success) { if (option.success) {
option.success(resData); option.success(resData);
} }
}, },
fail() { fail() {
wx.showToast({ title: "上传失败" }); wx.showToast({ title: '上传失败' });
if (option.fail) { if (option.fail) {
option.fail(); option.fail();
} }
@@ -277,15 +257,15 @@ export const getDataSet = (e: any) => {
}; };
export const toastSuccess = (title: string) => { export const toastSuccess = (title: string) => {
wx.showToast({ title: `${title}`, icon: "success" }); wx.showToast({ title: `${title}`, icon: 'success' });
}; };
export const toastError = (title: string) => { export const toastError = (title: string) => {
wx.showToast({ title: `${title}`, icon: "error" }); wx.showToast({ title: `${title}`, icon: 'error' });
}; };
export const toastSuccessNotIcon = (title: string) => { export const toastSuccessNotIcon = (title: string) => {
wx.showToast({ title: `${title}`, icon: "none" }); wx.showToast({ title: `${title}`, icon: 'none' });
}; };
export const getEnvVersion = wx.getAccountInfoSync().miniProgram.envVersion; export const getEnvVersion = wx.getAccountInfoSync().miniProgram.envVersion;
@@ -295,7 +275,8 @@ export const getEnvVersion = wx.getAccountInfoSync().miniProgram.envVersion;
* @param key string * @param key string
*/ */
export const getStorage = (key: string) => { export const getStorage = (key: string) => {
return wx.getStorageSync(`${getEnvVersion}_${key}`); // return wx.getStorageSync(`${getEnvVersion}_${key}`);
return wx.getStorageSync(key);
}; };
/** /**
@@ -304,7 +285,8 @@ export const getStorage = (key: string) => {
* @param data any * @param data any
*/ */
export const setStorage = (key: string, data: any) => { export const setStorage = (key: string, data: any) => {
return wx.setStorageSync(`${getEnvVersion}_${key}`, data); // return wx.setStorageSync(`${getEnvVersion}_${key}`, data);
return wx.setStorageSync(key, data);
}; };
/** /**
@@ -312,7 +294,8 @@ export const setStorage = (key: string, data: any) => {
* @param key string * @param key string
*/ */
export const removeStorage = (key: string) => { export const removeStorage = (key: string) => {
return wx.removeStorageSync(`${getEnvVersion}_${key}`); // return wx.removeStorageSync(`${getEnvVersion}_${key}`);
return wx.removeStorageSync(key);
}; };
/** /**
@@ -323,4 +306,3 @@ export const getCurrentPageRoute = () => {
const currentPage = pages[pages.length - 1]; // 获取当前页面对象 const currentPage = pages[pages.length - 1]; // 获取当前页面对象
return `/${currentPage.route}`; // 获取当前页面路径 return `/${currentPage.route}`; // 获取当前页面路径
}; };

View File

@@ -51,5 +51,5 @@
"ignore": [], "ignore": [],
"include": [] "include": []
}, },
"appid": "wxd5501d77a54dd128" "appid": "wx9485c70a4e26c10f"
} }