This commit is contained in:
2023-10-08 22:53:13 +08:00
parent b883b02fb9
commit e36d60d015
83 changed files with 18303 additions and 9590 deletions

8
.env.development Normal file
View File

@@ -0,0 +1,8 @@
# 开发版appid
TARO_APP_ID='wx7b3322daa2cf9c88'
# API接口
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
# 游戏链接
TARO_APP_GAME='https://game.wanzhuanyongcheng.cn/public/#/pages/index/index?uid='

7
.env.production Normal file
View File

@@ -0,0 +1,7 @@
# 正式版版appid
TARO_APP_ID='wxdd00d46fa6f07974'
# API接口
TARO_APP_API='https://www.wanzhuanyongcheng.cn/app'
TARO_APP_GAME = 'https://www.jdt168.com/public/#/pages/index/index?uid='

8
.env.test Normal file
View File

@@ -0,0 +1,8 @@
# 开发版appid
TARO_APP_ID='wx7b3322daa2cf9c88'
# API接口
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
# 游戏链接
TARO_APP_GAME = 'https://game.wanzhuanyongcheng.cn/public/#/pages/index/index?uid='

8
components.d.ts vendored
View File

@@ -9,7 +9,9 @@ declare module '@vue/runtime-core' {
export interface GlobalComponents { export interface GlobalComponents {
Auth: typeof import('./src/components/Auth.vue')['default'] Auth: typeof import('./src/components/Auth.vue')['default']
NutAvatar: typeof import('@nutui/nutui-taro')['Avatar'] NutAvatar: typeof import('@nutui/nutui-taro')['Avatar']
NutBacktop: typeof import('@nutui/nutui-taro')['Backtop']
NutButton: typeof import('@nutui/nutui-taro')['Button'] NutButton: typeof import('@nutui/nutui-taro')['Button']
NutCalendar: typeof import('@nutui/nutui-taro')['Calendar']
NutCell: typeof import('@nutui/nutui-taro')['Cell'] NutCell: typeof import('@nutui/nutui-taro')['Cell']
NutCellGroup: typeof import('@nutui/nutui-taro')['CellGroup'] NutCellGroup: typeof import('@nutui/nutui-taro')['CellGroup']
NutCheckbox: typeof import('@nutui/nutui-taro')['Checkbox'] NutCheckbox: typeof import('@nutui/nutui-taro')['Checkbox']
@@ -20,6 +22,7 @@ declare module '@vue/runtime-core' {
NutFormItem: typeof import('@nutui/nutui-taro')['FormItem'] NutFormItem: typeof import('@nutui/nutui-taro')['FormItem']
NutGrid: typeof import('@nutui/nutui-taro')['Grid'] NutGrid: typeof import('@nutui/nutui-taro')['Grid']
NutGridItem: typeof import('@nutui/nutui-taro')['GridItem'] NutGridItem: typeof import('@nutui/nutui-taro')['GridItem']
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']
NutOverlay: typeof import('@nutui/nutui-taro')['Overlay'] NutOverlay: typeof import('@nutui/nutui-taro')['Overlay']
@@ -31,11 +34,16 @@ declare module '@vue/runtime-core' {
NutSwipe: typeof import('@nutui/nutui-taro')['Swipe'] NutSwipe: typeof import('@nutui/nutui-taro')['Swipe']
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']
NutTable: typeof import('@nutui/nutui-taro')['Table']
NutTabPane: typeof import('@nutui/nutui-taro')['TabPane'] NutTabPane: typeof import('@nutui/nutui-taro')['TabPane']
NutTabs: typeof import('@nutui/nutui-taro')['Tabs'] NutTabs: typeof import('@nutui/nutui-taro')['Tabs']
NutTextarea: typeof import('@nutui/nutui-taro')['Textarea'] NutTextarea: typeof import('@nutui/nutui-taro')['Textarea']
NutUploader: typeof import('@nutui/nutui-taro')['Uploader'] NutUploader: typeof import('@nutui/nutui-taro')['Uploader']
Pay: typeof import('./src/components/Pay.vue')['default'] Pay: typeof import('./src/components/Pay.vue')['default']
RichEditor: typeof import('./src/components/RichEditor.vue')['default']
Ucharts: typeof import('./src/components/Ucharts.vue')['default']
Upload: typeof import('./src/components/Upload.vue')['default'] Upload: typeof import('./src/components/Upload.vue')['default']
UserModal: typeof import('./src/components/UserModal.vue')['default']
} }
} }

View File

@@ -64,7 +64,7 @@ const config = {
} }
}, },
cssModules: { cssModules: {
enable: false, // 默认为 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]'

View File

@@ -10,6 +10,7 @@
}, },
"scripts": { "scripts": {
"build:weapp": "taro build --type weapp", "build:weapp": "taro build --type weapp",
"build:test": "taro build --type weapp --mode test",
"build:swan": "taro build --type swan", "build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay", "build:alipay": "taro build --type alipay",
"build:tt": "taro build --type tt", "build:tt": "taro build --type tt",
@@ -18,7 +19,7 @@
"build:qq": "taro build --type qq", "build:qq": "taro build --type qq",
"build:jd": "taro build --type jd", "build:jd": "taro build --type jd",
"build:quickapp": "taro build --type quickapp", "build:quickapp": "taro build --type quickapp",
"dev:weapp": "set NODE_ENV=production && taro build --type weapp --watch", "dev:weapp": "taro build --type weapp --watch",
"dev:swan": "npm run build:swan -- --watch", "dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch", "dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch", "dev:tt": "npm run build:tt -- --watch",
@@ -35,49 +36,50 @@
], ],
"author": "", "author": "",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.7.7", "@babel/runtime": "^7.22.15",
"@nutui/icons-vue-taro": "^0.0.9", "@nutui/icons-vue-taro": "^0.0.9",
"@nutui/nutui-taro": "^4.0.4", "@nutui/nutui-taro": "^4.1.5",
"@tarojs/components": "3.6.11", "@qiun/vue-ucharts": "2.5.0-20230101",
"@tarojs/helper": "3.6.11", "@tarojs/components": "3.6.16",
"@tarojs/plugin-framework-vue3": "3.6.11", "@tarojs/helper": "3.6.16",
"@tarojs/plugin-html": "3.6.11", "@tarojs/plugin-framework-vue3": "3.6.16",
"@tarojs/plugin-platform-alipay": "3.6.11", "@tarojs/plugin-html": "3.6.16",
"@tarojs/plugin-platform-h5": "3.6.11", "@tarojs/plugin-platform-alipay": "3.6.16",
"@tarojs/plugin-platform-jd": "3.6.11", "@tarojs/plugin-platform-h5": "3.6.16",
"@tarojs/plugin-platform-qq": "3.6.11", "@tarojs/plugin-platform-jd": "3.6.16",
"@tarojs/plugin-platform-swan": "3.6.11", "@tarojs/plugin-platform-qq": "3.6.16",
"@tarojs/plugin-platform-tt": "3.6.11", "@tarojs/plugin-platform-swan": "3.6.16",
"@tarojs/plugin-platform-weapp": "3.6.11", "@tarojs/plugin-platform-tt": "3.6.16",
"@tarojs/runtime": "3.6.11", "@tarojs/plugin-platform-weapp": "3.6.16",
"@tarojs/shared": "3.6.11", "@tarojs/runtime": "3.6.16",
"@tarojs/taro": "3.6.11", "@tarojs/shared": "3.6.16",
"@tarojs/taro": "3.6.16",
"dayjs": "^1.11.9", "dayjs": "^1.11.9",
"pinia": "^2.1.6", "pinia": "^2.1.6",
"vue": "^3.2.40" "vue": "^3.3.4"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.0", "@babel/core": "^7.22.17",
"@tarojs/cli": "3.6.11", "@tarojs/cli": "3.6.16",
"@tarojs/taro-loader": "3.6.11", "@tarojs/taro-loader": "3.6.16",
"@tarojs/webpack5-runner": "3.6.11", "@tarojs/webpack5-runner": "3.6.16",
"@types/node": "^18.15.11", "@types/node": "^18.17.15",
"@types/webpack-env": "^1.13.6", "@types/webpack-env": "^1.18.1",
"@typescript-eslint/eslint-plugin": "^6.4.0", "@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.4.0", "@typescript-eslint/parser": "^6.7.0",
"@vue/babel-plugin-jsx": "^1.0.6", "@vue/babel-plugin-jsx": "^1.1.5",
"@vue/compiler-sfc": "^3.2.40", "@vue/compiler-sfc": "^3.3.4",
"babel-preset-taro": "3.6.11", "babel-preset-taro": "3.6.16",
"css-loader": "3.4.2", "css-loader": "3.4.2",
"eslint": "^8.12.0", "eslint": "^8.49.0",
"eslint-config-taro": "3.6.11", "eslint-config-taro": "3.6.16",
"eslint-plugin-vue": "^9.17.0", "eslint-plugin-vue": "^9.17.0",
"style-loader": "1.3.0", "style-loader": "1.3.0",
"stylelint": "9.3.0", "stylelint": "9.3.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4.1.0", "typescript": "^4.9.5",
"unplugin-vue-components": "^0.23.0", "unplugin-vue-components": "^0.23.0",
"vue-loader": "^17.0.0", "vue-loader": "^17.2.2",
"webpack": "^5.78.0" "webpack": "^5.88.2"
} }
} }

