From 7ff1a911dd744ce9899ef91b3d6b9ee50286998a Mon Sep 17 00:00:00 2001 From: zhengw <247276359@qq.com> Date: Wed, 21 Jan 2026 17:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E4=BB=B6=E5=8F=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierrc | 30 +++ .vscode/settings.json | 36 +-- miniprogram/app.json | 9 +- miniprogram/app.wxss | 10 +- .../icons/{流程录入.svg => 录入流程.svg} | 0 miniprogram/assets/icons/流程管理.svg | 2 +- miniprogram/assets/icons/订单排序.svg | 1 + .../components/card-plugin/card-plugin.ts | 12 +- .../components/card-plugin/card-plugin.wxml | 15 +- .../pages/components/cf-table/cf-table.wxml | 5 +- .../pages/components/cf-table/cf-table.wxss | 18 +- .../no-auth-plugin/no-auth-plugin.wxml | 4 +- .../components/page-plugin/page-plugin.ts | 54 ++-- .../components/page-plugin/page-plugin.wxml | 27 +- .../pagination-plugin/pagination-plugin.wxml | 49 +--- .../pagination-plugin/pagination-plugin.wxss | 8 +- .../components/search-input/search-input.json | 6 + .../components/search-input/search-input.ts | 24 ++ .../components/search-input/search-input.wxml | 1 + .../components/search-input/search-input.wxss | 0 .../components/search-popup/search-popup.wxml | 57 +--- .../select-plugin/select-plugin.wxml | 40 +-- .../select-plugin/select-plugin.wxss | 2 +- .../tab-bar-plugin/tab-bar-plugin.wxml | 5 +- miniprogram/pages/index/index.ts | 156 +++++------ miniprogram/pages/index/index.wxml | 62 ++--- miniprogram/pages/index/index.wxss | 68 ++++- miniprogram/pages/my/my.json | 9 +- miniprogram/pages/my/my.ts | 93 +++++-- miniprogram/pages/my/my.wxml | 51 ++-- .../pages/orders/orderSort/orderSort.json | 6 + .../pages/orders/orderSort/orderSort.ts | 51 ++++ .../pages/orders/orderSort/orderSort.wxml | 7 + .../pages/orders/orderSort/orderSort.wxss | 0 .../pages/orders/ordersList/ordersList.json | 6 + .../pages/orders/ordersList/ordersList.ts | 56 ++++ .../pages/orders/ordersList/ordersList.wxml | 7 + .../pages/orders/ordersList/ordersList.wxss | 0 .../pages/processEntry/processEntry.json | 5 +- .../pages/processEntry/processEntry.ts | 248 +++++++----------- .../pages/processEntry/processEntry.wxml | 132 +++++----- .../pages/processEntry/processEntry.wxss | 26 +- .../produce/processManage/processManage.json | 2 +- .../produce/processManage/processManage.ts | 188 +++---------- .../produce/processManage/processManage.wxml | 32 ++- .../produce/processManage/processManage.wxss | 1 - .../processManageDetail.json | 6 +- .../processManageDetail.ts | 120 +++++++-- .../processManageDetail.wxml | 60 ++++- miniprogram/utils/config.ts | 36 +-- miniprogram/utils/https.ts | 113 ++++---- miniprogram/utils/menuConfig.ts | 33 ++- miniprogram/utils/util.ts | 96 +++---- project.config.json | 2 +- 54 files changed, 1078 insertions(+), 1009 deletions(-) create mode 100644 .prettierrc rename miniprogram/assets/icons/{流程录入.svg => 录入流程.svg} (100%) create mode 100644 miniprogram/assets/icons/订单排序.svg create mode 100644 miniprogram/pages/components/search-input/search-input.json create mode 100644 miniprogram/pages/components/search-input/search-input.ts create mode 100644 miniprogram/pages/components/search-input/search-input.wxml create mode 100644 miniprogram/pages/components/search-input/search-input.wxss create mode 100644 miniprogram/pages/orders/orderSort/orderSort.json create mode 100644 miniprogram/pages/orders/orderSort/orderSort.ts create mode 100644 miniprogram/pages/orders/orderSort/orderSort.wxml create mode 100644 miniprogram/pages/orders/orderSort/orderSort.wxss create mode 100644 miniprogram/pages/orders/ordersList/ordersList.json create mode 100644 miniprogram/pages/orders/ordersList/ordersList.ts create mode 100644 miniprogram/pages/orders/ordersList/ordersList.wxml create mode 100644 miniprogram/pages/orders/ordersList/ordersList.wxss diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0435440 --- /dev/null +++ b/.prettierrc @@ -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" + } + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 0dc901a..cb4fd85 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,20 +1,5 @@ { "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": { "**/node_modules": true, "**/bower_components": true, @@ -23,23 +8,6 @@ "**/miniprogram_npm": 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": [ "bindchange", "binddragend", @@ -58,5 +26,7 @@ "Sesskey", "showmenu", "unionid" - ] + ], + "wxml.format.maxPreserveNewLines": null, + "wxml.format.wrapLineLength": 100 } diff --git a/miniprogram/app.json b/miniprogram/app.json index 1155aa5..4bcce25 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -5,7 +5,9 @@ "pages/my/my", "pages/processEntry/processEntry", "pages/produce/processManage/processManage", - "pages/produce/processManageDetail/processManageDetail" + "pages/produce/processManageDetail/processManageDetail", + "pages/orders/ordersList/ordersList", + "pages/orders/orderSort/orderSort" ], "window": { "navigationBarTextStyle": "black", @@ -16,9 +18,10 @@ "lazyCodeLoading": "requiredComponents", "usingComponents": { "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": { "@/*": "/*" } -} +} \ No newline at end of file diff --git a/miniprogram/app.wxss b/miniprogram/app.wxss index 00eeb35..5c62961 100644 --- a/miniprogram/app.wxss +++ b/miniprogram/app.wxss @@ -6,15 +6,9 @@ button.t-button { view.t-input { flex: none; - padding: 12px; + padding: 24rpx; } view.t-popup__close { - padding: 6px; + padding: 12rpx; } - -/* -page { - --td-button-small-height: 34px; - --td-button-small-height: 34px; -} */ diff --git a/miniprogram/assets/icons/流程录入.svg b/miniprogram/assets/icons/录入流程.svg similarity index 100% rename from miniprogram/assets/icons/流程录入.svg rename to miniprogram/assets/icons/录入流程.svg diff --git a/miniprogram/assets/icons/流程管理.svg b/miniprogram/assets/icons/流程管理.svg index a2068e4..038df96 100644 --- a/miniprogram/assets/icons/流程管理.svg +++ b/miniprogram/assets/icons/流程管理.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/miniprogram/assets/icons/订单排序.svg b/miniprogram/assets/icons/订单排序.svg new file mode 100644 index 0000000..7dfedc4 --- /dev/null +++ b/miniprogram/assets/icons/订单排序.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/pages/components/card-plugin/card-plugin.ts b/miniprogram/pages/components/card-plugin/card-plugin.ts index 8fae6f1..96629f4 100644 --- a/miniprogram/pages/components/card-plugin/card-plugin.ts +++ b/miniprogram/pages/components/card-plugin/card-plugin.ts @@ -16,9 +16,9 @@ Component({ }, lifetimes: { attached() { - setTimeout(() => { - this.getSlotHeight(); - }, 100); + // setTimeout(() => { + // this.getSlotHeight(); + // }, 100); }, }, @@ -27,7 +27,7 @@ Component({ */ data: { showMore: false, - showMoreBar: false, + showMoreBar: true, }, /** * 组件的方法列表 @@ -38,7 +38,7 @@ Component({ const query = wx.createSelectorQuery().in(this); // 2. 查询插槽容器节点 query - .select("#contentSlot") + .select('#contentSlot') .boundingClientRect((rect) => { if (rect) { const height = rect.height; // 获取节点高度(单位px) @@ -54,7 +54,7 @@ Component({ .exec(); // 执行查询 }, click(e: any) { - this.triggerEvent("tap", e); + this.triggerEvent('tap', e); }, showMoreTap() { this.setData({ diff --git a/miniprogram/pages/components/card-plugin/card-plugin.wxml b/miniprogram/pages/components/card-plugin/card-plugin.wxml index 22983a7..af1934c 100644 --- a/miniprogram/pages/components/card-plugin/card-plugin.wxml +++ b/miniprogram/pages/components/card-plugin/card-plugin.wxml @@ -1,9 +1,13 @@ - - + + - - + + @@ -14,5 +18,4 @@ - - + \ No newline at end of file diff --git a/miniprogram/pages/components/cf-table/cf-table.wxml b/miniprogram/pages/components/cf-table/cf-table.wxml index df8e3bf..89dc9df 100644 --- a/miniprogram/pages/components/cf-table/cf-table.wxml +++ b/miniprogram/pages/components/cf-table/cf-table.wxml @@ -26,7 +26,7 @@ - + @@ -37,5 +37,4 @@ -暂无数据 - +暂无数据 \ No newline at end of file diff --git a/miniprogram/pages/components/cf-table/cf-table.wxss b/miniprogram/pages/components/cf-table/cf-table.wxss index 8d6a4fa..dd01bb7 100644 --- a/miniprogram/pages/components/cf-table/cf-table.wxss +++ b/miniprogram/pages/components/cf-table/cf-table.wxss @@ -1,7 +1,7 @@ .table-box { - border-left: 1px solid #ddd; - border-right: 1px solid #ddd; - border-bottom: 1px solid #ddd; + border-left: 1rpx solid #ddd; + border-right: 1rpx solid #ddd; + border-bottom: 1rpx solid #ddd; overflow: auto; } @@ -38,14 +38,14 @@ .th, .td { display: table-cell; - border-bottom: 1px solid #ddd; - padding: 4px; - border-right: 1px solid #ddd; + border-bottom: 1rpx solid #ddd; + padding: 8rpx; + border-right: 1rpx solid #ddd; vertical-align: middle; } .tr .th { - border-top: 1px solid #ddd; + border-top: 1rpx solid #ddd; } .tr .th:last-child, @@ -65,7 +65,7 @@ .empty-data { text-align: center; - margin-top: -33px; - line-height: 30px; + margin-top: -66rpx; + line-height: 60rpx; color: #999; } diff --git a/miniprogram/pages/components/no-auth-plugin/no-auth-plugin.wxml b/miniprogram/pages/components/no-auth-plugin/no-auth-plugin.wxml index 64b579f..7e126c3 100644 --- a/miniprogram/pages/components/no-auth-plugin/no-auth-plugin.wxml +++ b/miniprogram/pages/components/no-auth-plugin/no-auth-plugin.wxml @@ -1,4 +1,4 @@ - + 抱歉!您当前没有权限访问该页面 @@ -7,4 +7,4 @@ 前往首页 - + \ No newline at end of file diff --git a/miniprogram/pages/components/page-plugin/page-plugin.ts b/miniprogram/pages/components/page-plugin/page-plugin.ts index 9759b63..5bb9fbd 100644 --- a/miniprogram/pages/components/page-plugin/page-plugin.ts +++ b/miniprogram/pages/components/page-plugin/page-plugin.ts @@ -1,6 +1,7 @@ -import { base, defaultAvatarUrl } from "@/utils/config"; -import { Subscribe } from "@/utils/subscribe"; -import { setStorage } from "@/utils/util"; +import { base, defaultAvatarUrl } from '@/utils/config'; +import { login } from '@/utils/https'; +import { Subscribe } from '@/utils/subscribe'; +import { isArray, setStorage } from '@/utils/util'; // import { IStorage } from "@/utils/storage"; // const app = getApp(); @@ -13,6 +14,7 @@ Component({ loading: Boolean, isAuth: null, customStyle: null, + hasTabBar: null, }, // attached() { @@ -35,24 +37,24 @@ Component({ appletName: base.appletName, show: false, companyList: [], - encryptedData: "", - iv: "", + encryptedData: '', + iv: '', }, methods: { handleLogin(e: any) { - this.triggerEvent("handleLogin", e.detail); + this.triggerEvent('handleLogin', e.detail); }, getPhoneNumberToast() { - setStorage("isLogin", 1); - Subscribe.set("isLogin", "zzzuz"); - wx.showToast({ title: "请先勾选协议", icon: "none" }); + setStorage('isLogin', 1); + Subscribe.set('isLogin', 'zzzuz'); + wx.showToast({ title: '请先勾选协议', icon: 'none' }); }, changeAgreementCheck(event: any) { this.setData({ isAgree: event.detail.checked }); }, navAgreement(e: any) { wx.navigateTo({ - url: "../agreement/agreement?type=" + e.target.dataset.type, + url: '../agreement/agreement?type=' + e.target.dataset.type, }); }, // getPhoneNumber(e) { @@ -64,23 +66,23 @@ Component({ this.data.iv = e.detail.iv; console.log(e); - // login(e.detail.encryptedData, e.detail.iv) - // .then((res) => { - // console.log(res); - // if (isArray(res.data)) { - // this.setData({ - // companyList: res.data, - // show: true, - // }); - // } else { - // this.triggerEvent("handleLogin", true); - // } - // }) - // .catch((err) => { - // this.triggerEvent("handleLogin", false); - // }); + login(e.detail.encryptedData, e.detail.iv) + .then((res) => { + console.log(res); + if (isArray(res.data)) { + this.setData({ + companyList: res.data, + show: true, + }); + } else { + this.triggerEvent('handleLogin', true); + } + }) + .catch((err) => { + this.triggerEvent('handleLogin', false); + }); } else { - wx.showToast({ title: e.detail.errMsg, icon: "none" }); + wx.showToast({ title: e.detail.errMsg, icon: 'none' }); } }, login2(e: any) { diff --git a/miniprogram/pages/components/page-plugin/page-plugin.wxml b/miniprogram/pages/components/page-plugin/page-plugin.wxml index 4b42441..e9f5801 100644 --- a/miniprogram/pages/components/page-plugin/page-plugin.wxml +++ b/miniprogram/pages/components/page-plugin/page-plugin.wxml @@ -1,38 +1,43 @@ - + - + - - + + - + 本小程序仅供{{appletName}}用户使用 申请获取以下权限 获取您的公开信息(昵称,头像等) - + 一键登录 一键登录 - + 我已阅读并同意 - + 《{{appletName}}平台用户服务协议》 - + 《{{appletName}}隐私权政策》 - - + \ No newline at end of file diff --git a/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxml b/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxml index 13e23e4..a2f1ff6 100644 --- a/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxml +++ b/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxml @@ -1,42 +1,19 @@ - + 共{{total}}条 - + - {{item}} + + {{item}} - - 跳转 + + 跳转 - - - - + + + \ No newline at end of file diff --git a/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxss b/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxss index 1f3bcaf..9f98b1f 100644 --- a/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxss +++ b/miniprogram/pages/components/pagination-plugin/pagination-plugin.wxss @@ -1,8 +1,8 @@ .box { - display: flex; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(0, max-content)); + column-gap: 16rpx; + row-gap: 16rpx; align-items: center; justify-content: center; - flex-wrap: wrap; - column-gap: 8px; - row-gap: 8px; } diff --git a/miniprogram/pages/components/search-input/search-input.json b/miniprogram/pages/components/search-input/search-input.json new file mode 100644 index 0000000..18a9292 --- /dev/null +++ b/miniprogram/pages/components/search-input/search-input.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "t-input": "tdesign-miniprogram/input/input" + } +} \ No newline at end of file diff --git a/miniprogram/pages/components/search-input/search-input.ts b/miniprogram/pages/components/search-input/search-input.ts new file mode 100644 index 0000000..f94e603 --- /dev/null +++ b/miniprogram/pages/components/search-input/search-input.ts @@ -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: '' }); + }, + }, +}); diff --git a/miniprogram/pages/components/search-input/search-input.wxml b/miniprogram/pages/components/search-input/search-input.wxml new file mode 100644 index 0000000..76c381e --- /dev/null +++ b/miniprogram/pages/components/search-input/search-input.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/miniprogram/pages/components/search-input/search-input.wxss b/miniprogram/pages/components/search-input/search-input.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/components/search-popup/search-popup.wxml b/miniprogram/pages/components/search-popup/search-popup.wxml index 343c04d..65fa121 100644 --- a/miniprogram/pages/components/search-popup/search-popup.wxml +++ b/miniprogram/pages/components/search-popup/search-popup.wxml @@ -1,60 +1,29 @@ - - + + - - - + size="small" t-class="aaaaaa"> + + - 筛选 + 筛选 - - 搜索 + + 搜索 - - + \ No newline at end of file diff --git a/miniprogram/pages/components/select-plugin/select-plugin.wxml b/miniprogram/pages/components/select-plugin/select-plugin.wxml index 31dc02c..26b2790 100644 --- a/miniprogram/pages/components/select-plugin/select-plugin.wxml +++ b/miniprogram/pages/components/select-plugin/select-plugin.wxml @@ -1,44 +1,24 @@ - + - - - {{item.label}} + + + {{item.label}} - - {{item.label}} + + {{item.label}} 确定 - - + \ No newline at end of file diff --git a/miniprogram/pages/components/select-plugin/select-plugin.wxss b/miniprogram/pages/components/select-plugin/select-plugin.wxss index 6ed0c83..606087f 100644 --- a/miniprogram/pages/components/select-plugin/select-plugin.wxss +++ b/miniprogram/pages/components/select-plugin/select-plugin.wxss @@ -6,5 +6,5 @@ bottom: 0; background: #fff; z-index: 1; - padding-top: 12px; + padding-top: 24rpx; } diff --git a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml index ffdf70a..1ce1de1 100644 --- a/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml +++ b/miniprogram/pages/components/tab-bar-plugin/tab-bar-plugin.wxml @@ -1,5 +1,6 @@ - + {{item.label}} - + \ No newline at end of file diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts index d6dd60b..e448fcb 100644 --- a/miniprogram/pages/index/index.ts +++ b/miniprogram/pages/index/index.ts @@ -1,8 +1,6 @@ -// pages/index/index.ts - -import { menuConfig } from "@/utils/menuConfig"; -import { Subscribe } from "@/utils/subscribe"; -import { getDataSet, toObject } from "@/utils/util"; +import { loginStatus, post } from '@/utils/https'; +import { menuConfig } from '@/utils/menuConfig'; +import { getDataSet, toArray, toObject } from '@/utils/util'; // const app = getApp(); // const Storage = app.Storage; @@ -11,94 +9,50 @@ Page({ * 页面的初始数据 */ data: { + isLogin: false, + loading: true, BGColors: [ - "linear-gradient( 135deg, #FDEB71 10%, #F8D800 100%)", - "linear-gradient( 135deg, #ABDCFF 10%, #0396FF 100%)", - "linear-gradient( 135deg, #FEB692 10%, #EA5455 100%)", - "linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%)", - "linear-gradient( 135deg, #90F7EC 10%, #32CCBC 100%)", - "linear-gradient( 135deg, #FFF6B7 10%, #F6416C 100%)", - "linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%)", - "linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)", - "linear-gradient( 135deg, #F97794 10%, #623AA2 100%)", - "linear-gradient( 135deg, #FCCF31 10%, #F55555 100%)", - "linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%)", - "linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%)", - "linear-gradient( 135deg, #5EFCE8 10%, #736EFE 100%)", - "linear-gradient( 135deg, #FAD7A1 10%, #E96D71 100%)", - "linear-gradient( 135deg, #FFD26F 10%, #3677FF 100%)", - "linear-gradient( 135deg, #A0FE65 10%, #FA016D 100%)", - "linear-gradient( 135deg, #FFDB01 10%, #0E197D 100%)", - "linear-gradient( 135deg, #FEC163 10%, #DE4313 100%)", - "linear-gradient( 135deg, #92FFC0 10%, #002661 100%)", - "linear-gradient( 135deg, #EEAD92 10%, #6018DC 100%)", - "linear-gradient( 135deg, #F6CEEC 10%, #D939CD 100%)", - "linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%)", - "linear-gradient( 135deg, #F1CA74 10%, #A64DB6 100%)", - "linear-gradient( 135deg, #E8D07A 10%, #5312D6 100%)", - "linear-gradient( 135deg, #EECE13 10%, #B210FF 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, - }, + 'linear-gradient( 135deg, #FDEB71 10%, #F8D800 100%)', + 'linear-gradient( 135deg, #ABDCFF 10%, #0396FF 100%)', + 'linear-gradient( 135deg, #FEB692 10%, #EA5455 100%)', + 'linear-gradient( 135deg, #CE9FFC 10%, #7367F0 100%)', + 'linear-gradient( 135deg, #90F7EC 10%, #32CCBC 100%)', + 'linear-gradient( 135deg, #FFF6B7 10%, #F6416C 100%)', + 'linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%)', + 'linear-gradient( 135deg, #E2B0FF 10%, #9F44D3 100%)', + 'linear-gradient( 135deg, #F97794 10%, #623AA2 100%)', + 'linear-gradient( 135deg, #FCCF31 10%, #F55555 100%)', + 'linear-gradient( 135deg, #F761A1 10%, #8C1BAB 100%)', + 'linear-gradient( 135deg, #43CBFF 10%, #9708CC 100%)', + 'linear-gradient( 135deg, #5EFCE8 10%, #736EFE 100%)', + 'linear-gradient( 135deg, #FAD7A1 10%, #E96D71 100%)', + 'linear-gradient( 135deg, #FFD26F 10%, #3677FF 100%)', + 'linear-gradient( 135deg, #A0FE65 10%, #FA016D 100%)', + 'linear-gradient( 135deg, #FFDB01 10%, #0E197D 100%)', + 'linear-gradient( 135deg, #FEC163 10%, #DE4313 100%)', + 'linear-gradient( 135deg, #92FFC0 10%, #002661 100%)', + 'linear-gradient( 135deg, #EEAD92 10%, #6018DC 100%)', + 'linear-gradient( 135deg, #F6CEEC 10%, #D939CD 100%)', + 'linear-gradient( 135deg, #52E5E7 10%, #130CB7 100%)', + 'linear-gradient( 135deg, #F1CA74 10%, #A64DB6 100%)', + 'linear-gradient( 135deg, #E8D07A 10%, #5312D6 100%)', + 'linear-gradient( 135deg, #EECE13 10%, #B210FF 100%)', + 'linear-gradient( 135deg, #79F1A4 10%, #0E5CAD 100%)', ], + block: [] as any[], authInfo: {} 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() { this.data.authInfo = {}; - const companyInfo = toObject(wx.getStorageSync("company_info")); + const companyInfo = toObject(wx.getStorageSync('company_info')); this.data.menuList.length = 0; menuConfig.forEach((el) => { const children: any[] = []; @@ -115,22 +69,41 @@ Page({ }); } }); - // this.getIndex(); + this.getIndex(); this.setData({ authInfo: this.data.authInfo, 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) { - const url = getDataSet(e).url; - wx.navigateTo({ url }); + const data = getDataSet(e); + 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() { wx.hideHomeButton(); - this.init(); }, /** diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml index 3b6bd4f..78891b7 100644 --- a/miniprogram/pages/index/index.wxml +++ b/miniprogram/pages/index/index.wxml @@ -1,38 +1,32 @@ - - pages/index/index.wxml - change - my - - - - - {{ item.title }} - - - - - - {{ child.title }} + + + + + {{item.name}} + + {{item.value}} + {{item.unit}} - + + + + + + + + {{ item.title }} + + + + + + {{ child.title }} + + + - - - 下拉选择 - - - 1111 - - + \ No newline at end of file diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss index 47c784e..84d5a3d 100644 --- a/miniprogram/pages/index/index.wxss +++ b/miniprogram/pages/index/index.wxss @@ -1,14 +1,34 @@ -.container { - height: calc(100vh - var(--td-tab-bar-height, 80rpx) - env(safe-area-inset-bottom)); +page { + 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 { display: inline-flex; flex-direction: column; - width: clamp(80px, 25%, 120px); + width: clamp(80rpx, 25%, 200rpx); box-sizing: border-box; - padding: 8px; - --width: calc((100vw - 16px - 24px) / 4 * 0.4); + padding: 16rpx; + --width: calc((100vw - 32rpx - 48rpx - 16rpx) / 4 * 0.4); justify-content: center; align-items: center; } @@ -23,3 +43,41 @@ display: inline-flex; 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; +} diff --git a/miniprogram/pages/my/my.json b/miniprogram/pages/my/my.json index ca7108f..5269529 100644 --- a/miniprogram/pages/my/my.json +++ b/miniprogram/pages/my/my.json @@ -1,9 +1,8 @@ { "usingComponents": { - "t-button": "tdesign-miniprogram/button/button", - "search-popup": "/pages/components/search-popup/search-popup", - "card-plugin": "/pages/components/card-plugin/card-plugin", - "t-input": "tdesign-miniprogram/input/input", - "tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin" + "tab-bar-plugin": "/pages/components/tab-bar-plugin/tab-bar-plugin", + "t-cell": "tdesign-miniprogram/cell/cell", + "t-cell-group": "tdesign-miniprogram/cell-group/cell-group", + "t-image": "tdesign-miniprogram/image/image" } } diff --git a/miniprogram/pages/my/my.ts b/miniprogram/pages/my/my.ts index 84fe92b..bde7fef 100644 --- a/miniprogram/pages/my/my.ts +++ b/miniprogram/pages/my/my.ts @@ -1,43 +1,80 @@ -import { Subscribe } from "@/utils/subscribe"; -import { setStorage } from "@/utils/util"; +import { base } from '@/utils/config'; +import { checkSesskey, loginStatus, post } from '@/utils/https'; +import { getStorage, toObject } from '@/utils/util'; Page({ data: { - columns: [ - { title: "我的收藏", width: "100px", dataIndex: "name" }, - { title: "我的点赞", width: "200px", dataIndex: "count" }, - { title: "我的评论", width: "300px", dataIndex: "desc" }, - ], - data: [ - // { 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" }, - // { name: "张三", count: 1, desc: "11111" }, - // { name: "张三", count: 1, desc: "11111" }, - // { name: "张三", count: 1, desc: "11111" }, - // { name: "张三", count: 1, desc: "11111" }, - ], + version: wx.getAccountInfoSync().miniProgram.version || '开发1.0', + isLogin: false, + host: base.apiHost, + user_info: {}, + company_info: {}, + loading: true, + // staffType: StaffType, + company_list: [], + show: false, + hideTabKeys: [], }, - change() { - setStorage("isLogin", 1); - Subscribe.set("isLogin", "zzzuz"); - // wx.navigateTo({ url: "/pages/my/my" }); + init() { + const companyInfo = toObject(getStorage('company_info')); + this.setData({ + user_info: toObject(getStorage('user_info')), + company_info: companyInfo, + }); }, searchChange(e: any) { 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); + }); + }); + } + }, + }); + }, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml index 4617a0a..6a5deaa 100644 --- a/miniprogram/pages/my/my.wxml +++ b/miniprogram/pages/my/my.wxml @@ -1,20 +1,37 @@ - - - pages/my/my.wxml - change - - - - 11111 - - - 11111 - - 11111 + + + + + - - + {{company_info.company_desc}} + + + + + + + + + + + + {{user_info.login_name}} + + + {{user_info.nick_name}} + {{user_info.user_phone}} + + + + + - - + \ No newline at end of file diff --git a/miniprogram/pages/orders/orderSort/orderSort.json b/miniprogram/pages/orders/orderSort/orderSort.json new file mode 100644 index 0000000..569a67a --- /dev/null +++ b/miniprogram/pages/orders/orderSort/orderSort.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "card-plugin": "/pages/components/card-plugin/card-plugin" + }, + "navigationBarTitleText": "订单排序" +} \ No newline at end of file diff --git a/miniprogram/pages/orders/orderSort/orderSort.ts b/miniprogram/pages/orders/orderSort/orderSort.ts new file mode 100644 index 0000000..03cd728 --- /dev/null +++ b/miniprogram/pages/orders/orderSort/orderSort.ts @@ -0,0 +1,51 @@ +Page({ + /** + * 页面的初始数据 + */ + data: { + list: [1, 2], + }, + + getList() { + // Orders/getLiteOrders + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) {}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() {}, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() {}, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() {}, +}); diff --git a/miniprogram/pages/orders/orderSort/orderSort.wxml b/miniprogram/pages/orders/orderSort/orderSort.wxml new file mode 100644 index 0000000..bf110e3 --- /dev/null +++ b/miniprogram/pages/orders/orderSort/orderSort.wxml @@ -0,0 +1,7 @@ + + + {{item}} + {{item}} + {{item}} + + \ No newline at end of file diff --git a/miniprogram/pages/orders/orderSort/orderSort.wxss b/miniprogram/pages/orders/orderSort/orderSort.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/orders/ordersList/ordersList.json b/miniprogram/pages/orders/ordersList/ordersList.json new file mode 100644 index 0000000..94b6194 --- /dev/null +++ b/miniprogram/pages/orders/ordersList/ordersList.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "card-plugin": "/pages/components/card-plugin/card-plugin" + }, + "navigationBarTitleText": "销售订单" +} \ No newline at end of file diff --git a/miniprogram/pages/orders/ordersList/ordersList.ts b/miniprogram/pages/orders/ordersList/ordersList.ts new file mode 100644 index 0000000..c9a0cdf --- /dev/null +++ b/miniprogram/pages/orders/ordersList/ordersList.ts @@ -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() {}, +}); diff --git a/miniprogram/pages/orders/ordersList/ordersList.wxml b/miniprogram/pages/orders/ordersList/ordersList.wxml new file mode 100644 index 0000000..bf110e3 --- /dev/null +++ b/miniprogram/pages/orders/ordersList/ordersList.wxml @@ -0,0 +1,7 @@ + + + {{item}} + {{item}} + {{item}} + + \ No newline at end of file diff --git a/miniprogram/pages/orders/ordersList/ordersList.wxss b/miniprogram/pages/orders/ordersList/ordersList.wxss new file mode 100644 index 0000000..e69de29 diff --git a/miniprogram/pages/processEntry/processEntry.json b/miniprogram/pages/processEntry/processEntry.json index a8f4b8e..a52636e 100644 --- a/miniprogram/pages/processEntry/processEntry.json +++ b/miniprogram/pages/processEntry/processEntry.json @@ -1,10 +1,11 @@ { - "navigationBarTitleText": "流程录入", + "navigationBarTitleText": "录入流程", "usingComponents": { "t-input": "tdesign-miniprogram/input/input", "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", "t-icon": "tdesign-miniprogram/icon/icon", "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" } } diff --git a/miniprogram/pages/processEntry/processEntry.ts b/miniprogram/pages/processEntry/processEntry.ts index ac6685f..22cc919 100644 --- a/miniprogram/pages/processEntry/processEntry.ts +++ b/miniprogram/pages/processEntry/processEntry.ts @@ -1,43 +1,36 @@ -import { loginStatus, post } from "@/utils/https"; -import { - formatTime, - getAuthInfo, - getDataSet, - isArray, - toArray, - toObject, -} from "@/utils/util"; -import { voiceRequest } from "@/utils/voiceUtil"; +import { loginStatus, post } from '@/utils/https'; +import { formatTime, getAuthInfo, getDataSet, isArray, toArray, toObject } from '@/utils/util'; +import { voiceRequest } from '@/utils/voiceUtil'; /** 拼接符号 */ -const ProcessCodeConcatSymbol = "&&"; +const ProcessCodeConcatSymbol = '&&'; /** 撤回码标记 */ -const RecallCodeMarking = "-"; +const RecallCodeMarking = '-'; /** * 解析流程码 * @param {string} value */ const parseQrCode = (value: string) => { - value = `${value || ""}`; + value = `${value || ''}`; const obj = { /** 工序码 */ code: value, /** 提成自定义字段 */ - key: "", + key: '', /** - => 撤回码 */ - type: "", + type: '', }; if (value.includes(ProcessCodeConcatSymbol)) { obj.code = value.substring(0, value.indexOf(ProcessCodeConcatSymbol)); obj.key = value.substring( - value.indexOf(ProcessCodeConcatSymbol) + ProcessCodeConcatSymbol.length + value.indexOf(ProcessCodeConcatSymbol) + ProcessCodeConcatSymbol.length, ); } if (obj.code.includes(RecallCodeMarking)) { obj.type = RecallCodeMarking; - obj.code = obj.code.replace(RecallCodeMarking, ""); + obj.code = obj.code.replace(RecallCodeMarking, ''); } return obj; @@ -48,10 +41,12 @@ Page({ * 页面的初始数据 */ data: { - action: "end", - processCodeMsg: "", - rel_order_no: "", - process_code: "", + action: 'end', + processCodeMsg: '', + // rel_order_no: 'XSDD2026011500000190', + // process_code: 'jd', + rel_order_no: '', + process_code: '', logsList: [] as any[], show: false, orders: [] as any[], @@ -63,49 +58,42 @@ Page({ hideTabKeys: [] as string[], processItems: [] as any[], backFlag: false, - selectedProcessCode: "", - result: "", - logType: "0", - /** 默认提成 */ - defaultBonus: true, - showDefaultBonus: false, - defaultBonusConfig: {}, - defaultBonusConfigKeys: [] as string[], - rel_order_no_temp: "", + selectedProcessCode: '', + result: '', + logType: '0', + rel_order_no_temp: '', }, handleLogin(e: any) { + this.setData({ isLogin: e.detail }); if (e.detail) { - this.setData({ isLogin: true, authInfo: getAuthInfo() }); this.init(); - } else { - this.setData({ isLogin: false }); } }, backChange(e: any) { - this.data.backFlag = e.detail; - this.setData({ backFlag: e.detail }); - wx.setStorageSync("processBackFlag", e.detail ? 1 : 0); + const checked = e.detail.checked; + this.data.backFlag = checked; + this.setData({ backFlag: checked }); + wx.setStorageSync('processBackFlag', checked ? 1 : 0); if (this.data.selectedProcessCode) { const { code, key } = parseQrCode(this.data.selectedProcessCode); - this.data.selectedProcessCode = `${code}${ - e.detail ? RecallCodeMarking : "" - }`; + this.data.selectedProcessCode = `${code}${checked ? RecallCodeMarking : ''}`; if (key) { this.data.selectedProcessCode += `${ProcessCodeConcatSymbol}${key}`; } } + wx.setStorageSync('selectedProcessCode', this.data.selectedProcessCode); this.getProcessName(); }, getProcessName() { if (this.data.selectedProcessCode) { const { code, type } = parseQrCode(this.data.selectedProcessCode); for (const ell of this.data.processItems) { - if (ell.code == code) { + if (ell.process_code == code) { this.setData({ - processCodeMsg: `工序名称:${ell.name || ""}(${ell.code})`, + processCodeMsg: `工序名称:${ell.process_name || ''}(${ell.process_code})`, selectedProcessCode: this.data.selectedProcessCode, process_code: this.data.selectedProcessCode, - action: type ? "back" : "end", + action: type ? 'back' : 'end', }); break; } @@ -113,19 +101,19 @@ Page({ } }, processItemTap(e: any) { - this.data.selectedProcessCode = - e.currentTarget.dataset.code + (this.data.backFlag ? "-" : ""); - wx.setStorageSync("selectedProcessCode", this.data.selectedProcessCode); + this.data.selectedProcessCode = e.currentTarget.dataset.code + (this.data.backFlag ? '-' : ''); + wx.setStorageSync('selectedProcessCode', this.data.selectedProcessCode); this.setData({ selectedProcessCode: this.data.selectedProcessCode, }); + this.getProcessName(); }, getExecProcess() { - post("Orders/getExecProcess1").then((res: any) => { + post('CompanyProcessV2/getProcessByCode').then((res: any) => { this.data.processItems = toArray(res.data); 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(); } else { this.getProcessName(); @@ -136,15 +124,16 @@ Page({ }); }, init() { - const companyInfo = toObject(wx.getStorageSync("company_info")); - const code = wx.getStorageSync("selectedProcessCode") || ""; + const companyInfo = toObject(wx.getStorageSync('company_info')); + const code = wx.getStorageSync('selectedProcessCode') || ''; this.data.selectedProcessCode = code; this.data.process_code = code; - this.data.backFlag = wx.getStorageSync("processBackFlag") == 1; - const logType = wx.getStorageSync("processEntry_logType"); + this.data.backFlag = wx.getStorageSync('processBackFlag') == 1; + const logType = wx.getStorageSync('processEntry_logType'); this.setData({ - hideTabKeys: companyInfo.staff_type == 3 ? ["2"] : [], + authInfo: getAuthInfo(), + hideTabKeys: companyInfo.staff_type == 3 ? ['2'] : [], backFlag: this.data.backFlag, selectedProcessCode: code, process_code: code, @@ -156,9 +145,10 @@ Page({ this.setData({ voice: event.detail, }); - wx.setStorageSync("processEntryVoice", `${event.detail}`); + wx.setStorageSync('processEntryVoice', `${event.detail}`); }, getVoice(msg: string, cacheVoice?: boolean) { + return; if (this.data.voice && msg) { voiceRequest(msg, cacheVoice); } @@ -166,18 +156,19 @@ Page({ onLogTypeChange(e: any) { const data = getDataSet(e); this.setData({ logType: data.key }); - wx.setStorageSync("processEntry_logType", data.key); + wx.setStorageSync('processEntry_logType', data.key); }, scanCode() { this.data.isScanCode = true; wx.scanCode({ onlyFromCamera: true, - scanType: ["qrCode"], + scanType: ['qrCode'], success: (res) => { console.log(res); - const qrcode = res.result || ""; + const qrcode = res.result || ''; + if (qrcode) { - if (qrcode.startsWith("DD") || qrcode.startsWith("LC")) { + if (qrcode.startsWith('XSDD')) { if (this.data.process_code) { this.data.rel_order_no = qrcode; this.setData({ @@ -185,16 +176,13 @@ Page({ }); this.processEnter(); } else { - wx.showToast({ - title: "请扫流程码", - icon: "none", - }); + wx.showToast({ title: '请扫流程码', icon: 'none' }); } } else { const code = parseQrCode(qrcode); this.setData({ - action: code.type == RecallCodeMarking ? "back" : "end", - rel_order_no: "", + action: code.type == RecallCodeMarking ? 'back' : 'end', + rel_order_no: '', }); this.getProcess(qrcode); } @@ -208,41 +196,32 @@ Page({ }, }); }, - getProcess(real_code: any) { - const code = parseQrCode(real_code); - post("CompanyProcess/processChildList", { + getProcess(process_code: any) { + const code = parseQrCode(process_code); + post('/CompanyProcessV2/getProcessByCode', { curr_page: 1, page_count: 1, - real_code: code.code, + process_code: code.code, }) .then((res: any) => { const data = res.data; if (Array.isArray(res.data) && data.length) { this.setData({ - processCodeMsg: `工序名称:${data[0].name || ""}(${real_code})`, - process_code: real_code, - selectedProcessCode: real_code, - }); - this.getVoice(`${data[0].name}工序`, true); - wx.showToast({ - title: "请扫订单二维码", - icon: "none", + processCodeMsg: `工序名称:${data[0].process_name || ''}(${process_code})`, + process_code: process_code, + selectedProcessCode: process_code, }); + this.getVoice(`${data[0].process_name}工序`, true); + wx.showToast({ title: '请扫订单二维码', icon: 'none' }); } else { - this.addMsg("未找到 " + real_code + " 工序"); - wx.showToast({ - title: "未找到该工序", - icon: "error", - }); + this.addMsg('未找到 ' + process_code + ' 工序'); + wx.showToast({ title: '未找到该工序', icon: 'error' }); this.getVoice(`未找到工序`, true); } }) .catch(() => { - this.addMsg("未找到 " + real_code + " 工序"); - wx.showToast({ - title: "未找到该工序", - icon: "error", - }); + this.addMsg('未找到 ' + process_code + ' 工序'); + wx.showToast({ title: '未找到该工序', icon: 'error' }); }); }, processEnter() { @@ -253,8 +232,12 @@ Page({ }, LCProcessEnter(e: any) { const item = this.data.orders[e.currentTarget.dataset.index]; - this.data.rel_order_no_temp = item.rel_order_no; - this.setProcess(); + this.data.rel_order_no_temp = item.order_no; + this.setProcess({ + info_process_id: JSON.stringify([item.info_process_id]), + action: this.data.action, + if_scan: 1, + }); }, setProcess(other?: any) { const code = parseQrCode(this.data.process_code); @@ -262,42 +245,31 @@ Page({ if (code.key) { obj[this.data.rel_order_no_temp] = code.key; } - post("Orders/setProcess", { - param: JSON.stringify({ - rel_order_no: this.data.rel_order_no_temp, - process_code: code.code, - action: this.data.action, - if_scan: 1, - same_process: this.data.rel_order_no_temp.startsWith("LC") - ? 1 - : undefined, - // defaultBonus: getDefaultBonus() != "0", - }), - other: JSON.stringify({ ...other, ...obj }), - }) + post( + 'ProduceOrder/setProcessV2', + other + ? other + : { + order_no: this.data.rel_order_no_temp, + process_code: code.code, + action: this.data.action, + if_scan: 1, + }, + ) .then((res: any) => { - if (res.bonus == 1) { - const data = toObject(res.data); - this.setData({ - defaultBonusConfig: data, - defaultBonusConfigKeys: Object.keys(data), - showDefaultBonus: true, - }); - } else if (isArray(res.data) && res.data.length) { + if (isArray(res.data) && res.data.length) { res.data.forEach((el: any) => { el.product_info_str = toArray(el.product_info) .map((ell) => { - return `${ell.room_name || "未命名"}(${ - ell.goods_name || "未命名" - })`; + return `${ell.room_name || '未命名'}(${ell.goods_name || '未命名'})`; }) - .join(","); + .join(','); el.sale_info_str = toArray(el.sale_info) .map((ell) => { return `${ell.goods_name}`; }) - .join(","); + .join(','); }); this.setData({ @@ -307,57 +279,42 @@ Page({ } else { this.addMsg(res.err_msg); // this.getVoice(res.err_msg); - this.getVoice("通过"); + this.getVoice('通过'); this.setData({ show: false, - result: "success", - showDefaultBonus: false, + result: 'success', }); wx.showToast({ title: res.err_msg, - icon: "none", + icon: 'none', }); } }) .catch((res: any) => { this.addMsg(res.err_msg); - if (res.err_code == "244269") { + if (res.err_code == '244269') { this.setData({ - result: "success", + result: 'success', }); wx.showToast({ title: res.err_msg, - icon: "none", + icon: 'none', }); - this.getVoice("通过"); + this.getVoice('通过'); } else { this.setData({ - result: "error", + result: 'error', }); 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) { const now = new Date(); this.data.logsList.unshift({ date: formatTime(now).substring(5), - msg: msg || "", + msg: msg || '', }); if (this.data.logsList.length > 100) { this.data.logsList.length = 100; @@ -381,20 +338,16 @@ Page({ onLoad(_options) { this.setData({ loading: true, - voice: wx.getStorageSync("processEntryVoice") == "false" ? false : true, + voice: wx.getStorageSync('processEntryVoice') == 'false' ? false : true, }); loginStatus() .then(() => { - this.setData({ - isLogin: true, - loading: false, - authInfo: getAuthInfo(), - }); + this.setData({ isLogin: true, loading: false }); this.init(); }) .catch((err) => { this.setData({ isLogin: false, loading: false }); - console.log("调用登录状态请求失败", err); + console.log('调用登录状态请求失败', err); }); }, @@ -408,11 +361,6 @@ Page({ */ onShow() { wx.hideHomeButton(); - this.setData({ - // defaultBonus: getDefaultBonus() != "0", - }); - // if (!this.data.isScanCode) { - // } }, /** diff --git a/miniprogram/pages/processEntry/processEntry.wxml b/miniprogram/pages/processEntry/processEntry.wxml index bcc9be2..c05f42e 100644 --- a/miniprogram/pages/processEntry/processEntry.wxml +++ b/miniprogram/pages/processEntry/processEntry.wxml @@ -1,41 +1,41 @@ - + - - - 工序: + + + 工序: - 撤回 + 撤回 + - - 暂无工序 + + + 暂无工序 - {{item.name}} + {{item.process_name}} - + - + {{processCodeMsg}} - - - 扫码 - 流程录入 + + + + 扫码 + 录入流程 @@ -45,24 +45,17 @@ 扫码结果 - 图标 + 图标 - 记录 + 记录 - +