Merge branch 'dev' into test
This commit is contained in:
57
.cz-config.js
Normal file
57
.cz-config.js
Normal file
@@ -0,0 +1,57 @@
|
||||
module.exports = {
|
||||
types: [
|
||||
{ value: "feat", name: "feat: 新增功能" },
|
||||
{ value: "fix", name: "fix: 修复bug" },
|
||||
{ value: "docs", name: "docs: 文档变更" },
|
||||
{
|
||||
value: "style",
|
||||
name: "style: 代码格式(不影响功能,例如空格、分号等格式修正)",
|
||||
},
|
||||
{
|
||||
value: "refactor",
|
||||
name: "refactor: 代码重构(不包括 bug 修复、功能新增)",
|
||||
},
|
||||
{ value: "perf", name: "perf: 性能优化" },
|
||||
{ value: "test", name: "test: 添加、修改测试用例" },
|
||||
{
|
||||
value: "build",
|
||||
name: "build: 构建流程、外部依赖变更(如升级 npm 包、修改 脚手架 配置等)",
|
||||
},
|
||||
{ value: "ci", name: "ci: 修改 CI 配置、脚本" },
|
||||
{
|
||||
value: "chore",
|
||||
name: "chore: 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)",
|
||||
},
|
||||
{ value: "revert", name: "revert: 回滚 commit" },
|
||||
{ value: "wip", name: "wip: 开发中" },
|
||||
{ value: "mod", name: "mod: 不确定分类的修改" },
|
||||
{ value: "release", name: "release: 发布" },
|
||||
],
|
||||
scopes: [
|
||||
["custom", "自定义"],
|
||||
["projects", "项目搭建"],
|
||||
["components", "组件相关"],
|
||||
["utils", "utils 相关"],
|
||||
["styles", "样式相关"],
|
||||
["deps", "项目依赖"],
|
||||
["other", "其他修改"],
|
||||
].map(([value, description]) => {
|
||||
return {
|
||||
value,
|
||||
name: `${value.padEnd(30)} (${description})`,
|
||||
};
|
||||
}),
|
||||
messages: {
|
||||
type: "确保本次提交遵循 Angular 规范!选择你要提交的类型:\n",
|
||||
scope: "选择一个 scope(可选):",
|
||||
customScope: "请输入自定义的 scope:",
|
||||
subject: "填写简短精炼的变更描述:",
|
||||
body: '填写更加详细的变更描述(可选)。使用 "|" 换行:',
|
||||
breaking: "列举非兼容性重大的变更(可选):",
|
||||
footer: "列举出所有变更的 Issues Closed(可选)。 例如: #31, #34:",
|
||||
confirmCommit: "确认提交?",
|
||||
},
|
||||
allowBreakingChanges: ["feat", "fix"],
|
||||
subjectLimit: 100,
|
||||
breaklineChar: "|",
|
||||
};
|
||||
@@ -5,7 +5,7 @@ root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
# 开发版appid
|
||||
TARO_APP_ID='wx7b3322daa2cf9c88'
|
||||
|
||||
# 开发版appkey
|
||||
TARO_APP_KEY='1234567890'
|
||||
|
||||
# API接口
|
||||
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
|
||||
|
||||
# 游戏链接
|
||||
TARO_APP_GAME='https://game.wanzhuanyongcheng.cn/public/#/pages/index/index?uid='
|
||||
TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid='
|
||||
@@ -1,7 +1,10 @@
|
||||
# 正式版版appid
|
||||
TARO_APP_ID='wxdd00d46fa6f07974'
|
||||
|
||||
# 开发版appkey
|
||||
TARO_APP_KEY='private.wxdd00d46fa6f07974.key'
|
||||
|
||||
# API接口
|
||||
TARO_APP_API='https://www.wanzhuanyongcheng.cn/app'
|
||||
|
||||
TARO_APP_GAME = 'https://www.jdt168.com/public/#/pages/index/index?uid='
|
||||
TARO_APP_GAME='https://jdt-prod-tz.wanzhuanyongcheng.cn/pages/index/index?uid='
|
||||
@@ -1,8 +1,11 @@
|
||||
# 开发版appid
|
||||
TARO_APP_ID='wx7b3322daa2cf9c88'
|
||||
|
||||
# 开发版appkey
|
||||
TARO_APP_KEY='private.wx7b3322daa2cf9c88.key'
|
||||
|
||||
# API接口
|
||||
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
|
||||
|
||||
# 游戏链接
|
||||
TARO_APP_GAME = 'https://game.wanzhuanyongcheng.cn/public/#/pages/index/index?uid='
|
||||
TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid='
|
||||
8
.eslintrc
Normal file
8
.eslintrc
Normal file
@@ -0,0 +1,8 @@
|
||||
// ESLint 检查 .vue 文件需要单独配置编辑器:
|
||||
// https://eslint.vuejs.org/user-guide/#editor-integrations
|
||||
{
|
||||
"extends": ["taro/vue3"],
|
||||
"rules": {
|
||||
"vue/multi-word-component-names": "off"
|
||||
}
|
||||
}
|
||||
4
.husky/commit-msg
Normal file
4
.husky/commit-msg
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npx --no -- commitlint --edit "$1"
|
||||
4
.husky/pre-commit
Normal file
4
.husky/pre-commit
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npm run lint:staged
|
||||
3
.prettierignore
Normal file
3
.prettierignore
Normal file
@@ -0,0 +1,3 @@
|
||||
/node_modules/**
|
||||
/dist/*
|
||||
/public/*
|
||||
@@ -2,9 +2,12 @@
|
||||
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
|
||||
module.exports = {
|
||||
presets: [
|
||||
['taro', {
|
||||
framework: 'vue3',
|
||||
ts: true
|
||||
}]
|
||||
]
|
||||
}
|
||||
[
|
||||
"taro",
|
||||
{
|
||||
framework: "vue3",
|
||||
ts: true,
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
26
commitlint.config.js
Normal file
26
commitlint.config.js
Normal file
@@ -0,0 +1,26 @@
|
||||
module.exports = {
|
||||
ignores: [(commit) => commit.includes("init")],
|
||||
extends: ["@commitlint/config-conventional"],
|
||||
rules: {
|
||||
"type-enum": [
|
||||
2,
|
||||
"always",
|
||||
[
|
||||
"feat",
|
||||
"fix",
|
||||
"docs",
|
||||
"style",
|
||||
"refactor",
|
||||
"perf",
|
||||
"test",
|
||||
"build",
|
||||
"ci",
|
||||
"chore",
|
||||
"revert",
|
||||
"wip",
|
||||
"mod",
|
||||
"release",
|
||||
],
|
||||
],
|
||||
},
|
||||
};
|
||||
85
components.d.ts
vendored
85
components.d.ts
vendored
@@ -1,49 +1,52 @@
|
||||
// generated by unplugin-vue-components
|
||||
// We suggest you to commit this file into source control
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
import '@vue/runtime-core'
|
||||
import "@vue/runtime-core";
|
||||
|
||||
export {}
|
||||
export {};
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
declare module "@vue/runtime-core" {
|
||||
export interface GlobalComponents {
|
||||
Auth: typeof import('./src/components/Auth.vue')['default']
|
||||
NutAvatar: typeof import('@nutui/nutui-taro')['Avatar']
|
||||
NutBacktop: typeof import('@nutui/nutui-taro')['Backtop']
|
||||
NutButton: typeof import('@nutui/nutui-taro')['Button']
|
||||
NutCalendar: typeof import('@nutui/nutui-taro')['Calendar']
|
||||
NutCell: typeof import('@nutui/nutui-taro')['Cell']
|
||||
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']
|
||||
NutImagePreview: typeof import('@nutui/nutui-taro')['ImagePreview']
|
||||
NutInput: typeof import('@nutui/nutui-taro')['Input']
|
||||
NutInputNumber: typeof import('@nutui/nutui-taro')['InputNumber']
|
||||
NutOverlay: typeof import('@nutui/nutui-taro')['Overlay']
|
||||
NutPagination: typeof import('@nutui/nutui-taro')['Pagination']
|
||||
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']
|
||||
NutSwitch: typeof import('@nutui/nutui-taro')['Switch']
|
||||
NutTable: typeof import('@nutui/nutui-taro')['Table']
|
||||
NutTabPane: typeof import('@nutui/nutui-taro')['TabPane']
|
||||
NutTabs: typeof import('@nutui/nutui-taro')['Tabs']
|
||||
NutTextarea: typeof import('@nutui/nutui-taro')['Textarea']
|
||||
NutUploader: typeof import('@nutui/nutui-taro')['Uploader']
|
||||
Pay: typeof import('./src/components/Pay.vue')['default']
|
||||
RichEditor: typeof import('./src/components/RichEditor.vue')['default']
|
||||
Ucharts: typeof import('./src/components/Ucharts.vue')['default']
|
||||
Upload: typeof import('./src/components/Upload.vue')['default']
|
||||
UserModal: typeof import('./src/components/UserModal.vue')['default']
|
||||
Auth: typeof import("./src/components/Auth.vue")["default"];
|
||||
Cart: typeof import("./src/components/Cart.vue")["default"];
|
||||
MerList: typeof import("./src/components/MerList.vue")["default"];
|
||||
NutAvatar: typeof import("@nutui/nutui-taro")["Avatar"];
|
||||
NutBacktop: typeof import("@nutui/nutui-taro")["Backtop"];
|
||||
NutButton: typeof import("@nutui/nutui-taro")["Button"];
|
||||
NutCalendar: typeof import("@nutui/nutui-taro")["Calendar"];
|
||||
NutCell: typeof import("@nutui/nutui-taro")["Cell"];
|
||||
NutCellGroup: typeof import("@nutui/nutui-taro")["CellGroup"];
|
||||
NutCheckbox: typeof import("@nutui/nutui-taro")["Checkbox"];
|
||||
NutCheckboxGroup: typeof import("@nutui/nutui-taro")["CheckboxGroup"];
|
||||
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"];
|
||||
NutImagePreview: typeof import("@nutui/nutui-taro")["ImagePreview"];
|
||||
NutInput: typeof import("@nutui/nutui-taro")["Input"];
|
||||
NutInputNumber: typeof import("@nutui/nutui-taro")["InputNumber"];
|
||||
NutOverlay: typeof import("@nutui/nutui-taro")["Overlay"];
|
||||
NutPagination: typeof import("@nutui/nutui-taro")["Pagination"];
|
||||
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"];
|
||||
NutSwiper: typeof import("@nutui/nutui-taro")["Swiper"];
|
||||
NutSwiperItem: typeof import("@nutui/nutui-taro")["SwiperItem"];
|
||||
NutSwitch: typeof import("@nutui/nutui-taro")["Switch"];
|
||||
NutTable: typeof import("@nutui/nutui-taro")["Table"];
|
||||
NutTabPane: typeof import("@nutui/nutui-taro")["TabPane"];
|
||||
NutTabs: typeof import("@nutui/nutui-taro")["Tabs"];
|
||||
NutTextarea: typeof import("@nutui/nutui-taro")["Textarea"];
|
||||
NutUploader: typeof import("@nutui/nutui-taro")["Uploader"];
|
||||
Pay: typeof import("./src/components/Pay.vue")["default"];
|
||||
Popup: typeof import("./src/components/Popup.vue")["default"];
|
||||
RichEditor: typeof import("./src/components/RichEditor.vue")["default"];
|
||||
Ucharts: typeof import("./src/components/Ucharts.vue")["default"];
|
||||
Upload: typeof import("./src/components/Upload.vue")["default"];
|
||||
UserModal: typeof import("./src/components/UserModal.vue")["default"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
NODE_ENV: '"development"'
|
||||
},
|
||||
defineConstants: {},
|
||||
mini: {},
|
||||
h5: {}
|
||||
}
|
||||
env: {
|
||||
NODE_ENV: '"development"',
|
||||
},
|
||||
defineConstants: {},
|
||||
mini: {},
|
||||
h5: {},
|
||||
};
|
||||
|
||||
218
config/index.ts
218
config/index.ts
@@ -1,105 +1,125 @@
|
||||
// @ts-nocheck
|
||||
import Components from 'unplugin-vue-components/webpack'
|
||||
import NutUIResolver from '@nutui/nutui-taro/dist/resolver'
|
||||
import {join} from 'node:path'
|
||||
import Components from "unplugin-vue-components/webpack";
|
||||
import NutUIResolver from "@nutui/nutui-taro/dist/resolver";
|
||||
import { join } from "node:path";
|
||||
import { argv } from "yargs";
|
||||
|
||||
const { robot = 1, desc } = argv;
|
||||
|
||||
/**
|
||||
* @typedef { import("@tarojs/plugin-mini-ci").CIOptions } CIOptions
|
||||
* @type {CIOptions}
|
||||
*/
|
||||
const CIPluginOpt = {
|
||||
weapp: {
|
||||
appid: process.env.TARO_APP_ID,
|
||||
privateKeyPath: process.env.TARO_APP_KEY,
|
||||
robot,
|
||||
},
|
||||
desc,
|
||||
};
|
||||
|
||||
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";`
|
||||
},
|
||||
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: true, // 默认为 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]'
|
||||
}
|
||||
}
|
||||
}
|
||||
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", ["@tarojs/plugin-mini-ci", CIPluginOpt]],
|
||||
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: true, // 默认为 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"));
|
||||
};
|
||||
|
||||
@@ -1,38 +1,37 @@
|
||||
// @ts-nocheck
|
||||
|
||||
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') })
|
||||
// }))
|
||||
// }
|
||||
}
|
||||
}
|
||||
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') })
|
||||
// }))
|
||||
// }
|
||||
},
|
||||
};
|
||||
|
||||
106
package.json
106
package.json
@@ -1,13 +1,16 @@
|
||||
{
|
||||
"name": "taroApp",
|
||||
"version": "1.0.0",
|
||||
"name": "jdt-user",
|
||||
"version": "3.0.0",
|
||||
"private": true,
|
||||
"description": "",
|
||||
"templateInfo": {
|
||||
"name": "vue3-NutUI4",
|
||||
"name": "jdt-user",
|
||||
"typescript": true,
|
||||
"css": "sass"
|
||||
},
|
||||
"taroConfig": {
|
||||
"version": "3.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build:weapp": "taro build --type weapp",
|
||||
"build:test": "taro build --type weapp --mode test",
|
||||
@@ -27,7 +30,16 @@
|
||||
"dev:rn": "npm run build:rn -- --watch",
|
||||
"dev:qq": "npm run build:qq -- --watch",
|
||||
"dev:jd": "npm run build:jd -- --watch",
|
||||
"dev:quickapp": "npm run build:quickapp -- --watch"
|
||||
"dev:quickapp": "npm run build:quickapp -- --watch",
|
||||
"lint": "eslint --ext .ts,.vue .",
|
||||
"lint:fix": "eslint --fix --ext .ts,.vue .",
|
||||
"lint:staged": "lint-staged",
|
||||
"prepare": "husky install",
|
||||
"preview": "vite preview",
|
||||
"cz": "cz",
|
||||
"lf": "npx prettier --write --end-of-line lf .",
|
||||
"build:weapp:prod:upload": "taro build --type weapp --upload --robot=1 --desc='正式环境'",
|
||||
"build:weapp:test:upload": "taro build --type weapp --upload --robot=2 --desc='测试环境' --mode test"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 3 versions",
|
||||
@@ -35,51 +47,69 @@
|
||||
"ios >= 8"
|
||||
],
|
||||
"author": "",
|
||||
"lint-staged": {
|
||||
"*.{ts,vue}": [
|
||||
"eslint --ext .ts,.vue .",
|
||||
"npx prettier --write --end-of-line lf ."
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "node_modules/cz-customizable"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.23.1",
|
||||
"@babel/runtime": "^7.23.2",
|
||||
"@nutui/icons-vue-taro": "^0.0.9",
|
||||
"@nutui/nutui-taro": "^4.1.6",
|
||||
"@nutui/nutui-taro": "^4.2.0",
|
||||
"@qiun/vue-ucharts": "2.5.0-20230101",
|
||||
"@tarojs/components": "3.6.16",
|
||||
"@tarojs/helper": "3.6.16",
|
||||
"@tarojs/plugin-framework-vue3": "3.6.16",
|
||||
"@tarojs/plugin-html": "3.6.16",
|
||||
"@tarojs/plugin-platform-alipay": "3.6.16",
|
||||
"@tarojs/plugin-platform-h5": "3.6.16",
|
||||
"@tarojs/plugin-platform-jd": "3.6.16",
|
||||
"@tarojs/plugin-platform-qq": "3.6.16",
|
||||
"@tarojs/plugin-platform-swan": "3.6.16",
|
||||
"@tarojs/plugin-platform-tt": "3.6.16",
|
||||
"@tarojs/plugin-platform-weapp": "3.6.16",
|
||||
"@tarojs/runtime": "3.6.16",
|
||||
"@tarojs/shared": "3.6.16",
|
||||
"@tarojs/taro": "3.6.16",
|
||||
"dayjs": "^1.11.10",
|
||||
"pinia": "^2.1.6",
|
||||
"vue": "^3.3.4"
|
||||
"@tarojs/components": "3.6.19",
|
||||
"@tarojs/helper": "3.6.19",
|
||||
"@tarojs/plugin-framework-vue3": "3.6.19",
|
||||
"@tarojs/plugin-html": "3.6.19",
|
||||
"@tarojs/plugin-platform-alipay": "3.6.19",
|
||||
"@tarojs/plugin-platform-h5": "3.6.19",
|
||||
"@tarojs/plugin-platform-jd": "3.6.19",
|
||||
"@tarojs/plugin-platform-qq": "3.6.19",
|
||||
"@tarojs/plugin-platform-swan": "3.6.19",
|
||||
"@tarojs/plugin-platform-tt": "3.6.19",
|
||||
"@tarojs/plugin-platform-weapp": "3.6.19",
|
||||
"@tarojs/runtime": "3.6.19",
|
||||
"@tarojs/shared": "3.6.19",
|
||||
"@tarojs/taro": "3.6.19",
|
||||
"dayjs": "^1.11.10",
|
||||
"pinia": "^2.1.7",
|
||||
"vue": "^3.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.0",
|
||||
"@tarojs/cli": "3.6.16",
|
||||
"@tarojs/taro-loader": "3.6.16",
|
||||
"@tarojs/webpack5-runner": "3.6.16",
|
||||
"@types/node": "^18.18.4",
|
||||
"@types/webpack-env": "^1.18.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||
"@typescript-eslint/parser": "^6.7.4",
|
||||
"@babel/core": "^7.23.3",
|
||||
"@commitlint/cli": "^18.2.0",
|
||||
"@commitlint/config-conventional": "^18.1.0",
|
||||
"@tarojs/cli": "3.6.19",
|
||||
"@tarojs/plugin-mini-ci": "^3.6.20",
|
||||
"@tarojs/taro-loader": "3.6.19",
|
||||
"@tarojs/webpack5-runner": "3.6.19",
|
||||
"@types/node": "^18.18.9",
|
||||
"@types/webpack-env": "^1.18.4",
|
||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
||||
"@typescript-eslint/parser": "^6.10.0",
|
||||
"@vue/babel-plugin-jsx": "^1.1.5",
|
||||
"@vue/compiler-sfc": "^3.3.4",
|
||||
"babel-preset-taro": "3.6.16",
|
||||
"@vue/compiler-sfc": "^3.3.8",
|
||||
"babel-preset-taro": "3.6.19",
|
||||
"commitizen": "^4.3.0",
|
||||
"css-loader": "3.4.2",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-config-taro": "3.6.16",
|
||||
"eslint-plugin-vue": "^9.17.0",
|
||||
"cz-customizable": "^7.0.0",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-taro": "3.6.19",
|
||||
"eslint-plugin-vue": "^9.18.1",
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^15.0.2",
|
||||
"style-loader": "1.3.0",
|
||||
"stylelint": "9.3.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.5",
|
||||
"unplugin-vue-components": "^0.23.0",
|
||||
"vue-loader": "^17.3.0",
|
||||
"webpack": "^5.88.2"
|
||||
"vue-loader": "^17.3.1",
|
||||
"webpack": "^5.89.0"
|
||||
}
|
||||
}
|
||||
|
||||
23470
pnpm-lock.yaml
generated
23470
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
27
private.wx7b3322daa2cf9c88.key
Normal file
27
private.wx7b3322daa2cf9c88.key
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEAqSpzKeiW3x8pHNgPNxnhx4wb5gyM21cJcwE5N+82iX0qMH2f
|
||||
QcU8WVyHvuYDK9d7kuzDFSbFNsUUeUB/Mqt2rzZcrGyO/6cRUaV8hjXClf4vZGvK
|
||||
gzMEExNzSIxwu+XYAur9FKm2h4J300PvmGD6zPGyr7pqYyzkSpltadRVsQebU1Cb
|
||||
f+gCmyzQSDY+dk+0cNmPeSJxXdbj6PJpmU+PVe9CoWmfapRqV3aEDWhTlOvTUQwf
|
||||
8bOoZn5r8a6H2W0HdNu0flMnoYWX/WNSTOF4izlaKOq7oRLnfjaefEO+WOUctzPE
|
||||
HpWw/k/LyMZJCiGZVdczfVSkR2Jq4iMC4arrDwIDAQABAoIBABeCgsbMQEt59SjB
|
||||
DjxGKI6m9imejOTez71f6ifP4vBwqLBchQmK87wnk+X/6WjqZY4hwWrrHHVkJlhD
|
||||
kmnkUnY/Q9nirGzzNwD10ryENCrMTKHUKSzapjJQfbETc4dphf/B0LJSc7+ZbjW6
|
||||
N04iDDj3TjIF4ksuLfwAHqiajd4wSpmiPFzwNFJSgNl86d3VuqnylPKDE0wG5yBf
|
||||
54AXkxrnzhL+cGCBazE+mYQoSihpDt0JP4zGb8W1AoWmXNoTlbP5AiTcf/1nza92
|
||||
HOd1IJN89YBgm707yEvY7pVsM5ftx8HlUtGopZq3DEBar3dTRT9+tGnLoOVyvbEF
|
||||
dvgV/oECgYEA0dNsZvHuAXIG62dgj+hLTtqxbdi0BaqChj2Y/bhLBbzjlScfiCJ/
|
||||
hczTSUMj1XAuYzZLXFHwEd7tZnXhhWOfALsFzodVoO6Zt5Y5lQ0Ed5d9GAg/JsDe
|
||||
Z1nn6WMH5c7+1gfpN+dzZVK/AWYZgYhIiaVFeiC5XxE4/mfFClIT0HECgYEAzmRv
|
||||
csA3WuuR9hSAl238g0bcDFjQS5I2tWJMRVDpA9m5A9tNCCIkh2Azn3LcGAnkPwbZ
|
||||
mCt0/Ck3hZPV7v9nuPAP9uOUC0+nGIaJSxcbZpH944meiVs3J+VQGcS4ubrEcaQ+
|
||||
KRT4fisnXI85/qc1r7XaziWgtCX7dvDHNFRQM38CgYEAuR2ZBp2siDPsbOTQaUXc
|
||||
ot4IKUxFTrZm3z4a6sUb0x0Zf657gCRHc2kIgxsr0xNcqYTuKa3Uaj/OHFYluAPy
|
||||
9LcLYXE+l3PJxBFSDfDlHwlUgM5NwMfpry6/jsUi45midHuYQwz8XskI4JgOKpxs
|
||||
uptH135lbL0KFlDAouFUv9ECgYADsa6A+knDWdYJ9oH6s+BCJUGJAwnvYFWUV4cP
|
||||
8ovJItt54zH0xE+tEJ676t1fnMW2DxRT8estHDu/K0838OBVYg6XF6mtriZKfRX1
|
||||
/xrhchl+OhdZVAWftC4D2A6KXHppokvuhk6QS4tvz6x1D18ZnwKkj+3Za5idn1+h
|
||||
YyTwVwKBgQCscqYudlBUyIuCnhxaaHNSwVDRvkYcncwIFGv8KMc9UChWehSj9mzb
|
||||
qmrsA1iifR1SW0vrGzNnzDo67BYNYhme3uNs5cfv6jmeMDj79eOIABJtYICSzHx2
|
||||
kzLzBtO804Q2CygVHae7qadf592Ex7b4CKfVVs4ZpqnknuoDKTWEGw==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
27
private.wxdd00d46fa6f07974.key
Normal file
27
private.wxdd00d46fa6f07974.key
Normal file
@@ -0,0 +1,27 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEA5MJntNKGXv+0z6Imaz0P/uZM57LiQwwmv6fLNsE8EzsW5JPC
|
||||
Bwvm1sWDJ670WxYQuXI2xEc4bXc4ACRdHwEPt1gJMbnXMCUh7HlzhRSh1mJQsMNP
|
||||
yVOFIz6lsAAnOrqHq2P7N1lOx8bIFwLr5HzeWYWj0XZWU4259JjJ+nn1EcBcaVtZ
|
||||
Txgn18K9MBSppc4vRQ/YEQF51LPNOs934vqHSnNEY0jW3HK+DXa5UPwT5Jj5RV16
|
||||
1aFiXAvxvY/DcaQKOx+CCA4QNa03ncmlLMLW1jZfQBijCnsrIfdMdsB/cJ2b1lpQ
|
||||
IiLZKiL8vBWR6tjdccD+XT62BMmfuCkpCJDAeQIDAQABAoIBAQCh4z4XBiFXm2gu
|
||||
xFah742hWwOzuLFMt424dhtmvWsxRNDXpAVcjTyoYxCFBdghmcTuJ/jAAJLbTNJR
|
||||
r2pDJbIkkuW2zgiOJskSG4T3+fjpyZvG7AFLvZJrtcr1ebZJZnXagZ/ntIj+8hrp
|
||||
xgSAJyoHen7LHg7LhHHDuli9rI8VJpDT5TZeXVXynD0bjMJ4z7MHA27ZO9nNk52P
|
||||
HML0pLYxs6+ubCL1IB5sy6gDO9eQUYzlVWEcDiVXBqlftjj100kbxvLVm0ydlwci
|
||||
SX2e/oV+iXPW0qiyOBjyc1Dp8uYxqYhvmdy7ajxL5f3mrepiydkI+lnYp9rnh9NO
|
||||
GfFvsQTNAoGBAPldj1JUXGB7TO5NAj0RiE2hkeQI6G3x3rDZz1DlkLs6oM7rAqds
|
||||
6EMMN7MONNQ53Qw0eFhuB/5gFH/EfDqufTjFIRiR9rcwa7NsYieewIfAksOJCyf1
|
||||
H3tfH+Wr0sQNIA/9tKzgzosSU1gcdCQFcmvzX+bUBowJ0oj0zSuskNeLAoGBAOrY
|
||||
fw2T7hQTJsiZ5y1GkhZ7Dq/l1qY3Mwodl339YzOxUFQyPDWC8UFHp9FZZ49CvG1Z
|
||||
1NUIN3fcIPORoKjCjdxvDh+PWUp0XV7Zp0yUtvehI8ex31U5Zc2nKfr3+ILhRS2b
|
||||
ZfoKX/3vQvItfpJfRlSZSpgt1Kl9XXE+O550eiiLAoGAXA2mt8y+oTtDJgE1n1eW
|
||||
ipnnYlfLfbK4824kcwebyxIUhO4Kd8XjY8Th1u6an/GQYU4JUxOjTcsoJhZhicQa
|
||||
I9fZpNlVS0DLsVuETH31MufrBdXUUXbSnVd7TeyFDKyPtneAuATxGjO0oqU2VonQ
|
||||
OHuKXorMs+t4VeiQyNuWSIsCgYBtjF4ADHBzZtehncEr6o589BxOyw0M7hTd9B3V
|
||||
xJxA4caR7/kMES/O/sj2rBjVyBCzhcL1OOb+/21TkSv7bP3VxOw2ppzFUXC4rRkQ
|
||||
bRLIgp95KK0ASU0G2KKJkqCXFNQ7SRERyUMr5i85XyV6y/y3u+YDBOX9xiAPkjMn
|
||||
YDgXrwKBgBlBiQxGI/JrzXgAoGox8sBmQcGplgnUL/QTJIiKugTbzfNA9STyW0E0
|
||||
j+Zcp2vf4wLZwOUMD74gGhtAUDMhOB+RlOUTFSHcyOAJ+Se9pZPNcaY6tqiZNeVS
|
||||
WsRqHJtoQkcUU2k+tCYXz2tib4R/FHgoL5QK/OkHRS61H481eWeZ
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"miniprogramRoot": "./dist",
|
||||
"projectname": "taroApp",
|
||||
"description": "",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": false,
|
||||
"enhance": false,
|
||||
"compileHotReLoad": false,
|
||||
"postcss": false,
|
||||
"minified": false
|
||||
},
|
||||
"compileType": "miniprogram"
|
||||
"miniprogramRoot": "./dist",
|
||||
"projectname": "taroApp",
|
||||
"description": "",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": false,
|
||||
"enhance": false,
|
||||
"compileHotReLoad": false,
|
||||
"postcss": false,
|
||||
"minified": false
|
||||
},
|
||||
"compileType": "miniprogram"
|
||||
}
|
||||
|
||||
@@ -1,40 +1,41 @@
|
||||
import request from '../utils/request'
|
||||
import request from "../utils/request";
|
||||
|
||||
// 订单核销
|
||||
export const orderVerify = (data: object) =>
|
||||
request('/user/cancelPointOrder', data, 'POST')
|
||||
request("/user/cancelPointOrder", data, "POST");
|
||||
|
||||
// 活动订单核销
|
||||
export const activeOrderVerify = (data: object) =>
|
||||
request('/user/cancelOrder', data, 'POST')
|
||||
request("/user/cancelOrder", data, "POST");
|
||||
|
||||
// 获取订单统计
|
||||
export const orderStatistics = (data: object) =>
|
||||
request('/store/order/count', data, 'POST')
|
||||
request("/store/order/count", data, "POST");
|
||||
|
||||
// 获取商家积分订单列表
|
||||
export const getJfOrderList = (data: object) =>
|
||||
request('/store/point/order', data, 'POST')
|
||||
request("/store/point/order", data, "POST");
|
||||
|
||||
// 获取商家活动订单列表
|
||||
export const getActiveOrderList = (data: object) =>
|
||||
request('/store/order', data, 'POST')
|
||||
|
||||
request("/store/order", data, "POST");
|
||||
|
||||
// 获取积分核销列表
|
||||
export const getJfVerifyList = (data: object) =>
|
||||
request('/point/order/details', data, 'POST')
|
||||
request("/point/order/details", data, "POST");
|
||||
|
||||
// 获取活动核销列表
|
||||
export const getActiveVerifyList = (data: object) =>
|
||||
request('/order/details', data, 'POST')
|
||||
request("/order/details", data, "POST");
|
||||
|
||||
// 增长率统计
|
||||
export const growthRate = (data: object) =>
|
||||
request('/store/date/count', data, 'POST')
|
||||
request("/store/date/count", data, "POST");
|
||||
|
||||
// 获取提现列表
|
||||
export const getWithdrawList = (data: object) => request('/store/withdraw', data, 'POST')
|
||||
export const getWithdrawList = (data: object) =>
|
||||
request("/store/withdraw", data, "POST");
|
||||
|
||||
// 获取提现列表
|
||||
export const addWithdraw = (data: object) => request('/store/withdraw/set', data, 'POST')
|
||||
export const addWithdraw = (data: object) =>
|
||||
request("/store/withdraw/set", data, "POST");
|
||||
|
||||
15
src/api/cart.ts
Normal file
15
src/api/cart.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import request from "../utils/request";
|
||||
|
||||
// 添加购物车
|
||||
export const addCart = (data: object) =>
|
||||
request("/goods/cart/add", data, "POST");
|
||||
|
||||
// 获取购物车
|
||||
export const getCart = (data: object) => request("/goods/cart", data, "POST");
|
||||
|
||||
// 清空购物车
|
||||
export const clearCart = (data: object) =>
|
||||
request("/goods/cart/removeAll", data, "POST");
|
||||
|
||||
// 获取全部购物车
|
||||
export const getAllCart = () => request("/goods/all/cart", {}, "POST");
|
||||
@@ -11,57 +11,57 @@ export const getCartList = () => request("/user/cart", {}, "POST");
|
||||
|
||||
// 获取积分商品详情
|
||||
export const getGoodsDetail = (data: object) =>
|
||||
request("/point/details", data, "POST");
|
||||
request("/point/details", data, "POST");
|
||||
|
||||
// 积分商品下单
|
||||
export const createOrder = (data: object) =>
|
||||
request("/point/place", data, "POST");
|
||||
request("/point/place", data, "POST");
|
||||
|
||||
// 确认付款
|
||||
export const payJfOrder = (data: object) =>
|
||||
request("/point/confirmOrder", data, "POST");
|
||||
request("/point/confirmOrder", data, "POST");
|
||||
|
||||
// 获取活动商品
|
||||
export const getActiveGoods = () => request("/goods", {}, "POST");
|
||||
|
||||
// 获取活动商品详情
|
||||
export const getActiveGoodsDetail = (data: object) =>
|
||||
request("/goods/details", data, "POST");
|
||||
request("/goods/details", data, "POST");
|
||||
|
||||
// 活动商品下单
|
||||
// 创建订单
|
||||
export const createActiveOrder = (data: object) =>
|
||||
request("/order/place", data, "POST");
|
||||
request("/order/place", data, "POST");
|
||||
|
||||
// 活动订单列表
|
||||
export const getActiveOrderList = (data: object) =>
|
||||
request("/user/order", data, "POST");
|
||||
request("/user/order", data, "POST");
|
||||
|
||||
// 获取分类列表
|
||||
export const getCategoryList = () => request("/goods/class", {}, "POST");
|
||||
|
||||
// 活动订单删除
|
||||
export const deleteActiveOrder = (data: object) =>
|
||||
request("/user/order/remove", data, "POST");
|
||||
request("/user/order/remove", data, "POST");
|
||||
|
||||
// 积分订单删除
|
||||
export const deleteJfOrder = (data: object) =>
|
||||
request("/user/point/remove", data, "POST");
|
||||
request("/user/point/remove", data, "POST");
|
||||
|
||||
// 获取分类商品
|
||||
export const getCategoryGoods = (data: object) =>
|
||||
request("/class/goods/list", data, "POST");
|
||||
request("/class/goods/list", data, "POST");
|
||||
|
||||
// 获取商家列表
|
||||
export const getMerList = (data: object) =>
|
||||
request("/store/list", data, "POST");
|
||||
request("/store/list", data, "POST");
|
||||
|
||||
// 获取商家商品分类
|
||||
export const getMerCategory = (data: object) =>
|
||||
request("/store/classify", data, "POST");
|
||||
request("/store/classify", data, "POST");
|
||||
|
||||
// 获取商家商品
|
||||
export const getGoodList = (data: object) =>
|
||||
request("/store/goods", data, "POST");
|
||||
request("/store/goods", data, "POST");
|
||||
|
||||
// // 获取活动商家列表
|
||||
// export const getHotMerList = (data: object) =>
|
||||
|
||||
7
src/api/home.ts
Normal file
7
src/api/home.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import request from "../utils/request";
|
||||
|
||||
// 获取商户分类
|
||||
export const getHomeList = () => request("/home/classify", {}, "POST");
|
||||
|
||||
// 获取商户子列表
|
||||
export const getHomeSubList = () => request("/home/all/classify", {}, "POST");
|
||||
@@ -2,8 +2,8 @@ import request from "@/utils/request";
|
||||
|
||||
// 订单支付
|
||||
export const payOrder = (data: object) =>
|
||||
request("/order/confirmOrder", data, "POST");
|
||||
request("/order/confirmOrder", data, "POST");
|
||||
|
||||
// 获取订单统计
|
||||
export const getOrderStatistics = (data: object) =>
|
||||
request("/user/order/count", data, "POST");
|
||||
request("/user/order/count", data, "POST");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import request from '@/utils/request'
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 商品列表
|
||||
export const productList = (data: object) =>
|
||||
request('/store/goods', data, 'POST')
|
||||
request("/store/goods", data, "POST");
|
||||
|
||||
// 商品添加
|
||||
export const addGood = (data: object) =>
|
||||
request('/store/goods/edit', data, 'POST')
|
||||
request("/store/goods/edit", data, "POST");
|
||||
|
||||
@@ -3,18 +3,18 @@ import request from "@/utils/request";
|
||||
// 登录
|
||||
export const login = (data: object) => request("/login", data, "POST");
|
||||
export const phoneLogin = (data: object) =>
|
||||
request("/phone/login", data, "POST");
|
||||
request("/phone/login", data, "POST");
|
||||
|
||||
// 获取用户信息
|
||||
// export const getUserInfo = () => request("/user/detail", {}, "GET");
|
||||
|
||||
// 获取短信验证码
|
||||
export const getVerifyCode = (data: object) =>
|
||||
request("/getSmsCode", data, "POST");
|
||||
request("/getSmsCode", data, "POST");
|
||||
|
||||
// 商家入驻申请
|
||||
export const applyMer = (data: object) =>
|
||||
request("/store/settle", data, "POST");
|
||||
request("/store/settle", data, "POST");
|
||||
|
||||
// 获取商家类型列表
|
||||
export const getMerTypeList = () => request("/store/getOther", {}, "POST");
|
||||
@@ -27,39 +27,48 @@ export const getBanner = () => request("/rotation", {}, "POST");
|
||||
|
||||
// 获取积分订单列表
|
||||
export const getIntegralOrderList = (data: object) =>
|
||||
request("/user/pointOrder", data, "POST");
|
||||
request("/user/pointOrder", data, "POST");
|
||||
|
||||
// 修改个人信息
|
||||
export const editPersonalInfo = (data: object) =>
|
||||
request("/user/editInfo", data, "POST");
|
||||
request("/user/editInfo", data, "POST");
|
||||
|
||||
// 积分明细
|
||||
export const getIntegralDetail = (data: object) =>
|
||||
request("/user/pulseRecord", data, "POST");
|
||||
request("/user/pulseRecord", data, "POST");
|
||||
|
||||
// 豆子明细
|
||||
export const getBeanDetail = (data: object) =>
|
||||
request("/user/pointRecord", data, "POST");
|
||||
request("/user/pointRecord", data, "POST");
|
||||
|
||||
// 授权手机号
|
||||
export const getPhone = (data: object) =>
|
||||
request("/user/getPhone", data, "POST");
|
||||
request("/user/getPhone", data, "POST");
|
||||
|
||||
// 获取推广积分明细
|
||||
export const getTGIntegralDetail = (data: object) =>
|
||||
request("/user/referee/point", data, "POST");
|
||||
request("/user/referee/point", data, "POST");
|
||||
|
||||
// 获取推广用户列表
|
||||
export const getTGUserList = (data: object) =>
|
||||
request("/user/referee/list", data, "POST");
|
||||
request("/user/referee/list", data, "POST");
|
||||
|
||||
// 绑定上级
|
||||
export const bindParent = (data: object) =>
|
||||
request("/user/bindCode", data, "POST");
|
||||
request("/user/bindCode", data, "POST");
|
||||
|
||||
// 获取推广码
|
||||
export const getRefereeCode = () => request("/user/promotion", {}, "POST");
|
||||
|
||||
// 取消订单返回积分
|
||||
export const qxOrder = (data: object) =>
|
||||
request("/user/point/off", data, "POST");
|
||||
request("/user/point/off", data, "POST");
|
||||
|
||||
// 用户签到
|
||||
export const userSign = () => request("/sign/user", {}, "POST");
|
||||
|
||||
// 获取签到记录
|
||||
export const getSignRecord = () => request("/sign/pulse/count", {}, "POST");
|
||||
// 获取赠送总记录
|
||||
export const getGiftRecord = (data: object) =>
|
||||
request("/user/giftPulseRecord", data, "POST");
|
||||
|
||||
@@ -1,109 +1,113 @@
|
||||
export default defineAppConfig({
|
||||
pages: [
|
||||
'pages/index/index',
|
||||
'pages/category/index',
|
||||
'pages/cart/index',
|
||||
'pages/user/index'
|
||||
pages: [
|
||||
"pages/index/index",
|
||||
"pages/category/index",
|
||||
"pages/cart/index",
|
||||
"pages/user/index",
|
||||
],
|
||||
subPackages: [
|
||||
{
|
||||
root: "pages/users",
|
||||
pages: [
|
||||
"order_list/index",
|
||||
"setting/index",
|
||||
"user_setting/index",
|
||||
"settled_mer/index",
|
||||
"order_list_detail/index",
|
||||
"account/index",
|
||||
"distribution/index",
|
||||
"distribution/integral/index",
|
||||
"distribution/userlist/index",
|
||||
"login/index",
|
||||
"bindPhone/index",
|
||||
],
|
||||
},
|
||||
{
|
||||
root: "pages/goods",
|
||||
pages: ["goods_detail/index", "order_create/index", "order_status/index"],
|
||||
},
|
||||
{
|
||||
root: "pages/admin",
|
||||
pages: [
|
||||
"verify/index",
|
||||
"order_manage/index",
|
||||
"order_manage/list/index",
|
||||
"order_manage/detail/index",
|
||||
"verify/verify_list/index",
|
||||
"statistics/index",
|
||||
"withdrawal/index",
|
||||
],
|
||||
},
|
||||
{
|
||||
root: "pages/product",
|
||||
pages: ["list/index", "addGoods/index"],
|
||||
},
|
||||
{
|
||||
root: "pages/game",
|
||||
pages: ["gamehome/index", "gamedetail/index", "gameview/index"],
|
||||
},
|
||||
{
|
||||
root: "pages/hotGoods",
|
||||
pages: ["index/index", "hot_list/index"],
|
||||
},
|
||||
{
|
||||
root: "pages/mer",
|
||||
pages: ["mer_detail/index"],
|
||||
},
|
||||
{
|
||||
root: "pages/marketing",
|
||||
pages: ["sign/index"],
|
||||
},
|
||||
{
|
||||
root: "pages/search",
|
||||
pages: ["index"],
|
||||
},
|
||||
],
|
||||
window: {
|
||||
backgroundTextStyle: "light",
|
||||
navigationBarBackgroundColor: "#fff",
|
||||
navigationBarTitleText: "WeChat",
|
||||
navigationBarTextStyle: "black",
|
||||
},
|
||||
tabBar: {
|
||||
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/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/user/index",
|
||||
iconPath: "static/tabbar/4-001.png",
|
||||
selectedIconPath: "static/tabbar/4-002.png",
|
||||
text: "我的",
|
||||
},
|
||||
],
|
||||
subPackages: [
|
||||
{
|
||||
root: 'pages/users',
|
||||
pages: [
|
||||
'order_list/index',
|
||||
'setting/index',
|
||||
'user_setting/index',
|
||||
'settled_mer/index',
|
||||
'order_list_detail/index',
|
||||
'account/index',
|
||||
'distribution/index',
|
||||
'distribution/integral/index',
|
||||
'distribution/userlist/index',
|
||||
'login/index',
|
||||
'bindPhone/index'
|
||||
]
|
||||
},
|
||||
{
|
||||
root: 'pages/goods',
|
||||
pages: [
|
||||
'goods_detail/index',
|
||||
'order_create/index',
|
||||
'order_status/index'
|
||||
]
|
||||
},
|
||||
{
|
||||
root: 'pages/admin',
|
||||
pages: [
|
||||
'verify/index',
|
||||
'order_manage/index',
|
||||
'order_manage/list/index',
|
||||
'order_manage/detail/index',
|
||||
'verify/verify_list/index',
|
||||
'statistics/index',
|
||||
'withdrawal/index'
|
||||
]
|
||||
},
|
||||
{
|
||||
root: 'pages/product',
|
||||
pages: ['list/index', 'addGoods/index']
|
||||
},
|
||||
{
|
||||
root: 'pages/game',
|
||||
pages: ['gamehome/index', 'gamedetail/index', 'gameview/index']
|
||||
},
|
||||
{
|
||||
root: 'pages/hotGoods',
|
||||
pages: ['index/index', 'hot_list/index']
|
||||
},
|
||||
{
|
||||
root: 'pages/mer',
|
||||
pages: ['mer_detail/index']
|
||||
}
|
||||
],
|
||||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
navigationBarBackgroundColor: '#fff',
|
||||
navigationBarTitleText: 'WeChat',
|
||||
navigationBarTextStyle: 'black'
|
||||
},
|
||||
permission: {
|
||||
"scope.userLocation": {
|
||||
desc: "你的位置信息将用于小程序位置接口的效果展示",
|
||||
},
|
||||
tabBar: {
|
||||
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/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/user/index',
|
||||
iconPath: 'static/tabbar/4-001.png',
|
||||
selectedIconPath: 'static/tabbar/4-002.png',
|
||||
text: '我的'
|
||||
}
|
||||
]
|
||||
},
|
||||
permission: {
|
||||
'scope.userLocation': {
|
||||
desc: '你的位置信息将用于小程序位置接口的效果展示'
|
||||
}
|
||||
},
|
||||
requiredBackgroundModes: ['audio', 'location'],
|
||||
// @ts-ignore
|
||||
requiredPrivateInfos: ['getLocation'],
|
||||
lazyCodeLoading: 'requiredComponents'
|
||||
});
|
||||
},
|
||||
requiredBackgroundModes: ["audio", "location"],
|
||||
// @ts-ignore
|
||||
requiredPrivateInfos: ["getLocation"],
|
||||
lazyCodeLoading: "requiredComponents",
|
||||
});
|
||||
|
||||
36
src/app.scss
36
src/app.scss
@@ -1,34 +1,20 @@
|
||||
@import "static/iconfont/iconfont.css";
|
||||
|
||||
//@font-face {
|
||||
// font-family: AlibabaPuHuiTi-3-55-Regular;
|
||||
// src: url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.eot)
|
||||
// format("embedded-opentype"),
|
||||
// url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.otf)
|
||||
// format("opentype"),
|
||||
// url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.ttf)
|
||||
// format("TrueType"),
|
||||
// url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff)
|
||||
// format("woff"),
|
||||
// url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff2)
|
||||
// format("woff2");
|
||||
//}
|
||||
|
||||
page {
|
||||
//font-family: AlibabaPuHuiTi-3-55-Regular, sans-serif;
|
||||
background-color: #f5f5f5;
|
||||
background-color: #f5f5f5;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.app {
|
||||
box-sizing: border-box;
|
||||
background-color: #f5f5f5;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
// 适配ios底部安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
box-sizing: border-box;
|
||||
background-color: #f5f5f5;
|
||||
height: 100vh;
|
||||
position: relative;
|
||||
// 适配ios底部安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
113
src/app.ts
113
src/app.ts
@@ -1,62 +1,67 @@
|
||||
import {createApp} from 'vue'
|
||||
import './app.scss'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { createApp } from "vue";
|
||||
import "./app.scss";
|
||||
import Taro from "@tarojs/taro";
|
||||
// import * as Sentry from "sentry-miniapp";
|
||||
|
||||
// 小程序场景值
|
||||
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049]
|
||||
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
|
||||
|
||||
// Sentry.init({
|
||||
// dsn: "https://47703e01ba4344b8b252c15e8fd980fd@sentry.io/1528228",
|
||||
// });
|
||||
|
||||
const App = createApp({
|
||||
onLaunch(options: {
|
||||
path: string;
|
||||
scene: number;
|
||||
query: object | any;
|
||||
shareTicket: string;
|
||||
referrerInfo: object | any;
|
||||
}) {
|
||||
// 检测更新
|
||||
if (Taro.canIUse('getUpdateManager') && options.scene !== 1154) {
|
||||
const updateManager = Taro.getUpdateManager()
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
if (res.hasUpdate) {
|
||||
updateManager.onUpdateFailed(function () {
|
||||
return Taro.showToast({
|
||||
title: '新版本下载失败',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
updateManager.onUpdateReady(function () {
|
||||
Taro.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本已经下载好,是否重启当前应用?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
updateManager.applyUpdate()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
updateManager.onUpdateFailed(function () {
|
||||
Taro.showModal({
|
||||
title: '发现新版本',
|
||||
content: '请删除当前小程序,重启搜索打开...'
|
||||
})
|
||||
})
|
||||
onLaunch(options: {
|
||||
path: string;
|
||||
scene: number;
|
||||
query: object | any;
|
||||
shareTicket: string;
|
||||
referrerInfo: object | any;
|
||||
}) {
|
||||
// 检测更新
|
||||
if (Taro.canIUse("getUpdateManager") && options.scene !== 1154) {
|
||||
const updateManager = Taro.getUpdateManager();
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
if (res.hasUpdate) {
|
||||
updateManager.onUpdateFailed(function () {
|
||||
return Taro.showToast({
|
||||
title: "新版本下载失败",
|
||||
icon: "none",
|
||||
});
|
||||
});
|
||||
updateManager.onUpdateReady(function () {
|
||||
Taro.showModal({
|
||||
title: "更新提示",
|
||||
content: "新版本已经下载好,是否重启当前应用?",
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
updateManager.applyUpdate();
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
const options = Taro.getCurrentInstance().router as any
|
||||
if (scenes.includes(options.scene)) {
|
||||
if (options.query.scene) {
|
||||
Taro.showToast({
|
||||
title: '已检测到推荐人',
|
||||
icon: 'none'
|
||||
})
|
||||
Taro.setStorageSync('bind_id', options.query.scene)
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
updateManager.onUpdateFailed(function () {
|
||||
Taro.showModal({
|
||||
title: "发现新版本",
|
||||
content: "请删除当前小程序,重启搜索打开...",
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
const options = Taro.getCurrentInstance().router as any;
|
||||
if (scenes.includes(options.scene)) {
|
||||
if (options.query.scene) {
|
||||
Taro.showToast({
|
||||
title: "已检测到推荐人",
|
||||
icon: "none",
|
||||
});
|
||||
Taro.setStorageSync("bind_id", options.query.scene);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export default App
|
||||
export default App;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<nut-overlay :visible="visible" :close-on-click-overlay="false">
|
||||
<view class="text">
|
||||
<view>授权提醒</view>
|
||||
<view style="margin-top: 10px"
|
||||
>请授权头像信息,以便为您提供更好的服务!
|
||||
</view>
|
||||
<view class="bom">
|
||||
<view class="btn b" @click="onCancel">随便逛逛</view>
|
||||
<view class="btn a" @tap="onOk">去授权</view>
|
||||
</view>
|
||||
</view>
|
||||
</nut-overlay>
|
||||
<nut-overlay :visible="visible" :close-on-click-overlay="false">
|
||||
<view class="text">
|
||||
<view>授权提醒</view>
|
||||
<view style="margin-top: 10px"
|
||||
>请授权头像信息,以便为您提供更好的服务!
|
||||
</view>
|
||||
<view class="bom">
|
||||
<view class="btn b" @click="onCancel">随便逛逛</view>
|
||||
<view class="btn a" @tap="onOk">去授权</view>
|
||||
</view>
|
||||
</view>
|
||||
</nut-overlay>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -19,92 +19,92 @@ import Taro from "@tarojs/taro";
|
||||
import { login } from "@/api/user";
|
||||
|
||||
defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:visible", "ok"]);
|
||||
|
||||
const onCancel = () => {
|
||||
emit("update:visible", false);
|
||||
emit("update:visible", false);
|
||||
};
|
||||
|
||||
const onOk = () => {
|
||||
Taro.showLoading({
|
||||
title: "正在授权中",
|
||||
mask: true,
|
||||
});
|
||||
Taro.getUserProfile({
|
||||
desc: "完善用户资料",
|
||||
success: async (user) => {
|
||||
Taro.login({
|
||||
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);
|
||||
},
|
||||
complete: () => {
|
||||
Taro.hideLoading();
|
||||
},
|
||||
Taro.showLoading({
|
||||
title: "正在授权中",
|
||||
mask: true,
|
||||
});
|
||||
Taro.getUserProfile({
|
||||
desc: "完善用户资料",
|
||||
success: async (user) => {
|
||||
Taro.login({
|
||||
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);
|
||||
},
|
||||
complete: () => {
|
||||
Taro.hideLoading();
|
||||
Taro.hideLoading();
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
},
|
||||
complete: () => {
|
||||
Taro.hideLoading();
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.text {
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
width: 500px;
|
||||
padding: 20px;
|
||||
margin: auto;
|
||||
transform: translateY(150%);
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
width: 500px;
|
||||
padding: 20px;
|
||||
margin: auto;
|
||||
transform: translateY(150%);
|
||||
border-radius: 10px;
|
||||
|
||||
.bom {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
.bom {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
|
||||
.btn {
|
||||
width: 150px;
|
||||
padding: 10px;
|
||||
border-radius: 15px;
|
||||
color: #fff;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.a {
|
||||
background-color: #ff5000;
|
||||
}
|
||||
|
||||
.b {
|
||||
background-color: rgba(255, 80, 0, 0.5);
|
||||
}
|
||||
.btn {
|
||||
width: 150px;
|
||||
padding: 10px;
|
||||
border-radius: 15px;
|
||||
color: #fff;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.a {
|
||||
background-color: #ff5000;
|
||||
}
|
||||
|
||||
.b {
|
||||
background-color: rgba(255, 80, 0, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
289
src/components/Cart.vue
Normal file
289
src/components/Cart.vue
Normal file
@@ -0,0 +1,289 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { addCart, getCart, clearCart } from "@/api/cart";
|
||||
import { Del2 } from "@nutui/icons-vue-taro";
|
||||
import { createActiveOrder } from "@/api/goods";
|
||||
import Pay from "@/components/Pay.vue";
|
||||
|
||||
interface CardList {
|
||||
name: string;
|
||||
cover: string;
|
||||
bid: string;
|
||||
gid: string;
|
||||
number: string;
|
||||
price: number;
|
||||
exchange: number;
|
||||
}
|
||||
|
||||
const show = ref(false);
|
||||
|
||||
const props = defineProps({
|
||||
merInfo: {
|
||||
required: true,
|
||||
type: Object,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["updateCart"]);
|
||||
|
||||
const openModal = async () => {
|
||||
await get_cart_list();
|
||||
if (card_list.value.length === 0) return;
|
||||
show.value = !show.value;
|
||||
};
|
||||
|
||||
const add_cart = async (item: CardList, num: number = 1) => {
|
||||
try {
|
||||
const res = await addCart({
|
||||
Bid: item.bid,
|
||||
Gid: item.gid,
|
||||
Number: Number(num),
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
});
|
||||
await get_cart_list();
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const onAdd = async (item: CardList) => {
|
||||
await add_cart(item, Number(item.number) + 1);
|
||||
};
|
||||
|
||||
const onReduce = async (item: CardList) => {
|
||||
await add_cart(item, Number(item.number) - 1);
|
||||
if (card_list.value.length === 0) show.value = false;
|
||||
};
|
||||
|
||||
const card_list = ref<CardList[]>([]);
|
||||
|
||||
const cartInfo = ref({
|
||||
count: 0,
|
||||
price: 0,
|
||||
exchange: 0,
|
||||
});
|
||||
|
||||
const get_cart_list = async () => {
|
||||
try {
|
||||
const res = await getCart({
|
||||
Bid: props.merInfo.bid,
|
||||
});
|
||||
card_list.value = res.data.data || [];
|
||||
cartInfo.value = {
|
||||
count: 0,
|
||||
price: 0,
|
||||
exchange: 0,
|
||||
};
|
||||
card_list.value.forEach((item: CardList) => {
|
||||
cartInfo.value.count += Number(item.number);
|
||||
cartInfo.value.price += Number(item.price);
|
||||
cartInfo.value.exchange += Number(item.exchange);
|
||||
});
|
||||
emit("updateCart", res.data.data || []);
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const clear_cart = async () => {
|
||||
try {
|
||||
await clearCart({
|
||||
Bid: props.merInfo.bid,
|
||||
});
|
||||
await get_cart_list();
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
show.value = false;
|
||||
};
|
||||
|
||||
const isShowPay = ref(false);
|
||||
|
||||
const orderData = ref<any>([]);
|
||||
|
||||
const closePay = (val: boolean) => {
|
||||
isShowPay.value = val;
|
||||
orderData.value = [];
|
||||
Taro.redirectTo({
|
||||
url: "/pages/users/order_list/index?type=0",
|
||||
});
|
||||
};
|
||||
|
||||
const create_order = async () => {
|
||||
try {
|
||||
const { data: res } = await createActiveOrder({
|
||||
Bid: [props.merInfo.bid],
|
||||
});
|
||||
if (res.oid) {
|
||||
orderData.value = res.oid;
|
||||
isShowPay.value = true;
|
||||
}
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
// await get_cart_list();
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
add_cart,
|
||||
get_cart_list,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<view class="cart" @click.stop="openModal">
|
||||
<view class="container">
|
||||
<view>购物车数量: {{ cartInfo.count }}</view>
|
||||
<view v-if="cartInfo.count > 0">
|
||||
<text>总金额: {{ cartInfo.price.toFixed(2) }}</text
|
||||
>,
|
||||
<text>总积分: {{ cartInfo.exchange.toFixed(2) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="cartInfo.count > 0" class="payBtn" @click.stop="create_order"
|
||||
>立即结算</view
|
||||
>
|
||||
</view>
|
||||
<!-- 购物车弹窗 -->
|
||||
<nut-popup
|
||||
:style="{ padding: '20rpx' }"
|
||||
round
|
||||
position="bottom"
|
||||
z-index="1"
|
||||
:catch-move="true"
|
||||
:safe-area-inset-bottom="true"
|
||||
v-model:visible="show"
|
||||
>
|
||||
<view class="list-header">
|
||||
<view class="left" @click.stop="clear_cart">
|
||||
<Del2 color="#666666" />
|
||||
<text style="color: #666666">清空购物车</text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view :scroll-y="true" class="cart-list">
|
||||
<view class="item" v-for="(item, index) in card_list" :key="index">
|
||||
<view class="left">
|
||||
<image :src="item.cover" />
|
||||
<view class="center">
|
||||
<view class="name">{{ item.name }}</view>
|
||||
<view class="price">
|
||||
<view>现金:{{ item.price }}</view>
|
||||
<view>积分:{{ item.exchange }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-input-number
|
||||
v-model="item.number"
|
||||
readonly
|
||||
:min="-1"
|
||||
@add="() => onAdd(item)"
|
||||
@reduce="() => onReduce(item)"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view style="height: 140rpx"></view>
|
||||
</nut-popup>
|
||||
<!-- 支付 -->
|
||||
<Pay
|
||||
:is-show-pay="isShowPay"
|
||||
v-model:jfInfo="orderData"
|
||||
@closePay="closePay"
|
||||
@successPay="closePay"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
$h-border-radius: 50rpx;
|
||||
|
||||
.cart {
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 9999;
|
||||
width: 95%;
|
||||
background-color: red;
|
||||
border-radius: $h-border-radius;
|
||||
color: #fff;
|
||||
height: 100rpx;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.container {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.payBtn {
|
||||
width: 180rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
text-align: center;
|
||||
background-color: #000;
|
||||
border-radius: 0 $h-border-radius $h-border-radius 0;
|
||||
}
|
||||
}
|
||||
|
||||
.list-header {
|
||||
margin: 15rpx 0;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.cart-list {
|
||||
height: 290rpx;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-bottom: 10rpx;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
|
||||
image {
|
||||
width: 130rpx;
|
||||
height: 130rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.center {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
justify-content: space-between;
|
||||
|
||||
.price {
|
||||
color: red;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
152
src/components/MerList.vue
Normal file
152
src/components/MerList.vue
Normal file
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<view class="goodBox">
|
||||
<view
|
||||
class="good"
|
||||
v-for="item in merdata"
|
||||
:key="item.ID"
|
||||
@click.stop="toMerDetails(item)"
|
||||
>
|
||||
<image :src="item.head_photo" />
|
||||
<view class="good-text-box">
|
||||
<text class="good-text">{{ item.name }}</text>
|
||||
<text style="color: #999"
|
||||
>距离我{{
|
||||
calculateDistance(
|
||||
userLocalNum.t,
|
||||
userLocalNum.l,
|
||||
Number(item.lat),
|
||||
Number(item.lon)
|
||||
)
|
||||
}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { calculateDistance } from "@/utils";
|
||||
import { bindParent } from "@/api/user";
|
||||
import { getMerList } from "@/api/goods";
|
||||
|
||||
const props = defineProps({
|
||||
classId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
Taro.useDidShow(async () => {
|
||||
await get_mer_list();
|
||||
if (Taro.getStorageSync("token") && Taro.getStorageSync("bind_id")) {
|
||||
try {
|
||||
const res = await bindParent({
|
||||
uid: Taro.getStorageSync("bind_id"),
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
});
|
||||
Taro.removeStorageSync("bind_id");
|
||||
} catch (error) {
|
||||
Taro.removeStorageSync("bind_id");
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
interface MerData {
|
||||
ID: number;
|
||||
name: string;
|
||||
head_photo: string;
|
||||
lat: string;
|
||||
lon: string;
|
||||
}
|
||||
|
||||
const merdata = ref<MerData[]>([]);
|
||||
|
||||
const userLocalNum = ref({
|
||||
l: 0,
|
||||
t: 0,
|
||||
});
|
||||
|
||||
const get_mer_list = async () => {
|
||||
Taro.getLocation({
|
||||
type: "wgs84",
|
||||
success: (res) => {
|
||||
userLocalNum.value.l = res.longitude;
|
||||
userLocalNum.value.t = res.latitude;
|
||||
},
|
||||
});
|
||||
|
||||
const res = await getMerList({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
class_id: props.classId,
|
||||
});
|
||||
merdata.value = res.data.data;
|
||||
};
|
||||
|
||||
const toMerDetails = (item: any) => {
|
||||
Taro.setStorageSync("mer_info", item);
|
||||
Taro.navigateTo({
|
||||
url: `/pages/mer/mer_detail/index`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.goodBox {
|
||||
display: flex;
|
||||
padding: 20px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
.good {
|
||||
width: 340px;
|
||||
background-color: #fff;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 10px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
border-top-right-radius: 10px;
|
||||
border-top-left-radius: 10px;
|
||||
}
|
||||
|
||||
.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: 1;
|
||||
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>
|
||||
@@ -1,181 +1,189 @@
|
||||
<template>
|
||||
<nut-popup
|
||||
position="bottom"
|
||||
closeable
|
||||
round
|
||||
safe-area-inset-bottom
|
||||
:close-on-click-overlay="false"
|
||||
:style="{ height: 'auto' }"
|
||||
: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="`剩余积分:${info.integral || 0}`"
|
||||
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' }"
|
||||
:visible="isShowPay"
|
||||
@click-close-icon="closePay"
|
||||
>
|
||||
<view class="div">
|
||||
<view style="text-align: center">支付方式</view>
|
||||
<nut-cell-group
|
||||
:style="{ margin: interval ? '40rpx 0 150rpx 0' : '40rpx 0' }"
|
||||
>
|
||||
<nut-cell
|
||||
title="微信支付"
|
||||
desc="使用微信快捷支付"
|
||||
is-link
|
||||
@click="goPay(1)"
|
||||
>
|
||||
<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
|
||||
title="积分支付"
|
||||
:desc="`剩余积分:${info.integral || 0}`"
|
||||
is-link
|
||||
@click="goPay(2)"
|
||||
>
|
||||
<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 {ref, watch} from 'vue'
|
||||
import {IconFont} from '@nutui/icons-vue-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {payOrder} from '@/api/order'
|
||||
import {payJfOrder} from '@/api/goods'
|
||||
import {getPersonalInfo} from '@/api/user'
|
||||
import { ref, watch } from "vue";
|
||||
import { IconFont } from "@nutui/icons-vue-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { payOrder } from "@/api/order";
|
||||
import { getPersonalInfo } from "@/api/user";
|
||||
|
||||
const prop = defineProps({
|
||||
isShowPay: {
|
||||
required: true,
|
||||
type: Boolean,
|
||||
default: false
|
||||
interval: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isShowPay: {
|
||||
required: true,
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
jfInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
},
|
||||
payType: {
|
||||
required: true,
|
||||
type: String,
|
||||
default: 'wx'
|
||||
},
|
||||
jfInfo: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
OrderType: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['closePay', 'successPay'])
|
||||
const emit = defineEmits(["closePay", "successPay"]);
|
||||
|
||||
const info = ref<{ integral?: any }>({})
|
||||
const info = ref<{ integral?: any }>({});
|
||||
|
||||
watch(
|
||||
() => prop.isShowPay,
|
||||
() => {
|
||||
getInfo()
|
||||
}
|
||||
)
|
||||
() => prop.isShowPay,
|
||||
() => {
|
||||
getInfo();
|
||||
}
|
||||
);
|
||||
|
||||
const getInfo = async () => {
|
||||
try {
|
||||
const res = await getPersonalInfo()
|
||||
info.value = res.data.data
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
throw error
|
||||
}
|
||||
}
|
||||
try {
|
||||
const res = await getPersonalInfo();
|
||||
info.value = res.data.data;
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const goPay = async () => {
|
||||
console.log(prop.jfInfo)
|
||||
if (!prop.jfInfo)
|
||||
return Taro.showToast({
|
||||
title: '未获取到订单信息',
|
||||
icon: 'none'
|
||||
})
|
||||
if (prop.payType === 'wx') {
|
||||
try {
|
||||
const {data} = await payOrder({
|
||||
oid: prop.jfInfo.oid
|
||||
})
|
||||
Taro.requestPayment({
|
||||
timeStamp: data.data.timeStamp,
|
||||
nonceStr: data.data.nonceStr,
|
||||
package: data.data.package,
|
||||
signType: data.data.signType,
|
||||
paySign: data.data.paySign,
|
||||
success: function () {
|
||||
Taro.showToast({
|
||||
title: '支付成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
Taro.navigateTo({
|
||||
url: '/pages/hotGoods/hot_list/index'
|
||||
})
|
||||
},
|
||||
fail: function () {
|
||||
Taro.showToast({
|
||||
title: '支付失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
emit('closePay', false)
|
||||
} catch (e) {
|
||||
const goPay = async (type: number) => {
|
||||
console.log(prop);
|
||||
if (!prop.jfInfo)
|
||||
return Taro.showToast({
|
||||
title: "未获取到订单信息",
|
||||
icon: "none",
|
||||
});
|
||||
try {
|
||||
const { data } = await payOrder({
|
||||
oid: prop.jfInfo,
|
||||
OrderType: prop.OrderType,
|
||||
PayType: type,
|
||||
});
|
||||
if (data.data) {
|
||||
// 1微信支付 2积分支付
|
||||
if (type === 1) {
|
||||
Taro.requestPayment({
|
||||
timeStamp: data.data.timeStamp,
|
||||
nonceStr: data.data.nonceStr,
|
||||
package: data.data.package,
|
||||
signType: data.data.signType,
|
||||
paySign: data.data.paySign,
|
||||
success: function () {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
throw e
|
||||
}
|
||||
} else {
|
||||
const res = await payJfOrder(prop.jfInfo)
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
emit("successPay", false);
|
||||
},
|
||||
fail: function () {
|
||||
Taro.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
emit("closePay", false);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
Taro.navigateTo({
|
||||
url: '/pages/users/order_list/index?type=0'
|
||||
})
|
||||
emit('closePay', false)
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
emit("successPay", false);
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: "未知异常",
|
||||
icon: "none",
|
||||
});
|
||||
emit("closePay", false);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
// emit("closePay", false);
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
const closePay = () => {
|
||||
Taro.showToast({
|
||||
title: '取消支付',
|
||||
icon: 'none'
|
||||
})
|
||||
emit('closePay', false)
|
||||
}
|
||||
Taro.showToast({
|
||||
title: "取消支付",
|
||||
icon: "none",
|
||||
});
|
||||
emit("closePay", false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.nut-popup {
|
||||
.nut-popup__container {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.nut-popup__container {
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.div {
|
||||
padding: 20px;
|
||||
// text-align: center;
|
||||
padding: 20rpx;
|
||||
--nut-cell-box-shadow: none;
|
||||
|
||||
.nut-cell {
|
||||
align-items: center;
|
||||
}
|
||||
.nut-cell {
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
63
src/components/Popup.vue
Normal file
63
src/components/Popup.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { userSign } from "@/api/user";
|
||||
|
||||
const show = ref(false);
|
||||
|
||||
Taro.useLoad(async () => {
|
||||
if (Taro.getStorageSync("token")) show.value = true;
|
||||
// const res = await getSignRecord()
|
||||
// console.log(res)
|
||||
});
|
||||
|
||||
const toSign = async () => {
|
||||
try {
|
||||
await userSign();
|
||||
Taro.showToast({
|
||||
title: "签到成功",
|
||||
icon: "none",
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
show.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nut-overlay
|
||||
v-model:visible="show"
|
||||
:lock-scroll="true"
|
||||
:close-on-click-overlay="false"
|
||||
>
|
||||
<view class="wrapper">
|
||||
<view @click.stop="toSign">
|
||||
<image class="image" src="../static/index/poppBg.png" />
|
||||
</view>
|
||||
<view @click.stop="show = false">
|
||||
<image class="icon" src="../static/index/close.png" />
|
||||
</view>
|
||||
</view>
|
||||
</nut-overlay>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.wrapper {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 500px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
</style>
|
||||
@@ -3,81 +3,81 @@
|
||||
<view class="page-body">
|
||||
<view class="wrapper">
|
||||
<view
|
||||
class="toolbar"
|
||||
@click="format"
|
||||
style="max-height: 240px; overflow-y: auto"
|
||||
class="toolbar"
|
||||
@click="format"
|
||||
style="max-height: 240px; overflow-y: auto"
|
||||
>
|
||||
<!-- 加粗 -->
|
||||
<view
|
||||
:class="data.formats.bold ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitijiacu"
|
||||
data-name="bold"
|
||||
:class="data.formats.bold ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitijiacu"
|
||||
data-name="bold"
|
||||
></view>
|
||||
<!-- 斜体 -->
|
||||
<view
|
||||
:class="data.formats.italic ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitixieti"
|
||||
data-name="italic"
|
||||
:class="data.formats.italic ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitixieti"
|
||||
data-name="italic"
|
||||
></view>
|
||||
<!-- 下划线 -->
|
||||
<view
|
||||
:class="data.formats.underline ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitixiahuaxian"
|
||||
data-name="underline"
|
||||
:class="data.formats.underline ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitixiahuaxian"
|
||||
data-name="underline"
|
||||
></view>
|
||||
<!-- 对齐方式:左 -->
|
||||
<view
|
||||
:class="data.formats.align === 'left' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zuoduiqi"
|
||||
data-name="align"
|
||||
data-value="left"
|
||||
:class="data.formats.align === 'left' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zuoduiqi"
|
||||
data-name="align"
|
||||
data-value="left"
|
||||
></view>
|
||||
<!-- 对齐方式:居中 -->
|
||||
<view
|
||||
:class="data.formats.align === 'center' ? 'ql-active' : ''"
|
||||
class="iconfont icon-juzhongduiqi"
|
||||
data-name="align"
|
||||
data-value="center"
|
||||
:class="data.formats.align === 'center' ? 'ql-active' : ''"
|
||||
class="iconfont icon-juzhongduiqi"
|
||||
data-name="align"
|
||||
data-value="center"
|
||||
></view>
|
||||
<!-- 对齐方式:右 -->
|
||||
<view
|
||||
:class="data.formats.align === 'right' ? 'ql-active' : ''"
|
||||
class="iconfont icon-youduiqi"
|
||||
data-name="align"
|
||||
data-value="right"
|
||||
:class="data.formats.align === 'right' ? 'ql-active' : ''"
|
||||
class="iconfont icon-youduiqi"
|
||||
data-name="align"
|
||||
data-value="right"
|
||||
></view>
|
||||
<!-- 对齐方式:两侧 -->
|
||||
<view
|
||||
:class="data.formats.align === 'justify' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zuoyouduiqi"
|
||||
data-name="align"
|
||||
data-value="justify"
|
||||
:class="data.formats.align === 'justify' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zuoyouduiqi"
|
||||
data-name="align"
|
||||
data-value="justify"
|
||||
></view>
|
||||
<!-- 有序排列 -->
|
||||
<view
|
||||
:class="data.formats.list === 'ordered' ? 'ql-active' : ''"
|
||||
class="iconfont icon-youxupailie"
|
||||
data-name="list"
|
||||
data-value="ordered"
|
||||
:class="data.formats.list === 'ordered' ? 'ql-active' : ''"
|
||||
class="iconfont icon-youxupailie"
|
||||
data-name="list"
|
||||
data-value="ordered"
|
||||
></view>
|
||||
<!-- 无序排列 -->
|
||||
<view
|
||||
:class="data.formats.list === 'bullet' ? 'ql-active' : ''"
|
||||
class="iconfont icon-wuxupailie"
|
||||
data-name="list"
|
||||
data-value="bullet"
|
||||
:class="data.formats.list === 'bullet' ? 'ql-active' : ''"
|
||||
class="iconfont icon-wuxupailie"
|
||||
data-name="list"
|
||||
data-value="bullet"
|
||||
></view>
|
||||
<!-- 取消缩进 -->
|
||||
<view
|
||||
class="iconfont icon-outdent"
|
||||
data-name="indent"
|
||||
data-value="-1"
|
||||
class="iconfont icon-outdent"
|
||||
data-name="indent"
|
||||
data-value="-1"
|
||||
></view>
|
||||
<!-- 缩进 -->
|
||||
<view
|
||||
class="iconfont icon-indent"
|
||||
data-name="indent"
|
||||
data-value="+1"
|
||||
class="iconfont icon-indent"
|
||||
data-name="indent"
|
||||
data-value="+1"
|
||||
></view>
|
||||
<!-- 添加分割线 -->
|
||||
<view class="iconfont icon-fengexian" @click="insertDivider"></view>
|
||||
@@ -85,37 +85,37 @@
|
||||
<view class="iconfont icon-image" @click="insertImage"></view>
|
||||
<!-- 设置标题 -->
|
||||
<view
|
||||
:class="data.formats.header === 3 ? 'ql-active' : ''"
|
||||
class="iconfont icon-H"
|
||||
data-name="header"
|
||||
:data-value="3"
|
||||
:class="data.formats.header === 3 ? 'ql-active' : ''"
|
||||
class="iconfont icon-H"
|
||||
data-name="header"
|
||||
:data-value="3"
|
||||
></view>
|
||||
<!-- 下标 -->
|
||||
<view
|
||||
:class="data.formats.script === 'sub' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitixiabiao"
|
||||
data-name="script"
|
||||
data-value="sub"
|
||||
:class="data.formats.script === 'sub' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitixiabiao"
|
||||
data-name="script"
|
||||
data-value="sub"
|
||||
></view>
|
||||
<!-- 上标 -->
|
||||
<view
|
||||
:class="data.formats.script === 'super' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitishangbiao"
|
||||
data-name="script"
|
||||
data-value="super"
|
||||
:class="data.formats.script === 'super' ? 'ql-active' : ''"
|
||||
class="iconfont icon-zitishangbiao"
|
||||
data-name="script"
|
||||
data-value="super"
|
||||
></view>
|
||||
<view class="iconfont icon-undo" @click="undo"></view>
|
||||
<view class="iconfont icon-redo" @click="redo"></view>
|
||||
</view>
|
||||
<view class="editor-wrapper">
|
||||
<editor
|
||||
id="editor"
|
||||
class="ql-container"
|
||||
:placeholder="data.placeholder"
|
||||
@statuschange="onStatusChange"
|
||||
:show-img-resize="true"
|
||||
@ready="onEditorReady"
|
||||
@input="getCtx"
|
||||
id="editor"
|
||||
class="ql-container"
|
||||
:placeholder="data.placeholder"
|
||||
@statuschange="onStatusChange"
|
||||
:show-img-resize="true"
|
||||
@ready="onEditorReady"
|
||||
@input="getCtx"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
@@ -124,116 +124,115 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {reactive} from 'vue'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {BASE_URL} from '@/utils/request'
|
||||
import { reactive } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { BASE_URL } from "@/utils/request";
|
||||
|
||||
const {content} = defineProps<{
|
||||
const { content } = defineProps<{
|
||||
content: string;
|
||||
}>()
|
||||
}>();
|
||||
|
||||
let emits = defineEmits(['input'])
|
||||
let emits = defineEmits(["input"]);
|
||||
|
||||
const data = reactive<any>({
|
||||
editorCtx: '',
|
||||
editorCtx: "",
|
||||
readOnly: false,
|
||||
placeholder: '请输入商品详情...',
|
||||
richText: '',
|
||||
formats: {}
|
||||
})
|
||||
placeholder: "请输入商品详情...",
|
||||
richText: "",
|
||||
formats: {},
|
||||
});
|
||||
|
||||
function onEditorReady() {
|
||||
// 富文本节点渲染完成
|
||||
Taro
|
||||
.createSelectorQuery()
|
||||
.select('#editor')
|
||||
.context((res) => {
|
||||
data.editorCtx = res.context
|
||||
// 初始化数据
|
||||
if (content) {
|
||||
data.editorCtx.setContents({
|
||||
html: content
|
||||
})
|
||||
}
|
||||
})
|
||||
.exec()
|
||||
Taro.createSelectorQuery()
|
||||
.select("#editor")
|
||||
.context((res) => {
|
||||
data.editorCtx = res.context;
|
||||
// 初始化数据
|
||||
if (content) {
|
||||
data.editorCtx.setContents({
|
||||
html: content,
|
||||
});
|
||||
}
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
|
||||
// 失去焦点时,获取富文本的内容
|
||||
function getCtx(e: { detail: { html: any; }; }) {
|
||||
data.richText = e.detail.html
|
||||
emits('input', e.detail.html)
|
||||
function getCtx(e: { detail: { html: any } }) {
|
||||
data.richText = e.detail.html;
|
||||
emits("input", e.detail.html);
|
||||
}
|
||||
|
||||
// 撤销操作
|
||||
function undo() {
|
||||
data.editorCtx.undo()
|
||||
data.editorCtx.undo();
|
||||
}
|
||||
|
||||
// 复原操作
|
||||
function redo() {
|
||||
data.editorCtx.redo()
|
||||
data.editorCtx.redo();
|
||||
}
|
||||
|
||||
//修改样式
|
||||
function format(e: { target: { dataset: { name: any; value: any; }; }; }) {
|
||||
function format(e: { target: { dataset: { name: any; value: any } } }) {
|
||||
// console.log("format", e.target.dataset);
|
||||
let {name, value} = e.target.dataset
|
||||
if (!name) return
|
||||
data.editorCtx.format(name, value)
|
||||
let { name, value } = e.target.dataset;
|
||||
if (!name) return;
|
||||
data.editorCtx.format(name, value);
|
||||
}
|
||||
|
||||
//通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式
|
||||
function onStatusChange(e: { detail: any; }) {
|
||||
data.formats = e.detail
|
||||
function onStatusChange(e: { detail: any }) {
|
||||
data.formats = e.detail;
|
||||
}
|
||||
|
||||
// 插入分割线
|
||||
function insertDivider() {
|
||||
data.editorCtx.insertDivider()
|
||||
data.editorCtx.insertDivider();
|
||||
}
|
||||
|
||||
// 插入图片
|
||||
function insertImage() {
|
||||
Taro.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
sizeType: ["original", "compressed"],
|
||||
sourceType: ["album", "camera"],
|
||||
success: (res) => {
|
||||
// 上传图片的逻辑各有不同,自行调整即可
|
||||
Taro.uploadFile({
|
||||
url: `${BASE_URL}/upload`,
|
||||
name: 'file',
|
||||
header: {token: Taro.getStorageSync('token')},
|
||||
name: "file",
|
||||
header: { token: Taro.getStorageSync("token") },
|
||||
filePath: res.tempFilePaths[0],
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
console.log(res);
|
||||
const imgData = JSON.parse(res.data) as {
|
||||
code: number;
|
||||
msg: string;
|
||||
data: any;
|
||||
}
|
||||
};
|
||||
if (imgData.code === 200) {
|
||||
// 将图片展示在编辑器中
|
||||
data.editorCtx.insertImage({
|
||||
width: '100%',
|
||||
height: 'auto',
|
||||
width: "100%",
|
||||
height: "auto",
|
||||
src: imgData.data.data,
|
||||
alt: '图像',
|
||||
alt: "图像",
|
||||
success: function () {
|
||||
console.log('insert image success')
|
||||
}
|
||||
})
|
||||
console.log("insert image success");
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log('上传失败')
|
||||
console.log("上传失败");
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(err);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -246,7 +245,7 @@ function insertImage() {
|
||||
|
||||
.editor-wrapper {
|
||||
height: calc(
|
||||
100vh - var(--window-top) - var(--status-bar-height) - 280px - 650px
|
||||
100vh - var(--window-top) - var(--status-bar-height) - 280px - 650px
|
||||
);
|
||||
overflow: scroll;
|
||||
background: rgba(153, 153, 153, 0.05);
|
||||
@@ -283,4 +282,4 @@ function insertImage() {
|
||||
.ql-active {
|
||||
color: #f38e48;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
<template>
|
||||
<canvas
|
||||
v-if="canvasId"
|
||||
:id="canvasId"
|
||||
:canvasId="canvasId"
|
||||
:style="{
|
||||
// width: (cWidth / cWidth) * sysInfo.windowWidth + 'px',
|
||||
width: cWidth,
|
||||
height: 250 + 'px',
|
||||
transform: 'scale(' + 1 / pixelRatio + ')',
|
||||
marginLeft: (cWidth * (pixelRatio - 1)) / 2 + 'px',
|
||||
marginTop: (cHeight * (pixelRatio - 1)) / 2 + 'px',
|
||||
}"
|
||||
@touchstart="touchStart"
|
||||
@touchmove="touchMove"
|
||||
@touchend="touchEnd"
|
||||
@error="error"
|
||||
>
|
||||
</canvas>
|
||||
<canvas
|
||||
v-if="canvasId"
|
||||
:id="canvasId"
|
||||
:canvasId="canvasId"
|
||||
:style="{
|
||||
// width: (cWidth / cWidth) * sysInfo.windowWidth + 'px',
|
||||
width: cWidth,
|
||||
height: 250 + 'px',
|
||||
transform: 'scale(' + 1 / pixelRatio + ')',
|
||||
marginLeft: (cWidth * (pixelRatio - 1)) / 2 + 'px',
|
||||
marginTop: (cHeight * (pixelRatio - 1)) / 2 + 'px',
|
||||
}"
|
||||
@touchstart="touchStart"
|
||||
@touchmove="touchMove"
|
||||
@touchend="touchEnd"
|
||||
@error="error"
|
||||
>
|
||||
</canvas>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ucharts">
|
||||
@@ -26,152 +26,152 @@ import Taro from "@tarojs/taro";
|
||||
const canvases = {};
|
||||
|
||||
const props = defineProps({
|
||||
chartType: {
|
||||
required: true,
|
||||
type: String,
|
||||
default: "column",
|
||||
},
|
||||
opts: {
|
||||
required: true,
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
canvasId: {
|
||||
type: String,
|
||||
default: "u-canvas",
|
||||
},
|
||||
cWidth: {
|
||||
default: 350,
|
||||
},
|
||||
cHeight: {
|
||||
default: 250,
|
||||
},
|
||||
pixelRatio: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
chartType: {
|
||||
required: true,
|
||||
type: String,
|
||||
default: "column",
|
||||
},
|
||||
opts: {
|
||||
required: true,
|
||||
type: Object,
|
||||
default() {
|
||||
return null;
|
||||
},
|
||||
},
|
||||
canvasId: {
|
||||
type: String,
|
||||
default: "u-canvas",
|
||||
},
|
||||
cWidth: {
|
||||
default: 350,
|
||||
},
|
||||
cHeight: {
|
||||
default: 250,
|
||||
},
|
||||
pixelRatio: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
});
|
||||
|
||||
Taro.useLoad(() => {
|
||||
init();
|
||||
init();
|
||||
});
|
||||
|
||||
const init = () => {
|
||||
switch (props.chartType) {
|
||||
case "column":
|
||||
initColumnChart();
|
||||
break;
|
||||
case "line":
|
||||
initLineChart();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (props.chartType) {
|
||||
case "column":
|
||||
initColumnChart();
|
||||
break;
|
||||
case "line":
|
||||
initLineChart();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
const initColumnChart = () => {
|
||||
const ctx = Taro.createCanvasContext(props.canvasId);
|
||||
canvases[props.canvasId] = new uCharts({
|
||||
context: ctx,
|
||||
type: "column",
|
||||
fontSize: 11,
|
||||
background: "#FFFFFF",
|
||||
pixelRatio: props.pixelRatio,
|
||||
animation: true,
|
||||
categories: props.opts.categories,
|
||||
series: props.opts.series,
|
||||
enableScroll: true,
|
||||
width: props.cWidth,
|
||||
height: props.cHeight,
|
||||
padding: [15,15,0,5],
|
||||
legend: {},
|
||||
xAxis: {
|
||||
disableGrid: true,
|
||||
const ctx = Taro.createCanvasContext(props.canvasId);
|
||||
canvases[props.canvasId] = new uCharts({
|
||||
context: ctx,
|
||||
type: "column",
|
||||
fontSize: 11,
|
||||
background: "#FFFFFF",
|
||||
pixelRatio: props.pixelRatio,
|
||||
animation: true,
|
||||
categories: props.opts.categories,
|
||||
series: props.opts.series,
|
||||
enableScroll: true,
|
||||
width: props.cWidth,
|
||||
height: props.cHeight,
|
||||
padding: [15, 15, 0, 5],
|
||||
legend: {},
|
||||
xAxis: {
|
||||
disableGrid: true,
|
||||
},
|
||||
yAxis: {
|
||||
data: [
|
||||
{
|
||||
min: 0,
|
||||
},
|
||||
yAxis: {
|
||||
data: [
|
||||
{
|
||||
min: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
extra: {
|
||||
column: {
|
||||
type: "group",
|
||||
width: 30,
|
||||
activeBgColor: "#000000",
|
||||
activeBgOpacity: 0.08,
|
||||
},
|
||||
},
|
||||
});
|
||||
],
|
||||
},
|
||||
extra: {
|
||||
column: {
|
||||
type: "group",
|
||||
width: 30,
|
||||
activeBgColor: "#000000",
|
||||
activeBgOpacity: 0.08,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const initLineChart = () => {
|
||||
const ctx = Taro.createCanvasContext(props.canvasId);
|
||||
canvases[props.canvasId] = new uCharts({
|
||||
context: ctx,
|
||||
type: "line",
|
||||
fontSize: 11,
|
||||
legend: true,
|
||||
dataLabel: false,
|
||||
dataPointShape: true,
|
||||
background: "#FFFFFF",
|
||||
pixelRatio: props.pixelRatio,
|
||||
categories: props.opts.categories,
|
||||
series: props.opts.series,
|
||||
animation: true,
|
||||
enableScroll: true,
|
||||
xAxis: {
|
||||
// type: "grid",
|
||||
// gridColor: "#CCCCCC",
|
||||
// gridType: "dash",
|
||||
// dashLength: 8,
|
||||
// itemCount: 4,
|
||||
scrollShow: true,
|
||||
disableGrid: true,
|
||||
},
|
||||
yAxis: {
|
||||
gridType: "dash",
|
||||
gridColor: "#CCCCCC",
|
||||
dashLength: 8,
|
||||
splitNumber: 5,
|
||||
min: 10,
|
||||
max: 180,
|
||||
format: (val) => {
|
||||
return val.toFixed(0) + "元";
|
||||
},
|
||||
},
|
||||
width: props.cWidth * props.pixelRatio,
|
||||
height: props.cHeight * props.pixelRatio,
|
||||
extra: {
|
||||
line: {
|
||||
type: "straight",
|
||||
},
|
||||
},
|
||||
});
|
||||
const ctx = Taro.createCanvasContext(props.canvasId);
|
||||
canvases[props.canvasId] = new uCharts({
|
||||
context: ctx,
|
||||
type: "line",
|
||||
fontSize: 11,
|
||||
legend: true,
|
||||
dataLabel: false,
|
||||
dataPointShape: true,
|
||||
background: "#FFFFFF",
|
||||
pixelRatio: props.pixelRatio,
|
||||
categories: props.opts.categories,
|
||||
series: props.opts.series,
|
||||
animation: true,
|
||||
enableScroll: true,
|
||||
xAxis: {
|
||||
// type: "grid",
|
||||
// gridColor: "#CCCCCC",
|
||||
// gridType: "dash",
|
||||
// dashLength: 8,
|
||||
// itemCount: 4,
|
||||
scrollShow: true,
|
||||
disableGrid: true,
|
||||
},
|
||||
yAxis: {
|
||||
gridType: "dash",
|
||||
gridColor: "#CCCCCC",
|
||||
dashLength: 8,
|
||||
splitNumber: 5,
|
||||
min: 10,
|
||||
max: 180,
|
||||
format: (val) => {
|
||||
return val.toFixed(0) + "元";
|
||||
},
|
||||
},
|
||||
width: props.cWidth * props.pixelRatio,
|
||||
height: props.cHeight * props.pixelRatio,
|
||||
extra: {
|
||||
line: {
|
||||
type: "straight",
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const touchStart = (e: any) => {
|
||||
canvases[props.canvasId].showToolTip(e, {
|
||||
format: function (item: any, category: any) {
|
||||
return category + " " + item.name + ":" + item.data;
|
||||
},
|
||||
});
|
||||
canvases[props.canvasId].scrollStart(e);
|
||||
canvases[props.canvasId].showToolTip(e, {
|
||||
format: function (item: any, category: any) {
|
||||
return category + " " + item.name + ":" + item.data;
|
||||
},
|
||||
});
|
||||
canvases[props.canvasId].scrollStart(e);
|
||||
};
|
||||
|
||||
const touchMove = (e: any) => {
|
||||
canvases[props.canvasId].scroll(e);
|
||||
canvases[props.canvasId].scroll(e);
|
||||
};
|
||||
|
||||
const touchEnd = (e: any) => {
|
||||
canvases[props.canvasId].scrollEnd(e);
|
||||
canvases[props.canvasId].scrollEnd(e);
|
||||
};
|
||||
|
||||
const error = (e: any) => {
|
||||
throw e;
|
||||
throw e;
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
<template>
|
||||
<nut-uploader
|
||||
v-model:file-list="fileList"
|
||||
:url="config.url"
|
||||
:maximum="max"
|
||||
:headers="config.headers"
|
||||
@success="success"
|
||||
@failure="failure"
|
||||
:multiple="multiple"
|
||||
>
|
||||
</nut-uploader>
|
||||
<nut-uploader
|
||||
v-model:file-list="fileList"
|
||||
:url="config.url"
|
||||
:maximum="max"
|
||||
:headers="config.headers"
|
||||
@success="success"
|
||||
@failure="failure"
|
||||
:multiple="multiple"
|
||||
>
|
||||
</nut-uploader>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {BASE_URL} from '@/utils/request'
|
||||
import {computed, ref} from 'vue'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { BASE_URL } from "@/utils/request";
|
||||
import { computed, ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
const props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['update:list'])
|
||||
const emits = defineEmits(["update:list"]);
|
||||
|
||||
const fileList = computed({
|
||||
get: () => props.list,
|
||||
set: (val) => emits('update:list', val)
|
||||
get: () => props.list,
|
||||
set: (val) => emits("update:list", val),
|
||||
});
|
||||
|
||||
const config = ref({
|
||||
url: `${BASE_URL}/upload`,
|
||||
headers: {
|
||||
token: Taro.getStorageSync('token')
|
||||
},
|
||||
url: `${BASE_URL}/upload`,
|
||||
headers: {
|
||||
token: Taro.getStorageSync("token"),
|
||||
},
|
||||
});
|
||||
|
||||
const success = (res: any) => {
|
||||
const data = JSON.parse(res.responseText.data)
|
||||
res.fileItem.url = data.data.data
|
||||
Taro.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success'
|
||||
});
|
||||
const data = JSON.parse(res.responseText.data);
|
||||
res.fileItem.url = data.data.data;
|
||||
Taro.showToast({
|
||||
title: "上传成功",
|
||||
icon: "success",
|
||||
});
|
||||
};
|
||||
|
||||
const failure = () => {
|
||||
Taro.showToast({
|
||||
title: '上传失败',
|
||||
icon: 'error'
|
||||
});
|
||||
Taro.showToast({
|
||||
title: "上传失败",
|
||||
icon: "error",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -7,24 +7,24 @@ import { BASE_URL } from "@/utils/request";
|
||||
import { getPhone, login } from "@/api/user";
|
||||
|
||||
const props = defineProps({
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["closeEdit", "update:isShow"]);
|
||||
|
||||
const userInfo = ref({
|
||||
nickname: "",
|
||||
avatar: "",
|
||||
phone: "",
|
||||
nickname: "",
|
||||
avatar: "",
|
||||
phone: "",
|
||||
});
|
||||
|
||||
const show = computed({
|
||||
get: (): boolean => props.isShow,
|
||||
set: (val) => {
|
||||
emits("update:isShow", val);
|
||||
},
|
||||
get: (): boolean => props.isShow,
|
||||
set: (val) => {
|
||||
emits("update:isShow", val);
|
||||
},
|
||||
});
|
||||
|
||||
const mp_is_new = ref(true);
|
||||
@@ -32,297 +32,287 @@ const mp_is_new = ref(true);
|
||||
const canvasStatus = ref(false);
|
||||
|
||||
const closeAttr = () => {
|
||||
emits("closeEdit");
|
||||
emits("closeEdit");
|
||||
};
|
||||
|
||||
const onChooseAvatar = (e) => {
|
||||
const { avatarUrl } = e.detail;
|
||||
console.log(avatarUrl);
|
||||
Taro.uploadFile({
|
||||
url: `${BASE_URL}/upload`,
|
||||
filePath: avatarUrl,
|
||||
name: "file",
|
||||
success: function (res) {
|
||||
const data = JSON.parse(res.data);
|
||||
userInfo.value.avatar = data.data.data;
|
||||
},
|
||||
});
|
||||
const { avatarUrl } = e.detail;
|
||||
Taro.uploadFile({
|
||||
url: `${BASE_URL}/upload`,
|
||||
filePath: avatarUrl,
|
||||
name: "file",
|
||||
success: function (res) {
|
||||
const data = JSON.parse(res.data);
|
||||
userInfo.value.avatar = data.data.data;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const uploadPic = () => {
|
||||
canvasStatus.value = true;
|
||||
canvasStatus.value = true;
|
||||
};
|
||||
|
||||
const getPhoneNumber = async (e: any) => {
|
||||
Taro.showLoading({
|
||||
title: "授权手机号中",
|
||||
mask: true,
|
||||
});
|
||||
const { code } = e.detail;
|
||||
const res = await getPhone({
|
||||
code: code,
|
||||
});
|
||||
userInfo.value.phone = res.data.phone;
|
||||
Taro.hideLoading();
|
||||
Taro.showLoading({
|
||||
title: "授权手机号中",
|
||||
mask: true,
|
||||
});
|
||||
const { code } = e.detail;
|
||||
const res = await getPhone({
|
||||
code: code,
|
||||
});
|
||||
userInfo.value.phone = res.data.phone;
|
||||
Taro.hideLoading();
|
||||
};
|
||||
|
||||
const formSubmit = async (e: any) => {
|
||||
if (!userInfo.value.avatar)
|
||||
return Taro.showToast({
|
||||
title: "请上传头像",
|
||||
icon: "none",
|
||||
});
|
||||
userInfo.value.nickname = e.detail.value.nickname;
|
||||
if (!userInfo.value.nickname)
|
||||
return Taro.showToast({
|
||||
title: "请输入昵称",
|
||||
icon: "none",
|
||||
});
|
||||
if (!userInfo.value.phone)
|
||||
return Taro.showToast({
|
||||
title: "请授权手机号码",
|
||||
icon: "none",
|
||||
});
|
||||
const res = await login({
|
||||
Code: Taro.getStorageSync("wx_code"),
|
||||
NickName: userInfo.value.nickname,
|
||||
AvatarUrl: userInfo.value.avatar,
|
||||
Phone: userInfo.value.phone,
|
||||
Referee: Taro.getStorageSync("bind_id") || "",
|
||||
if (!userInfo.value.avatar)
|
||||
return Taro.showToast({
|
||||
title: "请上传头像",
|
||||
icon: "none",
|
||||
});
|
||||
emits("closeEdit");
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
userInfo.value.nickname = e.detail.value.nickname;
|
||||
if (!userInfo.value.nickname)
|
||||
return Taro.showToast({
|
||||
title: "请输入昵称",
|
||||
icon: "none",
|
||||
});
|
||||
Taro.setStorageSync("token", res.data.token);
|
||||
setTimeout(() => {
|
||||
Taro.removeStorageSync("wx_code");
|
||||
Taro.removeStorageSync("bind_id");
|
||||
Taro.switchTab({
|
||||
url: "/pages/user/index",
|
||||
});
|
||||
}, 2000);
|
||||
if (!userInfo.value.phone)
|
||||
return Taro.showToast({
|
||||
title: "请授权手机号码",
|
||||
icon: "none",
|
||||
});
|
||||
const res = await login({
|
||||
Code: Taro.getStorageSync("wx_code"),
|
||||
NickName: userInfo.value.nickname,
|
||||
AvatarUrl: userInfo.value.avatar,
|
||||
Phone: userInfo.value.phone,
|
||||
Referee: Taro.getStorageSync("bind_id") || "",
|
||||
});
|
||||
emits("closeEdit");
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
Taro.setStorageSync("token", res.data.token);
|
||||
setTimeout(() => {
|
||||
Taro.removeStorageSync("wx_code");
|
||||
Taro.removeStorageSync("bind_id");
|
||||
Taro.switchTab({
|
||||
url: "/pages/user/index",
|
||||
});
|
||||
}, 2000);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<nut-popup
|
||||
position="bottom"
|
||||
safe-area-inset-bottom
|
||||
closeable
|
||||
:style="{ padding: '20px 10px' }"
|
||||
v-model:visible="show"
|
||||
@close="closeAttr"
|
||||
:close-on-click-overlay="false"
|
||||
>
|
||||
<view class="mp-data">
|
||||
<image class="image" :src="logoImg"></image>
|
||||
<text class="mp-name">捷兑通 申请</text>
|
||||
<view>
|
||||
<nut-popup
|
||||
position="bottom"
|
||||
safe-area-inset-bottom
|
||||
closeable
|
||||
:style="{ padding: '20px 10px' }"
|
||||
v-model:visible="show"
|
||||
@close="closeAttr"
|
||||
:close-on-click-overlay="false"
|
||||
>
|
||||
<view class="mp-data">
|
||||
<image class="image" :src="logoImg"></image>
|
||||
<text class="mp-name">捷兑通 申请</text>
|
||||
</view>
|
||||
<view class="trip-msg">
|
||||
<view class="title"> 获取您的昵称、头像 </view>
|
||||
<view class="trip"> 提供具有辨识度的用户中心界面 </view>
|
||||
</view>
|
||||
<form @submit="formSubmit">
|
||||
<view class="edit">
|
||||
<view class="avatar edit-box">
|
||||
<view class="left">
|
||||
<view class="head">头像</view>
|
||||
<view
|
||||
class="avatar-box"
|
||||
v-if="!mp_is_new"
|
||||
@click.stop="uploadPic"
|
||||
>
|
||||
<image
|
||||
:src="userInfo.avatar || headImg"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<button
|
||||
v-else
|
||||
class="avatar-box"
|
||||
open-type="chooseAvatar"
|
||||
@chooseavatar="onChooseAvatar"
|
||||
>
|
||||
<image
|
||||
:src="userInfo.avatar || headImg"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</button>
|
||||
</view>
|
||||
<view class="trip-msg">
|
||||
<view class="title"> 获取您的昵称、头像 </view>
|
||||
<view class="trip"> 提供具有辨识度的用户中心界面 </view>
|
||||
</view>
|
||||
<view class="nickname edit-box">
|
||||
<view class="left">
|
||||
<view class="head">昵称</view>
|
||||
<view class="input">
|
||||
<input
|
||||
type="nickname"
|
||||
placeholder-class="pl-sty"
|
||||
placeholder="请输入昵称"
|
||||
name="nickname"
|
||||
:maxlength="16"
|
||||
:value="userInfo.nickname"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<form @submit="formSubmit">
|
||||
<view class="edit">
|
||||
<view class="avatar edit-box">
|
||||
<view class="left">
|
||||
<view class="head">头像</view>
|
||||
<view
|
||||
class="avatar-box"
|
||||
v-if="!mp_is_new"
|
||||
@click.stop="uploadPic"
|
||||
>
|
||||
<image
|
||||
:src="userInfo.avatar || headImg"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<button
|
||||
v-else
|
||||
class="avatar-box"
|
||||
open-type="chooseAvatar"
|
||||
@chooseavatar="onChooseAvatar"
|
||||
>
|
||||
<image
|
||||
:src="userInfo.avatar || headImg"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nickname edit-box">
|
||||
<view class="left">
|
||||
<view class="head">昵称</view>
|
||||
<view class="input">
|
||||
<input
|
||||
type="nickname"
|
||||
placeholder-class="pl-sty"
|
||||
placeholder="请输入昵称"
|
||||
name="nickname"
|
||||
:maxlength="16"
|
||||
:value="userInfo.nickname"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nickname edit-box">
|
||||
<view class="left">
|
||||
<view class="head">号码</view>
|
||||
<view class="input">
|
||||
<button
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
>
|
||||
{{
|
||||
!userInfo.phone
|
||||
? "请授权手机号"
|
||||
: "授权成功"
|
||||
}}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nickname edit-box">
|
||||
<view class="left">
|
||||
<view class="head">号码</view>
|
||||
<view class="input">
|
||||
<button
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
>
|
||||
{{ !userInfo.phone ? "请授权手机号" : "授权成功" }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bottom">
|
||||
<nut-button
|
||||
formType="submit"
|
||||
block
|
||||
type="success"
|
||||
color="#07C160"
|
||||
>
|
||||
保存
|
||||
</nut-button>
|
||||
</view>
|
||||
</form>
|
||||
</nut-popup>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
<nut-button formType="submit" block type="success" color="#07C160">
|
||||
保存
|
||||
</nut-button>
|
||||
</view>
|
||||
</form>
|
||||
</nut-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.mp-data {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
|
||||
.mp-name {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
.mp-name {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
margin-right: 16px;
|
||||
}
|
||||
.image {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.trip-msg {
|
||||
padding-bottom: 32px;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
padding-bottom: 32px;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
|
||||
.title {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.title {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.trip {
|
||||
font-size: 26px;
|
||||
color: #777777;
|
||||
}
|
||||
.trip {
|
||||
font-size: 26px;
|
||||
color: #777777;
|
||||
}
|
||||
}
|
||||
|
||||
.edit {
|
||||
// border-bottom: 1px solid #f5f5f5;
|
||||
// border-bottom: 1px solid #f5f5f5;
|
||||
|
||||
.avatar {
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
.avatar {
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.nickname {
|
||||
.input {
|
||||
width: 100%;
|
||||
}
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
.nickname {
|
||||
.input {
|
||||
width: 100%;
|
||||
}
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 80px;
|
||||
}
|
||||
button {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: none;
|
||||
padding: 0;
|
||||
height: 50px;
|
||||
font-size: 28px;
|
||||
color: #838383;
|
||||
input {
|
||||
height: 80px;
|
||||
}
|
||||
button {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: none;
|
||||
padding: 0;
|
||||
height: 50px;
|
||||
font-size: 28px;
|
||||
color: #838383;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.edit-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 30px;
|
||||
padding: 22px 0;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 30px;
|
||||
padding: 22px 0;
|
||||
flex: 1;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
|
||||
.head {
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
white-space: nowrap;
|
||||
margin-right: 60px;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100%;
|
||||
border-radius: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
button {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: none;
|
||||
height: 100px;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
.head {
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
white-space: nowrap;
|
||||
margin-right: 60px;
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100%;
|
||||
border-radius: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
button {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: none;
|
||||
height: 100px;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon-xiangyou {
|
||||
color: #cfcfcf;
|
||||
color: #cfcfcf;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
margin-top: 20px;
|
||||
padding: 0 150px;
|
||||
margin-top: 20px;
|
||||
padding: 0 150px;
|
||||
|
||||
.nut-button {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.nut-button {
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-touch-fullscreen" content="yes">
|
||||
<meta name="format-detection" content="telephone=no,address=no">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="white">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
|
||||
<title>taroApp</title>
|
||||
<script><%= htmlWebpackPlugin.options.script %></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
||||
<meta
|
||||
content="width=device-width,initial-scale=1,user-scalable=no"
|
||||
name="viewport"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-touch-fullscreen" content="yes" />
|
||||
<meta name="format-detection" content="telephone=no,address=no" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="white" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<title>taroApp</title>
|
||||
<script>
|
||||
<%= htmlWebpackPlugin.options.script %>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '订单详情'
|
||||
})
|
||||
navigationBarTitleText: "订单详情",
|
||||
});
|
||||
|
||||
@@ -1,122 +1,116 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="header">
|
||||
<view>订单号:{{ info.oid }}</view>
|
||||
<view>{{ info.add_time }}</view>
|
||||
</view>
|
||||
<view class="good-info">
|
||||
<view class="top">
|
||||
<image :src="info.BindGoods?.cover" />
|
||||
<view class="title">{{ info.BindGoods?.name }}</view>
|
||||
</view>
|
||||
|
||||
<view class="public-total">
|
||||
共{{ info.count }}件商品,已支付
|
||||
<text class="money">{{ info.number }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<nut-cell-group>
|
||||
<nut-cell title="订单状态:" :desc="orderStatus"></nut-cell>
|
||||
<nut-cell
|
||||
title="下单用户:"
|
||||
:desc="info.BindUser?.nickName"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
title="用户手机号:"
|
||||
:desc="info.BindUser?.phone"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
v-if="info.status === 2"
|
||||
title="核销人员:"
|
||||
:desc="info.BindCancelUser?.nickName"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
v-if="info.status === 2"
|
||||
title="核销人手机号:"
|
||||
:desc="info.BindCancelUser?.phone"
|
||||
></nut-cell>
|
||||
</nut-cell-group>
|
||||
<view>
|
||||
<view class="header">
|
||||
<view>订单号:{{ info.oid }}</view>
|
||||
<view>{{ info.add_time }}</view>
|
||||
</view>
|
||||
<view class="good-info">
|
||||
<view class="top">
|
||||
<image :src="info.BindGoods?.cover" />
|
||||
<view class="title">{{ info.BindGoods?.name }}</view>
|
||||
</view>
|
||||
|
||||
<view class="public-total">
|
||||
共{{ info.count }}件商品,已支付
|
||||
<text class="money">{{ info.number }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<nut-cell-group>
|
||||
<nut-cell title="订单状态:" :desc="orderStatus"></nut-cell>
|
||||
<nut-cell title="下单用户:" :desc="info.BindUser?.nickName"></nut-cell>
|
||||
<nut-cell title="用户手机号:" :desc="info.BindUser?.phone"></nut-cell>
|
||||
<nut-cell
|
||||
v-if="info.status === 2"
|
||||
title="核销人员:"
|
||||
:desc="info.BindCancelUser?.nickName"
|
||||
></nut-cell>
|
||||
<nut-cell
|
||||
v-if="info.status === 2"
|
||||
title="核销人手机号:"
|
||||
:desc="info.BindCancelUser?.phone"
|
||||
></nut-cell>
|
||||
</nut-cell-group>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Taro from "@tarojs/taro";
|
||||
import { ref, computed } from "vue";
|
||||
import { ref } from "vue";
|
||||
|
||||
const info = ref<any>({});
|
||||
|
||||
Taro.useLoad(() => {
|
||||
info.value = Taro.getStorageSync("ver_order_info");
|
||||
info.value = Taro.getStorageSync("ver_order_info");
|
||||
});
|
||||
|
||||
const orderStatus = computed(() => {
|
||||
switch (info.value.status) {
|
||||
case 1:
|
||||
return "待核销";
|
||||
case 2:
|
||||
return "已核销";
|
||||
case 3:
|
||||
return "已失效";
|
||||
}
|
||||
});
|
||||
const orderStatus = () => {
|
||||
switch (info.value.status) {
|
||||
case 1:
|
||||
return "待核销";
|
||||
case 2:
|
||||
return "已核销";
|
||||
case 3:
|
||||
return "已失效";
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
--nut-cell-desc-color: #000;
|
||||
--nut-cell-desc-color: #000;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(90deg, #2291f8 0, #1cd1dc);
|
||||
padding: 30px;
|
||||
color: #fff;
|
||||
font-size: 30px;
|
||||
background: linear-gradient(90deg, #2291f8 0, #1cd1dc);
|
||||
padding: 30px;
|
||||
color: #fff;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.good-info {
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
|
||||
image {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.title {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.price {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.public-total {
|
||||
font-size: 28px;
|
||||
color: #282828;
|
||||
border-top: 1px solid #eee;
|
||||
height: 92px;
|
||||
line-height: 92px;
|
||||
text-align: right;
|
||||
padding: 0 30px;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
|
||||
image {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.title {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.price {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.public-total {
|
||||
font-size: 28px;
|
||||
color: #282828;
|
||||
border-top: 1px solid #eee;
|
||||
height: 92px;
|
||||
line-height: 92px;
|
||||
text-align: right;
|
||||
padding: 0 30px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.public-total .money {
|
||||
color: #ff4c3c;
|
||||
}
|
||||
.public-total .money {
|
||||
color: #ff4c3c;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '订单管理'
|
||||
})
|
||||
|
||||
navigationBarTitleText: "订单管理",
|
||||
});
|
||||
|
||||
@@ -1,114 +1,104 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="Card">
|
||||
<view>全部订单</view>
|
||||
<view class="orderinfo">
|
||||
<view class="info" @click="toListPage(0)">
|
||||
<view class="num">{{ orderInfo?.count?.A || 0 }}</view>
|
||||
<view class="sub">全部</view>
|
||||
</view>
|
||||
<view class="info" @click="toListPage(1)">
|
||||
<view class="num">{{ orderInfo?.count?.B || 0 }}</view>
|
||||
<view class="sub">待付款</view>
|
||||
</view>
|
||||
<view class="info" @click="toListPage(2)">
|
||||
<view class="num">{{ orderInfo?.count?.C || 0 }}</view>
|
||||
<view class="sub">待核销</view>
|
||||
</view>
|
||||
<view class="info" @click="toListPage(3)">
|
||||
<view class="num">{{ orderInfo?.count?.D || 0 }}</view>
|
||||
<view class="sub">已核销</view>
|
||||
</view>
|
||||
<view class="info" @click="toListPage(4)">
|
||||
<view class="num">{{ orderInfo?.count?.F || 0 }}</view>
|
||||
<view class="sub">已过期</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="Card">
|
||||
<view>全部订单</view>
|
||||
<view class="orderinfo">
|
||||
<view class="info" @click="toListPage(0)">
|
||||
<view class="num">{{ orderInfo?.count?.A || 0 }}</view>
|
||||
<view class="sub">全部</view>
|
||||
</view>
|
||||
<view class="Card">
|
||||
<view class="top"
|
||||
><text class="iconfont icon-shujutongji icon"></text
|
||||
><text>数据统计</text></view
|
||||
>
|
||||
<view class="gridBox">
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=price&time=today`"
|
||||
>
|
||||
<view class="title">{{
|
||||
orderInfo?.total?.TodayNumber || 0
|
||||
}}</view>
|
||||
<view class="sub">今日成交额</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=price&time=yesterday`"
|
||||
>
|
||||
<view class="title">{{
|
||||
orderInfo?.total?.YesterdayNumber || 0
|
||||
}}</view>
|
||||
<view class="sub">昨日成交额</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=price&time=month`"
|
||||
>
|
||||
<view class="title">{{
|
||||
orderInfo?.total?.MonthNumber || 0
|
||||
}}</view>
|
||||
<view class="sub">本月成交额</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=order&time=today`"
|
||||
>
|
||||
<view class="title">{{
|
||||
orderInfo?.total?.TodayOrder || 0
|
||||
}}</view>
|
||||
<view class="sub">今日订单数</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=order&time=yesterday`"
|
||||
>
|
||||
<view class="title">{{
|
||||
orderInfo?.total?.YesterdayOrder || 0
|
||||
}}</view>
|
||||
<view class="sub">昨日订单数</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=order&time=month`"
|
||||
>
|
||||
<view class="title">{{
|
||||
orderInfo?.total?.MonthOrder || 0
|
||||
}}</view>
|
||||
<view class="sub">本月订单数</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="info" @click="toListPage(1)">
|
||||
<view class="num">{{ orderInfo?.count?.B || 0 }}</view>
|
||||
<view class="sub">待付款</view>
|
||||
</view>
|
||||
<view class="Card">
|
||||
<view class="top"
|
||||
><text class="iconfont icon-xiangxishuju icon"></text
|
||||
><text>详细数据</text></view
|
||||
>
|
||||
<view v-if="orderInfo?.list?.length > 0">
|
||||
<nut-table
|
||||
:bordered="true"
|
||||
class="table"
|
||||
:columns="columns"
|
||||
:data="orderInfo?.list"
|
||||
></nut-table>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
||||
<view class="info" @click="toListPage(2)">
|
||||
<view class="num">{{ orderInfo?.count?.C || 0 }}</view>
|
||||
<view class="sub">待核销</view>
|
||||
</view>
|
||||
<view class="info" @click="toListPage(3)">
|
||||
<view class="num">{{ orderInfo?.count?.D || 0 }}</view>
|
||||
<view class="sub">已核销</view>
|
||||
</view>
|
||||
<view class="info" @click="toListPage(4)">
|
||||
<view class="num">{{ orderInfo?.count?.F || 0 }}</view>
|
||||
<view class="sub">已过期</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="Card">
|
||||
<view class="top"
|
||||
><text class="iconfont icon-shujutongji icon"></text
|
||||
><text>数据统计</text></view
|
||||
>
|
||||
<view class="gridBox">
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=price&time=today`"
|
||||
>
|
||||
<view class="title">{{ orderInfo?.total?.TodayNumber || 0 }}</view>
|
||||
<view class="sub">今日成交额</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=price&time=yesterday`"
|
||||
>
|
||||
<view class="title">{{
|
||||
orderInfo?.total?.YesterdayNumber || 0
|
||||
}}</view>
|
||||
<view class="sub">昨日成交额</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=price&time=month`"
|
||||
>
|
||||
<view class="title">{{ orderInfo?.total?.MonthNumber || 0 }}</view>
|
||||
<view class="sub">本月成交额</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=order&time=today`"
|
||||
>
|
||||
<view class="title">{{ orderInfo?.total?.TodayOrder || 0 }}</view>
|
||||
<view class="sub">今日订单数</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=order&time=yesterday`"
|
||||
>
|
||||
<view class="title">{{ orderInfo?.total?.YesterdayOrder || 0 }}</view>
|
||||
<view class="sub">昨日订单数</view>
|
||||
</navigator>
|
||||
<navigator
|
||||
class="item"
|
||||
hover-class="none"
|
||||
:url="`/pages/admin/statistics/index?type=order&time=month`"
|
||||
>
|
||||
<view class="title">{{ orderInfo?.total?.MonthOrder || 0 }}</view>
|
||||
<view class="sub">本月订单数</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<view class="Card">
|
||||
<view class="top"
|
||||
><text class="iconfont icon-xiangxishuju icon"></text
|
||||
><text>详细数据</text></view
|
||||
>
|
||||
<view v-if="orderInfo?.list?.length > 0">
|
||||
<nut-table
|
||||
:bordered="true"
|
||||
class="table"
|
||||
:columns="columns"
|
||||
:data="orderInfo?.list"
|
||||
></nut-table>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -117,121 +107,119 @@ import Taro from "@tarojs/taro";
|
||||
import { orderStatistics } from "../../../api/admin";
|
||||
|
||||
Taro.useLoad(() => {
|
||||
getData();
|
||||
getData();
|
||||
});
|
||||
|
||||
const orderInfo = ref<any>({});
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: "日期",
|
||||
key: "Date",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "订单数",
|
||||
key: "TotalCount",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "交易额",
|
||||
key: "NumberSum",
|
||||
align: "center",
|
||||
render: (row) => {
|
||||
return h(
|
||||
"view",
|
||||
{
|
||||
style: {
|
||||
color: "red",
|
||||
},
|
||||
},
|
||||
row.NumberSum
|
||||
);
|
||||
{
|
||||
title: "日期",
|
||||
key: "Date",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "订单数",
|
||||
key: "TotalCount",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "交易额",
|
||||
key: "NumberSum",
|
||||
align: "center",
|
||||
render: (row) => {
|
||||
return h(
|
||||
"view",
|
||||
{
|
||||
style: {
|
||||
color: "red",
|
||||
},
|
||||
},
|
||||
row.NumberSum
|
||||
);
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const getData = async () => {
|
||||
const mer_type = Taro.getStorageSync("mer_type");
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
const res = await orderStatistics({
|
||||
bid: user_info.bid,
|
||||
type: mer_type,
|
||||
});
|
||||
orderInfo.value = res.data;
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
const res = await orderStatistics({
|
||||
bid: user_info.data.bid,
|
||||
});
|
||||
orderInfo.value = res.data;
|
||||
};
|
||||
|
||||
const toListPage = (index: number) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/admin/order_manage/list/index?type=${index}`,
|
||||
});
|
||||
Taro.navigateTo({
|
||||
url: `/pages/admin/order_manage/list/index?type=${index}`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.Card {
|
||||
width: 90%;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 10px auto;
|
||||
padding: 25px;
|
||||
width: 90%;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 10px auto;
|
||||
padding: 25px;
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: red;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.gridBox {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 33.33%);
|
||||
grid-template-rows: repeat(3, 33.33%);
|
||||
grid-gap: 10px;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 33.33%);
|
||||
grid-template-rows: repeat(3, 33.33%);
|
||||
grid-gap: 10px;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
|
||||
.item {
|
||||
margin-top: 50px;
|
||||
.title {
|
||||
font-size: 50px;
|
||||
}
|
||||
.sub {
|
||||
font-size: 25px;
|
||||
color: #999;
|
||||
}
|
||||
.item {
|
||||
margin-top: 50px;
|
||||
.title {
|
||||
font-size: 50px;
|
||||
}
|
||||
.sub {
|
||||
font-size: 25px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table {
|
||||
margin-top: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.orderinfo {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 20px;
|
||||
align-items: center;
|
||||
.info {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 20px;
|
||||
align-items: center;
|
||||
.info {
|
||||
text-align: center;
|
||||
|
||||
.num {
|
||||
font-size: 40px;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 25px;
|
||||
color: #999;
|
||||
}
|
||||
.num {
|
||||
font-size: 40px;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 25px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '订单列表'
|
||||
})
|
||||
|
||||
navigationBarTitleText: "订单列表",
|
||||
});
|
||||
|
||||
@@ -1,35 +1,33 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="tabs">
|
||||
<view
|
||||
class="item"
|
||||
v-for="item in opt"
|
||||
:key="item.value"
|
||||
@click="tabChange(item.value)"
|
||||
>
|
||||
<view class="title">{{ item.text }}</view>
|
||||
<view
|
||||
class="line"
|
||||
:style="{
|
||||
backgroundColor: item.value === tabVal ? 'red' : '',
|
||||
}"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="dataList.length > 0">
|
||||
<view
|
||||
class="order-card"
|
||||
v-for="(item, index) in dataList"
|
||||
:key="index"
|
||||
@click="toDetailPage(item)"
|
||||
>
|
||||
<view class="top">
|
||||
<view class="name">订单号:{{ item.oid }}</view>
|
||||
<!-- <view class="sub">下单时间:{{ item.add_time }}</view> -->
|
||||
<view class="sub"
|
||||
>核销时间:{{ item.cancel_time || "待核销" }}</view
|
||||
>
|
||||
<!-- <view style="color: red">{{
|
||||
<view>
|
||||
<view class="tabs">
|
||||
<view
|
||||
class="item"
|
||||
v-for="item in opt"
|
||||
:key="item.value"
|
||||
@click="tabChange(item.value)"
|
||||
>
|
||||
<view class="title">{{ item.text }}</view>
|
||||
<view
|
||||
class="line"
|
||||
:style="{
|
||||
backgroundColor: item.value === tabVal ? 'red' : '',
|
||||
}"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="dataList.length > 0">
|
||||
<view
|
||||
class="order-card"
|
||||
v-for="(item, index) in dataList"
|
||||
:key="index"
|
||||
@click="toDetailPage(item)"
|
||||
>
|
||||
<view class="top">
|
||||
<view class="name">订单号:{{ item.oid }}</view>
|
||||
<!-- <view class="sub">下单时间:{{ item.add_time }}</view> -->
|
||||
<view class="sub">核销时间:{{ item.cancel_time || "待核销" }}</view>
|
||||
<!-- <view style="color: red">{{
|
||||
item.status === 0
|
||||
? "待付款"
|
||||
: item.status === 1
|
||||
@@ -38,58 +36,60 @@
|
||||
? "已使用"
|
||||
: "已失效"
|
||||
}}</view> -->
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="center">
|
||||
<view class="top">
|
||||
<image :src="item.BindGoods.cover" />
|
||||
<view class="title">{{ item.BindGoods.name }} </view>
|
||||
<view class="right">
|
||||
<view>{{ item.number }}</view>
|
||||
<view>x{{ item.count }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view
|
||||
class="bom"
|
||||
style="text-align: right; font-size: 13px"
|
||||
>
|
||||
共{{ item.count }}件商品,实付积分:
|
||||
<text style="color: red">{{ item.number }}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
||||
<view class="line"></view>
|
||||
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
|
||||
<view class="top">
|
||||
<image :src="itm.Goods.cover" />
|
||||
<view class="title">{{ itm.Goods.name }} </view>
|
||||
<view class="right">
|
||||
<view>{{ itm.pay_price }}元</view>
|
||||
<view>{{ itm.pay_integral }}积分</view>
|
||||
<view>x{{ itm.number }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="bom" style="text-align: right">
|
||||
共{{ item.count }}件商品,支付方式:{{
|
||||
item.pay_type === 1 ? "微信" : "积分"
|
||||
}},实付:
|
||||
<text style="color: red">{{
|
||||
item.pay_type === 1 ? item.price : item.exchange
|
||||
}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getJfOrderList, getActiveOrderList } from "../../../../api/admin";
|
||||
import { getActiveOrderList } from "../../../../api/admin";
|
||||
|
||||
const opt = ref([
|
||||
{
|
||||
text: "全部",
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: "待付款",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: "待核销",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: "已核销",
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: "已失效",
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
text: "全部",
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
text: "待付款",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
text: "待核销",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
text: "已核销",
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
text: "已失效",
|
||||
value: 4,
|
||||
},
|
||||
]);
|
||||
|
||||
const tabVal = ref(0);
|
||||
@@ -97,129 +97,123 @@ const tabVal = ref(0);
|
||||
const dataList = ref<any>([]);
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
tabVal.value = Number(options.type);
|
||||
getData();
|
||||
tabVal.value = Number(options.type);
|
||||
getData();
|
||||
});
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const mer_type = Taro.getStorageSync("mer_type");
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
let res: any = null;
|
||||
const data = {
|
||||
bid: user_info.bid,
|
||||
status: tabVal.value,
|
||||
};
|
||||
if (mer_type === 1) {
|
||||
res = await getActiveOrderList(data);
|
||||
} else {
|
||||
res = await getJfOrderList(data);
|
||||
}
|
||||
dataList.value = res.data.data;
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
try {
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
const data = {
|
||||
bid: user_info.data.bid,
|
||||
status: tabVal.value,
|
||||
};
|
||||
const res = await getActiveOrderList(data);
|
||||
dataList.value = res.data.data;
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const tabChange = (e: number) => {
|
||||
tabVal.value = e;
|
||||
getData();
|
||||
tabVal.value = e;
|
||||
getData();
|
||||
};
|
||||
|
||||
const toDetailPage = (item: any) => {
|
||||
Taro.setStorageSync("ver_order_info", item);
|
||||
Taro.navigateTo({
|
||||
url: "/pages/admin/order_manage/detail/index",
|
||||
});
|
||||
Taro.setStorageSync("ver_order_info", item);
|
||||
Taro.navigateTo({
|
||||
url: "/pages/admin/order_manage/detail/index",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.tabs {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
.item {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
.item {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.line {
|
||||
margin-top: 10px;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
}
|
||||
.line {
|
||||
margin-top: 10px;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
margin: 15px auto;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
margin: 15px auto;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 10px;
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.top {
|
||||
// display: flex;
|
||||
// justify-content: space-between;
|
||||
// align-items: center;
|
||||
|
||||
.name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sub {
|
||||
color: #999;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center {
|
||||
.top {
|
||||
// display: flex;
|
||||
// justify-content: space-between;
|
||||
// align-items: center;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// align-items: flex-start;
|
||||
|
||||
.name {
|
||||
font-weight: bold;
|
||||
}
|
||||
image {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.sub {
|
||||
color: #999;
|
||||
font-size: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center {
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// align-items: flex-start;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "订单数据统计",
|
||||
navigationBarTitleText: "订单数据统计",
|
||||
});
|
||||
|
||||
@@ -1,121 +1,117 @@
|
||||
<template>
|
||||
<view class="statistical-page" ref="container">
|
||||
<view class="navs">
|
||||
<view class="list">
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'today' ? 'on' : ''"
|
||||
@click="setTime('today')"
|
||||
>
|
||||
今天
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'yesterday' ? 'on' : ''"
|
||||
@click="setTime('yesterday')"
|
||||
>
|
||||
昨天
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'seven' ? 'on' : ''"
|
||||
@click="setTime('seven')"
|
||||
>
|
||||
最近7天
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'month' ? 'on' : ''"
|
||||
@click="setTime('month')"
|
||||
>
|
||||
本月
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'date' ? 'on' : ''"
|
||||
@click="dateTitle"
|
||||
>
|
||||
自定义
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper">
|
||||
<view class="title">
|
||||
{{ title }}{{ where.type == 1 ? "营业额" : "订单量" }}
|
||||
</view>
|
||||
<view v-if="where.type == 1" class="money">{{
|
||||
dataObj.all || 0
|
||||
}}</view>
|
||||
<view v-else class="money">{{ dataObj.all || 0 }}</view>
|
||||
<view class="increase">
|
||||
<view>
|
||||
{{ time === "date" ? "" : title }}增长率:<text
|
||||
:class="dataObj.growthRate >= 0 ? 'red' : 'green'"
|
||||
>
|
||||
{{ dataObj.growthRate }}%
|
||||
<text
|
||||
class="iconfont"
|
||||
:class="
|
||||
dataObj.growthRate >= 0
|
||||
? 'icon-xiangshang1'
|
||||
: 'icon-xiangxia2'
|
||||
"
|
||||
></text
|
||||
></text>
|
||||
</view>
|
||||
<view>
|
||||
{{ time === "date" ? "" : title }}增长:<text
|
||||
:class="dataObj.growthNumber >= 0 ? 'red' : 'green'"
|
||||
>{{ dataObj.growthNumber }}
|
||||
<text
|
||||
class="iconfont"
|
||||
:class="
|
||||
dataObj.growthNumber >= 0
|
||||
? 'icon-xiangshang1'
|
||||
: 'icon-xiangxia2'
|
||||
"
|
||||
></text
|
||||
></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="chart">
|
||||
<canvas
|
||||
canvas-id="myChart"
|
||||
style="width: 100%; height: 250px"
|
||||
:ontouch="true"
|
||||
@touchstart="touchStart"
|
||||
@touchmove="touchMove"
|
||||
@touchend="touchEnd"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="Card">
|
||||
<view class="top"
|
||||
><text class="iconfont icon-xiangxishuju icon"></text
|
||||
><text>详细数据</text></view
|
||||
>
|
||||
<view v-if="dataObj?.list?.length > 0">
|
||||
<nut-table
|
||||
:bordered="true"
|
||||
class="table"
|
||||
:columns="columns"
|
||||
:data="dataObj?.list"
|
||||
></nut-table>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
||||
</view>
|
||||
|
||||
<!-- 日期选择 -->
|
||||
<nut-calendar
|
||||
v-model:visible="isVisible"
|
||||
type="range"
|
||||
:start-date="date_start"
|
||||
@close="isVisible = false"
|
||||
@choose="setChooseValue"
|
||||
<view class="statistical-page" ref="container">
|
||||
<view class="navs">
|
||||
<view class="list">
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'today' ? 'on' : ''"
|
||||
@click="setTime('today')"
|
||||
>
|
||||
</nut-calendar>
|
||||
今天
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'yesterday' ? 'on' : ''"
|
||||
@click="setTime('yesterday')"
|
||||
>
|
||||
昨天
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'seven' ? 'on' : ''"
|
||||
@click="setTime('seven')"
|
||||
>
|
||||
最近7天
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'month' ? 'on' : ''"
|
||||
@click="setTime('month')"
|
||||
>
|
||||
本月
|
||||
</view>
|
||||
<view
|
||||
class="item"
|
||||
:class="time == 'date' ? 'on' : ''"
|
||||
@click="dateTitle"
|
||||
>
|
||||
自定义
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper">
|
||||
<view class="title">
|
||||
{{ title }}{{ where.type == 1 ? "营业额" : "订单量" }}
|
||||
</view>
|
||||
<view v-if="where.type == 1" class="money">{{ dataObj.all || 0 }}</view>
|
||||
<view v-else class="money">{{ dataObj.all || 0 }}</view>
|
||||
<view class="increase">
|
||||
<view>
|
||||
{{ time === "date" ? "" : title }}增长率:<text
|
||||
:class="dataObj.growthRate >= 0 ? 'red' : 'green'"
|
||||
>
|
||||
{{ dataObj.growthRate }}%
|
||||
<text
|
||||
class="iconfont"
|
||||
:class="
|
||||
dataObj.growthRate >= 0 ? 'icon-xiangshang1' : 'icon-xiangxia2'
|
||||
"
|
||||
></text
|
||||
></text>
|
||||
</view>
|
||||
<view>
|
||||
{{ time === "date" ? "" : title }}增长:<text
|
||||
:class="dataObj.growthNumber >= 0 ? 'red' : 'green'"
|
||||
>{{ dataObj.growthNumber }}
|
||||
<text
|
||||
class="iconfont"
|
||||
:class="
|
||||
dataObj.growthNumber >= 0
|
||||
? 'icon-xiangshang1'
|
||||
: 'icon-xiangxia2'
|
||||
"
|
||||
></text
|
||||
></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="chart">
|
||||
<canvas
|
||||
canvas-id="myChart"
|
||||
style="width: 100%; height: 250px"
|
||||
:ontouch="true"
|
||||
@touchstart="touchStart"
|
||||
@touchmove="touchMove"
|
||||
@touchend="touchEnd"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="Card">
|
||||
<view class="top"
|
||||
><text class="iconfont icon-xiangxishuju icon"></text
|
||||
><text>详细数据</text></view
|
||||
>
|
||||
<view v-if="dataObj?.list?.length > 0">
|
||||
<nut-table
|
||||
:bordered="true"
|
||||
class="table"
|
||||
:columns="columns"
|
||||
:data="dataObj?.list"
|
||||
></nut-table>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
||||
</view>
|
||||
|
||||
<!-- 日期选择 -->
|
||||
<nut-calendar
|
||||
v-model:visible="isVisible"
|
||||
type="range"
|
||||
:start-date="date_start"
|
||||
@close="isVisible = false"
|
||||
@choose="setChooseValue"
|
||||
>
|
||||
</nut-calendar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -134,321 +130,319 @@ let canvas_obj;
|
||||
const w = Taro.getSystemInfoSync().windowWidth;
|
||||
|
||||
const chartWH = ref({
|
||||
width: w * 0.9,
|
||||
height: 250,
|
||||
pixelRatio: 1,
|
||||
width: w * 0.9,
|
||||
height: 250,
|
||||
pixelRatio: 1,
|
||||
});
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: "日期",
|
||||
key: "Date",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "订单数",
|
||||
key: "TotalCount",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "交易额",
|
||||
key: "NumberSum",
|
||||
align: "center",
|
||||
render: (row) => {
|
||||
return h(
|
||||
"view",
|
||||
{
|
||||
style: {
|
||||
color: "red",
|
||||
},
|
||||
},
|
||||
row.NumberSum
|
||||
);
|
||||
{
|
||||
title: "日期",
|
||||
key: "Date",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "订单数",
|
||||
key: "TotalCount",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "交易额",
|
||||
key: "NumberSum",
|
||||
align: "center",
|
||||
render: (row) => {
|
||||
return h(
|
||||
"view",
|
||||
{
|
||||
style: {
|
||||
color: "red",
|
||||
},
|
||||
},
|
||||
row.NumberSum
|
||||
);
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const date_start = computed(() => {
|
||||
return dayjs().startOf("year").format("YYYY-MM-DD");
|
||||
return dayjs().startOf("year").format("YYYY-MM-DD");
|
||||
});
|
||||
|
||||
const title = ref("");
|
||||
|
||||
const where = ref({
|
||||
type: 1,
|
||||
status: 2,
|
||||
start: "",
|
||||
end: "",
|
||||
type: 1,
|
||||
status: 2,
|
||||
start: "",
|
||||
end: "",
|
||||
});
|
||||
|
||||
const dataObj = ref<any>({});
|
||||
|
||||
const opts = ref<any>({
|
||||
categories: [],
|
||||
series: [
|
||||
{
|
||||
name: "营业额",
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
name: "订单量",
|
||||
data: [],
|
||||
},
|
||||
],
|
||||
categories: [],
|
||||
series: [
|
||||
{
|
||||
name: "营业额",
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
name: "订单量",
|
||||
data: [],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
where.value.type = options.type === "price" ? 1 : 2;
|
||||
time.value = options.time;
|
||||
setTime(options.time);
|
||||
// getData();
|
||||
where.value.type = options.type === "price" ? 1 : 2;
|
||||
time.value = options.time;
|
||||
setTime(options.time);
|
||||
// getData();
|
||||
});
|
||||
|
||||
const setTime = (type: string) => {
|
||||
time.value = type;
|
||||
switch (type) {
|
||||
case "today":
|
||||
title.value = "今日";
|
||||
where.value.status = 2;
|
||||
where.value.start = dayjs().format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().format("YYYY-MM-DD");
|
||||
break;
|
||||
case "yesterday":
|
||||
title.value = "昨日";
|
||||
where.value.status = 2;
|
||||
where.value.start = dayjs().add(-1, "day").format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().add(-1, "day").format("YYYY-MM-DD");
|
||||
break;
|
||||
case "seven":
|
||||
title.value = "7天";
|
||||
where.value.status = 2;
|
||||
where.value.start = dayjs().add(-6, "day").format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().format("YYYY-MM-DD");
|
||||
break;
|
||||
case "month":
|
||||
title.value = "本月";
|
||||
where.value.status = 1;
|
||||
where.value.start = dayjs().startOf("month").format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().format("YYYY-MM-DD");
|
||||
break;
|
||||
}
|
||||
getData();
|
||||
time.value = type;
|
||||
switch (type) {
|
||||
case "today":
|
||||
title.value = "今日";
|
||||
where.value.status = 2;
|
||||
where.value.start = dayjs().format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().format("YYYY-MM-DD");
|
||||
break;
|
||||
case "yesterday":
|
||||
title.value = "昨日";
|
||||
where.value.status = 2;
|
||||
where.value.start = dayjs().add(-1, "day").format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().add(-1, "day").format("YYYY-MM-DD");
|
||||
break;
|
||||
case "seven":
|
||||
title.value = "7天";
|
||||
where.value.status = 2;
|
||||
where.value.start = dayjs().add(-6, "day").format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().format("YYYY-MM-DD");
|
||||
break;
|
||||
case "month":
|
||||
title.value = "本月";
|
||||
where.value.status = 1;
|
||||
where.value.start = dayjs().startOf("month").format("YYYY-MM-DD");
|
||||
where.value.end = dayjs().format("YYYY-MM-DD");
|
||||
break;
|
||||
}
|
||||
getData();
|
||||
};
|
||||
|
||||
const dateTitle = () => {
|
||||
where.value.status = 1;
|
||||
time.value = "date";
|
||||
isVisible.value = true;
|
||||
where.value.status = 1;
|
||||
time.value = "date";
|
||||
isVisible.value = true;
|
||||
};
|
||||
|
||||
const setChooseValue = (ref: any) => {
|
||||
where.value.start = ref[0][3];
|
||||
where.value.end = ref[1][3];
|
||||
title.value = `${where.value.start}-${where.value.end}`;
|
||||
getData();
|
||||
where.value.start = ref[0][3];
|
||||
where.value.end = ref[1][3];
|
||||
title.value = `${where.value.start}-${where.value.end}`;
|
||||
getData();
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const mer_type = Taro.getStorageSync("mer_type");
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
const res = await growthRate({
|
||||
bid: user_info.bid,
|
||||
type: mer_type,
|
||||
status: where.value.status,
|
||||
StartTime: where.value.start,
|
||||
EndTime: where.value.end,
|
||||
});
|
||||
dataObj.value = res.data;
|
||||
opts.value.categories = [];
|
||||
opts.value.series[0].data = [];
|
||||
opts.value.series[1].data = [];
|
||||
res.data.list.forEach((item: any) => {
|
||||
opts.value.categories.push(item.Date);
|
||||
opts.value.series[0].data.push(item.NumberSum);
|
||||
opts.value.series[1].data.push(item.TotalCount);
|
||||
});
|
||||
create_canvas();
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
try {
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
const res = await growthRate({
|
||||
bid: user_info.data.bid,
|
||||
status: where.value.status,
|
||||
StartTime: where.value.start,
|
||||
EndTime: where.value.end,
|
||||
});
|
||||
dataObj.value = res.data;
|
||||
opts.value.categories = [];
|
||||
opts.value.series[0].data = [];
|
||||
opts.value.series[1].data = [];
|
||||
res.data.list.forEach((item: any) => {
|
||||
opts.value.categories.push(item.Date);
|
||||
opts.value.series[0].data.push(item.NumberSum);
|
||||
opts.value.series[1].data.push(item.TotalCount);
|
||||
});
|
||||
create_canvas();
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const create_canvas = () => {
|
||||
const ctx = Taro.createCanvasContext("myChart");
|
||||
canvas_obj = new uCharts({
|
||||
type: "column",
|
||||
context: ctx,
|
||||
width: chartWH.value.width,
|
||||
height: chartWH.value.height,
|
||||
categories: opts.value.categories,
|
||||
series: opts.value.series,
|
||||
pixelRatio: chartWH.value.pixelRatio,
|
||||
animation: true,
|
||||
background: "#FFFFFF",
|
||||
color: [
|
||||
"#1890FF",
|
||||
"#91CB74",
|
||||
"#FAC858",
|
||||
"#EE6666",
|
||||
"#73C0DE",
|
||||
"#3CA272",
|
||||
"#FC8452",
|
||||
"#9A60B4",
|
||||
"#ea7ccc",
|
||||
],
|
||||
padding: [15, 15, 0, 15],
|
||||
enableScroll: true,
|
||||
legend: {},
|
||||
xAxis: {
|
||||
disableGrid: true,
|
||||
scrollShow: true,
|
||||
itemCount: 3,
|
||||
const ctx = Taro.createCanvasContext("myChart");
|
||||
canvas_obj = new uCharts({
|
||||
type: "column",
|
||||
context: ctx,
|
||||
width: chartWH.value.width,
|
||||
height: chartWH.value.height,
|
||||
categories: opts.value.categories,
|
||||
series: opts.value.series,
|
||||
pixelRatio: chartWH.value.pixelRatio,
|
||||
animation: true,
|
||||
background: "#FFFFFF",
|
||||
color: [
|
||||
"#1890FF",
|
||||
"#91CB74",
|
||||
"#FAC858",
|
||||
"#EE6666",
|
||||
"#73C0DE",
|
||||
"#3CA272",
|
||||
"#FC8452",
|
||||
"#9A60B4",
|
||||
"#ea7ccc",
|
||||
],
|
||||
padding: [15, 15, 0, 15],
|
||||
enableScroll: true,
|
||||
legend: {},
|
||||
xAxis: {
|
||||
disableGrid: true,
|
||||
scrollShow: true,
|
||||
itemCount: 3,
|
||||
},
|
||||
yAxis: {
|
||||
data: [
|
||||
{
|
||||
min: 0,
|
||||
},
|
||||
yAxis: {
|
||||
data: [
|
||||
{
|
||||
min: 0,
|
||||
},
|
||||
],
|
||||
},
|
||||
extra: {
|
||||
column: {
|
||||
type: "group",
|
||||
width: 20,
|
||||
activeBgColor: "#000000",
|
||||
activeBgOpacity: 0.08,
|
||||
},
|
||||
},
|
||||
});
|
||||
],
|
||||
},
|
||||
extra: {
|
||||
column: {
|
||||
type: "group",
|
||||
width: 20,
|
||||
activeBgColor: "#000000",
|
||||
activeBgOpacity: 0.08,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const touchStart = (e: any) => {
|
||||
canvas_obj.showToolTip(e, {
|
||||
format: function (item: any, category: any) {
|
||||
return category + " " + item.name + ":" + item.data;
|
||||
},
|
||||
});
|
||||
canvas_obj.scrollStart(e);
|
||||
canvas_obj.showToolTip(e, {
|
||||
format: function (item: any, category: any) {
|
||||
return category + " " + item.name + ":" + item.data;
|
||||
},
|
||||
});
|
||||
canvas_obj.scrollStart(e);
|
||||
};
|
||||
|
||||
const touchMove = (e: any) => {
|
||||
canvas_obj.scroll(e);
|
||||
canvas_obj.scroll(e);
|
||||
};
|
||||
|
||||
const touchEnd = (e: any) => {
|
||||
canvas_obj.scrollEnd(e);
|
||||
canvas_obj.scrollEnd(e);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.statistical-page {
|
||||
.navs {
|
||||
width: 100%;
|
||||
height: 96px;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
line-height: 96px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 9;
|
||||
.navs {
|
||||
width: 100%;
|
||||
height: 96px;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
line-height: 96px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 9;
|
||||
|
||||
.list {
|
||||
overflow-y: hidden;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
width: 100%;
|
||||
.list {
|
||||
overflow-y: hidden;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
width: 100%;
|
||||
|
||||
.item {
|
||||
font-size: 32px;
|
||||
color: #282828;
|
||||
margin-left: 60px;
|
||||
display: inline-block;
|
||||
}
|
||||
.item {
|
||||
font-size: 32px;
|
||||
color: #282828;
|
||||
margin-left: 60px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.on {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
.on {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 95%;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 119px auto 0 auto;
|
||||
padding: 50px 60px;
|
||||
|
||||
.title {
|
||||
font-size: 30px;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 95%;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 119px auto 0 auto;
|
||||
padding: 50px 60px;
|
||||
|
||||
.title {
|
||||
font-size: 30px;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.money {
|
||||
font-size: 72px;
|
||||
color: #fba02a;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.increase {
|
||||
font-size: 28px;
|
||||
color: #999;
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.red {
|
||||
color: #ff6969;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: #1abb1d;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 23px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
.money {
|
||||
font-size: 72px;
|
||||
color: #fba02a;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.chart {
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 23px auto;
|
||||
padding: 10px;
|
||||
.increase {
|
||||
font-size: 28px;
|
||||
color: #999;
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.red {
|
||||
color: #ff6969;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: #1abb1d;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 23px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.Card {
|
||||
width: 95%;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 10px auto;
|
||||
padding: 25px;
|
||||
.chart {
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 23px auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text {
|
||||
margin-right: 5px;
|
||||
}
|
||||
.Card {
|
||||
width: 95%;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 10px auto;
|
||||
padding: 25px;
|
||||
|
||||
.iconfont {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
.table {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
color: #fa2c19;
|
||||
}
|
||||
}
|
||||
.table {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "订单核销",
|
||||
navigationBarTitleText: "订单核销",
|
||||
});
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card">
|
||||
<nut-button block type="primary" @click="scanCode"
|
||||
>扫码核销</nut-button
|
||||
>
|
||||
</view>
|
||||
<view>
|
||||
<view class="card">
|
||||
<nut-button block type="primary" @click="scanCode">扫码核销</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -28,44 +26,43 @@ import Taro from "@tarojs/taro";
|
||||
// };
|
||||
|
||||
const scanCode = () => {
|
||||
Taro.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ["qrCode"],
|
||||
success: async (res) => {
|
||||
try {
|
||||
const mer_type = JSON.parse(Taro.getStorageSync("mer_type"));
|
||||
Taro.navigateTo({
|
||||
url: `/pages/admin/verify/verify_list/index?oid=${res.result}&mer_type=${mer_type}`,
|
||||
});
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
Taro.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ["qrCode"],
|
||||
success: async (res) => {
|
||||
try {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/admin/verify/verify_list/index?oid=${res.result}`,
|
||||
});
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
background-image: url("~@/static/admin/cancellation-header.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 30%;
|
||||
background-color: #f5f5f5;
|
||||
background-image: url("~@/static/admin/cancellation-header.png");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 30%;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 80%;
|
||||
height: 300px;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin: 300px auto;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 100px;
|
||||
width: 80%;
|
||||
height: 300px;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin: 300px auto;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 100px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "核销列表",
|
||||
});
|
||||
navigationBarTitleText: "核销列表",
|
||||
});
|
||||
|
||||
@@ -1,146 +1,132 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card">
|
||||
<view>订单号:{{ goodInfo.oid }}</view>
|
||||
<view class="line"></view>
|
||||
<view class="container">
|
||||
<image
|
||||
class="image"
|
||||
:src="goodInfo.cover"
|
||||
mode="widthFix"
|
||||
></image>
|
||||
<view class="info">
|
||||
<view class="title">{{ goodInfo.goods_name }}</view>
|
||||
<view class="num"
|
||||
>数量:
|
||||
<text style="color: red">{{
|
||||
goodInfo.count
|
||||
}}</text></view
|
||||
>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="cz">
|
||||
<nut-button size="small" type="primary" @click="subVerify"
|
||||
>确定核销</nut-button
|
||||
>
|
||||
</view>
|
||||
<view>
|
||||
<view class="card">
|
||||
<view>订单号:{{ goodInfo.oid }}</view>
|
||||
<view class="line"></view>
|
||||
<view
|
||||
class="container"
|
||||
v-for="(item, index) in goodInfo.OrderGoods"
|
||||
:key="index"
|
||||
>
|
||||
<image class="image" :src="item.Goods.cover" mode="widthFix"></image>
|
||||
<view class="info">
|
||||
<view class="title">商品名称:{{ item.Goods.name }}</view>
|
||||
<view class="num"
|
||||
>数量: <text style="color: red">{{ item.number }}</text></view
|
||||
>
|
||||
</view>
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<text>支付方式:{{ goodInfo.pay_type === 1 ? "微信" : "积分" }}</text
|
||||
>,
|
||||
<text
|
||||
>总计:{{
|
||||
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
|
||||
}}</text
|
||||
>
|
||||
<view class="line"></view>
|
||||
<view class="cz">
|
||||
<nut-button size="small" type="primary" @click="subVerify"
|
||||
>确定核销</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Taro from "@tarojs/taro";
|
||||
import {
|
||||
getJfVerifyList,
|
||||
getActiveVerifyList,
|
||||
activeOrderVerify,
|
||||
orderVerify,
|
||||
} from "@/api/admin";
|
||||
import { getActiveVerifyList, activeOrderVerify } from "@/api/admin";
|
||||
import { ref } from "vue";
|
||||
|
||||
const opt = ref<any>({});
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
opt.value = options;
|
||||
getData(options);
|
||||
opt.value = options;
|
||||
getData(options);
|
||||
});
|
||||
|
||||
const goodInfo = ref<any>({});
|
||||
|
||||
const getData = async (options: any) => {
|
||||
let res;
|
||||
if (Number(options.mer_type) === 1) {
|
||||
res = await getActiveVerifyList({
|
||||
oid: options.oid,
|
||||
});
|
||||
} else {
|
||||
res = await getJfVerifyList({
|
||||
oid: options.oid,
|
||||
});
|
||||
}
|
||||
if (!res.data.data.oid) {
|
||||
Taro.showToast({
|
||||
title: "没有此订单",
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
goodInfo.value = res.data.data;
|
||||
const res = await getActiveVerifyList({
|
||||
oid: options.oid,
|
||||
});
|
||||
if (!res.data.data.oid) {
|
||||
Taro.showToast({
|
||||
title: "没有此订单",
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
goodInfo.value = res.data.data;
|
||||
};
|
||||
|
||||
const subVerify = async () => {
|
||||
try {
|
||||
let res;
|
||||
if (Number(opt.value.mer_type) === 1) {
|
||||
res = await activeOrderVerify({
|
||||
oid: goodInfo.value.oid,
|
||||
});
|
||||
} else {
|
||||
res = await orderVerify({
|
||||
oid: goodInfo.value.oid,
|
||||
});
|
||||
}
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}, 3000);
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
try {
|
||||
const res = await activeOrderVerify({
|
||||
oid: goodInfo.value.oid,
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
});
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
}, 3000);
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card {
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
margin: 10px auto;
|
||||
width: 90%;
|
||||
border-radius: 7px;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
margin: 10px auto;
|
||||
width: 90%;
|
||||
border-radius: 7px;
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
.container {
|
||||
display: flex;
|
||||
|
||||
image {
|
||||
width: 200px;
|
||||
height: 100%;
|
||||
border-radius: 7px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.info {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
image {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
border-radius: 7px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 10px 0;
|
||||
.info {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.cz {
|
||||
text-align: right;
|
||||
.title {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.cz {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "收益提现",
|
||||
navigationBarTitleText: "收益提现",
|
||||
});
|
||||
|
||||
@@ -1,65 +1,83 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref, h} from 'vue'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {getWithdrawList, addWithdraw} from '@/api/admin'
|
||||
import { ref, h } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getWithdrawList, addWithdraw } from "@/api/admin";
|
||||
|
||||
const user_info = Taro.getStorageSync('userInfo')
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
|
||||
const row = ref(0)
|
||||
const row = ref(0);
|
||||
|
||||
const basicData = ref({
|
||||
num: ''
|
||||
})
|
||||
num: "",
|
||||
});
|
||||
|
||||
const showPreview = ref(false)
|
||||
const showPreview = ref(false);
|
||||
|
||||
const imgData = ref([{
|
||||
src: ''
|
||||
}])
|
||||
const imgData = ref([
|
||||
{
|
||||
src: "",
|
||||
},
|
||||
]);
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '时间',
|
||||
key: 'add_time',
|
||||
align: 'center'
|
||||
}, {
|
||||
title: '提现金额',
|
||||
key: 'integral',
|
||||
align: 'center',
|
||||
render: (row: { integral: number; }) => {
|
||||
return h('view', {}, row.integral / 100)
|
||||
}
|
||||
title: "时间",
|
||||
key: "add_time",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: '审核状态',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
render: (row: { status: number; }) => {
|
||||
return h('view', {
|
||||
class: `tag ${row.status === 1 ? 'success' : row.status === 2 ? 'danger' : 'warning'}`
|
||||
}, {
|
||||
default: () => row.status === 1 ? '已打款' : row.status === 2 ? '已拒绝' : '待审核'
|
||||
})
|
||||
}
|
||||
title: "提现金额",
|
||||
key: "integral",
|
||||
align: "center",
|
||||
render: (row: { integral: number }) => {
|
||||
return h("view", {}, row.integral / 100);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
key: 'img',
|
||||
align: 'center',
|
||||
render: (row: { status_img: string; }) => {
|
||||
return h('img', {
|
||||
class: 'image',
|
||||
onClick: () => {
|
||||
imgData.value[0].src = row.status_img
|
||||
showPreview.value = true
|
||||
title: "审核状态",
|
||||
key: "status",
|
||||
align: "center",
|
||||
render: (row: { status: number }) => {
|
||||
return h(
|
||||
"view",
|
||||
{
|
||||
class: `tag ${
|
||||
row.status === 1
|
||||
? "success"
|
||||
: row.status === 2
|
||||
? "danger"
|
||||
: "warning"
|
||||
}`,
|
||||
},
|
||||
src: row.status_img
|
||||
})
|
||||
}
|
||||
}
|
||||
])
|
||||
{
|
||||
default: () =>
|
||||
row.status === 1
|
||||
? "已打款"
|
||||
: row.status === 2
|
||||
? "已拒绝"
|
||||
: "待审核",
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "备注",
|
||||
key: "img",
|
||||
align: "center",
|
||||
render: (row: { status_img: string }) => {
|
||||
return h("img", {
|
||||
class: "image",
|
||||
onClick: () => {
|
||||
imgData.value[0].src = row.status_img;
|
||||
showPreview.value = true;
|
||||
},
|
||||
src: row.status_img,
|
||||
});
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const data = ref([])
|
||||
const data = ref([]);
|
||||
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
@@ -67,61 +85,67 @@ const pagination = ref({
|
||||
showPageSize: 5,
|
||||
totalItems: 0,
|
||||
change: (page: number) => {
|
||||
pagination.value.page = page
|
||||
getData()
|
||||
}
|
||||
})
|
||||
pagination.value.page = page;
|
||||
getData();
|
||||
},
|
||||
});
|
||||
|
||||
const hideFn = () => {
|
||||
showPreview.value = false
|
||||
}
|
||||
showPreview.value = false;
|
||||
};
|
||||
|
||||
Taro.useLoad(() => {
|
||||
getData()
|
||||
})
|
||||
getData();
|
||||
});
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const res = await getWithdrawList({
|
||||
PageNum: pagination.value.page,
|
||||
PageSize: pagination.value.showPageSize,
|
||||
Bid: user_info.bid
|
||||
})
|
||||
data.value = res.data.data || []
|
||||
pagination.value.totalItems = res.data.total
|
||||
row.value = res.data.integral || 0
|
||||
console.log(res)
|
||||
Bid: user_info.bid,
|
||||
});
|
||||
data.value = res.data.data || [];
|
||||
pagination.value.totalItems = res.data.total;
|
||||
row.value = res.data.integral || 0;
|
||||
console.log(res);
|
||||
} catch (e) {
|
||||
throw e
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const add = async () => {
|
||||
try {
|
||||
if (Number(basicData.value.num) === 0) return Taro.showToast({
|
||||
title: '提现积分需大于0',
|
||||
icon: 'none'
|
||||
})
|
||||
if (Number(basicData.value.num) === 0)
|
||||
return Taro.showToast({
|
||||
title: "提现积分需大于0",
|
||||
icon: "none",
|
||||
});
|
||||
const res = await addWithdraw({
|
||||
Bid: user_info.bid,
|
||||
Number: Number(basicData.value.num)
|
||||
})
|
||||
Number: Number(basicData.value.num),
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
await getData()
|
||||
icon: "none",
|
||||
});
|
||||
await getData();
|
||||
} catch (e) {
|
||||
throw e
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<nut-form>
|
||||
<nut-form-item label="提现积分:">
|
||||
<nut-input v-model="basicData.num" class="nut-input-text" placeholder="请输入提现积分" type="text"/>
|
||||
<nut-input
|
||||
v-model="basicData.num"
|
||||
class="nut-input-text"
|
||||
placeholder="请输入提现积分"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item>
|
||||
<view>
|
||||
@@ -141,19 +165,24 @@ const add = async () => {
|
||||
<view v-if="data.length > 0">
|
||||
<view class="data">
|
||||
<nut-table :columns="columns" :data="data"></nut-table>
|
||||
<nut-pagination class="pagination" v-model="pagination.page" :total-items="pagination.totalItems"
|
||||
:items-per-page="pagination.itemsPerPage" :show-page-size="pagination.showPageSize"
|
||||
@change="pagination.change" :bordered="false"/>
|
||||
<nut-pagination
|
||||
class="pagination"
|
||||
v-model="pagination.page"
|
||||
:total-items="pagination.totalItems"
|
||||
:items-per-page="pagination.itemsPerPage"
|
||||
:show-page-size="pagination.showPageSize"
|
||||
@change="pagination.change"
|
||||
:bordered="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无提现记录"></nut-empty>
|
||||
<!-- 图片预览 -->
|
||||
<nut-image-preview :show="showPreview" :images="imgData" @close="hideFn"/>
|
||||
<nut-image-preview :show="showPreview" :images="imgData" @close="hideFn" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
.text-red {
|
||||
color: red;
|
||||
}
|
||||
@@ -194,4 +223,4 @@ const add = async () => {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '购物车'
|
||||
})
|
||||
navigationBarTitleText: "购物车",
|
||||
});
|
||||
|
||||
@@ -1,117 +1,292 @@
|
||||
<template>
|
||||
<view>
|
||||
<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"/>
|
||||
<nut-cell-group v-for="(itm, idx) in list" :key="idx">
|
||||
<nut-cell>
|
||||
<nut-checkbox
|
||||
v-model="itm.state.checkbox"
|
||||
:indeterminate="itm.state.indeterminate"
|
||||
@change="(val: boolean) => changeBoxAll(val,idx)"
|
||||
>{{ itm.StoreName }}
|
||||
</nut-checkbox>
|
||||
</nut-cell>
|
||||
<nut-checkbox-group
|
||||
v-model="itm.state.checkboxgroup"
|
||||
:ref="(el) => getGroup(el, idx)"
|
||||
@change="(label) => changeBox(label, itm)"
|
||||
>
|
||||
<nut-cell v-for="(item, idx1) in itm.Goods" :key="idx1">
|
||||
<nut-checkbox :label="item.gid" style="width: 10%"></nut-checkbox>
|
||||
<view class="box">
|
||||
<view class="box-left">
|
||||
<img class="cover" :src="item.cover" alt="" />
|
||||
<view class="center">
|
||||
<view>{{ item.name }}</view>
|
||||
<view class="price">
|
||||
<view>{{ item.price }} 元</view>
|
||||
<view>{{ item.exchange }} 积分</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-input-number
|
||||
v-model="item.number"
|
||||
readonly
|
||||
:min="-1"
|
||||
@add.stop="() => onAdd(item)"
|
||||
@reduce.stop="() => onReduce(item)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template #right>
|
||||
<nut-button shape="square" style="height:100%" type="danger">删除</nut-button>
|
||||
</template>
|
||||
</nut-swipe>
|
||||
</nut-cell>
|
||||
</nut-checkbox-group>
|
||||
</nut-cell-group>
|
||||
</view>
|
||||
<nut-empty v-else description="购物车暂无数据">
|
||||
<!-- <nut-button icon="refresh" type="primary" @click="toPage()">去兑换商品</nut-button>-->
|
||||
</nut-empty>
|
||||
<nut-empty v-else description="购物车暂无数据"></nut-empty>
|
||||
<view>
|
||||
<view style="height: 100px"></view>
|
||||
<view style="height: 100rpx"></view>
|
||||
</view>
|
||||
<view class="bottom-box">
|
||||
<view class="left">
|
||||
<nut-checkbox v-model="selectAllVal" @change="selectAll">全选</nut-checkbox>
|
||||
<view class="text-box">
|
||||
总计积分:
|
||||
<nut-price v-model:price="localCount" size="normal" :need-symbol="false"/>
|
||||
<!-- <nut-checkbox v-model="selectAllVal" @change="selectAll"
|
||||
>全选
|
||||
</nut-checkbox> -->
|
||||
<view>
|
||||
<view class="text-box">
|
||||
总金额:
|
||||
<nut-price
|
||||
v-model:price="localCount.price"
|
||||
size="normal"
|
||||
:need-symbol="false"
|
||||
/>
|
||||
</view>
|
||||
<view class="text-box">
|
||||
总积分:
|
||||
<nut-price
|
||||
v-model:price="localCount.exchange"
|
||||
size="normal"
|
||||
:need-symbol="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-button type="primary" @click="sub">去结算</nut-button>
|
||||
</view>
|
||||
<!-- 支付 -->
|
||||
<Pay
|
||||
:is-show-pay="isShowPay"
|
||||
:interval="true"
|
||||
v-model:jfInfo="orderData"
|
||||
@closePay="closePay"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {getCartList} from '@/api/goods'
|
||||
import { nextTick, ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { addCart, getAllCart } from "@/api/cart";
|
||||
import { createActiveOrder } from "@/api/goods";
|
||||
import Pay from "@/components/Pay.vue";
|
||||
|
||||
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
|
||||
}
|
||||
})
|
||||
interface CardList {
|
||||
name: string;
|
||||
cover: string;
|
||||
bid: string;
|
||||
gid: string;
|
||||
number: string;
|
||||
price: number;
|
||||
exchange: number;
|
||||
}
|
||||
|
||||
const selectAll = () => {
|
||||
localCount.value = 0
|
||||
list.value.forEach((item: any) => {
|
||||
item.checkbox = selectAllVal.value
|
||||
})
|
||||
select()
|
||||
console.log(list.value)
|
||||
// const selectAllVal = ref(false);
|
||||
|
||||
interface List {
|
||||
StoreName: string;
|
||||
Goods: CardList[];
|
||||
state: {
|
||||
checkbox: boolean;
|
||||
indeterminate: boolean;
|
||||
checkboxgroup: string[];
|
||||
};
|
||||
}
|
||||
|
||||
const sub = () => {
|
||||
const arr = list.value.filter((item: any) => item.checkbox)
|
||||
if (arr.length === 0) {
|
||||
Taro.showToast({
|
||||
title: '请选择商品',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
const list = ref<List[]>([]);
|
||||
|
||||
const groupList = ref(new Map());
|
||||
|
||||
const localCount = ref({
|
||||
price: 0,
|
||||
exchange: 0,
|
||||
});
|
||||
|
||||
const getGroup = (el: any, idx: number) => {
|
||||
return groupList.value.set(idx, el);
|
||||
};
|
||||
|
||||
const changeBoxAll = async (value: boolean, idx: number) => {
|
||||
await nextTick(() => {
|
||||
groupList.value.get(idx).toggleAll(value);
|
||||
});
|
||||
};
|
||||
|
||||
const changeBox = (label: string[], item: any) => {
|
||||
localCount.value = {
|
||||
price: 0,
|
||||
exchange: 0,
|
||||
};
|
||||
|
||||
item["Count"] = {
|
||||
priceCount: 0,
|
||||
exchangeCount: 0,
|
||||
};
|
||||
|
||||
if (label.length > 0) {
|
||||
label.forEach((id: string) => {
|
||||
item.Goods.forEach((itm: any) => {
|
||||
if (itm.gid === id) {
|
||||
item["Count"].priceCount += itm.price * itm.number;
|
||||
item["Count"].exchangeCount += itm.exchange * itm.number;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/order_create/index'
|
||||
})
|
||||
}
|
||||
list.value.forEach((item: any) => {
|
||||
localCount.value.price += item.Count.priceCount;
|
||||
localCount.value.exchange += item.Count.exchangeCount;
|
||||
});
|
||||
|
||||
if (label.length === item.Goods.length) {
|
||||
item.state.checkbox = true;
|
||||
item.state.indeterminate = false;
|
||||
} else if (label.length && label.length < item.Goods.length) {
|
||||
item.state.indeterminate = true;
|
||||
} else {
|
||||
item.state.indeterminate = false;
|
||||
item.state.checkbox = false;
|
||||
}
|
||||
};
|
||||
|
||||
Taro.useDidShow(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
// const selectAll = () => {
|
||||
// localCount.value = {
|
||||
// price: 0,
|
||||
// exchange: 0,
|
||||
// };
|
||||
// groupList.value.forEach((item: any) => {
|
||||
// item.toggleAll(selectAllVal.value);
|
||||
// });
|
||||
// list.value.forEach((item: any) => {
|
||||
// if (item.state.checkboxgroup.length > 0) {
|
||||
// item.Goods.forEach((itm: any) => {
|
||||
// localCount.value.price += itm.price;
|
||||
// localCount.value.exchange += itm.exchange;
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
|
||||
const isShowPay = ref(false);
|
||||
const orderData = ref<any>([]);
|
||||
|
||||
const sub = async () => {
|
||||
const arr: any = list.value.filter(
|
||||
(item: any) => item.state.checkboxgroup.length > 0
|
||||
);
|
||||
if (arr.length === 0) {
|
||||
Taro.showToast({
|
||||
title: "请选择商品",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { data: res } = await createActiveOrder({
|
||||
Bid: arr.map((item: any) => item.StoreBid),
|
||||
});
|
||||
if (res.oid) {
|
||||
orderData.value = res?.oid;
|
||||
isShowPay.value = true;
|
||||
}
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const closePay = async (val: boolean) => {
|
||||
isShowPay.value = val;
|
||||
orderData.value = [];
|
||||
await getList();
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/order_list/index?type=0",
|
||||
});
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
const res = await getCartList()
|
||||
list.value = res.data.data.Goods.map((item: any) => {
|
||||
return {
|
||||
localCount.value = {
|
||||
price: 0,
|
||||
exchange: 0,
|
||||
};
|
||||
const res = await getAllCart();
|
||||
list.value = res.data.data || [];
|
||||
if (list.value.length > 0) {
|
||||
list.value = list.value.map((item: any) => ({
|
||||
...item,
|
||||
count: 1,
|
||||
countNum: item.number,
|
||||
checkbox: false
|
||||
}
|
||||
})
|
||||
}
|
||||
Goods: item.Goods.sort(
|
||||
(a: CardList, b: CardList) => Number(a.gid) - Number(b.gid)
|
||||
),
|
||||
state: {
|
||||
indeterminate: false,
|
||||
checkbox: false,
|
||||
checkboxgroup: [],
|
||||
},
|
||||
Count: {
|
||||
priceCount: 0,
|
||||
exchangeCount: 0,
|
||||
},
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
const toPage = () => {
|
||||
Taro.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
// const toPage = () => {
|
||||
// Taro.switchTab({
|
||||
// url: "/pages/index/index",
|
||||
// });
|
||||
// };
|
||||
|
||||
const onAdd = async (item: CardList) => {
|
||||
await add_cart(item, Number(item.number) + 1);
|
||||
};
|
||||
|
||||
const onReduce = async (item: CardList) => {
|
||||
await add_cart(item, Number(item.number) - 1);
|
||||
};
|
||||
|
||||
const add_cart = async (item: CardList, num: number = 1) => {
|
||||
try {
|
||||
const res = await addCart({
|
||||
Bid: item.bid,
|
||||
Gid: item.gid,
|
||||
Number: Number(num),
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
});
|
||||
await getList();
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -122,33 +297,34 @@ const toPage = () => {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.item {
|
||||
margin-top: 10px;
|
||||
padding: 20px;
|
||||
background-color: white;
|
||||
display: flex;
|
||||
justify-items: center;
|
||||
justify-content: space-between;
|
||||
.box {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
image {
|
||||
width: 200px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.text {
|
||||
width: 60%;
|
||||
margin-left: 20px;
|
||||
.box-left {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.bom {
|
||||
.cover {
|
||||
width: 130rpx;
|
||||
height: 130rpx;
|
||||
margin-right: 15rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,23 +336,22 @@ const toPage = () => {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
z-index: 999;
|
||||
height: 100rpx;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
box-shadow: 100px 104px 288px rgba(0, 0, 0, 0.01);
|
||||
padding: 0 20rpx;
|
||||
box-shadow: 100rpx 104rpx 288rpx rgba(0, 0, 0, 0.01);
|
||||
border-top: 1rpx solid #f5f5f5;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.text-box {
|
||||
margin-left: 10px;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '分类'
|
||||
})
|
||||
navigationBarTitleText: "分类",
|
||||
});
|
||||
|
||||
@@ -1,52 +1,48 @@
|
||||
<template>
|
||||
<nut-tabs
|
||||
style="height: 100vh"
|
||||
v-model="val"
|
||||
title-scroll
|
||||
ellipsis
|
||||
:animated-time="10"
|
||||
name="tabs"
|
||||
direction="vertical"
|
||||
@change="tabChange"
|
||||
<nut-tabs
|
||||
style="height: 100vh"
|
||||
v-model="val"
|
||||
title-scroll
|
||||
ellipsis
|
||||
:animated-time="10"
|
||||
name="tabs"
|
||||
direction="vertical"
|
||||
@change="tabChange"
|
||||
>
|
||||
<nut-tab-pane
|
||||
v-for="item in list"
|
||||
:title="(item.name as string)"
|
||||
:key="item.ID"
|
||||
>
|
||||
<nut-tab-pane
|
||||
v-for="item in list"
|
||||
:title="(item.name as string)"
|
||||
:key="item.ID"
|
||||
<view v-if="goodList.length > 0">
|
||||
<view
|
||||
class="list"
|
||||
v-for="(item, index) in (goodList as any)"
|
||||
:key="index"
|
||||
>
|
||||
<view v-if="goodList.length > 0">
|
||||
<view
|
||||
class="list"
|
||||
v-for="(item, index) in (goodList as any)"
|
||||
:key="index"
|
||||
<view class="item">
|
||||
<img :src="item.cover" />
|
||||
<view class="right">
|
||||
<view class="name">{{ item.name }}</view>
|
||||
<view class="bom">
|
||||
<view class="price"
|
||||
><text style="font-size: 15px">{{ item.number }}</text>
|
||||
积分</view
|
||||
>
|
||||
<view class="item">
|
||||
<img :src="item.cover" />
|
||||
<view class="right">
|
||||
<view class="name">{{ item.name }}</view>
|
||||
<view class="bom">
|
||||
<view class="price"
|
||||
><text style="font-size: 15px">{{
|
||||
item.number
|
||||
}}</text>
|
||||
积分</view
|
||||
>
|
||||
<nut-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click.stop="
|
||||
toGoodDetails(item.gid as number)
|
||||
"
|
||||
>去兑换</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click.stop="toGoodDetails(item.gid as number)"
|
||||
>去兑换</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无商品"></nut-empty>
|
||||
</nut-tab-pane>
|
||||
</nut-tabs>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无商品"></nut-empty>
|
||||
</nut-tab-pane>
|
||||
</nut-tabs>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -57,8 +53,8 @@ import { getCategoryList, getCategoryGoods } from "@/api/goods";
|
||||
const val = ref(0);
|
||||
|
||||
interface List {
|
||||
ID?: number;
|
||||
name?: string;
|
||||
ID?: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
const list = ref<Array<List>>([]);
|
||||
@@ -66,79 +62,79 @@ const list = ref<Array<List>>([]);
|
||||
const goodList = ref([]);
|
||||
|
||||
Taro.useDidShow(() => {
|
||||
getGoodsType();
|
||||
getGoodsType();
|
||||
});
|
||||
|
||||
// 获取商品分类
|
||||
const getGoodsType = async () => {
|
||||
const res = await getCategoryList();
|
||||
list.value = res.data.data;
|
||||
const res = await getCategoryList();
|
||||
list.value = res.data.data;
|
||||
|
||||
getData(list.value[val.value].ID as number);
|
||||
getData(list.value[val.value].ID as number);
|
||||
};
|
||||
|
||||
const getData = async (id: number) => {
|
||||
const res = await getCategoryGoods({
|
||||
class_id: id,
|
||||
});
|
||||
goodList.value = res.data.data;
|
||||
const res = await getCategoryGoods({
|
||||
class_id: id,
|
||||
});
|
||||
goodList.value = res.data.data;
|
||||
};
|
||||
|
||||
const tabChange = async () => {
|
||||
getData(list.value[val.value].ID as number);
|
||||
getData(list.value[val.value].ID as number);
|
||||
};
|
||||
|
||||
const toGoodDetails = (gid: number) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/goods/goods_detail/index?gid=${gid}`,
|
||||
});
|
||||
Taro.navigateTo({
|
||||
url: `/pages/goods/goods_detail/index?gid=${gid}`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.list {
|
||||
.item {
|
||||
display: flex;
|
||||
margin-bottom: 10px;
|
||||
img {
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.right {
|
||||
flex: 1;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
// text-align: right;
|
||||
|
||||
.name {
|
||||
// height: 20px;
|
||||
font-size: 28px;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.bom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
margin-top: 10px;
|
||||
.price {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #ff0000;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
.item {
|
||||
display: flex;
|
||||
margin-bottom: 10px;
|
||||
img {
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.right {
|
||||
flex: 1;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
// text-align: right;
|
||||
|
||||
.name {
|
||||
// height: 20px;
|
||||
font-size: 28px;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.bom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
margin-top: 10px;
|
||||
.price {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #ff0000;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "游戏详情",
|
||||
navigationStyle: "custom",
|
||||
navigationBarTitleText: "游戏详情",
|
||||
navigationStyle: "custom",
|
||||
});
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
<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>
|
||||
<nut-swiper
|
||||
class="swiper"
|
||||
:pagination-visible="true"
|
||||
pagination-color="#426543"
|
||||
auto-play="3000"
|
||||
>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/welcomenutui.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/fristfabu.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
</nut-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>
|
||||
<view
|
||||
class="head-wrapper"
|
||||
:style="{
|
||||
top: statusHeight + 'px',
|
||||
}"
|
||||
>
|
||||
<view class="head-menu">
|
||||
<Left class="iconfont" @click="returns" />
|
||||
<Home class="iconfont" @click="goHome" />
|
||||
</view>
|
||||
</view>
|
||||
<nut-swiper
|
||||
class="swiper"
|
||||
:pagination-visible="true"
|
||||
pagination-color="#426543"
|
||||
auto-play="3000"
|
||||
>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/welcomenutui.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
<nut-swiper-item>
|
||||
<image
|
||||
src="https://storage.360buyimg.com/jdc-article/fristfabu.jpg"
|
||||
alt=""
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
</nut-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,
|
||||
useLoad,
|
||||
getSystemInfoSync,
|
||||
navigateBack,
|
||||
switchTab,
|
||||
navigateTo,
|
||||
} from "@tarojs/taro";
|
||||
import { Left, Home } from "@nutui/icons-vue-taro";
|
||||
var statusBarHeight = getSystemInfoSync().statusBarHeight as number;
|
||||
@@ -71,89 +71,89 @@ const statusHeight = ref<number>(statusBarHeight);
|
||||
// const swiperList = ref([]);
|
||||
|
||||
useLoad((options) => {
|
||||
console.log(options);
|
||||
console.log(options);
|
||||
});
|
||||
|
||||
const returns = () => {
|
||||
navigateBack();
|
||||
navigateBack();
|
||||
};
|
||||
|
||||
const goHome = () => {
|
||||
switchTab({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
switchTab({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
};
|
||||
|
||||
const toGame = () => {
|
||||
navigateTo({
|
||||
url: "/pages/game/gameview/index",
|
||||
});
|
||||
navigateTo({
|
||||
url: "/pages/game/gameview/index",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.head-wrapper {
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
left: 30px;
|
||||
top: 0;
|
||||
height: 100px;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
.swiper {
|
||||
height: 450rpx;
|
||||
width: 100vw;
|
||||
image {
|
||||
width: 100%;
|
||||
}
|
||||
height: 450rpx;
|
||||
width: 100vw;
|
||||
image {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
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;
|
||||
}
|
||||
.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>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "活动游戏",
|
||||
navigationBarTitleText: "活动游戏",
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view>
|
||||
<web-view :src="url"></web-view>
|
||||
</view>
|
||||
<view>
|
||||
<web-view :src="url"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -11,8 +11,8 @@ import { useLoad, getStorageSync } from "@tarojs/taro";
|
||||
const url = ref("");
|
||||
|
||||
useLoad(() => {
|
||||
const user = getStorageSync("userInfo");
|
||||
url.value = `${process.env.TARO_APP_GAME}${user.uid}`;
|
||||
// const user = getStorageSync("userInfo");
|
||||
url.value = `${process.env.TARO_APP_GAME}${getStorageSync("token")}`;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "GameView",
|
||||
navigationBarTitleText: "GameView",
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<web-view
|
||||
style="height: 100vh; width: 100vw"
|
||||
:src="`https://www.jdt168.com/public/?uid=${user.uid}`"
|
||||
></web-view>
|
||||
<web-view
|
||||
style="height: 100vh; width: 100vw"
|
||||
:src="`https://www.jdt168.com/public/?uid=${user.uid}`"
|
||||
></web-view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -12,11 +12,11 @@ import { WebView } from "@tarojs/components";
|
||||
|
||||
const gameUrl = ref("");
|
||||
|
||||
const user = ref({})
|
||||
const user = ref({});
|
||||
|
||||
useLoad(() => {
|
||||
user.value = getStorageSync("userInfo");
|
||||
console.log(user);
|
||||
user.value = getStorageSync("userInfo");
|
||||
console.log(user);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '商品详情',
|
||||
navigationStyle: 'custom',
|
||||
})
|
||||
navigationBarTitleText: "商品详情",
|
||||
navigationStyle: "custom",
|
||||
});
|
||||
|
||||
@@ -1,462 +1,320 @@
|
||||
<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 :alt="idx.toString()" :src="itm"/>
|
||||
</nut-swiper-item>
|
||||
</nut-swiper>
|
||||
<!-- 标题价格 -->
|
||||
<view class="card">
|
||||
<view class="header">
|
||||
<nut-price
|
||||
size="large"
|
||||
:price="goodInfo.number as number"
|
||||
position="after"
|
||||
:symbol="payType === 'jf' ? '积分' : '元'"
|
||||
/>
|
||||
<view class="stock">
|
||||
库存剩余:{{ goodInfo.stock }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="title">{{ goodInfo.name }}</view>
|
||||
<view class="sub">{{ goodInfo.profile }}</view>
|
||||
</view>
|
||||
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
|
||||
<!-- 产品介绍 -->
|
||||
<view class="rich-box">
|
||||
<view class="title">产品介绍</view>
|
||||
<rich-text
|
||||
v-if="goodInfo.details"
|
||||
class="rich"
|
||||
:nodes="goodInfo.details"
|
||||
></rich-text>
|
||||
<nut-empty v-else description="暂无产品介绍"></nut-empty>
|
||||
</view>
|
||||
<view style="height: 9vh"></view>
|
||||
<!-- 底部 -->
|
||||
<view class="bottom-box">
|
||||
<view class="left">
|
||||
<view class="icon" @click="toPage('/pages/index/index')">
|
||||
<Home/>
|
||||
<view>首页</view>
|
||||
</view>
|
||||
<!-- <view-->
|
||||
<!-- class="icon"-->
|
||||
<!-- v-if="payType === 'jf'"-->
|
||||
<!-- @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="width: 80%">
|
||||
<!-- <nut-button-->
|
||||
<!-- v-if="payType === 'jf'"-->
|
||||
<!-- style="margin-right: 10px"-->
|
||||
<!-- type="warning"-->
|
||||
<!-- @click="add_cart()"-->
|
||||
<!-- >加入购物车-->
|
||||
<!-- </nut-button>-->
|
||||
<nut-button type="primary" block @click="toOrderDetail()"
|
||||
>{{ payType === 'jf' ? '立即兑换' : '立即购买' }}
|
||||
</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"
|
||||
button-size="30"
|
||||
/>
|
||||
</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="payType"
|
||||
v-model:jfInfo="orderData"
|
||||
@closePay="closePay"
|
||||
/>
|
||||
<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 :alt="idx.toString()" :src="itm" />
|
||||
</nut-swiper-item>
|
||||
</nut-swiper>
|
||||
<!-- 标题价格 -->
|
||||
<view class="card">
|
||||
<view class="header">
|
||||
<view class="price">
|
||||
<nut-price
|
||||
size="normal"
|
||||
:price="goodInfo.number as number"
|
||||
position="after"
|
||||
symbol="元"
|
||||
/>
|
||||
<nut-price
|
||||
size="normal"
|
||||
:price="goodInfo.exchange as number"
|
||||
position="after"
|
||||
symbol="积分"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="stock"> 库存剩余:{{ goodInfo.stock }}</view>
|
||||
</view>
|
||||
<view class="title">{{ goodInfo.name }}</view>
|
||||
<view class="sub">{{ goodInfo.profile }}</view>
|
||||
<nut-button size="small" type="primary" @click.stop="add_cart(goodInfo)">
|
||||
<template #icon>
|
||||
<Cart2 />
|
||||
</template>
|
||||
</nut-button>
|
||||
</view>
|
||||
<!-- 产品介绍 -->
|
||||
<view class="rich-box">
|
||||
<view class="title">产品介绍</view>
|
||||
<rich-text
|
||||
v-if="goodInfo.details"
|
||||
class="rich"
|
||||
:nodes="goodInfo.details"
|
||||
></rich-text>
|
||||
<nut-empty v-else description="暂无产品介绍"></nut-empty>
|
||||
</view>
|
||||
<view style="height: 9vh"></view>
|
||||
<!-- 底部 -->
|
||||
<!-- 购物车 -->
|
||||
<cart ref="cartRef" :mer-info="mer_info" @update-cart="updateCartNum" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight
|
||||
import {ref} from 'vue'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {Home, Left, My} from '@nutui/icons-vue-taro'
|
||||
import {createActiveOrder, createOrder, getActiveGoodsDetail, getGoodsDetail} from '@/api/goods'
|
||||
import Pay from '@/components/Pay.vue'
|
||||
import { Ref, ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { Home, Left } from "@nutui/icons-vue-taro";
|
||||
import { getActiveGoodsDetail } from "@/api/goods";
|
||||
import Cart from "@/components/Cart.vue";
|
||||
import { Cart2 } from "@nutui/icons-vue-taro";
|
||||
import { nextTick } from "vue";
|
||||
|
||||
const BarHeight = ref((statusBarHeight as number) + 7)
|
||||
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
|
||||
const BarHeight = ref((statusBarHeight as number) + 7);
|
||||
|
||||
const swiperList = ref([])
|
||||
|
||||
const isSkuShow = ref(false)
|
||||
|
||||
const isShowPay = ref(false)
|
||||
|
||||
// const sku = ref([]);
|
||||
|
||||
const payType = ref('')
|
||||
|
||||
const orderData = ref([])
|
||||
|
||||
const count = ref(1)
|
||||
const swiperList = ref([]);
|
||||
|
||||
interface GoodInfo {
|
||||
gid?: number;
|
||||
name?: string;
|
||||
number?: number;
|
||||
cover?: string;
|
||||
details?: string;
|
||||
sku?: any[];
|
||||
stock?: number;
|
||||
profile?: string;
|
||||
gid?: string;
|
||||
name?: string;
|
||||
number?: number;
|
||||
exchange?: number;
|
||||
cover?: string;
|
||||
details?: string;
|
||||
sku?: any[];
|
||||
stock?: number;
|
||||
profile?: string;
|
||||
price?: number;
|
||||
cartNum?: number;
|
||||
}
|
||||
|
||||
const goodInfo = ref<GoodInfo>({})
|
||||
const goodInfo = ref<GoodInfo>({});
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
payType.value = options.type === '1' ? 'wx' : 'jf'
|
||||
get_good_detail(options.gid)
|
||||
})
|
||||
Taro.useLoad(async (options) => {
|
||||
await get_good_detail(options.gid);
|
||||
mer_info.value = Taro.getStorageSync("mer_info");
|
||||
await nextTick(async () => {
|
||||
await cartRef.value.get_cart_list();
|
||||
});
|
||||
});
|
||||
|
||||
const get_good_detail = async (gid: string) => {
|
||||
try {
|
||||
let res: any
|
||||
if (payType.value === 'jf') {
|
||||
res = await getGoodsDetail({gid: gid})
|
||||
} else {
|
||||
res = await getActiveGoodsDetail({gid: gid})
|
||||
}
|
||||
goodInfo.value = {
|
||||
...res.data.data
|
||||
// details: res.data.data.details.,
|
||||
}
|
||||
|
||||
swiperList.value = res.data.data.rotation.split(',')
|
||||
} 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
|
||||
}
|
||||
}
|
||||
try {
|
||||
const res = await getActiveGoodsDetail({ gid: gid });
|
||||
goodInfo.value = {
|
||||
...res.data.data,
|
||||
// details: res.data.data.details.,
|
||||
};
|
||||
swiperList.value = res.data.data.rotation.split(",");
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
title: e.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const returns = () => {
|
||||
Taro.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
Taro.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
};
|
||||
|
||||
const goHome = () => {
|
||||
Taro.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
Taro.switchTab({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
};
|
||||
|
||||
interface CartItems {
|
||||
bid: string;
|
||||
gid: string;
|
||||
number: number;
|
||||
price: number;
|
||||
cover: string;
|
||||
name: string;
|
||||
exchange: number;
|
||||
}
|
||||
|
||||
const openSku = () => {
|
||||
isSkuShow.value = true
|
||||
}
|
||||
const mer_info = ref<any>({});
|
||||
|
||||
// const selectSku = () => {};
|
||||
// const clickBtnOperate = () => {};
|
||||
// const close = () => {};
|
||||
// const add_cart = async () => {
|
||||
// if (isSkuShow.value === false) return openSku();
|
||||
// try {
|
||||
// await addCart({ gid: goodInfo.value.gid });
|
||||
// Taro.showToast({
|
||||
// title: "加入购物车成功",
|
||||
// icon: "success",
|
||||
// duration: 2000,
|
||||
// });
|
||||
// } catch (e) {
|
||||
// Taro.showToast({
|
||||
// title: e.msg,
|
||||
// icon: "none",
|
||||
// });
|
||||
// }
|
||||
// isSkuShow.value = false;
|
||||
// };
|
||||
const cartRef = ref(null) as Ref;
|
||||
|
||||
const toOrderDetail = async () => {
|
||||
if (!Taro.getStorageSync('token')) {
|
||||
return Taro.showModal({
|
||||
title: '提示',
|
||||
content: '你还没登录,请先登录',
|
||||
cancelText: '先逛逛',
|
||||
confirmText: '去登录',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
Taro.reLaunch({
|
||||
url: '/pages/users/login/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (isSkuShow.value === false) return openSku()
|
||||
// Taro.navigateTo({
|
||||
// url: '/pages/goods/order_create/index'
|
||||
// })
|
||||
try {
|
||||
let res: any
|
||||
if (payType.value === 'jf') {
|
||||
res = await createOrder([
|
||||
{
|
||||
gid: goodInfo.value.gid,
|
||||
count: Number(count.value)
|
||||
}
|
||||
])
|
||||
} else {
|
||||
res = await createActiveOrder({
|
||||
gid: goodInfo.value.gid,
|
||||
stock: Number(count.value)
|
||||
})
|
||||
}
|
||||
const add_cart = async (item: any) => {
|
||||
const num = item.cartNum ? Number(item.cartNum) + 1 : 1;
|
||||
await nextTick(async () => {
|
||||
await cartRef.value.add_cart(item, num);
|
||||
});
|
||||
};
|
||||
|
||||
orderData.value = res?.data?.data
|
||||
|
||||
isShowPay.value = true
|
||||
|
||||
count.value = 1
|
||||
} 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'
|
||||
})
|
||||
}
|
||||
}
|
||||
const updateCartNum = (cartItems: CartItems[]) => {
|
||||
if (cartItems.length > 0) {
|
||||
cartItems.forEach((cartItem: CartItems) => {
|
||||
if (goodInfo.value.gid === cartItem.gid) {
|
||||
goodInfo.value.cartNum = cartItem.number;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Reflect.deleteProperty(goodInfo.value, "cartNum");
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
--nut-cell-box-shadow: none;
|
||||
// --nut-cell-padding: 0;
|
||||
--nut-cell-title-font: 30px;
|
||||
--nut-cell-box-shadow: none;
|
||||
--nut-cell-title-font: 30px;
|
||||
}
|
||||
|
||||
// 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: 30px;
|
||||
top: 0;
|
||||
height: 114px;
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
left: 30px;
|
||||
top: 0;
|
||||
height: 114px;
|
||||
}
|
||||
|
||||
.head-menu {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 54px;
|
||||
width: 140px;
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
border-radius: 27px;
|
||||
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;
|
||||
}
|
||||
.iconfont {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.nut-swiper-item img {
|
||||
width: 100%;
|
||||
height: 730px;
|
||||
width: 100%;
|
||||
height: 730px;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 30px;
|
||||
background-color: #fff;
|
||||
padding: 30px;
|
||||
background-color: #fff;
|
||||
position: relative;
|
||||
|
||||
.header {
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.title {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.stock {
|
||||
color: #8f8f8f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.sub {
|
||||
font-size: 24px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.rich {
|
||||
width: 100%;
|
||||
|
||||
// img {
|
||||
// width: 100%;
|
||||
// height: auto;
|
||||
// display: block;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
.nut-sku {
|
||||
// 适配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;
|
||||
box-sizing: border-box;
|
||||
bottom: 0;
|
||||
height: 150rpx;
|
||||
background: #fff;
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
// 适配ios底部安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
z-index: 999;
|
||||
width: 100%;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
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;
|
||||
width: 100px;
|
||||
// margin-right: 100px;
|
||||
}
|
||||
.price {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.stock {
|
||||
color: #8f8f8f;
|
||||
}
|
||||
}
|
||||
|
||||
.sub {
|
||||
font-size: 24px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.nut-button {
|
||||
// margin: 10px;
|
||||
position: absolute;
|
||||
right: 40rpx;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.rich {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.nut-sku {
|
||||
// 适配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;
|
||||
box-sizing: border-box;
|
||||
bottom: 0;
|
||||
height: 150rpx;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
// 适配ios底部安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
z-index: 999;
|
||||
width: 100%;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
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;
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #333;
|
||||
font-size: 25px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "提交订单"
|
||||
navigationBarTitleText: "提交订单",
|
||||
});
|
||||
|
||||
@@ -1,56 +1,53 @@
|
||||
<template>
|
||||
<view class="app">
|
||||
<view class="bg">
|
||||
<view class="card">
|
||||
<view class="left">
|
||||
<view>嘎嘎酒吧</view>
|
||||
<view>18888888888</view>
|
||||
<view>广西壮族自治区南宁市江南区</view>
|
||||
</view>
|
||||
<view class="right" @click="toLocal">
|
||||
<Find class="icon" />
|
||||
<view class="text">距离我{{ distance }}km</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="app">
|
||||
<view class="bg">
|
||||
<view class="card">
|
||||
<view class="left">
|
||||
<view>嘎嘎酒吧</view>
|
||||
<view>18888888888</view>
|
||||
<view>广西壮族自治区南宁市江南区</view>
|
||||
</view>
|
||||
<view class="order-info">21312312</view>
|
||||
<nut-form>
|
||||
<nut-form-item body-align="right" label="用户姓名">
|
||||
<nut-input
|
||||
:border="false"
|
||||
v-model="basicData.name"
|
||||
placeholder="请输入姓名"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item body-align="right" label="联系电话">
|
||||
<nut-input
|
||||
:border="false"
|
||||
v-model="basicData.phone"
|
||||
placeholder="请输入联系电话"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item body-align="right" label="订单备注">
|
||||
<nut-textarea
|
||||
class="nut-input-text"
|
||||
v-model="basicData.notes"
|
||||
placeholder="请输入备注"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
<!-- 底部 -->
|
||||
<view class="bottom-box">
|
||||
<view
|
||||
>总计:<nut-price
|
||||
:price="8888.01"
|
||||
position="after"
|
||||
symbol="积分"
|
||||
/></view>
|
||||
<nut-button type="primary" @click="orderPay">提交订单</nut-button>
|
||||
<view class="right" @click="toLocal">
|
||||
<Find class="icon" />
|
||||
<view class="text">距离我{{ distance }}km</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-info">21312312</view>
|
||||
<nut-form>
|
||||
<nut-form-item body-align="right" label="用户姓名">
|
||||
<nut-input
|
||||
:border="false"
|
||||
v-model="basicData.name"
|
||||
placeholder="请输入姓名"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item body-align="right" label="联系电话">
|
||||
<nut-input
|
||||
:border="false"
|
||||
v-model="basicData.phone"
|
||||
placeholder="请输入联系电话"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item body-align="right" label="订单备注">
|
||||
<nut-textarea
|
||||
class="nut-input-text"
|
||||
v-model="basicData.notes"
|
||||
placeholder="请输入备注"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
<!-- 底部 -->
|
||||
<view class="bottom-box">
|
||||
<view
|
||||
>总计:<nut-price :price="8888.01" position="after" symbol="积分"
|
||||
/></view>
|
||||
<nut-button type="primary" @click="orderPay">提交订单</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -62,122 +59,122 @@ import { ref } from "vue";
|
||||
const distance = ref("");
|
||||
|
||||
const basicData = ref({
|
||||
name: "",
|
||||
phone: "",
|
||||
notes: "",
|
||||
name: "",
|
||||
phone: "",
|
||||
notes: "",
|
||||
});
|
||||
|
||||
Taro.useLoad(() => {
|
||||
Taro.getLocation({
|
||||
type: "wgs84",
|
||||
success: function (res) {
|
||||
const latitude = res.latitude;
|
||||
const longitude = res.longitude;
|
||||
distance.value = calculateDistance(
|
||||
108.24898,
|
||||
22.83646,
|
||||
longitude,
|
||||
latitude
|
||||
);
|
||||
},
|
||||
});
|
||||
Taro.getLocation({
|
||||
type: "wgs84",
|
||||
success: function (res) {
|
||||
const latitude = res.latitude;
|
||||
const longitude = res.longitude;
|
||||
distance.value = calculateDistance(
|
||||
108.24898,
|
||||
22.83646,
|
||||
longitude,
|
||||
latitude
|
||||
);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
const toLocal = () => {
|
||||
Taro.openLocation({
|
||||
latitude: 22.83646,
|
||||
longitude: 108.24898,
|
||||
scale: 18,
|
||||
});
|
||||
Taro.openLocation({
|
||||
latitude: 22.83646,
|
||||
longitude: 108.24898,
|
||||
scale: 18,
|
||||
});
|
||||
};
|
||||
|
||||
const orderPay = () => {
|
||||
Taro.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
Taro.redirectTo({
|
||||
url: "/pages/goods/order_status/index",
|
||||
});
|
||||
}, 2000);
|
||||
},
|
||||
});
|
||||
Taro.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
Taro.redirectTo({
|
||||
url: "/pages/goods/order_status/index",
|
||||
});
|
||||
}, 2000);
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.bg {
|
||||
background: linear-gradient(0deg, #f5f5f5, #0396ffc7);
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
padding: 10px 0;
|
||||
background: linear-gradient(0deg, #f5f5f5, #0396ffc7);
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
padding: 10px 0;
|
||||
|
||||
.card {
|
||||
width: 90%;
|
||||
height: 75%;
|
||||
margin: 0 auto;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
position: relative;
|
||||
border-bottom: 1px dashed #ccc;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
|
||||
.left {
|
||||
width: 70%;
|
||||
color: #333;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
|
||||
.icon {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 25px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-info {
|
||||
.card {
|
||||
width: 90%;
|
||||
height: 75%;
|
||||
margin: 0 auto;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
position: relative;
|
||||
border-bottom: 1px dashed #ccc;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.left {
|
||||
width: 70%;
|
||||
color: #333;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
|
||||
.icon {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 25px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-info {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.nut-input-text {
|
||||
height: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.bottom-box {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
height: 9vh;
|
||||
background: #fff;
|
||||
// IOS安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
height: 9vh;
|
||||
background: #fff;
|
||||
// IOS安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "订单状态",
|
||||
navigationBarTitleText: "订单状态",
|
||||
});
|
||||
|
||||
@@ -1,30 +1,26 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card">
|
||||
<view class="icon">
|
||||
<Check
|
||||
font-class-name="nutui-iconfont check"
|
||||
size="70"
|
||||
color="#fff"
|
||||
/>
|
||||
<!-- <CloseLittle font-class-name="nutui-iconfont check" size="70" color="#fff" /> -->
|
||||
</view>
|
||||
<view class="text-box">
|
||||
<view class="title">支付成功</view>
|
||||
<nut-button block type="primary" @click="toOrderPage"
|
||||
>查看订单</nut-button
|
||||
>
|
||||
<nut-button
|
||||
block
|
||||
plain
|
||||
style="margin-top: 10px"
|
||||
type="primary"
|
||||
@click="toHome"
|
||||
>返回首页</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="card">
|
||||
<view class="icon">
|
||||
<Check font-class-name="nutui-iconfont check" size="70" color="#fff" />
|
||||
<!-- <CloseLittle font-class-name="nutui-iconfont check" size="70" color="#fff" /> -->
|
||||
</view>
|
||||
<view class="text-box">
|
||||
<view class="title">支付成功</view>
|
||||
<nut-button block type="primary" @click="toOrderPage"
|
||||
>查看订单</nut-button
|
||||
>
|
||||
<nut-button
|
||||
block
|
||||
plain
|
||||
style="margin-top: 10px"
|
||||
type="primary"
|
||||
@click="toHome"
|
||||
>返回首页</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -32,66 +28,66 @@ import { Check, CloseLittle } from "@nutui/icons-vue-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
const toHome = () => {
|
||||
Taro.switchTab({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
Taro.switchTab({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
};
|
||||
|
||||
const toOrderPage = () => {
|
||||
Taro.redirectTo({
|
||||
url: "/pages/users/order_list/index?type=0",
|
||||
});
|
||||
Taro.redirectTo({
|
||||
url: "/pages/users/order_list/index?type=0",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.card {
|
||||
width: 90%;
|
||||
height: 600px;
|
||||
width: 90%;
|
||||
height: 600px;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 200px auto;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
flex-direction: column;
|
||||
|
||||
.icon {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: -100px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
border: #f5f5f5 10px solid;
|
||||
text-align: center;
|
||||
|
||||
.check {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.text-box {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
margin: 200px auto;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
flex-direction: column;
|
||||
padding: 0 100px;
|
||||
|
||||
.icon {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-color: red;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: -100px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
border: #f5f5f5 10px solid;
|
||||
text-align: center;
|
||||
|
||||
.check {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.text-box {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 0 100px;
|
||||
|
||||
.title {
|
||||
font-size: 60px;
|
||||
color: #333;
|
||||
margin: 100px;
|
||||
}
|
||||
.title {
|
||||
font-size: 60px;
|
||||
color: #333;
|
||||
margin: 100px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '活动订单',
|
||||
})
|
||||
|
||||
navigationBarTitleText: "活动订单",
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import {
|
||||
useLoad,
|
||||
useReachBottom,
|
||||
showToast,
|
||||
navigateTo,
|
||||
setStorageSync,
|
||||
useLoad,
|
||||
useReachBottom,
|
||||
showToast,
|
||||
navigateTo,
|
||||
setStorageSync,
|
||||
} from "@tarojs/taro";
|
||||
import Pay from "@/components/Pay.vue";
|
||||
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods";
|
||||
@@ -16,116 +16,116 @@ const tabValue = ref(0);
|
||||
const isShowPay = ref(false);
|
||||
|
||||
const tabsList = ref([
|
||||
{
|
||||
title: "全部",
|
||||
value: 0,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "待付款",
|
||||
value: 1,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "待使用",
|
||||
value: 2,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "已使用",
|
||||
value: 3,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "已失效",
|
||||
value: 4,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "全部",
|
||||
value: 0,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "待付款",
|
||||
value: 1,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "待使用",
|
||||
value: 2,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "已使用",
|
||||
value: 3,
|
||||
num: 0,
|
||||
},
|
||||
{
|
||||
title: "已失效",
|
||||
value: 4,
|
||||
num: 0,
|
||||
},
|
||||
]);
|
||||
|
||||
const jfInfo = ref({});
|
||||
|
||||
interface OrderList {
|
||||
oid: string;
|
||||
add_time: string;
|
||||
status: number;
|
||||
BindGoods: {
|
||||
cover: string;
|
||||
name: string;
|
||||
number: number;
|
||||
};
|
||||
count: number;
|
||||
oid: string;
|
||||
add_time: string;
|
||||
status: number;
|
||||
BindGoods: {
|
||||
cover: string;
|
||||
name: string;
|
||||
number: number;
|
||||
};
|
||||
count: number;
|
||||
number: number;
|
||||
}
|
||||
|
||||
const orderList = ref<OrderList[]>([]);
|
||||
|
||||
useLoad((options) => {
|
||||
console.log(options);
|
||||
// tabValue.value = Number(options.type);
|
||||
getList();
|
||||
console.log(options);
|
||||
// tabValue.value = Number(options.type);
|
||||
getList();
|
||||
});
|
||||
|
||||
const countInfo = ref<any>({});
|
||||
|
||||
const getTj = async () => {
|
||||
try {
|
||||
const res = await getOrderStatistics({
|
||||
type: 1,
|
||||
});
|
||||
countInfo.value = res.data.data;
|
||||
console.log(res);
|
||||
tabsList.value[0].num = countInfo.value.A;
|
||||
tabsList.value[1].num = countInfo.value.B;
|
||||
tabsList.value[2].num = countInfo.value.C;
|
||||
tabsList.value[3].num = countInfo.value.D;
|
||||
tabsList.value[4].num = countInfo.value.F;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
try {
|
||||
const res = await getOrderStatistics({
|
||||
type: 1,
|
||||
});
|
||||
countInfo.value = res.data.data;
|
||||
console.log(res);
|
||||
tabsList.value[0].num = countInfo.value.A;
|
||||
tabsList.value[1].num = countInfo.value.B;
|
||||
tabsList.value[2].num = countInfo.value.C;
|
||||
tabsList.value[3].num = countInfo.value.D;
|
||||
tabsList.value[4].num = countInfo.value.F;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
try {
|
||||
const res = await getActiveOrderList({
|
||||
status: tabValue.value,
|
||||
});
|
||||
console.log(res);
|
||||
orderList.value = res.data.data;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
getTj();
|
||||
try {
|
||||
const res = await getActiveOrderList({
|
||||
status: tabValue.value,
|
||||
});
|
||||
console.log(res);
|
||||
orderList.value = res.data.data;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
getTj();
|
||||
};
|
||||
|
||||
const tabChange = (index: number) => {
|
||||
tabValue.value = index;
|
||||
getList();
|
||||
tabValue.value = index;
|
||||
getList();
|
||||
};
|
||||
|
||||
useReachBottom(() => {
|
||||
console.log("useReachBottom");
|
||||
console.log("useReachBottom");
|
||||
});
|
||||
|
||||
const openPay = (item: OrderList) => {
|
||||
isShowPay.value = true;
|
||||
jfInfo.value = item;
|
||||
isShowPay.value = true;
|
||||
jfInfo.value = item;
|
||||
};
|
||||
|
||||
const errPay = () => {
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
getList();
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
getList();
|
||||
};
|
||||
|
||||
// const successPay = (val: boolean) => {
|
||||
@@ -139,239 +139,235 @@ const errPay = () => {
|
||||
// };
|
||||
|
||||
const closePay = () => {
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付取消",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
getList();
|
||||
isShowPay.value = false;
|
||||
showToast({
|
||||
title: "支付取消",
|
||||
icon: "none",
|
||||
});
|
||||
jfInfo.value = {};
|
||||
getList();
|
||||
};
|
||||
|
||||
const toDetail = (item: any) => {
|
||||
setStorageSync("item", item);
|
||||
navigateTo({
|
||||
url: `/pages/users/order_list_detail/index?Id=${item.oid}&type=1`,
|
||||
});
|
||||
setStorageSync("item", item);
|
||||
navigateTo({
|
||||
url: `/pages/users/order_list_detail/index?Id=${item.oid}&type=1`,
|
||||
});
|
||||
};
|
||||
|
||||
const delOrder = async (oid: string) => {
|
||||
try {
|
||||
const res = await deleteActiveOrder({
|
||||
oid,
|
||||
});
|
||||
console.log(res);
|
||||
getList();
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
try {
|
||||
const res = await deleteActiveOrder({
|
||||
oid,
|
||||
});
|
||||
console.log(res);
|
||||
getList();
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<view class="topTips">
|
||||
<view>
|
||||
<view style="font-weight: bold">订单信息</view>
|
||||
<view style="font-size: 15px"
|
||||
>总消费(元):{{ countInfo.Total || 0 }}
|
||||
</view>
|
||||
</view>
|
||||
<image src="../static/user/order_list_top.png" />
|
||||
<view>
|
||||
<view class="topTips">
|
||||
<view>
|
||||
<view style="font-weight: bold">订单信息</view>
|
||||
<view style="font-size: 15px"
|
||||
>总消费(元):{{ countInfo.Total || 0 }}
|
||||
</view>
|
||||
<view class="tabs-box">
|
||||
<view
|
||||
v-for="item in tabsList"
|
||||
:key="item.value"
|
||||
@click="tabChange(item.value)"
|
||||
>
|
||||
<view class="text">{{ item.title }}</view>
|
||||
<view>{{ item.num }}</view>
|
||||
<view
|
||||
class="line"
|
||||
:class="{ lineColor: item.value === tabValue }"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<image src="../static/user/order_list_top.png" />
|
||||
</view>
|
||||
<view class="tabs-box">
|
||||
<view
|
||||
v-for="item in tabsList"
|
||||
:key="item.value"
|
||||
@click="tabChange(item.value)"
|
||||
>
|
||||
<view class="text">{{ item.title }}</view>
|
||||
<view>{{ item.num }}</view>
|
||||
<view
|
||||
class="line"
|
||||
:class="{ lineColor: item.value === tabValue }"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="orderList.length > 0">
|
||||
<view class="order-card" v-for="(item, index) in orderList" :key="index">
|
||||
<view class="top">
|
||||
<view>{{ item.add_time.slice(0, 19).replace("T", " ") }}</view>
|
||||
<view style="color: red"
|
||||
>{{
|
||||
item.status === 0
|
||||
? "待付款"
|
||||
: item.status === 1
|
||||
? "待使用"
|
||||
: item.status === 2
|
||||
? "已使用"
|
||||
: "已失效"
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="orderList.length > 0">
|
||||
<view
|
||||
class="order-card"
|
||||
v-for="(item, index) in orderList"
|
||||
:key="index"
|
||||
>
|
||||
<view class="top">
|
||||
<view>{{
|
||||
item.add_time.slice(0, 19).replace("T", " ")
|
||||
}}</view>
|
||||
<view style="color: red">{{
|
||||
item.status === 0
|
||||
? "待付款"
|
||||
: item.status === 1
|
||||
? "待使用"
|
||||
: item.status === 2
|
||||
? "已使用"
|
||||
: "已失效"
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="center">
|
||||
<view class="top">
|
||||
<image :src="item.BindGoods.cover" />
|
||||
<view class="title">{{ item.BindGoods.name }} </view>
|
||||
<view class="right">
|
||||
<view>{{ item.number }}</view>
|
||||
<!-- <view>x{{ item.count }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view
|
||||
<view class="line"></view>
|
||||
<view class="center">
|
||||
<view class="top">
|
||||
<image :src="item.BindGoods.cover" />
|
||||
<view class="title">{{ item.BindGoods.name }}</view>
|
||||
<view class="right">
|
||||
<view>{{ item.number }}</view>
|
||||
<!-- <view>x{{ item.count }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view
|
||||
class="bom"
|
||||
style="text-align: right; font-size: 13px"
|
||||
>
|
||||
共{{ item.count }}件商品,实付(元):
|
||||
<text style="color: red">{{ item.number }}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="btn">
|
||||
<nut-button
|
||||
v-if="item.status === 0"
|
||||
plain
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="delOrder(item.oid)"
|
||||
>删除订单
|
||||
</nut-button>
|
||||
<nut-button
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="toDetail(item)"
|
||||
>查看详情
|
||||
</nut-button>
|
||||
<nut-button
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
type="primary"
|
||||
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"
|
||||
@errPay="errPay"
|
||||
@closePay="closePay"
|
||||
:jfInfo="jfInfo"
|
||||
/>
|
||||
<view class="line"></view>
|
||||
<view class="btn">
|
||||
<nut-button
|
||||
v-if="item.status === 0"
|
||||
plain
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="delOrder(item.oid)"
|
||||
>删除订单
|
||||
</nut-button>
|
||||
<nut-button
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="toDetail(item)"
|
||||
>查看详情
|
||||
</nut-button>
|
||||
<nut-button
|
||||
style="margin-left: 5px"
|
||||
size="small"
|
||||
type="primary"
|
||||
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"
|
||||
@errPay="errPay"
|
||||
@closePay="closePay"
|
||||
:jfInfo="jfInfo"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.topTips {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
background-color: #ff0000;
|
||||
color: #ffffff;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
background-color: #ff0000;
|
||||
color: #ffffff;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
}
|
||||
image {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
.tabs-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: auto;
|
||||
background-color: #fff;
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
|
||||
.text {
|
||||
margin: 10px 20px;
|
||||
align-items: center;
|
||||
height: auto;
|
||||
background-color: #fff;
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin: 10px 20px;
|
||||
align-items: center;
|
||||
}
|
||||
.line {
|
||||
margin: 0 auto;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
border-radius: 30px;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.line {
|
||||
margin: 0 auto;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
border-radius: 30px;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.lineColor {
|
||||
background-color: #ff0000;
|
||||
}
|
||||
.lineColor {
|
||||
background-color: #ff0000;
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
margin: 15px auto;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
width: 95%;
|
||||
box-sizing: border-box;
|
||||
margin: 15px auto;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 10px;
|
||||
}
|
||||
.line {
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background-color: #f5f5f5;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center {
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.center {
|
||||
.top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// align-items: flex-start;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
// align-items: flex-start;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '活动商品',
|
||||
})
|
||||
|
||||
navigationBarTitleText: "活动商品",
|
||||
});
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 金刚区 -->
|
||||
<view class="top-box">
|
||||
<view class="item">
|
||||
<view @click="hotGoodsDetail">
|
||||
<IconFont
|
||||
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
|
||||
size="40"
|
||||
/>
|
||||
<view>我的订单</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="item"> </view>
|
||||
<view class="item">
|
||||
<view></view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- 金刚区 -->
|
||||
<view class="top-box">
|
||||
<view class="item">
|
||||
<view @click="hotGoodsDetail">
|
||||
<IconFont
|
||||
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
|
||||
size="40"
|
||||
/>
|
||||
<view>我的订单</view>
|
||||
</view>
|
||||
<!-- 商品列表 -->
|
||||
<!-- <view class="goodBox">
|
||||
</view>
|
||||
<view class="item">
|
||||
<view></view>
|
||||
</view>
|
||||
<view class="item"> </view>
|
||||
<view class="item">
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品列表 -->
|
||||
<!-- <view class="goodBox">
|
||||
<view
|
||||
class="good"
|
||||
v-for="item in list"
|
||||
@@ -42,38 +42,38 @@
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="goodBox">
|
||||
<view
|
||||
class="good"
|
||||
v-for="item in (merdata as any)"
|
||||
:key="item.ID"
|
||||
@click.stop="toMerDetails(item)"
|
||||
>
|
||||
<image :src="(item.head_photo as string)" />
|
||||
<view class="good-text-box">
|
||||
<text class="good-text">{{ item.name }}</text>
|
||||
<text style="color: #999"
|
||||
>距离我{{
|
||||
calculateDistance(
|
||||
userLocalNum.t,
|
||||
userLocalNum.l,
|
||||
Number(item.lat),
|
||||
Number(item.lon)
|
||||
)
|
||||
}}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goodBox">
|
||||
<view
|
||||
class="good"
|
||||
v-for="item in (merdata as any)"
|
||||
:key="item.ID"
|
||||
@click.stop="toMerDetails(item)"
|
||||
>
|
||||
<image :src="(item.head_photo as string)" />
|
||||
<view class="good-text-box">
|
||||
<text class="good-text">{{ item.name }}</text>
|
||||
<text style="color: #999"
|
||||
>距离我{{
|
||||
calculateDistance(
|
||||
userLocalNum.t,
|
||||
userLocalNum.l,
|
||||
Number(item.lat),
|
||||
Number(item.lon)
|
||||
)
|
||||
}}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import {
|
||||
// getActiveGoods,
|
||||
getMerList,
|
||||
// getActiveGoods,
|
||||
getMerList,
|
||||
} from "../../../api/goods";
|
||||
import { IconFont } from "@nutui/icons-vue-taro";
|
||||
import { calculateDistance } from "@/utils";
|
||||
@@ -81,8 +81,8 @@ import { calculateDistance } from "@/utils";
|
||||
// const list = ref<any>([]);
|
||||
|
||||
Taro.useLoad(() => {
|
||||
// getList();
|
||||
get_mer_list();
|
||||
// getList();
|
||||
get_mer_list();
|
||||
});
|
||||
|
||||
// const getList = async () => {
|
||||
@@ -98,109 +98,109 @@ Taro.useLoad(() => {
|
||||
// };
|
||||
|
||||
const hotGoodsDetail = () => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/hotGoods/hot_list/index`,
|
||||
});
|
||||
Taro.navigateTo({
|
||||
url: `/pages/hotGoods/hot_list/index`,
|
||||
});
|
||||
};
|
||||
|
||||
const merdata = ref([]);
|
||||
|
||||
const userLocalNum = ref({
|
||||
l: 0,
|
||||
t: 0,
|
||||
l: 0,
|
||||
t: 0,
|
||||
});
|
||||
|
||||
const get_mer_list = async () => {
|
||||
Taro.getLocation({
|
||||
type: "wgs84",
|
||||
success: (res) => {
|
||||
userLocalNum.value.l = res.longitude;
|
||||
userLocalNum.value.t = res.latitude;
|
||||
},
|
||||
});
|
||||
Taro.getLocation({
|
||||
type: "wgs84",
|
||||
success: (res) => {
|
||||
userLocalNum.value.l = res.longitude;
|
||||
userLocalNum.value.t = res.latitude;
|
||||
},
|
||||
});
|
||||
|
||||
const res = await getMerList({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
Btype: 1,
|
||||
classid: 0,
|
||||
});
|
||||
merdata.value = res.data.data;
|
||||
const res = await getMerList({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
Btype: 1,
|
||||
classid: 0,
|
||||
});
|
||||
merdata.value = res.data.data;
|
||||
};
|
||||
|
||||
const toMerDetails = (item: any) => {
|
||||
Taro.setStorageSync("mer_info", item);
|
||||
Taro.navigateTo({
|
||||
url: `/pages/mer/mer_detail/index`,
|
||||
});
|
||||
Taro.setStorageSync("mer_info", item);
|
||||
Taro.navigateTo({
|
||||
url: `/pages/mer/mer_detail/index`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.top-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 10px 20px 0 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 10px 20px 0 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
|
||||
.item {
|
||||
width: 150px;
|
||||
padding: 10px;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
.item {
|
||||
width: 150px;
|
||||
padding: 10px;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
-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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '首页',
|
||||
enableShareAppMessage: true
|
||||
})
|
||||
navigationBarTitleText: "首页",
|
||||
enableShareAppMessage: true,
|
||||
});
|
||||
|
||||
@@ -1,249 +1,180 @@
|
||||
<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="#000"
|
||||
duration="1000"
|
||||
:loop="false"
|
||||
>
|
||||
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in itm"
|
||||
:key="index"
|
||||
@click="toDetails(item)"
|
||||
>
|
||||
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
||||
<img :alt="itm.ID.toString()" :src="itm.url"/>
|
||||
</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="goodBox">
|
||||
<view
|
||||
class="good"
|
||||
v-for="item in (merdata as any)"
|
||||
:key="item.ID"
|
||||
@click.stop="toMerDetails(item)"
|
||||
>
|
||||
<image :src="(item.head_photo as string)"/>
|
||||
<view class="good-text-box">
|
||||
<text class="good-text">{{ item.name }}</text>
|
||||
<text style="color: #999"
|
||||
>距离我{{
|
||||
calculateDistance(
|
||||
userLocalNum.t,
|
||||
userLocalNum.l,
|
||||
Number(item.lat),
|
||||
Number(item.lon)
|
||||
)
|
||||
}}
|
||||
</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<image :src="item.icon" />
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</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>
|
||||
<MerList />
|
||||
<!-- 签到弹窗 -->
|
||||
<Popup />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {bindParent, getBanner} from '@/api/user'
|
||||
import {getMerList} from '@/api/goods'
|
||||
import {calculateDistance} from '@/utils'
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import Popup from "@/components/Popup.vue";
|
||||
import MerList from "@/components/MerList.vue";
|
||||
import { getHomeList } from "@/api/home";
|
||||
|
||||
const searchValue = ref('')
|
||||
const searchValue = ref("");
|
||||
|
||||
const swiperList = ref<any>([])
|
||||
interface SwiperList {
|
||||
ID: number;
|
||||
icon: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
const swiperList = ref<Array<Array<SwiperList>>>([]);
|
||||
|
||||
const userMenuList = ref([
|
||||
{
|
||||
id: 1,
|
||||
label: '活动游戏',
|
||||
url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync('token')}`,
|
||||
icon: 'http://jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
label: '活动商品',
|
||||
url: '/pages/hotGoods/index/index',
|
||||
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?uid=${Taro.getStorageSync("token")}`,
|
||||
icon: "//jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
label: "活动商品",
|
||||
// url: "/pages/hotGoods/index/index",
|
||||
url: "",
|
||||
icon: "//jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
label: "商户入驻",
|
||||
url: "/pages/users/settled_mer/index",
|
||||
icon: "//jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
label: "最新资讯",
|
||||
url: "",
|
||||
icon: "//jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png",
|
||||
},
|
||||
]);
|
||||
|
||||
Taro.useDidShow(async () => {
|
||||
await getBannerList()
|
||||
await get_mer_list()
|
||||
if (Taro.getStorageSync('token') && Taro.getStorageSync('bind_id')) {
|
||||
try {
|
||||
const res = await bindParent({
|
||||
uid: Taro.getStorageSync('bind_id')
|
||||
})
|
||||
Taro.showToast({
|
||||
title: res.msg
|
||||
})
|
||||
Taro.removeStorageSync('bind_id')
|
||||
} catch (error) {
|
||||
Taro.removeStorageSync('bind_id')
|
||||
throw error
|
||||
}
|
||||
}
|
||||
})
|
||||
await getBannerList();
|
||||
});
|
||||
|
||||
Taro.useShareAppMessage(() => ({
|
||||
title: '捷兑通',
|
||||
path: `/pages/index/index?scene=${Taro.getStorageSync('token')}`,
|
||||
imageUrl:
|
||||
'https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg'
|
||||
}))
|
||||
|
||||
const merdata = ref([])
|
||||
|
||||
const userLocalNum = ref({
|
||||
l: 0,
|
||||
t: 0
|
||||
})
|
||||
|
||||
const get_mer_list = async () => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84',
|
||||
success: (res) => {
|
||||
userLocalNum.value.l = res.longitude
|
||||
userLocalNum.value.t = res.latitude
|
||||
}
|
||||
})
|
||||
|
||||
const res = await getMerList({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
Btype: 2,
|
||||
classid: 0
|
||||
})
|
||||
merdata.value = res.data.data
|
||||
}
|
||||
title: "捷兑通",
|
||||
path: `/pages/index/index?scene=${Taro.getStorageSync("token")}`,
|
||||
imageUrl:
|
||||
"https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg",
|
||||
}));
|
||||
|
||||
const getBannerList = async () => {
|
||||
const {data}: any = await getBanner()
|
||||
swiperList.value = data.data
|
||||
}
|
||||
const { data } = await getHomeList();
|
||||
if (data.data.length > 0) {
|
||||
// for (let i = 0; i < 31; i++) {
|
||||
// data.data.push({
|
||||
// ID: i,
|
||||
// icon: "//jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
|
||||
// name: "活动商品",
|
||||
// });
|
||||
// }
|
||||
// 数组分组
|
||||
const arr = [];
|
||||
for (let i = 0; i < data.data.length; i += 10) {
|
||||
arr.push(data.data.slice(i, i + 10));
|
||||
}
|
||||
swiperList.value = arr;
|
||||
}
|
||||
};
|
||||
|
||||
const toPage = (url: string) => {
|
||||
Taro.navigateTo({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
};
|
||||
|
||||
const toMerDetails = (item: any) => {
|
||||
Taro.setStorageSync('mer_info', item)
|
||||
Taro.navigateTo({
|
||||
url: `/pages/mer/mer_detail/index`
|
||||
})
|
||||
}
|
||||
const toDetails = (item: SwiperList) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/search/index?id=${item.ID}&name=${item.name}`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.nut-swiper-item img {
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
.nut-swiper {
|
||||
background: #ffffff;
|
||||
|
||||
.nut-swiper-item {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.goodBox {
|
||||
display: flex;
|
||||
padding: 20px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
.good {
|
||||
width: 340px;
|
||||
background-color: #fff;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 10px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
border-top-right-radius: 10px;
|
||||
border-top-left-radius: 10px;
|
||||
}
|
||||
|
||||
.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: 1;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
3
src/pages/marketing/sign/index.config.ts
Normal file
3
src/pages/marketing/sign/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "每日签到",
|
||||
});
|
||||
7
src/pages/marketing/sign/index.vue
Normal file
7
src/pages/marketing/sign/index.vue
Normal file
@@ -0,0 +1,7 @@
|
||||
<script setup lang="ts"></script>
|
||||
|
||||
<template>
|
||||
<view></view>
|
||||
</template>
|
||||
|
||||
<style lang="scss"></style>
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "",
|
||||
navigationBarTitleText: "",
|
||||
});
|
||||
|
||||
@@ -1,327 +1,358 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 幻灯片 -->
|
||||
<nut-swiper
|
||||
:init-page="0"
|
||||
:pagination-visible="true"
|
||||
pagination-color="red"
|
||||
auto-play="3000"
|
||||
>
|
||||
<nut-swiper-item
|
||||
v-for="(itm, idx) in (swiperList as any)"
|
||||
:key="idx"
|
||||
>
|
||||
<img
|
||||
style="width: 100%; height: 100%"
|
||||
:src="itm"
|
||||
:alt="idx.toString()"
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
</nut-swiper>
|
||||
<!-- 商家信息 -->
|
||||
<view class="infoBox">
|
||||
<view class="title">{{ mer_info.name }}</view>
|
||||
<view class="bom">
|
||||
<view class="left">
|
||||
<view>{{ mer_info.address || '暂无商家地址' }}</view>
|
||||
<view class="sub"
|
||||
>距你{{
|
||||
calculateDistance(
|
||||
userLocalNum.t,
|
||||
userLocalNum.l,
|
||||
Number(mer_info.lat),
|
||||
Number(mer_info.lon)
|
||||
)
|
||||
}}
|
||||
</view
|
||||
>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view @click="clickMap">
|
||||
<Locationg3 color="red" size="25"/>
|
||||
<view>导航</view>
|
||||
</view>
|
||||
<view @click="clickPhone">
|
||||
<Find color="red" size="25"/>
|
||||
<view>电话</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- 幻灯片 -->
|
||||
<nut-swiper
|
||||
:init-page="0"
|
||||
:pagination-visible="true"
|
||||
pagination-color="red"
|
||||
auto-play="3000"
|
||||
>
|
||||
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
||||
<img
|
||||
style="width: 100%; height: 100%"
|
||||
:src="itm"
|
||||
:alt="idx.toString()"
|
||||
/>
|
||||
</nut-swiper-item>
|
||||
</nut-swiper>
|
||||
<!-- 商家信息 -->
|
||||
<view class="infoBox">
|
||||
<view class="title">{{ mer_info.name }}</view>
|
||||
<view class="bom">
|
||||
<view class="left">
|
||||
<view>{{ mer_info.address || "暂无商家地址" }}</view>
|
||||
<view class="sub"
|
||||
>距你{{
|
||||
calculateDistance(
|
||||
userLocalNum.t,
|
||||
userLocalNum.l,
|
||||
Number(mer_info.lat),
|
||||
Number(mer_info.lon)
|
||||
)
|
||||
}}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品列表 -->
|
||||
<!-- <view class="good">
|
||||
<view class="item"></view>
|
||||
</view> -->
|
||||
<view class="good-class" v-if="class_list.length > 0">
|
||||
<nut-tabs
|
||||
v-model="value"
|
||||
title-scroll
|
||||
direction="vertical"
|
||||
title-gutter="5"
|
||||
animated-time="0"
|
||||
name="tabName"
|
||||
@click="clickTab"
|
||||
>
|
||||
<nut-tab-pane
|
||||
v-for="(item, index) in class_list as any[]"
|
||||
:title="item.name"
|
||||
:pane-key="index"
|
||||
>
|
||||
<view v-if="good_list.length > 0">
|
||||
<view
|
||||
class="list"
|
||||
v-for="(item, index) in good_list as any[]"
|
||||
:key="index"
|
||||
>
|
||||
<view class="item">
|
||||
<img :src="item.cover"/>
|
||||
<view class="right">
|
||||
<view class="name">{{ item.name }}</view>
|
||||
<view class="stock">
|
||||
库存剩余:{{ item.stock }}
|
||||
</view>
|
||||
<view class="bom">
|
||||
<view class="price"
|
||||
>
|
||||
<text style="font-size: 15px">{{
|
||||
item.number
|
||||
}}
|
||||
</text>
|
||||
{{
|
||||
mer_info.bType === 1
|
||||
? '元'
|
||||
: '积分'
|
||||
}}
|
||||
</view
|
||||
>
|
||||
<nut-button
|
||||
size="mini"
|
||||
v-if="mer_info.bType === 1"
|
||||
type="primary"
|
||||
@click.stop="
|
||||
toGoodDetails(
|
||||
item.gid as number,
|
||||
1
|
||||
)
|
||||
"
|
||||
>去购买
|
||||
</nut-button
|
||||
>
|
||||
<nut-button
|
||||
size="mini"
|
||||
v-else
|
||||
type="primary"
|
||||
@click.stop="
|
||||
toGoodDetails(
|
||||
item.gid as number,
|
||||
2
|
||||
)
|
||||
"
|
||||
>去兑换
|
||||
</nut-button
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view
|
||||
>
|
||||
<nut-empty v-else description="该分类暂无商品"></nut-empty>
|
||||
</nut-tab-pane>
|
||||
</nut-tabs>
|
||||
<view class="right">
|
||||
<view @click="clickMap">
|
||||
<Locationg3 color="red" size="25" />
|
||||
<view>导航</view>
|
||||
</view>
|
||||
<view @click="clickPhone">
|
||||
<Find color="red" size="25" />
|
||||
<view>电话</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="该商家暂无商品"></nut-empty>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 商品列表 -->
|
||||
<view class="good-class" v-if="class_list.length > 0">
|
||||
<nut-tabs
|
||||
v-model="value"
|
||||
title-scroll
|
||||
direction="vertical"
|
||||
title-gutter="5"
|
||||
animated-time="0"
|
||||
name="tabName"
|
||||
>
|
||||
<nut-tab-pane
|
||||
v-for="(itm, index) in good_list"
|
||||
:key="index"
|
||||
:title="itm.name"
|
||||
:pane-key="index"
|
||||
>
|
||||
<view v-if="itm.Goods.length > 0">
|
||||
<view class="list" v-for="(item, index) in itm.Goods" :key="index">
|
||||
<view class="item" @click.stop="toGoodDetails(item.gid, 1)">
|
||||
<image :src="item.cover" lazy-load />
|
||||
<view class="right">
|
||||
<view class="name">{{ item.name }}</view>
|
||||
<view class="stock">剩余:{{ item.stock }}</view>
|
||||
<view class="bom">
|
||||
<view>
|
||||
<view class="price">
|
||||
<text style="font-size: 15px">{{ item.number }}元</text>
|
||||
</view>
|
||||
<view class="price">
|
||||
<text style="font-size: 15px"
|
||||
>{{ item.exchange }}积分</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<nut-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
@click.stop="add_cart(item)"
|
||||
>
|
||||
<template #icon>
|
||||
<Cart2 />
|
||||
</template>
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-empty v-else description="该分类暂无商品"></nut-empty>
|
||||
<view style="height: 180rpx"></view>
|
||||
</nut-tab-pane>
|
||||
</nut-tabs>
|
||||
</view>
|
||||
<nut-empty v-else description="该商家暂无商品"></nut-empty>
|
||||
<!-- 购物车 -->
|
||||
<cart ref="cartRef" :mer-info="mer_info" @update-cart="updateCartNum" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Taro from '@tarojs/taro'
|
||||
import {Find, Locationg3} from '@nutui/icons-vue-taro'
|
||||
import {ref} from 'vue'
|
||||
import {calculateDistance} from '@/utils'
|
||||
import {getGoodList, getMerCategory} from '@/api/goods'
|
||||
import Taro from "@tarojs/taro";
|
||||
import { Find, Locationg3 } from "@nutui/icons-vue-taro";
|
||||
import { Ref, ref } from "vue";
|
||||
import { calculateDistance } from "@/utils";
|
||||
import { getGoodList, getMerCategory } from "@/api/goods";
|
||||
import Cart from "@/components/Cart.vue";
|
||||
import { Cart2 } from "@nutui/icons-vue-taro";
|
||||
|
||||
const swiperList = ref([])
|
||||
const swiperList = ref([]);
|
||||
|
||||
const mer_info = ref<any>({})
|
||||
const mer_info = ref<any>({});
|
||||
|
||||
const value = ref('0')
|
||||
const value = ref("0");
|
||||
|
||||
const userLocalNum = ref({
|
||||
l: 0,
|
||||
t: 0
|
||||
})
|
||||
l: 0,
|
||||
t: 0,
|
||||
});
|
||||
|
||||
Taro.useLoad(() => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84',
|
||||
success: (res) => {
|
||||
userLocalNum.value.l = res.longitude
|
||||
userLocalNum.value.t = res.latitude
|
||||
}
|
||||
})
|
||||
mer_info.value = Taro.getStorageSync('mer_info')
|
||||
Taro.setNavigationBarTitle({
|
||||
title: mer_info.value.name
|
||||
})
|
||||
swiperList.value = mer_info.value.img.split(',')
|
||||
get_class_list()
|
||||
})
|
||||
Taro.useLoad(async () => {
|
||||
Taro.getLocation({
|
||||
type: "wgs84",
|
||||
success: (res) => {
|
||||
userLocalNum.value.l = res.longitude;
|
||||
userLocalNum.value.t = res.latitude;
|
||||
},
|
||||
});
|
||||
mer_info.value = Taro.getStorageSync("mer_info");
|
||||
Taro.setNavigationBarTitle({
|
||||
title: mer_info.value.name,
|
||||
});
|
||||
swiperList.value = mer_info.value.img.split(",");
|
||||
await get_class_list();
|
||||
await cartRef.value.get_cart_list();
|
||||
});
|
||||
|
||||
const clickPhone = () => {
|
||||
Taro.makePhoneCall({
|
||||
phoneNumber: mer_info.value.mobile
|
||||
})
|
||||
}
|
||||
Taro.makePhoneCall({
|
||||
phoneNumber: mer_info.value.mobile,
|
||||
});
|
||||
};
|
||||
|
||||
const clickMap = () => {
|
||||
Taro.openLocation({
|
||||
name: mer_info.value.name,
|
||||
address: mer_info.value.address,
|
||||
latitude: Number(mer_info.value.lat),
|
||||
longitude: Number(mer_info.value.lon),
|
||||
scale: 18
|
||||
})
|
||||
}
|
||||
Taro.openLocation({
|
||||
name: mer_info.value.name,
|
||||
address: mer_info.value.address,
|
||||
latitude: Number(mer_info.value.lat),
|
||||
longitude: Number(mer_info.value.lon),
|
||||
scale: 18,
|
||||
});
|
||||
};
|
||||
|
||||
const class_list = ref<
|
||||
Array<{
|
||||
ID?: number;
|
||||
name?: string;
|
||||
}>
|
||||
>([])
|
||||
Array<{
|
||||
ID?: number;
|
||||
name?: string;
|
||||
}>
|
||||
>([]);
|
||||
const get_class_list = async () => {
|
||||
const res = await getMerCategory({
|
||||
Bid: mer_info.value.bid
|
||||
})
|
||||
class_list.value = res.data.data || []
|
||||
await get_good_list(class_list.value[0].ID as number)
|
||||
const res = await getMerCategory({
|
||||
Bid: mer_info.value.bid,
|
||||
});
|
||||
class_list.value = res.data.data || [];
|
||||
await get_good_list(class_list.value[0].ID as number);
|
||||
};
|
||||
|
||||
// const clickTab = (val: any) => {
|
||||
// get_good_list(class_list.value[val.paneKey].ID as number);
|
||||
// };
|
||||
|
||||
interface goodList {
|
||||
ID: number;
|
||||
name: string;
|
||||
bid: string;
|
||||
Goods: GoodsType[];
|
||||
}
|
||||
|
||||
const clickTab = (val: any) => {
|
||||
get_good_list(class_list.value[val.paneKey].ID as number)
|
||||
interface GoodsType {
|
||||
gid: string;
|
||||
cover: string;
|
||||
name: string;
|
||||
number: number;
|
||||
stock: number;
|
||||
cartNum: number;
|
||||
exchange: number;
|
||||
}
|
||||
|
||||
const good_list = ref([])
|
||||
interface CartItems {
|
||||
bid: string;
|
||||
gid: string;
|
||||
number: number;
|
||||
price: number;
|
||||
cover: string;
|
||||
name: string;
|
||||
exchange: number;
|
||||
}
|
||||
|
||||
const good_list = ref<goodList[]>([]);
|
||||
const get_good_list = async (id: number) => {
|
||||
Taro.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
const res = await getGoodList({
|
||||
bid: mer_info.value.bid,
|
||||
BType: mer_info.value.bType,
|
||||
class_id: id,
|
||||
status: 1,
|
||||
state: 1
|
||||
})
|
||||
good_list.value = res.data.data || []
|
||||
Taro.hideLoading()
|
||||
}
|
||||
Taro.showLoading({
|
||||
title: "加载中",
|
||||
mask: true,
|
||||
});
|
||||
const res = await getGoodList({
|
||||
bid: mer_info.value.bid,
|
||||
goods_class_id: id,
|
||||
status: 1,
|
||||
state: 1,
|
||||
});
|
||||
good_list.value = res.data.data || [];
|
||||
Taro.hideLoading();
|
||||
};
|
||||
|
||||
const toGoodDetails = (id: number, type: number) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/goods/goods_detail/index?gid=${id}&type=${type}`
|
||||
})
|
||||
}
|
||||
const toGoodDetails = (id: string, type: number) => {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/goods/goods_detail/index?gid=${id}&type=${type}`,
|
||||
});
|
||||
};
|
||||
|
||||
const cartRef = ref(null) as Ref;
|
||||
|
||||
const add_cart = (item: GoodsType) => {
|
||||
const num = item.cartNum ? Number(item.cartNum) + 1 : 1;
|
||||
cartRef.value.add_cart(item, num);
|
||||
};
|
||||
|
||||
const updateCartNum = (cartItems: CartItems[]) => {
|
||||
if (cartItems.length > 0) {
|
||||
good_list.value.forEach((category: goodList) => {
|
||||
category.Goods.forEach((good: GoodsType) => {
|
||||
cartItems.forEach((cartItem: CartItems) => {
|
||||
if (good.gid === cartItem.gid) {
|
||||
good.cartNum = cartItem.number;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
good_list.value.forEach((category: goodList) => {
|
||||
category.Goods.forEach((good: GoodsType) => {
|
||||
Reflect.deleteProperty(good, "cartNum");
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
// IOS安全区域
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.nut-swiper {
|
||||
height: 350px;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.infoBox {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
|
||||
.title {
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
.title {
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.bom {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-top: 10px;
|
||||
|
||||
.left {
|
||||
width: 80%;
|
||||
|
||||
.sub {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.bom {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-top: 10px;
|
||||
|
||||
.left {
|
||||
width: 80%;
|
||||
|
||||
.sub {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
.right {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.good-class {
|
||||
margin-top: 10px;
|
||||
margin-top: 10px;
|
||||
|
||||
.nut-tabs {
|
||||
height: 100vh;
|
||||
border-top: #fff 10px solid;
|
||||
}
|
||||
.nut-tabs {
|
||||
height: 100vh;
|
||||
border-top: #fff 10px solid;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
.item {
|
||||
display: flex;
|
||||
margin-bottom: 10px;
|
||||
.item {
|
||||
display: flex;
|
||||
margin-bottom: 10px;
|
||||
|
||||
img {
|
||||
width: 140px;
|
||||
height: 150px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.right {
|
||||
flex: 1;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
// text-align: right;
|
||||
|
||||
.stock {
|
||||
margin-top: 10px;
|
||||
color: #8f8f8f;
|
||||
}
|
||||
|
||||
.name {
|
||||
// height: 20px;
|
||||
font-size: 28px;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.bom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
//margin-top: 10px;
|
||||
|
||||
.price {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #ff0000;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.right {
|
||||
flex: 1;
|
||||
margin-left: 5px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
// text-align: right;
|
||||
|
||||
.stock {
|
||||
margin-top: 10px;
|
||||
color: #8f8f8f;
|
||||
}
|
||||
|
||||
.name {
|
||||
// height: 20px;
|
||||
font-size: 28px;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.bom {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
//margin-top: 10px;
|
||||
|
||||
.price {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #ff0000;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '商品添加/编辑'
|
||||
})
|
||||
|
||||
navigationBarTitleText: "商品添加/编辑",
|
||||
});
|
||||
|
||||
@@ -1,158 +1,199 @@
|
||||
<script lang="ts" setup>
|
||||
import Taro from '@tarojs/taro'
|
||||
import {Ref, ref} from 'vue'
|
||||
import Upload from '../../../components/Upload.vue'
|
||||
import RichEditor from '../../../components/RichEditor.vue'
|
||||
import {addGood} from '@/api/product'
|
||||
import Taro from "@tarojs/taro";
|
||||
import { Ref, ref } from "vue";
|
||||
import Upload from "../../../components/Upload.vue";
|
||||
import RichEditor from "../../../components/RichEditor.vue";
|
||||
import { addGood } from "@/api/product";
|
||||
|
||||
const ruleForm = ref(null) as Ref
|
||||
const ruleForm = ref(null) as Ref;
|
||||
|
||||
const basicData = ref({
|
||||
name: '',
|
||||
class_id: null,
|
||||
cover: [],
|
||||
rotation: [],
|
||||
profile: '',
|
||||
details: '',
|
||||
stock: null,
|
||||
number: null,
|
||||
market_num: null,
|
||||
state: 2
|
||||
})
|
||||
name: "",
|
||||
class_id: null,
|
||||
cover: [],
|
||||
rotation: [],
|
||||
profile: "",
|
||||
details: "",
|
||||
stock: null,
|
||||
number: null,
|
||||
market_num: null,
|
||||
state: 2,
|
||||
});
|
||||
|
||||
const rules = {
|
||||
name: [{
|
||||
required: true,
|
||||
message: '请填写商品名称'
|
||||
}],
|
||||
class_id: [{
|
||||
required: true,
|
||||
message: '请选择商品分类'
|
||||
}],
|
||||
cover: [{
|
||||
required: true,
|
||||
message: '请上传商品封面',
|
||||
validator: (value) => {
|
||||
return value.length > 0
|
||||
}
|
||||
}],
|
||||
rotation: [{
|
||||
required: true,
|
||||
message: '请上传商品轮播图',
|
||||
validator: (value) => {
|
||||
return value.length > 0
|
||||
}
|
||||
}],
|
||||
profile: [{
|
||||
required: true,
|
||||
message: '请填写商品名称'
|
||||
}],
|
||||
stock: [{
|
||||
required: true,
|
||||
message: '请填写商品库存'
|
||||
}],
|
||||
number: [{
|
||||
required: true,
|
||||
message: '请填写商品价格'
|
||||
}],
|
||||
market_num: [{
|
||||
required: true,
|
||||
message: '请填写商品市场价'
|
||||
}]
|
||||
}
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写商品名称",
|
||||
},
|
||||
],
|
||||
class_id: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择商品分类",
|
||||
},
|
||||
],
|
||||
cover: [
|
||||
{
|
||||
required: true,
|
||||
message: "请上传商品封面",
|
||||
validator: (value) => {
|
||||
return value.length > 0;
|
||||
},
|
||||
},
|
||||
],
|
||||
rotation: [
|
||||
{
|
||||
required: true,
|
||||
message: "请上传商品轮播图",
|
||||
validator: (value) => {
|
||||
return value.length > 0;
|
||||
},
|
||||
},
|
||||
],
|
||||
profile: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写商品名称",
|
||||
},
|
||||
],
|
||||
stock: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写商品库存",
|
||||
},
|
||||
],
|
||||
number: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写商品价格",
|
||||
},
|
||||
],
|
||||
market_num: [
|
||||
{
|
||||
required: true,
|
||||
message: "请填写商品市场价",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const columnsClass = ref([])
|
||||
const columnsClass = ref([]);
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
console.log(options)
|
||||
})
|
||||
console.log(options);
|
||||
});
|
||||
|
||||
const openGoodClass = ref(false)
|
||||
const openGoodClass = ref(false);
|
||||
|
||||
const confirmClass = (val: any) => {
|
||||
console.log(val)
|
||||
}
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
const ok = async () => {
|
||||
ruleForm.value.validate().then(({valid, errors}: any) => {
|
||||
if (valid) {
|
||||
console.log('success', basicData.value)
|
||||
} else {
|
||||
console.log('error submit!!', errors)
|
||||
}
|
||||
})
|
||||
}
|
||||
ruleForm.value.validate().then(({ valid, errors }: any) => {
|
||||
if (valid) {
|
||||
console.log("success", basicData.value);
|
||||
} else {
|
||||
console.log("error submit!!", errors);
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
{{ basicData }}
|
||||
<nut-backtop>
|
||||
<template v-slot:content>
|
||||
<nut-form ref="ruleForm" :model-value="basicData" :rules="rules">
|
||||
<nut-form-item label="商品分类:" required prop="class_id">
|
||||
<nut-input v-model="basicData.class_id" disabled placeholder="请选择商品分类"
|
||||
@click="openGoodClass = true"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品封面:" required prop="cover">
|
||||
<Upload v-model:list="basicData.cover"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品轮播图:" required prop="rotation">
|
||||
<Upload v-model:list="basicData.rotation" :max="10"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品名称:" required prop="name">
|
||||
<nut-input v-model="basicData.name" placeholder="请输入商品名称"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品价格:" required prop="number">
|
||||
<nut-input v-model="basicData.number" placeholder="请输入商品价格"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="市场价格:" required prop="market_num">
|
||||
<nut-input v-model="basicData.market_num" placeholder="请输入市场价格"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品库存:" required prop="stock">
|
||||
<nut-input v-model="basicData.stock" placeholder="请输入商品库存"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品简介:" required prop="profile">
|
||||
<nut-textarea
|
||||
class="textarea"
|
||||
v-model="basicData.profile" placeholder="请输入商品简介"
|
||||
type="text"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="上架状态:" prop="state">
|
||||
<nut-switch v-model="basicData.state" :active-value="1" :inactive-value="2"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item prop="details">
|
||||
<RichEditor :content="basicData.details" @input="(val) => basicData.details = val"/>
|
||||
</nut-form-item>
|
||||
<nut-form-item prop="ok">
|
||||
<nut-button block type="primary" @click="ok">提交</nut-button>
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
</template>
|
||||
</nut-backtop>
|
||||
<!-- 商品分类 -->
|
||||
<nut-popup position="bottom" v-model:visible="openGoodClass" @close="openGoodClass = false">
|
||||
<nut-picker :columns="columnsClass" title="商品分类" @confirm="confirmClass"
|
||||
></nut-picker>
|
||||
</nut-popup>
|
||||
</view>
|
||||
<view>
|
||||
{{ basicData }}
|
||||
<nut-backtop>
|
||||
<template v-slot:content>
|
||||
<nut-form ref="ruleForm" :model-value="basicData" :rules="rules">
|
||||
<nut-form-item label="商品分类:" required prop="class_id">
|
||||
<nut-input
|
||||
v-model="basicData.class_id"
|
||||
disabled
|
||||
placeholder="请选择商品分类"
|
||||
@click="openGoodClass = true"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品封面:" required prop="cover">
|
||||
<Upload v-model:list="basicData.cover" />
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品轮播图:" required prop="rotation">
|
||||
<Upload v-model:list="basicData.rotation" :max="10" />
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品名称:" required prop="name">
|
||||
<nut-input
|
||||
v-model="basicData.name"
|
||||
placeholder="请输入商品名称"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品价格:" required prop="number">
|
||||
<nut-input
|
||||
v-model="basicData.number"
|
||||
placeholder="请输入商品价格"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="市场价格:" required prop="market_num">
|
||||
<nut-input
|
||||
v-model="basicData.market_num"
|
||||
placeholder="请输入市场价格"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品库存:" required prop="stock">
|
||||
<nut-input v-model="basicData.stock" placeholder="请输入商品库存" />
|
||||
</nut-form-item>
|
||||
<nut-form-item label="商品简介:" required prop="profile">
|
||||
<nut-textarea
|
||||
class="textarea"
|
||||
v-model="basicData.profile"
|
||||
placeholder="请输入商品简介"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="上架状态:" prop="state">
|
||||
<nut-switch
|
||||
v-model="basicData.state"
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item prop="details">
|
||||
<RichEditor
|
||||
:content="basicData.details"
|
||||
@input="(val) => (basicData.details = val)"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item prop="ok">
|
||||
<nut-button block type="primary" @click="ok">提交</nut-button>
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
</template>
|
||||
</nut-backtop>
|
||||
<!-- 商品分类 -->
|
||||
<nut-popup
|
||||
position="bottom"
|
||||
v-model:visible="openGoodClass"
|
||||
@close="openGoodClass = false"
|
||||
>
|
||||
<nut-picker
|
||||
:columns="columnsClass"
|
||||
title="商品分类"
|
||||
@confirm="confirmClass"
|
||||
></nut-picker>
|
||||
</nut-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.nut-input {
|
||||
border: none;
|
||||
color: #000;
|
||||
border: none;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.textarea {
|
||||
height: 100px;
|
||||
background-color: #FAFAFA;
|
||||
padding: 10px !important;
|
||||
border-radius: 10px;
|
||||
height: 100px;
|
||||
background-color: #fafafa;
|
||||
padding: 10px !important;
|
||||
border-radius: 10px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '商品管理'
|
||||
})
|
||||
|
||||
navigationBarTitleText: "商品管理",
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
3
src/pages/search/index.config.ts
Normal file
3
src/pages/search/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
enableShareAppMessage: true,
|
||||
});
|
||||
23
src/pages/search/index.vue
Normal file
23
src/pages/search/index.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import MerList from "@/components/MerList.vue";
|
||||
|
||||
const classId = ref<null | number>(null);
|
||||
|
||||
Taro.useLoad((e) => {
|
||||
console.log(e);
|
||||
Taro.setNavigationBarTitle({
|
||||
title: e.name,
|
||||
});
|
||||
classId.value = Number(e.id);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<MerList :classId="classId" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss"></style>
|
||||
@@ -1,4 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '个人中心',
|
||||
navigationStyle: 'custom'
|
||||
})
|
||||
navigationBarTitleText: "个人中心",
|
||||
navigationStyle: "custom",
|
||||
});
|
||||
|
||||
@@ -1,53 +1,46 @@
|
||||
<template>
|
||||
<view class="app">
|
||||
<view
|
||||
class="user-center-card__header__transparent"
|
||||
v-if="isLogin"
|
||||
:style="{ width: isLogin ? '100%' : '70%' }"
|
||||
class="user-center-card__header__transparent"
|
||||
v-if="isLogin"
|
||||
:style="{ width: isLogin ? '100%' : '70%' }"
|
||||
>
|
||||
<view class="user-center-card__header__avatar">
|
||||
<nut-avatar size="large">
|
||||
<img :src="userInfo.avatarUrl"/>
|
||||
<img :src="userInfo.data?.avatarUrl" />
|
||||
</nut-avatar>
|
||||
</view>
|
||||
<view class="user-center-card__header__info">
|
||||
<view
|
||||
class="user-center-card__header__info__name"
|
||||
@click="toPage('/pages/users/user_setting/index')"
|
||||
>{{ userInfo.nickName }}
|
||||
</view
|
||||
>
|
||||
<view v-if="!userInfo.phone">
|
||||
class="user-center-card__header__info__name"
|
||||
@click="toPage('/pages/users/user_setting/index')"
|
||||
>{{ userInfo.data?.nickName }}
|
||||
</view>
|
||||
<view v-if="!userInfo.data?.phone">
|
||||
<nut-button
|
||||
size="mini"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getphonenumber"
|
||||
>点击绑定手机号
|
||||
size="mini"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getphonenumber"
|
||||
>点击绑定手机号
|
||||
</nut-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rightIcon">
|
||||
<Scan style="margin-right: 20px" @click="scanCode" size="22"/>
|
||||
<Setting
|
||||
style="margin-right: 20px"
|
||||
@click="toSetting"
|
||||
size="22"
|
||||
/>
|
||||
<Scan style="margin-right: 20px" @click="scanCode" size="22" />
|
||||
<Setting style="margin-right: 20px" @click="toSetting" size="22" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="user-center-card__header__transparent">
|
||||
<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="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
|
||||
/>
|
||||
</nut-avatar>
|
||||
</view>
|
||||
<view class="user-center-card__header__info">
|
||||
<view
|
||||
class="user-center-card__header__info__name"
|
||||
@click="clickLogin"
|
||||
>点击立即登录
|
||||
<view class="user-center-card__header__info__name" @click="clickLogin"
|
||||
>点击立即登录
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -58,39 +51,39 @@
|
||||
<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"/> -->
|
||||
<IconFont
|
||||
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
|
||||
size="40"
|
||||
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
|
||||
size="40"
|
||||
/>
|
||||
<view class="center-text">待付款</view>
|
||||
</view>
|
||||
<view class="center-t" @click="toOrderList(2)">
|
||||
<!-- <Clock size="25px"/> -->
|
||||
<IconFont
|
||||
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
|
||||
size="40"
|
||||
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
|
||||
size="40"
|
||||
/>
|
||||
<view class="center-text">待使用</view>
|
||||
</view>
|
||||
<view class="center-t" @click="toOrderList(3)">
|
||||
<!-- <Shop size="25px"/> -->
|
||||
<IconFont
|
||||
name="http://article.biliimg.com/bfs/article/7c2ca0228180fe5f3b1d74b0043d80e76c42eb7d.png"
|
||||
size="40"
|
||||
name="http://article.biliimg.com/bfs/article/7c2ca0228180fe5f3b1d74b0043d80e76c42eb7d.png"
|
||||
size="40"
|
||||
/>
|
||||
<view class="center-text">已使用</view>
|
||||
</view>
|
||||
<view class="center-t" @click="toOrderList(4)">
|
||||
<!-- <Del size="25px"/> -->
|
||||
<IconFont
|
||||
name="http://article.biliimg.com/bfs/article/c4f4e069dddfa7104f794a46a759a7ed478b81ea.png"
|
||||
size="40"
|
||||
name="http://article.biliimg.com/bfs/article/c4f4e069dddfa7104f794a46a759a7ed478b81ea.png"
|
||||
size="40"
|
||||
/>
|
||||
<view class="center-text">已失效</view>
|
||||
</view>
|
||||
@@ -101,54 +94,61 @@
|
||||
<view class="user-center">
|
||||
<view>我的服务</view>
|
||||
<view class="box">
|
||||
<view
|
||||
<template v-if="isLogin">
|
||||
<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>
|
||||
<view class="label">{{ item.label }}</view>
|
||||
</view>
|
||||
<button v-if="isLogin" class="box-mini" open-type='contact'>
|
||||
<IconFont size="40"
|
||||
name="http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png"></IconFont>
|
||||
>
|
||||
<!-- <image :src="item.icon" /> -->
|
||||
<IconFont size="40" :name="item.icon"></IconFont>
|
||||
<view class="label">{{ item.label }}</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<button v-if="isLogin" class="box-mini" open-type="contact">
|
||||
<IconFont
|
||||
size="40"
|
||||
name="http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png"
|
||||
></IconFont>
|
||||
<text class="label">联系客服</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商家管理 -->
|
||||
<view class="mer-box" v-if="userInfo.bid">
|
||||
<view
|
||||
class="mer-box"
|
||||
v-if="userInfo.data?.bid && userInfo.store_status === 1"
|
||||
>
|
||||
<nut-grid :gutter="10" :border="false">
|
||||
<nut-grid-item
|
||||
:border="false"
|
||||
text="订单核销"
|
||||
@click="toPage('/pages/admin/verify/index')"
|
||||
:border="false"
|
||||
text="订单核销"
|
||||
@click="toPage('/pages/admin/verify/index')"
|
||||
>
|
||||
<IconFont
|
||||
size="50"
|
||||
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
|
||||
size="50"
|
||||
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
|
||||
></IconFont>
|
||||
</nut-grid-item>
|
||||
<nut-grid-item
|
||||
text="订单统计"
|
||||
@click="toPage('/pages/admin/order_manage/index')"
|
||||
text="订单统计"
|
||||
@click="toPage('/pages/admin/order_manage/index')"
|
||||
>
|
||||
<IconFont
|
||||
size="50"
|
||||
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
|
||||
size="50"
|
||||
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
|
||||
></IconFont>
|
||||
</nut-grid-item>
|
||||
<nut-grid-item
|
||||
text="收益提现"
|
||||
@click="toPage('/pages/admin/withdrawal/index')"
|
||||
text="收益提现"
|
||||
@click="toPage('/pages/admin/withdrawal/index')"
|
||||
>
|
||||
<IconFont
|
||||
size="50"
|
||||
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
|
||||
size="50"
|
||||
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
|
||||
></IconFont>
|
||||
</nut-grid-item>
|
||||
<!-- <nut-grid-item-->
|
||||
@@ -168,84 +168,87 @@
|
||||
</view>
|
||||
<!-- 登录 -->
|
||||
<Auth
|
||||
:visible="isShowLogin"
|
||||
@update:visible="cancelLogin"
|
||||
@ok="getUserInfo"
|
||||
:visible="isShowLogin"
|
||||
@update:visible="cancelLogin"
|
||||
@ok="getUserInfo"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue'
|
||||
import {ArrowRight, Setting, IconFont, Scan} from '@nutui/icons-vue-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import Auth from '@/components/Auth.vue'
|
||||
import {getPersonalInfo, getPhone, bindParent} from '@/api/user'
|
||||
import { ref } from "vue";
|
||||
import { ArrowRight, Setting, IconFont, Scan } from "@nutui/icons-vue-taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
import Auth from "@/components/Auth.vue";
|
||||
import { getPersonalInfo, getPhone, bindParent } from "@/api/user";
|
||||
|
||||
const isShowLogin = ref(false)
|
||||
const isShowLogin = ref(false);
|
||||
|
||||
const isLogin = ref(false)
|
||||
const isLogin = ref(false);
|
||||
|
||||
interface UserInfo {
|
||||
nickName?: string;
|
||||
avatarUrl?: string;
|
||||
ID?: string;
|
||||
bid?: string;
|
||||
phone?: string;
|
||||
uid?: string;
|
||||
data?: {
|
||||
nickName?: string;
|
||||
avatarUrl?: string;
|
||||
ID?: string;
|
||||
bid?: string;
|
||||
phone?: string;
|
||||
uid?: string;
|
||||
};
|
||||
store_status?: number;
|
||||
store_name?: string;
|
||||
}
|
||||
|
||||
const userInfo = ref<UserInfo>({})
|
||||
const userInfo = ref<UserInfo>({});
|
||||
|
||||
Taro.useDidShow(() => {
|
||||
const token = Taro.getStorageSync('token')
|
||||
const token = Taro.getStorageSync("token");
|
||||
if (token) {
|
||||
getUserInfo()
|
||||
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)
|
||||
Taro.setStorageSync('mer_type', res.data.store_type)
|
||||
isLogin.value = true
|
||||
cancelLogin()
|
||||
Taro.hideLoading()
|
||||
}
|
||||
title: "加载中",
|
||||
});
|
||||
const res = await getPersonalInfo();
|
||||
userInfo.value = res.data;
|
||||
Taro.setStorageSync("userInfo", res.data);
|
||||
isLogin.value = true;
|
||||
cancelLogin();
|
||||
Taro.hideLoading();
|
||||
};
|
||||
|
||||
const getphonenumber = async (e: any) => {
|
||||
await getPhone({
|
||||
uid: userInfo.value.uid,
|
||||
code: e.detail.code
|
||||
})
|
||||
await getUserInfo()
|
||||
}
|
||||
uid: userInfo.value.data?.uid,
|
||||
code: e.detail.code,
|
||||
});
|
||||
await getUserInfo();
|
||||
};
|
||||
|
||||
const toOrderList = (e: number) => {
|
||||
if (!isLogin)
|
||||
if (!isLogin.value)
|
||||
return Taro.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
})
|
||||
title: "请先登录",
|
||||
icon: "none",
|
||||
});
|
||||
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,
|
||||
@@ -255,65 +258,65 @@ const userMenuList = ref([
|
||||
// },
|
||||
{
|
||||
id: 3,
|
||||
label: '我的推广',
|
||||
url: '/pages/users/distribution/index',
|
||||
icon: 'http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png'
|
||||
label: "我的推广",
|
||||
url: "/pages/users/distribution/index",
|
||||
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
label: '关注商家',
|
||||
url: '',
|
||||
icon: 'http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png'
|
||||
}
|
||||
label: "关注商家",
|
||||
url: "",
|
||||
icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png",
|
||||
},
|
||||
// {
|
||||
// id: 5,
|
||||
// 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
|
||||
Taro.redirectTo({
|
||||
url: '/pages/users/login/index'
|
||||
})
|
||||
}
|
||||
url: "/pages/users/login/index",
|
||||
});
|
||||
};
|
||||
|
||||
const toPage = (url: string) => {
|
||||
Taro.navigateTo({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
url: url,
|
||||
});
|
||||
};
|
||||
|
||||
const scanCode = () => {
|
||||
Taro.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ['qrCode'],
|
||||
scanType: ["qrCode"],
|
||||
success: async (data) => {
|
||||
try {
|
||||
await bindParent({
|
||||
uid: data.result
|
||||
})
|
||||
uid: data.result,
|
||||
});
|
||||
Taro.showToast({
|
||||
title: '绑定成功',
|
||||
icon: 'none'
|
||||
})
|
||||
title: "绑定成功",
|
||||
icon: "none",
|
||||
});
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -457,7 +460,6 @@ const scanCode = () => {
|
||||
color: #000000;
|
||||
background-color: #fff;
|
||||
height: 100%;
|
||||
|
||||
}
|
||||
|
||||
button::after {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '我的账户'
|
||||
})
|
||||
navigationBarTitleText: "我的账户",
|
||||
});
|
||||
|
||||
@@ -1,262 +1,304 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
|
||||
import { getIntegralDetail, getBeanDetail } from "@/api/user";
|
||||
import { computed, ref } from "vue";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user";
|
||||
|
||||
// Taro.setStorageSync("token", "ok_OL66Ej4_lkQKNA0AwxnGwGyXo");
|
||||
|
||||
const tabValue = ref(1);
|
||||
|
||||
const tabsList = ref([
|
||||
{
|
||||
title: "兑换明细",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
title: "赠送明细",
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
title: "豆子明细",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
title: "兑换明细",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
title: "赠送明细",
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
title: "豆子明细",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
title: "活动赠送",
|
||||
value: 4,
|
||||
},
|
||||
]);
|
||||
|
||||
const computerType = computed(() => {
|
||||
return (val: number) => {
|
||||
switch (val) {
|
||||
case 5:
|
||||
return "注册赠送";
|
||||
case 6:
|
||||
return "签到赠送";
|
||||
case 7:
|
||||
return "系统赠送";
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
const tabChange = (index: number) => {
|
||||
tabValue.value = index;
|
||||
data.value = [];
|
||||
getList();
|
||||
page.value.PageNum = 1;
|
||||
tabValue.value = index;
|
||||
data.value = [];
|
||||
getList();
|
||||
page.value.PageNum = 1;
|
||||
};
|
||||
|
||||
const data = ref([]);
|
||||
interface DataType {
|
||||
goods_name: string;
|
||||
add_time: string;
|
||||
number: number;
|
||||
order_number: number;
|
||||
type: number;
|
||||
oid: string;
|
||||
}
|
||||
|
||||
const data = ref<DataType[]>([]);
|
||||
|
||||
const userInfo = ref<any>({});
|
||||
|
||||
useLoad(() => {
|
||||
getList();
|
||||
userInfo.value = getStorageSync("userInfo");
|
||||
Taro.useLoad(() => {
|
||||
getList();
|
||||
userInfo.value = Taro.getStorageSync("userInfo");
|
||||
});
|
||||
|
||||
const page = ref({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
ItemCount: 0,
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
ItemCount: 0,
|
||||
});
|
||||
|
||||
const pageChange = (e: number) => {
|
||||
page.value.PageNum = e;
|
||||
getList();
|
||||
page.value.PageNum = e;
|
||||
getList();
|
||||
};
|
||||
|
||||
const getList = async () => {
|
||||
try {
|
||||
let res: any;
|
||||
const newData = {
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
Type: tabValue.value,
|
||||
};
|
||||
if (tabValue.value === 1 || tabValue.value === 3) {
|
||||
res = await getBeanDetail(newData);
|
||||
} else {
|
||||
delete data.Type;
|
||||
res = await getIntegralDetail(newData);
|
||||
}
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
try {
|
||||
let res: any;
|
||||
const newData = {
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
Type: tabValue.value,
|
||||
};
|
||||
if (tabValue.value === 1 || tabValue.value === 3) {
|
||||
res = await getBeanDetail(newData);
|
||||
} else if (tabValue.value === 2) {
|
||||
// delete data.value.Type;
|
||||
Reflect.deleteProperty(data.value, "Type");
|
||||
res = await getIntegralDetail(newData);
|
||||
} else {
|
||||
res = await getGiftRecord(newData);
|
||||
}
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error.msg,
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view>
|
||||
<view class="card">
|
||||
<!-- <view class="greeting">Hello! YuanHuakk</view> -->
|
||||
<view class="info">
|
||||
<view class="left">
|
||||
<view>
|
||||
<view class="num">豆子: {{ userInfo.pulse }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="num">积分: {{ userInfo.integral }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
|
||||
</view>
|
||||
<view>
|
||||
<view class="card">
|
||||
<!-- <view class="greeting">Hello! YuanHuakk</view>-->
|
||||
<view class="info">
|
||||
<view class="left">
|
||||
<view>
|
||||
<view class="num">豆子: {{ userInfo.data?.pulse }}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="num">积分: {{ userInfo.data?.integral }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tabs-box">
|
||||
<view
|
||||
v-for="item in tabsList"
|
||||
:key="item.value"
|
||||
@click="tabChange(item.value)"
|
||||
>
|
||||
<view class="text">{{ item.title }}</view>
|
||||
<view
|
||||
class="line"
|
||||
:class="{ lineColor: item.value === tabValue }"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="data.length > 0">
|
||||
<view v-if="tabValue === 1 || tabValue === 3">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view>商品:{{ item.goods_name }}</view>
|
||||
<view>时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view v-if="tabValue === 1" style="color: green"
|
||||
>-<text>{{ item.number }}积分</text></view
|
||||
>
|
||||
<view v-if="tabValue === 3" style="color: red"
|
||||
>+<text>{{ item.number }}</text
|
||||
>积分</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view class="text">商品:{{ item.goods_name }}</view>
|
||||
<view>金额:{{ item.order_number }}元</view>
|
||||
<view>时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view style="color: red"
|
||||
>+<text>{{ item.number }}</text
|
||||
>豆子</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无明细"></nut-empty>
|
||||
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="tabs-box">
|
||||
<view
|
||||
v-for="item in tabsList"
|
||||
:key="item.value"
|
||||
@click="tabChange(item.value)"
|
||||
>
|
||||
<view class="text">{{ item.title }}</view>
|
||||
<view
|
||||
class="line"
|
||||
:class="{ lineColor: item.value === tabValue }"
|
||||
></view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="data.length > 0">
|
||||
<view v-if="tabValue === 1 || tabValue === 3">
|
||||
<view class="card-list" v-for="(item, index) in data" :key="index">
|
||||
<view class="left">
|
||||
<view>订单:{{ item.oid }}</view>
|
||||
<view>时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view v-if="tabValue === 1" style="color: green"
|
||||
>-
|
||||
<text>{{ item.number }}积分</text>
|
||||
</view>
|
||||
<view v-if="tabValue === 3" style="color: red"
|
||||
>+
|
||||
<text>{{ item.number }}</text>
|
||||
积分
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else-if="tabValue === 2">
|
||||
<view class="card-list" v-for="(item, index) in data" :key="index">
|
||||
<view class="left">
|
||||
<view class="text">订单:{{ item.oid }}</view>
|
||||
<view>时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view style="color: red"
|
||||
>+
|
||||
<text>{{ item.number }}</text>
|
||||
豆子
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else-if="tabValue === 4">
|
||||
<view class="card-list" v-for="(item, index) in data" :key="index">
|
||||
<view class="left">
|
||||
<view class="text">类型:{{ computerType(item.type) }}</view>
|
||||
<view>时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view style="color: red"
|
||||
>+
|
||||
<text>{{ item.number }}</text>
|
||||
豆子
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<nut-empty v-else description="暂无明细"></nut-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.nut-pagination {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.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;
|
||||
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;
|
||||
.greeting {
|
||||
font-size: 35px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
height: 300px;
|
||||
width: 50%;
|
||||
text-align: left;
|
||||
margin-left: 50px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.num {
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.left {
|
||||
height: 300px;
|
||||
width: 50%;
|
||||
text-align: left;
|
||||
margin-left: 50px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.num {
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 380px;
|
||||
height: 270px;
|
||||
}
|
||||
.img {
|
||||
width: 380px;
|
||||
height: 270px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tabs-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-evenly;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
height: auto;
|
||||
background-color: #fff;
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
|
||||
.text {
|
||||
margin: 10px 20px;
|
||||
align-items: center;
|
||||
height: auto;
|
||||
background-color: #fff;
|
||||
padding: 0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.line {
|
||||
margin: 0 auto;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
border-radius: 30px;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.lineColor {
|
||||
background-color: #ff0000;
|
||||
}
|
||||
}
|
||||
|
||||
.card-list {
|
||||
margin: 10px 20px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.left {
|
||||
width: 500px;
|
||||
|
||||
.text {
|
||||
margin: 10px 20px;
|
||||
align-items: center;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
// 超出一行隐藏
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.line {
|
||||
margin: 0 auto;
|
||||
width: 50px;
|
||||
height: 5px;
|
||||
border-radius: 30px;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.lineColor {
|
||||
background-color: #ff0000;
|
||||
}
|
||||
}
|
||||
.card-list {
|
||||
margin: 10px 20px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.left {
|
||||
width: 500px;
|
||||
|
||||
.text {
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
// 超出一行隐藏
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
}
|
||||
.right {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '手机号登录'
|
||||
})
|
||||
navigationBarTitleText: "手机号登录",
|
||||
});
|
||||
|
||||
@@ -5,12 +5,12 @@ import { getVerifyCode, phoneLogin } from "@/api/user";
|
||||
import logoImg from "../../../static/logo.jpg";
|
||||
|
||||
Taro.useLoad((options) => {
|
||||
console.log(options);
|
||||
console.log(options);
|
||||
});
|
||||
|
||||
const basicData = ref({
|
||||
phone: "",
|
||||
code: "",
|
||||
phone: "",
|
||||
code: "",
|
||||
});
|
||||
|
||||
const smsDisabled = ref(false);
|
||||
@@ -19,148 +19,146 @@ const smsStr = ref("获取验证码");
|
||||
|
||||
// 获取验证码
|
||||
const getSmsCode = async () => {
|
||||
if (
|
||||
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
||||
basicData.value.phone
|
||||
)
|
||||
if (
|
||||
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
||||
basicData.value.phone
|
||||
)
|
||||
return Taro.showToast({
|
||||
title: "请输入正确的手机号码",
|
||||
icon: "none",
|
||||
});
|
||||
await getVerifyCode({
|
||||
phone: basicData.value.phone.toString(),
|
||||
)
|
||||
return Taro.showToast({
|
||||
title: "请输入正确的手机号码",
|
||||
icon: "none",
|
||||
});
|
||||
smsDisabled.value = true;
|
||||
let time = 60;
|
||||
const timer = setInterval(() => {
|
||||
time--;
|
||||
smsStr.value = `${time}s`;
|
||||
if (time === 0) {
|
||||
clearInterval(timer);
|
||||
smsDisabled.value = false;
|
||||
smsStr.value = "获取验证码";
|
||||
}
|
||||
}, 1000);
|
||||
await getVerifyCode({
|
||||
phone: basicData.value.phone.toString(),
|
||||
});
|
||||
smsDisabled.value = true;
|
||||
let time = 60;
|
||||
const timer = setInterval(() => {
|
||||
time--;
|
||||
smsStr.value = `${time}s`;
|
||||
if (time === 0) {
|
||||
clearInterval(timer);
|
||||
smsDisabled.value = false;
|
||||
smsStr.value = "获取验证码";
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const login = async () => {
|
||||
if (
|
||||
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
||||
basicData.value.phone
|
||||
)
|
||||
if (
|
||||
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
||||
basicData.value.phone
|
||||
)
|
||||
return Taro.showToast({
|
||||
title: "请输入正确的手机号码",
|
||||
icon: "none",
|
||||
});
|
||||
if (!basicData.value.code)
|
||||
return Taro.showToast({
|
||||
title: "请输入验证码",
|
||||
icon: "none",
|
||||
});
|
||||
)
|
||||
return Taro.showToast({
|
||||
title: "请输入正确的手机号码",
|
||||
icon: "none",
|
||||
});
|
||||
if (!basicData.value.code)
|
||||
return Taro.showToast({
|
||||
title: "请输入验证码",
|
||||
icon: "none",
|
||||
});
|
||||
|
||||
const res = await phoneLogin({
|
||||
Phone: basicData.value.phone,
|
||||
Code: basicData.value.code,
|
||||
Referee: Taro.getStorageSync("bind_id") || "",
|
||||
const res = await phoneLogin({
|
||||
Phone: basicData.value.phone,
|
||||
Code: basicData.value.code,
|
||||
Referee: Taro.getStorageSync("bind_id") || "",
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
Taro.setStorageSync("token", res.data.token);
|
||||
setTimeout(() => {
|
||||
Taro.removeStorageSync("bind_id");
|
||||
Taro.switchTab({
|
||||
url: "/pages/user/index",
|
||||
});
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
Taro.setStorageSync("token", res.data.token);
|
||||
setTimeout(() => {
|
||||
Taro.removeStorageSync("bind_id");
|
||||
Taro.switchTab({
|
||||
url: "/pages/user/index",
|
||||
});
|
||||
}, 2000);
|
||||
}, 2000);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="wrapper">
|
||||
<image src="../../../static/wechat_login.jpg" />
|
||||
<view class="logo">
|
||||
<image :src="logoImg" />
|
||||
<view>捷兑通</view>
|
||||
</view>
|
||||
<view class="center">
|
||||
<nut-form :model-value="basicData" ref="RefForm">
|
||||
<nut-form-item label="手机号码:">
|
||||
<nut-input
|
||||
v-model="basicData.phone"
|
||||
class="nut-input-text"
|
||||
placeholder="请输入手机号码"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="验证码:">
|
||||
<view style="display: flex">
|
||||
<nut-input
|
||||
v-model="basicData.code"
|
||||
class="nut-input-text"
|
||||
placeholder="请输入验证码"
|
||||
type="text"
|
||||
/>
|
||||
<nut-button
|
||||
size="mini"
|
||||
style="margin-left: 10px"
|
||||
@click="getSmsCode"
|
||||
:disabled="smsDisabled"
|
||||
>{{ smsStr }}</nut-button
|
||||
>
|
||||
</view>
|
||||
</nut-form-item>
|
||||
<nut-form-item>
|
||||
<nut-button type="primary" block @click="login"
|
||||
>登录</nut-button
|
||||
>
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
</view>
|
||||
<view class="wrapper">
|
||||
<image src="../../../static/wechat_login.jpg" />
|
||||
<view class="logo">
|
||||
<image :src="logoImg" />
|
||||
<view>捷兑通</view>
|
||||
</view>
|
||||
<view class="center">
|
||||
<nut-form :model-value="basicData" ref="RefForm">
|
||||
<nut-form-item label="手机号码:">
|
||||
<nut-input
|
||||
v-model="basicData.phone"
|
||||
class="nut-input-text"
|
||||
placeholder="请输入手机号码"
|
||||
type="text"
|
||||
/>
|
||||
</nut-form-item>
|
||||
<nut-form-item label="验证码:">
|
||||
<view style="display: flex">
|
||||
<nut-input
|
||||
v-model="basicData.code"
|
||||
class="nut-input-text"
|
||||
placeholder="请输入验证码"
|
||||
type="text"
|
||||
/>
|
||||
<nut-button
|
||||
size="mini"
|
||||
style="margin-left: 10px"
|
||||
@click="getSmsCode"
|
||||
:disabled="smsDisabled"
|
||||
>{{ smsStr }}</nut-button
|
||||
>
|
||||
</view>
|
||||
</nut-form-item>
|
||||
<nut-form-item>
|
||||
<nut-button type="primary" block @click="login">登录</nut-button>
|
||||
</nut-form-item>
|
||||
</nut-form>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #fff;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
position: relative;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 838px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
top: 35%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
font-size: 35px;
|
||||
line-height: 70px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 838px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
top: 35%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
font-size: 35px;
|
||||
line-height: 70px;
|
||||
|
||||
image {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 55%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 55%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "我的推广",
|
||||
navigationBarTitleText: "我的推广",
|
||||
});
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="card-list">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
@click="clickItem(item)"
|
||||
>
|
||||
<view class="text">
|
||||
<IconFont :name="item.icon" color="red" size="30" />
|
||||
<view>{{ item.label }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 45%"></view>
|
||||
<view>
|
||||
<view class="card-list">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
@click="clickItem(item)"
|
||||
>
|
||||
<view class="text">
|
||||
<IconFont :name="item.icon" color="red" size="30" />
|
||||
<view>{{ item.label }}</view>
|
||||
</view>
|
||||
<!-- 二维码弹窗 -->
|
||||
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
|
||||
<view class="popup">
|
||||
<view>推荐人二维码绑定</view>
|
||||
<image style="margin-top: 10px" :src="urlCode" />
|
||||
</view>
|
||||
</nut-popup>
|
||||
</view>
|
||||
<view style="width: 45%"></view>
|
||||
</view>
|
||||
<!-- 二维码弹窗 -->
|
||||
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
|
||||
<view class="popup">
|
||||
<view>推荐人二维码绑定</view>
|
||||
<image style="margin-top: 10px" :src="urlCode" />
|
||||
</view>
|
||||
</nut-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -35,79 +35,79 @@ const show = ref(false);
|
||||
const urlCode = ref("");
|
||||
|
||||
const list = ref([
|
||||
{
|
||||
id: 1,
|
||||
icon: "scan",
|
||||
label: "推广名片",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
icon: "date",
|
||||
label: "积分明细",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
icon: "my2",
|
||||
label: "推广用户",
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
icon: "scan",
|
||||
label: "推广名片",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
icon: "date",
|
||||
label: "积分明细",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
icon: "my2",
|
||||
label: "推广用户",
|
||||
},
|
||||
]);
|
||||
|
||||
const clickItem = async (item: any) => {
|
||||
if (item.id === 1) {
|
||||
// urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
|
||||
// "token"
|
||||
// )}`;
|
||||
Taro.showLoading({
|
||||
title: "加载中",
|
||||
mask: true,
|
||||
});
|
||||
const res = await getRefereeCode();
|
||||
urlCode.value = `data:image/png;base64,${res.data.data}`;
|
||||
show.value = true;
|
||||
Taro.hideLoading();
|
||||
} else if (item.id === 2) {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/distribution/integral/index",
|
||||
});
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/distribution/userlist/index",
|
||||
});
|
||||
}
|
||||
if (item.id === 1) {
|
||||
// urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
|
||||
// "token"
|
||||
// )}`;
|
||||
Taro.showLoading({
|
||||
title: "加载中",
|
||||
mask: true,
|
||||
});
|
||||
const res = await getRefereeCode();
|
||||
urlCode.value = `data:image/png;base64,${res.data.data}`;
|
||||
show.value = true;
|
||||
Taro.hideLoading();
|
||||
} else if (item.id === 2) {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/distribution/integral/index",
|
||||
});
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/distribution/userlist/index",
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card-list {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.item {
|
||||
width: 45%;
|
||||
height: 200px;
|
||||
background-color: #fff;
|
||||
border-radius: 20px;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
.item {
|
||||
width: 45%;
|
||||
height: 200px;
|
||||
background-color: #fff;
|
||||
border-radius: 20px;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
|
||||
.text {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.text {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popup {
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
|
||||
image {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
image {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "积分明细",
|
||||
navigationBarTitleText: "积分明细",
|
||||
});
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="data.length > 0">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view>昵称:{{ item.nick_name }}</view>
|
||||
<view>购买商品:{{ item.goods_name }}</view>
|
||||
<view
|
||||
>订单价格:<text style="color: red">{{
|
||||
item.order_number
|
||||
}}</text></view
|
||||
>
|
||||
<view>购买时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view style="color: red"
|
||||
>+<text>{{ item.number }}积分</text></view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
<view>
|
||||
<view v-if="data.length > 0">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<view>昵称:{{ item.nick_name }}</view>
|
||||
<view>购买商品:{{ item.goods_name }}</view>
|
||||
<view
|
||||
>订单价格:<text style="color: red">{{
|
||||
item.order_number
|
||||
}}</text></view
|
||||
>
|
||||
<view>购买时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<nut-empty description="暂无积分明细" />
|
||||
<view class="right">
|
||||
<view style="color: red"
|
||||
>+<text>{{ item.number }}积分</text></view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<view v-else>
|
||||
<nut-empty description="暂无积分明细" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -43,48 +43,48 @@ import { getTGIntegralDetail } from "../../../../api/user";
|
||||
const data = ref([]);
|
||||
|
||||
useLoad(() => {
|
||||
getData();
|
||||
getData();
|
||||
});
|
||||
|
||||
const page = ref({
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
ItemCount: 0,
|
||||
PageNum: 1,
|
||||
PageSize: 10,
|
||||
ItemCount: 0,
|
||||
});
|
||||
|
||||
const pageChange = (e: number) => {
|
||||
page.value.PageNum = e;
|
||||
getData();
|
||||
page.value.PageNum = e;
|
||||
getData();
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const res = await getTGIntegralDetail({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({ title: error.msg, icon: "none" });
|
||||
}
|
||||
try {
|
||||
const res = await getTGIntegralDetail({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({ title: error.msg, icon: "none" });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.card-list {
|
||||
margin: 10px 20px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 10px 20px;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.nut-pagination {
|
||||
position: absolute;
|
||||
margin-top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
position: absolute;
|
||||
margin-top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: "推广人统计",
|
||||
navigationBarTitleText: "推广人统计",
|
||||
});
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="data.length > 0">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<image :src="item.avatarUrl" />
|
||||
<view class="text">
|
||||
<view>{{ item.nickName }}</view>
|
||||
<view>{{ item.phone }}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="right"></view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<view v-else>
|
||||
<nut-empty description="暂无明细"></nut-empty>
|
||||
<view>
|
||||
<view v-if="data.length > 0">
|
||||
<view
|
||||
class="card-list"
|
||||
v-for="(item, index) in (data as any[])"
|
||||
:key="index"
|
||||
>
|
||||
<view class="left">
|
||||
<image :src="item.avatarUrl" />
|
||||
<view class="text">
|
||||
<view>{{ item.nickName }}</view>
|
||||
<view>{{ item.phone }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right"></view>
|
||||
</view>
|
||||
<nut-pagination
|
||||
v-model="page.PageNum"
|
||||
:total-items="page.ItemCount"
|
||||
:items-per-page="page.PageSize"
|
||||
@change="pageChange"
|
||||
/>
|
||||
</view>
|
||||
<view v-else>
|
||||
<nut-empty description="暂无明细"></nut-empty>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -35,7 +34,7 @@ import { useLoad, showToast } from "@tarojs/taro";
|
||||
import { getTGUserList } from "../../../../api/user";
|
||||
|
||||
useLoad(() => {
|
||||
getData();
|
||||
getData();
|
||||
});
|
||||
|
||||
const data = ref([]);
|
||||
@@ -43,51 +42,51 @@ const data = ref([]);
|
||||
const page = ref({ PageNum: 1, PageSize: 10, ItemCount: 0 });
|
||||
|
||||
const pageChange = (e: number) => {
|
||||
page.value.PageNum = e;
|
||||
getData();
|
||||
page.value.PageNum = e;
|
||||
getData();
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const res = await getTGUserList({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({ title: error.msg, icon: "none" });
|
||||
}
|
||||
try {
|
||||
const res = await getTGUserList({
|
||||
PageNum: page.value.PageNum,
|
||||
PageSize: page.value.PageSize,
|
||||
});
|
||||
data.value = res.data.data || [];
|
||||
page.value.ItemCount = res.data.count;
|
||||
} catch (error) {
|
||||
showToast({ title: error.msg, icon: "none" });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.nut-pagination {
|
||||
position: absolute;
|
||||
margin-top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
position: absolute;
|
||||
margin-top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.card-list {
|
||||
width: 700px;
|
||||
background-color: #fff;
|
||||
margin: 10px auto;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
width: 700px;
|
||||
background-color: #fff;
|
||||
margin: 10px auto;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 20px;
|
||||
}
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
image {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '登录',
|
||||
navigationStyle: 'custom'
|
||||
})
|
||||
navigationBarTitleText: "登录",
|
||||
navigationStyle: "custom",
|
||||
});
|
||||
|
||||
@@ -7,83 +7,83 @@ import logoImg from "../../../static/logo.jpg";
|
||||
const isShow = ref(false);
|
||||
|
||||
const getCode = () => {
|
||||
Taro.showLoading({
|
||||
title: "授权中...",
|
||||
mask: true,
|
||||
});
|
||||
Taro.login({
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
Taro.setStorageSync("wx_code", res.code);
|
||||
isShow.value = true;
|
||||
},
|
||||
complete: () => {
|
||||
Taro.hideLoading();
|
||||
},
|
||||
});
|
||||
Taro.showLoading({
|
||||
title: "授权中...",
|
||||
mask: true,
|
||||
});
|
||||
Taro.login({
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
Taro.setStorageSync("wx_code", res.code);
|
||||
isShow.value = true;
|
||||
},
|
||||
complete: () => {
|
||||
Taro.hideLoading();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const toPage = () => {
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/bindPhone/index?type=1",
|
||||
});
|
||||
Taro.navigateTo({
|
||||
url: "/pages/users/bindPhone/index?type=1",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="wrapper">
|
||||
<image src="../../../static/wechat_login.jpg" />
|
||||
<view class="logo">
|
||||
<image :src="logoImg" />
|
||||
<view>捷兑通</view>
|
||||
</view>
|
||||
<view class="center">
|
||||
<nut-button type="success" @click="getCode">微信登录</nut-button>
|
||||
<nut-button style="margin-top: 15px" @click="toPage"
|
||||
>手机号登录</nut-button
|
||||
>
|
||||
</view>
|
||||
<UserModal v-model:isShow="isShow" @closeEdit="isShow = false" />
|
||||
<view class="wrapper">
|
||||
<image src="../../../static/wechat_login.jpg" />
|
||||
<view class="logo">
|
||||
<image :src="logoImg" />
|
||||
<view>捷兑通</view>
|
||||
</view>
|
||||
<view class="center">
|
||||
<nut-button type="success" @click="getCode">微信登录</nut-button>
|
||||
<nut-button style="margin-top: 15px" @click="toPage"
|
||||
>手机号登录</nut-button
|
||||
>
|
||||
</view>
|
||||
<UserModal v-model:isShow="isShow" @closeEdit="isShow = false" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #fff;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
position: relative;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 838px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
font-size: 35px;
|
||||
line-height: 70px;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 838px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
font-size: 35px;
|
||||
line-height: 70px;
|
||||
|
||||
image {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 80%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
padding: 10px 100px;
|
||||
}
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 80%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
padding: 10px 100px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user