19341
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,6 @@
"miniprogramRoot": "./dist", "miniprogramRoot": "./dist",
"projectname": "taroApp", "projectname": "taroApp",
"description": "", "description": "",
"appid": "wxdd00d46fa6f07974",
"setting": { "setting": {
"urlCheck": true, "urlCheck": true,
"es6": false, "es6": false,

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,6 +2,8 @@ import request from "@/utils/request";
// 登录 // 登录
export const login = (data: object) => request("/login", data, "POST"); export const login = (data: object) => request("/login", data, "POST");
export const phoneLogin = (data: object) =>
request("/phone/login", data, "POST");
// 获取用户信息 // 获取用户信息
// export const getUserInfo = () => request("/user/detail", {}, "GET"); // export const getUserInfo = () => request("/user/detail", {}, "GET");
@@ -52,4 +54,12 @@ export const getTGUserList = (data: object) =>
request("/user/referee/list", data, "POST"); request("/user/referee/list", data, "POST");
// 绑定上级 // 绑定上级
export const bindParent = (data: object) => request("/user/bindCode", data, "POST"); export const bindParent = (data: object) =>
request("/user/bindCode", data, "POST");
// 获取推广码
export const getRefereeCode = () => request("/user/promotion", {}, "POST");
// 取消订单返回积分
export const qxOrder = (data: object) =>
request("/user/point/off", data, "POST");

View File

@@ -18,6 +18,8 @@ export default defineAppConfig({
"distribution/index", "distribution/index",
"distribution/integral/index", "distribution/integral/index",
"distribution/userlist/index", "distribution/userlist/index",
"login/index",
"bindPhone/index",
], ],
}, },
{ {
@@ -30,7 +32,19 @@ export default defineAppConfig({
}, },
{ {
root: "pages/admin", root: "pages/admin",
pages: ["verify/index"], pages: [
"verify/index",
"order_manage/index",
"order_manage/list/index",
"order_manage/detail/index",
"verify/verify_list/index",
"statistics/index",
"withdrawal/index",
],
},
{
root: "pages/product",
pages: ["list/index", "addGoods/index"],
}, },
{ {
root: "pages/game", root: "pages/game",
@@ -40,6 +54,10 @@ export default defineAppConfig({
root: "pages/hotGoods", root: "pages/hotGoods",
pages: ["index/index", "hot_list/index"], pages: ["index/index", "hot_list/index"],
}, },
{
root: "pages/mer",
pages: ["mer_detail/index"],
},
], ],
window: { window: {
backgroundTextStyle: "light", backgroundTextStyle: "light",

View File

@@ -1,22 +1,28 @@
@font-face { @import "static/iconfont/iconfont.css";
font-family: AlibabaPuHuiTi-3-55-Regular;
src: url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.eot) //@font-face {
format("embedded-opentype"), // font-family: AlibabaPuHuiTi-3-55-Regular;
url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.otf) // src: url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.eot)
format("opentype"), // format("embedded-opentype"),
url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.ttf) // url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.otf)
format("TrueType"), // format("opentype"),
url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff) // url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.ttf)
format("woff"), // format("TrueType"),
url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff2) // url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff)
format("woff2"); // format("woff"),
} // url(https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-3/AlibabaPuHuiTi-3-55-Regular/AlibabaPuHuiTi-3-55-Regular.woff2)
// format("woff2");
//}
page { page {
font-family: AlibabaPuHuiTi-3-55-Regular, serif; //font-family: AlibabaPuHuiTi-3-55-Regular, sans-serif;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
view {
box-sizing: border-box;
}
.app { .app {
box-sizing: border-box; box-sizing: border-box;
background-color: #f5f5f5; background-color: #f5f5f5;
@@ -25,4 +31,4 @@ page {
// 适配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,10 +1,71 @@
import { createApp } from "vue"; import { createApp } from "vue";
import "./app.scss"; import "./app.scss";
import Taro from "@tarojs/taro";
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
const App = createApp({ const App = createApp({
onLaunch() {}, onLaunch(options: {
onShow() {}, path: string;
scene: number;
query: object | any;
shareTicket: string;
referrerInfo: object | any;
}) {
// if (scenes.includes(options.scene)) {
// if (options.query.scene) {
// Taro.showToast({
// title: "已检测到推荐人",
// icon: "none",
// });
// Taro.setStorageSync("bind_id", options.query.scene);
// }
// }
// 检测更新
if (Taro.canIUse("getUpdateManager") && options.scene !== 1154) {
const updateManager = Taro.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) {
updateManager.onUpdateFailed(function () {
return Taro.showToast({
title: "新版本下载失败",
icon: "none",
});
});
updateManager.onUpdateReady(function () {
Taro.showModal({
title: "更新提示",
content: "新版本已经下载好,是否重启当前应用?",
success(res) {
if (res.confirm) {
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function () {
Taro.showModal({
title: "发现新版本",
content: "请删除当前小程序,重启搜索打开...",
});
});
}
});
}
},
onShow() {
const options = Taro.getCurrentInstance().router as any;
console.log("onShow", options);
if (scenes.includes(options.scene)) {
if (options.query.scene) {
Taro.showToast({
title: "已检测到推荐人",
icon: "none",
});
Taro.setStorageSync("bind_id", options.query.scene);
}
}
},
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
}); });

View File

@@ -1,11 +1,10 @@
<template> <template>
<nut-overlay v-model:visible="visible" :close-on-click-overlay="false"> <nut-overlay :visible="visible" :close-on-click-overlay="false">
<view class="text"> <view class="text">
<view>授权提醒</view> <view>授权提醒</view>
<view style="margin-top: 10px" <view style="margin-top: 10px"
>请授权头像信息以便为您提供更好的服务 >请授权头像信息以便为您提供更好的服务
</view </view>
>
<view class="bom"> <view class="bom">
<view class="btn b" @click="onCancel">随便逛逛</view> <view class="btn b" @click="onCancel">随便逛逛</view>
<view class="btn a" @tap="onOk">去授权</view> <view class="btn a" @tap="onOk">去授权</view>
@@ -16,53 +15,63 @@
<script setup lang="ts"> <script setup lang="ts">
// import { computed, ref } from "vue"; // import { computed, ref } from "vue";
import Taro from '@tarojs/taro' import Taro from "@tarojs/taro";
import {login} from '@/api/user' import { login } from "@/api/user";
defineProps({ defineProps({
visible: { visible: {
type: Boolean, type: Boolean,
default: false default: false,
} },
}) });
const emit = defineEmits(['update:visible', 'ok']) const emit = defineEmits(["update:visible", "ok"]);
const onCancel = () => { const onCancel = () => {
emit('update:visible', false) emit("update:visible", false);
} };
const onOk = () => { const onOk = () => {
Taro.showLoading({
title: "正在授权中",
mask: true,
});
Taro.getUserProfile({ Taro.getUserProfile({
desc: '完善用户资料', desc: "完善用户资料",
success: async (user) => { success: async (user) => {
Taro.login({ Taro.login({
success: async ({code}) => { success: async ({ code }) => {
try { try {
const {data}: any = await login({ const { data }: any = await login({
code: code, code: code,
nickName: user.userInfo.nickName, nickName: user.userInfo.nickName,
avatarUrl: user.userInfo.avatarUrl avatarUrl: user.userInfo.avatarUrl,
}) });
Taro.setStorageSync('token', data.token) Taro.setStorageSync("token", data.token);
emit('ok', false) emit("ok", false);
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.message, title: error.message,
icon: 'none' icon: "none",
}) });
} }
}, },
fail: (err) => { fail: (err) => {
console.log(err) console.log(err);
} },
}) complete: () => {
Taro.hideLoading();
},
});
}, },
fail: (err) => { fail: (err) => {
console.log(err) console.log(err);
} },
}) complete: () => {
} Taro.hideLoading();
},
});
};
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -6,7 +6,7 @@
safe-area-inset-bottom safe-area-inset-bottom
:close-on-click-overlay="false" :close-on-click-overlay="false"
:style="{ height: 'auto' }" :style="{ height: 'auto' }"
v-model:visible="isShowPay" :visible="isShowPay"
@click-close-icon="closePay" @click-close-icon="closePay"
> >
<view class="div"> <view class="div">
@@ -46,66 +46,68 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import {ref, watch} from 'vue'
import { IconFont } from "@nutui/icons-vue-taro"; import {IconFont} from '@nutui/icons-vue-taro'
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro'
import { payOrder } from "@/api/order"; import {payOrder} from '@/api/order'
import { payJfOrder } from "@/api/goods"; import {payJfOrder} from '@/api/goods'
import { getPersonalInfo } from "@/api/user"; import {getPersonalInfo} from '@/api/user'
const prop = defineProps({ const prop = defineProps({
isShowPay: { isShowPay: {
required: true, required: true,
type: Boolean, type: Boolean,
default: false, default: false
}, },
payType: { payType: {
required: true, required: true,
type: String, type: String,
default: "wx", default: 'wx'
}, },
jfInfo: { jfInfo: {
type: Object, type: Object,
default: () => { default: () => {
return {}; return {}
}, }
}, }
}); })
const emit = defineEmits(["closePay", "successPay"]); const emit = defineEmits(['closePay', 'successPay'])
const info = ref<any>({}); const info = ref<{ integral?: any }>({})
watch( watch(
() => prop.isShowPay, () => prop.isShowPay,
() => { () => {
getInfo(); getInfo()
} }
); )
const getInfo = async () => { const getInfo = async () => {
try { try {
const res = await getPersonalInfo(); const res = await getPersonalInfo()
info.value = res.data.data; info.value = res.data.data
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none'
}); })
throw error
} }
}; }
const goPay = async () => { const goPay = async () => {
console.log(prop.jfInfo)
if (!prop.jfInfo) if (!prop.jfInfo)
return Taro.showToast({ return Taro.showToast({
title: "未获取到订单信息", title: '未获取到订单信息',
icon: "none", icon: 'none'
}); })
if (prop.payType === "wx") { if (prop.payType === 'wx') {
try { try {
const { data } = await payOrder({ const {data} = await payOrder({
oid: prop.jfInfo.oid, oid: prop.jfInfo.oid
}); })
Taro.requestPayment({ Taro.requestPayment({
timeStamp: data.data.timeStamp, timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr, nonceStr: data.data.nonceStr,
@@ -114,50 +116,51 @@ const goPay = async () => {
paySign: data.data.paySign, paySign: data.data.paySign,
success: function () { success: function () {
Taro.showToast({ Taro.showToast({
title: "支付成功", title: '支付成功',
icon: "success", icon: 'success',
duration: 2000, duration: 2000
}); })
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/hotGoods/hot_list/index", url: '/pages/hotGoods/hot_list/index'
}); })
}, },
fail: function () { fail: function () {
Taro.showToast({ Taro.showToast({
title: "支付失败", title: '支付失败',
icon: "none", icon: 'none',
duration: 2000, duration: 2000
}); })
}, }
}); })
emit("closePay", false); emit('closePay', false)
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
icon: "none", icon: 'none'
}); })
throw e
} }
} else { } else {
const res = await payJfOrder(prop.jfInfo); const res = await payJfOrder(prop.jfInfo)
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "success", icon: 'success',
duration: 2000, duration: 2000
}); })
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/users/order_list/index", url: '/pages/users/order_list/index?type=0'
}); })
emit("closePay", false); emit('closePay', false)
} }
}; }
const closePay = () => { const closePay = () => {
Taro.showToast({ Taro.showToast({
title: "取消支付", title: '取消支付',
icon: "none", icon: 'none'
}); })
emit("closePay", false); emit('closePay', false)
}; }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@@ -1,381 +1,286 @@
<template> <template>
<view class="container"> <view class="container">
<view class="page-body"> <view class="page-body">
<view class="wrapper"> <view class="wrapper">
<view <view
class="toolbar" class="toolbar"
@tap="format" @click="format"
style="max-height: 240px; overflow-y: auto" style="max-height: 240px; overflow-y: auto"
> >
<!-- 字体 --> <!-- 加粗 -->
<!-- <view <view
:class="data.formats.fontFamily ? 'ql-active' : ''" :class="data.formats.bold ? 'ql-active' : ''"
class="iconfont icon-font" class="iconfont icon-zitijiacu"
data-name="fontFamily" data-name="bold"
data-value="Pacifico" ></view>
></view> --> <!-- 斜体 -->
<!-- 加粗 --> <view
<view :class="data.formats.italic ? 'ql-active' : ''"
:class="data.formats.bold ? 'ql-active' : ''" class="iconfont icon-zitixieti"
class="iconfont icon-zitijiacu" data-name="italic"
data-name="bold" ></view>
></view> <!-- 下划线 -->
<!-- 斜体 --> <view
<view :class="data.formats.underline ? 'ql-active' : ''"
:class="data.formats.italic ? 'ql-active' : ''" class="iconfont icon-zitixiahuaxian"
class="iconfont icon-zitixieti" data-name="underline"
data-name="italic" ></view>
></view> <!-- 对齐方式 -->
<!-- 下划线 --> <view
<view :class="data.formats.align === 'left' ? 'ql-active' : ''"
:class="data.formats.underline ? 'ql-active' : ''" class="iconfont icon-zuoduiqi"
class="iconfont icon-zitixiahuaxian" data-name="align"
data-name="underline" data-value="left"
></view> ></view>
<!-- 删除中划线 --> <!-- 对齐方式居中 -->
<!-- <view <view
:class="data.formats.strike ? 'ql-active' : ''" :class="data.formats.align === 'center' ? 'ql-active' : ''"
class="iconfont icon-zitishanchuxian" class="iconfont icon-juzhongduiqi"
data-name="strike" data-name="align"
></view> --> data-value="center"
<!-- 字号 --> ></view>
<!-- <view <!-- 对齐方式 -->
:class="data.formats.fontSize === '24px' ? 'ql-active' : ''" <view
class="iconfont icon-font-size" :class="data.formats.align === 'right' ? 'ql-active' : ''"
data-name="fontSize" class="iconfont icon-youduiqi"
data-value="48px" data-name="align"
></view>--> data-value="right"
<!-- 字体颜色 --> ></view>
<!-- <view <!-- 对齐方式两侧 -->
:class="data.formats.color === '#0000ff' ? 'ql-active' : ''" <view
class="iconfont icon-font-colors" :class="data.formats.align === 'justify' ? 'ql-active' : ''"
data-name="color" class="iconfont icon-zuoyouduiqi"
data-value="#0000ff" data-name="align"
></view> --> data-value="justify"
<!-- 清除样式 --> ></view>
<!-- <view class="iconfont icon-clearformat" @tap="removeFormat"></view> --> <!-- 有序排列 -->
<!-- 对齐方式 --> <view
<view :class="data.formats.list === 'ordered' ? 'ql-active' : ''"
:class="data.formats.align === 'left' ? 'ql-active' : ''" class="iconfont icon-youxupailie"
class="iconfont icon-zuoduiqi" data-name="list"
data-name="align" data-value="ordered"
data-value="left" ></view>
></view> <!-- 无序排列 -->
<!-- 对齐方式居中 --> <view
<view :class="data.formats.list === 'bullet' ? 'ql-active' : ''"
:class="data.formats.align === 'center' ? 'ql-active' : ''" class="iconfont icon-wuxupailie"
class="iconfont icon-juzhongduiqi" data-name="list"
data-name="align" data-value="bullet"
data-value="center" ></view>
></view> <!-- 取消缩进 -->
<!-- 对齐方式 --> <view
<view class="iconfont icon-outdent"
:class="data.formats.align === 'right' ? 'ql-active' : ''" data-name="indent"
class="iconfont icon-youduiqi" data-value="-1"
data-name="align" ></view>
data-value="right" <!-- 缩进 -->
></view> <view
<!-- 对齐方式两侧 --> class="iconfont icon-indent"
<view data-name="indent"
:class="data.formats.align === 'justify' ? 'ql-active' : ''" data-value="+1"
class="iconfont icon-zuoyouduiqi" ></view>
data-name="align" <!-- 添加分割线 -->
data-value="justify" <view class="iconfont icon-fengexian" @click="insertDivider"></view>
></view> <!-- 插入图片 -->
<!-- 行高 --> <view class="iconfont icon-image" @click="insertImage"></view>
<!-- <view <!-- 设置标题 -->
:class="data.formats.lineHeight ? 'ql-active' : ''" <view
class="iconfont icon-line-height" :class="data.formats.header === 3 ? 'ql-active' : ''"
data-name="lineHeight" class="iconfont icon-H"
data-value="2" data-name="header"
></view>--> :data-value="3"
<!-- 字间距 --> ></view>
<!-- <view <!-- 下标 -->
:class="data.formats.letterSpacing ? 'ql-active' : ''" <view
class="iconfont icon-Character-Spacing" :class="data.formats.script === 'sub' ? 'ql-active' : ''"
data-name="letterSpacing" class="iconfont icon-zitixiabiao"
data-value="2em" data-name="script"
></view> --> data-value="sub"
<!-- 上边距 --> ></view>
<!-- <view <!-- 上标 -->
:class="data.formats.marginTop ? 'ql-active' : ''" <view
class="iconfont icon-duanqianju" :class="data.formats.script === 'super' ? 'ql-active' : ''"
data-name="marginTop" class="iconfont icon-zitishangbiao"
data-value="40px" data-name="script"
></view> --> data-value="super"
<!-- 下边距 --> ></view>
<!-- <view <view class="iconfont icon-undo" @click="undo"></view>
:class="data.formats.marginBottom ? 'ql-active' : ''" <view class="iconfont icon-redo" @click="redo"></view>
class="iconfont icon-duanhouju"
data-name="marginBottom"
data-value="40px"
></view> -->
<!-- 日期 -->
<!-- <view class="iconfont icon-date" @tap="insertDate"></view> -->
<!-- 勾选 -->
<!-- <view
class="iconfont icon--checklist"
data-name="list"
data-value="check"
></view> -->
<!-- 有序排列 -->
<view
:class="data.formats.list === 'ordered' ? 'ql-active' : ''"
class="iconfont icon-youxupailie"
data-name="list"
data-value="ordered"
></view>
<!-- 无序排列 -->
<view
:class="data.formats.list === 'bullet' ? 'ql-active' : ''"
class="iconfont icon-wuxupailie"
data-name="list"
data-value="bullet"
></view>
<!-- 取消缩进 -->
<view
class="iconfont icon-outdent"
data-name="indent"
data-value="-1"
></view>
<!-- 缩进 -->
<view
class="iconfont icon-indent"
data-name="indent"
data-value="+1"
></view>
<!-- 添加分割线 -->
<view class="iconfont icon-fengexian" @click="insertDivider"></view>
<!-- 插入图片 -->
<view class="iconfont icon-image" @click="insertImage"></view>
<!-- 设置标题 -->
<view
:class="data.formats.header === 3 ? 'ql-active' : ''"
class="iconfont icon-H"
data-name="header"
:data-value="3"
></view>
<!-- 下标 -->
<view
:class="data.formats.script === 'sub' ? 'ql-active' : ''"
class="iconfont icon-zitixiabiao"
data-name="script"
data-value="sub"
></view>
<!-- 上标 -->
<view
:class="data.formats.script === 'super' ? 'ql-active' : ''"
class="iconfont icon-zitishangbiao"
data-name="script"
data-value="super"
></view>
<!-- 清空 -->
<!-- <view class="iconfont icon-shanchu" @tap="clear"></view> -->
<!-- <view
:class="data.formats.direction === 'rtl' ? 'ql-active' : ''"
class="iconfont icon-direction-rtl"
data-name="direction"
data-value="rtl"
></view> -->
<view class="iconfont icon-undo" @click="undo"></view>
<view class="iconfont icon-redo" @click="redo"></view>
</view>
<view class="editor-wrapper">
<editor
id="editor"
class="ql-container"
:placeholder="data.placeholder"
@statuschange="onStatusChange"
:show-img-resize="true"
@ready="onEditorReady"
@input="getCtx"
:content="content"/>
</view>
</view>
</view> </view>
<view class="editor-wrapper">
<editor
id="editor"
class="ql-container"
:placeholder="data.placeholder"
@statuschange="onStatusChange"
:show-img-resize="true"
@ready="onEditorReady"
@input="getCtx"
/>
</view>
</view>
</view> </view>
</view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {reactive} from 'vue' import {reactive} from 'vue'
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import {BASE_URL} from '@/utils/request'
const {content} = defineProps<{ const {content} = defineProps<{
content: string; content: string;
}>() }>()
let emits = defineEmits(['input']) let emits = defineEmits(['input'])
const data = reactive<any>({ const data = reactive<any>({
editorCtx: '', editorCtx: '',
readOnly: false, readOnly: false,
placeholder: '开始输入...', placeholder: '请输入商品详情...',
richText: '', richText: '',
formats: {} formats: {}
}) })
function onEditorReady() { function onEditorReady() {
// 富文本节点渲染完成 // 富文本节点渲染完成
Taro Taro
.createSelectorQuery() .createSelectorQuery()
.select('#editor') .select('#editor')
.context((res) => { .context((res) => {
data.editorCtx = res.context data.editorCtx = res.context
// 初始化数据 // 初始化数据
if (content) { if (content) {
data.editorCtx.setContents({ data.editorCtx.setContents({
html: content html: content
}) })
} }
}) })
.exec() .exec()
} }
// 失去焦点时,获取富文本的内容 // 失去焦点时,获取富文本的内容
function getCtx(e: any) { function getCtx(e: { detail: { html: any; }; }) {
data.richText = e.detail.html data.richText = e.detail.html
emits('input', e.detail.html) emits('input', e.detail.html)
} }
// 撤销操作 // 撤销操作
function undo() { function undo() {
data.editorCtx.undo() data.editorCtx.undo()
} }
// 复原操作 // 复原操作
function redo() { function redo() {
data.editorCtx.redo() data.editorCtx.redo()
} }
//修改样式 //修改样式
function format(e) { function format(e: { target: { dataset: { name: any; value: any; }; }; }) {
// console.log("format", e.target.dataset); // console.log("format", e.target.dataset);
let {name, value} = e.target.dataset let {name, value} = e.target.dataset
if (!name) return if (!name) return
data.editorCtx.format(name, value) data.editorCtx.format(name, value)
} }
//通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式 //通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式
function onStatusChange(e) { function onStatusChange(e: { detail: any; }) {
data.formats = e.detail data.formats = e.detail
} }
// 插入分割线 // 插入分割线
function insertDivider() { function insertDivider() {
data.editorCtx.insertDivider() data.editorCtx.insertDivider()
} }
// 插入图片 // 插入图片
function insertImage() { function insertImage() {
Taro.chooseImage({ Taro.chooseImage({
count: 1, count: 1,
sizeType: ['original', 'compressed'], sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
success: (res) => {
// 上传图片的逻辑各有不同,自行调整即可
Taro.uploadFile({
url: `${BASE_URL}/upload`,
name: 'file',
header: {token: Taro.getStorageSync('token')},
filePath: res.tempFilePaths[0],
success: (res) => { success: (res) => {
// 上传图片的逻辑各有不同,自行调整即可 console.log(res)
Taro.uploadFile({ const imgData = JSON.parse(res.data) as {
url: `/system/v1/upload`, code: number;
name: 'file', msg: string;
header: {Authorization: 'token'}, data: any;
filePath: res.tempFilePaths[0], }
success: (res) => { if (imgData.code === 200) {
const imgData = JSON.parse(res.data) as { // 将图片展示在编辑器中
code: number; data.editorCtx.insertImage({
msg: string; width: '100%',
success: boolean; height: 'auto',
} src: imgData.data.data,
if (imgData.code === 200) { alt: '图像',
// 将图片展示在编辑器中 success: function () {
data.editorCtx.insertImage({ console.log('insert image success')
width: '20%', //设置宽度为100%防止宽度溢出手机屏幕 }
height: 'auto',
src: imgData.msg,
alt: '图像',
success: function () {
console.log('insert image success')
}
})
} else {
console.log('上传失败')
}
},
fail: (err) => {
console.log(err)
}
}) })
} else {
console.log('上传失败')
}
},
fail: (err) => {
console.log(err)
} }
}) })
}
})
} }
// 清空编辑器内容
// function clear() {
// data.editorCtx.clear({
// success: function (res) {
// console.log("clear success");
// },
// });
// }
// 清除当前选区的样式
// function removeFormat() {
// data.editorCtx.removeFormat();
// }
// 选择日期
// function insertDate() {
// const date = new Date();
// const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
// data.editorCtx.insertText({
// text: formatDate
// });
// }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
@import "//at.alicdn.com/t/c/font_4211210_2x20brbrv94.css"; @import "../static/font_4211210_2x20brbrv94.css";
.page-body {
// height: calc(100vh - var(--window-top) - var(--status-bar-height));
}
.wrapper { .wrapper {
height: 100%; height: 100%;
} }
.editor-wrapper { .editor-wrapper {
height: calc( height: calc(
100vh - var(--window-top) - var(--status-bar-height) - 280px - 650px 100vh - var(--window-top) - var(--status-bar-height) - 280px - 650px
); );
overflow: scroll; overflow: scroll;
background: rgba(153, 153, 153, 0.05); background: rgba(153, 153, 153, 0.05);
border-radius: 20px; border-radius: 20px;
margin: 20px 0; margin: 20px 0;
color: #000;
} }
.iconfont { .iconfont {
display: inline-block; display: inline-block;
margin: 20px 20px; margin: 20px 20px;
width: 32px; width: 32px;
height: 32px; height: 32px;
cursor: pointer; cursor: pointer;
font-size: 32px; font-size: 32px;
} }
.toolbar { .toolbar {
box-sizing: border-box; box-sizing: border-box;
border-bottom: 0; border-bottom: 0;
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
} }
.ql-container { .ql-container {
box-sizing: border-box; box-sizing: border-box;
padding: 24px 30px; padding: 24px 30px;
width: 100%; width: 100%;
min-height: 30vh; min-height: 30vh;
height: 100%; height: 100%;
font-size: 28px; font-size: 28px;
line-height: 1.5; line-height: 1.5;
} }
.ql-active { .ql-active {
color: #f38e48; color: #f38e48;
} }
</style> </style>

