Compare commits
45 Commits
877469ab43
...
master
Author | SHA1 | Date | |
---|---|---|---|
224db6202c | |||
dbd3800314 | |||
4545fbfab5 | |||
49af2cd078 | |||
bca9390042 | |||
bad6348393 | |||
c56ea0dd73 | |||
4d7f73aedf | |||
3945b36b0a | |||
4344adeb0b | |||
11a0637039 | |||
b53dc2dd4f | |||
0c0d5e55d5 | |||
b7461002dc | |||
68262d0519 | |||
d757f99b5d | |||
e910a76437 | |||
85d52f5065 | |||
915ff6b184 | |||
e92323a15b | |||
048ce5fd05 | |||
448ee810de | |||
6cd0361f33 | |||
0b1f0b9e26 | |||
531a955fe2 | |||
cb40ce643f | |||
f547216c2b | |||
62c9994444 | |||
100744cfaf | |||
74dba2ef29 | |||
dccdd43e3a | |||
eb1abb69fd | |||
68cce822be | |||
5bbfff9e21 | |||
7f6ace8ac6 | |||
bb9a32d296 | |||
bfc04c54aa | |||
5b8c7d4a2d | |||
634e801eb5 | |||
7b3676eda7 | |||
6c4c2ac85d | |||
b87c8e8292 | |||
32aa0eb971 | |||
178e8ff5cb | |||
0562554266 |
@@ -4,6 +4,8 @@ VITE_APP_TITLE='uniapp-vue3-project'
|
|||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
VITE_APP_ENV='development'
|
VITE_APP_ENV='development'
|
||||||
|
|
||||||
|
VITE_APP_ID='wx92e663dc11d0c0a8'
|
||||||
|
|
||||||
# 接口地址
|
# 接口地址
|
||||||
VITE_APP_BASE_API='https://apidev.lakeapp.cn/'
|
VITE_APP_BASE_API='https://apidev.lakeapp.cn/'
|
||||||
|
|
||||||
|
@@ -4,8 +4,10 @@ VITE_APP_TITLE='uniapp-vue3-project'
|
|||||||
# 生产环境配置
|
# 生产环境配置
|
||||||
VITE_APP_ENV='production'
|
VITE_APP_ENV='production'
|
||||||
|
|
||||||
|
VITE_APP_ID='wx67a750d0ceed4d88'
|
||||||
|
|
||||||
# 接口地址
|
# 接口地址
|
||||||
VITE_APP_BASE_API='http://api.lakeapp.cn/'
|
VITE_APP_BASE_API='https://api.lakeapp.cn/'
|
||||||
|
|
||||||
# 删除console
|
# 删除console
|
||||||
VITE_DROP_CONSOLE=true
|
VITE_DROP_CONSOLE=true
|
||||||
|
14
.env.test
14
.env.test
@@ -1,11 +1,17 @@
|
|||||||
# 页面标题
|
# 页面标题
|
||||||
VITE_APP_TITLE='uniapp-vue3-project'
|
VITE_APP_TITLE='uniapp-vue3-project'
|
||||||
|
|
||||||
# 生产环境配置
|
# 开发环境配置
|
||||||
VITE_APP_ENV='production'
|
VITE_APP_ENV='test'
|
||||||
|
|
||||||
|
VITE_APP_ID='wx92e663dc11d0c0a8'
|
||||||
|
|
||||||
# 接口地址
|
# 接口地址
|
||||||
VITE_APP_BASE_API='/'
|
#VITE_APP_BASE_API='https://apidev.lakeapp.cn/'
|
||||||
|
VITE_APP_BASE_API='https://api.lakeapp.cn/'
|
||||||
|
|
||||||
# 删除console
|
# 删除console
|
||||||
VITE_DROP_CONSOLE=true
|
VITE_DROP_CONSOLE=false
|
||||||
|
|
||||||
|
# 是否开启Mock
|
||||||
|
VITE_USE_MOCK=true
|
||||||
|
@@ -14,7 +14,7 @@ const WX_DESC = envType == 'production' ? '正式环境' : '测试环境'
|
|||||||
(async () => {
|
(async () => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const manifest = path.resolve(__dirname, './src/manifest.json')
|
const manifest = path.resolve(__dirname, './src/manifest.json')
|
||||||
console.log(manifest)
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const manifestConfig = JSON.parse(fs.readFileSync(manifest).toString())
|
const manifestConfig = JSON.parse(fs.readFileSync(manifest).toString())
|
||||||
const appId = manifestConfig['mp-weixin'].appid
|
const appId = manifestConfig['mp-weixin'].appid
|
||||||
|
27
keys/private.wx67a750d0ceed4d88.key
Normal file
27
keys/private.wx67a750d0ceed4d88.key
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEowIBAAKCAQEAw7dY+KsQ9Qa1Q0Amp2bNWW3/ch/2OmS5SsiXSfRgVLKcUB1C
|
||||||
|
1svyjDUzqaw53Rhn4WdwUCFQCkhWs1ud7NA/eudaqLmvrX0SaH6bJz2XCzyNoElM
|
||||||
|
amHh0U4sKEFcOcY9FPsriislpCmKnOKjyKB6fnpzIn7JxespswhiDsiKC2dk/8nB
|
||||||
|
GFeN559MYy6qOUyFrykkcF21oSfOynhw+ziqxRBIKh30dR1nUy+FZrZiVx2Bj/id
|
||||||
|
39AbZ89lK8pzdlFHtXqd56UCe5fEselh+KbT4eKIEhHoO+vSqralASLDMxijgA3V
|
||||||
|
49AUmpQ6F4nW9GfF3/IreX8X7k457M6FKo8L1QIDAQABAoIBABnTb+IgcLRkljax
|
||||||
|
mGguoJpUcYjVvuAlum2r2orfvHZwuz+3HMLLVs45lv+kwl3ygoKz65YnTzCMKySv
|
||||||
|
yj8dm8LUFJp/Jjd2cZ9oVYDwF6Zb7zRfd73x/KJp9lm5hjn5dsX1/uDUoLrw4GGj
|
||||||
|
Zolq478c2WSL5oQ/a9k8GfRpcg3e88L89r6QjZuQ3jmVxe4fJlYbUR3YXE2t3c41
|
||||||
|
v/uQfxXvvVrYGc8/jZE4AQcFbZhKu1xfl7dy8AEisZa4OxU5Gd+onHcnUgGO6oRn
|
||||||
|
x0pZQnZJZoTLJe8uB0jl+OPLLQbRcA01jITKAHKOqOQYgynfzy6xfMWhNk/4YWtf
|
||||||
|
oJ+wFmECgYEA7H/Iov01m7+k+oe3XyiQC0zMLtHWzF3thdAUJFRZPBfzb5X/F9a2
|
||||||
|
k+feK69aXHnsWtVKO1kZ+FMMs7OU0LOX+LRDeeiJqlhnuOC63NfyZ6yfgOEBq38s
|
||||||
|
C7rxgsuS6D5VvEzj57sjBGRTyfjNZVvfflBMVn9JgwVzdo9RumLnD98CgYEA09qv
|
||||||
|
IJtFlPcAbIuKQMRUnrLVDI5hMYzQUwpj4RkBOASIgCtJHUoN4GvdAaYeE6q9eeD1
|
||||||
|
TyKyIJekECejOqLdzidE/aOVRWcgiEjxjGf4e9n4/6q9CJGH7v2WMNbziALHb6We
|
||||||
|
KBwrIdaakD7m2yVZ1PxTyljCXx3wvv3IN/khSssCgYEAv8CH2+cz3RlQ2bTKcARC
|
||||||
|
bncRInEPGNqbaCCjBCXDyF6fCX1zvE9h76BTWdYujMZqZeeD7YS78sTbiqRzZ5gG
|
||||||
|
Ayedgi2R2SUezB6iQ8dvirHDDcriALv26Xfks6j9bwKDn040h0ILDVePPDZXyvPn
|
||||||
|
zNGsY4GHCA2WZa2klVv1fr8CgYBCkMPWCvOiCronYPDfyNCNzMMEXvhLCWOrs+gO
|
||||||
|
Ij0vzLzXCMLAYTRa/4lBq2Bn7Y37baOmadBuTTdPnCS9l875p30V9QBB/lVKfSDo
|
||||||
|
bQK2Z5bFPnCG8LM1dJhsYB3E7pqbif5XvAIRb8zA5gLDeMjxExeAzMLGADJU0IjI
|
||||||
|
jY7YYQKBgFy7WTwnEV4NTjus1FXj4Bf1BYJRrDRtxMNiKWZZ+C1XQqA1zWiIfDzt
|
||||||
|
B1LKjBwWZsM2ali582PcMkJYPVZBG+hMmHlAme/acpzGF4oiANZp+kCcrnxFvKvs
|
||||||
|
PAO6ui1zDN92bGNf/LQQOf1TM29sUbAFnwxNFOxvs2FbpWvFj0V3
|
||||||
|
-----END RSA PRIVATE KEY-----
|
@@ -1,27 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIIEowIBAAKCAQEAtAuySwDuVUqiKAgtB8yhmDXMbFtgSZQiC4FtahrqAxcwcett
|
|
||||||
khfncnldZZGMUtK3dM/xA5YaKe18vish3qbymwc+863r2NKIFtWhWIglXDuutGgT
|
|
||||||
U9/IqCnh4Dx8Owlw5/EzbvHSXj1/uzwuAVO6cxkkEvz9mxYixuB3YCd8yKQ5rLnu
|
|
||||||
EwNf063fI+jDVUBeyEejSZJ0pi3OzWdXJOjS9UYv2bAYOfJluGucfDXMbfdz8euy
|
|
||||||
T8WRCPJp4X2QoQU5WcSxWnvRSllwAfposZTIcu/msXm77QwoYqCHvJ2suGzL+SXa
|
|
||||||
c73wQB289dXqHbYmSa7bPmTmOEyCPYao0oIh8wIDAQABAoIBACfpb9ywmCTQJqI5
|
|
||||||
LcJM2oWjZ22d0/p7nBBw4JBk5vtIaLTYO7HnGqeFv+6EFVdG3uRGNGdXHvWsb7q4
|
|
||||||
VQnGeIFlWc8q/t1RzllBgkLd62pG0LOtXpt5QEIHBstunRt5PE4uafhuIvRBLc+T
|
|
||||||
x58DsJFTQWv0KUP35D2yBMSL/F19qqF6oe43kYbAei8w608XXKOT/rODdk1Ie3yx
|
|
||||||
AOgM4DvTqcSdqL/SDJ6r8xoplDNk4l+QYCJ9z7JodnJfU5OQVWw8WFWRg3jP9k/S
|
|
||||||
DsojcusTs1s14X8V3/TbR1vVW6g4Q5QnNFozHaKRZAD9DuBStrL02hgAq7oXdg+g
|
|
||||||
IoMR+AECgYEA7VVuOWwt2aWXks9aPpOVs9knMdrpxbO1nE/B2JECICElFtL8xwUi
|
|
||||||
BxWcM++wJNtKTAjJfpnFGZkyHfmnB8V0itGIz1lCZTs/yraJqaLxQdbHjEnCoCRq
|
|
||||||
tl1751hsBS15XFDskKHGFZj0wv9nq3I0wUoMjhsRV+Lopq+uHCodcgMCgYEAwjTO
|
|
||||||
dwh/0cTjiGOV8iX9WdM0I3wnYfcAgDbxGKNyZNw8oQ52vzTn1VG+LcxMcy+OUq/a
|
|
||||||
B/XBjkUI4WyHfK7zM6rhlQB8pWR3i+yPyLXJ69oRQwYAeHQzgZ6Z+sSsusHcG/wN
|
|
||||||
J/Z9EqiWQK/tZsBXQxDpHqxwz9Xl1BlL0xX9BVECgYBHKsr2pR3KmgEtoMfq486M
|
|
||||||
M52xMXfQNOdMjA4QpssAX3ADvBjYhQ2DGlPQrxsesjNBQZFKSUn1Nx70JhyUE/2y
|
|
||||||
csqXgqiKOo4Sd1IocBfwKjuEMcoOw1zMepPg937MvqoZqJqHdDs11rvujS/FFWYE
|
|
||||||
X/QL2MoGlKA2+482GtrhiQKBgQCTt8jnn45hx2nuXxk5w42umkiJSTFHgbJe0+uU
|
|
||||||
+xXTA/YV50OJcrt4daG7gi8QWjbeTCYCcfrUtUvo8z0nKIeSYEMPq/wjbYTE6J4B
|
|
||||||
Y8z/2bHRkiofdPuMd0/V/20G7Nf4bUKwh/tgit0mvOpNgrWdLKq1CyMP4znal5cm
|
|
||||||
Kw520QKBgB+I8yfp/E01ruSccdgRH3WMGStuHhSxcQ8WWD9oFdOn+klxr8h4al3+
|
|
||||||
Ibo6SJkKmwg2/IEsuc52qZPH5594XfQ7HxfVf9RVwdR96epRqah/cHofIVCX1wQB
|
|
||||||
CCirZNNiBe2hQxDyAHn492a6dzcjMojDN5JS+Yt071CB0Tph7+2c
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
40
manifest.modify.ts
Normal file
40
manifest.modify.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
const fs = require('fs');
|
||||||
|
// @ts-ignore
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const currentDir = path.dirname(__filename);
|
||||||
|
const manifestPath = path.join(currentDir, 'src/manifest.json');
|
||||||
|
|
||||||
|
const VITE_APP_WX_APPID = process.env.NODE_ENV === 'production' ? 'wx67a750d0ceed4d88' : 'wx92e663dc11d0c0a8';
|
||||||
|
fs.readFile(manifestPath, (err, data) => {
|
||||||
|
if(err) {
|
||||||
|
console.error(err);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if(!VITE_APP_WX_APPID) {
|
||||||
|
console.log('写入失败,没读到appid');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const _data = JSON.parse(data.toString());
|
||||||
|
_data['mp-weixin'].appid = VITE_APP_WX_APPID;
|
||||||
|
const newData = JSON.stringify(_data, null, 2);
|
||||||
|
fs.writeFile(
|
||||||
|
manifestPath,
|
||||||
|
newData,
|
||||||
|
{
|
||||||
|
encoding: 'utf-8'
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
if(err) {
|
||||||
|
console.log('APPID 写入失败', err);
|
||||||
|
} else {
|
||||||
|
console.log(`APPID 写入成功 ${VITE_APP_WX_APPID}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (parseError) {
|
||||||
|
console.error('解析 manifest.json 失败', parseError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
58
package.json
58
package.json
@@ -4,10 +4,12 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "uni -p mp-weixin",
|
"dev": "uni -p mp-weixin",
|
||||||
"build:test": "uni build --mode test -p mp-weixin",
|
"dev:test": "cross-env NODE_ENV=development node manifest.modify.ts && uni -p mp-weixin --mode development",
|
||||||
"build:prod": "uni build --mode production -p mp-weixin",
|
"dev:prod": "cross-env NODE_ENV=production node manifest.modify.ts && uni -p mp-weixin --mode production",
|
||||||
"deploy:test": "uni build --mode test -p mp-weixin && node deploy.ts test",
|
"build:test": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --mode test",
|
||||||
"deploy:prod": "uni build --mode production -p mp-weixin && node deploy.ts production",
|
"build:prod": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build --mode production",
|
||||||
|
"deploy:test": "cross-env NODE_ENV=test node manifest.modify.ts && uni build --mode test -p mp-weixin && node deploy.ts test",
|
||||||
|
"deploy:prod": "cross-env NODE_ENV=production node manifest.modify.ts && uni build --mode production -p mp-weixin && node deploy.ts production",
|
||||||
"type-check": "vue-tsc --noEmit",
|
"type-check": "vue-tsc --noEmit",
|
||||||
"eslint": "eslint --fix",
|
"eslint": "eslint --fix",
|
||||||
"stylelint": "stylelint \"src/**/*.(vue|scss|css)\" --fix",
|
"stylelint": "stylelint \"src/**/*.(vue|scss|css)\" --fix",
|
||||||
@@ -15,53 +17,53 @@
|
|||||||
"postinstall": "simple-git-hooks"
|
"postinstall": "simple-git-hooks"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dcloudio/uni-app": "3.0.0-4000820240401001",
|
"@dcloudio/uni-app": "3.0.0-alpha-4010520240507001",
|
||||||
"@dcloudio/uni-app-plus": "3.0.0-4000820240401001",
|
"@dcloudio/uni-app-plus": "3.0.0-alpha-4010520240507001",
|
||||||
"@dcloudio/uni-components": "3.0.0-4000820240401001",
|
"@dcloudio/uni-components": "3.0.0-alpha-4010520240507001",
|
||||||
"@dcloudio/uni-mp-weixin": "3.0.0-4000820240401001",
|
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-4010520240507001",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"pinia": "2.0.36",
|
"pinia": "2.0.36",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
"uview-plus": "^3.1.38",
|
"uview-plus": "^3.1.41",
|
||||||
"vue": "3.4.21",
|
"vue": "3.4.21",
|
||||||
"vue-i18n": "^9.9.0",
|
"vue-i18n": "^9.9.0",
|
||||||
"z-paging": "^2.6.2"
|
"z-paging": "^2.6.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "1.1.0",
|
"@antfu/eslint-config": "1.1.0",
|
||||||
"@dcloudio/types": "^3.4.3",
|
"@dcloudio/types": "^3.4.8",
|
||||||
"@dcloudio/uni-automator": "3.0.0-4000820240401001",
|
"@dcloudio/uni-automator": "3.0.0-alpha-4010520240507001",
|
||||||
"@dcloudio/uni-cli-shared": "3.0.0-4000820240401001",
|
"@dcloudio/uni-cli-shared": "3.0.0-alpha-4010520240507001",
|
||||||
"@dcloudio/uni-stacktracey": "3.0.0-4000820240401001",
|
"@dcloudio/uni-stacktracey": "3.0.0-alpha-4010520240507001",
|
||||||
"@dcloudio/vite-plugin-uni": "3.0.0-4000820240401001",
|
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-4010520240507001",
|
||||||
"@types/node": "^20.8.10",
|
"@types/node": "^20.10.3",
|
||||||
"@typescript-eslint/parser": "^6.10.0",
|
"@typescript-eslint/parser": "^6.13.1",
|
||||||
"@uni-helper/uni-app-types": "^0.5.9",
|
"@uni-helper/uni-app-types": "^0.5.12",
|
||||||
"@unocss/eslint-plugin": "^0.57.2",
|
"@unocss/eslint-plugin": "^0.57.7",
|
||||||
"@vue/runtime-core": "^3.4.21",
|
"@vue/runtime-core": "^3.4.21",
|
||||||
"@vue/tsconfig": "^0.4.0",
|
"@vue/tsconfig": "^0.4.0",
|
||||||
"czg": "^1.7.1",
|
"czg": "^1.7.1",
|
||||||
"eslint": "^8.53.0",
|
"eslint": "^8.55.0",
|
||||||
"lint-staged": "^15.0.2",
|
"lint-staged": "^15.2.0",
|
||||||
"miniprogram-ci": "^1.9.8",
|
"miniprogram-ci": "^1.9.10",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"postcss-html": "^1.5.0",
|
"postcss-html": "^1.5.0",
|
||||||
"postcss-scss": "^4.0.9",
|
"postcss-scss": "^4.0.9",
|
||||||
"sass": "^1.69.5",
|
"sass": "^1.69.5",
|
||||||
"simple-git-hooks": "^2.9.0",
|
"simple-git-hooks": "^2.9.0",
|
||||||
"stylelint": "^15.11.0",
|
"stylelint": "^15.11.0",
|
||||||
"stylelint-config-recess-order": "^4.3.0",
|
"stylelint-config-recess-order": "^4.4.0",
|
||||||
"stylelint-config-standard": "^34.0.0",
|
"stylelint-config-standard": "^34.0.0",
|
||||||
"stylelint-config-standard-vue": "^1.0.0",
|
"stylelint-config-standard-vue": "^1.0.0",
|
||||||
"stylelint-order": "^6.0.3",
|
"stylelint-order": "^6.0.3",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.3.2",
|
||||||
"unocss": "^0.57.2",
|
"unocss": "^0.57.7",
|
||||||
"unocss-applet": "^0.7.7",
|
"unocss-applet": "^0.7.8",
|
||||||
"unplugin-auto-import": "^0.16.7",
|
"unplugin-auto-import": "^0.16.7",
|
||||||
"unplugin-vue-components": "^0.25.2",
|
"unplugin-vue-components": "^0.25.2",
|
||||||
"vite": "^4.5.2",
|
"vite": "^5.2.8",
|
||||||
"vite-plugin-imagemin": "^0.6.1",
|
"vite-plugin-imagemin": "^0.6.1",
|
||||||
"vue-tsc": "^1.8.22"
|
"vue-tsc": "^1.8.24"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"src/**/*.{js,jsx,ts,tsx}": "eslint --fix",
|
"src/**/*.{js,jsx,ts,tsx}": "eslint --fix",
|
||||||
|
2799
pnpm-lock.yaml
generated
2799
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
253
src/App.vue
253
src/App.vue
@@ -1,30 +1,241 @@
|
|||||||
<script setup lang='ts'>
|
<script lang='ts'>
|
||||||
import { mpUpdate, setReferrerUserId, setRegisterStoreId } from '@/utils';
|
import {
|
||||||
|
getCompanyId,
|
||||||
|
getRegisterStoreId,
|
||||||
|
mpUpdate,
|
||||||
|
setCompanyId,
|
||||||
|
setReferrerUserId,
|
||||||
|
setRegisterStoreId
|
||||||
|
} from '@/utils';
|
||||||
|
import { Logger } from '@/utils/common/logger';
|
||||||
|
|
||||||
onLaunch((options) => {
|
const logger = new Logger();
|
||||||
console.log('App Launch options ', options);
|
|
||||||
if(options?.query) {
|
|
||||||
|
|
||||||
//保存登录邀请员工id
|
export default {
|
||||||
if(options.query.referrerUserId) {
|
onLaunch: async (options: any) => {
|
||||||
setReferrerUserId(options.query.referrerUserId);
|
const miniProgram = uni.getAccountInfoSync().miniProgram;
|
||||||
|
const env = miniProgram.envVersion;
|
||||||
|
|
||||||
|
console.log(`App Launch options ${env}: `, options);
|
||||||
|
|
||||||
|
//生产
|
||||||
|
if(env === 'release') {
|
||||||
|
logger.info(`App Launch options ${env}: `, options);
|
||||||
|
|
||||||
|
async function getVersionStatus() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.request({
|
||||||
|
url: 'https://api.lakeapp.cn/wechat/version_info',
|
||||||
|
success(res) {
|
||||||
|
console.log(res);
|
||||||
|
resolve(res);
|
||||||
|
},
|
||||||
|
fail(exception) {
|
||||||
|
reject(exception);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).then((res) => {
|
||||||
|
const { version, audit } = res.data;
|
||||||
|
// if(miniProgram.version === version && audit == 1) {
|
||||||
|
if(audit == 1) {
|
||||||
|
setCompanyId('1150930317231112193');
|
||||||
|
setRegisterStoreId('1150930317436633090');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await getVersionStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
//保存注册门店id
|
//测试、开发 trial,develop
|
||||||
if(options.query.storeId) {
|
else {
|
||||||
setRegisterStoreId(options.query.storeId);
|
//生产环境
|
||||||
|
if(import.meta.env.VITE_APP_BASE_API.includes('api.lakeapp')) {
|
||||||
|
// setCompanyId('1150930317231112193');
|
||||||
|
// setRegisterStoreId('1150930317436633090');
|
||||||
|
|
||||||
|
setCompanyId('1471673498334113794');
|
||||||
|
setRegisterStoreId('1471673498413805570');
|
||||||
|
}
|
||||||
|
//测试
|
||||||
|
else {
|
||||||
|
setCompanyId('1724629180555919361');
|
||||||
|
setRegisterStoreId('1725026299888406529');
|
||||||
|
// setRegisterStoreId('17250262998884000000');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(options?.query) {
|
||||||
|
|
||||||
|
// options.query.scene = 'companyId%3D1150930317231112193%26wxOpenId%3D111%26ticketId%3D123456%26storeId%3D1150930317436633090'
|
||||||
|
|
||||||
|
//保存登录邀请员工id
|
||||||
|
if(options.query.referrerUserId) {
|
||||||
|
setReferrerUserId(options.query.referrerUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存注册门店id
|
||||||
|
if(options.query.companyId) {
|
||||||
|
setCompanyId(options.query.companyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存注册门店id
|
||||||
|
if(options.query.storeId) {
|
||||||
|
setRegisterStoreId(options.query.storeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(options?.query.scene) {
|
||||||
|
function getQueryParam(queryParams: string, key: string) {
|
||||||
|
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
|
||||||
|
match = queryParams.match(regex);
|
||||||
|
return match && match[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存注册门店id
|
||||||
|
const params = decodeURIComponent(options?.query.scene);
|
||||||
|
if(params.includes('companyId')) {
|
||||||
|
setCompanyId(getQueryParam(params, 'companyId') || '');
|
||||||
|
}
|
||||||
|
if(params.includes('storeId')) {
|
||||||
|
setRegisterStoreId(getQueryParam(params, 'storeId') || '');
|
||||||
|
}
|
||||||
|
if(options?.query.scene === 'edit_avatar_nickname') {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/mine/subs/profile/index'
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//原先商品团购
|
||||||
|
if(options?.path?.includes('ticketsBuy/ticketsBuy') && options?.query.couponsId) {
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: 'pages/common/groupbuy/detail?id=' + options?.query.couponsId
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info(`App Launch options ${env}: { companyId: `, getCompanyId() + ', storeId: ' + getRegisterStoreId() + ' }');
|
||||||
|
|
||||||
|
// #ifdef MP
|
||||||
|
mpUpdate();
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
onShow: async () => {
|
||||||
|
console.log('App Show');
|
||||||
|
},
|
||||||
|
onHide: async () => {
|
||||||
|
console.log('App Hide');
|
||||||
|
},
|
||||||
|
|
||||||
|
globalData: {
|
||||||
|
logger: logger,
|
||||||
|
companyId: getCompanyId(),
|
||||||
|
storeId: getRegisterStoreId()
|
||||||
}
|
}
|
||||||
// #ifdef MP
|
};
|
||||||
mpUpdate();
|
|
||||||
// #endif
|
// onLaunch(async (options) => {
|
||||||
});
|
// console.log('App Launch options ', options);
|
||||||
onShow(() => {
|
// // globalData.logger.info('launch options : ', options);
|
||||||
console.log('App Show');
|
//
|
||||||
});
|
// const miniProgram = uni.getAccountInfoSync().miniProgram;
|
||||||
onHide(() => {
|
// const env = miniProgram.envVersion;
|
||||||
console.log('App Hide');
|
//
|
||||||
});
|
// logger.info('launch options env : ', `${env} ${options}`);
|
||||||
|
// //生产
|
||||||
|
// if(env === 'release' || env === 'trial') {
|
||||||
|
// async function getVersionStatus() {
|
||||||
|
// return new Promise((resolve, reject) => {
|
||||||
|
// uni.request({
|
||||||
|
// url: 'https://api.lakeapp.cn/wechat/version_info',
|
||||||
|
// success(res) {
|
||||||
|
// console.log(res);
|
||||||
|
// resolve(res);
|
||||||
|
// },
|
||||||
|
// fail(exception) {
|
||||||
|
// reject(exception);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }).then((res) => {
|
||||||
|
// const { version, audit } = res.data;
|
||||||
|
// // if(miniProgram.version === version && audit == 1) {
|
||||||
|
// if(audit == 1) {
|
||||||
|
// setCompanyId('1150930317231112193');
|
||||||
|
// setRegisterStoreId('1150930317436633090');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// await getVersionStatus();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //测试、开发 trial,develop
|
||||||
|
// else {
|
||||||
|
// // setCompanyId('1724629180555919361');
|
||||||
|
// // setRegisterStoreId('1725026299888406529');
|
||||||
|
// setCompanyId('1471673498334113794');
|
||||||
|
// setRegisterStoreId('1471673498413805570');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(options?.query) {
|
||||||
|
//
|
||||||
|
// // options.query.scene = 'companyId%3D1150930317231112193%26wxOpenId%3D111%26ticketId%3D123456%26storeId%3D1150930317436633090'
|
||||||
|
//
|
||||||
|
// //保存登录邀请员工id
|
||||||
|
// if(options.query.referrerUserId) {
|
||||||
|
// setReferrerUserId(options.query.referrerUserId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //保存注册门店id
|
||||||
|
// if(options.query.companyId) {
|
||||||
|
// setCompanyId(options.query.companyId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //保存注册门店id
|
||||||
|
// if(options.query.storeId) {
|
||||||
|
// setRegisterStoreId(options.query.storeId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(options?.query.scene) {
|
||||||
|
// function getQueryParam(queryParams: string, key: string) {
|
||||||
|
// let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
|
||||||
|
// match = queryParams.match(regex);
|
||||||
|
// return match && match[1];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //保存注册门店id
|
||||||
|
// const params = decodeURIComponent(options?.query.scene);
|
||||||
|
// if(params.includes('companyId')) {
|
||||||
|
// setCompanyId(getQueryParam(params, 'companyId') || '');
|
||||||
|
// }
|
||||||
|
// if(params.includes('storeId')) {
|
||||||
|
// setRegisterStoreId(getQueryParam(params, 'storeId') || '');
|
||||||
|
// }
|
||||||
|
// if(options?.query.scene === 'edit_avatar_nickname') {
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uni.reLaunch({
|
||||||
|
// url: '/pages/mine/subs/profile/index'
|
||||||
|
// });
|
||||||
|
// }, 500);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // #ifdef MP
|
||||||
|
// mpUpdate();
|
||||||
|
// // #endif
|
||||||
|
// });
|
||||||
|
// onShow(() => {
|
||||||
|
// console.log('App Show');
|
||||||
|
// });
|
||||||
|
// onHide(() => {
|
||||||
|
// console.log('App Hide');
|
||||||
|
// });
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss'>
|
<style lang='scss'>
|
||||||
|
@@ -26,6 +26,7 @@ export interface GoodsBean {
|
|||||||
name: string;
|
name: string;
|
||||||
price: number;
|
price: number;
|
||||||
send_num: number;
|
send_num: number;
|
||||||
|
priceExt: number;
|
||||||
price_ext: number;
|
price_ext: number;
|
||||||
payPrice: number;
|
payPrice: number;
|
||||||
profile: string;
|
profile: string;
|
||||||
|
@@ -6,7 +6,7 @@ export const getGroupBuyList = (data: {
|
|||||||
pageNum: number,
|
pageNum: number,
|
||||||
pageSize: number,
|
pageSize: number,
|
||||||
obj: {
|
obj: {
|
||||||
status: number,
|
timeStatus: number,
|
||||||
}
|
}
|
||||||
}) => post({ url: '/group/coupons/wx_query', data });
|
}) => post({ url: '/group/coupons/wx_query', data });
|
||||||
|
|
||||||
|
@@ -10,6 +10,7 @@ enum URL {
|
|||||||
login = '/wc/wechat/LoginByMa',
|
login = '/wc/wechat/LoginByMa',
|
||||||
loginByCode = '/wc/wechat/LoginByMaCode',
|
loginByCode = '/wc/wechat/LoginByMaCode',
|
||||||
register = '/wc/wechat/register',
|
register = '/wc/wechat/register',
|
||||||
|
telephone = '/wc/wechat/telephone',
|
||||||
uploadAvatar = '/wc/wechat/uploadImage',
|
uploadAvatar = '/wc/wechat/uploadImage',
|
||||||
logout = '/user/logout',
|
logout = '/user/logout',
|
||||||
// profile = '/user/profile',
|
// profile = '/user/profile',
|
||||||
@@ -30,7 +31,9 @@ enum URL {
|
|||||||
couponList = '/wechat/coupons/coupons/pageList',
|
couponList = '/wechat/coupons/coupons/pageList',
|
||||||
integralList = '/ext/member/integral_query',
|
integralList = '/ext/member/integral_query',
|
||||||
tradeList = '/memberIncoming/wx_balance_records',
|
tradeList = '/memberIncoming/wx_balance_records',
|
||||||
terminal = 'wechat/coupons/terminal?companyId='
|
terminal = 'wechat/coupons/terminal?companyId=',
|
||||||
|
cardLink = '/wc/wechat/get_card_url',
|
||||||
|
registerCoupon = '/couponsStrategy/wx_register_coupon'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUserProfile = () => get<UserBean>({ url: URL.profile });
|
export const getUserProfile = () => get<UserBean>({ url: URL.profile });
|
||||||
@@ -40,6 +43,8 @@ export const updateProfile = (data: any) => post<any>({ url: URL.updateProfile,
|
|||||||
export const login = (data: LoginParams) => post<LoginResult>({ url: URL.login, data });
|
export const login = (data: LoginParams) => post<LoginResult>({ url: URL.login, data });
|
||||||
export const loginByCode = (code: string, companyId: string) => post<any>({ url: URL.loginByCode + `?code=${code}` });
|
export const loginByCode = (code: string, companyId: string) => post<any>({ url: URL.loginByCode + `?code=${code}` });
|
||||||
|
|
||||||
|
export const getTelephone = (data: any) => post<any>({ url: URL.telephone, data });
|
||||||
|
|
||||||
export const register = (data: RegisterParams) => post<LoginResult>({ url: URL.register, data });
|
export const register = (data: RegisterParams) => post<LoginResult>({ url: URL.register, data });
|
||||||
|
|
||||||
export const logout = () => post<any>({ url: URL.logout });
|
export const logout = () => post<any>({ url: URL.logout });
|
||||||
@@ -49,7 +54,7 @@ export const getAddressDetail = (id: string) => get<any>({ url: URL.addressDetai
|
|||||||
|
|
||||||
export const addressCreate = (data: any) => post<any>({ url: URL.addressCreate, data });
|
export const addressCreate = (data: any) => post<any>({ url: URL.addressCreate, data });
|
||||||
export const addressUpdate = (data: any) => post<any>({ url: URL.addressUpdate, data });
|
export const addressUpdate = (data: any) => post<any>({ url: URL.addressUpdate, data });
|
||||||
export const addressDelete = (id: string) => post<any>({ url: URL.addressDelete + `?id=${id}` });
|
export const addressDelete = (id: string) => post<any>({ url: URL.addressDelete + `?addrid=${id}` });
|
||||||
|
|
||||||
export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
|
export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
|
||||||
|
|
||||||
@@ -67,3 +72,7 @@ export const getIntegralList = (data: any) => get({ url: URL.integralList, data
|
|||||||
export const getTerminal = (companyId: string) => get<TerminalBean>({ url: URL.terminal + companyId });
|
export const getTerminal = (companyId: string) => get<TerminalBean>({ url: URL.terminal + companyId });
|
||||||
|
|
||||||
export const getTradeList = (data: any) => post<any>({ url: URL.tradeList, data });
|
export const getTradeList = (data: any) => post<any>({ url: URL.tradeList, data });
|
||||||
|
|
||||||
|
export const getCardLink = () => get<string>({ url: URL.cardLink });
|
||||||
|
|
||||||
|
export const getRegisterCoupon = () => get<any>({ url: URL.registerCoupon });
|
||||||
|
@@ -4,7 +4,8 @@ export interface LoginParams {
|
|||||||
// phone: string;
|
// phone: string;
|
||||||
code: string;
|
code: string;
|
||||||
userInfo: any;
|
userInfo: any;
|
||||||
referrerUserId: string;
|
storeId: string;
|
||||||
|
// referrerUserId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RegisterParams {
|
export interface RegisterParams {
|
||||||
@@ -30,6 +31,7 @@ export interface LoginResult {
|
|||||||
user: UserBean;
|
user: UserBean;
|
||||||
userInfo: any;
|
userInfo: any;
|
||||||
token: string;
|
token: string;
|
||||||
|
maOpenId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IntegralBean {
|
export interface IntegralBean {
|
||||||
|
109
src/components/company-dialog.vue
Normal file
109
src/components/company-dialog.vue
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<template>
|
||||||
|
<uni-popup ref='popupRef' type='bottom' :mask-click='false' @touchmove.stop.prevent=''>
|
||||||
|
<view class='content'>
|
||||||
|
<text class='title'>切换门店</text>
|
||||||
|
<scroll-view scroll-y style='max-height: 600rpx;padding: 15rpx'>
|
||||||
|
<view class='store-item' v-for='(item, index) in companyList' :key='index' @click='() => {
|
||||||
|
handleClick(index)
|
||||||
|
}'>
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<text>{{ item?.companyName || '' }}</text>
|
||||||
|
<image v-if='index===currentIndex' src='/static/images/ic_checkmark_red.png' />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class='close-btn primary-button' @click='close'>
|
||||||
|
<text>取消</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang='ts' setup>
|
||||||
|
const props = defineProps({
|
||||||
|
companyList: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const popupRef = ref();
|
||||||
|
const currentIndex = ref(0);
|
||||||
|
let callback: Function;
|
||||||
|
|
||||||
|
const show = (companyId: string, fn: Function) => {
|
||||||
|
if(companyId) {
|
||||||
|
currentIndex.value = props.companyList.findIndex(item => item.id === companyId);
|
||||||
|
}
|
||||||
|
callback = fn;
|
||||||
|
popupRef.value.open();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClick = (index: number) => {
|
||||||
|
currentIndex.value = index;
|
||||||
|
callback(index);
|
||||||
|
close();
|
||||||
|
};
|
||||||
|
|
||||||
|
const close = () => {
|
||||||
|
popupRef.value.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show, close
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 20rpx 20rpx 0 0;
|
||||||
|
padding: 20rpx 30rpx 30rpx 30rpx;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-self: center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
font-size: 35rpx;
|
||||||
|
color: #333333;
|
||||||
|
//padding: 20rpx 20rpx;
|
||||||
|
|
||||||
|
|
||||||
|
.c-flex-row {
|
||||||
|
text {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.store-item:after {
|
||||||
|
content: '';
|
||||||
|
background: #F5F5F5;
|
||||||
|
height: 0.5rpx;
|
||||||
|
width: 100%;
|
||||||
|
margin: 25rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
background: #F5F5F5;
|
||||||
|
color: #333333;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -66,7 +66,7 @@ const buildSignParams = computed(() => {
|
|||||||
return sortASCII({
|
return sortASCII({
|
||||||
client_sn: props.payParams.client_sn || '',
|
client_sn: props.payParams.client_sn || '',
|
||||||
return_url: props.payParams.return_url,
|
return_url: props.payParams.return_url,
|
||||||
total_amount: (props.payParams.total_amount * 100).toString(),
|
total_amount: Number((props.payParams.total_amount * 100).toFixed(2)),
|
||||||
terminal_sn: props.payParams.terminal_sn,
|
terminal_sn: props.payParams.terminal_sn,
|
||||||
subject: props.payParams.subject,
|
subject: props.payParams.subject,
|
||||||
subject_img: props.payParams.subject_img,
|
subject_img: props.payParams.subject_img,
|
||||||
|
@@ -3,9 +3,10 @@
|
|||||||
<view class='content'>
|
<view class='content'>
|
||||||
<view class='c-flex-row' style='align-items: flex-start'>
|
<view class='c-flex-row' style='align-items: flex-start'>
|
||||||
<image class='goods-image' :src='goodsDetailBean?.images||defaultImage' />
|
<image class='goods-image' :src='goodsDetailBean?.images||defaultImage' />
|
||||||
<view class='c-flex-column' style='flex: 1'>
|
<view class='c-flex-column' style='flex: 1;display: inline-grid'>
|
||||||
<text class='goods-name'>{{ goodsDetailBean?.name || '未知' }}</text>
|
<text class='goods-name'>{{ goodsDetailBean?.name || '未知' }}</text>
|
||||||
<text class='goods-price'>{{ flashPrice > 0 ? `${flashPrice}` : `${goodsDetailBean?.consumePrice || 0}` || 0
|
<text class='goods-price'>
|
||||||
|
{{ flashPrice > 0 ? `${flashPrice}` : `${goodsDetailBean?.consumePrice || 0}` || 0
|
||||||
}}
|
}}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
:class='{"sku-item-active":currentColorIndex==index}'
|
:class='{"sku-item-active":currentColorIndex==index}'
|
||||||
v-for='(item, index) in skuColorList' :key='index'
|
v-for='(item, index) in skuColorList' :key='index'
|
||||||
@click='colorChange(index)'>
|
@click='colorChange(index)'>
|
||||||
<text>{{ item }}</text>
|
<text>{{ item||'均色' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@
|
|||||||
:class='{"sku-item-active":currentSizeIndex==index,"sku-item-disabled":item.existingNumber<=0}'
|
:class='{"sku-item-active":currentSizeIndex==index,"sku-item-disabled":item.existingNumber<=0}'
|
||||||
v-for='(item, index) in skuSizeList' :key='index'
|
v-for='(item, index) in skuSizeList' :key='index'
|
||||||
@click='sizeChange(index)'>
|
@click='sizeChange(index)'>
|
||||||
<text>{{ item.sizeName }}</text>
|
<text>{{ item.sizeName||'均码' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text v-else style='color: #999999;font-size: 30rpx'>暂无库存</text>
|
<text v-else style='color: #999999;font-size: 30rpx'>暂无库存</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button class='primary-button' :plain='currentSizeIndex<=0' :disabled='currentSizeIndex<=0' @click='confirm'>
|
<button class='primary-button' :plain='currentSizeIndex<0' :disabled='currentSizeIndex<0' @click='confirm'>
|
||||||
确定
|
确定
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
@@ -84,7 +85,8 @@ const show = async (goodsId: string, fn: Function) => {
|
|||||||
callback = fn;
|
callback = fn;
|
||||||
|
|
||||||
goodsDetailBean.value = await getGoodsDetail(goodsId);
|
goodsDetailBean.value = await getGoodsDetail(goodsId);
|
||||||
goodsDetailBean.value.consumePrice = Number((goodsDetailBean.value?.price * ((userInfo?.value?.levelEntity?.discount || 100) / 100)).toFixed(2));
|
goodsDetailBean.value.price = userStore.getRealGoodsPrice(goodsDetailBean.value?.price,goodsDetailBean.value?.priceExt)
|
||||||
|
goodsDetailBean.value.consumePrice = Number((goodsDetailBean.value?.price * userInfo?.value.userDiscount).toFixed(2));
|
||||||
|
|
||||||
if((goodsDetailBean.value?.stocks?.length || 0) <= 0) {
|
if((goodsDetailBean.value?.stocks?.length || 0) <= 0) {
|
||||||
showToast('暂无库存');
|
showToast('暂无库存');
|
||||||
@@ -111,8 +113,8 @@ const show = async (goodsId: string, fn: Function) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(skuSizeList) {
|
if(skuSizeList) {
|
||||||
//skuSizeList.value![0].existingNumber = 2;
|
// skuSizeList.value![0].existingNumber = 2;
|
||||||
//skuSizeList.value![2].existingNumber = 2;
|
// skuSizeList.value![2].existingNumber = 2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -189,6 +191,7 @@ defineExpose({
|
|||||||
color: #333333;
|
color: #333333;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-price {
|
.goods-price {
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
"name": "SUKE-MP",
|
"name": "SUKE-MP",
|
||||||
"appid": "",
|
"appid": "",
|
||||||
"description": "",
|
"description": "",
|
||||||
"versionName": "1.0.0",
|
"versionName": "3.0.2",
|
||||||
"versionCode": "100",
|
"versionCode": "302",
|
||||||
"transformPx": false,
|
"transformPx": false,
|
||||||
"app-plus": {
|
"app-plus": {
|
||||||
"usingComponents": true,
|
"usingComponents": true,
|
||||||
@@ -18,13 +18,11 @@
|
|||||||
"modules": {}
|
"modules": {}
|
||||||
},
|
},
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"appid": "wx92e663dc11d0c0a8",
|
"appid": "wx67a750d0ceed4d88",
|
||||||
// "appid": "wx67a750d0ceed4d88",
|
|
||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": false
|
"urlCheck": false
|
||||||
},
|
},
|
||||||
"usingComponents": true,
|
"usingComponents": true,
|
||||||
|
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"sqb-pay": {
|
"sqb-pay": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
@@ -42,4 +40,4 @@
|
|||||||
"base": "/uniapp-vue3-template/"
|
"base": "/uniapp-vue3-template/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -38,6 +38,12 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "肃客会员"
|
"navigationBarTitleText": "肃客会员"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/coupons/ticketsBuy/ticketsBuy",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "团购详情"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
@@ -50,6 +56,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "register/index",
|
"path": "register/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "用户注册"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "register/reward",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "注册有礼"
|
"navigationBarTitleText": "注册有礼"
|
||||||
}
|
}
|
||||||
@@ -196,6 +208,12 @@
|
|||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "新增收货地址"
|
"navigationBarTitleText": "新增收货地址"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "contact/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "联系商家"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<view class='swiper-container'>
|
<view class='swiper-container'>
|
||||||
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
||||||
<swiper-item v-for='(item,index) in bannerList' :key='index'>
|
<swiper-item v-for='(item,index) in bannerList' :key='index'>
|
||||||
<image :src='item||defaultImage' />
|
<image :src='item||defaultImage' mode='aspectFill' />
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
<view class='indicator'>
|
<view class='indicator'>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<text>{{ groupBuyBean?.payPrice || 0 }}</text>
|
<text>{{ groupBuyBean?.payPrice || 0 }}</text>
|
||||||
<text>¥{{ groupBuyBean?.price || 0 }}</text>
|
<text>¥{{ groupBuyBean?.price || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class='countdown-time c-flex-column'>
|
<view v-if='isPending()' class='countdown-time c-flex-column'>
|
||||||
<view class='c-flex-row'>{{ countdownTime?.days || 0 }}天
|
<view class='c-flex-row'>{{ countdownTime?.days || 0 }}天
|
||||||
<text class='time'>{{ countdownTime?.hours || '00' }}</text>
|
<text class='time'>{{ countdownTime?.hours || '00' }}</text>
|
||||||
:
|
:
|
||||||
@@ -29,6 +29,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<text>距离活动结束仅剩</text>
|
<text>距离活动结束仅剩</text>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-else>
|
||||||
|
<text style='font-size: 35rpx;color: #FFFFFF'>
|
||||||
|
{{ isNotStated() ? '未开始' : '已结束' }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='goods-info-view c-flex-column'>
|
<view class='goods-info-view c-flex-column'>
|
||||||
@@ -38,7 +43,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text style='flex: 1'>{{ groupBuyBean?.name }}</text>
|
<text style='flex: 1'>{{ groupBuyBean?.name || '未知' }}</text>
|
||||||
<view class='share-button c-flex-column'>
|
<view class='share-button c-flex-column'>
|
||||||
<image :src='assetsUrl("ic_share.png")'></image>
|
<image :src='assetsUrl("ic_share.png")'></image>
|
||||||
<button class='btn' plain open-type='share'>分享</button>
|
<button class='btn' plain open-type='share'>分享</button>
|
||||||
@@ -55,14 +60,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='recommend-view c-flex-column' v-if='recommendList?.length>0'>
|
<view class='recommend-view c-flex-column' v-if='(recommendList?.length||0)>0'>
|
||||||
<text>浏览此商品的客户还浏览了</text>
|
<text>浏览此商品的客户还浏览了</text>
|
||||||
<scroll-view scroll-x>
|
<scroll-view scroll-x>
|
||||||
<view style='display: inline-block' v-for='(item, index) in recommendList'
|
<view style='display: inline-block' v-for='(item, index) in recommendList'
|
||||||
:key='index'>
|
:key='index'>
|
||||||
<view class='recommend-item c-flex-column'>
|
<view class='recommend-item c-flex-column'>
|
||||||
<image :src='item.images' />
|
<image :src='item.images||defaultImage' />
|
||||||
<text>{{ item.goodsName }}</text>
|
<text>{{ item.goodsName || '未知' }}</text>
|
||||||
<text class='goods-price'>{{ item.price }}</text>
|
<text class='goods-price'>{{ item.price }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -122,7 +127,10 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='bottom-view c-flex-row'>
|
<view class='bottom-view c-flex-row'>
|
||||||
<view class='place-order-button' @click.stop='placeOrder'>跟团购买</view>
|
<button v-if='isPending()' class='place-order-button' @click.stop='placeOrder'>跟团购买</button>
|
||||||
|
<button v-else class='place-order-button-disable' :plain='true' :disabled='true'>
|
||||||
|
{{ isNotStated() ? '即将开始' : '已结束' }}
|
||||||
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<sku-dialog ref='skuDialogRef' :flash-price='Number(groupBuyBean?.payPrice) || 0' />
|
<sku-dialog ref='skuDialogRef' :flash-price='Number(groupBuyBean?.payPrice) || 0' />
|
||||||
@@ -166,12 +174,18 @@ onLoad(async (e: any) => {
|
|||||||
if(isLogin()) {
|
if(isLogin()) {
|
||||||
await uni.showLoading();
|
await uni.showLoading();
|
||||||
groupBuyBean.value = await getGroupBuyDetail(e.id);
|
groupBuyBean.value = await getGroupBuyDetail(e.id);
|
||||||
groupBuyBean.value.goods.price = groupBuyBean.value.price;
|
// setCompanyId('1512403904150138881');
|
||||||
bannerList.value = JSON.parse(groupBuyBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images);
|
// groupBuyBean.value = await getGroupBuyDetail('1740922051118063618');
|
||||||
countdown();
|
if(groupBuyBean.value) {
|
||||||
await fetchRecommendList();
|
groupBuyBean.value.goods.price = groupBuyBean.value.price;
|
||||||
await fetchBuyRecordList();
|
bannerList.value = JSON.parse(groupBuyBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images);
|
||||||
|
countdown();
|
||||||
|
await fetchRecommendList();
|
||||||
|
await fetchBuyRecordList();
|
||||||
|
}
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
} else {
|
||||||
|
goPath('/pages/common/login/index');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -181,6 +195,25 @@ onUnload(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShareAppMessage((e) => {
|
||||||
|
return {
|
||||||
|
title: groupBuyBean.value?.goods?.name || 'VIP顾客中心',
|
||||||
|
path: `/pages/common/groupbuy/detail?id=${groupBuyBean.value?.id}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const isNotStated = () => {
|
||||||
|
return dayjs(groupBuyBean.value?.startDate).isAfter(Date.now());
|
||||||
|
};
|
||||||
|
|
||||||
|
const isPending = () => {
|
||||||
|
return dayjs(groupBuyBean.value?.startDate).isBefore(Date.now()) && dayjs(groupBuyBean.value?.endDate).isAfter(Date.now());
|
||||||
|
};
|
||||||
|
|
||||||
|
const isEnded = () => {
|
||||||
|
return dayjs(groupBuyBean.value?.endDate).isBefore(Date.now());
|
||||||
|
};
|
||||||
|
|
||||||
const getStockColorCount = computed(() => {
|
const getStockColorCount = computed(() => {
|
||||||
const list = Array.from(new Set(groupBuyBean.value?.goods?.stocks?.map(item => item.colorName)))
|
const list = Array.from(new Set(groupBuyBean.value?.goods?.stocks?.map(item => item.colorName)))
|
||||||
.map(colorName => groupBuyBean.value?.goods?.stocks?.find(item => item.colorName === colorName)!);
|
.map(colorName => groupBuyBean.value?.goods?.stocks?.find(item => item.colorName === colorName)!);
|
||||||
@@ -194,7 +227,7 @@ const fetchRecommendList = async () => {
|
|||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
bean: {
|
bean: {
|
||||||
keyword: '',
|
keyword: '',
|
||||||
typeIds: ['1724629185362591745']
|
typeIds: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -550,6 +583,13 @@ const placeOrder = async () => {
|
|||||||
background: #F32B2B;
|
background: #F32B2B;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
border-radius: 40rpx;
|
border-radius: 40rpx;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.place-order-button-disable {
|
||||||
|
@extend .place-order-button;
|
||||||
|
background: #b9b5b5;
|
||||||
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
<!-- <u-list-item v-for='(item,index) in groupbuyList' :key='index'>-->
|
<!-- <u-list-item v-for='(item,index) in groupbuyList' :key='index'>-->
|
||||||
<view class='c-flex-column' v-for='(item,index) in groupbuyList' :key='index'>
|
<view class='c-flex-column' v-for='(item,index) in groupbuyList' :key='index'>
|
||||||
<view class='item c-flex-row' @click.stop='goPath(`/pages/common/groupbuy/detail?id=${item.id}`)'>
|
<view class='item c-flex-row' @click.stop='goPath(`/pages/common/groupbuy/detail?id=${item.id}`)'>
|
||||||
<image class='goods-image' :src='JSON.parse(item.content)[0].images||defaultImage' />
|
<image class='goods-image' mode='aspectFill' :src='JSON.parse(item.content)[0].images||defaultImage' />
|
||||||
<view class='c-flex-column' style='flex: 1'>
|
<view class='c-flex-column' style='flex: 1'>
|
||||||
<view class='goods-name'>{{ item.name }}</view>
|
<view class='goods-name'>{{ item.name }}</view>
|
||||||
<view class='middle-view c-flex-row'>
|
<view class='middle-view c-flex-row'>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<image :src='assetsUrl("ic_decline.png")' />
|
<image :src='assetsUrl("ic_decline.png")' />
|
||||||
<text>直降¥{{ (item.price - item.payPrice).toFixed(2) }}</text>
|
<text>直降¥{{ (item.price - item.payPrice).toFixed(2) }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text>即将恢复</text>
|
<text>{{ tabIndex == 0 ? '即将恢复' : '即将开始' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class='bottom-price c-flex-row' :class='{"bottom-price-disabled":tabIndex==1}'>
|
<view class='bottom-price c-flex-row' :class='{"bottom-price-disabled":tabIndex==1}'>
|
||||||
<text>{{ item.payPrice }}</text>
|
<text>{{ item.payPrice }}</text>
|
||||||
@@ -31,6 +31,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- </u-list-item>-->
|
<!-- </u-list-item>-->
|
||||||
<!-- </u-list>-->
|
<!-- </u-list>-->
|
||||||
|
|
||||||
|
<u-empty v-if='groupbuyList.length === 0' text='暂无团购活动' marginTop='100' />
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -62,7 +64,7 @@ const fetchData = async (refresh: boolean = true) => {
|
|||||||
pageNum: currentPageNum.value,
|
pageNum: currentPageNum.value,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
obj: {
|
obj: {
|
||||||
status: tabIndex.value
|
timeStatus: tabIndex.value + 1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
groupbuyList.value = list;
|
groupbuyList.value = list;
|
||||||
@@ -112,6 +114,7 @@ const loadMore = () => {
|
|||||||
|
|
||||||
.scroll-view {
|
.scroll-view {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
padding: 20rpx 30rpx 40rpx 30rpx;
|
padding: 20rpx 30rpx 40rpx 30rpx;
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { pay, progress } from '@/api/groupbuy';
|
import { pay, progress } from '@/api/groupbuy';
|
||||||
import { OrderBean } from '@/api/order/types';
|
import { OrderBean } from '@/api/order/types';
|
||||||
import { parseParameter, sortASCII } from '@/utils';
|
import { parseParameter, showToast, sortASCII } from '@/utils';
|
||||||
import { hexMD5 } from '@/utils/common/md5';
|
import { hexMD5 } from '@/utils/common/md5';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { handlePayResult } from '@/utils/order';
|
import { handlePayResult } from '@/utils/order';
|
||||||
@@ -65,7 +65,7 @@ const buildSqbParams = computed(() => {
|
|||||||
const params = sortASCII({
|
const params = sortASCII({
|
||||||
client_sn: orderBean.value?.id || '',
|
client_sn: orderBean.value?.id || '',
|
||||||
return_url: '/pages/common/payresult/index',
|
return_url: '/pages/common/payresult/index',
|
||||||
total_amount: ((orderBean.value?.totalPrice || 0) * 100).toString(),
|
total_amount: Number(((orderBean.value?.totalPrice || 0) * 100).toFixed(2)),
|
||||||
terminal_sn: terminalInfo.value.terminalSn,
|
terminal_sn: terminalInfo.value.terminalSn,
|
||||||
subject: '商品团购券',
|
subject: '商品团购券',
|
||||||
subject_img: orderBean?.value?.orderGoods[0].images || '',
|
subject_img: orderBean?.value?.orderGoods[0].images || '',
|
||||||
@@ -82,9 +82,17 @@ const buildSqbParams = computed(() => {
|
|||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
handlePayResult(orderBean.value?.id, e, {
|
handlePayResult(orderBean.value?.id, e, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
pay({
|
showToast('支付成功', {
|
||||||
'orderId': orderBean.value?.id,
|
icon: 'success',
|
||||||
'result': 'xxx'
|
complete: () => {
|
||||||
|
pay({
|
||||||
|
'orderId': orderBean.value?.id,
|
||||||
|
'result': 'xxx'
|
||||||
|
}).then(res => {
|
||||||
|
uni.navigateBack();
|
||||||
|
});
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -10,11 +10,15 @@
|
|||||||
微信登录
|
微信登录
|
||||||
</button>
|
</button>
|
||||||
<view class='hint'>
|
<view class='hint'>
|
||||||
登录代表同意
|
<image @click.stop='bindCheck'
|
||||||
<text class='link' @click.stop='openPrivacy'>
|
:src='isAgreePrivacy?("/static/images/ic_checked_green.png"):("/static/images/ic_checked_gray.png")' />
|
||||||
《小程序隐私保护协议》
|
|
||||||
|
<text @click.stop='bindCheck'>请先阅读并同意
|
||||||
|
<text class='link' @click.stop='openPrivacy'>
|
||||||
|
《小程序隐私保护协议》
|
||||||
|
</text>
|
||||||
|
并授权使用您的账号信息(如昵称、头像、收获地址)以便您统一管理
|
||||||
</text>
|
</text>
|
||||||
并授权使用您的账号信息(如昵称、头像、收获地址)以便您统一管理
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -22,17 +26,28 @@
|
|||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { showToast } from '@/utils';
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
const isAgreePrivacy = ref(false);
|
||||||
|
|
||||||
function wechatLogin() {
|
function wechatLogin() {
|
||||||
|
if(!isAgreePrivacy.value) {
|
||||||
|
showToast('请先阅读并同意小程序隐私保护协议');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uni.showLoading();
|
uni.showLoading();
|
||||||
userStore.authLogin().then(() => {
|
userStore.login().then(() => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.reLaunch({ url: '/pages/home/index' });
|
uni.reLaunch({ url: '/pages/home/index' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bindCheck = () => {
|
||||||
|
isAgreePrivacy.value = !isAgreePrivacy.value;
|
||||||
|
};
|
||||||
|
|
||||||
const openPrivacy = () => {
|
const openPrivacy = () => {
|
||||||
wx.openPrivacyContract({
|
wx.openPrivacyContract({
|
||||||
success: () => {
|
success: () => {
|
||||||
@@ -43,6 +58,7 @@ const openPrivacy = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
@@ -81,14 +97,23 @@ const openPrivacy = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hint {
|
.hint {
|
||||||
|
display: inline-block;
|
||||||
padding: 20rpx 50rpx;
|
padding: 20rpx 50rpx;
|
||||||
font-size: 25rpx;
|
font-size: 25rpx;
|
||||||
color: $u-tips-color;
|
color: $u-tips-color;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
align-items: center;
|
||||||
|
bottom: 50rpx;
|
||||||
|
|
||||||
.link {
|
.link {
|
||||||
color: $u-warning;
|
color: $u-warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
margin-bottom: -5rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -1,144 +1,207 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class='content'>
|
<view class='content'>
|
||||||
<image class='bg-image' :src='assetsUrl("bg_register.png")' />
|
<view class='c-flex-column avatar-container'>
|
||||||
<view class='card-view'>
|
<image class='avatar' :src='avatarUrl' />
|
||||||
<view class='mobile-view c-flex-row'>
|
<button class='avatar-button' open-type='chooseAvatar' @chooseavatar='chooseAvatar' />
|
||||||
<image :src='assetsUrl("ic_register_mobile.png")' />
|
|
||||||
<input placeholder='请输入手机号' inputmode='number' maxlength='11' />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class='captcha-view c-flex-row'>
|
|
||||||
<view class='c-flex-row'>
|
|
||||||
<image :src='assetsUrl("ic_register_captcha.png")' />
|
|
||||||
<input placeholder='请输入验证码' inputmode='number' maxlength='6' />
|
|
||||||
</view>
|
|
||||||
<text @click.stop='startCountdown'>{{ countdown }}</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<text class='btn_register' @click.stop='register'>注册领券</text>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class='c-flex-row' style='margin-top: 60rpx'>
|
||||||
|
<label class='row-title'>姓名</label>
|
||||||
|
<input class='row-value' type='nickname' placeholder='请输入手机号' v-model='nickName' />
|
||||||
|
</view>
|
||||||
|
<view class='divider' />
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<label class='row-title'>手机号</label>
|
||||||
|
<input class='row-value' placeholder='请输入手机号' type='text' v-model='telephone' />
|
||||||
|
<button class='primary-button authorize-button' open-type='getPhoneNumber' @getphonenumber='getPhoneNumber'>
|
||||||
|
获取手机号
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
<view class='divider' />
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<label class='row-title'>生日</label>
|
||||||
|
<picker mode='date' @change='changeDate'>
|
||||||
|
<text class='row-value'>{{ dayjs(birthday).format('YYYY-MM-DD') || '请选择生日' }}</text>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class='divider' />
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<label class='row-title'>性别</label>
|
||||||
|
<view class='c-flex-row' @click.stop='changeGender(0)'>
|
||||||
|
<image class='gender-image'
|
||||||
|
:src='assetsUrl(gender==="男"?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||||
|
<text class='gender-text'>男</text>
|
||||||
|
</view>
|
||||||
|
<view class='c-flex-row' @click.stop='changeGender(1)'>
|
||||||
|
<image class='gender-image'
|
||||||
|
:src='assetsUrl(gender==="女"?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||||
|
<text class='gender-text'>女</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style='height: 100rpx' />
|
||||||
|
<button class='primary-button submit-button' @click='save'>确定</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { getTelephone } from '@/api/user';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
import { getRegisterStoreId, getSessionKey, showToast } from '@/utils';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
const countdown = ref('获取验证码');
|
const userStore = useUserStore();
|
||||||
|
const { userInfo } = storeToRefs(userStore);
|
||||||
|
|
||||||
onLoad((e) => {
|
const birthday = ref(userInfo.value.birthday || dayjs().format('YYYY-MM-DD'));
|
||||||
|
const nickName = ref(userInfo.value.nickName);
|
||||||
|
const gender = ref(userInfo.value.gender);
|
||||||
|
const telephone = ref(userInfo.value.telephone);
|
||||||
|
const avatarUrl = ref(userInfo.value.image);
|
||||||
|
|
||||||
});
|
const chooseAvatar = (e: any) => {
|
||||||
|
uni.showLoading();
|
||||||
|
uni.uploadFile({
|
||||||
|
url: import.meta.env.VITE_APP_BASE_API + '/wc/wechat/uploadImage',
|
||||||
|
filePath: e.detail.avatarUrl,
|
||||||
|
name: 'fileName',
|
||||||
|
header: {
|
||||||
|
'Content-Type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
success: (res: any) => {
|
||||||
|
avatarUrl.value = JSON.parse(res.data).data;
|
||||||
|
},
|
||||||
|
error: (err: any) => {
|
||||||
|
showToast('上传失败');
|
||||||
|
},
|
||||||
|
complete() {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const startCountdown = () => {
|
const getPhoneNumber = (e: any) => {
|
||||||
if(countdown.value !== '获取验证码') {
|
if(e.detail.errMsg === 'getPhoneNumber:ok') {
|
||||||
|
uni.login({
|
||||||
|
success: res => {
|
||||||
|
getTelephone({
|
||||||
|
sessionKey: getSessionKey(),
|
||||||
|
code: res.code,
|
||||||
|
iv: e.detail.iv,
|
||||||
|
encryptedData: e.detail.encryptedData
|
||||||
|
}).then(response => {
|
||||||
|
if(response.phoneNumber) {
|
||||||
|
telephone.value = response.phoneNumber;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeDate = (e: any) => {
|
||||||
|
birthday.value = e.detail.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeGender = (index: number) => {
|
||||||
|
gender.value = index === 0 ? '男' : '女';
|
||||||
|
};
|
||||||
|
|
||||||
|
const save = async () => {
|
||||||
|
if(!getRegisterStoreId()) {
|
||||||
|
showToast('请从公众号消息窗口点击店名打开小程序');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let time = 120;
|
|
||||||
let interval = setInterval(() => {
|
|
||||||
time--;
|
|
||||||
countdown.value = `${time}s 重新获取`;
|
|
||||||
if(time == 0) {
|
|
||||||
clearInterval(interval);
|
|
||||||
countdown.value = '获取验证码';
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
const register = () => {
|
await uni.showLoading();
|
||||||
};
|
const registerForm = {
|
||||||
|
image: avatarUrl.value,
|
||||||
|
avatarUrl: avatarUrl.value,
|
||||||
|
nickName: nickName.value,
|
||||||
|
telephone: telephone.value,
|
||||||
|
birthday: dayjs(birthday.value).isValid() ? dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
|
gender: gender.value
|
||||||
|
};
|
||||||
|
|
||||||
|
getApp().globalData?.logger.info('register params: ', registerForm);
|
||||||
|
const result = await userStore.register(registerForm);
|
||||||
|
getApp().globalData?.logger.info('register params: ', registerForm);
|
||||||
|
if(result) {
|
||||||
|
showToast('注册成功');
|
||||||
|
await uni.reLaunch({
|
||||||
|
url: '/pages/home/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
uni.hideLoading();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.content {
|
.content {
|
||||||
position: relative;
|
display: flex;
|
||||||
height: 100vh;
|
background: white;
|
||||||
}
|
padding: 30rpx;
|
||||||
|
|
||||||
.bg-image {
|
.divider {
|
||||||
position: fixed;
|
margin: 30rpx 5rpx;
|
||||||
height: 100vh;
|
|
||||||
width: 100%;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-view {
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
margin: 0 50rpx;
|
|
||||||
padding: 40rpx;
|
|
||||||
top: 600rpx;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.mobile-view {
|
|
||||||
border-radius: 10rpx;
|
|
||||||
border: 1rpx solid #D8D8D8;
|
|
||||||
padding-left: 28rpx;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 36rpx;
|
|
||||||
height: 36rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
flex: 1;
|
|
||||||
height: 80rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #333333;
|
|
||||||
margin-left: 26rpx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.captcha-view {
|
.row-title {
|
||||||
margin-top: 20rpx;
|
|
||||||
|
|
||||||
.c-flex-row {
|
|
||||||
border-radius: 10rpx;
|
|
||||||
border: 1rpx solid #D8D8D8;
|
|
||||||
padding-left: 28rpx;
|
|
||||||
flex: 1;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 33rpx;
|
|
||||||
height: 26rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
height: 80rpx;
|
|
||||||
font-size: 30rpx;
|
|
||||||
color: #333333;
|
|
||||||
margin-left: 26rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
text {
|
|
||||||
display: flex;
|
|
||||||
height: 80rpx;
|
|
||||||
background: #FFD436;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
margin-left: 12rpx;
|
|
||||||
padding: 0 15rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn_register {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 90rpx;
|
|
||||||
background: #F53636;
|
|
||||||
border-radius: 10rpx;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #FFFFFF;
|
color: #666666;
|
||||||
margin-top: 46rpx;
|
width: 150rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-value {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.avatar-container {
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 150rpx;
|
||||||
|
height: 150rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-button {
|
||||||
|
width: 150rpx;
|
||||||
|
height: 150rpx;
|
||||||
|
background-color: transparent;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorize-button {
|
||||||
|
width: auto;
|
||||||
|
font-size: 20rpx;
|
||||||
|
min-width: auto;
|
||||||
|
height: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gender-image {
|
||||||
|
width: 37rpx;
|
||||||
|
height: 37rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gender-text {
|
||||||
|
width: 80rpx;
|
||||||
|
color: #333333;
|
||||||
|
font-size: 30rpx;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-button {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
228
src/pages/common/register/reward.vue
Normal file
228
src/pages/common/register/reward.vue
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
<template>
|
||||||
|
<view class='content'>
|
||||||
|
<image class='bg-image' :src='assetsUrl("bg_register.png")' />
|
||||||
|
|
||||||
|
<image :src='assetsUrl("ic_register_gift_text.png")'
|
||||||
|
style='align-self: center;position: relative;width: 356rpx;height: 124rpx;margin-top: 70rpx' />
|
||||||
|
<view class='card-view'>
|
||||||
|
<view class='mobile-view c-flex-row' style='display: none'>
|
||||||
|
<image :src='assetsUrl("ic_register_mobile.png")' />
|
||||||
|
<input placeholder='请输入手机号' inputmode='number' maxLength='11' />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class='captcha-view c-flex-row' style='display: none'>
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<image :src='assetsUrl("ic_register_captcha.png")' />
|
||||||
|
<input placeholder='请输入验证码' inputmode='number' maxLength='6' />
|
||||||
|
</view>
|
||||||
|
<text @click.stop='startCountdown'>{{ countdown }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<text class='btn_register' style='display: none' @click.stop='register'>注册领券</text>
|
||||||
|
|
||||||
|
<image :src='companyConfigInfo.regqrcode||defaultImage' :show-menu-by-longpress='true' mode='aspectFill'
|
||||||
|
style='width: 439rpx;height: 439rpx;align-self: center' />
|
||||||
|
<text style='font-size: 26rpx;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
align-self: center;color: #666666;'>长按扫码注册
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<template v-if='couponBean&&couponBean.status==0'>
|
||||||
|
<view class='divider' />
|
||||||
|
<view class='coupon c-flex-column' @click.stop='goPath("/pages/mine/subs/coupon/index")'>
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<text class='coupon-name'>{{ couponBean.title }}</text>
|
||||||
|
<image :src='assetsUrl("ic_arrow_right_gray.png")' />
|
||||||
|
</view>
|
||||||
|
<text class='expired-time'>
|
||||||
|
有效期至{{ dayjs(Date.now()).add(couponBean.triggerEndDay, 'day').format('YYYY.MM.DD') }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class='divider' />
|
||||||
|
|
||||||
|
<text style='font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;margin-top: 20rpx'>福利详情
|
||||||
|
</text>
|
||||||
|
<text style='font-size: 28rpx;
|
||||||
|
color: #333333;margin-top: 14rpx'>1.优惠金额{{ couponBean.reduce }}元\n
|
||||||
|
2.满{{ couponBean.threshold }}减{{ couponBean.reduce }}\n
|
||||||
|
3.赠送{{ couponBean.publicNum }}张
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<text style='font-size: 28rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;margin-top: 20rpx'>
|
||||||
|
微信扫一扫领取会员卡
|
||||||
|
</text>
|
||||||
|
<text style='font-size: 28rpx;
|
||||||
|
color: #333333;margin-top: 14rpx'>
|
||||||
|
1、及时接受消费小票\n
|
||||||
|
2、随时查询消费记录\n
|
||||||
|
3、及时接收优惠信息
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang='ts' setup>
|
||||||
|
import { assetsUrl, defaultImage } from '@/utils/assets';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
import { goPath } from '@/utils';
|
||||||
|
import { getRegisterCoupon } from '@/api/user';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const { companyConfigInfo } = storeToRefs(userStore);
|
||||||
|
|
||||||
|
const countdown = ref('获取验证码');
|
||||||
|
const couponBean = ref();
|
||||||
|
|
||||||
|
onLoad(async (e) => {
|
||||||
|
couponBean.value = await getRegisterCoupon();
|
||||||
|
});
|
||||||
|
|
||||||
|
const startCountdown = () => {
|
||||||
|
if(countdown.value !== '获取验证码') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let time = 120;
|
||||||
|
let interval = setInterval(() => {
|
||||||
|
time--;
|
||||||
|
countdown.value = `${time}s 重新获取`;
|
||||||
|
if(time == 0) {
|
||||||
|
clearInterval(interval);
|
||||||
|
countdown.value = '获取验证码';
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
};
|
||||||
|
|
||||||
|
const register = () => {
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
.content {
|
||||||
|
position: relative;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-image {
|
||||||
|
position: fixed;
|
||||||
|
height: 100vh;
|
||||||
|
width: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-view {
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
margin: 0 40rpx;
|
||||||
|
padding: 50rpx;
|
||||||
|
top: 150rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.mobile-view {
|
||||||
|
border-radius: 10rpx;
|
||||||
|
border: 1rpx solid #D8D8D8;
|
||||||
|
padding-left: 28rpx;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
flex: 1;
|
||||||
|
height: 80rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333333;
|
||||||
|
margin-left: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.captcha-view {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
|
||||||
|
.c-flex-row {
|
||||||
|
border-radius: 10rpx;
|
||||||
|
border: 1rpx solid #D8D8D8;
|
||||||
|
padding-left: 28rpx;
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 33rpx;
|
||||||
|
height: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
height: 80rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333333;
|
||||||
|
margin-left: 26rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
display: flex;
|
||||||
|
height: 80rpx;
|
||||||
|
background: #FFD436;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
padding: 0 15rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_register {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 90rpx;
|
||||||
|
background: #F53636;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
margin-top: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
border-bottom-style: dashed;
|
||||||
|
border-color: #E98585;
|
||||||
|
border-width: 0.2rpx;
|
||||||
|
margin-top: 34rpx
|
||||||
|
}
|
||||||
|
|
||||||
|
.coupon {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
|
||||||
|
.coupon-name {
|
||||||
|
display: flex;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #D95554;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 13rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expired-time {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<web-view class="h-full" :src="url" />
|
<web-view class='h-full' :src='url' />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang='ts'>
|
||||||
const url = ref<string>('');
|
const url = ref<string>('');
|
||||||
|
|
||||||
onLoad((params: any) => {
|
onLoad((params: any) => {
|
||||||
if (params.url)
|
if(params.url)
|
||||||
url.value = params.url;
|
url.value = decodeURIComponent(params.url);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
29
src/pages/coupons/ticketsBuy/ticketsBuy.vue
Normal file
29
src/pages/coupons/ticketsBuy/ticketsBuy.vue
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang='ts' setup>
|
||||||
|
onLoad((options) => {
|
||||||
|
getApp().logger?.info('ticketsBuy options: ', options);
|
||||||
|
let couponId = options?.couponsId;
|
||||||
|
if(options?.query && couponId == undefined) {
|
||||||
|
const params = decodeURIComponent(options?.query);
|
||||||
|
couponId = getQueryParam(params, 'couponsId');
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: `/pages/common/groupbuy/detail?id=${couponId}`
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
});
|
||||||
|
|
||||||
|
function getQueryParam(queryParams: string, key: string) {
|
||||||
|
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
|
||||||
|
match = queryParams.match(regex);
|
||||||
|
return match && match[1];
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
|
||||||
|
</style>
|
@@ -15,8 +15,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='user-info-card' @click.stop='goPath("/pages/mine/index")'>
|
<view class='user-info-card' @click.stop='goPath("/pages/mine/index")'>
|
||||||
<image class='user-avatar' :src='userInfo.image||defaultAvatar' mode='aspectFill' />
|
<image class='user-avatar' :src='userInfo?.image||defaultAvatar' mode='aspectFill' />
|
||||||
<text class='user-name primary-text-color'>{{ userInfo?.nickName || '未登录' }}</text>
|
<text class='user-name primary-text-color'>{{ userInfo?.nickName || '点击注册会员' }}</text>
|
||||||
<view class='integral-view primary-text-color' @click.stop='goPath("/pages/mine/subs/integral/index")'>
|
<view class='integral-view primary-text-color' @click.stop='goPath("/pages/mine/subs/integral/index")'>
|
||||||
<text>{{ userInfo?.integration || 0 }}</text>
|
<text>{{ userInfo?.integration || 0 }}</text>
|
||||||
<text>积分</text>
|
<text>积分</text>
|
||||||
@@ -34,12 +34,12 @@
|
|||||||
|
|
||||||
<view class='menu-view'>
|
<view class='menu-view'>
|
||||||
<view @click.stop='goPath("/pages/mine/subs/recharge/index")'>
|
<view @click.stop='goPath("/pages/mine/subs/recharge/index")'>
|
||||||
<image :src='assetsUrl("ic_member_card.png")' style='width: 108rpx;height: 72rpx;padding: 11rpx 0' />
|
<image :src='assetsUrl("ic_member_card2.png")' style='width: 108rpx;height: 72rpx;padding: 11rpx 0' />
|
||||||
<text>会员充值</text>
|
<text>会员充值</text>
|
||||||
</view>
|
</view>
|
||||||
<view class='divider' style='margin: 0;height: 153rpx' />
|
<view class='divider' style='margin: 0;height: 153rpx' />
|
||||||
<view @click.stop='goPath("/pages/mine/subs/coupon/index")'>
|
<view @click.stop='goPath("/pages/mine/subs/coupon/index")'>
|
||||||
<image :src='assetsUrl("ic_coupon.png")' style='width: 108rpx;height: 95rpx' />
|
<image :src='assetsUrl("ic_coupon2.png")' style='width: 108rpx;height: 95rpx' />
|
||||||
<text>优惠券</text>
|
<text>优惠券</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -57,22 +57,26 @@
|
|||||||
|
|
||||||
<view class='bottom-banner-view'>
|
<view class='bottom-banner-view'>
|
||||||
<swiper :indicator-dots='true' :autoplay='true' :interval='3000' :duration='1000'>
|
<swiper :indicator-dots='true' :autoplay='true' :interval='3000' :duration='1000'>
|
||||||
<swiper-item v-for='(item, index) in companyConfigInfo.bannerhot' :key='index'>
|
<swiper-item v-for='(item, index) in companyConfigInfo?.bannerhot' :key='index'>
|
||||||
<image :src='item.src' mode='aspectFill' />
|
<image :src='item.src' mode='aspectFill' />
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<CompanyDialog ref='companyDialogRef' :companyList='companyList' />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
|
import CompanyDialog from '@/components/company-dialog.vue';
|
||||||
import { getCompanyList } from '@/api/company';
|
import { getCompanyList } from '@/api/company';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { assetsUrl, defaultAvatar, defaultImage } from '@/utils/assets';
|
import { assetsUrl, defaultAvatar, defaultImage } from '@/utils/assets';
|
||||||
import { getCompanyId, goPath, isLogin } from '@/utils';
|
import { getOpenId, goPath, isLogin } from '@/utils';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { UserBean } from '@/store/modules/user/types';
|
||||||
|
|
||||||
|
const companyDialogRef = ref();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { userInfo, companyConfigInfo } = storeToRefs(userStore);
|
const { userInfo, companyConfigInfo } = storeToRefs(userStore);
|
||||||
const currentBannerIndex = ref(0);
|
const currentBannerIndex = ref(0);
|
||||||
@@ -80,20 +84,23 @@ const currentBannerIndex = ref(0);
|
|||||||
const submenuList = [
|
const submenuList = [
|
||||||
{
|
{
|
||||||
title: '注册有礼',
|
title: '注册有礼',
|
||||||
icon: assetsUrl('ic_register_gift.png'),
|
icon: assetsUrl('ic_register_gift2.png'),
|
||||||
path: '/pages/common/register/index'
|
path: '/pages/common/register/reward'
|
||||||
|
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1797773484774432769'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '团购秒杀',
|
title: '团购秒杀',
|
||||||
icon: assetsUrl('ic_groupbuy.png'),
|
icon: assetsUrl('ic_groupbuy2.png'),
|
||||||
path: '/pages/common/groupbuy/index'
|
path: '/pages/common/groupbuy/index'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '入群有礼',
|
title: '入群有礼',
|
||||||
icon: assetsUrl('ic_group_gift.png'),
|
icon: assetsUrl('ic_group_gift2.png'),
|
||||||
path: '/pages/home/subs/group/join'
|
path: '/pages/home/subs/group/join'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
const companyList = ref([]);
|
||||||
|
const userList = ref<UserBean[]>([]);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
wx.getPrivacySetting({
|
wx.getPrivacySetting({
|
||||||
@@ -121,31 +128,89 @@ onLoad((e) => {
|
|||||||
onShow(async () => {
|
onShow(async () => {
|
||||||
if(isLogin()) {
|
if(isLogin()) {
|
||||||
// userStore.getProfile();
|
// userStore.getProfile();
|
||||||
if(userInfo.value.maOpenId) {
|
fetchCompanyList();
|
||||||
if(getCompanyId() === '') {
|
|
||||||
switchCompany();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await userStore.getProfile();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// setToken('42ae187265fb4688804fd294cbcf99f1')
|
// setToken('42ae187265fb4688804fd294cbcf99f1')
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '您还未登录,请先登录',
|
||||||
|
showCancel: true,
|
||||||
|
success: (res) => {
|
||||||
|
if(res.confirm) {
|
||||||
|
goPath('/pages/common/login/index');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const switchCompany = () => {
|
const switchCompany = () => {
|
||||||
getCompanyList(userInfo.value.maOpenId).then(res => {
|
fetchCompanyList((companyList: any[], userList: any[]) => {
|
||||||
const companyList = res.map((res: { company: any }) => res.company);
|
companyDialogRef.value.show(getApp().globalData?.companyId, (index: number) => {
|
||||||
const userList = res.map((res: { user: any }) => res.user);
|
userStore.setUserInfo(userList[index]);
|
||||||
uni.showActionSheet({
|
userStore.setCompanyInfo(companyList[index]);
|
||||||
itemList: companyList.map((res: { companyName: string }) => res.companyName),
|
|
||||||
success: (res) => {
|
avatarModifyRemind();
|
||||||
userStore.setUserInfo(userList[res.tapIndex]);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function avatarModifyRemind() {
|
||||||
|
setTimeout(() => {
|
||||||
|
if(userInfo.value.image === defaultAvatar) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '为了提供更优质的个性化服务,请先修改头像',
|
||||||
|
showCancel: true,
|
||||||
|
success: (res) => {
|
||||||
|
if(res.confirm) {
|
||||||
|
goPath('/pages/mine/subs/profile/index');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchCompanyList = (fn: any = undefined) => {
|
||||||
|
const maOpenId = getOpenId() || userInfo.value?.maOpenId || (userList.value.filter((res: UserBean) => res?.maOpenId !== '')[0]?.maOpenId);
|
||||||
|
getCompanyList(maOpenId).then(res => {
|
||||||
|
companyList.value = res.map((res: { company: any }) => res.company);
|
||||||
|
userList.value = res.map((res: { user: any }) => res.user);
|
||||||
|
|
||||||
|
if(companyList.value.length === 0) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '当前店铺还未注册,请先注册',
|
||||||
|
showCancel: true,
|
||||||
|
success: (res) => {
|
||||||
|
if(res.confirm) {
|
||||||
|
goPath('/pages/common/register/index');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(fn != undefined && fn instanceof Function) {
|
||||||
|
fn(companyList.value, userList.value);
|
||||||
|
} else {
|
||||||
|
let index = companyList.value.findIndex((res: { id: string }) => res.id === getApp().globalData?.companyId);
|
||||||
|
//未在当前公司下注册
|
||||||
|
if(index < 0) {
|
||||||
|
if(!getApp()?.globalData?.storeId) {
|
||||||
|
goPath('/pages/common/register/index');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
userStore.setUserInfo(userList.value[index]);
|
||||||
|
userStore.setCompanyInfo(companyList.value[index]);
|
||||||
|
avatarModifyRemind();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const swiperChange = (e: any) => {
|
const swiperChange = (e: any) => {
|
||||||
currentBannerIndex.value = e.detail.current;
|
currentBannerIndex.value = e.detail.current;
|
||||||
};
|
};
|
||||||
@@ -220,6 +285,10 @@ const swiperChange = (e: any) => {
|
|||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-left: 16rpx;
|
margin-left: 16rpx;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.integral-view {
|
.integral-view {
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
1.长按识别下方二维码,添加【店铺福利群】
|
1.长按识别下方二维码,添加【店铺福利群】
|
||||||
</text>
|
</text>
|
||||||
<view class='divider' style='margin-top: 28rpx' />
|
<view class='divider' style='margin-top: 28rpx' />
|
||||||
<image :src=' companyConfigInfo.regqrcode' show-menu-by-longpress />
|
<image :src=' companyConfigInfo.groupqrcode||defaultImage' show-menu-by-longpress />
|
||||||
<text class='step-title'>
|
<text class='step-title'>
|
||||||
2.识别【店铺福利群】发您的二维码,即可入群
|
2.识别【店铺福利群】发您的二维码,即可入群
|
||||||
</text>
|
</text>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
|
import { defaultImage } from '@/utils/assets';
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { companyConfigInfo } = storeToRefs(userStore);
|
const { companyConfigInfo } = storeToRefs(userStore);
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<view class='search-view'>
|
<view class='search-view'>
|
||||||
<view class='search-input' @click.stop='goPath("/pages/mall/subs/search/index")'>
|
<view class='search-input' @click.stop='goPath("/pages/mall/subs/search/index")'>
|
||||||
<image :src=' assetsUrl("ic_search.png")'></image>
|
<image :src=' assetsUrl("ic_search.png")'></image>
|
||||||
<input placeholder='输入名称、款号搜索' />
|
<input placeholder='输入名称、款号搜索' :disabled='true' />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -21,11 +21,17 @@
|
|||||||
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
|
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
|
||||||
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
|
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
|
||||||
<image class='goods-image' :src='item.images||defaultImage' />
|
<image class='goods-image' :src='item.images||defaultImage' />
|
||||||
<text class='goods-name'>{{ item.goodsName }}</text>
|
<text class='goods-name'>{{ item.goodsName || '未知' }}</text>
|
||||||
<text class='goods-price'>¥{{ item.price }}</text>
|
<text class='goods-price'>¥{{ (item.price * userInfo.userDiscount).toFixed(2) }}
|
||||||
|
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
|
||||||
|
style='text-decoration: line-through;color: #999999;font-size: 25rpx'>
|
||||||
|
¥{{ item.price }}
|
||||||
|
</text>
|
||||||
|
</text>
|
||||||
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart(item)' />
|
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart(item)' />
|
||||||
</view>
|
</view>
|
||||||
</grid-view>
|
</grid-view>
|
||||||
|
<u-empty v-if='goodsList.length === 0' text='暂无商品数据' />
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -41,6 +47,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
|
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||||
import SkuDialog from '@/components/sku-dialog.vue';
|
import SkuDialog from '@/components/sku-dialog.vue';
|
||||||
import { assetsUrl, defaultImage } from '@/utils/assets';
|
import { assetsUrl, defaultImage } from '@/utils/assets';
|
||||||
import { goLogin, goPath, isLogin, showToast } from '@/utils';
|
import { goLogin, goPath, isLogin, showToast } from '@/utils';
|
||||||
@@ -50,7 +57,7 @@ import useShoppingCartStore from '@/store/modules/shoppingcart';
|
|||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { companyConfigInfo } = storeToRefs(userStore);
|
const { userInfo, companyConfigInfo } = storeToRefs(userStore);
|
||||||
const shoppingCartStore = useShoppingCartStore();
|
const shoppingCartStore = useShoppingCartStore();
|
||||||
const { totalCount } = storeToRefs(shoppingCartStore);
|
const { totalCount } = storeToRefs(shoppingCartStore);
|
||||||
|
|
||||||
@@ -79,9 +86,26 @@ onLoad(() => {
|
|||||||
fetchCategoryList();
|
fetchCategoryList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShareAppMessage((e) => {
|
||||||
|
return {
|
||||||
|
title: 'VIP顾客中心',
|
||||||
|
path: '/pages/mall/index'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
onShareTimeline((e) => {
|
||||||
|
return {
|
||||||
|
title: 'VIP顾客中心',
|
||||||
|
path: '/pages/mall/index'
|
||||||
|
};
|
||||||
|
});
|
||||||
const fetchCategoryList = async () => {
|
const fetchCategoryList = async () => {
|
||||||
if(companyConfigInfo.value.mallopen == 1) {
|
if(companyConfigInfo.value.mallopen == 1) {
|
||||||
categoryList.value = await getCategoryList();
|
const list = await getCategoryList();
|
||||||
|
list.unshift({ typeName: '上新精选', typeId: '2' });
|
||||||
|
list.unshift({ typeName: '热销商品', typeId: '1' });
|
||||||
|
list.unshift({ typeName: '全部分类', typeId: '0' });
|
||||||
|
categoryList.value = list;
|
||||||
await changeCategory(0);
|
await changeCategory(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -93,13 +117,27 @@ const changeCategory = async (index: number) => {
|
|||||||
|
|
||||||
const fetchGoodsList = async (refresh: boolean = true) => {
|
const fetchGoodsList = async (refresh: boolean = true) => {
|
||||||
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
|
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
|
||||||
|
|
||||||
|
let typeId = [categoryList.value[categorySelectedIndex.value].typeId];
|
||||||
|
let sort = undefined;
|
||||||
|
if(typeId[0] === '0') {
|
||||||
|
typeId = [];
|
||||||
|
sort = undefined;
|
||||||
|
} else if(typeId[0] === '1') {
|
||||||
|
typeId = [];
|
||||||
|
sort = 'good_num DESC';
|
||||||
|
} else if(typeId[0] === '2') {
|
||||||
|
typeId = [];
|
||||||
|
sort = 'update_time DESC';
|
||||||
|
}
|
||||||
const { rows } = await getGoodsList({
|
const { rows } = await getGoodsList({
|
||||||
page: {
|
page: {
|
||||||
pageNum: currentPageNum.value,
|
pageNum: currentPageNum.value,
|
||||||
pageSize: 30,
|
pageSize: 30,
|
||||||
bean: {
|
bean: {
|
||||||
keyword: '',
|
keyword: '',
|
||||||
typeIds: [categoryList.value[categorySelectedIndex.value].typeId]
|
typeIds: typeId,
|
||||||
|
sort: sort
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -108,6 +146,10 @@ const fetchGoodsList = async (refresh: boolean = true) => {
|
|||||||
} else {
|
} else {
|
||||||
goodsList.value = goodsList.value.concat(rows);
|
goodsList.value = goodsList.value.concat(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
goodsList.value.forEach(e => {
|
||||||
|
e.price = userStore.getRealGoodsPrice(e.price, e.priceExt);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadMore = () => {
|
const loadMore = () => {
|
||||||
@@ -179,7 +221,7 @@ const addShoppingCart = (goodsBean: GoodsBean) => {
|
|||||||
.category-list {
|
.category-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 210rpx;
|
width: 280rpx;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
|
||||||
.category-item {
|
.category-item {
|
||||||
|
@@ -38,7 +38,7 @@ const coupons = ref<CouponBean[]>([]);
|
|||||||
|
|
||||||
const fetchData = async (status: number) => {
|
const fetchData = async (status: number) => {
|
||||||
const { list } = await getCouponList({
|
const { list } = await getCouponList({
|
||||||
companyId: getCompanyId(),
|
companyId: getApp()?.globalData?.companyId,
|
||||||
memberId: userInfo.value?.id,
|
memberId: userInfo.value?.id,
|
||||||
status: status,
|
status: status,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<view class='swiper-container'>
|
<view class='swiper-container'>
|
||||||
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
||||||
<swiper-item v-for='(item,index) in [goodsBean?.images]' :key='index'>
|
<swiper-item v-for='(item,index) in [goodsBean?.images]' :key='index'>
|
||||||
<image :src='item||defaultImage' />
|
<image :src='item||defaultImage' mode='aspectFill' />
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
<view class='indicator' style='display: none'>
|
<view class='indicator' style='display: none'>
|
||||||
@@ -14,13 +14,19 @@
|
|||||||
|
|
||||||
<view class='goods-info-view c-flex-column' style='margin-right: 10rpx'>
|
<view class='goods-info-view c-flex-column' style='margin-right: 10rpx'>
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text class='goods-price accent-text-color'>{{ goodsBean?.price || 0 }}</text>
|
<text class='goods-price accent-text-color'>
|
||||||
<text>销量{{ goodsBean?.send_num || 0 }}</text>
|
¥{{ ((goodsBean?.price || 0) * userInfo.userDiscount).toFixed(2) }}
|
||||||
|
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
|
||||||
|
style='display:unset;text-decoration: line-through;font-size: 30rpx;color: #999999'>
|
||||||
|
¥{{ goodsBean?.price || 0 }}
|
||||||
|
</text>
|
||||||
|
</text>
|
||||||
|
<text>销量{{ goodsBean?.salesCount || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text style='flex: 1'>{{ goodsBean?.name }}</text>
|
<text style='flex: 1'>{{ goodsBean?.name || '未知' }}</text>
|
||||||
<view class='share-button c-flex-column'>
|
<view class='share-button'>
|
||||||
<image :src='assetsUrl("ic_share.png")'></image>
|
<image :src='assetsUrl("ic_share.png")'></image>
|
||||||
<button class='btn' plain open-type='share'>分享</button>
|
<button class='btn' plain open-type='share'>分享</button>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,8 +55,12 @@
|
|||||||
:key='index'>
|
:key='index'>
|
||||||
<view class='recommend-item c-flex-column'>
|
<view class='recommend-item c-flex-column'>
|
||||||
<image :src='item.images||defaultImage' />
|
<image :src='item.images||defaultImage' />
|
||||||
<text>{{ item.goodsName }}</text>
|
<text>{{ item.goodsName || '未知' }}</text>
|
||||||
<text class='goods-price'>{{ item.price }}</text>
|
<text class='goods-price'>{{ (item.price * userInfo.userDiscount).toFixed(2) }}
|
||||||
|
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
|
||||||
|
style='text-decoration: line-through;font-size: 25rpx;color: #999999'>{{ item.price }}
|
||||||
|
</text>
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -100,10 +110,14 @@ import { goPath, showToast } from '@/utils';
|
|||||||
import { getGoodsDetail, getGoodsList } from '@/api/goods';
|
import { getGoodsDetail, getGoodsList } from '@/api/goods';
|
||||||
import { GoodsBean } from '@/api/goods/types';
|
import { GoodsBean } from '@/api/goods/types';
|
||||||
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
|
||||||
const shoppingCartStore = useShoppingCartStore();
|
const shoppingCartStore = useShoppingCartStore();
|
||||||
const { totalCount } = storeToRefs(shoppingCartStore);
|
const { totalCount } = storeToRefs(shoppingCartStore);
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const { userInfo } = storeToRefs(userStore);
|
||||||
|
|
||||||
const goodsBean = ref<GoodsBean>();
|
const goodsBean = ref<GoodsBean>();
|
||||||
const recommendList = ref<GoodsBean[]>();
|
const recommendList = ref<GoodsBean[]>();
|
||||||
|
|
||||||
@@ -115,20 +129,31 @@ const swiperIndex = ref(0);
|
|||||||
onLoad(async (e: any) => {
|
onLoad(async (e: any) => {
|
||||||
await uni.showLoading();
|
await uni.showLoading();
|
||||||
goodsBean.value = await getGoodsDetail(e.goodsId);
|
goodsBean.value = await getGoodsDetail(e.goodsId);
|
||||||
|
goodsBean.value.price = userStore.getRealGoodsPrice(goodsBean.value?.price, goodsBean.value?.priceExt);
|
||||||
const { rows } = await getGoodsList({
|
const { rows } = await getGoodsList({
|
||||||
page: {
|
page: {
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
bean: {
|
bean: {
|
||||||
keyword: '',
|
keyword: '',
|
||||||
typeIds: ['1724629185362591745']
|
typeIds: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
recommendList.value = rows;
|
recommendList.value = rows;
|
||||||
|
recommendList.value?.forEach(e => {
|
||||||
|
e.price = userStore.getRealGoodsPrice(e.price, e.priceExt);
|
||||||
|
});
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShareAppMessage((e) => {
|
||||||
|
return {
|
||||||
|
title: goodsBean.value?.name || 'VIP顾客中心',
|
||||||
|
path: `/pages/common/groupbuy/detail?id=${goodsBean.value?.id}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const getStockColorCount = computed(() => {
|
const getStockColorCount = computed(() => {
|
||||||
const list = Array.from(new Set(goodsBean.value?.stocks?.map(item => item.colorName)))
|
const list = Array.from(new Set(goodsBean.value?.stocks?.map(item => item.colorName)))
|
||||||
.map(colorName => goodsBean.value?.stocks?.find(item => item.colorName === colorName)!);
|
.map(colorName => goodsBean.value?.stocks?.find(item => item.colorName === colorName)!);
|
||||||
@@ -161,7 +186,6 @@ const addShoppingCart = () => {
|
|||||||
|
|
||||||
const placeOrder = () => {
|
const placeOrder = () => {
|
||||||
showSkuDialog((e: GoodsBean) => {
|
showSkuDialog((e: GoodsBean) => {
|
||||||
console.log(e);
|
|
||||||
const orderBean = {
|
const orderBean = {
|
||||||
totalPrice: (e.consumePrice * e.checkedStock.count).toFixed(2),
|
totalPrice: (e.consumePrice * e.checkedStock.count).toFixed(2),
|
||||||
orderGoods: [e]
|
orderGoods: [e]
|
||||||
@@ -216,6 +240,9 @@ const placeOrder = () => {
|
|||||||
padding: 20rpx 30rpx;
|
padding: 20rpx 30rpx;
|
||||||
|
|
||||||
view:nth-of-type(1) {
|
view:nth-of-type(1) {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
text:nth-of-type(1) {
|
text:nth-of-type(1) {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
@@ -225,10 +252,10 @@ const placeOrder = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.goods-price:before {
|
.goods-price:before {
|
||||||
content: "¥";
|
//content: "¥";
|
||||||
font-size: 30rpx;
|
//font-size: 30rpx;
|
||||||
margin-bottom: 5rpx;
|
//margin-bottom: 5rpx;
|
||||||
margin-right: 5rpx;
|
//margin-right: 5rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
text:nth-of-type(2) {
|
text:nth-of-type(2) {
|
||||||
@@ -247,6 +274,8 @@ const placeOrder = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.share-button {
|
.share-button {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
|
@@ -42,14 +42,15 @@
|
|||||||
<image class='goods-image' :src='item.images||defaultImage' />
|
<image class='goods-image' :src='item.images||defaultImage' />
|
||||||
<view class='c-flex-column' style='flex: 1;'>
|
<view class='c-flex-column' style='flex: 1;'>
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text class='goods-name'>{{ item.name }}</text>
|
<text class='goods-name'>{{ item.name || '未知' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<text style='color: #999999;margin-top: 30rpx'>
|
<text style='color: #999999;margin-top: 30rpx'>
|
||||||
{{ item.code }}
|
{{ item.code }}
|
||||||
</text>
|
</text>
|
||||||
<view class='bottom-sku-view c-flex-row'>
|
<view class='bottom-sku-view c-flex-row'>
|
||||||
<text>
|
<text>
|
||||||
{{ item.checkedStock.colorName }},{{ item.checkedStock.sizeName }} x{{ item.checkedStock.count }}
|
{{ item.checkedStock.colorName || '均色' }},{{ item.checkedStock.sizeName || '均码' }}
|
||||||
|
x{{ item.checkedStock.count }}
|
||||||
</text>
|
</text>
|
||||||
<text>¥{{ item.price }}</text>
|
<text>¥{{ item.price }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -159,17 +160,17 @@ const buildSqbParams = computed(() => {
|
|||||||
const params = sortASCII({
|
const params = sortASCII({
|
||||||
client_sn: orderBean.value?.id || '',
|
client_sn: orderBean.value?.id || '',
|
||||||
return_url: '/pages/common/payresult/index',
|
return_url: '/pages/common/payresult/index',
|
||||||
total_amount: ((orderBean.value?.totalPrice || 0) * 100).toString(),
|
total_amount: Number(((totalPrice.value || 0) * 100).toFixed(2)),
|
||||||
terminal_sn: terminalInfo.value.terminalSn,
|
terminal_sn: terminalInfo.value?.terminalSn,
|
||||||
subject: orderBean?.value?.orderGoods[0].name,
|
subject: orderBean?.value?.orderGoods[0].name || '未知',
|
||||||
subject_img: orderBean?.value?.orderGoods[0].images || '',
|
subject_img: orderBean?.value?.orderGoods[0].images || '',
|
||||||
merchant_name: terminalInfo.value.companyName,
|
merchant_name: terminalInfo.value?.companyName,
|
||||||
notify_url: 'https://www.baidu.com'
|
notify_url: 'https://www.baidu.com'
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...params,
|
...params,
|
||||||
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value.terminalKey).toUpperCase()
|
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value?.terminalKey).toUpperCase()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -193,12 +194,19 @@ const navigateTo = (e: any) => {
|
|||||||
},
|
},
|
||||||
onFailure: () => {
|
onFailure: () => {
|
||||||
console.error('pay onFailure');
|
console.error('pay onFailure');
|
||||||
|
if(orderBean.value?.id) {
|
||||||
|
orderBean.value.id = '';
|
||||||
|
}
|
||||||
|
createOrder();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const createOrder = async () => {
|
const createOrder = async () => {
|
||||||
|
if(!terminalInfo.value) {
|
||||||
|
showToast('当前店铺未配置收款渠道,请联系商家');
|
||||||
|
return;
|
||||||
|
}
|
||||||
//邮寄
|
//邮寄
|
||||||
if(tabIndex.value == 1 && !deliveryAddress.value.addrid) {
|
if(tabIndex.value == 1 && !deliveryAddress.value.addrid) {
|
||||||
showToast('请选择收货地址');
|
showToast('请选择收货地址');
|
||||||
@@ -233,10 +241,12 @@ const createOrder = async () => {
|
|||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
await uni.showLoading();
|
if(orderBean.value?.id == undefined || orderBean.value?.id == '') {
|
||||||
const result = await orderCreate(params);
|
await uni.showLoading();
|
||||||
orderBean.value!.id = result.id;
|
const result = await orderCreate(params);
|
||||||
uni.hideLoading();
|
orderBean.value!.id = result.id;
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
|
||||||
//删除购物车已存在商品
|
//删除购物车已存在商品
|
||||||
orderBean?.value?.orderGoods?.forEach(item => {
|
orderBean?.value?.orderGoods?.forEach(item => {
|
||||||
@@ -256,7 +266,7 @@ const payment = async () => {
|
|||||||
transactionPrice: orderBean?.value?.totalPrice,
|
transactionPrice: orderBean?.value?.totalPrice,
|
||||||
useGold: orderBean.value?.useGold || 0,
|
useGold: orderBean.value?.useGold || 0,
|
||||||
detailBos: [{
|
detailBos: [{
|
||||||
integralNumber: orderBean?.value?.totalPrice || 0,
|
integralNumber: Math.floor(orderBean?.value?.totalPrice || 0),
|
||||||
onlinePayResult: '',
|
onlinePayResult: '',
|
||||||
payName: '收钱吧',
|
payName: '收钱吧',
|
||||||
payTypeId: paymentList.find((res: any) => res.type === 'ShouQianBa')?.id,
|
payTypeId: paymentList.find((res: any) => res.type === 'ShouQianBa')?.id,
|
||||||
@@ -264,7 +274,13 @@ const payment = async () => {
|
|||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
await overPayment(paymentParams);
|
await overPayment(paymentParams);
|
||||||
uni.hideLoading();
|
showToast('支付成功', {
|
||||||
|
icon: 'success',
|
||||||
|
complete: () => {
|
||||||
|
uni.navigateBack();
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -12,8 +12,12 @@
|
|||||||
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
|
<view v-for='(item, index) in goodsList' :key='index' class='goods-item'
|
||||||
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
|
@click.stop='goPath(`/pages/mall/subs/goods/detail?goodsId=${item.goodsId}`)'>
|
||||||
<image class='goods-image' :src='item.images||defaultImage' />
|
<image class='goods-image' :src='item.images||defaultImage' />
|
||||||
<text class='goods-name'>{{ item.goodsName }}</text>
|
<text class='goods-name'>{{ item.goodsName || '未知' }}</text>
|
||||||
<text class='goods-price'>¥{{ item.price }}</text>
|
<text class='goods-price'>¥{{ (item.price * userInfo.userDiscount).toFixed(2) }}
|
||||||
|
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
|
||||||
|
style='text-decoration: line-through;color: #999999;font-size: 25rpx'>¥{{ item.price }}
|
||||||
|
</text>
|
||||||
|
</text>
|
||||||
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart(item)' />
|
<image class='add-image' :src='assetsUrl("ic_add_goods.png")' @click.stop='addShoppingCart(item)' />
|
||||||
</view>
|
</view>
|
||||||
</grid-view>
|
</grid-view>
|
||||||
@@ -29,10 +33,14 @@ import { goPath } from '@/utils';
|
|||||||
import { getGoodsList } from '@/api/goods';
|
import { getGoodsList } from '@/api/goods';
|
||||||
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
import useShoppingCartStore from '@/store/modules/shoppingcart';
|
||||||
import { GoodsBean } from '@/api/goods/types';
|
import { GoodsBean } from '@/api/goods/types';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
|
||||||
const skuDialogRef = ref();
|
const skuDialogRef = ref();
|
||||||
const shoppingCartStore = useShoppingCartStore();
|
const shoppingCartStore = useShoppingCartStore();
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const { userInfo } = storeToRefs(userStore);
|
||||||
|
|
||||||
const goodsList = ref<GoodsBean[]>([]);
|
const goodsList = ref<GoodsBean[]>([]);
|
||||||
|
|
||||||
onLoad((e) => {
|
onLoad((e) => {
|
||||||
@@ -46,7 +54,7 @@ const bindInput = async (e: any) => {
|
|||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
bean: {
|
bean: {
|
||||||
keyword: e.detail.value,
|
keyword: e.detail.value,
|
||||||
typeIds: ['1724629185362591745']
|
typeIds: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -113,7 +121,7 @@ const addShoppingCart = (goodsBean: GoodsBean) => {
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
|
@@ -12,19 +12,24 @@
|
|||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<image class='checkbox'
|
<image class='checkbox'
|
||||||
:src='assetsUrl(item.checked?"ic_checkbox_active_red.png":"ic_checkbox_normal.png")'
|
:src='assetsUrl(item.checked?"ic_checkbox_active_red.png":"ic_checkbox_normal.png")'
|
||||||
@click.stop='item.checked=!item.checked' />
|
@click.stop='handleCheck(item)' />
|
||||||
<image class='goods-image' :src='item.images||defaultImage' />
|
<image class='goods-image' :src='item.images||defaultImage' />
|
||||||
<view class='c-flex-column'>
|
<view class='c-flex-column'>
|
||||||
<text>{{ item.name }}</text>
|
<text>{{ item.name }}</text>
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<view class='sku-view' @click.stop='showSkuDialog(index)'>
|
<view class='sku-view' @click.stop='showSkuDialog(index)'>
|
||||||
<text>{{ item?.checkedStock?.colorName }},{{ item?.checkedStock?.sizeName }}
|
<text>{{ item?.checkedStock?.colorName||'均色' }},{{ item?.checkedStock?.sizeName||'均码' }}
|
||||||
x{{ item?.checkedStock?.count }}
|
x{{ item?.checkedStock?.count }}
|
||||||
</text>
|
</text>
|
||||||
<image :src='assetsUrl("ic_arrow_down_gray.png")' />
|
<image :src='assetsUrl("ic_arrow_down_gray.png")' />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<text style='margin-top: 50rpx'>¥{{ item.price }}</text>
|
<text style='margin-top: 50rpx'>
|
||||||
|
¥{{ (item?.price * userInfo.userDiscount).toFixed(2) }}
|
||||||
|
<text v-if='userInfo.userDiscount>0&&userInfo.userDiscount<1'
|
||||||
|
style='text-decoration: line-through;color: #999999;font-size: 25rpx'>¥{{ item?.price }}
|
||||||
|
</text>
|
||||||
|
</text>
|
||||||
<view class='count-change-view c-flex-row'>
|
<view class='count-change-view c-flex-row'>
|
||||||
<view class='count-image' @click.stop='countChange(index,false)'>
|
<view class='count-image' @click.stop='countChange(index,false)'>
|
||||||
<image :src='assetsUrl("ic_reduce.png")' />
|
<image :src='assetsUrl("ic_reduce.png")' />
|
||||||
@@ -39,9 +44,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-empty v-else text='暂无数据' margin-top='100' />
|
||||||
|
|
||||||
<view class='bottom-view c-flex-row'>
|
<view class='bottom-view c-flex-row'>
|
||||||
<view class='c-flex-row' @click.stop='checkedAll = !checkedAll'>
|
<view class='c-flex-row' @click.stop='handleAllCheck'>
|
||||||
<image :src='assetsUrl(checkedAll?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
<image :src='assetsUrl(checkedAll?"ic_checkbox_active.png":"ic_checkbox_normal.png")' />
|
||||||
<text>全选</text>
|
<text>全选</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -50,7 +56,7 @@
|
|||||||
<text v-if='isEditMode' class='settlement' @click.stop='deleteShoppingCart'>删除</text>
|
<text v-if='isEditMode' class='settlement' @click.stop='deleteShoppingCart'>删除</text>
|
||||||
<view v-else class='c-flex-row'>
|
<view v-else class='c-flex-row'>
|
||||||
<text>合计:
|
<text>合计:
|
||||||
<text>¥{{ totalPayPrice }}</text>
|
<text>¥{{ totalPayPrice.toFixed(2) }}</text>
|
||||||
</text>
|
</text>
|
||||||
<text class='settlement' @click.stop='settlement'>结算</text>
|
<text class='settlement' @click.stop='settlement'>结算</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -67,6 +73,7 @@ import { goPath, showToast } from '@/utils';
|
|||||||
import { GoodsBean, StockBean } from '@/api/goods/types';
|
import { GoodsBean, StockBean } from '@/api/goods/types';
|
||||||
import SkuDialog from '@/components/sku-dialog.vue';
|
import SkuDialog from '@/components/sku-dialog.vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
|
||||||
const isEditMode = ref(false);
|
const isEditMode = ref(false);
|
||||||
const checkedAll = ref(false);
|
const checkedAll = ref(false);
|
||||||
@@ -74,22 +81,37 @@ const checkedAll = ref(false);
|
|||||||
const shoppingCartStore = useShoppingCartStore();
|
const shoppingCartStore = useShoppingCartStore();
|
||||||
const { shoppingCartList, totalCount } = storeToRefs(shoppingCartStore);
|
const { shoppingCartList, totalCount } = storeToRefs(shoppingCartStore);
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const { userInfo } = storeToRefs(userStore);
|
||||||
|
|
||||||
const skuDialogRef = ref();
|
const skuDialogRef = ref();
|
||||||
const temporaryGoodsBean = ref<GoodsBean>();
|
const temporaryGoodsBean = ref<GoodsBean>();
|
||||||
const temporaryStockBean = ref<StockBean>();
|
const temporaryStockBean = ref<StockBean>();
|
||||||
|
|
||||||
watch(checkedAll, (newValue) => {
|
const totalPayPrice = computed(() => {
|
||||||
shoppingCartList.value.forEach(res => {
|
return shoppingCartList.value.filter(res => res.checked).reduce((a, b) => a + b.consumePrice * b.checkedStock.count, 0) || 0;
|
||||||
res.checked = newValue;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const totalPayPrice = computed(() => {
|
const handleCheck = (item: any) => {
|
||||||
return shoppingCartList.value.filter(res => res.checked).reduce((a, b) => a + b.consumePrice * b.checkedStock.count, 0);
|
item.checked = !item.checked;
|
||||||
});
|
if(!item.checked) {
|
||||||
|
checkedAll.value = false;
|
||||||
|
} else {
|
||||||
|
checkedAll.value = shoppingCartList.value.every(res => res.checked);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAllCheck = () => {
|
||||||
|
checkedAll.value = !checkedAll.value;
|
||||||
|
shoppingCartList.value.forEach(res => {
|
||||||
|
res.checked = checkedAll.value;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const deleteShoppingCart = () => {
|
const deleteShoppingCart = () => {
|
||||||
shoppingCartStore.deleteIfChecked();
|
shoppingCartStore.deleteIfChecked();
|
||||||
|
checkedAll.value = false;
|
||||||
|
isEditMode.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const showSkuDialog = (index: number) => {
|
const showSkuDialog = (index: number) => {
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<view class='integral-add-view'>
|
<view class='integral-add-view'>
|
||||||
<text>将会员卡放入微信卡包,及时了解积分变动</text>
|
<text>将会员卡放入微信卡包,及时了解积分变动</text>
|
||||||
<text>去添加</text>
|
<text @click.stop='openCard'>去添加</text>
|
||||||
<image :src='assetsUrl("ic_arrow_right_yellow.png")' />
|
<image :src='assetsUrl("ic_arrow_right_yellow.png")' />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<view v-for='(item,index) in orderActionList' :key='index' @click.stop='gotoPath(item.path)'>
|
<view v-for='(item,index) in orderActionList' :key='index' @click.stop='gotoPath(item.path)'>
|
||||||
<image :src='item.icon' />
|
<image :src='item.icon' />
|
||||||
<text>{{ item.title }}</text>
|
<text>{{ item.title }}</text>
|
||||||
<text v-if='index==0&&userInfo?.orderNum>0'>{{ userInfo?.orderNum }}</text>
|
<text v-if='index==0&&unPaidOrderCount>0'>{{ unPaidOrderCount }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -67,9 +67,13 @@
|
|||||||
<script setup lang='ts'>
|
<script setup lang='ts'>
|
||||||
import { assetsUrl, defaultAvatar } from '@/utils/assets';
|
import { assetsUrl, defaultAvatar } from '@/utils/assets';
|
||||||
import { goLogin, goPath, isLogin } from '@/utils';
|
import { goLogin, goPath, isLogin } from '@/utils';
|
||||||
|
import { isPending } from '@/utils/order';
|
||||||
|
import { getCardLink } from '@/api/user';
|
||||||
|
import { getOrderList } from '@/api/order';
|
||||||
import OfficialAccountDialog from '@/components/official-account-dialog.vue';
|
import OfficialAccountDialog from '@/components/official-account-dialog.vue';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
const officialAccountDialogRef = ref();
|
const officialAccountDialogRef = ref();
|
||||||
|
|
||||||
const orderActionList = ref([{
|
const orderActionList = ref([{
|
||||||
@@ -109,7 +113,7 @@ const serviceList = [
|
|||||||
}, {
|
}, {
|
||||||
title: '联系商家',
|
title: '联系商家',
|
||||||
icon: assetsUrl('ic_member_service_contact.png'),
|
icon: assetsUrl('ic_member_service_contact.png'),
|
||||||
path: ''
|
path: '/pages/mine/subs/contact/index'
|
||||||
}
|
}
|
||||||
// ,{
|
// ,{
|
||||||
// title: '推广中心',
|
// title: '推广中心',
|
||||||
@@ -118,11 +122,11 @@ const serviceList = [
|
|||||||
// }
|
// }
|
||||||
];
|
];
|
||||||
|
|
||||||
const title = ref<string>();
|
|
||||||
title.value = import.meta.env.VITE_APP_TITLE;
|
|
||||||
|
|
||||||
const store = useUserStore();
|
const store = useUserStore();
|
||||||
const { userInfo, companyConfigInfo } = storeToRefs(store);
|
const { userInfo, companyInfo, companyConfigInfo } = storeToRefs(store);
|
||||||
|
|
||||||
|
const cardLink = ref('');
|
||||||
|
const unPaidOrderCount = ref(0);
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
if(!isLogin()) {
|
if(!isLogin()) {
|
||||||
@@ -131,6 +135,32 @@ onLoad(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onShow(async () => {
|
||||||
|
const { list } = await getOrderList({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 9999,
|
||||||
|
obj: { payStatus: 1 }
|
||||||
|
});
|
||||||
|
unPaidOrderCount.value = list.filter((item: any) => isPending(item))?.length || 0;
|
||||||
|
const { cardurl } = await getCardLink();
|
||||||
|
cardLink.value = cardurl;
|
||||||
|
await userStore.getProfile();
|
||||||
|
});
|
||||||
|
|
||||||
|
const openCard = () => {
|
||||||
|
// const url = 'https://mp.weixin.qq.com/bizmall/activatemembercard?action=preshow&&encrypt_card_id=LI%2FNyDp0x3z8XXorvvrHzSR4VUPa2vlioBg2xkDT3HqybiAFNsNgjH7pBpyKGrSA&outer_str=1702887425732870145&biz=MzU2MTg5MjgxMg%3D%3D#wechat_redirect';
|
||||||
|
goPath(`/pages/common/webview/index?url=${encodeURIComponent(cardLink.value)}`);
|
||||||
|
// uni.navigateToMiniProgram({ appId: 'wxeb490c6f9b154ef9' });
|
||||||
|
// uni.addCard({
|
||||||
|
// cardList: [
|
||||||
|
// {
|
||||||
|
// cardId: 'pzCtO1NU8FDcF3v09_Q76-7ZuN8I',
|
||||||
|
// cardExt: JSON.stringify({ 'code': '12345', openId: 'wxc480826360455685', 'timestamp': Date.now(), 'signature': '' })
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|
||||||
const gotoPath = (path: string) => {
|
const gotoPath = (path: string) => {
|
||||||
if(path === 'follow_official_account') {
|
if(path === 'follow_official_account') {
|
||||||
showOfficialAccountDialog();
|
showOfficialAccountDialog();
|
||||||
@@ -138,6 +168,10 @@ const gotoPath = (path: string) => {
|
|||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/qrcode/index'
|
url: '/pages/qrcode/index'
|
||||||
});
|
});
|
||||||
|
} else if(path === 'call') {
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber: companyInfo.value.telphone
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
goPath(path);
|
goPath(path);
|
||||||
}
|
}
|
||||||
@@ -165,6 +199,7 @@ const showOfficialAccountDialog = () => {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-row {
|
.top-row {
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
<item v-for='(item,index) in addressList' :key='index' :item='item'
|
<item v-for='(item,index) in addressList' :key='index' :item='item'
|
||||||
@on-checked='onChecked(item)'
|
@on-checked='onChecked(item)'
|
||||||
@on-edit='args => goPath(`create?bean=${encodeURIComponent(JSON.stringify(args))}`)'
|
@on-edit='args => goPath(`create?bean=${encodeURIComponent(JSON.stringify(args))}`)'
|
||||||
@on-delete='args => {addressDelete(args?.addrid);fetchAddressList}' />
|
@on-delete='args => {handleDelete(args)}' />
|
||||||
|
<u-empty v-if='addressList.length === 0' text='暂无数据' margin-top='100' />
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<view class='bottom-button-view'>
|
<view class='bottom-button-view'>
|
||||||
@@ -42,6 +43,23 @@ const fetchAddressList = async () => {
|
|||||||
addressList.value = await getAddressList();
|
addressList.value = await getAddressList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDelete = async (item: any) => {
|
||||||
|
uni.showModal(
|
||||||
|
{
|
||||||
|
title: '提示',
|
||||||
|
content: '确定删除该地址吗?',
|
||||||
|
success: async (res) => {
|
||||||
|
if(res.confirm) {
|
||||||
|
const result = await addressDelete(item?.addrid);
|
||||||
|
if(result) {
|
||||||
|
await fetchAddressList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const onChecked = (e: any) => {
|
const onChecked = (e: any) => {
|
||||||
const pages = getCurrentPages();
|
const pages = getCurrentPages();
|
||||||
if(pages.length >= 2 && pages[pages.length - 2].route?.includes('pages/mall/subs/order/order-confirm')) {
|
if(pages.length >= 2 && pages[pages.length - 2].route?.includes('pages/mall/subs/order/order-confirm')) {
|
||||||
|
61
src/pages/mine/subs/contact/index.vue
Normal file
61
src/pages/mine/subs/contact/index.vue
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<template>
|
||||||
|
<view class='card-view'>
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<text class='key'>姓名</text>
|
||||||
|
<text class='value'>{{ companyConfigInfo?.contactname}}</text>
|
||||||
|
</view>
|
||||||
|
<view class='divider' />
|
||||||
|
<view class='c-flex-row'>
|
||||||
|
<text class='key'>手机号</text>
|
||||||
|
<text class='value'>{{companyConfigInfo?.contacttelephone}}</text>
|
||||||
|
<image :src='assetsUrl("ic_contact_merchant.png")' @click.stop='call' />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang='ts' setup>
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
import { assetsUrl } from '@/utils/assets';
|
||||||
|
|
||||||
|
const { companyConfigInfo } = storeToRefs(useUserStore());
|
||||||
|
const call = () => {
|
||||||
|
uni.makePhoneCall({
|
||||||
|
phoneNumber: companyConfigInfo.value.contacttelephone
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang='scss' scoped>
|
||||||
|
.card-view {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 30rpx 20rpx;
|
||||||
|
margin: 24rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
margin: 30rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.c-flex-row {
|
||||||
|
.key {
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #7E7E7E;
|
||||||
|
width: 120rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
display: flex;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #333333;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 39rpx;
|
||||||
|
height: 41rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class='coupon-content'>
|
<view class='coupon-content'>
|
||||||
<image v-if='item?.status==0' :src='assetsUrl("bg_coupon.png")' />
|
<image v-if='item?.status==0' :src='assetsUrl("bg_coupon.png")' />
|
||||||
<image v-else-if='item?.status==1' :src='assetsUrl("bg_coupon_expired.png")' />
|
<image v-else-if='item?.status==1||item?.status==2' :src='assetsUrl("bg_coupon_expired.png")' />
|
||||||
<view class='left-content accent-text-color' :class='{"left-content-disabled": item?.status==1}'>
|
<view class='left-content accent-text-color' :class='{"left-content-disabled": item?.status!=0}'>
|
||||||
<text>{{ item?.reduce }}</text>
|
<text>{{ item?.reduce }}</text>
|
||||||
<text>满{{ item?.threshold }}元可用</text>
|
<text>满{{ item?.threshold }}元可用</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='right-content accent-text-color' :class='{"right-content-disabled": item?.status==1}'>
|
<view class='right-content accent-text-color' :class='{"right-content-disabled": item?.status!=0}'>
|
||||||
<text>{{ item?.name }}</text>
|
<text>{{ item?.name }}</text>
|
||||||
<text>有效期至{{ dayjs(item?.startTime).format('YYYY-MM-DD') }}</text>
|
<text>有效期至{{ dayjs(item?.startTime).format('YYYY-MM-DD') }}</text>
|
||||||
<text class='btn-text' :class='{"btn-text-disabled": item?.status==1}' @click.stop='goPath("/pages/mall/index")'>
|
<text class='btn-text' :class='{"btn-text-disabled": item?.status!=0}' @click.stop='goPath("/pages/mall/index")'>
|
||||||
立即使用
|
立即使用
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
@@ -1,11 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<tabbar :titles='["全部","未使用","已使用"]' :indicator-color='"#D95554"' @change='tabChange' />
|
<tabbar :titles='["全部","未使用","已使用"]' :indicator-color='"#D95554"' @change='tabChange' />
|
||||||
<scroll-view :scroll-y='true' class='content' @loadmore='onLoadMore'>
|
<u-list @scrolltolower='onLoadMore'>
|
||||||
<coupon-item v-for='item in coupons' :item='item' />
|
<coupon-item v-for='item in couponList' :item='item' :key='item.id' />
|
||||||
</scroll-view>
|
<u-loadmore v-if='couponList.length>0' :status='loadingStatus' />
|
||||||
|
<u-empty v-if='couponList.length === 0' text='暂无优惠券' marginTop='100' />
|
||||||
|
</u-list>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
import CouponItem from './components/coupon-item.vue';
|
import CouponItem from './components/coupon-item.vue';
|
||||||
import { getCouponList } from '@/api/user';
|
import { getCouponList } from '@/api/user';
|
||||||
@@ -16,32 +19,54 @@ import { CouponBean } from '@/api/user/types';
|
|||||||
const store = useUserStore();
|
const store = useUserStore();
|
||||||
const { userInfo } = storeToRefs(store);
|
const { userInfo } = storeToRefs(store);
|
||||||
|
|
||||||
const coupons = ref<CouponBean[]>([]);
|
const couponStatus = ref<number | any>(undefined);
|
||||||
|
const couponList = ref<CouponBean[]>([]);
|
||||||
|
const currentPageNum = ref(1);
|
||||||
|
const loadingStatus = ref('loading');
|
||||||
|
|
||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
await fetchData(0);
|
await fetchData();
|
||||||
});
|
});
|
||||||
|
|
||||||
const tabChange = (index: number) => {
|
const tabChange = (index: number) => {
|
||||||
fetchData(index);
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
couponStatus.value = undefined;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
couponStatus.value = 0;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
couponStatus.value = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
currentPageNum.value = 1;
|
||||||
|
fetchData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchData = async (status: number) => {
|
const fetchData = async (refresh: boolean = true) => {
|
||||||
|
loadingStatus.value = 'loading';
|
||||||
|
if(!refresh) {
|
||||||
|
currentPageNum.value += 1;
|
||||||
|
}
|
||||||
|
|
||||||
const { list } = await getCouponList({
|
const { list } = await getCouponList({
|
||||||
companyId: getCompanyId(),
|
companyId: getCompanyId(),
|
||||||
memberId: userInfo.value?.id,
|
memberId: userInfo.value?.id,
|
||||||
status: status,
|
status: couponStatus.value,
|
||||||
pageNum: 1,
|
pageNum: currentPageNum.value,
|
||||||
pageSize: 20
|
pageSize: 20
|
||||||
});
|
});
|
||||||
coupons.value = list;
|
if(refresh) {
|
||||||
|
couponList.value = list;
|
||||||
|
} else {
|
||||||
|
couponList.value = couponList.value.concat(list);
|
||||||
|
}
|
||||||
|
loadingStatus.value = 'no';
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLoadMore = () => {
|
const onLoadMore = () => {
|
||||||
if(coupons.value.length >= 20) {
|
fetchData(false);
|
||||||
return;
|
|
||||||
}
|
|
||||||
fetchData(0);
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
<scroll-view style='margin: 10rpx 20rpx'>
|
<scroll-view style='margin: 10rpx 20rpx'>
|
||||||
<u-list @scrolltolower='loadMore'>
|
<u-list @scrolltolower='loadMore'>
|
||||||
<integral-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
<integral-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
||||||
|
<u-empty v-if='tradeList.length === 0' text='暂无数据' margin-top='100' />
|
||||||
</u-list>
|
</u-list>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<image class='goods-image' :src='item?.orderGoods[0].images||defaultImage' />
|
<image class='goods-image' :src='item?.orderGoods[0].images||defaultImage' />
|
||||||
<view class='c-flex-column' style='flex: 1;'>
|
<view class='c-flex-column' style='flex: 1;'>
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text class='goods-name'>{{ item?.orderGoods[0].goodsName||'未知' }}</text>
|
<text class='goods-name'>{{ item?.orderGoods[0].goodsName || '未知' }}</text>
|
||||||
<text class='status'>
|
<text class='status'>
|
||||||
<text v-if='item?.payStatus == 2'>已支付</text>
|
<text v-if='item?.payStatus == 2'>已支付</text>
|
||||||
<text v-else-if='isPending(item)'>待支付</text>
|
<text v-else-if='isPending(item)'>待支付</text>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class='bottom-view c-flex-row'>
|
<view class='bottom-view c-flex-row'>
|
||||||
<text>
|
<text>
|
||||||
{{ item?.orderGoods[0].stockStock.colorName }},{{ item?.orderGoods[0].stockStock.sizeName }}
|
{{ item?.orderGoods[0].stockStock.colorName||'均色' }},{{ item?.orderGoods[0].stockStock.sizeName||'均码' }}
|
||||||
</text>
|
</text>
|
||||||
<text>
|
<text>
|
||||||
共{{ item?.itemNum }}件
|
共{{ item?.itemNum }}件
|
||||||
@@ -33,7 +33,8 @@
|
|||||||
|
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text class='add-shoppingcart secondary-text-color' @click.stop='add(item?.orderGoods[0])'>加入购物车</text>
|
<text class='add-shoppingcart secondary-text-color' @click.stop='add(item?.orderGoods[0])'>加入购物车</text>
|
||||||
<text class='payment accent-text-color' v-if='isPending(item)' @click.stop='goPath(`/pages/mine/subs/order/detail?orderId=${item?.id}`)'>立即支付
|
<text class='payment accent-text-color' v-if='isPending(item)'
|
||||||
|
@click.stop='goPath(`/pages/mine/subs/order/detail?orderId=${item?.id}`)'>立即支付
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -155,13 +156,14 @@ const pay = (orderId: string | undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.add-shoppingcart {
|
.add-shoppingcart {
|
||||||
border: 1rpx solid #ACACAC;
|
border: 2rpx solid #ACACAC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.payment {
|
.payment {
|
||||||
border: 1rpx solid #F32B2B;
|
border: 2rpx solid #F32B2B;
|
||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,11 +18,14 @@
|
|||||||
<view class='address-view c-flex-column'
|
<view class='address-view c-flex-column'
|
||||||
v-if='orderBean?.order?.address'>
|
v-if='orderBean?.order?.address'>
|
||||||
<view class='user-info c-flex-row'>
|
<view class='user-info c-flex-row'>
|
||||||
<text v-if='orderBean.order.address.defaultstatus==1'>默认</text>
|
<text class='status' v-if='orderBean.order.address.defaultstatus==1'>默认</text>
|
||||||
<text>{{ orderBean?.order?.address.name }}</text>
|
<text>{{ orderBean?.order?.address.name }}</text>
|
||||||
<text>{{ orderBean?.order?.address.mobile }}</text>
|
<text>{{ orderBean?.order?.address.mobile }}</text>
|
||||||
<view style='flex: 1' />
|
<view style='flex: 1' />
|
||||||
<text style='color: #5B96FB'>复制</text>
|
<text style='color: #5B96FB'
|
||||||
|
@click.stop='copy(orderBean?.order?.address.name+","+orderBean?.order?.address.mobile+","+orderBean?.order?.address.addr)'>
|
||||||
|
复制
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='addr c-flex-row'>
|
<view class='addr c-flex-row'>
|
||||||
@@ -45,7 +48,7 @@
|
|||||||
</text>
|
</text>
|
||||||
<view class='bottom-view c-flex-row'>
|
<view class='bottom-view c-flex-row'>
|
||||||
<text>
|
<text>
|
||||||
{{ item.stockStock.colorName }},{{ item.stockStock.sizeName }} x{{ item.goodsNum }}
|
{{ item.stockStock.colorName||'均色' }},{{ item.stockStock.sizeName||'均码' }} x{{ item.goodsNum }}
|
||||||
</text>
|
</text>
|
||||||
<text>{{ item.consumePrice }}</text>
|
<text>{{ item.consumePrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -89,7 +92,7 @@
|
|||||||
|
|
||||||
<view class='order-no c-flex-column'>
|
<view class='order-no c-flex-column'>
|
||||||
<text>订单编号:{{ orderBean?.order?.id }}
|
<text>订单编号:{{ orderBean?.order?.id }}
|
||||||
<text style='color: #5B96FB;margin-left: 10rpx'>复制</text>
|
<text style='color: #5B96FB;margin-left: 10rpx' @click.stop='copy(orderBean?.order?.id||"")'>复制</text>
|
||||||
</text>
|
</text>
|
||||||
<text>下单时间:{{ orderBean?.order?.createTime }}</text>
|
<text>下单时间:{{ orderBean?.order?.createTime }}</text>
|
||||||
<text>
|
<text>
|
||||||
@@ -122,7 +125,7 @@
|
|||||||
import { assetsUrl, defaultImage } from '@/utils/assets';
|
import { assetsUrl, defaultImage } from '@/utils/assets';
|
||||||
import { getOrderDetail } from '@/api/order';
|
import { getOrderDetail } from '@/api/order';
|
||||||
import { OrderBean } from '@/api/order/types';
|
import { OrderBean } from '@/api/order/types';
|
||||||
import { parseParameter, sortASCII } from '@/utils';
|
import { copy, parseParameter, sortASCII } from '@/utils';
|
||||||
import { hexMD5 } from '@/utils/common/md5';
|
import { hexMD5 } from '@/utils/common/md5';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { getOrderDeadline, handlePayResult, isPending } from '@/utils/order';
|
import { getOrderDeadline, handlePayResult, isPending } from '@/utils/order';
|
||||||
@@ -161,7 +164,7 @@ const buildSqbParams = computed(() => {
|
|||||||
const params = sortASCII({
|
const params = sortASCII({
|
||||||
client_sn: orderBean.value?.order?.id || '',
|
client_sn: orderBean.value?.order?.id || '',
|
||||||
return_url: '/pages/common/payresult/index',
|
return_url: '/pages/common/payresult/index',
|
||||||
total_amount: ((orderBean.value?.order?.totalPrice || 0) * 100).toString(),
|
total_amount: Number(((orderBean.value?.order?.totalPrice || 0) * 100).toFixed(2)),
|
||||||
terminal_sn: terminalInfo.value.terminalSn,
|
terminal_sn: terminalInfo.value.terminalSn,
|
||||||
subject: '商品支付',
|
subject: '商品支付',
|
||||||
merchant_name: terminalInfo.value.companyName,
|
merchant_name: terminalInfo.value.companyName,
|
||||||
@@ -255,7 +258,7 @@ const payment = () => {
|
|||||||
margin-left: 20rpx;
|
margin-left: 20rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
|
|
||||||
text:nth-of-type(1) {
|
.status {
|
||||||
padding: 2rpx 10rpx;
|
padding: 2rpx 10rpx;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #F32B2B;
|
color: #F32B2B;
|
||||||
@@ -438,11 +441,12 @@ const payment = () => {
|
|||||||
sqb-pay button {
|
sqb-pay button {
|
||||||
padding: 0 45rpx;
|
padding: 0 45rpx;
|
||||||
border-radius: 50rpx;
|
border-radius: 50rpx;
|
||||||
border: 1rpx solid #F32B2B;
|
border: 2rpx solid #F32B2B;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #F32B2B;
|
color: #F32B2B;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
<u-list-item v-for='(item,index) in orderList' :key='index'>
|
<u-list-item v-for='(item,index) in orderList' :key='index'>
|
||||||
<order-item :item='item' @addShoppingCart='addShoppingCart' @pay='payment' />
|
<order-item :item='item' @addShoppingCart='addShoppingCart' @pay='payment' />
|
||||||
</u-list-item>
|
</u-list-item>
|
||||||
<u-loadmore status='loading' />
|
<u-loadmore v-if='orderList.length>0' :status='loadingStatus' />
|
||||||
|
<u-empty v-if='orderList.length === 0' text='暂无数据' margin-top='100' />
|
||||||
</u-list>
|
</u-list>
|
||||||
<sku-dialog ref='skuDialogRef' :exists='temporaryStockBean' />
|
<sku-dialog ref='skuDialogRef' :exists='temporaryStockBean' />
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ const temporaryStockBean = ref<StockBean>();
|
|||||||
const orderList = ref<OrderBean[]>([]);
|
const orderList = ref<OrderBean[]>([]);
|
||||||
const currentPageNum = ref(1);
|
const currentPageNum = ref(1);
|
||||||
const payStatus = ref(0);
|
const payStatus = ref(0);
|
||||||
|
const loadingStatus = ref('loading');
|
||||||
|
|
||||||
let currentInterval = 0;
|
let currentInterval = 0;
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@ const tabChange = (index: number) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchData = async (refresh: boolean = true) => {
|
const fetchData = async (refresh: boolean = true) => {
|
||||||
|
loadingStatus.value = 'loading';
|
||||||
if(!refresh) {
|
if(!refresh) {
|
||||||
currentPageNum.value += 1;
|
currentPageNum.value += 1;
|
||||||
}
|
}
|
||||||
@@ -59,6 +62,7 @@ const fetchData = async (refresh: boolean = true) => {
|
|||||||
} else {
|
} else {
|
||||||
orderList.value = orderList.value.concat(list);
|
orderList.value = orderList.value.concat(list);
|
||||||
}
|
}
|
||||||
|
loadingStatus.value = 'no';
|
||||||
handleCountdown(orderList.value.filter(item => item.payStatus == 1));
|
handleCountdown(orderList.value.filter(item => item.payStatus == 1));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<view class='top-card-view'>
|
<view class='top-card-view'>
|
||||||
<image class='bg-image' :src='companyConfigInfo.userbgcover' />
|
<image class='bg-image' :src='companyConfigInfo.userbgcover' />
|
||||||
<image class='avatar-image' :src='params.image' />
|
<image class='avatar-image' :src='params.image' />
|
||||||
<text>{{ userInfo.name }}</text>
|
<text>{{ userInfo.nickName }}</text>
|
||||||
<text>{{ userInfo.levelName }}</text>
|
<text>{{ userInfo.levelName }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
<view class='divider' />
|
<view class='divider' />
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text>生日</text>
|
<text>生日</text>
|
||||||
<picker mode='date' :disabled='userInfo.birthday!=""' @change='changeDate'>
|
<picker mode='date' :disabled='(userInfo.birthday?.length||0)!=0' @change='changeDate'>
|
||||||
<text>{{ params?.birthday || '请选择生日' }}</text>
|
<text>{{ dayjs(params?.birthday || Date.now()).format('YYYY-MM-DD') || '请选择生日' }}</text>
|
||||||
</picker>
|
</picker>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -80,7 +80,7 @@ const params = ref<{
|
|||||||
nickName: userInfo.value.nickName,
|
nickName: userInfo.value.nickName,
|
||||||
telephone: userInfo.value.telephone,
|
telephone: userInfo.value.telephone,
|
||||||
gender: userInfo.value.gender,
|
gender: userInfo.value.gender,
|
||||||
birthday: userInfo.value.birthday
|
birthday: userInfo.value.birthday|| dayjs().format('YYYY-MM-DD')
|
||||||
});
|
});
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
@@ -135,20 +135,19 @@ const save = async () => {
|
|||||||
|
|
||||||
const result = await updateProfile({
|
const result = await updateProfile({
|
||||||
...params.value,
|
...params.value,
|
||||||
birthday: dayjs(params.value.birthday).format('YYYY-MM-DD HH:mm:ss'),
|
birthday: dayjs(birthday.value).isValid() ? dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
birthdayType: 0
|
birthdayType: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
if(result) {
|
if(result) {
|
||||||
await store.setUserInfo(newUserInfo);
|
await store.setUserInfo(newUserInfo);
|
||||||
uni.showToast({
|
showToast('修改成功', {
|
||||||
title: '修改成功',
|
icon: 'success', complete: () => {
|
||||||
icon: 'success',
|
|
||||||
duration: 2000,
|
|
||||||
success(result) {
|
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
showToast('服务异常,操作失败', { icon: 'error' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<image :src='assetsUrl("bg_member_recharge.png")' />
|
<image :src='assetsUrl("bg_member_recharge.png")' />
|
||||||
<view class='balance-content'>
|
<view class='balance-content'>
|
||||||
<text>累计余额(元)</text>
|
<text>累计余额(元)</text>
|
||||||
<text>¥{{ userInfo?.totalIncoming}}</text>
|
<text>¥{{ userInfo?.totalIncoming }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class='balance-content'>
|
<view class='balance-content'>
|
||||||
<text>当前余额(元)</text>
|
<text>当前余额(元)</text>
|
||||||
@@ -13,17 +13,30 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='recharge-option-card'>
|
<view class='recharge-option-card'>
|
||||||
<text>充值金额</text>
|
<view class='top-border'></view>
|
||||||
<tabbar :titles='rechargeItems?.map(res=>res.rechargeamount)' @change='change' />
|
<text class='title'>充值金额</text>
|
||||||
<view class='divider' />
|
<scroll-view scroll-y style='flex: 1;padding-bottom: 180rpx'>
|
||||||
<view class='option-item'>
|
<view class='option-item' :class="{'option-item-active': currentIndex==index}"
|
||||||
<image :src='assetsUrl("bg_member_recharge_item.png")' />
|
v-for='(item,index) in rechargeItems' :key='index' @click.stop='change(index)'>
|
||||||
<text>充值{{ rechargeItems[currentIndex]?.rechargeamount }}送{{ rechargeItems[currentIndex]?.rewardamount }}元
|
<image v-if='currentIndex==index' class='checked-image' src='/static/images/ic_recharge_checked.png' />
|
||||||
</text>
|
<label class='amount-title'>{{ item.rechargeamount }}元</label>
|
||||||
<text class='accent-text-color'>
|
<view class='divider' style='margin-bottom: 36rpx' />
|
||||||
实得{{ rechargeItems[currentIndex]?.rechargeamount + (rechargeItems[currentIndex]?.rewardamount) }}元
|
<view class='card-view'>
|
||||||
</text>
|
<view class='title-container'>
|
||||||
</view>
|
<text>充值{{ item?.rechargeamount || 0 }}送{{ item?.rewardamount || 0
|
||||||
|
}}元
|
||||||
|
</text>
|
||||||
|
<text class='accent-text-color'>
|
||||||
|
实得{{ item?.rechargeamount + (item?.rewardamount) }}元
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<text class='description'>送{{ item.rewardamount || 0 }}元、送{{ item.rewardcouponamount || 0
|
||||||
|
}}元优惠券共{{ item.rewardcouponnum || 0 }}张、
|
||||||
|
返利{{ item.rewardrefundamount || 0 }}元
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class='bottom-button-view'>
|
<view class='bottom-button-view'>
|
||||||
@@ -47,7 +60,7 @@
|
|||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { assetsUrl } from '@/utils/assets';
|
import { assetsUrl } from '@/utils/assets';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { getRechargeList, preRecharge, recharge, rechargeVerify } from '@/api/user';
|
import { getRechargeList, preRecharge, rechargeVerify } from '@/api/user';
|
||||||
import { parseParameter, sortASCII } from '@/utils';
|
import { parseParameter, sortASCII } from '@/utils';
|
||||||
import { hexMD5 } from '@/utils/common/md5';
|
import { hexMD5 } from '@/utils/common/md5';
|
||||||
import { handlePayResult } from '@/utils/order';
|
import { handlePayResult } from '@/utils/order';
|
||||||
@@ -55,12 +68,16 @@ import { handlePayResult } from '@/utils/order';
|
|||||||
const userState = useUserStore();
|
const userState = useUserStore();
|
||||||
const { userInfo, terminalInfo } = storeToRefs(userState);
|
const { userInfo, terminalInfo } = storeToRefs(userState);
|
||||||
|
|
||||||
|
const rechargeOptionBackgroundUrl = assetsUrl('bg_member_recharge_item.png');
|
||||||
|
|
||||||
const rechargeItems = ref<{
|
const rechargeItems = ref<{
|
||||||
itemid: string
|
itemid: string
|
||||||
rechargeamount: number
|
rechargeamount: number
|
||||||
rewardamount: number
|
rewardamount: number
|
||||||
rewardcouponamount: number,
|
rewardcouponamount: number,
|
||||||
rechargetype: number
|
rewardcouponnum: number
|
||||||
|
rechargetype: number,
|
||||||
|
rewardrefundamount: number
|
||||||
}[]>([]);
|
}[]>([]);
|
||||||
const currentIndex = ref<number>(0);
|
const currentIndex = ref<number>(0);
|
||||||
const preRechargeOrderId = ref();
|
const preRechargeOrderId = ref();
|
||||||
@@ -68,6 +85,12 @@ const preRechargeOrderId = ref();
|
|||||||
onLoad(async () => {
|
onLoad(async () => {
|
||||||
const { ruleitems } = await getRechargeList();
|
const { ruleitems } = await getRechargeList();
|
||||||
rechargeItems.value = ruleitems;
|
rechargeItems.value = ruleitems;
|
||||||
|
// rechargeItems.value.push(rechargeItems.value[0]);
|
||||||
|
// rechargeItems.value.push(rechargeItems.value[0]);
|
||||||
|
// rechargeItems.value.push(rechargeItems.value[0]);
|
||||||
|
// rechargeItems.value.push(rechargeItems.value[0]);
|
||||||
|
|
||||||
|
console.log(rechargeItems.value);
|
||||||
await change(0);
|
await change(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,7 +106,7 @@ const buildSqbParams = computed(() => {
|
|||||||
const params = sortASCII({
|
const params = sortASCII({
|
||||||
client_sn: preRechargeOrderId.value,
|
client_sn: preRechargeOrderId.value,
|
||||||
return_url: '/pages/common/payresult/index',
|
return_url: '/pages/common/payresult/index',
|
||||||
total_amount: ((rechargeItems.value[currentIndex.value]?.rechargeamount || 0) * 100).toString(),
|
total_amount: Number(((rechargeItems.value[currentIndex.value]?.rechargeamount || 0) * 100).toFixed(2)),
|
||||||
terminal_sn: terminalInfo.value.terminalSn,
|
terminal_sn: terminalInfo.value.terminalSn,
|
||||||
subject: '充值',
|
subject: '充值',
|
||||||
merchant_name: terminalInfo.value.companyName,
|
merchant_name: terminalInfo.value.companyName,
|
||||||
@@ -98,26 +121,23 @@ const buildSqbParams = computed(() => {
|
|||||||
const navigateTo = (e: any) => {
|
const navigateTo = (e: any) => {
|
||||||
handlePayResult(preRechargeOrderId.value, e, {
|
handlePayResult(preRechargeOrderId.value, e, {
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
console.log('---------->>> recharge success ');
|
|
||||||
await goRecharge();
|
await goRecharge();
|
||||||
await userState.setUserInfo({
|
await userState.setUserInfo({
|
||||||
...userInfo.value,
|
...userInfo.value,
|
||||||
balance: Number(userInfo.value.balance) + Number(rechargeItems.value[currentIndex.value].rechargeamount) + Number(rechargeItems.value[currentIndex.value]?.rewardamount)
|
balance: Number(userInfo.value.balance) + Number(rechargeItems.value[currentIndex.value].rechargeamount) + Number(rechargeItems.value[currentIndex.value]?.rewardamount)
|
||||||
});
|
});
|
||||||
|
await uni.navigateBack();
|
||||||
},
|
},
|
||||||
onFailure: () => {
|
onFailure: () => {
|
||||||
console.log('---------->>> recharge failure ');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const goRecharge = async () => {
|
const goRecharge = async () => {
|
||||||
console.log(buildSqbParams.value);
|
// const result = await recharge({
|
||||||
const result = await recharge({
|
// itemid: rechargeItems.value[currentIndex.value].itemid
|
||||||
itemid: rechargeItems.value[currentIndex.value].itemid
|
// });
|
||||||
});
|
// console.log('platform recharge result ', result);
|
||||||
console.log('platform recharge result ', result);
|
|
||||||
|
|
||||||
await rechargeVerify({
|
await rechargeVerify({
|
||||||
payid: preRechargeOrderId.value
|
payid: preRechargeOrderId.value
|
||||||
});
|
});
|
||||||
@@ -161,53 +181,109 @@ const goRecharge = async () => {
|
|||||||
.recharge-option-card {
|
.recharge-option-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: #FFFFFF;
|
background: #F5F5F5;
|
||||||
border-radius: 30rpx 30rpx 0 0;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: -25rpx;
|
//margin-top: -25rpx;
|
||||||
|
|
||||||
text:nth-of-type(1) {
|
.top-border {
|
||||||
|
background: #FFFFFF;
|
||||||
|
height: 30rpx;
|
||||||
|
margin-top: -35rpx;
|
||||||
|
border-radius: 30rpx 30rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin-top: 20rpx;
|
background: #FFFFFF;
|
||||||
margin-left: 30rpx;
|
border-radius: 10rpx 10rpx 0 0;
|
||||||
|
padding: 10rpx 20rpx 20rpx 20rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
margin-top: -15rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.option-item {
|
.option-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
margin: 10rpx 20rpx 20rpx 20rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding-top: 20rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border: solid #00000000 2rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 36rpx 20rpx;
|
|
||||||
|
|
||||||
image {
|
.amount-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 40rpx;
|
||||||
|
width: fit-content;
|
||||||
|
color: #333333;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amount-title:after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
border: 2rpx solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checked-image {
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
border-radius: 0 18rpx 0 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-view {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 167rpx;
|
height: 167rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
}
|
//background-image: url(v-bind(rechargeOptionBackgroundUrl));
|
||||||
|
background-image: url('https://img.lakeapp.cn/wx/images/bg_member_recharge_item.png');
|
||||||
text:nth-of-type(1) {
|
background-size: 100% 100%;
|
||||||
font-size: 36rpx;
|
justify-content: flex-start;
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
margin-top: 27rpx;
|
|
||||||
margin-left: 30rpx;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
text:nth-of-type(2) {
|
.title-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 30rpx;
|
flex-direction: row;
|
||||||
margin-top: 85rpx;
|
align-items: center;
|
||||||
margin-left: 30rpx;
|
justify-content: space-between;
|
||||||
align-items: center;
|
margin-top: 27rpx;
|
||||||
justify-content: center;
|
padding: 0 30rpx;
|
||||||
width: 185rpx;
|
|
||||||
height: 50rpx;
|
text:nth-of-type(1) {
|
||||||
background: #FFFFFF;
|
display: flex;
|
||||||
border-radius: 25rpx;
|
font-size: 36rpx;
|
||||||
position: absolute;
|
}
|
||||||
|
|
||||||
|
text:nth-of-type(2) {
|
||||||
|
display: flex;
|
||||||
|
font-size: 30rpx;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 185rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 25rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.option-item-active {
|
||||||
|
@extend .option-item;
|
||||||
|
border: 2rpx solid #f95e5d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
<!-- <view class='item c-flex-column' v-for='(item,index) in 3' :key='index'>-->
|
<!-- <view class='item c-flex-column' v-for='(item,index) in 3' :key='index'>-->
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text class='primary-text-color' style='flex: 1'>{{ item.name }}</text>
|
<text class='primary-text-color' style='flex: 1'>{{ item.name }}</text>
|
||||||
<text class='accent-text-color'>-{{ item.transactionPrice || 0 }}</text>
|
<text class='accent-text-color'>{{item.type===1?'-':'+'}}{{
|
||||||
|
item.transactionPrice || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class='c-flex-row'>
|
<view class='c-flex-row'>
|
||||||
<text class='secondary-text-color' style='flex: 1'>{{ item.createTime }}</text>
|
<text class='secondary-text-color' style='flex: 1'>{{ item.createTime }}</text>
|
||||||
@@ -28,7 +29,7 @@ defineProps({
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 16rpx 23rpx 20rpx 30rpx;
|
padding: 16rpx 23rpx 20rpx 30rpx;
|
||||||
margin: 10rpx 0;
|
margin: 20rpx 0 10rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.category-title {
|
.category-title {
|
||||||
|
@@ -2,33 +2,34 @@
|
|||||||
<tabbar :titles='["全部","充值","消费"]' @change='changeTab' :item-active-color='"#D95554"'
|
<tabbar :titles='["全部","充值","消费"]' @change='changeTab' :item-active-color='"#D95554"'
|
||||||
:indicator-color='"#D95554"' />
|
:indicator-color='"#D95554"' />
|
||||||
<view class='content'>
|
<view class='content'>
|
||||||
<view class='c-flex-row'>
|
<!-- <view class='c-flex-row'>-->
|
||||||
<text>选择日期</text>
|
<!-- <text>选择日期</text>-->
|
||||||
<picker mode='date' @change='changeDate'>
|
<!-- <picker mode='date' @change='changeDate'>-->
|
||||||
<view class='current-date c-flex-row'>
|
<!-- <view class='current-date c-flex-row'>-->
|
||||||
<text>{{ tradeDate }}</text>
|
<!-- <text>{{ tradeDate }}</text>-->
|
||||||
<image :src='assetsUrl("ic_triangle_down.png")' />
|
<!-- <image :src='assetsUrl("ic_triangle_down.png")' />-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
</picker>
|
<!-- </picker>-->
|
||||||
</view>
|
<!-- </view>-->
|
||||||
|
|
||||||
<u-list @scrolltolower='loadMore'>
|
<u-list @scrolltolower='loadMore'>
|
||||||
<trade-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
<trade-item v-for='(item,index) in tradeList' :key='index' :item='item' />
|
||||||
<u-loadmore status='loading' />
|
<u-loadmore v-if='tradeList.length>0' :status='loadingStatus' />
|
||||||
|
<u-empty v-if='tradeList.length === 0' text='暂无数据' margin-top='100' />
|
||||||
</u-list>
|
</u-list>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { assetsUrl } from '@/utils/assets';
|
|
||||||
import TradeItem from './components/trade-item.vue';
|
import TradeItem from './components/trade-item.vue';
|
||||||
import { getTradeList } from '@/api/user';
|
import { getTradeList } from '@/api/user';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
const tradeList = ref([]);
|
const tradeList = ref([]);
|
||||||
const tradeType = ref('全部');
|
const tradeType = ref('');
|
||||||
const tradeDate = ref();
|
const tradeDate = ref();
|
||||||
const currentPageNum = ref(1);
|
const currentPageNum = ref(1);
|
||||||
|
const loadingStatus = ref('loading');
|
||||||
|
|
||||||
onLoad((e) => {
|
onLoad((e) => {
|
||||||
tradeDate.value = dayjs(Date.now()).format('YYYY-MM-DD');
|
tradeDate.value = dayjs(Date.now()).format('YYYY-MM-DD');
|
||||||
@@ -43,7 +44,7 @@ const changeDate = (e: any) => {
|
|||||||
const changeTab = (index: number) => {
|
const changeTab = (index: number) => {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
tradeType.value = '全部';
|
tradeType.value = '';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
tradeType.value = '会员充值';
|
tradeType.value = '会员充值';
|
||||||
@@ -57,9 +58,10 @@ const changeTab = (index: number) => {
|
|||||||
|
|
||||||
const fetchData = async (refresh: boolean = true) => {
|
const fetchData = async (refresh: boolean = true) => {
|
||||||
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
|
currentPageNum.value = refresh ? 1 : currentPageNum.value + 1;
|
||||||
|
loadingStatus.value = 'loading';
|
||||||
const { list } = await getTradeList({
|
const { list } = await getTradeList({
|
||||||
startDate: tradeDate.value,
|
// startDate: tradeDate.value,
|
||||||
endDate: tradeDate.value,
|
// endDate: dayjs(tradeDate.value).add(1, 'day').format('YYYY-MM-DD'),
|
||||||
name: tradeType.value,
|
name: tradeType.value,
|
||||||
pageNum: currentPageNum.value,
|
pageNum: currentPageNum.value,
|
||||||
pageSize: 20
|
pageSize: 20
|
||||||
@@ -69,6 +71,7 @@ const fetchData = async (refresh: boolean = true) => {
|
|||||||
} else {
|
} else {
|
||||||
tradeList.value = tradeList.value.concat(list);
|
tradeList.value = tradeList.value.concat(list);
|
||||||
}
|
}
|
||||||
|
loadingStatus.value = 'no';
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadMore = () => {
|
const loadMore = () => {
|
||||||
|
@@ -3,7 +3,9 @@ import { getToken } from '@/utils/auth';
|
|||||||
// 登录页面
|
// 登录页面
|
||||||
const loginPage = '/pages/common/login/index';
|
const loginPage = '/pages/common/login/index';
|
||||||
// 页面白名单
|
// 页面白名单
|
||||||
const whiteList = ['/', '/pages/common/login/index', '/pages/home/index'];
|
const whiteList = ['/', '/pages/common/login/index', '/pages/home/index','/pages/common/register/index',
|
||||||
|
'/pages/common/register/reward',
|
||||||
|
'/pages/mine/index','/pages/mine/subs/order/index'];
|
||||||
|
|
||||||
// 检查地址白名单
|
// 检查地址白名单
|
||||||
function checkWhite(url: string) {
|
function checkWhite(url: string) {
|
||||||
|
BIN
src/static/images/ic_checked_gray.png
Normal file
BIN
src/static/images/ic_checked_gray.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
src/static/images/ic_checked_green.png
Normal file
BIN
src/static/images/ic_checked_green.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
src/static/images/ic_checkmark_red.png
Normal file
BIN
src/static/images/ic_checkmark_red.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
src/static/images/ic_recharge_checked.png
Normal file
BIN
src/static/images/ic_recharge_checked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
@@ -4,7 +4,7 @@ import { getCompanyId } from '@/utils';
|
|||||||
|
|
||||||
const useShoppingCartStore = defineStore('shoppingCart', {
|
const useShoppingCartStore = defineStore('shoppingCart', {
|
||||||
state: (): { shoppingCartList: GoodsBean[] } => ({
|
state: (): { shoppingCartList: GoodsBean[] } => ({
|
||||||
shoppingCartList: uni.getStorageSync(`shoppingCart_${getCompanyId()}`) == '' ? [] : uni.getStorageSync(`shoppingCart_${getCompanyId()}`) as GoodsBean[]
|
shoppingCartList: uni.getStorageSync(`shoppingCart_${getCompanyId()}`) === '' ? [] : uni.getStorageSync(`shoppingCart_${getCompanyId()}`) as GoodsBean[]
|
||||||
}),
|
}),
|
||||||
|
|
||||||
persist: {
|
persist: {
|
||||||
@@ -12,11 +12,11 @@ const useShoppingCartStore = defineStore('shoppingCart', {
|
|||||||
key: 'shoppingCartState',
|
key: 'shoppingCartState',
|
||||||
storage: {
|
storage: {
|
||||||
setItem(key, value) {
|
setItem(key, value) {
|
||||||
uni.setStorageSync(key, value || []); // [!code warning]
|
uni.setStorageSync(key, value); // [!code warning]
|
||||||
uni.setStorageSync(`shoppingCart_${getCompanyId()}`, JSON.parse(value).shoppingCartList);
|
uni.setStorageSync(`shoppingCart_${getCompanyId()}`, JSON.parse(value).shoppingCartList);
|
||||||
},
|
},
|
||||||
getItem(key) {
|
getItem(key) {
|
||||||
return uni.getStorageSync(uni.getStorageSync(`shoppingCart_${getCompanyId()}`)) || []; // [!code warning]
|
return uni.getStorageSync(uni.getStorageSync(`shoppingCart_${getCompanyId()}`)) || '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 部分持久化状态的点符号路径数组,[]意味着没有状态被持久化(默认为undefined,持久化整个状态)
|
// 部分持久化状态的点符号路径数组,[]意味着没有状态被持久化(默认为undefined,持久化整个状态)
|
||||||
@@ -33,12 +33,19 @@ const useShoppingCartStore = defineStore('shoppingCart', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getSameGoodsIndex: (state) => (goodsId: string, colorId: string, sizeId: string) => {
|
getSameGoodsIndex: (state) => (goodsId: string, colorId: string, sizeId: string) => {
|
||||||
return state.shoppingCartList.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId) || -1;
|
if(Array.isArray(state.shoppingCartList)) {
|
||||||
|
return state.shoppingCartList?.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId);
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
save(partial: Partial<GoodsBean>) {
|
save(partial: Partial<GoodsBean>) {
|
||||||
|
if(!Array.isArray(this.shoppingCartList)) {
|
||||||
|
this.shoppingCartList = [];
|
||||||
|
}
|
||||||
this.shoppingCartList.push(partial as GoodsBean);
|
this.shoppingCartList.push(partial as GoodsBean);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -1,14 +1,23 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import type { providerType, UserBean } from './types';
|
import type { providerType, UserBean } from './types';
|
||||||
import { getTerminal, getUserProfile, login, logout as userLogout, register } from '@/api/user/index';
|
import { getTerminal, getUserProfile, login, logout as userLogout, register } from '@/api/user/index';
|
||||||
import { clearToken, getReferrerUserId, getRegisterStoreId, setCompanyId, setToken } from '@/utils/auth';
|
import {
|
||||||
import type { LoginResult, RegisterParams, TerminalBean } from '@/api/user/types';
|
clearToken,
|
||||||
|
getCompanyId,
|
||||||
|
getRegisterStoreId,
|
||||||
|
setCompanyId,
|
||||||
|
setOpenId,
|
||||||
|
setSessionKey,
|
||||||
|
setToken
|
||||||
|
} from '@/utils/auth';
|
||||||
|
import type { RegisterParams, TerminalBean } from '@/api/user/types';
|
||||||
import { getCompanyInfo } from '@/api/company';
|
import { getCompanyInfo } from '@/api/company';
|
||||||
|
|
||||||
const useUserStore = defineStore('user', {
|
const useUserStore = defineStore('user', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
userInfo: {} as UserBean,
|
userInfo: {} as UserBean,
|
||||||
terminalInfo: {} as TerminalBean,
|
terminalInfo: {} as TerminalBean,
|
||||||
|
companyInfo: {} as any,
|
||||||
companyConfigInfo: {
|
companyConfigInfo: {
|
||||||
bannerhot: [] as any[],
|
bannerhot: [] as any[],
|
||||||
bannerinx: [] as any[],
|
bannerinx: [] as any[],
|
||||||
@@ -16,7 +25,10 @@ const useUserStore = defineStore('user', {
|
|||||||
goodsstockzero: 0,
|
goodsstockzero: 0,
|
||||||
mallopen: 0,
|
mallopen: 0,
|
||||||
regqrcode: undefined,
|
regqrcode: undefined,
|
||||||
userbgcover: undefined
|
userbgcover: undefined,
|
||||||
|
groupqrcode: undefined,
|
||||||
|
contactname: '',
|
||||||
|
contacttelephone: ''
|
||||||
},
|
},
|
||||||
deliveryAddress: {
|
deliveryAddress: {
|
||||||
addrid: '',
|
addrid: '',
|
||||||
@@ -43,58 +55,22 @@ const useUserStore = defineStore('user', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
// getUserInfo(state: UserBean): UserBean {
|
getUserDiscount(): number {
|
||||||
// return { state };
|
if(this.userInfo?.levelEntity?.discount > 0 && this.userInfo?.levelEntity?.discount < 10) {
|
||||||
// }
|
return this.userInfo?.levelEntity?.discount / 10;
|
||||||
|
} else if(this.userInfo?.levelEntity?.discount >= 10 && this.userInfo?.levelEntity?.discount <= 100) {
|
||||||
|
return this.userInfo?.levelEntity?.discount / 100;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
getRealGoodsPrice: (state) => (price: number, priceExt: number) => {
|
||||||
|
return state.userInfo.salePrice == 'price_ext' ? priceExt || 0 : price;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
// 设置用户的信息
|
login(provider: providerType = 'weixin') {
|
||||||
async setUserInfo(partial: Partial<UserBean>) {
|
|
||||||
this.userInfo = partial as UserBean;
|
|
||||||
await setCompanyId(this.userInfo.companyId);
|
|
||||||
await this.fetchTerminal();
|
|
||||||
await this.fetchCompanyInfo();
|
|
||||||
},
|
|
||||||
|
|
||||||
setDeliveryAddress(partial: Partial<any>) {
|
|
||||||
this.deliveryAddress = partial as any;
|
|
||||||
},
|
|
||||||
|
|
||||||
// 重置用户信息
|
|
||||||
resetInfo() {
|
|
||||||
this.$reset();
|
|
||||||
},
|
|
||||||
// 获取用户信息
|
|
||||||
async getProfile() {
|
|
||||||
const result = await getUserProfile();
|
|
||||||
await this.setUserInfo(result);
|
|
||||||
},
|
|
||||||
|
|
||||||
async fetchCompanyInfo() {
|
|
||||||
this.companyConfigInfo = await getCompanyInfo();
|
|
||||||
},
|
|
||||||
|
|
||||||
userRegister(registerForm: RegisterParams) {
|
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
try {
|
|
||||||
const result = await register(registerForm);
|
|
||||||
resolve(result);
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// Logout
|
|
||||||
async logout() {
|
|
||||||
await userLogout();
|
|
||||||
this.resetInfo();
|
|
||||||
clearToken();
|
|
||||||
},
|
|
||||||
|
|
||||||
// 小程序授权登录
|
|
||||||
authLogin(provider: providerType = 'weixin') {
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.login({
|
uni.login({
|
||||||
provider,
|
provider,
|
||||||
@@ -108,50 +84,119 @@ const useUserStore = defineStore('user', {
|
|||||||
signature: wechatUserInfo?.signature,
|
signature: wechatUserInfo?.signature,
|
||||||
iv: wechatUserInfo.iv
|
iv: wechatUserInfo.iv
|
||||||
};
|
};
|
||||||
|
getApp().globalData?.logger.info('login params: ', userInfo);
|
||||||
const res = await login({
|
const res = await login({
|
||||||
code: result.code,
|
code: result.code,
|
||||||
userInfo: userInfo,
|
userInfo: userInfo,
|
||||||
|
storeId: getRegisterStoreId()
|
||||||
// referrerUserId: '1727303781559697409'
|
// referrerUserId: '1727303781559697409'
|
||||||
referrerUserId: getReferrerUserId()
|
// referrerUserId: getReferrerUserId()
|
||||||
});
|
});
|
||||||
|
getApp().globalData?.logger.info('login result: ', res);
|
||||||
if(res.user == undefined || res.user.id === null) {
|
setToken(res.token);
|
||||||
const registerForm = {
|
setSessionKey(res.sessionKey);
|
||||||
unionId: res.user.unionId,
|
setOpenId(res.maOpenId);
|
||||||
openId: res.user.openId,
|
if(res.user) {
|
||||||
maOpenId: res.user.maOpenId,
|
this.setUserInfo(res.user);
|
||||||
image: res.user.image,
|
|
||||||
nickName: res.user.nickName,
|
|
||||||
telephone: res.user.telephone,
|
|
||||||
birthday: res.user.birthday,
|
|
||||||
companyId: res.user.companyId,
|
|
||||||
creatorId: res.user.creatorId,
|
|
||||||
gender: res.user.gender,
|
|
||||||
storeId: getRegisterStoreId()
|
|
||||||
};
|
|
||||||
setToken(res.token);
|
|
||||||
const registerResult = await this.userRegister(registerForm);
|
|
||||||
await this.setUserInfo(registerResult as LoginResult);
|
|
||||||
} else {
|
} else {
|
||||||
setToken(res.token);
|
this.setUserInfo(res.userInfo);
|
||||||
await this.setUserInfo(res.user);
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
resolve(res);
|
resolve(res);
|
||||||
} else {
|
} else {
|
||||||
|
getApp().globalData?.logger.error('login error: ', result.errMsg);
|
||||||
reject(new Error(result.errMsg));
|
reject(new Error(result.errMsg));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err: any) => {
|
fail: (err: any) => {
|
||||||
console.error(`login error: ${err}`);
|
console.error(`login error: ${err}`);
|
||||||
|
getApp().globalData?.logger.error('login error: ', err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
register(params: {
|
||||||
|
image: string,
|
||||||
|
avatarUrl: string,
|
||||||
|
nickName: string,
|
||||||
|
telephone: string,
|
||||||
|
birthday: string,
|
||||||
|
gender: string
|
||||||
|
}) {
|
||||||
|
const registerForm = {
|
||||||
|
...params,
|
||||||
|
unionId: this.userInfo.unionId,
|
||||||
|
openId: this.userInfo.openId,
|
||||||
|
maOpenId: this.userInfo.maOpenId,
|
||||||
|
companyId: getCompanyId(),
|
||||||
|
creatorId: this.userInfo.creatorId,
|
||||||
|
storeId: getRegisterStoreId()
|
||||||
|
} as RegisterParams;
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const result = await register(registerForm);
|
||||||
|
resolve(result);
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 设置用户的信息
|
||||||
|
async setUserInfo(partial: Partial<UserBean>) {
|
||||||
|
this.userInfo = partial as UserBean;
|
||||||
|
// this.userInfo.levelEntity?.discount = 79;
|
||||||
|
// this.userInfo.salePrice = 'price_ext';
|
||||||
|
if(this.userInfo) {
|
||||||
|
this.userInfo.userDiscount = this.getUserDiscount;
|
||||||
|
await setCompanyId(this.userInfo.companyId);
|
||||||
|
if(getApp().globalData){
|
||||||
|
getApp().globalData.companyId = this.userInfo.companyId;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await clearToken();
|
||||||
|
}
|
||||||
|
this.fetchTerminal();
|
||||||
|
this.fetchCompanyInfo();
|
||||||
|
},
|
||||||
|
|
||||||
|
setCompanyInfo(partial: Partial<any>) {
|
||||||
|
this.companyInfo = partial as any;
|
||||||
|
if(getApp()?.globalData) {
|
||||||
|
getApp().globalData.companyId = this.companyInfo.id;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setDeliveryAddress(partial: Partial<any>) {
|
||||||
|
this.deliveryAddress = partial as any;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取用户信息
|
||||||
|
async getProfile() {
|
||||||
|
const result = await getUserProfile();
|
||||||
|
await this.setUserInfo(result);
|
||||||
|
},
|
||||||
|
|
||||||
|
async fetchCompanyInfo() {
|
||||||
|
this.companyConfigInfo = await getCompanyInfo();
|
||||||
|
},
|
||||||
|
|
||||||
async fetchTerminal() {
|
async fetchTerminal() {
|
||||||
this.terminalInfo = await getTerminal(this.userInfo.companyId);
|
this.terminalInfo = await getTerminal(this.userInfo?.companyId);
|
||||||
|
},
|
||||||
|
|
||||||
|
// 重置用户信息
|
||||||
|
resetInfo() {
|
||||||
|
this.$reset();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Logout
|
||||||
|
async logout() {
|
||||||
|
await userLogout();
|
||||||
|
this.resetInfo();
|
||||||
|
clearToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -38,7 +38,7 @@ export interface UserBean {
|
|||||||
registerDay: number;
|
registerDay: number;
|
||||||
relatedRate: number;
|
relatedRate: number;
|
||||||
remark: string;
|
remark: string;
|
||||||
salePrice: number;
|
salePrice: string;
|
||||||
source: string;
|
source: string;
|
||||||
status: string;
|
status: string;
|
||||||
storeId: string;
|
storeId: string;
|
||||||
@@ -50,6 +50,7 @@ export interface UserBean {
|
|||||||
updateTime: string;
|
updateTime: string;
|
||||||
useCouponsPrice: number;
|
useCouponsPrice: number;
|
||||||
wirelinedTelephone: string;
|
wirelinedTelephone: string;
|
||||||
|
userDiscount:number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type providerType =
|
export type providerType =
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
export const assetsUrl = (name: string) => `https://img.lakeapp.cn/wx/images/${name}`;
|
export const assetsUrl = (name: string) => `https://img.lakeapp.cn/wx/images/${name}`;
|
||||||
export const defaultAvatar = 'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132';
|
export const defaultAvatar = 'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132';
|
||||||
|
|
||||||
export const defaultImage = '/static/images/ic_noimage.svg';
|
export const defaultImage = '/static/images/ic_noimage.svg';
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
const TokenKey = 'accessToken';
|
const TokenKey = 'accessToken';
|
||||||
|
const SessionKey = 'sessionKey';
|
||||||
|
const OpenIdKey = 'openId';
|
||||||
const CompanyIdKey = 'companyId';
|
const CompanyIdKey = 'companyId';
|
||||||
const ReferrerUserIdKey = 'referrerUserId';
|
const ReferrerUserIdKey = 'referrerUserId';
|
||||||
const RegisterStoreIdKey = 'storeId';
|
const RegisterStoreIdKey = 'storeId';
|
||||||
@@ -17,12 +19,33 @@ function setToken(token: string) {
|
|||||||
uni.setStorageSync(TokenKey, token);
|
uni.setStorageSync(TokenKey, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSessionKey() {
|
||||||
|
return uni.getStorageSync(SessionKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSessionKey(sessionKey: string) {
|
||||||
|
uni.setStorageSync(SessionKey, sessionKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOpenId() {
|
||||||
|
return uni.getStorageSync(OpenIdKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setOpenId(openId: string) {
|
||||||
|
uni.setStorageSync(OpenIdKey, openId);
|
||||||
|
}
|
||||||
|
|
||||||
function getCompanyId() {
|
function getCompanyId() {
|
||||||
return uni.getStorageSync(CompanyIdKey);
|
return uni.getStorageSync(CompanyIdKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCompanyId(companyId: string) {
|
function setCompanyId(companyId: string) {
|
||||||
uni.setStorageSync(CompanyIdKey, companyId);
|
if(companyId) {
|
||||||
|
uni.setStorageSync(CompanyIdKey, companyId);
|
||||||
|
if(getApp()?.globalData) {
|
||||||
|
getApp().globalData.companyId = companyId;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReferrerUserId() {
|
function getReferrerUserId() {
|
||||||
@@ -44,6 +67,7 @@ function getRegisterStoreId() {
|
|||||||
function clearToken() {
|
function clearToken() {
|
||||||
uni.removeStorageSync(TokenKey);
|
uni.removeStorageSync(TokenKey);
|
||||||
uni.removeStorageSync(CompanyIdKey);
|
uni.removeStorageSync(CompanyIdKey);
|
||||||
|
uni.removeStorageSync(SessionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -51,6 +75,10 @@ export {
|
|||||||
isLogin,
|
isLogin,
|
||||||
getToken,
|
getToken,
|
||||||
setToken,
|
setToken,
|
||||||
|
getSessionKey,
|
||||||
|
setSessionKey,
|
||||||
|
getOpenId,
|
||||||
|
setOpenId,
|
||||||
getCompanyId,
|
getCompanyId,
|
||||||
setCompanyId,
|
setCompanyId,
|
||||||
getReferrerUserId,
|
getReferrerUserId,
|
||||||
|
@@ -108,3 +108,12 @@ export function parseParameter(obj: any) {
|
|||||||
}
|
}
|
||||||
return arr.join('&');
|
return arr.join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function copy(content: string) {
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: content,
|
||||||
|
success: function(res) {
|
||||||
|
showToast('复制成功');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
36
src/utils/common/logger.ts
Normal file
36
src/utils/common/logger.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import RealtimeTagLogManager = UniNamespace.RealtimeTagLogManager;
|
||||||
|
|
||||||
|
export class Logger {
|
||||||
|
|
||||||
|
private env = uni.getAccountInfoSync().miniProgram.envVersion;
|
||||||
|
private readonly logger: RealtimeTagLogManager;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
const logManager = uni.getRealtimeLogManager();
|
||||||
|
this.logger = logManager.tag('suke-mp');
|
||||||
|
}
|
||||||
|
|
||||||
|
info(key: string, value: any) {
|
||||||
|
if(this.env === 'release' || this.env === 'trial') {
|
||||||
|
this.logger.info(key, value);
|
||||||
|
} else {
|
||||||
|
console.info(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
warn(key: string, value: any) {
|
||||||
|
if(this.env === 'release' || this.env === 'trial') {
|
||||||
|
this.logger.warn(key, value);
|
||||||
|
}else {
|
||||||
|
console.warn(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
error(key: string, value: any) {
|
||||||
|
if(this.env === 'release' || this.env === 'trial') {
|
||||||
|
this.logger.error(key, value);
|
||||||
|
}else {
|
||||||
|
console.error(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
import type { HttpError, HttpRequestConfig, HttpResponse } from 'uview-plus/libs/luch-request';
|
import type { HttpError, HttpRequestConfig, HttpResponse } from 'uview-plus/libs/luch-request';
|
||||||
import { showMessage } from './status';
|
|
||||||
import { getCompanyId, getToken } from '@/utils/auth';
|
import { getCompanyId, getToken } from '@/utils/auth';
|
||||||
import useUserStore from '@/store/modules/user';
|
import { showMessage } from '@/utils/request/status';
|
||||||
|
import { useUserStore } from '@/store';
|
||||||
|
|
||||||
// 是否正在刷新token的标记
|
// 是否正在刷新token的标记
|
||||||
let isRefreshing: boolean = false;
|
let isRefreshing: boolean = false;
|
||||||
@@ -26,6 +26,7 @@ function requestInterceptors() {
|
|||||||
|
|
||||||
// config.header.contentType = "x-www-form-urlencoded"
|
// config.header.contentType = "x-www-form-urlencoded"
|
||||||
}
|
}
|
||||||
|
getApp().globalData?.logger.info('request: ', config);
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
@@ -52,18 +53,20 @@ function responseInterceptors() {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getApp().globalData?.logger.info('response: ', data);
|
||||||
|
|
||||||
// 请求成功则返回结果
|
// 请求成功则返回结果
|
||||||
if(data.code === 200 || data?.retcode == 0) {
|
if(data.code === 200 || data?.retcode == 0) {
|
||||||
return data || {};
|
return data || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// 登录状态失效,重新登录
|
// 登录状态失效,重新登录
|
||||||
if(data.code === 401) {
|
if(data.code === 4011 || data?.retcode === 4011) {
|
||||||
// 是否在获取token中,防止重复获取
|
// 是否在获取token中,防止重复获取
|
||||||
if(!isRefreshing) {
|
if(!isRefreshing) {
|
||||||
// 修改登录状态为true
|
// 修改登录状态为true
|
||||||
isRefreshing = true;
|
isRefreshing = true;
|
||||||
await useUserStore().authLogin();
|
await useUserStore().login();
|
||||||
// 登录完成之后,开始执行队列请求
|
// 登录完成之后,开始执行队列请求
|
||||||
requestQueue.forEach(cb => cb());
|
requestQueue.forEach(cb => cb());
|
||||||
// 重试完了清空这个队列
|
// 重试完了清空这个队列
|
||||||
@@ -96,12 +99,15 @@ function responseInterceptors() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
(response: HttpError) => {
|
(response: HttpError) => {
|
||||||
|
console.error('http error: ', response);
|
||||||
|
/* 对响应错误做点什么 (statusCode !== 200)*/
|
||||||
|
getApp().globalData?.logger.error('request error : ', response);
|
||||||
if(response.statusCode) {
|
if(response.statusCode) {
|
||||||
// 请求已发出,但是不在2xx的范围
|
// 请求已发出,但是不在2xx的范围
|
||||||
showMessage(response.statusCode);
|
uni.$u.toast(showMessage(response.statusCode));
|
||||||
return Promise.reject(response.data);
|
return Promise.reject(response.data);
|
||||||
}
|
}
|
||||||
showMessage('网络连接异常,请稍后再试!');
|
uni.$u.toast('网络连接异常,请稍后再试!');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ export const showMessage = (status: number | string): string => {
|
|||||||
message = 'HTTP版本不受支持(505)';
|
message = 'HTTP版本不受支持(505)';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
message = `连接出错(${status})!`;
|
message = `操作失败(${status})!`;
|
||||||
}
|
}
|
||||||
return `${message},请检查网络或联系管理员!`;
|
return `${message},请检查网络或联系管理员!`;
|
||||||
};
|
};
|
||||||
|
1
types/components.d.ts
vendored
1
types/components.d.ts
vendored
@@ -7,6 +7,7 @@ export {}
|
|||||||
|
|
||||||
declare module 'vue' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
|
CompanyDialog: typeof import('./../src/components/company-dialog.vue')['default']
|
||||||
OfficialAccountDialog: typeof import('./../src/components/official-account-dialog.vue')['default']
|
OfficialAccountDialog: typeof import('./../src/components/official-account-dialog.vue')['default']
|
||||||
PageNav: typeof import('./../src/components/page-nav/page-nav.vue')['default']
|
PageNav: typeof import('./../src/components/page-nav/page-nav.vue')['default']
|
||||||
PaymentButton: typeof import('./../src/components/payment-button.vue')['default']
|
PaymentButton: typeof import('./../src/components/payment-button.vue')['default']
|
||||||
|
Reference in New Issue
Block a user