This commit is contained in:
weicw
2023-09-28 21:19:51 +08:00
parent 81ecfd9df0
commit 0256bd355d
21 changed files with 1025 additions and 596 deletions

View File

@@ -1,5 +1,11 @@
import request from '@/utils/request'
import http from '@/websoft/api/index.js'
import {
fileUrl
} from '@/config.js';
import storage from '@/utils/storage'
import dayjs from "dayjs"
import appConfig from '@/config.js'
// api地址
const api = {
image: 'upload/image'
@@ -16,3 +22,49 @@ export const image = files => {
.catch(reject)
})
}
export const uploadFile = async ({filePath}) => {
// 获取临时凭证
let sts = storage.get('sts');
if(!sts){
const stsRes = await http.get('/oss/getPostForm')
console.log('stsRes: ',stsRes);
sts = stsRes.data
storage.set('sts', sts, 60)
}
const {polocyBase64,signature} = sts;
var suffix = filePath.substring(filePath.lastIndexOf(".")); //.txt
const fileName = dayjs().format('YYYYMMDD') + '/'+ uni.$u.guid() + suffix;
return new Promise((reso, rej) => {
uni.uploadFile({
url: appConfig.fileUrl, // 开发者服务器的URL。
filePath: filePath,
name: 'file', // 必须填file。
formData: {
key: fileName,
'policy': polocyBase64,
'OSSAccessKeyId': 'LTAI5tSZ62sPCvUsLRDDf7fH',
'success_action_status': '200', //让服务端返回200,不然默认会返回204
'signature': signature,
// 'x-oss-security-token': this.stsToken,
},
success: (res) => {
const webUrl = appConfig.fileUrl + '/' + fileName;
reso({data: {url: webUrl,thumb: webUrl}})
},
fail: err => {
rej(err)
}
});
})
}
export const getTempOssToken = () => http.get('/oss/getTempToken')
export default {
uploadFile,
getTempOssToken
}

View File

@@ -1,15 +1,13 @@
module.exports = {
// 系统名称
name: "云芯威BMS",
// 生产环境
// apiUrl: "https://server.gxwebsoft.com/api",
// apiUrl: "https://open.gxwebsoft.com/api",
// 开发环境
// apiUrl: "http://127.0.0.1:8081/api",
apiUrl: "http://127.0.0.1:9090/api",
// apiUrl: "http://chatgpt.wsdns.cn/api",
// apiUrl: "https://yxw.wsdns.cn/api", // 生产环境
apiUrl: "http://127.0.0.1:9090/api", // 开发环境
// apiUrl: "http://1.14.132.108:10050/api",
uploadUrl: 'https://file.wsdns.cn',
fileUrl: 'https://file.wsdns.cn',
fileUrl: 'https://oss-yunxinwei.oss-cn-shenzhen.aliyuncs.com',
// 应用ID
appId: 6,
// 应用秘钥

View File

@@ -1,6 +1,6 @@
{
"name" : "萤火商城2.0",
"appid" : "__UNI__73499CF",
"appid" : "__UNI__C024D17",
"description" : "萤火商城V2.0是2021年全新推出的一款轻量级、高性能、前后端分离的电商系统",
"versionName" : "2.0.6",
"versionCode" : 206,

View File

@@ -1,14 +1,45 @@
{
"_args": [
[
"@dcloudio/types@2.6.12",
"E:\\202308\\yunxinwei-uniapp"
]
],
"_from": "@dcloudio/types@2.6.12",
"_id": "@dcloudio/types@2.6.12",
"_inBundle": false,
"_integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==",
"_location": "/@dcloudio/types",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@dcloudio/types@2.6.12",
"name": "@dcloudio/types",
"version": "2.6.12",
"description": "uni-app types",
"typings": "index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "fxy060608",
"license": "Apache-2.0",
"devDependencies": {
"vue": "^2.6.10"
}
"escapedName": "@dcloudio%2ftypes",
"scope": "@dcloudio",
"rawSpec": "2.6.12",
"saveSpec": null,
"fetchSpec": "2.6.12"
},
"_requiredBy": [
"/luch-request"
],
"_resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz",
"_spec": "2.6.12",
"_where": "E:\\202308\\yunxinwei-uniapp",
"author": {
"name": "fxy060608"
},
"description": "uni-app types",
"devDependencies": {
"vue": "^2.6.10"
},
"license": "Apache-2.0",
"name": "@dcloudio/types",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"typings": "index.d.ts",
"version": "2.6.12"
}

75
node_modules/commander/package.json generated vendored
View File

@@ -1,13 +1,66 @@
{
"name": "commander"
, "version": "1.1.1"
, "description": "the complete solution for node.js command-line programs"
, "keywords": ["command", "option", "parser", "prompt", "stdin"]
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
, "repository": { "type": "git", "url": "https://github.com/visionmedia/commander.js.git" }
, "dependencies": { "keypress": "0.1.x"}
, "devDependencies": { "should": ">= 0.0.1" }
, "scripts": { "test": "make test" }
, "main": "index"
, "engines": { "node": ">= 0.6.x" }
"_args": [
[
"commander@1.1.1",
"E:\\202308\\yunxinwei-uniapp"
]
],
"_development": true,
"_from": "commander@1.1.1",
"_id": "commander@1.1.1",
"_inBundle": false,
"_integrity": "sha512-71Rod2AhcH3JhkBikVpNd0pA+fWsmAaVoti6OR38T76chA7vE3pSerS0Jor4wDw+tOueD2zLVvFOw5H0Rcj7rA==",
"_location": "/commander",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "commander@1.1.1",
"name": "commander",
"escapedName": "commander",
"rawSpec": "1.1.1",
"saveSpec": null,
"fetchSpec": "1.1.1"
},
"_requiredBy": [
"/js"
],
"_resolved": "https://registry.npmmirror.com/commander/-/commander-1.1.1.tgz",
"_spec": "1.1.1",
"_where": "E:\\202308\\yunxinwei-uniapp",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca"
},
"bugs": {
"url": "https://github.com/visionmedia/commander.js/issues"
},
"dependencies": {
"keypress": "0.1.x"
},
"description": "the complete solution for node.js command-line programs",
"devDependencies": {
"should": ">= 0.0.1"
},
"engines": {
"node": ">= 0.6.x"
},
"homepage": "https://github.com/visionmedia/commander.js#readme",
"keywords": [
"command",
"option",
"parser",
"prompt",
"stdin"
],
"main": "index",
"name": "commander",
"repository": {
"type": "git",
"url": "git+https://github.com/visionmedia/commander.js.git"
},
"scripts": {
"test": "make test"
},
"version": "1.1.1"
}

74
node_modules/js-md5/package.json generated vendored
View File

