build(custom): 修正提交规范

This commit is contained in:
2023-11-09 19:49:24 +08:00
parent 76d57cea37
commit 29c1d4280f
105 changed files with 29374 additions and 18618 deletions

57
.cz-config.js Normal file
View 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: "|",
};

View File

@@ -5,7 +5,7 @@ root = true
[*] [*]
indent_style = space indent_style = space
indent_size = 4 indent_size = 2
end_of_line = lf end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = false trim_trailing_whitespace = false

8
.eslintrc Normal file
View 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
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no -- commitlint --edit "$1"

4
.husky/pre-commit Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run lint:staged

View File

@@ -2,9 +2,12 @@
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = { module.exports = {
presets: [ presets: [
['taro', { [
framework: 'vue3', "taro",
ts: true {
}] framework: "vue3",
] ts: true,
} },
],
],
};

26
commitlint.config.js Normal file
View 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",
],
],
},
};

View File

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

View File

@@ -1,105 +1,109 @@
// @ts-nocheck // @ts-nocheck
import Components from 'unplugin-vue-components/webpack' import Components from "unplugin-vue-components/webpack";
import NutUIResolver from '@nutui/nutui-taro/dist/resolver' import NutUIResolver from "@nutui/nutui-taro/dist/resolver";
import {join} from 'node:path' import { join } from "node:path";
const config = { const config = {
projectName: 'taroApp', projectName: "taroApp",
date: '2023-8-13', date: "2023-8-13",
designWidth(input: { file: string; }) { designWidth(input: { file: string }) {
if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) { if (input?.file?.replace(/\\+/g, "/").indexOf("@nutui") > -1) {
return 375 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]'
}
}
}
} }
} 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: true, // 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) { module.exports = function (merge) {
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === "development") {
return merge({}, config, require('./dev')) return merge({}, config, require("./dev"));
} }
return merge({}, config, require('./prod')) return merge({}, config, require("./prod"));
} };

View File

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

View File

@@ -27,7 +27,14 @@
"dev:rn": "npm run build:rn -- --watch", "dev:rn": "npm run build:rn -- --watch",
"dev:qq": "npm run build:qq -- --watch", "dev:qq": "npm run build:qq -- --watch",
"dev:jd": "npm run build:jd -- --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 ."
}, },
"browserslist": [ "browserslist": [
"last 3 versions", "last 3 versions",
@@ -35,51 +42,68 @@
"ios >= 8" "ios >= 8"
], ],
"author": "", "author": "",
"lint-staged": {
"*.{ts,vue}": [
"eslint --ext .ts,.vue .",
"npx prettier --write --end-of-line lf ."
]
},
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
}
},
"dependencies": { "dependencies": {
"@babel/runtime": "^7.23.1", "@babel/runtime": "^7.23.2",
"@nutui/icons-vue-taro": "^0.0.9", "@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", "@qiun/vue-ucharts": "2.5.0-20230101",
"@tarojs/components": "3.6.16", "@tarojs/components": "3.6.18",
"@tarojs/helper": "3.6.16", "@tarojs/helper": "3.6.18",
"@tarojs/plugin-framework-vue3": "3.6.16", "@tarojs/plugin-framework-vue3": "3.6.18",
"@tarojs/plugin-html": "3.6.16", "@tarojs/plugin-html": "3.6.18",
"@tarojs/plugin-platform-alipay": "3.6.16", "@tarojs/plugin-platform-alipay": "3.6.18",
"@tarojs/plugin-platform-h5": "3.6.16", "@tarojs/plugin-platform-h5": "3.6.18",
"@tarojs/plugin-platform-jd": "3.6.16", "@tarojs/plugin-platform-jd": "3.6.18",
"@tarojs/plugin-platform-qq": "3.6.16", "@tarojs/plugin-platform-qq": "3.6.18",
"@tarojs/plugin-platform-swan": "3.6.16", "@tarojs/plugin-platform-swan": "3.6.18",
"@tarojs/plugin-platform-tt": "3.6.16", "@tarojs/plugin-platform-tt": "3.6.18",
"@tarojs/plugin-platform-weapp": "3.6.16", "@tarojs/plugin-platform-weapp": "3.6.18",
"@tarojs/runtime": "3.6.16", "@tarojs/runtime": "3.6.18",
"@tarojs/shared": "3.6.16", "@tarojs/shared": "3.6.18",
"@tarojs/taro": "3.6.16", "@tarojs/taro": "3.6.18",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"pinia": "^2.1.6", "pinia": "^2.1.7",
"vue": "^3.3.4" "vue": "^3.3.8"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.0", "@babel/core": "^7.23.3",
"@tarojs/cli": "3.6.16", "@commitlint/cli": "^18.2.0",
"@tarojs/taro-loader": "3.6.16", "@commitlint/config-conventional": "^18.1.0",
"@tarojs/webpack5-runner": "3.6.16", "@tarojs/cli": "3.6.18",
"@types/node": "^18.18.4", "@tarojs/taro-loader": "3.6.18",
"@types/webpack-env": "^1.18.2", "@tarojs/webpack5-runner": "3.6.18",
"@typescript-eslint/eslint-plugin": "^6.7.4", "@types/node": "^18.18.9",
"@typescript-eslint/parser": "^6.7.4", "@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/babel-plugin-jsx": "^1.1.5",
"@vue/compiler-sfc": "^3.3.4", "@vue/compiler-sfc": "^3.3.8",
"babel-preset-taro": "3.6.16", "babel-preset-taro": "3.6.18",
"commitizen": "^4.3.0",
"css-loader": "3.4.2", "css-loader": "3.4.2",
"eslint": "^8.51.0", "cz-customizable": "^7.0.0",
"eslint-config-taro": "3.6.16", "eslint": "^8.53.0",
"eslint-plugin-vue": "^9.17.0", "eslint-config-taro": "3.6.18",
"eslint-plugin-vue": "^9.18.1",
"husky": "^8.0.3",
"lint-staged": "^15.0.2",
"style-loader": "1.3.0", "style-loader": "1.3.0",
"stylelint": "9.3.0", "stylelint": "9.3.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"unplugin-vue-components": "^0.23.0", "unplugin-vue-components": "^0.23.0",
"vue-loader": "^17.3.0", "vue-loader": "^17.3.1",
"webpack": "^5.88.2" "webpack": "^5.89.0"
} }
} }

26981
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,14 @@
{ {
"miniprogramRoot": "./dist", "miniprogramRoot": "./dist",
"projectname": "taroApp", "projectname": "taroApp",
"description": "", "description": "",
"setting": { "setting": {
"urlCheck": true, "urlCheck": true,
"es6": false, "es6": false,
"enhance": false, "enhance": false,
"compileHotReLoad": false, "compileHotReLoad": false,
"postcss": false, "postcss": false,
"minified": false "minified": false
}, },
"compileType": "miniprogram" "compileType": "miniprogram"
} }

View File

@@ -1,40 +1,41 @@
import request from '../utils/request' import request from "../utils/request";
// 订单核销 // 订单核销
export const orderVerify = (data: object) => export const orderVerify = (data: object) =>
request('/user/cancelPointOrder', data, 'POST') request("/user/cancelPointOrder", data, "POST");
// 活动订单核销 // 活动订单核销
export const activeOrderVerify = (data: object) => export const activeOrderVerify = (data: object) =>
request('/user/cancelOrder', data, 'POST') request("/user/cancelOrder", data, "POST");
// 获取订单统计 // 获取订单统计
export const orderStatistics = (data: object) => export const orderStatistics = (data: object) =>
request('/store/order/count', data, 'POST') request("/store/order/count", data, "POST");
// 获取商家积分订单列表 // 获取商家积分订单列表
export const getJfOrderList = (data: object) => export const getJfOrderList = (data: object) =>
request('/store/point/order', data, 'POST') request("/store/point/order", data, "POST");
// 获取商家活动订单列表 // 获取商家活动订单列表
export const getActiveOrderList = (data: object) => export const getActiveOrderList = (data: object) =>
request('/store/order', data, 'POST') request("/store/order", data, "POST");
// 获取积分核销列表 // 获取积分核销列表
export const getJfVerifyList = (data: object) => export const getJfVerifyList = (data: object) =>
request('/point/order/details', data, 'POST') request("/point/order/details", data, "POST");
// 获取活动核销列表 // 获取活动核销列表
export const getActiveVerifyList = (data: object) => export const getActiveVerifyList = (data: object) =>
request('/order/details', data, 'POST') request("/order/details", data, "POST");
// 增长率统计 // 增长率统计
export const growthRate = (data: object) => 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");

View File

@@ -11,57 +11,57 @@ export const getCartList = () => request("/user/cart", {}, "POST");
// 获取积分商品详情 // 获取积分商品详情
export const getGoodsDetail = (data: object) => export const getGoodsDetail = (data: object) =>
request("/point/details", data, "POST"); request("/point/details", data, "POST");
// 积分商品下单 // 积分商品下单
export const createOrder = (data: object) => export const createOrder = (data: object) =>
request("/point/place", data, "POST"); request("/point/place", data, "POST");
// 确认付款 // 确认付款
export const payJfOrder = (data: object) => export const payJfOrder = (data: object) =>
request("/point/confirmOrder", data, "POST"); request("/point/confirmOrder", data, "POST");
// 获取活动商品 // 获取活动商品
export const getActiveGoods = () => request("/goods", {}, "POST"); export const getActiveGoods = () => request("/goods", {}, "POST");
// 获取活动商品详情 // 获取活动商品详情
export const getActiveGoodsDetail = (data: object) => export const getActiveGoodsDetail = (data: object) =>
request("/goods/details", data, "POST"); request("/goods/details", data, "POST");
// 活动商品下单 // 活动商品下单
export const createActiveOrder = (data: object) => export const createActiveOrder = (data: object) =>
request("/order/place", data, "POST"); request("/order/place", data, "POST");
// 活动订单列表 // 活动订单列表
export const getActiveOrderList = (data: object) => export const getActiveOrderList = (data: object) =>
request("/user/order", data, "POST"); request("/user/order", data, "POST");
// 获取分类列表 // 获取分类列表
export const getCategoryList = () => request("/goods/class", {}, "POST"); export const getCategoryList = () => request("/goods/class", {}, "POST");
// 活动订单删除 // 活动订单删除
export const deleteActiveOrder = (data: object) => export const deleteActiveOrder = (data: object) =>
request("/user/order/remove", data, "POST"); request("/user/order/remove", data, "POST");
// 积分订单删除 // 积分订单删除
export const deleteJfOrder = (data: object) => export const deleteJfOrder = (data: object) =>
request("/user/point/remove", data, "POST"); request("/user/point/remove", data, "POST");
// 获取分类商品 // 获取分类商品
export const getCategoryGoods = (data: object) => export const getCategoryGoods = (data: object) =>
request("/class/goods/list", data, "POST"); request("/class/goods/list", data, "POST");
// 获取商家列表 // 获取商家列表
export const getMerList = (data: object) => export const getMerList = (data: object) =>
request("/store/list", data, "POST"); request("/store/list", data, "POST");
// 获取商家商品分类 // 获取商家商品分类
export const getMerCategory = (data: object) => export const getMerCategory = (data: object) =>
request("/store/classify", data, "POST"); request("/store/classify", data, "POST");
// 获取商家商品 // 获取商家商品
export const getGoodList = (data: object) => export const getGoodList = (data: object) =>
request("/store/goods", data, "POST"); request("/store/goods", data, "POST");
// // 获取活动商家列表 // // 获取活动商家列表
// export const getHotMerList = (data: object) => // export const getHotMerList = (data: object) =>

View File

@@ -2,8 +2,8 @@ import request from "@/utils/request";
// 订单支付 // 订单支付
export const payOrder = (data: object) => export const payOrder = (data: object) =>
request("/order/confirmOrder", data, "POST"); request("/order/confirmOrder", data, "POST");
// 获取订单统计 // 获取订单统计
export const getOrderStatistics = (data: object) => export const getOrderStatistics = (data: object) =>
request("/user/order/count", data, "POST"); request("/user/order/count", data, "POST");

View File

@@ -1,9 +1,9 @@
import request from '@/utils/request' import request from "@/utils/request";
// 商品列表 // 商品列表
export const productList = (data: object) => export const productList = (data: object) =>
request('/store/goods', data, 'POST') request("/store/goods", data, "POST");
// 商品添加 // 商品添加
export const addGood = (data: object) => export const addGood = (data: object) =>
request('/store/goods/edit', data, 'POST') request("/store/goods/edit", data, "POST");

View File

@@ -3,18 +3,18 @@ import request from "@/utils/request";
// 登录 // 登录
export const login = (data: object) => request("/login", data, "POST"); export const login = (data: object) => request("/login", data, "POST");
export const phoneLogin = (data: object) => export const phoneLogin = (data: object) =>
request("/phone/login", data, "POST"); request("/phone/login", data, "POST");
// 获取用户信息 // 获取用户信息
// export const getUserInfo = () => request("/user/detail", {}, "GET"); // export const getUserInfo = () => request("/user/detail", {}, "GET");
// 获取短信验证码 // 获取短信验证码
export const getVerifyCode = (data: object) => export const getVerifyCode = (data: object) =>
request("/getSmsCode", data, "POST"); request("/getSmsCode", data, "POST");
// 商家入驻申请 // 商家入驻申请
export const applyMer = (data: object) => export const applyMer = (data: object) =>
request("/store/settle", data, "POST"); request("/store/settle", data, "POST");
// 获取商家类型列表 // 获取商家类型列表
export const getMerTypeList = () => request("/store/getOther", {}, "POST"); export const getMerTypeList = () => request("/store/getOther", {}, "POST");
@@ -27,50 +27,48 @@ export const getBanner = () => request("/rotation", {}, "POST");
// 获取积分订单列表 // 获取积分订单列表
export const getIntegralOrderList = (data: object) => export const getIntegralOrderList = (data: object) =>
request("/user/pointOrder", data, "POST"); request("/user/pointOrder", data, "POST");
// 修改个人信息 // 修改个人信息
export const editPersonalInfo = (data: object) => export const editPersonalInfo = (data: object) =>
request("/user/editInfo", data, "POST"); request("/user/editInfo", data, "POST");
// 积分明细 // 积分明细
export const getIntegralDetail = (data: object) => export const getIntegralDetail = (data: object) =>
request("/user/pulseRecord", data, "POST"); request("/user/pulseRecord", data, "POST");
// 豆子明细 // 豆子明细
export const getBeanDetail = (data: object) => export const getBeanDetail = (data: object) =>
request("/user/pointRecord", data, "POST"); request("/user/pointRecord", data, "POST");
// 授权手机号 // 授权手机号
export const getPhone = (data: object) => export const getPhone = (data: object) =>
request("/user/getPhone", data, "POST"); request("/user/getPhone", data, "POST");
// 获取推广积分明细 // 获取推广积分明细
export const getTGIntegralDetail = (data: object) => export const getTGIntegralDetail = (data: object) =>
request("/user/referee/point", data, "POST"); request("/user/referee/point", data, "POST");
// 获取推广用户列表 // 获取推广用户列表
export const getTGUserList = (data: object) => export const getTGUserList = (data: object) =>
request("/user/referee/list", data, "POST"); request("/user/referee/list", data, "POST");
// 绑定上级 // 绑定上级
export const bindParent = (data: object) => export const bindParent = (data: object) =>
request("/user/bindCode", data, "POST"); request("/user/bindCode", data, "POST");
// 获取推广码 // 获取推广码
export const getRefereeCode = () => request("/user/promotion", {}, "POST"); export const getRefereeCode = () => request("/user/promotion", {}, "POST");
// 取消订单返回积分 // 取消订单返回积分
export const qxOrder = (data: object) => export const qxOrder = (data: object) =>
request("/user/point/off", data, "POST"); request("/user/point/off", data, "POST");
// 用户签到 // 用户签到
export const userSign = () => export const userSign = () => request("/sign/user", {}, "POST");
request("/sign/user", {}, "POST");
// 获取签到记录 // 获取签到记录
export const getSignRecord = () => export const getSignRecord = () => request("/sign/pulse/count", {}, "POST");
request("/sign/pulse/count", {}, "POST");
// 获取赠送总记录 // 获取赠送总记录
export const getGiftRecord = (data: object) => export const getGiftRecord = (data: object) =>
request("/user/giftPulseRecord", data, "POST"); request("/user/giftPulseRecord", data, "POST");

View File

@@ -1,113 +1,109 @@
export default defineAppConfig({ export default defineAppConfig({
pages: [ pages: [
'pages/index/index', "pages/index/index",
'pages/category/index', "pages/category/index",
'pages/cart/index', "pages/cart/index",
'pages/user/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"],
},
],
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: [ },
{ permission: {
root: 'pages/users', "scope.userLocation": {
pages: [ desc: "你的位置信息将用于小程序位置接口的效果展示",
'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']
}
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
}, },
tabBar: { },
color: '#666666', requiredBackgroundModes: ["audio", "location"],
selectedColor: '#ff0000', // @ts-ignore
backgroundColor: '#ffffff', requiredPrivateInfos: ["getLocation"],
borderStyle: 'white', lazyCodeLoading: "requiredComponents",
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'
});

View File

@@ -1,34 +1,17 @@
@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 { page {
//font-family: AlibabaPuHuiTi-3-55-Regular, sans-serif; background-color: #f5f5f5;
background-color: #f5f5f5;
} }
view { view {
box-sizing: border-box; box-sizing: border-box;
} }
.app { .app {
box-sizing: border-box; box-sizing: border-box;
background-color: #f5f5f5; background-color: #f5f5f5;
height: 100vh; height: 100vh;
position: relative; position: relative;
// 适配ios底部安全区域 // 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
} }

View File

@@ -1,62 +1,63 @@
import {createApp} from 'vue' import { createApp } from "vue";
import './app.scss' import "./app.scss";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import "static/iconfont/iconfont.css";
// 小程序场景值 // 小程序场景值
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049] const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
const App = createApp({ const App = createApp({
onLaunch(options: { onLaunch(options: {
path: string; path: string;
scene: number; scene: number;
query: object | any; query: object | any;
shareTicket: string; shareTicket: string;
referrerInfo: object | any; referrerInfo: object | any;
}) { }) {
// 检测更新 // 检测更新
if (Taro.canIUse('getUpdateManager') && options.scene !== 1154) { if (Taro.canIUse("getUpdateManager") && options.scene !== 1154) {
const updateManager = Taro.getUpdateManager() const updateManager = Taro.getUpdateManager();
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) { if (res.hasUpdate) {
updateManager.onUpdateFailed(function () { updateManager.onUpdateFailed(function () {
return Taro.showToast({ return Taro.showToast({
title: '新版本下载失败', title: "新版本下载失败",
icon: 'none' icon: "none",
}) });
}) });
updateManager.onUpdateReady(function () { updateManager.onUpdateReady(function () {
Taro.showModal({ Taro.showModal({
title: '更新提示', title: "更新提示",
content: '新版本已经下载好,是否重启当前应用?', content: "新版本已经下载好,是否重启当前应用?",
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
updateManager.applyUpdate() updateManager.applyUpdate();
}
}
})
})
updateManager.onUpdateFailed(function () {
Taro.showModal({
title: '发现新版本',
content: '请删除当前小程序,重启搜索打开...'
})
})
} }
}) },
} });
}, });
onShow() { updateManager.onUpdateFailed(function () {
const options = Taro.getCurrentInstance().router as any Taro.showModal({
if (scenes.includes(options.scene)) { title: "发现新版本",
if (options.query.scene) { content: "请删除当前小程序,重启搜索打开...",
Taro.showToast({ });
title: '已检测到推荐人', });
icon: 'none'
})
Taro.setStorageSync('bind_id', options.query.scene)
}
} }
});
} }
}) },
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;

View File

@@ -1,16 +1,16 @@
<template> <template>
<nut-overlay :visible="visible" :close-on-click-overlay="false"> <nut-overlay :visible="visible" :close-on-click-overlay="false">
<view class="text"> <view class="text">
<view>授权提醒</view> <view>授权提醒</view>
<view style="margin-top: 10px" <view style="margin-top: 10px"
>请授权头像信息以便为您提供更好的服务 >请授权头像信息以便为您提供更好的服务
</view> </view>
<view class="bom"> <view class="bom">
<view class="btn b" @click="onCancel">随便逛逛</view> <view class="btn b" @click="onCancel">随便逛逛</view>
<view class="btn a" @tap="onOk">去授权</view> <view class="btn a" @tap="onOk">去授权</view>
</view> </view>
</view> </view>
</nut-overlay> </nut-overlay>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -19,92 +19,92 @@ import Taro from "@tarojs/taro";
import { login } from "@/api/user"; import { login } from "@/api/user";
defineProps({ defineProps({
visible: { visible: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
}); });
const emit = defineEmits(["update:visible", "ok"]); const emit = defineEmits(["update:visible", "ok"]);
const onCancel = () => { const onCancel = () => {
emit("update:visible", false); emit("update:visible", false);
}; };
const onOk = () => { const onOk = () => {
Taro.showLoading({ Taro.showLoading({
title: "正在授权中", title: "正在授权中",
mask: true, mask: true,
}); });
Taro.getUserProfile({ Taro.getUserProfile({
desc: "完善用户资料", desc: "完善用户资料",
success: async (user) => { success: async (user) => {
Taro.login({ Taro.login({
success: async ({ code }) => { success: async ({ code }) => {
try { try {
const { data }: any = await login({ const { data }: any = await login({
code: code, code: code,
nickName: user.userInfo.nickName, nickName: user.userInfo.nickName,
avatarUrl: user.userInfo.avatarUrl, 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.setStorageSync("token", data.token);
emit("ok", false);
} catch (error) {
Taro.showToast({
title: error.message,
icon: "none",
});
}
}, },
fail: (err) => { fail: (err) => {
console.log(err); console.log(err);
}, },
complete: () => { complete: () => {
Taro.hideLoading(); Taro.hideLoading();
}, },
}); });
},
fail: (err) => {
console.log(err);
},
complete: () => {
Taro.hideLoading();
},
});
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.text { .text {
text-align: center; text-align: center;
background-color: #fff; background-color: #fff;
width: 500px; width: 500px;
padding: 20px; padding: 20px;
margin: auto; margin: auto;
transform: translateY(150%); transform: translateY(150%);
border-radius: 10px; border-radius: 10px;
.bom { .bom {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
align-items: center; align-items: center;
margin-top: 20px; margin-top: 20px;
.btn { .btn {
width: 150px; width: 150px;
padding: 10px; padding: 10px;
border-radius: 15px; border-radius: 15px;
color: #fff; color: #fff;
margin-bottom: 10px; margin-bottom: 10px;
}
.a {
background-color: #ff5000;
}
.b {
background-color: rgba(255, 80, 0, 0.5);
}
} }
.a {
background-color: #ff5000;
}
.b {
background-color: rgba(255, 80, 0, 0.5);
}
}
} }
</style> </style>

View File

@@ -1,181 +1,181 @@
<template> <template>
<nut-popup <nut-popup
position="bottom" position="bottom"
closeable closeable
round round
safe-area-inset-bottom safe-area-inset-bottom
:close-on-click-overlay="false" :close-on-click-overlay="false"
:style="{ height: 'auto' }" :style="{ height: 'auto' }"
:visible="isShowPay" :visible="isShowPay"
@click-close-icon="closePay" @click-close-icon="closePay"
> >
<view class="div"> <view class="div">
<view style="text-align: center">支付方式</view> <view style="text-align: center">支付方式</view>
<nut-cell-group> <nut-cell-group>
<nut-cell <nut-cell
v-if="payType === 'wx'" v-if="payType === 'wx'"
title="微信支付" title="微信支付"
desc="使用微信快捷支付" desc="使用微信快捷支付"
is-link is-link
@click="goPay()" @click="goPay()"
> >
<template v-slot:icon> <template v-slot:icon>
<IconFont <IconFont
size="30" size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png" name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/> />
</template> </template>
</nut-cell> </nut-cell>
<nut-cell <nut-cell
v-if="payType === 'jf'" v-if="payType === 'jf'"
title="积分支付" title="积分支付"
:desc="`剩余积分:${info.integral || 0}`" :desc="`剩余积分:${info.integral || 0}`"
is-link is-link
@click="goPay()" @click="goPay()"
> >
<template v-slot:icon> <template v-slot:icon>
<IconFont <IconFont
size="30" size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png" name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/> />
</template> </template>
</nut-cell> </nut-cell>
</nut-cell-group> </nut-cell-group>
</view> </view>
</nut-popup> </nut-popup>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref, watch} from 'vue' import { ref, watch } from "vue";
import {IconFont} from '@nutui/icons-vue-taro' import { IconFont } from "@nutui/icons-vue-taro";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {payOrder} from '@/api/order' import { payOrder } from "@/api/order";
import {payJfOrder} from '@/api/goods' import { payJfOrder } from "@/api/goods";
import {getPersonalInfo} from '@/api/user' import { getPersonalInfo } from "@/api/user";
const prop = defineProps({ const prop = defineProps({
isShowPay: { isShowPay: {
required: true, required: true,
type: Boolean, type: Boolean,
default: false default: false,
},
payType: {
required: true,
type: String,
default: "wx",
},
jfInfo: {
type: Object,
default: () => {
return {};
}, },
payType: { },
required: true, });
type: String,
default: 'wx'
},
jfInfo: {
type: Object,
default: () => {
return {}
}
}
})
const emit = defineEmits(['closePay', 'successPay']) const emit = defineEmits(["closePay", "successPay"]);
const info = ref<{ integral?: any }>({}) const info = ref<{ integral?: any }>({});
watch( watch(
() => prop.isShowPay, () => prop.isShowPay,
() => { () => {
getInfo() getInfo();
} }
) );
const getInfo = async () => { const getInfo = async () => {
try { try {
const res = await getPersonalInfo() const res = await getPersonalInfo();
info.value = res.data.data info.value = res.data.data;
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: 'none' icon: "none",
}) });
throw error throw error;
} }
} };
const goPay = async () => { const goPay = async () => {
console.log(prop.jfInfo) console.log(prop.jfInfo);
if (!prop.jfInfo) if (!prop.jfInfo)
return Taro.showToast({ return Taro.showToast({
title: '未获取到订单信息', title: "未获取到订单信息",
icon: 'none' icon: "none",
}) });
if (prop.payType === 'wx') { if (prop.payType === "wx") {
try { try {
const {data} = await payOrder({ const { data } = await payOrder({
oid: prop.jfInfo.oid oid: prop.jfInfo.oid,
}) });
Taro.requestPayment({ Taro.requestPayment({
timeStamp: data.data.timeStamp, timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr, nonceStr: data.data.nonceStr,
package: data.data.package, package: data.data.package,
signType: data.data.signType, signType: data.data.signType,
paySign: data.data.paySign, paySign: data.data.paySign,
success: function () { success: function () {
Taro.showToast({ Taro.showToast({
title: '支付成功', title: "支付成功",
icon: 'success', icon: "success",
duration: 2000 duration: 2000,
}) });
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/hotGoods/hot_list/index' url: "/pages/hotGoods/hot_list/index",
}) });
}, },
fail: function () { fail: function () {
Taro.showToast({ Taro.showToast({
title: '支付失败', title: "支付失败",
icon: 'none', icon: "none",
duration: 2000 duration: 2000,
}) });
} },
}) });
emit('closePay', false) emit("closePay", false);
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: 'none' icon: "none",
}) });
throw e throw e;
}
} else {
const res = await payJfOrder(prop.jfInfo)
Taro.showToast({
title: res.msg,
icon: 'success',
duration: 2000
})
Taro.navigateTo({
url: '/pages/users/order_list/index?type=0'
})
emit('closePay', false)
} }
} } else {
const res = await payJfOrder(prop.jfInfo);
Taro.showToast({
title: res.msg,
icon: "success",
duration: 2000,
});
Taro.navigateTo({
url: "/pages/users/order_list/index?type=0",
});
emit("closePay", false);
}
};
const closePay = () => { const closePay = () => {
Taro.showToast({ Taro.showToast({
title: '取消支付', title: "取消支付",
icon: 'none' icon: "none",
}) });
emit('closePay', false) emit("closePay", false);
} };
</script> </script>
<style lang="scss"> <style lang="scss">
.nut-popup { .nut-popup {
.nut-popup__container { .nut-popup__container {
border-radius: 10px; border-radius: 10px;
} }
} }
.div { .div {
padding: 20px; padding: 20px;
// text-align: center; // text-align: center;
.nut-cell { .nut-cell {
align-items: center; align-items: center;
} }
} }
</style> </style>

View File

