This commit is contained in:
2023-08-18 17:22:11 +08:00
parent 1263c372cb
commit 61f840059b
36 changed files with 2371 additions and 1109 deletions

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

6
.idea/jsLibraryMappings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>

6
.idea/jsLinters/eslint.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EslintConfiguration">
<custom-configuration-file used="true" path="$PROJECT_DIR$/.eslintrc.js" />
</component>
</project>

3
components.d.ts vendored
View File

@@ -14,17 +14,20 @@ declare module '@vue/runtime-core' {
NutCellGroup: typeof import('@nutui/nutui-taro')['CellGroup']
NutCheckbox: typeof import('@nutui/nutui-taro')['Checkbox']
NutDialog: typeof import('@nutui/nutui-taro')['Dialog']
NutEllipsis: typeof import('@nutui/nutui-taro')['Ellipsis']
NutEmpty: typeof import('@nutui/nutui-taro')['Empty']
NutForm: typeof import('@nutui/nutui-taro')['Form']
NutFormItem: typeof import('@nutui/nutui-taro')['FormItem']
NutGrid: typeof import('@nutui/nutui-taro')['Grid']
NutGridItem: typeof import('@nutui/nutui-taro')['GridItem']
NutInput: typeof import('@nutui/nutui-taro')['Input']
NutInputNumber: typeof import('@nutui/nutui-taro')['InputNumber']
NutOverlay: typeof import('@nutui/nutui-taro')['Overlay']
NutPicker: typeof import('@nutui/nutui-taro')['Picker']
NutPopup: typeof import('@nutui/nutui-taro')['Popup']
NutPrice: typeof import('@nutui/nutui-taro')['Price']
NutSearchbar: typeof import('@nutui/nutui-taro')['Searchbar']
NutSwipe: typeof import('@nutui/nutui-taro')['Swipe']
NutSwiper: typeof import('@nutui/nutui-taro')['Swiper']
NutSwiperItem: typeof import('@nutui/nutui-taro')['SwiperItem']
NutTabPane: typeof import('@nutui/nutui-taro')['TabPane']

View File

@@ -1,9 +1,10 @@
// @ts-nocheck
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {
},
mini: {},
h5: {}
env: {
NODE_ENV: '"development"'
},
defineConstants: {},
mini: {},
h5: {}
}

View File

@@ -1,101 +1,105 @@
import Components from 'unplugin-vue-components/webpack';
import NutUIResolver from '@nutui/nutui-taro/dist/resolver';
// @ts-nocheck
import Components from 'unplugin-vue-components/webpack'
import NutUIResolver from '@nutui/nutui-taro/dist/resolver'
import { join } from 'node:path'
const config = {
projectName: 'taroApp',
date: '2023-8-13',
designWidth (input: { file: string; }) {
if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
return 375
}
return 750
},
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2,
375: 2
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
defineConstants: {
},
copy: {
patterns: [
],
options: {
}
},
framework: 'vue3',
compiler: {
type: 'webpack5',
prebundle: { enable: false }
},
cache: {
enable: false // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
},
sass:{
data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`
},
mini: {
webpackChain(chain) {
chain.plugin('unplugin-vue-components').use(Components({
resolvers: [NutUIResolver({taro: true})]
}))
projectName: 'taroApp',
date: '2023-8-13',
designWidth(input: { file: string; }) {
if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
return 375
}
return 750
},
postcss: {
pxtransform: {
enable: true,
config: {
// selectorBlackList: ['nut-']
}
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
},
h5: {
webpackChain(chain) {
chain.plugin('unplugin-vue-components').use(Components({
resolvers: [NutUIResolver({taro: true})]
}))
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2,
375: 2
},
publicPath: '/',
staticDirectory: 'static',
esnextModules: ['nutui-taro', 'icons-vue-taro'],
postcss: {
autoprefixer: {
enable: true,
config: {
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
defineConstants: {},
copy: {
patterns: [],
options: {}
},
framework: 'vue3',
compiler: {
type: 'webpack5',
prebundle: {enable: false}
},
cache: {
enable: false // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
},
sass: {
data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`
},
alias: {
'@': join(__dirname, '..', 'src')
},
mini: {
webpackChain(chain) {
chain.plugin('unplugin-vue-components').use(Components({
resolvers: [NutUIResolver({taro: true})]
}))
},
miniCssExtractPluginOption: {
//忽略css文件引入顺序
ignoreOrder: true
},
postcss: {
pxtransform: {
enable: true,
config: {
// selectorBlackList: ['nut-']
}
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
},
h5: {
webpackChain(chain) {
chain.plugin('unplugin-vue-components').use(Components({
resolvers: [NutUIResolver({taro: true})]
}))
},
publicPath: '/',
staticDirectory: 'static',
esnextModules: ['nutui-taro', 'icons-vue-taro'],
postcss: {
autoprefixer: {
enable: true,
config: {}
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
}
}
}
}
module.exports = function (merge) {
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'))
}
return merge({}, config, require('./prod'))
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'))
}
return merge({}, config, require('./prod'))
}

View File