@@ -1,8 +1,41 @@
{
"name": "js-md5",
"version": "0.7.3",
"_args": [
[
"js-md5@0.7.3",
"E:\\202308\\yunxinwei-uniapp"
]
],
"_development": true,
"_from": "js-md5@0.7.3",
"_id": "js-md5@0.7.3",
"_inBundle": false,
"_integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==",
"_location": "/js-md5",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "js-md5@0.7.3",
"name": "js-md5",
"escapedName": "js-md5",
"rawSpec": "0.7.3",
"saveSpec": null,
"fetchSpec": "0.7.3"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmmirror.com/js-md5/-/js-md5-0.7.3.tgz",
"_spec": "0.7.3",
"_where": "E:\\202308\\yunxinwei-uniapp",
"author": {
"name": "Chen, Yi-Cyuan",
"email": "emn178@gmail.com"
},
"bugs": {
"url": "https://github.com/emn178/js-md5/issues"
},
"description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.",
"main": "src/md5.js",
"devDependencies": {
"expect.js": "~0.3.1",
"jsdoc": "^3.4.0",
@@ -12,18 +45,7 @@
"uglify-js": "^3.1.9",
"webworker-threads": "^0.7.11"
},
"scripts": {
"test": "nyc mocha tests/node-test.js",
"report": "nyc --reporter=html --reporter=text mocha tests/node-test.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"doc": "rm -rf doc;jsdoc src README.md -d doc",
"compress": "uglifyjs src/md5.js -c -m eval --comments --output build/md5.min.js",
"build": "npm run-script compress;npm run-script doc"
},
"repository": {
"type": "git",
"url": "https://github.com/emn178/js-md5.git"
},
"homepage": "https://github.com/emn178/js-md5",
"keywords": [
"md5",
"hash",
@@ -32,14 +54,24 @@
"HMAC"
],
"license": "MIT",
"author": "Chen, Yi-Cyuan <emn178@gmail.com>",
"homepage": "https://github.com/emn178/js-md5",
"bugs": {
"url": "https://github.com/emn178/js-md5/issues"
},
"main": "src/md5.js",
"name": "js-md5",
"nyc": {
"exclude": [
"tests"
]
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/emn178/js-md5.git"
},
"scripts": {
"build": "npm run-script compress;npm run-script doc",
"compress": "uglifyjs src/md5.js -c -m eval --comments --output build/md5.min.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"doc": "rm -rf doc;jsdoc src README.md -d doc",
"report": "nyc --reporter=html --reporter=text mocha tests/node-test.js",
"test": "nyc mocha tests/node-test.js"
},
"version": "0.7.3"
}

44
node_modules/js/package.json generated vendored
View File

@@ -1,12 +1,44 @@
{
"name": "js",
"description": "A better `node -p`.",
"author": "Marco Aurelio <thecoreh@gmail.com>",
"version": "0.1.0",
"_args": [
[
"js@0.1.0",
"E:\\202308\\yunxinwei-uniapp"
]
],
"_development": true,
"_from": "js@0.1.0",
"_id": "js@0.1.0",
"_inBundle": false,
"_integrity": "sha512-ZBbGYOpact8QAH9RprFWL4RAESYwbDodxiuDjOnzwzzk9pBzKycoifGuUrHHcDixE/eLMKPHRaXenTgu1qXBqA==",
"_location": "/js",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "js@0.1.0",
"name": "js",
"escapedName": "js",
"rawSpec": "0.1.0",
"saveSpec": null,
"fetchSpec": "0.1.0"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmmirror.com/js/-/js-0.1.0.tgz",
"_spec": "0.1.0",
"_where": "E:\\202308\\yunxinwei-uniapp",
"author": {
"name": "Marco Aurelio",
"email": "thecoreh@gmail.com"
},
"bin": {
"js": "./bin/js"
"js": "bin/js"
},
"dependencies": {
"commander": "~1.1.1"
}
},
"description": "A better `node -p`.",
"name": "js",
"version": "0.1.0"
}

61
node_modules/keypress/package.json generated vendored
View File

@@ -1,20 +1,57 @@
{
"name": "keypress",
"version": "0.1.0",
"_args": [
[
"keypress@0.1.0",
"E:\\202308\\yunxinwei-uniapp"
]
],
"_development": true,
"_from": "keypress@0.1.0",
"_id": "keypress@0.1.0",
"_inBundle": false,
"_integrity": "sha512-x0yf9PL/nx9Nw9oLL8ZVErFAk85/lslwEP7Vz7s5SI1ODXZIgit3C5qyWjw4DxOuO/3Hb4866SQh28a1V1d+WA==",
"_location": "/keypress",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "keypress@0.1.0",
"name": "keypress",
"escapedName": "keypress",
"rawSpec": "0.1.0",
"saveSpec": null,
"fetchSpec": "0.1.0"
},
"_requiredBy": [
"/commander"
],
"_resolved": "https://registry.npmmirror.com/keypress/-/keypress-0.1.0.tgz",
"_spec": "0.1.0",
"_where": "E:\\202308\\yunxinwei-uniapp",
"author": {
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net",
"url": "http://tootallnate.net"
},
"bugs": {
"url": "https://github.com/TooTallNate/keypress/issues"
},
"description": "Make any Node ReadableStream emit \"keypress\" events",
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/keypress.git"
},
"homepage": "https://github.com/TooTallNate/keypress#readme",
"keywords": [
"keypress",
"readline",
"core"
],
"license": "MIT"
"license": "MIT",
"main": "index.js",
"name": "keypress",
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/keypress.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.1.0"
}

View File

@@ -1,68 +1,38 @@
{
"name": "luch-request",
"version": "3.0.8",
"description": "基于Promise实现uni-app request 请求插件",
"keywords": [
"uni-app",
"request",
"Promise",
"luch",
"luch-request"
"_args": [
[
"luch-request@3.0.8",
"E:\\202308\\yunxinwei-uniapp"
]
],
"main": "src/lib/luch-request.js",
"scripts": {
"dev": "rollup -c",
"watch": "rollup -c -w",
"build": "rimraf DCloud && rollup -c --environment NODE_ENV:production",
"zipD": "node node/zipDCloudPlugin.js && node node/zipDCloudDemo.js",
"docs": "vuepress dev docs",
"docs:build": "vuepress build docs",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -w -r 0",
"pub": "npm publish && cnpm sync luch-request",
"pub:alpha": "npm publish --tag=alpha && cnpm sync luch-request",
"test": "echo \"Error: no test specified\" && exit 1"
"_from": "luch-request@3.0.8",
"_id": "luch-request@3.0.8",
"_inBundle": false,
"_integrity": "sha512-5ZVp1y4tFaizbGMOuQwbeyfHnf4PhQAwQ3S1Fm1tS7juMoB14pXslxWriElhiSq6ytYYW0KVC8RShfHiNujFcQ==",
"_location": "/luch-request",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "luch-request@3.0.8",
"name": "luch-request",
"escapedName": "luch-request",
"rawSpec": "3.0.8",
"saveSpec": null,
"fetchSpec": "3.0.8"
},
"repository": {
"type": "git",
"url": "https://github.com/lei-mu/luch-request.git"
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/luch-request/-/luch-request-3.0.8.tgz",
"_spec": "3.0.8",
"_where": "E:\\202308\\yunxinwei-uniapp",
"author": {
"name": "luch"
},
"author": "luch",
"license": "MIT",
"bugs": {
"url": "https://github.com/lei-mu/luch-request/issues"
},
"homepage": "https://www.quanzhan.co/luch-request/",
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-arrow-functions": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"@vuepress/plugin-active-header-links": "^1.5.0",
"@vuepress/plugin-pwa": "^1.5.2",
"archiver": "^4.0.1",
"babel-eslint": "^10.1.0",
"babel-preset-es2015": "^6.24.1",
"commitizen": "^4.2.4",
"conventional-changelog-cli": "^2.1.1",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^6.8.0",
"grunt": "^1.1.0",
"grunt-babel": "^8.0.0",
"load-grunt-tasks": "^5.1.0",
"node-zip": "^1.1.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-live-server": "^1.0.3",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.4",
"rollup-plugin-zip": "^1.0.0",
"validate-commit-msg": "^2.14.0",
"vuepress": "^1.4.1"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
@@ -102,5 +72,65 @@
},
"dependencies": {
"@dcloudio/types": "^2.0.16"
}
},
"description": "基于Promise实现uni-app request 请求插件",
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-arrow-functions": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"@vuepress/plugin-active-header-links": "^1.5.0",
"@vuepress/plugin-pwa": "^1.5.2",
"archiver": "^4.0.1",
"babel-eslint": "^10.1.0",
"babel-preset-es2015": "^6.24.1",
"commitizen": "^4.2.4",
"conventional-changelog-cli": "^2.1.1",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^6.8.0",
"grunt": "^1.1.0",
"grunt-babel": "^8.0.0",
"load-grunt-tasks": "^5.1.0",
"node-zip": "^1.1.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-live-server": "^1.0.3",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.4",
"rollup-plugin-zip": "^1.0.0",
"validate-commit-msg": "^2.14.0",
"vuepress": "^1.4.1"
},
"homepage": "https://www.quanzhan.co/luch-request/",
"keywords": [
"uni-app",
"request",
"Promise",
"luch",
"luch-request"
],
"license": "MIT",
"main": "src/lib/luch-request.js",
"name": "luch-request",
"repository": {
"type": "git",
"url": "git+https://github.com/lei-mu/luch-request.git"
},
"scripts": {
"build": "rimraf DCloud && rollup -c --environment NODE_ENV:production",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -w -r 0",
"dev": "rollup -c",
"docs": "vuepress dev docs",
"docs:build": "vuepress build docs",
"pub": "npm publish && cnpm sync luch-request",
"pub:alpha": "npm publish --tag=alpha && cnpm sync luch-request",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "rollup -c -w",
"zipD": "node node/zipDCloudPlugin.js && node node/zipDCloudDemo.js"
},
"version": "3.0.8"
}

