From 960523e7e5fa4be8a88e57794e86c6f6c5770697 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Tue, 4 Mar 2025 16:13:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/da-tree-vue2/changelog.md | 110 + components/da-tree-vue2/index.vue | 1108 +++++++++ components/da-tree-vue2/props.js | 183 ++ components/da-tree-vue2/readme.md | 303 +++ components/da-tree-vue2/utils.js | 151 ++ page_components/eletj.vue | 718 +++--- page_components/shiming.vue | 179 +- page_fenbao/hehuoren/shebeilist.vue | 25 +- page_fenbao/hehuoren/shebeixq.vue | 2164 +++++++++++++++++ page_fenbao/sbshouye.vue | 2 +- .../statulist/myshop/editshop/index.vue | 80 +- .../statulist/myshop/shebeilist/index.vue | 2 +- page_fenbao/statulist/myshop/shopxx/index.vue | 75 +- page_fenbao/xinzeng/index.vue | 2 +- page_fenbao/zhuce.vue | 27 +- page_user/mapditu/index.vue | 2 +- page_user/sbdetail.vue | 145 +- pages.json | 11 + pages/daili/index.vue | 2 +- pages/index/index.vue | 47 +- pages/my.vue | 49 +- pages/shanghudd.vue | 11 +- pages/shouye/index.vue | 2 +- pages/tj.vue | 170 +- 24 files changed, 4952 insertions(+), 616 deletions(-) create mode 100644 components/da-tree-vue2/changelog.md create mode 100644 components/da-tree-vue2/index.vue create mode 100644 components/da-tree-vue2/props.js create mode 100644 components/da-tree-vue2/readme.md create mode 100644 components/da-tree-vue2/utils.js create mode 100644 page_fenbao/hehuoren/shebeixq.vue diff --git a/components/da-tree-vue2/changelog.md b/components/da-tree-vue2/changelog.md new file mode 100644 index 0000000..aef338d --- /dev/null +++ b/components/da-tree-vue2/changelog.md @@ -0,0 +1,110 @@ +# 1.4.1 + +## 版本调整 + +建议更新,但需要注意,异步数据的时候,后台需返回 leaf 字段来判断是否末项数据 + +1. **调整数据项格式,新增 `leaf` 字段,来判断是否为末节点** +2. **调整数据项格式,新增 `sort` 字段,来排序节点位置** +3. **注意:异步加载数据,当为末项的时候,需要服务端数据返回 `leaf` 字段** +4. 新增 `alwaysFirstLoad` ,即异步数据总会在第一次展开节点时,拉取一次后台数据,来比对是否一致 +5. 拆分 `field` 属性,**注意: 1.5.0 版本后将移除 `field` 属性** +6. 新增 `labelField` 同 `field.label`,指定节点对象中某个属性为**标签**字段,默认`label` +7. 新增 `valueField` 同 `field.key`,指定节点对象中某个属性为**值**字段,默认`value` +8. 新增 `childrenField` 同 `field.children`,指定节点对象中某个属性为**子树节点**字段,默认`children` +9. 新增 `disabledField` 同 `field.disabled`,指定节点对象中某个属性为**禁用**字段,默认`disabled` +10. 新增 `appendField` 同 `field.append`,指定节点对象中某个属性为**副标签**字段,默认`append` +11. 新增 `leafField` 同 `field.label`,指定节点对象中某个属性为**末级节点**字段,默认`leaf` +12. 新增 `sortField` 同 `field.label`,指定节点对象中某个属性为**排序**字段,默认`sort` +13. 新增 `isLeafFn` ,用来自定义控制数据项的末项 +14. 更多的项目示例 +15. 支持单选取消选中 +16. 修复节点展开时可能存在的 bug +17. 修复节点选择可能存在的 bug +18. 调整为子节点默认继承父节点禁用属性 +19. `setExpandedKeys` 添加参数一为 `all` 即可支持一键展开/收起全部节点 +20. 其它更多优化 + +# 1.3.4 + +优化 + +1. 优化图标字体命名 + +# 1.3.3 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.3.2 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.3.1.1 + +修复 + +1. 修复 APP 兼容性引起的报错 + +# 1.3.1 + +## 建议更新 + +### 1.2.2~1.3.1 更新预览 + +1. 新增支持主题换色 +2. 新增支持点击标签也能选中节点 +3. 新增`field`字段 `append` 用于在标签后面显示小提示 +4. 方法`setExpandedKeys`支持加载动态数据 +5. 支持单选的`onlyRadioLeaf`为`true`时可点父节点展开/收起 +6. 新增 `expandChecked`,控制选择时是否展开当前已选的所有下级节点 +7. 新增 `checkedDisabled`,支持渲染禁用值 +8. 新增 `packDisabledkey`,支持返回已选中的禁用的 key +9. 更多细节修复、优化请移步 Vue3 版的更新日志 + +后续版本仍不会实时同步 Vue3 版本,如急需新功能,请移步 Vue3 版 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.2.2 + +## 建议更新,优化诸多问题 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.2.1 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.2.0.1 + +优化 + +1. 优化小程序兼容 + +# 1.2.0 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.1.1.1 + +修复 + +1. 修复同步版本的错误写法引起的报错 + +# 1.1.1 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.1.0 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.0.6 + +新增 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384&update_log) + +# 1.0.5 + +版本同步于 Vue3 版,[查看 Vue3 版更新日志](https://ext.dcloud.net.cn/plugin?id=12384),基于 Vue2 进行开发,支持单选、多选,全平台兼容。 diff --git a/components/da-tree-vue2/index.vue b/components/da-tree-vue2/index.vue new file mode 100644 index 0000000..5144cc5 --- /dev/null +++ b/components/da-tree-vue2/index.vue @@ -0,0 +1,1108 @@ + + + + + diff --git a/components/da-tree-vue2/props.js b/components/da-tree-vue2/props.js new file mode 100644 index 0000000..44c45a0 --- /dev/null +++ b/components/da-tree-vue2/props.js @@ -0,0 +1,183 @@ +// @ts-nocheck +export default { + /** + * 树的数据 + */ + data: { + type: Array, + default: () => [], + }, + /** + * 主题色 + */ + themeColor: { + type: String, + default: '#007aff', + }, + /** + * 是否开启多选,默认单选 + */ + showCheckbox: { + type: Boolean, + default: false, + }, + /** + * 默认选中的节点,注意单选时为单个key,多选时为key的数组 + */ + defaultCheckedKeys: { + type: [Array, String, Number], + default: null, + }, + /** + * 选择框的位置,可选 left/right + */ + checkboxPlacement: { + type: String, + default: 'left', + }, + /** + * 是否默认展开全部 + */ + defaultExpandAll: { + type: Boolean, + default: false, + }, + /** + * 默认展开的节点 + */ + defaultExpandedKeys: { + type: Array, + default: null, + }, + /** + * 是否自动展开到选中的节点,默认不展开 + */ + expandChecked: { + type: Boolean, + default: false, + }, + /** + * 子项缩进距离,默认40,单位rpx + */ + indent: { + type: Number, + default: 40, + }, + /** + * (旧)字段对应内容,默认为 {label: 'label',key: 'key', children: 'children', disabled: 'disabled', append: 'append'} + * 注意:1.5.0版本后不再兼容 + */ + field: { + type: Object, + default: null, + }, + /** + * 标签字段(新,拆分了) + */ + labelField: { + type: String, + default: 'label', + }, + /** + * 值字段(新,拆分了) + */ + valueField: { + type: String, + default: 'value', + }, + /** + * 下级字段(新,拆分了) + */ + childrenField: { + type: String, + default: 'children', + }, + /** + * 禁用字段(新,拆分了) + */ + disabledField: { + type: String, + default: 'disabled', + }, + /** + * 末级节点字段(新,拆分了) + */ + leafField: { + type: String, + default: 'leaf', + }, + /** + * 副标签字段(新,拆分了) + */ + appendField: { + type: String, + default: 'append', + }, + /** + * 排序字段(新,拆分了) + */ + sortField: { + type: String, + default: 'sort', + }, + isLeafFn: { + type: Function, + default: null, + }, + /** + * 是否显示单选图标,默认显示 + */ + showRadioIcon: { + type: Boolean, + default: true, + }, + /** + * 单选时只允许选中末级,默认可随意选中 + */ + onlyRadioLeaf: { + type: Boolean, + default: false, + }, + /** + * 多选时,是否执行父子不关联的任意勾选,默认父子关联 + */ + checkStrictly: { + type: Boolean, + default: false, + }, + /** + * 为 true 时,空的 children 数组会显示展开图标 + */ + loadMode: { + type: Boolean, + default: false, + }, + /** + * 异步加载接口 + */ + loadApi: { + type: Function, + default: null, + }, + /** + * 是否总在首次的时候加载一下内容,来比对是否一致 + */ + alwaysFirstLoad: { + type: Boolean, + default: false, + }, + /** + * 是否渲染(操作)禁用值 + */ + checkedDisabled: { + type: Boolean, + default: false, + }, + /** + * 是否返回已禁用的但已选中的key + */ + packDisabledkey: { + type: Boolean, + default: true, + }, +} diff --git a/components/da-tree-vue2/readme.md b/components/da-tree-vue2/readme.md new file mode 100644 index 0000000..d4c4459 --- /dev/null +++ b/components/da-tree-vue2/readme.md @@ -0,0 +1,303 @@ +# da-tree-vue2 + +一个基于 Vue2 的 tree(树)组件,同时支持主题换色,可能是最适合你的 tree(树)组件 + +`内容同步于 Vue3 版本,在此查看 ===>` **[Vue3 版](https://ext.dcloud.net.cn/plugin?id=12384)** + +_与 Vue3 版本版本不同的是,此版本兼容更全面,比如 360 小程序、快应用等均支持_ + +### 关于使用 + +可在右侧的`使用 HBuilderX 导入插件`或`下载示例项目ZIP`,方便快速上手。 + +可通过下方的示例及文档说明,进一步了解使用组件相关细节参数。 + +插件地址:https://ext.dcloud.net.cn/plugin?id=12692 + +### 组件示例 + +```jsx + +``` + +```js +/** + * 模拟创建一个接口数据 + */ +function GetApiData(currentNode) { + const { key } = currentNode + + return new Promise((resolve) => { + setTimeout(() => { + // 模拟返回空数据 + if (key.indexOf('-') > -1) { + return resolve(null) + // return resolve([]) + } + + return resolve([ + { + id: `${key}-1`, + name: `行政部X${key}-1`, + }, + { + id: `${key}-2`, + name: `财务部X${key}-2`, + append: '定义了末项数据', + leaf: true, + }, + { + id: `${key}-3`, + name: `资源部X${key}-3`, + }, + { + id: `${key}-4`, + name: `资源部X${key}-3`, + append: '被禁用,无展开图标', + disabled: true, + }, + ]) + }, 2000) + }) +} + +import DaTreeVue2 from '@/components/da-tree-vue2/index.vue' +export default { + components: { DaTreeVue2 }, + data() { + return { + GetApiData, + // key的类型必须对应树数据key的类型 + defaultCheckedKeysValue: ['211', '222'], + defaultCheckedKeysValue2: '222', + defaultExpandKeysValue3: ['212', '231'], + roomTreeData: [ + { + id: '2', + name: '行政中心', + children: [ + { + id: '21', + name: '行政部', + children: [ + { + id: '211', + name: '行政一部', + children: null, + }, + { + id: '212', + name: '行政二部', + children: [], + disabled: true, + }, + ], + }, + { + id: '22', + name: '财务部', + children: [ + { + id: '221', + name: '财务一部', + children: [], + disabled: true, + }, + { + id: '222', + name: '财务二部', + children: [], + }, + ], + }, + { + id: '23', + name: '人力资源部', + children: [ + { + id: '231', + name: '人力一部', + children: [], + }, + { + id: '232', + name: '人力二部', + append: '更多示例,请下载示例项目查看', + }, + ], + }, + ], + }, + ], + } + }, + methods: { + doExpandTree(keys, expand) { + this.$refs.DaTreeRef?.setExpandedKeys(keys, expand) + + const gek = this.$refs.DaTreeRef?.getExpandedKeys() + console.log('当前已展开的KEY ==>', gek) + }, + doCheckedTree(keys, checked) { + this.$refs.DaTreeRef?.setCheckedKeys(keys, checked) + + const gek = this.$refs.DaTreeRef?.getCheckedKeys() + console.log('当前已选中的KEY ==>', gek) + }, + handleTreeChange(allSelectedKeys, currentItem) { + console.log('handleTreeChange ==>', allSelectedKeys, currentItem) + }, + handleExpandChange(expand, currentItem) { + console.log('handleExpandChange ==>', expand, currentItem) + }, + }, +} +``` + +** 更多示例请下载/导入示例项目 ZIP 查看 ** + +### 组件参数 + +| 属性 | 类型 | 默认值 | 必填 | 说明 | +| :------------------ | :------------------------------ | :--------- | :--- | :--------------------------------------------------------------------------- | +| data | `Array` | - | 是 | 树的数据 | +| themeColor | `String` | `#007aff` | 否 | 主题色,十六进制 | +| defaultCheckedKeys | `Array` \| `Number` \| `String` | - | 否 | 默认选中的节点,单选为单个 key,多选为 key 的数组 | +| showCheckbox | `Boolean` | `false` | 否 | 是否开启多选,默认单选 | +| checkStrictly | `Boolean` | `false` | 否 | 多选时,是否执行父子不关联的任意勾选,默认父子关联 | +| showRadioIcon | `Boolean` | `true` | 否 | 是否显示单选图标,默认显示 | +| onlyRadioLeaf | `Boolean` | `true` | 否 | 单选时只允许选中末级,默认可随意选中 | +| defaultExpandAll | `Boolean` | `false` | 否 | 是否默认展开全部 | +| defaultExpandedKeys | `Array` | - | 否 | 默认展开的节点 | +| indent | `Number` | `40` | 否 | 子项缩进距离,单位 rpx | +| checkboxPlacement | `String` | `left` | 否 | 选择框的位置,可选 left/right | +| loadMode | `Boolean` | `false` | 否 | 为 true 时,空的 children 数组会显示展开图标 | +| loadApi | `Function` | - | 否 | 选择框的位置,可选 left/right | +| checkedDisabled | `Boolean` | `false` | 否 | 是否渲染禁用值,默认不渲染 | +| packDisabledkey | `Boolean` | `true` | 否 | 是否返回已禁用的但已选中的 key,默认返回禁用已选值 | +| expandChecked | `Boolean` | `false` | 否 | 是否自动展开到选中的节点,默认不展开 | +| alwaysFirstLoad | `Boolean` | `false` | 否 | 是否总在首次的时候加载一下内容,默认不加载,否则只有展开末级节点才会加载数据 | +| isLeafFn | `Function` | - | 否 | 自定义函数返回来控制数据项的末项 | +| field | `Object` | - | 否 | 字段对应内容,格式参考下方(1.5.0 后移除,请用单独的字段匹配) | +| labelField | `String` | `label` | 否 | 指定节点对象中某个属性为标签字段,默认`label` | +| valueField | `String` | `value` | 否 | 指定节点对象中某个属性为值字段,默认`value` | +| childrenField | `String` | `children` | 否 | 指定节点对象中某个属性为子树节点字段,默认`children` | +| disabledField | `String` | `disabled` | 否 | 指定节点对象中某个属性为禁用字段,默认`disabled` | +| appendField | `String` | `append` | 否 | 指定节点对象中某个属性为副标签字段,默认`append` | +| leafField | `String` | `leaf` | 否 | 指定节点对象中某个属性为末级节点字段,默认`leaf` | +| sortField | `String` | `sort` | 否 | 指定节点对象中某个属性为排序字段,默认`sort` | + +**field 格式(1.5.0 后移除,请用单独的字段匹配)** + +```js +{ + label: 'label', + key: 'key', + children: 'children', + disabled: 'disabled', + append: 'append' +} +``` + +### 组件事件 + +| 事件名称 | 回调参数 | 说明 | +| :------- | :-------------------------------------- | :-------------- | +| change | `(allCheckedKeys, currentItem) => void` | 选中时回调 | +| expand | `(expandState, currentItem) => void` | 展开/收起时回调 | + +### 组件方法 + +| 方法名称 | 参数 | 说明 | +| :------------------ | :--------------- | :------------------------------------------------------------------------------------------------ | +| setCheckedKeys | `(keys,checked)` | 设置指定 key 的节点选中/取消选中的状态。注: keys 单选时为 key,多选时为 key 的数组 | +| setExpandedKeys | `(keys,expand)` | 设置指定 key 的节点展开/收起的状态,当 keys 为 all 时即代表展开/收起全部。注:keys 为数组或 `all` | +| getCheckedKeys | - | 返回已选的 key | +| getHalfCheckedKeys | - | 返回半选的 key | +| getUncheckedKeys | - | 返回未选的 key | +| getCheckedNodes | - | 返回已选的节点 | +| getUncheckedNodes | - | 返回未选的节点 | +| getHalfCheckedNodes | - | 返回半选的节点 | +| getExpandedKeys | - | 返回已展开的 key | +| getUnexpandedKeys | - | 返回未展开的 key | +| getExpandedNodes | - | 返回已展开的节点 | +| getUnexpandedNodes | - | 返回未展开的节点 | + +### 组件版本 + +v1.4.1 + +### 差异化 + +已通过测试 + +> - H5 页面 +> - 微信小程序 +> - 支付宝、钉钉小程序 +> - 字节跳动、抖音、今日头条小程序 +> - 百度小程序 +> - 飞书小程序 +> - QQ 小程序 +> - 京东小程序 +> - 快应用 +> - 360 小程序 + +未测试 + +> - 快手小程序由于非企业用户暂无演示 + +### 开发组 + +[@CRLANG](https://crlang.com) diff --git a/components/da-tree-vue2/utils.js b/components/da-tree-vue2/utils.js new file mode 100644 index 0000000..979b331 --- /dev/null +++ b/components/da-tree-vue2/utils.js @@ -0,0 +1,151 @@ +// @ts-nocheck +/** 未选 */ +export const unCheckedStatus = 0 +/** 半选 */ +export const halfCheckedStatus = 1 +/** 选中 */ +export const isCheckedStatus = 2 + +/** + * 深拷贝内容 + * @param originData 拷贝对象 + * @author crlang(https://crlang.com) + */ +export function deepClone(originData) { + const type = Object.prototype.toString.call(originData) + let data + if (type === '[object Array]') { + data = [] + for (let i = 0; i < originData.length; i++) { + data.push(deepClone(originData[i])) + } + } else if (type === '[object Object]') { + data = {} + for (const prop in originData) { + // eslint-disable-next-line no-prototype-builtins + if (originData.hasOwnProperty(prop)) { // 非继承属性 + data[prop] = deepClone(originData[prop]) + } + } + } else { + data = originData + } + return data +} + +/** + * 获取所有指定的节点 + * @param type + * @param value + * @author crlang(https://crlang.com) + */ +export function getAllNodes(list, type, value, packDisabledkey = true) { + if (!list || list.length === 0) { + return [] + } + + const res = [] + for (let i = 0; i < list.length; i++) { + const item = list[i] + if (item[type] === value) { + if ((packDisabledkey && item.disabled) || !item.disabled) { + res.push(item) + } + } + } + + return res +} + +/** + * 获取所有指定的key值 + * @param type + * @param value + * @author crlang(https://crlang.com) + */ +export function getAllNodeKeys(list, type, value, packDisabledkey = true) { + if (!list || list.length === 0) { + return null + } + + const res = [] + for (let i = 0; i < list.length; i++) { + const item = list[i] + if (item[type] === value) { + if ((packDisabledkey && item.disabled) || !item.disabled) { + res.push(item.key) + } + } + } + + return res.length ? res : null +} + +/** + * 错误输出 + * + * @param msg + */ +export function logError(msg, ...args) { + console.error(`DaTree: ${msg}`, ...args) +} + +const toString = Object.prototype.toString + +export function is(val, type) { + return toString.call(val) === `[object ${type}]` +} + +/** + * 是否对象(Object) + * @param val + + */ +export function isObject(val) { + return val !== null && is(val, 'Object') +} + +/** + * 是否数字(Number) + * @param val + + */ +export function isNumber(val) { + return is(val, 'Number') +} + +/** + * 是否字符串(String) + * @param val + + */ +export function isString(val) { + return is(val, 'String') +} + +/** + * 是否函数方法(Function) + * @param val + + */ +export function isFunction(val) { + return typeof val === 'function' +} + +/** + * 是否布尔(Boolean) + * @param val + + */ +export function isBoolean(val) { + return is(val, 'Boolean') +} + +/** + * 是否数组(Array) + * @param val + + */ +export function isArray(val) { + return val && Array.isArray(val) +} diff --git a/page_components/eletj.vue b/page_components/eletj.vue index 2301939..a581b39 100644 --- a/page_components/eletj.vue +++ b/page_components/eletj.vue @@ -1,94 +1,94 @@ @@ -253,7 +255,7 @@ var xBlufi = require("@/page_components/blufi/xBlufi.js") import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue' import * as echarts from '@/components/uni-ec-canvas/echarts' -import { Counter } from './blufi/crypto/aes' + import { Counter } from './blufi/crypto/aes' let chart = null export default { components: { @@ -327,6 +329,7 @@ import { Counter } from './blufi/crypto/aes' devicesarr:[], timedingshi: null, // 定时器 countdown: 30, // 倒计时时间 + yongdianlist:[] } }, onLoad(option) { @@ -350,13 +353,12 @@ import { Counter } from './blufi/crypto/aes' setTimeout(()=>{ this.startTimerone() },1500) - }, computed: { }, onUnload: function() { - console.log("unload "); + console.log("unload"); this.stopTimer(); this.clearTimer() clearInterval(this.timerone); @@ -367,7 +369,6 @@ import { Counter } from './blufi/crypto/aes' deviceId: this.deviceId, name: this.name }) - }, mounted() { // 组件挂载后启动定时器 @@ -419,29 +420,28 @@ import { Counter } from './blufi/crypto/aes' } }, onHide() { - console.log("页面隐藏"); - this.handleScreenOff(); + console.log("页面隐藏") + this.handleScreenOff() uni.navigateBack() }, methods: { // 处理息屏事件 - handleScreenOff() { - console.log("处理息屏事件"); - xBlufi.notifyConnectBle({ - isStart: false, - deviceId: this.deviceId, - name: this.name - }) - this.clearTimer() // 倒计时结束,清除定时器 - uni.reLaunch({ - url:'/pages/shouye/index' - }) - }, - // 处理亮屏事件 - handleScreenOn() { - console.log("处理亮屏事件"); - }, - + handleScreenOff() { + console.log("处理息屏事件"); + xBlufi.notifyConnectBle({ + isStart: false, + deviceId: this.deviceId, + name: this.name + }) + this.clearTimer() // 倒计时结束,清除定时器 + uni.reLaunch({ + url:'/pages/shouye/index' + }) + }, + // 处理亮屏事件 + handleScreenOn() { + console.log("处理亮屏事件"); + }, // 启动定时器 startTimerdingshi() { let that = this @@ -535,7 +535,6 @@ import { Counter } from './blufi/crypto/aes' return `${timeObj.seconds}秒`; } }, - startTimerone() { // 清除之前可能存在的定时器,防止重复设置 clearInterval(this.timerone); @@ -566,7 +565,6 @@ import { Counter } from './blufi/crypto/aes' url: '/page_fenbao/chongzhi?dingobj=' + JSON.stringify(this.dingobj) }) }, - // 点击拨打客服电话 btncall(){ let phoneNumber = '' @@ -585,8 +583,6 @@ import { Counter } from './blufi/crypto/aes' } }) }, - - // 开启和关闭 btnkq() { if (this.onlineStatus == 1) { @@ -711,10 +707,6 @@ import { Counter } from './blufi/crypto/aes' } } }, - - - - // 点击进行强刷数据 shuaxin(txt){ clearInterval(this.timerIds); @@ -1001,7 +993,14 @@ import { Counter } from './blufi/crypto/aes' } }) }, - + // 获取分时段用电量 + getyongdian() { + this.$u.get(`/app/billEleRecord/listByBill?billId=${this.billId}`).then(res => { + if (res.code == 200) { + this.yongdianlist = res.data + } + }) + }, // 获取订单详情 getDevice() { this.$u.get(`/app/bill/byNo/${this.id}`).then(res => { @@ -1012,6 +1011,7 @@ import { Counter } from './blufi/crypto/aes' this.detaobj = res.data this.billId = res.data.billId this.orderno = res.data.billNo + this.getyongdian() if(res.data.deviceRechargeStatus == 1){ clearInterval(this.timerone); this.timerone = null @@ -1086,101 +1086,55 @@ import { Counter } from './blufi/crypto/aes' let that = this if (that.deviceId != '') { let systemInfo = uni.getSystemInfoSync() - if (systemInfo.platform == 'android') { - that.modelId.some(item => { - if(item == 2){ - console.log('配网'); - let zuih = '' - if(that.deviceId.slice(-1) == 8){ - zuih = 'A' - }else if(that.deviceId.slice(-1) == 9){ - zuih = 'B' - }else if(that.deviceId.slice(-1) == 'A'){ - zuih = 'C' - }else if(that.deviceId.slice(-1) == 'B'){ - zuih = 'D' - }else if(that.deviceId.slice(-1) == 'C'){ - zuih = 'E' - }else if(that.deviceId.slice(-1) == 'D'){ - zuih = 'F' - }else{ - zuih = Number(that.deviceId.slice(-1)) + 2 - } - that.deviceId = that.deviceId.slice(0, -1) + zuih - console.log(that.modelId,zuih,that.deviceId.slice(0, -1),'...........') - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }) - console.log("进入蓝牙连接", that.deviceId) - console.log("进入that.name", that.name) - xBlufi.notifyConnectBle({ - isStart: true, - deviceId: that.deviceId, - name: that.name - }) - }else{ - console.log('无配网'); - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }) - console.log("进入蓝牙连接", that.deviceId) - console.log("进入that.name", that.name) - xBlufi.notifyConnectBle({ - isStart: true, - deviceId: that.deviceId, - name: that.name - }) - } - }) - } else if (systemInfo.platform == 'ios') { - // 当前设备是 iOS - that.findDevice() - // var falg = 0 - // console.log("进入这里是IOS") - // this.devicesarr.forEach(device => { - // console.log(device.name, this.qrResult, '111') - // console.log("IOSMAC",device) - // console.log("device.name",device.name) - // console.log("that.qrResult",that.qrResult) - // if (device.name.slice(-12) == that.qrResult.slice(-12)) { - // this.deviceId = device.deviceId - // this.name = device.device - // console.log(this.deviceId, '11221'); - // falg = 1; - // xBlufi.notifyStartDiscoverBle({ - // 'isStart': false - // }) - // xBlufi.notifyConnectBle({ - // isStart: true, - // deviceId: device.deviceId, - // name: device.name - // }) - // } - // }) - // if(falg==0){ - // setTimeout(()=>{ - // this.devicesarr.forEach(device => { - // console.log(device.name, this.qrResult, '111') - // console.log("IOSMAC",device) - // console.log("device.name",device.name) - // console.log("that.qrResult",that.qrResult) - // if (device.name.slice(-12) == that.qrResult.slice(-12)) { - // this.deviceId = device.deviceId - // this.name = device.device - // console.log(this.deviceId, '11221'); - // falg = 1; - // xBlufi.notifyStartDiscoverBle({ - // 'isStart': false - // }) - // xBlufi.notifyConnectBle({ - // isStart: true, - // deviceId: device.deviceId, - // name: device.name - // }) - // } - // }) - // },3000) - // } + if (systemInfo.platform == 'android') { + that.modelId.some(item => { + if(item == 2){ + console.log('配网'); + let zuih = '' + if(that.deviceId.slice(-1) == 8){ + zuih = 'A' + }else if(that.deviceId.slice(-1) == 9){ + zuih = 'B' + }else if(that.deviceId.slice(-1) == 'A'){ + zuih = 'C' + }else if(that.deviceId.slice(-1) == 'B'){ + zuih = 'D' + }else if(that.deviceId.slice(-1) == 'C'){ + zuih = 'E' + }else if(that.deviceId.slice(-1) == 'D'){ + zuih = 'F' + }else{ + zuih = Number(that.deviceId.slice(-1)) + 2 + } + that.deviceId = that.deviceId.slice(0, -1) + zuih + console.log(that.modelId,zuih,that.deviceId.slice(0, -1),'...........') + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }) + console.log("进入蓝牙连接", that.deviceId) + console.log("进入that.name", that.name) + xBlufi.notifyConnectBle({ + isStart: true, + deviceId: that.deviceId, + name: that.name + }) + }else{ + console.log('无配网'); + xBlufi.notifyStartDiscoverBle({ + 'isStart': false + }) + console.log("进入蓝牙连接", that.deviceId) + console.log("进入that.name", that.name) + xBlufi.notifyConnectBle({ + isStart: true, + deviceId: that.deviceId, + name: that.name + }) + } + }) + } else if (systemInfo.platform == 'ios') { + // 当前设备是 iOS + that.findDevice() } } } @@ -1260,7 +1214,6 @@ import { Counter } from './blufi/crypto/aes' seconds: seconds } }, - funListenDeviceMsgEvent: function(options) { switch (options.type) { case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: @@ -1271,19 +1224,7 @@ import { Counter } from './blufi/crypto/aes' case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: if (options.result) { this.devicesarr = options.data - // console.log(devicesarr, this.mac, '111') - // devicesarr.forEach(device => { - // // const mac = device.name.substring(4) - // // if (device.name.slice(-12) == this.qrResult) { - // // this.deviceId = device.deviceId - // // this.name = device.name - // // // console.log(device.name,this.mac,'222'); - // // this.devicesList.push(device) - // // let uniqueDevicesList = Array.from(new Set(this.devicesList)) - // // // 将去重后的数组重新赋值给 this.devicesList - // // this.devicesList = uniqueDevicesList - // // } - // }) + } break; case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: @@ -1316,14 +1257,6 @@ import { Counter } from './blufi/crypto/aes' this.jieshufalg = false uni.hideLoading() break - // case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: - // if (options.result) { - // let uniqueDevicesList = Array.from(new Set(this.devicesList)); - // let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) === "CTKG"); - // // 将过滤后的数组重新赋值给 this.devicesList - // this.devicesList = filteredDevices - // } - // break case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START: if (!options.result) { this.lanyaflag = true @@ -1335,7 +1268,6 @@ import { Counter } from './blufi/crypto/aes' break } }, - parseCustomData(data) { // 将字符串按照 "@" 分割成数组 const dataArray = data.split('@') @@ -1373,16 +1305,28 @@ import { Counter } from './blufi/crypto/aes' } } - \ No newline at end of file diff --git a/page_fenbao/sbshouye.vue b/page_fenbao/sbshouye.vue index 9aaca6b..dc75652 100644 --- a/page_fenbao/sbshouye.vue +++ b/page_fenbao/sbshouye.vue @@ -18,7 +18,7 @@ src="https://api.ccttiot.com/smartmeter/img/static/uZSiz7XWpxcXEkl6sTwj" mode="aspectFit"> - 维修中 + 调试中 使用中 diff --git a/page_fenbao/statulist/myshop/editshop/index.vue b/page_fenbao/statulist/myshop/editshop/index.vue index c9c284b..76265de 100644 --- a/page_fenbao/statulist/myshop/editshop/index.vue +++ b/page_fenbao/statulist/myshop/editshop/index.vue @@ -112,6 +112,10 @@ 是否允许在非营业时间使用 + + 店铺描述 + + 提交修改 @@ -152,27 +156,7 @@ regionshow: false, regiontext: '请选择省市区', regionvalue: '', - selector: [{ - value: 1, - label: '商场' - }, - { - value: 2, - label: '学校' - }, - { - value: 3, - label: '娱乐场所' - }, - { - value: 4, - label: '出租房' - }, - { - value: 5, - label: '其他' - }, - ], + selector: [], latitude: '请输入纬度', longitude: '请输入经度', shopname: '', @@ -189,14 +173,18 @@ listobj: {}, storeId: '', url:'', - jtdz:'' + jtdz:'', + miaoshu:'', + leixinglist:[] } }, onLoad(option) { + this.getleixing() let obj = JSON.parse(option.obj) this.listobj = obj console.log(this.listobj); this.shopname = this.listobj.name + this.miaoshu = this.listobj.description this.ksyy = this.listobj.businessTimeStart this.jsyy = this.listobj.businessTimeEnd this.regiontext = this.listobj.province + this.listobj.city + this.listobj.county @@ -205,7 +193,7 @@ this.latitude = this.listobj.lat this.longitude = this.listobj.lng this.xqdz = this.listobj.address - this.selectorvalue = this.listobj.type + this.selectorvalue = this.listobj.typeId this.imglist = this.listobj.picture.split(',') this.province = this.listobj.province this.city = this.listobj.city @@ -213,18 +201,18 @@ this.storeId = this.listobj.storeId this.checked = this.listobj.show this.checkeds = this.listobj.useOutTime - if (this.selectorvalue == 1) { - this.selectortext = '商场' - this.updateTime = this.listobj.updateTime - } else if (this.selectorvalue == 2) { - this.selectortext = '学校' - } else if (this.selectorvalue == 3) { - this.selectortext = '娱乐场所' - } else if (this.selectorvalue == 4) { - this.selectortext = '出租房' - } else { - this.selectortext = '其他' - } + // if (this.selectorvalue == 1) { + // this.selectortext = '商场' + // this.updateTime = this.listobj.updateTime + // } else if (this.selectorvalue == 2) { + // this.selectortext = '学校' + // } else if (this.selectorvalue == 3) { + // this.selectortext = '娱乐场所' + // } else if (this.selectorvalue == 4) { + // this.selectortext = '出租房' + // } else { + // this.selectortext = '其他' + // } this.getQiniuToken() }, // 分享到好友(会话) @@ -244,6 +232,21 @@ } }, methods: { + getleixing() { + this.$u.get("/app/storeType/listAll").then(res => { + this.leixinglist = res.data.map(item => ({ + value: item.id, + label: item.name + })) + this.selector = this.leixinglist + // console.log(this.listobj.typeId,this.leixinglist); + this.leixinglist.forEach(item =>{ + if(item.value == this.selectorvalue){ + this.selectortext = item.label + } + }) + }) + }, handleLongPress(index) { let that = this uni.showModal({ @@ -382,10 +385,11 @@ specificAddress: this.jtdz, contactName: this.lxname, contactMobile: this.lxphone, - type: this.selectorvalue, + typeId: this.selectorvalue, storeId: this.storeId, show:this.checked, - useOutTime:this.checkeds + useOutTime:this.checkeds, + description:this.miaoshu } this.$u.put("/app/store", data).then(res => { if (res.code == 500) { @@ -434,7 +438,7 @@ this.latitude = res.latitude; this.longitude = res.longitude; this.xqdz = res.name - this.jtdz = res.address + this.jtdz = res.name }, fail: function(err) { console.log('选择位置失败', err); diff --git a/page_fenbao/statulist/myshop/shebeilist/index.vue b/page_fenbao/statulist/myshop/shebeilist/index.vue index b1a7a7c..deae15b 100644 --- a/page_fenbao/statulist/myshop/shebeilist/index.vue +++ b/page_fenbao/statulist/myshop/shebeilist/index.vue @@ -18,7 +18,7 @@ src="https://api.ccttiot.com/smartmeter/img/static/uZSiz7XWpxcXEkl6sTwj" mode="aspectFit"> - 维修中 + 调试中 使用中 diff --git a/page_fenbao/statulist/myshop/shopxx/index.vue b/page_fenbao/statulist/myshop/shopxx/index.vue index 5ae0053..c8ecfdf 100644 --- a/page_fenbao/statulist/myshop/shopxx/index.vue +++ b/page_fenbao/statulist/myshop/shopxx/index.vue @@ -52,24 +52,18 @@ 店铺名称 + 店铺类型 - - - {{selectortext == '' ? '请选择商铺类型' : selectortext}} - - - - - + + + + 营业时间 是否允许在非营业时间使用 + + 店铺描述 + + + + + 提交创建 @@ -139,6 +140,7 @@ export default { data() { return { + bgc: { backgroundColor: " #8883F0", }, @@ -160,27 +162,7 @@ regionshow: false, regiontext: '请选择省市区', regionvalue: '', - selector: [{ - value: 1, - label: '商场' - }, - { - value: 2, - label: '学校' - }, - { - value: 3, - label: '娱乐场所' - }, - { - value: 4, - label: '出租房' - }, - { - value: 5, - label: '其他' - }, - ], + selector: [], latitude: '请输入纬度', longitude: '请输入经度', shopname: '', @@ -196,7 +178,8 @@ area: '', url:'', id:'', - jtdz:'' + jtdz:'', + miaoshu:'' } }, onLoad(option) { @@ -207,8 +190,21 @@ }, onShow() { this.getQiniuToken() + this.getleixing() }, methods: { + btnlx() { + this.selectorshow = true + }, + + getleixing() { + this.$u.get("/app/storeType/listAll").then(res => { + this.selector = res.data.map(item => ({ + value: item.id, + label: item.name + })) + }) + }, handleLongPress(index) { let that = this uni.showModal({ @@ -356,9 +352,10 @@ specificAddress: this.xqdz, contactName: this.shopname, contactMobile: this.lxphone, - type: this.selectorvalue, + typeId: this.selectorvalue, show:this.checked, - useOutTime:this.checkeds + useOutTime:this.checkeds, + description:this.miaoshu } this.$u.post("/app/store", data).then(res => { if (res.code == 200) { @@ -409,9 +406,7 @@ } }, - btnlx() { - this.selectorshow = true - }, + btnselector(e) { this.selectorvalue = e[0].value this.selectortext = e[0].label @@ -432,7 +427,7 @@ this.latitude = res.latitude this.longitude = res.longitude this.xqdz = res.name - this.jtdz = res.address + this.jtdz = res.name }, fail: function(err) { // 检查错误消息,看是否是用户取消了位置选择 @@ -448,8 +443,6 @@ }, }) }, - - getQiniuToken() { this.$u.get("/common/qiniu/uploadInfo").then((res) => { if (res.code == 200) { diff --git a/page_fenbao/xinzeng/index.vue b/page_fenbao/xinzeng/index.vue index 32f9c8b..d3f91a3 100644 --- a/page_fenbao/xinzeng/index.vue +++ b/page_fenbao/xinzeng/index.vue @@ -20,7 +20,7 @@ src="https://api.ccttiot.com/smartmeter/img/static/uZSiz7XWpxcXEkl6sTwj" mode="aspectFit"> - 维修中 + 调试中 使用中 diff --git a/page_fenbao/zhuce.vue b/page_fenbao/zhuce.vue index 2171ded..61fbe6b 100644 --- a/page_fenbao/zhuce.vue +++ b/page_fenbao/zhuce.vue @@ -229,6 +229,15 @@ this.mac = device.name.slice(5, 17) } }) + let uniqueDevicesList = Array.from(new Set(this.devicesList)); + this.devicesLists = uniqueDevicesList.map(device => { + const deviceId = device.name.slice(-12) + const newDevice = { + ...device, + xuanz: "请选择", + }; // 直接在复制时添加 xuanz 字段 + return newDevice + }) } break; case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: @@ -262,15 +271,15 @@ break; case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: if (options.result) { - let uniqueDevicesList = Array.from(new Set(this.devicesList)); - this.devicesLists = uniqueDevicesList.map(device => { - const deviceId = device.name.slice(-12) - const newDevice = { - ...device, - xuanz: "请选择", - }; // 直接在复制时添加 xuanz 字段 - return newDevice - }) + // let uniqueDevicesList = Array.from(new Set(this.devicesList)); + // this.devicesLists = uniqueDevicesList.map(device => { + // const deviceId = device.name.slice(-12) + // const newDevice = { + // ...device, + // xuanz: "请选择", + // }; // 直接在复制时添加 xuanz 字段 + // return newDevice + // }) let devicesarr = options.data this.devicesList.forEach(device => { if (device.name.substring(0, 4) == "CCYK") { diff --git a/page_user/mapditu/index.vue b/page_user/mapditu/index.vue index 159d6d5..3223be0 100644 --- a/page_user/mapditu/index.vue +++ b/page_user/mapditu/index.vue @@ -80,7 +80,7 @@ src="https://api.ccttiot.com/smartmeter/img/static/uZSiz7XWpxcXEkl6sTwj" mode="aspectFit"> - 维修中 + 调试中 使用中 diff --git a/page_user/sbdetail.vue b/page_user/sbdetail.vue index dc249cd..e901dbf 100644 --- a/page_user/sbdetail.vue +++ b/page_user/sbdetail.vue @@ -1,7 +1,7 @@ @@ -391,7 +412,11 @@ userTpye_userid:'', ver_dataflag:2, showshop: false, - devicesarr:[] + devicesarr:[], + fanhui:'', + xishu:1, + wxs:'', + jiaozhunflag:false } }, onLoad(option) { @@ -400,6 +425,9 @@ let id = option.id this.id = id this.gettanc() + if(option.fanhui){ + this.fanhui = option.fanhui + } if (option.flag) { this.opflag = false } else { @@ -487,6 +515,38 @@ this.drawCanvas() }, methods: { + // 点击减电量系数 + btnjian() { + const value = Number(this.wxs.slice(0, -1)) - 0.05 + this.wxs = value.toFixed(2) + '%' + }, + btnadd() { + const value = Number(this.wxs.slice(0, -1)) + 0.05 + this.wxs = value.toFixed(2) + '%' + }, + // 点击校准电量 + btndian(){ + let data = { + deviceId: this.id, + wxs: this.wxs.slice(0,-1) / 100, + } + this.$u.put('/mch/device/setWxs', data).then(res => { + if (res.code == 200) { + this.jiaozhunflag = false + uni.showToast({ + title: '校准成功', + icon: 'success', + duration: 2000 + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }, // 点击修改名称 btnxgname(){ this.xgname = this.deviceInfo.deviceName @@ -581,9 +641,13 @@ }, // 自定义返回 btns(){ - uni.reLaunch({ - url:'/pages/index/index' - }) + // if(this.fanhui == 1){ + uni.reLaunch({ + url:'/pages/index/index' + }) + // }else{ + // uni.navigateBack() + // } }, // 商户跳转进行中订单 btnshdd(){ @@ -955,6 +1019,11 @@ getDevice(id) { this.$u.get("/app/device/" + id).then((res) => { if (res.code == 200) { + if(res.data.wxs != null){ + this.wxs = (res.data.wxs * 100).toFixed(2) + '%' + }else{ + this.wxs = 100 + '%' + } this.deviceInfo = res.data this.qrResult = res.data.mac this.modelId = res.data.modelTags @@ -1665,7 +1734,71 @@ page { background-color: #F9F8FF; } - + .dianliang{ + position: fixed; + top: 30%; + left: 50%; + transform: translateX(-50%); + z-index: 3; + width: 680rpx; + height: 733rpx; + .anniu{ + width: 636rpx; + height: 114rpx; + line-height: 114rpx; + text-align: center; + font-weight: 600; + font-size: 40rpx; + color: #FFFFFF; + background: #8883F0; + border-radius: 18rpx 18rpx 18rpx 18rpx; + position: absolute; + top: 570rpx; + left: 50%; + transform:translateX(-50%); + z-index: 2; + } + .shuru{ + position: absolute; + top: 400rpx; + left: 50%; + transform:translateX(-50%); + z-index: 2; + display: flex; + align-items: center; + justify-content: center; + input{ + width: 386rpx; + height: 88rpx; + border-radius: 15rpx 15rpx 15rpx 15rpx; + border: 1rpx solid #808080; + text-align: center; + line-height: 88rpx; + margin: 0 27rpx; + } + image{ + width: 88rpx; + height: 88rpx; + } + } + .bj{ + position: absolute; + top: 0; + left: 0; + z-index: 2; + } + } + .mask { + width: 750rpx; + height: 100vh; + background: #000000; + border-radius: 0rpx 0rpx 0rpx 0rpx; + opacity: 0.2; + z-index: 1; + position: fixed; + top: 0; + left: 0; + } .maskss { width: 750rpx; height: 100vh; diff --git a/pages.json b/pages.json index 835a569..1d18d1d 100644 --- a/pages.json +++ b/pages.json @@ -532,6 +532,17 @@ "transparentTitle": "always", //支付宝 "titlePenetrate": "YES" //支付宝 } + },{ + "path": "hehuoren/shebeixq", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationBarBackgroundColor": "#8883F0", + "navigationBarTextStyle": "#FFFFFF", + "navigationStyle": "custom", + "transparentTitle": "always", //支付宝 + "titlePenetrate": "YES" //支付宝 + } },{ "path": "hehuoren/hhrtx", "style": { diff --git a/pages/daili/index.vue b/pages/daili/index.vue index 94685bf..722fc06 100644 --- a/pages/daili/index.vue +++ b/pages/daili/index.vue @@ -91,7 +91,7 @@ 状态: - 维修中 + 调试中 使用中 diff --git a/pages/index/index.vue b/pages/index/index.vue index 191d541..aedc964 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -2,7 +2,8 @@ - + + @@ -106,17 +107,19 @@ 该店铺暂无设备... - + + + - + - - {{item.deviceName}} - + + {{item.deviceName.length > 5 ? item.deviceName.slice(0,5) + '...' : item.deviceName}} + 蓝牙 @@ -129,14 +132,14 @@ 4G - + 4G 未配网 - 维修中 + 调试中 使用中 @@ -147,16 +150,16 @@ + @clic.stop="todetail(item.deviceId)"> S/N码:{{item.deviceNo}} - 未分配店铺 + @click.stop="todetail(item.deviceId)"> 店铺:{{item.storeName.length > 5 ? item.storeName.slice(0,5) + '...' : item.storeName}} @@ -334,7 +337,9 @@ groupListone:[], groupListsone:[], shoplistone:[], - wateringListone:[] + wateringListone:[], + + } }, onLoad() { @@ -404,6 +409,8 @@ } }, methods: { + + getlists() { this.$u.get(`/app/device/list?pageNum=${this.pagenum - 1}&pageSize=${this.pagesize}&orderByColumn=${this.pxzt}&isAsc=${this.pxdaoxu}&storeId=${this.storeId == null ? '' : this.storeId}&keyword=${this.keyword}`).then((res) => { if (res.code == 200) { @@ -1418,7 +1425,7 @@ }, todetail(id) { uni.navigateTo({ - url: '/page_user/sbdetail?id=' + id + url: '/page_user/sbdetail?id=' + id + '&fanhui=' + 1 }) }, // 跳转到抄表 @@ -1433,6 +1440,8 @@