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_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
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
module.exports = {
presets: [
['taro', {
framework: 'vue3',
ts: true
}]
]
}
[
"taro",
{
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
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {},
mini: {},
h5: {}
}
env: {
NODE_ENV: '"development"',
},
defineConstants: {},
mini: {},
h5: {},
};

View File

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

View File

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

View File

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

26981
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,122 +1,116 @@
<template>
<view>
<view class="header">
<view>订单号:{{ info.oid }}</view>
<view>{{ info.add_time }}</view>
</view>
<view class="good-info">
<view class="top">
<image :src="info.BindGoods?.cover" />
<view class="title">{{ info.BindGoods?.name }}</view>
</view>
<view class="public-total">
{{ info.count }}件商品已支付
<text class="money">{{ info.number }}</text>
</view>
</view>
<nut-cell-group>
<nut-cell title="订单状态:" :desc="orderStatus"></nut-cell>
<nut-cell
title="下单用户:"
:desc="info.BindUser?.nickName"
></nut-cell>
<nut-cell
title="用户手机号:"
:desc="info.BindUser?.phone"
></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人员:"
:desc="info.BindCancelUser?.nickName"
></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人手机号:"
:desc="info.BindCancelUser?.phone"
></nut-cell>
</nut-cell-group>
<view>
<view class="header">
<view>订单号:{{ info.oid }}</view>
<view>{{ info.add_time }}</view>
</view>
<view class="good-info">
<view class="top">
<image :src="info.BindGoods?.cover" />
<view class="title">{{ info.BindGoods?.name }}</view>
</view>
<view class="public-total">
{{ info.count }}件商品已支付
<text class="money">{{ info.number }}</text>
</view>
</view>
<nut-cell-group>
<nut-cell title="订单状态:" :desc="orderStatus"></nut-cell>
<nut-cell title="下单用户:" :desc="info.BindUser?.nickName"></nut-cell>
<nut-cell title="用户手机号:" :desc="info.BindUser?.phone"></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人员:"
:desc="info.BindCancelUser?.nickName"
></nut-cell>
<nut-cell
v-if="info.status === 2"
title="核销人手机号:"
:desc="info.BindCancelUser?.phone"
></nut-cell>
</nut-cell-group>
</view>
</template>
<script setup lang="ts">
import Taro from "@tarojs/taro";
import { ref, computed } from "vue";
import { ref } from "vue";
const info = ref<any>({});
Taro.useLoad(() => {
info.value = Taro.getStorageSync("ver_order_info");
info.value = Taro.getStorageSync("ver_order_info");
});
const orderStatus = computed(() => {
switch (info.value.status) {
case 1:
return "待核销";
case 2:
return "已核销";
case 3:
return "已失效";
}
});
const orderStatus = () => {
switch (info.value.status) {
case 1:
return "待核销";
case 2:
return "已核销";
case 3:
return "已失效";
}
};
</script>
<style lang="scss">
page {
--nut-cell-desc-color: #000;
--nut-cell-desc-color: #000;
}
.header {
background: linear-gradient(90deg, #2291f8 0, #1cd1dc);
padding: 30px;
color: #fff;
font-size: 30px;
background: linear-gradient(90deg, #2291f8 0, #1cd1dc);
padding: 30px;
color: #fff;
font-size: 30px;
}
.user-info {
background-color: #fff;
width: 100%;
background-color: #fff;
width: 100%;
}
.good-info {
margin-top: 20px;
width: 100%;
margin-top: 20px;
width: 100%;
background-color: #fff;
padding: 20px;
.top {
display: flex;
justify-content: space-between;
align-items: flex-start;
image {
width: 200px;
height: 200px;
}
.title {
flex: 1;
padding: 10px;
}
.price {
text-align: right;
}
}
.public-total {
font-size: 28px;
color: #282828;
border-top: 1px solid #eee;
height: 92px;
line-height: 92px;
text-align: right;
padding: 0 30px;
background-color: #fff;
padding: 20px;
}
.top {
display: flex;
justify-content: space-between;
align-items: flex-start;
image {
width: 200px;
height: 200px;
}
.title {
flex: 1;
padding: 10px;
}
.price {
text-align: right;
}
}
.public-total {
font-size: 28px;
color: #282828;
border-top: 1px solid #eee;
height: 92px;
line-height: 92px;
text-align: right;
padding: 0 30px;
background-color: #fff;
}
.public-total .money {
color: #ff4c3c;
}
.public-total .money {
color: #ff4c3c;
}
}
</style>

View File

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

View File

@@ -1,114 +1,104 @@
<template>
<view>
<view class="Card">
<view>全部订单</view>
<view class="orderinfo">
<view class="info" @click="toListPage(0)">
<view class="num">{{ orderInfo?.count?.A || 0 }}</view>
<view class="sub">全部</view>
</view>
<view class="info" @click="toListPage(1)">
<view class="num">{{ orderInfo?.count?.B || 0 }}</view>
<view class="sub">待付款</view>
</view>
<view class="info" @click="toListPage(2)">
<view class="num">{{ orderInfo?.count?.C || 0 }}</view>
<view class="sub">待核销</view>
</view>
<view class="info" @click="toListPage(3)">
<view class="num">{{ orderInfo?.count?.D || 0 }}</view>
<view class="sub">已核销</view>
</view>
<view class="info" @click="toListPage(4)">
<view class="num">{{ orderInfo?.count?.F || 0 }}</view>
<view class="sub">已过期</view>
</view>
</view>
<view>
<view class="Card">
<view>全部订单</view>
<view class="orderinfo">
<view class="info" @click="toListPage(0)">
<view class="num">{{ orderInfo?.count?.A || 0 }}</view>
<view class="sub">全部</view>
</view>
<view class="Card">
<view class="top"
><text class="iconfont icon-shujutongji icon"></text
><text>数据统计</text></view
>
<view class="gridBox">
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=today`"
>
<view class="title">{{
orderInfo?.total?.TodayNumber || 0
}}</view>
<view class="sub">今日成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=yesterday`"
>
<view class="title">{{
orderInfo?.total?.YesterdayNumber || 0
}}</view>
<view class="sub">昨日成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=month`"
>
<view class="title">{{
orderInfo?.total?.MonthNumber || 0
}}</view>
<view class="sub">本月成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=today`"
>
<view class="title">{{
orderInfo?.total?.TodayOrder || 0
}}</view>
<view class="sub">今日订单数</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=yesterday`"
>
<view class="title">{{
orderInfo?.total?.YesterdayOrder || 0
}}</view>
<view class="sub">昨日订单数</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=month`"
>
<view class="title">{{
orderInfo?.total?.MonthOrder || 0
}}</view>
<view class="sub">本月订单数</view>
</navigator>
</view>
<view class="info" @click="toListPage(1)">
<view class="num">{{ orderInfo?.count?.B || 0 }}</view>
<view class="sub">待付款</view>
</view>
<view class="Card">
<view class="top"
><text class="iconfont icon-xiangxishuju icon"></text
><text>详细数据</text></view
>
<view v-if="orderInfo?.list?.length > 0">
<nut-table
:bordered="true"
class="table"
:columns="columns"
:data="orderInfo?.list"
></nut-table>
</view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
<view class="info" @click="toListPage(2)">
<view class="num">{{ orderInfo?.count?.C || 0 }}</view>
<view class="sub">待核销</view>
</view>
<view class="info" @click="toListPage(3)">
<view class="num">{{ orderInfo?.count?.D || 0 }}</view>
<view class="sub">已核销</view>
</view>
<view class="info" @click="toListPage(4)">
<view class="num">{{ orderInfo?.count?.F || 0 }}</view>
<view class="sub">已过期</view>
</view>
</view>
</view>
<view class="Card">
<view class="top"
><text class="iconfont icon-shujutongji icon"></text
><text>数据统计</text></view
>
<view class="gridBox">
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=today`"
>
<view class="title">{{ orderInfo?.total?.TodayNumber || 0 }}</view>
<view class="sub">今日成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=yesterday`"
>
<view class="title">{{
orderInfo?.total?.YesterdayNumber || 0
}}</view>
<view class="sub">昨日成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=price&time=month`"
>
<view class="title">{{ orderInfo?.total?.MonthNumber || 0 }}</view>
<view class="sub">本月成交额</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=today`"
>
<view class="title">{{ orderInfo?.total?.TodayOrder || 0 }}</view>
<view class="sub">今日订单数</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=yesterday`"
>
<view class="title">{{ orderInfo?.total?.YesterdayOrder || 0 }}</view>
<view class="sub">昨日订单数</view>
</navigator>
<navigator
class="item"
hover-class="none"
:url="`/pages/admin/statistics/index?type=order&time=month`"
>
<view class="title">{{ orderInfo?.total?.MonthOrder || 0 }}</view>
<view class="sub">本月订单数</view>
</navigator>
</view>
</view>
<view class="Card">
<view class="top"
><text class="iconfont icon-xiangxishuju icon"></text
><text>详细数据</text></view
>
<view v-if="orderInfo?.list?.length > 0">
<nut-table
:bordered="true"
class="table"
:columns="columns"
:data="orderInfo?.list"
></nut-table>
</view>
<nut-empty v-else description="暂无订单数据"></nut-empty>
</view>
</view>
</template>
<script lang="ts" setup>
@@ -117,121 +107,121 @@ import Taro from "@tarojs/taro";
import { orderStatistics } from "../../../api/admin";
Taro.useLoad(() => {
getData();
getData();
});
const orderInfo = ref<any>({});
const columns = ref([
{
title: "日期",
key: "Date",
align: "center",
},
{
title: "订单数",
key: "TotalCount",
align: "center",
},
{
title: "交易额",
key: "NumberSum",
align: "center",
render: (row) => {
return h(
"view",
{
style: {
color: "red",
},
},
row.NumberSum
);
{
title: "日期",
key: "Date",
align: "center",
},
{
title: "订单数",
key: "TotalCount",
align: "center",
},
{
title: "交易额",
key: "NumberSum",
align: "center",
render: (row) => {
return h(
"view",
{
style: {
color: "red",
},
},
row.NumberSum
);
},
},
]);
const getData = async () => {
const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo");
const res = await orderStatistics({
bid: user_info.bid,
type: mer_type,
});
orderInfo.value = res.data;
const mer_type = Taro.getStorageSync("mer_type");
const user_info = Taro.getStorageSync("userInfo");
const res = await orderStatistics({
bid: user_info.bid,
type: mer_type,
});
orderInfo.value = res.data;
};
const toListPage = (index: number) => {
Taro.navigateTo({
url: `/pages/admin/order_manage/list/index?type=${index}`,
});
Taro.navigateTo({
url: `/pages/admin/order_manage/list/index?type=${index}`,
});
};
</script>
<style lang="scss">
.Card {
width: 90%;
background-color: #fff;
border-radius: 10px;
margin: 10px auto;
padding: 25px;
width: 90%;
background-color: #fff;
border-radius: 10px;
margin: 10px auto;
padding: 25px;
.top {
display: flex;
align-items: center;
text {
margin-right: 5px;
}
.top {
display: flex;
align-items: center;
text {
margin-right: 5px;
}
}
}
.icon {
color: red;
color: red;
}
.gridBox {
width: 100%;
height: 100%;
display: grid;
grid-template-columns: repeat(3, 33.33%);
grid-template-rows: repeat(3, 33.33%);
grid-gap: 10px;
justify-content: center;
text-align: center;
width: 100%;
height: 100%;
display: grid;
grid-template-columns: repeat(3, 33.33%);
grid-template-rows: repeat(3, 33.33%);
grid-gap: 10px;
justify-content: center;
text-align: center;
.item {
margin-top: 50px;
.title {
font-size: 50px;
}
.sub {
font-size: 25px;
color: #999;
}
.item {
margin-top: 50px;
.title {
font-size: 50px;
}
.sub {
font-size: 25px;
color: #999;
}
}
}
.table {
margin-top: 10px;
margin-top: 10px;
}
.orderinfo {
display: flex;
justify-content: space-between;
margin-top: 20px;
align-items: center;
.info {
text-align: center;
display: flex;
justify-content: space-between;
margin-top: 20px;
align-items: center;
.info {
text-align: center;
.num {
font-size: 40px;
color: red;
}
.sub {
font-size: 25px;
color: #999;
}
.num {
font-size: 40px;
color: red;
}
.sub {
font-size: 25px;
color: #999;
}
}
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,56 +1,53 @@
<template>
<view class="app">
<view class="bg">
<view class="card">
<view class="left">
<view>嘎嘎酒吧</view>
<view>18888888888</view>
<view>广西壮族自治区南宁市江南区</view>
</view>
<view class="right" @click="toLocal">
<Find class="icon" />
<view class="text">距离我{{ distance }}km</view>
</view>
</view>
<view class="app">
<view class="bg">
<view class="card">
<view class="left">
<view>嘎嘎酒吧</view>
<view>18888888888</view>
<view>广西壮族自治区南宁市江南区</view>
</view>
<view class="order-info">21312312</view>
<nut-form>
<nut-form-item body-align="right" label="用户姓名">
<nut-input
:border="false"
v-model="basicData.name"
placeholder="请输入姓名"
type="text"
/>
</nut-form-item>
<nut-form-item body-align="right" label="联系电话">
<nut-input
:border="false"
v-model="basicData.phone"
placeholder="请输入联系电话"
type="text"
/>
</nut-form-item>
<nut-form-item body-align="right" label="订单备注">
<nut-textarea
class="nut-input-text"
v-model="basicData.notes"
placeholder="请输入备注"
type="text"
/>
</nut-form-item>
</nut-form>
<!-- 底部 -->
<view class="bottom-box">
<view
>总计<nut-price
:price="8888.01"
position="after"
symbol="积分"
/></view>
<nut-button type="primary" @click="orderPay">提交订单</nut-button>
<view class="right" @click="toLocal">
<Find class="icon" />
<view class="text">距离我{{ distance }}km</view>
</view>
</view>
</view>
<view class="order-info">21312312</view>
<nut-form>
<nut-form-item body-align="right" label="用户姓名">
<nut-input
:border="false"
v-model="basicData.name"
placeholder="请输入姓名"
type="text"
/>
</nut-form-item>
<nut-form-item body-align="right" label="联系电话">
<nut-input
:border="false"
v-model="basicData.phone"
placeholder="请输入联系电话"
type="text"
/>
</nut-form-item>
<nut-form-item body-align="right" label="订单备注">
<nut-textarea
class="nut-input-text"
v-model="basicData.notes"
placeholder="请输入备注"
type="text"
/>
</nut-form-item>
</nut-form>
<!-- 底部 -->
<view class="bottom-box">
<view
>总计<nut-price :price="8888.01" position="after" symbol="积分"
/></view>
<nut-button type="primary" @click="orderPay">提交订单</nut-button>
</view>
</view>
</template>
<script setup lang="ts">
@@ -62,122 +59,122 @@ import { ref } from "vue";
const distance = ref("");
const basicData = ref({
name: "",
phone: "",
notes: "",
name: "",
phone: "",
notes: "",
});
Taro.useLoad(() => {
Taro.getLocation({
type: "wgs84",
success: function (res) {
const latitude = res.latitude;
const longitude = res.longitude;
distance.value = calculateDistance(
108.24898,
22.83646,
longitude,
latitude
);
},
});
Taro.getLocation({
type: "wgs84",
success: function (res) {
const latitude = res.latitude;
const longitude = res.longitude;
distance.value = calculateDistance(
108.24898,
22.83646,
longitude,
latitude
);
},
});
});
const toLocal = () => {
Taro.openLocation({
latitude: 22.83646,
longitude: 108.24898,
scale: 18,
});
Taro.openLocation({
latitude: 22.83646,
longitude: 108.24898,
scale: 18,
});
};
const orderPay = () => {
Taro.showToast({
title: "支付成功",
icon: "success",
success: () => {
setTimeout(() => {
Taro.redirectTo({
url: "/pages/goods/order_status/index",
});
}, 2000);
},
});
Taro.showToast({
title: "支付成功",
icon: "success",
success: () => {
setTimeout(() => {
Taro.redirectTo({
url: "/pages/goods/order_status/index",
});
}, 2000);
},
});
};
</script>
<style lang="scss">
.bg {
background: linear-gradient(0deg, #f5f5f5, #0396ffc7);
background-size: 100% 100%;
background-repeat: no-repeat;
padding: 10px 0;
background: linear-gradient(0deg, #f5f5f5, #0396ffc7);
background-size: 100% 100%;
background-repeat: no-repeat;
padding: 10px 0;
.card {
width: 90%;
height: 75%;
margin: 0 auto;
background: #fff;
border-radius: 10px;
padding: 20px;
margin-top: 20px;
position: relative;
border-bottom: 1px dashed #ccc;
display: flex;
align-items: center;
justify-content: space-evenly;
.left {
width: 70%;
color: #333;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.right {
width: 30%;
text-align: center;
.icon {
font-size: 50px;
}
.text {
font-size: 25px;
color: #999;
}
}
}
}
.order-info {
.card {
width: 90%;
height: 75%;
margin: 0 auto;
background: #fff;
border-radius: 10px;
padding: 20px;
margin-top: 20px;
position: relative;
border-bottom: 1px dashed #ccc;
display: flex;
align-items: center;
justify-content: space-evenly;
margin-bottom: 10px;
.left {
width: 70%;
color: #333;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.right {
width: 30%;
text-align: center;
.icon {
font-size: 50px;
}
.text {
font-size: 25px;
color: #999;
}
}
}
}
.order-info {
background: #fff;
padding: 20px;
position: relative;
display: flex;
align-items: center;
justify-content: space-evenly;
margin-bottom: 10px;
}
.nut-input-text {
height: 100px;
height: 100px;
}
.bottom-box {
position: fixed;
bottom: 0;
width: 100%;
box-sizing: border-box;
height: 9vh;
background: #fff;
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
position: fixed;
bottom: 0;
width: 100%;
box-sizing: border-box;
height: 9vh;
background: #fff;
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 10px;
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,3 @@
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({
navigationBarTitleText: '个人中心',
navigationStyle: 'custom'
})
navigationBarTitleText: "个人中心",
navigationStyle: "custom",
});

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,12 +5,12 @@ import { getVerifyCode, phoneLogin } from "@/api/user";
import logoImg from "../../../static/logo.jpg";
Taro.useLoad((options) => {
console.log(options);
console.log(options);
});
const basicData = ref({
phone: "",
code: "",
phone: "",
code: "",
});
const smsDisabled = ref(false);
@@ -19,148 +19,146 @@ const smsStr = ref("获取验证码");
// 获取验证码
const getSmsCode = async () => {
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
await getVerifyCode({
phone: basicData.value.phone.toString(),
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
smsDisabled.value = true;
let time = 60;
const timer = setInterval(() => {
time--;
smsStr.value = `${time}s`;
if (time === 0) {
clearInterval(timer);
smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
await getVerifyCode({
phone: basicData.value.phone.toString(),
});
smsDisabled.value = true;
let time = 60;
const timer = setInterval(() => {
time--;
smsStr.value = `${time}s`;
if (time === 0) {
clearInterval(timer);
smsDisabled.value = false;
smsStr.value = "获取验证码";
}
}, 1000);
};
const login = async () => {
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
if (
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
basicData.value.phone
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
if (!basicData.value.code)
return Taro.showToast({
title: "请输入验证码",
icon: "none",
});
)
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
if (!basicData.value.code)
return Taro.showToast({
title: "请输入验证码",
icon: "none",
});
const res = await phoneLogin({
Phone: basicData.value.phone,
Code: basicData.value.code,
Referee: Taro.getStorageSync("bind_id") || "",
const res = await phoneLogin({
Phone: basicData.value.phone,
Code: basicData.value.code,
Referee: Taro.getStorageSync("bind_id") || "",
});
Taro.showToast({
title: res.msg,
icon: "success",
duration: 2000,
});
Taro.setStorageSync("token", res.data.token);
setTimeout(() => {
Taro.removeStorageSync("bind_id");
Taro.switchTab({
url: "/pages/user/index",
});
Taro.showToast({
title: res.msg,
icon: "success",
duration: 2000,
});
Taro.setStorageSync("token", res.data.token);
setTimeout(() => {
Taro.removeStorageSync("bind_id");
Taro.switchTab({
url: "/pages/user/index",
});
}, 2000);
}, 2000);
};
</script>
<template>
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-form :model-value="basicData" ref="RefForm">
<nut-form-item label="手机号码:">
<nut-input
v-model="basicData.phone"
class="nut-input-text"
placeholder="请输入手机号码"
type="text"
/>
</nut-form-item>
<nut-form-item label="验证码:">
<view style="display: flex">
<nut-input
v-model="basicData.code"
class="nut-input-text"
placeholder="请输入验证码"
type="text"
/>
<nut-button
size="mini"
style="margin-left: 10px"
@click="getSmsCode"
:disabled="smsDisabled"
>{{ smsStr }}</nut-button
>
</view>
</nut-form-item>
<nut-form-item>
<nut-button type="primary" block @click="login"
>登录</nut-button
>
</nut-form-item>
</nut-form>
</view>
<view class="wrapper">
<image src="../../../static/wechat_login.jpg" />
<view class="logo">
<image :src="logoImg" />
<view>捷兑通</view>
</view>
<view class="center">
<nut-form :model-value="basicData" ref="RefForm">
<nut-form-item label="手机号码:">
<nut-input
v-model="basicData.phone"
class="nut-input-text"
placeholder="请输入手机号码"
type="text"
/>
</nut-form-item>
<nut-form-item label="验证码:">
<view style="display: flex">
<nut-input
v-model="basicData.code"
class="nut-input-text"
placeholder="请输入验证码"
type="text"
/>
<nut-button
size="mini"
style="margin-left: 10px"
@click="getSmsCode"
:disabled="smsDisabled"
>{{ smsStr }}</nut-button
>
</view>
</nut-form-item>
<nut-form-item>
<nut-button type="primary" block @click="login">登录</nut-button>
</nut-form-item>
</nut-form>
</view>
</view>
</template>
<style lang="scss">
page {
background: #fff;
background: #fff;
}
.wrapper {
position: relative;
position: relative;
image {
width: 100%;
height: 838px;
}
.logo {
position: absolute;
top: 35%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 100%;
height: 838px;
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.logo {
position: absolute;
top: 35%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 35px;
line-height: 70px;
image {
width: 200px;
height: 200px;
border-radius: 50%;
}
}
.center {
position: absolute;
top: 55%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 0px 10px;
}
.center {
position: absolute;
top: 55%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding: 0px 10px;
}
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,18 +1,22 @@
<script lang="ts" setup>
import Taro from '@tarojs/taro'
import Taro from "@tarojs/taro";
const toPage = (url: string) => {
if (url === '1') return Taro.showToast({title: '暂未开放', icon: 'none'})
if (url === "1") return Taro.showToast({ title: "暂未开放", icon: "none" });
Taro.navigateTo({
url: url
})
}
url: url,
});
};
</script>
<template>
<view class="app">
<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>
@@ -27,4 +31,4 @@ const toPage = (url: string) => {
height: 100vh;
background-color: #f5f5f5;
}
</style>
</style>

View File

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

View File

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

View File

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

View File

@@ -10,210 +10,200 @@ import { BASE_URL } from "@/utils/request";
const userInfo = ref<any>({});
Taro.useLoad(() => {
const data = Taro.getStorageSync("userInfo");
userInfo.value = data;
const data = Taro.getStorageSync("userInfo");
userInfo.value = data;
});
const logOut = () => {
Taro.showModal({
title: "提示",
content: "确定退出登录吗?",
success: function (res) {
if (res.confirm) {
Taro.removeStorageSync("token");
Taro.removeStorageSync("userInfo");
Taro.removeStorageSync("mer_type");
Taro.reLaunch({
url: "/pages/index/index",
});
} else if (res.cancel) {
console.log("用户点击取消");
}
},
});
Taro.showModal({
title: "提示",
content: "确定退出登录吗?",
success: function (res) {
if (res.confirm) {
Taro.removeStorageSync("token");
Taro.removeStorageSync("userInfo");
Taro.removeStorageSync("mer_type");
Taro.reLaunch({
url: "/pages/index/index",
});
} else if (res.cancel) {
console.log("用户点击取消");
}
},
});
};
const chooseavatar = (e: any) => {
Taro.uploadFile({
url: `${BASE_URL}/upload`,
filePath: e.detail.avatarUrl,
name: "file",
header: {
token: Taro.getStorageSync("token"),
},
success: function (res) {
const data = JSON.parse(res.data);
userInfo.value.avatarUrl = data.data.data;
},
});
Taro.uploadFile({
url: `${BASE_URL}/upload`,
filePath: e.detail.avatarUrl,
name: "file",
header: {
token: Taro.getStorageSync("token"),
},
success: function (res) {
const data = JSON.parse(res.data);
userInfo.value.avatarUrl = data.data.data;
},
});
};
const subUser = async () => {
try {
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}$/;
if (!reg.test(userInfo.value.phone))
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
const res = await editPersonalInfo(userInfo.value);
Taro.showToast({
title: res.msg,
icon: "none",
});
Taro.switchTab({
url: "/pages/user/index",
});
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
try {
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}$/;
if (!reg.test(userInfo.value.phone))
return Taro.showToast({
title: "请输入正确的手机号码",
icon: "none",
});
const res = await editPersonalInfo(userInfo.value);
Taro.showToast({
title: res.msg,
icon: "none",
});
Taro.switchTab({
url: "/pages/user/index",
});
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
};
const getUserInfo = async () => {
try {
const res = await getPersonalInfo();
userInfo.value = res.data.data;
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
try {
const res = await getPersonalInfo();
userInfo.value = res.data.data;
} catch (error) {
Taro.showToast({
title: error.msg,
icon: "none",
});
}
};
</script>
<template>
<view class="app">
<view class="user-card">
<view>管理我的账号</view>
<!-- {{ userInfo }} -->
<view class="avatar-card">
<view class="left">
<nut-button
open-type="chooseAvatar"
@chooseavatar="chooseavatar"
>
<nut-avatar size="large">
<img
style="border-radius: 50%"
:src="userInfo.avatarUrl"
/>
</nut-avatar>
</nut-button>
<view class="app">
<view class="user-card">
<view>管理我的账号</view>
<!-- {{ userInfo }} -->
<view class="avatar-card">
<view class="left">
<nut-button open-type="chooseAvatar" @chooseavatar="chooseavatar">
<nut-avatar size="large">
<img style="border-radius: 50%" :src="userInfo.avatarUrl" />
</nut-avatar>
</nut-button>
<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 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>
</template>
<style lang="scss">
.user-card {
width: 100%;
background-color: #fff;
box-sizing: border-box;
margin: auto;
position: relative;
top: 10px;
width: 100%;
background-color: #fff;
box-sizing: border-box;
margin: auto;
position: relative;
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;
position: relative;
.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;
position: relative;
.left {
margin-left: 10px;
display: flex;
align-items: center;
position: relative;
justify-content: space-between;
.left {
margin-left: 10px;
display: flex;
align-items: center;
position: relative;
justify-content: space-between;
.name {
margin-left: 10px;
}
.nut-button {
margin: 0 auto;
width: 125px;
height: 125px;
border-radius: 50%;
}
}
.name {
margin-left: 10px;
}
.nut-button {
margin: 0 auto;
width: 125px;
height: 125px;
border-radius: 50%;
}
}
}
}
.btn {
padding: 0 40px;
margin-bottom: 20px;
padding: 0 40px;
margin-bottom: 20px;
}
.nut-input {
width: 400px !important;
padding: 0 !important;
width: 400px !important;
padding: 0 !important;
}
.nut-cell {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
.phoneBtn {
padding: 0 !important;
margin: 0 !important;
border-radius: 0 !important;
background-color: transparent !important;
border: none !important;
padding: 0 !important;
margin: 0 !important;
border-radius: 0 !important;
background-color: transparent !important;
border: none !important;
}
</style>

View File

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

View File

@@ -1,8 +1,11 @@
@font-face {
font-family: "iconfont"; /* Project id 993865 */
src: url('https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.woff2?t=1681715156711') format('woff2'),
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');
src: url("https://at.alicdn.com/t/c/font_993865_zmqjk4lvax.woff2?t=1681715156711")
format("woff2"),
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 {

View File

@@ -2,22 +2,29 @@ import { showToast, navigateBack } from "@tarojs/taro";
// 经纬度计算距离
export function calculateDistance(
la1: number,
lo1: number,
la2: number,
lo2: number
la1: number,
lo1: number,
la2: number,
lo2: number
): any {
var radLat1 = la1 * Math.PI / 180.0;
var radLat2 = la2 * Math.PI / 180.0;
var a = radLat1 - radLat2;
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)));
s = s * 6378.137;
s = Math.round(s * 10000) / 10000;
return s.toFixed(2) + 'km'
var radLat1 = (la1 * Math.PI) / 180.0;
var radLat2 = (la2 * Math.PI) / 180.0;
var a = radLat1 - radLat2;
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)
)
);
s = s * 6378.137;
s = Math.round(s * 10000) / 10000;
return s.toFixed(2) + "km";
}
// 将角度转换为弧度
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