68
package-lock.json generated
View File

@@ -1,67 +1,6 @@
{
"name": "yunxinwei-app",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"luch-request": "^3.0.8"
},
"devDependencies": {
"js": "^0.1.0",
"js-md5": "^0.7.3"
}
},
"node_modules/@dcloudio/types": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz",
"integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ=="
},
"node_modules/commander": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/commander/-/commander-1.1.1.tgz",
"integrity": "sha512-71Rod2AhcH3JhkBikVpNd0pA+fWsmAaVoti6OR38T76chA7vE3pSerS0Jor4wDw+tOueD2zLVvFOw5H0Rcj7rA==",
"dev": true,
"dependencies": {
"keypress": "0.1.x"
},
"engines": {
"node": ">= 0.6.x"
}
},
"node_modules/js": {
"version": "0.1.0",
"resolved": "https://registry.npmmirror.com/js/-/js-0.1.0.tgz",
"integrity": "sha512-ZBbGYOpact8QAH9RprFWL4RAESYwbDodxiuDjOnzwzzk9pBzKycoifGuUrHHcDixE/eLMKPHRaXenTgu1qXBqA==",
"dev": true,
"dependencies": {
"commander": "~1.1.1"
},
"bin": {
"js": "bin/js"
}
},
"node_modules/js-md5": {
"version": "0.7.3",
"resolved": "https://registry.npmmirror.com/js-md5/-/js-md5-0.7.3.tgz",
"integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==",
"dev": true
},
"node_modules/keypress": {
"version": "0.1.0",
"resolved": "https://registry.npmmirror.com/keypress/-/keypress-0.1.0.tgz",
"integrity": "sha512-x0yf9PL/nx9Nw9oLL8ZVErFAk85/lslwEP7Vz7s5SI1ODXZIgit3C5qyWjw4DxOuO/3Hb4866SQh28a1V1d+WA==",
"dev": true
},
"node_modules/luch-request": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/luch-request/-/luch-request-3.0.8.tgz",
"integrity": "sha512-5ZVp1y4tFaizbGMOuQwbeyfHnf4PhQAwQ3S1Fm1tS7juMoB14pXslxWriElhiSq6ytYYW0KVC8RShfHiNujFcQ==",
"dependencies": {
"@dcloudio/types": "^2.0.16"
}
}
},
"lockfileVersion": 1,
"dependencies": {
"@dcloudio/types": {
"version": "2.6.12",
@@ -77,6 +16,11 @@
"keypress": "0.1.x"
}
},
"dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"js": {
"version": "0.1.0",
"resolved": "https://registry.npmmirror.com/js/-/js-0.1.0.tgz",

View File

