添加组件及页面

This commit is contained in:
zhengw
2026-02-04 17:07:30 +08:00
parent e10c7bc537
commit 62039e3684
20 changed files with 756 additions and 55 deletions

View File

@@ -79,6 +79,7 @@
"description": "卡片组件",
"attributes": {
"customStyle": { "type": "String" },
"showAll": { "type": "Boolean" },
"className": { "type": "String" },
"headerStyle": { "type": "String" },
"contentStyle": { "type": "String" }
@@ -160,7 +161,8 @@
"select-plugin": {
"description": "选择组件",
"attributes": {
"mode": { "type": "String", "values": [ "single", "multiple" ] },
"title": { "type": "String" },
"value": { "type": "any" },
"options": { "type": "array" },
"bind:change": { "type": "Event" }
}

View File

@@ -28,6 +28,9 @@
"pages/logs/operateLog/operateLog",
"pages/manage/staff/staff",
"pages/other/transfer/transfer",
"pages/other/goods/goods",
"pages/other/goodsDetail/goodsDetail",
"pages/other/batch/batch",
"pages/base/viewAttachment/viewAttachment",
"pages/other/outbound/outbound"
],

View File

@@ -0,0 +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 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="M341.445937 457.049896l-114.51925-42.325112c-16.152491-6.017155-34.128777 2.203589-40.144955 18.361938-6.012273 16.152491 2.206518 34.128777 18.360962 40.145932l114.523155 42.942156c16.153468 6.018131 34.127801-2.202612 40.14105-18.360962 6.016178-16.152491-2.203589-34.128777-18.360962-40.143979v-0.619973z m0 0" fill="#165dff"></path><path d="M1004.921432 200.622261h-3.737412a29.802635 29.802635 0 0 0-4.978334-5.602212h-4.35836L522.564924 13.903991a31.088469 31.088469 0 0 0-21.783993 0L34.607181 190.042692h-4.357384a29.789943 29.789943 0 0 0-7.466036 10.579569h-3.733506a30.508526 30.508526 0 0 0-4.98224 18.671437v580.692999a31.129475 31.129475 0 0 0 19.915288 29.254912l466.799581 180.496085a31.135333 31.135333 0 0 0 22.40299 0l466.798604-178.631285a31.113854 31.113854 0 0 0 19.915287-29.251006V219.292721a30.497786 30.497786 0 0 0-4.978333-18.67046zM511.986331 76.144391l377.792949 143.14833-377.792949 140.660628-377.792948-140.660628L511.986331 76.144391zM76.306463 262.860708l404.560157 151.864076v518.454553L76.306463 778.205633V262.860708zM947.660342 777.581755l-404.554299 155.598558V414.72576l404.554299-151.864075v514.72007z m0 0" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +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 viewBox="0 0 1052 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="65.75" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M791.299539 1023.864218h-14.189219l-250.110456-119.963403-1.493602-0.543128-0.950474 0.543128-250.042564 119.963403h-16.22595L8.244709 903.900815a11.134125 11.134125 0 0 1-8.214811-12.152489V570.55599a1.968839 1.968839 0 0 0 2.104621-2.03673h4.005569l250.042565-119.963402a13.102964 13.102964 0 0 1 8.282702-1.35782 22.268249 22.268249 0 0 1 0-2.444077v-321.124444a2.03673 2.03673 0 0 0 2.03673-2.104621h4.005569L516.001522 1.561493a12.559836 12.559836 0 0 1 11.948816 0L641.735659 58.522045a10.930452 10.930452 0 0 1 9.979978 6.11019l121.728568 58.997282h4.00557a1.968839 1.968839 0 0 1 1.968839 2.03673v2.03673c0 2.03673 2.03673 2.03673 2.03673 4.07346 0 0 0 2.03673 5.974408 2.03673V444.821852a9.979977 9.979977 0 0 1-0.746801 3.462442l0.746801 0.339455 115.822051 56.960551a11.134125 11.134125 0 0 1 10.11576 6.042299l124.036863 58.997282h4.005569a1.968839 1.968839 0 0 1 2.104621 2.03673v2.104621c0 2.03673 2.03673 2.03673 2.03673 4.00557 0 0 0 2.03673 6.11019 2.03673v311.076576a16.769078 16.769078 0 0 1-8.14692 12.152489l-250.042565 119.963403z m4.07346-313.045415V991.344428l223.565074-107.810913V603.00789z m-518.823045 0V991.344428l223.632964-107.810913V603.00789z m285.142213-130.147053l89.480342 42.703441 130.079162 63.002851 219.559504-105.706292-130.079162-63.002851-89.480342-42.63555z m-518.823046 0l89.480342 42.703441 130.079162 63.002851 219.559504-105.706292-130.079162-63.002851-89.480342-42.63555z m492.956574-316.847312v280.525625l219.559504-107.743022V156.081416z m-229.471591-130.079162l87.783067 42.703441 127.770868 63.002851 215.486044-105.706292-127.702977-63.002851L521.908039 28.038984z m739.129351 444.889744z m-264.163893-446.926474z" fill="#165dff"></path></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -1,11 +1,10 @@
{
"component": true,
"usingComponents": {
"popup-plugin": "/pages/components/popup-plugin/popup-plugin",
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
"t-radio": "tdesign-miniprogram/radio/radio",
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
"t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group"
"t-picker": "tdesign-miniprogram/picker/picker",
"t-picker-item": "tdesign-miniprogram/picker-item/picker-item",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-icon": "tdesign-miniprogram/icon/icon"
}
}

View File

@@ -1,21 +1,19 @@
import { toArray } from '@/utils/util';
Component({
options: { multipleSlots: true },
/**
* 组件的属性列表
*/
properties: {
mode: { type: String, value: "single" },
title: { type: String, value: "请选择" },
options: { type: Array, value: [] },
value: { type: null, value: [] },
title: null,
options: null,
value: null,
},
observers: {
"value,mode": function (v, m) {
if (m == "multiple") {
this.setData({ val: Array.isArray(v) ? [...v] : [] });
} else {
this.setData({ val: v });
}
value: function (value) {
const data = toArray(this.data.options).find((el) => el.value == value);
this.setData({ note: data?.label || '' });
},
},
@@ -23,31 +21,27 @@ Component({
* 组件的初始数据
*/
data: {
visible: false,
val: [] as any[] | string | number,
show: false,
note: '',
},
/**
* 组件的方法列表
*/
methods: {
click() {
this.setData({ visible: true });
onOpenPicker() {
this.setData({ show: true });
},
close() {
this.setData({ visible: false });
onPickerCancel() {
this.setData({ show: false });
},
radioChange(e: any) {
this.triggerEvent("change", { value: e.detail.value });
this.setData({ val: e.detail.value, visible: false });
onConfirm(e: any) {
this.triggerEvent('change', { value: e.detail.value?.[0] });
this.onPickerCancel();
},
checkboxChange(e: any) {
this.setData({ val: e.detail.value });
},
ok() {
this.setData({ visible: false });
this.triggerEvent("change", { value: this.data.val });
onClear() {
this.triggerEvent('change', { value: '' });
this.onPickerCancel();
},
},
});

View File

@@ -1,24 +1,15 @@
<view style="display: contents" bindtap="click">
<slot />
</view>
<popup-plugin visible="{{visible}}" bind:close="close" title="{{title}}">
<view style="padding: 24rpx 0;">
<t-radio-group wx:if="{{mode == 'single'}}" bind:change="radioChange" allow-uncheck
value="{{val}}" borderless>
<t-radio wx:for="{{options}}" wx:key="index" value="{{item.value}}"
style="padding-bottom: 12rpx;padding-top: 12rpx;">{{item.label}}
</t-radio>
</t-radio-group>
<t-checkbox-group wx:else value="{{val}}" bind:change="checkboxChange" borderless>
<t-checkbox style="padding-bottom: 12rpx;padding-top: 12rpx;" wx:for="{{options}}"
icon="rectangle" wx:key="index" value="{{item.value}}">{{item.label}}
</t-checkbox>
</t-checkbox-group>
<t-cell title="{{title || ''}}" arrow hover bind:click="onOpenPicker">
<view slot="note" style="display: flex;align-items: center;column-gap: 12rpx;">
<view>{{note || ''}}</view>
<t-icon wx:if="{{value}}" name="close-circle-filled" catch:tap="onClear"></t-icon>
<text wx:else>{{placeholder || title}}</text>
</view>
<view class="footer" wx:if="{{ mode == 'multiple' }}">
<t-button size="small" theme="primary" bindtap="ok">确定</t-button>
</view>
</popup-plugin>
</t-cell>
<t-picker visible="{{show}}" value="{{[value]}}" data-key="value" title="{{title || ''}}"
cancelBtn="取消" confirmBtn="确认" bind:confirm="onConfirm" bindcancel="onPickerCancel">
<t-picker-item options="{{options || []}}">
<block wx:for="{{options || []}}" wx:key="value">
{{item.label}}
</block>
</t-picker-item>
</t-picker>

View File

@@ -0,0 +1,16 @@
{
"usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
"date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
"sort-plugin": "/pages/components/sort-plugin/sort-plugin",
"select-plugin": "/pages/components/select-plugin/select-plugin",
"count-plugin": "/pages/components/count-plugin/count-plugin",
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input"
},
"navigationBarTitleText": "批次信息"
}

View File

@@ -0,0 +1,171 @@
import { loginStatus, post } from '@/utils/https';
import { cloneLite, getAuthInfo, getDataSet, toArray, toNumber } from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20 };
Page({
/**
* 页面的初始数据
*/
data: {
params: cloneLite(defaultParams) as any,
list: [] as any[],
count: 0,
sort: [{ label: '创建日期', value: 'create_date' }],
depots: [] as any[],
crms: [] as any[],
depotsObj: {} as any,
crmObj: {} as any,
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
this.getData();
},
searchChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchChange2(e: any) {
const key = getDataSet(e).key;
const val = `${e.detail.value || ''}`.trim();
if (val) {
this.data.params[key] = val;
} else {
delete this.data.params[key];
}
this.setData({ params: this.data.params });
},
onOptionChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
datePickerConfirm(e: any) {
const data = getDataSet(e);
this.data.params[data.key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchOk() {
this.getList(1);
},
searchReset() {
this.data.params = cloneLite(defaultParams);
this.getList(1);
},
onSort(e: any) {
this.data.params.order = e.detail.value;
this.setData({ params: this.data.params });
this.getList(1);
},
paginationChange(e: any) {
this.getList(e.detail.curr_page);
},
getData() {
post('ErpDepot/ajaxDepotList').then((res: any) => {
const depots = toArray(res.data).map((el) => {
this.data.depotsObj[el.depot_id] = el.depot_name;
return { label: el.depot_name, value: el.depot_id };
});
this.setData({
depots,
depotsObj: this.data.depotsObj,
});
});
post('ErpCrm/ajaxList', { crm_type: 2 }).then((res: any) => {
const crms = toArray(res.data?.list).map((el) => {
this.data.crmObj[el.crm_id] = el.crm_name;
return { label: el.crm_name, value: el.crm_id };
});
this.setData({
crms,
crmObj: this.data.crmObj,
});
});
},
getList(curr: number = 1) {
this.data.params.curr_page = curr;
this.setData({ params: this.data.params });
const temp = cloneLite(this.data.params);
post('GoodsBatch/goodsBatchList', temp).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,
});
});
},
onDetail(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
wx.navigateTo({
url: `/pages/other/goodsDetail/goodsDetail?goods_id=${
item.goods_id
}&title=${encodeURIComponent(item.goods_name)}`,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(_options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
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);
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,53 @@
<page-plugin isAuth="{{authInfo['SF_ERP_GOODS_BATCH_VIEW']}}" loading="{{loading}}"
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
<search-popup placeholder="输入批号" bind:change="searchChange" bind:ok="searchOk"
bind:reset="searchReset" value="{{params.batch_no}}" data-key="batch_no">
<view slot="content">
<search-input label="自定义批号" value="{{params.batch_custom_no}}" data-key="batch_custom_no"
bind:change="searchChange2" />
<!-- <option-cell-plugin title="订单阶段" value="{{params.order_step}}" bind:change="onOptionChange"
mode="checkbox" options="{{orderStep}}" data-key="order_step" /> -->
<select-plugin title="仓库" options="{{depots}}" value="{{params.depot_id}}"
bind:change="onOptionChange" data-key="depot_id" />
<select-plugin title="供应商" options="{{crms}}" value="{{params.supplier_id}}"
bind:change="onOptionChange" data-key="supplier_id" />
<date-picker-plugin title="保质期开始日期" value="{{params.expire_dateL}}" data-key="expire_dateL"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="保质期结束日期" value="{{params.expire_dateU}}" data-key="expire_dateU"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
bind:confirm="datePickerConfirm" />
</view>
</search-popup>
<count-plugin count="{{count}}">
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
</count-plugin>
<empty-plugin wx:if="{{list.length == 0}}" />
<card-plugin wx:for="{{ list }}" wx:key="batch_id">
<view slot="header">{{ item.batch_no }}</view>
<view slot="content">
<card-item-plugin label="自定义批号" value="{{item.batch_custom_no}}" />
<card-item-plugin label="保质期" value="{{item.expire_date}}" />
<card-item-plugin label="商品名称" value="{{item.goods_name}}" />
<card-item-plugin label="商品编码" value="{{item.goods_code}}" />
<card-item-plugin label="批次单位" value="{{item.unit_ch_name}}" />
<card-item-plugin label="批次单价" value="{{item.batch_price}}" />
<card-item-plugin label="库存" value="{{item.batch_nums}}" />
<card-item-plugin label="仓库" value="{{depotsObj[item.depot_id]}}" />
<card-item-plugin label="供应商" value="{{crmObj[item.supplier_id]}}" />
<card-item-plugin label="备注" value="{{item.comments}}" />
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
</view>
<view slot="footer" class="card-plugin-footer">
<t-button size="small" theme="primary" bind:tap="onDetail" data-index="{{index}}">子商品
</t-button>
</view>
</card-plugin>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>

View File

View File

@@ -0,0 +1,16 @@
{
"usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
"date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
"sort-plugin": "/pages/components/sort-plugin/sort-plugin",
"count-plugin": "/pages/components/count-plugin/count-plugin",
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input",
"select-plugin": "/pages/components/select-plugin/select-plugin"
},
"navigationBarTitleText": "商品信息"
}

View File

@@ -0,0 +1,166 @@
import { loginStatus, post } from '@/utils/https';
import { cloneLite, getAuthInfo, getDataSet, toArray, toNumber } from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20 };
Page({
/**
* 页面的初始数据
*/
data: {
params: cloneLite(defaultParams) as any,
list: [] as any[],
count: 0,
sort: [{ label: '创建日期', value: 'create_date' }],
depots: [] as any[],
goodsClass: [] as any[],
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getList();
this.getData();
},
searchChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchChange2(e: any) {
const key = getDataSet(e).key;
const val = `${e.detail.value || ''}`.trim();
if (val) {
this.data.params[key] = val;
} else {
delete this.data.params[key];
}
this.setData({ params: this.data.params });
},
onOptionChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
datePickerConfirm(e: any) {
const data = getDataSet(e);
this.data.params[data.key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchOk() {
this.getList(1);
},
searchReset() {
this.data.params = cloneLite(defaultParams);
this.getList(1);
},
onSort(e: any) {
this.data.params.order = e.detail.value;
this.setData({ params: this.data.params });
this.getList(1);
},
paginationChange(e: any) {
this.getList(e.detail.curr_page);
},
getData() {
post('ErpDepot/list').then((res: any) => {
const depots = toArray(res.data?.list).map((el) => {
return { label: el.depot_name, value: el.depot_id };
});
this.setData({ depots });
});
post('GoodsCategory/list').then((res: any) => {
const goodsClass = toArray(res.data?.list).map((el) => {
return { label: el.cate_name, value: el.cate_id };
});
this.setData({ goodsClass });
});
},
getList(curr: number = 1) {
this.data.params.curr_page = curr;
this.setData({ params: this.data.params });
const temp = cloneLite(this.data.params);
if (!temp.depot_id) {
delete temp.depot_id;
}
if (!temp.goods_class) {
delete temp.goods_class;
}
post('ErpGoods/list', temp).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,
});
});
},
onDetail(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
wx.navigateTo({
url: `/pages/other/goodsDetail/goodsDetail?goods_id=${
item.goods_id
}&title=${encodeURIComponent(item.goods_name)}`,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(_options) {
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);
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,50 @@
<page-plugin isAuth="{{authInfo['SF_ERP_GOODS_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<search-popup placeholder="输入商品名称" bind:change="searchChange" bind:ok="searchOk"
bind:reset="searchReset" value="{{params.goods_name}}" data-key="goods_name">
<view slot="content">
<search-input label="商品编码" value="{{params.goods_code}}" data-key="goods_code"
bind:change="searchChange2" />
<search-input label="助记码" value="{{params.sku_alias}}" data-key="sku_alias"
bind:change="searchChange2" />
<!-- <option-cell-plugin title="订单阶段" value="{{params.order_step}}" bind:change="onOptionChange"
mode="checkbox" options="{{orderStep}}" data-key="order_step" /> -->
<select-plugin title="仓库" options="{{depots}}" value="{{params.depot_id}}"
bind:change="onOptionChange" data-key="depot_id" />
<select-plugin title="商品分类" options="{{goodsClass}}" value="{{params.goods_class}}"
bind:change="onOptionChange" data-key="goods_class" />
<date-picker-plugin title="创建开始日期" value="{{params.create_dateL}}" data-key="create_dateL"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="创建结束日期" value="{{params.create_dateU}}" data-key="create_dateU"
bind:confirm="datePickerConfirm" />
</view>
</search-popup>
<count-plugin count="{{count}}">
<!-- <sort-plugin options="{{sort}}" bind:ok="onSort" value="{{params.order}}" slot="right" /> -->
</count-plugin>
<empty-plugin wx:if="{{list.length == 0}}" />
<card-plugin wx:for="{{ list }}" wx:key="goods_id">
<view slot="header">{{ item.goods_name }}</view>
<view slot="content">
<card-item-plugin label="商品别名" value="{{item.goods_alias}}" />
<card-item-plugin label="商品类别" value="{{item.cate_name}}" />
<card-item-plugin label="商品编码" value="{{item.goods_code}}" />
<card-item-plugin label="采购价格" value="{{item.purchase_price}}" />
<card-item-plugin label="零售价格" value="{{item.commodity_price}}" />
<card-item-plugin label="销售价格" value="{{item.wholesale_price}}" />
<card-item-plugin label="单位" value="{{item.unit_ch_name}}" />
<card-item-plugin label="仓库" value="{{item.depot_name}}" />
<card-item-plugin label="供应商" value="{{item.crm_name}}" />
<card-item-plugin label="备注" value="{{item.comments}}" />
<card-item-plugin label="创建日期" value="{{item.create_date}}" />
</view>
<view slot="footer" class="card-plugin-footer">
<t-button size="small" theme="primary" bind:tap="onDetail" data-index="{{index}}">子商品
</t-button>
</view>
</card-plugin>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>

View File

View File

@@ -0,0 +1,15 @@
{
"usingComponents": {
"search-popup": "/pages/components/search-popup/search-popup",
"card-plugin": "/pages/components/card-plugin/card-plugin",
"card-item-plugin": "/pages/components/card-item-plugin/card-item-plugin",
"option-cell-plugin": "/pages/components/option-cell-plugin/option-cell-plugin",
"date-picker-plugin": "/pages/components/date-picker-plugin/date-picker-plugin",
"sort-plugin": "/pages/components/sort-plugin/sort-plugin",
"count-plugin": "/pages/components/count-plugin/count-plugin",
"total-bar-plugin": "/pages/components/total-bar-plugin/total-bar-plugin",
"pagination-plugin": "/pages/components/pagination-plugin/pagination-plugin",
"search-input": "/pages/components/search-input/search-input"
},
"navigationBarTitleText": "商品详情"
}

View File

@@ -0,0 +1,173 @@
import { loginStatus, post } from '@/utils/https';
import {
cloneLite,
getAuthInfo,
getDataSet,
showModal,
sleep,
toArray,
toastSuccess,
} from '@/utils/util';
const defaultParams = { curr_page: 1, page_count: 20 };
Page({
/**
* 页面的初始数据
*/
data: {
params: cloneLite(defaultParams) as any,
list: [] as any[],
count: 0,
goods_id: '',
sort: [],
goodsSubAttr: {} as any,
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
init() {
this.setData({ authInfo: getAuthInfo() });
this.getGoodsAttr();
},
searchChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchChange2(e: any) {
const key = getDataSet(e).key;
const val = `${e.detail.value || ''}`.trim();
if (val) {
this.data.params[key] = val;
} else {
delete this.data.params[key];
}
this.setData({ params: this.data.params });
},
onOptionChange(e: any) {
const key = getDataSet(e).key;
this.data.params[key] = e.detail.value;
this.setData({ params: this.data.params });
},
datePickerConfirm(e: any) {
const data = getDataSet(e);
this.data.params[data.key] = e.detail.value;
this.setData({ params: this.data.params });
},
searchOk() {
this.getList();
},
searchReset() {
this.data.params = cloneLite(defaultParams);
this.getList();
},
onSort(e: any) {
this.data.params.order = e.detail.value;
this.setData({ params: this.data.params });
this.getList();
},
getGoodsAttr() {
post('GoodsAttr/list').then((res: any) => {
this.data.goodsSubAttr = {};
toArray(res?.data?.list).forEach((el) => {
toArray(el.sub_attr).forEach((ell) => {
this.data.goodsSubAttr[ell.attr_id] = {
...ell,
p_attr_name: el.attr_name,
};
});
});
// console.log(this.data.goodsSubAttr);
this.setData({ goodsSubAttr: this.data.goodsSubAttr });
this.getList();
});
},
getList() {
post('ErpGoods/getSkuPrice', { goods_id: this.data.goods_id }).then((res: any) => {
const list = toArray(res.data).map((el) => {
el.attr_id_arr = `${el.attr_id || ''}`.split(',');
el.attr_name_arr = `${el.attr_name || ''}`.split(',');
return el;
});
// console.log(list);
this.setData({ list });
});
},
onOrderDel(e: any) {
const data = getDataSet(e);
const index = data.index;
const item = this.data.list[index];
showModal({ content: `确认删除 ${item.order_no} 订单?` }).then(() => {
post('Orders/delSaleOrders', { order_no: JSON.stringify([item.order_no]) }).then(() => {
toastSuccess('删除成功');
sleep(() => {
this.getList();
}, 1000);
});
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const { goods_id = '', title } = options;
this.data.goods_id = goods_id;
if (title) {
wx.setNavigationBarTitle({ title: decodeURIComponent(title) });
}
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);
});
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
});

View File

@@ -0,0 +1,40 @@
<page-plugin isAuth="{{authInfo['SF_ERP_GOODS_VIEW']}}" loading="{{loading}}" is-login="{{isLogin}}"
bind:handleLogin="handleLogin">
<!-- <search-popup placeholder="输入销售单号" bind:change="searchChange" bind:ok="searchOk"
bind:reset="searchReset" value="{{params.order_no}}" data-key="order_no">
<view slot="content">
<search-input label="自定义单号" value="{{params.custom_order_no}}" data-key="custom_order_no"
bind:change="searchChange2" />
<option-cell-plugin title="订单阶段" value="{{params.order_step}}" bind:change="onOptionChange"
mode="checkbox" options="{{orderStep}}" data-key="order_step" />
<date-picker-plugin title="单据开始日期" value="{{params.document_dateL}}" data-key="document_dateL"
bind:confirm="datePickerConfirm" />
<date-picker-plugin title="单据结束日期" value="{{params.document_dateU}}" data-key="document_dateU"
bind:confirm="datePickerConfirm" />
</view>
</search-popup> -->
<empty-plugin wx:if="{{list.length == 0}}" />
<card-plugin wx:for="{{ list }}" wx:key="goods_child_id" showAll>
<view slot="header">{{ item.sku_code }}</view>
<view slot="content">
<card-item-plugin label="助记码" value="{{item.sku_alias}}" />
<block wx:for="{{item.attr_id_arr}}" wx:key="index" wx:for-item="attr">
<!-- 取配置的值 -->
<!-- <card-item-plugin label="{{goodsSubAttr[item].p_attr_name}}"
value="{{goodsSubAttr[item].attr_name}}" /> -->
<card-item-plugin label="{{goodsSubAttr[attr].p_attr_name}}"
value="{{item.attr_name_arr[index]}}" />
</block>
<card-item-plugin label="采购价格" value="{{item.purchase_price}}" />
<card-item-plugin label="零售价格" value="{{item.commodity_price}}" />
<card-item-plugin label="销售价格" value="{{item.wholesale_price}}" />
<card-item-plugin label="单位" value="{{item.unit_ch_name}}" />
</view>
</card-plugin>
<pagination-plugin curr_page="{{params.curr_page}}" page_count="{{params.page_count}}"
total="{{count}}" bind:change="paginationChange" />
</page-plugin>

View File

@@ -74,6 +74,16 @@ export const menuConfig = [
icon: 'home',
iconColor: iconColor,
children: [
{
title: '商品信息',
url: '/pages/other/goods/goods',
auth: 'SF_ERP_GOODS_VIEW',
},
{
title: '批次信息',
url: '/pages/other/batch/batch',
auth: 'SF_ERP_GOODS_BATCH_VIEW',
},
{
title: '原料出库',
url: '/pages/other/outbound/outbound',