添加组件
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"t-picker": "tdesign-miniprogram/picker/picker",
|
||||||
|
"t-picker-item": "tdesign-miniprogram/picker-item/picker-item",
|
||||||
|
"t-cell": "tdesign-miniprogram/cell/cell"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import { post } from '@/utils/https';
|
||||||
|
import { getAuthInfo, toArray } from '@/utils/util';
|
||||||
|
|
||||||
|
Component({
|
||||||
|
options: { multipleSlots: true },
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
value: {
|
||||||
|
type: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
observers: {
|
||||||
|
value: function () {
|
||||||
|
this.setData({ label: this.data.listToObj[this.data.value]?.label });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
visible: false,
|
||||||
|
list: [] as any[],
|
||||||
|
listToObj: {} as any,
|
||||||
|
label: '',
|
||||||
|
},
|
||||||
|
lifetimes: {
|
||||||
|
attached() {
|
||||||
|
const auth = getAuthInfo();
|
||||||
|
const SF_ERP_ACCOUNT_VIEW = auth.SF_ERP_ACCOUNT_VIEW;
|
||||||
|
post('ErpAccount/list', { state: 1 }).then((res: any) => {
|
||||||
|
let accountDefaultObj: any = {};
|
||||||
|
const list = toArray(res?.data?.list).map((el) => {
|
||||||
|
if (el.if_default == 2) {
|
||||||
|
accountDefaultObj = el;
|
||||||
|
}
|
||||||
|
const label = `${el.account_name}${
|
||||||
|
SF_ERP_ACCOUNT_VIEW ? `(余额: ${el.current_amount})` : ''
|
||||||
|
}`;
|
||||||
|
el.label = label;
|
||||||
|
this.data.listToObj[el.account_id] = el;
|
||||||
|
return {
|
||||||
|
label: label,
|
||||||
|
value: el.account_id,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (!accountDefaultObj) {
|
||||||
|
accountDefaultObj = list[0] || {};
|
||||||
|
}
|
||||||
|
this.setData({ list: list, label: this.data.listToObj[this.data.value]?.label });
|
||||||
|
this.triggerEvent('default', accountDefaultObj);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
onShowPicker() {
|
||||||
|
this.setData({ visible: true });
|
||||||
|
},
|
||||||
|
onPickerCancel() {
|
||||||
|
this.setData({ visible: false });
|
||||||
|
},
|
||||||
|
onPickerConfirm(e: any) {
|
||||||
|
// console.log(e);
|
||||||
|
const item = this.data.listToObj[e.detail.value[0]];
|
||||||
|
this.triggerEvent('ok', item);
|
||||||
|
this.setData({ visible: false });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<t-cell arrow note="{{label}}" hover bind:click="onShowPicker">
|
||||||
|
<view slot="title" class="custom-label">选择账户</view>
|
||||||
|
</t-cell>
|
||||||
|
<t-picker visible="{{visible}}" value="{{value}}" title="选择账户" cancelBtn="取消" confirmBtn="确认"
|
||||||
|
bindconfirm="onPickerConfirm" bindcancel="onPickerCancel">
|
||||||
|
<t-picker-item options="{{list}}">
|
||||||
|
<block wx:for="{{list}}" wx:key="index" wx:for-item="option">
|
||||||
|
<view wx:if="{{option.tag}}" slot="label-suffix--{{index}}" class="label-suffix">
|
||||||
|
<t-tag size="small" theme="primary">{{option.tag}}</t-tag>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</t-picker-item>
|
||||||
|
</t-picker>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
.custom-label {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-label::after {
|
||||||
|
content: '*';
|
||||||
|
color: red;
|
||||||
|
font-size: 32rpx;
|
||||||
|
margin-left: 4rpx;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker",
|
||||||
|
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||||
|
"t-icon": "tdesign-miniprogram/icon/icon"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
Component({
|
||||||
|
options: { multipleSlots: true },
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
title: null,
|
||||||
|
mode: null,
|
||||||
|
placeholder: null,
|
||||||
|
value: null,
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
visible: false,
|
||||||
|
format: {
|
||||||
|
date: 'YYYY-MM-DD',
|
||||||
|
second: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
},
|
||||||
|
now: Date.now(),
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
showPicker() {
|
||||||
|
this.setData({ visible: true });
|
||||||
|
},
|
||||||
|
hidePicker() {
|
||||||
|
this.setData({ visible: false });
|
||||||
|
},
|
||||||
|
onConfirm(e: any) {
|
||||||
|
this.triggerEvent('confirm', { value: e.detail.value });
|
||||||
|
this.hidePicker();
|
||||||
|
},
|
||||||
|
onClear() {
|
||||||
|
this.triggerEvent('confirm', { value: '' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<t-cell title="{{title || ''}}" hover arrow bindtap="showPicker">
|
||||||
|
<view slot="note" style="display: flex;align-items: center;column-gap: 12rpx;">
|
||||||
|
<view>{{value || ''}}</view>
|
||||||
|
<t-icon wx:if="{{value}}" name="close-circle-filled" catch:tap="onClear"></t-icon>
|
||||||
|
</view>
|
||||||
|
</t-cell>
|
||||||
|
<!-- 年月日时分 -->
|
||||||
|
<t-date-time-picker title="{{placeholder || '选择日期'}}" visible="{{visible}}"
|
||||||
|
mode="{{mode || 'date'}}" format="{{format[mode|| 'date'] || 'YYYY-MM-DD HH:mm:ss'}}"
|
||||||
|
value="{{value || now}}" bindconfirm="onConfirm" auto-close="{{true}}" bindcancel="hidePicker" />
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
一键登录
|
一键登录
|
||||||
</t-button>
|
</t-button>
|
||||||
|
|
||||||
<t-checkbox borderless style="padding: 0;margin: 1em 0;" value="{{isAgree}}"
|
<t-checkbox borderless style="padding: 0;margin: 1em 0; background: transparent;"
|
||||||
bind:change="changeAgreementCheck">
|
value="{{isAgree}}" bind:change="changeAgreementCheck">
|
||||||
我已阅读并同意
|
我已阅读并同意
|
||||||
</t-checkbox>
|
</t-checkbox>
|
||||||
<t-link theme="primary" bindtap="navAgreement" data-type="user" style="margin-bottom: 16rpx;">
|
<t-link theme="primary" bindtap="navAgreement" data-type="user" style="margin-bottom: 16rpx;">
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||||
|
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||||
|
"popup-plugin": "/pages/components/popup-plugin/popup-plugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
39
miniprogram/pages/components/sort-plugin/sort-plugin.ts
Normal file
39
miniprogram/pages/components/sort-plugin/sort-plugin.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import { getDataSet } from '@/utils/util';
|
||||||
|
|
||||||
|
Component({
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
options: Array,
|
||||||
|
value: null,
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
this.setData({ visible: true });
|
||||||
|
},
|
||||||
|
onClose() {
|
||||||
|
this.setData({ visible: false });
|
||||||
|
},
|
||||||
|
select(e: any) {
|
||||||
|
const dataset = getDataSet(e);
|
||||||
|
const index = dataset.index;
|
||||||
|
const item = this.data.options[index];
|
||||||
|
const order = dataset.order;
|
||||||
|
|
||||||
|
this.triggerEvent('ok', { value: item.value + ' ' + order });
|
||||||
|
this.onClose();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
18
miniprogram/pages/components/sort-plugin/sort-plugin.wxml
Normal file
18
miniprogram/pages/components/sort-plugin/sort-plugin.wxml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<t-button bind:tap="open" size="small" variant="outline" theme="primary">
|
||||||
|
排序
|
||||||
|
<t-icon slot="suffix" name="{{ visible ? 'chevron-up' : 'chevron-down'}}" size="34rpx" />
|
||||||
|
</t-button>
|
||||||
|
|
||||||
|
<popup-plugin visible="{{ visible }}" title="排序" bind:close="onClose">
|
||||||
|
<t-cell title="{{item.label}}" wx:for="{{options}}" wx:key="value">
|
||||||
|
<view slot="note" style="display: flex;align-items: center;">
|
||||||
|
<t-button size="small" theme="primary"
|
||||||
|
variant="{{value != (item.value || '') + ' asc' ? 'outline': 'base'}}"
|
||||||
|
style="margin-right: 24rpx;" bind:tap="select" data-index="{{index}}" data-order="asc">升序
|
||||||
|
</t-button>
|
||||||
|
<t-button size="small" theme="primary" variant="outline"
|
||||||
|
variant="{{value != (item.value || '') + ' desc' ? 'outline': 'base'}}" bind:tap="select"
|
||||||
|
data-index="{{index}}" data-order="desc">降序</t-button>
|
||||||
|
</view>
|
||||||
|
</t-cell>
|
||||||
|
</popup-plugin>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
.sort-plugin {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 64rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: 1rpx solid #ddd;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 0 16rpx;
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||||
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin",
|
"tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin",
|
||||||
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
|
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
|
||||||
"select-plugin": "/pages/components/select-plugin/select-plugin",
|
|
||||||
"search-popup": "/pages/components/search-popup/search-popup"
|
"search-popup": "/pages/components/search-popup/search-popup"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,23 +3,30 @@
|
|||||||
<t-cell-group title="企业信息">
|
<t-cell-group title="企业信息">
|
||||||
<t-cell title="{{company_info.company_name}}" use-label-slot>
|
<t-cell title="{{company_info.company_name}}" use-label-slot>
|
||||||
<view slot="image" style="margin-right: 12rpx;">
|
<view slot="image" style="margin-right: 12rpx;">
|
||||||
<t-image width="200rpx" height="200rpx" fit="cover"
|
<t-image width="200rpx" height="200rpx" mode="aspectFill"
|
||||||
src="{{host}}{{company_info.company_logo}}" />
|
src="{{host}}{{company_info.company_logo}}" error="slot">
|
||||||
|
<view slot="error" style="font-size: 120rpx;color: #999;line-height: 1.1;">
|
||||||
|
<block wx:if="{{company_info.company_name}}">
|
||||||
|
{{company_info.company_name[0]}}
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</t-image>
|
||||||
</view>
|
</view>
|
||||||
<view slot="description">{{company_info.company_desc}}</view>
|
<view slot="description">{{company_info.company_desc}}</view>
|
||||||
</t-cell>
|
</t-cell>
|
||||||
</t-cell-group>
|
</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-group title="账号信息">
|
||||||
<t-cell>
|
<t-cell>
|
||||||
<view slot="image" style="margin-right: 12rpx;">
|
<view slot="image" style="margin-right: 12rpx;">
|
||||||
<t-image width="200rpx" height="200rpx" fit="cover" src="{{host}}{{user_info.logo}}" />
|
<t-image width="200rpx" height="200rpx" mode="aspectFill" error="slot"
|
||||||
|
src="{{host}}{{user_info.logo}}">
|
||||||
|
<view slot="error" style="font-size: 120rpx;color: #999;line-height: 1.1;">
|
||||||
|
<block wx:if="{{user_info.login_name}}">
|
||||||
|
{{user_info.login_name[0]}}
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</t-image>
|
||||||
</view>
|
</view>
|
||||||
<view slot="title" style="display: flex;align-items: center;flex-wrap: wrap;">
|
<view slot="title" style="display: flex;align-items: center;flex-wrap: wrap;">
|
||||||
<view style="margin-right: 16rpx;">{{user_info.login_name}}</view>
|
<view style="margin-right: 16rpx;">{{user_info.login_name}}</view>
|
||||||
@@ -32,6 +39,5 @@
|
|||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
<t-cell title="退出登录" bind:tap="loginOut" hover bordered arrow />
|
<t-cell title="退出登录" bind:tap="loginOut" hover bordered arrow />
|
||||||
<t-cell title="版本" note="{{version}}" hover bind:tap="txDoc" 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" />
|
||||||
Reference in New Issue
Block a user