@@ -1,5 +1,6 @@
{
"dependencies": {
"dayjs": "^1.11.10",
"luch-request": "^3.0.8"
},
"devDependencies": {

View File

@@ -8,6 +8,12 @@
</view>
<u-form :label-width="200" :model="form" ref="uForm">
<u-form-item left-icon="info-circle" label="设备状态">
<view class="item-right">{{ form.workingStatus }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="bms状态">
<view class="item-right">{{ form.bms }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="剩余电量">
<view class="item-right">{{ form.surplusPower }}</view>
</u-form-item>
@@ -20,21 +26,21 @@
<u-form-item left-icon="info-circle" label="GSM信号">
<view class="item-right">{{ form.gsm }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="设备电流">
<!-- <u-form-item left-icon="info-circle" label="设备电流">
<view class="item-right">{{ form.equipmentCurrent }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="标称容量">
<view class="item-right">{{ form.nominalCapacity }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="设备温度">
</u-form-item> -->
<!-- <u-form-item left-icon="info-circle" label="设备温度">
<view class="item-right">{{ form.equipmentTemperature }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="电池温度">
<view class="item-right">{{ form.batteryTemperature }}</view>
</u-form-item>
</u-form-item> -->
</u-form>
</view>
<view class="address-item">
<!-- <view class="address-item">
<u-row gutter="16" justify="center">
<u-col span="4">
<view class="demo-layout bg-purple">
@@ -55,7 +61,7 @@
</view>
</u-col>
</u-row>
</view>
</view> -->
<view class="address-item">
<view class="head-info">
<view class="title">电芯电压</view>

View File

@@ -26,6 +26,7 @@
<view class="bind-content">
<input v-model="bindValue" class="input" @confirm="onSearch" focus="true" placeholder="请输入设备编号"
type="text"></input>
<!-- <u-icon @click="scanImage" name="scan"></u-icon> -->
</view>
<view class="submit">
<u-button type="error" @click="doEquipment(true)">确定更换电池</u-button>
@@ -425,6 +426,7 @@
padding: 0 10rpx;
border: 1rpx solid #eee;
font-size: 24rpx;
display: flex;
.image {
display: block;

View File

@@ -6,17 +6,17 @@
<view class="info">
<text class="goods-name">{{ record.equipmentName }}</text>
<!-- <text class="goods-desc">归属门店{{ record.merchantName }}</text> -->
<text class="goods-desc">电池型号{{ record.batteryModel }}</text>
<text class="goods-desc">电池编号{{ record.equipmentCode }}</text>
<text class="goods-desc">是否激活{{ record.isCtive == 0 ? '已激活' : '未激活' }}</text>
<text class="goods-desc">BMS{{ record.bms }}</text>
<text class="goods-desc">工作状态{{ record.workingStatus }}</text>
<text class="goods-desc">租赁状态{{ record.leaseStatus }}</text>
<text class="goods-desc">电池状态{{ record.batteryStatus }}</text>
<text class="goods-desc">电池电量{{ record.batteryPower }}</text>
<text class="goods-desc">是否在线{{ record.isOnline }}</text>
<text class="goods-desc">总电压{{ record.totalVoltage }}</text>
<text class="goods-desc">剩余容量{{ record.surplusCapacity }}</text>
<text class="goods-desc">电池型号{{ record.batteryModel || '' }}</text>
<text class="goods-desc">电池编号{{ record.equipmentCode || '' }}</text>
<text class="goods-desc">是否激活{{ record.isCtive || '' }}</text>
<text class="goods-desc">BMS{{ record.bms || ''}}</text>
<text class="goods-desc">设备状态{{ record.workingStatus || ''}}</text>
<text class="goods-desc">租赁状态{{ record.userId > 0?'在租': '闲置' }}</text>
<text class="goods-desc">电池状态{{ record.batteryStatus || '' }}</text>
<text class="goods-desc">电池电量{{ record.batteryPower || '' }}</text>
<text class="goods-desc">是否在线{{ record.isOnline || '' }}</text>
<text class="goods-desc">总电压{{ record.totalVoltage || '' }}</text>
<text class="goods-desc">剩余容量{{ record.surplusCapacity || '' }}</text>
@@ -27,6 +27,12 @@
<view class="submit">
<u-button type="primary" @click="onBuy">立即购买</u-button>
</view>
<uni-data-picker ref="equipmenPicker" v-model="orderId" @change="confirmReplace" placeholder="请选择需要更换的旧电池" popup-title="请选择需要更换的旧电池" :localdata="equipments" :map="{text:'equipmentCode',value:'orderId'}">
<view class="submit">
<u-button type="warning" @click="onReplace">更换电池</u-button>
</view>
</uni-data-picker>
<!-- <view class="submit">
<u-button type="success" :disabled="agree" @click="copyCode(record.equipmentCode)">复制设备编号</u-button>
</view> -->
@@ -34,6 +40,8 @@
<u-button type="success" :disabled="agree" @click="gohome">返回首页</u-button>
</view>
</view>
</template>
@@ -46,6 +54,7 @@
import { addOrder } from '@/websoft/api/order.js'
import { createOrderNo } from '@/utils/util.js'
import store from '../../store';
import * as EquipmentApi from '@/websoft/api/equipment.js'
export default {
components: {
// Search
@@ -68,11 +77,16 @@
batteryDeposit: 300,
batteryInsurance: 0
},
showEquipments: false,
equipments: [
],
orderId: null
}
},
onLoad(option) {
const app = this
app.getMyEquipments()
// 记录当前选择的门店ID
console.log("option: ",option);
app.equipmentId = Number(option.equipmentId)
@@ -92,6 +106,13 @@
console.log("res2222: ", app.record);
})
},
getMyEquipments() {
const app = this
EquipmentApi.pageEquipment({userId: uni.getStorageSync('userId')}).then(res => {
console.log("res: ",res);
app.equipments = res.data.list
})
},
gohome(){
uni.reLaunch({
url: '/pages/index/index'
@@ -156,7 +177,57 @@
const app = this
const { equipmentId } = this
this.$navTo('pages/merchant/merchant', { equipmentId })
}
},
onReplace() {
console.log("点击更换电池");
const app = this
if(this.record.userId > 0) {
uni.showToast({
title: '该电池已经被别人租走了',
icon: 'none'
})
}else if(app.equipments.length == 0) {
uni.showToast({
title: '你没有可更换的电池',
icon: 'none'
})
}else {
this.$refs.equipmenPicker.show()
this.showEquipments = true
}
},
confirmReplace(e) {
const app = this
uni.showModal({
title: '提示',
content: `确认更换此电池?`,
success: (res) => {
if(res.confirm) {
app.doEquipment()
}
}
})
console.log(e);
},
doEquipment(canReset = false) {
const app = this
const {
equipmentId,
equipmentCode,
} = app.record
EquipmentApi.changeEquipment({
equipmentCode,
equipmentId,
orderId: app.orderId
}).then(result => {
app.$success(result.message)
app.getEquipment()
app.getMyEquipments()
}).catch(err => {
app.$error(err.message)
})
},
}
}

View File

@@ -94,13 +94,24 @@
// my.alert({ title: res.code });
// }
// })
my.scan({
scanType: ['barCode'],
my.ap.openAlipayApp({
appCode: 'alipayScan',
success: res => {
console.log("res: ",res);
my.alert({ title: res.code });
console.log('openAlipayApp success', res);
},
fail: err => {
console.log('openAlipayApp fail', err);
}
});
// my.scan({
// scanType: ['qrCode'],
// autoDecodeCharset: true,
// success: res => {
// console.log("res: ",res);
// my.ap.openAlipayApp()
// },
// });
}
}
}
@@ -138,7 +149,12 @@
}
.bottom-bar{
position: fixed;
/* #ifdef H5 */
bottom: 100rpx;
/* #endif */
/* #ifndef H5 */
bottom: 10rpx;
/* #endif */
left: 25rpx;
z-index: 1000;
line-height: 70rpx;

View File

@@ -54,7 +54,7 @@
<script>
import {
uploadFile
} from '@/websoft/api/upload.js'
} from '@/api/upload'
import {
pageOrder,
removeOrder,
@@ -66,6 +66,7 @@
export default {
data() {
return {
form: {},
order: {},
orderSourceData: [],
// 按钮禁用
@@ -130,13 +131,14 @@
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(chooseImageRes) {
const tempFilePaths = chooseImageRes.tempFilePaths;
uploadFile({
filePath: tempFilePaths[0],
fileType: 'image',
name: 'file'
}).then(res => {
console.log("res: ", res);
app.orderSourceData.push(fileUrl + res.data.path)
app.orderSourceData.push(res.data.url)
receiptOrder({
orderId,
orderSourceData: JSON.stringify(app.orderSourceData)

View File

@@ -31,11 +31,11 @@
</block>
</view>
<view class="status-text">
<text class="state-text" v-if="order.payStatus == 10">待支付</text>
<text class="state-text" v-if="order.payStatus == 20 && order.receiptStatus == 10">绑定</text>
<text class="state-text" v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && order.receiptStatus == 20">已完成</text>
<text class="state-text" v-if="order.receiptStatus == 21">退租</text>
<text class="state-text" v-if="order.receiptStatus == 30">已退租</text>
<text class="state-text" v-if="order.payStatus == 20 && (order.receiptStatus == 30 || order.currPeriods >= order.periods)">已完成</text>
<text class="state-text" v-else-if="order.payStatus == 10">支付</text>
<text class="state-text" v-else-if="order.payStatus == 20 && order.receiptStatus == 10">待绑定</text>
<text class="state-text" v-else-if="order.orderStatus == 30 && order.receiptStatus == 20">进行</text>
<text class="state-text" v-else-if="order.receiptStatus == 21">进行中</text>
<!-- <text>{{ order.stateText }}</text> -->
</view>
</view>
@@ -215,6 +215,12 @@
</view>
</view>
</block>
<view class="info-item">
<view class="item-lable">可用天数</view>
<view class="item-content">
<text>{{ Math.abs(order.expirationDay) }}天</text>
</view>
</view>
<block v-if="equipmentGoods.equipmentCategory == '40'">
<view class="info-item">
<view class="item-lable">下单方式</view>
@@ -369,10 +375,11 @@
<!-- 续费订单 -->
<view class="trade-info i-card">
<view class="info-item" v-if="equipmentGoods.equipmentCategory != '40'">
<view class="info-item" v-if="order.orderSource != 10">
<view class="item-lable">当前期数</view>
<view class="item-content">
<text>第 {{ renewOrderList.length + 1 }} 期</text>
<text v-if="order.orderSource == 20">首期</text>
<text v-else>第 1 期</text>
</view>
</view>
<view class="info-item">
@@ -411,6 +418,10 @@
<text>+¥{{ orderPrice3 }}</text>
</view>
</view>
<view class="info-item">
<view class="item-lable">付款时间</view>
<view class="item-content">{{ order.payTime }}</view>
</view>
<view class="info-item"
v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && equipmentGoods.equipmentCategory != '10'">
<view class="item-lable">到期时间</view>
@@ -420,12 +431,7 @@
{{ Math.abs(order.expirationDay) }}天)</text>
</view>
</view>
<view class="info-item">
<view class="item-lable">可用天数</view>
<view class="item-content">
<text>{{ Math.abs(order.expirationDay) }}天</text>
</view>
</view>
<!-- <view v-if="order.updatePrice.value != '0.00'" class="info-item">
<view class="item-lable">后台改价</view>
@@ -443,10 +449,10 @@
</view>
</view>
</view>
<view class="renew-divider">-- 历史订单 --</view>
<view class="renew-divider">-- 续费订单 --</view>
<view class="renew-order" v-if="renewOrderList.length > 0 && equipmentGoods.equipmentCategory != '10' ">
<!-- 首付 -->
<!-- <view class="trade-info i-card " v-for="(item,index) in renewOrderList" :key="index" v-if="index == 0">
<!-- 首付 -->
<!-- <view class="trade-info i-card " v-for="(item,index) in renewOrderList" :key="index" v-if="index == 0">
<view class="info-item" v-if="equipmentGoods.equipmentCategory != '40'">
<view class="item-lable">期数</view>
<view class="item-content">
@@ -485,10 +491,11 @@
</view>
</view> -->
<view class="trade-info i-card " v-for="(item,index) in renewOrderList" :key="index">
<view class="info-item" v-if="equipmentGoods.equipmentCategory != '40'">
<view class="item-lable">期数</view>
<view class="info-item" v-if="order.orderSource != 10">
<view class="item-lable">当前期数</view>
<view class="item-content">
<text>第 {{ index + 1 }} 期</text>
<text v-if="order.orderSource == 20">第 {{ index + 1}} 期</text>
<text v-else>第 {{ index + 2}} 期</text>
</view>
</view>
<view class="info-item">
@@ -557,7 +564,7 @@
<view class="btn-wrapper">
<!-- 未支付取消订单 -->
<block v-if="order.payStatus == PayStatusEnum.PENDING.value">
<view class="btn-item" @click="onCancel(order.orderId)">取消</view>
<view class="btn-item" @click="onCancel(order.orderId)">取消订单</view>
</block>
<!-- 已支付进行中的订单 -->
<block v-if="order.orderStatus != OrderStatusEnum.APPLY_CANCEL.value">
@@ -586,14 +593,16 @@
<view class="btn-item active" @click="onReceipt(order.orderId)">确认收货</view>
</block>
<!-- 订单评价 -->
<block v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && order.isComment == 0 && order.receiptStatus != 30">
<block
v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && order.isComment == 0 && order.receiptStatus != 30">
<view class="btn-item" @click="handleTargetEquipment(order.equipmentId)">查看电池</view>
<view class="btn-item" @click="handleHireEquipment(order.orderId)"
v-if="equipmentGoods.equipmentCategory != '10' && !orderEnd">我要续费</view>
<view class="btn-item" @click="handleRentingOut(order)"
v-if="equipmentGoods.equipmentCategory != '10' && order.receiptStatus != 21">我要退租</view>
<view class="btn-item" @click="handleRentingOut(order)"
v-if="equipmentGoods.equipmentCategory != '10' && order.receiptStatus == 21 && !orderEnd">取消退租</view>
v-if="equipmentGoods.equipmentCategory != '10' && order.receiptStatus == 21 && !orderEnd">取消退租
</view>
</block>
</view>
</view>
@@ -710,8 +719,7 @@
}) {
// 当前订单ID
this.orderId = orderId
// 获取当前订单信息
this.getOrderDetail()
// 注册全局事件订阅: 是否刷新当前订单数据
uni.$on('syncRefreshOrder', (val, isCur) => {
if (!isCur) {
@@ -724,7 +732,7 @@
* 生命周期函数--监听页面显示
*/
onShow() {
this.canReset && this.getOrderDetail()
this.getOrderDetail()
this.canReset = false
},
@@ -808,8 +816,12 @@
})
.then(res => {
console.log(res);
res.data.sort((a,b) => {
return new Date(a.createTime.replace(/-/gi, '/')) - new Date(b.createTime.replace(/-/gi, '/'))
})
app.renewOrderList = res.data;
if(res.data.length >= app.equipmentGoods.periods){
if (res.data.length >= app.equipmentGoods.periods && (this.order.orderSource == 20 || this
.order.orderSource == 30)) {
app.orderEnd = true
}
// 计算逾期
@@ -942,17 +954,33 @@
orderId
})
},
handleRentingOut(order){
const { orderId,equipmentId } = order
EquipmentApi.rentingOut({orderId,equipmentId}).then(res => {
this.$success(res.message)
setTimeout(() => {
// 刷新当前订单数据
app.getOrderDetail(true)
}, 1500)
}).catch(err => {
this.$success(err.message)
handleRentingOut(order) {
const app = this
uni.showModal({
title: '提示',
content: '是否退租',
success: (result) => {
if(result.confirm) {
const {
orderId,
equipmentId
} = order
EquipmentApi.rentingOut({
orderId,
equipmentId
}).then(res => {
this.$success(res.message)
setTimeout(() => {
// 刷新当前订单数据
app.getOrderDetail(true)
}, 1500)
}).catch(err => {
this.$success(err.message)
})
}
}
})
},
// 跳转到设备详情页
@@ -986,7 +1014,7 @@
orderSource: order.orderSource,
orderSourceId: order.goodsId,
equipmentId: order.equipmentId,
dealerPhone:order.dealerPhone,
dealerPhone: order.dealerPhone,
comments: '续租订单' + order.orderNo
}).then(res => {
const {
@@ -1413,6 +1441,7 @@
align-items: center;
font-size: 26rpx;
color: #333;
.act-copy {
margin-left: 20rpx;
padding: 2rpx 20rpx;
@@ -1444,7 +1473,8 @@
font-size: 26rpx;
color: #333;
text-align: right;
.expirat-time-box{
.expirat-time-box {
display: flex;
flex-direction: column;
}
@@ -1477,7 +1507,7 @@
.renew-order {
display: flex;
flex-direction: column-reverse;
flex-direction: column;
}
// 底部操作栏
@@ -1579,7 +1609,8 @@
color: #ff0000;
padding-left: 10rpx
}
.renew-divider{
.renew-divider {
padding: 30rpx 0;
text-align: center;
color: #666666;

View File

@@ -13,11 +13,12 @@
<text class="order-time">{{ item.merchantName }}</text>
</view>
<view class="item-top-right">
<text class="state-text" v-if="item.payStatus == 10">待支付</text>
<text class="state-text" v-if="item.payStatus == 20 && item.receiptStatus == 10">绑定</text>
<text class="state-text" v-if="item.orderStatus == 30 && item.receiptStatus == 20">已完成</text>
<text class="state-text" v-if="item.receiptStatus == 21">退租</text>
<text class="state-text" v-if="item.receiptStatus == 30">已退租</text>
<text class="state-text" v-if="item.payStatus == 20 && (item.receiptStatus == 30 || item.currPeriods >= item.periods)">已完成</text>
<text class="state-text" v-else-if="item.payStatus == 10">支付</text>
<text class="state-text" v-else-if="item.payStatus == 20 && item.receiptStatus == 10">待绑定</text>
<text class="state-text" v-else-if="item.orderStatus == 30 && item.receiptStatus == 20">进行</text>
<text class="state-text" v-else-if="item.receiptStatus == 21">进行中</text>
</view>
</view>
<!-- 商品列表 -->
@@ -115,6 +116,12 @@
<!-- <view class="btn-item" v-if="item.equipmentGoods.equipmentCategory == '锂电池租赁' || item.equipmentGoods.equipmentCategory == '电动车租赁'" @click="handleTargetDetail(item.orderId)">续费</view> -->
<view class="btn-item" @click="handleTargetDetail(item.orderId)">详情</view>
</block>
<block
v-if="item.orderStatus == OrderStatusEnum.COMPLETED.value && item.isComment == 0 && item.receiptStatus != 30">
<view class="btn-item" @click="handleTargetDetail(item.orderId)"
v-if="item.equipmentGoods.equipmentCategory != '10' && !orderEnd">我要续费 </view>
</block>
</view>
</view>
</view>
@@ -181,7 +188,8 @@
import {
pageOrder,
removeOrder,
receiptOrder
receiptOrder,
addOrder
} from '@/websoft/api/order.js'
import {
bindEquipment
@@ -190,7 +198,9 @@
uploadFile
} from '@/websoft/api/upload.js'
import { fileUrl } from '@/config.js';
import {
createOrderNo,dateFormat
} from '@/utils/util.js'
// 每页记录数量
const pageSize = 15
@@ -201,12 +211,18 @@
}, {
name: `待支付`,
value: 'payment'
}, {
},
{
name: `待绑定`,
value: 'delivery'
}, {
name: `已完成`,
},
{
name: `进行中`,
value: 'comment'
},
{
name: `已完成`,
value: 'refund'
}]
export default {
@@ -321,7 +337,6 @@
// })
// .catch(() => app.mescroll.endErr())
},
// 获取订单列表
getOrderList(pageNo = 1) {
const app = this
@@ -343,11 +358,11 @@
}
if (curTab == 3) {
app.where.payStatus = 20;
app.where.receiptStatus = 20;
app.where.orderStatus = 30;
}
if (curTab == 4) {
app.where.receiptStatus = 20;
app.where.isComment = 0;
app.where.payStatus = 20;
app.where.orderStatus = 40;
}
app.where.userId = uni.getStorageSync('userId');
app.where.isRenew = 0;

View File

@@ -1,29 +1,62 @@
<template>
<view>
<uni-list>
<uni-list-item :key="index" v-for="(item, index) in dataList" :title="`订单号:${item.orderNo}`"
:note="`${orderType[item.scene]}:+ ${item.money}元`" :rightText="item.createTime"></uni-list-item>
</uni-list>
<view class="cell" :key="index" v-for="(item, index) in dataList">
<view class="cell-top">
<view class="title"> {{`订单号:${item.orderNo}`}}</view>
<view class="time"> {{item.createTime}}</view>
</view>
<view cell-desc>
<view class="cell-desc-item">
{{`${orderType[item.scene]}:+ ${item.money}`}}
</view>
<view class="cell-desc-item">
门店名称:{{item.merchantName }}
</view>
<view class="cell-desc-item">
下单方式:{{ orderSource[item.orderSource] }}<text v-if="item.orderSource == 20 || item.orderSource == 30 "> {{item.isRenew?'续费':'首期'}}</text>
</view>
<view class="cell-desc-item">
设备编号:{{item.equipmentCode }}
</view>
</view>
</view>
<empty v-if="dataList.length == 0"></empty>
<!-- <uni-list>
<uni-list-item :title=""
:note="`${orderType[item.scene]}:+ ${item.money}元`" :rightText="item.createTime">
</uni-list-item>
</uni-list> -->
</view>
</template>
<script>
import * as LogApi from '@/api/shop/profitLog.js'
import {mapGetters} from 'vuex'
import {
mapGetters
} from 'vuex'
import storage from '../../../utils/storage';
import Empty from '@/components/empty'
export default {
components: {Empty},
data() {
return {
dataList: [],
hasMore: true,
page: 1,
limit: 10,
where: {
},
orderType:{
limit: 20,
where: {},
orderType: {
1: "投资收益",
3: "推广收益",
4: "门店收益",
5: "门店业绩",
5: "区域经理收益",
},
orderSource: {
10: "销售",
20: "分期",
30: "以租代购",
40: "租赁",
}
};
},
@@ -38,17 +71,20 @@
LogApi.list({
page: this.page,
limit: this.limit,
userId: this.userId
userId: storage.get("userId")
}).then(res => {
if(res.code == 0){
if (res.code == 0) {
res.data.list.forEach(item => {
item.createTime = this.$u.timeFormat(item.createTime, 'yyyy-mm-dd');
item.createTime = item.createTime.replace(/-/gi, '/')
item.createTime = this.$u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM');
})
this.dataList.push(...res.data.list)
this.hasMore = this.dataList.length < res.data.count
}
}).finally(()=>{
}).finally(() => {
uni.stopPullDownRefresh()
})
},
@@ -63,8 +99,8 @@
this.hasMore = true
},
onReachBottom() {
if(this.hasMore){
this.page ++
if (this.hasMore) {
this.page++
this.queryList();
}
}
@@ -72,5 +108,21 @@
</script>
<style lang="scss">
.cell{
padding: 27rpx 30rpx;
&-top {
display: flex;
justify-content: space-between;
align-items: center;
}
border-bottom: solid #e8e8e8 1px;
}
.title{
font-size: 28rpx;
}
.time {
font-size: 24rpx;
color: #999;
}
</style>

View File

@@ -1,38 +1,41 @@
<template>
<view class="container" :style="appThemeStyle">
<view class="addres-list">
<view class="address-item" v-for="(item, index) in list" :key="index">
<view class="title">
<text>设备编号{{ item.equipmentCode }}</text>
<u-tag v-if="item.isCtive == '已激活'" :text="item.isCtive" plain size="mini" type="success"></u-tag>
<u-tag v-else :text="item.isCtive" plain size="mini" type="warning"></u-tag>
</view>
<view class="line"></view>
<view class="contacts">
<view class="bms-info">
<text class="item">电池型号{{ item.batteryModel }}</text>
<text class="item">BMS模块{{ item.bms }}</text>
<text class="item">工作状态{{ item.workingStatus }}</text>
<text class="item">电池状态健康</text>
</view>
<view class="bms-image">
<view class="bms-image-box">
<image class="image" src="/static/battery.png"></image>
<text class="bms-image-fbf">67%</text>
<view class="container" :style="appThemeStyle">
<view class="addres-list">
<view class="address-item" v-for="(item, index) in list" :key="index">
<view class="title">
<text>设备编号{{ item.equipmentCode }}</text>
<u-tag v-if="item.isCtive == '已激活'" :text="item.isCtive" plain size="mini" type="success"></u-tag>
<u-tag v-else :text="item.isCtive" plain size="mini" type="warning"></u-tag>
</view>
<u-tag text="离线" plain size="mini" type="info"></u-tag>
</view>
</view>
<view class="line"></view>
<view class="item-option">
<view class="_left">
<u-icon label="操作" size="40" name="map" @click="navTo('package/user/equipment/operation?equipmentId='+item.equipmentId)"></u-icon>
</view>
<view class="line-align"></view>
<view class="_right">
<view class="events">
<u-icon label="详情" size="40" name="file-text" @click="navTo('package/user/equipment/detail?equipmentId='+item.equipmentId)"></u-icon>
<!-- <view class="event-item" @click="handleUpdate(item.address_id)">
<view class="line"></view>
<view class="contacts">
<view class="bms-info">
<text class="item">电池型号{{ item.batteryModel }}</text>
<text class="item">BMS模块{{ item.bms }}</text>
<text class="item">工作状态{{ item.workingStatus }}</text>
<text class="item">设备电压{{ item.totalVoltage }}</text>
<text class="item">剩余电量{{ item.batteryPower }}</text>
</view>
<view class="bms-image">
<view class="bms-image-box">
<image class="image" src="/static/battery.png"></image>
<text class="bms-image-fbf">{{ item.batteryPower }}</text>
</view>
<u-tag text="离线" plain size="mini" type="info"></u-tag>
</view>
</view>
<view class="line"></view>
<view class="item-option">
<view class="_left">
<u-icon label="操作" size="40" name="map"
@click="navTo('package/user/equipment/operation?equipmentId='+item.equipmentId)"></u-icon>
</view>
<view class="line-align"></view>
<view class="_right">
<view class="events">
<u-icon label="详情" size="40" name="file-text"
@click="navTo('package/user/equipment/detail?equipmentId='+item.equipmentId)"></u-icon>
<!-- <view class="event-item" @click="handleUpdate(item.address_id)">
<text class="iconfont icon-edit"></text>
<text class="title">编辑</text>
</view>
@@ -40,316 +43,337 @@
<text class="iconfont icon-delete"></text>
<text class="title">删除</text>
</view> -->
</view>
</view>
</view>
</view>
</view>
<empty v-if="!list.length" tips="暂无设备" />
<!-- 底部操作按钮 -->
<!-- <view class="footer-fixed">
</view>
</view>
</view>
</view>
</view>
<empty v-if="!list.length" tips="暂无设备" />
<!-- 底部操作按钮 -->
<!-- <view class="footer-fixed">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="handleCreate()">添加新地址</view>
</view>
</view> -->
</view>
</view>
</template>
<script>
import * as EquipmentApi from '@/websoft/api/equipment.js'
import Empty from '@/components/empty'
import * as EquipmentApi from '@/websoft/api/equipment.js'
import Empty from '@/components/empty'
import storage from '../../../utils/storage';
export default {
components: {
Empty
},
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: true,
// 收货地址列表
list: [],
// 默认收货地址
defaultId: null
}
},
export default {
components: {
Empty
},
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: true,
// 收货地址列表
list: [],
// 默认收货地址
defaultId: null
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取页面数据
this.getPageData()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取页面数据
this.getPageData()
},
methods: {
methods: {
// 获取页面数据
getPageData() {
const app = this
app.isLoading = true
Promise.all([app.getDefaultId(), app.getEquipmentList()])
.then(() => {
// 列表排序把默认收货地址放到最前
app.onReorder()
})
.finally(() => app.isLoading = false)
},
// 获取页面数据
getPageData() {
const app = this
app.isLoading = true
Promise.all([app.getDefaultId(), app.getEquipment()])
.then(() => {
// 列表排序把默认收货地址放到最前
app.onReorder()
})
.finally(() => app.isLoading = false)
},
// 获取收货地址列表
getEquipment() {
const app = this
EquipmentApi.getEquipment(this.options.equipmentId).then(res => {
this.list = [res.data]
console.log(res);
})
},
getEquipmentList() {
const app = this
EquipmentApi.pageEquipment({
userId: storage.get("userId")
}).then(res => {
this.list = res.data.list
console.log(res);
})
},
// 获取默认的收货地址
getDefaultId() {
return new Promise((resolve, reject) => {
const app = this
// AddressApi.defaultId()
// .then(result => {
// app.defaultId = result.data.defaultId
// resolve(result)
// })
// .catch(reject)
})
},
// 获取收货地址列表
getEquipment() {
const app = this
EquipmentApi.pageEquipment({userId: uni.getStorageSync('userId')}).then(res => {
console.log("res: ",res);
app.list = res.data.list
})
},
// 列表排序把默认收货地址放到最前
onReorder() {
const app = this
app.list.sort(item => {
return item.address_id == app.defaultId ? -1 : 1
})
},
// 获取默认的收货地址
getDefaultId() {
return new Promise((resolve, reject) => {
const app = this
// AddressApi.defaultId()
// .then(result => {
// app.defaultId = result.data.defaultId
// resolve(result)
// })
// .catch(reject)
})
},
navTo(url) {
this.$navTo(url)
},
// 列表排序把默认收货地址放到最前
onReorder() {
const app = this
app.list.sort(item => {
return item.address_id == app.defaultId ? -1 : 1
})
},
/**
* 添加新地址
*/
handleCreate() {
this.$navTo('pages/address/create')
},
navTo(url){
this.$navTo(url)
},
/**
* 编辑地址
* @param {int} addressId 收货地址ID
*/
handleUpdate(addressId) {
this.$navTo('pages/address/update', {
addressId
})
},
/**
* 添加新地址
*/
handleCreate() {
this.$navTo('pages/address/create')
},
/**
* 删除收货地址
* @param {int} addressId 收货地址ID
*/
handleRemove(addressId) {
const app = this
uni.showModal({
title: "提示",
content: "您确定要删除当前收货地址吗?",
success({
confirm
}) {
confirm && app.onRemove(addressId)
}
});
},
/**
* 编辑地址
* @param {int} addressId 收货地址ID
*/
handleUpdate(addressId) {
this.$navTo('pages/address/update', { addressId })
},
/**
* 确认删除收货地址
* @param {int} addressId 收货地址ID
*/
onRemove(addressId) {
const app = this
AddressApi.remove(addressId)
.then(result => {
app.getPageData()
})
},
/**
* 删除收货地址
* @param {int} addressId 收货地址ID
*/
handleRemove(addressId) {
const app = this
uni.showModal({
title: "提示",
content: "您确定要删除当前收货地址吗?",
success({ confirm }) {
confirm && app.onRemove(addressId)
}
});
},
/**
* 确认删除收货地址
* @param {int} addressId 收货地址ID
*/
onRemove(addressId) {
const app = this
AddressApi.remove(addressId)
.then(result => {
app.getPageData()
})
},
/**
* 设置为默认地址
* @param {Object} addressId
*/
handleSetDefault(addressId) {
const app = this
AddressApi.setDefault(addressId)
.then(result => {
app.defaultId = addressId
app.options.from === 'checkout' && uni.navigateBack()
})
}
}
}
/**
* 设置为默认地址
* @param {Object} addressId
*/
handleSetDefault(addressId) {
const app = this
AddressApi.setDefault(addressId)
.then(result => {
app.defaultId = addressId
app.options.from === 'checkout' && uni.navigateBack()
})
}
}
}
</script>
<style lang="scss" scoped>
.addres-list {
padding-bottom: calc(constant(safe-area-inset-bottom) + 140rpx);
padding-bottom: calc(env(safe-area-inset-bottom) + 140rpx);
padding-top: 20rpx;
}
.addres-list {
padding-bottom: calc(constant(safe-area-inset-bottom) + 140rpx);
padding-bottom: calc(env(safe-area-inset-bottom) + 140rpx);
padding-top: 20rpx;
}
// 项目内容
.address-item {
margin: 0 auto 20rpx auto;
padding: 30rpx 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0 rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.title{
// 项目内容
.address-item {
margin: 0 auto 20rpx auto;
padding: 30rpx 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0 rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.title {
display: flex;
justify-content: space-between;
}
}
.contacts {
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
}
}
.contacts {
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
.bms-info{
display: flex;
flex-direction: column;
color: #666666;
.item{
margin-right: 16rpx;
}
.name {
margin-right: 16rpx;
}
}
.bms-image{
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
width: 120rpx;
.bms-image-box{
.bms-info {
display: flex;
font-size: 22rpx;
margin-bottom: 18rpx;
color: #00af00;
.bms-image-fbf{
margin-top: 22rpx;
flex-direction: column;
color: #666666;
.item {
margin-right: 16rpx;
}
.name {
margin-right: 16rpx;
}
}
.image{
width: 50rpx; height: 60rpx;
.bms-image {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
width: 120rpx;
.bms-image-box {
display: flex;
font-size: 22rpx;
margin-bottom: 18rpx;
color: #00af00;
.bms-image-fbf {
margin-top: 22rpx;
}
}
.image {
width: 50rpx;
height: 60rpx;
}
}
}
}
.address {
font-size: 28rpx;
.address {
font-size: 28rpx;
.region {
margin-right: 10rpx;
}
}
.region {
margin-right: 10rpx;
}
}
.line {
margin: 20rpx 0;
border-bottom: 1rpx solid #f3f3f3;
}
.line {
margin: 20rpx 0;
border-bottom: 1rpx solid #f3f3f3;
}
.line-align{
width: 6rpx;
height: 48rpx;
border-right: 1rpx solid #f3f3f3;
}
.line-align {
width: 6rpx;
height: 48rpx;
border-right: 1rpx solid #f3f3f3;
}
.item-option {
display: flex;
justify-content: space-around;
align-items: center;
height: 48rpx;
.item-option {
display: flex;
justify-content: space-around;
align-items: center;
height: 48rpx;
// 单选框
.item-radio {
font-size: 28rpx;
// 单选框
.item-radio {
font-size: 28rpx;
.radio {
vertical-align: middle;
transform: scale(0.76)
}
.radio {
vertical-align: middle;
transform: scale(0.76)
}
.text {
vertical-align: middle;
}
}
.text {
vertical-align: middle;
}
}
// 操作
.events {
display: flex;
align-items: center;
line-height: 48rpx;
// 操作
.events {
display: flex;
align-items: center;
line-height: 48rpx;
.event-item {
font-size: 28rpx;
margin-right: 26rpx;
color: #4c4c4c;
.event-item {
font-size: 28rpx;
margin-right: 26rpx;
color: #4c4c4c;
&:last-child {
margin-right: 0;
}
&:last-child {
margin-right: 0;
}
.title {
margin-left: 8rpx;
}
}
}
.title {
margin-left: 8rpx;
}
}
}
}
}
// 底部操作栏
.footer-fixed {
position: fixed;
bottom: var(--window-bottom);
left: 0;
right: 0;
z-index: 11;
// 底部操作栏
.footer-fixed {
position: fixed;
bottom: var(--window-bottom);
left: 0;
right: 0;
z-index: 11;
// 设置ios刘海屏底部横线安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
// 设置ios刘海屏底部横线安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.btn-wrapper {
height: 120rpx;
padding: 0 40rpx;
}
.btn-wrapper {
height: 120rpx;
padding: 0 40rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 86rpx;
color: #fff;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 1rpx 5rpx 0 rgba(0, 0, 0, 0.05);
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 86rpx;
color: #fff;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 1rpx 5rpx 0 rgba(0, 0, 0, 0.05);
}
.btn-item-main {
background: linear-gradient(to right, $main-bg, $main-bg2);
}
.btn-item-main {
background: linear-gradient(to right, $main-bg, $main-bg2);
}
}
}
</style>

View File

@@ -53,9 +53,9 @@
<u-button shape="circle" size="mini"
@click="navTo('package/dealer/withdraw/apply')">查看明细</u-button>
</view> -->
<view class="asset-left-item" style="display: flex;align-items: center;">
<!-- <view class="asset-left-item" style="display: flex;align-items: center;">
<u-button shape="circle" type="primary" size="mini" @click="onApply">去提现</u-button>
</view>
</view> -->
</view>
</view>
<view class="my-service">
@@ -125,11 +125,11 @@
<!-- 退出登录 -->
<!-- <view v-if="isLogin" class="my-logout">
<view v-if="isLogin" class="my-logout">
<view class="logout-btn" @click="handleLogout()">
<text>退出登录</text>
</view>
</view> -->
</view>
<u-toast ref="uToast" />
</view>
@@ -181,7 +181,7 @@
{id: 'get_order',name: '订单管理',icon: 'qpdingdan',type: 'link',url: 'pages/order/index'},
{id: 'equipment',name: '设备管理',icon: 'shouhuodizhi',type: 'link',url: 'pages/user/equipment/index'},
{id: 'saleman',name: '收益明细',icon: 'shouhuodizhi',type: 'link',url: 'pages/saleman/profir-log/profir-log'},
{id: 'withdraw_kog',name: '提现记录',icon: 'shouhuodizhi',type: 'link',url: 'package/dealer/withdraw/apply'},
// {id: 'withdraw_kog',name: '提现记录',icon: 'shouhuodizhi',type: 'link',url: 'package/dealer/withdraw/apply'},
{id: 'help',name: '使用帮助',icon: 'bangzhu',type: 'link',url: 'pages/help/index'},
{id: 'administration',name: '关于我们',icon: 'sy-yh',type: 'link',url: 'pages/help/about'},
]