@@ -1,37 +1,38 @@
module.exports = {
env: {
NODE_ENV: '"production"'
},
defineConstants: {
},
mini: {},
h5: {
/**
* WebpackChain 插件配置
* @docs https://github.com/neutrinojs/webpack-chain
*/
// webpackChain (chain) {
// /**
// * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
// * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
// */
// chain.plugin('analyzer')
// .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
// @ts-nocheck
// /**
// * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
// * @docs https://github.com/chrisvfritz/prerender-spa-plugin
// */
// const path = require('path')
// const Prerender = require('prerender-spa-plugin')
// const staticDir = path.join(__dirname, '..', 'dist')
// chain
// .plugin('prerender')
// .use(new Prerender({
// staticDir,
// routes: [ '/pages/index/index' ],
// postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
// }))
// }
}
module.exports = {
env: {
NODE_ENV: '"production"'
},
defineConstants: {},
mini: {},
h5: {
/**
* WebpackChain 插件配置
* @docs https://github.com/neutrinojs/webpack-chain
*/
// webpackChain (chain) {
// /**
// * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
// * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
// */
// chain.plugin('analyzer')
// .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
// /**
// * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
// * @docs https://github.com/chrisvfritz/prerender-spa-plugin
// */
// const path = require('path')
// const Prerender = require('prerender-spa-plugin')
// const staticDir = path.join(__dirname, '..', 'dist')
// chain
// .plugin('prerender')
// .use(new Prerender({
// staticDir,
// routes: [ '/pages/index/index' ],
// postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
// }))
// }
}
}

View File

@@ -18,7 +18,7 @@
"build:qq": "taro build --type qq",
"build:jd": "taro build --type jd",
"build:quickapp": "taro build --type quickapp",
"dev:weapp": "taro build --type weapp --watch",
"dev:weapp": "set NODE_ENV=production && taro build --type weapp --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch",
@@ -53,6 +53,7 @@
"@tarojs/shared": "3.6.11",
"@tarojs/taro": "3.6.11",
"pinia": "^2.1.6",
"uqrcodejs": "^4.0.7",
"vue": "^3.2.40"
},
"devDependencies": {
@@ -62,15 +63,15 @@
"@tarojs/webpack5-runner": "3.6.11",
"@types/node": "^18.15.11",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@vue/babel-plugin-jsx": "^1.0.6",
"@vue/compiler-sfc": "^3.2.40",
"babel-preset-taro": "3.6.11",
"css-loader": "3.4.2",
"eslint": "^8.12.0",
"eslint-config-taro": "3.6.11",
"eslint-plugin-vue": "^8.0.0",
"eslint-plugin-vue": "^9.17.0",
"style-loader": "1.3.0",
"stylelint": "9.3.0",
"ts-node": "^10.9.1",

189
pnpm-lock.yaml generated
View File

@@ -59,6 +59,9 @@ dependencies:
pinia:
specifier: ^2.1.6
version: 2.1.6(typescript@4.1.2)(vue@3.2.40)
uqrcodejs:
specifier: ^4.0.7
version: 4.0.7
vue:
specifier: ^3.2.40
version: 3.2.40
@@ -83,11 +86,11 @@ devDependencies:
specifier: ^1.13.6
version: 1.13.6
'@typescript-eslint/eslint-plugin':
specifier: ^5.20.0
version: 5.20.0(@typescript-eslint/parser@5.20.0)(eslint@8.12.0)(typescript@4.1.2)
specifier: ^6.4.0
version: 6.4.0(@typescript-eslint/parser@6.4.0)(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/parser':
specifier: ^5.20.0
version: 5.20.0(eslint@8.12.0)(typescript@4.1.2)
specifier: ^6.4.0
version: 6.4.0(eslint@8.12.0)(typescript@4.1.2)
'@vue/babel-plugin-jsx':
specifier: ^1.0.6
version: 1.0.6(@babel/core@7.8.0)
@@ -107,17 +110,14 @@ devDependencies:
specifier: 3.6.11
version: 3.6.11(@babel/core@7.8.0)(eslint@8.12.0)(typescript@4.1.2)
eslint-plugin-vue:
specifier: ^8.0.0
version: 8.0.0(eslint@8.12.0)
specifier: ^9.17.0
version: 9.17.0(eslint@8.12.0)
style-loader:
specifier: 1.3.0
version: 1.3.0(webpack@5.78.0)
stylelint:
specifier: 9.3.0
version: 9.3.0
taro-plugin-pinia:
specifier: ^1.0.0
version: 1.0.0
ts-node:
specifier: ^10.9.1
version: 10.9.1(@swc/core@1.3.23)(@types/node@18.15.11)(typescript@4.1.2)
@@ -2588,6 +2588,16 @@ packages:
requiresBuild: true
optional: true
/@eslint-community/eslint-utils@4.4.0(eslint@8.12.0):
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
dependencies:
eslint: 8.12.0
eslint-visitor-keys: 3.4.3
dev: true
/@eslint-community/eslint-utils@4.4.0(eslint@8.41.0):
resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -4023,6 +4033,10 @@ packages:
dependencies:
sass: 1.50.0
/@types/semver@7.5.0:
resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==}
dev: true
/@types/send@0.17.1:
resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==}
dependencies:
@@ -4071,28 +4085,30 @@ packages:
'@types/node': 18.15.11
dev: true
/@typescript-eslint/eslint-plugin@5.20.0(@typescript-eslint/parser@5.20.0)(eslint@8.12.0)(typescript@4.1.2):
resolution: {integrity: sha512-fapGzoxilCn3sBtC6NtXZX6+P/Hef7VDbyfGqTTpzYydwhlkevB+0vE0EnmHPVTVSy68GUncyJ/2PcrFBeCo5Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/@typescript-eslint/eslint-plugin@6.4.0(@typescript-eslint/parser@6.4.0)(eslint@8.12.0)(typescript@4.1.2):
resolution: {integrity: sha512-62o2Hmc7Gs3p8SLfbXcipjWAa6qk2wZGChXG2JbBtYpwSRmti/9KHLqfbLs9uDigOexG+3PaQ9G2g3201FWLKg==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
'@typescript-eslint/parser': ^5.0.0
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
'@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha
eslint: ^7.0.0 || ^8.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@typescript-eslint/parser': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/scope-manager': 5.20.0
'@typescript-eslint/type-utils': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/utils': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
'@eslint-community/regexpp': 4.6.2
'@typescript-eslint/parser': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/scope-manager': 6.4.0
'@typescript-eslint/type-utils': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/utils': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/visitor-keys': 6.4.0
debug: 4.3.4
eslint: 8.12.0
functional-red-black-tree: 1.0.1
graphemer: 1.4.0
ignore: 5.2.4
regexpp: 3.2.0
natural-compare: 1.4.0
semver: 7.5.4
tsutils: 3.21.0(typescript@4.1.2)
ts-api-utils: 1.0.1(typescript@4.1.2)
typescript: 4.1.2
transitivePeerDependencies:
- supports-color
@@ -4118,6 +4134,27 @@ packages:
- supports-color
dev: true
/@typescript-eslint/parser@6.4.0(eslint@8.12.0)(typescript@4.1.2):
resolution: {integrity: sha512-I1Ah1irl033uxjxO9Xql7+biL3YD7w9IU8zF+xlzD/YxY6a4b7DYA08PXUUCbm2sEljwJF6ERFy2kTGAGcNilg==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@typescript-eslint/scope-manager': 6.4.0
'@typescript-eslint/types': 6.4.0
'@typescript-eslint/typescript-estree': 6.4.0(typescript@4.1.2)
'@typescript-eslint/visitor-keys': 6.4.0
debug: 4.3.4
eslint: 8.12.0
typescript: 4.1.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/scope-manager@5.20.0:
resolution: {integrity: sha512-h9KtuPZ4D/JuX7rpp1iKg3zOH0WNEa+ZIXwpW/KWmEFDxlA/HSfCMhiyF1HS/drTICjIbpA6OqkAhrP/zkCStg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -4126,20 +4163,29 @@ packages:
'@typescript-eslint/visitor-keys': 5.20.0
dev: true
/@typescript-eslint/type-utils@5.20.0(eslint@8.12.0)(typescript@4.1.2):
resolution: {integrity: sha512-WxNrCwYB3N/m8ceyoGCgbLmuZwupvzN0rE8NBuwnl7APgjv24ZJIjkNzoFBXPRCGzLNkoU/WfanW0exvp/+3Iw==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/@typescript-eslint/scope-manager@6.4.0:
resolution: {integrity: sha512-TUS7vaKkPWDVvl7GDNHFQMsMruD+zhkd3SdVW0d7b+7Zo+bd/hXJQ8nsiUZMi1jloWo6c9qt3B7Sqo+flC1nig==}
engines: {node: ^16.0.0 || >=18.0.0}
dependencies:
'@typescript-eslint/types': 6.4.0
'@typescript-eslint/visitor-keys': 6.4.0
dev: true
/@typescript-eslint/type-utils@6.4.0(eslint@8.12.0)(typescript@4.1.2):
resolution: {integrity: sha512-TvqrUFFyGY0cX3WgDHcdl2/mMCWCDv/0thTtx/ODMY1QhEiyFtv/OlLaNIiYLwRpAxAtOLOY9SUf1H3Q3dlwAg==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: '*'
eslint: ^7.0.0 || ^8.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@typescript-eslint/utils': 5.20.0(eslint@8.12.0)(typescript@4.1.2)
'@typescript-eslint/typescript-estree': 6.4.0(typescript@4.1.2)
'@typescript-eslint/utils': 6.4.0(eslint@8.12.0)(typescript@4.1.2)
debug: 4.3.4
eslint: 8.12.0
tsutils: 3.21.0(typescript@4.1.2)
ts-api-utils: 1.0.1(typescript@4.1.2)
typescript: 4.1.2
transitivePeerDependencies:
- supports-color
@@ -4150,6 +4196,11 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/@typescript-eslint/types@6.4.0:
resolution: {integrity: sha512-+FV9kVFrS7w78YtzkIsNSoYsnOtrYVnKWSTVXoL1761CsCRv5wpDOINgsXpxD67YCLZtVQekDDyaxfjVWUJmmg==}
engines: {node: ^16.0.0 || >=18.0.0}
dev: true
/@typescript-eslint/typescript-estree@5.20.0(typescript@4.1.2):
resolution: {integrity: sha512-36xLjP/+bXusLMrT9fMMYy1KJAGgHhlER2TqpUVDYUQg4w0q/NW/sg4UGAgVwAqb8V4zYg43KMUpM8vV2lve6w==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -4171,19 +4222,41 @@ packages:
- supports-color
dev: true
/@typescript-eslint/utils@5.20.0(eslint@8.12.0)(typescript@4.1.2):
resolution: {integrity: sha512-lHONGJL1LIO12Ujyx8L8xKbwWSkoUKFSO+0wDAqGXiudWB2EO7WEUT+YZLtVbmOmSllAjLb9tpoIPwpRe5Tn6w==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/@typescript-eslint/typescript-estree@6.4.0(typescript@4.1.2):
resolution: {integrity: sha512-iDPJArf/K2sxvjOR6skeUCNgHR/tCQXBsa+ee1/clRKr3olZjZ/dSkXPZjG6YkPtnW6p5D1egeEPMCW6Gn4yLA==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
dependencies:
'@typescript-eslint/types': 6.4.0
'@typescript-eslint/visitor-keys': 6.4.0
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
semver: 7.5.4
ts-api-utils: 1.0.1(typescript@4.1.2)
typescript: 4.1.2
transitivePeerDependencies:
- supports-color
dev: true
/@typescript-eslint/utils@6.4.0(eslint@8.12.0)(typescript@4.1.2):
resolution: {integrity: sha512-BvvwryBQpECPGo8PwF/y/q+yacg8Hn/2XS+DqL/oRsOPK+RPt29h5Ui5dqOKHDlbXrAeHUTnyG3wZA0KTDxRZw==}
engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.12.0)
'@types/json-schema': 7.0.12
'@typescript-eslint/scope-manager': 5.20.0
'@typescript-eslint/types': 5.20.0
'@typescript-eslint/typescript-estree': 5.20.0(typescript@4.1.2)
'@types/semver': 7.5.0
'@typescript-eslint/scope-manager': 6.4.0
'@typescript-eslint/types': 6.4.0
'@typescript-eslint/typescript-estree': 6.4.0(typescript@4.1.2)
eslint: 8.12.0
eslint-scope: 5.1.1
eslint-utils: 3.0.0(eslint@8.12.0)
semver: 7.5.4
transitivePeerDependencies:
- supports-color
- typescript
@@ -4197,6 +4270,14 @@ packages:
eslint-visitor-keys: 3.4.3
dev: true
/@typescript-eslint/visitor-keys@6.4.0:
resolution: {integrity: sha512-yJSfyT+uJm+JRDWYRYdCm2i+pmvXJSMtPR9Cq5/XQs4QIgNoLcoRtDdzsLbLsFM/c6um6ohQkg/MLxWvoIndJA==}
engines: {node: ^16.0.0 || >=18.0.0}
dependencies:
'@typescript-eslint/types': 6.4.0
eslint-visitor-keys: 3.4.3
dev: true
/@vue/babel-helper-vue-transform-on@1.1.5:
resolution: {integrity: sha512-SgUymFpMoAyWeYWLAY+MkCK3QEROsiUnfaw5zxOVD/M64KQs8D/4oK6Q5omVA2hnvEOE0SCkH2TZxs/jnnUj7w==}
dev: true
@@ -7136,17 +7217,20 @@ packages:
- typescript
dev: true
/eslint-plugin-vue@8.0.0(eslint@8.12.0):
resolution: {integrity: sha512-BhS+B4bHFXS4b3bwpfPIJXgvydgvw+2lsM7Ue2AA8BscBjCFT+PbsTAGqpOnc+k28AsM6S8oplqgu/R/5ISeag==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/eslint-plugin-vue@9.17.0(eslint@8.12.0):
resolution: {integrity: sha512-r7Bp79pxQk9I5XDP0k2dpUC7Ots3OSWgvGZNu3BxmKK6Zg7NgVtcOB6OCna5Kb9oQwJPl5hq183WD0SY5tZtIQ==}
engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: ^6.2.0 || ^7.0.0 || ^8.0.0
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.12.0)
eslint: 8.12.0
eslint-utils: 3.0.0(eslint@8.12.0)
natural-compare: 1.4.0
nth-check: 2.1.1
postcss-selector-parser: 6.0.13
semver: 7.5.4
vue-eslint-parser: 8.3.0(eslint@8.12.0)
vue-eslint-parser: 9.3.1(eslint@8.12.0)
xml-name-validator: 4.0.0
transitivePeerDependencies:
- supports-color
dev: true
@@ -13149,10 +13233,6 @@ packages:
postcss-value-parser: 3.3.1
dev: true
/taro-plugin-pinia@1.0.0:
resolution: {integrity: sha512-Ip2LTRh7NGsFyEzkZWvU115xDqV3D8cRRbqqw0JKTvzHFBzpwycmrUVQQxV61AMg0r2RJm3mcEbQ997j7xNjtg==}
dev: true
/terser-webpack-plugin@5.3.9(@swc/core@1.3.23)(esbuild@0.14.54)(webpack@5.78.0):
resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==}
engines: {node: '>= 10.13.0'}
@@ -13348,6 +13428,15 @@ packages:
resolution: {integrity: sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==}
dev: true
/ts-api-utils@1.0.1(typescript@4.1.2):
resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==}
engines: {node: '>=16.13.0'}
peerDependencies:
typescript: '>=4.2.0'
dependencies:
typescript: 4.1.2
dev: true
/ts-node@10.9.1(@swc/core@1.3.23)(@types/node@18.15.11)(typescript@4.1.2):
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true
@@ -13720,6 +13809,10 @@ packages:
tslib: 2.6.1
dev: false
/uqrcodejs@4.0.7:
resolution: {integrity: sha512-84+aZmD2godCVI+93lxE3YUAPNY8zAJvNA7xRS7R7U+q57KzMDepBSfNCwoRUhWOfR6eHFoAOcHRPwsP6ka1cA==}
dev: false
/uri-js@4.4.1:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
dependencies:
@@ -13898,9 +13991,9 @@ packages:
vue: 3.2.40
dev: false
/vue-eslint-parser@8.3.0(eslint@8.12.0):
resolution: {integrity: sha512-dzHGG3+sYwSf6zFBa0Gi9ZDshD7+ad14DGOdTLjruRVgZXe2J+DcZ9iUhyR48z5g1PqRa20yt3Njna/veLJL/g==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/vue-eslint-parser@9.3.1(eslint@8.12.0):
resolution: {integrity: sha512-Clr85iD2XFZ3lJ52/ppmUDG/spxQu6+MAeHXjjyI4I1NUYZ9xmenQp4N0oaHJhrA8OOxltCVxMRfANGa70vU0g==}
engines: {node: ^14.17.0 || >=16.0.0}
peerDependencies:
eslint: '>=6.0.0'
dependencies:

4
src/api/admin.ts Normal file
View File

@@ -0,0 +1,4 @@
import request from '../utils/request';
// 订单核销
export const orderVerify = (data: object) => request('/user/cancelPointOrder', data, 'POST');

View File

@@ -0,0 +1,19 @@
import request from '@/utils/request'
// 获取商品列表
export const getGoodsList = () => request('/point/goods', {}, 'POST')
// 添加购物车
export const addCart = (data: object) => request('/user/addCart', data, 'POST')
// 获取购物车列表
export const getCartList = () => request('/user/cart', {}, 'POST')
// 获取积分商品详情
export const getGoodsDetail = (data: object) => request('/point/details', data, 'POST')
// 积分商品下单
export const createOrder = (data: object) => request('/point/place', data, 'POST')
// 确认付款
export const payJfOrder = (data: object) => request('/point/confirmOrder', data, 'POST')

View File

@@ -0,0 +1,4 @@
import request from '@/utils/request'
// 订单支付
export const payOrder = (data: object) => request('/order/place', data, 'POST')

View File

@@ -1,4 +1,4 @@
import { request } from "../utils/request";
import request from "@/utils/request";
// 登录
export const login = (data: object) => request("/login", data, "POST");
@@ -6,5 +6,20 @@ export const login = (data: object) => request("/login", data, "POST");
// 获取用户信息
export const getUserInfo = () => request("/user/detail", {}, "GET");
// 支付订单
export const payOrder = (data: object) => request("/order/place", data, "POST");
// 获取短信验证码
export const getVerifyCode = (data: object) => request("/getSmsCode", data, "POST");
// 商家入驻申请
export const applyMer = (data: object) => request("/store/settle", data, "POST");
// 获取商家类型列表
export const getMerTypeList = () => request("/store/getOther", {},"POST");
// 获取个人信息
export const getPersonalInfo = () => request("/user/info", {}, "POST");
// 获取轮播图
export const getBanner = () => request("/rotation", {}, "POST");
// 获取积分订单列表
export const getIntegralOrderList = (data: object) => request("/user/pointOrder", data, "POST");

View File

@@ -1,78 +1,86 @@
export default defineAppConfig({
pages: [
"pages/index/index",
"pages/category/index",
"pages/cart/index",
"pages/user/index",
'pages/index/index',
'pages/category/index',
'pages/cart/index',
'pages/user/index',
],
subPackages: [
{
root: "pages/users",
root: 'pages/users',
pages: [
"order_list/index",
"setting/index",
"user_setting/index",
"settled_mer/index",
"order_list_detail/index",
],
'order_list/index',
'setting/index',
'user_setting/index',
'settled_mer/index',
'order_list_detail/index',
'account/index'
]
},
{
root: "pages/goods",
root: 'pages/goods',
pages: [
"goods_detail/index",
"order_create/index",
"order_status/index",
],
'goods_detail/index',
'order_create/index',
'order_status/index'
]
},
{
root: "pages/admin",
pages: ["verify/index"],
root: 'pages/admin',
pages: ['verify/index']
},
{
root: 'pages/game',
pages: [
'gamehome/index',
'gamedetail/index',
]
}
],
window: {
backgroundTextStyle: "light",
navigationBarBackgroundColor: "#fff",
navigationBarTitleText: "WeChat",
navigationBarTextStyle: "black",
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
},
tabBar: {
color: "#666666",
selectedColor: "#ff0000",
backgroundColor: "#ffffff",
borderStyle: "white",
color: '#666666',
selectedColor: '#ff0000',
backgroundColor: '#ffffff',
borderStyle: 'white',
list: [
{
pagePath: "pages/index/index",
iconPath: "static/tabbar/1-001.png",
selectedIconPath: "static/tabbar/1-002.png",
text: "首页",
pagePath: 'pages/index/index',
iconPath: 'static/tabbar/1-001.png',
selectedIconPath: 'static/tabbar/1-002.png',
text: '首页'
},
{
pagePath: "pages/category/index",
iconPath: "static/tabbar/2-001.png",
selectedIconPath: "static/tabbar/2-002.png",
text: "分类",
pagePath: 'pages/category/index',
iconPath: 'static/tabbar/2-001.png',
selectedIconPath: 'static/tabbar/2-002.png',
text: '分类'
},
{
pagePath: "pages/cart/index",
iconPath: "static/tabbar/3-001.png",
selectedIconPath: "static/tabbar/3-002.png",
text: "购物车",
pagePath: 'pages/cart/index',
iconPath: 'static/tabbar/3-001.png',
selectedIconPath: 'static/tabbar/3-002.png',
text: '购物车'
},
{
pagePath: "pages/user/index",
iconPath: "static/tabbar/4-001.png",
selectedIconPath: "static/tabbar/4-002.png",
text: "我的",
},
],
pagePath: 'pages/user/index',
iconPath: 'static/tabbar/4-001.png',
selectedIconPath: 'static/tabbar/4-002.png',
text: '我的'
}
]
},
permission: {
"scope.userLocation": {
desc: "你的位置信息将用于小程序位置接口的效果展示",
},
'scope.userLocation': {
desc: '你的位置信息将用于小程序位置接口的效果展示'
}
},
requiredBackgroundModes: ["audio", "location"],
requiredBackgroundModes: ['audio', 'location'],
// @ts-ignore
requiredPrivateInfos: ["getLocation"],
});
requiredPrivateInfos: ['getLocation']
})

View File

@@ -14,6 +14,7 @@
page {
font-family: AlibabaPuHuiTi-3-55-Regular, serif;
background-color: #f5f5f5;
}
.app {

View File

@@ -3,7 +3,8 @@
<view class="text">
<view>授权提醒</view>
<view style="margin-top: 10px"
>请授权头像信息以便为您提供更好的服务</view
>请授权头像信息以便为您提供更好的服务
</view
>
<view class="bom">
<view class="btn b" @click="onCancel">随便逛逛</view>
@@ -15,45 +16,53 @@
<script setup lang="ts">
// import { computed, ref } from "vue";
import Taro from "@tarojs/taro";
import { login } from "../api/user";
import Taro from '@tarojs/taro'
import {login} from '@/api/user'
defineProps({
visible: {
type: Boolean,
default: false,
},
});
default: false
}
})
const emit = defineEmits(["update:visible", "update:info"]);
const emit = defineEmits(['update:visible', 'ok'])
const onCancel = () => {
emit("update:visible", false);
};
emit('update:visible', false)
}
const onOk = () => {
Taro.getUserProfile({
desc: "用于完善会员资料",
desc: '完善用户资料',
success: async (user) => {
console.log(user);
Taro.login({
success: async ({ code }) => {
const { data }: any = await login({
code: code,
});
Taro.setStorageSync("token", data.token);
emit("update:visible", false);
success: async ({code}) => {
try {
const {data}: any = await login({
code: code,
nickName: user.userInfo.nickName,
avatarUrl: user.userInfo.avatarUrl
})
Taro.setStorageSync('token', data.token)
emit('ok', false)
} catch (error) {
Taro.showToast({
title: error.message,
icon: 'none'
})
}
},
fail: (err) => {
console.log(err);
},
});
console.log(err)
}
})
},
fail: (err) => {
console.log(err);
},
});
};
console.log(err)
}
})
}
</script>
<style lang="scss">
@@ -71,6 +80,7 @@ const onOk = () => {
justify-content: space-evenly;
align-items: center;
margin-top: 20px;
.btn {
width: 150px;
padding: 10px;

View File

@@ -1,124 +1,134 @@
<template>
<nut-popup
position="bottom"
closeable
round
safe-area-inset-bottom
:close-on-click-overlay="false"
:style="{ height: 'auto' }"
v-model:visible="isShowPay"
@click-close-icon="closePay"
>
<view class="div">
<view style="text-align: center">支付方式</view>
<nut-cell-group>
<nut-cell
v-if="payType === 'wx'"
title="微信支付"
desc="使用微信快捷支付"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<nut-cell
v-if="payType === 'jf'"
title="积分支付"
desc="剩余积分:18888"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
<nut-popup
position="bottom"
closeable
round
safe-area-inset-bottom
:close-on-click-overlay="false"
:style="{ height: 'auto' }"
v-model:visible="isShowPay"
@click-close-icon="closePay"
>
<view class="div">
<view style="text-align: center">支付方式</view>
<nut-cell-group>
<nut-cell
v-if="payType === 'wx'"
title="微信支付"
desc="使用微信快捷支付"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<nut-cell
v-if="payType === 'jf'"
title="积分支付"
desc="剩余积分:18888"
is-link
@click="goPay()"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
</template>
<script setup lang="ts">
import {IconFont} from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import {payOrder} from "../api/user";
import {IconFont} from '@nutui/icons-vue-taro'
import Taro from '@tarojs/taro'
import {payOrder} from '@/api/order'
import {payJfOrder} from '@/api/goods'
const prop = defineProps({
isShowPay: {
required: true,
type: Boolean,
default: false,
},
payType: {
required: true,
type: String,
default: "wx",
},
});
isShowPay: {
required: true,
type: Boolean,
default: false
},
payType: {
required: true,
type: String,
default: 'wx'
},
jfInfo: {
type: Object,
default: () => {
return {}
}
}
})
const emit = defineEmits(["errPay", "closePay"]);
const emit = defineEmits(['closePay'])
const goPay = async () => {
if (prop.payType === "wx") {
const {data} = await payOrder({gid: 1, token: Taro.getStorageSync("token")});
console.log(data);
// Taro.request({
// url: "http://192.168.2.3:9000/app/order/place",
// method: "POST",
// data: {
// gid: 1,
// token: Taro.getStorageSync("token"),
// },
// success: function ({data}) {
// console.log(data);
// Taro.requestPayment({
// timeStamp: data.data.data.timeStamp,
// nonceStr: data.data.data.nonceStr,
// package: data.data.data.package,
// signType: "MD5",
// paySign: data.data.data.paySign,
// success: function (res) {
// console.log(res);
// },
// fail: function (res) {
// console.log("1111", res);
// emit("errPay", false);
// },
// });
// },
// fail: function (res) {
// console.log("1111", res);
// emit("errPay", false);
// },
// });
if (prop.payType === 'wx') {
try {
const {data} = await payOrder({gid: 1, token: Taro.getStorageSync('token')})
Taro.requestPayment({
timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr,
package: data.data.package,
signType: data.data.signType,
paySign: data.data.paySign,
success: function (res) {
console.log(res)
},
fail: function (res) {
console.log(res)
}
})
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
};
} else {
if (!prop.jfInfo) return Taro.showToast({
title: '未获取到订单信息',
icon: 'none'
})
console.log(prop.jfInfo)
const res = await payJfOrder(prop.jfInfo)
Taro.showToast({
title: res.msg,
icon: 'success',
duration: 2000
})
}
emit('closePay', false)
}
const closePay = () => {
emit("closePay", false);
};
emit('closePay', false)
}
</script>
<style lang="scss">
.nut-popup {
.nut-popup__container {
border-radius: 10px;
}
.nut-popup__container {
border-radius: 10px;
}
}
.div {
padding: 20px;
// text-align: center;
padding: 20px;
// text-align: center;
.nut-cell {
align-items: center;
}
.nut-cell {
align-items: center;
}
}
</style>

