Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-05-29 15:10:19 +08:00
92 changed files with 3868 additions and 22588 deletions

View File

@@ -8,7 +8,8 @@ TARO_APP_KEY='1234567890'
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app' TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
# 骰子游戏链接 # 骰子游戏链接
TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid=' # TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid='
TARO_APP_GAME='http://192.168.31.225:10086?uid='
# 捕鱼游戏链接 # 捕鱼游戏链接
TARO_APP_FISH_GAME='https://jdt-test-fish.wanzhuanyongcheng.cn/?uid=' TARO_APP_FISH_GAME='https://jdt-test-fish.wanzhuanyongcheng.cn/?uid='

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ deploy_versions/
node_modules/ node_modules/
.DS_Store .DS_Store
.swc .swc
pnpm-lock.yaml

7
.prettierrc.json Normal file
View File

@@ -0,0 +1,7 @@
{
"arrowParens": "avoid",
"bracketSameLine": true,
"bracketSpacing": false,
"singleQuote": true,
"trailingComma": "all"
}

View File

@@ -3,9 +3,9 @@
module.exports = { module.exports = {
presets: [ presets: [
[ [
"taro", 'taro',
{ {
framework: "vue3", framework: 'vue3',
ts: true, ts: true,
}, },
], ],

8
components.d.ts vendored
View File

@@ -29,12 +29,17 @@ declare module '@vue/runtime-core' {
NutImagePreview: typeof import('@nutui/nutui-taro')['ImagePreview'] NutImagePreview: typeof import('@nutui/nutui-taro')['ImagePreview']
NutInput: typeof import('@nutui/nutui-taro')['Input'] NutInput: typeof import('@nutui/nutui-taro')['Input']
NutInputNumber: typeof import('@nutui/nutui-taro')['InputNumber'] NutInputNumber: typeof import('@nutui/nutui-taro')['InputNumber']
NutNumberKeyboard: typeof import('@nutui/nutui-taro')['NumberKeyboard']
NutOverlay: typeof import('@nutui/nutui-taro')['Overlay'] NutOverlay: typeof import('@nutui/nutui-taro')['Overlay']
NutPagination: typeof import('@nutui/nutui-taro')['Pagination'] NutPagination: typeof import('@nutui/nutui-taro')['Pagination']
NutPicker: typeof import('@nutui/nutui-taro')['Picker'] NutPicker: typeof import('@nutui/nutui-taro')['Picker']
NutPopover: typeof import('@nutui/nutui-taro')['Popover']
NutPopup: typeof import('@nutui/nutui-taro')['Popup'] NutPopup: typeof import('@nutui/nutui-taro')['Popup']
NutPrice: typeof import('@nutui/nutui-taro')['Price'] NutPrice: typeof import('@nutui/nutui-taro')['Price']
NutSearchbar: typeof import('@nutui/nutui-taro')['Searchbar'] NutRadio: typeof import('@nutui/nutui-taro')['Radio']
NutRadioGroup: typeof import('@nutui/nutui-taro')['RadioGroup']
NutRate: typeof import('@nutui/nutui-taro')['Rate']
NutShortPassword: typeof import('@nutui/nutui-taro')['ShortPassword']
NutSwiper: typeof import('@nutui/nutui-taro')['Swiper'] NutSwiper: typeof import('@nutui/nutui-taro')['Swiper']
NutSwiperItem: typeof import('@nutui/nutui-taro')['SwiperItem'] NutSwiperItem: typeof import('@nutui/nutui-taro')['SwiperItem']
NutSwitch: typeof import('@nutui/nutui-taro')['Switch'] NutSwitch: typeof import('@nutui/nutui-taro')['Switch']
@@ -46,6 +51,7 @@ declare module '@vue/runtime-core' {
Pay: typeof import('./src/components/Pay.vue')['default'] Pay: typeof import('./src/components/Pay.vue')['default']
Popup: typeof import('./src/components/Popup.vue')['default'] Popup: typeof import('./src/components/Popup.vue')['default']
RichEditor: typeof import('./src/components/RichEditor.vue')['default'] RichEditor: typeof import('./src/components/RichEditor.vue')['default']
StoreList: typeof import('./src/components/StoreList.vue')['default']
Ucharts: typeof import('./src/components/Ucharts.vue')['default'] Ucharts: typeof import('./src/components/Ucharts.vue')['default']
Upload: typeof import('./src/components/Upload.vue')['default'] Upload: typeof import('./src/components/Upload.vue')['default']
UserModal: typeof import('./src/components/UserModal.vue')['default'] UserModal: typeof import('./src/components/UserModal.vue')['default']

View File

@@ -1,10 +1,11 @@
// @ts-nocheck // @ts-nocheck
import Components from "unplugin-vue-components/webpack"; import Components from 'unplugin-vue-components/webpack';
import NutUIResolver from "@nutui/nutui-taro/dist/resolver"; import NutUIResolver from '@nutui/nutui-taro/dist/resolver';
import { join } from "node:path"; import {UnifiedWebpackPluginV5} from 'weapp-tailwindcss/webpack';
import { argv } from "yargs"; import {join} from 'node:path';
import {argv} from 'yargs';
const { robot = 1, desc } = argv; const {robot = 1, desc} = argv;
const CIPluginOptFn = async () => { const CIPluginOptFn = async () => {
/** /**
@@ -22,10 +23,10 @@ const CIPluginOptFn = async () => {
}; };
const config = { const config = {
projectName: "taroApp", projectName: 'taroApp',
date: "2023-8-13", date: '2023-8-13',
designWidth(input: { file: string }) { designWidth(input: {file: string}) {
if (input?.file?.replace(/\\+/g, "/").indexOf("@nutui") > -1) { if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
return 375; return 375;
} }
return 750; return 750;
@@ -36,18 +37,18 @@ const config = {
828: 1.81 / 2, 828: 1.81 / 2,
375: 2, 375: 2,
}, },
sourceRoot: "src", sourceRoot: 'src',
outputRoot: "dist", outputRoot: 'dist',
plugins: ["@tarojs/plugin-html", ["@tarojs/plugin-mini-ci", CIPluginOptFn]], plugins: ['@tarojs/plugin-html', ['@tarojs/plugin-mini-ci', CIPluginOptFn]],
defineConstants: {}, defineConstants: {},
copy: { copy: {
patterns: [], patterns: [],
options: {}, options: {},
}, },
framework: "vue3", framework: 'vue3',
compiler: { compiler: {
type: "webpack5", type: 'webpack5',
prebundle: { enable: false }, prebundle: {enable: false},
}, },
cache: { cache: {
enable: false, // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache enable: false, // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
@@ -56,14 +57,26 @@ const config = {
data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`, data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`,
}, },
alias: { alias: {
"@": join(__dirname, "..", "src"), '@': join(__dirname, '..', 'src'),
}, },
mini: { mini: {
webpackChain(chain) { webpackChain(chain) {
chain.plugin("unplugin-vue-components").use( chain.merge({
plugin: {
install: {
plugin: UnifiedWebpackPluginV5,
args: [
{
appType: 'taro',
},
],
},
},
});
chain.plugin('unplugin-vue-components').use(
Components({ Components({
resolvers: [NutUIResolver({ taro: true })], resolvers: [NutUIResolver({taro: true})],
}) }),
); );
}, },
miniCssExtractPluginOption: { miniCssExtractPluginOption: {
@@ -75,6 +88,7 @@ const config = {
enable: true, enable: true,
config: { config: {
// selectorBlackList: ['nut-'] // selectorBlackList: ['nut-']
removeCursorStyle: false,
}, },
}, },
url: { url: {
@@ -86,23 +100,23 @@ const config = {
cssModules: { cssModules: {
enable: true, // 默认为 false如需使用 css modules 功能,则设为 true enable: true, // 默认为 false如需使用 css modules 功能,则设为 true
config: { config: {
namingPattern: "module", // 转换模式,取值为 global/module namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: "[name]__[local]___[hash:base64:5]", generateScopedName: '[name]__[local]___[hash:base64:5]',
}, },
}, },
}, },
}, },
h5: { h5: {
webpackChain(chain) { webpackChain(chain) {
chain.plugin("unplugin-vue-components").use( chain.plugin('unplugin-vue-components').use(
Components({ Components({
resolvers: [NutUIResolver({ taro: true })], resolvers: [NutUIResolver({taro: true})],
}) }),
); );
}, },
publicPath: "/", publicPath: '/',
staticDirectory: "static", staticDirectory: 'static',
esnextModules: ["nutui-taro", "icons-vue-taro"], esnextModules: ['nutui-taro', 'icons-vue-taro'],
postcss: { postcss: {
autoprefixer: { autoprefixer: {
enable: true, enable: true,
@@ -111,8 +125,8 @@ const config = {
cssModules: { cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: { config: {
namingPattern: "module", // 转换模式,取值为 global/module namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: "[name]__[local]___[hash:base64:5]", generateScopedName: '[name]__[local]___[hash:base64:5]',
}, },
}, },
}, },
@@ -120,8 +134,8 @@ const config = {
}; };
module.exports = function (merge) { module.exports = function (merge) {
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === 'development') {
return merge({}, config, require("./dev")); return merge({}, config, require('./dev'));
} }
return merge({}, config, require("./prod")); return merge({}, config, require('./prod'));
}; };

View File

@@ -38,6 +38,7 @@
"preview": "vite preview", "preview": "vite preview",
"cz": "cz", "cz": "cz",
"lf": "npx prettier --write --end-of-line lf .", "lf": "npx prettier --write --end-of-line lf .",
"postinstall": "weapp-tw patch",
"build:weapp:prod:upload": "taro build --type weapp --upload --robot=1 --desc='正式环境'", "build:weapp:prod:upload": "taro build --type weapp --upload --robot=1 --desc='正式环境'",
"build:weapp:test:upload": "taro build --type weapp --upload --robot=2 --desc='测试环境' --mode test" "build:weapp:test:upload": "taro build --type weapp --upload --robot=2 --desc='测试环境' --mode test"
}, },
@@ -63,20 +64,20 @@
"@nutui/icons-vue-taro": "^0.0.9", "@nutui/icons-vue-taro": "^0.0.9",
"@nutui/nutui-taro": "^4.3.6", "@nutui/nutui-taro": "^4.3.6",
"@qiun/vue-ucharts": "2.5.0-20230101", "@qiun/vue-ucharts": "2.5.0-20230101",
"@tarojs/components": "3.6.28", "@tarojs/components": "3.6.29",
"@tarojs/helper": "3.6.28", "@tarojs/helper": "3.6.29",
"@tarojs/plugin-framework-vue3": "3.6.28", "@tarojs/plugin-framework-vue3": "3.6.29",
"@tarojs/plugin-html": "3.6.28", "@tarojs/plugin-html": "3.6.29",
"@tarojs/plugin-platform-alipay": "3.6.28", "@tarojs/plugin-platform-alipay": "3.6.29",
"@tarojs/plugin-platform-h5": "3.6.28", "@tarojs/plugin-platform-h5": "3.6.29",
"@tarojs/plugin-platform-jd": "3.6.28", "@tarojs/plugin-platform-jd": "3.6.29",
"@tarojs/plugin-platform-qq": "3.6.28", "@tarojs/plugin-platform-qq": "3.6.29",
"@tarojs/plugin-platform-swan": "3.6.28", "@tarojs/plugin-platform-swan": "3.6.29",
"@tarojs/plugin-platform-tt": "3.6.28", "@tarojs/plugin-platform-tt": "3.6.29",
"@tarojs/plugin-platform-weapp": "3.6.28", "@tarojs/plugin-platform-weapp": "3.6.29",
"@tarojs/runtime": "3.6.28", "@tarojs/runtime": "3.6.29",
"@tarojs/shared": "3.6.28", "@tarojs/shared": "3.6.29",
"@tarojs/taro": "3.6.28", "@tarojs/taro": "3.6.29",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"vue": "^3.3.9" "vue": "^3.3.9"
@@ -85,32 +86,37 @@
"@babel/core": "^7.23.5", "@babel/core": "^7.23.5",
"@commitlint/cli": "^18.4.3", "@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3", "@commitlint/config-conventional": "^18.4.3",
"@tarojs/cli": "3.6.28", "@tarojs/cli": "3.6.29",
"@tarojs/plugin-mini-ci": "3.6.28", "@tarojs/plugin-mini-ci": "3.6.29",
"@tarojs/taro-loader": "3.6.28", "@tarojs/taro-loader": "3.6.29",
"@tarojs/webpack5-runner": "3.6.28", "@tarojs/webpack5-runner": "3.6.29",
"@types/node": "^18.19.1", "@types/node": "^18.19.1",
"@types/webpack-env": "^1.18.4", "@types/webpack-env": "^1.18.4",
"@typescript-eslint/eslint-plugin": "^6.13.1", "@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1", "@typescript-eslint/parser": "^6.13.1",
"@unocss/webpack": "^0.60.0",
"@vue/babel-plugin-jsx": "^1.1.5", "@vue/babel-plugin-jsx": "^1.1.5",
"@vue/compiler-sfc": "^3.3.9", "@vue/compiler-sfc": "^3.3.9",
"babel-preset-taro": "3.6.28", "autoprefixer": "^10.4.19",
"babel-preset-taro": "3.6.29",
"commitizen": "^4.3.0", "commitizen": "^4.3.0",
"css-loader": "3.4.2", "css-loader": "3.4.2",
"cz-customizable": "^7.0.0", "cz-customizable": "^7.0.0",
"eslint": "^8.55.0", "eslint": "^8.55.0",
"eslint-config-taro": "3.6.28", "eslint-config-taro": "3.6.29",
"eslint-plugin-vue": "^9.19.2", "eslint-plugin-vue": "^9.19.2",
"husky": "^8.0.3", "husky": "^8.0.3",
"lint-staged": "^15.1.0", "lint-staged": "^15.1.0",
"postcss": "8.4.29", "postcss": "8.4.29",
"postcss-rem-to-responsive-pixel": "^6.0.1",
"style-loader": "1.3.0", "style-loader": "1.3.0",
"stylelint": "9.3.0", "stylelint": "9.3.0",
"tailwindcss": "^3.4.3",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"unplugin-vue-components": "^0.23.0", "unplugin-vue-components": "^0.23.0",
"vue-loader": "^17.3.1", "vue-loader": "^17.3.1",
"weapp-tailwindcss": "^3.2.0",
"webpack": "^5.89.0" "webpack": "^5.89.0"
} }
} }

20375
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

14
postcss.config.js Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
'postcss-rem-to-responsive-pixel': {
// 32 意味着 1rem = 32rpx
rootValue: 32,
// 默认所有属性都转化
propList: ['*'],
// 转化的单位,可以变成 px / rpx
transformUnit: 'rpx',
},
},
};

View File

@@ -1,44 +1,44 @@
import request from "../utils/request"; import request from '../utils/request';
// 订单核销 // 订单核销
export const orderVerify = (data: object) => export const orderVerify = (data: object) =>
request("/user/cancelPointOrder", data, "POST"); request('/user/cancelPointOrder', data, 'POST');
// 活动订单核销 // 活动订单核销
export const activeOrderVerify = (data: object) => export const activeOrderVerify = (data: object) =>
request("/user/cancelOrder", data, "POST"); request('/user/cancelOrder', data, 'POST');
// 获取订单统计 // 获取订单统计
export const orderStatistics = (data: object) => export const orderStatistics = (data: object) =>
request("/store/order/count", data, "POST"); request('/store/order/count', data, 'POST');
// 获取商家积分订单列表 // 获取商家积分订单列表
export const getJfOrderList = (data: object) => export const getJfOrderList = (data: object) =>
request("/store/point/order", data, "POST"); request('/store/point/order', data, 'POST');
// 获取商家活动订单列表 // 获取商家活动订单列表
export const getActiveOrderList = (data: object) => export const getActiveOrderList = (data: object) =>
request("/store/order", data, "POST"); request('/store/order', data, 'POST');
// 获取积分核销列表 // 获取积分核销列表
export const getJfVerifyList = (data: object) => export const getJfVerifyList = (data: object) =>
request("/point/order/details", data, "POST"); request('/point/order/details', data, 'POST');
// 获取活动核销列表 // 获取活动核销列表
export const getActiveVerifyList = (data: object) => export const getActiveVerifyList = (data: object) =>
request("/order/details", data, "POST"); request('/order/details', data, 'POST');
// 增长率统计 // 增长率统计
export const growthRate = (data: object) => export const growthRate = (data: object) =>
request("/store/date/count", data, "POST"); request('/store/date/count', data, 'POST');
// 获取提现列表 // 获取提现列表
export const getWithdrawList = (data: object) => export const getWithdrawList = (data: object) =>
request("/store/withdraw", data, "POST"); request('/store/withdraw', data, 'POST');
// 获取提现列表 // 获取提现列表
export const addWithdraw = (data: object) => export const addWithdraw = (data: object) =>
request("/store/withdraw/set", data, "POST"); request('/store/withdraw/set', data, 'POST');
/** /**
* 后结api * 后结api
@@ -46,32 +46,36 @@ export const addWithdraw = (data: object) =>
// 创建后结订单 // 创建后结订单
export const createAfterOrder = (data: object) => export const createAfterOrder = (data: object) =>
request("/later/order/place", data, "POST"); request('/later/order/place', data, 'POST');
// 获取商家后结订单列表 // 获取商家后结订单列表
export const getAfterOrderList = (data: object) => export const getAfterOrderList = (data: object) =>
request("/later/store/user/order", data, "POST"); request('/later/store/user/order', data, 'POST');
// 获取单个后结订单 // 获取单个后结订单
export const getAfterOrder = (data: object) => export const getAfterOrder = (data: object) =>
request("/later/order/details", data, "POST"); request('/later/order/details', data, 'POST');
// 确定挂帐 // 确定挂帐
export const confirmAfterOrder = (data: object) => export const confirmAfterOrder = (data: object) =>
request("/later/order/onAccount", data, "POST"); request('/later/order/onAccount', data, 'POST');
// 修改台号/备注 // 修改台号/备注
export const editAfterOrder = (data: object) => export const editAfterOrder = (data: object) =>
request("/later/order/edit", data, "POST"); request('/later/order/edit', data, 'POST');
// 生成付款二维码 // 生成付款二维码
export const createPayQr = (data: object) => export const createPayQr = (data: object) =>
request("/later/order/pay", data, "POST"); request('/later/order/pay', data, 'POST');
// 检查手机号码是否存在 // 检查手机号码是否存在
export const checkPhone = (data: object) => export const checkPhone = (data: object) =>
request("/user/find/phone", data, "POST"); request('/user/find/phone', data, 'POST');
// 获取商家特定用户会员积分2024-3-19 // 获取商家特定用户会员积分2024-3-19
export const getUserPoint = (data: object) => export const getUserPoint = (data: object) =>
request("/store/get/user/integral", data, "POST"); request('/store/get/user/integral', data, 'POST');
// 取消后结订单
export const cancelAfterOrder = (data: object) =>
request('/user/later/order/remove', data, 'POST');

View File

@@ -1,67 +1,67 @@
import request from "@/utils/request"; import request from '@/utils/request';
// 获取商品列表 // 获取商品列表
export const getGoodsList = () => request("/point/goods", {}, "POST"); export const getGoodsList = () => request('/point/goods', {}, 'POST');
// 添加购物车 // 添加购物车
export const addCart = (data: object) => request("/user/addCart", data, "POST"); export const addCart = (data: object) => request('/user/addCart', data, 'POST');
// 获取购物车列表 // 获取购物车列表
export const getCartList = () => request("/user/cart", {}, "POST"); export const getCartList = () => request('/user/cart', {}, 'POST');
// 获取积分商品详情 // 获取积分商品详情
export const getGoodsDetail = (data: object) => export const getGoodsDetail = (data: object) =>
request("/point/details", data, "POST"); request('/point/details', data, 'POST');
// 积分商品下单 // 积分商品下单
export const createOrder = (data: object) => export const createOrder = (data: object) =>
request("/point/place", data, "POST"); request('/point/place', data, 'POST');
// 确认付款 // 确认付款
export const payJfOrder = (data: object) => export const payJfOrder = (data: object) =>
request("/point/confirmOrder", data, "POST"); request('/point/confirmOrder', data, 'POST');
// 获取活动商品 // 获取活动商品
export const getActiveGoods = () => request("/goods", {}, "POST"); export const getActiveGoods = () => request('/goods', {}, 'POST');
// 获取活动商品详情 // 获取活动商品详情
export const getActiveGoodsDetail = (data: object) => export const getActiveGoodsDetail = (data: object) =>
request("/goods/details", data, "POST"); request('/goods/details', data, 'POST');
// 创建订单 // 创建订单
export const createActiveOrder = (data: object) => export const createActiveOrder = (data: object) =>
request("/order/place", data, "POST"); request('/order/place', data, 'POST');
// 活动订单列表 // 活动订单列表
export const getActiveOrderList = (data: object) => export const getActiveOrderList = (data: object) =>
request("/user/order", data, "POST"); request('/user/order', data, 'POST');
// 获取分类列表 // 获取分类列表
export const getCategoryList = () => request("/goods/class", {}, "POST"); export const getCategoryList = () => request('/goods/class', {}, 'POST');
// 活动订单删除 // 活动订单删除
export const deleteActiveOrder = (data: object) => export const deleteActiveOrder = (data: object) =>
request("/user/order/remove", data, "POST"); request('/user/order/remove', data, 'POST');
// 积分订单删除 // 积分订单删除
export const deleteJfOrder = (data: object) => export const deleteJfOrder = (data: object) =>
request("/user/point/remove", data, "POST"); request('/user/point/remove', data, 'POST');
// 获取分类商品 // 获取分类商品
export const getCategoryGoods = (data: object) => export const getCategoryGoods = (data: object) =>
request("/class/goods/list", data, "POST"); request('/class/goods/list', data, 'POST');
// 获取商家列表 // 获取商家列表
export const getMerList = (data: object) => export const getMerList = (data: object) =>
request("/store/list", data, "POST"); request('/store/list', data, 'POST');
// 获取商家商品分类 // 获取商家商品分类
export const getMerCategory = (data: object) => export const getMerCategory = (data: object) =>
request("/store/classify", data, "POST"); request('/store/classify', data, 'POST');
// 获取商家商品 // 获取商家商品
export const getGoodList = (data: object) => export const getGoodList = (data: object) =>
request("/store/goods", data, "POST"); request('/store/goods', data, 'POST');
// // 获取活动商家列表 // // 获取活动商家列表
// export const getHotMerList = (data: object) => // export const getHotMerList = (data: object) =>
@@ -77,4 +77,12 @@ export const getGoodList = (data: object) =>
// 获取全部商家类目 // 获取全部商家类目
export const getAllMerCategory = () => export const getAllMerCategory = () =>
request("/home/all/classify", {}, "POST"); request('/home/all/classify', {}, 'POST');
// 获取活动订单详情
export const getActiveOrderDetail = (data: object) =>
request('/user/order/details', data, 'POST');
// 校验交易密码
export const checkTradePwd = (data: object) =>
request('/user/check/payPassword', data, 'POST');

View File

@@ -5,3 +5,6 @@ export const getHomeList = () => request("/home/classify", {}, "POST");
// 获取商户子列表 // 获取商户子列表
export const getHomeSubList = () => request("/home/all/classify", {}, "POST"); export const getHomeSubList = () => request("/home/all/classify", {}, "POST");
// 查找商家
export const getStoreList = (data) => request("/find/store", data, "POST");

View File

@@ -1,81 +1,89 @@
import request from "@/utils/request"; import request from '@/utils/request';
// 获取用户协议 // 获取用户协议
export const getAgreement = () => request("/user/agreement", {}, "POST"); export const getAgreement = () => request('/user/agreement', {}, 'POST');
// 登录 // 登录
export const login = (data: object) => request("/login", data, "POST"); export const login = (data: object) => request('/login', data, 'POST');
export const phoneLogin = (data: object) => export const phoneLogin = (data: object) =>
request("/phone/login", data, "POST"); request('/phone/login', data, 'POST');
// 获取用户信息 // 获取用户信息
// export const getUserInfo = () => request("/user/detail", {}, "GET"); // export const getUserInfo = () => request("/user/detail", {}, "GET");
// 获取短信验证码 // 获取短信验证码
export const getVerifyCode = (data: object) => export const getVerifyCode = (data: object) =>
request("/getSmsCode", data, "POST"); request('/getSmsCode', data, 'POST');
// 商家入驻申请 // 商家入驻申请
export const applyMer = (data: object) => export const applyMer = (data: object) =>
request("/store/settle", data, "POST"); request('/store/settle', data, 'POST');
// 获取商家类型列表 // 获取商家类型列表
export const getMerTypeList = () => request("/store/getOther", {}, "POST"); export const getMerTypeList = () => request('/store/getOther', {}, 'POST');
// 获取个人信息 // 获取个人信息
export const getPersonalInfo = () => request("/user/info", {}, "POST"); export const getPersonalInfo = () => request('/user/info', {}, 'POST');
// 获取轮播图 // 获取轮播图
export const getBanner = () => request("/rotation", {}, "POST"); export const getBanner = () => request('/rotation', {}, 'POST');
// 获取积分订单列表 // 获取积分订单列表
export const getIntegralOrderList = (data: object) => export const getIntegralOrderList = (data: object) =>
request("/user/pointOrder", data, "POST"); request('/user/pointOrder', data, 'POST');
// 修改个人信息 // 修改个人信息
export const editPersonalInfo = (data: object) => export const editPersonalInfo = (data: object) =>
request("/user/editInfo", data, "POST"); request('/user/editInfo', data, 'POST');
// 积分明细 // 积分明细
export const getIntegralDetail = (data: object) => export const getIntegralDetail = (data: object) =>
request("/user/pulseRecord", data, "POST"); request('/user/pulseRecord', data, 'POST');
// 豆子明细 // 豆子明细
export const getBeanDetail = (data: object) => export const getBeanDetail = (data: object) =>
request("/user/pointRecord", data, "POST"); request('/user/pointRecord', data, 'POST');
// 授权手机号 // 授权手机号
export const getPhone = (data: object) => export const getPhone = (data: object) =>
request("/user/getPhone", data, "POST"); request('/user/getPhone', data, 'POST');
// 获取推广积分明细 // 获取推广积分明细
export const getTGIntegralDetail = (data: object) => export const getTGIntegralDetail = (data: object) =>
request("/user/referee/point", data, "POST"); request('/user/referee/point', data, 'POST');
// 获取推广用户列表 // 获取推广用户列表
export const getTGUserList = (data: object) => export const getTGUserList = (data: object) =>
request("/user/referee/list", data, "POST"); request('/user/referee/list', data, 'POST');
// 绑定上级 // 绑定上级
export const bindParent = (data: object) => export const bindParent = (data: object) =>
request("/user/bindCode", data, "POST"); request('/user/bindCode', data, 'POST');
// 获取推广码 // 获取推广码
export const getRefereeCode = () => request("/user/promotion", {}, "POST"); export const getRefereeCode = () => request('/user/promotion', {}, 'POST');
// 取消订单返回积分 // 取消订单返回积分
export const qxOrder = (data: object) => export const qxOrder = (data: object) =>
request("/user/point/off", data, "POST"); request('/user/point/off', data, 'POST');
// 用户签到 // 用户签到
export const userSign = () => 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) => export const getGiftRecord = (data: object) =>
request("/user/giftPulseRecord", data, "POST"); request('/user/giftPulseRecord', data, 'POST');
// 修改交易密码
export const editTradePwd = (data: object) =>
request('/user/edit/payPassword', data, 'POST');
// 检查是否有交易密码
export const isCheckTradePwd = () =>
request('/user/find/payPassword', {}, 'POST');
/** /**
* 用户后结订单 * 用户后结订单
@@ -83,8 +91,8 @@ export const getGiftRecord = (data: object) =>
// 获取用户后结订单列表 // 获取用户后结订单列表
export const getUserAfterOrderList = (data: object) => export const getUserAfterOrderList = (data: object) =>
request("/later/user/order", data, "POST"); request('/later/user/order', data, 'POST');
// 获取用户后结订单详情 // 获取用户后结订单详情
export const getUserAfterOrderDetail = (data: object) => export const getUserAfterOrderDetail = (data: object) =>
request("/later/order/details", data, "POST"); request('/later/order/details', data, 'POST');

View File

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

View File

@@ -1,8 +1,11 @@
@import "./static/iconfont/iconfont.css"; @import "./static/iconfont/iconfont.css";
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
page { page {
background-color: #f5f5f5; background-color: #f5f5f5;
font-size: 30rpx; // font-size: 30rpx;
// IOS安全区域 // IOS安全区域
padding-bottom: constant(safe-area-inset-bottom); padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);

View File

@@ -1,15 +1,10 @@
import { createApp } from "vue"; import {createApp} from 'vue';
import "./app.scss"; import Taro from '@tarojs/taro';
import Taro from "@tarojs/taro"; import './app.scss';
// import * as Sentry from "sentry-miniapp";
// 小程序场景值 // 小程序场景值
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049]; const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
// Sentry.init({
// dsn: "https://47703e01ba4344b8b252c15e8fd980fd@sentry.io/1528228",
// });
const App = createApp({ const App = createApp({
onLaunch(options: { onLaunch(options: {
path: string; path: string;
@@ -19,20 +14,20 @@ const App = createApp({
referrerInfo: object | any; referrerInfo: object | any;
}) { }) {
// 检测更新 // 检测更新
if (Taro.canIUse("getUpdateManager") && options.scene !== 1154) { if (Taro.canIUse('getUpdateManager') && options.scene !== 1154) {
const updateManager = Taro.getUpdateManager(); const updateManager = Taro.getUpdateManager();
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) { if (res.hasUpdate) {
updateManager.onUpdateFailed(function () { updateManager.onUpdateFailed(function () {
return Taro.showToast({ return Taro.showToast({
title: "新版本下载失败", title: '新版本下载失败',
icon: "none", icon: 'none',
}); });
}); });
updateManager.onUpdateReady(function () { updateManager.onUpdateReady(function () {
Taro.showModal({ Taro.showModal({
title: "更新提示", title: '更新提示',
content: "新版本已经下载好,是否重启当前应用?", content: '新版本已经下载好,是否重启当前应用?',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
updateManager.applyUpdate(); updateManager.applyUpdate();
@@ -42,8 +37,8 @@ const App = createApp({
}); });
updateManager.onUpdateFailed(function () { updateManager.onUpdateFailed(function () {
Taro.showModal({ Taro.showModal({
title: "发现新版本", title: '发现新版本',
content: "请删除当前小程序,重启搜索打开...", content: '请删除当前小程序,重启搜索打开...',
}); });
}); });
} }
@@ -55,10 +50,10 @@ const App = createApp({
if (scenes.includes(options.scene)) { if (scenes.includes(options.scene)) {
if (options.query.scene) { if (options.query.scene) {
Taro.showToast({ Taro.showToast({
title: "已检测到推荐人", title: '已检测到推荐人',
icon: "none", icon: 'none',
}); });
Taro.setStorageSync("bind_id", options.query.scene); Taro.setStorageSync('bind_id', options.query.scene);
} }
} }
}, },

View File

@@ -1,11 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { addCart, getCart, clearCart } from "@/api/cart"; import {addCart, getCart, clearCart} from '@/api/cart';
import { Del2 } from "@nutui/icons-vue-taro"; import {Plus, Minus} from '@nutui/icons-vue-taro';
import { createActiveOrder } from "@/api/goods"; import {createActiveOrder} from '@/api/goods';
import { createAfterOrder, getUserPoint } from "@/api/admin"; import {createAfterOrder, getUserPoint} from '@/api/admin';
import Pay from "@/components/Pay.vue"; import Pay from '@/components/Pay.vue';
interface CardList { interface CardList {
name: string; name: string;
@@ -30,7 +30,7 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits(["updateCart"]); const emit = defineEmits(['updateCart']);
const openModal = async () => { const openModal = async () => {
await get_cart_list(); await get_cart_list();
@@ -47,13 +47,13 @@ const add_cart = async (item: CardList, num: number = 1) => {
}); });
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
await get_cart_list(); await get_cart_list();
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
@@ -92,11 +92,11 @@ const get_cart_list = async () => {
cartInfo.value.price += Number(item.price); cartInfo.value.price += Number(item.price);
cartInfo.value.exchange += Number(item.exchange); cartInfo.value.exchange += Number(item.exchange);
}); });
emit("updateCart", res.data.data || []); emit('updateCart', res.data.data || []);
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
@@ -110,7 +110,7 @@ const clear_cart = async () => {
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
} }
show.value = false; show.value = false;
@@ -124,7 +124,7 @@ const closePay = (val: boolean) => {
isShowPay.value = val; isShowPay.value = val;
orderData.value = []; orderData.value = [];
Taro.redirectTo({ Taro.redirectTo({
url: "/pages/users/order_list/index?type=0", url: '/pages/users/order_list/index?type=0',
}); });
}; };
@@ -142,8 +142,8 @@ const create_order = async () => {
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?oid=${res.data.oid}&bid=${props.merInfo.bid}`, url: `/pages/admin/add_order/pending_order/pending_order_detail/index?oid=${res.data.oid}&bid=${props.merInfo.bid}`,
}); });
} else { } else {
const mer_info = Taro.getStorageSync("mer_info"); const mer_info = Taro.getStorageSync('mer_info');
const user_info = Taro.getStorageSync("userInfo"); const user_info = Taro.getStorageSync('userInfo');
const data = await getUserPoint({ const data = await getUserPoint({
phone: user_info.data.phone, phone: user_info.data.phone,
bid: mer_info.bid, bid: mer_info.bid,
@@ -157,17 +157,20 @@ const create_order = async () => {
jh_info: data.data, jh_info: data.data,
oid: res.data.oid, oid: res.data.oid,
}; };
isShowPay.value = true; // isShowPay.value = true;
Taro.navigateTo({
url: `/pages/goods/pay/index?oid=${res.data.oid}&bid=${mer_info.bid}&OrderType=1`,
});
} }
} }
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
@@ -181,9 +184,17 @@ defineExpose({
<template> <template>
<view> <view>
<view class="cart" @click.stop="openModal"> <view class="cart" @click.stop="openModal">
<view class="container"> <view class="container flex items-center">
<view>购物车数量: {{ cartInfo.count }}</view> <!-- <view>购物车数量: {{ cartInfo.count }}</view> -->
<view v-if="cartInfo.count > 0"> <view class="cardImg">
<image
src="http://p1.meituan.net/csc/929f447a96a44b09a09b2e0055433222717.png">
</image>
<view class="count-text" v-if="cartInfo.count > 0">
<text>{{ cartInfo.count }}</text>
</view>
</view>
<view class="ml-1">
<text>总金额: {{ cartInfo.price.toFixed(2) }}</text> <text>总金额: {{ cartInfo.price.toFixed(2) }}</text>
<text v-if="!IsPendingOrder" <text v-if="!IsPendingOrder"
>总积分: {{ cartInfo.exchange.toFixed(2) }}</text >总积分: {{ cartInfo.exchange.toFixed(2) }}</text
@@ -191,23 +202,25 @@ defineExpose({
</view> </view>
</view> </view>
<view v-if="cartInfo.count > 0" class="payBtn" @click.stop="create_order" <view v-if="cartInfo.count > 0" class="payBtn" @click.stop="create_order"
>立即下单</view >去结算</view
> >
</view> </view>
<!-- 购物车弹窗 --> <!-- 购物车弹窗 -->
<nut-popup <nut-popup
:style="{ padding: '20rpx' }" :style="{padding: '15px'}"
round round
position="bottom" position="bottom"
z-index="1" z-index="1"
:catch-move="true" :catch-move="true"
:safe-area-inset-bottom="true" :safe-area-inset-bottom="true"
v-model:visible="show" v-model:visible="show">
>
<view class="list-header"> <view class="list-header">
<view class="left" @click.stop="clear_cart"> <view class="left" @click.stop="clear_cart">
<Del2 color="#666666" /> <!-- <Del2 color="#666666" /> -->
<text style="color: #666666">清空购物车</text> <image
class="w-[20px] h-[20px]"
src="http://p0.meituan.net/csc/db4d11fd744b69435c6ffdc6bfc868c5684.png" />
<text class="text-[20px]" style="color: #666666">清空购物车</text>
</view> </view>
</view> </view>
<scroll-view :scroll-y="true" class="cart-list"> <scroll-view :scroll-y="true" class="cart-list">
@@ -216,9 +229,10 @@ defineExpose({
<image :src="item.cover" /> <image :src="item.cover" />
<view class="center"> <view class="center">
<view class="name">{{ item.name }}</view> <view class="name">{{ item.name }}</view>
<view class="price">
<view class="price flex">
<view>现金:{{ item.price }}</view> <view>现金:{{ item.price }}</view>
<view>积分:{{ item.exchange }}</view> <view class="ml-2">积分:{{ item.exchange }}</view>
</view> </view>
</view> </view>
</view> </view>
@@ -227,57 +241,90 @@ defineExpose({
readonly readonly
:min="-1" :min="-1"
@add="() => onAdd(item)" @add="() => onAdd(item)"
@reduce="() => onReduce(item)" @reduce="() => onReduce(item)">
/> <template #left-icon>
<view class="btn" @click.stop="onReduce(item)">
<Minus />
</view>
</template>
<template #right-icon>
<view class="btn" @click.stop="onAdd(item)">
<Plus />
</view>
</template>
</nut-input-number>
</view> </view>
</scroll-view> </scroll-view>
<view style="height: 140rpx"></view> <view style="height: 140px"></view>
</nut-popup> </nut-popup>
<!-- 支付 --> <!-- 支付 -->
<Pay <Pay
:is-show-pay="isShowPay" :is-show-pay="isShowPay"
v-model:jfInfo="orderData" v-model:jfInfo="orderData"
@closePay="closePay" @closePay="closePay"
@successPay="closePay" @successPay="closePay" />
/>
</view> </view>
</template> </template>
<style lang="scss"> <style lang="scss">
$h-border-radius: 50rpx; $h-border-radius: 50px;
.cart { .cart {
position: fixed; position: fixed;
bottom: 50rpx; bottom: 50px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 9999; z-index: 9999;
width: 95%; width: 95%;
background-color: red; background-color: #262323;
border-radius: $h-border-radius; border-radius: $h-border-radius;
color: #fff; color: #fff;
height: 100rpx; height: 100px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.container { .container {
margin-left: 30rpx; margin-left: 30px;
.cardImg {
position: relative;
image {
width: 60px;
height: 60px;
}
.count-text {
position: absolute;
top: -10px;
right: -10px;
background-image: url('http://p0.meituan.net/csc/80b0e11d4270d09324df0b802d4c479b986.png');
background-size: 100% 100%;
// padding: 0 8px;
width: 35px;
height: 35px;
text-align: center;
line-height: 35px;
text {
margin: auto;
font-size: 25px;
}
}
}
} }
.payBtn { .payBtn {
width: 180rpx; width: 200px;
height: 100rpx; height: 100px;
line-height: 100rpx; line-height: 100px;
text-align: center; text-align: center;
background-color: #000; background-color: #f83d3d;
border-radius: 0 $h-border-radius $h-border-radius 0; border-radius: 0 $h-border-radius $h-border-radius 0;
} }
} }
.list-header { .list-header {
margin: 15rpx 0; margin: 15px 0;
.left { .left {
display: flex; display: flex;
@@ -286,37 +333,47 @@ $h-border-radius: 50rpx;
} }
.cart-list { .cart-list {
height: 290rpx; height: 290px;
.item { .item {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
margin-bottom: 10rpx; margin-bottom: 10px;
justify-content: space-between; justify-content: space-between;
.left { .left {
display: flex; display: flex;
justify-content: space-between;
image { image {
width: 130rpx; width: 130px;
height: 130rpx; height: 130px;
border-radius: 10rpx; border-radius: 15px;
margin-right: 10rpx; margin-right: 10px;
} }
.center { .center {
height: 100%; height: 130px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
.price { .price {
color: red; color: red;
margin-top: 20rpx; // margin-bottom: 0px;
} }
} }
} }
} }
} }
.btn {
background-color: #ff0000;
color: #fff;
border-radius: 50%;
text-align: center;
line-height: 65px;
width: 45px;
height: 45px;
}
</style> </style>

View File

@@ -1,60 +1,124 @@
<template> <template>
<view class="goodBox"> <view class="list-box">
<view <view class="list">
class="good" <swiper
v-for="item in merdata" class="item"
:key="item.ID" :style="{
@click.stop="toMerDetails(item)" height: '250px',
> }"
<image :src="item.head_photo" /> indicator-color="#EDEDED"
<view class="good-text-box"> indicator-active-color="#F83D3D"
<text class="good-text">{{ item.name }}</text> :circular="true"
<text style="color: #999" :indicator-dots="true"
>距离我{{ :autoplay="true">
calculateDistance( <swiper-item v-for="(item, index) in bannerList" :key="index">
userLocalNum.t, <image
userLocalNum.l, :style="{
Number(item.lat), width: '100%',
Number(item.lon) height: '100%',
) }"
}} :src="item.url"
</text> @tap="toPage(item.jump)" />
</swiper-item>
</swiper>
<view
class="item"
v-for="(item, index) in list1"
:key="index"
@click="toMerDetails(item)">
<image
:style="{
height: '200px',
}"
:src="item.head_photo" />
<view class="text">
<view class="title">{{ item.name }}</view>
<view class="list_local">
<view class="icon iconfont icon-dizhi"></view>
<view class="desc"
>距离我{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(item.lat),
Number(item.lon),
)
}}
</view>
</view>
</view>
</view>
</view>
<view class="list">
<view
class="item"
v-for="(item, index) in list2"
:key="index"
@click.stop="toMerDetails(item)">
<image
:style="{
height: '200px',
}"
:src="item.head_photo" />
<view class="text">
<view class="title">{{ item.name }}</view>
<view class="list_local">
<view class="icon iconfont icon-dizhi"></view>
<view class="desc"
>距离我{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(item.lat),
Number(item.lon),
)
}}
</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { calculateDistance } from "@/utils"; import {calculateDistance, parseQueryString} from '@/utils';
import { bindParent } from "@/api/user"; import {bindParent, getBanner} from '@/api/user';
import { getMerList } from "@/api/goods"; import {getMerList} from '@/api/goods';
const props = defineProps({ const classId = defineModel({default: 0});
classId: {
type: Number, const list1 = ref<Array<MerData>>([]);
default: 0, const list2 = ref<Array<MerData>>([]);
},
Taro.useLoad(() => {
init();
}); });
Taro.useDidShow(async () => { const init = async () => {
Taro.showLoading({
title: '加载中',
});
await get_mer_list(); await get_mer_list();
if (Taro.getStorageSync("token") && Taro.getStorageSync("bind_id")) { await get_banner_list();
if (Taro.getStorageSync('token') && Taro.getStorageSync('bind_id')) {
try { try {
const res = await bindParent({ const res = await bindParent({
uid: Taro.getStorageSync("bind_id"), uid: Taro.getStorageSync('bind_id'),
}); });
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
}); });
Taro.removeStorageSync("bind_id"); Taro.removeStorageSync('bind_id');
} catch (error) { } catch (error) {
Taro.removeStorageSync("bind_id"); Taro.removeStorageSync('bind_id');
throw error; throw error;
} }
} }
}); Taro.hideLoading();
};
interface MerData { interface MerData {
ID: number; ID: number;
@@ -71,79 +135,124 @@ const userLocalNum = ref({
t: 0, t: 0,
}); });
const pageVal = ref({
page: 1,
total: 0,
});
const get_mer_list = async () => { const get_mer_list = async () => {
Taro.getLocation({ Taro.getLocation({
type: "wgs84", type: 'wgs84',
success: (res) => { success: res => {
userLocalNum.value.l = res.longitude; userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude; userLocalNum.value.t = res.latitude;
}, },
}); });
const res = await getMerList({ const res = await getMerList({
PageNum: 1, PageNum: pageVal.value.page,
PageSize: 10, PageSize: 10,
class_id: props.classId, class_id: classId.value,
}); });
pageVal.value.total = res.data.total;
merdata.value = res.data.data; merdata.value = res.data.data;
const middleIndex = Math.floor(merdata.value.length / 2);
const arr1 = merdata.value.slice(0, middleIndex);
const arr2 = merdata.value.slice(middleIndex);
list1.value.push(...arr1);
list2.value.push(...arr2);
merdata.value = [];
};
const bannerList = ref<any[]>([]);
const get_banner_list = async () => {
const {data}: any = await getBanner();
bannerList.value = data.data;
}; };
const toMerDetails = (item: any) => { const toPage = async (url: string) => {
Taro.setStorageSync("mer_info", item); console.log(url);
// url转对象
const obj = parseQueryString(url);
if (obj.type === '1') {
const {data: res} = await getMerList({});
const mer = res.data.filter(item => item.bid === obj.bid)[0];
Taro.setStorageSync('mer_info', mer);
}
Taro.navigateTo({
url,
});
};
const toMerDetails = item => {
Taro.setStorageSync('mer_info', item);
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/mer/mer_detail/index`, url: `/pages/mer/mer_detail/index`,
}); });
}; };
Taro.useReachBottom(() => {
const currTotal = list1.value.length + list2.value.length;
if (currTotal === pageVal.value.total) {
Taro.showToast({
title: '没有更多了',
icon: 'none',
});
} else {
pageVal.value.page += 1;
get_mer_list();
}
});
</script> </script>
<style lang="scss"> <style lang="scss">
.goodBox { .list-box {
margin: 20px;
padding: 10px;
display: flex; display: flex;
padding: 20px;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
.good { .list {
width: 340px; overflow: scroll;
background-color: #fff;
margin-bottom: 20px;
border-radius: 10px;
image { .item {
width: 100%; width: 340px;
height: 250px; margin-bottom: 18px;
border-top-right-radius: 10px; border-radius: 20px;
border-top-left-radius: 10px; background-color: #fff;
}
.good-text-box { image {
padding: 10px; width: 100%;
border-radius: 15px;
.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 { .text {
display: flex; padding: 15px;
justify-content: space-between;
align-items: center;
margin-top: 10px;
.good-text-price { .title {
font-size: 28px; color: #333333;
font-weight: bold; font-size: 30px;
color: #ff0000;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis;
// white-space: nowrap;
}
.list_local {
display: flex;
align-items: center;
justify-content: flex-start;
color: #808080;
margin-top: 8px;
.icon {
display: inline-block;
font-size: 30px;
}
.desc {
font-size: 28px;
}
} }
} }
} }

View File

@@ -5,21 +5,18 @@
round round
safe-area-inset-bottom safe-area-inset-bottom
:close-on-click-overlay="false" :close-on-click-overlay="false"
:style="{ height: 'auto' }" :style="{height: 'auto'}"
:visible="isShowPay" :visible="isShowPay"
@click-close-icon="closePay" @click-close-icon="closePay">
>
<view class="div"> <view class="div">
<view style="text-align: center">支付方式</view> <view style="text-align: center">支付方式</view>
<nut-cell-group <nut-cell-group
:style="{ margin: interval ? '40rpx 0 150rpx 0' : '40rpx 0' }" :style="{margin: interval ? '40rpx 0 150rpx 0' : '40rpx 0'}">
>
<nut-cell <nut-cell
title="微信支付" title="微信支付"
desc="使用微信快捷支付" desc="使用微信快捷支付"
is-link is-link
@click="goPay(1)" @click="goPay(1)">
>
<template v-slot:icon> <template v-slot:icon>
<IconFont size="30" :name="require('../static/wx.png')" /> <IconFont size="30" :name="require('../static/wx.png')" />
</template> </template>
@@ -28,8 +25,7 @@
title="平台积分支付" title="平台积分支付"
:desc="`剩余积分:${info.integral || 0}`" :desc="`剩余积分:${info.integral || 0}`"
is-link is-link
@click="goPay(2)" @click="goPay(2)">
>
<template v-slot:icon> <template v-slot:icon>
<IconFont size="30" :name="require('../static/pt.png')" /> <IconFont size="30" :name="require('../static/pt.png')" />
</template> </template>
@@ -38,8 +34,7 @@
title="天才小猪积分支付" title="天才小猪积分支付"
:desc="`剩余积分:${jfInfo.jh_info?.integral || 0}`" :desc="`剩余积分:${jfInfo.jh_info?.integral || 0}`"
is-link is-link
@click="goPay(3)" @click="goPay(3)">
>
<template v-slot:icon> <template v-slot:icon>
<IconFont size="30" :name="require('../static/jh.png')" /> <IconFont size="30" :name="require('../static/jh.png')" />
</template> </template>
@@ -50,11 +45,11 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import {ref, watch} from 'vue';
import { IconFont } from "@nutui/icons-vue-taro"; import {IconFont} from '@nutui/icons-vue-taro';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { payOrder } from "@/api/order"; import {payOrder} from '@/api/order';
import { getPersonalInfo } from "@/api/user"; import {getPersonalInfo} from '@/api/user';
const prop = defineProps({ const prop = defineProps({
interval: { interval: {
@@ -78,15 +73,15 @@ const prop = defineProps({
}, },
}); });
const emit = defineEmits(["closePay", "successPay"]); const emit = defineEmits(['closePay', 'successPay']);
const info = ref<{ integral?: any }>({}); const info = ref<{integral?: any}>({});
watch( watch(
() => prop.isShowPay, () => prop.isShowPay,
() => { () => {
getInfo(); getInfo();
} },
); );
const getInfo = async () => { const getInfo = async () => {
@@ -96,7 +91,7 @@ const getInfo = async () => {
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
throw error; throw error;
} }
@@ -105,13 +100,13 @@ const getInfo = async () => {
const goPay = async (type: number) => { const goPay = async (type: number) => {
if (!prop.jfInfo) if (!prop.jfInfo)
return Taro.showToast({ return Taro.showToast({
title: "未获取到订单信息~", title: '未获取到订单信息~',
icon: "none", icon: 'none',
}); });
try { try {
console.log(prop.jfInfo); console.log(prop.jfInfo);
// 1微信支付 2积分支付 3专属积分兑换 // 1微信支付 2积分支付 3专属积分兑换
const { data } = await payOrder({ const {data} = await payOrder({
oid: prop.jfInfo.oid, oid: prop.jfInfo.oid,
OrderType: prop.OrderType, OrderType: prop.OrderType,
PayType: type, PayType: type,
@@ -128,53 +123,53 @@ const goPay = async (type: number) => {
paySign: data.data.paySign, paySign: data.data.paySign,
success: function () { success: function () {
Taro.showToast({ Taro.showToast({
title: "支付成功", title: '支付成功',
icon: "success", icon: 'success',
duration: 2000, duration: 2000,
}); });
emit("successPay", false); emit('successPay', false);
}, },
fail: function () { fail: function () {
Taro.showToast({ Taro.showToast({
title: "支付失败", title: '支付失败',
icon: "none", icon: 'none',
duration: 2000, duration: 2000,
}); });
emit("closePay", false); emit('closePay', false);
}, },
}); });
} else { } else {
Taro.showToast({ Taro.showToast({
title: "支付失败,请稍后再试~", title: '支付失败,请稍后再试~',
icon: "none", icon: 'none',
}); });
emit("closePay", false); emit('closePay', false);
} }
break; break;
default: default:
Taro.showToast({ Taro.showToast({
title: "支付成功", title: '支付成功',
icon: "none", icon: 'none',
}); });
emit("successPay", false); emit('successPay', false);
break; break;
} }
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
emit("closePay", false); emit('closePay', false);
throw e; throw e;
} }
}; };
const closePay = () => { const closePay = () => {
Taro.showToast({ Taro.showToast({
title: "取消支付", title: '取消支付',
icon: "none", icon: 'none',
}); });
emit("closePay", false); emit('closePay', false);
}; };
</script> </script>

View File

@@ -0,0 +1,61 @@
<template>
<view>
<view class="flex justify-center" v-if="storeList.length > 0">
<view
class="bg-white rounded-[15px] mt-3 p-2 w-[95%] flex items-center"
v-for="(item, index) in storeList"
:key="index"
@click="goDetail(item)">
<image
class="w-[200px] h-[200px] rounded-[15px] mr-2"
:src="item.head_photo" />
<view class="flex-1">
<view class="text-[#333333] text-[30px] font-bold">{{
item.name
}}</view>
<nut-rate
spacing="1"
active-color="rgba(252, 207, 10, 1)"
v-model="item.rate" />
<view class="text-[#9E9E9E] text-[25px]">销量10000</view>
<view class="text-[#9E9E9E] text-[25px]"
>营业时间{{ item.week_start }}-{{ item.week_end }}</view
>
<view class="text-[#999999] text-[23px]">{{ item.address }}</view>
</view>
</view>
</view>
<nut-empty v-else description="暂无数据"></nut-empty>
</view>
</template>
<script setup lang="ts">
import {getStoreList} from '@/api/home';
import Taro from '@tarojs/taro';
import {ref} from 'vue';
const name = defineModel({
default: '',
});
const storeList = ref<any>([]);
Taro.useLoad(() => {
getList();
});
const getList = async () => {
const res = await getStoreList({
name: name.value,
});
storeList.value = res.data.data;
};
const goDetail = item => {
Taro.setStorageSync('mer_info', item);
Taro.navigateTo({
url: `/pages/mer/mer_detail/index`,
});
};
</script>
<style lang="scss"></style>

View File

@@ -1,30 +1,51 @@
<template> <template>
<view> <view>
<view class="footer" v-if="info.status !== 1"> <view class="footer" v-if="info.status !== 1">
<view <nut-popover
v-if="info.status !== 2"
v-model:visible="popoverShow"
:list="popoverList"
:duration="0"
location="bottom-start"
@choose="popoverChoose">
<template #reference>
<view class="text-[#9C9C9C] text-[30px]">更多</view>
</template>
</nut-popover>
<view v-else></view>
<view class="flex">
<!-- <view
v-if="info.status !== 2" v-if="info.status !== 2"
class="btn" class="btn"
style="border: 1px #7f7f7f solid; color: #666666" style="border: 1px #7f7f7f solid; color: #666666"
@click="visible = true" @click="visible = true"
>挂帐</view >挂帐</view
> > -->
<view <view
v-if="info.status !== 2" v-if="info.status !== 2"
class="btn" class="btn"
style="background-color: #009ee0" style="background-color: #009ee0"
@click="to_menu_page" @click="to_menu_page"
>继续点单</view >继续点单</view
> >
<view <view
v-if="info.status !== 2"
class="btn"
style="background-color: none; color: black; border: 1px solid #000"
@click="cancelOrder"
>取消订单</view
>
<!-- <view
v-if="info.status !== 2" v-if="info.status !== 2"
class="btn" class="btn"
style="background-color: #ffa938" style="background-color: #ffa938"
@click="visible1 = true" @click="visible1 = true"
>修改</view >修改</view
> > -->
<view class="btn" style="background-color: #fd0100" @click="to_pay_page" <view class="btn" style="background-color: #fd0100" @click="to_pay_page"
>收款码</view >收款码</view
> >
</view>
</view> </view>
<nut-dialog v-model:visible="visible" @ok="onOk"> <nut-dialog v-model:visible="visible" @ok="onOk">
<template #header>挂帐</template> <template #header>挂帐</template>
@@ -57,9 +78,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import {onMounted, ref} from 'vue';
import { confirmAfterOrder, editAfterOrder } from "@/api/admin"; import {cancelAfterOrder, confirmAfterOrder, editAfterOrder} from '@/api/admin';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
const props = defineProps({ const props = defineProps({
info: { info: {
@@ -69,17 +90,33 @@ const props = defineProps({
}); });
onMounted(() => { onMounted(() => {
console.log(props.info); // console.log(props.info);
}) popoverList.value = [
{
name: '修改',
value: 1,
disabled: props.info.status === 2,
className: 'text-[35px] p-[10px]',
},
{
name: '挂帐',
value: 2,
disabled: props.info.status === 2,
className: 'text-[35px] p-[10px]',
},
];
const emits = defineEmits(["ok"]); console.log(popoverList.value);
});
const emits = defineEmits(['ok', 'cancelOrderOk']);
const visible = ref(false); const visible = ref(false);
const visible1 = ref(false); const visible1 = ref(false);
const formVal = ref({ const formVal = ref({
seat: "", seat: '',
notes: "", notes: '',
}); });
const onCancel = () => { const onCancel = () => {
@@ -94,9 +131,9 @@ const onOk = async () => {
}); });
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
emits("ok"); emits('ok');
}; };
const onOk1 = async () => { const onOk1 = async () => {
@@ -111,15 +148,15 @@ const onOk1 = async () => {
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
formVal.value = { formVal.value = {
seat: "", seat: '',
notes: "", notes: '',
}; };
emits("ok"); emits('ok');
}; };
const to_pay_page = () => { const to_pay_page = () => {
@@ -133,13 +170,39 @@ const to_menu_page = () => {
url: `/pages/admin/add_order/add_menu/index?type=1&bid=${props.info.bid}&oid=${props.info.oid}&seat=${props.info.seat}&phone=${props.info.phone}&notes=${props.info.notes}`, url: `/pages/admin/add_order/add_menu/index?type=1&bid=${props.info.bid}&oid=${props.info.oid}&seat=${props.info.seat}&phone=${props.info.phone}&notes=${props.info.notes}`,
}); });
}; };
const popoverShow = ref(false);
const popoverList = ref<any>([]);
const popoverChoose = e => {
console.log(e);
switch (e.value) {
case 1:
visible1.value = true;
break;
case 2:
visible.value = true;
break;
}
};
const cancelOrder = async () => {
const res = await cancelAfterOrder({
oid: props.info.oid,
});
Taro.showToast({
title: res.msg,
icon: 'none',
});
emits('cancelOrderOk');
};
</script> </script>
<style lang="scss"> <style lang="scss">
.footer { .footer {
display: flex; display: flex;
justify-content: flex-end; justify-content: space-between;
padding: 20px; padding: 20px;
align-items: center;
.btn { .btn {
width: 143px; width: 143px;
height: 56px; height: 56px;

View File

@@ -7,7 +7,8 @@ page {
.tabs { .tabs {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 20px 30px; padding: 20px 30px;
background-color: #ffffff;
.item { .item {
display: flex; display: flex;
@@ -61,11 +62,13 @@ page {
min-width: 195px; min-width: 195px;
height: 195px; height: 195px;
border-radius: 12px; border-radius: 12px;
margin-right: 20px;
} }
.center { .center {
margin-left: 20px; display: flex;
flex-direction: column;
justify-content: space-between;
.title { .title {
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;

View File

@@ -5,25 +5,24 @@
class="item" class="item"
v-for="item in tabs" v-for="item in tabs"
:key="item.value" :key="item.value"
@click="changeTabs(item.value)" @click="changeTabs(item.value)">
>
<text>{{ item.text }}</text> <text>{{ item.text }}</text>
<view <view
class="line" class="line"
:class="tabsIndex == item.value ? 'active' : ''" :class="tabsIndex == item.value ? 'active' : ''"></view>
></view>
</view> </view>
</view> </view>
<view v-if="listData.length > 0"> <view v-if="listData.length > 0">
<view <view
class="card" class="card"
v-for="(item, index) in (listData as any[])" v-for="(item, index) in (listData as any[])"
:key="index" :key="index">
>
<view class="header"> <view class="header">
<view> <view>
<text>台号: {{ item.seat }}</text> <text class="text-[#9C9C9C] text-[28px]"
<text>点单人: {{ item.PlaceUser?.nickName }}</text> >台号: {{ item.seat }}</text
>
<!-- <text>点单人: {{ item.PlaceUser?.nickName }}</text> -->
</view> </view>
<view <view
:style="{ :style="{
@@ -38,8 +37,7 @@
<view <view
class="goods-list" class="goods-list"
v-for="(itm, idx) in item.OrderGoods" v-for="(itm, idx) in item.OrderGoods"
:key="idx" :key="idx">
>
<image :src="itm.Goods.cover"></image> <image :src="itm.Goods.cover"></image>
<view class="center"> <view class="center">
<nut-ellipsis <nut-ellipsis
@@ -47,23 +45,20 @@
:content="itm.Goods.name" :content="itm.Goods.name"
rows="3" rows="3"
expand-text="展开" expand-text="展开"
collapse-text="收起" collapse-text="收起"></nut-ellipsis>
></nut-ellipsis> <view class="text-[#9C9C9C]">
<!-- <view class="title">{{ itm.Goods.name }}</view> --> <view>订单时间: {{ item.add_time.slice(0, 10) }}</view>
<view>备注: {{ item.notes }}</view>
</view>
</view> </view>
<view class="num"> <view class="num">
<view>x{{ itm.pay_price }}</view> <view>{{ itm.pay_price }}</view>
<view>x{{ itm.number }}</view> <view>x{{ itm.number }}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="desc"> <!-- <view class="line"></view> -->
<view>订单时间: {{ item.add_time }}</view> <Footer :info="item" @ok="get_list" @cancelOrderOk="get_list" />
<view>备注: {{ item.notes }}</view>
</view>
<view class="line"></view>
<Footer :info="item" @ok="get_list" />
</view> </view>
</view> </view>
<nut-empty v-else description="暂无订单"></nut-empty> <nut-empty v-else description="暂无订单"></nut-empty>
@@ -71,32 +66,32 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import Footer from "./components/Footer.vue"; import Footer from './components/Footer.vue';
import { getAfterOrderList } from "@/api/admin"; import {getAfterOrderList} from '@/api/admin';
const tabsIndex = ref(1); const tabsIndex = ref(0);
const listData = ref([]); const listData = ref([]);
const tabs = ref([ const tabs = ref([
{ {
text: "未收款", text: '全部',
value: 0,
},
{
text: '未收款',
value: 1, value: 1,
}, },
{ {
text: "挂帐中", text: '挂帐中',
value: 3, value: 3,
}, },
{ {
text: "已收款", text: '已收款',
value: 2, value: 2,
}, },
{
text: "全部",
value: 0,
},
]); ]);
Taro.useDidShow(() => { Taro.useDidShow(() => {
@@ -110,10 +105,10 @@ const changeTabs = (index: number) => {
const get_list = async () => { const get_list = async () => {
Taro.showLoading({ Taro.showLoading({
title: "加载中", title: '加载中',
}); });
const user_info = await Taro.getStorageSync("userInfo"); const user_info = await Taro.getStorageSync('userInfo');
const { data: res } = await getAfterOrderList({ const {data: res} = await getAfterOrderList({
bid: user_info.data.bid, bid: user_info.data.bid,
status: tabsIndex.value, status: tabsIndex.value,
}); });
@@ -124,26 +119,26 @@ const get_list = async () => {
const get_color = (status: number) => { const get_color = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "#FD0100"; return '#FD0100';
case 1: case 1:
return "#03A113"; return '#03A113';
case 2: case 2:
return "#FFA938"; return '#FFA938';
} }
}; };
const get_status_text = (status: number) => { const get_status_text = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "未付款"; return '未付款';
case 1: case 1:
return "已付款"; return '已付款';
case 2: case 2:
return "挂帐中"; return '挂帐中';
} }
}; };
const to_page = (item) => { const to_page = item => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?bid=${item.bid}&oid=${item.oid}`, url: `/pages/admin/add_order/pending_order/pending_order_detail/index?bid=${item.bid}&oid=${item.oid}`,
}); });
@@ -151,5 +146,5 @@ const to_page = (item) => {
</script> </script>
<style lang="scss"> <style lang="scss">
@import "./index.scss"; @import './index.scss';
</style> </style>

View File

@@ -1,5 +1,5 @@
.container { .container {
margin: 30px; padding: 20px;
.name { .name {
font-size: 55px; font-size: 55px;

View File

@@ -33,11 +33,13 @@
height: 195px; height: 195px;
border-radius: 12px; border-radius: 12px;
min-width: 195px; min-width: 195px;
margin-right: 20px;
} }
.center { .center {
margin-left: 20px; display: flex;
flex-direction: column;
justify-content: space-between;
.title { .title {
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
@@ -54,7 +56,7 @@
} }
.desc { .desc {
padding: 10px 20px; // padding: 10px 0px;
color: #666666; color: #666666;
} }
} }
@@ -75,4 +77,4 @@
color: #333333; color: #333333;
font-size: 32px; font-size: 32px;
} }
} }

View File

@@ -4,8 +4,8 @@
<view class="card" style="margin-top: 15px"> <view class="card" style="margin-top: 15px">
<view class="header"> <view class="header">
<view> <view>
<text>台号: {{ data.seat }}</text> <text class="text-[#9C9C9C]">台号: {{ data.seat }}</text>
<text>点单人: {{ data.PlaceUser?.nickName }}</text> <!-- <text>点单人: {{ data.PlaceUser?.nickName }}</text> -->
</view> </view>
<view <view
:style="{ :style="{
@@ -24,17 +24,16 @@
:content="itm.Goods.name" :content="itm.Goods.name"
rows="3" rows="3"
expand-text="展开" expand-text="展开"
collapse-text="收起" collapse-text="收起"></nut-ellipsis>
></nut-ellipsis>
<!-- <view class="title">{{ itm.Goods.name }}</view> --> <!-- <view class="title">{{ itm.Goods.name }}</view> -->
</view> </view>
<view class="num"> <view class="num">
<view>x{{ itm.pay_price }}</view> <view>{{ itm.pay_price }}</view>
<view>x{{ itm.number }}</view> <view>x{{ itm.number }}</view>
</view> </view>
</view> </view>
<view class="line"></view> <!-- <view class="line"></view> -->
<Footer :info="data" @ok="get_data" /> <Footer :info="data" @ok="get_data" @cancelOrderOk="back" />
</view> </view>
<nut-cell-group> <nut-cell-group>
<nut-cell> <nut-cell>
@@ -50,17 +49,14 @@
<nut-cell <nut-cell
v-if="data.status !== 0" v-if="data.status !== 0"
title="收款时间" title="收款时间"
:desc="data.payment_time" :desc="data.payment_time"></nut-cell>
></nut-cell>
<nut-cell <nut-cell
v-if="data.status !== 0 && data.status !== 1" v-if="data.status !== 0 && data.status !== 1"
title="挂帐时间" title="挂帐时间"
:desc="data.payment_time" :desc="data.payment_time"></nut-cell>
></nut-cell>
<nut-cell <nut-cell
title="订单状态" title="订单状态"
:desc="get_status_text(data.status)" :desc="get_status_text(data.status)"></nut-cell>
></nut-cell>
<nut-cell title="下单数量" :desc="String(data.count)"></nut-cell> <nut-cell title="下单数量" :desc="String(data.count)"></nut-cell>
<nut-cell title="订单金额" :desc="String(data.payments)"></nut-cell> <nut-cell title="订单金额" :desc="String(data.payments)"></nut-cell>
<nut-cell title="应收金额" :desc="String(data.payments)"></nut-cell> <nut-cell title="应收金额" :desc="String(data.payments)"></nut-cell>
@@ -68,28 +64,25 @@
<nut-cell <nut-cell
v-if="data.status !== 0" v-if="data.status !== 0"
title="实收金额" title="实收金额"
:desc="String(data.pay_amount)" :desc="String(data.pay_amount)"></nut-cell>
></nut-cell>
<nut-cell <nut-cell
v-if="data.status !== 0" v-if="data.status !== 0"
title="抹零" title="抹零"
:desc="String(data.zero)" :desc="String(data.zero)"></nut-cell>
></nut-cell>
<nut-cell <nut-cell
v-if="data.status !== 0" v-if="data.status !== 0"
title="收款方式" title="收款方式"
desc="微信" desc="微信"></nut-cell>
></nut-cell>
<nut-cell title="备注" :desc="data.notes"></nut-cell> <nut-cell title="备注" :desc="data.notes"></nut-cell>
</nut-cell-group> </nut-cell-group>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import Footer from "../components/Footer.vue"; import Footer from '../components/Footer.vue';
import { getAfterOrder } from "@/api/admin"; import {getAfterOrder} from '@/api/admin';
// import BackComponent from "../../../../../components/Back.vue"; // import BackComponent from "../../../../../components/Back.vue";
const data = ref<any>({}); const data = ref<any>({});
@@ -103,7 +96,7 @@ Taro.useLoad((e: any) => {
const get_data = async () => { const get_data = async () => {
Taro.showLoading({ Taro.showLoading({
title: "加载中", title: '加载中',
}); });
const res = await getAfterOrder({ const res = await getAfterOrder({
bid: params.value.bid, bid: params.value.bid,
@@ -116,26 +109,32 @@ const get_data = async () => {
const get_color = (status: number) => { const get_color = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "#FD0100"; return '#FD0100';
case 1: case 1:
return "#03A113"; return '#03A113';
case 2: case 2:
return "#FFA938"; return '#FFA938';
} }
}; };
const get_status_text = (status: number) => { const get_status_text = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "未付款"; return '未付款';
case 1: case 1:
return "已付款"; return '已付款';
case 2: case 2:
return "挂帐中"; return '挂帐中';
} }
}; };
const back = () => {
Taro.navigateBack({
delta: 1,
});
};
</script> </script>
<style lang="scss"> <style lang="scss">
@import "./index.scss"; @import './index.scss';
</style> </style>

View File

@@ -1,71 +1,77 @@
<template> <template>
<view> <view>
<view class="header"> <!-- 订单信息 -->
<view>订单号:{{ info.oid }}</view>
<view>{{ info.add_time }}</view>
</view>
<view class="card">
<view class="center" v-for="(itm, idx) in info.OrderGoods" :key="idx">
<view class="top">
<image :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods.name }} </view>
<view class="right">
<view v-if="info.pay_type === 1">{{ itm.pay_price }}</view>
<view v-else>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</view>
</view>
</view>
</view>
<view class="line"></view>
<view class="bom" style="text-align: right">
{{ info.count }}件商品,支付方式:{{
info.pay_type === 1 ? "微信" : "积分"
}},实付:
<text style="color: red">{{
info.pay_type === 1 ? `${info.price}` : `${info.exchange}积分`
}}</text>
</view>
</view>
<nut-cell-group> <nut-cell-group>
<nut-cell title="订单状态:" :desc="orderStatus"></nut-cell> <nut-cell>
<template #default>
<view class="center-box">
<view
class="top"
v-for="(item, index) in info.OrderGoods"
:key="index">
<image class="mr-10" :src="item.Goods?.cover" />
<view class="flex-1">
<view class="title">{{ item.Goods?.name }}</view>
<view class="text-[#F83D3D] mt-5">
<view>{{ item.pay_price }}</view>
<view>{{ item.pay_integral }}积分</view>
</view>
</view>
<view class="right">
<view>x{{ item.number }}</view>
</view>
</view>
<view
class="flex justify-between items-center mt-2 mb-2 text-[25px]">
<view class="text-[#9C9C9C]">{{ `${info.count}件商品` }}</view>
<view
>{{ info.status !== 0 ? '实' : '应' }}付款{{
info.pay_type === 1 ? '(元): ' : '(积分): '
}}{{ info.pay_type === 1 ? info.price : info.exchange }}</view
>
</view>
</view>
</template>
</nut-cell>
</nut-cell-group>
<nut-cell-group>
<nut-cell title="订单号:" :desc="info.oid"></nut-cell>
<nut-cell
title="订单状态:"
:desc="
info.status === 0
? '待付款'
: info.status === 1
? '待使用'
: info.status === 2
? '已使用'
: '已失效'
">
</nut-cell>
<nut-cell title="下单用户:" :desc="info.User?.nickName"></nut-cell> <nut-cell title="下单用户:" :desc="info.User?.nickName"></nut-cell>
<nut-cell title="用户手机号:" :desc="info.User?.phone"></nut-cell> <nut-cell title="用户手机号:" :desc="info.User?.phone"></nut-cell>
<nut-cell title="下单时间:" :desc="info.add_time"></nut-cell>
<nut-cell title="核销时间:" :desc="info.User?.phone"></nut-cell> <nut-cell title="核销时间:" :desc="info.User?.phone"></nut-cell>
<nut-cell <nut-cell
v-if="info.status === 2" v-if="info.status === 2"
title="核销人员:" title="核销人员:"
:desc="info.CancelUser?.nickName" :desc="info.CancelUser?.nickName"></nut-cell>
></nut-cell>
<nut-cell <nut-cell
v-if="info.status === 2" v-if="info.status === 2"
title="核销人手机号:" title="核销人手机号:"
:desc="info.CancelUser?.phone" :desc="info.CancelUser?.phone"></nut-cell>
></nut-cell>
</nut-cell-group> </nut-cell-group>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { computed, ref } from "vue"; import {ref} from 'vue';
const info = ref<any>({}); const info = ref<any>({});
Taro.useLoad(() => { Taro.useLoad(() => {
info.value = Taro.getStorageSync("ver_order_info"); info.value = Taro.getStorageSync('ver_order_info');
console.log(info.value);
});
const orderStatus = computed(() => {
switch (info.value.status) {
case 1:
return "待核销";
case 2:
return "已核销";
case 3:
return "已失效";
}
}); });
</script> </script>
@@ -148,6 +154,7 @@ page {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
// align-items: flex-start; // align-items: flex-start;
margin-bottom: 10px;
image { image {
width: 150px; width: 150px;
@@ -172,4 +179,41 @@ page {
} }
} }
} }
.center-box {
display: flex;
flex-direction: column;
width: 100%;
.top {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10rpx;
image {
width: 150px;
height: 150px;
border-radius: 10rpx;
margin-right: 10px;
}
.title {
margin-left: 10px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
width: 350px;
}
.right {
margin-left: 10px;
font-size: 28px;
text-align: right;
}
}
}
</style> </style>

View File

@@ -1,29 +1,94 @@
.tabs-1 { .tabs-1 {
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
justify-content: space-between; justify-content: space-evenly;
align-items: center; align-items: center;
background-color: #fff; background-color: #fff;
padding: 10px; // padding: 10px;
overflow-x: scroll;
.item { .item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
.line { .line {
margin-top: 10px auto; margin: 10px auto;
width: 50px; width: 50px;
height: 5px; height: 8px;
border-radius: 15px;
} }
} }
} }
// .order-card {
// 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;
// }
// .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: flex-start;
// image {
// width: 150px;
// height: 150px;
// border-radius: 10px;
// }
// .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;
// }
// }
// }
// }
.order-card { .order-card {
width: 95%;
box-sizing: border-box; box-sizing: border-box;
margin: 15px auto; margin: 15px auto;
background-color: #fff; background-color: #fff;
border-radius: 10px;
padding: 20px; padding: 20px;
.line { .line {
@@ -34,18 +99,9 @@
} }
.top { .top {
// display: flex; display: flex;
// justify-content: space-between; justify-content: space-between;
// align-items: center; align-items: center;
.name {
font-weight: bold;
}
.sub {
color: #999;
font-size: 30px;
}
} }
.btn { .btn {
@@ -55,19 +111,20 @@
} }
.center { .center {
// margin-bottom: 10px;
.top { .top {
display: flex; display: flex;
justify-content: space-between; // justify-content: space-between;
// align-items: flex-start; align-items: flex-start;
image { image {
width: 150px; width: 150px;
height: 150px; height: 150px;
border-radius: 10px; border-radius: 15px;
margin-right: 10px;
} }
.title { .title {
margin-left: 10px;
display: -webkit-box; display: -webkit-box;
overflow: hidden; overflow: hidden;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
@@ -80,6 +137,7 @@
margin-left: 10px; margin-left: 10px;
font-size: 28px; font-size: 28px;
text-align: right; text-align: right;
color: #9c9c9c;
} }
} }
} }

View File

@@ -5,15 +5,18 @@
class="item" class="item"
v-for="(item, index) in opt" v-for="(item, index) in opt"
:key="index" :key="index"
@click="tabChange(item.value)" @click="tabChange(item.value)">
> <view
<view>{{ item.text }}</view> :style="{
color: item.value === tabVal ? '#333333' : '#9C9C9C',
}"
>{{ item.text }}</view
>
<view <view
class="line" class="line"
:style="{ :style="{
backgroundColor: item.value === tabVal ? 'red' : '', backgroundColor: item.value === tabVal ? '#FFD940' : '',
}" }"></view>
></view>
</view> </view>
</view> </view>
<view v-if="dataList.length > 0"> <view v-if="dataList.length > 0">
@@ -21,73 +24,87 @@
class="order-card" class="order-card"
v-for="(item, index) in dataList" v-for="(item, index) in dataList"
:key="index" :key="index"
@click="toDetailPage(item)" @click="toDetailPage(item)">
>
<view class="top"> <view class="top">
<view class="name">订单号:{{ item.oid }}</view> <view class="text-[#9C9C9C] text-[25px]">订单号{{ item.oid }}</view>
<!-- <view class="sub">下单时间{{ item.add_time }}</view> --> <view
<view class="sub" v-if="item.status !== 3">核销时间:{{ item.cancel_time || "待核销" }}</view> :style="{
<!-- <view style="color: red">{{ color:
item.status === 0 item.status === 0
? "待付款" ? '#FF850A'
: item.status === 1 : item.status === 1
? "待使用" ? '#F83D3D'
: item.status === 2 : item.status === 2
? "已使用" ? '#333333'
: "已失效" : '#9C9C9C',
}}</view> --> }"
>{{
item.status === 0
? '待付款'
: item.status === 1
? '待使用'
: item.status === 2
? '已使用'
: '已失效'
}}
</view>
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx"> <view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
<view class="top"> <view class="top">
<image :src="itm.Goods.cover" /> <image class="mr-10" :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods.name }} </view> <view class="flex-1">
<view class="title">{{ itm.Goods?.name }}</view>
<view class="text-[#F83D3D] mt-5">
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
</view>
</view>
<view class="right"> <view class="right">
<view v-if="item.pay_type === 1">{{ itm.pay_price }}</view>
<view v-else>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</view> <view>x{{ itm.number }}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="line"></view> <view
<view class="bom" style="text-align: right"> class="flex justify-between items-center mt-2 mb-2 text-[25px]"
{{ item.count }}件商品,支付方式:{{ v-if="item.status !== 0">
item.pay_type === 1 ? "微信" : "积分" <text class="text-[#9C9C9C]">{{ item.count }}件商品</text>
}},实付: <view
<text style="color: red">{{ >{{ item.status !== 0 ? '实' : '应' }}付款{{
item.pay_type === 1 ? `${item.price}` : `${item.exchange}积分` item.pay_type === 1 ? '(元): ' : '(积分): '
}}</text> }}{{ item.pay_type === 1 ? item.price : item.exchange }}</view
>
</view> </view>
</view> </view>
</view> </view>
<nut-empty v-else description="暂无订单数据"></nut-empty> <nut-empty v-else description="暂无订单"></nut-empty>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { getActiveOrderList } from "../../../../api/admin"; import {getActiveOrderList} from '../../../../api/admin';
const opt = ref([ const opt = ref([
{ {
text: "全部", text: '全部',
value: 0, value: 0,
}, },
{ {
text: "待付款", text: '待付款',
value: 1, value: 1,
}, },
{ {
text: "待核销", text: '待核销',
value: 2, value: 2,
}, },
{ {
text: "已核销", text: '已核销',
value: 3, value: 3,
}, },
{ {
text: "已失效", text: '已失效',
value: 4, value: 4,
}, },
]); ]);
@@ -96,42 +113,63 @@ const tabVal = ref(0);
const dataList = ref<any>([]); const dataList = ref<any>([]);
Taro.useLoad((options) => { const pageOpt = ref({
page: 1,
total: 0,
});
Taro.useLoad(options => {
tabVal.value = Number(options.type); tabVal.value = Number(options.type);
getData(); getData();
}); });
const getData = async () => { const getData = async () => {
Taro.showLoading({
title: '加载中',
});
try { try {
const user_info = Taro.getStorageSync("userInfo"); const user_info = Taro.getStorageSync('userInfo');
const data = { const data = {
bid: user_info.data.bid, bid: user_info.data.bid,
status: tabVal.value, status: tabVal.value,
PageNum: pageOpt.value.page,
PageSize: 10,
}; };
const res = await getActiveOrderList(data); const res = await getActiveOrderList(data);
dataList.value = res.data.data; dataList.value.push(...res.data.data);
pageOpt.value.total = res.data.total || 0;
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
Taro.hideLoading();
}; };
const tabChange = (e: number) => { const tabChange = (e: number) => {
console.log(e);
tabVal.value = e; tabVal.value = e;
getData(); getData();
}; };
const toDetailPage = (item: any) => { const toDetailPage = (item: any) => {
Taro.setStorageSync("ver_order_info", item); Taro.setStorageSync('ver_order_info', item);
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/admin/order_manage/detail/index", url: '/pages/admin/order_manage/detail/index',
}); });
}; };
Taro.useReachBottom(() => {
if (pageOpt.value.total === dataList.value.length)
return Taro.showToast({
title: '没有更多数据了',
icon: 'none',
});
pageOpt.value.page++;
getData();
});
</script> </script>
<style lang="scss"> <style lang="scss">
@import "./index.scss"; @import './index.scss';
</style> </style>

View File

@@ -106,6 +106,7 @@
<nut-calendar <nut-calendar
v-model:visible="isVisible" v-model:visible="isVisible"
type="range" type="range"
:default-value="pickerVal"
:start-date="date_start" :start-date="date_start"
@close="isVisible = false" @close="isVisible = false"
@choose="setChooseValue" @choose="setChooseValue"
@@ -193,11 +194,17 @@ const opts = ref<any>({
], ],
}); });
const pickerVal = ref<any>([])
Taro.useLoad((options) => { Taro.useLoad((options) => {
where.value.type = options.type === "price" ? 1 : 2; where.value.type = options.type === "price" ? 1 : 2;
time.value = options.time; time.value = options.time;
setTime(options.time); setTime(options.time);
// getData(); // getData();
pickerVal.value = [
dayjs().format('YYYY-MM-DD'),
dayjs().format('YYYY-MM-DD'),
];
}); });
const setTime = (type: string) => { const setTime = (type: string) => {

View File

@@ -1,13 +1,17 @@
<template> <template>
<view> <view>
<view class="card"> <view class="card">
<nut-button block type="primary" @click="scanCode">扫码核销</nut-button> <image
class="image"
@tap="scanCode"
src="http://p1.meituan.net/csc/696924dda634f05689dabdfbb18e88cc13551.png" />
<view class="mt-2 text-[#7A7A7A]">扫描二维码核销</view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
// url参数转对象 // url参数转对象
// const urlParse = (url: string) => { // const urlParse = (url: string) => {
@@ -28,8 +32,8 @@ import Taro from "@tarojs/taro";
const scanCode = () => { const scanCode = () => {
Taro.scanCode({ Taro.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
scanType: ["qrCode"], scanType: ['qrCode'],
success: async (res) => { success: async res => {
try { try {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/admin/verify/verify_list/index?oid=${res.result}`, url: `/pages/admin/verify/verify_list/index?oid=${res.result}`,
@@ -37,7 +41,7 @@ const scanCode = () => {
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
}, },
@@ -48,21 +52,27 @@ const scanCode = () => {
<style lang="scss"> <style lang="scss">
page { page {
background-color: #f5f5f5; background-color: #f5f5f5;
background-image: url("~@/static/admin/cancellation-header.png"); background-image: url('http://p0.meituan.net/csc/e6ff5582788af2023f49241afe22fc89391851.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 30%; background-size: 100% 25%;
} }
.card { .card {
width: 80%; width: 690px;
height: 300px; height: 300px;
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
margin: 300px auto; margin: 300px auto;
border-radius: 10px; border-radius: 33px;
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 100px; padding: 0 100px;
.image {
width: 150px;
height: 150px;
}
} }
</style> </style>

View File

@@ -0,0 +1,38 @@
.card {
padding: 20rpx;
background-color: #fff;
margin: 20px auto;
.container {
display: flex;
justify-content: space-between;
.image {
width: 150px;
height: 150px;
border-radius: 15px;
margin-right: 20px;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.title {
margin-bottom: 10px;
}
}
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px 0;
}
}
.nut-button {
border-radius: 20px;
}

View File

@@ -1,49 +1,71 @@
<template> <template>
<view> <view>
<view class="card"> <view class="card">
<view>订单号{{ goodInfo.oid }}</view> <view class="text-[#7A7A7A]">订单号{{ goodInfo.oid }}</view>
<view class="line"></view> <view class="line"></view>
<view <view
class="container" class="container"
v-for="(item, index) in goodInfo.OrderGoods" v-for="(item, index) in goodInfo.OrderGoods"
:key="index" :key="index">
> <image class="image" :src="item.Goods.cover"></image>
<image class="image" :src="item.Goods.cover" mode="widthFix"></image>
<view class="info"> <view class="info">
<view class="title">商品名称{{ item.Goods.name }}</view> <view class="title">{{ item.Goods.name }}</view>
<view class="title">描述{{ item.Goods.profile }}</view> <view class="text-[#7A7A7A] text-[22px]">{{
<view class="num" item.Goods.profile || '此商品暂无描述'
>数量: <text style="color: red">{{ item.number }}</text></view }}</view>
>
</view> </view>
<view></view> <view class="text-[#9C9C9C]">x{{ item.number }}</view>
</view> </view>
<view class="line"></view> <view class="line"></view>
<text>支付方式{{ goodInfo.pay_type === 1 ? "微信" : "积分" }}</text <view
> class="flex justify-between items-center mt-3 mb-2 text-[25px]"
<text style="text-align: right">
>总计{{ <text class="text-[#9C9C9C] text-left"
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange >{{ goodInfo.count }}件商品</text
}}</text >
> <text class="flex-1"
<view class="line"></view> >{{ goodInfo.status !== 0 ? '实' : '应' }}付款{{
<view class="cz"> goodInfo.pay_type === 1 ? '(元): ' : '(积分): '
}}{{
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
}}</text
>
</view>
<!-- <view class="line"></view> -->
<!-- <view class="cz">
<nut-button size="small" type="primary" @click="subVerify" <nut-button size="small" type="primary" @click="subVerify"
>确定核销</nut-button >确定核销</nut-button
> >
</view> </view> -->
</view>
<nut-cell-group>
<nut-cell title="订单信息"></nut-cell>
<nut-cell
title="下单时间:"
:desc="goodInfo.add_time?.slice(0, 19)"></nut-cell>
<nut-cell title="下单号码:" :desc="goodInfo.User?.phone"></nut-cell>
<nut-cell title="下单用户:" :desc="goodInfo.User?.nickName"></nut-cell>
<nut-cell
title="付款方式:"
:desc="getPayType(goodInfo.pay_type)"></nut-cell>
</nut-cell-group>
<view class="w-[90%] mt-[40px] m-auto">
<nut-button type="primary" shape="square" block @click="subVerify"
>确定核销</nut-button
>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { getActiveVerifyList, activeOrderVerify } from "@/api/admin"; import {getActiveVerifyList, activeOrderVerify} from '@/api/admin';
import { ref } from "vue"; import {ref} from 'vue';
const opt = ref<any>({}); const opt = ref<any>({});
Taro.useLoad((options) => { Taro.useLoad(options => {
opt.value = options; opt.value = options;
getData(options); getData(options);
}); });
@@ -58,8 +80,8 @@ const getData = async (options: any) => {
}); });
if (!res.data.data.oid) { if (!res.data.data.oid) {
Taro.showToast({ Taro.showToast({
title: "没有此订单", title: '没有此订单',
icon: "none", icon: 'none',
}); });
setTimeout(() => { setTimeout(() => {
Taro.navigateBack({ Taro.navigateBack({
@@ -78,7 +100,7 @@ const subVerify = async () => {
}); });
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
setTimeout(() => { setTimeout(() => {
Taro.navigateBack({ Taro.navigateBack({
@@ -88,49 +110,26 @@ const subVerify = async () => {
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
throw error; throw error;
} }
}; };
const getPayType = (type: number) => {
switch (type) {
case 1:
return '微信线上支付';
case 2:
return '平台积分支付';
case 3:
return '天才小猪支付';
default:
return '未知';
}
};
</script> </script>
<style lang="scss"> <style lang="scss">
.card { @import './index.scss';
padding: 20rpx;
background-color: #fff;
margin: 10px auto;
width: 90%;
border-radius: 7px;
.container {
display: flex;
image {
width: 150px;
height: 150px;
border-radius: 7px;
display: block;
}
.info {
margin-left: 20px;
}
.title {
margin-bottom: 10px;
}
}
.line {
width: 100%;
height: 1px;
background-color: #f5f5f5;
margin: 10px 0;
}
.cz {
text-align: right;
}
}
</style> </style>

View File

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

View File

@@ -0,0 +1,125 @@
.text-red {
color: red;
}
.data {
display: flex;
flex-direction: column;
justify-content: center;
background-color: #fff;
padding: 10px;
.pagination {
margin: 10px auto;
}
}
.tag {
width: 100%;
padding: 5px 8px;
color: white;
border-radius: 8px;
margin: 0 auto;
}
.success {
color: #4fc08d;
}
.danger {
color: #df3526;
}
.warning {
color: #f3812e;
}
.image {
width: 50px;
height: 50px;
}
.card {
margin: 20px auto;
background-image: url('http://p0.meituan.net/csc/902ecf4ba9765a8200817d58a3a5a655172781.png');
background-size: 100% 100%;
width: 95%;
height: 250px;
border-radius: 15px;
display: flex;
flex-direction: column;
justify-content: space-between;
.container {
color: #fff;
padding: 45px 100px;
display: flex;
justify-content: space-between;
align-items: center;
text-align: center;
.line {
width: 1px;
height: 50px;
background-color: #ff9c9c;
}
}
.footer {
display: flex;
justify-content: space-between;
align-items: center;
color: #8a1717;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
background-color: rgba(255, 255, 255, 0.2);
padding: 10px 30px;
height: 150px;
}
}
.formCard {
width: 95%;
margin: auto;
border-radius: 20px;
background-color: #fff;
padding: 20px;
--nut-cell-box-shadow: none;
--nut-cell-padding: 10px 5px;
}
.nut-button {
border-radius: 20px;
border: none;
}
.title {
margin: 20px;
display: flex;
align-items: center;
.title-line {
width: 8px;
height: 35px;
background-color: #df3526;
border-radius: 20px;
margin-right: 10px;
}
}
.list {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #333333;
.item {
width: 95%;
background-color: #fff;
margin-bottom: 10px;
border-radius: 15px;
padding: 25px;
}
}

View File

@@ -1,100 +1,40 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, h } from "vue"; import {ref, h} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { getWithdrawList, addWithdraw } from "@/api/admin"; import {getWithdrawList, addWithdraw} from '@/api/admin';
const user_info = Taro.getStorageSync("userInfo"); const user_info = ref<any>({});
const mer_info = ref<any>({});
const row = ref(0); const row = ref(0);
const formRef = ref();
const basicData = ref({ const basicData = ref({
num: "", num: '',
}); });
const showPreview = ref(false); const showPreview = ref(false);
const visible1 = ref(false);
const imgData = ref([ const imgData = ref([
{ {
src: "", src: '',
}, },
]); ]);
const columns = ref([ const data = ref<any>([]);
{
title: "时间",
key: "add_time",
align: "center",
},
{
title: "提现金额",
key: "integral",
align: "center",
render: (row: { integral: number }) => {
return h("view", {}, row.integral);
},
},
{
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: "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 pagination = ref({ const pagination = ref({
page: 1, page: 1,
itemsPerPage: 5, total: 0,
showPageSize: 5,
totalItems: 0,
change: (page: number) => {
pagination.value.page = page;
getData();
},
}); });
const hideFn = () => {
showPreview.value = false;
};
Taro.useLoad(() => { Taro.useLoad(() => {
user_info.value = Taro.getStorageSync('userInfo');
mer_info.value = Taro.getStorageSync('mer_info');
getData(); getData();
}); });
@@ -102,11 +42,11 @@ const getData = async () => {
try { try {
const res = await getWithdrawList({ const res = await getWithdrawList({
PageNum: pagination.value.page, PageNum: pagination.value.page,
PageSize: pagination.value.showPageSize, PageSize: 10,
Bid: user_info.data.bid, Bid: user_info.value.data.bid,
}); });
data.value = res.data.data || []; data.value.push(...res.data.data);
pagination.value.totalItems = res.data.total; pagination.value.total = res.data.total;
row.value = res.data.integral || 0; row.value = res.data.integral || 0;
} catch (e) { } catch (e) {
throw e; throw e;
@@ -115,111 +55,220 @@ const getData = async () => {
const add = async () => { const add = async () => {
try { try {
if (Number(basicData.value.num) === 0) formRef.value?.validate().then(async ({valid}) => {
return Taro.showToast({ if (valid) {
title: "提现积分需大于0", const res = await addWithdraw({
icon: "none", Bid: user_info.value.data.bid,
}); Number: Number(basicData.value.num),
const res = await addWithdraw({ });
Bid: user_info.data.bid, Taro.showToast({
Number: Number(basicData.value.num), title: res.msg,
icon: 'none',
});
basicData.value.num = '';
await getData();
}
}); });
Taro.showToast({
title: res.msg,
icon: "none",
});
await getData();
} catch (e) { } catch (e) {
throw e; throw e;
} }
}; };
const rules = ref({
num: [
{
message: '请填写提现积分',
validator: (value, _) => {
console.log(value);
if (!value) {
return false;
} else {
return true;
}
},
},
{
message: '提现积分最低为100',
validator: (value, _) => {
if (Number(value) < 100) {
return false;
} else {
return true;
}
},
},
{
message: '提现积分不能大于可提现积分',
validator: (value, _) => {
if (Number(value) > row.value) {
return false;
} else {
return true;
}
},
},
],
});
const openPreview = item => {
imgData.value[0].src = item.status_img;
showPreview.value = true;
};
const closePreview = () => {
showPreview.value = false;
imgData.value[0].src = '';
};
Taro.usePullDownRefresh(() => {
pagination.value.page = 1;
getData();
Taro.stopPullDownRefresh();
});
Taro.useReachBottom(() => {
if (pagination.value.total === data.value.length)
return Taro.showToast({
title: '没有更多数据了',
icon: 'none',
});
pagination.value.page++;
getData();
});
</script> </script>
<template> <template>
<view> <view>
<nut-form> <view class="card">
<nut-form-item label="提现积分:"> <view class="container">
<nut-input <view class="">
v-model="basicData.num" <view class="font-bold text-[35px]">{{ row }}</view>
class="nut-input-text" <view class="text-[25px] mt-2">可提现积分</view>
placeholder="请输入提现积分" </view>
type="text" <view class="line"></view>
/> <view class="">
</nut-form-item> <view class="font-bold text-[35px]">{{
<nut-form-item> (row / 100 - (row / 100) * 0.138).toFixed(2)
}}</view>
<view class="text-[25px] mt-2">实际到账</view>
</view>
</view>
<view class="footer">
<text>到账方式</text>
<!-- <text>{{
`${mer_info.bank}(${mer_info.bank_card?.substring(
mer_info.bank_card.length - 4,
)})`
}}</text> -->
<text>银行卡汇款</text>
</view>
</view>
<view class="formCard">
<view class="flex justify-between mb-[25px]">
<text>积分提现</text>
<view class="flex items-center" @click="visible1 = true">
<image
class="w-[26px] h-[26px]"
src="http://p1.meituan.net/csc/5437a800f4ed4a49f14984494c1c3077994.png"></image>
<view class="text-[#EC4443] text-[26px] ml-1">提现疑问</view>
</view>
</view>
<nut-form ref="formRef" :model-value="basicData" :rules="rules">
<nut-form-item prop="num">
<nut-input
v-model="basicData.num"
class="nut-input-text"
placeholder="请输入提现积分"
type="text">
<template #right>
<text
class="text-[#EC4443] text-[26px]"
@tap="basicData.num = row.toString()"
>全部</text
>
</template>
</nut-input>
</nut-form-item>
</nut-form>
<nut-button block type="primary" @click="add">立即提现</nut-button>
</view>
<view class="title">
<view class="title-line"></view>
<view class="title-text">提现记录</view>
</view>
<view class="list" v-if="data.length > 0">
<view class="item" v-for="(item, index) in data" :key="index">
<view class="flex justify-between items-center">
<view class="text-[25px] text-[#9C9C9C]">到账金额</view>
<view
class="text-[27px]"
:class="
item.status === 1
? 'success'
: item.status === 1
? 'danger'
: 'warning'
"
>{{
item.status === 1
? '已打款'
: item.status === 2
? '已拒绝'
: '待审核'
}}</view
>
</view>
<view> <view>
当前可提现积分 <view class="mt-3 mb-3 text-[35px]">{{ item.number }}</view>
<text class="text-red">{{ row }}</text> <view class="text-[25px] mb-1">提现积分{{ item.integral }}</view>
<view class="text-[25px] mb-1"
>信息服务费{{ item.commission }}</view
>
<view class="text-[25px] mb-1"
>手续费{{ item.commission_number }}%</view
>
<view class="text-[25px] mb-1">时间{{ item.add_time }}</view>
<view v-if="item.status === 2" class="text-[25px] text-[#9C9C9C]"
>备注</view
>
<view
v-if="item.status === 1"
class="text-[23px] mt-2 text-[#df3526]"
@click="openPreview(item)"
>点我查看回执单</view
>
</view> </view>
<view style="margin-top: 10px">
实际到账
<text class="text-red">{{ (row / 100).toFixed(2) }}</text>
</view>
</nut-form-item>
<nut-form-item>
<nut-button block type="primary" @click="add">立即提现</nut-button>
</nut-form-item>
</nut-form>
<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"
/>
</view> </view>
</view> </view>
<nut-empty v-else description="暂无提现记录"></nut-empty> <nut-empty v-else description="暂无提现记录"></nut-empty>
<!-- 图片预览 --> <!-- 图片预览 -->
<nut-image-preview :show="showPreview" :images="imgData" @close="hideFn" /> <nut-image-preview
:show="showPreview"
:images="imgData"
@close="closePreview" />
<nut-dialog
title="提现疑问?"
content="这是基础弹框。"
ok-text="我已知晓"
:no-cancel-btn="true"
v-model:visible="visible1">
<template #default>
<text>
积分和人民币兑换比例为
<text class="text-[#F83D3D]">100:1</text>
平台收取<text class="text-[#F83D3D]">10%服务费</text><text
class="text-[#F83D3D]"
>0.038%手续费</text
>
</text>
</template>
</nut-dialog>
</view> </view>
</template> </template>
<style lang="scss"> <style lang="scss">
.text-red { @import './index.scss';
color: red;
}
.data {
display: flex;
flex-direction: column;
justify-content: center;
background-color: #fff;
padding: 10px;
.pagination {
margin: 10px auto;
}
}
.tag {
width: 100%;
padding: 5px 8px;
color: white;
border-radius: 8px;
margin: 0 auto;
}
.success {
background-color: #4fc08d;
}
.danger {
background-color: #df3526;
}
.warning {
background-color: #f3812e;
}
.image {
width: 50px;
height: 50px;
}
</style> </style>

View File

@@ -12,9 +12,8 @@
</nut-cell> </nut-cell>
<nut-checkbox-group <nut-checkbox-group
v-model="itm.state.checkboxgroup" v-model="itm.state.checkboxgroup"
:ref="(el) => getGroup(el, idx)" :ref="el => getGroup(el, idx)"
@change="(label) => changeBox(label, itm)" @change="label => changeBox(label, itm)">
>
<nut-cell v-for="(item, idx1) in itm.Goods" :key="idx1"> <nut-cell v-for="(item, idx1) in itm.Goods" :key="idx1">
<nut-checkbox :label="item.gid" style="width: 10%"></nut-checkbox> <nut-checkbox :label="item.gid" style="width: 10%"></nut-checkbox>
<view class="box"> <view class="box">
@@ -33,8 +32,7 @@
readonly readonly
:min="-1" :min="-1"
@add.stop="() => onAdd(item)" @add.stop="() => onAdd(item)"
@reduce.stop="() => onReduce(item)" @reduce.stop="() => onReduce(item)" />
/>
</view> </view>
</nut-cell> </nut-cell>
</nut-checkbox-group> </nut-checkbox-group>
@@ -44,7 +42,7 @@
<view> <view>
<view style="height: 100rpx"></view> <view style="height: 100rpx"></view>
</view> </view>
<view class="bottom-box"> <view class="bottom-box" v-if="list.length > 0">
<view class="left"> <view class="left">
<!-- <nut-checkbox v-model="selectAllVal" @change="selectAll" <!-- <nut-checkbox v-model="selectAllVal" @change="selectAll"
>全选 >全选
@@ -55,16 +53,14 @@
<nut-price <nut-price
v-model:price="localCount.price" v-model:price="localCount.price"
size="normal" size="normal"
:need-symbol="false" :need-symbol="false" />
/>
</view> </view>
<view class="text-box"> <view class="text-box">
总积分 总积分
<nut-price <nut-price
v-model:price="localCount.exchange" v-model:price="localCount.exchange"
size="normal" size="normal"
:need-symbol="false" :need-symbol="false" />
/>
</view> </view>
</view> </view>
</view> </view>
@@ -75,17 +71,16 @@
:is-show-pay="isShowPay" :is-show-pay="isShowPay"
:interval="true" :interval="true"
v-model:jfInfo="orderData" v-model:jfInfo="orderData"
@closePay="closePay" @closePay="closePay" />
/>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, ref } from "vue"; import {nextTick, ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { addCart, getAllCart } from "@/api/cart"; import {addCart, getAllCart} from '@/api/cart';
import { createActiveOrder } from "@/api/goods"; import {createActiveOrder} from '@/api/goods';
import Pay from "@/components/Pay.vue"; import Pay from '@/components/Pay.vue';
interface CardList { interface CardList {
name: string; name: string;
@@ -134,7 +129,7 @@ const changeBox = (label: string[], item: any) => {
exchange: 0, exchange: 0,
}; };
item["Count"] = { item['Count'] = {
priceCount: 0, priceCount: 0,
exchangeCount: 0, exchangeCount: 0,
}; };
@@ -143,8 +138,8 @@ const changeBox = (label: string[], item: any) => {
label.forEach((id: string) => { label.forEach((id: string) => {
item.Goods.forEach((itm: any) => { item.Goods.forEach((itm: any) => {
if (itm.gid === id) { if (itm.gid === id) {
item["Count"].priceCount += itm.price; item['Count'].priceCount += itm.price;
item["Count"].exchangeCount += itm.exchange; item['Count'].exchangeCount += itm.exchange;
} }
}); });
}); });
@@ -193,28 +188,32 @@ const orderData = ref<any>([]);
const sub = async () => { const sub = async () => {
const arr: any = list.value.filter( const arr: any = list.value.filter(
(item: any) => item.state.checkboxgroup.length > 0 (item: any) => item.state.checkboxgroup.length > 0,
); );
if (arr.length === 0) { console.log(arr);
Taro.showToast({ if (arr.length === 0) {
title: "请选择商品", Taro.showToast({
icon: "none", title: '请选择商品',
}); icon: 'none',
return; });
} return;
}
try { try {
const { data: res } = await createActiveOrder({ const {data: res} = await createActiveOrder({
Bid: arr.map((item: any) => item.StoreBid), Bid: arr.map((item: any) => item.StoreBid),
}); });
if (res.oid) { if (res.oid) {
orderData.value = res?.oid; // orderData.value = res?.oid;
isShowPay.value = true; // isShowPay.value = true;
// console.log(arr)
Taro.navigateTo({
url: `/pages/goods/pay/index?oid=${res.oid}&bid=${arr[0].StoreBid}&OrderType=1`,
});
} }
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
@@ -224,7 +223,7 @@ const closePay = async (val: boolean) => {
orderData.value = []; orderData.value = [];
await getList(); await getList();
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/users/order_list/index?type=0", url: '/pages/users/order_list/index?type=0',
}); });
}; };
@@ -239,7 +238,7 @@ const getList = async () => {
list.value = list.value.map((item: any) => ({ list.value = list.value.map((item: any) => ({
...item, ...item,
Goods: item.Goods.sort( Goods: item.Goods.sort(
(a: CardList, b: CardList) => Number(a.gid) - Number(b.gid) (a: CardList, b: CardList) => Number(a.gid) - Number(b.gid),
), ),
state: { state: {
indeterminate: false, indeterminate: false,
@@ -277,13 +276,13 @@ const add_cart = async (item: CardList, num: number = 1) => {
}); });
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
await getList(); await getList();
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
@@ -291,7 +290,7 @@ const add_cart = async (item: CardList, num: number = 1) => {
<style lang="scss"> <style lang="scss">
.index { .index {
font-family: "Avenir", Helvetica, Arial, sans-serif; font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
text-align: center; text-align: center;

View File

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

View File

@@ -5,14 +5,26 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import { useLoad, getStorageSync } from "@tarojs/taro"; import Taro from '@tarojs/taro';
const url = ref(""); const url = ref('');
useLoad(() => { Taro.useDidShow(() => {
// const user = getStorageSync("userInfo"); const token = Taro.getStorageSync('token');
url.value = `${process.env.TARO_APP_GAME}${getStorageSync("token")}`; if (token) {
url.value = `${process.env.TARO_APP_GAME}${Taro.getStorageSync('token')}`;
} else {
Taro.showToast({
title: '请先登录,再尝试进入游戏大厅。',
icon: 'none',
});
setTimeout(() => {
Taro.switchTab({
url: '/pages/index/index',
});
}, 1000);
}
}); });
</script> </script>

View File

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

View File

@@ -3,14 +3,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import { getStorageSync, useLoad } from "@tarojs/taro"; import {getStorageSync, useDidShow} from '@tarojs/taro';
import { WebView } from "@tarojs/components"; import {WebView} from '@tarojs/components';
const url = ref(""); const url = ref('');
useLoad(() => { useDidShow(() => {
url.value = getStorageSync("game_url"); url.value = getStorageSync('game_url');
}); });
</script> </script>

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="app"> <view class="app">
<view class="head-wrapper" :style="{ top: BarHeight + 'px' }"> <view class="head-wrapper" :style="{top: BarHeight + 'px'}">
<view class="head-menu"> <view class="head-menu">
<Left class="iconfont" @click="returns" /> <Left class="iconfont" @click="returns" />
<Home class="iconfont" @click="goHome" /> <Home class="iconfont" @click="goHome" />
@@ -11,71 +11,63 @@
:init-page="0" :init-page="0"
:pagination-visible="true" :pagination-visible="true"
pagination-color="#426543" pagination-color="#426543"
auto-play="3000" auto-play="3000">
>
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx"> <nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img :alt="idx.toString()" :src="itm" /> <img :alt="idx.toString()" :src="itm" />
</nut-swiper-item> </nut-swiper-item>
</nut-swiper> </nut-swiper>
<!-- 标题价格 --> <!-- 标题价格 -->
<view class="card"> <view class="card">
<view class="header"> <view class="flex items-center justify-between">
<view class="price"> <view class="flex items-center">
<nut-price size="large" :price="goodInfo.number"></nut-price>
<view class="ml-5 line"></view>
<nut-price <nut-price
size="normal" class="ml-5"
:price="goodInfo.number as number" size="large"
position="after" :price="goodInfo.exchange"
symbol="元" symbol="积分"></nut-price>
/>
<nut-price
size="normal"
:price="goodInfo.exchange as number"
position="after"
symbol="积分"
/>
</view> </view>
<view class="stock"> 库存剩余:{{ goodInfo.stock }}</view>
</view>
<view class="title">{{ goodInfo.name }}</view>
<view class="sub">{{ goodInfo.profile }}</view>
<view class="cartBox">
<nut-button <nut-button
size="small" size="small"
type="primary" type="primary"
@click.stop="add_cart(goodInfo)" @click.stop="add_cart(goodInfo)">
>
<template #icon> <template #icon>
<Cart2 /> <Cart2 />
</template> </template>
</nut-button> </nut-button>
</view> </view>
<view class="flex items-center justify-between mt-3">
<view class="title text-lg">{{ goodInfo.name }}</view>
<view class="stock text-[#9E9E9E]"> 库存:{{ goodInfo.stock }}</view>
</view>
<view class="line1"></view>
<view class="sub">{{ goodInfo.profile }}</view>
</view> </view>
<!-- 产品介绍 --> <!-- 商品详情 -->
<view class="rich-box"> <view class="rich-box">
<view class="title">产品介绍</view> <view class="title">-----商品详情-----</view>
<rich-text <rich-text
v-if="goodInfo.details" v-if="goodInfo.details"
class="rich" class="rich"
:nodes="goodInfo.details" :nodes="goodInfo.details"></rich-text>
></rich-text> <nut-empty v-else description="暂无商品详情"></nut-empty>
<nut-empty v-else description="暂无产品介绍"></nut-empty>
</view> </view>
<view style="height: 9vh"></view> <view style="height: 9vh"></view>
<!-- 底部 --> <!-- 底部 -->
<!-- 购物车 --> <!-- 购物车 -->
<cart ref="cartRef" :mer-info="mer_info" @update-cart="updateCartNum" /> <Cart ref="cartRef" :mer-info="mer_info" @update-cart="updateCartNum" />
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Ref, ref } from "vue"; import {Ref, ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { Home, Left } from "@nutui/icons-vue-taro"; import {Home, Left} from '@nutui/icons-vue-taro';
import { getActiveGoodsDetail } from "@/api/goods"; import {getActiveGoodsDetail} from '@/api/goods';
import Cart from "@/components/Cart.vue"; import Cart from '@/components/Cart.vue';
import { Cart2 } from "@nutui/icons-vue-taro"; import {Cart2} from '@nutui/icons-vue-taro';
import { nextTick } from "vue"; import {nextTick} from 'vue';
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight; const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
const BarHeight = ref((statusBarHeight as number) + 7); const BarHeight = ref((statusBarHeight as number) + 7);
@@ -98,9 +90,9 @@ interface GoodInfo {
const goodInfo = ref<GoodInfo>({}); const goodInfo = ref<GoodInfo>({});
Taro.useLoad(async (options) => { Taro.useLoad(async options => {
await get_good_detail(options.gid); await get_good_detail(options.gid);
mer_info.value = Taro.getStorageSync("mer_info"); mer_info.value = Taro.getStorageSync('mer_info');
await nextTick(async () => { await nextTick(async () => {
await cartRef.value.get_cart_list(); await cartRef.value.get_cart_list();
}); });
@@ -114,16 +106,16 @@ Taro.useShareAppMessage(() => ({
const get_good_detail = async (gid: string) => { const get_good_detail = async (gid: string) => {
try { try {
const res = await getActiveGoodsDetail({ gid: gid }); const res = await getActiveGoodsDetail({gid: gid});
goodInfo.value = { goodInfo.value = {
...res.data.data, ...res.data.data,
// details: res.data.data.details., // details: res.data.data.details.,
}; };
swiperList.value = res.data.data.rotation.split(","); swiperList.value = res.data.data.rotation.split(',');
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
@@ -136,7 +128,7 @@ const returns = () => {
const goHome = () => { const goHome = () => {
Taro.switchTab({ Taro.switchTab({
url: "/pages/index/index", url: '/pages/index/index',
}); });
}; };
@@ -169,7 +161,7 @@ const updateCartNum = (cartItems: CartItems[]) => {
} }
}); });
} else { } else {
Reflect.deleteProperty(goodInfo.value, "cartNum"); Reflect.deleteProperty(goodInfo.value, 'cartNum');
} }
}; };
</script> </script>
@@ -221,38 +213,15 @@ page {
padding: 30px; padding: 30px;
background-color: #fff; background-color: #fff;
position: relative; position: relative;
border-radius: 30px;
.header { top: -60px;
display: flex; width: 95%;
justify-content: space-between; margin: auto;
align-items: center;
.price {
display: flex;
flex-direction: column;
}
.title {
font-size: 30px;
font-weight: bold;
color: #333;
}
.stock {
color: #8f8f8f;
}
}
.sub { .sub {
font-size: 24px; font-size: 30px;
color: #999; color: #999;
} }
.cartBox {
display: flex;
justify-content: flex-end;
align-items: center;
}
} }
.rich-box { .rich-box {
@@ -262,6 +231,8 @@ page {
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
padding: 15px 0; padding: 15px 0;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
.title { .title {
font-size: 30px; font-size: 30px;
@@ -328,4 +299,16 @@ page {
font-size: 25px; font-size: 25px;
} }
} }
.line {
width: 1px;
height: 30px;
background-color: #8f8f8f;
}
.line1 {
width: 100%;
height: 1px;
background-color: #F0F0F0;
margin: 20px auto;
}
</style> </style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '支付订单',
});

View File

@@ -0,0 +1,39 @@
.nut-price {
color: #333333;
}
.nut-price--symbol-large {
font-size: 25px;
}
.line {
width: 1;
height: 30px;
border-left: 1px solid #a3a3a3;
margin: 0 50px;
display: inline-block;
}
.nut-radio {
margin-left: 10px;
}
.nut-radio__label {
margin-left: 0;
}
.nut-button {
border-radius: 20px;
}
.nut-short-password {
// .nut-icon-tips {
// display: none;
// }
@for $i from 1 through 5 {
.nut-short-password__item:nth-child(#{$i}) {
border-right: 1px solid var(--nut-shortpassword-border-color, #ddd);
}
}
}

View File

@@ -0,0 +1,332 @@
<template>
<view class="flex flex-col items-center justify-center">
<view class="mt-6 text-[#8C8C8C] text-[25px]"
>交易剩余时间{{ tStr }}
</view>
<view class="flex items-center mt-5 mb-5">
<nut-price :price="a" size="large" />
<view class="line"></view>
<nut-price position="after" symbol="积分" :price="b" size="large" />
</view>
<nut-radio-group class="w-[95%]" v-model="payVal">
<nut-cell-group class="w-full">
<nut-cell class="text-[#333333]" title="支付方式"></nut-cell>
<nut-cell
class="flex items-center"
title="微信支付"
@click="cellClick(1, false)">
<template #icon>
<IconFont size="30" :name="require('../../../static/wx.png')" />
</template>
<template #link>
<nut-radio :label="1"></nut-radio>
</template>
</nut-cell>
<nut-cell
class="flex items-center"
title="平台积分支付"
:desc="`剩余积分:${orderData.User?.integral || 0}`"
@click="cellClick(2, orderData.User?.integral === 0)">
<template #icon>
<IconFont size="30" :name="require('../../../static/pt.png')" />
</template>
<template #link>
<nut-radio
:disabled="orderData.User?.integral === 0"
:label="2"></nut-radio>
</template>
</nut-cell>
<nut-cell
class="flex items-center"
title="天才小猪积分支付"
:desc="`剩余积分:${orderData.integral || 0}`"
@click="cellClick(3, orderData.integral === 0)">
<template #icon>
<IconFont size="30" :name="require('../../../static/jh.png')" />
</template>
<template #link>
<nut-radio
:disabled="orderData.integral === 0"
:label="3"></nut-radio>
</template>
</nut-cell>
</nut-cell-group>
</nut-radio-group>
<view class="w-[90%] mt-[100px]">
<nut-button
shape="square"
:loading="isLoading"
type="primary"
block
@click="pay"
>确认支付
</nut-button>
</view>
<nut-short-password
title="请输入交易密码"
tips="忘记密码"
desc=" "
:error-msg="error_msg"
v-model="shortVal"
v-model:visible="visible"
:length="6"
:close-on-click-overlay="false"
@focus="showKeyboard = true"
@complete="shortComplete"
@close="shortClose"
@tips="onTips">
</nut-short-password>
<nut-number-keyboard
v-model="shortVal"
v-model:visible="showKeyboard"
@blur="showKeyboard = false">
</nut-number-keyboard>
<nut-dialog
title="设置交易密码"
content="您还未设置交易密码,请前往设置"
cancel-text="其他支付方式"
ok-text="设置交易密码"
v-model:visible="visible2"
@cancel="visible2 = false"
@ok="onTips">
</nut-dialog>
</view>
</template>
<script setup lang="ts">
import Taro from '@tarojs/taro';
import {IconFont} from '@nutui/icons-vue-taro';
import {onUnmounted, ref} from 'vue';
import {getActiveOrderDetail, checkTradePwd} from '@/api/goods';
import {getUserPoint} from '@/api/admin';
import {payOrder} from '@/api/order';
import {isCheckTradePwd} from '@/api/user';
import * as dayjs from 'dayjs';
const payVal = ref();
const t_id = ref();
const tStr = ref('00:00');
const error_msg = ref('');
const shortVal = ref('');
const orderData = ref<any>({});
const visible = ref(false);
const showKeyboard = ref(false);
const isLoading = ref(false);
const visible2 = ref(false);
const opt = ref<any>({});
Taro.useLoad(e => {
const {oid, bid, OrderType} = e;
opt.value = e;
getData(oid, bid, OrderType);
});
const a = ref(0);
const b = ref(0);
const getData = async (oid: string, bid: string, OrderType: number) => {
const user_info = Taro.getStorageSync('userInfo');
const data = await getUserPoint({
phone: user_info.data.phone,
bid,
});
const res = await getActiveOrderDetail({
oid,
OrderType: Number(OrderType),
});
// let a = 0;
// let b = 0;
orderData.value = {
...res.data.data[0],
...data.data,
};
a.value = 0;
b.value = 0;
res.data.data.forEach(item => {
a.value += item.price;
b.value += item.exchange;
});
console.log(orderData.value);
if (!orderData.value.oid)
return Taro.showToast({
title: '未获取到订单信息~',
icon: 'none',
});
countdownTime();
};
const pay = async () => {
try {
isLoading.value = true;
if (!payVal.value)
return Taro.showToast({title: '请选择支付方式', icon: 'none'});
if (payVal.value !== 1) {
const res = await isCheckTradePwd();
if (res.data.pay_password) {
visible.value = true;
showKeyboard.value = true;
} else {
isLoading.value = false;
visible2.value = true;
}
} else {
await confirmPay();
}
} catch (error) {
isLoading.value = false;
Taro.showToast({
title: error.msg,
icon: 'none',
});
}
};
const shortComplete = async value => {
try {
await checkTradePwd({
pay_password: value,
});
shortClose(false);
await confirmPay();
} catch (error) {
error_msg.value = error.msg;
shortVal.value = '';
}
};
const confirmPay = async () => {
try {
const res = await payOrder({
// oid: opt.value.oid.map(item => item.oid),
oid: opt.value.oid,
OrderType: payVal.value,
PayType: payVal.value,
});
switch (payVal.value) {
case 1:
if (typeof res.data.data === 'object') {
Taro.requestPayment({
timeStamp: res.data.data.timeStamp,
nonceStr: res.data.data.nonceStr,
package: res.data.data.package,
signType: res.data.data.signType,
paySign: res.data.data.paySign,
success: function () {
Taro.showToast({
title: '支付成功',
icon: 'success',
});
},
fail: function () {
Taro.showToast({
title: '支付失败',
icon: 'none',
});
},
complete: function () {
// Taro.redirectTo({
// url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}&OrderType=1`,
// });
Taro.redirectTo({
url: `/pages/users/order_list/index?type=0`,
});
},
});
} else {
Taro.showToast({
title: '参数获取失败,请重试~',
icon: 'none',
});
}
break;
default:
Taro.showToast({
title: res.msg,
icon: 'none',
});
setTimeout(() => {
// Taro.redirectTo({
// url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}&OrderType=1`,
// });
Taro.redirectTo({
url: `/pages/users/order_list/index?type=0`,
});
}, 2000);
break;
}
isLoading.value = false;
} catch (err) {
isLoading.value = false;
Taro.showToast({
title: err.msg,
icon: 'none',
});
}
};
const shortClose = (isMsg: boolean = true) => {
showKeyboard.value = false;
visible.value = false;
isLoading.value = false;
shortVal.value = '';
error_msg.value = '';
if (isMsg) Taro.showToast({title: '支付取消', icon: 'none'});
};
const cellClick = (val: number, isTrue: boolean) => {
if (isTrue) {
Taro.showToast({
title: '该支付暂不可用!',
icon: 'none',
});
payVal.value = undefined;
} else {
payVal.value = val;
}
};
const countdownTime = () => {
if (!orderData.value.expires) return;
t_id.value = setInterval(() => {
const nowTime = dayjs().valueOf();
const endTime = orderData.value.expires * 1000;
const time = endTime - nowTime;
tStr.value = dayjs(time).format('mm:ss');
}, 1000);
};
const onTips = () => {
Taro.redirectTo({
url: '/pages/users/pwd/index',
});
};
Taro.useDidHide(() => {
clearInterval(t_id.value);
});
onUnmounted(() => {
clearInterval(t_id.value);
});
</script>
<style lang="scss">
@import './index.scss';
</style>

View File

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

121
src/pages/index/index.scss Normal file
View File

@@ -0,0 +1,121 @@
page {
background-image: url('//p0.meituan.net/csc/aaaccd28594119e4b838d07d30739471440261.png');
background-size: 100% 57%;
background-repeat: no-repeat;
box-sizing: border-box;
}
.local {
margin-left: 15px;
display: flex;
align-items: flex-end;
color: #fff;
}
.search {
margin: 30px auto;
display: flex;
border-radius: 18px;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
background: rgba(255, 255, 255, 0.8);
width: 730px;
input {
flex: 1;
}
.search-btn {
background-color: #f83d3d;
color: #fff;
border-radius: 10px;
width: 100px;
height: 60px;
text-align: center;
line-height: 60px;
}
}
.banner {
.title {
background-image: url('//p0.meituan.net/csc/542112fc072d4687b437848bc29b0a1730495.png');
background-size: 100% 100%;
width: 600px;
height: 90px;
margin: auto;
}
.jf-btn {
margin: 15px auto;
background-image: url('//p1.meituan.net/csc/e125184432dc591137c24a26abe5796a25262.png');
background-size: 100% 100%;
width: 350px;
height: 70px;
}
.footer {
display: flex;
align-items: flex-end;
justify-content: space-between;
margin: 0 auto;
padding: 0 15px;
.btn-1 {
background-image: url('//p0.meituan.net/csc/7708348ee250eae910328bb7c12197f029562.png');
background-size: 100% 100%;
width: 200px;
height: 220px;
}
.btn-2 {
background-image: url('//p1.meituan.net/csc/8cc2b518031eb7424b184d90a583d805146287.png');
background-size: 100% 100%;
width: 300px;
height: 220px;
}
.btn-3 {
background-image: url('//p0.meituan.net/csc/31bd1f5c791c95557758dfa5c96e001529545.png');
background-size: 100% 100%;
width: 200px;
height: 220px;
}
}
}
.navigation {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 40px;
margin: 20px;
height: auto;
background-color: #fff;
border-radius: 20px;
padding: 32px 0;
.item {
display: flex;
flex-direction: column;
align-items: center;
.icon {
background-size: 100% 100%;
width: 90px;
height: 90px;
}
.text {
color: #333333;
font-size: 26px;
margin-top: 6px;
}
}
}
.ad {
background-image: url('https://jdt168.oss-cn-guangzhou.aliyuncs.com/ad.png');
background-size: 100% 100%;
height: 180px;
margin: 20px;
}

View File

@@ -1,172 +1,148 @@
<template> <template>
<view class="app"> <view>
<!-- 搜索 --> <view :style="{marginTop: BarHeight + 'px'}"></view>
<nut-searchbar <view class="local">
v-model="searchValue" <view class="iconfont icon-dizhi" style="font-size: 20px"></view>
placeholder="要搜索点什么?" <text class="text-[28px]">{{ address }}</text>
></nut-searchbar> </view>
<view class="search">
<view
class="iconfont icon-sousuo"
style="color: #8f8f8f; margin-right: 8px"></view>
<input placeholder="请输入商家名称搜索" v-model="searchVal" />
<view class="search-btn" @click="clickSearch">搜索</view>
</view>
<view class="banner"> <view class="banner">
<nut-swiper <view class="title"></view>
:init-page="0" <navigator class="jf-btn" hover-class="none"></navigator>
:pagination-visible="true" <view class="footer">
pagination-color="#ff0000" <navigator hover-class="none" class="btn-1"></navigator>
auto-play="3000" <navigator
> hover-class="none"
<nut-swiper-item v-for="(itm, idx) in bannerList" :key="idx"> openType="switchTab"
<img url="/pages/game/gamehome/index"
:src="itm.url" class="btn-2"></navigator>
:alt="itm.ID.toString()" <navigator hover-class="none" class="btn-3"></navigator>
@click="toPage(itm.jump)" </view>
/>
</nut-swiper-item>
</nut-swiper>
</view> </view>
<view class="navigation">
<!-- 金刚区 --> <view
<view class="navbar"> class="item"
<nut-grid :border="false" column-num="5"> v-for="(item, index) in navigationList"
<nut-grid-item :key="index"
v-for="item in swiperList" @click="toPage(item)">
:key="item.ID" <image class="icon" :src="item.icon" />
:text="item.name" <view class="text">{{ item.name }}</view>
@click="toDetails(item)" </view>
>
<image :src="item.icon" />
</nut-grid-item>
</nut-grid>
</view> </view>
<MerList /> <view class="ad" @click="showTips('该功能暂未开放')"></view>
<!-- 签到弹窗 --> <MerList :get-user-location="getUserLocal" />
<Popup
v-for="(item, index) in popupList"
:ref="(el) => getRef(el, item.type)"
:type="item.type"
:src="item.src"
:cb="item.cb"
:key="index"
/>
</view> </view>
</template> </template>
<script lang="ts" setup> <script setup lang="ts">
import { ref } from "vue"; import Taro from '@tarojs/taro';
import Taro from "@tarojs/taro"; import {ref} from 'vue';
import Popup from "@/components/Popup.vue"; import {getHomeList, getStoreList} from '@/api/home';
import MerList from "@/components/MerList.vue"; import MerList from '@/components/MerList.vue';
import { getHomeList } from "@/api/home"; import {showTips} from '@/utils';
import { getBanner, userSign } from "@/api/user";
import { parseQueryString } from "@/utils";
import { getMerList } from "@/api/goods";
import game_1 from "../../static/index/game_1.png";
const searchValue = ref(""); const statusBarHeight = Taro.getSystemInfoSync().statusBarHeight;
const BarHeight = ref((statusBarHeight as number) + 7);
interface SwiperList { interface navigationType {
ID?: number; ID?: number;
icon?: string; type: number;
name?: string; icon: string;
url?: string; name: string;
type?: number; url: string;
} }
const swiperList = ref<Array<SwiperList>>([]); const navigationList = ref<Array<navigationType>>([]);
const bannerList = ref<any[]>([]);
const popupRefs = ref<Map<number, any>>(new Map());
const getRef = (el, type) => {
popupRefs.value.set(type, el);
};
const popupList = ref([
// {
// type: 1,
// src: require("../../static/index/poppBg.png"),
// cb: async (type) => {
// await userSign();
// Taro.showToast({
// title: "签到成功",
// icon: "none",
// });
// popupRefs.value.get(type).show = false;
// },
// },
{
type: 2,
src: "//upload.jdt168.com/1714381111493034239_game_1.png",
cb: (type) => {
Taro.setStorageSync(
"game_url",
`${process.env.TARO_APP_FISH_GAME}${Taro.getStorageSync("token")}`
);
Taro.navigateTo({
url: `/pages/game/view/index`,
});
popupRefs.value.get(type).show = false;
},
},
]);
Taro.useDidShow(async () => {
await getBannerList();
await get_banner_list();
});
Taro.useShareAppMessage(() => ({ Taro.useShareAppMessage(() => ({
title: "捷兑通", title: '捷兑通',
path: `/pages/index/index?scene=${Taro.getStorageSync("token")}`, path: `/pages/index/index?scene=${Taro.getStorageSync('token')}`,
imageUrl: "https://upload.jdt168.com/1714375021923881119_Share.jpg", imageUrl: 'https://upload.jdt168.com/1714375021923881119_Share.jpg',
})); }));
const getBannerList = async () => { const searchVal = ref('');
swiperList.value = [
{ const clickSearch = () => {
ID: 11224, if (!searchVal.value)
type: 1, return Taro.showToast({
name: "全部服务", title: '请输入商家名称再搜索',
url: "/pages/allClassList/index", icon: 'none',
icon: "//upload.jdt168.com/1702296870765673412_%E5%85%A8%E9%83%A8%E6%9C%8D%E5%8A%A1.png", });
}, Taro.navigateTo({
{ url: `/pages/search/index?name=${searchVal.value}`,
ID: 11225, });
type: 1, searchVal.value = '';
name: "活动游戏", };
url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync("token")}`,
icon: "//jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png", Taro.useLoad(async () => {
}, getNavLists();
{ getUserLocal();
ID: 11226, });
type: 1,
name: "商户入驻", const address = ref('获取位置中......');
url: "/pages/users/settled_mer/index",
icon: "//jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png", const getUserLocal = async () => {
}, Taro.getLocation({
// { type: 'wgs84',
// ID: 11227, success: res => {
// type: 1, Taro.request({
// name: "最新资讯", url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${res.longitude}&key=S3GBZ-WR26O-IXNW2-SXBOD-LZXV6-WAFNO&get_poi=1`,
// url: "", method: 'GET',
// icon: "//jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png", success: res => {
// }, const data = res.data.result.address_component;
]; address.value = `${data.district}${data.street_number}`;
const { data } = await getHomeList(); },
if (data.data.length > 0) {
for (let i = 0; i < data.data.length; i++) {
swiperList.value.push({
type: 2,
...data.data[i],
}); });
} },
} });
}; };
const get_banner_list = async () => { const getNavLists = async () => {
const { data }: any = await getBanner(); navigationList.value = [
bannerList.value = data.data; // {
// type: 1,
// icon: '//p0.meituan.net/csc/5c770748f0028c63741c5ec14df3cc386715.png',
// url: '',
// name: '活动商家',
// },
// {
// type: 1,
// icon: '//p0.meituan.net/csc/4868c06b99008ff7d5f81e6514858c8a7950.png',
// url: '',
// name: '兑换商家',
// },
{
type: 1,
icon: '//p0.meituan.net/csc/f33ad2443a67e9f3474a1d5fd9d529db7504.png',
url: '/pages/users/settled_mer/index',
name: '商户入驻',
},
{
type: 1,
icon: '//p0.meituan.net/csc/0403cf37dd14a6b44b22ffccaa2878f95703.png',
url: '/pages/allClassList/index',
name: '全部服务',
},
];
const res = await getHomeList();
res.data.data.forEach(item => {
navigationList.value.unshift({
ID: item.ID,
type: 2,
icon: item.icon,
url: item.url,
name: item.name,
});
});
}; };
const toDetails = (item: SwiperList) => { const toPage = item => {
item.type !== 1 item.type !== 1
? Taro.navigateTo({ ? Taro.navigateTo({
url: `/pages/search/index?id=${item.ID}&name=${item.name}`, url: `/pages/search/index?id=${item.ID}&name=${item.name}`,
@@ -175,79 +151,8 @@ const toDetails = (item: SwiperList) => {
url: item.url as string, url: item.url as string,
}); });
}; };
const toPage = async (url: string) => {
// url转对象
const obj = parseQueryString(url);
if (obj.type === "1") {
const { data: res } = await getMerList({});
const mer = res.data.filter((item) => item.bid === obj.bid)[0];
Taro.setStorageSync("mer_info", mer);
}
Taro.navigateTo({
url,
});
};
</script> </script>
<style lang="scss"> <style lang="scss">
.swiper { @import './index.scss';
.nut-swiper {
background: #ffffff;
.nut-swiper-item {
display: grid;
grid-template-columns: repeat(5, 1fr);
.item {
display: flex;
flex-direction: column;
align-items: center;
image {
width: 100px;
height: 100px;
border-radius: 50%;
}
}
}
}
}
.banner {
padding: 10px;
.nut-swiper-item img {
border-radius: 26rpx;
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;
}
.navbar {
background-color: #ffffff;
.nut-grid-item__content {
padding: 15px;
}
image {
width: 80px;
height: 80px;
}
}
</style> </style>

View File

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

View File

@@ -0,0 +1,161 @@
page {
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
-nut-tabs-titles-item-color: #8c8c8c;
-nut-tabs-titles-item-active-color: #333333;
}
.head-wrapper {
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;
.iconfont {
flex: 1;
text-align: center;
color: #fff;
box-sizing: border-box;
}
}
.nut-swiper {
height: 550px;
}
.infoBox {
background-color: #fff;
padding: 30px;
border-radius: 25px;
position: relative;
top: -50px;
.title {
font-size: large;
font-weight: bold;
font-size: 40px;
}
.line {
margin: 30px auto;
width: 670px;
height: 1px;
background-color: rgba(240, 240, 240, 1);
}
.bom {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-top: 10px;
.left {
width: 75%;
.sub {
color: #999;
font-size: 27px;
}
}
.right {
flex: 1;
display: flex;
justify-content: space-between;
color: #999;
text-align: center;
}
}
}
.btn {
background-color: #ff0000;
color: #fff;
border-radius: 50%;
text-align: center;
line-height: 65px;
width: 45px;
height: 45px;
}
.good-class {
.nut-tabs {
height: 100vh;
// border-top: #fff 10px solid;
.nut-tabs__titles {
padding: 20px 0;
}
.nut-tab-pane {
border-radius: 20px;
padding: 25px;
}
}
}
.list {
.item {
display: flex;
margin-bottom: 20px;
image {
width: 180px;
height: 180px;
border-radius: 15px;
}
.right {
flex: 1;
margin-left: 15px;
display: flex;
flex-direction: column;
justify-content: space-between;
// 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;
}
}
}
}
}

View File

@@ -1,45 +1,65 @@
<template> <template>
<view> <view>
<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 <nut-swiper
:init-page="0" :init-page="0"
:pagination-visible="true" :pagination-visible="false"
pagination-color="red" pagination-color="red"
auto-play="3000" auto-play="3000">
>
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx"> <nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
<img <img
style="width: 100%; height: 100%" style="width: 100%; height: 100%"
:src="itm" :src="itm"
:alt="idx.toString()" :alt="idx.toString()" />
/>
</nut-swiper-item> </nut-swiper-item>
</nut-swiper> </nut-swiper>
<!-- 商家信息 --> <!-- 商家信息 -->
<view class="infoBox"> <view class="infoBox">
<view class="title">{{ mer_info.name }}</view> <view class="title text-[#333333]">{{ mer_info.name }}</view>
<view class="flex items-center justify-between mt-3">
<nut-rate
spacing="1"
active-color="rgba(252, 207, 10, 1)"
v-model="mer_info.rate" />
<view class="text-[#9E9E9E] text-[25px]">销量10000</view>
<view class="text-[#9E9E9E] text-[25px]"
>营业时间{{ mer_info.week_start }}-{{ mer_info.week_end }}</view
>
</view>
<view class="line"></view>
<view class="bom"> <view class="bom">
<view
class="iconfont icon-dizhi text-[#C4C4C4]"
style="width: 15px; height: 15px; margin-right: 15px"></view>
<view class="left"> <view class="left">
<view>{{ mer_info.address || "暂无商家地址" }}</view> <view>{{ mer_info.address || '暂无商家地址' }}</view>
<view class="sub" <view class="sub mt-1"
>{{ >离您{{
calculateDistance( calculateDistance(
userLocalNum.t, userLocalNum.t,
userLocalNum.l, userLocalNum.l,
Number(mer_info.lat), Number(mer_info.lat),
Number(mer_info.lon) Number(mer_info.lon),
) )
}} }}
</view> </view>
</view> </view>
<view class="right"> <view class="right">
<view @click="clickMap"> <view @click="clickMap">
<Locationg3 color="red" size="25" /> <image
<view>导航</view> class="w-[50px] h-[50px]"
src="http://p1.meituan.net/csc/92ee8512c90527169b44e07fd11d250d924.png" />
</view> </view>
<view @click="clickPhone"> <view @click="clickPhone">
<Find color="red" size="25" /> <image
<view>电话</view> class="w-[50px] h-[50px]"
src="http://p0.meituan.net/csc/ab0493b124a6bb858bf82a2340767c0d919.png" />
</view> </view>
</view> </view>
</view> </view>
@@ -53,21 +73,20 @@
direction="vertical" direction="vertical"
title-gutter="5" title-gutter="5"
animated-time="0" animated-time="0"
name="tabName" type=""
> name="tabName">
<nut-tab-pane <nut-tab-pane
v-for="(itm, index) in good_list" v-for="(itm, index) in good_list"
:key="index" :key="index"
:title="itm.name" :title="itm.name"
:pane-key="index" :pane-key="index">
>
<view v-if="itm.Goods.length > 0"> <view v-if="itm.Goods.length > 0">
<view class="list" v-for="(item, index) in itm.Goods" :key="index"> <view class="list" v-for="(item, index) in itm.Goods" :key="index">
<view class="item" @click.stop="toGoodDetails(item.gid, 1)"> <view class="item" @click.stop="toGoodDetails(item.gid, 1)">
<image :src="item.cover" lazy-load /> <image :src="item.cover" lazy-load />
<view class="right"> <view class="right">
<view class="name">{{ item.name }}</view> <view class="name">{{ item.name }}</view>
<view class="stock">剩余:{{ item.stock }}</view> <view class="stock text-[25px]">剩余:{{ item.stock }}</view>
<view class="bom"> <view class="bom">
<view> <view>
<view class="price"> <view class="price">
@@ -79,15 +98,20 @@
> >
</view> </view>
</view> </view>
<nut-button <view class="flex items-center justify-between">
size="mini" <view
type="primary" v-if="item.cartNum > 0"
@click.stop="add_cart(item)" class="btn"
> @click.stop="add_cart(item, 1)">
<template #icon> <Minus />
<Cart2 /> </view>
</template> <view v-if="item.cartNum > 0" style="margin: 0 10px">
</nut-button> {{ item.cartNum }}
</view>
<view class="btn" @click.stop="add_cart(item, 2)">
<Plus />
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -105,37 +129,40 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { Find, Locationg3, Cart2 } from "@nutui/icons-vue-taro"; import {Left, Home, Plus, Minus} from '@nutui/icons-vue-taro';
import { Ref, ref } from "vue"; import {Ref, ref} from 'vue';
import { calculateDistance } from "@/utils"; import {calculateDistance} from '@/utils';
import { getGoodList, getMerCategory } from "@/api/goods"; import {getGoodList, getMerCategory} from '@/api/goods';
import Cart from "@/components/Cart.vue"; import Cart from '@/components/Cart.vue';
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
const BarHeight = ref((statusBarHeight as number) + 6);
const swiperList = ref([]); const swiperList = ref([]);
const mer_info = ref<any>({}); const mer_info = ref<any>({});
const value = ref("0"); const value = ref('0');
const userLocalNum = ref({ const userLocalNum = ref({
l: 0, l: 0,
t: 0, t: 0,
}); });
Taro.useLoad(async () => { Taro.useDidShow(async () => {
Taro.getLocation({ Taro.getLocation({
type: "wgs84", type: 'wgs84',
success: (res) => { success: res => {
userLocalNum.value.l = res.longitude; userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude; userLocalNum.value.t = res.latitude;
}, },
}); });
mer_info.value = Taro.getStorageSync("mer_info"); mer_info.value = Taro.getStorageSync('mer_info');
Taro.setNavigationBarTitle({ Taro.setNavigationBarTitle({
title: mer_info.value.name, title: mer_info.value.name,
}); });
swiperList.value = mer_info.value.img.split(","); swiperList.value = mer_info.value.img.split(',');
await get_class_list(); await get_class_list();
await cartRef.value.get_cart_list(); await cartRef.value.get_cart_list();
}); });
@@ -204,7 +231,7 @@ interface CartItems {
const good_list = ref<goodList[]>([]); const good_list = ref<goodList[]>([]);
const get_good_list = async (id: number) => { const get_good_list = async (id: number) => {
Taro.showLoading({ Taro.showLoading({
title: "加载中", title: '加载中',
mask: true, mask: true,
}); });
const res = await getGoodList({ const res = await getGoodList({
@@ -225,8 +252,14 @@ const toGoodDetails = (id: string, type: number) => {
const cartRef = ref(null) as Ref; const cartRef = ref(null) as Ref;
const add_cart = (item: GoodsType) => { const add_cart = (item: GoodsType, type: number) => {
const num = item.cartNum ? Number(item.cartNum) + 1 : 1; let num = 0;
if (type === 1) {
num = Number(item.cartNum) - 1;
} else {
num = item.cartNum ? Number(item.cartNum) + 1 : 1;
}
cartRef.value.add_cart(item, num); cartRef.value.add_cart(item, num);
}; };
@@ -244,115 +277,25 @@ const updateCartNum = (cartItems: CartItems[]) => {
} else { } else {
good_list.value.forEach((category: goodList) => { good_list.value.forEach((category: goodList) => {
category.Goods.forEach((good: GoodsType) => { category.Goods.forEach((good: GoodsType) => {
Reflect.deleteProperty(good, "cartNum"); Reflect.deleteProperty(good, 'cartNum');
}); });
}); });
} }
}; };
const returns = () => {
Taro.navigateBack({
delta: 1,
});
};
const goHome = () => {
Taro.switchTab({
url: '/pages/index/index',
});
};
</script> </script>
<style lang="scss"> <style lang="scss">
page { @import './index.scss';
// IOS安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.nut-swiper {
height: 350px;
}
.infoBox {
background-color: #fff;
padding: 20px;
.title {
font-size: large;
font-weight: bold;
}
.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;
}
}
}
.good-class {
margin-top: 10px;
.nut-tabs {
height: 100vh;
border-top: #fff 10px solid;
}
}
.list {
.item {
display: flex;
margin-bottom: 10px;
image {
width: 180px;
height: 180px;
border-radius: 10px;
}
.right {
flex: 1;
margin-left: 5px;
display: flex;
flex-direction: column;
justify-content: center;
// text-align: right;
.stock {
margin-top: 10px;
color: #8f8f8f;
}
.name {
// height: 20px;
font-size: 28px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-word;
}
.bom {
display: flex;
justify-content: space-between;
align-items: flex-end;
//margin-top: 10px;
.price {
font-size: 20px;
font-weight: bold;
color: #ff0000;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
}
}
}
}
</style> </style>

View File

@@ -1,21 +1,33 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref, onMounted} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import MerList from "@/components/MerList.vue"; import MerList from '@/components/MerList.vue';
import Storelist from '@/components/StoreList.vue';
const classId = ref<null | number>(null); const classId = ref();
Taro.useLoad((e) => { const name = ref('');
Taro.setNavigationBarTitle({
title: e.name, onMounted(() => {
}); const e = Taro.getCurrentInstance().router?.params as any;
classId.value = Number(e.id); if (e.id) {
Taro.setNavigationBarTitle({
title: e.name,
});
classId.value = Number(e.id);
} else {
Taro.setNavigationBarTitle({
title: '搜索列表',
});
name.value = e.name;
}
}); });
</script> </script>
<template> <template>
<view> <view>
<MerList :classId="classId" /> <MerList v-if="classId" v-model="classId" />
<Storelist v-else v-model="name" />
</view> </view>
</template> </template>

View File

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

141
src/pages/user/index.scss Normal file
View File

@@ -0,0 +1,141 @@
.appUser {
box-sizing: border-box;
background-color: #f8f8f8;
height: 100%;
background-image: url('http://p0.meituan.net/csc/f44bb11463e3c538c307d7ce4b303bec33520.png');
background-size: 100% 500px;
background-repeat: no-repeat;
position: relative;
padding-top: 180px;
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666));
}
.user-center-card__header__avatar {
img {
border-radius: 50%;
}
}
.user-center-card__header__info__phone {
color: #737373;
font-size: 25px;
}
.user-center-card__header__transparent {
padding-left: 30px;
background-color: transparent;
display: flex;
align-items: center;
box-sizing: border-box;
text-align: left;
padding-right: 20px;
.user-center-card__header__info {
margin-left: 20px;
width: 400px;
color: #333;
font-weight: bolder;
}
}
.cell-card {
box-sizing: border-box;
background-color: #fff;
padding: 30px;
.center {
display: flex;
justify-content: space-between;
color: #666;
padding: 0 30px;
.center-t {
margin-top: 30px;
display: flex;
flex-direction: column;
align-items: center;
.center-text {
margin-top: 15px;
}
}
}
}
.user-center {
background-color: #fff;
margin: 20px 0px;
padding: 20px;
-nut-grid-item-text-color: #333;
.box {
margin-top: 30px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 20px 100px;
box-sizing: border-box;
line-height: 1.5;
.box-mini {
display: flex;
box-sizing: border-box;
flex-direction: column;
align-items: center;
.label {
font-size: 25px;
margin-top: 10px;
color: #333333;
}
image {
width: 80px;
height: 80px;
}
}
}
}
.mer-box {
background-color: #fff;
margin: 20px;
width: 100%;
}
.user-acc {
background-image: url('http://p0.meituan.net/csc/a74c44a7af541f01efbcc6fb023e6e09132712.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 90%;
height: 150px;
padding: 0 100px;
margin: 50px auto 0 auto;
.line {
width: 1px;
height: 50px;
background-color: #ffc300;
margin: 0 100px;
}
}
.kf-btn {
padding: 0 !important;
margin: 0 !important;
background: transparent;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
font-size: 25px;
color: #333333;
line-height: 1;
.IconFont {
margin-bottom: 13px;
}
&::after {
border: none;
background: transparent;
line-height: 1;
}
}

View File

@@ -1,20 +1,21 @@
<template> <template>
<view class="app"> <view class="appUser">
<view <view
class="user-center-card__header__transparent" class="user-center-card__header__transparent"
v-if="isLogin" v-if="isLogin"
:style="{ width: isLogin ? '100%' : '70%' }" :style="{width: isLogin ? '100%' : '70%'}">
> <view
<view class="user-center-card__header__avatar"> class="user-center-card__header__avatar"
@click="toPage('/pages/users/user_setting/index')">
<nut-avatar size="large"> <nut-avatar size="large">
<img :src="userInfo.data?.avatarUrl" /> <img :src="userInfo.data?.avatarUrl" />
</nut-avatar> </nut-avatar>
</view> </view>
<view class="user-center-card__header__info"> <view
<view class="user-center-card__header__info"
class="user-center-card__header__info__name" @click="toPage('/pages/users/user_setting/index')">
@click="toPage('/pages/users/user_setting/index')" <view class="user-center-card__header__info__name"
>{{ userInfo.data?.nickName }} >{{ userInfo.data?.nickName || '点击设置昵称' }}
</view> </view>
<view v-if="!userInfo.data?.phone"> <view v-if="!userInfo.data?.phone">
<nut-button <nut-button
@@ -24,27 +25,16 @@
>点击绑定手机号 >点击绑定手机号
</nut-button> </nut-button>
</view> </view>
</view> <view v-else class="user-center-card__header__info__phone"
<view class="rightIcon"> >{{ maskString(userInfo.data?.phone, 3, 7) }}
<Scan style="margin-right: 20px" @click="scanCode" size="22" /> </view>
<button v-if="isLogin" open-type="contact">
<Message
color="#666666"
style="margin-right: 20px"
@click="toSetting"
size="22"
/>
</button>
<Setting style="margin-right: 20px" @click="toSetting" size="22" />
</view> </view>
</view> </view>
<view v-else class="user-center-card__header__transparent"> <view v-else class="user-center-card__header__transparent">
<view class="user-center-card__header__avatar"> <view class="user-center-card__header__avatar">
<nut-avatar size="large"> <nut-avatar size="large">
<img <img
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png" src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png" />
/>
</nut-avatar> </nut-avatar>
</view> </view>
<view class="user-center-card__header__info"> <view class="user-center-card__header__info">
@@ -53,146 +43,151 @@
</view> </view>
</view> </view>
</view> </view>
<view class="container"> <view class="user-acc flex items-center text-center justify-between">
<!--我的订单--> <view>
<view class="cell-card"> <view class="text-[#ffc300] text-[40px] font-bold">{{
<view class="top"> userInfo.data?.pulse || 0
<view>我的订单</view> }}</view>
<view class="sub" @click="toOrderList(0)"> <view class="text-[#CFAA32] text-[28px]">豆子</view>
<view>全部订单</view> </view>
<ArrowRight /> <view class="line"></view>
</view> <view>
</view> <view class="text-[#ffc300] text-[40px] font-bold">{{
<view class="center"> userInfo.data?.integral || 0
<view class="center-t" @click="toOrderList(1)"> }}</view>
<!-- <Order size="25px"/> --> <view class="text-[#CFAA32] text-[28px]">积分</view>
<IconFont </view>
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png" </view>
size="40" <!--我的订单-->
/> <view class="border-box bg-[#fff] p-[20px]">
<view class="center-text">待付款</view> <view class="flex justify-between items-center mt-2">
</view> <view class="text-[#333333] text-[32px]">我的订单</view>
<view class="center-t" @click="toOrderList(2)"> <view class="flex text-[#c9c9c9] items-center" @click="toOrderList(0)">
<!-- <Clock size="25px"/> --> <view class="text-[26px]">查看全部</view>
<IconFont <ArrowRight size="12" />
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"
/>
<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"
/>
<view class="center-text">已失效</view>
</view>
</view> </view>
</view> </view>
<view class="flex justify-between text-[#666] px-[20px]">
<view
class="mt-[30px] flex flex-col items-center"
@click="toOrderList(1)">
<IconFont
name="http://p0.meituan.net/csc/9943f6c938fc0e310141a2b99d5bde6617483.png"
size="42" />
<view class="mt-[15px] text-[25px] text-[#333333]">待付款</view>
</view>
<view
class="mt-[30px] flex flex-col items-center"
@click="toOrderList(2)">
<IconFont
name="http://p0.meituan.net/csc/5306d094d7b4b61848dd21c86b693a9515523.png"
size="42" />
<view class="mt-[15px] text-[25px] text-[#333333]">待使用</view>
</view>
<view
class="mt-[30px] flex flex-col items-center"
@click="toOrderList(3)">
<IconFont
name="http://p0.meituan.net/csc/32ea9bbf51e3bbb0cbd75bc0fea97ca815779.png"
size="42" />
<view class="mt-[15px] text-[25px] text-[#333333]">已使用</view>
</view>
<view
class="mt-[30px] flex flex-col items-center"
@click="toOrderList(4)">
<IconFont
name="http://p0.meituan.net/csc/2e0dee89e9a3e3f2e7bf65db355fa11c11630.png"
size="42" />
<view class="mt-[15px] text-[25px] text-[#333333]">已失效</view>
</view>
</view>
</view>
<!-- 我的服务 --> <!-- 我的服务 -->
<view class="user-center" v-if="isLogin"> <view class="user-center" v-if="isLogin">
<view>我的服务</view> <view class="text-[#333333] text-[32px] mt-2">我的服务</view>
<view class="box"> <view class="box">
<view v-for="(item, idx) in userMenuList" :key="idx">
<view <view
v-if="item.type !== 333"
class="box-mini" class="box-mini"
v-for="(item, idx) in userMenuList" @click="toPage(item.url)">
:key="idx" <IconFont size="42" :name="item.icon"></IconFont>
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view> <view class="label">{{ item.label }}</view>
</view> </view>
<button v-else class="kf-btn" open-type="contact">
<IconFont class="IconFont" size="42" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view>
</button>
</view> </view>
</view> </view>
</view>
<!-- 商家管理 --> <!-- 商家管理 -->
<view <view
class="mer-box" class="user-center"
v-if="userInfo.data?.bid && userInfo.store_status === 1" v-if="userInfo.data?.bid && userInfo.store_status === 1">
> <view class="text-[#333333] text-[32px] mt-2">商家服务</view>
<nut-grid :gutter="10" :border="false"> <view class="box">
<nut-grid-item <view
:border="false" v-if="userInfo.data.permission.dd"
v-if="userInfo.data.permission.dd" class="box-mini"
text="点单" @click="toPage('/pages/admin/add_order/index')">
@click="toPage('/pages/admin/add_order/index')" <IconFont
> size="42"
<IconFont name="http://p0.meituan.net/csc/72a389ac6a441061fd534b96644c431b7839.png"></IconFont>
size="40" <view class="label">后结点单</view>
:name="require('../../static/user/1-1.png')" </view>
></IconFont> <view
</nut-grid-item> v-if="userInfo.data.permission.hx"
<nut-grid-item class="box-mini"
:border="false" @click="toPage('/pages/admin/verify/index')">
v-if="userInfo.data.permission.hx" <IconFont
text="订单核销" size="42"
@click="toPage('/pages/admin/verify/index')" name="http://p1.meituan.net/csc/c236a8b7a73178da25218e1fb59a96f06610.png"></IconFont>
> <view class="label">订单核销</view>
<IconFont </view>
size="40" <view
:name="require('../../static/user/1-2.png')" v-if="userInfo.data.permission.tj"
></IconFont> class="box-mini"
</nut-grid-item> @click="toPage('/pages/admin/order_manage/index')">
<nut-grid-item <IconFont
:border="false" size="42"
v-if="userInfo.data.permission.tj" name="http://p0.meituan.net/csc/bd9aca457a109b4d69a692a9109a73ed9045.png"></IconFont>
text="订单统计" <view class="label">订单统计</view>
@click="toPage('/pages/admin/order_manage/index')" </view>
> <view
<IconFont v-if="userInfo.data.permission.tx"
size="40" class="box-mini"
:name="require('../../static/user/1-3.png')" @click="toPage('/pages/admin/withdrawal/index')">
></IconFont> <IconFont
</nut-grid-item> size="42"
<nut-grid-item name="http://p0.meituan.net/csc/f85d7dc1bf9eda8977e9089b260a586b7440.png"></IconFont>
:border="false" <view class="label">收益提现</view>
v-if="userInfo.data.permission.tx" </view>
text="收益提现"
@click="toPage('/pages/admin/withdrawal/index')"
>
<IconFont
size="40"
:name="require('../../static/user/1-4.png')"
></IconFont>
</nut-grid-item>
</nut-grid>
</view> </view>
</view>
<!-- 版权 --> <!-- 版权 -->
<!-- <view class="copy">© 2023 </view>--> <view class="text-[#999999] mt-5 text-[20px] text-center">
<view>鑫瓴科技版权所有</view>
<view>v4.0.0</view>
</view> </view>
<!-- 登录 --> <!-- 登录 -->
<Auth <Auth
:visible="isShowLogin" :visible="isShowLogin"
@update:visible="cancelLogin" @update:visible="cancelLogin"
@ok="getUserInfo" @ok="getUserInfo" />
/>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import {ref} from 'vue';
import { import {ArrowRight, IconFont} from '@nutui/icons-vue-taro';
ArrowRight, import Taro from '@tarojs/taro';
Setting, import Auth from '@/components/Auth.vue';
IconFont, import {getPersonalInfo, getPhone, bindParent} from '@/api/user';
Scan, import {maskString} from '@/utils';
Message,
} 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);
@@ -207,6 +202,8 @@ interface UserInfo {
phone?: string; phone?: string;
uid?: string; uid?: string;
permission?: any; permission?: any;
integral?: string;
pulse?: string;
}; };
store_status?: number; store_status?: number;
store_name?: string; store_name?: string;
@@ -215,20 +212,40 @@ interface UserInfo {
const userInfo = ref<UserInfo>({}); const userInfo = ref<UserInfo>({});
Taro.useDidShow(() => { Taro.useDidShow(() => {
const token = Taro.getStorageSync("token"); init_data();
});
// Taro.startPullDownRefresh({
// success: () => {
// init_data();
// },
// complete: () => {
// Taro.stopPullDownRefresh();
// },
// });
const init_data = () => {
const token = Taro.getStorageSync('token');
if (token) { if (token) {
getUserInfo(); getUserInfo();
} }
}); };
const test = () => {
console.log(process.env.TARO_APP_ID);
Taro.openCustomerServiceChat({
corpId: 'wwb5dd953ca36043ef',
extInfo: {
url: 'https://work.weixin.qq.com/kfid/kfcb2b0420e94102346',
},
});
};
const cancelLogin = () => { const cancelLogin = () => {
isShowLogin.value = false; isShowLogin.value = false;
}; };
const getUserInfo = async () => { const getUserInfo = async () => {
Taro.showLoading({
title: "加载中",
});
const res = await getPersonalInfo(); const res = await getPersonalInfo();
userInfo.value = { userInfo.value = {
...res.data, ...res.data,
@@ -239,10 +256,9 @@ const getUserInfo = async () => {
: {}, : {},
}, },
}; };
Taro.setStorageSync("userInfo", userInfo.value); Taro.setStorageSync('userInfo', userInfo.value);
isLogin.value = true; isLogin.value = true;
cancelLogin(); cancelLogin();
Taro.hideLoading();
}; };
const getphonenumber = async (e: any) => { const getphonenumber = async (e: any) => {
@@ -256,8 +272,8 @@ const getphonenumber = async (e: any) => {
const toOrderList = (e: number) => { const toOrderList = (e: number) => {
if (!isLogin.value) if (!isLogin.value)
return Taro.showToast({ return Taro.showToast({
title: "请先登录", title: '请先登录',
icon: "none", icon: 'none',
}); });
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/users/order_list/index?type=${e}`, url: `/pages/users/order_list/index?type=${e}`,
@@ -266,43 +282,37 @@ const toOrderList = (e: number) => {
const userMenuList = ref([ const userMenuList = ref([
{ {
label: "后结订单", label: '账户明细',
url: "/pages/users/pending_order/index", url: '/pages/users/account/index',
icon: require("../../static/user/dd.png"), icon: 'http://p0.meituan.net/csc/104f787b7cc5582868be46ff52475ecf7084.png',
}, },
{ {
label: "我的账户", label: '后结订单',
url: "/pages/users/account/index", url: '/pages/users/pending_order/index',
icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png", icon: 'http://p0.meituan.net/csc/68d3f1f1ea375897a2b918851199b6546322.png',
}, },
// {
// id: 2,
// label: "商家入驻",
// url: "/pages/users/account/index",
// icon: "http://jdt168.com/uploads/default/20220829/583fd6cbd729b24eab9c3cae20ae694d.png",
// },
{ {
label: "我的推广", label: '我的推广',
url: "/pages/users/distribution/index", url: '/pages/users/distribution/index',
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png", icon: 'http://p0.meituan.net/csc/950814cc0ed1289f170e8612fab597cd5310.png',
},
{
label: '联系客服',
type: 333,
url: '/pages/users/account/index',
icon: 'http://p0.meituan.net/csc/ddd4b6ff4271ec05ced60db0aee1e9548383.png',
},
{
label: '设置',
url: '/pages/users/setting/index',
icon: 'http://p0.meituan.net/csc/1d8e6b328d384ff042c282976b82feec6005.png',
}, },
// {
// label: "聚合积分",
// url: "/pages/users/integral/index",
// icon: require("../../static/jhjf.png"),
// },
]); ]);
const toSetting = () => {
Taro.navigateTo({
url: "/pages/users/setting/index",
});
};
const clickLogin = () => { const clickLogin = () => {
// isShowLogin.value = true // isShowLogin.value = true
Taro.redirectTo({ Taro.redirectTo({
url: "/pages/users/login/index", url: '/pages/users/login/index',
}); });
}; };
@@ -315,20 +325,20 @@ const toPage = (url: string) => {
const scanCode = () => { const scanCode = () => {
Taro.scanCode({ Taro.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
scanType: ["qrCode"], scanType: ['qrCode'],
success: async (data) => { success: async data => {
try { try {
await bindParent({ await bindParent({
uid: data.result, uid: data.result,
}); });
Taro.showToast({ Taro.showToast({
title: "绑定成功", title: '绑定成功',
icon: "none", icon: 'none',
}); });
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
}, },
@@ -337,151 +347,5 @@ const scanCode = () => {
</script> </script>
<style lang="scss"> <style lang="scss">
.app { @import './index.scss';
box-sizing: border-box;
background-color: #f5f5f5;
height: 100vh;
background-image: url("https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png");
background-size: auto 40%;
background-repeat: no-repeat;
position: relative;
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666));
}
.user-center-card__header__avatar {
img {
border-radius: 50%;
}
}
.user-center-card__header__transparent {
position: absolute;
left: 30px;
top: 200px;
background-color: transparent;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
text-align: left;
padding-right: 20px;
.user-center-card__header__info {
margin-left: 20px;
width: 400px;
color: #333;
font-weight: bolder;
}
.rightIcon {
height: 100px;
margin: auto;
display: flex;
justify-content: flex-start;
// align-items: center;
button {
padding: 0 !important;
margin: 0 !important;
background: transparent;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
position: relative;
top: -13px;
}
button::after {
border: none;
background: transparent;
}
}
}
.container {
position: absolute;
top: 350px;
width: 710px;
}
.cell-card {
box-sizing: border-box;
background-color: #fff;
border-radius: 20px;
margin: 20px;
padding: 30px;
width: 710px;
.top {
display: flex;
justify-content: space-between;
align-items: center;
.sub {
display: flex;
color: #c9c9c9;
align-items: center;
}
}
.center {
display: flex;
justify-content: space-between;
color: #666;
padding: 0 30px;
.center-t {
margin-top: 30px;
display: flex;
flex-direction: column;
align-items: center;
.center-text {
margin-top: 15px;
}
}
}
}
.user-center {
background-color: #fff;
border-radius: 20px;
margin: 20px;
padding: 20px;
width: 710px;
box-sizing: border-box;
.box {
margin-top: 20px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 20px;
box-sizing: border-box;
.box-mini {
display: flex;
box-sizing: border-box;
width: 150px;
flex-direction: column;
align-items: center;
.label {
font-size: 25px;
margin-top: 10px;
color: #333;
}
image {
width: 80px;
height: 80px;
}
}
}
}
.mer-box {
box-sizing: border-box;
background-color: #fff;
border-radius: 20px;
margin: 20px;
width: 710px;
}
</style> </style>

View File

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

View File

@@ -1,31 +1,32 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from "vue"; import {computed, ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import * as dayjs from "dayjs"; import * as dayjs from 'dayjs';
import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user"; import {getIntegralDetail, getBeanDetail, getGiftRecord} from '@/api/user';
import {TriangleDown} from '@nutui/icons-vue-taro';
const tabValue = ref(1); const tabValue = ref(1);
const tabsList = ref([ const tabsList = ref([
{ {
title: "兑换明细", title: '兑换明细',
value: 1, value: 1,
}, },
{ {
title: "赠送明细", title: '赠送明细',
value: 3, value: 3,
}, },
{ {
title: "豆子明细", title: '豆子明细',
value: 2, value: 2,
}, },
{ {
title: "活动赠送", title: '聚合积分',
value: 4, value: 5,
}, },
{ {
title: "聚合积分", title: '活动赠送',
value: 5, value: 4,
}, },
]); ]);
@@ -33,11 +34,11 @@ const computerType = computed(() => {
return (val: number) => { return (val: number) => {
switch (val) { switch (val) {
case 5: case 5:
return "注册赠送"; return '注册赠送';
case 6: case 6:
return "签到赠送"; return '签到赠送';
case 7: case 7:
return "系统赠送"; return '系统赠送';
} }
}; };
}); });
@@ -64,8 +65,12 @@ const data = ref<DataType[]>([]);
const userInfo = ref<any>({}); const userInfo = ref<any>({});
Taro.useLoad(() => { Taro.useLoad(() => {
pickerVal.value = [
dayjs().format('YYYY-MM-DD'),
dayjs().format('YYYY-MM-DD'),
];
getList(); getList();
userInfo.value = Taro.getStorageSync("userInfo"); userInfo.value = Taro.getStorageSync('userInfo');
}); });
const page = ref({ const page = ref({
@@ -86,12 +91,14 @@ const getList = async () => {
PageNum: page.value.PageNum, PageNum: page.value.PageNum,
PageSize: page.value.PageSize, PageSize: page.value.PageSize,
Type: tabValue.value, Type: tabValue.value,
TimeStart: pickerVal.value[0],
TimeEnd: pickerVal.value[1],
}; };
if (tabValue.value === 1 || tabValue.value === 3 || tabValue.value === 5) { if (tabValue.value === 1 || tabValue.value === 3 || tabValue.value === 5) {
res = await getBeanDetail(newData); res = await getBeanDetail(newData);
} else if (tabValue.value === 2) { } else if (tabValue.value === 2) {
// delete data.value.Type; // delete data.value.Type;
Reflect.deleteProperty(data.value, "Type"); Reflect.deleteProperty(data.value, 'Type');
res = await getIntegralDetail(newData); res = await getIntegralDetail(newData);
} else if (tabValue.value === 4) { } else if (tabValue.value === 4) {
res = await getGiftRecord(newData); res = await getGiftRecord(newData);
@@ -101,67 +108,94 @@ const getList = async () => {
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
const pickerRef = ref();
const showPicker = ref(false);
const pickerVal = ref<Array<string>>([]);
const openPicker = () => {
showPicker.value = true;
pickerRef.value.scrollToDate(dayjs().format('YYYY-MM-DD'));
};
const choose = e => {
pickerVal.value = [e[0][3], e[1][3]];
getList();
};
const closePicker = () => {
showPicker.value = false;
};
</script> </script>
<template> <template>
<view> <view class="overflow-scroll">
<view class="card"> <view class="tabs-box">
<view class="info"> <view
<view class="left"> class="item"
<view> v-for="(item, idx) in tabsList"
<view class="num">豆子: {{ userInfo.data?.pulse }}</view> :key="idx"
</view> @click="tabChange(item.value)"
<view> :style="{
<view class="num">积分: {{ userInfo.data?.integral }}</view> backgroundColor: item.value === tabValue ? '#ff0000' : '#F0F0F0',
</view> color: item.value === tabValue ? '#fff' : '#333',
</view> }">
<view>{{ item.title }}</view>
</view> </view>
</view> </view>
<scroll-view scroll-x>
<view class="tabs-box"> <view
<view @click="openPicker"
v-for="item in tabsList" class="pt-[20px] pb-[20px] pl-[25px] text-[30px] text-[#333] flex items-center">
:key="item.value" <text>时间筛选</text>
@click="tabChange(item.value)" <TriangleDown size="20px" color="#333" />
> </view>
<view class="text">{{ item.title }}</view>
<view <nut-calendar
class="line" ref="pickerRef"
:class="{ lineColor: item.value === tabValue }" type="range"
></view> title="时间筛选"
</view> v-model:visible="showPicker"
</view> :default-value="pickerVal"
</scroll-view> start-date="2023-01-01"
end-date="2070-01-01"
@close="closePicker"
@choose="choose">
</nut-calendar>
<view v-if="data.length > 0"> <view v-if="data.length > 0">
<view v-if="tabValue === 1"> <view v-if="tabValue === 1">
<view class="card-list" v-for="(item, index) in data" :key="index"> <view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left"> <view>
<view>订单号: {{ item.oid }}</view> <view class="text-[28px]">订单号: {{ item.oid }}</view>
<text class="jf">{{ <view class="text-[#484848] text-[26px] mt-[18px]">{{
dayjs(item.add_time).format("YYYY/MM/DD mm:ss") dayjs(item.add_time).format('YYYY/MM/DD mm:ss')
}}</text> }}</view>
</view> </view>
<view class="right"> <view class="flex-1 text-right mt-[18px]">
<view v-if="tabValue === 1" style="color: red" <view v-if="tabValue === 1" style="color: red"
>- >-
<text>{{ item.number }}</text> <text>{{ item.number }}</text>
</view> </view>
<text class="jf">积分余额: {{ item.residue || 0 }}</text> <text class="text-[#484848]"
>积分余额: {{ item.residue || 0 }}</text
>
</view> </view>
</view> </view>
</view> </view>
<view v-if="tabValue === 3 || tabValue === 5"> <view v-if="tabValue === 3 || tabValue === 5">
<view class="card-list" v-for="(item, index) in data" :key="index"> <view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left"> <view>
<view>订单{{ item.oid }}</view> <view class="text-[28px]">订单{{ item.oid }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view> <view class="text-[#484848] text-[26px] mt-[18px]"
>时间{{ item.add_time.slice(0, 10) }}</view
>
</view> </view>
<view class="right"> <view class="flex-1 text-right mt-[18px]">
<view v-if="tabValue === 5" style="color: red" <view v-if="tabValue === 5" style="color: red"
>- >-
<text>{{ item.number }}积分</text> <text>{{ item.number }}积分</text>
@@ -176,11 +210,13 @@ const getList = async () => {
</view> </view>
<view v-else-if="tabValue === 2"> <view v-else-if="tabValue === 2">
<view class="card-list" v-for="(item, index) in data" :key="index"> <view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left"> <view>
<view class="text">订单{{ item.oid }}</view> <view class="text-[28px]">订单{{ item.oid }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view> <view class="text-[#484848] text-[26px] mt-[18px]"
>时间{{ item.add_time.slice(0, 10) }}</view
>
</view> </view>
<view class="right"> <view class="flex-1 text-right mt-[18px]">
<view style="color: green" <view style="color: green"
>+ >+
<text>{{ item.number }}</text> <text>{{ item.number }}</text>
@@ -191,11 +227,13 @@ const getList = async () => {
</view> </view>
<view v-else-if="tabValue === 4"> <view v-else-if="tabValue === 4">
<view class="card-list" v-for="(item, index) in data" :key="index"> <view class="card-list" v-for="(item, index) in data" :key="index">
<view class="left"> <view>
<view class="text">类型{{ computerType(item.type) }}</view> <view class="text-[28px]">类型{{ computerType(item.type) }}</view>
<view>时间{{ item.add_time.slice(0, 10) }}</view> <view class="text-[#484848] text-[26px] mt-[18px]"
>时间{{ item.add_time.slice(0, 10) }}</view
>
</view> </view>
<view class="right"> <view class="flex-1 text-right mt-[18px]">
<view style="color: green" <view style="color: green"
>+ >+
<text>{{ item.number }}</text> <text>{{ item.number }}</text>
@@ -205,11 +243,11 @@ const getList = async () => {
</view> </view>
</view> </view>
<nut-pagination <nut-pagination
class="mt-3"
v-model="page.PageNum" v-model="page.PageNum"
:total-items="page.ItemCount" :total-items="page.ItemCount"
:items-per-page="page.PageSize" :items-per-page="page.PageSize"
@change="pageChange" @change="pageChange" />
/>
</view> </view>
<nut-empty v-else description="暂无明细"></nut-empty> <nut-empty v-else description="暂无明细"></nut-empty>
</view> </view>
@@ -222,101 +260,38 @@ const getList = async () => {
transform: translateX(-50%); transform: translateX(-50%);
} }
.card {
width: 90%;
border-radius: 20px;
background-color: #282828;
margin: 10px auto;
color: #d0a568;
padding: 20px;
.info {
.left {
height: 200px;
text-align: left;
margin-left: 50px;
display: flex;
flex-direction: column;
justify-content: center;
.num {
font-weight: bold;
margin-top: 10px;
}
}
}
}
.tabs-box { .tabs-box {
display: flex; display: flex;
flex-direction: row;
// justify-content: space-evenly;
align-items: center; align-items: center;
height: auto;
background-color: #fff; background-color: #fff;
padding: 0 10px;
text-align: center; text-align: center;
overflow-x: auto; padding: 15px;
justify-content: space-between;
overflow-x: scroll;
&::-webkit-scrollbar { .item {
width: 0; width: 144px;
height: 0; min-width: 144px;
} height: 60px;
min-height: 60px;
view { font-size: 26px;
width: 200px; border-radius: 10px;
} text-align: center;
line-height: 60px;
.text { margin-left: 25px;
margin: 10px 0;
align-items: center;
font-size: large;
}
.line {
margin: 0 auto;
width: 100px;
height: 5px;
border-radius: 30px;
transition: all 0.3s ease-in-out;
}
.lineColor {
background-color: #ff0000;
} }
} }
.card-list { .card-list {
margin: 10px 20px;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
font-size: 25px;
margin-bottom: 25px;
.jf {
color: #8a8a8a;
}
.left {
.text {
text-align: left;
font-weight: bolder;
// 超出一行隐藏
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
color: #484848;
font-size: large;
}
}
.right {
flex: 1;
text-align: right;
}
} }
</style> </style>

View File

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

View File

@@ -1,38 +1,40 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import Pay from "@/components/Pay.vue"; import Pay from '@/components/Pay.vue';
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods"; import {getActiveOrderList, deleteActiveOrder} from '@/api/goods';
import { getOrderStatistics } from "@/api/order"; import {getOrderStatistics} from '@/api/order';
import { getUserPoint } from "@/api/admin"; import {getUserPoint} from '@/api/admin';
const tabValue = ref(0); const tabValue = ref(0);
const isShowPay = ref(false); const isShowPay = ref(false);
const isShowCode = ref(false);
const url = ref('');
const tabsList = ref([ const tabsList = ref([
{ {
title: "全部", title: '全部',
value: 0, value: 0,
num: 0, num: 0,
}, },
{ {
title: "待付款", title: '待付款',
value: 1, value: 1,
num: 0, num: 0,
}, },
{ {
title: "待使用", title: '待使用',
value: 2, value: 2,
num: 0, num: 0,
}, },
{ {
title: "已使用", title: '已使用',
value: 3, value: 3,
num: 0, num: 0,
}, },
{ {
title: "已失效", title: '已失效',
value: 4, value: 4,
num: 0, num: 0,
}, },
@@ -53,6 +55,8 @@ interface OrderList {
pay_type: number; pay_type: number;
exchange: number; exchange: number;
price: number; price: number;
joint_oid: string;
bid: string;
} }
interface GoodsItem { interface GoodsItem {
@@ -70,7 +74,7 @@ interface GoodsItem {
const orderList = ref<OrderList[]>([]); const orderList = ref<OrderList[]>([]);
Taro.useLoad((options) => { Taro.useLoad(options => {
tabValue.value = Number(options.type); tabValue.value = Number(options.type);
}); });
@@ -78,6 +82,12 @@ Taro.useDidShow(() => {
getList(); getList();
}); });
// Taro.startPullDownRefresh({
// success: () => {
// getList();
// },
// });
const getList = async () => { const getList = async () => {
try { try {
const res = await getActiveOrderList({ const res = await getActiveOrderList({
@@ -87,10 +97,11 @@ const getList = async () => {
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
await getTj(); // await getTj();
// Taro.stopPullDownRefresh();
}; };
const tabChange = (index: number) => { const tabChange = (index: number) => {
@@ -99,23 +110,26 @@ const tabChange = (index: number) => {
}; };
const openPay = async (item: OrderList) => { const openPay = async (item: OrderList) => {
isShowPay.value = true; // isShowPay.value = true;
const user_info = Taro.getStorageSync("userInfo"); // const user_info = Taro.getStorageSync('userInfo');
const data = await getUserPoint({ // const data = await getUserPoint({
phone: user_info.data.phone, // phone: user_info.data.phone,
bid: item.Store.bid, // bid: item.Store.bid,
// });
// jfInfo.value = {
// jh_info: data.data,
// oid: item.oid,
// };
Taro.navigateTo({
url: `/pages/goods/pay/index?oid=${item.joint_oid}&bid=${item.bid}`,
}); });
jfInfo.value = {
jh_info: data.data,
oid: item.oid,
};
}; };
const errPay = () => { const errPay = () => {
isShowPay.value = false; isShowPay.value = false;
Taro.showToast({ Taro.showToast({
title: "支付失败", title: '支付失败',
icon: "none", icon: 'none',
}); });
jfInfo.value = {}; jfInfo.value = {};
getList(); getList();
@@ -123,8 +137,8 @@ const errPay = () => {
const closePay = () => { const closePay = () => {
isShowPay.value = false; isShowPay.value = false;
Taro.showToast({ Taro.showToast({
title: "支付取消", title: '支付取消',
icon: "none", icon: 'none',
}); });
jfInfo.value = {}; jfInfo.value = {};
getList(); getList();
@@ -137,19 +151,18 @@ const successPay = () => {
}; };
const toDetail = (item: any) => { const toDetail = (item: any) => {
Taro.setStorageSync("item", item);
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`, url: `/pages/users/order_list_detail/index?orderId=${item.oid}&OrderType=2`,
}); });
}; };
const delOrder = async (oid: string) => { const delOrder = async (oid: string) => {
try { try {
await deleteActiveOrder({ oid }); await deleteActiveOrder({oid});
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
await getList(); await getList();
@@ -179,15 +192,50 @@ const getTj = async () => {
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
const t_id = ref();
const openCode = item => {
if (item.status === 2) return;
url.value = `https://api.pwmqr.com/qrcode/create?url=${item.oid}`;
isShowCode.value = true;
t_id.value = setInterval(() => {
checkStatus(item);
}, 1000);
};
const checkStatus = async itm => {
await getList();
orderList.value.forEach(item => {
if (item.oid === itm.oid) {
console.log(item);
if (item.status === 2) {
clearInterval(t_id.value);
isShowCode.value = false;
url.value = '';
Taro.showToast({
title: '核销成功',
icon: 'none',
});
}
}
});
};
const closed = () => {
isShowCode.value = false;
url.value = '';
clearInterval(t_id.value);
};
</script> </script>
<template> <template>
<view> <view>
<view class="topTips"> <!-- <view class="topTips">
<view> <view>
<view style="font-weight: bold">订单信息</view> <view style="font-weight: bold">订单信息</view>
<view style="font-size: 15px" <view style="font-size: 15px"
@@ -198,34 +246,50 @@ const getTj = async () => {
</view> </view>
</view> </view>
<image src="../static/user/order_list_top.png" /> <image src="../static/user/order_list_top.png" />
</view> </view> -->
<view class="tabs-box"> <view class="tabs-box">
<view <view
v-for="item in tabsList" v-for="item in tabsList"
:key="item.value" :key="item.value"
@click="tabChange(item.value)" @click="tabChange(item.value)">
>
<view class="text">{{ item.title }}</view>
<view>{{ item.num }}</view>
<view <view
class="line" class="text"
:class="{ lineColor: item.value === tabValue }" :style="{
></view> color: tabValue === item.value ? '#000' : '#9C9C9C',
}"
>{{ item.title }}</view
>
<!-- <view>{{ item.num }}</view> -->
<view class="line" :class="{lineColor: item.value === tabValue}"></view>
</view> </view>
</view> </view>
<view v-if="orderList.length > 0"> <view v-if="orderList.length > 0">
<view class="order-card" v-for="(item, index) in orderList" :key="index"> <view
class="order-card"
v-for="(item, index) in orderList"
:key="index"
@click="toDetail(item)">
<view class="top"> <view class="top">
<view>{{ item.add_time.slice(0, 19) }}</view> <view class="text-[#9C9C9C] text-[28px]">订单号{{ item.oid }}</view>
<view style="color: red" <view
:style="{
color:
item.status === 0
? '#FF850A'
: item.status === 1
? '#F83D3D'
: item.status === 2
? '#333333'
: '#9C9C9C',
}"
>{{ >{{
item.status === 0 item.status === 0
? "待付款" ? '待付款'
: item.status === 1 : item.status === 1
? "待使用" ? '待使用'
: item.status === 2 : item.status === 2
? "已使用" ? '已使用'
: "已失效" : '已失效'
}} }}
</view> </view>
</view> </view>
@@ -233,52 +297,83 @@ const getTj = async () => {
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx"> <view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
<view class="top"> <view class="top">
<image :src="itm.Goods.cover" /> <image :src="itm.Goods.cover" />
<view class="title">{{ itm.Goods?.name }}</view> <view class="flex flex-col justify-between flex-1">
<view class="title">{{ itm.Goods?.name }}</view>
<view class="text-[#F83D3D] mt-5">
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
</view>
</view>
<view class="right"> <view class="right">
<view>{{ itm.pay_price }}</view>
<view>{{ itm.pay_integral }}积分</view>
<view>x{{ itm.number }}</view> <view>x{{ itm.number }}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="line"></view> <!-- <view class="line"></view> -->
<view v-if="item.status !== 0" style="text-align: right"> <view
<text>{{ item.count }}件商品</text>, class="flex justify-between items-center mt-2 mb-2 text-[25px]"
<text v-if="item.status !== 0"
>实付款:{{ item.pay_type === 1 ? item.price : item.exchange }},{{ style="text-align: right">
item.pay_type === 1 ? "微信支付" : "积分支付" <text class="text-[#9C9C9C] text-[28px]"
}}</text >{{ item.count }}件商品</text
> >
<view class="line"></view> <text class="text-[26px]"
>{{ item.status !== 0 ? '实' : '应' }}付款{{
item.pay_type === 1 ? '(元): ' : '(积分): '
}}{{ item.pay_type === 1 ? item.price : item.exchange }}</text
>
<!-- <view class="line"></view> -->
</view> </view>
<view class="btn"> <view class="btn">
<nut-button <nut-button
v-if="item.status === 0" v-if="item.status === 0"
plain plain
size="small" size="mini"
type="primary" type="primary"
@click="delOrder(item.oid)" @click.stop="delOrder(item.oid)"
>取消订单 >取消订单
</nut-button> </nut-button>
<nut-button <!-- <nut-button
style="margin-left: 5px" style="margin-left: 5px"
size="small" size="mini"
type="primary" type="primary"
@click="toDetail(item)" @click="toDetail(item)"
>查看详情 >查看详情
</nut-button> -->
<nut-button
style="margin-left: 5px"
size="mini"
type="primary"
v-if="item.status === 0"
@click.stop="openPay(item)"
>立即付款
</nut-button> </nut-button>
<nut-button <nut-button
style="margin-left: 5px" style="margin-left: 5px"
size="small" size="mini"
type="primary" type="primary"
v-if="item.status === 0" v-if="item.status === 1"
@click="openPay(item)" @click.stop="openCode(item)"
>立即付款 >出示核销码
</nut-button> </nut-button>
</view> </view>
</view> </view>
</view> </view>
<nut-empty v-else description="暂无订单"></nut-empty> <nut-empty v-else description="暂无订单"></nut-empty>
<!-- 核销码弹窗 -->
<nut-popup
v-model:visible="isShowCode"
position="center"
style="padding: 20px; border-radius: 15px"
:maskClosable="true"
safe-area-inset-bottom
@click-overlay="closed"
@closed="closed">
<view class="code-box">
<view>核销码</view>
<image class="qrcode" :src="url"></image>
</view>
</nut-popup>
<pay <pay
:isShowPay="isShowPay" :isShowPay="isShowPay"
:interval="false" :interval="false"
@@ -286,8 +381,7 @@ const getTj = async () => {
:OrderType="2" :OrderType="2"
@errPay="errPay" @errPay="errPay"
@successPay="successPay" @successPay="successPay"
@closePay="closePay" @closePay="closePay" />
/>
</view> </view>
</template> </template>
@@ -309,8 +403,8 @@ page {
align-items: center; align-items: center;
image { image {
width: 150px; width: 200px;
height: 150px; height: 200px;
} }
} }
@@ -319,20 +413,19 @@ page {
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
height: auto;
background-color: #fff; background-color: #fff;
padding: 0 20px; padding: 20px 20px 0 20px;
text-align: center; text-align: center;
.text { .text {
margin: 10px 20px;
align-items: center; align-items: center;
font-size: 30px;
} }
.line { .line {
margin: 0 auto; margin: 10px auto;
width: 50px; width: 50px;
height: 5px; height: 10px;
border-radius: 30px; border-radius: 30px;
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
} }
@@ -345,7 +438,7 @@ page {
.order-card { .order-card {
width: 95%; width: 95%;
box-sizing: border-box; box-sizing: border-box;
margin: 15px auto; margin: 20px auto;
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
@@ -354,7 +447,7 @@ page {
width: 100%; width: 100%;
height: 1px; height: 1px;
background-color: #f5f5f5; background-color: #f5f5f5;
margin: 10px; margin: 20px auto;
} }
.top { .top {
@@ -370,20 +463,18 @@ page {
} }
.center { .center {
margin-bottom: 10px;
.top { .top {
display: flex; display: flex;
justify-content: space-between; align-items: flex-start;
// align-items: flex-start;
image { image {
width: 150rpx; width: 150px;
height: 150rpx; height: 150px;
border-radius: 10rpx; border-radius: 15px;
margin-right: 20px;
} }
.title { .title {
margin-left: 10px;
display: -webkit-box; display: -webkit-box;
overflow: hidden; overflow: hidden;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
@@ -396,8 +487,21 @@ page {
margin-left: 10px; margin-left: 10px;
font-size: 28px; font-size: 28px;
text-align: right; text-align: right;
color: #9c9c9c;
} }
} }
} }
} }
.code-box {
padding: 20px;
box-sizing: border-box;
text-align: center;
font-size: large;
}
.qrcode {
width: 300px;
height: 300px;
}
</style> </style>

View File

@@ -1,79 +1,142 @@
<template> <template>
<view> <view class="p-4">
<!-- 步骤条 --> <!-- 步骤条 -->
<view class="step-bar"> <!-- <view class="step-bar">
<view <view
class="item" class="item"
v-for="item in statusList" v-for="item in statusList"
:key="item.id" :key="item.id"
:class="{ activation: item.id === goodInfo.status }" :class="{activation: item.id === goodInfo.status}">
>
<view class="text">{{ item.text }}</view> <view class="text">{{ item.text }}</view>
<view class="dot"></view> <view class="dot"></view>
</view> </view>
</view> </view> -->
<view v-if="goodInfo.status === 1" class="timeBox"> <!-- <view v-if="goodInfo.status === 1" class="timeBox">
订单剩余{{ timeStr }}过期,请尽快核销 订单剩余{{ timeStr }}过期,请尽快核销
</view> -->
<view class="mb-3">
<view v-if="goodInfo.status === 0">
<view class="flex text-[#333333] items-center mb-1">
<view class="font-bold">订单待付款</view>
<IconFont name="rect-right" size="15" color="#333333"></IconFont>
</view>
<view class="text-[#9C9C9C] text-[20px]">订单未支付请付款</view>
</view>
<view v-if="goodInfo.status === 1">
<view class="flex text-[#333333] items-center mb-1">
<view class="font-bold">订单待使用</view>
<IconFont name="rect-right" size="15" color="#333333"></IconFont>
</view>
<view class="text-[#9C9C9C] text-[20px]"
>订单剩余<text class="text-[#FF0000]">{{ timeStr }}</text
>过期请尽快核销</view
>
</view>
<view v-if="goodInfo.status === 2">
<view class="flex text-[#333333] items-center mb-1">
<view class="font-bold">订单已使用</view>
<IconFont name="rect-right" size="15" color="#333333"></IconFont>
</view>
<view class="text-[#9C9C9C] text-[20px]">订单已核销欢迎下次光临</view>
</view>
<view v-if="goodInfo.status === 3">
<view class="flex text-[#333333] items-center mb-1">
<view class="font-bold">订单失效</view>
<IconFont name="rect-right" size="15" color="#333333"></IconFont>
</view>
<view class="text-[#9C9C9C] text-[20px]">未核销已失效</view>
</view>
</view> </view>
<!-- 商家信息 --> <!-- 商家信息 -->
<view class="mer-info"> <view class="mer-info">
<view class="left"> <image
<view> class="w-[150px] h-[150px] rounded-lg mr-2"
<text>{{ goodInfo.Store?.name }}</text> :src="goodInfo.Store?.head_photo" />
<text>{{ goodInfo.Store?.phone }}</text>
</view>
<nut-ellipsis
:rows="2"
:content="goodInfo.Store?.address"
direction="end"
></nut-ellipsis>
</view>
<view class="right"> <view class="right">
<view class="icon" @click="toPhone"> <view class="text-[#333333]">{{ goodInfo.Store?.name }}</view>
<Service /> <view
<text>电话</text> class="flex mt-2 items-center text-[#999999] text-[23px] text-ellipsis line-clamp-3">
<view
style="font-size: 15px"
class="iconfont icon-dizhi text-[#C4C4C4]"></view>
<view>{{ goodInfo.Store?.address }}</view>
</view> </view>
<view class="icon" @click="toAdder"> <view class="w-full flex items-center justify-between mt-1">
<Find /> <view class="ml-3 text-[23px] text-[#999999]"
<text>导航</text> >距离您{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(goodInfo.Store?.lat),
Number(goodInfo.Store?.lon),
)
}}
</view>
<view class="flex items-center">
<image
@tap="toPhone()"
class="w-[50px] h-[50px]"
src="http://p0.meituan.net/csc/ab0493b124a6bb858bf82a2340767c0d919.png" />
<image
@tap="toAdder()"
class="w-[50px] h-[50px] ml-2"
src="http://p1.meituan.net/csc/92ee8512c90527169b44e07fd11d250d924.png" />
</view>
</view> </view>
</view> </view>
</view> </view>
<!-- 订单信息 --> <!-- 订单信息 -->
<nut-cell-group> <nut-cell-group>
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
<nut-cell> <nut-cell>
<template #default> <template #default>
<view class="center-box"> <view class="center-box">
<view <view
class="top" class="top"
v-for="(item, index) in goodInfo.OrderGoods" v-for="(item, index) in goodInfo.OrderGoods"
:key="index" :key="index">
>
<image :src="item.Goods?.cover" /> <image :src="item.Goods?.cover" />
<view class="title">{{ item.Goods?.name }} </view> <view class="flex flex-col justify-between flex-1">
<view class="title">{{ item.Goods?.name }}</view>
<view class="text-[#F83D3D] mt-5">
<view>{{ item.pay_price }}</view>
<view>{{ item.pay_integral }}积分</view>
</view>
</view>
<view class="right"> <view class="right">
<view>{{ item.pay_price }}</view>
<view>{{ item.pay_integral }}积分</view>
<view>x{{ item.number }}</view> <view>x{{ item.number }}</view>
</view> </view>
</view> </view>
<view
class="flex justify-between items-center mt-2 mb-2 text-[25px]">
<view class="text-[#9C9C9C]">{{
`${goodInfo.count}件商品`
}}</view>
<text
>{{ goodInfo.status !== 0 ? '实' : '应' }}付款{{
goodInfo.pay_type === 1 ? '(元): ' : '(积分): '
}}{{
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
}}</text
>
</view>
</view> </view>
</template> </template>
</nut-cell> </nut-cell>
</nut-cell-group>
<nut-cell-group>
<nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell> <nut-cell title="订单号:" :desc="goodInfo.oid"></nut-cell>
<nut-cell <nut-cell
title="下单时间:" title="下单时间:"
:desc="goodInfo.add_time?.slice(0, 19)" :desc="goodInfo.add_time?.slice(0, 19)"></nut-cell>
></nut-cell> <!-- <nut-cell
<nut-cell
v-if="goodInfo.expires !== 0" v-if="goodInfo.expires !== 0"
title="订单过期时间:" title="订单过期时间:"
:desc="dayjs.unix(goodInfo.expires).format('YYYY-MM-DD HH:mm:ss')" :desc="
></nut-cell> dayjs.unix(goodInfo.expires).format('YYYY-MM-DD HH:mm:ss')
"></nut-cell> -->
<nut-cell <nut-cell
title="支付状态:" title="订单状态:"
:desc=" :desc="
goodInfo.status === 0 goodInfo.status === 0
? '待付款' ? '待付款'
@@ -82,38 +145,36 @@
: goodInfo.status === 2 : goodInfo.status === 2
? '已使用' ? '已使用'
: '已失效' : '已失效'
" "></nut-cell>
></nut-cell>
<!-- <nut-cell
:title="`商品总价(${type === '1' ? '元' : '积分'}):`"
:desc="goodInfo.number"
>
</nut-cell> -->
<nut-cell v-if="goodInfo.status !== 0">
<template #default>
<view style="text-align: right; width: 100%">
<view
>实付款({{ goodInfo.pay_type === 1 ? "微信" : "积分" }})
<nut-price
:price="
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
"
size="normal"
:need-symbol="false"
/>
</view>
</view>
</template>
</nut-cell>
</nut-cell-group> </nut-cell-group>
<view class="btn">
<!-- <nut-button <view class="mt-[30px] m-auto">
<nut-button
v-if="goodInfo.status === 0"
shape="square"
type="primary"
block
@click="openPay()"
>继续付款</nut-button
>
<nut-button
v-if="goodInfo.status === 1"
shape="square"
type="primary"
block
@click="openCode()"
>出示核销码</nut-button
>
</view>
<!-- <view class="btn">
<nut-button
plain plain
v-if="goodInfo.status === 0" v-if="goodInfo.status === 0"
size="small" size="small"
type="primary" type="primary"
>取消订单 >取消订单
</nut-button> --> </nut-button>
<nut-button <nut-button
v-if="goodInfo.status === 0" v-if="goodInfo.status === 0"
style="margin-left: 5px" style="margin-left: 5px"
@@ -130,19 +191,19 @@
@click="openCode()" @click="openCode()"
>出示核销码 >出示核销码
</nut-button> </nut-button>
</view> </view> -->
<!-- 核销码弹窗 --> <!-- 核销码弹窗 -->
<nut-popup <nut-popup
v-model:visible="isShowCode" v-model:visible="isShowCode"
position="bottom" position="center"
:style="{ height: 'auto' }" style="padding: 20px; border-radius: 15px"
:maskClosable="true" :maskClosable="true"
safe-area-inset-bottom safe-area-inset-bottom
@closed="closed" @click-overlay="closed"
> @closed="closed">
<view class="code-box"> <view class="code-box">
<view>请出示核销码核销</view> <view>核销码</view>
<image class="qrcode" :src="url"></image> <image class="qrcode" :src="url"></image>
</view> </view>
</nut-popup> </nut-popup>
@@ -153,58 +214,74 @@
:OrderType="2" :OrderType="2"
@errPay="errPay" @errPay="errPay"
@successPay="successPay" @successPay="successPay"
@closePay="closePay" @closePay="closePay" />
/>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { Find, Service } from "@nutui/icons-vue-taro"; import {onUnmounted, ref} from 'vue';
import { ref } from "vue"; import dayjs from 'dayjs';
import dayjs from "dayjs"; import duration from 'dayjs/plugin/duration';
import duration from "dayjs/plugin/duration"; import Pay from '@/components/Pay.vue';
import Pay from "@/components/Pay.vue"; import {getUserPoint} from '@/api/admin';
import { getUserPoint } from "@/api/admin"; import {calculateDistance} from '@/utils';
import {IconFont} from '@nutui/icons-vue-taro';
import {getActiveOrderDetail} from '@/api/goods';
dayjs.extend(duration); dayjs.extend(duration);
const goodInfo = ref<any>({}); const goodInfo = ref<any>({});
const statusList = ref([ const userLocalNum = ref({
{ l: 0,
id: 0, t: 0,
text: "待付款", });
},
{
id: 1,
text: "待使用",
},
{
id: 2,
text: "已使用",
},
{
id: 3,
text: "已失效",
},
]);
const isShowCode = ref(false); const isShowCode = ref(false);
const isShowPay = ref(false); const isShowPay = ref(false);
const jfInfo = ref<any>({}); const jfInfo = ref<any>({});
const type = ref(""); const type = ref('');
const url = ref(""); const url = ref('');
Taro.useLoad((options) => { const oid = ref('');
const tId = ref();
Taro.useLoad(options => {
type.value = options.type; type.value = options.type;
goodInfo.value = Taro.getStorageSync("item"); oid.value = options.orderId;
tId.value = Number(options.OrderType);
Taro.getLocation({
type: 'wgs84',
success: res => {
userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude;
},
});
// goodInfo.value = Taro.getStorageSync('item');
getOrderDetail();
});
const getOrderDetail = async () => {
const res = await getActiveOrderDetail({
oid: oid.value,
OrderType: tId.value,
});
goodInfo.value = res.data.data[0];
if (goodInfo.value.status === 1) { if (goodInfo.value.status === 1) {
startTime(); startTime();
} }
});
if (goodInfo.value.status === 2 && isShowCode.value) {
Taro.showToast({
title: '订单核销完成',
icon: 'none',
});
}
};
const toPhone = () => { const toPhone = () => {
Taro.makePhoneCall({ Taro.makePhoneCall({
@@ -221,24 +298,28 @@ const toAdder = () => {
}; };
const openPay = async () => { const openPay = async () => {
isShowPay.value = true; // isShowPay.value = true;
const mer_info = Taro.getStorageSync("mer_info"); // const mer_info = Taro.getStorageSync('mer_info');
const user_info = Taro.getStorageSync("userInfo"); // const user_info = Taro.getStorageSync('userInfo');
const data = await getUserPoint({ // const data = await getUserPoint({
phone: user_info.data.phone, // phone: user_info.data.phone,
bid: mer_info.bid, // bid: mer_info.bid,
// });
// jfInfo.value = {
// jh_info: data.data,
// oid: Taro.getStorageSync('item').oid,
// };
// console.log(goodInfo.value.bid, goodInfo.value.joint_oid);
Taro.navigateTo({
url: `/pages/goods/pay/index?oid=${goodInfo.value.joint_oid}&bid=${goodInfo.value.bid}`,
}); });
jfInfo.value = {
jh_info: data.data,
oid: Taro.getStorageSync("item").oid,
};
}; };
const successPay = (val: boolean) => { const successPay = (val: boolean) => {
isShowPay.value = val; isShowPay.value = val;
Taro.showToast({ Taro.showToast({
title: "支付成功", title: '支付成功',
icon: "none", icon: 'none',
}); });
Taro.navigateBack({ Taro.navigateBack({
delta: 1, delta: 1,
@@ -248,33 +329,40 @@ const successPay = (val: boolean) => {
const errPay = () => { const errPay = () => {
isShowPay.value = false; isShowPay.value = false;
Taro.showToast({ Taro.showToast({
title: "支付失败", title: '支付失败',
icon: "none", icon: 'none',
}); });
jfInfo.value = {}; jfInfo.value = {};
}; };
const closePay = () => { const closePay = () => {
isShowPay.value = false; isShowPay.value = false;
Taro.showToast({ Taro.showToast({
title: "支付取消", title: '支付取消',
icon: "none", icon: 'none',
}); });
jfInfo.value = {}; jfInfo.value = {};
}; };
const t_id = ref();
const openCode = () => { const openCode = () => {
if (goodInfo.value.status === 2) return;
url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`; url.value = `https://api.pwmqr.com/qrcode/create?url=${goodInfo.value.oid}`;
isShowCode.value = true; isShowCode.value = true;
t_id.value = setInterval(() => {
getOrderDetail();
}, 1000);
}; };
const closed = () => { const closed = () => {
isShowCode.value = false; isShowCode.value = false;
url.value = ""; url.value = '';
clearInterval(t_id.value);
}; };
let timeId: any; let timeId: any;
const timeStr = ref("????"); const timeStr = ref('????');
const startTime = () => { const startTime = () => {
const nowTime = dayjs(); const nowTime = dayjs();
@@ -284,10 +372,10 @@ const startTime = () => {
const duration = dayjs.duration(endTime.diff(nowTime)); const duration = dayjs.duration(endTime.diff(nowTime));
// 格式化剩余时间 // 格式化剩余时间
timeStr.value = duration.format("D天H小时m分钟s秒"); timeStr.value = duration.format('D天H小时m分钟s秒');
if (goodInfo.value.expires - dayjs().unix() > 0) { if (goodInfo.value.expires - dayjs().unix() > 0) {
clearInterval(timeId); clearTimeout(timeId);
timeId = setTimeout(() => { timeId = setTimeout(() => {
startTime(); startTime();
}, 1000); }, 1000);
@@ -296,6 +384,17 @@ const startTime = () => {
Taro.useUnload(() => { Taro.useUnload(() => {
clearTimeout(timeId); clearTimeout(timeId);
clearInterval(t_id.value);
});
Taro.useDidHide(() => {
clearTimeout(timeId);
clearInterval(t_id.value);
});
onUnmounted(() => {
clearTimeout(timeId);
clearInterval(t_id.value);
}); });
</script> </script>
@@ -349,7 +448,7 @@ page {
position: relative; position: relative;
&::before { &::before {
content: ""; content: '';
width: 15px; width: 15px;
height: 15px; height: 15px;
border-radius: 50%; border-radius: 50%;
@@ -365,43 +464,20 @@ page {
.mer-info { .mer-info {
background-color: white; background-color: white;
padding: 20px 30px; padding: 15px;
margin-top: 10px; margin-top: 10px;
width: 100%;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
justify-content: space-between; justify-content: space-betweenhh;
align-items: center; align-items: center;
border-radius: 15px;
.left {
width: 50%;
text {
margin-right: 10px;
}
.address {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: -webkit-box;
-webkit-line-clamp: 1;
}
}
.right { .right {
color: #858585; color: #858585;
text-align: center;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 120px;
justify-content: space-between; justify-content: space-between;
width: 70%;
.icon {
display: flex;
align-items: center;
//margin-bottom: 20px;
}
} }
} }
@@ -435,6 +511,7 @@ page {
width: 150px; width: 150px;
height: 150px; height: 150px;
border-radius: 10rpx; border-radius: 10rpx;
margin-right: 10px;
} }
.title { .title {
@@ -466,4 +543,8 @@ page {
width: 300px; width: 300px;
height: 300px; height: 300px;
} }
.nut-button {
border-radius: 20px;
}
</style> </style>

View File

@@ -21,7 +21,8 @@ page {
.tabs { .tabs {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 20px 30px; padding: 20px;
background-color: #ffffff;
.item { .item {
display: flex; display: flex;
@@ -71,8 +72,8 @@ page {
margin: 20px; margin: 20px;
image { image {
width: 195px; width: 150px;
height: 195px; height: 150px;
border-radius: 12px; border-radius: 12px;
} }

View File

@@ -17,21 +17,18 @@
class="item" class="item"
v-for="item in tabs" v-for="item in tabs"
:key="item.value" :key="item.value"
@click="changeTabs(item.value)" @click="changeTabs(item.value)">
>
<text>{{ item.text }}</text> <text>{{ item.text }}</text>
<view <view
class="line" class="line"
:class="tabsIndex == item.value ? 'active' : ''" :class="tabsIndex == item.value ? 'active' : ''"></view>
></view>
</view> </view>
</view> </view>
<view v-if="listData.length > 0"> <view v-if="listData.length > 0">
<view <view
class="card" class="card"
v-for="(item, index) in (listData as any[])" v-for="(item, index) in (listData as any[])"
:key="index" :key="index">
>
<view class="header"> <view class="header">
<view> <view>
<text>台号: {{ item.seat }}</text> <text>台号: {{ item.seat }}</text>
@@ -50,11 +47,12 @@
<view <view
class="goods-list" class="goods-list"
v-for="(itm, idx) in item.OrderGoods" v-for="(itm, idx) in item.OrderGoods"
:key="idx" :key="idx">
>
<image :src="itm.Goods.cover"></image> <image :src="itm.Goods.cover"></image>
<view class="center"> <view class="center">
<nut-ellipsis direction="end" :content="itm.Goods.name"></nut-ellipsis> <nut-ellipsis
direction="end"
:content="itm.Goods.name"></nut-ellipsis>
<!-- <view class="title">{{ itm.Goods.name }}</view> --> <!-- <view class="title">{{ itm.Goods.name }}</view> -->
</view> </view>
<view class="num"> <view class="num">
@@ -76,29 +74,29 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import {ref} from 'vue';
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { getUserAfterOrderList } from "../../../api/user"; import {getUserAfterOrderList} from '../../../api/user';
const tabsIndex = ref(0); const tabsIndex = ref(0);
const listData = ref([]); const listData = ref<any[]>([]);
const tabs = ref([ const tabs = ref([
{ {
text: "全部", text: '全部',
value: 0, value: 0,
}, },
{ {
text: "未付款", text: '未付款',
value: 1, value: 1,
}, },
{ {
text: "挂帐中", text: '挂帐中',
value: 3, value: 3,
}, },
{ {
text: "已收款", text: '已收款',
value: 2, value: 2,
}, },
]); ]);
@@ -112,48 +110,66 @@ const changeTabs = (index: number) => {
get_list(); get_list();
}; };
const pageOpt = ref({
page: 1,
total: 0,
});
const get_list = async () => { const get_list = async () => {
Taro.showLoading({ Taro.showLoading({
title: "加载中", title: '加载中',
}); });
const user_info = await Taro.getStorageSync("userInfo"); const user_info = await Taro.getStorageSync('userInfo');
const { data: res } = await getUserAfterOrderList({ const {data: res} = await getUserAfterOrderList({
phone: user_info.data.phone, phone: user_info.data.phone,
status: tabsIndex.value, status: tabsIndex.value,
PageNum: pageOpt.value.page,
PageSize: 10,
}); });
listData.value = res.data || []; listData.value.push(...res.data);
pageOpt.value.total = res.total || 0;
Taro.hideLoading(); Taro.hideLoading();
}; };
const get_color = (status: number) => { const get_color = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "#FD0100"; return '#FD0100';
case 1: case 1:
return "#03A113"; return '#03A113';
case 2: case 2:
return "#FFA938"; return '#FFA938';
} }
}; };
const get_status_text = (status: number) => { const get_status_text = (status: number) => {
switch (status) { switch (status) {
case 0: case 0:
return "未付款"; return '未付款';
case 1: case 1:
return "已付款"; return '已付款';
case 2: case 2:
return "挂帐中"; return '挂帐中';
} }
}; };
const to_page = (item) => { const to_page = item => {
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/users/pending_order/pending_order_detail/index?bid=${item.bid}&oid=${item.oid}`, url: `/pages/users/pending_order/pending_order_detail/index?bid=${item.bid}&oid=${item.oid}`,
}); });
}; };
Taro.useReachBottom(() => {
if (pageOpt.value.total === listData.value.length)
return Taro.showToast({
title: '没有更多数据了',
icon: 'none',
});
pageOpt.value.page++;
get_list();
});
</script> </script>
<style lang="scss"> <style lang="scss">
@import "./index.scss"; @import './index.scss';
</style> </style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: '交易密码',
});

View File

@@ -0,0 +1,34 @@
.form {
background-color: #fff;
margin-top: 20px;
padding: 25px 0;
.form-item {
display: flex;
padding: 20px 30px;
align-items: center;
.form-item-label {
font-size: 28px;
width: 150px;
}
.form-item-content {
flex: 1;
border-bottom: rgba(232, 232, 232, 1) 1px solid;
padding: 10px 0;
display: flex;
justify-content: space-between;
align-items: center;
.input-placeholder {
font-size: 28px;
color: rgba(176, 176, 176, 1);
}
}
}
}
.nut-button {
border-radius: 20px;
}

View File

@@ -0,0 +1,146 @@
<template>
<view>
<view class="form">
<view class="form-item">
<view class="form-item-label">
<text>设置密码:</text>
</view>
<view class="form-item-content">
<input
type="password"
maxLength="6"
placeholder="请输入6位数交易密码"
v-model="formVal.password"
placeholderClass="input-placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-item-label">
<text>确认密码:</text>
</view>
<view class="form-item-content">
<input
type="password"
maxLength="6"
v-model="formVal.confirmPassword"
placeholder="请再次输入6位数密码"
placeholderClass="input-placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-item-label">
<text>手机号码:</text>
</view>
<view class="form-item-content">
<input
type="text"
placeholder="请输入手机号码"
:disabled="true"
:value="userinfo.data?.phone"
placeholderClass="input-placeholder" />
</view>
</view>
<view class="form-item">
<view class="form-item-label">
<text>验证码:</text>
</view>
<view class="form-item-content">
<input
type="text"
placeholder="请输入验证码"
maxLength="6"
v-model="formVal.code"
placeholderClass="input-placeholder" />
<text
:style="{
color: !isT ? '#F83D3D' : 'rgba(176, 176, 176, 1)',
}"
@tap="getCode"
>{{ codeText }}
</text>
</view>
</view>
</view>
<view class="w-[90%] mt-[80px] mx-auto">
<nut-button shape="square" type="primary" block @click="formSubmit"
>确认修改
</nut-button>
</view>
</view>
</template>
<script setup lang="ts">
import {ref} from 'vue';
import Taro from '@tarojs/taro';
import {editTradePwd, getVerifyCode} from '@/api/user';
const userinfo = ref<any>({});
const codeText = ref('获取验证码');
const isT = ref(false);
const formVal = ref({
password: '',
confirmPassword: '',
code: '',
});
const xFormVal = ref({
oldPassword: '',
password: '',
confirmPassword: '',
code: '',
});
Taro.useLoad(() => {
userinfo.value = Taro.getStorageSync('userInfo');
});
const formSubmit = async () => {
try {
if (!formVal.value.password)
return Taro.showToast({title: '请输入交易密码', icon: 'none'});
if (!formVal.value.confirmPassword)
return Taro.showToast({title: '请再次输入交易密码', icon: 'none'});
if (formVal.value.password !== formVal.value.confirmPassword)
return Taro.showToast({title: '两次密码不一致', icon: 'none'});
if (!formVal.value.code)
return Taro.showToast({title: '请输入验证码', icon: 'none'});
const res = await editTradePwd({
pay_password: formVal.value.password,
code: formVal.value.code,
});
Taro.showToast({title: res.msg, icon: 'none'});
Taro.navigateBack({
delta: 1,
});
} catch (err) {
Taro.showToast({title: err.msg, icon: 'none'});
}
};
const getCode = async () => {
if (isT.value) return;
isT.value = true;
await getVerifyCode({
phone: userinfo.value.data?.phone,
});
// 倒计时60s
let time = 60;
const timer = setInterval(() => {
if (time === 0) {
clearInterval(timer);
isT.value = false;
codeText.value = '获取验证码';
} else {
codeText.value = `${time}s后重新获取`;
time--;
}
}, 1000);
};
</script>
<style lang="scss">
@import './index.scss';
</style>

View File

@@ -1,12 +1,37 @@
<script lang="ts" setup> <script lang="ts" setup>
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
const toPage = (url: string) => { const toPage = (url: string) => {
if (url === "1") return Taro.showToast({ title: "暂未开放", icon: "none" }); if (url === '1') return Taro.showToast({title: '暂未开放', icon: 'none'});
Taro.navigateTo({ Taro.navigateTo({
url: url, url: url,
}); });
}; };
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('用户点击取消');
}
},
});
};
const clickText = (type: number, text: string) => {
Taro.navigateTo({
url: `/pages/users/user_agreement/index?type=${type}&name=${text}`,
});
};
</script> </script>
<template> <template>
@@ -15,13 +40,34 @@ const toPage = (url: string) => {
<nut-cell <nut-cell
title="个人信息" title="个人信息"
is-link is-link
@click="toPage('/pages/users/user_setting/index')" @click="toPage('/pages/users/user_setting/index')"></nut-cell>
></nut-cell> <nut-cell
<!-- <nut-cell title="关于我们" is-link @click="toPage('1')"></nut-cell> title="服务协议"
<nut-cell title="资质证明" is-link @click="toPage('1')"></nut-cell> is-link
<nut-cell title="协议规则" is-link @click="toPage('1')"></nut-cell> @click="clickText(1, '用户协议')"></nut-cell>
<nut-cell title="隐私设置" is-link @click="toPage('1')"></nut-cell> --> <nut-cell
title="隐私政策协议"
is-link
@click="clickText(2, '隐私政策')"></nut-cell>
<nut-cell
title="平台积分使用规则"
is-link
@click="clickText(3, '积分使用规则')"></nut-cell>
<nut-cell
title="修改交易密码"
is-link
@click="toPage('/pages/users/pwd/index')"></nut-cell>
</nut-cell-group> </nut-cell-group>
<view class="w-[90%] m-auto">
<nut-button
block
type="primary"
shape="square"
style="border-radius: 10px"
@click="logOut"
>退出登录</nut-button
>
</view>
</view> </view>
</template> </template>

View File

@@ -1,45 +1,25 @@
<script lang="ts" setup> <script lang="ts" setup>
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
import { ref } from "vue"; import {ref} from 'vue';
import { editPersonalInfo } from "@/api/user"; import {editPersonalInfo} from '@/api/user';
import { View } from "@tarojs/components"; import {BASE_URL} from '@/utils/request';
import { BASE_URL } from "@/utils/request";
// const toPage = (e: string) => {}; // const toPage = (e: string) => {};
const userInfo = ref<any>({}); const userInfo = ref<any>({});
Taro.useLoad(() => { Taro.useLoad(() => {
const { data: data } = Taro.getStorageSync("userInfo"); const {data: data} = Taro.getStorageSync('userInfo');
userInfo.value = data; 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("用户点击取消");
}
},
});
};
const chooseavatar = (e: any) => { const chooseavatar = (e: any) => {
Taro.uploadFile({ Taro.uploadFile({
url: `${BASE_URL}/upload`, url: `${BASE_URL}/upload`,
filePath: e.detail.avatarUrl, filePath: e.detail.avatarUrl,
name: "file", name: 'file',
header: { header: {
token: Taro.getStorageSync("token"), token: Taro.getStorageSync('token'),
}, },
success: function (res) { success: function (res) {
const data = JSON.parse(res.data); const data = JSON.parse(res.data);
@@ -53,65 +33,48 @@ const subUser = async () => {
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}$/; 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)) if (!reg.test(userInfo.value.phone))
return Taro.showToast({ return Taro.showToast({
title: "请输入正确的手机号码", title: '请输入正确的手机号码',
icon: "none", icon: 'none',
}); });
const res = await editPersonalInfo(userInfo.value); const res = await editPersonalInfo(userInfo.value);
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
}); });
Taro.switchTab({ Taro.switchTab({
url: "/pages/user/index", url: '/pages/user/index',
}); });
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
}); });
} }
}; };
// const getUserInfo = async () => {
// try {
// const res = await getPersonalInfo();
// userInfo.value = res.data.data;
// } catch (error) {
// Taro.showToast({
// title: error.msg,
// icon: "none",
// });
// }
// };
</script> </script>
<template> <template>
<view class="app"> <view class="app">
<view class="user-card"> <nut-cell-group>
<view>管理我的账号</view> <nut-cell title="头像">
<!-- {{ userInfo }} --> <template v-slot:link>
<view class="avatar-card"> <nut-button
<view class="left"> style="border: none; height: auto; padding: 0"
<nut-button open-type="chooseAvatar" @chooseavatar="chooseavatar"> open-type="chooseAvatar"
@chooseavatar="chooseavatar">
<nut-avatar size="large"> <nut-avatar size="large">
<img style="border-radius: 50%" :src="userInfo.avatarUrl" /> <img style="border-radius: 50%" :src="userInfo.avatarUrl" />
</nut-avatar> </nut-avatar>
</nut-button> </nut-button> </template
></nut-cell>
<view class="name">{{ userInfo.nickName }}</view>
</view>
</view>
</view>
<nut-cell-group>
<!-- :desc="userInfo.nickName" -->
<nut-cell title="昵称"> <nut-cell title="昵称">
<template v-slot:link> <template v-slot:link>
<nut-input <nut-input
type="nickname"
v-model="userInfo.nickName" v-model="userInfo.nickName"
:border="false" :border="false"
input-align="right" input-align="right"
placeholder="请输入昵称" placeholder="请输入昵称" /> </template
/> </template
></nut-cell> ></nut-cell>
<nut-cell title="手机号码"> <nut-cell title="手机号码">
<template v-slot:link> <template v-slot:link>
@@ -119,27 +82,30 @@ const subUser = async () => {
v-model="userInfo.phone" v-model="userInfo.phone"
:border="false" :border="false"
input-align="right" input-align="right"
disabled disabled />
/>
</template> </template>
</nut-cell> </nut-cell>
<nut-cell title="登录密码"> <!-- <nut-cell title="登录密码">
<template v-slot:link> <template v-slot:link>
<nut-input <nut-input
v-model="userInfo.password" v-model="userInfo.password"
:border="false" :border="false"
input-align="right" input-align="right"
placeholder="修改登录密码" placeholder="修改登录密码" />
/>
</template> </template>
</nut-cell> </nut-cell> -->
<nut-cell title="注销账号" desc="账号注销后不能恢复" is-link> </nut-cell> <!-- <nut-cell title="交易密码" desc="创建/修改交易密码" is-link> </nut-cell> -->
<!-- <nut-cell title="注销账号" desc="账号注销后不能恢复" is-link> </nut-cell> -->
</nut-cell-group> </nut-cell-group>
<view class="btn"> <view class="btn">
<nut-button block @click="subUser">保存信息</nut-button> <nut-button
</view> shape="square"
<view class="btn"> style="border-radius: 10px"
<nut-button block type="primary" @click="logOut">退出登录</nut-button> type="primary"
block
@click="subUser"
>保存信息</nut-button
>
</view> </view>
</view> </view>
</template> </template>

BIN
src/static/index/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
src/static/index/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
src/static/index/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
src/static/index/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
src/static/index/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
src/static/index/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
src/static/tabbar/1-0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

BIN
src/static/tabbar/1-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

BIN
src/static/tabbar/2-0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

BIN
src/static/tabbar/2-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/static/tabbar/3-0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

BIN
src/static/tabbar/3-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

BIN
src/static/tabbar/4-0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

BIN
src/static/tabbar/4-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,11 +1,11 @@
import { showToast, navigateBack } from "@tarojs/taro"; import Taro from '@tarojs/taro';
// 经纬度计算距离 // 经纬度计算距离
export function calculateDistance( export function calculateDistance(
la1: number, la1: number,
lo1: number, lo1: number,
la2: number, la2: number,
lo2: number lo2: number,
): any { ): any {
var radLat1 = (la1 * Math.PI) / 180.0; var radLat1 = (la1 * Math.PI) / 180.0;
var radLat2 = (la2 * Math.PI) / 180.0; var radLat2 = (la2 * Math.PI) / 180.0;
@@ -16,12 +16,12 @@ export function calculateDistance(
Math.asin( Math.asin(
Math.sqrt( Math.sqrt(
Math.pow(Math.sin(a / 2), 2) + Math.pow(Math.sin(a / 2), 2) +
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2) Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2),
) ),
); );
s = s * 6378.137; s = s * 6378.137;
s = Math.round(s * 10000) / 10000; s = Math.round(s * 10000) / 10000;
return s.toFixed(2) + "km"; return s.toFixed(2) + 'km';
} }
// 将角度转换为弧度 // 将角度转换为弧度
@@ -36,20 +36,50 @@ interface UrlParams {
bid?: string; bid?: string;
} }
export function parseQueryString(url: string) { export function parseQueryString(url: string) {
const queryString = url.split("?")[1]; const queryString = url.split('?')[1];
if (!queryString) { if (!queryString) {
return {}; return {};
} }
const keyValuePairs = queryString.split("&"); const keyValuePairs = queryString.split('&');
const result: UrlParams = {}; const result: UrlParams = {};
keyValuePairs.forEach((keyValue) => { keyValuePairs.forEach(keyValue => {
const [key, value] = keyValue.split("="); const [key, value] = keyValue.split('=');
result[key] = decodeURIComponent(value); result[key] = decodeURIComponent(value);
}); });
return result; return result;
} }
// 格式化时间
export function formatTime(time: number): string {
const date = new Date(time);
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
}
// 字符串脱敏
export function maskString(str: string, start: number, end: number): string {
const maskLength = Math.min(str.length, end) - Math.max(0, start);
const maskedPart = '*'.repeat(maskLength);
const beginning = str.slice(0, Math.max(0, start));
const endPart = str.slice(end);
return beginning + maskedPart + endPart;
}
// tips
export function showTips(msg: string) {
Taro.showToast({
title: msg,
icon: 'none',
});
}

View File

@@ -1,4 +1,4 @@
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro';
export const BASE_URL = process.env.TARO_APP_API; export const BASE_URL = process.env.TARO_APP_API;
@@ -8,15 +8,15 @@ interface Res<T> {
msg: string; msg: string;
} }
type Method = "GET" | "POST" | "PUT" | "DELETE"; type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
// 忽略系统提示白名单 // 忽略系统提示白名单
const IGNORED_TIPS = ["/user/find/phone"]; const IGNORED_TIPS = ['/user/find/phone', '/user/check/payPassword'];
const request = ( const request = (
url: string, url: string,
data: object = {}, data: object = {},
method: Method = "GET" method: Method = 'GET',
): Promise<Res<any>> => { ): Promise<Res<any>> => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
Taro.request({ Taro.request({
@@ -24,15 +24,15 @@ const request = (
data: data, data: data,
method: method, method: method,
header: { header: {
"content-type": "application/json", 'content-type': 'application/json',
token: Taro.getStorageSync("token") || "", token: Taro.getStorageSync('token') || '',
}, },
success: ({ data }) => { success: ({data}) => {
if (data.code !== 200) { if (data.code !== 200) {
if (!IGNORED_TIPS.includes(url)) { if (!IGNORED_TIPS.includes(url)) {
Taro.showToast({ Taro.showToast({
title: data.msg, title: data.msg,
icon: "none", icon: 'none',
}); });
} }
reject(data); reject(data);
@@ -40,7 +40,7 @@ const request = (
resolve(data); resolve(data);
} }
}, },
fail: (err) => { fail: err => {
reject(err); reject(err);
}, },
}); });

11
tailwind.config.js Normal file
View File

@@ -0,0 +1,11 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/pages/index.html', './src/**/*.{html,js,ts,jsx,tsx,vue}'],
theme: {
extend: {},
},
plugins: [],
corePlugins: {
preflight: process.env.TARO_ENV === 'h5',
},
};