178
src/components/Ucharts.vue Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,6 @@
<script setup lang="ts"> <script setup lang="ts">
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import { orderVerify, activeOrderVerify } from "@/api/admin";
// url参数转对象 // url参数转对象
// const urlParse = (url: string) => { // const urlParse = (url: string) => {
@@ -35,20 +34,8 @@ const scanCode = () => {
success: async (res) => { success: async (res) => {
try { try {
const mer_type = JSON.parse(Taro.getStorageSync("mer_type")); const mer_type = JSON.parse(Taro.getStorageSync("mer_type"));
let data; Taro.navigateTo({
if (mer_type === 1) { url: `/pages/admin/verify/verify_list/index?oid=${res.result}&mer_type=${mer_type}`,
data = await activeOrderVerify({
oid: res.result,
});
} else {
data = await orderVerify({
oid: res.result,
});
}
Taro.showToast({
title: data.msg,
icon: "none",
}); });
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({

View File

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

View File

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

View File

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

View File

@@ -1,15 +1,197 @@
<script lang="ts"> <script lang="ts" setup>
import {defineComponent} from 'vue' import {ref, h} from 'vue'
import Taro from '@tarojs/taro'
import {getWithdrawList, addWithdraw} from '@/api/admin'
export default defineComponent({ const user_info = Taro.getStorageSync('userInfo')
name: "index"
const row = ref(0)
const basicData = ref({
num: ''
}) })
const showPreview = ref(false)
const imgData = ref([{
src: ''
}])
const columns = ref([
{
title: '时间',
key: 'add_time',
align: 'center'
}, {
title: '提现金额',
key: 'integral',
align: 'center',
render: (row: { integral: number; }) => {
return h('view', {}, row.integral / 100)
}
},
{
title: '审核状态',
key: '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({
page: 1,
itemsPerPage: 5,
showPageSize: 5,
totalItems: 0,
change: (page: number) => {
pagination.value.page = page
getData()
}
})
const hideFn = () => {
showPreview.value = false
}
Taro.useLoad(() => {
getData()
})
const getData = async () => {
try {
const res = await getWithdrawList({
PageNum: pagination.value.page,
PageSize: pagination.value.showPageSize,
Bid: user_info.bid
})
data.value = res.data.data || []
pagination.value.totalItems = res.data.total
row.value = res.data.integral || 0
console.log(res)
} catch (e) {
throw e
}
}
const add = async () => {
try {
if (Number(basicData.value.num) === 0) return Taro.showToast({
title: '提现积分需大于0',
icon: 'none'
})
const res = await addWithdraw({
Bid: user_info.bid,
Number: Number(basicData.value.num)
})
Taro.showToast({
title: res.msg,
icon: 'none'
})
await getData()
} catch (e) {
throw e
}
}
</script> </script>
<template> <template>
$END$ <view>
<nut-form>
<nut-form-item label="提现积分:">
<nut-input v-model="basicData.num" class="nut-input-text" placeholder="请输入提现积分" type="text"/>
</nut-form-item>
<nut-form-item>
<view>
当前可提现积分
<text class="text-red">{{ row }}</text>
</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>
<nut-empty v-else description="暂无提现记录"></nut-empty>
<!-- 图片预览 -->
<nut-image-preview :show="showPreview" :images="imgData" @close="hideFn"/>
</view>
</template> </template>
<style scoped lang="scss"> <style lang="scss">
.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 {
background-color: #4fc08d;
}
.danger {
background-color: #df3526;
}
.warning {
background-color: #f3812e;
}
.image {
width: 50px;
height: 50px;
}
</style> </style>

View File

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

View File

@@ -6,59 +6,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { useLoad } from "@tarojs/taro"; import { useLoad, getStorageSync } from "@tarojs/taro";
// const listVal = ref<any>([]);
const url = ref(""); const url = ref("");
useLoad((options) => { useLoad(() => {
console.log(options); const user = getStorageSync("userInfo");
// getList(); url.value = `${process.env.TARO_APP_GAME}${user.uid}`;
url.value = `https://www.jdt168.com/public/#/pages/index/index?uid=${options.uid}`;
console.log(url.value);
}); });
// const getList = () => {
// for (let i = 0; i < 1; i++) {
// setTimeout(() => {
// listVal.value.push({
// id: i,
// status: true,
// });
// }, 50 * i);
// }
// };
// const toDetails = (id: string) => {
// navigateTo({
// url: "/pages/game/gamedetail/index?id=" + id,
// });
// };
</script> </script>
<style lang="scss"> <style lang="scss"></style>
.list-box {
background-color: #fff;
border-radius: 15rpx;
width: 630rpx;
height: 200rpx;
margin: 20rpx auto;
padding: 30rpx;
font-size: 45rpx;
}
.listBoxAnim {
animation: 0.5s leftAnim;
}
@keyframes leftAnim {
from {
transform: translateX(110%);
}
to {
transform: translateX(0);
}
}
</style>

View File

@@ -12,9 +12,10 @@ import { WebView } from "@tarojs/components";
const gameUrl = ref(""); const gameUrl = ref("");
const user = getStorageSync("userInfo"); const user = ref({})
useLoad(() => { useLoad(() => {
user.value = getStorageSync("userInfo");
console.log(user); console.log(user);
}); });
</script> </script>

View File

@@ -27,8 +27,8 @@
:symbol="payType === 'jf' ? '积分' : '元'" :symbol="payType === 'jf' ? '积分' : '元'"
/> />
</view> </view>
<view class="title">{{ goodInfo.name }} </view> <view class="title">{{ goodInfo.name }}</view>
<view class="sub">{{ goodInfo.profile }} </view> <view class="sub">{{ goodInfo.profile }}</view>
</view> </view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell> <nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
<!-- 产品介绍 --> <!-- 产品介绍 -->
@@ -40,7 +40,6 @@
: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>
<!-- 底部 --> <!-- 底部 -->
@@ -50,33 +49,30 @@
<Home /> <Home />
<view>首页</view> <view>首页</view>
</view> </view>
<view <!-- <view-->
class="icon" <!-- class="icon"-->
v-if="payType === 'jf'" <!-- v-if="payType === 'jf'"-->
@click="toPage('/pages/cart/index')" <!-- @click="toPage('/pages/cart/index')"-->
> <!-- >-->
<Cart /> <!-- <Cart/>-->
<view>购物车</view> <!-- <view>购物车</view>-->
</view> <!-- </view>-->
<view class="icon" @click="toPage('/pages/kefu/index', 2)"> <view class="icon" @click="toPage('/pages/kefu/index', 2)">
<My /> <My />
<view>客服</view> <view>客服</view>
</view> </view>
</view> </view>
<!-- 占位 --> <!-- 占位 -->
<view> <view style="width: 80%">
<nut-button <!-- <nut-button-->
v-if="payType === 'jf'" <!-- v-if="payType === 'jf'"-->
style="margin-right: 10px" <!-- style="margin-right: 10px"-->
type="warning" <!-- type="warning"-->
@click="add_cart()" <!-- @click="add_cart()"-->
>加入购物车 <!-- >加入购物车-->
</nut-button> <!-- </nut-button>-->
<nut-button <nut-button type="primary" block @click="toOrderDetail()"
:style="payType === 'wx' ? 'width: 200px' : ''"
type="primary"
@click="toOrderDetail()"
>{{ payType === "jf" ? "立即兑换" : "立即购买" }} >{{ payType === "jf" ? "立即兑换" : "立即购买" }}
</nut-button> </nut-button>
</view> </view>
@@ -99,6 +95,7 @@
<nut-input-number <nut-input-number
v-model="count" v-model="count"
@change="addCount" @change="addCount"
button-size="30"
/> />
</template> </template>
</nut-cell> </nut-cell>
@@ -126,11 +123,16 @@
var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight; var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
import { ref } from "vue"; import { ref } from "vue";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import { Left, Home, Cart, My } from "@nutui/icons-vue-taro"; import {
Left,
Home,
// Cart,
My,
} from "@nutui/icons-vue-taro";
import { import {
getGoodsDetail, getGoodsDetail,
getActiveGoodsDetail, getActiveGoodsDetail,
addCart, // addCart,
createOrder, createOrder,
createActiveOrder, createActiveOrder,
} from "@/api/goods"; } from "@/api/goods";
@@ -178,11 +180,12 @@ const get_good_detail = async (gid: string) => {
} else { } else {
res = await getActiveGoodsDetail({ gid: gid }); res = await getActiveGoodsDetail({ gid: gid });
} }
goodInfo.value = res.data.data; goodInfo.value = {
...res.data.data,
// details: res.data.data.details.,
};
swiperList.value = res.data.data.rotation.split(","); swiperList.value = res.data.data.rotation.split(",");
console.log(goodInfo.value);
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
@@ -221,25 +224,40 @@ const openSku = () => {
// const selectSku = () => {}; // const selectSku = () => {};
// const clickBtnOperate = () => {}; // const clickBtnOperate = () => {};
// const close = () => {}; // const close = () => {};
const add_cart = async () => { // const add_cart = async () => {
if (isSkuShow.value === false) return openSku(); // if (isSkuShow.value === false) return openSku();
try { // try {
await addCart({ gid: goodInfo.value.gid }); // await addCart({ gid: goodInfo.value.gid });
Taro.showToast({ // Taro.showToast({
title: "加入购物车成功", // title: "加入购物车成功",
icon: "success", // icon: "success",
duration: 2000, // duration: 2000,
}); // });
} catch (e) { // } catch (e) {
Taro.showToast({ // Taro.showToast({
title: e.msg, // title: e.msg,
icon: "none", // icon: "none",
}); // });
} // }
isSkuShow.value = false; // isSkuShow.value = false;
}; // };
const toOrderDetail = async () => { const toOrderDetail = async () => {
if (!Taro.getStorageSync("token")) {
return Taro.showModal({
title: "提示",
content: "你还没登录,请先登录",
cancelText: "先逛逛",
confirmText: "去登录",
success: (res) => {
if (res.confirm) {
Taro.reLaunch({
url: "/pages/users/login/index",
});
}
},
});
}
if (isSkuShow.value === false) return openSku(); if (isSkuShow.value === false) return openSku();
// Taro.navigateTo({ // Taro.navigateTo({
// url: '/pages/goods/order_create/index' // url: '/pages/goods/order_create/index'
@@ -260,7 +278,7 @@ const toOrderDetail = async () => {
}); });
} }
orderData.value = res.data.data; orderData.value = res?.data?.data;
isShowPay.value = true; isShowPay.value = true;
@@ -298,6 +316,12 @@ const toPage = (url: string, type: number = 1) => {
</script> </script>
<style lang="scss"> <style lang="scss">
page {
--nut-cell-box-shadow: none;
// --nut-cell-padding: 0;
--nut-cell-title-font: 30px;
}
// sku遮罩 // sku遮罩
.overlay { .overlay {
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
@@ -311,12 +335,7 @@ const toPage = (url: string, type: number = 1) => {
position: fixed; position: fixed;
left: 30px; left: 30px;
top: 0; top: 0;
/* #ifdef MP */
// height: 43px;
/* #endif */
/* #ifdef H5 */
height: 114px; height: 114px;
/* #endif */
} }
.head-menu { .head-menu {
@@ -337,7 +356,7 @@ const toPage = (url: string, type: number = 1) => {
.nut-swiper-item img { .nut-swiper-item img {
width: 100%; width: 100%;
height: 550px; height: 730px;
} }
.card { .card {
@@ -371,13 +390,12 @@ const toPage = (url: string, type: number = 1) => {
} }
.rich { .rich {
box-sizing: border-box; width: 100%;
// &[img] {
// max-width: 100%;
// }
// &[alt] { // img {
// max-width: 100%; // width: 100%;
// height: auto;
// display: block;
// } // }
} }
} }
@@ -395,8 +413,9 @@ const toPage = (url: string, type: number = 1) => {
.bottom-box { .bottom-box {
border-top: 1px solid #e5e5e585; border-top: 1px solid #e5e5e585;
position: fixed; position: fixed;
box-sizing: border-box;
bottom: 0; bottom: 0;
height: 5.5vh; height: 150rpx;
background: #fff; background: #fff;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -405,7 +424,7 @@ const toPage = (url: string, type: number = 1) => {
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);
z-index: 999; z-index: 999;
width: 100vw; width: 100%;
.left { .left {
display: flex; display: flex;

View File

@@ -46,6 +46,7 @@ const tabsList = ref([
const jfInfo = ref({}); const jfInfo = ref({});
interface OrderList { interface OrderList {
oid: string;
add_time: string; add_time: string;
status: number; status: number;
BindGoods: { BindGoods: {
@@ -222,7 +223,7 @@ const delOrder = async (oid: string) => {
<view class="title">{{ item.BindGoods.name }} </view> <view class="title">{{ item.BindGoods.name }} </view>
<view class="right"> <view class="right">
<view>{{ item.number }}</view> <view>{{ item.number }}</view>
<view>x{{ item.count }}</view> <!-- <view>x{{ item.count }}</view> -->
</view> </view>
</view> </view>
<!-- <view <!-- <view

View File

@@ -20,7 +20,7 @@
</view> </view>
</view> </view>
<!-- 商品列表 --> <!-- 商品列表 -->
<view class="goodBox"> <!-- <view class="goodBox">
<view <view
class="good" class="good"
v-for="item in list" v-for="item in list"
@@ -41,37 +41,97 @@
</view> </view>
</view> </view>
</view> </view>
</view> -->
<view class="goodBox">
<view
class="good"
v-for="item in (merdata as any)"
:key="item.ID"
@click.stop="toMerDetails(item)"
>
<image :src="(item.head_photo as string)" />
<view class="good-text-box">
<text class="good-text">{{ item.name }}</text>
<text style="color: #999"
>距离我{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(item.lat),
Number(item.lon)
)
}}</text
>
</view>
</view>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import { useLoad, navigateTo } from "@tarojs/taro"; import Taro from "@tarojs/taro";
import { getActiveGoods } from "../../../api/goods"; import {
// getActiveGoods,
getMerList,
} from "../../../api/goods";
import { IconFont } from "@nutui/icons-vue-taro"; import { IconFont } from "@nutui/icons-vue-taro";
import { calculateDistance } from "@/utils";
const list = ref<any>([]); // const list = ref<any>([]);
useLoad(() => { Taro.useLoad(() => {
getList(); // getList();
get_mer_list();
}); });
const getList = async () => { // const getList = async () => {
const res = await getActiveGoods(); // const res = await getActiveGoods();
console.log(res); // console.log(res);
list.value = res.data.data; // list.value = res.data.data;
}; // };
const toGoodDetails = (id: number) => { // const toGoodDetails = (id: number) => {
navigateTo({ // Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${id}&type=1`, // url: `/pages/goods/goods_detail/index?gid=${id}&type=1`,
// });
// };
const hotGoodsDetail = () => {
Taro.navigateTo({
url: `/pages/hotGoods/hot_list/index`,
}); });
}; };
const hotGoodsDetail = () => { const merdata = ref([]);
navigateTo({
url: `/pages/hotGoods/hot_list/index`, const userLocalNum = ref({
l: 0,
t: 0,
});
const get_mer_list = async () => {
Taro.getLocation({
type: "wgs84",
success: (res) => {
userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude;
},
});
const res = await getMerList({
PageNum: 1,
PageSize: 10,
Btype: 1,
classid: 0,
});
merdata.value = res.data.data;
};
const toMerDetails = (item: any) => {
Taro.setStorageSync("mer_info", item);
Taro.navigateTo({
url: `/pages/mer/mer_detail/index`,
}); });
}; };
</script> </script>

View File

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

View File

@@ -30,9 +30,9 @@
</nut-grid> </nut-grid>
</view> </view>
<!-- 标题 --> <!-- 标题 -->
<view class="titleImg">为你推荐</view> <!-- <view class="titleImg">为你推荐</view> -->
<!-- 商品列表 --> <!-- 商品列表 -->
<view class="goodBox"> <!-- <view class="goodBox">
<view <view
class="good" class="good"
v-for="item in list" v-for="item in list"
@@ -41,23 +41,68 @@
> >
<image :src="(item.cover as string)" /> <image :src="(item.cover as string)" />
<view class="good-text-box"> <view class="good-text-box">
<text class="good-text">{{ item.name }} </text> <text class="good-text">{{ item.name }}</text>
<view class="good-price-box"> <view class="good-price-box">
<text class="good-text-price"> <text class="good-text-price">
<text style="font-size: 20px">{{ <text style="font-size: 20px"
item.number >{{ item.number }}
}}</text> </text>
积分 积分
</text> </text>
<!-- <Cart <Cart
size="20" size="20"
color="#ff0000" color="#ff0000"
@click.stop="add_cart(item.gid as number)" @click.stop="add_cart(item.gid as number)"
/> --> />
</view> </view>
</view> </view>
</view> </view>
</view> -->
<view class="goodBox">
<view
class="good"
v-for="item in (merdata as any)"
:key="item.ID"
@click.stop="toMerDetails(item)"
>
<image :src="(item.head_photo as string)" />
<view class="good-text-box">
<text class="good-text">{{ item.name }}</text>
<text style="color: #999"
>距离我{{
calculateDistance(
userLocalNum.t,
userLocalNum.l,
Number(item.lat),
Number(item.lon)
)
}}</text
>
</view>
</view>
</view> </view>
<!-- 商家列表 -->
<!-- <view class="merBox">
<view class="item" v-for="item in merdata" :key="item.ID">
<view class="left">
<image
class="img"
src="//www.wanzhuanyongcheng.cn/static/bdae68d9512fecacf744eea61f92e71.jpg"
></image>
</view>
<view class="right">
<view class="title">{{ item.name }}</view>
<view class="tag">
<view class="left">
<text>喷射</text>
<text>汉堡</text>
<text>炸鸡</text>
</view>
<view class="right">距我900m</view>
</view>
</view>
</view>
</view> -->
</view> </view>
</template> </template>
@@ -65,8 +110,12 @@
import { ref } from "vue"; import { ref } from "vue";
// import { Cart } from "@nutui/icons-vue-taro"; // import { Cart } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import { getBanner } from "@/api/user"; import { getBanner, bindParent } from "@/api/user";
import { getGoodsList, addCart } from "@/api/goods"; import {
// getGoodsList,
getMerList,
} from "@/api/goods";
import { calculateDistance } from "@/utils";
const searchValue = ref(""); const searchValue = ref("");
// const tabvalue = ref("0"); // const tabvalue = ref("0");
@@ -100,23 +149,71 @@ const userMenuList = ref([
}, },
]); ]);
interface List { // interface List {
gid?: number; // gid?: number;
name?: string; // name?: string;
number?: number; // number?: number;
cover?: string; // cover?: string;
} // }
const list = ref<Array<List>>([]); // const list = ref<Array<List>>([]);
Taro.useLoad(() => { Taro.useDidShow(async () => {
getBannerList(); getBannerList();
get_goods_list(); // get_goods_list();
get_mer_list();
if (Taro.getStorageSync("token") && Taro.getStorageSync("bind_id")) {
try {
const res = await bindParent({
uid: Taro.getStorageSync("bind_id"),
});
Taro.showToast({
title: res.msg,
});
Taro.removeStorageSync("bind_id");
} catch (error) {
Taro.removeStorageSync("bind_id");
throw error;
}
}
}); });
const get_goods_list = async () => { Taro.useShareAppMessage(() => ({
const { data } = await getGoodsList(); title: "捷兑通",
list.value = data.data; path: `/pages/index/index?scene=${Taro.getStorageSync("token")}`,
imageUrl:
"https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg",
}));
// const get_goods_list = async () => {
// const { data } = await getGoodsList();
// list.value = data.data;
// };
const merdata = ref([]);
const userLocalNum = ref({
l: 0,
t: 0,
});
const get_mer_list = async () => {
Taro.getLocation({
type: "wgs84",
success: (res) => {
userLocalNum.value.l = res.longitude;
userLocalNum.value.t = res.latitude;
},
});
const res = await getMerList({
PageNum: 1,
PageSize: 10,
Btype: 2,
classid: 0,
});
merdata.value = res.data.data;
console.log(res);
}; };
const getBannerList = async () => { const getBannerList = async () => {
@@ -146,19 +243,21 @@ const toPage = (url: string) => {
}); });
}; };
const toGoodDetails = (gid: number) => { // const toGoodDetails = (gid: number) => {
// Taro.navigateTo({
// url: `/pages/goods/goods_detail/index?gid=${gid}`,
// });
// };
const toMerDetails = (item: any) => {
Taro.setStorageSync("mer_info", item);
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/goods/goods_detail/index?gid=${gid}`, url: `/pages/mer/mer_detail/index`,
}); });
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.app {
box-sizing: border-box;
background-color: #f5f5f5;
}
.nut-swiper-item img { .nut-swiper-item img {
width: 100%; width: 100%;
height: 350px; height: 350px;
@@ -198,12 +297,13 @@ const toGoodDetails = (gid: number) => {
width: 340px; width: 340px;
background-color: #fff; background-color: #fff;
margin-bottom: 20px; margin-bottom: 20px;
border-bottom-left-radius: 15px; border-radius: 10px;
border-bottom-right-radius: 15px;
image { image {
width: 100%; width: 100%;
height: 350px; height: 250px;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
} }
.good-text-box { .good-text-box {
@@ -216,7 +316,7 @@ const toGoodDetails = (gid: number) => {
font-weight: 400; font-weight: 400;
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
-webkit-line-clamp: 2; -webkit-line-clamp: 1;
overflow: hidden; overflow: hidden;
word-break: break-word; word-break: break-word;
} }
@@ -239,4 +339,60 @@ const toGoodDetails = (gid: number) => {
} }
} }
} }
.merBox {
padding: 10px;
.item {
display: flex;
// align-items: center;
background-color: #fff;
border-radius: 20px;
padding: 20px;
margin-bottom: 10px;
.left {
.img {
width: 150px;
height: 150px;
border-radius: 10px;
}
}
.right {
flex: 1;
margin-left: 15px;
border-bottom: 2px solid #f5f5f5;
.title {
width: 100%;
font-weight: bold;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
.tag {
margin: 10px 0;
color: #999;
width: 100%;
display: flex;
justify-content: space-evenly;
.left {
display: flex;
width: 50%;
text {
margin-right: 10px;
}
}
.right {
flex: 1;
text-align: right;
}
}
}
}
}
</style> </style>

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,418 +1,477 @@
<template> <template>
<view class="app"> <view class="app">
<view
class="user-center-card__header__transparent"
v-if="isLogin"
:style="{ width: isLogin ? '100%' : '70%' }"
>
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img :src="userInfo.avatarUrl"/>
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view <view
class="user-center-card__header__transparent" class="user-center-card__header__info__name"
v-if="isLogin" @click="toPage('/pages/users/user_setting/index')"
:style="{ width: isLogin ? '100%' : '70%' }" >{{ userInfo.nickName }}
</view
> >
<view class="user-center-card__header__avatar"> <view v-if="!userInfo.phone">
<nut-avatar size="large"> <nut-button
<img :src="userInfo.avatarUrl" /> size="mini"
</nut-avatar> open-type="getPhoneNumber"
</view> @getphonenumber="getphonenumber"
<view class="user-center-card__header__info"> >点击绑定手机号
<view class="user-center-card__header__info__name">{{ </nut-button>
userInfo.nickName
}}</view>
<view v-if="!userInfo.phone">
<nut-button
size="mini"
open-type="getPhoneNumber"
@getphonenumber="getphonenumber"
>点击绑定手机号
</nut-button>
</view>
</view>
<view class="rightIcon">
<Scan style="margin-right: 20px" @click="scanCode" size="22" />
<Setting
style="margin-right: 20px"
@click="toSetting"
size="22"
/>
</view>
</view> </view>
<view v-else class="user-center-card__header__transparent"> </view>
<view class="user-center-card__header__avatar"> <view class="rightIcon">
<nut-avatar size="large"> <Scan style="margin-right: 20px" @click="scanCode" size="22"/>
<img <Setting
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png" style="margin-right: 20px"
/> @click="toSetting"
</nut-avatar> size="22"
</view>
<view class="user-center-card__header__info">
<view
class="user-center-card__header__info__name"
@tap="clickLogin"
>点击立即授权
</view>
</view>
</view>
<view class="container">
<!--我的订单-->
<view class="cell-card">
<view class="top">
<view>我的订单</view>
<view class="sub" @click="toOrderList(0)">
<view>全部订单</view>
<ArrowRight />
</view>
</view>
<view class="center">
<view class="center-t" @click="toOrderList(1)">
<!-- <Order size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
size="40"
/>
<view class="center-text">待付款</view>
</view>
<view class="center-t" @click="toOrderList(2)">
<!-- <Clock size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
size="40"
/>
<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 class="user-center">
<view>我的服务</view>
<view class="box">
<view
class="box-mini"
v-if="isLogin"
v-for="item in userMenuList"
:key="item.id"
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view>
</view>
</view>
</view>
<!-- 商家管理 -->
<view class="mer-box" v-if="userInfo.bid">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
:border="false"
text="订单核销"
@click="toPage('/pages/admin/verify/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<!-- <nut-grid-item text="订单统计">
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item> -->
</nut-grid>
</view>
<!-- 版权 -->
<!--<view class="copy">© 2023 </view>-->
</view>
<!-- 登录 -->
<Auth
:visible="isShowLogin"
@update:visible="cancelLogin"
@ok="getUserInfo"
/> />
</view>
</view> </view>
<view v-else class="user-center-card__header__transparent">
<view class="user-center-card__header__avatar">
<nut-avatar size="large">
<img
src="https://img12.360buyimg.com/imagetools/jfs/t1/196430/38/8105/14329/60c806a4Ed506298a/e6de9fb7b8490f38.png"
/>
</nut-avatar>
</view>
<view class="user-center-card__header__info">
<view
class="user-center-card__header__info__name"
@click="clickLogin"
>点击立即登录
</view>
</view>
</view>
<view class="container">
<!--我的订单-->
<view class="cell-card">
<view class="top">
<view>我的订单</view>
<view class="sub" @click="toOrderList(0)">
<view>全部订单</view>
<ArrowRight/>
</view>
</view>
<view class="center">
<view class="center-t" @click="toOrderList(1)">
<!-- <Order size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/131eda0add8662808d97ffb1191d19bf3e420647.png"
size="40"
/>
<view class="center-text">待付款</view>
</view>
<view class="center-t" @click="toOrderList(2)">
<!-- <Clock size="25px"/> -->
<IconFont
name="http://article.biliimg.com/bfs/article/002434c9ed4774cb732517eb27e0ff547a41c606.png"
size="40"
/>
<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 class="user-center">
<view>我的服务</view>
<view class="box">
<view
class="box-mini"
v-if="isLogin"
v-for="item in userMenuList"
:key="item.id"
@click="toPage(item.url)"
>
<!-- <image :src="item.icon" /> -->
<IconFont size="40" :name="item.icon"></IconFont>
<view class="label">{{ item.label }}</view>
</view>
<button v-if="isLogin" class="box-mini" open-type='contact'>
<IconFont size="40"
name="http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png"></IconFont>
<text class="label">联系客服</text>
</button>
</view>
</view>
<!-- 商家管理 -->
<view class="mer-box" v-if="userInfo.bid">
<nut-grid :gutter="10" :border="false">
<nut-grid-item
:border="false"
text="订单核销"
@click="toPage('/pages/admin/verify/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<nut-grid-item
text="订单统计"
@click="toPage('/pages/admin/order_manage/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<nut-grid-item
text="收益提现"
@click="toPage('/pages/admin/withdrawal/index')"
>
<IconFont
size="50"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
></IconFont>
</nut-grid-item>
<!-- <nut-grid-item-->
<!-- text="商品管理"-->
<!-- @click="toPage('/pages/product/list/index')"-->
<!-- >-->
<!-- <IconFont-->
<!-- size="50"-->
<!-- name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"-->
<!-- ></IconFont>-->
<!-- </nut-grid-item>-->
</nut-grid>
</view>
<!-- 版权 -->
<!-- <view class="copy">© 2023 </view>-->
</view>
<!-- 登录 -->
<Auth
:visible="isShowLogin"
@update:visible="cancelLogin"
@ok="getUserInfo"
/>
</view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import {ref} from 'vue'
import { ArrowRight, Setting, IconFont, Scan } from "@nutui/icons-vue-taro"; import {ArrowRight, Setting, IconFont, Scan} from '@nutui/icons-vue-taro'
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro'
import Auth from "@/components/Auth.vue"; import Auth from '@/components/Auth.vue'
import { getPersonalInfo, getPhone, bindParent } from "@/api/user"; import {getPersonalInfo, getPhone, bindParent} from '@/api/user'
const isShowLogin = ref(false); const isShowLogin = ref(false)
const isLogin = ref(false); const isLogin = ref(false)
interface UserInfo { interface UserInfo {
nickName?: string; nickName?: string;
avatarUrl?: string; avatarUrl?: string;
ID?: string; ID?: string;
bid?: string; bid?: string;
phone?: string; phone?: string;
uid?: string; uid?: string;
} }
const userInfo = ref<UserInfo>({}); const userInfo = ref<UserInfo>({})
Taro.useDidShow(() => { Taro.useDidShow(() => {
const token = Taro.getStorageSync("token"); const token = Taro.getStorageSync('token')
if (token) { if (token) {
getUserInfo(); getUserInfo()
} }
}); })
const cancelLogin = () => { const cancelLogin = () => {
isShowLogin.value = false; isShowLogin.value = false
}; }
const getUserInfo = async () => { const getUserInfo = async () => {
Taro.showLoading({ Taro.showLoading({
title: "加载中", title: '加载中'
}); })
const res = await getPersonalInfo(); const res = await getPersonalInfo()
userInfo.value = res.data.data; userInfo.value = res.data.data
Taro.setStorageSync("userInfo", res.data.data); Taro.setStorageSync('userInfo', res.data.data)
Taro.setStorageSync("mer_type", res.data.store_type); Taro.setStorageSync('mer_type', res.data.store_type)
isLogin.value = true; isLogin.value = true
cancelLogin(); cancelLogin()
Taro.hideLoading(); Taro.hideLoading()
}; }
const getphonenumber = async (e: any) => { const getphonenumber = async (e: any) => {
await getPhone({ await getPhone({
uid: userInfo.value.uid, uid: userInfo.value.uid,
code: e.detail.code, code: e.detail.code
}); })
getUserInfo(); await getUserInfo()
}; }
const toOrderList = (e: number) => { const toOrderList = (e: number) => {
if (!isLogin) if (!isLogin)
return Taro.showToast({ return Taro.showToast({
title: "请先登录", title: '请先登录',
icon: "none", icon: 'none'
}); })
Taro.navigateTo({ Taro.navigateTo({
url: `/pages/users/order_list/index?type=${e}`, url: `/pages/users/order_list/index?type=${e}`
}); })
}; }
const userMenuList = ref([ const userMenuList = ref([
{ {
id: 1, id: 1,
label: "我的账户", label: '我的账户',
url: "/pages/users/account/index", url: '/pages/users/account/index',
icon: "http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png", icon: 'http://jdt168.com/uploads/default/20220829/e819815623276fdbb9a54d685292e5c7.png'
}, },
// { // {
// id: 2, // id: 2,
// label: "商家入驻", // label: "商家入驻",
// url: "/pages/users/account/index", // url: "/pages/users/account/index",
// icon: "http://jdt168.com/uploads/default/20220829/583fd6cbd729b24eab9c3cae20ae694d.png", // icon: "http://jdt168.com/uploads/default/20220829/583fd6cbd729b24eab9c3cae20ae694d.png",
// }, // },
{ {
id: 3, id: 3,
label: "我的推广", label: '我的推广',
url: "/pages/users/distribution/index", url: '/pages/users/distribution/index',
icon: "http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png", icon: 'http://jdt168.com/uploads/default/20220829/73656833c1d849c050638f9ee9903b9d.png'
}, },
{ {
id: 4, id: 4,
label: "关注商家", label: '关注商家',
url: "", url: '',
icon: "http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png", icon: 'http://jdt168.com/uploads/default/20220829/13637589cd20785aa21fca1d4f9b26bc.png'
}, }
{ // {
id: 5, // id: 5,
label: "问题反馈", // label: '联系客服',
url: "", // url: '',
icon: "http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png", // icon: 'http://jdt168.com/uploads/default/20220829/7437d90fdd0fba868084bd9cd0b59049.png'
}, // }
]); ])
const toSetting = () => { const toSetting = () => {
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/users/setting/index", url: '/pages/users/setting/index'
}); })
}; }
const clickLogin = () => { const clickLogin = () => {
isShowLogin.value = true; // isShowLogin.value = true
}; Taro.redirectTo({
url: '/pages/users/login/index'
})
}
const toPage = (url: string) => { const toPage = (url: string) => {
Taro.navigateTo({ Taro.navigateTo({
url: url, url: url
}); })
}; }
const scanCode = () => { const scanCode = () => {
Taro.scanCode({ Taro.scanCode({
onlyFromCamera: true, onlyFromCamera: true,
scanType: ["qrCode"], scanType: ['qrCode'],
success: async (data) => { success: async (data) => {
try { try {
await bindParent({ await bindParent({
uid: data.result, uid: data.result
}); })
Taro.showToast({ Taro.showToast({
title: "绑定成功", title: '绑定成功',
icon: "none", icon: 'none'
}); })
} catch (error) { } catch (error) {
Taro.showToast({ Taro.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none'
}); })
} }
}, }
}); })
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
.app { .app {
box-sizing: border-box; box-sizing: border-box;
background-color: #f5f5f5; background-color: #f5f5f5;
height: 100vh; height: 100vh;
background-image: url("https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png"); background-image: url("https://cdn-we-retail.ym.tencent.com/miniapp/template/user-center-bg-v1.png");
background-size: auto 40%; background-size: auto 40%;
background-repeat: no-repeat; background-repeat: no-repeat;
position: relative; position: relative;
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666)); color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666666));
} }
.user-center-card__header__avatar { .user-center-card__header__avatar {
img { img {
border-radius: 50%; border-radius: 50%;
} }
} }
.user-center-card__header__transparent { .user-center-card__header__transparent {
position: absolute; position: absolute;
left: 30px; left: 30px;
top: 200px; top: 200px;
background-color: transparent; background-color: transparent;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
box-sizing: border-box; box-sizing: border-box;
text-align: left; text-align: left;
.user-center-card__header__info { .user-center-card__header__info {
margin-left: 20px; margin-left: 20px;
width: 400px; width: 400px;
color: #333; color: #333;
font-weight: bolder; font-weight: bolder;
} }
.rightIcon { .rightIcon {
height: 100px; height: 100px;
margin: auto; margin: auto;
} }
} }
.container { .container {
position: absolute; position: absolute;
top: 350px; top: 350px;
width: 710px; width: 710px;
} }
.cell-card { .cell-card {
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
border-radius: 20px; border-radius: 20px;
margin: 20px; margin: 20px;
padding: 30px; padding: 30px;
width: 710px; width: 710px;
.top { .top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.sub { .sub {
display: flex; display: flex;
color: #c9c9c9; color: #c9c9c9;
align-items: center; align-items: center;
}
} }
}
.center { .center {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
color: #666; color: #666;
padding: 0 30px; padding: 0 30px;
.center-t { .center-t {
margin-top: 30px; margin-top: 30px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
.center-text { .center-text {
margin-top: 15px; margin-top: 15px;
} }
}
} }
}
} }
.user-center { .user-center {
background-color: #fff; background-color: #fff;
border-radius: 20px; border-radius: 20px;
margin: 20px; margin: 20px;
padding: 30px; padding: 30px;
width: 710px; width: 710px;
box-sizing: border-box;
.box {
margin-top: 20px;
display: flex;
flex-wrap: wrap;
box-sizing: border-box; box-sizing: border-box;
.box { .box-mini {
margin-top: 20px; display: flex;
display: flex; box-sizing: border-box;
flex-wrap: wrap; flex-direction: column;
box-sizing: border-box; align-items: center;
width: 150px;
margin-bottom: 20px;
margin-right: 13px;
.box-mini { .label {
display: flex; font-size: 25px;
box-sizing: border-box; margin-top: 10px;
flex-direction: column; color: #333;
align-items: center; }
width: 150px;
margin-bottom: 20px;
margin-right: 13px;
.label { image {
font-size: 25px; width: 80px;
margin-top: 10px; height: 80px;
color: #333; }
}
image {
width: 80px;
height: 80px;
}
}
} }
button {
width: 150px;
position: relative;
margin-left: auto;
margin-right: auto;
padding-left: 0;
padding-right: 0;
box-sizing: border-box;
// font-size: 18px;
text-align: center;
text-decoration: none;
// line-height: 1;
line-height: 1.35;
// border-radius: 5px;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
color: #000000;
background-color: #fff;
height: 100%;
}
button::after {
border: none;
background: transparent;
}
}
} }
.mer-box { .mer-box {
box-sizing: border-box; box-sizing: border-box;
background-color: #fff; background-color: #fff;
border-radius: 20px; border-radius: 20px;
margin: 20px; margin: 20px;
width: 710px; width: 710px;
} }
</style> </style>

View File

@@ -3,22 +3,28 @@ import { ref } from "vue";
import { showToast, useLoad, getStorageSync } from "@tarojs/taro"; import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
import { getIntegralDetail, getBeanDetail } from "@/api/user"; import { getIntegralDetail, getBeanDetail } from "@/api/user";
const tabValue = ref(0); const tabValue = ref(1);
const tabsList = ref([ const tabsList = ref([
{ {
title: "积分明细", title: "兑换明细",
value: 0, value: 1,
},
{
title: "赠送明细",
value: 3,
}, },
{ {
title: "豆子明细", title: "豆子明细",
value: 1, value: 2,
}, },
]); ]);
const tabChange = (index: number) => { const tabChange = (index: number) => {
tabValue.value = index; tabValue.value = index;
data.value = [];
getList(); getList();
page.value.PageNum = 1;
}; };
const data = ref([]); const data = ref([]);
@@ -44,16 +50,16 @@ const pageChange = (e: number) => {
const getList = async () => { const getList = async () => {
try { try {
let res: any; let res: any;
if (tabValue.value === 0) { const newData = {
res = await getBeanDetail({ PageNum: page.value.PageNum,
PageNum: page.value.PageNum, PageSize: page.value.PageSize,
PageSize: page.value.PageSize, Type: tabValue.value,
}); };
if (tabValue.value === 1 || tabValue.value === 3) {
res = await getBeanDetail(newData);
} else { } else {
res = await getIntegralDetail({ delete data.Type;
PageNum: page.value.PageNum, res = await getIntegralDetail(newData);
PageSize: page.value.PageSize,
});
} }
data.value = res.data.data || []; data.value = res.data.data || [];
page.value.ItemCount = res.data.count; page.value.ItemCount = res.data.count;
@@ -96,20 +102,24 @@ const getList = async () => {
</view> </view>
</view> </view>
<view v-if="data.length > 0"> <view v-if="data.length > 0">
<view v-if="tabValue === 0"> <view v-if="tabValue === 1 || tabValue === 3">
<view <view
class="card-list" class="card-list"
v-for="(item, index) in (data as any[])" v-for="(item, index) in (data as any[])"
:key="index" :key="index"
> >
<view class="left"> <view class="left">
<view>购买商品{{ item.goods_name }}</view> <view>商品{{ item.goods_name }}</view>
<view>支付时间{{ item.add_time.slice(0, 10) }}</view> <view>时间{{ item.add_time.slice(0, 10) }}</view>
</view> </view>
<view class="right"> <view class="right">
<view style="color: green" <view v-if="tabValue === 1" style="color: green"
>-<text>{{ item.number }}积分</text></view >-<text>{{ item.number }}积分</text></view
> >
<view v-if="tabValue === 3" style="color: red"
>+<text>{{ item.number }}</text
>积分</view
>
</view> </view>
</view> </view>
</view> </view>
@@ -120,9 +130,9 @@ const getList = async () => {
:key="index" :key="index"
> >
<view class="left"> <view class="left">
<view>购买商品{{ item.goods_name }}</view> <view class="text">商品{{ item.goods_name }}</view>
<view>支付金额{{ item.order_number }}</view> <view>金额{{ item.order_number }}</view>
<view>支付时间{{ item.add_time.slice(0, 10) }}</view> <view>时间{{ item.add_time.slice(0, 10) }}</view>
</view> </view>
<view class="right"> <view class="right">
<view style="color: red" <view style="color: red"
@@ -228,5 +238,25 @@ const getList = async () => {
padding: 20px; padding: 20px;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.left {
width: 500px;
.text {
text-align: left;
width: 100%;
// 超出一行隐藏
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
word-break: break-word;
}
}
.right {
flex: 1;
text-align: right;
}
} }
</style> </style>

View File

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

View File

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

View File

@@ -12,13 +12,13 @@
<view>{{ item.label }}</view> <view>{{ item.label }}</view>
</view> </view>
</view> </view>
<view style="width: 45%;"></view> <view style="width: 45%"></view>
</view> </view>
<!-- 二维码弹窗 --> <!-- 二维码弹窗 -->
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show"> <nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
<view class="popup"> <view class="popup">
<view>推荐人二维码绑定</view> <view>推荐人二维码绑定</view>
<image :src="urlCode" /> <image style="margin-top: 10px" :src="urlCode" />
</view> </view>
</nut-popup> </nut-popup>
</view> </view>
@@ -28,6 +28,7 @@
import { ref } from "vue"; import { ref } 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 { getRefereeCode } from "@/api/user";
const show = ref(false); const show = ref(false);
@@ -51,12 +52,19 @@ const list = ref([
}, },
]); ]);
const clickItem = (item: any) => { const clickItem = async (item: any) => {
if (item.id === 1) { if (item.id === 1) {
urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync( // urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
"token" // "token"
)}`; // )}`;
Taro.showLoading({
title: "加载中",
mask: true,
});
const res = await getRefereeCode();
urlCode.value = `data:image/png;base64,${res.data.data}`;
show.value = true; show.value = true;
Taro.hideLoading();
} else if (item.id === 2) { } else if (item.id === 2) {
Taro.navigateTo({ Taro.navigateTo({
url: "/pages/users/distribution/integral/index", url: "/pages/users/distribution/integral/index",

View File

@@ -9,7 +9,12 @@
<view class="left"> <view class="left">
<view>昵称{{ item.nick_name }}</view> <view>昵称{{ item.nick_name }}</view>
<view>购买商品{{ item.goods_name }}</view> <view>购买商品{{ item.goods_name }}</view>
<view>支付时间{{ item.add_time.slice(0, 10) }}</view> <view
>订单价格<text style="color: red">{{
item.order_number
}}</text></view
>
<view>购买时间{{ item.add_time.slice(0, 10) }}</view>
</view> </view>
<view class="right"> <view class="right">
<view style="color: red" <view style="color: red"

View File

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

View File

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

View File

@@ -6,6 +6,7 @@ import {
showToast, showToast,
navigateTo, navigateTo,
setStorageSync, setStorageSync,
useDidShow,
} from "@tarojs/taro"; } from "@tarojs/taro";
import Pay from "@/components/Pay.vue"; import Pay from "@/components/Pay.vue";
import { getIntegralOrderList } from "@/api/user"; import { getIntegralOrderList } from "@/api/user";
@@ -63,6 +64,9 @@ const orderList = ref<OrderList[]>([]);
useLoad((options) => { useLoad((options) => {
tabValue.value = Number(options.type); tabValue.value = Number(options.type);
});
useDidShow(() => {
getList(); getList();
}); });
@@ -205,10 +209,10 @@ const getTj = async () => {
<view class="center"> <view class="center">
<view class="top"> <view class="top">
<image :src="item.BindGoods.cover" /> <image :src="item.BindGoods.cover" />
<view class="title">{{ item.BindGoods.name }} </view> <view class="title">{{ item.BindGoods?.name }} </view>
<view class="right"> <view class="right">
<view>{{ item.number }}</view> <view>{{ item.BindGoods?.number }}</view>
<view>x{{ item.count }}</view> <view>x{{ item?.count }}</view>
</view> </view>
</view> </view>
<!-- <view <!-- <view

View File

@@ -16,12 +16,12 @@
<view class="mer-info"> <view class="mer-info">
<view class="left"> <view class="left">
<view> <view>
<text>{{ goodInfo.BindStore.name }}</text> <text>{{ goodInfo.BindStore?.name }}</text>
<text>{{ goodInfo.BindStore.phone }}</text> <text>{{ goodInfo.BindStore?.phone }}</text>
</view> </view>
<nut-ellipsis <nut-ellipsis
:rows="2" :rows="2"
:content="goodInfo.BindStore.address" :content="goodInfo.BindStore?.address"
direction="end" direction="end"
></nut-ellipsis> ></nut-ellipsis>
</view> </view>
@@ -43,12 +43,12 @@
<nut-cell> <nut-cell>
<template #default> <template #default>
<view class="top"> <view class="top">
<image :src="goodInfo.BindGoods.cover" /> <image :src="goodInfo.BindGoods?.cover" />
<view class="title" <view class="title"
>{{ goodInfo.BindGoods.name }} >{{ goodInfo.BindGoods?.name }}
</view> </view>
<view class="right"> <view class="right">
<view>{{ goodInfo.number }}</view> <view>{{ goodInfo.BindGoods?.number }}</view>
<view>x{{ goodInfo.count }}</view> <view>x{{ goodInfo.count }}</view>
</view> </view>
</view> </view>
@@ -57,15 +57,13 @@
<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=" :desc="
dayjs dayjs.unix(goodInfo.expires).format('YYYY-MM-DD HH:mm:ss')
.unix(goodInfo.expires)
.format('YYYY-MM-DD HH:mm:ss')
" "
></nut-cell> ></nut-cell>
<nut-cell <nut-cell

View File

@@ -31,6 +31,11 @@ const formValue = ref<any>({
back: [], back: [],
head_photo: [], head_photo: [],
img: [], img: [],
bank: "",
bank_card: "",
bank_name: "",
bank_user: "",
address: "",
}); });
const merGooList = ref([]); const merGooList = ref([]);
@@ -78,13 +83,18 @@ const onOk = async () => {
front: formValue.value.front[0]?.url, front: formValue.value.front[0]?.url,
back: formValue.value.back[0]?.url, back: formValue.value.back[0]?.url,
head_photo: formValue.value.head_photo[0]?.url, head_photo: formValue.value.head_photo[0]?.url,
img: formValue.value.img.map((item: any) => item.url), img: formValue.value.img.map((item: any) => item.url).join(","),
}; };
const res = await applyMer(data); const res = await applyMer(data);
Taro.showToast({ Taro.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
}); });
setTimeout(() => {
Taro.redirectTo({
url: "/pages/index/index",
});
}, 3000);
} catch (e) { } catch (e) {
Taro.showToast({ Taro.showToast({
title: e.msg, title: e.msg,
@@ -243,6 +253,91 @@ const submit = () => {
</nut-button> </nut-button>
</view> </view>
</nut-form-item> </nut-form-item>
<nut-form-item
required
label="店铺地址"
prop="address"
:rules="[
{
required: true,
message: '请输入店铺详细地址',
},
]"
>
<input
type="text"
v-model="formValue.address"
placeholder="请输入店铺详细地址"
/>
</nut-form-item>
<nut-form-item
required
label="法人"
prop="bank_user"
:rules="[
{
required: true,
message: '请输入法人',
},
]"
>
<input
type="text"
v-model="formValue.bank_user"
placeholder="请输入法人"
/>
</nut-form-item>
<nut-form-item
required
label="账户名称"
prop="bank_name"
:rules="[
{
required: true,
message: '请输入账户名称',
},
]"
>
<input
type="text"
v-model="formValue.bank_name"
placeholder="请输入账户名称"
/>
</nut-form-item>
<nut-form-item
required
label="开户银行"
prop="bank"
:rules="[
{
required: true,
message: '请输入银行名称',
},
]"
>
<input
type="text"
v-model="formValue.bank"
placeholder="请输入银行名称"
/>
</nut-form-item>
<nut-form-item
required
label="银行卡号"
prop="bank_card"
:rules="[
{
required: true,
message: '请输入银行卡号',
},
]"
>
<input
type="text"
v-model="formValue.bank_card"
placeholder="请输入银行卡号"
/>
</nut-form-item>
<nut-form-item <nut-form-item
required required
label="商户类型" label="商户类型"

View File

@@ -22,6 +22,7 @@ const logOut = () => {
if (res.confirm) { if (res.confirm) {
Taro.removeStorageSync("token"); Taro.removeStorageSync("token");
Taro.removeStorageSync("userInfo"); Taro.removeStorageSync("userInfo");
Taro.removeStorageSync("mer_type");
Taro.reLaunch({ Taro.reLaunch({
url: "/pages/index/index", url: "/pages/index/index",
}); });
@@ -34,7 +35,7 @@ const logOut = () => {
const chooseavatar = (e: any) => { const chooseavatar = (e: any) => {
Taro.uploadFile({ Taro.uploadFile({
url: `${BASE_URL}/app/upload`, url: `${BASE_URL}/upload`,
filePath: e.detail.avatarUrl, filePath: e.detail.avatarUrl,
name: "file", name: "file",
header: { header: {

BIN
src/static/contact.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src/static/def_avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,139 @@
@font-face {
font-family: "iconfont"; /* Project id 4211210 */
src: url('https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.woff2?t=1692081500100') format('woff2'),
url('https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.woff?t=1692081500100') format('woff'),
url('https://at.alicdn.com/t/c/font_4211210_2x20brbrv94.ttf?t=1692081500100') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-H:before {
content: "\e609";
}
.icon-indent:before {
content: "\e618";
}
.icon-outdent:before {
content: "\e620";
}
.icon-image:before {
content: "\e63f";
}
.icon-shanchu:before {
content: "\e74b";
}
.icon-formatheader1:before {
content: "\e860";
}
.icon-zitishangbiao:before {
content: "\e65c";
}
.icon-zitixiabiao:before {
content: "\e65d";
}
.icon-direction-rtl:before {
content: "\e6de";
}
.icon-fengexian:before {
content: "\e62d";
}
.icon-clearformat:before {
content: "\e60b";
}
.icon-redo:before {
content: "\e627";
}
.icon-undo:before {
content: "\e633";
}
.icon-font:before {
content: "\eae6";
}
.icon-font-colors:before {
content: "\e7f7";
}
.icon-font-size:before {
content: "\e7f8";
}
.icon-Character-Spacing:before {
content: "\e964";
}
.icon-duanhouju:before {
content: "\e61a";
}
.icon-duanqianju:before {
content: "\e61b";
}
.icon-line-height:before {
content: "\e7c4";
}
.icon-juzhongduiqi:before {
content: "\e621";
}
.icon-wuxupailie:before {
content: "\e63e";
}
.icon-youduiqi:before {
content: "\e64b";
}
.icon-youxupailie:before {
content: "\e64c";
}
.icon-zitijiacu:before {
content: "\e656";
}
.icon-zitishanchuxian:before {
content: "\e657";
}
.icon-zitixiahuaxian:before {
content: "\e658";
}
.icon-zitixieti:before {
content: "\e659";
}
.icon-zuoyouduiqi:before {
content: "\e65a";
}
.icon-zuoduiqi:before {
content: "\e65b";
}
.icon-fontbgcolor-copy:before {
content: "\eae7";
}

File diff suppressed because it is too large Load Diff

BIN
src/static/logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
src/static/wechat_login.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,26 +1,20 @@
import { showToast, navigateBack } from "@tarojs/taro";
// 经纬度计算距离 // 经纬度计算距离
export function calculateDistance( export function calculateDistance(
lat1: number, la1: number,
lon1: number, lo1: number,
lat2: number, la2: number,
lon2: number lo2: number
): string { ): any {
const R = 6371; // 地球平均半径(单位:千米) var radLat1 = la1 * Math.PI / 180.0;
var radLat2 = la2 * Math.PI / 180.0;
const dLat = toRadians(lat2 - lat1); var a = radLat1 - radLat2;
const dLon = toRadians(lon2 - lon1); var b = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
const a = s = s * 6378.137;
Math.sin(dLat / 2) * Math.sin(dLat / 2) + s = Math.round(s * 10000) / 10000;
Math.cos(toRadians(lat1)) * return s.toFixed(2) + 'km'
Math.cos(toRadians(lat2)) *
Math.sin(dLon / 2) *
Math.sin(dLon / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = R * c;
return distance.toFixed(2);
} }
// 将角度转换为弧度 // 将角度转换为弧度

18
src/utils/js_sdk/u-charts.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,6 @@
import Taro from "@tarojs/taro"; import Taro from '@tarojs/taro'
export const BASE_URL = export const BASE_URL = process.env.TARO_APP_API
process.env.NODE_ENV === "development"
? "http://192.168.2.3:9000/app"
: "https://www.wanzhuanyongcheng.cn/app";
interface Res<T> { interface Res<T> {
code: number; code: number;
@@ -11,47 +8,47 @@ interface Res<T> {
msg: string; msg: string;
} }
type Method = "GET" | "POST" | "PUT" | "DELETE"; type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
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.showLoading({ // Taro.showLoading({
title: "加载中...", // title: '加载中...',
mask: true, // mask: true
}); // })
Taro.request({ Taro.request({
url: BASE_URL + url, url: BASE_URL + url,
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}) => {
Taro.hideLoading(); // Taro.hideLoading()
if (data.code !== 200) { if (data.code !== 200) {
Taro.showToast({ Taro.showToast({
title: data.msg, title: data.msg,
icon: "none", icon: 'none'
}); })
reject(data); reject(data)
return; return
} }
resolve(data); resolve(data)
}, },
fail: () => { fail: () => {
Taro.showToast({ Taro.showToast({
title: "服务器异常", title: '服务器异常',
icon: "none", icon: 'none'
}); })
reject({ code: 1, msg: "服务器异常" }); reject({code: 1, msg: '服务器异常'})
}, }
}); })
}); })
}; }
export default request; export default request