View File

@@ -10,29 +10,43 @@
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { orderVerify } from "@/api/admin";
// url参数转对象
const urlParse = (url: string) => {
const obj: any = {};
const reg = /[?&][^?&]+=[^?&]+/g;
const arr = url.match(reg);
if (arr) {
arr.forEach((item) => {
const tempArr = item.substring(1).split("=");
const key = decodeURIComponent(tempArr[0]);
const val = decodeURIComponent(tempArr[1]);
obj[key] = val;
});
}
return obj;
};
// const urlParse = (url: string) => {
// const obj: any = {};
// const reg = /[?&][^?&]+=[^?&]+/g;
// const arr = url.match(reg);
// if (arr) {
// arr.forEach((item) => {
// const tempArr = item.substring(1).split("=");
// const key = decodeURIComponent(tempArr[0]);
// const val = decodeURIComponent(tempArr[1]);
// obj[key] = val;
// });
// }
// return obj;
// };
const scanCode = () => {
Taro.scanCode({
onlyFromCamera: true,
scanType: ["qrCode"],
success: (res) => {
console.log(urlParse(res.result));
success: async (res) => {
try {
const data = await orderVerify({
oid: res.result,
});
Taro.showToast({
title: data.msg,
icon: "none",
});
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
},
});
};
@@ -41,7 +55,7 @@ const scanCode = () => {
<style lang="scss">
page {
background-color: #f5f5f5;
background-image: url("../../../static/admin/cancellation-header.png");
background-image: url("~@/static/admin/cancellation-header.png");
background-repeat: no-repeat;
background-size: 100% 30%;
}

View File

@@ -1,30 +1,111 @@
<template>
<view>
<nut-empty description="购物车暂无数据">
<!-- <nut-button icon="refresh" type="primary" @click="toPage()">去兑换商品</nut-button>-->
<view v-if="list.length > 0">
<nut-swipe v-for="(item,index) in list" :key="index">
<view class="item">
<nut-checkbox v-model="item.checkbox" @click="select">{{ item.ID }}</nut-checkbox>
<image src="https://s2.loli.net/2023/08/16/6KgdSQa4WRoT3sz.jpg"
style="width: 100px;height: 100px"/>
<view class="text">
<view>{{ item.name }}</view>
<view class="bom">
<nut-price :price="item.number" size="normal" :need-symbol="false"/>
<nut-input-number readonly @add="select()" @reduce="select()"
v-model="item.count"/>
</view>
</view>
</view>
<template #right>
<nut-button shape="square" style="height:100%" type="danger">删除</nut-button>
</template>
</nut-swipe>
</view>
<nut-empty v-else description="购物车暂无数据">
<!-- <nut-button icon="refresh" type="primary" @click="toPage()">去兑换商品</nut-button>-->
</nut-empty>
<view>
<view style="height: 100px"></view>
</view>
<view class="bottom-box">
<view class="left">
<nut-checkbox v-model="checkbox">全选</nut-checkbox>
<nut-checkbox v-model="selectAllVal" @change="selectAll">全选</nut-checkbox>
<view class="text-box">
总计积分
<nut-price :price="0" size="normal" :need-symbol="false"/>
<nut-price v-model:price="localCount" size="normal" :need-symbol="false"/>
</view>
</view>
<nut-button type="primary">去结算</nut-button>
<nut-button type="primary" @click="sub">去结算</nut-button>
</view>
</view>
</template>
<script lang="ts" setup>
import {ref} from 'vue';
import {ref} from 'vue'
import Taro from '@tarojs/taro'
import {getCartList} from '@/api/goods'
const checkbox = ref(false)
const selectAllVal = ref(false)
const list = ref([])
const localCount = ref(0)
Taro.useDidShow(() => {
getList()
})
const select = () => {
localCount.value = 0
list.value.forEach((item: any) => {
if (item.checkbox) {
setTimeout(() => {
item.countNum = Number(item.number) * Number(item.count)
localCount.value += item.countNum
console.log(localCount.value)
}, 1)
selectAllVal.value = true
} else {
selectAllVal.value = false
}
})
}
const selectAll = () => {
localCount.value = 0
list.value.forEach((item: any) => {
item.checkbox = selectAllVal.value
})
select()
console.log(list.value)
}
const sub = () => {
const arr = list.value.filter((item: any) => item.checkbox)
if (arr.length === 0) {
Taro.showToast({
title: '请选择商品',
icon: 'none'
})
return
}
Taro.navigateTo({
url: '/pages/goods/order_create/index'
})
}
const getList = async () => {
const res = await getCartList()
list.value = res.data.data.Goods.map((item: any) => {
return {
...item,
count: 1,
countNum: item.number,
checkbox: false
}
})
}
const toPage = () => {
Taro.switchTab({
@@ -41,6 +122,37 @@ const toPage = () => {
text-align: center;
}
.item {
margin-top: 10px;
padding: 20px;
background-color: white;
display: flex;
justify-items: center;
justify-content: space-between;
width: 100%;
box-sizing: border-box;
image {
width: 200px;
height: 150px;
}
.text {
width: 60%;
margin-left: 20px;
display: flex;
flex-direction: column;
padding: 20px;
justify-content: space-between;
.bom {
display: flex;
justify-content: space-between;
align-items: center;
}
}
}
.bottom-box {
box-sizing: border-box;
background-color: #fff;

View File

@@ -1,13 +1,36 @@
<template>
<nut-tabs style="height:100vh" v-model="val" title-scroll name="tab4value" direction="vertical">
<nut-tab-pane v-for="item in 10" :title="'Tab '+ item"> Tab {{ item }}</nut-tab-pane>
</nut-tabs>
<nut-tabs style="height:100vh" v-model="val" title-scroll name="tab4value" direction="vertical">
<nut-tab-pane v-for="item in list" :title="(item.name as string)"> Tab {{ item.name }}</nut-tab-pane>
</nut-tabs>
</template>
<script lang="ts" setup>
import {ref, onMounted} from 'vue';
import Taro from '@tarojs/taro'
import {ref} from 'vue'
import {getMerTypeList} from '@/api/user'
const val = ref('0');
const val = ref('0')
interface List {
ID?: number
name?: string
}
const list = ref<Array<List>>([])
Taro.useLoad(() => {
getGoodsType()
console.log('load')
})
Taro.useDidShow(() => {
})
// 获取商品分类
const getGoodsType = async () => {
const res = await getMerTypeList()
list.value = res.data.class
}
</script>

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: "游戏详情",
navigationStyle: "custom",
});

View File

@@ -0,0 +1,117 @@
<template>
<view>
<view class="head-wrapper" :style="'top:' + statusHeight + 'px'">
<view class="head-menu">
<Left class="iconfont" @click="returns" />
<Home class="iconfont" @click="goHome" />
</view>
</view>
<!-- <swiper class="swiper" :autoplay="true" :circular="true">
<swiper-item v-for="(item, index) in swiperList" :key="index">
<image style="width: 100%" :src="item"></image>
</swiper-item>
</swiper> -->
<view class="box">
<view class="line"></view>
<view class="game-title"></view>
<view class="game-title"></view>
<view class="game-title"></view>
<view class="game-btn" @click="toGame()">开始游戏</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import {
useLoad,
getSystemInfoSync,
navigateBack,
switchTab,
navigateTo,
} from "@tarojs/taro";
import { Left, Home } from "@nutui/icons-vue-taro";
var statusBarHeight = (getSystemInfoSync().statusBarHeight as number) - 7;
const statusHeight = ref<number>(statusBarHeight);
const swiperList = ref([]);
useLoad(() => {});
const returns = () => {
navigateBack();
};
const goHome = () => {
switchTab({
url: "/pages/index/index",
});
};
const toGame = () => {
navigateTo({
url: "/pages/game/gamehome/index",
});
};
</script>
<style lang="scss">
.head-wrapper {
z-index: 999;
display: flex;
align-items: center;
position: fixed;
left: 30px;
top: 0;
height: 100px;
}
.head-menu {
display: flex;
align-items: center;
height: 54px;
width: 140px;
background: rgba(0, 0, 0, 0.25);
border-radius: 27px;
.iconfont {
flex: 1;
text-align: center;
color: #fff;
box-sizing: border-box;
&.icon-xiangzuo {
border-right: 1px solid #fff;
}
}
}
.box {
width: 100%;
height: 90vh;
background-color: #fff;
z-index: 1;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
box-sizing: border-box;
position: absolute;
padding: 20px;
top: 400px;
.line {
width: 90px;
height: 10px;
border-radius: 4px;
background-color: rgba(202, 202, 202, 1);
margin: auto;
}
.game-btn {
width: 300px;
height: 75px;
margin: 50px auto;
color: #fff;
background-color: rgba(85, 77, 132, 1);
border-radius: 50px;
text-align: center;
line-height: 75px;
}
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "活动游戏",
});

View File

@@ -0,0 +1,67 @@
<template>
<view>
<view
v-for="item in listVal"
:key="item.id"
class="list-box"
:class="{ listBoxAnim: item.status }"
@click="toDetails(item.id)"
>
<view>摇骰子</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { useLoad, navigateTo } from "@tarojs/taro";
const listVal = ref<any>([]);
useLoad(() => {
getList();
});
const getList = () => {
for (let i = 0; i < 1; i++) {
setTimeout(() => {
listVal.value.push({
id: i,
status: true,
});
}, 50 * i);
}
};
const toDetails = (id: string) => {
navigateTo({
url: "/pages/game/gamedetail/index?id=" + id,
});
};
</script>
<style lang="scss">
.list-box {
background-color: #fff;
border-radius: 15rpx;
width: 630rpx;
height: 200rpx;
margin: 20rpx auto;
padding: 30rpx;
font-size: 45rpx;
}
.listBoxAnim {
animation: 0.5s leftAnim;
}
@keyframes leftAnim {
from {
transform: translateX(110%);
}
to {
transform: translateX(0);
}
}
</style>

View File

@@ -1,293 +1,405 @@
<template>
<view class="app">
<view class="head-wrapper" :style="'top:' + BarHeight + 'px'">
<view class="head-menu">
<Left class="iconfont" @click="returns" />
<Home class="iconfont" @click="goHome" />
</view>
</view>
<!-- 幻灯片 -->
<nut-swiper
:init-page="0"
:pagination-visible="true"
pagination-color="#426543"
auto-play="3000"
>
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img :src="itm.url" :alt="itm.id.toString()" />
</nut-swiper-item>
</nut-swiper>
<!-- 标题价格 -->
<view class="card">
<view>
<nut-price
size="large"
:price="8888"
position="after"
symbol="积分"
/>
</view>
<view class="title"
>MIUCHO可爱卡通学生通勤手提电脑包13.3寸14村女适用苹果联想小米</view
>
</view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
<!-- 产品介绍 -->
<view class="rich-box">
<view class="title">产品介绍</view>
<view></view>
<nut-empty description="暂无产品介绍"></nut-empty>
</view>
<!-- 底部 -->
<view class="bottom-box">
<view class="left">
<view class="icon" @click="toPage('/pages/index/index')">
<Home />
<view>首页</view>
</view>
<view class="icon" @click="toPage('/pages/cart/index')">
<Cart />
<view>购物车</view>
</view>
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
<My />
<view>客服</view>
</view>
</view>
<!-- 占位 -->
<view style="height: 155px"></view>
<view>
<nut-button
style="margin-right: 10px"
type="warning"
@click="addCart()"
>加入购物车</nut-button
>
<nut-button type="primary" @click="toOrderDetail()"
>立即兑换</nut-button
>
</view>
</view>
<!-- 规格选择 -->
<nut-popup
position="bottom"
overlay-class="overlay"
safe-area-inset-bottom
closeable
round
:style="{ height: '45%', zIndex: 1 }"
v-model:visible="isSkuShow"
></nut-popup>
<!-- <nut-sku
v-model:visible="isSkuShow"
:sku="sku"
:goods="goods"
@selectSku="selectSku"
@clickBtnOperate="clickBtnOperate"
@close="close"
></nut-sku> -->
<view class="app">
<view class="head-wrapper" :style="'top:' + BarHeight + 'px'">
<view class="head-menu">
<Left class="iconfont" @click="returns"/>
<Home class="iconfont" @click="goHome"/>
</view>
</view>
<!-- 幻灯片 -->
<nut-swiper
:init-page="0"
:pagination-visible="true"
pagination-color="#426543"
auto-play="3000"
>
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img :src="itm.url" :alt="itm.id.toString()"/>
</nut-swiper-item>
</nut-swiper>
<!-- 标题价格 -->
<view class="card">
<view>
<nut-price
size="large"
:price="goodInfo.number as number"
position="after"
symbol="积分"
/>
</view>
<view class="title"
>{{ goodInfo.name }}
</view
>
</view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
<!-- 产品介绍 -->
<view class="rich-box">
<view class="title">产品介绍</view>
<view v-if="goodInfo.details" v-html="goodInfo.details"></view>
<nut-empty v-else description="暂无产品介绍"></nut-empty>
</view>
<!-- 底部 -->
<view class="bottom-box">
<view class="left">
<view class="icon" @click="toPage('/pages/index/index')">
<Home/>
<view>首页</view>
</view>
<view class="icon" @click="toPage('/pages/cart/index')">
<Cart/>
<view>购物车</view>
</view>
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
<My/>
<view>客服</view>
</view>
</view>
<!-- 占位 -->
<view style="height: 155px"></view>
<view>
<nut-button
style="margin-right: 10px"
type="warning"
@click="add_cart()"
>加入购物车
</nut-button
>
<nut-button type="primary" @click="toOrderDetail()"
>立即兑换
</nut-button
>
</view>
</view>
<!-- 规格选择 -->
<nut-popup
position="bottom"
overlay-class="overlay"
safe-area-inset-bottom
closeable
round
:style="{zIndex: 1 }"
v-model:visible="isSkuShow"
>
<view class="sku-box">
<view>商品规格</view>
<nut-cell-group>
<nut-cell title="数量:">
<template v-slot:link>
<nut-input-number v-model="count" @change="addCount"/>
</template>
</nut-cell>
</nut-cell-group>
</view>
</nut-popup>
<!-- <nut-sku
v-model:visible="isSkuShow"
:sku="sku"
:goods="goods"
@selectSku="selectSku"
@clickBtnOperate="clickBtnOperate"
@close="close"
></nut-sku> -->
<Pay :is-show-pay="isShowPay" pay-type="jf" :jfInfo="orderData" @closePay="closePay"/>
</view>
</template>
<script setup lang="ts">
var statusBarHeight = Taro.getSystemInfoSync().statusBarHeight;
import { ref } from "vue";
import Taro from "@tarojs/taro";
import { Left, Home, Cart, My } from "@nutui/icons-vue-taro";
var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight
import {ref} from 'vue'
import Taro from '@tarojs/taro'
import {Left, Home, Cart, My} from '@nutui/icons-vue-taro'
import {getGoodsDetail, addCart, createOrder, payOrder} from '@/api/goods'
import Pay from '@/components/Pay.vue'
const BarHeight = ref((statusBarHeight as number) + 7);
const BarHeight = ref((statusBarHeight as number) + 7)
const swiperList = ref([
{
id: 1,
url: "https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg",
},
{
id: 2,
url: "https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg",
},
{
id: 3,
url: "https://storage.360buyimg.com/jdc-article/welcomenutui.jpg",
},
{
id: 4,
url: "https://storage.360buyimg.com/jdc-article/fristfabu.jpg",
},
]);
{
id: 1,
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg'
},
{
id: 2,
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg'
},
{
id: 3,
url: 'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg'
},
{
id: 4,
url: 'https://storage.360buyimg.com/jdc-article/fristfabu.jpg'
}
])
const isSkuShow = ref(false);
const isSkuShow = ref(false)
const sku = ref([]);
const isShowPay = ref(false)
const goods = ref({});
const sku = ref([])
const orderData = ref([])
const count = ref(1)
interface GoodInfo {
gid?: number
name?: string
number?: number
cover?: string
details?: string
sku?: any[]
stock?: number
}
const goodInfo = ref<GoodInfo>({})
Taro.useLoad((options) => {
get_good_detail(options.gid)
})
const get_good_detail = async (gid: string) => {
try {
const res = await getGoodsDetail({gid: Number(gid)})
goodInfo.value = res.data.data
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
}
const addCount = () => {
if (count.value >= (goodInfo.value.stock as number)) {
count.value = goodInfo.value.stock as number
Taro.showToast({
title: '库存不足',
icon: 'none'
})
return
}
}
const returns = () => {
Taro.navigateBack({
delta: 1,
});
};
Taro.navigateBack({
delta: 1
})
}
const goHome = () => {
Taro.switchTab({
url: "/pages/index/index",
});
};
Taro.switchTab({
url: '/pages/index/index'
})
}
const openSku = () => {
isSkuShow.value = true;
};
isSkuShow.value = true
}
const selectSku = () => {};
const clickBtnOperate = () => {};
const close = () => {};
const addCart = () => {
if (isSkuShow.value === false) return openSku();
const selectSku = () => {
}
const clickBtnOperate = () => {
}
const close = () => {
}
const add_cart = async () => {
if (isSkuShow.value === false) return openSku()
try {
await addCart({gid: Number(goodInfo.value.gid)})
Taro.showToast({
title: "加入购物车成功",
icon: "none",
});
isSkuShow.value = false;
};
title: '加入购物车成功',
icon: 'success',
duration: 2000
})
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
isSkuShow.value = false
}
const toOrderDetail = () => {
if (isSkuShow.value === false) return openSku();
Taro.navigateTo({
url: "/pages/goods/order_create/index",
});
isSkuShow.value = false;
};
const toOrderDetail = async () => {
if (isSkuShow.value === false) return openSku()
// Taro.navigateTo({
// url: '/pages/goods/order_create/index'
// })
try {
const {data} = await createOrder([
{
gid: Number(goodInfo.value.gid),
count: Number(count.value)
}
])
// 删除不必要的字段
// orderData.value = data.data.map((item: any) => {
// delete item.ID
// delete item.uid
// delete item.status
// delete item.add_time
// delete item.expires
// return item
// })
orderData.value = data.data
isShowPay.value = true
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
isSkuShow.value = false
}
const closePay = (val: boolean) => {
isShowPay.value = val
orderData.value = []
}
const toPage = (url: string, type: number = 1) => {
if (type === 1) {
Taro.switchTab({
url: url,
});
} else {
// Taro.navigateTo({
// url: url,
// });
Taro.showToast({
title: "暂未开放",
icon: "none",
});
}
};
if (type === 1) {
Taro.switchTab({
url: url
})
} else {
// Taro.navigateTo({
// url: url,
// });
Taro.showToast({
title: '暂未开放',
icon: 'none'
})
}
}
</script>
<style lang="scss">
// sku遮罩
.overlay {
background-color: rgba(0, 0, 0, 0.5);
z-index: 1 !important;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1 !important;
}
.head-wrapper {
z-index: 999;
display: flex;
align-items: center;
position: fixed;
left: 30rpx;
top: 0;
/* #ifdef MP */
// height: 43px;
/* #endif */
/* #ifdef H5 */
height: 114rpx;
/* #endif */
z-index: 999;
display: flex;
align-items: center;
position: fixed;
left: 30px;
top: 0;
/* #ifdef MP */
// height: 43px;
/* #endif */
/* #ifdef H5 */
height: 114px;
/* #endif */
}
.head-menu {
display: flex;
align-items: center;
height: 54rpx;
width: 140rpx;
background: rgba(0, 0, 0, 0.25);
border-radius: 27rpx;
.iconfont {
flex: 1;
text-align: center;
color: #fff;
box-sizing: border-box;
}
display: flex;
align-items: center;
height: 54px;
width: 140px;
background: rgba(0, 0, 0, 0.25);
border-radius: 27px;
.iconfont {
flex: 1;
text-align: center;
color: #fff;
box-sizing: border-box;
}
}
.nut-swiper-item img {
width: 100%;
height: 450px;
width: 100%;
height: 450px;
}
.card {
padding: 30px;
background-color: #fff;
padding: 30px;
background-color: #fff;
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
}
.rich-box {
background-color: #fff;
margin-top: 20px;
width: 100vw;
box-sizing: border-box;
text-align: center;
padding: 15px 0;
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
background-color: #fff;
margin-top: 20px;
width: 100vw;
box-sizing: border-box;
text-align: center;
padding: 15px 0;
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
}
.nut-sku {
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.sku-box {
padding: 100px 50px;
}
.bottom-box {
border-top: 1px solid #e5e5e585;
position: fixed;
bottom: 0;
height: 5.5vh;
background: #fff;
border-top: 1px solid #e5e5e585;
position: fixed;
bottom: 0;
height: 5.5vh;
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
.left {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
.left {
display: flex;
align-items: center;
justify-content: space-between;
width: 300px;
padding: 0 20px;
box-sizing: border-box;
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
}
}
justify-content: space-between;
width: 300px;
padding: 0 20px;
box-sizing: border-box;
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
}
}
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
}
}
</style>