@@ -1,59 +1,63 @@
<script setup lang="ts"> <script setup lang="ts">
import {ref} from 'vue' import { ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {getSignRecord, userSign} from '@/api/user' import { getSignRecord, userSign } from "@/api/user";
const show = ref(false) const show = ref(false);
Taro.useLoad(async () => { Taro.useLoad(async () => {
show.value = true show.value = true;
// const res = await getSignRecord() // const res = await getSignRecord()
// console.log(res) // console.log(res)
}) });
const toSign = async () => { const toSign = async () => {
try { try {
await userSign() await userSign();
Taro.showToast({ Taro.showToast({
title: '签到成功', title: "签到成功",
icon: 'none' icon: "none",
}) });
} catch (e) { } catch (e) {
console.log(e) console.log(e);
} }
show.value = false show.value = false;
} };
</script> </script>
<template> <template>
<nut-overlay v-model:visible="show" :lock-scroll="true" :close-on-click-overlay="false"> <nut-overlay
<view class="wrapper"> v-model:visible="show"
<view @click.stop="toSign"> :lock-scroll="true"
<image class="image" src="../static/index/poppBg.png"/> :close-on-click-overlay="false"
</view> >
<view @click.stop="show = false"> <view class="wrapper">
<image class="icon" src="../static/index/close.png"/> <view @click.stop="toSign">
</view> <image class="image" src="../static/index/poppBg.png" />
</view> </view>
</nut-overlay> <view @click.stop="show = false">
<image class="icon" src="../static/index/close.png" />
</view>
</view>
</nut-overlay>
</template> </template>
<style lang="scss"> <style lang="scss">
.wrapper { .wrapper {
display: flex; display: flex;
height: 100%; height: 100%;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
} }
.image { .image {
width: 500px; width: 500px;
height: 600px; height: 600px;
} }
.icon { .icon {
width: 80px; width: 80px;
height: 80px; height: 80px;
} }
</style> </style>

View File

@@ -3,81 +3,81 @@
<view class="page-body"> <view class="page-body">
<view class="wrapper"> <view class="wrapper">
<view <view
class="toolbar" class="toolbar"
@click="format" @click="format"
style="max-height: 240px; overflow-y: auto" style="max-height: 240px; overflow-y: auto"
> >
<!-- 加粗 --> <!-- 加粗 -->
<view <view
:class="data.formats.bold ? 'ql-active' : ''" :class="data.formats.bold ? 'ql-active' : ''"
class="iconfont icon-zitijiacu" class="iconfont icon-zitijiacu"
data-name="bold" data-name="bold"
></view> ></view>
<!-- 斜体 --> <!-- 斜体 -->
<view <view
:class="data.formats.italic ? 'ql-active' : ''" :class="data.formats.italic ? 'ql-active' : ''"
class="iconfont icon-zitixieti" class="iconfont icon-zitixieti"
data-name="italic" data-name="italic"
></view> ></view>
<!-- 下划线 --> <!-- 下划线 -->
<view <view
:class="data.formats.underline ? 'ql-active' : ''" :class="data.formats.underline ? 'ql-active' : ''"
class="iconfont icon-zitixiahuaxian" class="iconfont icon-zitixiahuaxian"
data-name="underline" data-name="underline"
></view> ></view>
<!-- 对齐方式 --> <!-- 对齐方式 -->
<view <view
:class="data.formats.align === 'left' ? 'ql-active' : ''" :class="data.formats.align === 'left' ? 'ql-active' : ''"
class="iconfont icon-zuoduiqi" class="iconfont icon-zuoduiqi"
data-name="align" data-name="align"
data-value="left" data-value="left"
></view> ></view>
<!-- 对齐方式居中 --> <!-- 对齐方式居中 -->
<view <view
:class="data.formats.align === 'center' ? 'ql-active' : ''" :class="data.formats.align === 'center' ? 'ql-active' : ''"
class="iconfont icon-juzhongduiqi" class="iconfont icon-juzhongduiqi"
data-name="align" data-name="align"
data-value="center" data-value="center"
></view> ></view>
<!-- 对齐方式 --> <!-- 对齐方式 -->
<view <view
:class="data.formats.align === 'right' ? 'ql-active' : ''" :class="data.formats.align === 'right' ? 'ql-active' : ''"
class="iconfont icon-youduiqi" class="iconfont icon-youduiqi"
data-name="align" data-name="align"
data-value="right" data-value="right"
></view> ></view>
<!-- 对齐方式两侧 --> <!-- 对齐方式两侧 -->
<view <view
:class="data.formats.align === 'justify' ? 'ql-active' : ''" :class="data.formats.align === 'justify' ? 'ql-active' : ''"
class="iconfont icon-zuoyouduiqi" class="iconfont icon-zuoyouduiqi"
data-name="align" data-name="align"
data-value="justify" data-value="justify"
></view> ></view>
<!-- 有序排列 --> <!-- 有序排列 -->
<view <view
:class="data.formats.list === 'ordered' ? 'ql-active' : ''" :class="data.formats.list === 'ordered' ? 'ql-active' : ''"
class="iconfont icon-youxupailie" class="iconfont icon-youxupailie"
data-name="list" data-name="list"
data-value="ordered" data-value="ordered"
></view> ></view>
<!-- 无序排列 --> <!-- 无序排列 -->
<view <view
:class="data.formats.list === 'bullet' ? 'ql-active' : ''" :class="data.formats.list === 'bullet' ? 'ql-active' : ''"
class="iconfont icon-wuxupailie" class="iconfont icon-wuxupailie"
data-name="list" data-name="list"
data-value="bullet" data-value="bullet"
></view> ></view>
<!-- 取消缩进 --> <!-- 取消缩进 -->
<view <view
class="iconfont icon-outdent" class="iconfont icon-outdent"
data-name="indent" data-name="indent"
data-value="-1" data-value="-1"
></view> ></view>
<!-- 缩进 --> <!-- 缩进 -->
<view <view
class="iconfont icon-indent" class="iconfont icon-indent"
data-name="indent" data-name="indent"
data-value="+1" data-value="+1"
></view> ></view>
<!-- 添加分割线 --> <!-- 添加分割线 -->
<view class="iconfont icon-fengexian" @click="insertDivider"></view> <view class="iconfont icon-fengexian" @click="insertDivider"></view>
@@ -85,37 +85,37 @@
<view class="iconfont icon-image" @click="insertImage"></view> <view class="iconfont icon-image" @click="insertImage"></view>
<!-- 设置标题 --> <!-- 设置标题 -->
<view <view
:class="data.formats.header === 3 ? 'ql-active' : ''" :class="data.formats.header === 3 ? 'ql-active' : ''"
class="iconfont icon-H" class="iconfont icon-H"
data-name="header" data-name="header"
:data-value="3" :data-value="3"
></view> ></view>
<!-- 下标 --> <!-- 下标 -->
<view <view
:class="data.formats.script === 'sub' ? 'ql-active' : ''" :class="data.formats.script === 'sub' ? 'ql-active' : ''"
class="iconfont icon-zitixiabiao" class="iconfont icon-zitixiabiao"
data-name="script" data-name="script"
data-value="sub" data-value="sub"
></view> ></view>
<!-- 上标 --> <!-- 上标 -->
<view <view
:class="data.formats.script === 'super' ? 'ql-active' : ''" :class="data.formats.script === 'super' ? 'ql-active' : ''"
class="iconfont icon-zitishangbiao" class="iconfont icon-zitishangbiao"
data-name="script" data-name="script"
data-value="super" data-value="super"
></view> ></view>
<view class="iconfont icon-undo" @click="undo"></view> <view class="iconfont icon-undo" @click="undo"></view>
<view class="iconfont icon-redo" @click="redo"></view> <view class="iconfont icon-redo" @click="redo"></view>
</view> </view>
<view class="editor-wrapper"> <view class="editor-wrapper">
<editor <editor
id="editor" id="editor"
class="ql-container" class="ql-container"
:placeholder="data.placeholder" :placeholder="data.placeholder"
@statuschange="onStatusChange" @statuschange="onStatusChange"
:show-img-resize="true" :show-img-resize="true"
@ready="onEditorReady" @ready="onEditorReady"
@input="getCtx" @input="getCtx"
/> />
</view> </view>
</view> </view>
@@ -124,116 +124,115 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {reactive} from 'vue' import { reactive } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {BASE_URL} from '@/utils/request' import { BASE_URL } from "@/utils/request";
const {content} = defineProps<{ const { content } = defineProps<{
content: string; content: string;
}>() }>();
let emits = defineEmits(['input']) let emits = defineEmits(["input"]);
const data = reactive<any>({ const data = reactive<any>({
editorCtx: '', editorCtx: "",
readOnly: false, readOnly: false,
placeholder: '请输入商品详情...', placeholder: "请输入商品详情...",
richText: '', richText: "",
formats: {} formats: {},
}) });
function onEditorReady() { function onEditorReady() {
// 富文本节点渲染完成 // 富文本节点渲染完成
Taro Taro.createSelectorQuery()
.createSelectorQuery() .select("#editor")
.select('#editor') .context((res) => {
.context((res) => { data.editorCtx = res.context;
data.editorCtx = res.context // 初始化数据
// 初始化数据 if (content) {
if (content) { data.editorCtx.setContents({
data.editorCtx.setContents({ html: content,
html: content });
}) }
} })
}) .exec();
.exec()
} }
// 失去焦点时,获取富文本的内容 // 失去焦点时,获取富文本的内容
function getCtx(e: { detail: { html: any; }; }) { function getCtx(e: { detail: { html: any } }) {
data.richText = e.detail.html data.richText = e.detail.html;
emits('input', e.detail.html) emits("input", e.detail.html);
} }
// 撤销操作 // 撤销操作
function undo() { function undo() {
data.editorCtx.undo() data.editorCtx.undo();
} }
// 复原操作 // 复原操作
function redo() { 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); // console.log("format", e.target.dataset);
let {name, value} = e.target.dataset let { name, value } = e.target.dataset;
if (!name) return if (!name) return;
data.editorCtx.format(name, value) data.editorCtx.format(name, value);
} }
//通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式 //通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式
function onStatusChange(e: { detail: any; }) { function onStatusChange(e: { detail: any }) {
data.formats = e.detail data.formats = e.detail;
} }
// 插入分割线 // 插入分割线
function insertDivider() { function insertDivider() {
data.editorCtx.insertDivider() data.editorCtx.insertDivider();
} }
// 插入图片 // 插入图片
function insertImage() { function insertImage() {
Taro.chooseImage({ Taro.chooseImage({
count: 1, count: 1,
sizeType: ['original', 'compressed'], sizeType: ["original", "compressed"],
sourceType: ['album', 'camera'], sourceType: ["album", "camera"],
success: (res) => { success: (res) => {
// 上传图片的逻辑各有不同,自行调整即可 // 上传图片的逻辑各有不同,自行调整即可
Taro.uploadFile({ Taro.uploadFile({
url: `${BASE_URL}/upload`, url: `${BASE_URL}/upload`,
name: 'file', name: "file",
header: {token: Taro.getStorageSync('token')}, header: { token: Taro.getStorageSync("token") },
filePath: res.tempFilePaths[0], filePath: res.tempFilePaths[0],
success: (res) => { success: (res) => {
console.log(res) console.log(res);
const imgData = JSON.parse(res.data) as { const imgData = JSON.parse(res.data) as {
code: number; code: number;
msg: string; msg: string;
data: any; data: any;
} };
if (imgData.code === 200) { if (imgData.code === 200) {
// 将图片展示在编辑器中 // 将图片展示在编辑器中
data.editorCtx.insertImage({ data.editorCtx.insertImage({
width: '100%', width: "100%",
height: 'auto', height: "auto",
src: imgData.data.data, src: imgData.data.data,
alt: '图像', alt: "图像",
success: function () { success: function () {
console.log('insert image success') console.log("insert image success");
} },
}) });
} else { } else {
console.log('上传失败') console.log("上传失败");
} }
}, },
fail: (err) => { fail: (err) => {
console.log(err) console.log(err);
} },
}) });
} },
}) });
} }
</script> </script>
@@ -246,7 +245,7 @@ function insertImage() {
.editor-wrapper { .editor-wrapper {
height: calc( height: calc(
100vh - var(--window-top) - var(--status-bar-height) - 280px - 650px 100vh - var(--window-top) - var(--status-bar-height) - 280px - 650px
); );
overflow: scroll; overflow: scroll;
background: rgba(153, 153, 153, 0.05); background: rgba(153, 153, 153, 0.05);
@@ -283,4 +282,4 @@ function insertImage() {
.ql-active { .ql-active {
color: #f38e48; color: #f38e48;
} }
</style> </style>

View File

@@ -1,22 +1,22 @@
<template> <template>
<canvas <canvas
v-if="canvasId" v-if="canvasId"
:id="canvasId" :id="canvasId"
:canvasId="canvasId" :canvasId="canvasId"
:style="{ :style="{
// width: (cWidth / cWidth) * sysInfo.windowWidth + 'px', // width: (cWidth / cWidth) * sysInfo.windowWidth + 'px',
width: cWidth, width: cWidth,
height: 250 + 'px', height: 250 + 'px',
transform: 'scale(' + 1 / pixelRatio + ')', transform: 'scale(' + 1 / pixelRatio + ')',
marginLeft: (cWidth * (pixelRatio - 1)) / 2 + 'px', marginLeft: (cWidth * (pixelRatio - 1)) / 2 + 'px',
marginTop: (cHeight * (pixelRatio - 1)) / 2 + 'px', marginTop: (cHeight * (pixelRatio - 1)) / 2 + 'px',
}" }"
@touchstart="touchStart" @touchstart="touchStart"
@touchmove="touchMove" @touchmove="touchMove"
@touchend="touchEnd" @touchend="touchEnd"
@error="error" @error="error"
> >
</canvas> </canvas>
</template> </template>
<script setup lang="ts" name="ucharts"> <script setup lang="ts" name="ucharts">
@@ -26,152 +26,152 @@ import Taro from "@tarojs/taro";
const canvases = {}; const canvases = {};
const props = defineProps({ const props = defineProps({
chartType: { chartType: {
required: true, required: true,
type: String, type: String,
default: "column", default: "column",
}, },
opts: { opts: {
required: true, required: true,
type: Object, type: Object,
default() { default() {
return null; return null;
},
},
canvasId: {
type: String,
default: "u-canvas",
},
cWidth: {
default: 350,
},
cHeight: {
default: 250,
},
pixelRatio: {
type: Number,
default: 1,
}, },
},
canvasId: {
type: String,
default: "u-canvas",
},
cWidth: {
default: 350,
},
cHeight: {
default: 250,
},
pixelRatio: {
type: Number,
default: 1,
},
}); });
Taro.useLoad(() => { Taro.useLoad(() => {
init(); init();
}); });
const init = () => { const init = () => {
switch (props.chartType) { switch (props.chartType) {
case "column": case "column":
initColumnChart(); initColumnChart();
break; break;
case "line": case "line":
initLineChart(); initLineChart();
break; break;
default: default:
break; break;
} }
}; };
const initColumnChart = () => { const initColumnChart = () => {
const ctx = Taro.createCanvasContext(props.canvasId); const ctx = Taro.createCanvasContext(props.canvasId);
canvases[props.canvasId] = new uCharts({ canvases[props.canvasId] = new uCharts({
context: ctx, context: ctx,
type: "column", type: "column",
fontSize: 11, fontSize: 11,
background: "#FFFFFF", background: "#FFFFFF",
pixelRatio: props.pixelRatio, pixelRatio: props.pixelRatio,
animation: true, animation: true,
categories: props.opts.categories, categories: props.opts.categories,
series: props.opts.series, series: props.opts.series,
enableScroll: true, enableScroll: true,
width: props.cWidth, width: props.cWidth,
height: props.cHeight, height: props.cHeight,
padding: [15,15,0,5], padding: [15, 15, 0, 5],
legend: {}, legend: {},
xAxis: { xAxis: {
disableGrid: true, disableGrid: true,
},
yAxis: {
data: [
{
min: 0,
}, },
yAxis: { ],
data: [ },
{ extra: {
min: 0, column: {
}, type: "group",
], width: 30,
}, activeBgColor: "#000000",
extra: { activeBgOpacity: 0.08,
column: { },
type: "group", },
width: 30, });
activeBgColor: "#000000",
activeBgOpacity: 0.08,
},
},
});
}; };
const initLineChart = () => { const initLineChart = () => {
const ctx = Taro.createCanvasContext(props.canvasId); const ctx = Taro.createCanvasContext(props.canvasId);
canvases[props.canvasId] = new uCharts({ canvases[props.canvasId] = new uCharts({
context: ctx, context: ctx,
type: "line", type: "line",
fontSize: 11, fontSize: 11,
legend: true, legend: true,
dataLabel: false, dataLabel: false,
dataPointShape: true, dataPointShape: true,
background: "#FFFFFF", background: "#FFFFFF",
pixelRatio: props.pixelRatio, pixelRatio: props.pixelRatio,
categories: props.opts.categories, categories: props.opts.categories,
series: props.opts.series, series: props.opts.series,
animation: true, animation: true,
enableScroll: true, enableScroll: true,
xAxis: { xAxis: {
// type: "grid", // type: "grid",
// gridColor: "#CCCCCC", // gridColor: "#CCCCCC",
// gridType: "dash", // gridType: "dash",
// dashLength: 8, // dashLength: 8,
// itemCount: 4, // itemCount: 4,
scrollShow: true, scrollShow: true,
disableGrid: true, disableGrid: true,
}, },
yAxis: { yAxis: {
gridType: "dash", gridType: "dash",
gridColor: "#CCCCCC", gridColor: "#CCCCCC",
dashLength: 8, dashLength: 8,
splitNumber: 5, splitNumber: 5,
min: 10, min: 10,
max: 180, max: 180,
format: (val) => { format: (val) => {
return val.toFixed(0) + "元"; return val.toFixed(0) + "元";
}, },
}, },
width: props.cWidth * props.pixelRatio, width: props.cWidth * props.pixelRatio,
height: props.cHeight * props.pixelRatio, height: props.cHeight * props.pixelRatio,
extra: { extra: {
line: { line: {
type: "straight", type: "straight",
}, },
}, },
}); });
}; };
const touchStart = (e: any) => { const touchStart = (e: any) => {
canvases[props.canvasId].showToolTip(e, { canvases[props.canvasId].showToolTip(e, {
format: function (item: any, category: any) { format: function (item: any, category: any) {
return category + " " + item.name + ":" + item.data; return category + " " + item.name + ":" + item.data;
}, },
}); });
canvases[props.canvasId].scrollStart(e); canvases[props.canvasId].scrollStart(e);
}; };
const touchMove = (e: any) => { const touchMove = (e: any) => {
canvases[props.canvasId].scroll(e); canvases[props.canvasId].scroll(e);
}; };
const touchEnd = (e: any) => { const touchEnd = (e: any) => {
canvases[props.canvasId].scrollEnd(e); canvases[props.canvasId].scrollEnd(e);
}; };
const error = (e: any) => { const error = (e: any) => {
throw e; throw e;
}; };
</script> </script>

View File

@@ -1,64 +1,64 @@
<template> <template>
<nut-uploader <nut-uploader
v-model:file-list="fileList" v-model:file-list="fileList"
:url="config.url" :url="config.url"
:maximum="max" :maximum="max"
:headers="config.headers" :headers="config.headers"
@success="success" @success="success"
@failure="failure" @failure="failure"
:multiple="multiple" :multiple="multiple"
> >
</nut-uploader> </nut-uploader>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {BASE_URL} from '@/utils/request' import { BASE_URL } from "@/utils/request";
import {computed, ref} from 'vue' import { computed, ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
const props = defineProps({ const props = defineProps({
list: { list: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
max: { max: {
type: Number, type: Number,
default: 1 default: 1,
}, },
multiple: { multiple: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}); });
const emits = defineEmits(['update:list']) const emits = defineEmits(["update:list"]);
const fileList = computed({ const fileList = computed({
get: () => props.list, get: () => props.list,
set: (val) => emits('update:list', val) set: (val) => emits("update:list", val),
}); });
const config = ref({ const config = ref({
url: `${BASE_URL}/upload`, url: `${BASE_URL}/upload`,
headers: { headers: {
token: Taro.getStorageSync('token') token: Taro.getStorageSync("token"),
}, },
}); });
const success = (res: any) => { const success = (res: any) => {
const data = JSON.parse(res.responseText.data) const data = JSON.parse(res.responseText.data);
res.fileItem.url = data.data.data res.fileItem.url = data.data.data;
Taro.showToast({ Taro.showToast({
title: '上传成功', title: "上传成功",
icon: 'success' icon: "success",
}); });
}; };
const failure = () => { const failure = () => {
Taro.showToast({ Taro.showToast({
title: '上传失败', title: "上传失败",
icon: 'error' icon: "error",
}); });
}; };
</script> </script>

View File

@@ -7,24 +7,24 @@ import { BASE_URL } from "@/utils/request";
import { getPhone, login } from "@/api/user"; import { getPhone, login } from "@/api/user";
const props = defineProps({ const props = defineProps({
isShow: { isShow: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
}); });
const emits = defineEmits(["closeEdit", "update:isShow"]); const emits = defineEmits(["closeEdit", "update:isShow"]);
const userInfo = ref({ const userInfo = ref({
nickname: "", nickname: "",
avatar: "", avatar: "",
phone: "", phone: "",
}); });
const show = computed({ const show = computed({
get: (): boolean => props.isShow, get: (): boolean => props.isShow,
set: (val) => { set: (val) => {
emits("update:isShow", val); emits("update:isShow", val);
}, },
}); });
const mp_is_new = ref(true); const mp_is_new = ref(true);
@@ -32,297 +32,288 @@ const mp_is_new = ref(true);
const canvasStatus = ref(false); const canvasStatus = ref(false);
const closeAttr = () => { const closeAttr = () => {
emits("closeEdit"); emits("closeEdit");
}; };
const onChooseAvatar = (e) => { const onChooseAvatar = (e) => {
const { avatarUrl } = e.detail; const { avatarUrl } = e.detail;
console.log(avatarUrl); console.log(avatarUrl);
Taro.uploadFile({ Taro.uploadFile({
url: `${BASE_URL}/upload`, url: `${BASE_URL}/upload`,
filePath: avatarUrl, filePath: avatarUrl,
name: "file", name: "file",
success: function (res) { success: function (res) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
userInfo.value.avatar = data.data.data; userInfo.value.avatar = data.data.data;
}, },
}); });
}; };
const uploadPic = () => { const uploadPic = () => {
canvasStatus.value = true; canvasStatus.value = true;
}; };
const getPhoneNumber = async (e: any) => { const getPhoneNumber = async (e: any) => {
Taro.showLoading({ Taro.showLoading({
title: "授权手机号中", title: "授权手机号中",
mask: true, mask: true,
}); });
const { code } = e.detail; const { code } = e.detail;
const res = await getPhone({ const res = await getPhone({
code: code, code: code,
}); });
userInfo.value.phone = res.data.phone; userInfo.value.phone = res.data.phone;
Taro.hideLoading(); Taro.hideLoading();
}; };
const formSubmit = async (e: any) => { const formSubmit = async (e: any) => {
if (!userInfo.value.avatar) if (!userInfo.value.avatar)
return Taro.showToast({ return Taro.showToast({
title: "请上传头像", title: "请上传头像",
icon: "none", 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") || "",
}); });
emits("closeEdit"); userInfo.value.nickname = e.detail.value.nickname;
Taro.showToast({ if (!userInfo.value.nickname)
title: res.msg, return Taro.showToast({
icon: "success", title: "请输入昵称",
duration: 2000, icon: "none",
}); });
Taro.setStorageSync("token", res.data.token); if (!userInfo.value.phone)
setTimeout(() => { return Taro.showToast({
Taro.removeStorageSync("wx_code"); title: "请授权手机号码",
Taro.removeStorageSync("bind_id"); icon: "none",
Taro.switchTab({ });
url: "/pages/user/index", const res = await login({
}); Code: Taro.getStorageSync("wx_code"),
}, 2000); 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> </script>
<template> <template>
<view> <view>
<nut-popup <nut-popup
position="bottom" position="bottom"
safe-area-inset-bottom safe-area-inset-bottom
closeable closeable
:style="{ padding: '20px 10px' }" :style="{ padding: '20px 10px' }"
v-model:visible="show" v-model:visible="show"
@close="closeAttr" @close="closeAttr"
:close-on-click-overlay="false" :close-on-click-overlay="false"
> >
<view class="mp-data"> <view class="mp-data">
<image class="image" :src="logoImg"></image> <image class="image" :src="logoImg"></image>
<text class="mp-name">捷兑通 申请</text> <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>
<view class="trip-msg"> </view>
<view class="title"> 获取您的昵称头像 </view> <view class="nickname edit-box">
<view class="trip"> 提供具有辨识度的用户中心界面 </view> <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>
<form @submit="formSubmit"> </view>
<view class="edit"> <view class="nickname edit-box">
<view class="avatar edit-box"> <view class="left">
<view class="left"> <view class="head">号码</view>
<view class="head">头像</view> <view class="input">
<view <button
class="avatar-box" open-type="getPhoneNumber"
v-if="!mp_is_new" @getphonenumber="getPhoneNumber"
@click.stop="uploadPic" >
> {{ !userInfo.phone ? "请授权手机号" : "授权成功" }}
<image </button>
:src="userInfo.avatar || headImg" </view>
mode="aspectFill" </view>
></image> </view>
</view> </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 class="bottom"> <view class="bottom">
<nut-button <nut-button formType="submit" block type="success" color="#07C160">
formType="submit" 保存
block </nut-button>
type="success" </view>
color="#07C160" </form>
> </nut-popup>
保存 </view>
</nut-button>
</view>
</form>
</nut-popup>
</view>
</template> </template>
<style lang="scss"> <style lang="scss">
.mp-data { .mp-data {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 30px; margin-bottom: 30px;
.mp-name { .mp-name {
font-size: 28px; font-size: 28px;
font-weight: bold; font-weight: bold;
color: #000000; color: #000000;
} }
.image { .image {
width: 48px; width: 48px;
height: 48px; height: 48px;
border-radius: 50%; border-radius: 50%;
margin-right: 16px; margin-right: 16px;
} }
} }
.trip-msg { .trip-msg {
padding-bottom: 32px; padding-bottom: 32px;
border-bottom: 1px solid #f5f5f5; border-bottom: 1px solid #f5f5f5;
.title { .title {
font-size: 30px; font-size: 30px;
font-weight: bold; font-weight: bold;
color: #000; color: #000;
margin-bottom: 6px; margin-bottom: 6px;
} }
.trip { .trip {
font-size: 26px; font-size: 26px;
color: #777777; color: #777777;
} }
} }
.edit { .edit {
// border-bottom: 1px solid #f5f5f5; // border-bottom: 1px solid #f5f5f5;
.avatar { .avatar {
border-bottom: 1px solid #f5f5f5; border-bottom: 1px solid #f5f5f5;
} }
.nickname { .nickname {
.input { .input {
width: 100%; width: 100%;
}
border-bottom: 1px solid #f5f5f5;
} }
border-bottom: 1px solid #f5f5f5;
}
input { input {
height: 80px; height: 80px;
} }
button { button {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
background: none; background: none;
padding: 0; padding: 0;
height: 50px; height: 50px;
font-size: 28px; font-size: 28px;
color: #838383; color: #838383;
&::after { &::after {
border: none; border: none;
}
} }
}
} }
.edit-box { .edit-box {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 30px;
padding: 22px 0;
.left {
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
font-size: 30px; flex: 1;
padding: 22px 0;
.left { .head {
display: flex; color: rgba(0, 0, 0, 0.9);
align-items: center; white-space: nowrap;
flex: 1; margin-right: 60px;
.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;
}
}
} }
.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 { .icon-xiangyou {
color: #cfcfcf; color: #cfcfcf;
} }
.bottom { .bottom {
margin-top: 20px; margin-top: 20px;
padding: 0 150px; padding: 0 150px;
.nut-button { .nut-button {
border-radius: 10px; border-radius: 10px;
} }
} }
</style> </style>

View File

@@ -1,17 +1,22 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <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
<meta name="apple-mobile-web-app-capable" content="yes"> content="width=device-width,initial-scale=1,user-scalable=no"
<meta name="apple-touch-fullscreen" content="yes"> name="viewport"
<meta name="format-detection" content="telephone=no,address=no"> />
<meta name="apple-mobile-web-app-status-bar-style" content="white"> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > <meta name="apple-touch-fullscreen" content="yes" />
<title>taroApp</title> <meta name="format-detection" content="telephone=no,address=no" />
<script><%= htmlWebpackPlugin.options.script %></script> <meta name="apple-mobile-web-app-status-bar-style" content="white" />
</head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<body> <title>taroApp</title>
<div id="app"></div> <script>
</body> <%= htmlWebpackPlugin.options.script %>
</script>
</head>
<body>
<div id="app"></div>
</body>
</html> </html>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '订单详情' navigationBarTitleText: "订单详情",
}) });

View File

@@ -1,122 +1,116 @@
<template> <template>
<view> <view>
<view class="header"> <view class="header">
<view>订单号:{{ info.oid }}</view> <view>订单号:{{ info.oid }}</view>
<view>{{ info.add_time }}</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>
<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> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import { ref, computed } from "vue"; import { ref } from "vue";
const info = ref<any>({}); const info = ref<any>({});
Taro.useLoad(() => { Taro.useLoad(() => {
info.value = Taro.getStorageSync("ver_order_info"); info.value = Taro.getStorageSync("ver_order_info");
}); });
const orderStatus = computed(() => { const orderStatus = () => {
switch (info.value.status) { switch (info.value.status) {
case 1: case 1:
return "待核销"; return "待核销";
case 2: case 2:
return "已核销"; return "已核销";
case 3: case 3:
return "已失效"; return "已失效";
} }
}); };
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
--nut-cell-desc-color: #000; --nut-cell-desc-color: #000;
} }
.header { .header {
background: linear-gradient(90deg, #2291f8 0, #1cd1dc); background: linear-gradient(90deg, #2291f8 0, #1cd1dc);
padding: 30px; padding: 30px;
color: #fff; color: #fff;
font-size: 30px; font-size: 30px;
} }
.user-info { .user-info {
background-color: #fff; background-color: #fff;
width: 100%; width: 100%;
} }
.good-info { .good-info {
margin-top: 20px; margin-top: 20px;
width: 100%; 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; background-color: #fff;
padding: 20px; }
.top { .public-total .money {
display: flex; color: #ff4c3c;
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;
}
} }
</style> </style>

View File

@@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '订单管理' navigationBarTitleText: "订单管理",
}) });

View File

@@ -1,114 +1,104 @@
<template> <template>
<view> <view>
<view class="Card"> <view class="Card">
<view>全部订单</view> <view>全部订单</view>
<view class="orderinfo"> <view class="orderinfo">
<view class="info" @click="toListPage(0)"> <view class="info" @click="toListPage(0)">
<view class="num">{{ orderInfo?.count?.A || 0 }}</view> <view class="num">{{ orderInfo?.count?.A || 0 }}</view>
<view class="sub">全部</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>
<view class="Card"> <view class="info" @click="toListPage(1)">
<view class="top" <view class="num">{{ orderInfo?.count?.B || 0 }}</view>
><text class="iconfont icon-shujutongji icon"></text <view class="sub">待付款</view>
><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>
<view class="Card"> <view class="info" @click="toListPage(2)">
<view class="top" <view class="num">{{ orderInfo?.count?.C || 0 }}</view>
><text class="iconfont icon-xiangxishuju icon"></text <view class="sub">待核销</view>
><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>
<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>
<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> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -117,121 +107,121 @@ import Taro from "@tarojs/taro";
import { orderStatistics } from "../../../api/admin"; import { orderStatistics } from "../../../api/admin";
Taro.useLoad(() => { Taro.useLoad(() => {
getData(); getData();
}); });
const orderInfo = ref<any>({}); const orderInfo = ref<any>({});
const columns = ref([ const columns = ref([
{ {
title: "日期", title: "日期",
key: "Date", key: "Date",
align: "center", align: "center",
}, },
{ {
title: "订单数", title: "订单数",
key: "TotalCount", key: "TotalCount",
align: "center", align: "center",
}, },
{ {
title: "交易额", title: "交易额",
key: "NumberSum", key: "NumberSum",
align: "center", align: "center",
render: (row) => { render: (row) => {
return h( return h(
"view", "view",
{ {
style: { style: {
color: "red", color: "red",
}, },
},
row.NumberSum
);
}, },
row.NumberSum
);
}, },
},
]); ]);
const getData = async () => { const getData = async () => {
const mer_type = Taro.getStorageSync("mer_type"); const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo"); const user_info = Taro.getStorageSync("userInfo");
const res = await orderStatistics({ const res = await orderStatistics({
bid: user_info.bid, bid: user_info.bid,
type: mer_type, type: mer_type,
}); });
orderInfo.value = res.data; orderInfo.value = res.data;
}; };
const toListPage = (index: number) => { const toListPage = (index: number) => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/admin/order_manage/list/index?type=${index}`, url: `/pages/admin/order_manage/list/index?type=${index}`,
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.Card { .Card {
width: 90%; width: 90%;
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
margin: 10px auto; margin: 10px auto;
padding: 25px; padding: 25px;
.top { .top {
display: flex; display: flex;
align-items: center; align-items: center;
text { text {
margin-right: 5px; margin-right: 5px;
}
} }
}
} }
.icon { .icon {
color: red; color: red;
} }
.gridBox { .gridBox {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: grid; display: grid;
grid-template-columns: repeat(3, 33.33%); grid-template-columns: repeat(3, 33.33%);
grid-template-rows: repeat(3, 33.33%); grid-template-rows: repeat(3, 33.33%);
grid-gap: 10px; grid-gap: 10px;
justify-content: center; justify-content: center;
text-align: center; text-align: center;
.item { .item {
margin-top: 50px; margin-top: 50px;
.title { .title {
font-size: 50px; font-size: 50px;
}
.sub {
font-size: 25px;
color: #999;
}
} }
.sub {
font-size: 25px;
color: #999;
}
}
} }
.table { .table {
margin-top: 10px; margin-top: 10px;
} }
.orderinfo { .orderinfo {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-top: 20px; margin-top: 20px;
align-items: center; align-items: center;
.info { .info {
text-align: center; text-align: center;
.num { .num {
font-size: 40px; font-size: 40px;
color: red; color: red;
}
.sub {
font-size: 25px;
color: #999;
}
} }
.sub {
font-size: 25px;
color: #999;
}
}
} }
</style> </style>

View File

@@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '订单列表' navigationBarTitleText: "订单列表",
}) });

View File

@@ -1,35 +1,33 @@
<template> <template>
<view> <view>
<view class="tabs"> <view class="tabs">
<view <view
class="item" class="item"
v-for="item in opt" v-for="item in opt"
:key="item.value" :key="item.value"
@click="tabChange(item.value)" @click="tabChange(item.value)"
> >
<view class="title">{{ item.text }}</view> <view class="title">{{ item.text }}</view>
<view <view
class="line" class="line"
:style="{ :style="{
backgroundColor: item.value === tabVal ? 'red' : '', backgroundColor: item.value === tabVal ? 'red' : '',
}" }"
></view> ></view>
</view> </view>
</view> </view>
<view v-if="dataList.length > 0"> <view v-if="dataList.length > 0">
<view <view
class="order-card" class="order-card"
v-for="(item, index) in dataList" v-for="(item, index) in dataList"
:key="index" :key="index"
@click="toDetailPage(item)" @click="toDetailPage(item)"
> >
<view class="top"> <view class="top">
<view class="name">订单号:{{ item.oid }}</view> <view class="name">订单号:{{ item.oid }}</view>
<!-- <view class="sub">下单时间{{ item.add_time }}</view> --> <!-- <view class="sub">下单时间{{ item.add_time }}</view> -->
<view class="sub" <view class="sub">核销时间{{ item.cancel_time || "待核销" }}</view>
>核销时间{{ item.cancel_time || "待核销" }}</view <!-- <view style="color: red">{{
>
<!-- <view style="color: red">{{
item.status === 0 item.status === 0
? "待付款" ? "待付款"
: item.status === 1 : item.status === 1
@@ -38,30 +36,30 @@
? "已使用" ? "已使用"
: "已失效" : "已失效"
}}</view> --> }}</view> -->
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="center"> <view class="center">
<view class="top"> <view class="top">
<image :src="item.BindGoods.cover" /> <image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods.name }} </view> <view class="title">{{ item.BindGoods.name }} </view>
<view class="right"> <view class="right">
<view>{{ item.number }}</view> <view>{{ item.number }}</view>
<view>x{{ item.count }}</view> <view>x{{ item.count }}</view>
</view> </view>
</view> </view>
<!-- <view <!-- <view
class="bom" class="bom"
style="text-align: right; font-size: 13px" style="text-align: right; font-size: 13px"
> >
{{ item.count }}件商品,实付积分: {{ item.count }}件商品,实付积分:
<text style="color: red">{{ item.number }}</text> <text style="color: red">{{ item.number }}</text>
</view> --> </view> -->
</view>
<view class="line"></view>
</view>
</view> </view>
<nut-empty v-else description="暂无订单数据"></nut-empty> <view class="line"></view>
</view>
</view> </view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -70,26 +68,26 @@ import Taro from "@tarojs/taro";
import { getJfOrderList, getActiveOrderList } from "../../../../api/admin"; import { getJfOrderList, getActiveOrderList } from "../../../../api/admin";
const opt = ref([ const opt = ref([
{ {
text: "全部", text: "全部",
value: 0, value: 0,
}, },
{ {
text: "待付款", text: "待付款",
value: 1, value: 1,
}, },
{ {
text: "待核销", text: "待核销",
value: 2, value: 2,
}, },
{ {
text: "已核销", text: "已核销",
value: 3, value: 3,
}, },
{ {
text: "已失效", text: "已失效",
value: 4, value: 4,
}, },
]); ]);
const tabVal = ref(0); const tabVal = ref(0);
@@ -97,129 +95,129 @@ const tabVal = ref(0);
const dataList = ref<any>([]); const dataList = ref<any>([]);
Taro.useLoad((options) => { Taro.useLoad((options) => {
tabVal.value = Number(options.type); tabVal.value = Number(options.type);
getData(); getData();
}); });
const getData = async () => { const getData = async () => {
try { try {
const mer_type = Taro.getStorageSync("mer_type"); const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo"); const user_info = Taro.getStorageSync("userInfo");
let res: any = null; let res: any = null;
const data = { const data = {
bid: user_info.bid, bid: user_info.bid,
status: tabVal.value, status: tabVal.value,
}; };
if (mer_type === 1) { if (mer_type === 1) {
res = await getActiveOrderList(data); res = await getActiveOrderList(data);
} else { } else {
res = await getJfOrderList(data); res = await getJfOrderList(data);
}
dataList.value = res.data.data;
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
} }
dataList.value = res.data.data;
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
}; };
const tabChange = (e: number) => { const tabChange = (e: number) => {
tabVal.value = e; tabVal.value = e;
getData(); getData();
}; };
const toDetailPage = (item: any) => { const toDetailPage = (item: any) => {
Taro.setStorageSync("ver_order_info", item); Taro.setStorageSync("ver_order_info", item);
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/admin/order_manage/detail/index", url: "/pages/admin/order_manage/detail/index",
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.tabs { .tabs {
display: flex;
justify-content: space-evenly;
align-items: center;
background-color: #fff;
padding: 10px;
.item {
width: 100%;
display: flex; display: flex;
justify-content: space-evenly; flex-direction: column;
align-items: center; align-items: center;
background-color: #fff; .line {
padding: 10px; margin-top: 10px;
.item { width: 50px;
width: 100%; height: 5px;
display: flex;
flex-direction: column;
align-items: center;
.line {
margin-top: 10px;
width: 50px;
height: 5px;
}
} }
}
} }
.order-card { .order-card {
width: 95%; width: 95%;
box-sizing: border-box; box-sizing: border-box;
margin: 15px auto; margin: 15px auto;
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
.line { .line {
width: 100%; width: 100%;
height: 1px; height: 1px;
background-color: #f5f5f5; background-color: #f5f5f5;
margin: 10px; 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 { .top {
// display: flex; display: flex;
// justify-content: space-between; justify-content: space-between;
// align-items: center; // align-items: flex-start;
.name { image {
font-weight: bold; width: 150px;
} height: 150px;
}
.sub { .title {
color: #999; margin-left: 10px;
font-size: 30px; display: -webkit-box;
} overflow: hidden;
} -webkit-line-clamp: 2;
-webkit-box-orient: vertical;
.btn { text-overflow: ellipsis;
display: flex; width: 350px;
justify-content: flex-end; }
align-items: center;
} .right {
margin-left: 10px;
.center { font-size: 28px;
.top { 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> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "订单数据统计", navigationBarTitleText: "订单数据统计",
}); });

View File

@@ -1,121 +1,117 @@
<template> <template>
<view class="statistical-page" ref="container"> <view class="statistical-page" ref="container">
<view class="navs"> <view class="navs">
<view class="list"> <view class="list">
<view <view
class="item" class="item"
:class="time == 'today' ? 'on' : ''" :class="time == 'today' ? 'on' : ''"
@click="setTime('today')" @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"
> >
</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>
<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> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -134,321 +130,321 @@ let canvas_obj;
const w = Taro.getSystemInfoSync().windowWidth; const w = Taro.getSystemInfoSync().windowWidth;
const chartWH = ref({ const chartWH = ref({
width: w * 0.9, width: w * 0.9,
height: 250, height: 250,
pixelRatio: 1, pixelRatio: 1,
}); });
const columns = ref([ const columns = ref([
{ {
title: "日期", title: "日期",
key: "Date", key: "Date",
align: "center", align: "center",
}, },
{ {
title: "订单数", title: "订单数",
key: "TotalCount", key: "TotalCount",
align: "center", align: "center",
}, },
{ {
title: "交易额", title: "交易额",
key: "NumberSum", key: "NumberSum",
align: "center", align: "center",
render: (row) => { render: (row) => {
return h( return h(
"view", "view",
{ {
style: { style: {
color: "red", color: "red",
}, },
},
row.NumberSum
);
}, },
row.NumberSum
);
}, },
},
]); ]);
const date_start = computed(() => { const date_start = computed(() => {
return dayjs().startOf("year").format("YYYY-MM-DD"); return dayjs().startOf("year").format("YYYY-MM-DD");
}); });
const title = ref(""); const title = ref("");
const where = ref({ const where = ref({
type: 1, type: 1,
status: 2, status: 2,
start: "", start: "",
end: "", end: "",
}); });
const dataObj = ref<any>({}); const dataObj = ref<any>({});
const opts = ref<any>({ const opts = ref<any>({
categories: [], categories: [],
series: [ series: [
{ {
name: "营业额", name: "营业额",
data: [], data: [],
}, },
{ {
name: "订单量", name: "订单量",
data: [], data: [],
}, },
], ],
}); });
Taro.useLoad((options) => { Taro.useLoad((options) => {
where.value.type = options.type === "price" ? 1 : 2; where.value.type = options.type === "price" ? 1 : 2;
time.value = options.time; time.value = options.time;
setTime(options.time); setTime(options.time);
// getData(); // getData();
}); });
const setTime = (type: string) => { const setTime = (type: string) => {
time.value = type; time.value = type;
switch (type) { switch (type) {
case "today": case "today":
title.value = "今日"; title.value = "今日";
where.value.status = 2; where.value.status = 2;
where.value.start = dayjs().format("YYYY-MM-DD"); where.value.start = dayjs().format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD"); where.value.end = dayjs().format("YYYY-MM-DD");
break; break;
case "yesterday": case "yesterday":
title.value = "昨日"; title.value = "昨日";
where.value.status = 2; where.value.status = 2;
where.value.start = dayjs().add(-1, "day").format("YYYY-MM-DD"); where.value.start = dayjs().add(-1, "day").format("YYYY-MM-DD");
where.value.end = dayjs().add(-1, "day").format("YYYY-MM-DD"); where.value.end = dayjs().add(-1, "day").format("YYYY-MM-DD");
break; break;
case "seven": case "seven":
title.value = "7天"; title.value = "7天";
where.value.status = 2; where.value.status = 2;
where.value.start = dayjs().add(-6, "day").format("YYYY-MM-DD"); where.value.start = dayjs().add(-6, "day").format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD"); where.value.end = dayjs().format("YYYY-MM-DD");
break; break;
case "month": case "month":
title.value = "本月"; title.value = "本月";
where.value.status = 1; where.value.status = 1;
where.value.start = dayjs().startOf("month").format("YYYY-MM-DD"); where.value.start = dayjs().startOf("month").format("YYYY-MM-DD");
where.value.end = dayjs().format("YYYY-MM-DD"); where.value.end = dayjs().format("YYYY-MM-DD");
break; break;
} }
getData(); getData();
}; };
const dateTitle = () => { const dateTitle = () => {
where.value.status = 1; where.value.status = 1;
time.value = "date"; time.value = "date";
isVisible.value = true; isVisible.value = true;
}; };
const setChooseValue = (ref: any) => { const setChooseValue = (ref: any) => {
where.value.start = ref[0][3]; where.value.start = ref[0][3];
where.value.end = ref[1][3]; where.value.end = ref[1][3];
title.value = `${where.value.start}-${where.value.end}`; title.value = `${where.value.start}-${where.value.end}`;
getData(); getData();
}; };
const getData = async () => { const getData = async () => {
try { try {
const mer_type = Taro.getStorageSync("mer_type"); const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo"); const user_info = Taro.getStorageSync("userInfo");
const res = await growthRate({ const res = await growthRate({
bid: user_info.bid, bid: user_info.bid,
type: mer_type, type: mer_type,
status: where.value.status, status: where.value.status,
StartTime: where.value.start, StartTime: where.value.start,
EndTime: where.value.end, EndTime: where.value.end,
}); });
dataObj.value = res.data; dataObj.value = res.data;
opts.value.categories = []; opts.value.categories = [];
opts.value.series[0].data = []; opts.value.series[0].data = [];
opts.value.series[1].data = []; opts.value.series[1].data = [];
res.data.list.forEach((item: any) => { res.data.list.forEach((item: any) => {
opts.value.categories.push(item.Date); opts.value.categories.push(item.Date);
opts.value.series[0].data.push(item.NumberSum); opts.value.series[0].data.push(item.NumberSum);
opts.value.series[1].data.push(item.TotalCount); opts.value.series[1].data.push(item.TotalCount);
}); });
create_canvas(); create_canvas();
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
throw error; throw error;
} }
}; };
const create_canvas = () => { const create_canvas = () => {
const ctx = Taro.createCanvasContext("myChart"); const ctx = Taro.createCanvasContext("myChart");
canvas_obj = new uCharts({ canvas_obj = new uCharts({
type: "column", type: "column",
context: ctx, context: ctx,
width: chartWH.value.width, width: chartWH.value.width,
height: chartWH.value.height, height: chartWH.value.height,
categories: opts.value.categories, categories: opts.value.categories,
series: opts.value.series, series: opts.value.series,
pixelRatio: chartWH.value.pixelRatio, pixelRatio: chartWH.value.pixelRatio,
animation: true, animation: true,
background: "#FFFFFF", background: "#FFFFFF",
color: [ color: [
"#1890FF", "#1890FF",
"#91CB74", "#91CB74",
"#FAC858", "#FAC858",
"#EE6666", "#EE6666",
"#73C0DE", "#73C0DE",
"#3CA272", "#3CA272",
"#FC8452", "#FC8452",
"#9A60B4", "#9A60B4",
"#ea7ccc", "#ea7ccc",
], ],
padding: [15, 15, 0, 15], padding: [15, 15, 0, 15],
enableScroll: true, enableScroll: true,
legend: {}, legend: {},
xAxis: { xAxis: {
disableGrid: true, disableGrid: true,
scrollShow: true, scrollShow: true,
itemCount: 3, itemCount: 3,
},
yAxis: {
data: [
{
min: 0,
}, },
yAxis: { ],
data: [ },
{ extra: {
min: 0, column: {
}, type: "group",
], width: 20,
}, activeBgColor: "#000000",
extra: { activeBgOpacity: 0.08,
column: { },
type: "group", },
width: 20, });
activeBgColor: "#000000",
activeBgOpacity: 0.08,
},
},
});
}; };
const touchStart = (e: any) => { const touchStart = (e: any) => {
canvas_obj.showToolTip(e, { canvas_obj.showToolTip(e, {
format: function (item: any, category: any) { format: function (item: any, category: any) {
return category + " " + item.name + ":" + item.data; return category + " " + item.name + ":" + item.data;
}, },
}); });
canvas_obj.scrollStart(e); canvas_obj.scrollStart(e);
}; };
const touchMove = (e: any) => { const touchMove = (e: any) => {
canvas_obj.scroll(e); canvas_obj.scroll(e);
}; };
const touchEnd = (e: any) => { const touchEnd = (e: any) => {
canvas_obj.scrollEnd(e); canvas_obj.scrollEnd(e);
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.statistical-page { .statistical-page {
.navs { .navs {
width: 100%; width: 100%;
height: 96px; height: 96px;
background-color: #fff; background-color: #fff;
overflow: hidden; overflow: hidden;
line-height: 96px; line-height: 96px;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
z-index: 9; z-index: 9;
.list { .list {
overflow-y: hidden; overflow-y: hidden;
overflow-x: auto; overflow-x: auto;
white-space: nowrap; white-space: nowrap;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
width: 100%; width: 100%;
.item { .item {
font-size: 32px; font-size: 32px;
color: #282828; color: #282828;
margin-left: 60px; margin-left: 60px;
display: inline-block; display: inline-block;
} }
.on { .on {
color: #fa2c19; 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 { .money {
width: 95%; font-size: 72px;
background-color: #fff; color: #fba02a;
border-radius: 10px; text-align: center;
margin: 119px auto 0 auto; margin-top: 10px;
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;
}
}
} }
.chart { .increase {
width: 95%; font-size: 28px;
box-sizing: border-box; color: #999;
background-color: #fff; margin-top: 20px;
border-radius: 10px; display: flex;
margin: 23px auto; justify-content: space-between;
padding: 10px; align-items: center;
.red {
color: #ff6969;
}
.green {
color: #1abb1d;
}
.iconfont {
font-size: 23px;
margin-left: 15px;
}
} }
}
.Card { .chart {
width: 95%; width: 95%;
background-color: #fff; box-sizing: border-box;
border-radius: 10px; background-color: #fff;
margin: 10px auto; border-radius: 10px;
padding: 25px; margin: 23px auto;
padding: 10px;
}
.top { .Card {
display: flex; width: 95%;
align-items: center; background-color: #fff;
text { border-radius: 10px;
margin-right: 5px; margin: 10px auto;
} padding: 25px;
.iconfont { .top {
color: #fa2c19; display: flex;
} align-items: center;
} text {
.table { margin-right: 5px;
margin-top: 10px; }
}
.iconfont {
color: #fa2c19;
}
} }
.table {
margin-top: 10px;
}
}
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "订单核销", navigationBarTitleText: "订单核销",
}); });

View File

@@ -1,11 +1,9 @@
<template> <template>
<view> <view>
<view class="card"> <view class="card">
<nut-button block type="primary" @click="scanCode" <nut-button block type="primary" @click="scanCode">扫码核销</nut-button>
>扫码核销</nut-button
>
</view>
</view> </view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -28,44 +26,44 @@ import Taro from "@tarojs/taro";
// }; // };
const scanCode = () => { const scanCode = () => {
Taro.scanCode({ Taro.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
scanType: ["qrCode"], scanType: ["qrCode"],
success: async (res) => { success: async (res) => {
try { try {
const mer_type = JSON.parse(Taro.getStorageSync("mer_type")); const mer_type = JSON.parse(Taro.getStorageSync("mer_type"));
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/admin/verify/verify_list/index?oid=${res.result}&mer_type=${mer_type}`, url: `/pages/admin/verify/verify_list/index?oid=${res.result}&mer_type=${mer_type}`,
}); });
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
}, },
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: #f5f5f5; background-color: #f5f5f5;
background-image: url("~@/static/admin/cancellation-header.png"); background-image: url("~@/static/admin/cancellation-header.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 30%; background-size: 100% 30%;
} }
.card { .card {
width: 80%; width: 80%;
height: 300px; height: 300px;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
margin: 300px auto; margin: 300px auto;
border-radius: 10px; border-radius: 10px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 100px; padding: 0 100px;
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "核销列表", navigationBarTitleText: "核销列表",
}); });

