feat(custom): build
This commit is contained in:
@@ -5,4 +5,4 @@ TARO_APP_ID='wx7b3322daa2cf9c88'
|
|||||||
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
|
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
|
||||||
|
|
||||||
# 游戏链接
|
# 游戏链接
|
||||||
TARO_APP_GAME='https://game.wanzhuanyongcheng.cn/public/#/pages/index/index?uid='
|
TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid='
|
||||||
@@ -4,4 +4,4 @@ TARO_APP_ID='wxdd00d46fa6f07974'
|
|||||||
# API接口
|
# API接口
|
||||||
TARO_APP_API='https://www.wanzhuanyongcheng.cn/app'
|
TARO_APP_API='https://www.wanzhuanyongcheng.cn/app'
|
||||||
|
|
||||||
TARO_APP_GAME = 'https://www.jdt168.com/public/#/pages/index/index?uid='
|
TARO_APP_GAME='https://jdt-prod-tz.wanzhuanyongcheng.cn/pages/index/index?uid='
|
||||||
@@ -5,4 +5,4 @@ TARO_APP_ID='wx7b3322daa2cf9c88'
|
|||||||
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
|
TARO_APP_API='https://test.wanzhuanyongcheng.cn/app'
|
||||||
|
|
||||||
# 游戏链接
|
# 游戏链接
|
||||||
TARO_APP_GAME = 'https://game.wanzhuanyongcheng.cn/public/#/pages/index/index?uid='
|
TARO_APP_GAME='https://jdt-test-tz.wanzhuanyongcheng.cn/pages/index/index?uid='
|
||||||
4
components.d.ts
vendored
4
components.d.ts
vendored
@@ -8,6 +8,8 @@ export {};
|
|||||||
declare module "@vue/runtime-core" {
|
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"];
|
||||||
|
Cart: typeof import("./src/components/Cart.vue")["default"];
|
||||||
|
MerList: typeof import("./src/components/MerList.vue")["default"];
|
||||||
NutAvatar: typeof import("@nutui/nutui-taro")["Avatar"];
|
NutAvatar: typeof import("@nutui/nutui-taro")["Avatar"];
|
||||||
NutBacktop: typeof import("@nutui/nutui-taro")["Backtop"];
|
NutBacktop: typeof import("@nutui/nutui-taro")["Backtop"];
|
||||||
NutButton: typeof import("@nutui/nutui-taro")["Button"];
|
NutButton: typeof import("@nutui/nutui-taro")["Button"];
|
||||||
@@ -15,6 +17,7 @@ declare module "@vue/runtime-core" {
|
|||||||
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"];
|
||||||
|
NutCheckboxGroup: typeof import("@nutui/nutui-taro")["CheckboxGroup"];
|
||||||
NutDialog: typeof import("@nutui/nutui-taro")["Dialog"];
|
NutDialog: typeof import("@nutui/nutui-taro")["Dialog"];
|
||||||
NutEllipsis: typeof import("@nutui/nutui-taro")["Ellipsis"];
|
NutEllipsis: typeof import("@nutui/nutui-taro")["Ellipsis"];
|
||||||
NutEmpty: typeof import("@nutui/nutui-taro")["Empty"];
|
NutEmpty: typeof import("@nutui/nutui-taro")["Empty"];
|
||||||
@@ -31,7 +34,6 @@ declare module "@vue/runtime-core" {
|
|||||||
NutPopup: typeof import("@nutui/nutui-taro")["Popup"];
|
NutPopup: typeof import("@nutui/nutui-taro")["Popup"];
|
||||||
NutPrice: typeof import("@nutui/nutui-taro")["Price"];
|
NutPrice: typeof import("@nutui/nutui-taro")["Price"];
|
||||||
NutSearchbar: typeof import("@nutui/nutui-taro")["Searchbar"];
|
NutSearchbar: typeof import("@nutui/nutui-taro")["Searchbar"];
|
||||||
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"];
|
NutSwitch: typeof import("@nutui/nutui-taro")["Switch"];
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const config = {
|
|||||||
prebundle: { enable: false },
|
prebundle: { enable: false },
|
||||||
},
|
},
|
||||||
cache: {
|
cache: {
|
||||||
enable: true, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
||||||
},
|
},
|
||||||
sass: {
|
sass: {
|
||||||
data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`,
|
data: `@import "@nutui/nutui-taro/dist/styles/variables.scss";`,
|
||||||
|
|||||||
215
package.json
215
package.json
@@ -1,109 +1,110 @@
|
|||||||
{
|
{
|
||||||
"name": "taroApp",
|
"name": "taroApp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "",
|
"description": "",
|
||||||
"templateInfo": {
|
"templateInfo": {
|
||||||
"name": "vue3-NutUI4",
|
"name": "vue3-NutUI4",
|
||||||
"typescript": true,
|
"typescript": true,
|
||||||
"css": "sass"
|
"css": "sass"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:weapp": "taro build --type weapp",
|
"build:weapp": "taro build --type weapp",
|
||||||
"build:test": "taro build --type weapp --mode test",
|
"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",
|
||||||
"build:h5": "taro build --type h5",
|
"build:h5": "taro build --type h5",
|
||||||
"build:rn": "taro build --type rn",
|
"build:rn": "taro build --type rn",
|
||||||
"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": "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",
|
||||||
"dev:h5": "npm run build:h5 -- --watch",
|
"dev:h5": "npm run build:h5 -- --watch",
|
||||||
"dev:rn": "npm run build:rn -- --watch",
|
"dev:rn": "npm run build:rn -- --watch",
|
||||||
"dev:qq": "npm run build:qq -- --watch",
|
"dev:qq": "npm run build:qq -- --watch",
|
||||||
"dev:jd": "npm run build:jd -- --watch",
|
"dev:jd": "npm run build:jd -- --watch",
|
||||||
"dev:quickapp": "npm run build:quickapp -- --watch",
|
"dev:quickapp": "npm run build:quickapp -- --watch",
|
||||||
"lint": "eslint --ext .ts,.vue .",
|
"lint": "eslint --ext .ts,.vue .",
|
||||||
"lint:fix": "eslint --fix --ext .ts,.vue .",
|
"lint:fix": "eslint --fix --ext .ts,.vue .",
|
||||||
"lint:staged": "lint-staged",
|
"lint:staged": "lint-staged",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"cz": "cz",
|
"cz": "cz",
|
||||||
"lf": "npx prettier --write --end-of-line lf ."
|
"lf": "npx prettier --write --end-of-line lf ."
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 3 versions",
|
"last 3 versions",
|
||||||
"Android >= 4.1",
|
"Android >= 4.1",
|
||||||
"ios >= 8"
|
"ios >= 8"
|
||||||
],
|
],
|
||||||
"author": "",
|
"author": "",
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,vue}": [
|
"*.{ts,vue}": [
|
||||||
"eslint --ext .ts,.vue .",
|
"eslint --ext .ts,.vue .",
|
||||||
"npx prettier --write --end-of-line lf ."
|
"npx prettier --write --end-of-line lf ."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"commitizen": {
|
"commitizen": {
|
||||||
"path": "node_modules/cz-customizable"
|
"path": "node_modules/cz-customizable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.23.2",
|
"@babel/runtime": "^7.23.2",
|
||||||
"@nutui/icons-vue-taro": "^0.0.9",
|
"@nutui/icons-vue-taro": "^0.0.9",
|
||||||
"@nutui/nutui-taro": "^4.2.0",
|
"@nutui/nutui-taro": "^4.2.0",
|
||||||
"@qiun/vue-ucharts": "2.5.0-20230101",
|
"@qiun/vue-ucharts": "2.5.0-20230101",
|
||||||
"@tarojs/components": "3.6.18",
|
"@tarojs/components": "3.6.19",
|
||||||
"@tarojs/helper": "3.6.18",
|
"@tarojs/helper": "3.6.19",
|
||||||
"@tarojs/plugin-framework-vue3": "3.6.18",
|
"@tarojs/plugin-framework-vue3": "3.6.19",
|
||||||
"@tarojs/plugin-html": "3.6.18",
|
"@tarojs/plugin-html": "3.6.19",
|
||||||
"@tarojs/plugin-platform-alipay": "3.6.18",
|
"@tarojs/plugin-platform-alipay": "3.6.19",
|
||||||
"@tarojs/plugin-platform-h5": "3.6.18",
|
"@tarojs/plugin-platform-h5": "3.6.19",
|
||||||
"@tarojs/plugin-platform-jd": "3.6.18",
|
"@tarojs/plugin-platform-jd": "3.6.19",
|
||||||
"@tarojs/plugin-platform-qq": "3.6.18",
|
"@tarojs/plugin-platform-qq": "3.6.19",
|
||||||
"@tarojs/plugin-platform-swan": "3.6.18",
|
"@tarojs/plugin-platform-swan": "3.6.19",
|
||||||
"@tarojs/plugin-platform-tt": "3.6.18",
|
"@tarojs/plugin-platform-tt": "3.6.19",
|
||||||
"@tarojs/plugin-platform-weapp": "3.6.18",
|
"@tarojs/plugin-platform-weapp": "3.6.19",
|
||||||
"@tarojs/runtime": "3.6.18",
|
"@tarojs/runtime": "3.6.19",
|
||||||
"@tarojs/shared": "3.6.18",
|
"@tarojs/shared": "3.6.19",
|
||||||
"@tarojs/taro": "3.6.18",
|
"@tarojs/taro": "3.6.19",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"vue": "^3.3.8"
|
"sentry-miniapp": "^0.12.0",
|
||||||
},
|
"vue": "^3.3.8"
|
||||||
"devDependencies": {
|
},
|
||||||
"@babel/core": "^7.23.3",
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^18.2.0",
|
"@babel/core": "^7.23.3",
|
||||||
"@commitlint/config-conventional": "^18.1.0",
|
"@commitlint/cli": "^18.2.0",
|
||||||
"@tarojs/cli": "3.6.18",
|
"@commitlint/config-conventional": "^18.1.0",
|
||||||
"@tarojs/taro-loader": "3.6.18",
|
"@tarojs/cli": "3.6.19",
|
||||||
"@tarojs/webpack5-runner": "3.6.18",
|
"@tarojs/taro-loader": "3.6.19",
|
||||||
"@types/node": "^18.18.9",
|
"@tarojs/webpack5-runner": "3.6.19",
|
||||||
"@types/webpack-env": "^1.18.4",
|
"@types/node": "^18.18.9",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
"@types/webpack-env": "^1.18.4",
|
||||||
"@typescript-eslint/parser": "^6.10.0",
|
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
||||||
"@vue/babel-plugin-jsx": "^1.1.5",
|
"@typescript-eslint/parser": "^6.10.0",
|
||||||
"@vue/compiler-sfc": "^3.3.8",
|
"@vue/babel-plugin-jsx": "^1.1.5",
|
||||||
"babel-preset-taro": "3.6.18",
|
"@vue/compiler-sfc": "^3.3.8",
|
||||||
"commitizen": "^4.3.0",
|
"babel-preset-taro": "3.6.19",
|
||||||
"css-loader": "3.4.2",
|
"commitizen": "^4.3.0",
|
||||||
"cz-customizable": "^7.0.0",
|
"css-loader": "3.4.2",
|
||||||
"eslint": "^8.53.0",
|
"cz-customizable": "^7.0.0",
|
||||||
"eslint-config-taro": "3.6.18",
|
"eslint": "^8.53.0",
|
||||||
"eslint-plugin-vue": "^9.18.1",
|
"eslint-config-taro": "3.6.19",
|
||||||
"husky": "^8.0.3",
|
"eslint-plugin-vue": "^9.18.1",
|
||||||
"lint-staged": "^15.0.2",
|
"husky": "^8.0.3",
|
||||||
"style-loader": "1.3.0",
|
"lint-staged": "^15.0.2",
|
||||||
"stylelint": "9.3.0",
|
"style-loader": "1.3.0",
|
||||||
"ts-node": "^10.9.1",
|
"stylelint": "9.3.0",
|
||||||
"typescript": "^4.9.5",
|
"ts-node": "^10.9.1",
|
||||||
"unplugin-vue-components": "^0.23.0",
|
"typescript": "^4.9.5",
|
||||||
"vue-loader": "^17.3.1",
|
"unplugin-vue-components": "^0.23.0",
|
||||||
"webpack": "^5.89.0"
|
"vue-loader": "^17.3.1",
|
||||||
}
|
"webpack": "^5.89.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13896
pnpm-lock.yaml
generated
13896
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
15
src/api/cart.ts
Normal file
15
src/api/cart.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import request from "../utils/request";
|
||||||
|
|
||||||
|
// 添加购物车
|
||||||
|
export const addCart = (data: object) =>
|
||||||
|
request("/goods/cart/add", data, "POST");
|
||||||
|
|
||||||
|
// 获取购物车
|
||||||
|
export const getCart = (data: object) => request("/goods/cart", data, "POST");
|
||||||
|
|
||||||
|
// 清空购物车
|
||||||
|
export const clearCart = (data: object) =>
|
||||||
|
request("/goods/cart/removeAll", data, "POST");
|
||||||
|
|
||||||
|
// 获取全部购物车
|
||||||
|
export const getAllCart = () => request("/goods/all/cart", {}, "POST");
|
||||||
@@ -28,7 +28,7 @@ export const getActiveGoods = () => request("/goods", {}, "POST");
|
|||||||
export const getActiveGoodsDetail = (data: object) =>
|
export const getActiveGoodsDetail = (data: object) =>
|
||||||
request("/goods/details", data, "POST");
|
request("/goods/details", data, "POST");
|
||||||
|
|
||||||
// 活动商品下单
|
// 创建订单
|
||||||
export const createActiveOrder = (data: object) =>
|
export const createActiveOrder = (data: object) =>
|
||||||
request("/order/place", data, "POST");
|
request("/order/place", data, "POST");
|
||||||
|
|
||||||
|
|||||||
7
src/api/home.ts
Normal file
7
src/api/home.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import request from "../utils/request";
|
||||||
|
|
||||||
|
// 获取商户分类
|
||||||
|
export const getHomeList = () => request("/home/classify", {}, "POST");
|
||||||
|
|
||||||
|
// 获取商户子列表
|
||||||
|
export const getHomeSubList = () => request("/home/all/classify", {}, "POST");
|
||||||
@@ -58,6 +58,10 @@ export default defineAppConfig({
|
|||||||
root: "pages/marketing",
|
root: "pages/marketing",
|
||||||
pages: ["sign/index"],
|
pages: ["sign/index"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
root: "pages/search",
|
||||||
|
pages: ["index"],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
window: {
|
window: {
|
||||||
backgroundTextStyle: "light",
|
backgroundTextStyle: "light",
|
||||||
@@ -83,12 +87,12 @@ export default defineAppConfig({
|
|||||||
// selectedIconPath: "static/tabbar/2-002.png",
|
// selectedIconPath: "static/tabbar/2-002.png",
|
||||||
// text: "分类",
|
// text: "分类",
|
||||||
// },
|
// },
|
||||||
// {
|
{
|
||||||
// pagePath: "pages/cart/index",
|
pagePath: "pages/cart/index",
|
||||||
// iconPath: "static/tabbar/3-001.png",
|
iconPath: "static/tabbar/3-001.png",
|
||||||
// selectedIconPath: "static/tabbar/3-002.png",
|
selectedIconPath: "static/tabbar/3-002.png",
|
||||||
// text: "购物车",
|
text: "购物车",
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
pagePath: "pages/user/index",
|
pagePath: "pages/user/index",
|
||||||
iconPath: "static/tabbar/4-001.png",
|
iconPath: "static/tabbar/4-001.png",
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
@import "static/iconfont/iconfont.css";
|
||||||
|
|
||||||
page {
|
page {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
|
font-size: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
view {
|
view {
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
import "./app.scss";
|
import "./app.scss";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import "static/iconfont/iconfont.css";
|
// import * as Sentry from "sentry-miniapp";
|
||||||
|
|
||||||
// 小程序场景值
|
// 小程序场景值
|
||||||
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
|
const scenes = [1007, 1008, 1011, 1012, 1013, 1047, 1048, 1049];
|
||||||
|
|
||||||
|
// Sentry.init({
|
||||||
|
// dsn: "https://47703e01ba4344b8b252c15e8fd980fd@sentry.io/1528228",
|
||||||
|
// });
|
||||||
|
|
||||||
const App = createApp({
|
const App = createApp({
|
||||||
onLaunch(options: {
|
onLaunch(options: {
|
||||||
path: string;
|
path: string;
|
||||||
|
|||||||
289
src/components/Cart.vue
Normal file
289
src/components/Cart.vue
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import Taro from "@tarojs/taro";
|
||||||
|
import { addCart, getCart, clearCart } from "@/api/cart";
|
||||||
|
import { Del2 } from "@nutui/icons-vue-taro";
|
||||||
|
import { createActiveOrder } from "@/api/goods";
|
||||||
|
import Pay from "@/components/Pay.vue";
|
||||||
|
|
||||||
|
interface CardList {
|
||||||
|
name: string;
|
||||||
|
cover: string;
|
||||||
|
bid: string;
|
||||||
|
gid: string;
|
||||||
|
number: string;
|
||||||
|
price: number;
|
||||||
|
exchange: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const show = ref(false);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
merInfo: {
|
||||||
|
required: true,
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(["updateCart"]);
|
||||||
|
|
||||||
|
const openModal = async () => {
|
||||||
|
await get_cart_list();
|
||||||
|
if (card_list.value.length === 0) return;
|
||||||
|
show.value = !show.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const add_cart = async (item: CardList, num: number = 1) => {
|
||||||
|
try {
|
||||||
|
const res = await addCart({
|
||||||
|
Bid: item.bid,
|
||||||
|
Gid: item.gid,
|
||||||
|
Number: Number(num),
|
||||||
|
});
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
await get_cart_list();
|
||||||
|
} catch (e) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: e.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAdd = async (item: CardList) => {
|
||||||
|
await add_cart(item, Number(item.number) + 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onReduce = async (item: CardList) => {
|
||||||
|
await add_cart(item, Number(item.number) - 1);
|
||||||
|
if (card_list.value.length === 0) show.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const card_list = ref<CardList[]>([]);
|
||||||
|
|
||||||
|
const cartInfo = ref({
|
||||||
|
count: 0,
|
||||||
|
price: 0,
|
||||||
|
exchange: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const get_cart_list = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getCart({
|
||||||
|
Bid: props.merInfo.bid,
|
||||||
|
});
|
||||||
|
card_list.value = res.data.data || [];
|
||||||
|
cartInfo.value = {
|
||||||
|
count: 0,
|
||||||
|
price: 0,
|
||||||
|
exchange: 0,
|
||||||
|
};
|
||||||
|
card_list.value.forEach((item: CardList) => {
|
||||||
|
cartInfo.value.count += Number(item.number);
|
||||||
|
cartInfo.value.price += Number(item.price);
|
||||||
|
cartInfo.value.exchange += Number(item.exchange);
|
||||||
|
});
|
||||||
|
emit("updateCart", res.data.data || []);
|
||||||
|
} catch (e) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: e.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const clear_cart = async () => {
|
||||||
|
try {
|
||||||
|
await clearCart({
|
||||||
|
Bid: props.merInfo.bid,
|
||||||
|
});
|
||||||
|
await get_cart_list();
|
||||||
|
} catch (e) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: e.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
show.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const isShowPay = ref(false);
|
||||||
|
|
||||||
|
const orderData = ref<any>([]);
|
||||||
|
|
||||||
|
const closePay = (val: boolean) => {
|
||||||
|
isShowPay.value = val;
|
||||||
|
orderData.value = [];
|
||||||
|
Taro.redirectTo({
|
||||||
|
url: "/pages/users/order_list/index?type=0",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const create_order = async () => {
|
||||||
|
try {
|
||||||
|
const { data: res } = await createActiveOrder({
|
||||||
|
Bid: [props.merInfo.bid],
|
||||||
|
});
|
||||||
|
if (res.oid) {
|
||||||
|
orderData.value = res.oid;
|
||||||
|
isShowPay.value = true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: e.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// await get_cart_list();
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add_cart,
|
||||||
|
get_cart_list,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="cart" @click.stop="openModal">
|
||||||
|
<view class="container">
|
||||||
|
<view>购物车数量: {{ cartInfo.count }}</view>
|
||||||
|
<view v-if="cartInfo.count > 0">
|
||||||
|
<text>总金额: {{ cartInfo.price.toFixed(2) }}</text
|
||||||
|
>,
|
||||||
|
<text>总积分: {{ cartInfo.exchange.toFixed(2) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="cartInfo.count > 0" class="payBtn" @click.stop="create_order"
|
||||||
|
>立即结算</view
|
||||||
|
>
|
||||||
|
</view>
|
||||||
|
<!-- 购物车弹窗 -->
|
||||||
|
<nut-popup
|
||||||
|
:style="{ padding: '20rpx' }"
|
||||||
|
round
|
||||||
|
position="bottom"
|
||||||
|
z-index="1"
|
||||||
|
:catch-move="true"
|
||||||
|
:safe-area-inset-bottom="true"
|
||||||
|
v-model:visible="show"
|
||||||
|
>
|
||||||
|
<view class="list-header">
|
||||||
|
<view class="left" @click.stop="clear_cart">
|
||||||
|
<Del2 color="#666666" />
|
||||||
|
<text style="color: #666666">清空购物车</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view :scroll-y="true" class="cart-list">
|
||||||
|
<view class="item" v-for="(item, index) in card_list" :key="index">
|
||||||
|
<view class="left">
|
||||||
|
<image :src="item.cover" />
|
||||||
|
<view class="center">
|
||||||
|
<view class="name">{{ item.name }}</view>
|
||||||
|
<view class="price">
|
||||||
|
<view>现金:{{ item.price }}</view>
|
||||||
|
<view>积分:{{ item.exchange }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<nut-input-number
|
||||||
|
v-model="item.number"
|
||||||
|
readonly
|
||||||
|
:min="-1"
|
||||||
|
@add="() => onAdd(item)"
|
||||||
|
@reduce="() => onReduce(item)"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view style="height: 140rpx"></view>
|
||||||
|
</nut-popup>
|
||||||
|
<!-- 支付 -->
|
||||||
|
<Pay
|
||||||
|
:is-show-pay="isShowPay"
|
||||||
|
v-model:jfInfo="orderData"
|
||||||
|
@closePay="closePay"
|
||||||
|
@successPay="closePay"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
$h-border-radius: 50rpx;
|
||||||
|
|
||||||
|
.cart {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 50rpx;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
z-index: 9999;
|
||||||
|
width: 95%;
|
||||||
|
background-color: red;
|
||||||
|
border-radius: $h-border-radius;
|
||||||
|
color: #fff;
|
||||||
|
height: 100rpx;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.container {
|
||||||
|
margin-left: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payBtn {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #000;
|
||||||
|
border-radius: 0 $h-border-radius $h-border-radius 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header {
|
||||||
|
margin: 15rpx 0;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cart-list {
|
||||||
|
height: 290rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 130rpx;
|
||||||
|
height: 130rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: red;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
152
src/components/MerList.vue
Normal file
152
src/components/MerList.vue
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
<template>
|
||||||
|
<view class="goodBox">
|
||||||
|
<view
|
||||||
|
class="good"
|
||||||
|
v-for="item in merdata"
|
||||||
|
:key="item.ID"
|
||||||
|
@click.stop="toMerDetails(item)"
|
||||||
|
>
|
||||||
|
<image :src="item.head_photo" />
|
||||||
|
<view class="good-text-box">
|
||||||
|
<text class="good-text">{{ item.name }}</text>
|
||||||
|
<text style="color: #999"
|
||||||
|
>距离我{{
|
||||||
|
calculateDistance(
|
||||||
|
userLocalNum.t,
|
||||||
|
userLocalNum.l,
|
||||||
|
Number(item.lat),
|
||||||
|
Number(item.lon)
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import Taro from "@tarojs/taro";
|
||||||
|
import { calculateDistance } from "@/utils";
|
||||||
|
import { bindParent } from "@/api/user";
|
||||||
|
import { getMerList } from "@/api/goods";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
classId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Taro.useDidShow(async () => {
|
||||||
|
await get_mer_list();
|
||||||
|
if (Taro.getStorageSync("token") && Taro.getStorageSync("bind_id")) {
|
||||||
|
try {
|
||||||
|
const res = await bindParent({
|
||||||
|
uid: Taro.getStorageSync("bind_id"),
|
||||||
|
});
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
});
|
||||||
|
Taro.removeStorageSync("bind_id");
|
||||||
|
} catch (error) {
|
||||||
|
Taro.removeStorageSync("bind_id");
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
interface MerData {
|
||||||
|
ID: number;
|
||||||
|
name: string;
|
||||||
|
head_photo: string;
|
||||||
|
lat: string;
|
||||||
|
lon: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const merdata = ref<MerData[]>([]);
|
||||||
|
|
||||||
|
const userLocalNum = ref({
|
||||||
|
l: 0,
|
||||||
|
t: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const get_mer_list = async () => {
|
||||||
|
Taro.getLocation({
|
||||||
|
type: "wgs84",
|
||||||
|
success: (res) => {
|
||||||
|
userLocalNum.value.l = res.longitude;
|
||||||
|
userLocalNum.value.t = res.latitude;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const res = await getMerList({
|
||||||
|
PageNum: 1,
|
||||||
|
PageSize: 10,
|
||||||
|
class_id: props.classId,
|
||||||
|
});
|
||||||
|
merdata.value = res.data.data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const toMerDetails = (item: any) => {
|
||||||
|
Taro.setStorageSync("mer_info", item);
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/pages/mer/mer_detail/index`,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.goodBox {
|
||||||
|
display: flex;
|
||||||
|
padding: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.good {
|
||||||
|
width: 340px;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 250px;
|
||||||
|
border-top-right-radius: 10px;
|
||||||
|
border-top-left-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.good-text-box {
|
||||||
|
padding: 10px;
|
||||||
|
|
||||||
|
.good-text {
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-size: 28px;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 400;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.good-price-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.good-text-price {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ff0000;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -11,13 +11,14 @@
|
|||||||
>
|
>
|
||||||
<view class="div">
|
<view class="div">
|
||||||
<view style="text-align: center">支付方式</view>
|
<view style="text-align: center">支付方式</view>
|
||||||
<nut-cell-group>
|
<nut-cell-group
|
||||||
|
:style="{ margin: interval ? '40rpx 0 150rpx 0' : '40rpx 0' }"
|
||||||
|
>
|
||||||
<nut-cell
|
<nut-cell
|
||||||
v-if="payType === 'wx'"
|
|
||||||
title="微信支付"
|
title="微信支付"
|
||||||
desc="使用微信快捷支付"
|
desc="使用微信快捷支付"
|
||||||
is-link
|
is-link
|
||||||
@click="goPay()"
|
@click="goPay(1)"
|
||||||
>
|
>
|
||||||
<template v-slot:icon>
|
<template v-slot:icon>
|
||||||
<IconFont
|
<IconFont
|
||||||
@@ -27,11 +28,10 @@
|
|||||||
</template>
|
</template>
|
||||||
</nut-cell>
|
</nut-cell>
|
||||||
<nut-cell
|
<nut-cell
|
||||||
v-if="payType === 'jf'"
|
|
||||||
title="积分支付"
|
title="积分支付"
|
||||||
:desc="`剩余积分:${info.integral || 0}`"
|
:desc="`剩余积分:${info.integral || 0}`"
|
||||||
is-link
|
is-link
|
||||||
@click="goPay()"
|
@click="goPay(2)"
|
||||||
>
|
>
|
||||||
<template v-slot:icon>
|
<template v-slot:icon>
|
||||||
<IconFont
|
<IconFont
|
||||||
@@ -50,26 +50,28 @@ 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 { getPersonalInfo } from "@/api/user";
|
import { getPersonalInfo } from "@/api/user";
|
||||||
|
|
||||||
const prop = defineProps({
|
const prop = defineProps({
|
||||||
|
interval: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
isShowPay: {
|
isShowPay: {
|
||||||
required: true,
|
required: true,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
payType: {
|
|
||||||
required: true,
|
|
||||||
type: String,
|
|
||||||
default: "wx",
|
|
||||||
},
|
|
||||||
jfInfo: {
|
jfInfo: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
OrderType: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["closePay", "successPay"]);
|
const emit = defineEmits(["closePay", "successPay"]);
|
||||||
@@ -96,61 +98,67 @@ const getInfo = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const goPay = async () => {
|
const goPay = async (type: number) => {
|
||||||
console.log(prop.jfInfo);
|
console.log(prop);
|
||||||
if (!prop.jfInfo)
|
if (!prop.jfInfo)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "未获取到订单信息",
|
title: "未获取到订单信息",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
if (prop.payType === "wx") {
|
try {
|
||||||
try {
|
const { data } = await payOrder({
|
||||||
const { data } = await payOrder({
|
oid: prop.jfInfo,
|
||||||
oid: prop.jfInfo.oid,
|
OrderType: prop.OrderType,
|
||||||
});
|
PayType: type,
|
||||||
Taro.requestPayment({
|
});
|
||||||
timeStamp: data.data.timeStamp,
|
if (data.data) {
|
||||||
nonceStr: data.data.nonceStr,
|
// 1微信支付 2积分支付
|
||||||
package: data.data.package,
|
if (type === 1) {
|
||||||
signType: data.data.signType,
|
Taro.requestPayment({
|
||||||
paySign: data.data.paySign,
|
timeStamp: data.data.timeStamp,
|
||||||
success: function () {
|
nonceStr: data.data.nonceStr,
|
||||||
Taro.showToast({
|
package: data.data.package,
|
||||||
title: "支付成功",
|
signType: data.data.signType,
|
||||||
icon: "success",
|
paySign: data.data.paySign,
|
||||||
duration: 2000,
|
success: function () {
|
||||||
});
|
Taro.showToast({
|
||||||
Taro.navigateTo({
|
title: "支付成功",
|
||||||
url: "/pages/hotGoods/hot_list/index",
|
icon: "success",
|
||||||
});
|
duration: 2000,
|
||||||
},
|
});
|
||||||
fail: function () {
|
emit("successPay", false);
|
||||||
Taro.showToast({
|
},
|
||||||
title: "支付失败",
|
fail: function () {
|
||||||
icon: "none",
|
Taro.showToast({
|
||||||
duration: 2000,
|
title: "支付失败",
|
||||||
});
|
icon: "none",
|
||||||
},
|
duration: 2000,
|
||||||
});
|
});
|
||||||
emit("closePay", false);
|
emit("closePay", false);
|
||||||
} catch (e) {
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
title: "支付成功",
|
||||||
|
icon: "success",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
emit("successPay", false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: e.msg,
|
title: "未知异常",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
throw e;
|
emit("closePay", false);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (e) {
|
||||||
const res = await payJfOrder(prop.jfInfo);
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: e.msg,
|
||||||
icon: "success",
|
icon: "none",
|
||||||
duration: 2000,
|
|
||||||
});
|
});
|
||||||
Taro.navigateTo({
|
// emit("closePay", false);
|
||||||
url: "/pages/users/order_list/index?type=0",
|
throw e;
|
||||||
});
|
|
||||||
emit("closePay", false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -166,13 +174,13 @@ const closePay = () => {
|
|||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.nut-popup {
|
.nut-popup {
|
||||||
.nut-popup__container {
|
.nut-popup__container {
|
||||||
border-radius: 10px;
|
border-radius: 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.div {
|
.div {
|
||||||
padding: 20px;
|
padding: 20rpx;
|
||||||
// text-align: center;
|
--nut-cell-box-shadow: none;
|
||||||
|
|
||||||
.nut-cell {
|
.nut-cell {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { getSignRecord, userSign } from "@/api/user";
|
import { userSign } from "@/api/user";
|
||||||
|
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
|
|
||||||
Taro.useLoad(async () => {
|
Taro.useLoad(async () => {
|
||||||
show.value = true;
|
if (Taro.getStorageSync("token")) show.value = true;
|
||||||
// const res = await getSignRecord()
|
// const res = await getSignRecord()
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ const closeAttr = () => {
|
|||||||
|
|
||||||
const onChooseAvatar = (e) => {
|
const onChooseAvatar = (e) => {
|
||||||
const { avatarUrl } = e.detail;
|
const { avatarUrl } = e.detail;
|
||||||
console.log(avatarUrl);
|
|
||||||
Taro.uploadFile({
|
Taro.uploadFile({
|
||||||
url: `${BASE_URL}/upload`,
|
url: `${BASE_URL}/upload`,
|
||||||
filePath: avatarUrl,
|
filePath: avatarUrl,
|
||||||
|
|||||||
@@ -142,11 +142,9 @@ const columns = ref([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const mer_type = Taro.getStorageSync("mer_type");
|
|
||||||
const user_info = Taro.getStorageSync("userInfo");
|
const user_info = Taro.getStorageSync("userInfo");
|
||||||
const res = await orderStatistics({
|
const res = await orderStatistics({
|
||||||
bid: user_info.bid,
|
bid: user_info.data.bid,
|
||||||
type: mer_type,
|
|
||||||
});
|
});
|
||||||
orderInfo.value = res.data;
|
orderInfo.value = res.data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,24 +38,26 @@
|
|||||||
}}</view> -->
|
}}</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="center">
|
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image :src="item.BindGoods.cover" />
|
<image :src="itm.Goods.cover" />
|
||||||
<view class="title">{{ item.BindGoods.name }} </view>
|
<view class="title">{{ itm.Goods.name }} </view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view>{{ item.number }}</view>
|
<view>{{ itm.pay_price }}元</view>
|
||||||
<view>x{{ item.count }}</view>
|
<view>{{ itm.pay_integral }}积分</view>
|
||||||
|
<view>x{{ itm.number }}</view>
|
||||||
</view>
|
</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>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
|
<view class="bom" style="text-align: right">
|
||||||
|
共{{ item.count }}件商品,支付方式:{{
|
||||||
|
item.pay_type === 1 ? "微信" : "积分"
|
||||||
|
}},实付:
|
||||||
|
<text style="color: red">{{
|
||||||
|
item.pay_type === 1 ? item.price : item.exchange
|
||||||
|
}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
<nut-empty v-else description="暂无订单数据"></nut-empty>
|
||||||
@@ -65,7 +67,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { getJfOrderList, getActiveOrderList } from "../../../../api/admin";
|
import { getActiveOrderList } from "../../../../api/admin";
|
||||||
|
|
||||||
const opt = ref([
|
const opt = ref([
|
||||||
{
|
{
|
||||||
@@ -101,18 +103,12 @@ Taro.useLoad((options) => {
|
|||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
try {
|
try {
|
||||||
const mer_type = Taro.getStorageSync("mer_type");
|
|
||||||
const user_info = Taro.getStorageSync("userInfo");
|
const user_info = Taro.getStorageSync("userInfo");
|
||||||
let res: any = null;
|
|
||||||
const data = {
|
const data = {
|
||||||
bid: user_info.bid,
|
bid: user_info.data.bid,
|
||||||
status: tabVal.value,
|
status: tabVal.value,
|
||||||
};
|
};
|
||||||
if (mer_type === 1) {
|
const res = await getActiveOrderList(data);
|
||||||
res = await getActiveOrderList(data);
|
|
||||||
} else {
|
|
||||||
res = await getJfOrderList(data);
|
|
||||||
}
|
|
||||||
dataList.value = res.data.data;
|
dataList.value = res.data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
|
|||||||
@@ -246,11 +246,9 @@ const setChooseValue = (ref: any) => {
|
|||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
try {
|
try {
|
||||||
const mer_type = Taro.getStorageSync("mer_type");
|
|
||||||
const user_info = Taro.getStorageSync("userInfo");
|
const user_info = Taro.getStorageSync("userInfo");
|
||||||
const res = await growthRate({
|
const res = await growthRate({
|
||||||
bid: user_info.bid,
|
bid: user_info.data.bid,
|
||||||
type: mer_type,
|
|
||||||
status: where.value.status,
|
status: where.value.status,
|
||||||
StartTime: where.value.start,
|
StartTime: where.value.start,
|
||||||
EndTime: where.value.end,
|
EndTime: where.value.end,
|
||||||
|
|||||||
@@ -31,9 +31,8 @@ const scanCode = () => {
|
|||||||
scanType: ["qrCode"],
|
scanType: ["qrCode"],
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
try {
|
try {
|
||||||
const mer_type = JSON.parse(Taro.getStorageSync("mer_type"));
|
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/admin/verify/verify_list/index?oid=${res.result}&mer_type=${mer_type}`,
|
url: `/pages/admin/verify/verify_list/index?oid=${res.result}`,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
|
|||||||
@@ -3,17 +3,29 @@
|
|||||||
<view class="card">
|
<view class="card">
|
||||||
<view>订单号:{{ goodInfo.oid }}</view>
|
<view>订单号:{{ goodInfo.oid }}</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="container">
|
<view
|
||||||
<image class="image" :src="goodInfo.cover" mode="widthFix"></image>
|
class="container"
|
||||||
|
v-for="(item, index) in goodInfo.OrderGoods"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<image class="image" :src="item.Goods.cover" mode="widthFix"></image>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="title">{{ goodInfo.goods_name }}</view>
|
<view class="title">商品名称:{{ item.Goods.name }}</view>
|
||||||
<view class="num"
|
<view class="num"
|
||||||
>数量: <text style="color: red">{{ goodInfo.count }}</text></view
|
>数量: <text style="color: red">{{ item.number }}</text></view
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
<view></view>
|
<view></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
|
<text>支付方式:{{ goodInfo.pay_type === 1 ? "微信" : "积分" }}</text
|
||||||
|
>,
|
||||||
|
<text
|
||||||
|
>总计:{{
|
||||||
|
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
|
||||||
|
}}</text
|
||||||
|
>
|
||||||
|
<view class="line"></view>
|
||||||
<view class="cz">
|
<view class="cz">
|
||||||
<nut-button size="small" type="primary" @click="subVerify"
|
<nut-button size="small" type="primary" @click="subVerify"
|
||||||
>确定核销</nut-button
|
>确定核销</nut-button
|
||||||
@@ -25,12 +37,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import {
|
import { getActiveVerifyList, activeOrderVerify } from "@/api/admin";
|
||||||
getJfVerifyList,
|
|
||||||
getActiveVerifyList,
|
|
||||||
activeOrderVerify,
|
|
||||||
orderVerify,
|
|
||||||
} from "@/api/admin";
|
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
const opt = ref<any>({});
|
const opt = ref<any>({});
|
||||||
@@ -43,16 +50,9 @@ Taro.useLoad((options) => {
|
|||||||
const goodInfo = ref<any>({});
|
const goodInfo = ref<any>({});
|
||||||
|
|
||||||
const getData = async (options: any) => {
|
const getData = async (options: any) => {
|
||||||
let res;
|
const res = await getActiveVerifyList({
|
||||||
if (Number(options.mer_type) === 1) {
|
oid: options.oid,
|
||||||
res = await getActiveVerifyList({
|
});
|
||||||
oid: options.oid,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
res = await getJfVerifyList({
|
|
||||||
oid: options.oid,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!res.data.data.oid) {
|
if (!res.data.data.oid) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "没有此订单",
|
title: "没有此订单",
|
||||||
@@ -69,16 +69,9 @@ const getData = async (options: any) => {
|
|||||||
|
|
||||||
const subVerify = async () => {
|
const subVerify = async () => {
|
||||||
try {
|
try {
|
||||||
let res;
|
const res = await activeOrderVerify({
|
||||||
if (Number(opt.value.mer_type) === 1) {
|
oid: goodInfo.value.oid,
|
||||||
res = await activeOrderVerify({
|
});
|
||||||
oid: goodInfo.value.oid,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
res = await orderVerify({
|
|
||||||
oid: goodInfo.value.oid,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
@@ -110,8 +103,8 @@ const subVerify = async () => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 200px;
|
width: 150rpx;
|
||||||
height: 100%;
|
height: 150rpx;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,106 +1,200 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view v-if="list.length > 0">
|
<view v-if="list.length > 0">
|
||||||
<nut-swipe v-for="(item, index) in list" :key="index">
|
<nut-cell-group v-for="(itm, idx) in list" :key="idx">
|
||||||
<view class="item">
|
<nut-cell>
|
||||||
<nut-checkbox v-model="item.checkbox" @click="select">{{
|
<nut-checkbox
|
||||||
item.ID
|
v-model="itm.state.checkbox"
|
||||||
}}</nut-checkbox>
|
:indeterminate="itm.state.indeterminate"
|
||||||
<image
|
@change="(val: boolean) => changeBoxAll(val,idx)"
|
||||||
src="https://s2.loli.net/2023/08/16/6KgdSQa4WRoT3sz.jpg"
|
>{{ itm.StoreName }}
|
||||||
style="width: 100px; height: 100px"
|
</nut-checkbox>
|
||||||
/>
|
</nut-cell>
|
||||||
<view class="text">
|
<nut-checkbox-group
|
||||||
<view>{{ item.name }}</view>
|
v-model="itm.state.checkboxgroup"
|
||||||
<view class="bom">
|
:ref="(el) => getGroup(el, idx)"
|
||||||
<nut-price
|
@change="(label) => changeBox(label, itm)"
|
||||||
:price="item.number"
|
>
|
||||||
size="normal"
|
<nut-cell v-for="(item, idx1) in itm.Goods" :key="idx1">
|
||||||
:need-symbol="false"
|
<nut-checkbox :label="item.gid" style="width: 10%"></nut-checkbox>
|
||||||
/>
|
<view class="box">
|
||||||
|
<view class="box-left">
|
||||||
|
<img class="cover" :src="item.cover" alt="" />
|
||||||
|
<view class="center">
|
||||||
|
<view>{{ item.name }}</view>
|
||||||
|
<view class="price">
|
||||||
|
<view>{{ item.price }} 元</view>
|
||||||
|
<view>{{ item.exchange }} 积分</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<nut-input-number
|
<nut-input-number
|
||||||
|
v-model="item.number"
|
||||||
readonly
|
readonly
|
||||||
@add="select()"
|
:min="-1"
|
||||||
@reduce="select()"
|
@add.stop="() => onAdd(item)"
|
||||||
v-model="item.count"
|
@reduce.stop="() => onReduce(item)"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</nut-cell>
|
||||||
</view>
|
</nut-checkbox-group>
|
||||||
<template #right>
|
</nut-cell-group>
|
||||||
<nut-button shape="square" style="height: 100%" type="danger"
|
|
||||||
>删除</nut-button
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
</nut-swipe>
|
|
||||||
</view>
|
</view>
|
||||||
<nut-empty v-else description="购物车暂无数据">
|
<nut-empty v-else description="购物车暂无数据"></nut-empty>
|
||||||
<!-- <nut-button icon="refresh" type="primary" @click="toPage()">去兑换商品</nut-button>-->
|
|
||||||
</nut-empty>
|
|
||||||
<view>
|
<view>
|
||||||
<view style="height: 100px"></view>
|
<view style="height: 100rpx"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom-box">
|
<view class="bottom-box">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<nut-checkbox v-model="selectAllVal" @change="selectAll"
|
<!-- <nut-checkbox v-model="selectAllVal" @change="selectAll"
|
||||||
>全选</nut-checkbox
|
>全选
|
||||||
>
|
</nut-checkbox> -->
|
||||||
<view class="text-box">
|
<view>
|
||||||
总计积分:
|
<view class="text-box">
|
||||||
<nut-price
|
总金额:
|
||||||
v-model:price="localCount"
|
<nut-price
|
||||||
size="normal"
|
v-model:price="localCount.price"
|
||||||
:need-symbol="false"
|
size="normal"
|
||||||
/>
|
:need-symbol="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="text-box">
|
||||||
|
总积分:
|
||||||
|
<nut-price
|
||||||
|
v-model:price="localCount.exchange"
|
||||||
|
size="normal"
|
||||||
|
:need-symbol="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<nut-button type="primary" @click="sub">去结算</nut-button>
|
<nut-button type="primary" @click="sub">去结算</nut-button>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 支付 -->
|
||||||
|
<Pay
|
||||||
|
:is-show-pay="isShowPay"
|
||||||
|
:interval="true"
|
||||||
|
v-model:jfInfo="orderData"
|
||||||
|
@closePay="closePay"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { nextTick, ref } from "vue";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { getCartList } from "@/api/goods";
|
import { addCart, getAllCart } from "@/api/cart";
|
||||||
|
import { createActiveOrder } from "@/api/goods";
|
||||||
|
import Pay from "@/components/Pay.vue";
|
||||||
|
|
||||||
const selectAllVal = ref(false);
|
interface CardList {
|
||||||
|
name: string;
|
||||||
|
cover: string;
|
||||||
|
bid: string;
|
||||||
|
gid: string;
|
||||||
|
number: string;
|
||||||
|
price: number;
|
||||||
|
exchange: number;
|
||||||
|
}
|
||||||
|
|
||||||
const list = ref([]);
|
// const selectAllVal = ref(false);
|
||||||
|
|
||||||
const localCount = ref(0);
|
interface List {
|
||||||
|
StoreName: string;
|
||||||
|
Goods: CardList[];
|
||||||
|
state: {
|
||||||
|
checkbox: boolean;
|
||||||
|
indeterminate: boolean;
|
||||||
|
checkboxgroup: string[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const list = ref<List[]>([]);
|
||||||
|
|
||||||
|
const groupList = ref(new Map());
|
||||||
|
|
||||||
|
const localCount = ref({
|
||||||
|
price: 0,
|
||||||
|
exchange: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const getGroup = (el: any, idx: number) => {
|
||||||
|
return groupList.value.set(idx, el);
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeBoxAll = async (value: boolean, idx: number) => {
|
||||||
|
await nextTick(() => {
|
||||||
|
groupList.value.get(idx).toggleAll(value);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const changeBox = (label: string[], item: any) => {
|
||||||
|
localCount.value = {
|
||||||
|
price: 0,
|
||||||
|
exchange: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
item["Count"] = {
|
||||||
|
priceCount: 0,
|
||||||
|
exchangeCount: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (label.length > 0) {
|
||||||
|
label.forEach((id: string) => {
|
||||||
|
item.Goods.forEach((itm: any) => {
|
||||||
|
if (itm.gid === id) {
|
||||||
|
item["Count"].priceCount += itm.price * itm.number;
|
||||||
|
item["Count"].exchangeCount += itm.exchange * itm.number;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
list.value.forEach((item: any) => {
|
||||||
|
localCount.value.price += item.Count.priceCount;
|
||||||
|
localCount.value.exchange += item.Count.exchangeCount;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (label.length === item.Goods.length) {
|
||||||
|
item.state.checkbox = true;
|
||||||
|
item.state.indeterminate = false;
|
||||||
|
} else if (label.length && label.length < item.Goods.length) {
|
||||||
|
item.state.indeterminate = true;
|
||||||
|
} else {
|
||||||
|
item.state.indeterminate = false;
|
||||||
|
item.state.checkbox = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Taro.useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const select = () => {
|
// const selectAll = () => {
|
||||||
localCount.value = 0;
|
// localCount.value = {
|
||||||
list.value.forEach((item: any) => {
|
// price: 0,
|
||||||
if (item.checkbox) {
|
// exchange: 0,
|
||||||
setTimeout(() => {
|
// };
|
||||||
item.countNum = Number(item.number) * Number(item.count);
|
// groupList.value.forEach((item: any) => {
|
||||||
localCount.value += item.countNum;
|
// item.toggleAll(selectAllVal.value);
|
||||||
console.log(localCount.value);
|
// });
|
||||||
}, 1);
|
// list.value.forEach((item: any) => {
|
||||||
selectAllVal.value = true;
|
// if (item.state.checkboxgroup.length > 0) {
|
||||||
} else {
|
// item.Goods.forEach((itm: any) => {
|
||||||
selectAllVal.value = false;
|
// localCount.value.price += itm.price;
|
||||||
}
|
// localCount.value.exchange += itm.exchange;
|
||||||
});
|
// });
|
||||||
};
|
// }
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
const selectAll = () => {
|
const isShowPay = ref(false);
|
||||||
localCount.value = 0;
|
const orderData = ref<any>([]);
|
||||||
list.value.forEach((item: any) => {
|
|
||||||
item.checkbox = selectAllVal.value;
|
|
||||||
});
|
|
||||||
select();
|
|
||||||
console.log(list.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const sub = () => {
|
const sub = async () => {
|
||||||
const arr = list.value.filter((item: any) => item.checkbox);
|
const arr: any = list.value.filter(
|
||||||
|
(item: any) => item.state.checkboxgroup.length > 0
|
||||||
|
);
|
||||||
if (arr.length === 0) {
|
if (arr.length === 0) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "请选择商品",
|
title: "请选择商品",
|
||||||
@@ -109,27 +203,89 @@ const sub = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { data: res } = await createActiveOrder({
|
||||||
|
Bid: arr.map((item: any) => item.StoreBid),
|
||||||
|
});
|
||||||
|
if (res.oid) {
|
||||||
|
orderData.value = res?.oid;
|
||||||
|
isShowPay.value = true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: e.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const closePay = async (val: boolean) => {
|
||||||
|
isShowPay.value = val;
|
||||||
|
orderData.value = [];
|
||||||
|
await getList();
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: "/pages/goods/order_create/index",
|
url: "/pages/users/order_list/index?type=0",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
const res = await getCartList();
|
localCount.value = {
|
||||||
list.value = res.data.data.Goods.map((item: any) => {
|
price: 0,
|
||||||
return {
|
exchange: 0,
|
||||||
|
};
|
||||||
|
const res = await getAllCart();
|
||||||
|
list.value = res.data.data || [];
|
||||||
|
if (list.value.length > 0) {
|
||||||
|
list.value = list.value.map((item: any) => ({
|
||||||
...item,
|
...item,
|
||||||
count: 1,
|
Goods: item.Goods.sort(
|
||||||
countNum: item.number,
|
(a: CardList, b: CardList) => Number(a.gid) - Number(b.gid)
|
||||||
checkbox: false,
|
),
|
||||||
};
|
state: {
|
||||||
});
|
indeterminate: false,
|
||||||
|
checkbox: false,
|
||||||
|
checkboxgroup: [],
|
||||||
|
},
|
||||||
|
Count: {
|
||||||
|
priceCount: 0,
|
||||||
|
exchangeCount: 0,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toPage = () => {
|
// const toPage = () => {
|
||||||
Taro.switchTab({
|
// Taro.switchTab({
|
||||||
url: "/pages/index/index",
|
// url: "/pages/index/index",
|
||||||
});
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
|
const onAdd = async (item: CardList) => {
|
||||||
|
await add_cart(item, Number(item.number) + 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onReduce = async (item: CardList) => {
|
||||||
|
await add_cart(item, Number(item.number) - 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const add_cart = async (item: CardList, num: number = 1) => {
|
||||||
|
try {
|
||||||
|
const res = await addCart({
|
||||||
|
Bid: item.bid,
|
||||||
|
Gid: item.gid,
|
||||||
|
Number: Number(num),
|
||||||
|
});
|
||||||
|
Taro.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
await getList();
|
||||||
|
} catch (e) {
|
||||||
|
Taro.showToast({
|
||||||
|
title: e.msg,
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -141,33 +297,34 @@ const toPage = () => {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.box {
|
||||||
margin-top: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
background-color: white;
|
|
||||||
display: flex;
|
|
||||||
justify-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
image {
|
.box-left {
|
||||||
width: 200px;
|
|
||||||
height: 150px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text {
|
|
||||||
width: 60%;
|
|
||||||
margin-left: 20px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
padding: 20px;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.bom {
|
.cover {
|
||||||
|
width: 130rpx;
|
||||||
|
height: 130rpx;
|
||||||
|
margin-right: 15rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
flex-direction: column;
|
||||||
align-items: center;
|
justify-content: space-around;
|
||||||
|
|
||||||
|
.price {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,20 +336,21 @@ const toPage = () => {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100px;
|
height: 100rpx;
|
||||||
z-index: 999;
|
z-index: 9999;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 20px;
|
padding: 0 20rpx;
|
||||||
box-shadow: 100px 104px 288px rgba(0, 0, 0, 0.01);
|
box-shadow: 100rpx 104rpx 288rpx rgba(0, 0, 0, 0.01);
|
||||||
|
border-top: 1rpx solid #f5f5f5;
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.text-box {
|
.text-box {
|
||||||
margin-left: 10px;
|
margin-left: 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import { useLoad, getStorageSync } from "@tarojs/taro";
|
|||||||
const url = ref("");
|
const url = ref("");
|
||||||
|
|
||||||
useLoad(() => {
|
useLoad(() => {
|
||||||
const user = getStorageSync("userInfo");
|
// const user = getStorageSync("userInfo");
|
||||||
url.value = `${process.env.TARO_APP_GAME}${user.uid}`;
|
url.value = `${process.env.TARO_APP_GAME}${getStorageSync("token")}`;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -20,18 +20,31 @@
|
|||||||
<!-- 标题价格 -->
|
<!-- 标题价格 -->
|
||||||
<view class="card">
|
<view class="card">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<nut-price
|
<view class="price">
|
||||||
size="large"
|
<nut-price
|
||||||
:price="goodInfo.number as number"
|
size="normal"
|
||||||
position="after"
|
:price="goodInfo.number as number"
|
||||||
:symbol="payType === 'jf' ? '积分' : '元'"
|
position="after"
|
||||||
/>
|
symbol="元"
|
||||||
<view class="stock"> 库存剩余:{{ goodInfo.stock }} </view>
|
/>
|
||||||
|
<nut-price
|
||||||
|
size="normal"
|
||||||
|
:price="goodInfo.exchange as number"
|
||||||
|
position="after"
|
||||||
|
symbol="积分"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="stock"> 库存剩余:{{ goodInfo.stock }}</view>
|
||||||
</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>
|
||||||
|
<nut-button size="small" type="primary" @click.stop="add_cart(goodInfo)">
|
||||||
|
<template #icon>
|
||||||
|
<Cart2 />
|
||||||
|
</template>
|
||||||
|
</nut-button>
|
||||||
</view>
|
</view>
|
||||||
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
|
|
||||||
<!-- 产品介绍 -->
|
<!-- 产品介绍 -->
|
||||||
<view class="rich-box">
|
<view class="rich-box">
|
||||||
<view class="title">产品介绍</view>
|
<view class="title">产品介绍</view>
|
||||||
@@ -44,142 +57,56 @@
|
|||||||
</view>
|
</view>
|
||||||
<view style="height: 9vh"></view>
|
<view style="height: 9vh"></view>
|
||||||
<!-- 底部 -->
|
<!-- 底部 -->
|
||||||
<view class="bottom-box">
|
<!-- 购物车 -->
|
||||||
<view class="left">
|
<cart ref="cartRef" :mer-info="mer_info" @update-cart="updateCartNum" />
|
||||||
<view class="icon" @click="toPage('/pages/index/index')">
|
|
||||||
<Home />
|
|
||||||
<view>首页</view>
|
|
||||||
</view>
|
|
||||||
<!-- <view-->
|
|
||||||
<!-- class="icon"-->
|
|
||||||
<!-- v-if="payType === 'jf'"-->
|
|
||||||
<!-- @click="toPage('/pages/cart/index')"-->
|
|
||||||
<!-- >-->
|
|
||||||
<!-- <Cart/>-->
|
|
||||||
<!-- <view>购物车</view>-->
|
|
||||||
<!-- </view>-->
|
|
||||||
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
|
|
||||||
<My />
|
|
||||||
<view>客服</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 占位 -->
|
|
||||||
|
|
||||||
<view style="width: 80%">
|
|
||||||
<!-- <nut-button-->
|
|
||||||
<!-- v-if="payType === 'jf'"-->
|
|
||||||
<!-- style="margin-right: 10px"-->
|
|
||||||
<!-- type="warning"-->
|
|
||||||
<!-- @click="add_cart()"-->
|
|
||||||
<!-- >加入购物车-->
|
|
||||||
<!-- </nut-button>-->
|
|
||||||
<nut-button type="primary" block @click="toOrderDetail()"
|
|
||||||
>{{ payType === "jf" ? "立即兑换" : "立即购买" }}
|
|
||||||
</nut-button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 规格选择 -->
|
|
||||||
<nut-popup
|
|
||||||
position="bottom"
|
|
||||||
overlay-class="overlay"
|
|
||||||
safe-area-inset-bottom
|
|
||||||
closeable
|
|
||||||
round
|
|
||||||
:style="{ zIndex: 1 }"
|
|
||||||
v-model:visible="isSkuShow"
|
|
||||||
>
|
|
||||||
<view class="sku-box">
|
|
||||||
<view>商品规格</view>
|
|
||||||
<nut-cell-group>
|
|
||||||
<nut-cell title="数量:">
|
|
||||||
<template v-slot:link>
|
|
||||||
<nut-input-number
|
|
||||||
v-model="count"
|
|
||||||
@change="addCount"
|
|
||||||
button-size="30"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</nut-cell>
|
|
||||||
</nut-cell-group>
|
|
||||||
</view>
|
|
||||||
</nut-popup>
|
|
||||||
<!-- <nut-sku
|
|
||||||
v-model:visible="isSkuShow"
|
|
||||||
:sku="sku"
|
|
||||||
:goods="goods"
|
|
||||||
@selectSku="selectSku"
|
|
||||||
@clickBtnOperate="clickBtnOperate"
|
|
||||||
@close="close"
|
|
||||||
></nut-sku> -->
|
|
||||||
<Pay
|
|
||||||
:is-show-pay="isShowPay"
|
|
||||||
:pay-type="payType"
|
|
||||||
v-model:jfInfo="orderData"
|
|
||||||
@closePay="closePay"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
|
import { Ref, ref } from "vue";
|
||||||
import { ref } from "vue";
|
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { Home, Left, My } from "@nutui/icons-vue-taro";
|
import { Home, Left } from "@nutui/icons-vue-taro";
|
||||||
import {
|
import { getActiveGoodsDetail } from "@/api/goods";
|
||||||
createActiveOrder,
|
import Cart from "@/components/Cart.vue";
|
||||||
createOrder,
|
import { Cart2 } from "@nutui/icons-vue-taro";
|
||||||
getActiveGoodsDetail,
|
import { nextTick } from "vue";
|
||||||
getGoodsDetail,
|
|
||||||
} from "@/api/goods";
|
|
||||||
import Pay from "@/components/Pay.vue";
|
|
||||||
|
|
||||||
|
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
|
||||||
const BarHeight = ref((statusBarHeight as number) + 7);
|
const BarHeight = ref((statusBarHeight as number) + 7);
|
||||||
|
|
||||||
const swiperList = ref([]);
|
const swiperList = ref([]);
|
||||||
|
|
||||||
const isSkuShow = ref(false);
|
|
||||||
|
|
||||||
const isShowPay = ref(false);
|
|
||||||
|
|
||||||
// const sku = ref([]);
|
|
||||||
|
|
||||||
const payType = ref("");
|
|
||||||
|
|
||||||
const orderData = ref([]);
|
|
||||||
|
|
||||||
const count = ref(1);
|
|
||||||
|
|
||||||
interface GoodInfo {
|
interface GoodInfo {
|
||||||
gid?: number;
|
gid?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
number?: number;
|
number?: number;
|
||||||
|
exchange?: number;
|
||||||
cover?: string;
|
cover?: string;
|
||||||
details?: string;
|
details?: string;
|
||||||
sku?: any[];
|
sku?: any[];
|
||||||
stock?: number;
|
stock?: number;
|
||||||
profile?: string;
|
profile?: string;
|
||||||
|
price?: number;
|
||||||
|
cartNum?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const goodInfo = ref<GoodInfo>({});
|
const goodInfo = ref<GoodInfo>({});
|
||||||
|
|
||||||
Taro.useLoad((options) => {
|
Taro.useLoad(async (options) => {
|
||||||
payType.value = options.type === "1" ? "wx" : "jf";
|
await get_good_detail(options.gid);
|
||||||
get_good_detail(options.gid);
|
mer_info.value = Taro.getStorageSync("mer_info");
|
||||||
|
await nextTick(async () => {
|
||||||
|
await cartRef.value.get_cart_list();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const get_good_detail = async (gid: string) => {
|
const get_good_detail = async (gid: string) => {
|
||||||
try {
|
try {
|
||||||
let res: any;
|
const res = await getActiveGoodsDetail({ gid: gid });
|
||||||
if (payType.value === "jf") {
|
|
||||||
res = await getGoodsDetail({ gid: gid });
|
|
||||||
} else {
|
|
||||||
res = await getActiveGoodsDetail({ gid: gid });
|
|
||||||
}
|
|
||||||
goodInfo.value = {
|
goodInfo.value = {
|
||||||
...res.data.data,
|
...res.data.data,
|
||||||
// details: res.data.data.details.,
|
// details: res.data.data.details.,
|
||||||
};
|
};
|
||||||
|
|
||||||
swiperList.value = res.data.data.rotation.split(",");
|
swiperList.value = res.data.data.rotation.split(",");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@@ -189,17 +116,6 @@ const get_good_detail = async (gid: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const addCount = () => {
|
|
||||||
if (count.value >= (goodInfo.value.stock as number)) {
|
|
||||||
count.value = goodInfo.value.stock as number;
|
|
||||||
Taro.showToast({
|
|
||||||
title: "库存不足",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const returns = () => {
|
const returns = () => {
|
||||||
Taro.navigateBack({
|
Taro.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
@@ -212,100 +128,36 @@ const goHome = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const openSku = () => {
|
interface CartItems {
|
||||||
isSkuShow.value = true;
|
bid: string;
|
||||||
|
gid: string;
|
||||||
|
number: number;
|
||||||
|
price: number;
|
||||||
|
cover: string;
|
||||||
|
name: string;
|
||||||
|
exchange: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mer_info = ref<any>({});
|
||||||
|
|
||||||
|
const cartRef = ref(null) as Ref;
|
||||||
|
|
||||||
|
const add_cart = async (item: any) => {
|
||||||
|
const num = item.cartNum ? Number(item.cartNum) + 1 : 1;
|
||||||
|
await nextTick(async () => {
|
||||||
|
await cartRef.value.add_cart(item, num);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// const selectSku = () => {};
|
const updateCartNum = (cartItems: CartItems[]) => {
|
||||||
// const clickBtnOperate = () => {};
|
if (cartItems.length > 0) {
|
||||||
// const close = () => {};
|
cartItems.forEach((cartItem: CartItems) => {
|
||||||
// const add_cart = async () => {
|
if (goodInfo.value.gid === cartItem.gid) {
|
||||||
// if (isSkuShow.value === false) return openSku();
|
goodInfo.value.cartNum = cartItem.number;
|
||||||
// try {
|
}
|
||||||
// await addCart({ gid: goodInfo.value.gid });
|
|
||||||
// Taro.showToast({
|
|
||||||
// title: "加入购物车成功",
|
|
||||||
// icon: "success",
|
|
||||||
// duration: 2000,
|
|
||||||
// });
|
|
||||||
// } catch (e) {
|
|
||||||
// Taro.showToast({
|
|
||||||
// title: e.msg,
|
|
||||||
// icon: "none",
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// isSkuShow.value = false;
|
|
||||||
// };
|
|
||||||
|
|
||||||
const toOrderDetail = async () => {
|
|
||||||
if (!Taro.getStorageSync("token")) {
|
|
||||||
return Taro.showModal({
|
|
||||||
title: "提示",
|
|
||||||
content: "你还没登录,请先登录",
|
|
||||||
cancelText: "先逛逛",
|
|
||||||
confirmText: "去登录",
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
Taro.reLaunch({
|
|
||||||
url: "/pages/users/login/index",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (isSkuShow.value === false) return openSku();
|
|
||||||
// Taro.navigateTo({
|
|
||||||
// url: '/pages/goods/order_create/index'
|
|
||||||
// })
|
|
||||||
try {
|
|
||||||
let res: any;
|
|
||||||
if (payType.value === "jf") {
|
|
||||||
res = await createOrder([
|
|
||||||
{
|
|
||||||
gid: goodInfo.value.gid,
|
|
||||||
count: Number(count.value),
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
} else {
|
|
||||||
res = await createActiveOrder({
|
|
||||||
gid: goodInfo.value.gid,
|
|
||||||
stock: Number(count.value),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
orderData.value = res?.data?.data;
|
|
||||||
|
|
||||||
isShowPay.value = true;
|
|
||||||
|
|
||||||
count.value = 1;
|
|
||||||
} catch (e) {
|
|
||||||
Taro.showToast({
|
|
||||||
title: e.msg,
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
isSkuShow.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const closePay = (val: boolean) => {
|
|
||||||
isShowPay.value = val;
|
|
||||||
orderData.value = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
const toPage = (url: string, type: number = 1) => {
|
|
||||||
if (type === 1) {
|
|
||||||
Taro.switchTab({
|
|
||||||
url: url,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Taro.navigateTo({
|
Reflect.deleteProperty(goodInfo.value, "cartNum");
|
||||||
// url: url,
|
|
||||||
// });
|
|
||||||
Taro.showToast({
|
|
||||||
title: "暂未开放",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -313,7 +165,6 @@ const toPage = (url: string, type: number = 1) => {
|
|||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
--nut-cell-box-shadow: none;
|
--nut-cell-box-shadow: none;
|
||||||
// --nut-cell-padding: 0;
|
|
||||||
--nut-cell-title-font: 30px;
|
--nut-cell-title-font: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,12 +208,18 @@ page {
|
|||||||
.card {
|
.card {
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
.price {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -378,6 +235,13 @@ page {
|
|||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nut-button {
|
||||||
|
// margin: 10px;
|
||||||
|
position: absolute;
|
||||||
|
right: 40rpx;
|
||||||
|
bottom: 20rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.rich-box {
|
.rich-box {
|
||||||
@@ -396,12 +260,6 @@ page {
|
|||||||
|
|
||||||
.rich {
|
.rich {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
// img {
|
|
||||||
// width: 100%;
|
|
||||||
// height: auto;
|
|
||||||
// display: block;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,7 +305,6 @@ page {
|
|||||||
color: #333;
|
color: #333;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
// margin-right: 100px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,21 +200,23 @@ const delOrder = async (oid: string) => {
|
|||||||
<view class="order-card" v-for="(item, index) in orderList" :key="index">
|
<view class="order-card" v-for="(item, index) in orderList" :key="index">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view>{{ item.add_time.slice(0, 19).replace("T", " ") }}</view>
|
<view>{{ item.add_time.slice(0, 19).replace("T", " ") }}</view>
|
||||||
<view style="color: red">{{
|
<view style="color: red"
|
||||||
item.status === 0
|
>{{
|
||||||
? "待付款"
|
item.status === 0
|
||||||
: item.status === 1
|
? "待付款"
|
||||||
? "待使用"
|
: item.status === 1
|
||||||
: item.status === 2
|
? "待使用"
|
||||||
? "已使用"
|
: item.status === 2
|
||||||
: "已失效"
|
? "已使用"
|
||||||
}}</view>
|
: "已失效"
|
||||||
|
}}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="center">
|
<view class="center">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image :src="item.BindGoods.cover" />
|
<image :src="item.BindGoods.cover" />
|
||||||
<view class="title">{{ item.BindGoods.name }} </view>
|
<view class="title">{{ item.BindGoods.name }}</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view>{{ item.number }}</view>
|
<view>{{ item.number }}</view>
|
||||||
<!-- <view>x{{ item.count }}</view> -->
|
<!-- <view>x{{ item.count }}</view> -->
|
||||||
|
|||||||
@@ -9,11 +9,20 @@
|
|||||||
<nut-swiper
|
<nut-swiper
|
||||||
:init-page="0"
|
:init-page="0"
|
||||||
:pagination-visible="true"
|
:pagination-visible="true"
|
||||||
pagination-color="#426543"
|
pagination-color="#000"
|
||||||
auto-play="3000"
|
duration="1000"
|
||||||
|
:loop="false"
|
||||||
>
|
>
|
||||||
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
||||||
<img :alt="itm.ID.toString()" :src="itm.url" />
|
<view
|
||||||
|
class="item"
|
||||||
|
v-for="(item, index) in itm"
|
||||||
|
:key="index"
|
||||||
|
@click="toDetails(item)"
|
||||||
|
>
|
||||||
|
<image :src="item.icon" />
|
||||||
|
<text>{{ item.name }}</text>
|
||||||
|
</view>
|
||||||
</nut-swiper-item>
|
</nut-swiper-item>
|
||||||
</nut-swiper>
|
</nut-swiper>
|
||||||
<!-- 金刚区 -->
|
<!-- 金刚区 -->
|
||||||
@@ -29,29 +38,7 @@
|
|||||||
</nut-grid-item>
|
</nut-grid-item>
|
||||||
</nut-grid>
|
</nut-grid>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodBox">
|
<MerList />
|
||||||
<view
|
|
||||||
class="good"
|
|
||||||
v-for="item in (merdata as any[])"
|
|
||||||
:key="item.ID"
|
|
||||||
@click.stop="toMerDetails(item)"
|
|
||||||
>
|
|
||||||
<image :src="(item.head_photo as string)" />
|
|
||||||
<view class="good-text-box">
|
|
||||||
<text class="good-text">{{ item.name }}</text>
|
|
||||||
<text style="color: #999"
|
|
||||||
>距离我{{
|
|
||||||
calculateDistance(
|
|
||||||
userLocalNum.t,
|
|
||||||
userLocalNum.l,
|
|
||||||
Number(item.lat),
|
|
||||||
Number(item.lon)
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 签到弹窗 -->
|
<!-- 签到弹窗 -->
|
||||||
<Popup />
|
<Popup />
|
||||||
</view>
|
</view>
|
||||||
@@ -60,59 +47,50 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { bindParent, getBanner } from "@/api/user";
|
|
||||||
import { getMerList } from "@/api/goods";
|
|
||||||
import { calculateDistance } from "@/utils";
|
|
||||||
import Popup from "@/components/Popup.vue";
|
import Popup from "@/components/Popup.vue";
|
||||||
|
import MerList from "@/components/MerList.vue";
|
||||||
|
import { getHomeList } from "@/api/home";
|
||||||
|
|
||||||
const searchValue = ref("");
|
const searchValue = ref("");
|
||||||
|
|
||||||
const swiperList = ref<any>([]);
|
interface SwiperList {
|
||||||
|
ID: number;
|
||||||
|
icon: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const swiperList = ref<Array<Array<SwiperList>>>([]);
|
||||||
|
|
||||||
const userMenuList = ref([
|
const userMenuList = ref([
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
label: "活动游戏",
|
label: "活动游戏",
|
||||||
url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync("token")}`,
|
url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync("token")}`,
|
||||||
icon: "http://jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png",
|
icon: "//jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
label: "活动商品",
|
label: "活动商品",
|
||||||
url: "/pages/hotGoods/index/index",
|
// url: "/pages/hotGoods/index/index",
|
||||||
icon: "http://jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
|
url: "",
|
||||||
|
icon: "//jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
label: "商户入驻",
|
label: "商户入驻",
|
||||||
url: "/pages/users/settled_mer/index",
|
url: "/pages/users/settled_mer/index",
|
||||||
icon: "http://jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png",
|
icon: "//jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
label: "最新资讯",
|
label: "最新资讯",
|
||||||
url: "",
|
url: "",
|
||||||
icon: "http://jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png",
|
icon: "//jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Taro.useDidShow(async () => {
|
Taro.useDidShow(async () => {
|
||||||
await getBannerList();
|
await getBannerList();
|
||||||
await get_mer_list();
|
|
||||||
if (Taro.getStorageSync("token") && Taro.getStorageSync("bind_id")) {
|
|
||||||
try {
|
|
||||||
const res = await bindParent({
|
|
||||||
uid: Taro.getStorageSync("bind_id"),
|
|
||||||
});
|
|
||||||
Taro.showToast({
|
|
||||||
title: res.msg,
|
|
||||||
});
|
|
||||||
Taro.removeStorageSync("bind_id");
|
|
||||||
} catch (error) {
|
|
||||||
Taro.removeStorageSync("bind_id");
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Taro.useShareAppMessage(() => ({
|
Taro.useShareAppMessage(() => ({
|
||||||
@@ -122,34 +100,23 @@ Taro.useShareAppMessage(() => ({
|
|||||||
"https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg",
|
"https://upload.jdt168.com/1694242954957988438_微信图片_20230909150016.jpg",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const merdata = ref([]);
|
|
||||||
|
|
||||||
const userLocalNum = ref({
|
|
||||||
l: 0,
|
|
||||||
t: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
const get_mer_list = async () => {
|
|
||||||
Taro.getLocation({
|
|
||||||
type: "wgs84",
|
|
||||||
success: (res) => {
|
|
||||||
userLocalNum.value.l = res.longitude;
|
|
||||||
userLocalNum.value.t = res.latitude;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const res = await getMerList({
|
|
||||||
PageNum: 1,
|
|
||||||
PageSize: 10,
|
|
||||||
Btype: 2,
|
|
||||||
classid: 0,
|
|
||||||
});
|
|
||||||
merdata.value = res.data.data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getBannerList = async () => {
|
const getBannerList = async () => {
|
||||||
const { data }: any = await getBanner();
|
const { data } = await getHomeList();
|
||||||
swiperList.value = data.data;
|
if (data.data.length > 0) {
|
||||||
|
// for (let i = 0; i < 31; i++) {
|
||||||
|
// data.data.push({
|
||||||
|
// ID: i,
|
||||||
|
// icon: "//jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
|
||||||
|
// name: "活动商品",
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// 数组分组
|
||||||
|
const arr = [];
|
||||||
|
for (let i = 0; i < data.data.length; i += 10) {
|
||||||
|
arr.push(data.data.slice(i, i + 10));
|
||||||
|
}
|
||||||
|
swiperList.value = arr;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toPage = (url: string) => {
|
const toPage = (url: string) => {
|
||||||
@@ -158,18 +125,33 @@ const toPage = (url: string) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const toMerDetails = (item: any) => {
|
const toDetails = (item: SwiperList) => {
|
||||||
Taro.setStorageSync("mer_info", item);
|
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/mer/mer_detail/index`,
|
url: `/pages/search/index?id=${item.ID}&name=${item.name}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.nut-swiper-item img {
|
.nut-swiper {
|
||||||
width: 100%;
|
background: #ffffff;
|
||||||
height: 350px;
|
|
||||||
|
.nut-swiper-item {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, 1fr);
|
||||||
|
|
||||||
|
.item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.titleImg {
|
.titleImg {
|
||||||
@@ -195,57 +177,4 @@ const toMerDetails = (item: any) => {
|
|||||||
height: 80px;
|
height: 80px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.goodBox {
|
|
||||||
display: flex;
|
|
||||||
padding: 20px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.good {
|
|
||||||
width: 340px;
|
|
||||||
background-color: #fff;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100%;
|
|
||||||
height: 250px;
|
|
||||||
border-top-right-radius: 10px;
|
|
||||||
border-top-left-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.good-text-box {
|
|
||||||
padding: 10px;
|
|
||||||
|
|
||||||
.good-text {
|
|
||||||
flex-shrink: 0;
|
|
||||||
font-size: 28px;
|
|
||||||
color: #333;
|
|
||||||
font-weight: 400;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
word-break: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
.good-price-box {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-top: 10px;
|
|
||||||
|
|
||||||
.good-text-price {
|
|
||||||
font-size: 28px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #ff0000;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
-webkit-line-clamp: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
pagination-color="red"
|
pagination-color="red"
|
||||||
auto-play="3000"
|
auto-play="3000"
|
||||||
>
|
>
|
||||||
<nut-swiper-item v-for="(itm, idx) in (swiperList as any)" :key="idx">
|
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
||||||
<img
|
<img
|
||||||
style="width: 100%; height: 100%"
|
style="width: 100%; height: 100%"
|
||||||
:src="itm"
|
:src="itm"
|
||||||
@@ -45,9 +45,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 商品列表 -->
|
<!-- 商品列表 -->
|
||||||
<!-- <view class="good">
|
|
||||||
<view class="item"></view>
|
|
||||||
</view> -->
|
|
||||||
<view class="good-class" v-if="class_list.length > 0">
|
<view class="good-class" v-if="class_list.length > 0">
|
||||||
<nut-tabs
|
<nut-tabs
|
||||||
v-model="value"
|
v-model="value"
|
||||||
@@ -56,43 +53,39 @@
|
|||||||
title-gutter="5"
|
title-gutter="5"
|
||||||
animated-time="0"
|
animated-time="0"
|
||||||
name="tabName"
|
name="tabName"
|
||||||
@click="clickTab"
|
|
||||||
>
|
>
|
||||||
<nut-tab-pane
|
<nut-tab-pane
|
||||||
v-for="(item, index) in class_list as any[]"
|
v-for="(itm, index) in good_list"
|
||||||
:key="index"
|
:key="index"
|
||||||
:title="item.name"
|
:title="itm.name"
|
||||||
:pane-key="index"
|
:pane-key="index"
|
||||||
>
|
>
|
||||||
<view v-if="good_list.length > 0">
|
<view v-if="itm.Goods.length > 0">
|
||||||
<view
|
<view class="list" v-for="(item, index) in itm.Goods" :key="index">
|
||||||
class="list"
|
<view class="item" @click.stop="toGoodDetails(item.gid, 1)">
|
||||||
v-for="(item, index) in good_list as any[]"
|
<image :src="item.cover" lazy-load />
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view class="item">
|
|
||||||
<img :src="item.cover" />
|
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="name">{{ item.name }}</view>
|
<view class="name">{{ item.name }}</view>
|
||||||
<view class="stock"> 库存剩余:{{ item.stock }} </view>
|
<view class="stock">剩余:{{ item.stock }}</view>
|
||||||
<view class="bom">
|
<view class="bom">
|
||||||
<view class="price">
|
<view>
|
||||||
<text style="font-size: 15px">{{ item.number }} </text>
|
<view class="price">
|
||||||
{{ mer_info.bType === 1 ? "元" : "积分" }}
|
<text style="font-size: 15px">{{ item.number }}元</text>
|
||||||
|
</view>
|
||||||
|
<view class="price">
|
||||||
|
<text style="font-size: 15px"
|
||||||
|
>{{ item.exchange }}积分</text
|
||||||
|
>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<nut-button
|
<nut-button
|
||||||
size="mini"
|
size="mini"
|
||||||
v-if="mer_info.bType === 1"
|
|
||||||
type="primary"
|
type="primary"
|
||||||
@click.stop="toGoodDetails(item.gid as number, 1)"
|
@click.stop="add_cart(item)"
|
||||||
>去购买
|
>
|
||||||
</nut-button>
|
<template #icon>
|
||||||
<nut-button
|
<Cart2 />
|
||||||
size="mini"
|
</template>
|
||||||
v-else
|
|
||||||
type="primary"
|
|
||||||
@click.stop="toGoodDetails(item.gid as number, 2)"
|
|
||||||
>去兑换
|
|
||||||
</nut-button>
|
</nut-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -100,19 +93,24 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<nut-empty v-else description="该分类暂无商品"></nut-empty>
|
<nut-empty v-else description="该分类暂无商品"></nut-empty>
|
||||||
|
<view style="height: 180rpx"></view>
|
||||||
</nut-tab-pane>
|
</nut-tab-pane>
|
||||||
</nut-tabs>
|
</nut-tabs>
|
||||||
</view>
|
</view>
|
||||||
<nut-empty v-else description="该商家暂无商品"></nut-empty>
|
<nut-empty v-else description="该商家暂无商品"></nut-empty>
|
||||||
|
<!-- 购物车 -->
|
||||||
|
<cart ref="cartRef" :mer-info="mer_info" @update-cart="updateCartNum" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { Find, Locationg3 } from "@nutui/icons-vue-taro";
|
import { Find, Locationg3 } from "@nutui/icons-vue-taro";
|
||||||
import { ref } from "vue";
|
import { Ref, ref } from "vue";
|
||||||
import { calculateDistance } from "@/utils";
|
import { calculateDistance } from "@/utils";
|
||||||
import { getGoodList, getMerCategory } from "@/api/goods";
|
import { getGoodList, getMerCategory } from "@/api/goods";
|
||||||
|
import Cart from "@/components/Cart.vue";
|
||||||
|
import { Cart2 } from "@nutui/icons-vue-taro";
|
||||||
|
|
||||||
const swiperList = ref([]);
|
const swiperList = ref([]);
|
||||||
|
|
||||||
@@ -125,7 +123,7 @@ const userLocalNum = ref({
|
|||||||
t: 0,
|
t: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
Taro.useLoad(() => {
|
Taro.useLoad(async () => {
|
||||||
Taro.getLocation({
|
Taro.getLocation({
|
||||||
type: "wgs84",
|
type: "wgs84",
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
@@ -138,7 +136,8 @@ Taro.useLoad(() => {
|
|||||||
title: mer_info.value.name,
|
title: mer_info.value.name,
|
||||||
});
|
});
|
||||||
swiperList.value = mer_info.value.img.split(",");
|
swiperList.value = mer_info.value.img.split(",");
|
||||||
get_class_list();
|
await get_class_list();
|
||||||
|
await cartRef.value.get_cart_list();
|
||||||
});
|
});
|
||||||
|
|
||||||
const clickPhone = () => {
|
const clickPhone = () => {
|
||||||
@@ -171,11 +170,38 @@ const get_class_list = async () => {
|
|||||||
await get_good_list(class_list.value[0].ID as number);
|
await get_good_list(class_list.value[0].ID as number);
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickTab = (val: any) => {
|
// const clickTab = (val: any) => {
|
||||||
get_good_list(class_list.value[val.paneKey].ID as number);
|
// get_good_list(class_list.value[val.paneKey].ID as number);
|
||||||
};
|
// };
|
||||||
|
|
||||||
const good_list = ref([]);
|
interface goodList {
|
||||||
|
ID: number;
|
||||||
|
name: string;
|
||||||
|
bid: string;
|
||||||
|
Goods: GoodsType[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GoodsType {
|
||||||
|
gid: string;
|
||||||
|
cover: string;
|
||||||
|
name: string;
|
||||||
|
number: number;
|
||||||
|
stock: number;
|
||||||
|
cartNum: number;
|
||||||
|
exchange: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CartItems {
|
||||||
|
bid: string;
|
||||||
|
gid: string;
|
||||||
|
number: number;
|
||||||
|
price: number;
|
||||||
|
cover: string;
|
||||||
|
name: string;
|
||||||
|
exchange: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const good_list = ref<goodList[]>([]);
|
||||||
const get_good_list = async (id: number) => {
|
const get_good_list = async (id: number) => {
|
||||||
Taro.showLoading({
|
Taro.showLoading({
|
||||||
title: "加载中",
|
title: "加载中",
|
||||||
@@ -183,8 +209,7 @@ const get_good_list = async (id: number) => {
|
|||||||
});
|
});
|
||||||
const res = await getGoodList({
|
const res = await getGoodList({
|
||||||
bid: mer_info.value.bid,
|
bid: mer_info.value.bid,
|
||||||
BType: mer_info.value.bType,
|
goods_class_id: id,
|
||||||
class_id: id,
|
|
||||||
status: 1,
|
status: 1,
|
||||||
state: 1,
|
state: 1,
|
||||||
});
|
});
|
||||||
@@ -192,14 +217,47 @@ const get_good_list = async (id: number) => {
|
|||||||
Taro.hideLoading();
|
Taro.hideLoading();
|
||||||
};
|
};
|
||||||
|
|
||||||
const toGoodDetails = (id: number, type: number) => {
|
const toGoodDetails = (id: string, type: number) => {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/goods/goods_detail/index?gid=${id}&type=${type}`,
|
url: `/pages/goods/goods_detail/index?gid=${id}&type=${type}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cartRef = ref(null) as Ref;
|
||||||
|
|
||||||
|
const add_cart = (item: GoodsType) => {
|
||||||
|
const num = item.cartNum ? Number(item.cartNum) + 1 : 1;
|
||||||
|
cartRef.value.add_cart(item, num);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateCartNum = (cartItems: CartItems[]) => {
|
||||||
|
if (cartItems.length > 0) {
|
||||||
|
good_list.value.forEach((category: goodList) => {
|
||||||
|
category.Goods.forEach((good: GoodsType) => {
|
||||||
|
cartItems.forEach((cartItem: CartItems) => {
|
||||||
|
if (good.gid === cartItem.gid) {
|
||||||
|
good.cartNum = cartItem.number;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
good_list.value.forEach((category: goodList) => {
|
||||||
|
category.Goods.forEach((good: GoodsType) => {
|
||||||
|
Reflect.deleteProperty(good, "cartNum");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
// IOS安全区域
|
||||||
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
}
|
||||||
|
|
||||||
.nut-swiper {
|
.nut-swiper {
|
||||||
height: 350px;
|
height: 350px;
|
||||||
}
|
}
|
||||||
@@ -250,9 +308,9 @@ const toGoodDetails = (id: number, type: number) => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
img {
|
image {
|
||||||
width: 140px;
|
width: 180px;
|
||||||
height: 150px;
|
height: 180px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
src/pages/search/index.config.ts
Normal file
3
src/pages/search/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
enableShareAppMessage: true,
|
||||||
|
});
|
||||||
23
src/pages/search/index.vue
Normal file
23
src/pages/search/index.vue
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import Taro from "@tarojs/taro";
|
||||||
|
import MerList from "@/components/MerList.vue";
|
||||||
|
|
||||||
|
const classId = ref<null | number>(null);
|
||||||
|
|
||||||
|
Taro.useLoad((e) => {
|
||||||
|
console.log(e);
|
||||||
|
Taro.setNavigationBarTitle({
|
||||||
|
title: e.name,
|
||||||
|
});
|
||||||
|
classId.value = Number(e.id);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<MerList :classId="classId" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss"></style>
|
||||||
@@ -7,16 +7,16 @@
|
|||||||
>
|
>
|
||||||
<view class="user-center-card__header__avatar">
|
<view class="user-center-card__header__avatar">
|
||||||
<nut-avatar size="large">
|
<nut-avatar size="large">
|
||||||
<img :src="userInfo.avatarUrl" />
|
<img :src="userInfo.data?.avatarUrl" />
|
||||||
</nut-avatar>
|
</nut-avatar>
|
||||||
</view>
|
</view>
|
||||||
<view class="user-center-card__header__info">
|
<view class="user-center-card__header__info">
|
||||||
<view
|
<view
|
||||||
class="user-center-card__header__info__name"
|
class="user-center-card__header__info__name"
|
||||||
@click="toPage('/pages/users/user_setting/index')"
|
@click="toPage('/pages/users/user_setting/index')"
|
||||||
>{{ userInfo.nickName }}
|
>{{ userInfo.data?.nickName }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!userInfo.phone">
|
<view v-if="!userInfo.data?.phone">
|
||||||
<nut-button
|
<nut-button
|
||||||
size="mini"
|
size="mini"
|
||||||
open-type="getPhoneNumber"
|
open-type="getPhoneNumber"
|
||||||
@@ -118,7 +118,10 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 商家管理 -->
|
<!-- 商家管理 -->
|
||||||
<view class="mer-box" v-if="userInfo.bid">
|
<view
|
||||||
|
class="mer-box"
|
||||||
|
v-if="userInfo.data?.bid && userInfo.store_status === 1"
|
||||||
|
>
|
||||||
<nut-grid :gutter="10" :border="false">
|
<nut-grid :gutter="10" :border="false">
|
||||||
<nut-grid-item
|
<nut-grid-item
|
||||||
:border="false"
|
:border="false"
|
||||||
@@ -184,12 +187,16 @@ const isShowLogin = ref(false);
|
|||||||
const isLogin = ref(false);
|
const isLogin = ref(false);
|
||||||
|
|
||||||
interface UserInfo {
|
interface UserInfo {
|
||||||
nickName?: string;
|
data?: {
|
||||||
avatarUrl?: string;
|
nickName?: string;
|
||||||
ID?: string;
|
avatarUrl?: string;
|
||||||
bid?: string;
|
ID?: string;
|
||||||
phone?: string;
|
bid?: string;
|
||||||
uid?: string;
|
phone?: string;
|
||||||
|
uid?: string;
|
||||||
|
};
|
||||||
|
store_status?: number;
|
||||||
|
store_name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const userInfo = ref<UserInfo>({});
|
const userInfo = ref<UserInfo>({});
|
||||||
@@ -210,9 +217,8 @@ const getUserInfo = async () => {
|
|||||||
title: "加载中",
|
title: "加载中",
|
||||||
});
|
});
|
||||||
const res = await getPersonalInfo();
|
const res = await getPersonalInfo();
|
||||||
userInfo.value = res.data.data;
|
userInfo.value = res.data;
|
||||||
Taro.setStorageSync("userInfo", res.data.data);
|
Taro.setStorageSync("userInfo", res.data);
|
||||||
Taro.setStorageSync("mer_type", res.data.store_type);
|
|
||||||
isLogin.value = true;
|
isLogin.value = true;
|
||||||
cancelLogin();
|
cancelLogin();
|
||||||
Taro.hideLoading();
|
Taro.hideLoading();
|
||||||
@@ -220,7 +226,7 @@ const getUserInfo = async () => {
|
|||||||
|
|
||||||
const getphonenumber = async (e: any) => {
|
const getphonenumber = async (e: any) => {
|
||||||
await getPhone({
|
await getPhone({
|
||||||
uid: userInfo.value.uid,
|
uid: userInfo.value.data?.uid,
|
||||||
code: e.detail.code,
|
code: e.detail.code,
|
||||||
});
|
});
|
||||||
await getUserInfo();
|
await getUserInfo();
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { showToast, useLoad, getStorageSync } from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user";
|
import { getIntegralDetail, getBeanDetail, getGiftRecord } from "@/api/user";
|
||||||
|
|
||||||
|
// Taro.setStorageSync("token", "ok_OL66Ej4_lkQKNA0AwxnGwGyXo");
|
||||||
|
|
||||||
const tabValue = ref(1);
|
const tabValue = ref(1);
|
||||||
|
|
||||||
const tabsList = ref([
|
const tabsList = ref([
|
||||||
@@ -44,13 +46,22 @@ const tabChange = (index: number) => {
|
|||||||
page.value.PageNum = 1;
|
page.value.PageNum = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const data = ref<any>([]);
|
interface DataType {
|
||||||
|
goods_name: string;
|
||||||
|
add_time: string;
|
||||||
|
number: number;
|
||||||
|
order_number: number;
|
||||||
|
type: number;
|
||||||
|
oid: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = ref<DataType[]>([]);
|
||||||
|
|
||||||
const userInfo = ref<any>({});
|
const userInfo = ref<any>({});
|
||||||
|
|
||||||
useLoad(() => {
|
Taro.useLoad(() => {
|
||||||
getList();
|
getList();
|
||||||
userInfo.value = getStorageSync("userInfo");
|
userInfo.value = Taro.getStorageSync("userInfo");
|
||||||
});
|
});
|
||||||
|
|
||||||
const page = ref({
|
const page = ref({
|
||||||
@@ -84,7 +95,7 @@ const getList = async () => {
|
|||||||
data.value = res.data.data || [];
|
data.value = res.data.data || [];
|
||||||
page.value.ItemCount = res.data.count;
|
page.value.ItemCount = res.data.count;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showToast({
|
Taro.showToast({
|
||||||
title: error.msg,
|
title: error.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
@@ -95,14 +106,14 @@ const getList = async () => {
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="card">
|
<view class="card">
|
||||||
<!-- <view class="greeting">Hello! YuanHuakk</view> -->
|
<!-- <view class="greeting">Hello! YuanHuakk</view>-->
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view>
|
<view>
|
||||||
<view class="num">豆子: {{ userInfo.pulse }}</view>
|
<view class="num">豆子: {{ userInfo.data?.pulse }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="num">积分: {{ userInfo.integral }}</view>
|
<view class="num">积分: {{ userInfo.data?.integral }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
|
<!-- <image class="img" src="https://picdm.sunbangyan.cn/2023/08/15/ste192.png"/> -->
|
||||||
@@ -123,13 +134,9 @@ const getList = async () => {
|
|||||||
</view>
|
</view>
|
||||||
<view v-if="data.length > 0">
|
<view v-if="data.length > 0">
|
||||||
<view v-if="tabValue === 1 || tabValue === 3">
|
<view v-if="tabValue === 1 || tabValue === 3">
|
||||||
<view
|
<view class="card-list" v-for="(item, index) in data" :key="index">
|
||||||
class="card-list"
|
|
||||||
v-for="(item, index) in (data as any[])"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view>商品:{{ item.goods_name }}</view>
|
<view>订单:{{ item.oid }}</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">
|
||||||
@@ -139,38 +146,29 @@ const getList = async () => {
|
|||||||
</view>
|
</view>
|
||||||
<view v-if="tabValue === 3" style="color: red"
|
<view v-if="tabValue === 3" style="color: red"
|
||||||
>+
|
>+
|
||||||
<text>{{ item.number }} </text>
|
<text>{{ item.number }}</text>
|
||||||
积分
|
积分
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="tabValue === 2">
|
<view v-else-if="tabValue === 2">
|
||||||
<view
|
<view class="card-list" v-for="(item, index) in data" :key="index">
|
||||||
class="card-list"
|
|
||||||
v-for="(item, index) in (data as any[])"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="text">商品:{{ item.goods_name }}</view>
|
<view class="text">订单:{{ item.oid }}</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"
|
||||||
>+
|
>+
|
||||||
<text>{{ item.number }} </text>
|
<text>{{ item.number }}</text>
|
||||||
豆子
|
豆子
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-else-if="tabValue === 4">
|
<view v-else-if="tabValue === 4">
|
||||||
<view
|
<view class="card-list" v-for="(item, index) in data" :key="index">
|
||||||
class="card-list"
|
|
||||||
v-for="(item, index) in (data as any[])"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view class="text">类型:{{ computerType(item.type) }}</view>
|
<view class="text">类型:{{ computerType(item.type) }}</view>
|
||||||
<view>时间:{{ item.add_time.slice(0, 10) }}</view>
|
<view>时间:{{ item.add_time.slice(0, 10) }}</view>
|
||||||
@@ -178,7 +176,7 @@ const getList = async () => {
|
|||||||
<view class="right">
|
<view class="right">
|
||||||
<view style="color: red"
|
<view style="color: red"
|
||||||
>+
|
>+
|
||||||
<text>{{ item.number }} </text>
|
<text>{{ item.number }}</text>
|
||||||
豆子
|
豆子
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import {
|
import Taro from "@tarojs/taro";
|
||||||
useLoad,
|
|
||||||
useReachBottom,
|
|
||||||
showToast,
|
|
||||||
navigateTo,
|
|
||||||
setStorageSync,
|
|
||||||
useDidShow,
|
|
||||||
} from "@tarojs/taro";
|
|
||||||
import Pay from "@/components/Pay.vue";
|
import Pay from "@/components/Pay.vue";
|
||||||
import { getIntegralOrderList } from "@/api/user";
|
import { getActiveOrderList, deleteActiveOrder } from "@/api/goods";
|
||||||
import { deleteJfOrder } from "@/api/goods";
|
|
||||||
import { getOrderStatistics } from "@/api/order";
|
import { getOrderStatistics } from "@/api/order";
|
||||||
|
|
||||||
const tabValue = ref(0);
|
const tabValue = ref(0);
|
||||||
@@ -51,40 +43,50 @@ interface OrderList {
|
|||||||
oid: string;
|
oid: string;
|
||||||
add_time: string;
|
add_time: string;
|
||||||
status: number;
|
status: number;
|
||||||
BindGoods: {
|
OrderGoods: GoodsItem[];
|
||||||
cover: string;
|
|
||||||
name: string;
|
|
||||||
number: number;
|
|
||||||
};
|
|
||||||
count: number;
|
count: number;
|
||||||
number: number;
|
number: number;
|
||||||
|
pay_type: number;
|
||||||
|
exchange: number;
|
||||||
|
price: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GoodsItem {
|
||||||
|
Goods: {
|
||||||
|
name: string;
|
||||||
|
cover: string;
|
||||||
|
};
|
||||||
|
ID: number;
|
||||||
|
gid: string;
|
||||||
|
number: number;
|
||||||
|
oid: string;
|
||||||
|
pay_integral: number;
|
||||||
|
pay_price: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const orderList = ref<OrderList[]>([]);
|
const orderList = ref<OrderList[]>([]);
|
||||||
|
|
||||||
useLoad((options) => {
|
Taro.useLoad((options) => {
|
||||||
tabValue.value = Number(options.type);
|
tabValue.value = Number(options.type);
|
||||||
});
|
});
|
||||||
|
|
||||||
useDidShow(() => {
|
Taro.useDidShow(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getIntegralOrderList({
|
const res = await getActiveOrderList({
|
||||||
status: tabValue.value,
|
status: tabValue.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(res);
|
|
||||||
orderList.value = res.data.data;
|
orderList.value = res.data.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showToast({
|
Taro.showToast({
|
||||||
title: error.msg,
|
title: error.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getTj();
|
await getTj();
|
||||||
};
|
};
|
||||||
|
|
||||||
const tabChange = (index: number) => {
|
const tabChange = (index: number) => {
|
||||||
@@ -92,18 +94,18 @@ const tabChange = (index: number) => {
|
|||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
useReachBottom(() => {
|
Taro.useReachBottom(() => {
|
||||||
console.log("useReachBottom");
|
console.log("useReachBottom");
|
||||||
});
|
});
|
||||||
|
|
||||||
const openPay = (item: OrderList) => {
|
const openPay = (item: OrderList) => {
|
||||||
isShowPay.value = true;
|
isShowPay.value = true;
|
||||||
jfInfo.value = [item];
|
jfInfo.value = item.oid;
|
||||||
};
|
};
|
||||||
|
|
||||||
const errPay = () => {
|
const errPay = () => {
|
||||||
isShowPay.value = false;
|
isShowPay.value = false;
|
||||||
showToast({
|
Taro.showToast({
|
||||||
title: "支付失败",
|
title: "支付失败",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
@@ -112,7 +114,7 @@ const errPay = () => {
|
|||||||
};
|
};
|
||||||
const closePay = () => {
|
const closePay = () => {
|
||||||
isShowPay.value = false;
|
isShowPay.value = false;
|
||||||
showToast({
|
Taro.showToast({
|
||||||
title: "支付取消",
|
title: "支付取消",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
@@ -121,26 +123,32 @@ const closePay = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toDetail = (item: any) => {
|
const toDetail = (item: any) => {
|
||||||
setStorageSync("item", item);
|
Taro.setStorageSync("item", item);
|
||||||
navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
|
url: `/pages/users/order_list_detail/index?orderId=${item.oid}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const delOrder = async (oid: string) => {
|
const delOrder = async (oid: string) => {
|
||||||
try {
|
try {
|
||||||
const res = await deleteJfOrder({ oid });
|
await deleteActiveOrder({ oid });
|
||||||
console.log(res);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showToast({
|
Taro.showToast({
|
||||||
title: error.msg,
|
title: error.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getList();
|
await getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
const countInfo = ref<any>({});
|
const countInfo = ref<{
|
||||||
|
A?: number;
|
||||||
|
B?: number;
|
||||||
|
C?: number;
|
||||||
|
D?: number;
|
||||||
|
F?: number;
|
||||||
|
Total?: number;
|
||||||
|
}>({});
|
||||||
|
|
||||||
const getTj = async () => {
|
const getTj = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -154,7 +162,7 @@ const getTj = async () => {
|
|||||||
tabsList.value[3].num = countInfo.value.D || 0;
|
tabsList.value[3].num = countInfo.value.D || 0;
|
||||||
tabsList.value[4].num = countInfo.value.F || 0;
|
tabsList.value[4].num = countInfo.value.F || 0;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
showToast({
|
Taro.showToast({
|
||||||
title: error.msg,
|
title: error.msg,
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
@@ -191,35 +199,40 @@ const getTj = async () => {
|
|||||||
<view class="order-card" v-for="(item, index) in orderList" :key="index">
|
<view class="order-card" v-for="(item, index) in orderList" :key="index">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view>{{ item.add_time.slice(0, 19) }}</view>
|
<view>{{ item.add_time.slice(0, 19) }}</view>
|
||||||
<view style="color: red">{{
|
<view style="color: red"
|
||||||
item.status === 0
|
>{{
|
||||||
? "待付款"
|
item.status === 0
|
||||||
: item.status === 1
|
? "待付款"
|
||||||
? "待使用"
|
: item.status === 1
|
||||||
: item.status === 2
|
? "待使用"
|
||||||
? "已使用"
|
: item.status === 2
|
||||||
: "已失效"
|
? "已使用"
|
||||||
}}</view>
|
: "已失效"
|
||||||
|
}}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="center">
|
<view class="center" v-for="(itm, idx) in item.OrderGoods" :key="idx">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image :src="item.BindGoods.cover" />
|
<image :src="itm.Goods.cover" />
|
||||||
<view class="title">{{ item.BindGoods?.name }} </view>
|
<view class="title">{{ itm.Goods?.name }}</view>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view>{{ item.BindGoods?.number }}</view>
|
<view>{{ itm.pay_price }}元</view>
|
||||||
<view>x{{ item?.count }}</view>
|
<view>{{ itm.pay_integral }}积分</view>
|
||||||
|
<view>x{{ itm.number }}</view>
|
||||||
</view>
|
</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>
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
|
<view v-if="item.status !== 0" style="text-align: right">
|
||||||
|
<text>共{{ item.count }}件商品</text>,
|
||||||
|
<text
|
||||||
|
>实付款:{{ item.pay_type === 1 ? item.price : item.exchange }},{{
|
||||||
|
item.pay_type === 1 ? "微信支付" : "积分支付"
|
||||||
|
}}</text
|
||||||
|
>
|
||||||
|
<view class="line"></view>
|
||||||
|
</view>
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<nut-button
|
<nut-button
|
||||||
v-if="item.status === 0"
|
v-if="item.status === 0"
|
||||||
@@ -250,15 +263,22 @@ const getTj = async () => {
|
|||||||
<nut-empty v-else description="暂无订单"></nut-empty>
|
<nut-empty v-else description="暂无订单"></nut-empty>
|
||||||
<pay
|
<pay
|
||||||
:isShowPay="isShowPay"
|
:isShowPay="isShowPay"
|
||||||
payType="jf"
|
:interval="false"
|
||||||
|
:jfInfo="jfInfo"
|
||||||
|
:OrderType="2"
|
||||||
@errPay="errPay"
|
@errPay="errPay"
|
||||||
@closePay="closePay"
|
@closePay="closePay"
|
||||||
:jfInfo="jfInfo"
|
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
// IOS安全区域
|
||||||
|
padding-bottom: constant(safe-area-inset-bottom);
|
||||||
|
padding-bottom: env(safe-area-inset-bottom);
|
||||||
|
}
|
||||||
|
|
||||||
.topTips {
|
.topTips {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -331,14 +351,16 @@ const getTj = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.center {
|
.center {
|
||||||
|
margin-bottom: 10px;
|
||||||
.top {
|
.top {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
// align-items: flex-start;
|
// align-items: flex-start;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 150px;
|
width: 150rpx;
|
||||||
height: 150px;
|
height: 150rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
|
|||||||
@@ -19,12 +19,12 @@
|
|||||||
<view class="mer-info">
|
<view class="mer-info">
|
||||||
<view class="left">
|
<view class="left">
|
||||||
<view>
|
<view>
|
||||||
<text>{{ goodInfo.BindStore?.name }}</text>
|
<text>{{ goodInfo.Store?.name }}</text>
|
||||||
<text>{{ goodInfo.BindStore?.phone }}</text>
|
<text>{{ goodInfo.Store?.phone }}</text>
|
||||||
</view>
|
</view>
|
||||||
<nut-ellipsis
|
<nut-ellipsis
|
||||||
:rows="2"
|
:rows="2"
|
||||||
:content="goodInfo.BindStore?.address"
|
:content="goodInfo.Store?.address"
|
||||||
direction="end"
|
direction="end"
|
||||||
></nut-ellipsis>
|
></nut-ellipsis>
|
||||||
</view>
|
</view>
|
||||||
@@ -45,12 +45,19 @@
|
|||||||
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
|
<nut-cell :title="`共${goodInfo.count}件商品`"></nut-cell>
|
||||||
<nut-cell>
|
<nut-cell>
|
||||||
<template #default>
|
<template #default>
|
||||||
<view class="top">
|
<view class="center-box">
|
||||||
<image :src="goodInfo.BindGoods?.cover" />
|
<view
|
||||||
<view class="title">{{ goodInfo.BindGoods?.name }} </view>
|
class="top"
|
||||||
<view class="right">
|
v-for="(item, index) in goodInfo.OrderGoods"
|
||||||
<view>{{ goodInfo.BindGoods?.number }}</view>
|
:key="index"
|
||||||
<view>x{{ goodInfo.count }}</view>
|
>
|
||||||
|
<image :src="item.Goods?.cover" />
|
||||||
|
<view class="title">{{ item.Goods?.name }} </view>
|
||||||
|
<view class="right">
|
||||||
|
<view>{{ item.pay_price }}元</view>
|
||||||
|
<view>{{ item.pay_integral }}积分</view>
|
||||||
|
<view>x{{ item.number }}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -77,19 +84,20 @@
|
|||||||
: '已失效'
|
: '已失效'
|
||||||
"
|
"
|
||||||
></nut-cell>
|
></nut-cell>
|
||||||
<nut-cell
|
<!-- <nut-cell
|
||||||
:title="`商品总价(${type === '1' ? '元' : '积分'}):`"
|
:title="`商品总价(${type === '1' ? '元' : '积分'}):`"
|
||||||
:desc="goodInfo.number"
|
:desc="goodInfo.number"
|
||||||
></nut-cell>
|
>
|
||||||
<nut-cell>
|
</nut-cell> -->
|
||||||
|
<nut-cell v-if="goodInfo.status !== 0">
|
||||||
<template #default>
|
<template #default>
|
||||||
<view style="text-align: right; width: 100%">
|
<view style="text-align: right; width: 100%">
|
||||||
<view
|
<view
|
||||||
>{{ goodInfo.status === 0 ? "应付款" : "实付款" }}({{
|
>实付款({{ goodInfo.pay_type === 1 ? "微信" : "积分" }})
|
||||||
type === "1" ? "元" : "积分"
|
|
||||||
}}):
|
|
||||||
<nut-price
|
<nut-price
|
||||||
:price="goodInfo.number"
|
:price="
|
||||||
|
goodInfo.pay_type === 1 ? goodInfo.price : goodInfo.exchange
|
||||||
|
"
|
||||||
size="normal"
|
size="normal"
|
||||||
:need-symbol="false"
|
:need-symbol="false"
|
||||||
/>
|
/>
|
||||||
@@ -140,10 +148,11 @@
|
|||||||
</nut-popup>
|
</nut-popup>
|
||||||
<pay
|
<pay
|
||||||
:isShowPay="isShowPay"
|
:isShowPay="isShowPay"
|
||||||
:payType="type === '1' ? 'wx' : 'jf'"
|
:interval="false"
|
||||||
|
:jfInfo="jfInfo"
|
||||||
|
:OrderType="2"
|
||||||
@errPay="errPay"
|
@errPay="errPay"
|
||||||
@closePay="closePay"
|
@closePay="closePay"
|
||||||
:jfInfo="jfInfo"
|
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -197,14 +206,14 @@ Taro.useLoad((options) => {
|
|||||||
|
|
||||||
const toPhone = () => {
|
const toPhone = () => {
|
||||||
Taro.makePhoneCall({
|
Taro.makePhoneCall({
|
||||||
phoneNumber: goodInfo.value.BindStore.mobile,
|
phoneNumber: goodInfo.value.Store.mobile,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const toAdder = () => {
|
const toAdder = () => {
|
||||||
Taro.openLocation({
|
Taro.openLocation({
|
||||||
latitude: Number(goodInfo.value.BindStore.lat),
|
latitude: Number(goodInfo.value.Store.lat),
|
||||||
longitude: Number(goodInfo.value.BindStore.lon),
|
longitude: Number(goodInfo.value.Store.lon),
|
||||||
scale: 18,
|
scale: 18,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -214,6 +223,17 @@ const openPay = () => {
|
|||||||
jfInfo.value = Taro.getStorageSync("item");
|
jfInfo.value = Taro.getStorageSync("item");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const successPay = (val: boolean) => {
|
||||||
|
isShowPay.value = val;
|
||||||
|
Taro.showToast({
|
||||||
|
title: "支付成功",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
Taro.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const errPay = () => {
|
const errPay = () => {
|
||||||
isShowPay.value = false;
|
isShowPay.value = false;
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
@@ -270,6 +290,7 @@ Taro.useUnload(() => {
|
|||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
|
--nut-cell-desc-color: #999;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
@@ -387,31 +408,39 @@ page {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top {
|
.center-box {
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
flex-direction: column;
|
||||||
align-items: center;
|
width: 100%;
|
||||||
|
|
||||||
image {
|
.top {
|
||||||
width: 150px;
|
width: 100%;
|
||||||
height: 150px;
|
display: flex;
|
||||||
}
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
|
||||||
.title {
|
image {
|
||||||
margin-left: 10px;
|
width: 150px;
|
||||||
display: -webkit-box;
|
height: 150px;
|
||||||
overflow: hidden;
|
border-radius: 10rpx;
|
||||||
-webkit-line-clamp: 2;
|
}
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
width: 350px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right {
|
.title {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
font-size: 28px;
|
display: -webkit-box;
|
||||||
text-align: right;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import Upload from "@/components/Upload.vue";
|
|||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
|
|
||||||
const merType = ref(false);
|
|
||||||
|
|
||||||
const merGooType = ref(false);
|
const merGooType = ref(false);
|
||||||
|
|
||||||
// 验证码按钮文字
|
// 验证码按钮文字
|
||||||
@@ -17,13 +15,30 @@ const smsStr = ref("获取验证码");
|
|||||||
const smsDisabled = ref(false);
|
const smsDisabled = ref(false);
|
||||||
|
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formValue = ref<any>({
|
const formValue = ref<{
|
||||||
|
name: string;
|
||||||
|
userName: string;
|
||||||
|
phone: string;
|
||||||
|
mobile: string;
|
||||||
|
code: string;
|
||||||
|
classId: string;
|
||||||
|
merGooTypeStr: string;
|
||||||
|
license: any[];
|
||||||
|
front: any[];
|
||||||
|
back: any[];
|
||||||
|
head_photo: any[];
|
||||||
|
img: any[];
|
||||||
|
bank: string;
|
||||||
|
bank_card: string;
|
||||||
|
bank_name: string;
|
||||||
|
bank_user: string;
|
||||||
|
address: string;
|
||||||
|
}>({
|
||||||
name: "",
|
name: "",
|
||||||
userName: "",
|
userName: "",
|
||||||
phone: "",
|
phone: "",
|
||||||
|
mobile: "",
|
||||||
code: "",
|
code: "",
|
||||||
bType: "",
|
|
||||||
merTypeStr: "",
|
|
||||||
classId: "",
|
classId: "",
|
||||||
merGooTypeStr: "",
|
merGooTypeStr: "",
|
||||||
license: [],
|
license: [],
|
||||||
@@ -40,8 +55,6 @@ const formValue = ref<any>({
|
|||||||
|
|
||||||
const merGooList = ref([]);
|
const merGooList = ref([]);
|
||||||
|
|
||||||
const merList = ref([]);
|
|
||||||
|
|
||||||
// 表单校验
|
// 表单校验
|
||||||
const ruleForm = ref<any>(null);
|
const ruleForm = ref<any>(null);
|
||||||
|
|
||||||
@@ -53,19 +66,10 @@ Taro.useLoad(() => {
|
|||||||
const getMerType = async () => {
|
const getMerType = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getMerTypeList();
|
const res = await getMerTypeList();
|
||||||
console.log(res);
|
merGooList.value = res.data.class.map((item: any) => ({
|
||||||
merList.value = res.data.type.map((item: any) => {
|
text: item.name,
|
||||||
return {
|
value: item.ID,
|
||||||
text: item.name,
|
}));
|
||||||
value: item.ID,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
merGooList.value = res.data.class.map((item: any) => {
|
|
||||||
return {
|
|
||||||
text: item.name,
|
|
||||||
value: item.ID,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: e.msg,
|
title: e.msg,
|
||||||
@@ -139,13 +143,6 @@ const getSmsCode = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 选择商户类型
|
|
||||||
const confirmMerType = (e: any) => {
|
|
||||||
formValue.value.merTypeStr = e.selectedOptions[0].text;
|
|
||||||
formValue.value.bType = e.selectedOptions[0].value;
|
|
||||||
merType.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 选择经营类目
|
// 选择经营类目
|
||||||
const confirmGooType = (e: any) => {
|
const confirmGooType = (e: any) => {
|
||||||
formValue.value.merGooTypeStr = e.selectedOptions[0].text;
|
formValue.value.merGooTypeStr = e.selectedOptions[0].text;
|
||||||
@@ -357,33 +354,6 @@ const submit = () => {
|
|||||||
placeholder="请输入银行卡号"
|
placeholder="请输入银行卡号"
|
||||||
/>
|
/>
|
||||||
</nut-form-item>
|
</nut-form-item>
|
||||||
<nut-form-item
|
|
||||||
required
|
|
||||||
label="商户类型"
|
|
||||||
prop="merTypeStr"
|
|
||||||
:rules="[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
message: '请选择商户类型',
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
:disabled="true"
|
|
||||||
v-model="formValue.merTypeStr"
|
|
||||||
placeholder="请选择商户类型"
|
|
||||||
@click="merType = true"
|
|
||||||
/>
|
|
||||||
<nut-popup position="bottom" v-model:visible="merType">
|
|
||||||
<nut-picker
|
|
||||||
:columns="merList"
|
|
||||||
title="商户类型"
|
|
||||||
@confirm="confirmMerType"
|
|
||||||
@cancel="merType = false"
|
|
||||||
></nut-picker>
|
|
||||||
</nut-popup>
|
|
||||||
</nut-form-item>
|
|
||||||
<nut-form-item
|
<nut-form-item
|
||||||
required
|
required
|
||||||
label="经营类目"
|
label="经营类目"
|
||||||
@@ -402,9 +372,14 @@ const submit = () => {
|
|||||||
placeholder="请选择经营类目"
|
placeholder="请选择经营类目"
|
||||||
@click="merGooType = true"
|
@click="merGooType = true"
|
||||||
/>
|
/>
|
||||||
<nut-popup position="bottom" v-model:visible="merGooType">
|
<nut-popup
|
||||||
|
position="bottom"
|
||||||
|
v-model:visible="merGooType"
|
||||||
|
:safe-area-inset-bottom="true"
|
||||||
|
:catch-move="true"
|
||||||
|
>
|
||||||
<nut-picker
|
<nut-picker
|
||||||
:columns="merGooList"
|
v-model:columns="merGooList"
|
||||||
title="商户类型"
|
title="商户类型"
|
||||||
@confirm="confirmGooType"
|
@confirm="confirmGooType"
|
||||||
@cancel="merGooType = false"
|
@cancel="merGooType = false"
|
||||||
@@ -494,8 +469,8 @@ const submit = () => {
|
|||||||
|
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<nut-button block type="primary" round @click="submit()"
|
<nut-button block type="primary" round @click="submit()"
|
||||||
>提交</nut-button
|
>提交
|
||||||
>
|
</nut-button>
|
||||||
</view>
|
</view>
|
||||||
</nut-form>
|
</nut-form>
|
||||||
<!-- 入驻协议弹窗 -->
|
<!-- 入驻协议弹窗 -->
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<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 { getPersonalInfo, editPersonalInfo, getPhone } from "@/api/user";
|
import { getPersonalInfo, editPersonalInfo } from "@/api/user";
|
||||||
import { View } from "@tarojs/components";
|
import { View } from "@tarojs/components";
|
||||||
import { BASE_URL } from "@/utils/request";
|
import { BASE_URL } from "@/utils/request";
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ import { BASE_URL } from "@/utils/request";
|
|||||||
const userInfo = ref<any>({});
|
const userInfo = ref<any>({});
|
||||||
|
|
||||||
Taro.useLoad(() => {
|
Taro.useLoad(() => {
|
||||||
const data = Taro.getStorageSync("userInfo");
|
const { data: data } = Taro.getStorageSync("userInfo");
|
||||||
userInfo.value = data;
|
userInfo.value = data;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -72,17 +72,17 @@ const subUser = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUserInfo = async () => {
|
// const getUserInfo = async () => {
|
||||||
try {
|
// try {
|
||||||
const res = await getPersonalInfo();
|
// const res = await getPersonalInfo();
|
||||||
userInfo.value = res.data.data;
|
// userInfo.value = res.data.data;
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
Taro.showToast({
|
// Taro.showToast({
|
||||||
title: error.msg,
|
// title: error.msg,
|
||||||
icon: "none",
|
// icon: "none",
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -31,16 +31,12 @@ const request = (
|
|||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
reject(data);
|
reject(data);
|
||||||
return;
|
} else {
|
||||||
|
resolve(data);
|
||||||
}
|
}
|
||||||
resolve(data);
|
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: (err) => {
|
||||||
Taro.showToast({
|
reject(err);
|
||||||
title: "服务器异常",
|
|
||||||
icon: "none",
|
|
||||||
});
|
|
||||||
reject({ code: 1, msg: "服务器异常" });
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,11 +19,10 @@
|
|||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"typeRoots": ["node_modules/@types"],
|
"typeRoots": ["node_modules/@types"],
|
||||||
"types": ["@tarojs/components/vue3", "node"],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"]
|
"@/*": ["src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["./src", "./types", "components.d.ts"],
|
"include": ["./src", "./types", "./config"],
|
||||||
"compileOnSave": false
|
"compileOnSave": false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user