View File

@@ -56,7 +56,7 @@
<script setup lang="ts">
import { Find } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import { calculateDistance } from "../../../utils";
import { calculateDistance } from "@/utils";
import { ref } from "vue";
const distance = ref("");

View File

@@ -1,225 +1,259 @@
<template>
<view class="app">
<!-- 搜索 -->
<nut-searchbar
v-model="searchValue"
placeholder="要搜索点什么?"
></nut-searchbar>
<!-- 幻灯片 -->
<nut-swiper
:init-page="0"
:pagination-visible="true"
pagination-color="#426543"
auto-play="3000"
<view class="app">
<!-- 搜索 -->
<nut-searchbar
v-model="searchValue"
placeholder="要搜索点什么?"
></nut-searchbar>
<!-- 幻灯片 -->
<nut-swiper
:init-page="0"
:pagination-visible="true"
pagination-color="#426543"
auto-play="3000"
>
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img :src="itm.url" :alt="itm.id.toString()"/>
</nut-swiper-item>
</nut-swiper>
<!-- 金刚区 -->
<view class="navbar">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
v-for="item in userMenuList"
:key="item.id"
:text="item.label"
@click="toPage(item.url)"
>
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img :src="itm.url" :alt="itm.id.toString()" />
</nut-swiper-item>
</nut-swiper>
<!-- 金刚区 -->
<view class="navbar">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
v-for="item in userMenuList"
:key="item.id"
:text="item.label"
@click="toPage(item.url)"
>
<image :src="item.icon" />
</nut-grid-item>
</nut-grid>
</view>
<!-- 标题 -->
<view class="titleImg">为你推荐</view>
<!-- 商品列表 -->
<view class="goodBox">
<view
class="good"
v-for="item in 5"
:key="item"
@click.stop="toGoodDetails(item)"
>
<image
src="https://cdn-we-retail.ym.tencent.com/tsr/goods/nz-09a.png?imageMogr2/thumbnail/564x564/quality/70/strip/format/webp"
/>
<view class="good-text-box">
<text class="good-text"
>白色短袖连衣裙荷叶边裙摆宽松韩版休闲纯白清爽优雅连衣裙</text
>
<view class="good-price-box">
<text class="good-text-price">
<text style="font-size: 20px">188</text>
积分
</text>
<Cart size="20" color="#ff0000" @click.stop="addCart()" />
</view>
</view>
</view>
</view>
<image :src="item.icon"/>
</nut-grid-item>
</nut-grid>
</view>
<!-- 标题 -->
<view class="titleImg">为你推荐</view>
<!-- 商品列表 -->
<view class="goodBox">
<view
class="good"
v-for="item in list"
:key="item.gid"
@click.stop="toGoodDetails(item.gid as number)"
>
<image
:src="item.cover"
/>
<view class="good-text-box">
<text class="good-text"
>{{ item.name }}
</text
>
<view class="good-price-box">
<text class="good-text-price">
<text style="font-size: 20px">{{ item.number }}</text>
积分
</text>
<Cart size="20" color="#ff0000" @click.stop="add_cart(item.gid)"/>
</view>
</view>
</view>
</view>
</view>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { Cart } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import {ref} from 'vue'
import {Cart} from '@nutui/icons-vue-taro'
import Taro from '@tarojs/taro'
import {getBanner} from '@/api/user'
import {getGoodsList, addCart} from '@/api/goods'
const searchValue = ref("");
const searchValue = ref('')
// const tabvalue = ref("0");
const swiperList = ref([
{
id: 1,
url: "https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg",
},
{
id: 2,
url: "https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg",
},
{
id: 3,
url: "https://storage.360buyimg.com/jdc-article/welcomenutui.jpg",
},
{
id: 4,
url: "https://storage.360buyimg.com/jdc-article/fristfabu.jpg",
},
]);
{
id: 1,
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg'
},
{
id: 2,
url: 'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg'
},
{
id: 3,
url: 'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg'
},
{
id: 4,
url: 'https://storage.360buyimg.com/jdc-article/fristfabu.jpg'
}
])
const userMenuList = ref([
{
id: 1,
label: "活动游戏",
url: "",
icon: "http://jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png",
},
{
id: 2,
label: "活动商品",
url: "",
icon: "http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
},
{
id: 3,
label: "商户入驻",
url: "/pages/users/settled_mer/index",
icon: "http://jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png",
},
{
id: 4,
label: "最新资讯",
url: "",
icon: "http://jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png",
},
]);
{
id: 1,
label: '活动游戏',
url: '/pages/game/gamehome/index',
icon: 'http://jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png'
},
{
id: 2,
label: '活动商品',
url: '',
icon: 'http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png'
},
{
id: 3,
label: '商户入驻',
url: '/pages/users/settled_mer/index',
icon: 'http://jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png'
},
{
id: 4,
label: '最新资讯',
url: '',
icon: 'http://jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png'
}
])
const addCart = () => {
interface List {
gid?: number
name?: string
number?: number
cover?: string
}
const list = ref<Array<List>>([])
Taro.useLoad(() => {
getBannerList()
get_goods_list()
})
const get_goods_list = async () => {
const {data} = await getGoodsList()
list.value = data.data
}
const getBannerList = async () => {
const {data}: any = await getBanner()
console.log(data)
}
const add_cart = async (gid: number) => {
try {
await addCart({gid: Number(gid)})
Taro.showToast({
title: "加入购物车成功",
icon: "success",
duration: 2000,
});
};
title: '加入购物车成功',
icon: 'success',
duration: 2000
})
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
}
const toPage = (url: string) => {
Taro.navigateTo({
url: url,
});
};
Taro.navigateTo({
url: url
})
}
const toGoodDetails = (item: number) => {
Taro.navigateTo({
url: `/pages/goods/goods_detail/index?id=${item}`,
});
};
const toGoodDetails = (gid: number) => {
Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${gid}`
})
}
</script>
<style lang="scss">
.app {
box-sizing: border-box;
background-color: #f5f5f5;
box-sizing: border-box;
background-color: #f5f5f5;
}
.nut-swiper-item img {
width: 100%;
height: 350px;
width: 100%;
height: 350px;
}
.titleImg {
margin-top: 10px;
width: 100%;
height: 50px;
box-sizing: border-box;
background-image: url("../../static/index/index-title.png");
background-repeat: no-repeat;
background-position: center;
background-size: 50%;
text-align: center;
line-height: 50px;
color: #ff0000;
font-weight: bold;
margin-top: 10px;
width: 100%;
height: 50px;
box-sizing: border-box;
background-image: url("~@/static/index/index-title.png");
background-repeat: no-repeat;
background-position: center;
background-size: 50%;
text-align: center;
line-height: 50px;
color: #ff0000;
font-weight: bold;
}
.navbar {
background-color: #ffffff;
background-color: #ffffff;
image {
width: 80px;
height: 80px;
}
image {
width: 80px;
height: 80px;
}
}
.goodBox {
display: flex;
padding: 20px;
flex-wrap: wrap;
justify-content: space-between;
display: flex;
padding: 20px;
flex-wrap: wrap;
justify-content: space-between;
.good {
width: 340px;
background-color: #fff;
margin-bottom: 20px;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
.good {
width: 340px;
background-color: #fff;
margin-bottom: 20px;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
image {
width: 100%;
height: 350px;
}
.good-text-box {
padding: 10px;
.good-text {
flex-shrink: 0;
font-size: 28px;
color: #333;
font-weight: 400;
display: -webkit-box;
height: 72px;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-word;
line-height: 36px;
}
.good-price-box {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
.good-text-price {
font-size: 28px;
font-weight: bold;
color: #ff0000;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
}
}
image {
width: 100%;
height: 350px;
}
.good-text-box {
padding: 10px;
.good-text {
flex-shrink: 0;
font-size: 28px;
color: #333;
font-weight: 400;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-word;
}
.good-price-box {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
.good-text-price {
font-size: 28px;
font-weight: bold;
color: #ff0000;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
}
}
}
}
</style>

View File

@@ -8,18 +8,19 @@
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
:src="userInfo.avatarUrl"
/>
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view class="user-center-card__header__info__name">小明</view>
<view class="user-center-card__header__info__name">{{ userInfo.nickName }}</view>
<view class="user-center-card__header__info__desc"
>ID:{{ 1 }}</view
>ID:{{ userInfo.ID }}
</view
>
</view>
<view class="rightIcon">
<Setting @click="toSetting" size="22" />
<Setting @click="toSetting" size="22"/>
</view>
</view>
<view v-else class="user-center-card__header__transparent">
@@ -34,7 +35,8 @@
<view
class="user-center-card__header__info__name"
@tap="clickLogin"
>点击立即授权</view
>点击立即授权
</view
>
</view>
</view>
@@ -45,24 +47,24 @@
<view>我的订单</view>
<view class="sub" @click="toOrderList(0)">
<view>全部订单</view>
<ArrowRight />
<ArrowRight/>
</view>
</view>
<view class="center">
<view class="center-t" @click="toOrderList(1)">
<Order size="25px" />
<Order size="25px"/>
<view class="center-text">待付款</view>
</view>
<view class="center-t" @click="toOrderList(2)">
<Clock size="25px" />
<Clock size="25px"/>
<view class="center-text">待使用</view>
</view>
<view class="center-t" @click="toOrderList(3)">
<Shop size="25px" />
<Shop size="25px"/>
<view class="center-text">已使用</view>
</view>
<view class="center-t" @click="toOrderList(4)">
<Del size="25px" />
<Del size="25px"/>
<view class="center-text">已失效</view>
</view>
</view>
@@ -74,8 +76,10 @@
<view class="box">
<view
class="box-mini"
v-if="isLogin"
v-for="item in userMenuList"
:key="item.id"
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
@@ -85,7 +89,7 @@
</view>
<!-- 商家管理 -->
<view class="mer-box">
<view class="mer-box" v-if="userInfo.bid !== 0">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
:border="false"
@@ -105,14 +109,17 @@
</nut-grid-item>
</nut-grid>
</view>
<!-- 版权 -->
<!--<view class="copy">© 2023 </view>-->
</view>
<!-- 登录 -->
<Auth :visible="isShowLogin" @update:visible="cancelLogin" />
<Auth :visible="isShowLogin" @update:visible="cancelLogin" @ok="getUserInfo"/>
</view>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import {ref} from 'vue'
import {
ArrowRight,
Order,
@@ -120,40 +127,60 @@ import {
Clock,
Shop,
Setting,
IconFont,
} from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
import Auth from "../../components/Auth.vue";
IconFont
} from '@nutui/icons-vue-taro'
import Taro from '@tarojs/taro'
import Auth from '@/components/Auth.vue'
import {getPersonalInfo} from '@/api/user'
const isShowLogin = ref(false);
const isShowLogin = ref(false)
const isLogin = ref(false);
const isLogin = ref(false)
// const userInfo = ref({});
interface UserInfo {
nickName?: string
avatarUrl?: string
ID?: string
bid?: number
}
const userInfo = ref<UserInfo>({})
Taro.useLoad(() => {
const token = Taro.getStorageSync("token");
const token = Taro.getStorageSync('token')
if (token) {
isLogin.value = true;
getUserInfo()
}
});
})
const cancelLogin = () => {
isShowLogin.value = false;
};
isShowLogin.value = false
}
const getUserInfo = async () => {
Taro.showLoading({
title: '加载中'
})
const res = await getPersonalInfo()
userInfo.value = res.data.data
Taro.setStorageSync('userInfo', res.data.data)
isLogin.value = true
cancelLogin()
Taro.hideLoading()
}
const toOrderList = (e: number) => {
Taro.navigateTo({
url: `/pages/users/order_list/index?type=${e}`,
});
};
url: `/pages/users/order_list/index?type=${e}`
})
}
const userMenuList = ref([
{
id: 1,
label: "我的账户",
url: "/pages/users/account/index",
icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png",
label: '我的账户',
url: '/pages/users/account/index',
icon: 'http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png'
},
// {
// id: 2,
@@ -163,39 +190,40 @@ const userMenuList = ref([
// },
{
id: 3,
label: "分销中心",
url: "/pages/users/account/index",
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png",
label: '分销中心',
url: '',
icon: 'http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png'
},
{
id: 4,
label: "关注商家",
url: "/pages/users/account/index",
icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png",
label: '关注商家',
url: '',
icon: 'http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png'
},
{
id: 5,
label: "问题反馈",
url: "/pages/users/account/index",
icon: "http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png",
},
]);
label: '问题反馈',
url: '',
icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png'
}
])
const toSetting = () => {
Taro.navigateTo({
url: "/pages/users/setting/index",
});
};
url: '/pages/users/setting/index'
})
}
const clickLogin = () => {
isShowLogin.value = true;
};
isShowLogin.value = true
}
const toPage = (url: string) => {
console.log(url)
Taro.navigateTo({
url: url,
});
};
url: url
})
}
</script>
<style lang="scss">
@@ -210,6 +238,12 @@ const toPage = (url: string) => {
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666));
}
.user-center-card__header__avatar {
img {
border-radius: 50%;
}
}
.user-center-card__header__transparent {
position: absolute;
left: 30px;
@@ -321,7 +355,6 @@ const toPage = (url: string) => {
background-color: #fff;
border-radius: 20px;
margin: 20px;
//padding: 30px;
width: 710px;
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '我的账户'
})

View File

@@ -1,15 +1,73 @@
<script lang="ts">
import {defineComponent} from 'vue'
<script lang="ts" setup>
export default defineComponent({
name: "index"
})
</script>
<template>
$END$
<view>
<view class="card">
<view class="greeting">Hello! YuanHuakk</view>
<view class="info">
<view class="left">
<view>
<view class="num">豆子188888</view>
</view>
<view>
<view class="num">积分188888</view>
</view>
</view>
<image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/>
</view>
</view>
</view>
</template>
<style scoped lang="scss">
<style lang="scss">
page {
//background-color: #111;
}
.card {
width: 90%;
height: 300px;
border-radius: 20px;
background-color: #282828;
box-shadow: 0 0 10px rgba(40, 40, 40, 0.1);
background-size: 100% 100%;
background-repeat: no-repeat;
margin: 10px auto;
color: #D0A568;
padding: 20px;
.greeting {
font-size: 35px;
font-weight: bold;
}
.info {
display: flex;
justify-content: space-between;
.left {
height: 300px;
width: 50%;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
.num {
font-size: 40px;
font-weight: bold;
margin-top: 10px;
}
}
.img {
width: 380px;
height: 270px;
}
}
}
</style>

View File

@@ -1,7 +1,14 @@
<script lang="ts" setup>
import {ref} from "vue";
import Taro from "@tarojs/taro";
import Pay from "../../../components/Pay.vue";
import { ref } from "vue";
import {
useLoad,
useReachBottom,
showToast,
navigateTo,
setStorageSync,
} from "@tarojs/taro";
import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user";
const tabValue = ref(0);
@@ -35,38 +42,79 @@ const tabsList = ref([
},
]);
const orderList = ref([{}]);
const jfInfo = ref({});
Taro.useLoad((options) => {
interface OrderList {
add_time: string;
status: number;
BindGoods: {
cover: string;
name: string;
number: number;
};
count: number;
number: number;
}
const orderList = ref<OrderList[]>([]);
useLoad((options) => {
tabValue.value = Number(options.type);
getList();
});
const getList = async () => {
try {
const res = await getIntegralOrderList({
status: tabValue.value,
});
console.log(res);
orderList.value = res.data.data;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
};
const tabChange = (index: number) => {
tabValue.value = index;
getList();
};
Taro.useReachBottom(() => {
useReachBottom(() => {
console.log("useReachBottom");
});
const openPay = () => {
console.log("openPay");
const openPay = (item: OrderList) => {
console.log("openPay", item);
isShowPay.value = true;
jfInfo.value = item;
};
const errPay = () => {
isShowPay.value = false;
Taro.showToast({
showToast({
title: "支付失败",
icon: "none",
});
jfInfo.value = {};
};
const closePay = () => {
isShowPay.value = false;
Taro.showToast({
showToast({
title: "支付取消",
icon: "none",
});
jfInfo.value = {};
};
const toDetail = (item: any) => {
setStorageSync("item", item);
navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
});
};
</script>
@@ -76,11 +124,10 @@ const closePay = () => {
<view>
<view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px"
>消费订单{{ 10 || 0 }} 总消费积分{{ 12312 || 0 }}
</view
>
>消费订单{{ 10 || 0 }} 总消费积分{{ 12312 || 0 }}
</view>
</view>
<image src="../static/user/order_list_top.png"/>
<image src="../static/user/order_list_top.png" />
</view>
<view class="tabs-box">
<view
@@ -97,80 +144,80 @@ const closePay = () => {
</view>
</view>
<view v-if="orderList.length > 0">
<view class="order-card" v-for="item in 10" :key="item">
<view
class="order-card"
v-for="(item, index) in orderList"
:key="index"
>
<view class="top">
<view>2023-08-14 14:24:23</view>
<view style="color: red">待付款</view>
<view>{{ item.add_time.slice(0, 19) }}</view>
<view style="color: red">{{
item.status === 1
? "待付款"
: item.status === 2
? "待使用"
: item.status === 3
? "已使用"
: "已失效"
}}</view>
</view>
<view class="line"></view>
<view class="center">
<view class="top">
<image src="../static/user/order_list_top.png"/>
<view class="title"
>商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称
</view
>
<image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods.name }} </view>
<view class="right">
<view>123.00</view>
<view>x1</view>
<view>{{ item.BindGoods.number }}</view>
<view>x{{ item.count }}</view>
</view>
</view>
<view
class="bom"
style="text-align: right; font-size: 13px"
>
10件商品,实付积分:
<text style="color: red"
>123.00
</text
>
{{ item.count }}件商品,实付积分:
<text style="color: red">{{ item.number }}</text>
</view>
</view>
<view class="line"></view>
<view class="btn">
<nut-button plain size="small" type="primary"
>取消订单
</nut-button
>
<nut-button
v-if="item.status === 0"
plain
size="small"
type="primary"
>取消订单
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
>查看详情
</nut-button
>
@click="toDetail(item)"
>查看详情
</nut-button>
<nut-button
style="margin-left: 5px"
size="small"
type="primary"
@click="openPay()"
>立即付款
</nut-button
>
v-if="item.status === 0"
@click="openPay(item)"
>立即付款
</nut-button>
</view>
</view>
</view>
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="wx"
payType="jf"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template>
<style lang="scss">
page {
background-color: #f5f5f5;
}
scroll-view {
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.topTips {
box-sizing: border-box;
width: 100%;
@@ -246,7 +293,7 @@ scroll-view {
.top {
display: flex;
justify-content: space-between;
align-items: center;
// align-items: flex-start;
image {
width: 150px;

View File

@@ -1,7 +1,354 @@
<template>
<view>这里是订单详情</view>
<view>
<!-- 步骤条 -->
<view class="step-bar">
<view
class="item"
v-for="item in statusList"
:key="item.id"
:class="{ activation: item.id === goodInfo.status }"
>
<view class="text">{{ item.text }}</view>
<view class="dot"></view>
</view>
</view>
<!-- 商家信息 -->
<view class="mer-info">
<view class="left">
<view>
<text>{{ goodInfo.BindStore.name }}</text>
<text>{{ goodInfo.BindStore.phone }}</text>
</view>
<nut-ellipsis
:rows="2"
:content="goodInfo.BindStore.address"
direction="end"
></nut-ellipsis>
</view>
<view class="right">
<view class="icon" @click="toPhone">
<Service />
<text>电话</text>
</view>
<view class="icon" @click="toAdder">
<Find />
<text>导航</text>
</view>
</view>
</view>
<!-- 订单信息 -->
<nut-cell-group>
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
<nut-cell>
<template #default>
<view class="top">
<image :src="goodInfo.BindGoods.cover" />
<view class="title"
>{{ goodInfo.BindGoods.name }}
</view>
<view class="right">
<view>{{ goodInfo.BindGoods.number }}</view>
<view>x{{ goodInfo.count }}</view>
</view>
</view>
</template>
</nut-cell>
<nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell>
<nut-cell
title="下单时间:"
:desc="goodInfo.add_time.slice(0, 19)"
></nut-cell>
<nut-cell
title="支付状态:"
:desc="
goodInfo.status === 0
? '待付款'
: goodInfo.status === 1
? '待使用'
: goodInfo.status === 2
? '已使用'
: '已失效'
"
></nut-cell>
<nut-cell
title="商品总价(积分):"
:desc="goodInfo.number"
></nut-cell>
<nut-cell>
<template #default>
<view style="text-align: right; width: 100%">
<view
>实付款(积分):
<nut-price
:price="goodInfo.number"
size="normal"
:need-symbol="false"
/>
</view>
</view>
</template>
</nut-cell>
</nut-cell-group>
<view class="btn">
<nut-button
plain
v-if="goodInfo.status === 0"
size="small"
type="primary"
>取消订单
</nut-button>
<nut-button
v-if="goodInfo.status === 0"
style="margin-left: 5px"
size="small"
type="primary"
@click="openPay()"
>立即付款
</nut-button>
<nut-button
v-if="goodInfo.status === 1"
style="margin-left: 5px"
size="small"
type="primary"
@click="openCode()"
>出示核销码
</nut-button>
</view>
<!-- 核销码弹窗 -->
<nut-popup
v-model:visible="isShowCode"
position="bottom"
:style="{ height: 'auto' }"
:maskClosable="true"
safe-area-inset-bottom
@closed="closed"
>
<view class="code-box">
<view>请出示核销码核销</view>
<image class="qrcode" :src="url"></image>
</view>
</nut-popup>
</view>
</template>
<script setup lang="ts"></script>
<script setup lang="ts">
import {
useLoad,
getStorageSync,
makePhoneCall,
openLocation,
} from "@tarojs/taro";
import { Service, Find } from "@nutui/icons-vue-taro";
import { ref } from "vue";
<style lang="scss"></style>
const goodInfo = ref<any>({});
const statusList = ref([
{
id: 0,
text: "待付款",
},
{
id: 1,
text: "待使用",
},
{
id: 2,
text: "已使用",
},
{
id: 3,
text: "已失效",
},
]);
const isShowCode = ref(false);
const url = ref("");
useLoad((options) => {
console.log("options", options);
goodInfo.value = getStorageSync("item");
});
const toPhone = () => {
makePhoneCall({
phoneNumber: goodInfo.value.BindStore.phone,
});
};
const toAdder = () => {
openLocation({
latitude: Number(goodInfo.value.BindStore.lat),
longitude: Number(goodInfo.value.BindStore.lon),
scale: 18,
});
};
const openPay = () => {};
const openCode = () => {
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
isShowCode.value = true;
};
const closed = () => {
isShowCode.value = false;
url.value = "";
};
</script>
<style lang="scss">
page {
height: 100vh;
box-sizing: border-box;
padding-bottom: 100px;
position: relative;
}
.step-bar {
width: 100%;
height: 100px;
background: #fff;
display: flex;
.item {
width: 200px;
height: 100px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: small;
.dot {
width: 25px;
height: 25px;
border-radius: 50%;
background: #cecece;
margin-top: 5px;
}
}
.activation {
.text {
color: #ff0000;
}
.dot {
background: #ff0000;
position: relative;
&::before {
content: "";
width: 15px;
height: 15px;
border-radius: 50%;
background: #fff;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
}
}
.mer-info {
background-color: white;
padding: 20px 30px;
margin-top: 10px;
width: 100%;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
.left {
width: 50%;
text {
margin-right: 10px;
}
.address {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: -webkit-box;
-webkit-line-clamp: 1;
}
}
.right {
color: #858585;
text-align: center;
display: flex;
flex-direction: column;
height: 120px;
justify-content: space-between;
.icon {
display: flex;
align-items: center;
//margin-bottom: 20px;
}
}
}
.btn {
box-sizing: border-box;
background-color: #fff;
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 20px;
display: flex;
justify-content: flex-end;
align-items: flex-start;
}
.top {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
image {
width: 150px;
height: 150px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
.code-box {
padding: 20px;
box-sizing: border-box;
text-align: center;
font-size: large;
}
.qrcode {
width: 300px;
height: 300px;
}
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '申请商户',
navigationBarTitleText: '商户入驻',
})

View File

@@ -1,160 +1,250 @@
<script lang="ts" setup>
import {reactive, ref} from "vue";
import Taro from '@tarojs/taro'
import {ref} from 'vue'
import {getVerifyCode, applyMer, getMerTypeList} from '@/api/user'
const basicData = reactive({
name: '',
age: '',
tel: '',
address: ''
});
const visible = ref(false)
const visible = ref(false);
const merType = ref(false);
const merGooType = ref(false);
const merType = ref(false)
const merGooType = ref(false)
// 验证码按钮文字
const smsStr = ref('获取验证码')
// 验证码按钮是否禁用
const smsDisabled = ref(false)
// 表单数据
const formValue = ref({
merName: '',
name: '',
phone: '',
merType: '',
merTypeStr: '',
merGooType: '',
merGooTypeStr: '',
});
name: '',
userName: '',
phone: '',
code: '',
bType: '',
merTypeStr: '',
classId: '',
merGooTypeStr: ''
})
const ruleForm = ref<any>(null);
const merGooList = ref([])
const onOk = () => {
visible.value = false;
const merList = ref([])
};
// 表单校验
const ruleForm = ref<any>(null)
const open = () => {
console.log('open');
visible.value = true;
};
Taro.useLoad(() => {
getMerType()
})
const confirmMerType = (e: any) => {
formValue.value.merTypeStr = e.selectedOptions[0].text;
formValue.value.merType = e.selectedOptions[0].value;
merType.value = false;
}
const confirmGooType = (e: any) => {
formValue.value.merGooTypeStr = e.selectedOptions[0].text;
formValue.value.merGooType = e.selectedOptions[0].value;
merGooType.value = false;
}
const submit = () => {
ruleForm.value.validate().then(({valid, errors}: any) => {
if (valid) {
console.log('success', formValue.value);
visible.value = true;
} else {
console.log('error submit!!', errors);
// 获取商户类型
const getMerType = async () => {
try {
const res = await getMerTypeList()
console.log(res)
merList.value = res.data.type.map((item: any) => {
return {
text: item.name,
value: item.ID
}
})
merGooList.value = res.data.class.map((item: any) => {
return {
text: item.name,
value: item.ID
}
})
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
});
}
// 关闭弹窗
const onOk = async () => {
try {
const res = await applyMer(formValue.value)
Taro.showToast({
title: res.msg,
icon: 'none'
})
} catch (e) {
Taro.showToast({
title: e.msg,
icon: 'none'
})
}
visible.value = false
}
// 打开弹窗
const open = () => {
console.log('open')
visible.value = true
}
// 获取验证码
const getSmsCode = () => {
ruleForm.value.validate('phone').then(async ({valid}: any) => {
if (valid) {
try {
await getVerifyCode({
phone: formValue.value.phone.toString()
})
smsDisabled.value = true
let time = 10
const timer = setInterval(() => {
time--
smsStr.value = `${time}s`
if (time === 0) {
clearInterval(timer)
smsDisabled.value = false
smsStr.value = '获取验证码'
}
}, 1000)
} catch (e) {
Taro.showToast({
title: e.message,
icon: 'none'
})
}
}
})
}
// 选择商户类型
const confirmMerType = (e: any) => {
formValue.value.merTypeStr = e.selectedOptions[0].text
formValue.value.bType = e.selectedOptions[0].value
merType.value = false
}
// 选择经营类目
const confirmGooType = (e: any) => {
formValue.value.merGooTypeStr = e.selectedOptions[0].text
formValue.value.classId = e.selectedOptions[0].value
merGooType.value = false
}
// 提交
const submit = () => {
ruleForm.value.validate().then(({valid, errors}: any) => {
if (valid) {
console.log('success', formValue.value)
visible.value = true
} else {
console.log('error submit!!', errors)
}
})
}
</script>
<template>
<view class="appBg">
<nut-form ref="ruleForm" class="form" :model-value="formValue">
<nut-form-item required label="商户名称" prop="merName" :rules="[{
<view>
<nut-form ref="ruleForm" class="form" :model-value="formValue">
<nut-form-item required label="商户名称" prop="name" :rules="[{
required: true,
message: '请输入商户名称',
}]">
<input type="text" v-model="formValue.merName" placeholder="请输入商户名称"/>
</nut-form-item>
<nut-form-item required label="用户姓名" prop="name" :rules="[{
<input type="text" v-model="formValue.name" placeholder="请输入商户名称"/>
</nut-form-item>
<nut-form-item required label="用户姓名" prop="userName" :rules="[{
required: true,
message: '请输入用户姓名',
}]">
<input type="text" v-model="formValue.name" placeholder="请输入真实姓名"/>
</nut-form-item>
<nut-form-item required label="联系电话" prop="phone" :rules="[{
<input type="text" v-model="formValue.userName" placeholder="请输入真实姓名"/>
</nut-form-item>
<nut-form-item required label="联系电话" prop="phone" :rules="[{
required: true,
message: '请输入正确的电话号码',
regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
}]">
<input type="number" :maxlength="11" v-model="formValue.phone" placeholder="请输入联系电话"/>
</nut-form-item>
<nut-form-item required label="商户类型" prop="merTypeStr" :rules="[{
<input type="text" :maxlength="11" v-model="formValue.phone" placeholder="请输入联系电话"/>
</nut-form-item>
<nut-form-item required label="验证码" prop="code" :rules="[{
required: true,
message: '请输入验证码',
}]">
<view class="yanCode">
<input type="text" :maxlength="6" v-model="formValue.code" placeholder="请输入验证码"/>
<nut-button style="width: 100px; padding: 3px" plain type="primary" size="mini"
:disabled="smsDisabled" round
@click="getSmsCode">
{{ smsStr }}
</nut-button>
</view>
</nut-form-item>
<nut-form-item required label="商户类型" prop="merTypeStr" :rules="[{
required: true,
message: '请选择商户类型',
}]">
<input type="text" :disabled="true" v-model="formValue.merTypeStr" placeholder="请选择商户类型"
@click="merType = true"/>
<nut-popup position="bottom" v-model:visible="merType">
<nut-picker :columns="[{
text: '供应商',
value: '1'
},{
text: '兑换商',
value: '2'
}]" title="商户类型" @confirm="confirmMerType" @cancel="merType = false"></nut-picker>
</nut-popup>
</nut-form-item>
<nut-form-item required label="经营类目" prop="merGooTypeStr" :rules="[{
<input type="text" :disabled="true" v-model="formValue.merTypeStr" placeholder="请选择商户类型"
@click="merType = true"/>
<nut-popup position="bottom" v-model:visible="merType">
<nut-picker :columns="merList" title="商户类型" @confirm="confirmMerType"
@cancel="merType = false"></nut-picker>
</nut-popup>
</nut-form-item>
<nut-form-item required label="经营类目" prop="merGooTypeStr" :rules="[{
required: true,
message: '请选择经营类目',
}]">
<input type="text" :disabled="true" v-model="formValue.merGooTypeStr" placeholder="请选择经营类目"
@click="merGooType = true"/>
<nut-popup position="bottom" v-model:visible="merGooType">
<nut-picker :columns="[{
text: '酒吧',
value: '1'
},{
text: 'KTV',
value: '2'
},{
text: '餐饮',
value: '2'
},{
text: '娱乐',
value: '4'
},{
text: '其他',
value: '5'
}]" title="商户类型" @confirm="confirmGooType" @cancel="merGooType = false"></nut-picker>
</nut-popup>
</nut-form-item>
<view class="btn">
<nut-button block type="primary" round @click="submit()">提交</nut-button>
</view>
<input type="text" :disabled="true" v-model="formValue.merGooTypeStr" placeholder="请选择经营类目"
@click="merGooType = true"/>
<nut-popup position="bottom" v-model:visible="merGooType">
<nut-picker :columns="merGooList" title="商户类型" @confirm="confirmGooType"
@cancel="merGooType = false"></nut-picker>
</nut-popup>
</nut-form-item>
<!-- <nut-form-item label="资质上传" prop="img">-->
<!-- <nut-uploader url="www.baidu.com"></nut-uploader>-->
<!-- </nut-form-item>-->
</nut-form>
<!-- 入驻协议弹窗 -->
<nut-dialog
no-cancel-btn
title="入驻协议"
ok-text="已阅读并且同意"
v-model:visible="visible"
@ok="onOk"
>
<view>入驻协议</view>
</nut-dialog>
</view>
<view class="btn">
<nut-button block type="primary" round @click="submit()">提交</nut-button>
</view>
</nut-form>
<!-- 入驻协议弹窗 -->
<nut-dialog
no-cancel-btn
title="入驻协议"
ok-text="已阅读并且同意"
v-model:visible="visible"
@ok="onOk"
>
<view>入驻协议</view>
</nut-dialog>
</view>
</template>
<style lang="scss">
.appBg {
background-image: url("../../../static/merchantBg.jpg");
background-size: 100%;
background-color: #E93423;
height: 100vh;
background-repeat: no-repeat;
page {
background-image: url("~@/static/merchantBg.jpg");
background-size: 100%;
background-color: #E93423;
background-repeat: no-repeat;
}
.form {
.form {
position: relative;
top: 300px;
.btn {
padding: 20px;
margin-top: 20px;
text-align: center;
padding: 20px;
margin-top: 20px;
text-align: center;
}
}
}
.yanCode {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>

View File

@@ -1,46 +1,48 @@
import Taro from "@tarojs/taro";
import Taro from '@tarojs/taro'
const BASE_URL = () => {
if (process.env.NODE_ENV === "development") {
return "http://192.168.2.3:9000";
} else {
return "https://api.imooc.hybrid.lgdsunday.club";
}
};
const BASE_URL = process.env.NODE_ENV === 'development' ? 'http://192.168.2.3:9000' : 'https://www.wanzhuanyongcheng.cn'
// interface Res {
//
// }
interface Res<T> {
code: number;
data: T;
msg: string;
}
type Method = "GET" | "POST" | "PUT" | "DELETE";
type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
export const request = (
const request = (
url: string,
data: object = {},
method: Method = "GET"
): Promise<any> => {
method: Method = 'GET'
): Promise<Res<any>> => {
return new Promise((resolve, reject) => {
Taro.showLoading({
title: '加载中...',
mask: true
})
Taro.request({
url: BASE_URL() + "/app" + url,
url: BASE_URL + '/app' + url,
data: data,
method: method,
header: {
"content-type": "application/json",
token: Taro.getStorageSync("token"),
'content-type': 'application/json',
token: Taro.getStorageSync('token')
},
success: ({data}) => {
console.log(data);
Taro.hideLoading()
if (data.code !== 200)
return reject({code: 1, msg: data.msg});
resolve(data);
return reject({code: 1, msg: data.msg})
resolve(data)
},
fail: () => {
Taro.showToast({
title: "服务器异常",
icon: "none",
});
reject({code: 1, msg: "服务器异常"});
},
});
});
};
title: '服务器异常',
icon: 'none'
})
reject({code: 1, msg: '服务器异常'})
}
})
})
}
export default request

View File

@@ -1,34 +1,39 @@
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"removeComments": false,
"preserveConstEnums": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"outDir": "lib",
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"sourceMap": true,
"baseUrl": ".",
"rootDir": ".",
"jsx": "preserve",
"allowJs": true,
"resolveJsonModule": true,
"typeRoots": [
"node_modules/@types"
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"removeComments": false,
"preserveConstEnums": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"outDir": "lib",
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"sourceMap": true,
"baseUrl": ".",
"rootDir": ".",
"jsx": "preserve",
"allowJs": true,
"resolveJsonModule": true,
"typeRoots": [
"node_modules/@types"
],
"types": [
"@tarojs/components/vue3"
],
"paths": {
"@/*": [
"src/*"
]
}
},
"include": [
"./src",
"./types",
"components.d.ts"
],
"types": [
"@tarojs/components/vue3"
]
},
"include": [
"./src",
"./types",
"components.d.ts"
],
"compileOnSave": false
"compileOnSave": false
}