View File

@@ -1,146 +1,139 @@
<template> <template>
<view> <view>
<view class="card"> <view class="card">
<view>订单号{{ goodInfo.oid }}</view> <view>订单号{{ goodInfo.oid }}</view>
<view class="line"></view> <view class="line"></view>
<view class="container"> <view class="container">
<image <image class="image" :src="goodInfo.cover" mode="widthFix"></image>
class="image" <view class="info">
:src="goodInfo.cover" <view class="title">{{ goodInfo.goods_name }}</view>
mode="widthFix" <view class="num"
></image> >数量: <text style="color: red">{{ goodInfo.count }}</text></view
<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>
<view></view>
</view>
<view class="line"></view>
<view class="cz">
<nut-button size="small" type="primary" @click="subVerify"
>确定核销</nut-button
>
</view>
</view> </view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import { import {
getJfVerifyList, getJfVerifyList,
getActiveVerifyList, getActiveVerifyList,
activeOrderVerify, activeOrderVerify,
orderVerify, orderVerify,
} from "@/api/admin"; } from "@/api/admin";
import { ref } from "vue"; import { ref } from "vue";
const opt = ref<any>({}); const opt = ref<any>({});
Taro.useLoad((options) => { Taro.useLoad((options) => {
opt.value = options; opt.value = options;
getData(options); getData(options);
}); });
const goodInfo = ref<any>({}); const goodInfo = ref<any>({});
const getData = async (options: any) => { const getData = async (options: any) => {
let res; let res;
if (Number(options.mer_type) === 1) { if (Number(options.mer_type) === 1) {
res = await getActiveVerifyList({ res = await getActiveVerifyList({
oid: options.oid, oid: options.oid,
}); });
} else { } else {
res = await getJfVerifyList({ res = await getJfVerifyList({
oid: options.oid, oid: options.oid,
}); });
} }
if (!res.data.data.oid) { if (!res.data.data.oid) {
Taro.showToast({ Taro.showToast({
title: "没有此订单", title: "没有此订单",
icon: "none", icon: "none",
}); });
setTimeout(() => { setTimeout(() => {
Taro.navigateBack({ Taro.navigateBack({
delta: 1, delta: 1,
}); });
}, 3000); }, 3000);
} }
goodInfo.value = res.data.data; goodInfo.value = res.data.data;
}; };
const subVerify = async () => { const subVerify = async () => {
try { try {
let res; let res;
if (Number(opt.value.mer_type) === 1) { if (Number(opt.value.mer_type) === 1) {
res = await activeOrderVerify({ res = await activeOrderVerify({
oid: goodInfo.value.oid, oid: goodInfo.value.oid,
}); });
} else { } else {
res = await orderVerify({ res = await orderVerify({
oid: goodInfo.value.oid, 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;
} }
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> </script>
<style lang="scss"> <style lang="scss">
.card { .card {
padding: 20rpx; padding: 20rpx;
background-color: #fff; background-color: #fff;
margin: 10px auto; margin: 10px auto;
width: 90%; width: 90%;
border-radius: 7px; border-radius: 7px;
.container { .container {
display: flex; display: flex;
image { image {
width: 200px; width: 200px;
height: 100%; height: 100%;
border-radius: 7px; border-radius: 7px;
display: block; display: block;
}
.info {
margin-left: 20px;
}
.title {
margin-bottom: 10px;
}
} }
.line { .info {
width: 100%; margin-left: 20px;
height: 1px;
background-color: #f5f5f5;
margin: 10px 0;
} }
.cz { .title {
text-align: right; margin-bottom: 10px;
} }
}
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px 0;
}
.cz {
text-align: right;
}
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "收益提现", navigationBarTitleText: "收益提现",
}); });

View File

@@ -1,65 +1,83 @@
<script lang="ts" setup> <script lang="ts" setup>
import {ref, h} from 'vue' import { ref, h } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {getWithdrawList, addWithdraw} from '@/api/admin' 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({ const basicData = ref({
num: '' num: "",
}) });
const showPreview = ref(false) const showPreview = ref(false);
const imgData = ref([{ const imgData = ref([
src: '' {
}]) src: "",
},
]);
const columns = ref([ const columns = ref([
{ {
title: '时间', title: "时间",
key: 'add_time', key: "add_time",
align: 'center' align: "center",
}, {
title: '提现金额',
key: 'integral',
align: 'center',
render: (row: { integral: number; }) => {
return h('view', {}, row.integral / 100)
}
}, },
{ {
title: '审核状态', title: "提现金额",
key: 'status', key: "integral",
align: 'center', align: "center",
render: (row: { status: number; }) => { render: (row: { integral: number }) => {
return h('view', { return h("view", {}, row.integral / 100);
class: `tag ${row.status === 1 ? 'success' : row.status === 2 ? 'danger' : 'warning'}` },
}, {
default: () => row.status === 1 ? '已打款' : row.status === 2 ? '已拒绝' : '待审核'
})
}
}, },
{ {
title: '备注', title: "审核状态",
key: 'img', key: "status",
align: 'center', align: "center",
render: (row: { status_img: string; }) => { render: (row: { status: number }) => {
return h('img', { return h(
class: 'image', "view",
onClick: () => { {
imgData.value[0].src = row.status_img class: `tag ${
showPreview.value = true 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({ const pagination = ref({
page: 1, page: 1,
@@ -67,61 +85,67 @@ const pagination = ref({
showPageSize: 5, showPageSize: 5,
totalItems: 0, totalItems: 0,
change: (page: number) => { change: (page: number) => {
pagination.value.page = page pagination.value.page = page;
getData() getData();
} },
}) });
const hideFn = () => { const hideFn = () => {
showPreview.value = false showPreview.value = false;
} };
Taro.useLoad(() => { Taro.useLoad(() => {
getData() getData();
}) });
const getData = async () => { const getData = async () => {
try { try {
const res = await getWithdrawList({ const res = await getWithdrawList({
PageNum: pagination.value.page, PageNum: pagination.value.page,
PageSize: pagination.value.showPageSize, PageSize: pagination.value.showPageSize,
Bid: user_info.bid Bid: user_info.bid,
}) });
data.value = res.data.data || [] data.value = res.data.data || [];
pagination.value.totalItems = res.data.total pagination.value.totalItems = res.data.total;
row.value = res.data.integral || 0 row.value = res.data.integral || 0;
console.log(res) console.log(res);
} catch (e) { } catch (e) {
throw e throw e;
} }
} };
const add = async () => { const add = async () => {
try { try {
if (Number(basicData.value.num) === 0) return Taro.showToast({ if (Number(basicData.value.num) === 0)
title: '提现积分需大于0', return Taro.showToast({
icon: 'none' title: "提现积分需大于0",
}) icon: "none",
});
const res = await addWithdraw({ const res = await addWithdraw({
Bid: user_info.bid, Bid: user_info.bid,
Number: Number(basicData.value.num) Number: Number(basicData.value.num),
}) });
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: "none",
}) });
await getData() await getData();
} catch (e) { } catch (e) {
throw e throw e;
} }
} };
</script> </script>
<template> <template>
<view> <view>
<nut-form> <nut-form>
<nut-form-item label="提现积分:"> <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>
<nut-form-item> <nut-form-item>
<view> <view>
@@ -141,19 +165,24 @@ const add = async () => {
<view v-if="data.length > 0"> <view v-if="data.length > 0">
<view class="data"> <view class="data">
<nut-table :columns="columns" :data="data"></nut-table> <nut-table :columns="columns" :data="data"></nut-table>
<nut-pagination class="pagination" v-model="pagination.page" :total-items="pagination.totalItems" <nut-pagination
:items-per-page="pagination.itemsPerPage" :show-page-size="pagination.showPageSize" class="pagination"
@change="pagination.change" :bordered="false"/> 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>
</view> </view>
<nut-empty v-else description="暂无提现记录"></nut-empty> <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> </view>
</template> </template>
<style lang="scss"> <style lang="scss">
.text-red { .text-red {
color: red; color: red;
} }
@@ -194,4 +223,4 @@ const add = async () => {
width: 50px; width: 50px;
height: 50px; height: 50px;
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '购物车' navigationBarTitleText: "购物车",
}) });

View File

@@ -1,22 +1,36 @@
<template> <template>
<view> <view>
<view v-if="list.length > 0"> <view v-if="list.length > 0">
<nut-swipe v-for="(item,index) in list" :key="index"> <nut-swipe v-for="(item, index) in list" :key="index">
<view class="item"> <view class="item">
<nut-checkbox v-model="item.checkbox" @click="select">{{ item.ID }}</nut-checkbox> <nut-checkbox v-model="item.checkbox" @click="select">{{
<image src="https://s2.loli.net/2023/08/16/6KgdSQa4WRoT3sz.jpg" item.ID
style="width: 100px;height: 100px"/> }}</nut-checkbox>
<image
src="https://s2.loli.net/2023/08/16/6KgdSQa4WRoT3sz.jpg"
style="width: 100px; height: 100px"
/>
<view class="text"> <view class="text">
<view>{{ item.name }}</view> <view>{{ item.name }}</view>
<view class="bom"> <view class="bom">
<nut-price :price="item.number" size="normal" :need-symbol="false"/> <nut-price
<nut-input-number readonly @add="select()" @reduce="select()" :price="item.number"
v-model="item.count"/> size="normal"
:need-symbol="false"
/>
<nut-input-number
readonly
@add="select()"
@reduce="select()"
v-model="item.count"
/>
</view> </view>
</view> </view>
</view> </view>
<template #right> <template #right>
<nut-button shape="square" style="height:100%" type="danger">删除</nut-button> <nut-button shape="square" style="height: 100%" type="danger"
>删除</nut-button
>
</template> </template>
</nut-swipe> </nut-swipe>
</view> </view>
@@ -28,10 +42,16 @@
</view> </view>
<view class="bottom-box"> <view class="bottom-box">
<view class="left"> <view class="left">
<nut-checkbox v-model="selectAllVal" @change="selectAll">全选</nut-checkbox> <nut-checkbox v-model="selectAllVal" @change="selectAll"
>全选</nut-checkbox
>
<view class="text-box"> <view class="text-box">
总计积分 总计积分
<nut-price v-model:price="localCount" size="normal" :need-symbol="false"/> <nut-price
v-model:price="localCount"
size="normal"
:need-symbol="false"
/>
</view> </view>
</view> </view>
<nut-button type="primary" @click="sub">去结算</nut-button> <nut-button type="primary" @click="sub">去结算</nut-button>
@@ -40,78 +60,77 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue' import { ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {getCartList} from '@/api/goods' import { getCartList } from "@/api/goods";
const selectAllVal = ref(false) const selectAllVal = ref(false);
const list = ref([]) const list = ref([]);
const localCount = ref(0) const localCount = ref(0);
Taro.useDidShow(() => { Taro.useDidShow(() => {
getList() getList();
}) });
const select = () => { const select = () => {
localCount.value = 0 localCount.value = 0;
list.value.forEach((item: any) => { list.value.forEach((item: any) => {
if (item.checkbox) { if (item.checkbox) {
setTimeout(() => { setTimeout(() => {
item.countNum = Number(item.number) * Number(item.count) item.countNum = Number(item.number) * Number(item.count);
localCount.value += item.countNum localCount.value += item.countNum;
console.log(localCount.value) console.log(localCount.value);
}, 1) }, 1);
selectAllVal.value = true selectAllVal.value = true;
} else { } else {
selectAllVal.value = false selectAllVal.value = false;
} }
}) });
} };
const selectAll = () => { const selectAll = () => {
localCount.value = 0 localCount.value = 0;
list.value.forEach((item: any) => { list.value.forEach((item: any) => {
item.checkbox = selectAllVal.value item.checkbox = selectAllVal.value;
}) });
select() select();
console.log(list.value) console.log(list.value);
} };
const sub = () => { const sub = () => {
const arr = list.value.filter((item: any) => item.checkbox) const arr = list.value.filter((item: any) => item.checkbox);
if (arr.length === 0) { if (arr.length === 0) {
Taro.showToast({ Taro.showToast({
title: '请选择商品', title: "请选择商品",
icon: 'none' icon: "none",
}) });
return return;
} }
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/goods/order_create/index' url: "/pages/goods/order_create/index",
}) });
} };
const getList = async () => { const getList = async () => {
const res = await getCartList() const res = await getCartList();
list.value = res.data.data.Goods.map((item: any) => { list.value = res.data.data.Goods.map((item: any) => {
return { return {
...item, ...item,
count: 1, count: 1,
countNum: item.number, countNum: item.number,
checkbox: false checkbox: false,
} };
}) });
} };
const toPage = () => { const toPage = () => {
Taro.switchTab({ Taro.switchTab({
url: '/pages/index/index' url: "/pages/index/index",
}) });
} };
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -176,7 +195,5 @@ const toPage = () => {
margin-left: 10px; margin-left: 10px;
} }
} }
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '分类' navigationBarTitleText: "分类",
}) });

View File

@@ -1,52 +1,48 @@
<template> <template>
<nut-tabs <nut-tabs
style="height: 100vh" style="height: 100vh"
v-model="val" v-model="val"
title-scroll title-scroll
ellipsis ellipsis
:animated-time="10" :animated-time="10"
name="tabs" name="tabs"
direction="vertical" direction="vertical"
@change="tabChange" @change="tabChange"
>
<nut-tab-pane
v-for="item in list"
:title="(item.name as string)"
:key="item.ID"
> >
<nut-tab-pane <view v-if="goodList.length > 0">
v-for="item in list" <view
:title="(item.name as string)" class="list"
:key="item.ID" v-for="(item, index) in (goodList as any)"
:key="index"
> >
<view v-if="goodList.length > 0"> <view class="item">
<view <img :src="item.cover" />
class="list" <view class="right">
v-for="(item, index) in (goodList as any)" <view class="name">{{ item.name }}</view>
:key="index" <view class="bom">
<view class="price"
><text style="font-size: 15px">{{ item.number }}</text>
积分</view
> >
<view class="item"> <nut-button
<img :src="item.cover" /> size="mini"
<view class="right"> type="primary"
<view class="name">{{ item.name }}</view> @click.stop="toGoodDetails(item.gid as number)"
<view class="bom"> >去兑换</nut-button
<view class="price" >
><text style="font-size: 15px">{{ </view>
item.number
}}</text>
积分</view
>
<nut-button
size="mini"
type="primary"
@click.stop="
toGoodDetails(item.gid as number)
"
>去兑换</nut-button
>
</view>
</view>
</view>
</view>
</view> </view>
<nut-empty v-else description="暂无商品"></nut-empty> </view>
</nut-tab-pane> </view>
</nut-tabs> </view>
<nut-empty v-else description="暂无商品"></nut-empty>
</nut-tab-pane>
</nut-tabs>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@@ -57,8 +53,8 @@ import { getCategoryList, getCategoryGoods } from "@/api/goods";
const val = ref(0); const val = ref(0);
interface List { interface List {
ID?: number; ID?: number;
name?: string; name?: string;
} }
const list = ref<Array<List>>([]); const list = ref<Array<List>>([]);
@@ -66,79 +62,79 @@ const list = ref<Array<List>>([]);
const goodList = ref([]); const goodList = ref([]);
Taro.useDidShow(() => { Taro.useDidShow(() => {
getGoodsType(); getGoodsType();
}); });
// 获取商品分类 // 获取商品分类
const getGoodsType = async () => { const getGoodsType = async () => {
const res = await getCategoryList(); const res = await getCategoryList();
list.value = res.data.data; 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 getData = async (id: number) => {
const res = await getCategoryGoods({ const res = await getCategoryGoods({
class_id: id, class_id: id,
}); });
goodList.value = res.data.data; goodList.value = res.data.data;
}; };
const tabChange = async () => { const tabChange = async () => {
getData(list.value[val.value].ID as number); getData(list.value[val.value].ID as number);
}; };
const toGoodDetails = (gid: number) => { const toGoodDetails = (gid: number) => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${gid}`, url: `/pages/goods/goods_detail/index?gid=${gid}`,
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.list { .list {
.item { .item {
display: flex; display: flex;
margin-bottom: 10px; margin-bottom: 10px;
img { img {
width: 140px; width: 140px;
height: 140px; height: 140px;
border-radius: 10px; 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;
}
}
}
} }
.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> </style>

View File

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

View File

@@ -1,65 +1,65 @@
<template> <template>
<view> <view>
<view <view
class="head-wrapper" class="head-wrapper"
:style="{ :style="{
top: statusHeight + 'px', top: statusHeight + 'px',
}" }"
> >
<view class="head-menu"> <view class="head-menu">
<Left class="iconfont" @click="returns" /> <Left class="iconfont" @click="returns" />
<Home class="iconfont" @click="goHome" /> <Home class="iconfont" @click="goHome" />
</view> </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>
<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> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { import {
useLoad, useLoad,
getSystemInfoSync, getSystemInfoSync,
navigateBack, navigateBack,
switchTab, switchTab,
navigateTo, navigateTo,
} from "@tarojs/taro"; } from "@tarojs/taro";
import { Left, Home } from "@nutui/icons-vue-taro"; import { Left, Home } from "@nutui/icons-vue-taro";
var statusBarHeight = getSystemInfoSync().statusBarHeight as number; var statusBarHeight = getSystemInfoSync().statusBarHeight as number;
@@ -71,89 +71,89 @@ const statusHeight = ref<number>(statusBarHeight);
// const swiperList = ref([]); // const swiperList = ref([]);
useLoad((options) => { useLoad((options) => {
console.log(options); console.log(options);
}); });
const returns = () => { const returns = () => {
navigateBack(); navigateBack();
}; };
const goHome = () => { const goHome = () => {
switchTab({ switchTab({
url: "/pages/index/index", url: "/pages/index/index",
}); });
}; };
const toGame = () => { const toGame = () => {
navigateTo({ navigateTo({
url: "/pages/game/gameview/index", url: "/pages/game/gameview/index",
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.head-wrapper { .head-wrapper {
z-index: 999; z-index: 999;
display: flex; display: flex;
align-items: center; align-items: center;
position: fixed; position: fixed;
left: 30px; left: 30px;
top: 0; top: 0;
height: 100px; height: 100px;
} }
.head-menu { .head-menu {
display: flex; display: flex;
align-items: center; align-items: center;
height: 54px; height: 54px;
width: 140px; width: 140px;
background: rgba(0, 0, 0, 0.25); background: rgba(0, 0, 0, 0.25);
border-radius: 27px; border-radius: 27px;
.iconfont { .iconfont {
flex: 1; flex: 1;
text-align: center; text-align: center;
color: #fff; color: #fff;
box-sizing: border-box; box-sizing: border-box;
&.icon-xiangzuo { &.icon-xiangzuo {
border-right: 1px solid #fff; border-right: 1px solid #fff;
}
} }
}
} }
.swiper { .swiper {
height: 450rpx; height: 450rpx;
width: 100vw; width: 100vw;
image { image {
width: 100%; width: 100%;
} }
} }
.box { .box {
width: 100%; width: 100%;
height: 90vh; height: 90vh;
background-color: #fff; background-color: #fff;
z-index: 1; z-index: 1;
border-top-left-radius: 20px; border-top-left-radius: 20px;
border-top-right-radius: 20px; border-top-right-radius: 20px;
box-sizing: border-box; box-sizing: border-box;
position: absolute; position: absolute;
padding: 20px; padding: 20px;
top: 400px; top: 400px;
.line { .line {
width: 90px; width: 90px;
height: 10px; height: 10px;
border-radius: 4px; border-radius: 4px;
background-color: rgba(202, 202, 202, 1); background-color: rgba(202, 202, 202, 1);
margin: auto; margin: auto;
} }
.game-btn { .game-btn {
width: 300px; width: 300px;
height: 75px; height: 75px;
margin: 50px auto; margin: 50px auto;
color: #fff; color: #fff;
background-color: rgba(85, 77, 132, 1); background-color: rgba(85, 77, 132, 1);
border-radius: 50px; border-radius: 50px;
text-align: center; text-align: center;
line-height: 75px; line-height: 75px;
} }
} }
</style> </style>

View File

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

View File

@@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<web-view :src="url"></web-view> <web-view :src="url"></web-view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -11,8 +11,8 @@ import { useLoad, getStorageSync } from "@tarojs/taro";
const url = ref(""); const url = ref("");
useLoad(() => { useLoad(() => {
const user = getStorageSync("userInfo"); const user = getStorageSync("userInfo");
url.value = `${process.env.TARO_APP_GAME}${user.uid}`; url.value = `${process.env.TARO_APP_GAME}${user.uid}`;
}); });
</script> </script>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "GameView", navigationBarTitleText: "GameView",
}); });

View File

@@ -1,8 +1,8 @@
<template> <template>
<web-view <web-view
style="height: 100vh; width: 100vw" style="height: 100vh; width: 100vw"
:src="`https://www.jdt168.com/public/?uid=${user.uid}`" :src="`https://www.jdt168.com/public/?uid=${user.uid}`"
></web-view> ></web-view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -12,11 +12,11 @@ import { WebView } from "@tarojs/components";
const gameUrl = ref(""); const gameUrl = ref("");
const user = ref({}) const user = ref({});
useLoad(() => { useLoad(() => {
user.value = getStorageSync("userInfo"); user.value = getStorageSync("userInfo");
console.log(user); console.log(user);
}); });
</script> </script>

View File

@@ -1,4 +1,4 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '商品详情', navigationBarTitleText: "商品详情",
navigationStyle: 'custom', navigationStyle: "custom",
}) });

View File

@@ -1,111 +1,109 @@
<template> <template>
<view class="app"> <view class="app">
<view class="head-wrapper" :style="{ top: BarHeight + 'px' }"> <view class="head-wrapper" :style="{ top: BarHeight + 'px' }">
<view class="head-menu"> <view class="head-menu">
<Left class="iconfont" @click="returns"/> <Left class="iconfont" @click="returns" />
<Home class="iconfont" @click="goHome"/> <Home class="iconfont" @click="goHome" />
</view> </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>
<!-- 幻灯片 --> <!-- <view-->
<nut-swiper <!-- class="icon"-->
:init-page="0" <!-- v-if="payType === 'jf'"-->
:pagination-visible="true" <!-- @click="toPage('/pages/cart/index')"-->
pagination-color="#426543" <!-- >-->
auto-play="3000" <!-- <Cart/>-->
> <!-- <view>购物车</view>-->
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx"> <!-- </view>-->
<img :alt="idx.toString()" :src="itm"/> <view class="icon" @click="toPage('/pages/kefu/index', 2)">
</nut-swiper-item> <My />
</nut-swiper> <view>客服</view>
<!-- 标题价格 -->
<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> </view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell> </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>
<!-- 底部 -->
<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%"> <view style="width: 80%">
<!-- <nut-button--> <!-- <nut-button-->
<!-- v-if="payType === 'jf'"--> <!-- v-if="payType === 'jf'"-->
<!-- style="margin-right: 10px"--> <!-- style="margin-right: 10px"-->
<!-- type="warning"--> <!-- type="warning"-->
<!-- @click="add_cart()"--> <!-- @click="add_cart()"-->
<!-- >加入购物车--> <!-- >加入购物车-->
<!-- </nut-button>--> <!-- </nut-button>-->
<nut-button type="primary" block @click="toOrderDetail()" <nut-button type="primary" block @click="toOrderDetail()"
>{{ payType === 'jf' ? '立即兑换' : '立即购买' }} >{{ payType === "jf" ? "立即兑换" : "立即购买" }}
</nut-button> </nut-button>
</view> </view>
</view> </view>
<!-- 规格选择 --> <!-- 规格选择 -->
<nut-popup <nut-popup
position="bottom" position="bottom"
overlay-class="overlay" overlay-class="overlay"
safe-area-inset-bottom safe-area-inset-bottom
closeable closeable
round round
:style="{ zIndex: 1 }" :style="{ zIndex: 1 }"
v-model:visible="isSkuShow" v-model:visible="isSkuShow"
> >
<view class="sku-box"> <view class="sku-box">
<view>商品规格</view> <view>商品规格</view>
<nut-cell-group> <nut-cell-group>
<nut-cell title="数量:"> <nut-cell title="数量:">
<template v-slot:link> <template v-slot:link>
<nut-input-number <nut-input-number
v-model="count" v-model="count"
@change="addCount" @change="addCount"
button-size="30" button-size="30"
/> />
</template> </template>
</nut-cell> </nut-cell>
</nut-cell-group> </nut-cell-group>
</view> </view>
</nut-popup> </nut-popup>
<!-- <nut-sku <!-- <nut-sku
v-model:visible="isSkuShow" v-model:visible="isSkuShow"
:sku="sku" :sku="sku"
:goods="goods" :goods="goods"
@@ -113,105 +111,110 @@
@clickBtnOperate="clickBtnOperate" @clickBtnOperate="clickBtnOperate"
@close="close" @close="close"
></nut-sku> --> ></nut-sku> -->
<Pay <Pay
:is-show-pay="isShowPay" :is-show-pay="isShowPay"
:pay-type="payType" :pay-type="payType"
v-model:jfInfo="orderData" v-model:jfInfo="orderData"
@closePay="closePay" @closePay="closePay"
/> />
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
import {ref} from 'vue' import { ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {Home, Left, My} from '@nutui/icons-vue-taro' import { Home, Left, My } from "@nutui/icons-vue-taro";
import {createActiveOrder, createOrder, getActiveGoodsDetail, getGoodsDetail} from '@/api/goods' import {
import Pay from '@/components/Pay.vue' createActiveOrder,
createOrder,
getActiveGoodsDetail,
getGoodsDetail,
} from "@/api/goods";
import Pay from "@/components/Pay.vue";
const BarHeight = ref((statusBarHeight as number) + 7) const BarHeight = ref((statusBarHeight as number) + 7);
const swiperList = ref([]) const swiperList = ref([]);
const isSkuShow = ref(false) const isSkuShow = ref(false);
const isShowPay = ref(false) const isShowPay = ref(false);
// const sku = ref([]); // const sku = ref([]);
const payType = ref('') const payType = ref("");
const orderData = ref([]) const orderData = ref([]);
const count = ref(1) const count = ref(1);
interface GoodInfo { interface GoodInfo {
gid?: number; gid?: number;
name?: string; name?: string;
number?: number; number?: number;
cover?: string; cover?: string;
details?: string; details?: string;
sku?: any[]; sku?: any[];
stock?: number; stock?: number;
profile?: string; profile?: string;
} }
const goodInfo = ref<GoodInfo>({}) const goodInfo = ref<GoodInfo>({});
Taro.useLoad((options) => { Taro.useLoad((options) => {
payType.value = options.type === '1' ? 'wx' : 'jf' payType.value = options.type === "1" ? "wx" : "jf";
get_good_detail(options.gid) get_good_detail(options.gid);
}) });
const get_good_detail = async (gid: string) => { const get_good_detail = async (gid: string) => {
try { try {
let res: any let res: any;
if (payType.value === 'jf') { if (payType.value === "jf") {
res = await getGoodsDetail({gid: gid}) res = await getGoodsDetail({ gid: gid });
} else { } else {
res = await getActiveGoodsDetail({gid: gid}) 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'
})
} }
} 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 = () => { const addCount = () => {
if (count.value >= (goodInfo.value.stock as number)) { if (count.value >= (goodInfo.value.stock as number)) {
count.value = goodInfo.value.stock as number count.value = goodInfo.value.stock as number;
Taro.showToast({ Taro.showToast({
title: '库存不足', title: "库存不足",
icon: 'none' icon: "none",
}) });
return return;
} }
} };
const returns = () => { const returns = () => {
Taro.navigateBack({ Taro.navigateBack({
delta: 1 delta: 1,
}) });
} };
const goHome = () => { const goHome = () => {
Taro.switchTab({ Taro.switchTab({
url: '/pages/index/index' url: "/pages/index/index",
}) });
} };
const openSku = () => { const openSku = () => {
isSkuShow.value = true isSkuShow.value = true;
} };
// const selectSku = () => {}; // const selectSku = () => {};
// const clickBtnOperate = () => {}; // const clickBtnOperate = () => {};
@@ -235,228 +238,226 @@ const openSku = () => {
// }; // };
const toOrderDetail = async () => { const toOrderDetail = async () => {
if (!Taro.getStorageSync('token')) { if (!Taro.getStorageSync("token")) {
return Taro.showModal({ return Taro.showModal({
title: '提示', title: "提示",
content: '你还没登录,请先登录', content: "你还没登录,请先登录",
cancelText: '先逛逛', cancelText: "先逛逛",
confirmText: '去登录', confirmText: "去登录",
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
Taro.reLaunch({ Taro.reLaunch({
url: '/pages/users/login/index' 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)
})
} }
},
orderData.value = res?.data?.data });
}
isShowPay.value = true if (isSkuShow.value === false) return openSku();
// Taro.navigateTo({
count.value = 1 // url: '/pages/goods/order_create/index'
} catch (e) { // })
Taro.showToast({ try {
title: e.msg, let res: any;
icon: 'none' 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),
});
} }
isSkuShow.value = false 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) => { const closePay = (val: boolean) => {
isShowPay.value = val isShowPay.value = val;
orderData.value = [] orderData.value = [];
} };
const toPage = (url: string, type: number = 1) => { const toPage = (url: string, type: number = 1) => {
if (type === 1) { if (type === 1) {
Taro.switchTab({ Taro.switchTab({
url: url url: url,
}) });
} else { } else {
// Taro.navigateTo({ // Taro.navigateTo({
// url: url, // url: url,
// }); // });
Taro.showToast({ Taro.showToast({
title: '暂未开放', title: "暂未开放",
icon: 'none' icon: "none",
}) });
} }
} };
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
--nut-cell-box-shadow: none; --nut-cell-box-shadow: none;
// --nut-cell-padding: 0; // --nut-cell-padding: 0;
--nut-cell-title-font: 30px; --nut-cell-title-font: 30px;
} }
// sku遮罩 // sku遮罩
.overlay { .overlay {
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
z-index: 1 !important; z-index: 1 !important;
} }
.head-wrapper { .head-wrapper {
z-index: 999; z-index: 999;
display: flex; display: flex;
align-items: center; align-items: center;
position: fixed; position: fixed;
left: 30px; left: 30px;
top: 0; top: 0;
height: 114px; height: 114px;
} }
.head-menu { .head-menu {
display: flex; display: flex;
align-items: center; align-items: center;
height: 54px; height: 54px;
width: 140px; width: 140px;
background: rgba(0, 0, 0, 0.25); background: rgba(0, 0, 0, 0.25);
border-radius: 27px; border-radius: 27px;
.iconfont { .iconfont {
flex: 1; flex: 1;
text-align: center; text-align: center;
color: #fff; color: #fff;
box-sizing: border-box; box-sizing: border-box;
} }
} }
.nut-swiper-item img { .nut-swiper-item img {
width: 100%; width: 100%;
height: 730px; height: 730px;
} }
.card { .card {
padding: 30px; padding: 30px;
background-color: #fff; background-color: #fff;
.header { .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;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
// 适配ios底部安全区域
padding-bottom: constant(safe-area-inset-bottom); .title {
padding-bottom: env(safe-area-inset-bottom); font-size: 30px;
z-index: 999; 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%; width: 100%;
.left { // img {
display: flex; // width: 100%;
align-items: center; // height: auto;
justify-content: flex-start; // display: block;
width: 300px; // }
padding: 0 20px; }
box-sizing: border-box; }
.icon { .nut-sku {
display: flex; // 适配ios底部安全区域
flex-direction: column; padding-bottom: constant(safe-area-inset-bottom);
align-items: center; padding-bottom: env(safe-area-inset-bottom);
justify-content: center; }
color: #333;
font-size: 25px; .sku-box {
width: 100px; padding: 100px 50px;
// margin-right: 100px; }
}
} .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 { .icon {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #333; color: #333;
font-size: 25px; font-size: 25px;
width: 100px;
// margin-right: 100px;
} }
}
.icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #333;
font-size: 25px;
}
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "提交订单" navigationBarTitleText: "提交订单",
}); });

View File

@@ -1,56 +1,53 @@
<template> <template>
<view class="app"> <view class="app">
<view class="bg"> <view class="bg">
<view class="card"> <view class="card">
<view class="left"> <view class="left">
<view>嘎嘎酒吧</view> <view>嘎嘎酒吧</view>
<view>18888888888</view> <view>18888888888</view>
<view>广西壮族自治区南宁市江南区</view> <view>广西壮族自治区南宁市江南区</view>
</view>
<view class="right" @click="toLocal">
<Find class="icon" />
<view class="text">距离我{{ distance }}km</view>
</view>
</view>
</view> </view>
<view class="order-info">21312312</view> <view class="right" @click="toLocal">
<nut-form> <Find class="icon" />
<nut-form-item body-align="right" label="用户姓名"> <view class="text">距离我{{ distance }}km</view>
<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>
</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> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -62,122 +59,122 @@ import { ref } from "vue";
const distance = ref(""); const distance = ref("");
const basicData = ref({ const basicData = ref({
name: "", name: "",
phone: "", phone: "",
notes: "", notes: "",
}); });
Taro.useLoad(() => { Taro.useLoad(() => {
Taro.getLocation({ Taro.getLocation({
type: "wgs84", type: "wgs84",
success: function (res) { success: function (res) {
const latitude = res.latitude; const latitude = res.latitude;
const longitude = res.longitude; const longitude = res.longitude;
distance.value = calculateDistance( distance.value = calculateDistance(
108.24898, 108.24898,
22.83646, 22.83646,
longitude, longitude,
latitude latitude
); );
}, },
}); });
}); });
const toLocal = () => { const toLocal = () => {
Taro.openLocation({ Taro.openLocation({
latitude: 22.83646, latitude: 22.83646,
longitude: 108.24898, longitude: 108.24898,
scale: 18, scale: 18,
}); });
}; };
const orderPay = () => { const orderPay = () => {
Taro.showToast({ Taro.showToast({
title: "支付成功", title: "支付成功",
icon: "success", icon: "success",
success: () => { success: () => {
setTimeout(() => { setTimeout(() => {
Taro.redirectTo({ Taro.redirectTo({
url: "/pages/goods/order_status/index", url: "/pages/goods/order_status/index",
}); });
}, 2000); }, 2000);
}, },
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.bg { .bg {
background: linear-gradient(0deg, #f5f5f5, #0396ffc7); background: linear-gradient(0deg, #f5f5f5, #0396ffc7);
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
padding: 10px 0; padding: 10px 0;
.card { .card {
width: 90%; width: 90%;
height: 75%; height: 75%;
margin: 0 auto; 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 {
background: #fff; background: #fff;
border-radius: 10px;
padding: 20px; padding: 20px;
margin-top: 20px;
position: relative; position: relative;
border-bottom: 1px dashed #ccc;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-evenly; 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 { .nut-input-text {
height: 100px; height: 100px;
} }
.bottom-box { .bottom-box {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
height: 9vh; height: 9vh;
background: #fff; background: #fff;
// IOS安全区域 // IOS安全区域
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 10px; padding: 0 10px;
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "订单状态", navigationBarTitleText: "订单状态",
}); });

View File

@@ -1,30 +1,26 @@
<template> <template>
<view> <view>
<view class="card"> <view class="card">
<view class="icon"> <view class="icon">
<Check <Check font-class-name="nutui-iconfont check" size="70" color="#fff" />
font-class-name="nutui-iconfont check" <!-- <CloseLittle font-class-name="nutui-iconfont check" size="70" color="#fff" /> -->
size="70" </view>
color="#fff" <view class="text-box">
/> <view class="title">支付成功</view>
<!-- <CloseLittle font-class-name="nutui-iconfont check" size="70" color="#fff" /> --> <nut-button block type="primary" @click="toOrderPage"
</view> >查看订单</nut-button
<view class="text-box"> >
<view class="title">支付成功</view> <nut-button
<nut-button block type="primary" @click="toOrderPage" block
>查看订单</nut-button plain
> style="margin-top: 10px"
<nut-button type="primary"
block @click="toHome"
plain >返回首页</nut-button
style="margin-top: 10px" >
type="primary" </view>
@click="toHome"
>返回首页</nut-button
>
</view>
</view>
</view> </view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -32,66 +28,66 @@ import { Check, CloseLittle } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
const toHome = () => { const toHome = () => {
Taro.switchTab({ Taro.switchTab({
url: "/pages/index/index", url: "/pages/index/index",
}); });
}; };
const toOrderPage = () => { const toOrderPage = () => {
Taro.redirectTo({ Taro.redirectTo({
url: "/pages/users/order_list/index?type=0", url: "/pages/users/order_list/index?type=0",
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.card { .card {
width: 90%; width: 90%;
height: 600px; 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; box-sizing: border-box;
background-color: #fff; padding: 0 100px;
border-radius: 10px;
margin: 200px auto;
position: relative;
display: flex;
align-items: center;
justify-content: space-evenly;
flex-direction: column;
.icon { .title {
width: 200px; font-size: 60px;
height: 200px; color: #333;
background-color: red; margin: 100px;
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;
}
} }
}
} }
</style> </style>

View File

@@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '活动订单', navigationBarTitleText: "活动订单",
}) });

View File

@@ -1,11 +1,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref } from "vue";
import { import {
useLoad, useLoad,
useReachBottom, useReachBottom,
showToast, showToast,
navigateTo, navigateTo,
setStorageSync, setStorageSync,
} from "@tarojs/taro"; } from "@tarojs/taro";
import Pay from "@/components/Pay.vue"; import Pay from "@/components/Pay.vue";
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods"; import { getActiveOrderList, deleteActiveOrder } from "@/api/goods";
@@ -16,116 +16,116 @@ const tabValue = ref(0);
const isShowPay = ref(false); const isShowPay = ref(false);
const tabsList = ref([ const tabsList = ref([
{ {
title: "全部", title: "全部",
value: 0, value: 0,
num: 0, num: 0,
}, },
{ {
title: "待付款", title: "待付款",
value: 1, value: 1,
num: 0, num: 0,
}, },
{ {
title: "待使用", title: "待使用",
value: 2, value: 2,
num: 0, num: 0,
}, },
{ {
title: "已使用", title: "已使用",
value: 3, value: 3,
num: 0, num: 0,
}, },
{ {
title: "已失效", title: "已失效",
value: 4, value: 4,
num: 0, num: 0,
}, },
]); ]);
const jfInfo = ref({}); const jfInfo = ref({});
interface OrderList { interface OrderList {
oid: string; oid: string;
add_time: string; add_time: string;
status: number; status: number;
BindGoods: { BindGoods: {
cover: string; cover: string;
name: string; name: string;
number: number;
};
count: number;
number: number; number: number;
};
count: number;
number: number;
} }
const orderList = ref<OrderList[]>([]); const orderList = ref<OrderList[]>([]);
useLoad((options) => { useLoad((options) => {
console.log(options); console.log(options);
// tabValue.value = Number(options.type); // tabValue.value = Number(options.type);
getList(); getList();
}); });
const countInfo = ref<any>({}); const countInfo = ref<any>({});
const getTj = async () => { const getTj = async () => {
try { try {
const res = await getOrderStatistics({ const res = await getOrderStatistics({
type: 1, type: 1,
}); });
countInfo.value = res.data.data; countInfo.value = res.data.data;
console.log(res); console.log(res);
tabsList.value[0].num = countInfo.value.A; tabsList.value[0].num = countInfo.value.A;
tabsList.value[1].num = countInfo.value.B; tabsList.value[1].num = countInfo.value.B;
tabsList.value[2].num = countInfo.value.C; tabsList.value[2].num = countInfo.value.C;
tabsList.value[3].num = countInfo.value.D; tabsList.value[3].num = countInfo.value.D;
tabsList.value[4].num = countInfo.value.F; tabsList.value[4].num = countInfo.value.F;
} catch (error) { } catch (error) {
showToast({ showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
}; };
const getList = async () => { const getList = async () => {
try { try {
const res = await getActiveOrderList({ const res = await getActiveOrderList({
status: tabValue.value, status: tabValue.value,
}); });
console.log(res); console.log(res);
orderList.value = res.data.data; orderList.value = res.data.data;
} catch (error) { } catch (error) {
showToast({ showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
getTj(); getTj();
}; };
const tabChange = (index: number) => { const tabChange = (index: number) => {
tabValue.value = index; tabValue.value = index;
getList(); getList();
}; };
useReachBottom(() => { useReachBottom(() => {
console.log("useReachBottom"); console.log("useReachBottom");
}); });
const openPay = (item: OrderList) => { const openPay = (item: OrderList) => {
isShowPay.value = true; isShowPay.value = true;
jfInfo.value = item; jfInfo.value = item;
}; };
const errPay = () => { const errPay = () => {
isShowPay.value = false; isShowPay.value = false;
showToast({ showToast({
title: "支付失败", title: "支付失败",
icon: "none", icon: "none",
}); });
jfInfo.value = {}; jfInfo.value = {};
getList(); getList();
}; };
// const successPay = (val: boolean) => { // const successPay = (val: boolean) => {
@@ -139,239 +139,233 @@ const errPay = () => {
// }; // };
const closePay = () => { const closePay = () => {
isShowPay.value = false; isShowPay.value = false;
showToast({ showToast({
title: "支付取消", title: "支付取消",
icon: "none", icon: "none",
}); });
jfInfo.value = {}; jfInfo.value = {};
getList(); getList();
}; };
const toDetail = (item: any) => { const toDetail = (item: any) => {
setStorageSync("item", item); setStorageSync("item", item);
navigateTo({ navigateTo({
url: `/pages/users/order_list_detail/index?Id=${item.oid}&type=1`, url: `/pages/users/order_list_detail/index?Id=${item.oid}&type=1`,
}); });
}; };
const delOrder = async (oid: string) => { const delOrder = async (oid: string) => {
try { try {
const res = await deleteActiveOrder({ const res = await deleteActiveOrder({
oid, oid,
}); });
console.log(res); console.log(res);
getList(); getList();
} catch (error) { } catch (error) {
showToast({ showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
}; };
</script> </script>
<template> <template>
<view> <view>
<view class="topTips"> <view class="topTips">
<view> <view>
<view style="font-weight: bold">订单信息</view> <view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px" <view style="font-size: 15px"
>总消费(){{ countInfo.Total || 0 }} >总消费(){{ countInfo.Total || 0 }}
</view>
</view>
<image src="../static/user/order_list_top.png" />
</view> </view>
<view class="tabs-box"> </view>
<view <image src="../static/user/order_list_top.png" />
v-for="item in tabsList" </view>
:key="item.value" <view class="tabs-box">
@click="tabChange(item.value)" <view
> v-for="item in tabsList"
<view class="text">{{ item.title }}</view> :key="item.value"
<view>{{ item.num }}</view> @click="tabChange(item.value)"
<view >
class="line" <view class="text">{{ item.title }}</view>
:class="{ lineColor: item.value === tabValue }" <view>{{ item.num }}</view>
></view> <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>
<view v-if="orderList.length > 0"> <view class="line"></view>
<view <view class="center">
class="order-card" <view class="top">
v-for="(item, index) in orderList" <image :src="item.BindGoods.cover" />
:key="index" <view class="title">{{ item.BindGoods.name }} </view>
> <view class="right">
<view class="top"> <view>{{ item.number }}</view>
<view>{{ <!-- <view>x{{ item.count }}</view> -->
item.add_time.slice(0, 19).replace("T", " ") </view>
}}</view> </view>
<view style="color: red">{{ <!-- <view
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
class="bom" class="bom"
style="text-align: right; font-size: 13px" style="text-align: right; font-size: 13px"
> >
{{ item.count }}件商品,实付(): {{ item.count }}件商品,实付():
<text style="color: red">{{ item.number }}</text> <text style="color: red">{{ item.number }}</text>
</view> --> </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> </view>
<nut-empty v-else description="暂无订单"></nut-empty> <view class="line"></view>
<pay <view class="btn">
:isShowPay="isShowPay" <nut-button
payType="wx" v-if="item.status === 0"
@errPay="errPay" plain
@closePay="closePay" size="small"
:jfInfo="jfInfo" 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> </view>
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="wx"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template> </template>
<style lang="scss"> <style lang="scss">
.topTips { .topTips {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
background-color: #ff0000; background-color: #ff0000;
color: #ffffff; color: #ffffff;
padding: 20px; padding: 20px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
image { image {
width: 150px; width: 150px;
height: 150px; height: 150px;
} }
} }
.tabs-box { .tabs-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; 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; align-items: center;
height: auto; }
background-color: #fff;
padding: 0 20px;
text-align: center;
.text { .line {
margin: 10px 20px; margin: 0 auto;
align-items: center; width: 50px;
} height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.line { .lineColor {
margin: 0 auto; background-color: #ff0000;
width: 50px; }
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
}
} }
.order-card { .order-card {
width: 95%; width: 95%;
box-sizing: border-box; box-sizing: border-box;
margin: 15px auto; margin: 15px auto;
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
.line { .line {
width: 100%; width: 100%;
height: 1px; height: 1px;
background-color: #f5f5f5; background-color: #f5f5f5;
margin: 10px; margin: 10px;
} }
.top {
display: flex;
justify-content: space-between;
align-items: center;
}
.btn {
display: flex;
justify-content: flex-end;
align-items: center;
}
.center {
.top { .top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; // align-items: flex-start;
}
image {
.btn { width: 150px;
display: flex; height: 150px;
justify-content: flex-end; }
align-items: center;
} .title {
margin-left: 10px;
.center { display: -webkit-box;
.top { overflow: hidden;
display: flex; -webkit-line-clamp: 2;
justify-content: space-between; -webkit-box-orient: vertical;
// align-items: flex-start; text-overflow: ellipsis;
width: 350px;
image { }
width: 150px;
height: 150px; .right {
} margin-left: 10px;
font-size: 28px;
.title { text-align: right;
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> </style>

View File

@@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '活动商品', navigationBarTitleText: "活动商品",
}) });

View File

@@ -1,26 +1,26 @@
<template> <template>
<view> <view>
<!-- 金刚区 --> <!-- 金刚区 -->
<view class="top-box"> <view class="top-box">
<view class="item"> <view class="item">
<view @click="hotGoodsDetail"> <view @click="hotGoodsDetail">
<IconFont <IconFont
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png" name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
size="40" size="40"
/> />
<view>我的订单</view> <view>我的订单</view>
</view>
</view>
<view class="item">
<view></view>
</view>
<view class="item"> </view>
<view class="item">
<view></view>
</view>
</view> </view>
<!-- 商品列表 --> </view>
<!-- <view class="goodBox"> <view class="item">
<view></view>
</view>
<view class="item"> </view>
<view class="item">
<view></view>
</view>
</view>
<!-- 商品列表 -->
<!-- <view class="goodBox">
<view <view
class="good" class="good"
v-for="item in list" v-for="item in list"
@@ -42,38 +42,38 @@
</view> </view>
</view> </view>
</view> --> </view> -->
<view class="goodBox"> <view class="goodBox">
<view <view
class="good" class="good"
v-for="item in (merdata as any)" v-for="item in (merdata as any)"
:key="item.ID" :key="item.ID"
@click.stop="toMerDetails(item)" @click.stop="toMerDetails(item)"
> >
<image :src="(item.head_photo as string)" /> <image :src="(item.head_photo as string)" />
<view class="good-text-box"> <view class="good-text-box">
<text class="good-text">{{ item.name }}</text> <text class="good-text">{{ item.name }}</text>
<text style="color: #999" <text style="color: #999"
>距离我{{ >距离我{{
calculateDistance( calculateDistance(
userLocalNum.t, userLocalNum.t,
userLocalNum.l, userLocalNum.l,
Number(item.lat), Number(item.lat),
Number(item.lon) Number(item.lon)
) )
}}</text }}</text
> >
</view>
</view>
</view> </view>
</view>
</view> </view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import { import {
// getActiveGoods, // getActiveGoods,
getMerList, getMerList,
} from "../../../api/goods"; } from "../../../api/goods";
import { IconFont } from "@nutui/icons-vue-taro"; import { IconFont } from "@nutui/icons-vue-taro";
import { calculateDistance } from "@/utils"; import { calculateDistance } from "@/utils";
@@ -81,8 +81,8 @@ import { calculateDistance } from "@/utils";
// const list = ref<any>([]); // const list = ref<any>([]);
Taro.useLoad(() => { Taro.useLoad(() => {
// getList(); // getList();
get_mer_list(); get_mer_list();
}); });
// const getList = async () => { // const getList = async () => {
@@ -98,109 +98,109 @@ Taro.useLoad(() => {
// }; // };
const hotGoodsDetail = () => { const hotGoodsDetail = () => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/hotGoods/hot_list/index`, url: `/pages/hotGoods/hot_list/index`,
}); });
}; };
const merdata = ref([]); const merdata = ref([]);
const userLocalNum = ref({ const userLocalNum = ref({
l: 0, l: 0,
t: 0, t: 0,
}); });
const get_mer_list = async () => { const get_mer_list = async () => {
Taro.getLocation({ Taro.getLocation({
type: "wgs84", type: "wgs84",
success: (res) => { success: (res) => {
userLocalNum.value.l = res.longitude; userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude; userLocalNum.value.t = res.latitude;
}, },
}); });
const res = await getMerList({ const res = await getMerList({
PageNum: 1, PageNum: 1,
PageSize: 10, PageSize: 10,
Btype: 1, Btype: 1,
classid: 0, classid: 0,
}); });
merdata.value = res.data.data; merdata.value = res.data.data;
}; };
const toMerDetails = (item: any) => { const toMerDetails = (item: any) => {
Taro.setStorageSync("mer_info", item); Taro.setStorageSync("mer_info", item);
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/mer/mer_detail/index`, url: `/pages/mer/mer_detail/index`,
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.top-box { .top-box {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 10px 20px 0 20px; margin: 10px 20px 0 20px;
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
.item { .item {
width: 150px; width: 150px;
padding: 10px; padding: 10px;
background-color: #fff; background-color: #fff;
text-align: center; text-align: center;
} }
} }
.goodBox { .goodBox {
display: flex; display: flex;
padding: 20px; padding: 20px;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
.good { .good {
width: 340px; width: 340px;
background-color: #fff; background-color: #fff;
margin-bottom: 20px; margin-bottom: 20px;
border-bottom-left-radius: 15px; border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px; border-bottom-right-radius: 15px;
image { image {
width: 100%; width: 100%;
height: 350px; 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;
}
}
}
} }
.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> </style>

View File

@@ -1,4 +1,4 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '首页', navigationBarTitleText: "首页",
enableShareAppMessage: true enableShareAppMessage: true,
}) });

View File

@@ -1,252 +1,251 @@
<template> <template>
<view class="app"> <view class="app">
<!-- 搜索 --> <!-- 搜索 -->
<nut-searchbar <nut-searchbar
v-model="searchValue" v-model="searchValue"
placeholder="要搜索点什么?" placeholder="要搜索点什么?"
></nut-searchbar> ></nut-searchbar>
<!-- 幻灯片 --> <!-- 幻灯片 -->
<nut-swiper <nut-swiper
:init-page="0" :init-page="0"
:pagination-visible="true" :pagination-visible="true"
pagination-color="#426543" pagination-color="#426543"
auto-play="3000" auto-play="3000"
>
<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)"
> >
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx"> <image :src="item.icon" />
<img :alt="itm.ID.toString()" :src="itm.url"/> </nut-grid-item>
</nut-swiper-item> </nut-grid>
</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>
</view>
<!-- 签到弹窗 -->
<Popup/>
</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>
<!-- 签到弹窗 -->
<Popup />
</view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue' import { ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {bindParent, getBanner} from '@/api/user' import { bindParent, getBanner } from "@/api/user";
import {getMerList} from '@/api/goods' import { getMerList } from "@/api/goods";
import {calculateDistance} from '@/utils' import { calculateDistance } from "@/utils";
import Popup from "@/components/Popup.vue"; import Popup from "@/components/Popup.vue";
const searchValue = ref('') const searchValue = ref("");
const swiperList = ref<any>([]) const swiperList = ref<any>([]);
const userMenuList = ref([ const userMenuList = ref([
{ {
id: 1, id: 1,
label: '活动游戏', label: "活动游戏",
url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync('token')}`, url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync("token")}`,
icon: 'http://jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png' icon: "http://jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png",
}, },
{ {
id: 2, id: 2,
label: '活动商品', label: "活动商品",
url: '/pages/hotGoods/index/index', url: "/pages/hotGoods/index/index",
icon: 'http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png' icon: "http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
}, },
{ {
id: 3, id: 3,
label: '商户入驻', label: "商户入驻",
url: '/pages/users/settled_mer/index', url: "/pages/users/settled_mer/index",
icon: 'http://jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png' icon: "http://jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png",
}, },
{ {
id: 4, id: 4,
label: '最新资讯', label: "最新资讯",
url: '', url: "",
icon: 'http://jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png' icon: "http://jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png",
} },
]) ]);
Taro.useDidShow(async () => { Taro.useDidShow(async () => {
await getBannerList() await getBannerList();
await get_mer_list() await get_mer_list();
if (Taro.getStorageSync('token') && Taro.getStorageSync('bind_id')) { if (Taro.getStorageSync("token") && Taro.getStorageSync("bind_id")) {
try { try {
const res = await bindParent({ const res = await bindParent({
uid: Taro.getStorageSync('bind_id') uid: Taro.getStorageSync("bind_id"),
}) });
Taro.showToast({ Taro.showToast({
title: res.msg title: res.msg,
}) });
Taro.removeStorageSync('bind_id') Taro.removeStorageSync("bind_id");
} catch (error) { } catch (error) {
Taro.removeStorageSync('bind_id') Taro.removeStorageSync("bind_id");
throw error throw error;
}
} }
}) }
});
Taro.useShareAppMessage(() => ({ Taro.useShareAppMessage(() => ({
title: '捷兑通', title: "捷兑通",
path: `/pages/index/index?scene=${Taro.getStorageSync('token')}`, path: `/pages/index/index?scene=${Taro.getStorageSync("token")}`,
imageUrl: imageUrl:
'https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg' "https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg",
})) }));
const merdata = ref([]) const merdata = ref([]);
const userLocalNum = ref({ const userLocalNum = ref({
l: 0, l: 0,
t: 0 t: 0,
}) });
const get_mer_list = async () => { const get_mer_list = async () => {
Taro.getLocation({ Taro.getLocation({
type: 'wgs84', type: "wgs84",
success: (res) => { success: (res) => {
userLocalNum.value.l = res.longitude userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude userLocalNum.value.t = res.latitude;
} },
}) });
const res = await getMerList({ const res = await getMerList({
PageNum: 1, PageNum: 1,
PageSize: 10, PageSize: 10,
Btype: 2, Btype: 2,
classid: 0 classid: 0,
}) });
merdata.value = res.data.data merdata.value = res.data.data;
} };
const getBannerList = async () => { const getBannerList = async () => {
const {data}: any = await getBanner() const { data }: any = await getBanner();
swiperList.value = data.data swiperList.value = data.data;
} };
const toPage = (url: string) => { const toPage = (url: string) => {
Taro.navigateTo({ Taro.navigateTo({
url: url url: url,
}) });
} };
const toMerDetails = (item: any) => { const toMerDetails = (item: any) => {
Taro.setStorageSync('mer_info', item) Taro.setStorageSync("mer_info", item);
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/mer/mer_detail/index` url: `/pages/mer/mer_detail/index`,
}) });
} };
</script> </script>
<style lang="scss"> <style lang="scss">
.nut-swiper-item img { .nut-swiper-item img {
width: 100%; width: 100%;
height: 350px; height: 350px;
} }
.titleImg { .titleImg {
margin-top: 10px; margin-top: 10px;
width: 100%; width: 100%;
height: 50px; height: 50px;
box-sizing: border-box; box-sizing: border-box;
background-image: url("~@/static/index/index-title.png"); background-image: url("~@/static/index/index-title.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
background-size: 50%; background-size: 50%;
text-align: center; text-align: center;
line-height: 50px; line-height: 50px;
color: #ff0000; color: #ff0000;
font-weight: bold; font-weight: bold;
} }
.navbar { .navbar {
background-color: #ffffff; background-color: #ffffff;
image { image {
width: 80px; width: 80px;
height: 80px; height: 80px;
} }
} }
.goodBox { .goodBox {
display: flex; display: flex;
padding: 20px; padding: 20px;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
.good { .good {
width: 340px; width: 340px;
background-color: #fff; background-color: #fff;
margin-bottom: 20px; margin-bottom: 20px;
border-radius: 10px; border-radius: 10px;
image { image {
width: 100%; width: 100%;
height: 250px; height: 250px;
border-top-right-radius: 10px; border-top-right-radius: 10px;
border-top-left-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;
}
}
}
} }
.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> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "每日签到", navigationBarTitleText: "每日签到",
}); });

View File

@@ -1,11 +1,7 @@
<script setup lang="ts"> <script setup lang="ts"></script>
</script>
<template> <template>
<view></view> <view></view>
</template> </template>
<style lang="scss"> <style lang="scss"></style>
</style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "", navigationBarTitleText: "",
}); });

View File

@@ -1,327 +1,300 @@
<template> <template>
<view> <view>
<!-- 幻灯片 --> <!-- 幻灯片 -->
<nut-swiper <nut-swiper
:init-page="0" :init-page="0"
:pagination-visible="true" :pagination-visible="true"
pagination-color="red" pagination-color="red"
auto-play="3000" auto-play="3000"
> >
<nut-swiper-item <nut-swiper-item v-for="(itm, idx) in (swiperList as any)" :key="idx">
v-for="(itm, idx) in (swiperList as any)" <img
:key="idx" style="width: 100%; height: 100%"
> :src="itm"
<img :alt="idx.toString()"
style="width: 100%; height: 100%" />
:src="itm" </nut-swiper-item>
:alt="idx.toString()" </nut-swiper>
/> <!-- 商家信息 -->
</nut-swiper-item> <view class="infoBox">
</nut-swiper> <view class="title">{{ mer_info.name }}</view>
<!-- 商家信息 --> <view class="bom">
<view class="infoBox"> <view class="left">
<view class="title">{{ mer_info.name }}</view> <view>{{ mer_info.address || "暂无商家地址" }}</view>
<view class="bom"> <view class="sub"
<view class="left"> >距你{{
<view>{{ mer_info.address || '暂无商家地址' }}</view> calculateDistance(
<view class="sub" userLocalNum.t,
>距你{{ userLocalNum.l,
calculateDistance( Number(mer_info.lat),
userLocalNum.t, Number(mer_info.lon)
userLocalNum.l, )
Number(mer_info.lat), }}
Number(mer_info.lon) </view>
)
}}
</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> </view>
<!-- 商品列表 --> <view class="right">
<!-- <view class="good"> <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>
<!-- 商品列表 -->
<!-- <view class="good">
<view class="item"></view> <view class="item"></view>
</view> --> </view> -->
<view class="good-class" v-if="class_list.length > 0"> <view class="good-class" v-if="class_list.length > 0">
<nut-tabs <nut-tabs
v-model="value" v-model="value"
title-scroll title-scroll
direction="vertical" direction="vertical"
title-gutter="5" title-gutter="5"
animated-time="0" animated-time="0"
name="tabName" name="tabName"
@click="clickTab" @click="clickTab"
>
<nut-tab-pane
v-for="(item, index) in class_list as any[]"
:key="index"
: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"
> >
<nut-tab-pane <view class="item">
v-for="(item, index) in class_list as any[]" <img :src="item.cover" />
:title="item.name" <view class="right">
:pane-key="index" <view class="name">{{ item.name }}</view>
> <view class="stock"> 库存剩余:{{ item.stock }} </view>
<view v-if="good_list.length > 0"> <view class="bom">
<view <view class="price">
class="list" <text style="font-size: 15px">{{ item.number }} </text>
v-for="(item, index) in good_list as any[]" {{ mer_info.bType === 1 ? "元" : "积分" }}
:key="index" </view>
> <nut-button
<view class="item"> size="mini"
<img :src="item.cover"/> v-if="mer_info.bType === 1"
<view class="right"> type="primary"
<view class="name">{{ item.name }}</view> @click.stop="toGoodDetails(item.gid as number, 1)"
<view class="stock"> >去购买
库存剩余:{{ item.stock }} </nut-button>
</view> <nut-button
<view class="bom"> size="mini"
<view class="price" v-else
> type="primary"
<text style="font-size: 15px">{{ @click.stop="toGoodDetails(item.gid as number, 2)"
item.number >去兑换
}} </nut-button>
</text> </view>
{{ </view>
mer_info.bType === 1 </view>
? '元' </view>
: '积分' </view>
}} <nut-empty v-else description="该分类暂无商品"></nut-empty>
</view </nut-tab-pane>
> </nut-tabs>
<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>
<nut-empty v-else description="该商家暂无商品"></nut-empty>
</view> </view>
<nut-empty v-else description="该商家暂无商品"></nut-empty>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {Find, Locationg3} from '@nutui/icons-vue-taro' import { Find, Locationg3 } from "@nutui/icons-vue-taro";
import {ref} from 'vue' import { ref } from "vue";
import {calculateDistance} from '@/utils' import { calculateDistance } from "@/utils";
import {getGoodList, getMerCategory} from '@/api/goods' import { getGoodList, getMerCategory } from "@/api/goods";
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({ const userLocalNum = ref({
l: 0, l: 0,
t: 0 t: 0,
}) });
Taro.useLoad(() => { Taro.useLoad(() => {
Taro.getLocation({ Taro.getLocation({
type: 'wgs84', type: "wgs84",
success: (res) => { success: (res) => {
userLocalNum.value.l = res.longitude userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude userLocalNum.value.t = res.latitude;
} },
}) });
mer_info.value = Taro.getStorageSync('mer_info') mer_info.value = Taro.getStorageSync("mer_info");
Taro.setNavigationBarTitle({ Taro.setNavigationBarTitle({
title: mer_info.value.name title: mer_info.value.name,
}) });
swiperList.value = mer_info.value.img.split(',') swiperList.value = mer_info.value.img.split(",");
get_class_list() get_class_list();
}) });
const clickPhone = () => { const clickPhone = () => {
Taro.makePhoneCall({ Taro.makePhoneCall({
phoneNumber: mer_info.value.mobile phoneNumber: mer_info.value.mobile,
}) });
} };
const clickMap = () => { const clickMap = () => {
Taro.openLocation({ Taro.openLocation({
name: mer_info.value.name, name: mer_info.value.name,
address: mer_info.value.address, address: mer_info.value.address,
latitude: Number(mer_info.value.lat), latitude: Number(mer_info.value.lat),
longitude: Number(mer_info.value.lon), longitude: Number(mer_info.value.lon),
scale: 18 scale: 18,
}) });
} };
const class_list = ref< const class_list = ref<
Array<{ Array<{
ID?: number; ID?: number;
name?: string; name?: string;
}> }>
>([]) >([]);
const get_class_list = async () => { const get_class_list = async () => {
const res = await getMerCategory({ const res = await getMerCategory({
Bid: mer_info.value.bid Bid: mer_info.value.bid,
}) });
class_list.value = res.data.data || [] class_list.value = res.data.data || [];
await get_good_list(class_list.value[0].ID as number) await get_good_list(class_list.value[0].ID as number);
} };
const clickTab = (val: any) => { const clickTab = (val: any) => {
get_good_list(class_list.value[val.paneKey].ID as number) get_good_list(class_list.value[val.paneKey].ID as number);
} };
const good_list = ref([]) const good_list = ref([]);
const get_good_list = async (id: number) => { const get_good_list = async (id: number) => {
Taro.showLoading({ Taro.showLoading({
title: '加载中', title: "加载中",
mask: true mask: true,
}) });
const res = await getGoodList({ const res = await getGoodList({
bid: mer_info.value.bid, bid: mer_info.value.bid,
BType: mer_info.value.bType, BType: mer_info.value.bType,
class_id: id, class_id: id,
status: 1, status: 1,
state: 1 state: 1,
}) });
good_list.value = res.data.data || [] good_list.value = res.data.data || [];
Taro.hideLoading() Taro.hideLoading();
} };
const toGoodDetails = (id: number, type: number) => { const toGoodDetails = (id: number, type: number) => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${id}&type=${type}` url: `/pages/goods/goods_detail/index?gid=${id}&type=${type}`,
}) });
} };
</script> </script>
<style lang="scss"> <style lang="scss">
.nut-swiper { .nut-swiper {
height: 350px; height: 350px;
} }
.infoBox { .infoBox {
background-color: #fff; background-color: #fff;
padding: 20px; padding: 20px;
.title { .title {
font-size: large; font-size: large;
font-weight: bold; font-weight: bold;
}
.bom {
display: flex;
align-items: flex-end;
margin-top: 10px;
.left {
width: 80%;
.sub {
color: #999;
}
} }
.bom { .right {
display: flex; flex: 1;
align-items: flex-end; display: flex;
margin-top: 10px; justify-content: space-between;
color: #999;
.left { text-align: center;
width: 80%;
.sub {
color: #999;
}
}
.right {
flex: 1;
display: flex;
justify-content: space-between;
color: #999;
text-align: center;
}
} }
}
} }
.good-class { .good-class {
margin-top: 10px; margin-top: 10px;
.nut-tabs { .nut-tabs {
height: 100vh; height: 100vh;
border-top: #fff 10px solid; border-top: #fff 10px solid;
} }
} }
.list { .list {
.item { .item {
display: flex; display: flex;
margin-bottom: 10px; margin-bottom: 10px;
img { img {
width: 140px; width: 140px;
height: 150px; height: 150px;
border-radius: 10px; 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;
}
}
}
} }
.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> </style>

View File

@@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '商品添加/编辑' navigationBarTitleText: "商品添加/编辑",
}) });

View File

@@ -1,158 +1,199 @@
<script lang="ts" setup> <script lang="ts" setup>
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {Ref, ref} from 'vue' import { Ref, ref } from "vue";
import Upload from '../../../components/Upload.vue' import Upload from "../../../components/Upload.vue";
import RichEditor from '../../../components/RichEditor.vue' import RichEditor from "../../../components/RichEditor.vue";
import {addGood} from '@/api/product' import { addGood } from "@/api/product";
const ruleForm = ref(null) as Ref const ruleForm = ref(null) as Ref;
const basicData = ref({ const basicData = ref({
name: '', name: "",
class_id: null, class_id: null,
cover: [], cover: [],
rotation: [], rotation: [],
profile: '', profile: "",
details: '', details: "",
stock: null, stock: null,
number: null, number: null,
market_num: null, market_num: null,
state: 2 state: 2,
}) });
const rules = { const rules = {
name: [{ name: [
required: true, {
message: '请填写商品名称' required: true,
}], message: "请填写商品名称",
class_id: [{ },
required: true, ],
message: '请选择商品分类' class_id: [
}], {
cover: [{ required: true,
required: true, message: "请选择商品分类",
message: '请上传商品封面', },
validator: (value) => { ],
return value.length > 0 cover: [
} {
}], required: true,
rotation: [{ message: "请上传商品封面",
required: true, validator: (value) => {
message: '请上传商品轮播图', return value.length > 0;
validator: (value) => { },
return value.length > 0 },
} ],
}], rotation: [
profile: [{ {
required: true, required: true,
message: '请填写商品名称' message: "请上传商品轮播图",
}], validator: (value) => {
stock: [{ return value.length > 0;
required: true, },
message: '请填写商品库存' },
}], ],
number: [{ profile: [
required: true, {
message: '请填写商品价格' required: true,
}], message: "请填写商品名称",
market_num: [{ },
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) => { Taro.useLoad((options) => {
console.log(options) console.log(options);
}) });
const openGoodClass = ref(false) const openGoodClass = ref(false);
const confirmClass = (val: any) => { const confirmClass = (val: any) => {
console.log(val) console.log(val);
} };
const ok = async () => { const ok = async () => {
ruleForm.value.validate().then(({valid, errors}: any) => { ruleForm.value.validate().then(({ valid, errors }: any) => {
if (valid) { if (valid) {
console.log('success', basicData.value) console.log("success", basicData.value);
} else { } else {
console.log('error submit!!', errors) console.log("error submit!!", errors);
} }
}) });
} };
</script> </script>
<template> <template>
<view> <view>
{{ basicData }} {{ basicData }}
<nut-backtop> <nut-backtop>
<template v-slot:content> <template v-slot:content>
<nut-form ref="ruleForm" :model-value="basicData" :rules="rules"> <nut-form ref="ruleForm" :model-value="basicData" :rules="rules">
<nut-form-item label="商品分类:" required prop="class_id"> <nut-form-item label="商品分类:" required prop="class_id">
<nut-input v-model="basicData.class_id" disabled placeholder="请选择商品分类" <nut-input
@click="openGoodClass = true"/> v-model="basicData.class_id"
</nut-form-item> disabled
<nut-form-item label="商品封面:" required prop="cover"> placeholder="请选择商品分类"
<Upload v-model:list="basicData.cover"/> @click="openGoodClass = true"
</nut-form-item> />
<nut-form-item label="商品轮播图:" required prop="rotation"> </nut-form-item>
<Upload v-model:list="basicData.rotation" :max="10"/> <nut-form-item label="商品封面:" required prop="cover">
</nut-form-item> <Upload v-model:list="basicData.cover" />
<nut-form-item label="商品名称:" required prop="name"> </nut-form-item>
<nut-input v-model="basicData.name" placeholder="请输入商品名称" <nut-form-item label="商品轮播图:" required prop="rotation">
type="text" <Upload v-model:list="basicData.rotation" :max="10" />
/> </nut-form-item>
</nut-form-item> <nut-form-item label="商品名称:" required prop="name">
<nut-form-item label="商品价格:" required prop="number"> <nut-input
<nut-input v-model="basicData.number" placeholder="请输入商品价格" v-model="basicData.name"
/> placeholder="请输入商品名称"
</nut-form-item> type="text"
<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="number">
</nut-form-item> <nut-input
<nut-form-item label="商品库存:" required prop="stock"> v-model="basicData.number"
<nut-input v-model="basicData.stock" placeholder="请输入商品库存" placeholder="请输入商品价格"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item label="商品简介:" required prop="profile"> <nut-form-item label="市场价格:" required prop="market_num">
<nut-textarea <nut-input
class="textarea" v-model="basicData.market_num"
v-model="basicData.profile" placeholder="请输入商品简介" placeholder="请输入市场价格"
type="text"/> />
</nut-form-item> </nut-form-item>
<nut-form-item label="上架状态:" prop="state"> <nut-form-item label="商品库存:" required prop="stock">
<nut-switch v-model="basicData.state" :active-value="1" :inactive-value="2"/> <nut-input v-model="basicData.stock" placeholder="请输入商品库存" />
</nut-form-item> </nut-form-item>
<nut-form-item prop="details"> <nut-form-item label="商品简介:" required prop="profile">
<RichEditor :content="basicData.details" @input="(val) => basicData.details = val"/> <nut-textarea
</nut-form-item> class="textarea"
<nut-form-item prop="ok"> v-model="basicData.profile"
<nut-button block type="primary" @click="ok">提交</nut-button> placeholder="请输入商品简介"
</nut-form-item> type="text"
</nut-form> />
</template> </nut-form-item>
</nut-backtop> <nut-form-item label="上架状态:" prop="state">
<!-- 商品分类 --> <nut-switch
<nut-popup position="bottom" v-model:visible="openGoodClass" @close="openGoodClass = false"> v-model="basicData.state"
<nut-picker :columns="columnsClass" title="商品分类" @confirm="confirmClass" :active-value="1"
></nut-picker> :inactive-value="2"
</nut-popup> />
</view> </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> </template>
<style lang="scss"> <style lang="scss">
.nut-input { .nut-input {
border: none; border: none;
color: #000; color: #000;
} }
.textarea { .textarea {
height: 100px; height: 100px;
background-color: #FAFAFA; background-color: #fafafa;
padding: 10px !important; padding: 10px !important;
border-radius: 10px; border-radius: 10px;
} }
</style> </style>

View File

@@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '商品管理' navigationBarTitleText: "商品管理",
}) });

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '个人中心', navigationBarTitleText: "个人中心",
navigationStyle: 'custom' navigationStyle: "custom",
}) });

View File

@@ -1,53 +1,46 @@
<template> <template>
<view class="app"> <view class="app">
<view <view
class="user-center-card__header__transparent" class="user-center-card__header__transparent"
v-if="isLogin" v-if="isLogin"
:style="{ width: isLogin ? '100%' : '70%' }" :style="{ width: isLogin ? '100%' : '70%' }"
> >
<view class="user-center-card__header__avatar"> <view class="user-center-card__header__avatar">
<nut-avatar size="large"> <nut-avatar size="large">
<img :src="userInfo.avatarUrl"/> <img :src="userInfo.avatarUrl" />
</nut-avatar> </nut-avatar>
</view> </view>
<view class="user-center-card__header__info"> <view class="user-center-card__header__info">
<view <view
class="user-center-card__header__info__name" class="user-center-card__header__info__name"
@click="toPage('/pages/users/user_setting/index')" @click="toPage('/pages/users/user_setting/index')"
>{{ userInfo.nickName }} >{{ userInfo.nickName }}
</view </view>
>
<view v-if="!userInfo.phone"> <view v-if="!userInfo.phone">
<nut-button <nut-button
size="mini" size="mini"
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getphonenumber" @getphonenumber="getphonenumber"
>点击绑定手机号 >点击绑定手机号
</nut-button> </nut-button>
</view> </view>
</view> </view>
<view class="rightIcon"> <view class="rightIcon">
<Scan style="margin-right: 20px" @click="scanCode" size="22"/> <Scan style="margin-right: 20px" @click="scanCode" size="22" />
<Setting <Setting style="margin-right: 20px" @click="toSetting" size="22" />
style="margin-right: 20px"
@click="toSetting"
size="22"
/>
</view> </view>
</view> </view>
<view v-else class="user-center-card__header__transparent"> <view v-else class="user-center-card__header__transparent">
<view class="user-center-card__header__avatar"> <view class="user-center-card__header__avatar">
<nut-avatar size="large"> <nut-avatar size="large">
<img <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> </nut-avatar>
</view> </view>
<view class="user-center-card__header__info"> <view class="user-center-card__header__info">
<view <view class="user-center-card__header__info__name" @click="clickLogin"
class="user-center-card__header__info__name" >点击立即登录
@click="clickLogin"
>点击立即登录
</view> </view>
</view> </view>
</view> </view>
@@ -58,39 +51,39 @@
<view>我的订单</view> <view>我的订单</view>
<view class="sub" @click="toOrderList(0)"> <view class="sub" @click="toOrderList(0)">
<view>全部订单</view> <view>全部订单</view>
<ArrowRight/> <ArrowRight />
</view> </view>
</view> </view>
<view class="center"> <view class="center">
<view class="center-t" @click="toOrderList(1)"> <view class="center-t" @click="toOrderList(1)">
<!-- <Order size="25px"/> --> <!-- <Order size="25px"/> -->
<IconFont <IconFont
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png" name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
size="40" size="40"
/> />
<view class="center-text">待付款</view> <view class="center-text">待付款</view>
</view> </view>
<view class="center-t" @click="toOrderList(2)"> <view class="center-t" @click="toOrderList(2)">
<!-- <Clock size="25px"/> --> <!-- <Clock size="25px"/> -->
<IconFont <IconFont
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png" name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
size="40" size="40"
/> />
<view class="center-text">待使用</view> <view class="center-text">待使用</view>
</view> </view>
<view class="center-t" @click="toOrderList(3)"> <view class="center-t" @click="toOrderList(3)">
<!-- <Shop size="25px"/> --> <!-- <Shop size="25px"/> -->
<IconFont <IconFont
name="http://article.biliimg.com/bfs/article/7c2ca0228180fe5f3b1d74b0043d80e76c42eb7d.png" name="http://article.biliimg.com/bfs/article/7c2ca0228180fe5f3b1d74b0043d80e76c42eb7d.png"
size="40" size="40"
/> />
<view class="center-text">已使用</view> <view class="center-text">已使用</view>
</view> </view>
<view class="center-t" @click="toOrderList(4)"> <view class="center-t" @click="toOrderList(4)">
<!-- <Del size="25px"/> --> <!-- <Del size="25px"/> -->
<IconFont <IconFont
name="http://article.biliimg.com/bfs/article/c4f4e069dddfa7104f794a46a759a7ed478b81ea.png" name="http://article.biliimg.com/bfs/article/c4f4e069dddfa7104f794a46a759a7ed478b81ea.png"
size="40" size="40"
/> />
<view class="center-text">已失效</view> <view class="center-text">已失效</view>
</view> </view>
@@ -101,20 +94,24 @@
<view class="user-center"> <view class="user-center">
<view>我的服务</view> <view>我的服务</view>
<view class="box"> <view class="box">
<view <template v-if="isLogin">
<view
class="box-mini" class="box-mini"
v-if="isLogin"
v-for="item in userMenuList" v-for="item in userMenuList"
:key="item.id" :key="item.id"
@click="toPage(item.url)" @click="toPage(item.url)"
> >
<!-- <image :src="item.icon" /> --> <!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont> <IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view> <view class="label">{{ item.label }}</view>
</view> </view>
<button v-if="isLogin" class="box-mini" open-type='contact'> </template>
<IconFont size="40"
name="http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png"></IconFont> <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> <text class="label">联系客服</text>
</button> </button>
</view> </view>
@@ -124,31 +121,31 @@
<view class="mer-box" v-if="userInfo.bid"> <view class="mer-box" v-if="userInfo.bid">
<nut-grid :gutter="10" :border="false"> <nut-grid :gutter="10" :border="false">
<nut-grid-item <nut-grid-item
:border="false" :border="false"
text="订单核销" text="订单核销"
@click="toPage('/pages/admin/verify/index')" @click="toPage('/pages/admin/verify/index')"
> >
<IconFont <IconFont
size="50" size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png" name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont> ></IconFont>
</nut-grid-item> </nut-grid-item>
<nut-grid-item <nut-grid-item
text="订单统计" text="订单统计"
@click="toPage('/pages/admin/order_manage/index')" @click="toPage('/pages/admin/order_manage/index')"
> >
<IconFont <IconFont
size="50" size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png" name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont> ></IconFont>
</nut-grid-item> </nut-grid-item>
<nut-grid-item <nut-grid-item
text="收益提现" text="收益提现"
@click="toPage('/pages/admin/withdrawal/index')" @click="toPage('/pages/admin/withdrawal/index')"
> >
<IconFont <IconFont
size="50" size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png" name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont> ></IconFont>
</nut-grid-item> </nut-grid-item>
<!-- <nut-grid-item--> <!-- <nut-grid-item-->
@@ -168,23 +165,23 @@
</view> </view>
<!-- 登录 --> <!-- 登录 -->
<Auth <Auth
:visible="isShowLogin" :visible="isShowLogin"
@update:visible="cancelLogin" @update:visible="cancelLogin"
@ok="getUserInfo" @ok="getUserInfo"
/> />
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {ref} from 'vue' import { ref } from "vue";
import {ArrowRight, Setting, IconFont, Scan} from '@nutui/icons-vue-taro' import { ArrowRight, Setting, IconFont, Scan } from "@nutui/icons-vue-taro";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import Auth from '@/components/Auth.vue' import Auth from "@/components/Auth.vue";
import {getPersonalInfo, getPhone, bindParent} from '@/api/user' 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 { interface UserInfo {
nickName?: string; nickName?: string;
@@ -195,57 +192,57 @@ interface UserInfo {
uid?: string; uid?: string;
} }
const userInfo = ref<UserInfo>({}) const userInfo = ref<UserInfo>({});
Taro.useDidShow(() => { Taro.useDidShow(() => {
const token = Taro.getStorageSync('token') const token = Taro.getStorageSync("token");
if (token) { if (token) {
getUserInfo() getUserInfo();
} }
}) });
const cancelLogin = () => { const cancelLogin = () => {
isShowLogin.value = false isShowLogin.value = false;
} };
const getUserInfo = async () => { const getUserInfo = async () => {
Taro.showLoading({ Taro.showLoading({
title: '加载中' title: "加载中",
}) });
const res = await getPersonalInfo() const res = await getPersonalInfo();
userInfo.value = res.data.data userInfo.value = res.data.data;
Taro.setStorageSync('userInfo', res.data.data) Taro.setStorageSync("userInfo", res.data.data);
Taro.setStorageSync('mer_type', res.data.store_type) Taro.setStorageSync("mer_type", res.data.store_type);
isLogin.value = true isLogin.value = true;
cancelLogin() cancelLogin();
Taro.hideLoading() Taro.hideLoading();
} };
const getphonenumber = async (e: any) => { const getphonenumber = async (e: any) => {
await getPhone({ await getPhone({
uid: userInfo.value.uid, uid: userInfo.value.uid,
code: e.detail.code code: e.detail.code,
}) });
await getUserInfo() await getUserInfo();
} };
const toOrderList = (e: number) => { const toOrderList = (e: number) => {
if (!isLogin) if (!isLogin.value)
return Taro.showToast({ return Taro.showToast({
title: '请先登录', title: "请先登录",
icon: 'none' icon: "none",
}) });
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/users/order_list/index?type=${e}` url: `/pages/users/order_list/index?type=${e}`,
}) });
} };
const userMenuList = ref([ const userMenuList = ref([
{ {
id: 1, id: 1,
label: '我的账户', label: "我的账户",
url: '/pages/users/account/index', url: "/pages/users/account/index",
icon: 'http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png' icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png",
}, },
// { // {
// id: 2, // id: 2,
@@ -255,65 +252,65 @@ const userMenuList = ref([
// }, // },
{ {
id: 3, id: 3,
label: '我的推广', label: "我的推广",
url: '/pages/users/distribution/index', url: "/pages/users/distribution/index",
icon: 'http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png' icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png",
}, },
{ {
id: 4, id: 4,
label: '关注商家', label: "关注商家",
url: '', url: "",
icon: 'http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png' icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png",
} },
// { // {
// id: 5, // id: 5,
// label: '联系客服', // label: '联系客服',
// url: '', // url: '',
// icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png' // icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png'
// } // }
]) ]);
const toSetting = () => { const toSetting = () => {
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/users/setting/index' url: "/pages/users/setting/index",
}) });
} };
const clickLogin = () => { const clickLogin = () => {
// isShowLogin.value = true // isShowLogin.value = true
Taro.redirectTo({ Taro.redirectTo({
url: '/pages/users/login/index' url: "/pages/users/login/index",
}) });
} };
const toPage = (url: string) => { const toPage = (url: string) => {
Taro.navigateTo({ Taro.navigateTo({
url: url url: url,
}) });
} };
const scanCode = () => { const scanCode = () => {
Taro.scanCode({ Taro.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
scanType: ['qrCode'], scanType: ["qrCode"],
success: async (data) => { success: async (data) => {
try { try {
await bindParent({ await bindParent({
uid: data.result uid: data.result,
}) });
Taro.showToast({ Taro.showToast({
title: '绑定成功', title: "绑定成功",
icon: 'none' icon: "none",
}) });
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: 'none' icon: "none",
}) });
} }
} },
}) });
} };
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -457,7 +454,6 @@ const scanCode = () => {
color: #000000; color: #000000;
background-color: #fff; background-color: #fff;
height: 100%; height: 100%;
} }
button::after { button::after {

View File

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

View File

@@ -1,316 +1,306 @@
<script lang="ts" setup> <script lang="ts" setup>
import {computed, ref} from "vue"; import { computed, ref } from "vue";
import {showToast, useLoad, getStorageSync} from "@tarojs/taro"; import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
import {getIntegralDetail, getBeanDetail, getGiftRecord} from "@/api/user"; import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user";
const tabValue = ref(1); const tabValue = ref(1);
const tabsList = ref([ const tabsList = ref([
{ {
title: "兑换明细", title: "兑换明细",
value: 1, value: 1,
}, },
{ {
title: "赠送明细", title: "赠送明细",
value: 3, value: 3,
}, },
{ {
title: "豆子明细", title: "豆子明细",
value: 2, value: 2,
}, },
{ {
title: "活动赠送", title: "活动赠送",
value: 4, value: 4,
} },
]); ]);
const computerType = computed(() => { const computerType = computed(() => {
return (val: number) => { return (val: number) => {
switch (val) { switch (val) {
case 5: case 5:
return '注册赠送'; return "注册赠送";
case 6: case 6:
return '签到赠送'; return "签到赠送";
case 7: case 7:
return '系统赠送'; return "系统赠送";
}
} }
}) };
});
const tabChange = (index: number) => { const tabChange = (index: number) => {
tabValue.value = index; tabValue.value = index;
data.value = []; data.value = [];
getList(); getList();
page.value.PageNum = 1; page.value.PageNum = 1;
}; };
const data = ref([]); const data = ref<any>([]);
const userInfo = ref<any>({}); const userInfo = ref<any>({});
useLoad(() => { useLoad(() => {
getList(); getList();
userInfo.value = getStorageSync("userInfo"); userInfo.value = getStorageSync("userInfo");
}); });
const page = ref({ const page = ref({
PageNum: 1, PageNum: 1,
PageSize: 10, PageSize: 10,
ItemCount: 0, ItemCount: 0,
}); });
const pageChange = (e: number) => { const pageChange = (e: number) => {
page.value.PageNum = e; page.value.PageNum = e;
getList(); getList();
}; };
const getList = async () => { const getList = async () => {
try { try {
let res: any; let res: any;
const newData = { const newData = {
PageNum: page.value.PageNum, PageNum: page.value.PageNum,
PageSize: page.value.PageSize, PageSize: page.value.PageSize,
Type: tabValue.value, Type: tabValue.value,
}; };
if (tabValue.value === 1 || tabValue.value === 3) { if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData); res = await getBeanDetail(newData);
} else if (tabValue.value === 2) { } else if (tabValue.value === 2) {
delete data.Type; // delete data.value.Type;
res = await getIntegralDetail(newData); Reflect.deleteProperty(data.value, "Type");
} else { res = await getIntegralDetail(newData);
res = await getGiftRecord(newData); } else {
} res = await getGiftRecord(newData);
console.log(res);
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
} }
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({
title: error.msg,
icon: "none",
});
}
}; };
</script> </script>
<template> <template>
<view> <view>
<view class="card"> <view class="card">
<!-- <view class="greeting">Hello! YuanHuakk</view> --> <!-- <view class="greeting">Hello! YuanHuakk</view> -->
<view class="info"> <view class="info">
<view class="left"> <view class="left">
<view> <view>
<view class="num">豆子: {{ userInfo.pulse }}</view> <view class="num">豆子: {{ userInfo.pulse }}</view>
</view> </view>
<view> <view>
<view class="num">积分: {{ userInfo.integral }}</view> <view class="num">积分: {{ userInfo.integral }}</view>
</view> </view>
</view>
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
</view>
</view> </view>
<view class="tabs-box"> <!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
<view </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-if="tabValue === 2">
<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>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
: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> </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-if="tabValue === 2">
<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>
<view v-else-if="tabValue === 4">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
: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> </template>
<style lang="scss"> <style lang="scss">
.nut-pagination { .nut-pagination {
position: absolute; position: absolute;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
} }
.card { .card {
width: 90%; width: 90%;
height: 300px; height: 300px;
border-radius: 20px; border-radius: 20px;
background-color: #282828; background-color: #282828;
box-shadow: 0 0 10px rgba(40, 40, 40, 0.1); box-shadow: 0 0 10px rgba(40, 40, 40, 0.1);
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
margin: 10px auto; margin: 10px auto;
color: #d0a568; color: #d0a568;
padding: 20px; padding: 20px;
.greeting { .greeting {
font-size: 35px; 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; font-weight: bold;
margin-top: 10px;
}
} }
.info { .img {
display: flex; width: 380px;
justify-content: space-between; height: 270px;
.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;
}
} }
}
} }
.tabs-box { .tabs-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-evenly; 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; align-items: center;
height: auto; }
background-color: #fff;
padding: 0 20px;
text-align: center;
.text { .line {
margin: 10px 20px; margin: 0 auto;
align-items: center; width: 50px;
} height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.line { .lineColor {
margin: 0 auto; background-color: #ff0000;
width: 50px; }
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
}
} }
.card-list { .card-list {
margin: 10px 20px; margin: 10px 20px;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.left { .left {
width: 500px; width: 500px;
.text { .text {
text-align: left; text-align: left;
width: 100%; width: 100%;
// 超出一行隐藏 // 超出一行隐藏
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 1; -webkit-line-clamp: 1;
overflow: hidden; overflow: hidden;
word-break: break-word; word-break: break-word;
}
} }
}
.right { .right {
flex: 1; flex: 1;
text-align: right; text-align: right;
} }
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '手机号登录' navigationBarTitleText: "手机号登录",
}) });

View File

@@ -5,12 +5,12 @@ import { getVerifyCode, phoneLogin } from "@/api/user";
import logoImg from "../../../static/logo.jpg"; import logoImg from "../../../static/logo.jpg";
Taro.useLoad((options) => { Taro.useLoad((options) => {
console.log(options); console.log(options);
}); });
const basicData = ref({ const basicData = ref({
phone: "", phone: "",
code: "", code: "",
}); });
const smsDisabled = ref(false); const smsDisabled = ref(false);
@@ -19,148 +19,146 @@ const smsStr = ref("获取验证码");
// 获取验证码 // 获取验证码
const getSmsCode = async () => { const getSmsCode = async () => {
if ( 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( !/^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 basicData.value.phone
)
) )
return Taro.showToast({ )
title: "请输入正确的手机号码", return Taro.showToast({
icon: "none", title: "请输入正确的手机号码",
}); icon: "none",
await getVerifyCode({
phone: basicData.value.phone.toString(),
}); });
smsDisabled.value = true; await getVerifyCode({
let time = 60; phone: basicData.value.phone.toString(),
const timer = setInterval(() => { });
time--; smsDisabled.value = true;
smsStr.value = `${time}s`; let time = 60;
if (time === 0) { const timer = setInterval(() => {
clearInterval(timer); time--;
smsDisabled.value = false; smsStr.value = `${time}s`;
smsStr.value = "获取验证码"; if (time === 0) {
} clearInterval(timer);
}, 1000); smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
}; };
const login = async () => { const login = async () => {
if ( 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( !/^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 basicData.value.phone
)
) )
return Taro.showToast({ )
title: "请输入正确的手机号码", return Taro.showToast({
icon: "none", title: "请输入正确的手机号码",
}); icon: "none",
if (!basicData.value.code) });
return Taro.showToast({ if (!basicData.value.code)
title: "请输入验证码", return Taro.showToast({
icon: "none", title: "请输入验证码",
}); icon: "none",
});
const res = await phoneLogin({ const res = await phoneLogin({
Phone: basicData.value.phone, Phone: basicData.value.phone,
Code: basicData.value.code, Code: basicData.value.code,
Referee: Taro.getStorageSync("bind_id") || "", 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({ }, 2000);
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);
}; };
</script> </script>
<template> <template>
<view class="wrapper"> <view class="wrapper">
<image src="../../../static/wechat_login.jpg" /> <image src="../../../static/wechat_login.jpg" />
<view class="logo"> <view class="logo">
<image :src="logoImg" /> <image :src="logoImg" />
<view>捷兑通</view> <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> </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> </template>
<style lang="scss"> <style lang="scss">
page { page {
background: #fff; background: #fff;
} }
.wrapper { .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 { image {
width: 100%; width: 200px;
height: 838px; height: 200px;
border-radius: 50%;
} }
}
.logo { .center {
position: absolute; position: absolute;
top: 35%; top: 55%;
left: 50%; width: 100%;
transform: translate(-50%, -50%); display: flex;
text-align: center; flex-direction: column;
font-size: 35px; justify-content: flex-start;
line-height: 70px; padding: 0px 10px;
}
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;
}
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "我的推广", navigationBarTitleText: "我的推广",
}); });

View File

@@ -1,27 +1,27 @@
<template> <template>
<view> <view>
<view class="card-list"> <view class="card-list">
<view <view
class="item" class="item"
v-for="(item, index) in list" v-for="(item, index) in list"
:key="index" :key="index"
@click="clickItem(item)" @click="clickItem(item)"
> >
<view class="text"> <view class="text">
<IconFont :name="item.icon" color="red" size="30" /> <IconFont :name="item.icon" color="red" size="30" />
<view>{{ item.label }}</view> <view>{{ item.label }}</view>
</view>
</view>
<view style="width: 45%"></view>
</view> </view>
<!-- 二维码弹窗 --> </view>
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show"> <view style="width: 45%"></view>
<view class="popup">
<view>推荐人二维码绑定</view>
<image style="margin-top: 10px" :src="urlCode" />
</view>
</nut-popup>
</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> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -35,79 +35,79 @@ const show = ref(false);
const urlCode = ref(""); const urlCode = ref("");
const list = ref([ const list = ref([
{ {
id: 1, id: 1,
icon: "scan", icon: "scan",
label: "推广名片", label: "推广名片",
}, },
{ {
id: 2, id: 2,
icon: "date", icon: "date",
label: "积分明细", label: "积分明细",
}, },
{ {
id: 3, id: 3,
icon: "my2", icon: "my2",
label: "推广用户", label: "推广用户",
}, },
]); ]);
const clickItem = async (item: any) => { const clickItem = async (item: any) => {
if (item.id === 1) { if (item.id === 1) {
// urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync( // urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
// "token" // "token"
// )}`; // )}`;
Taro.showLoading({ Taro.showLoading({
title: "加载中", title: "加载中",
mask: true, mask: true,
}); });
const res = await getRefereeCode(); const res = await getRefereeCode();
urlCode.value = `data:image/png;base64,${res.data.data}`; urlCode.value = `data:image/png;base64,${res.data.data}`;
show.value = true; show.value = true;
Taro.hideLoading(); Taro.hideLoading();
} else if (item.id === 2) { } else if (item.id === 2) {
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/users/distribution/integral/index", url: "/pages/users/distribution/integral/index",
}); });
} else { } else {
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/users/distribution/userlist/index", url: "/pages/users/distribution/userlist/index",
}); });
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.card-list { .card-list {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
flex-wrap: wrap; flex-wrap: wrap;
.item { .item {
width: 45%; width: 45%;
height: 200px; height: 200px;
background-color: #fff; background-color: #fff;
border-radius: 20px; border-radius: 20px;
margin-top: 10px; margin-top: 10px;
text-align: center; text-align: center;
padding: 10px; padding: 10px;
position: relative; position: relative;
.text { .text {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
}
} }
}
} }
.popup { .popup {
text-align: center; text-align: center;
image { image {
width: 300px; width: 300px;
height: 300px; height: 300px;
} }
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "积分明细", navigationBarTitleText: "积分明细",
}); });

View File

@@ -1,38 +1,38 @@
<template> <template>
<view> <view>
<view v-if="data.length > 0"> <view v-if="data.length > 0">
<view <view
class="card-list" class="card-list"
v-for="(item, index) in (data as any[])" v-for="(item, index) in (data as any[])"
:key="index" :key="index"
> >
<view class="left"> <view class="left">
<view>昵称{{ item.nick_name }}</view> <view>昵称{{ item.nick_name }}</view>
<view>购买商品{{ item.goods_name }}</view> <view>购买商品{{ item.goods_name }}</view>
<view <view
>订单价格<text style="color: red">{{ >订单价格<text style="color: red">{{
item.order_number item.order_number
}}</text></view }}</text></view
> >
<view>购买时间{{ item.add_time.slice(0, 10) }}</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>
<view v-else> <view class="right">
<nut-empty description="暂无积分明细" /> <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> </view>
<view v-else>
<nut-empty description="暂无积分明细" />
</view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -43,48 +43,48 @@ import { getTGIntegralDetail } from "../../../../api/user";
const data = ref([]); const data = ref([]);
useLoad(() => { useLoad(() => {
getData(); getData();
}); });
const page = ref({ const page = ref({
PageNum: 1, PageNum: 1,
PageSize: 10, PageSize: 10,
ItemCount: 0, ItemCount: 0,
}); });
const pageChange = (e: number) => { const pageChange = (e: number) => {
page.value.PageNum = e; page.value.PageNum = e;
getData(); getData();
}; };
const getData = async () => { const getData = async () => {
try { try {
const res = await getTGIntegralDetail({ const res = await getTGIntegralDetail({
PageNum: page.value.PageNum, PageNum: page.value.PageNum,
PageSize: page.value.PageSize, PageSize: page.value.PageSize,
}); });
data.value = res.data.data || []; data.value = res.data.data || [];
page.value.ItemCount = res.data.count; page.value.ItemCount = res.data.count;
} catch (error) { } catch (error) {
showToast({ title: error.msg, icon: "none" }); showToast({ title: error.msg, icon: "none" });
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.card-list { .card-list {
margin: 10px 20px; margin: 10px 20px;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.nut-pagination { .nut-pagination {
position: absolute; position: absolute;
margin-top: 10px; margin-top: 10px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: "推广人统计", navigationBarTitleText: "推广人统计",
}); });

View File

@@ -1,32 +1,31 @@
<template> <template>
<view> <view>
<view v-if="data.length > 0"> <view v-if="data.length > 0">
<view <view
class="card-list" class="card-list"
v-for="(item, index) in (data as any[])" v-for="(item, index) in (data as any[])"
:key="index" :key="index"
> >
<view class="left"> <view class="left">
<image :src="item.avatarUrl" /> <image :src="item.avatarUrl" />
<view class="text"> <view class="text">
<view>{{ item.nickName }}</view> <view>{{ item.nickName }}</view>
<view>{{ item.phone }}</view> <view>{{ item.phone }}</view>
</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>
<view class="right"></view>
</view>
<nut-pagination
v-model="page.PageNum"
:total-items="page.ItemCount"
:items-per-page="page.PageSize"
@change="pageChange"
/>
</view> </view>
<view v-else>
<nut-empty description="暂无明细"></nut-empty>
</view>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -35,7 +34,7 @@ import { useLoad, showToast } from "@tarojs/taro";
import { getTGUserList } from "../../../../api/user"; import { getTGUserList } from "../../../../api/user";
useLoad(() => { useLoad(() => {
getData(); getData();
}); });
const data = ref([]); const data = ref([]);
@@ -43,51 +42,51 @@ const data = ref([]);
const page = ref({ PageNum: 1, PageSize: 10, ItemCount: 0 }); const page = ref({ PageNum: 1, PageSize: 10, ItemCount: 0 });
const pageChange = (e: number) => { const pageChange = (e: number) => {
page.value.PageNum = e; page.value.PageNum = e;
getData(); getData();
}; };
const getData = async () => { const getData = async () => {
try { try {
const res = await getTGUserList({ const res = await getTGUserList({
PageNum: page.value.PageNum, PageNum: page.value.PageNum,
PageSize: page.value.PageSize, PageSize: page.value.PageSize,
}); });
data.value = res.data.data || []; data.value = res.data.data || [];
page.value.ItemCount = res.data.count; page.value.ItemCount = res.data.count;
} catch (error) { } catch (error) {
showToast({ title: error.msg, icon: "none" }); showToast({ title: error.msg, icon: "none" });
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.nut-pagination { .nut-pagination {
position: absolute; position: absolute;
margin-top: 10px; margin-top: 10px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
} }
.card-list { .card-list {
width: 700px; width: 700px;
background-color: #fff; background-color: #fff;
margin: 10px auto; margin: 10px auto;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
.left { .left {
display: flex; display: flex;
align-items: center; align-items: center;
image { image {
width: 100px; width: 100px;
height: 100px; height: 100px;
border-radius: 50%; border-radius: 50%;
}
.text {
margin-left: 20px;
}
} }
.text {
margin-left: 20px;
}
}
} }
</style> </style>

View File

@@ -1,4 +1,4 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '登录', navigationBarTitleText: "登录",
navigationStyle: 'custom' navigationStyle: "custom",
}) });

View File

@@ -7,83 +7,83 @@ import logoImg from "../../../static/logo.jpg";
const isShow = ref(false); const isShow = ref(false);
const getCode = () => { const getCode = () => {
Taro.showLoading({ Taro.showLoading({
title: "授权中...", title: "授权中...",
mask: true, mask: true,
}); });
Taro.login({ Taro.login({
success: (res) => { success: (res) => {
console.log(res); console.log(res);
Taro.setStorageSync("wx_code", res.code); Taro.setStorageSync("wx_code", res.code);
isShow.value = true; isShow.value = true;
}, },
complete: () => { complete: () => {
Taro.hideLoading(); Taro.hideLoading();
}, },
}); });
}; };
const toPage = () => { const toPage = () => {
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/users/bindPhone/index?type=1", url: "/pages/users/bindPhone/index?type=1",
}); });
}; };
</script> </script>
<template> <template>
<view class="wrapper"> <view class="wrapper">
<image src="../../../static/wechat_login.jpg" /> <image src="../../../static/wechat_login.jpg" />
<view class="logo"> <view class="logo">
<image :src="logoImg" /> <image :src="logoImg" />
<view>捷兑通</view> <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> </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> </template>
<style lang="scss"> <style lang="scss">
page { page {
background: #fff; background: #fff;
} }
.wrapper { .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 { image {
width: 100%; width: 200px;
height: 838px; height: 200px;
border-radius: 50%;
} }
}
.logo { .center {
position: absolute; position: absolute;
top: 50%; top: 80%;
left: 50%; width: 100%;
transform: translate(-50%, -50%); display: flex;
text-align: center; flex-direction: column;
font-size: 35px; justify-content: flex-start;
line-height: 70px; padding: 10px 100px;
}
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;
}
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '我的订单' navigationBarTitleText: "我的订单",
}) });

View File

@@ -1,12 +1,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref } from "vue";
import { import {
useLoad, useLoad,
useReachBottom, useReachBottom,
showToast, showToast,
navigateTo, navigateTo,
setStorageSync, setStorageSync,
useDidShow, useDidShow,
} from "@tarojs/taro"; } from "@tarojs/taro";
import Pay from "@/components/Pay.vue"; import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user"; import { getIntegralOrderList } from "@/api/user";
@@ -18,349 +18,345 @@ const tabValue = ref(0);
const isShowPay = ref(false); const isShowPay = ref(false);
const tabsList = ref([ const tabsList = ref([
{ {
title: "全部", title: "全部",
value: 0, value: 0,
num: 0, num: 0,
}, },
{ {
title: "待付款", title: "待付款",
value: 1, value: 1,
num: 0, num: 0,
}, },
{ {
title: "待使用", title: "待使用",
value: 2, value: 2,
num: 0, num: 0,
}, },
{ {
title: "已使用", title: "已使用",
value: 3, value: 3,
num: 0, num: 0,
}, },
{ {
title: "已失效", title: "已失效",
value: 4, value: 4,
num: 0, num: 0,
}, },
]); ]);
const jfInfo = ref({}); const jfInfo = ref({});
interface OrderList { interface OrderList {
oid: string; oid: string;
add_time: string; add_time: string;
status: number; status: number;
BindGoods: { BindGoods: {
cover: string; cover: string;
name: string; name: string;
number: number;
};
count: number;
number: number; number: number;
};
count: number;
number: number;
} }
const orderList = ref<OrderList[]>([]); const orderList = ref<OrderList[]>([]);
useLoad((options) => { useLoad((options) => {
tabValue.value = Number(options.type); tabValue.value = Number(options.type);
}); });
useDidShow(() => { useDidShow(() => {
getList(); getList();
}); });
const getList = async () => { const getList = async () => {
try { try {
const res = await getIntegralOrderList({ const res = await getIntegralOrderList({
status: tabValue.value, status: tabValue.value,
}); });
console.log(res); console.log(res);
orderList.value = res.data.data; orderList.value = res.data.data;
} catch (error) { } catch (error) {
showToast({ showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
getTj(); getTj();
}; };
const tabChange = (index: number) => { const tabChange = (index: number) => {
tabValue.value = index; tabValue.value = index;
getList(); getList();
}; };
useReachBottom(() => { useReachBottom(() => {
console.log("useReachBottom"); console.log("useReachBottom");
}); });
const openPay = (item: OrderList) => { const openPay = (item: OrderList) => {
isShowPay.value = true; isShowPay.value = true;
jfInfo.value = [item]; jfInfo.value = [item];
}; };
const errPay = () => { const errPay = () => {
isShowPay.value = false; isShowPay.value = false;
showToast({ showToast({
title: "支付失败", title: "支付失败",
icon: "none", icon: "none",
}); });
jfInfo.value = {}; jfInfo.value = {};
getList(); getList();
}; };
const closePay = () => { const closePay = () => {
isShowPay.value = false; isShowPay.value = false;
showToast({ showToast({
title: "支付取消", title: "支付取消",
icon: "none", icon: "none",
}); });
jfInfo.value = {}; jfInfo.value = {};
getList(); getList();
}; };
const toDetail = (item: any) => { const toDetail = (item: any) => {
setStorageSync("item", item); setStorageSync("item", item);
navigateTo({ navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`, url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
}); });
}; };
const delOrder = async (oid: string) => { const delOrder = async (oid: string) => {
try { try {
const res = await deleteJfOrder({ oid }); const res = await deleteJfOrder({ oid });
console.log(res); console.log(res);
} catch (error) { } catch (error) {
showToast({ showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
getList(); getList();
}; };
const countInfo = ref<any>({}); const countInfo = ref<any>({});
const getTj = async () => { const getTj = async () => {
try { try {
const res = await getOrderStatistics({ const res = await getOrderStatistics({
type: 2, type: 2,
}); });
countInfo.value = res.data.data; countInfo.value = res.data.data;
tabsList.value[0].num = countInfo.value.A || 0; tabsList.value[0].num = countInfo.value.A || 0;
tabsList.value[1].num = countInfo.value.B || 0; tabsList.value[1].num = countInfo.value.B || 0;
tabsList.value[2].num = countInfo.value.C || 0; tabsList.value[2].num = countInfo.value.C || 0;
tabsList.value[3].num = countInfo.value.D || 0; tabsList.value[3].num = countInfo.value.D || 0;
tabsList.value[4].num = countInfo.value.F || 0; tabsList.value[4].num = countInfo.value.F || 0;
} catch (error) { } catch (error) {
showToast({ showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
}; };
</script> </script>
<template> <template>
<view> <view>
<view class="topTips"> <view class="topTips">
<view> <view>
<view style="font-weight: bold">订单信息</view> <view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px" <view style="font-size: 15px"
>总消费积分{{ countInfo.Total || 0 }} >总消费积分{{ countInfo.Total || 0 }}
</view>
</view>
<image src="../static/user/order_list_top.png" />
</view> </view>
<view class="tabs-box"> </view>
<view <image src="../static/user/order_list_top.png" />
v-for="item in tabsList" </view>
:key="item.value" <view class="tabs-box">
@click="tabChange(item.value)" <view
> v-for="item in tabsList"
<view class="text">{{ item.title }}</view> :key="item.value"
<view>{{ item.num }}</view> @click="tabChange(item.value)"
<view >
class="line" <view class="text">{{ item.title }}</view>
:class="{ lineColor: item.value === tabValue }" <view>{{ item.num }}</view>
></view> <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) }}</view>
<view style="color: red">{{
item.status === 0
? "待付款"
: item.status === 1
? "待使用"
: item.status === 2
? "已使用"
: "已失效"
}}</view>
</view> </view>
<view v-if="orderList.length > 0"> <view class="line"></view>
<view <view class="center">
class="order-card" <view class="top">
v-for="(item, index) in orderList" <image :src="item.BindGoods.cover" />
:key="index" <view class="title">{{ item.BindGoods?.name }} </view>
> <view class="right">
<view class="top"> <view>{{ item.BindGoods?.number }}</view>
<view>{{ item.add_time.slice(0, 19) }}</view> <view>x{{ item?.count }}</view>
<view style="color: red">{{ </view>
item.status === 0 </view>
? "待付款" <!-- <view
: 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.BindGoods?.number }}</view>
<view>x{{ item?.count }}</view>
</view>
</view>
<!-- <view
class="bom" class="bom"
style="text-align: right; font-size: 13px" style="text-align: right; font-size: 13px"
> >
{{ item.count }}件商品,实付积分: {{ item.count }}件商品,实付积分:
<text style="color: red">{{ item.number }}</text> <text style="color: red">{{ item.number }}</text>
</view> --> </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> </view>
<nut-empty v-else description="暂无订单"></nut-empty> <view class="line"></view>
<pay <view class="btn">
:isShowPay="isShowPay" <nut-button
payType="jf" v-if="item.status === 0"
@errPay="errPay" plain
@closePay="closePay" size="small"
:jfInfo="jfInfo" 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> </view>
<nut-empty v-else description="暂无订单"></nut-empty>
<pay
:isShowPay="isShowPay"
payType="jf"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template> </template>
<style lang="scss"> <style lang="scss">
.topTips { .topTips {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
background-color: #ff0000; background-color: #ff0000;
color: #ffffff; color: #ffffff;
padding: 20px; padding: 20px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
image { image {
width: 150px; width: 150px;
height: 150px; height: 150px;
} }
} }
.tabs-box { .tabs-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; 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; align-items: center;
height: auto; }
background-color: #fff;
padding: 0 20px;
text-align: center;
.text { .line {
margin: 10px 20px; margin: 0 auto;
align-items: center; width: 50px;
} height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.line { .lineColor {
margin: 0 auto; background-color: #ff0000;
width: 50px; }
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
}
} }
.order-card { .order-card {
width: 95%; width: 95%;
box-sizing: border-box; box-sizing: border-box;
margin: 15px auto; margin: 15px auto;
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
.line { .line {
width: 100%; width: 100%;
height: 1px; height: 1px;
background-color: #f5f5f5; background-color: #f5f5f5;
margin: 10px; margin: 10px;
} }
.top {
display: flex;
justify-content: space-between;
align-items: center;
}
.btn {
display: flex;
justify-content: flex-end;
align-items: center;
}
.center {
.top { .top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; // align-items: flex-start;
}
image {
.btn { width: 150px;
display: flex; height: 150px;
justify-content: flex-end; }
align-items: center;
} .title {
margin-left: 10px;
.center { display: -webkit-box;
.top { overflow: hidden;
display: flex; -webkit-line-clamp: 2;
justify-content: space-between; -webkit-box-orient: vertical;
// align-items: flex-start; text-overflow: ellipsis;
width: 350px;
image { }
width: 150px;
height: 150px; .right {
} margin-left: 10px;
font-size: 28px;
.title { text-align: right;
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> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '订单详情' navigationBarTitleText: "订单详情",
}) });

View File

@@ -1,433 +1,429 @@
<template> <template>
<view> <view>
<!-- 步骤条 --> <!-- 步骤条 -->
<view class="step-bar"> <view class="step-bar">
<view <view
class="item" class="item"
v-for="item in statusList" v-for="item in statusList"
:key="item.id" :key="item.id"
:class="{ activation: item.id === goodInfo.status }" :class="{ activation: item.id === goodInfo.status }"
> >
<view class="text">{{ item.text }}</view> <view class="text">{{ item.text }}</view>
<view class="dot"></view> <view class="dot"></view>
</view> </view>
</view>
<view v-if="goodInfo.status === 1" class="timeBox">
订单剩余{{ timeStr }}过期,请尽快核销
</view>
<!-- 商家信息 -->
<view class="mer-info">
<view class="left">
<view>
<text>{{ goodInfo.BindStore?.name }}</text>
<text>{{ goodInfo.BindStore?.phone }}</text>
</view> </view>
<view v-if="goodInfo.status === 1" class="timeBox"> <nut-ellipsis
订单剩余{{ timeStr }}过期,请尽快核销 :rows="2"
:content="goodInfo.BindStore?.address"
direction="end"
></nut-ellipsis>
</view>
<view class="right">
<view class="icon" @click="toPhone">
<Service />
<text>电话</text>
</view> </view>
<!-- 商家信息 --> <view class="icon" @click="toAdder">
<view class="mer-info"> <Find />
<view class="left"> <text>导航</text>
<view>
<text>{{ goodInfo.BindStore?.name }}</text>
<text>{{ goodInfo.BindStore?.phone }}</text>
</view>
<nut-ellipsis
:rows="2"
:content="goodInfo.BindStore?.address"
direction="end"
></nut-ellipsis>
</view>
<view class="right">
<view class="icon" @click="toPhone">
<Service/>
<text>电话</text>
</view>
<view class="icon" @click="toAdder">
<Find/>
<text>导航</text>
</view>
</view>
</view> </view>
</view>
</view>
<!-- 订单信息 --> <!-- 订单信息 -->
<nut-cell-group> <nut-cell-group>
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell> <nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
<nut-cell> <nut-cell>
<template #default> <template #default>
<view class="top"> <view class="top">
<image :src="goodInfo.BindGoods?.cover"/> <image :src="goodInfo.BindGoods?.cover" />
<view class="title" <view class="title">{{ goodInfo.BindGoods?.name }} </view>
>{{ goodInfo.BindGoods?.name }} <view class="right">
</view> <view>{{ goodInfo.BindGoods?.number }}</view>
<view class="right"> <view>x{{ goodInfo.count }}</view>
<view>{{ goodInfo.BindGoods?.number }}</view> </view>
<view>x{{ goodInfo.count }}</view> </view>
</view> </template>
</view> </nut-cell>
</template> <nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell>
</nut-cell> <nut-cell
<nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell> title="下单时间:"
<nut-cell :desc="goodInfo.add_time?.slice(0, 19)"
title="下单时间:" ></nut-cell>
:desc="goodInfo.add_time?.slice(0, 19)" <nut-cell
></nut-cell> v-if="goodInfo.expires !== 0"
<nut-cell title="订单过期时间:"
v-if="goodInfo.expires !== 0" :desc="dayjs.unix(goodInfo.expires).format('YYYY-MM-DD HH:mm:ss')"
title="订单过期时间:" ></nut-cell>
:desc=" <nut-cell
dayjs.unix(goodInfo.expires).format('YYYY-MM-DD HH:mm:ss') title="支付状态:"
" :desc="
></nut-cell> goodInfo.status === 0
<nut-cell ? '待付款'
title="支付状态:" : goodInfo.status === 1
:desc=" ? '待使用'
goodInfo.status === 0 : goodInfo.status === 2
? '待付款' ? '已使用'
: goodInfo.status === 1 : '已失效'
? '待使用' "
: goodInfo.status === 2 ></nut-cell>
? '已使用' <nut-cell
: '已失效' :title="`商品总价(${type === '1' ? '元' : '积分'}):`"
" :desc="goodInfo.number"
></nut-cell> ></nut-cell>
<nut-cell <nut-cell>
:title="`商品总价(${type === '1' ? '元' : '积分'}):`" <template #default>
:desc="goodInfo.number" <view style="text-align: right; width: 100%">
></nut-cell> <view
<nut-cell> >{{ goodInfo.status === 0 ? "应付款" : "实付款" }}({{
<template #default> type === "1" ? "元" : "积分"
<view style="text-align: right; width: 100%"> }}):
<view <nut-price
>{{ :price="goodInfo.number"
goodInfo.status === 0 ? '应付款' : '实付款' size="normal"
}}({{ type === '1' ? '元' : '积分' }}): :need-symbol="false"
<nut-price />
:price="goodInfo.number" </view>
size="normal" </view>
:need-symbol="false" </template>
/> </nut-cell>
</view> </nut-cell-group>
</view> <view class="btn">
</template> <!-- <nut-button
</nut-cell>
</nut-cell-group>
<view class="btn">
<!-- <nut-button
plain plain
v-if="goodInfo.status === 0" v-if="goodInfo.status === 0"
size="small" size="small"
type="primary" type="primary"
>取消订单 >取消订单
</nut-button> --> </nut-button> -->
<nut-button <nut-button
v-if="goodInfo.status === 0" v-if="goodInfo.status === 0"
style="margin-left: 5px" style="margin-left: 5px"
size="small" size="small"
type="primary" type="primary"
@click="openPay()" @click="openPay()"
>立即付款 >立即付款
</nut-button> </nut-button>
<nut-button <nut-button
v-if="goodInfo.status === 1" v-if="goodInfo.status === 1"
style="margin-left: 5px" style="margin-left: 5px"
size="small" size="small"
type="primary" type="primary"
@click="openCode()" @click="openCode()"
>出示核销码 >出示核销码
</nut-button> </nut-button>
</view>
<!-- 核销码弹窗 -->
<nut-popup
v-model:visible="isShowCode"
position="bottom"
:style="{ height: 'auto' }"
:maskClosable="true"
safe-area-inset-bottom
@closed="closed"
>
<view class="code-box">
<view>请出示核销码核销</view>
<image class="qrcode" :src="url"></image>
</view>
</nut-popup>
<pay
:isShowPay="isShowPay"
:payType="type === '1' ? 'wx' : 'jf'"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view> </view>
<!-- 核销码弹窗 -->
<nut-popup
v-model:visible="isShowCode"
position="bottom"
:style="{ height: 'auto' }"
:maskClosable="true"
safe-area-inset-bottom
@closed="closed"
>
<view class="code-box">
<view>请出示核销码核销</view>
<image class="qrcode" :src="url"></image>
</view>
</nut-popup>
<pay
:isShowPay="isShowPay"
:payType="type === '1' ? 'wx' : 'jf'"
@errPay="errPay"
@closePay="closePay"
:jfInfo="jfInfo"
/>
</view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {Find, Service} from '@nutui/icons-vue-taro' import { Find, Service } from "@nutui/icons-vue-taro";
import {ref} from 'vue' import { ref } from "vue";
import dayjs from 'dayjs' import dayjs from "dayjs";
import duration from 'dayjs/plugin/duration' import duration from "dayjs/plugin/duration";
import Pay from '@/components/Pay.vue' import Pay from "@/components/Pay.vue";
dayjs.extend(duration) dayjs.extend(duration);
const goodInfo = ref<any>({}) const goodInfo = ref<any>({});
const statusList = ref([ const statusList = ref([
{ {
id: 0, id: 0,
text: '待付款' text: "待付款",
}, },
{ {
id: 1, id: 1,
text: '待使用' text: "待使用",
}, },
{ {
id: 2, id: 2,
text: '已使用' text: "已使用",
}, },
{ {
id: 3, id: 3,
text: '已失效' text: "已失效",
} },
]) ]);
const isShowCode = ref(false) const isShowCode = ref(false);
const isShowPay = ref(false) const isShowPay = ref(false);
const jfInfo = ref<any>({}) const jfInfo = ref<any>({});
const type = ref('') const type = ref("");
const url = ref('') const url = ref("");
Taro.useLoad((options) => { Taro.useLoad((options) => {
type.value = options.type type.value = options.type;
goodInfo.value = Taro.getStorageSync('item') goodInfo.value = Taro.getStorageSync("item");
if (goodInfo.value.status === 1) { if (goodInfo.value.status === 1) {
startTime() startTime();
} }
}) });
const toPhone = () => { const toPhone = () => {
Taro.makePhoneCall({ Taro.makePhoneCall({
phoneNumber: goodInfo.value.BindStore.mobile phoneNumber: goodInfo.value.BindStore.mobile,
}) });
} };
const toAdder = () => { const toAdder = () => {
Taro.openLocation({ Taro.openLocation({
latitude: Number(goodInfo.value.BindStore.lat), latitude: Number(goodInfo.value.BindStore.lat),
longitude: Number(goodInfo.value.BindStore.lon), longitude: Number(goodInfo.value.BindStore.lon),
scale: 18 scale: 18,
}) });
} };
const openPay = () => { const openPay = () => {
isShowPay.value = true isShowPay.value = true;
jfInfo.value = Taro.getStorageSync('item') jfInfo.value = Taro.getStorageSync("item");
} };
const errPay = () => { const errPay = () => {
isShowPay.value = false isShowPay.value = false;
Taro.showToast({ Taro.showToast({
title: '支付失败', title: "支付失败",
icon: 'none' icon: "none",
}) });
jfInfo.value = {} jfInfo.value = {};
} };
const closePay = () => { const closePay = () => {
isShowPay.value = false isShowPay.value = false;
Taro.showToast({ Taro.showToast({
title: '支付取消', title: "支付取消",
icon: 'none' icon: "none",
}) });
jfInfo.value = {} jfInfo.value = {};
} };
const openCode = () => { const openCode = () => {
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}` url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
isShowCode.value = true isShowCode.value = true;
} };
const closed = () => { const closed = () => {
isShowCode.value = false isShowCode.value = false;
url.value = '' url.value = "";
} };
let timeId: any let timeId: any;
const timeStr = ref('????') const timeStr = ref("????");
const startTime = () => { const startTime = () => {
const nowTime = dayjs() const nowTime = dayjs();
const endTime = dayjs(goodInfo.value.expires * 1000) const endTime = dayjs(goodInfo.value.expires * 1000);
// 计算剩余时间的持续时间对象 // 计算剩余时间的持续时间对象
const duration = dayjs.duration(endTime.diff(nowTime)) const duration = dayjs.duration(endTime.diff(nowTime));
// 格式化剩余时间 // 格式化剩余时间
timeStr.value = duration.format('D天H小时m分钟s秒') timeStr.value = duration.format("D天H小时m分钟s秒");
if (goodInfo.value.expires - dayjs().unix() > 0) { if (goodInfo.value.expires - dayjs().unix() > 0) {
clearInterval(timeId) clearInterval(timeId);
timeId = setTimeout(() => { timeId = setTimeout(() => {
startTime() startTime();
}, 1000) }, 1000);
} }
} };
Taro.useUnload(() => { Taro.useUnload(() => {
clearTimeout(timeId) clearTimeout(timeId);
}) });
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
height: 100vh; height: 100vh;
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 100px; padding-bottom: 100px;
position: relative; position: relative;
} }
.timeBox { .timeBox {
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
font-size: 30px; font-size: 30px;
padding: 30px; padding: 30px;
} }
.step-bar { .step-bar {
width: 100%; width: 100%;
height: 100px;
background: #fff;
display: flex;
.item {
width: 200px;
height: 100px; height: 100px;
background: #fff;
display: flex; display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: small;
.item { .dot {
width: 200px; width: 25px;
height: 100px; height: 25px;
display: flex; border-radius: 50%;
flex-direction: column; background: #cecece;
justify-content: center; margin-top: 5px;
align-items: center; }
font-size: small; }
.dot { .activation {
width: 25px; .text {
height: 25px; color: #ff0000;
border-radius: 50%;
background: #cecece;
margin-top: 5px;
}
} }
.activation { .dot {
.text { background: #ff0000;
color: #ff0000; position: relative;
}
.dot { &::before {
background: #ff0000; content: "";
position: relative; width: 15px;
height: 15px;
&::before { border-radius: 50%;
content: ""; background: #fff;
width: 15px; position: absolute;
height: 15px; left: 50%;
border-radius: 50%; top: 50%;
background: #fff; transform: translate(-50%, -50%);
position: absolute; }
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
} }
}
} }
.mer-info { .mer-info {
background-color: white; background-color: white;
padding: 20px 30px; padding: 20px 30px;
margin-top: 10px; margin-top: 10px;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
.left {
width: 50%;
text {
margin-right: 10px;
}
.address {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: -webkit-box;
-webkit-line-clamp: 1;
}
}
.right {
color: #858585;
text-align: center;
display: flex; display: flex;
flex-direction: column;
height: 120px;
justify-content: space-between; justify-content: space-between;
align-items: center;
.left { .icon {
width: 50%; display: flex;
align-items: center;
text { //margin-bottom: 20px;
margin-right: 10px;
}
.address {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: -webkit-box;
-webkit-line-clamp: 1;
}
}
.right {
color: #858585;
text-align: center;
display: flex;
flex-direction: column;
height: 120px;
justify-content: space-between;
.icon {
display: flex;
align-items: center;
//margin-bottom: 20px;
}
} }
}
} }
.btn { .btn {
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
padding: 20px; padding: 20px;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: flex-start; align-items: flex-start;
} }
.top { .top {
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
image { image {
width: 150px; width: 150px;
height: 150px; height: 150px;
} }
.title { .title {
margin-left: 10px; margin-left: 10px;
display: -webkit-box; display: -webkit-box;
overflow: hidden; overflow: hidden;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
text-overflow: ellipsis; text-overflow: ellipsis;
width: 350px; width: 350px;
} }
.right { .right {
margin-left: 10px; margin-left: 10px;
font-size: 28px; font-size: 28px;
text-align: right; text-align: right;
} }
} }
.code-box { .code-box {
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
font-size: large; font-size: large;
} }
.qrcode { .qrcode {
width: 300px; width: 300px;
height: 300px; height: 300px;
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '个人设置' navigationBarTitleText: "个人设置",
}) });

View File

@@ -1,18 +1,22 @@
<script lang="ts" setup> <script lang="ts" setup>
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
const toPage = (url: string) => { const toPage = (url: string) => {
if (url === '1') return Taro.showToast({title: '暂未开放', icon: 'none'}) if (url === "1") return Taro.showToast({ title: "暂未开放", icon: "none" });
Taro.navigateTo({ Taro.navigateTo({
url: url url: url,
}) });
} };
</script> </script>
<template> <template>
<view class="app"> <view class="app">
<nut-cell-group> <nut-cell-group>
<nut-cell title="个人信息" is-link @click="toPage('/pages/users/user_setting/index')"></nut-cell> <nut-cell
title="个人信息"
is-link
@click="toPage('/pages/users/user_setting/index')"
></nut-cell>
<nut-cell title="关于我们" is-link @click="toPage('1')"></nut-cell> <nut-cell title="关于我们" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="资质证明" is-link @click="toPage('1')"></nut-cell> <nut-cell title="资质证明" is-link @click="toPage('1')"></nut-cell>
<nut-cell title="协议规则" is-link @click="toPage('1')"></nut-cell> <nut-cell title="协议规则" is-link @click="toPage('1')"></nut-cell>
@@ -27,4 +31,4 @@ const toPage = (url: string) => {
height: 100vh; height: 100vh;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
</style> </style>

View File

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

View File

@@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {ref} from 'vue' import { ref } from "vue";
import {applyMer, getMerTypeList, getVerifyCode} from '@/api/user' import { applyMer, getMerTypeList, getVerifyCode } from "@/api/user";
import Upload from '@/components/Upload.vue' import Upload from "@/components/Upload.vue";
const visible = ref(false); const visible = ref(false);
@@ -18,24 +18,24 @@ const smsDisabled = ref(false);
// 表单数据 // 表单数据
const formValue = ref<any>({ const formValue = ref<any>({
name: "", name: "",
userName: "", userName: "",
phone: "", phone: "",
code: "", code: "",
bType: "", bType: "",
merTypeStr: "", merTypeStr: "",
classId: "", classId: "",
merGooTypeStr: "", merGooTypeStr: "",
license: [], license: [],
front: [], front: [],
back: [], back: [],
head_photo: [], head_photo: [],
img: [], img: [],
bank: "", bank: "",
bank_card: "", bank_card: "",
bank_name: "", bank_name: "",
bank_user: "", bank_user: "",
address: "", address: "",
}); });
const merGooList = ref([]); const merGooList = ref([]);
@@ -46,62 +46,62 @@ const merList = ref([]);
const ruleForm = ref<any>(null); const ruleForm = ref<any>(null);
Taro.useLoad(() => { Taro.useLoad(() => {
getMerType(); getMerType();
}); });
// 获取商户类型 // 获取商户类型
const getMerType = async () => { const getMerType = async () => {
try { try {
const res = await getMerTypeList(); const res = await getMerTypeList();
console.log(res); console.log(res);
merList.value = res.data.type.map((item: any) => { merList.value = res.data.type.map((item: any) => {
return { return {
text: item.name, text: item.name,
value: item.ID, value: item.ID,
}; };
}); });
merGooList.value = res.data.class.map((item: any) => { merGooList.value = res.data.class.map((item: any) => {
return { return {
text: item.name, text: item.name,
value: item.ID, value: item.ID,
}; };
}); });
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: "none",
}); });
} }
}; };
// 关闭弹窗 // 关闭弹窗
const onOk = async () => { const onOk = async () => {
try { try {
const data = { const data = {
...formValue.value, ...formValue.value,
license: formValue.value.license[0]?.url, license: formValue.value.license[0]?.url,
front: formValue.value.front[0]?.url, front: formValue.value.front[0]?.url,
back: formValue.value.back[0]?.url, back: formValue.value.back[0]?.url,
head_photo: formValue.value.head_photo[0]?.url, head_photo: formValue.value.head_photo[0]?.url,
img: formValue.value.img.map((item: any) => item.url).join(","), img: formValue.value.img.map((item: any) => item.url).join(","),
}; };
const res = await applyMer(data); const res = await applyMer(data);
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
}); });
setTimeout(() => { setTimeout(() => {
Taro.switchTab({ Taro.switchTab({
url: "/pages/index/index", url: "/pages/index/index",
}); });
}, 3000); }, 3000);
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: "none",
}); });
} }
visible.value = false; visible.value = false;
}; };
// 打开弹窗 // 打开弹窗
@@ -112,429 +112,429 @@ const onOk = async () => {
// 获取验证码 // 获取验证码
const getSmsCode = () => { const getSmsCode = () => {
ruleForm.value.validate("phone").then(async ({ valid }: any) => { ruleForm.value.validate("phone").then(async ({ valid }: any) => {
if (valid) { if (valid) {
try { try {
await getVerifyCode({ await getVerifyCode({
phone: formValue.value.phone.toString(), phone: formValue.value.phone.toString(),
}); });
smsDisabled.value = true; smsDisabled.value = true;
let time = 60; let time = 60;
const timer = setInterval(() => { const timer = setInterval(() => {
time--; time--;
smsStr.value = `${time}s`; smsStr.value = `${time}s`;
if (time === 0) { if (time === 0) {
clearInterval(timer); clearInterval(timer);
smsDisabled.value = false; smsDisabled.value = false;
smsStr.value = "获取验证码"; smsStr.value = "获取验证码";
} }
}, 1000); }, 1000);
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.message, title: e.message,
icon: "none", icon: "none",
}); });
} }
} }
}); });
}; };
// 选择商户类型 // 选择商户类型
const confirmMerType = (e: any) => { const confirmMerType = (e: any) => {
formValue.value.merTypeStr = e.selectedOptions[0].text; formValue.value.merTypeStr = e.selectedOptions[0].text;
formValue.value.bType = e.selectedOptions[0].value; formValue.value.bType = e.selectedOptions[0].value;
merType.value = false; merType.value = false;
}; };
// 选择经营类目 // 选择经营类目
const confirmGooType = (e: any) => { const confirmGooType = (e: any) => {
formValue.value.merGooTypeStr = e.selectedOptions[0].text; formValue.value.merGooTypeStr = e.selectedOptions[0].text;
formValue.value.classId = e.selectedOptions[0].value; formValue.value.classId = e.selectedOptions[0].value;
merGooType.value = false; merGooType.value = false;
}; };
// 提交 // 提交
const submit = () => { const submit = () => {
ruleForm.value.validate().then(({ valid, errors }: any) => { ruleForm.value.validate().then(({ valid, errors }: any) => {
if (valid) { if (valid) {
console.log("success", formValue.value); console.log("success", formValue.value);
visible.value = true; visible.value = true;
} else { } else {
console.log("error submit!!", errors); console.log("error submit!!", errors);
} }
}); });
}; };
</script> </script>
<template> <template>
<view> <view>
<nut-form ref="ruleForm" class="form" :model-value="formValue"> <nut-form ref="ruleForm" class="form" :model-value="formValue">
<nut-form-item <nut-form-item
required required
label="商户名称" label="商户名称"
prop="name" prop="name"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入商户名称', message: '请输入商户名称',
}, },
]" ]"
> >
<input <input
type="text" type="text"
v-model="formValue.name" v-model="formValue.name"
placeholder="请输入商户名称" placeholder="请输入商户名称"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="用户姓名" label="用户姓名"
prop="userName" prop="userName"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入用户姓名', message: '请输入用户姓名',
}, },
]" ]"
> >
<input <input
type="text" type="text"
v-model="formValue.userName" v-model="formValue.userName"
placeholder="请输入真实姓名" placeholder="请输入真实姓名"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="联系电话" label="联系电话"
prop="phone" prop="phone"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入正确的电话号码', message: '请输入正确的电话号码',
regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/, regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
}, },
]" ]"
> >
<input <input
type="text" type="text"
:maxlength="11" :maxlength="11"
v-model="formValue.phone" v-model="formValue.phone"
placeholder="请输入联系电话" placeholder="请输入联系电话"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入正确的店铺号码', message: '请输入正确的店铺号码',
regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/, regex: /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/,
}, },
]" ]"
label="店铺号码" label="店铺号码"
prop="phone" prop="phone"
required required
> >
<input <input
v-model="formValue.mobile" v-model="formValue.mobile"
:maxlength="11" :maxlength="11"
placeholder="请输入店铺号码" placeholder="请输入店铺号码"
type="text" type="text"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="验证码" label="验证码"
prop="code" prop="code"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入验证码', message: '请输入验证码',
}, },
]" ]"
> >
<view class="yanCode"> <view class="yanCode">
<input <input
type="text" type="text"
:maxlength="6" :maxlength="6"
v-model="formValue.code" v-model="formValue.code"
placeholder="请输入验证码" placeholder="请输入验证码"
/> />
<nut-button <nut-button
style="width: 100px; padding: 3px" style="width: 100px; padding: 3px"
plain plain
type="primary" type="primary"
size="mini" size="mini"
:disabled="smsDisabled" :disabled="smsDisabled"
round round
@click="getSmsCode" @click="getSmsCode"
> >
{{ smsStr }} {{ smsStr }}
</nut-button> </nut-button>
</view> </view>
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="店铺地址" label="店铺地址"
prop="address" prop="address"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入店铺详细地址', message: '请输入店铺详细地址',
}, },
]" ]"
> >
<input <input
type="text" type="text"
v-model="formValue.address" v-model="formValue.address"
placeholder="请输入店铺详细地址" placeholder="请输入店铺详细地址"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="法人" label="法人"
prop="bank_user" prop="bank_user"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入法人', message: '请输入法人',
}, },
]" ]"
> >
<input <input
type="text" type="text"
v-model="formValue.bank_user" v-model="formValue.bank_user"
placeholder="请输入法人" placeholder="请输入法人"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="账户名称" label="账户名称"
prop="bank_name" prop="bank_name"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入账户名称', message: '请输入账户名称',
}, },
]" ]"
> >
<input <input
type="text" type="text"
v-model="formValue.bank_name" v-model="formValue.bank_name"
placeholder="请输入账户名称" placeholder="请输入账户名称"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="开户银行" label="开户银行"
prop="bank" prop="bank"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入银行名称', message: '请输入银行名称',
}, },
]" ]"
> >
<input <input
type="text" type="text"
v-model="formValue.bank" v-model="formValue.bank"
placeholder="请输入银行名称" placeholder="请输入银行名称"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="银行卡号" label="银行卡号"
prop="bank_card" prop="bank_card"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请输入银行卡号', message: '请输入银行卡号',
}, },
]" ]"
> >
<input <input
type="text" type="text"
v-model="formValue.bank_card" v-model="formValue.bank_card"
placeholder="请输入银行卡号" placeholder="请输入银行卡号"
/> />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="商户类型" label="商户类型"
prop="merTypeStr" prop="merTypeStr"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请选择商户类型', message: '请选择商户类型',
}, },
]" ]"
> >
<input <input
type="text" type="text"
:disabled="true" :disabled="true"
v-model="formValue.merTypeStr" v-model="formValue.merTypeStr"
placeholder="请选择商户类型" placeholder="请选择商户类型"
@click="merType = true" @click="merType = true"
/> />
<nut-popup position="bottom" v-model:visible="merType"> <nut-popup position="bottom" v-model:visible="merType">
<nut-picker <nut-picker
:columns="merList" :columns="merList"
title="商户类型" title="商户类型"
@confirm="confirmMerType" @confirm="confirmMerType"
@cancel="merType = false" @cancel="merType = false"
></nut-picker> ></nut-picker>
</nut-popup> </nut-popup>
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="经营类目" label="经营类目"
prop="merGooTypeStr" prop="merGooTypeStr"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请选择经营类目', message: '请选择经营类目',
}, },
]" ]"
> >
<input <input
type="text" type="text"
:disabled="true" :disabled="true"
v-model="formValue.merGooTypeStr" v-model="formValue.merGooTypeStr"
placeholder="请选择经营类目" placeholder="请选择经营类目"
@click="merGooType = true" @click="merGooType = true"
/> />
<nut-popup position="bottom" v-model:visible="merGooType"> <nut-popup position="bottom" v-model:visible="merGooType">
<nut-picker <nut-picker
:columns="merGooList" :columns="merGooList"
title="商户类型" title="商户类型"
@confirm="confirmGooType" @confirm="confirmGooType"
@cancel="merGooType = false" @cancel="merGooType = false"
></nut-picker> ></nut-picker>
</nut-popup> </nut-popup>
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="营业执照" label="营业执照"
prop="license" prop="license"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请上传营业执照', message: '请上传营业执照',
validator: (value) => { validator: (value) => {
return value.length > 0; return value.length > 0;
}, },
}, },
]" ]"
> >
<Upload v-model:list="formValue.license" /> <Upload v-model:list="formValue.license" />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="法人身份证(正面)" label="法人身份证(正面)"
prop="front" prop="front"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '法人身份证(正面)', message: '法人身份证(正面)',
validator: (value) => { validator: (value) => {
return value.length > 0; return value.length > 0;
}, },
}, },
]" ]"
> >
<Upload v-model:list="formValue.front" /> <Upload v-model:list="formValue.front" />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="法人身份证(反面)" label="法人身份证(反面)"
prop="back" prop="back"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '法人身份证(反面)', message: '法人身份证(反面)',
validator: (value) => { validator: (value) => {
return value.length > 0; return value.length > 0;
}, },
}, },
]" ]"
> >
<Upload v-model:list="formValue.back" /> <Upload v-model:list="formValue.back" />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="门头照" label="门头照"
prop="head_photo" prop="head_photo"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请上传门头照', message: '请上传门头照',
validator: (value) => { validator: (value) => {
return value.length > 0; return value.length > 0;
}, },
}, },
]" ]"
> >
<Upload v-model:list="formValue.head_photo" /> <Upload v-model:list="formValue.head_photo" />
</nut-form-item> </nut-form-item>
<nut-form-item <nut-form-item
required required
label="店内照" label="店内照"
prop="img" prop="img"
:rules="[ :rules="[
{ {
required: true, required: true,
message: '请上传店内照至少3张', message: '请上传店内照至少3张',
validator: (value) => { validator: (value) => {
return value.length >= 3; return value.length >= 3;
}, },
}, },
]" ]"
> >
<Upload v-model:list="formValue.img" :max="5" multiple/> <Upload v-model:list="formValue.img" :max="5" multiple />
</nut-form-item> </nut-form-item>
<view class="btn"> <view class="btn">
<nut-button block type="primary" round @click="submit()" <nut-button block type="primary" round @click="submit()"
>提交</nut-button >提交</nut-button
>
</view>
</nut-form>
<!-- 入驻协议弹窗 -->
<nut-dialog
no-cancel-btn
title="入驻协议"
ok-text="已阅读并且同意"
v-model:visible="visible"
@ok="onOk"
> >
<view>入驻协议</view> </view>
</nut-dialog> </nut-form>
</view> <!-- 入驻协议弹窗 -->
<nut-dialog
no-cancel-btn
title="入驻协议"
ok-text="已阅读并且同意"
v-model:visible="visible"
@ok="onOk"
>
<view>入驻协议</view>
</nut-dialog>
</view>
</template> </template>
<style lang="scss"> <style lang="scss">
page { page {
background-image: url("~@/static/merchantBg.jpg"); background-image: url("~@/static/merchantBg.jpg");
background-size: 100%; background-size: 100%;
background-color: #e93423; background-color: #e93423;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.form { .form {
position: relative; position: relative;
top: 200px; top: 200px;
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
.btn { .btn {
padding: 20px; padding: 20px;
margin-top: 20px; margin-top: 20px;
text-align: center; text-align: center;
} }
} }
.yanCode { .yanCode {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
</style> </style>

View File

@@ -1,3 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '个人资料', navigationBarTitleText: "个人资料",
}) });

View File

@@ -10,210 +10,200 @@ import { BASE_URL } from "@/utils/request";
const userInfo = ref<any>({}); const userInfo = ref<any>({});
Taro.useLoad(() => { Taro.useLoad(() => {
const data = Taro.getStorageSync("userInfo"); const data = Taro.getStorageSync("userInfo");
userInfo.value = data; userInfo.value = data;
}); });
const logOut = () => { const logOut = () => {
Taro.showModal({ Taro.showModal({
title: "提示", title: "提示",
content: "确定退出登录吗?", content: "确定退出登录吗?",
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
Taro.removeStorageSync("token"); Taro.removeStorageSync("token");
Taro.removeStorageSync("userInfo"); Taro.removeStorageSync("userInfo");
Taro.removeStorageSync("mer_type"); Taro.removeStorageSync("mer_type");
Taro.reLaunch({ Taro.reLaunch({
url: "/pages/index/index", url: "/pages/index/index",
}); });
} else if (res.cancel) { } else if (res.cancel) {
console.log("用户点击取消"); console.log("用户点击取消");
} }
}, },
}); });
}; };
const chooseavatar = (e: any) => { const chooseavatar = (e: any) => {
Taro.uploadFile({ Taro.uploadFile({
url: `${BASE_URL}/upload`, url: `${BASE_URL}/upload`,
filePath: e.detail.avatarUrl, filePath: e.detail.avatarUrl,
name: "file", name: "file",
header: { header: {
token: Taro.getStorageSync("token"), token: Taro.getStorageSync("token"),
}, },
success: function (res) { success: function (res) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
userInfo.value.avatarUrl = data.data.data; userInfo.value.avatarUrl = data.data.data;
}, },
}); });
}; };
const subUser = async () => { const subUser = async () => {
try { try {
const reg = const reg = /^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/; if (!reg.test(userInfo.value.phone))
if (!reg.test(userInfo.value.phone)) return Taro.showToast({
return Taro.showToast({ title: "请输入正确的手机号码",
title: "请输入正确的手机号码", icon: "none",
icon: "none", });
}); const res = await editPersonalInfo(userInfo.value);
const res = await editPersonalInfo(userInfo.value); Taro.showToast({
Taro.showToast({ title: res.msg,
title: res.msg, icon: "none",
icon: "none", });
}); Taro.switchTab({
Taro.switchTab({ url: "/pages/user/index",
url: "/pages/user/index", });
}); } catch (error) {
} catch (error) { Taro.showToast({
Taro.showToast({ title: error.msg,
title: error.msg, icon: "none",
icon: "none", });
}); }
}
}; };
const getUserInfo = async () => { const getUserInfo = async () => {
try { try {
const res = await getPersonalInfo(); const res = await getPersonalInfo();
userInfo.value = res.data.data; userInfo.value = res.data.data;
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: "none",
}); });
} }
}; };
</script> </script>
<template> <template>
<view class="app"> <view class="app">
<view class="user-card"> <view class="user-card">
<view>管理我的账号</view> <view>管理我的账号</view>
<!-- {{ userInfo }} --> <!-- {{ userInfo }} -->
<view class="avatar-card"> <view class="avatar-card">
<view class="left"> <view class="left">
<nut-button <nut-button open-type="chooseAvatar" @chooseavatar="chooseavatar">
open-type="chooseAvatar" <nut-avatar size="large">
@chooseavatar="chooseavatar" <img style="border-radius: 50%" :src="userInfo.avatarUrl" />
> </nut-avatar>
<nut-avatar size="large"> </nut-button>
<img
style="border-radius: 50%"
:src="userInfo.avatarUrl"
/>
</nut-avatar>
</nut-button>
<view class="name">{{ userInfo.nickName }}</view> <view class="name">{{ userInfo.nickName }}</view>
</view>
</view>
</view>
<nut-cell-group>
<!-- :desc="userInfo.nickName" -->
<nut-cell title="昵称">
<template v-slot:link>
<nut-input
v-model="userInfo.nickName"
:border="false"
input-align="right"
placeholder="请输入昵称"
/> </template
></nut-cell>
<nut-cell title="手机号码">
<template v-slot:link>
<nut-input
v-model="userInfo.phone"
:border="false"
input-align="right"
disabled
/>
</template>
</nut-cell>
<nut-cell title="登录密码">
<template v-slot:link>
<nut-input
v-model="userInfo.password"
:border="false"
input-align="right"
placeholder="修改登录密码"
/>
</template>
</nut-cell>
<nut-cell title="注销账号" desc="账号注销后不能恢复" is-link>
</nut-cell>
</nut-cell-group>
<view class="btn">
<nut-button block @click="subUser">保存信息</nut-button>
</view>
<view class="btn">
<nut-button block type="primary" @click="logOut"
>退出登录</nut-button
>
</view> </view>
</view>
</view> </view>
<nut-cell-group>
<!-- :desc="userInfo.nickName" -->
<nut-cell title="昵称">
<template v-slot:link>
<nut-input
v-model="userInfo.nickName"
:border="false"
input-align="right"
placeholder="请输入昵称"
/> </template
></nut-cell>
<nut-cell title="手机号码">
<template v-slot:link>
<nut-input
v-model="userInfo.phone"
:border="false"
input-align="right"
disabled
/>
</template>
</nut-cell>
<nut-cell title="登录密码">
<template v-slot:link>
<nut-input
v-model="userInfo.password"
:border="false"
input-align="right"
placeholder="修改登录密码"
/>
</template>
</nut-cell>
<nut-cell title="注销账号" desc="账号注销后不能恢复" is-link> </nut-cell>
</nut-cell-group>
<view class="btn">
<nut-button block @click="subUser">保存信息</nut-button>
</view>
<view class="btn">
<nut-button block type="primary" @click="logOut">退出登录</nut-button>
</view>
</view>
</template> </template>
<style lang="scss"> <style lang="scss">
.user-card { .user-card {
width: 100%; width: 100%;
background-color: #fff; background-color: #fff;
box-sizing: border-box; box-sizing: border-box;
margin: auto; margin: auto;
position: relative; position: relative;
top: 10px; top: 10px;
padding: 30px;
.avatar-card {
background-color: rgba(255, 0, 0, 0.1);
margin: 20px auto;
border-radius: 20px;
border: 1px solid #ff0000;
display: flex;
align-items: center;
padding: 30px; padding: 30px;
position: relative;
.avatar-card { .left {
background-color: rgba(255, 0, 0, 0.1); margin-left: 10px;
margin: 20px auto; display: flex;
border-radius: 20px; align-items: center;
border: 1px solid #ff0000; position: relative;
display: flex; justify-content: space-between;
align-items: center;
padding: 30px;
position: relative;
.left { .name {
margin-left: 10px; margin-left: 10px;
display: flex; }
align-items: center; .nut-button {
position: relative; margin: 0 auto;
justify-content: space-between; width: 125px;
height: 125px;
.name { border-radius: 50%;
margin-left: 10px; }
}
.nut-button {
margin: 0 auto;
width: 125px;
height: 125px;
border-radius: 50%;
}
}
} }
}
} }
.btn { .btn {
padding: 0 40px; padding: 0 40px;
margin-bottom: 20px; margin-bottom: 20px;
} }
.nut-input { .nut-input {
width: 400px !important; width: 400px !important;
padding: 0 !important; padding: 0 !important;
} }
.nut-cell { .nut-cell {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.phoneBtn { .phoneBtn {
padding: 0 !important; padding: 0 !important;
margin: 0 !important; margin: 0 !important;
border-radius: 0 !important; border-radius: 0 !important;
background-color: transparent !important; background-color: transparent !important;
border: none !important; border: none !important;
} }
</style> </style>

View File

@@ -1,8 +1,11 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 4211210 */ font-family: "iconfont"; /* Project id 4211210 */
src: url('https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.woff2?t=1692081500100') format('woff2'), src: url("https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.woff2?t=1692081500100")
url('https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.woff?t=1692081500100') format('woff'), format("woff2"),
url('https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.ttf?t=1692081500100') format('truetype'); url("https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.woff?t=1692081500100")
format("woff"),
url("https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.ttf?t=1692081500100")
format("truetype");
} }
.iconfont { .iconfont {
@@ -136,4 +139,3 @@
.icon-fontbgcolor-copy:before { .icon-fontbgcolor-copy:before {
content: "\eae7"; content: "\eae7";
} }

View File

@@ -1,8 +1,11 @@
@font-face { @font-face {
font-family: "iconfont"; /* Project id 993865 */ font-family: "iconfont"; /* Project id 993865 */
src: url('https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.woff2?t=1681715156711') format('woff2'), src: url("https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.woff2?t=1681715156711")
url('https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.woff?t=1681715156711') format('woff'), format("woff2"),
url('https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.ttf?t=1681715156711') format('truetype'); url("https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.woff?t=1681715156711")
format("woff"),
url("https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.ttf?t=1681715156711")
format("truetype");
} }
.iconfont { .iconfont {

View File

@@ -2,22 +2,29 @@ import { showToast, navigateBack } from "@tarojs/taro";
// 经纬度计算距离 // 经纬度计算距离
export function calculateDistance( export function calculateDistance(
la1: number, la1: number,
lo1: number, lo1: number,
la2: number, la2: number,
lo2: number lo2: number
): any { ): any {
var radLat1 = la1 * Math.PI / 180.0; var radLat1 = (la1 * Math.PI) / 180.0;
var radLat2 = la2 * Math.PI / 180.0; var radLat2 = (la2 * Math.PI) / 180.0;
var a = radLat1 - radLat2; var a = radLat1 - radLat2;
var b = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0; var b = (lo1 * Math.PI) / 180.0 - (lo2 * Math.PI) / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))); var s =
s = s * 6378.137; 2 *
s = Math.round(s * 10000) / 10000; Math.asin(
return s.toFixed(2) + 'km' Math.sqrt(
Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)
)
);
s = s * 6378.137;
s = Math.round(s * 10000) / 10000;
return s.toFixed(2) + "km";
} }
// 将角度转换为弧度 // 将角度转换为弧度
function toRadians(degrees: number): number { function toRadians(degrees: number): number {
return (degrees * Math.PI) / 180; return (degrees * Math.PI) / 180;
} }

Some files were not shown because too many files have changed in this diff Show More